Re: [fpc-pascal] mciSendString with long file names

2022-09-20 Thread Alexander Grotewohl via fpc-pascal
I've only ever done this like:

pcmd: string;

pcmd:='open "'+filename+'" ... '+#0;

mciSendString(@pcmd[1], ...);

mciSendString does return errors.. duno if that'll be helpful.

I originally used it in Virtual Pascal and had to make a partial header myself 
so the FreePascal one might take parameters differently.

From: fpc-pascal  on behalf of James 
Richters via fpc-pascal 
Sent: Tuesday, September 20, 2022 9:56:03 AM
To: 'FPC-Pascal users discussions' 
Cc: James Richters 
Subject: [fpc-pascal] mciSendString with long file names


I’m trying to get mciSendString() to work with long file names with spaces in 
them and I’m not having any success.

I know with winnows you need quotes around long file names, so I’m trying 
things like this:



Var MySoundFile:String;

mciSendString(PChar('play '+Ansistring(#34+MySoundFile+#34)),Nil,0,0);



But still it works if my file name has no spaces, but does not work if there 
are spaces.

I think maybe it’s my conversion to a PChar, but it works as long as there are 
no spaces, so I don’t know.



The name of my file is in a string because it comes from a record with a string 
variable in it.. part of another whole system that I don’t want to change just 
to get this to work.



Any one have any ideas how to get long file names with spaces to work?



James
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Text Only printing on Windows.

2022-02-09 Thread Alexander Grotewohl via fpc-pascal
Is this for a Dymo style printer?

The easiest way you might do this nowadays is using the Windows API.. I'm sorry 
for the sort of pseudo-code but I'm stuck with examples my previous work owns 
so I have to paraphrase a bit:

GetDefaultPrinter (so you don't have to enumerate and then find the right one, 
set the label printer to default)
CreateDC (we want something to draw our text to)

StartDoc(dc, @di); (our initial 'print')
StartPage(dc); (this in our case would be each label)

Some sample stuff to create a font you can use:

fillchar(lf, sizeof(lf), 0);
lf.lfWeight:=FW_NORMAL;
lf.lfHeight:=-MulDiv(12, GetDeviceCaps(dc, LOGPIXELSY), 72);
newfont:=CreateFontIndirect(@lf);
oldfont:=GetCurrentObject(dc, OBJ_FONT);
SelectObject(dc, newfont);

A little helper function.. not amazing but gets text mostly where you'd want it 
at column/row
procedure printxy(dc: HDC; x, y: byte; s: string);
begin
TextOut(dc, x*50, y*110, @s[1], length(s));
end;

EndPage(dc); (in our case end this label)
EndDoc(dc); (end the print job)

SelectObject(dc, oldfont); (cleanup)
DeleteObject(newfont);
DeleteDC(dc);

It'll take a bit of effort to read up on those functions and get them working 
right, but afterward you should have printing sorted for yourself as long as 
the windows api is supported.

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of James 
Richters via fpc-pascal 
Sent: Wednesday, February 9, 2022 1:17 PM
To: 'FPC-Pascal users discussions' 
Cc: James Richters 
Subject: [fpc-pascal] Text Only printing on Windows.


Way back in the old Turbo Pascal days, it was super simple to send text to a 
printer…   I had written a program that printed text on labels in the

order the labels were needed.. the whole thing took me less than an hour to 
write and labels were spewing out of the printer.

I haven’t had a need to print anything since then, but now, I want to do the 
exact same thing.. print sequential text only labels from my FPC console 
program…

I can display the labels to the console window, or write them to a file… but 
I’m just staring at my code at a total loss on how to send these simple labels 
to my

USB label printer connected to a windows 10 64bit PC.  Is there no way to just 
send text to printers anymore?

I don’t want to go through the windows print dialog for every label, and I 
don’t want to create one huge document of all the labels and print them all at 
once..

I want my FPC console application to spit out the next in sequence single label 
each time I push the space bar, without dealing with any the print dialog or 
doing anything else.

This used to be so easy to do, but now it seems either very complicated or 
impossible.  Does anyone know of a way to just send pain text

to a USB printer with FPC ,preferably without Lazarus?



James
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] String error on Windows

2021-10-30 Thread Alexander Grotewohl via fpc-pascal
Because += is a mistake and hopefully it's irreparably broken.

Does using just s:=s+';'; work?

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Hairy 
Pixels via fpc-pascal 
Sent: Saturday, October 30, 2021 11:09:49 PM
To: FPC-Pascal users discussions 
Cc: Hairy Pixels 
Subject: [fpc-pascal] String error on Windows

Why isn't this syntax valid on Windows? Very confused.



{$mode objfpc}

program WindowsTest;

var
s: String;
begin
s += ';';//  Syntax error, ";" expected but "const char" found
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] My Linux service application consumes 10% CPU when idling - why?

2021-10-24 Thread Alexander Grotewohl via fpc-pascal
In the end we have a black box with Indy that isn't going to be opened.. and 
from the sound of it, a dated method of manually checking for i/o (in this case 
likely with select() and a zero timeout..). Calling that and sleep() over and 
over millions of times..

I'm sorry to the OP if I'm assuming a lot but my guess is the code is a bit old 
and could use some refactoring to do away with the old Pascal "active loop."

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Bernd 
K. via fpc-pascal 
Sent: Saturday, October 23, 2021 6:46:21 AM
To: fpc-pascal@lists.freepascal.org 
Cc: Bernd K. 
Subject: Re: [fpc-pascal] My Linux service application consumes 10% CPU when 
idling - why?

Am 07.10.21 um 19:41 schrieb Bo Berglund via fpc-pascal:

> The question is: how to find what is still using CPU?

Have a look at the tool sysprof. This is a statistical sampling profiler
that can show you a call tree with percentages of CPU consumption. Thee
are also other sampling profilers around (oprofile, perf/hotspot,
google-gperftools, etc..) that all work by the same principle, you could
try which one suits you best. They should all be able to tell you where
exactly it spends how much of its CPU time. You don't need to instrument
the code, just compile it with dwarf debug info contained in the
executable (not as external debug file), maybe also reduce the
optimization level if, and it should be able to show you the call tree
along with time consumption of each function.

Bernd


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

2021-06-21 Thread Alexander Grotewohl via fpc-pascal
It's best to think of these in two parts. The Windows API part and then the 
interfacing with Pascal part.

SaveAsFileName.lpstrFile = long pointer to a (C) string filename buffer

This buffer isn't created for you, you provide it and tell Windows it's size.

If you were to just do

StrPLCopy( SaveAsFileName.lpstrFile, DefaulSaveAsFileName, Max_Path+1);

there is no buffer there to receive DefaultSaveAsFileName. (or more correctly 
the lpstrFile pointer will point to random memory).

So, you first create the buffer, StrPLCopy the default string into it, and then 
pass it to the Windows API.

On return, it uses that same buffer (Windows doesn't have to create the buffer 
because you did) and knows the maximum it can place into the buffer (because 
you provided that information).

Afterwards you can take that buffer (a C-string) and convert it to something 
Pascal-like again.

This is important because almost everything you do with the Windows API will be 
some variant of this procedure and you need to be able to repeat this every 
time you use it without bugs 

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of James 
Richters via fpc-pascal 
Sent: Monday, June 21, 2021 1:56 PM
To: 'FPC-Pascal users discussions' 
Cc: James Richters ; 'Jean SUZINEAU' 

Subject: Re: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default 
name

>I would prefer to use
> StrPLCopy( SaveAsFileNameBuffer, DefaulSaveAsFileName,
SizeOf(SaveAsFileNameBuffer));
>instead of
>  SaveAsFileNameBuffer:=Pchar(DefaulSaveAsFileName);

I'm curious what the difference is between StrPLCopy() and PChar()

I wonder if PChar() was my problem.. maybe I don't need the buffer, maybe I
just needed:
StrPLCopy( SaveAsFileName.lpstrFile, DefaulSaveAsFileName, Max_Path+1);
?

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default name

2021-06-18 Thread Alexander Grotewohl via fpc-pascal
The Windows API doesn't understand what an 'AnsiString' is and cannot resize it 
dynamically like FreePascal would do as it is used.

You need to use something like

buf: array[0..512] of char;

TFileName.nMaxFile := sizeof(buf);

But then you should also handle the possibility that the dir is greater than 
512 and allocate a bigger buffer as needed.
So maybe dynamically allocating the space would be better.

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of James 
Richters via fpc-pascal 
Sent: Friday, June 18, 2021 1:56 PM
To: 'FPC-Pascal users discussions' 
Cc: James Richters 
Subject: [fpc-pascal] GetSaveFileNameA limited to 100 characters in default name


I’m using GetSaveFileNameA() in a windows console program to obtain a save-as 
directory and file name, I am passing  sending it a default file name with:



TFileName.lpstrFile:=Pchar(DefaultFileName);



DefaultFileName is an AnsiString that contains a full path and filename.



This all works fine as long as DefaultFileName is 100 characters or less,  if 
it’s 101 or more, then GetSaveFileNameA() never opens a dialog box and just 
returns False;



Does anyone know where the 100 character limit is coming from?



TFileName.lpstrFile is a PChar, and DefaultFileName is an AnsiString, Neither 
of which have a length limit that I know of…

I am doing a Writeln if Both DefaultFileName and TFileName.lpstrFile and they 
both match, nothing is being truncated.



James
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to find where my app consumes CPU?

2021-05-18 Thread Alexander Grotewohl via fpc-pascal
https://www.freepascal.org/docs-html/rtl/baseunix/fpsigtimedwait.html

there we go :) i think this should do the trick. might need to rearrange some 
things though..

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Bo 
Berglund via fpc-pascal 
Sent: Tuesday, May 18, 2021 6:29:17 PM
To: fpc-pascal@lists.freepascal.org 
Cc: Bo Berglund 
Subject: Re: [fpc-pascal] How to find where my app consumes CPU?

On Tue, 18 May 2021 21:40:15 +, Alexander Grotewohl via fpc-pascal
 wrote:

>if it's waiting on keyboard input you might be better off using select() for
>that instead of looping and checking for keyboard input each go around.
>
>sleep() might already do something similar with a zero timeout but even that
>would probably be insufficient

As I tried to explain at the start of this thread my application runs as a
*systemd service* on Linux, so there is absolutely no keyboard input.

The main program looks like this after initializations etc:

  try
try
  bSTerm := False;
  bSInt := False;
  bsHup := False;
  {$IFDEF UNIX}
  fpSignal(SigTerm, SignalHandler(@handleSignal));
  fpSignal(SigInt, SignalHandler(@handleSignal));
  fpSignal(SigHup, SignalHandler(@handleSignal));
  {$ENDIF}

  Debug_Writeln('Enter eternal loop');
  FLogServ.StdLog('Enter eternal loop');

  While not (bSTerm or bSInt or bsHup) do
  begin
//Here is where the server runs as defined elsewhere
//Eternal loop to wait for system messages
Sleep(1); //To not hog the CPU
CheckSynchronize; //To get thread comm working
  end;

  Debug_Writeln('Exit eternal loop');
  FLogServ.StdLog('Exit eternal loop');
except
  on E: Exception do
  begin
FLogServ.ExceptionLog('Unhandled exception: ' + E.Message);
  end;
end;
  finally
ShutdownServer;
  end;

As you can see it sits in the eternal loop until the system sends a "signal" to
it to stop. So systemd does that if I issue a sudo systemctl stop myservice and
this works fine.
Could this tiny loop consume 6-7% CPU cycles?


--
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to find where my app consumes CPU?

2021-05-18 Thread Alexander Grotewohl via fpc-pascal
if it's waiting on keyboard input you might be better off using select() for 
that instead of looping and checking for keyboard input each go around.

sleep() might already do something similar with a zero timeout but even that 
would probably be insufficient

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Travis 
Siegel via fpc-pascal 
Sent: Tuesday, May 18, 2021 5:29:10 PM
To: bo.bergl...@gmail.com ; FPC-Pascal users discussions 

Cc: Travis Siegel 
Subject: Re: [fpc-pascal] How to find where my app consumes CPU?

I'm not positive, but I'm pretty sure the sleep command in linux does
not behave the same way it does in windows.

As you know, in windows, a sleep command (even if delivered with a
parameter of 0) gives up time slices to other programs on the system.
This does not appear to be the case on linux.

On linux, the sleep command simply suspends the process for the
specified amount of time, but so far as I can tell, does nothing for
unused cpu cycles.

I've done a little digging, but I can't find any way on linux to give
away unused cpu cycles.

Perhaps the linux task switcher doesn't allow for this capability?


On 5/18/2021 3:59 PM, Bo Berglund via fpc-pascal wrote:
> I have a pretty sizable console app written with Delphi 15 years ago but 
> ported
> to Linux using FreePascal (3.2.0) with Lazarus (2.0.12) as IDE. It runs as a
> systemd service on a Raspberry Pi3.
>
> Basically it is a scheduler, which checks every minute if there is a task to
> run, otherwise it waits for the next minute to pass.
>
> Meanwhile in another thread there is a TCP/IP socket server active for
> communicating with the app over the network. So it is listening for incoming
> connections.
>
> This is working seemingly OK, but today when I checked the RPi I found using 
> top
> that it was running 11% CPU, which is strange because it has nothing to do at
> the moment.
>
> I have tried to be as conservative as possible regarding wait loops etc so in
> such loops I always have a sleep() call, which in my Windows experience used 
> to
> stop excessive CPU usage.
>
> So I was surprised to find the high CPU usage and now I am at a loss on how to
> find *where* this is happening...
>
> Any ideas on how to proceed?
> Is there some Lazarus way to find this?
> (But I cannot really run the application in service mode from within 
> Lazarus...)
>
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] compiling on command line linux

2021-02-15 Thread Alexander Grotewohl via fpc-pascal
There's a command line parameter.. try something like

fpc -FU~/.units.lnx yourapp.pp

Of course you would have to remember to do that for EVERY compile (I set my 
text editor to do it) but you could probably add it to your fpc.cfg too.

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of duilio 
foschi via fpc-pascal 
Sent: Monday, February 15, 2021 2:20:28 PM
To: FPC-Pascal users discussions 
Cc: duilio foschi 
Subject: [fpc-pascal] compiling on command line linux

Today I had to compile a program on my Linux server.

The program was written for windows and needed libraries synapse and lazutils, 
and they were missing from the server.

I copied  all the needed units from my PC into the linux work directory and it 
worked with the usual command

fpc programname.pp

Unfortunately now my work directory is messy with tens of units (belonging to 
libraries synapse and lazutils) unworthily mixed with my poor code.

I guess that the kosher way is to create directories lazutils and synapse 
somewhere in the server but ... where?

Where should libraries be copied in linux?

How to make them accessible to the compiler?

Sorry for being so ignorant... I know how to do it in Lazarus on windows, but 
fpc on linux is rather arcane to me :)

Thank you

Duilio




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Windows Defender considers fp.exe a malicious program

2021-02-12 Thread Alexander Grotewohl via fpc-pascal
Unfortunately from what I've read just using certain Windows APIs is enough to 
get an executable flagged. Probably nothing to be too concerned about.

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of 
Alexander Bunakov via fpc-pascal 
Sent: Thursday, February 11, 2021 3:22:40 AM
To: fpc-pascal@lists.freepascal.org 
Cc: Alexander Bunakov 
Subject: [fpc-pascal] Windows Defender considers fp.exe a malicious program

Hello all,

As of trunk r48648, Windows Defender deletes fp.exe after compilation
because it considers it an infected file. It claims that fp.exe is
infected with Trojan:Win32/Fuerboos.E!cl and quarantines the file.

Anyone else is experiencing this? Any idea why is this happening?

--
Regards,
Alexander
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

2020-12-31 Thread Alexander Grotewohl via fpc-pascal
yes, this type of thing is why we use Pascal. pchar is your little bucket of 
ram that FPC in a sense knows nothing about. set it to #0 and pray for the 
best, cause that's what you do..

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Jean 
SUZINEAU via fpc-pascal 
Sent: Friday, January 1, 2021 2:41:18 AM
To: fpc-pascal@lists.freepascal.org 
Cc: Jean SUZINEAU 
Subject: Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

Le 01/01/2021 à 00:48, James Richters via fpc-pascal a écrit :

I’m not too familiar with PChars, but is there a way to set it to zero length?

I set it to #0 and it works ok with the #0 in there with Notepadd++ but I think 
it’s technically not correct.

For me, it's correct. C strings are just terminated with a null character, no 
notion of length, the length is not recorded in the string as in Pascal.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

2020-12-30 Thread Alexander Grotewohl via fpc-pascal
The memory for FN is allocated at the top with StrAlloc()

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Martin 
Frb via fpc-pascal 
Sent: Wednesday, December 30, 2020 8:00 PM
To: fpc-pascal@lists.freepascal.org 
Cc: Martin Frb 
Subject: Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

On 31/12/2020 01:09, James Richters via fpc-pascal wrote:
> Var
> FN : LPTSTR;
>
> Begin
>
> FN:='';
> Writeln(Format_ID);
> GetClipboardFormatName(Format_Id,FN,250);
>

Check the msdn help.
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getclipboardformatnamea

FN must point to an existing buffer (allocated mem) that receives the
result.

FN : Array [0..255]of Byte;
GotLen := GetClipboardFormatName(Format_Id, LPTSTR(@FN[0]),250);

then "move()" the received bytes into a string, make sure to use
UniqueString() or similar

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] GetClipboardFormatName causing an Error 216

2020-12-30 Thread Alexander Grotewohl via fpc-pascal
Your

FN:='';

is clobbering the pointer 'FN' with nonsense.

Just leave that line out, it isn't necessary. Or do like FN^:=#0; if you want 
C-string like functions to report zero length..


--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of James 
Richters via fpc-pascal 
Sent: Wednesday, December 30, 2020 7:09 PM
To: 'FPC-Pascal users discussions' 
Cc: James Richters 
Subject: [fpc-pascal] GetClipboardFormatName causing an Error 216

I'm trying to write a programs to get data from the windows clipboard that
was put into it with Notepad++ using vertical editing.
It uses a non-standard format and I'm trying to figure it out.
GetClipboardFormatName is supposed to get me the name of non-standard
formats,
but whenever I try to run it, I get a runtime error 216

I found some python code at: https://gist.github.com/adam-p/2514182 that I'm
trying to convert to FPC.
My fork is at:
https://gist.github.com/Zaaphod/7d94e1d712a5b9ac2bcb0bc79f039a63 Which shows
both the original python code and my FPC attempt

It works fine for standard formats:

Running "i:\programming\gcode\test\clipboard formats.exe "
Number of formats: 4
13 CF_UNICODETEXT
16 CF_LOCALE
1 CF_TEXT
7 CF_OEMTEXT

But if I highlight some text in Notepadd++ using vertical editing, holding
down Shift and ALT while using the arrow keys to highlight a block of text,
and the copy that to the clipboard, I get the following:

Running "i:\programming\gcode\test\clipboard formats.exe "
Number of formats: 6
13 CF_UNICODETEXT
49882
Runtime error 216 at $774C246C
  $774C246C
  $76932F63
  $76932EB7
  $004017EC  main,  line 60 of i:/programming/gcode/test/clipboard
formats.pas
  $00408F67

Line 60 is:
   GetClipboardFormatName(Format_Id,FN,250);

It only gets run for non-standard formats.  As I understand it that's all it
us supposed to be used for.

It's pretty short program so I pasted it below.

Any ideas on what I'm doing wrong here?

James

-


uses
   Windows,strings;
Type
   BT = Record
  BT_ID: Byte;
  BT_Name: String;
   End;

Const
builtin_type: Array [0..22] of BT = (
{ 0} (BT_ID:2   ;BT_Name:'CF_BITMAP' ),
{ 1} (BT_ID:8   ;BT_Name:'CF_DIB'),
{ 2} (BT_ID:17  ;BT_Name:'CF_DIBV5'  ),
{ 3} (BT_ID:5   ;BT_Name:'CF_DIF'),
{ 4} (BT_ID:130 ;BT_Name:'CF_DSPBITMAP'  ),
{ 5} (BT_ID:142 ;BT_Name:'CF_DSPENHMETAFILE' ),
{ 6} (BT_ID:131 ;BT_Name:'CF_DSPMETAFILEPICT'),
{ 7} (BT_ID:129 ;BT_Name:'CF_DSPTEXT'),
{ 8} (BT_ID:14  ;BT_Name:'CF_ENHMETAFILE'),
{ 9} (BT_ID:15  ;BT_Name:'CF_HDROP'  ),
{10} (BT_ID:16  ;BT_Name:'CF_LOCALE' ),
{11} (BT_ID:18  ;BT_Name:'CF_MAX'),
{12} (BT_ID:3   ;BT_Name:'CF_METAFILEPICT'   ),
{13} (BT_ID:7   ;BT_Name:'CF_OEMTEXT'),
{14} (BT_ID:128 ;BT_Name:'CF_OWNERDISPLAY'   ),
{15} (BT_ID:9   ;BT_Name:'CF_PALETTE'),
{16} (BT_ID:10  ;BT_Name:'CF_PENDATA'),
{17} (BT_ID:11  ;BT_Name:'CF_RIFF'   ),
{18} (BT_ID:4   ;BT_Name:'CF_SYLK'   ),
{19} (BT_ID:1   ;BT_Name:'CF_TEXT'   ),
{20} (BT_ID:6   ;BT_Name:'CF_TIFF'   ),
{21} (BT_ID:13  ;BT_Name:'CF_UNICODETEXT'),
{22} (BT_ID:12  ;BT_Name:'CF_WAVE'   ));

Var
   i,j,Number_Of_Formats : Byte;
   Format_ID : DWord;
   FN : LPTSTR;
   Format_Name : String;

Begin
   FN:=StrAlloc (255);
   OpenClipboard(0);
   Number_Of_Formats := CountClipboardFormats();
   Writeln('Number of formats: ',Number_Of_Formats);
   format_id := 0;
   for i := 1 to Number_Of_Formats do
  Begin
 Format_Name := 'FAILED';
 Format_ID:=EnumClipboardFormats(Format_ID);
 For J:= 0 to 22 do
Begin
   If Format_ID = builtin_type[J].BT_ID then
  Format_Name := builtin_type[J].BT_Name;
End;
 If Format_Name = 'FAILED' Then
Begin
   FN:='';
   Writeln(Format_ID);
   GetClipboardFormatName(Format_Id,FN,250);
   Writeln(FN);

   If strpas(FN) <> '' Then
  Format_Name := StrPas(FN);
End;
 Writeln(Format_ID,' ',Format_Name);
 End;
CloseClipboard();
End.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Two versions of freemem() - are they equal

2020-12-30 Thread Alexander Grotewohl via fpc-pascal
The TP7 manual suggests it was possible to partially free the memory. If you 
had a pointer to the un-freed chunk, I wonder if that could also have been 
freed, or if was left in limbo.

As the manual suggests, I bet everyone just used SizeOf() as the parameter, and 
I'm not so sure how useful using freemem like above would be..

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of Marco 
van de Voort via fpc-pascal 
Sent: Wednesday, December 30, 2020 5:56:45 PM
To: FPC-Pascal users discussions 
Cc: Marco van de Voort 
Subject: Re: [fpc-pascal] Two versions of freemem() - are they equal


Op 2020-12-30 om 23:54 schreef Graeme Geldenhuys via fpc-pascal:
> Do both these method yield the same result, or is one better (performance,
> safer?) that the other?
>
>
> procedure FreeMem(p:pointer;Size:ptruint);
> procedure FreeMem(p:pointer);
They are the same.   TP required size for deallocation, Delphi and FPC
don't.  The overload with size is for TP compatibility.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpmmap problem 64 bit linux

2020-11-20 Thread Alexander Grotewohl via fpc-pascal
It would seem C handles this at compile time with a define.. mapping mmap to 
mmap64. Which would almost seem to imply you'd end up with a 32 bit binary that 
would only work on 64 bit systems. I'm not really sure how this would work for 
Pascal. You could start by looking in the file listed in the fpmmap docs you 
posted. My guess is the easiest answer is "distribute both 32 and 64 bit 
versions," but that doesn't help when you need to test the 32 bit one..

--
Alexander Grotewohl
https://dcclost.com

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Rainer 
Stratmann via fpc-pascal 
Sent: Friday, November 20, 2020 6:33:51 PM
To: fpc-pascal@lists.freepascal.org 
Cc: Rainer Stratmann 
Subject: [fpc-pascal] fpmmap problem 64 bit linux

A 32 bit freepascal program on a 32 bit Linux Debian system is working
properly. It uses fpmmap for getting the adress of a kms framebuffer.

The same 32 bit program on a 64 bit Linux Debian system *** is not working.
When it comes to the fpmmap it gives an error:

Sys_EINVAL
One of the record fields Start, length or offset is invalid.

https://www.freepascal.org/docs-html/rtl/baseunix/fpmmap.html

I figured out that it likely can only be the offset value since start and length
are always the same.

The offset value I got from a previous DRM function.

On the 32 bit System this offset value is $1000 (fits in 32 bit)
And on the 64 bit System this offset value is $1 (does not fit in 32
bit).

Can it be possible that the fpmmap function strips the offset value to 32 bit?
Is there another way to call fpmmap more directly?
What does fpmmap exactly?
Where can I research?


***
dpkg --add-architecture i386
apt-get update
apt-get install libc6-i386


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Adding file to string to the RTL

2020-10-06 Thread Alexander Grotewohl via fpc-pascal
Not 100% on this but I think the gist is that UnicodeString is compatible with 
AnsiString and a conversion is done on assignment.

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of Ryan 
Joseph via fpc-pascal 
Sent: Tuesday, October 6, 2020 12:39:43 PM
To: FPC-Pascal users discussions 
Cc: Ryan Joseph 
Subject: Re: [fpc-pascal] Adding file to string to the RTL



> On Oct 6, 2020, at 2:12 AM, Michael Van Canneyt via fpc-pascal 
>  wrote:
>
> I added the following functions to the sysutils unit (rev 47056):

Great, thanks Michael.

I've always used AnsiString so why is UnicodeString preferable here?

So is the idea we need to specify an UTF-8 encoding for unicode otherwise it 
assumes ASCII format? I didn't specify the encoding with TStringList and I 
always seemed to get back what I wanted (maybe it sniffed the encoding from the 
file?).

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Writeln() behaves differently on Windows and Linux, why?

2020-07-09 Thread Alexander Grotewohl
perhaps try 'reset' or 'stty sane' in the terminal before running your program?

are you using the crt or video units at all?

it sounds like your terminal has gotten fudged somehow

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Bo 
Berglund via fpc-pascal 
Sent: Thursday, July 9, 2020 12:01:42 PM
To: fpc-pascal@lists.freepascal.org 
Cc: Bo Berglund 
Subject: [fpc-pascal] Writeln() behaves differently on Windows and Linux, why?

I am writing a cross-platform program (console program, no GUI).
I am using Lazarus 2.0.8 and FPC 3.0.4 on both Linux and Windows.

During sebugging I have put numerous writeln commands in the code to
track what is happening.
I started on Windows and all worked just fine according to
expectations.
Every new output generated a new line on the console with the printed
text left aligned.

But then I moved the code over to Linux (Raspbian Buster) and
strangely this happens:

Test line 1
   Test line 2
  Test line 3

and so on.
It looks exactly the same if I use a terminal window on the Linux
system itself as it does if I connect to the Linux machine using PuTTY
from Windows...


It seems like a writeln() in the code does actually not do a carriage
return on the console, just a linefeed so the console continues at the
column where the previous line ended.
The messages I print out are simple text strings either showing
incoming data packets or just my comment.

Typical code:

  s := 'Status changed: ' + newstat + ' msg: ' + AStatusText;
  LogStd(s);
  Writeln(s);

In the log file this obviously does not happen...

What can cause this strange behaviour?


--
Bo Berglund
Developer in Sweden

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Copying a Pchar to an array of bytes

2020-05-19 Thread Alexander Grotewohl
I believe pchar has special treatment where pchar[i] is the same as pchar^[i]

do move(Hello^, ...

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of 
Giuliano Colla 
Sent: Tuesday, May 19, 2020 1:05:54 PM
To: FPC-Pascal users discussions 
Subject: [fpc-pascal] Copying a Pchar to an array of bytes

I'm not too familiar with Pchar, and apparently I'm missing something.

I have a Pchar string which I must copy into an array of bytes.

Could someone explain me while a move doesn't work while an assignment
byte by byte does?

Here's a snippet of the code:

buffer: array [0..1023] of byte;
Hello: PChar = 'Hello from server';

   len := strlen(Hello);

Move(Hello,buffer,len); <--- Garbage in buffer - doesn't work

   for I := 0 to Pred(len) do
   begin
 buffer[I] := Byte(Hello[I]);  < Works just fine.
   end;

I fail to understand why. What I'm missing?

Giuliano

--
Do not do to others as you would have them do to you.They might have different 
tastes.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to implement a simple tcp/ip connection?

2020-05-19 Thread Alexander Grotewohl
It was added for Linux 3.9 in 2013.. maybe the code predates that?

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Michael 
Van Canneyt 
Sent: Tuesday, May 19, 2020 12:57:37 PM
To: FPC-Pascal users discussions 
Cc: bo.bergl...@gmail.com 
Subject: Re: [fpc-pascal] How to implement a simple tcp/ip connection?



On Tue, 19 May 2020, Giuliano Colla wrote:

> I'm struggling with a similar problem. It would appear that the easiest
> way would be just take advantage of the Sockets unit. You only must
> define some more constants, such as SO_REUSEPORT and SOCK_NONBLOCK which
> are missing in fpc.

They are not missing.

How do you think fpsock and lnet implement non-blocking ?
It's simply called  O_NONBLOCK.

For some reason, SO_REUSEPORT was commented for linux, I uncommented it.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to implement a simple tcp/ip connection?

2020-05-14 Thread Alexander Grotewohl
the sockets unit should work exactly like any tutorial for c sockets for linux. 
a handful of the functuons need an fp prefix but should work mostly the same.

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of 
Giuliano Colla 
Sent: Thursday, May 14, 2020 12:21:36 PM
To: FPC-Pascal users discussions 
Subject: [fpc-pascal] How to implement a simple tcp/ip connection?

Hi all,

I need to implement a simple dedicated TCP/IP connection between a
client and a server. Nothing fancy, just sending and receiving short
strings. I have used in the past for that purpose the unit Sockets
lifting it from Kylix. This unit was taking advantage of libc, and this
rules it out.

I see that fpc provides a Socket unit in rtl-extra and a fpSock unit in
fcl-net. At first glance they both appear to provide what I need.

Can somebody which has used those units point me in the right direction,
before I painfully study in detail those units.

Thanks for any help.

Giuliano

--
Do not do to others as you would have them do to you.They might have different 
tastes.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Different behaviour between FPC 2.6.4 and FPC 3.0.4

2020-05-05 Thread Alexander Grotewohl
my original suggestion and then

function proc_bool : boolean;

what exactly are you trying to accomplish?

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Rainer 
Stratmann 
Sent: Tuesday, May 5, 2020 4:20:11 PM
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Different behaviour between FPC 2.6.4 and FPC 3.0.4

Am Dienstag, 5. Mai 2020, 22:14:09 CEST schrieb Alexander Grotewohl:
> procvar:=@proc_bool; ?

Error: Incompatible types

> --
> Alexander Grotewohl
> https://dcclost.com
>
> 
> From: fpc-pascal  on behalf of
> Rainer Stratmann  Sent: Tuesday, May 5, 2020,
> 4:05 PM
> To: FPC-Pascal users discussions
> Subject: [fpc-pascal] Different behaviour between FPC 2.6.4 and FPC 3.0.4
>
> Compiled with FPC 3.0.4 there is an access violation when executing procvar;
> Compiled with FPC 2.6.4 it works for a long time.
>
> Did I overlooked something?
>
> Mode: MObjFPC
>
> type
>  t_funcboolean = function : boolean;
> var
>  procvar : t_funcboolean;
>
> function proc_bool : t_funcboolean;
> begin
> end;
>
> begin
>  procvar := proc_bool;
>  procvar; // -> access violation with FPC 3.0.4
>
>
>
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Different behaviour between FPC 2.6.4 and FPC 3.0.4

2020-05-05 Thread Alexander Grotewohl
procvar:=@proc_bool; ?

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of Rainer 
Stratmann 
Sent: Tuesday, May 5, 2020, 4:05 PM
To: FPC-Pascal users discussions
Subject: [fpc-pascal] Different behaviour between FPC 2.6.4 and FPC 3.0.4

Compiled with FPC 3.0.4 there is an access violation when executing procvar;
Compiled with FPC 2.6.4 it works for a long time.

Did I overlooked something?

Mode: MObjFPC

type
 t_funcboolean = function : boolean;
var
 procvar : t_funcboolean;

function proc_bool : t_funcboolean;
begin
end;

begin
 procvar := proc_bool;
 procvar; // -> access violation with FPC 3.0.4




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Porting from Turbo Pascal to FPC

2020-04-30 Thread Alexander Grotewohl
Not really sure how you would adapt this to your setup, but I threw this 
together from a project I did previously. I've only tested it with the Windows 
10 builtin XPS and PDF printers so I'm not sure how it will behave on a real 
printer.

(Hopefully the attachment makes it through..)

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of 
Francisco Glover via fpc-pascal 
Sent: Wednesday, April 29, 2020 4:42 AM
To: fpc-pascal@lists.freepascal.org 
Cc: Francisco Glover 
Subject: [fpc-pascal] Porting from Turbo Pascal to FPC

Overt the years I have developed programs  in Turbo Pascal for student lab use, 
in which the student can easily send to an attached printer contents of the 
text or VGA graphics screens. These no longer work on Windows 10.  In shifting 
to FPC , certain key procedures which worked in Turbo Pascal running on Windows 
XP no longer work in FPC running on Windows 10. Samples are shown below:
===
Program Sample;
{$ mode TP}
Uses Crt, Dos, Printer;
Var Regs: Registers;

 Procedure Print_screen;   { Interupt $05 }
   Begin
 Intr($05, Regs);
   End;   {Nothing printed, exit code= 0}

 Procedure Print_string;
  Begin
Writeln('Text Screen');
Writeln(LST, 'String to be printed');
  End;{nothing printed, system hangs}


 Procedure Print_characters;   {Intrupt $17, function 0,  char to printer}
 Var j: byte;
 Msg: String[2];
   Begin
 Msg :=  'A' + #11;{ #11 = formfeed  }
 For j := 1 to 2 do
Begin
  Regs.AH := 0;   {Function 0, output char}
  Regs.AL :=Ord(Msg[j]);
  Regs.DX := 0;   {default printer}
  Intr($17, Regs);
End;
   End;  {Nothing printed, exit code= 0}

 Procedure Print1Char; {Interupt $21, Fcn 5}
   Begin
 Regs.AH := 5; {print character}
 Regs.DL := 'A';
 MSDos(Regs);
 Regs.AH := 5; {print character}
 Regs.DL := #11;  {formfeed}
 MSDos(Regs);
   End;{Nothing printed, exit code= 0}

How can I have my FPC programs running on Windows 10 send text and graphics 
screens direct to an attached printer? Thank you



print.pas
Description: print.pas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Converting http date back to TDateTime

2020-04-28 Thread Alexander Grotewohl
"Note that to include any of the above characters literally in the result 
string, they must be enclosed in double quotes."

This only makes sense for FormatDateTime which returns a string you can display.

For example:
writeln(FormatDateTime(' "" =  ', now));

To print:
 = 2020

--
Alexander Grotewohl
https://dcclost.com


From: Zamrony P. Juhara 
Sent: Tuesday, April 28, 2020 10:44:07 PM
To: FPC-Pascal users discussions ; Alexander 
Grotewohl ; FPC-Pascal Users Discussions 

Subject: Re: [fpc-pascal] Converting http date back to TDateTime

No it does not work. Docs says literal string needs to be quoted with "

Zamrony P. Juhara

On Wed, Apr 29, 2020 at 9:37, Alexander Grotewohl
 wrote:
___
fpc-pascal maillist  -  
fpc-pascal@lists.freepascal.org<mailto:fpc-pascal@lists.freepascal.org>
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Converting http date back to TDateTime

2020-04-28 Thread Alexander Grotewohl
Can't test, but from the docs shouldn't it be something like:

adateTime := ScanDateTime(
'ddd, dd mmm  hh:mm:ss GMT',
'Wed, 29 Apr 2020 10:35:50 GMT');

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of Zamrony 
P. Juhara via fpc-pascal 
Sent: Tuesday, April 28, 2020 10:29:27 PM
To: FPC-Pascal Users Discussions 
Cc: Zamrony P. Juhara 
Subject: [fpc-pascal] Converting http date back to TDateTime

Hi,

How do I convert string with HTTP date format such as

Wed, 29 Apr 2020 10:35:50 GMT

back to its TDateTime value?

I try with ScanDateTime()

adateTime := ScanDateTime(
 'ddd", "dd" "mmm" "" "hh:mm:ss" GMT"',
 'Wed, 29 Apr 2020 10:35:50 GMT');

but EConvertError exception is raised with message

Mismatch char " " <> "," at pattern position 5, string position 5


Zamroni
Fano Framework
https://fanoframework.github.io


Zamrony P. Juhara
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Alexander Grotewohl
This is an evil travesty and I'm not happy about it:

-Fu$_$/../../lib/fpc/$fpcversion/units/$fpctarget
-Fu$_$/../../lib/fpc/$fpcversion/units/$fpctarget/*
-Fu$_$/../../lib/fpc/$fpcversion/units/$fpctarget/rtl

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Saturday, April 11, 2020 8:52 PM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Search path order for fpc.cfg

I promise, it is the last for tonight.

It would be wonderful if in /compiler/globals.pas, at line 906, you add this
line (or something like that):

 { Replace some macros }

Replace(s,'$FPCPATH',AnsiString(IncludeTrailingBackslash(ExtractFilePath(ParamStr(0);

So in fpc.cfg you may do:

-Fu$FPCPATH/units/$fpctarget
-Fu$FPCPATH/units/$fpctarget/*
-Fu$FPCPATH/units/$fpctarget/rtl

And it works like charm.

@Jonas, I apologize, really, you kindly answered but I feel alone against a
tribe of gurus who want to eat me.

OK, I go to sleep (if I can).

Fred










--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Alexander Grotewohl
Are you always going to be running the compiler from a front-end (IDE, whatever 
else)? Just use code on the other end to find the binary directory and call 
something like "fpc @/home/whereis/fpc/fpc.cfg ..."

You could also use a bash script to wrap the compiler and do something like:
https://stackoverflow.com/questions/59895/how-to-get-the-source-directory-of-a-bash-script-from-within-the-script-itself#59916

To find out where the script is (and therefore where your binaries/config are) 
to use with @ again.

I duno. If you really do this I'd suggest doing it once and writing a correct 
config to .fpc.cfg in their home directory... in that case they can at least 
upgrade fpc independently from the whole project. But that touches the system..

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Saturday, April 11, 2020 11:31:32 AM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Search path order for fpc.cfg

> if the .so.n issue was really so urgent for you,

Ho, it was urgent for we since the first time I did use it 15 years ago!

And each time that I request it, it finished by insult.

And when I created uos, problems of linking to libs where solved by
loadlibrary() because with ld it was not possible.

Sorry but now it is the time to change and fast.

Fred




--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Search path order for fpc.cfg

2020-04-11 Thread Alexander Grotewohl
Why not just provide instructions for installation in the user's home 
directory, for example. It's what you'd have to do if you didn't have root 
access anyways. Then you can pretend that it's "cleaner" than just installing 
it systemwide.

There's a prompt in the freepascal installer that asks for the prefix. Your 
users should be capable of that?

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Saturday, April 11, 2020 8:07:17 AM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Search path order for fpc.cfg

Hello.

The target of that "patched" fpc is mainly the Raspbian RPi.

I want a fpc out-of-the-box, only a zip file that people may unzip where
they want, without need to touch anything to the system.

All what I have found in fpc doc always require to touch to system.

Also, I want that people can compile out-of-the-box, without the need to
install dev package because that army of Rpi is not connected.

I thanks you for the warnings about using fpc.cfg in the same directory than
the compiler.
But for my need there is no problem with that, even if you create a symlink
and run fpc from that symlink.

I do propose my patch here to inform what I am changing in
https://github.com/fredvs/freepascal

Fre;D






--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Wine + Unsupported ioctl

2020-04-04 Thread Alexander Grotewohl
my guess is that function of wine is unimplemented (pretends to work but does 
nothing)

try to see if you can fix the cause of the second error? does wine handle 
relative paths gracefully?

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of Juha 
Manninen via fpc-pascal 
Sent: Saturday, April 4, 2020 1:32:21 PM
To: FPC-Pascal users discussions 
Cc: Juha Manninen 
Subject: [fpc-pascal] Wine + Unsupported ioctl

Hello

I installed FPC 3.2RC1 Win32 version under Wine in Linux Manjaro 64-bit.
Wine version is a recent 5.5-1.
Compiling a hello.lpr program works.
Then I made a symbolic link for my Lazarus trunk sources and tried to build 
with both "make all" and "make bigide".
All components compile well but with lazbuild it stops with an error (see 
below).
What does "008b:fixme:ntdll:server_ioctl_file Unsupported ioctl" mean?
A net search gave only few links and they told to ignore the message if the 
program works.
Well, this does not work.
Has anybody built Lazarus under Wine? Should I test with FPC 3.0.4? Is this 
somehow related to the new version? Or is it about 32 / 64 bits?
I remember building Lazarus under Wine some years ago but then I installed from 
Lazarus installer and later created a symlink for trunk sources.

Juha

---

make[1]: Leaving directory `c:/lazarus_trunk/components/lazdebuggergdbmi'
make -C ide lazbuilder LCL_PLATFORM=nogui
make[1]: Entering directory `c:/lazarus_trunk/ide'
make --assume-new=lazbuild.lpr lazbuild.exe OPT=' 
-Fu../packager/units/i386-win32 -Fu../components/codetools/units/i386-win32 
-Fu../components/debuggerintf/lib/i386-win32 
-Fu../components/lazutils/lib/i386-win32 -Fu../lcl/units/i386-win32 
-Fu../lcl/units/i386-win32/nogui -Fu../components/buildintf/units/i386-win32 
-Fu../components/ideintf/units/i386-win32/nogui 
-Fu../components/synedit/units/i386-win32/nogui 
-Fu../components/lazcontrols/lib/i386-win32/nogui 
-Fu../components/lazdebuggergdbmi/units/i386-win32/nogui 
-Fu../units/i386-win32/nogui '
make[2]: Entering directory `c:/lazarus_trunk/ide'
c:/FPC/3.2.0rc1/bin/i386-Win32/ppc386.exe -gl -vbqewnhi -Sci -dlclnogui 
-Fu../designer -Fu../debugger -Fu../debugger/frames -Fu../converter 
-Fu../packager -Fu../packager/frames -Fu../components/custom -Fuinclude/win 
-Fuframes -Fu. -Fiinclude -Fiinclude/win32 -Fi../images -FE.. 
-FU../units/i386-win32/nogui -Fu../packager/units/i386-win32 
-Fu../components/codetools/units/i386-win32 
-Fu../components/debuggerintf/lib/i386-win32 
-Fu../components/lazutils/lib/i386-win32 -Fu../lcl/units/i386-win32 
-Fu../lcl/units/i386-win32/nogui -Fu../components/buildintf/units/i386-win32 
-Fu../components/ideintf/units/i386-win32/nogui 
-Fu../components/synedit/units/i386-win32/nogui 
-Fu../components/lazcontrols/lib/i386-win32/nogui 
-Fu../components/lazdebuggergdbmi/units/i386-win32/nogui 
-Fu../units/i386-win32/nogui -di386 lazbuild.lpr
Hint: (11030) Start of reading config file 
c:\FPC\3.2.0rc1\bin\i386-Win32\fpc.cfg
Hint: (11031) End of reading config file c:\FPC\3.2.0rc1\bin\i386-Win32\fpc.cfg
Free Pascal Compiler version 3.2.0rc1 [2020/02/29] for i386
Copyright (c) 1993-2020 by Florian Klaempfl and others
008b:fixme:ntdll:server_ioctl_file Unsupported ioctl 900a8 (device=9 access=0 
func=2a method=0)
Error: (1017) Path "..\" does not exist
make[2]: *** [lazbuild.exe] Error 1
make[2]: Leaving directory `c:/lazarus_trunk/ide'
make[1]: *** [lazbuilder] Error 2
make[1]: Leaving directory `c:/lazarus_trunk/ide'
make: *** [lazbuild] Error 2

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Why external execution so slow?

2020-03-31 Thread Alexander Grotewohl
Does FPC come as a 64 bit release now? I usually steal FPC from a Lazarus 
release because the 32bit compiler and it's generated binaries have a noticable 
lag executing on a 64bit Windows machine vs 64bit the whole way through.

The other though I had is that your E: is going to sleep while you're 
programming and the first execution requires the drive to spin up again.

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of Marco 
van de Voort 
Sent: Tuesday, March 31, 2020 5:21:14 PM
To: fpc-pascal@lists.freepascal.org 
Subject: Re: [fpc-pascal] Why external execution so slow?


Op 2020-03-31 om 19:37 schreef Gabor Boros:
>
> I need to execute an external program from my application. This
> execution is much slower than execute the external application from
> command line. I made a simple example (see below) which show 1.7 seconds
> for me. Why? (From command line the execution time is 15 milliseconds.
> I used Windows 10 64bit.)

Antivirus?


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Alexander Grotewohl
perhaps calculate those results by hand and assign them.. then fix it later? 
hehe

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Tuesday, March 24, 2020 1:53:19 PM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Range check error warning.

> what mode are you compiling with?

{$mode objfpc}{$h+}



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Alexander Grotewohl
just to be clear.. you did do foldhiddenbit: byte = 7, etc?

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Tuesday, March 24, 2020 12:22:10 PM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Range check error warning.

Hello WKitty.

   foldhiddenmask : byte = 1 shl foldhiddenbit;
   currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit;
   foldlevelmask : byte = not (foldhiddenmask or currentfoldhiddenmask);

  =

  msedatalist.pas(897,47) Error: (3203) Illegal expression
  msedatalist.pas(899,61) Error: (3203) Illegal expression
  msedatalist.pas(900,72) Error: (3203) Illegal expression


Thanks for the links for calculation, indeed the result is -193.

I did play with abs(), for example:

foldlevelmask = abs(byte(not (foldhiddenmask or currentfoldhiddenmask)));

But strangely still that warning:
Warning: (4110) Range check error while evaluating constants (-193 must be
between 0 and 255)

Fre;D


Fre;D





-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Alexander Grotewohl
Yes, those constants are defaulting to integer, which can represent both 
negative and positive values. When you do your shl you're inadvertently causing 
them to go into the range that pascal thinks is negative.

The typed constant should fix it.

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of 
wkitt...@windstream.net 
Sent: Tuesday, March 24, 2020 11:49:33 AM
To: fpc-pascal@lists.freepascal.org 
Subject: Re: [fpc-pascal] Range check error warning.

On 3/23/20 8:08 PM, fredvs via fpc-pascal wrote:
> const
>   foldhiddenbit = 7;
>   foldhiddenmask = 1 shl foldhiddenbit;
>   currentfoldhiddenbit = 6;
>   currentfoldhiddenmask = 1 shl currentfoldhiddenbit;
>   foldlevelmask = byte(not (foldhiddenmask or currentfoldhiddenmask));
> >Here the warning
>
> I dont understand how the compiler can find -193 as value for
> foldlevelmask...


so let's work through it manually... with a little rambling because too much
c0ffee...


foldhiddenmask is1000 binary (128 decimal; 80 hex)
currentfoldhiddenmask is 0100 binary (64 decimal; 40 hex)

ORing them gives 1100 binary (192 decimal; c0 hex)
applying the NOT gives 0011 binary (63 decimal; 3f hex)

so that seems to come out as expected but i found several online bitwise
calculators that came with the same -193 answer that fpc returned... this seems
to be related to a wrong field initialization of some kind or using the wrong
size for the value...

go here: http://easyonlineconverter.com/converters/bitwise-calculator.html
place 1100 in field 1
leave field 2 blank
select "NOT"
click calculate


this one, https://toolslick.com/math/bitwise/not-calculator , gives the same
-193 result but you can also see that it is using 16 bits (word) instead of 8
bits (byte) so the top 8 zero bits are also NOTted which makes them ones and
there's the error... 0011 == -193... so i tried to trick it and used
16bits... damned thing prepended 8 more ones to the beginning... they're not
respecting that this is a byte we're working with...

i almost feel like telling both of them and the others i found that their
calculators are broken pretty badly... so back to your immediate problem...


apparently your byte() is not working as desired?

perhaps byte() is in the wrong place? perhaps it should be
   foldlevelmask = not (byte(foldhiddenmask) or byte(currentfoldhiddenmask));

perhaps the top 8 bits need to be cleared by forcing them to zeros somehow if
the default size of a const is larger than a byte?

perhaps it should be specified that all four of foldhiddenbit, foldhiddenmask,
currentfoldhiddenbit, currentfoldhiddenmask are of byte instead of word or 
other?


const
   foldhiddenbit : byte = 7;
   foldhiddenmask : byte = 1 shl foldhiddenbit;
   currentfoldhiddenbit : byte = 6;
   currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit;
   foldlevelmask : byte = not (foldhiddenmask or currentfoldhiddenmask);
*or*
   foldlevelmask : byte = not (byte(foldhiddenmask) or 
byte(currentfoldhiddenmask));



NOTE: i do not currently have FPC (or lazarus) installed so i haven't tested
this in fpc... i needed some drive space a few weeks back and it was easiest to
remove fpc and lazarus at the time... especially since i had four or five
versions of each installed with full source code...


--
  NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Killing the mail list

2020-03-15 Thread Alexander Grotewohl
Not that I'm anyone special but I and many others who lurk for the most part 
would probably just lose track of the project.

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of Michael 
Van Canneyt 
Sent: Sunday, March 15, 2020 1:09:22 PM
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Killing the mail list



On Sun, 15 Mar 2020, Jonas Maebe wrote:

> On 15/03/2020 14:55, Ryan Joseph via fpc-pascal wrote:
>> Has there ever been any discussion into replacing it with a modern web based 
>> forum?
>
> There are web forums if you prefer them to using a mailing list:
> https://forum.lazarus.freepascal.org/ (see the forums under the "Free
> Pascal" header).
>
> There are no plans to remove the mailing lists.

Indeed, I hope not.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cannot find system type "__m64"

2020-03-06 Thread Alexander Grotewohl
tbh this list is off topic so very infrequently.. it's nice to see some "life" 
out there beyond our compilers :)

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of 
wkitt...@windstream.net 
Sent: Friday, March 6, 2020 1:46:44 PM
To: fpc-pascal@lists.freepascal.org 
Subject: Re: [fpc-pascal] Cannot find system type "__m64"

On 3/6/20 11:06 AM, Sven Barth via fpc-pascal wrote:
> mailto:wkitt...@windstream.net>> schrieb am Fr., 6.
> März 2020, 15:51:
>
> On 3/6/20 9:17 AM, Ryan Joseph via fpc-pascal wrote:
>  > Ok, I got this reply finally so maybe something else went wrong. I'm 
> tempting
>  > to try another account with some free email service because Gmail 
> never shows
>  > my initial post, which is annoying.
>
> i've written before, several years back, about gmail won't return you 
> your own
> posts even when you have the list specifically set to send your posts 
> back to
> you... yes, it is very very annoying... especially when you pop all your 
> mail
> from gmail into your own local storage and want those posts for proper
> threading...
>
> At least with Android Gmail as well as Thunderbird with IMAP I have no problem
> there. Though it might be the sent mail that I see in Thunderbird...


yep... getting your post back goes against the "view the conversation" mode
thing they have... i've never used IMAP and don't plan to any time soon so
getting my posts back from my mailing lists is important to me... especially
since i sync/archive everything on one main system... the others are all used
only for read access...

anyway... i'll stop my contribution to OT now ;)


--
  NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpbind ipv6 version

2019-10-27 Thread Alexander Grotewohl
I sent this direct to him on accident but I don't think it worked 
anyways (bounced?)


Just some test code so not very pretty. It works, but IN6ADDR_ANY was 
missing and I'm not familiar enough with ipv6 to know how it might be 
defined in other languages.


uses sockets;
const
    IN6ADDR_ANY: array[0..3] of longint = (0, 0, 0, 0);
    test: string = 'derp derp derp'#13#10;

var
    servsoc: longint;
    clientsoc: longint;
    serv, client: TInetSockAddr6;

    i, res: longint;
begin
    servsoc:=fpsocket(AF_INET6, SOCK_STREAM, 0);

    fillchar(serv, sizeof(serv), 0);
    serv.sin6_family:=AF_INET6;
    serv.sin6_port:=htons(1234);
    serv.sin6_addr.s6_addr32:=IN6ADDR_ANY;

    fpbind(servsoc, @serv, sizeof(serv));

    if (fplisten(servsoc, 10) < 0) then
        writeln('ow');

    i:=sizeof(client);
    clientsoc:=fpaccept(servsoc, @client, @i);
    if (clientsoc = -1) then
        writeln('ow');
    res:=fpsend(clientsoc, @test[1], length(test), 0);
    if (res = -1) then
        writeln('ow')
    else
        writeln(res);
    closesocket(clientsoc);
    closesocket(servsoc);
end.

On 10/27/2019 5:32 AM, Michael Van Canneyt wrote:



On Sat, 26 Oct 2019, Rainer Stratmann wrote:


https://www.freepascal.org/docs-html/current/rtl/sockets/fpbind.html

Is there an example for IPV6?

function fpbind(
 s: cint;
 addrx: psockaddr;
 addrlen: TSockLen
):cint;

I guess psockaddr is different in IPV6 version.


No, it does not have to be.. The addrlen will differ of course. That's 
why it is there to begin with. Maybe an overload could be added, I 
would need to look into this to see if

it is required.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] DecodeDate vs DecodeDateFully

2019-10-14 Thread Alexander Grotewohl
Returns true if it's a leap year according to source.--Alexander Grotewohlhttp://dcclost.comOn Oct 14, 2019 4:36 PM, Ched  wrote:Hello All,
I'm wondering why DecodeDate is a procedure and DecodeDateFully a function in SysUtils... And there is no 
description of the returned Boolean.
https://www.freepascal.org/docs-html/rtl/sysutils/decodedate.html
https://www.freepascal.org/docs-html/rtl/sysutils/decodedatefully.html
Cheers, Raoul
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Very vague gettickcount64 description?

2019-09-07 Thread Alexander Grotewohl
but the resolution is not a ms at all. every call to gettickcount is something like 10-15ms or so off. you'd be lucky to call it a ms after it was updated by the os. do we document that too?--Alexander Grotewohlhttp://dcclost.comOn Sep 7, 2019 7:41 PM, Martin Frb  wrote:On 07/09/2019 21:42, Zoe Peterson wrote:
> GetTickCount and GetTickCount64 are Windows API functions that are
> explicitly documented as returning milliseconds, and FPC on Unix up to
> now is has matched that. Why in the world would you think that
> changing that behavior would be a good idea, *especially* if you keep
> the function name the same?!?
>
> As an FPC user, this seems like an astoundingly bad decision to even
> be considering.
>
I do back that.
vague-ness or "the absence of documenting" is  not the same as (from the 
beginning on) documenting that "the unit is not given, *because* it may 
*vary*"
I would suggest to amend the documentation to the current state. 
Something like:

The length of a tick depends on the platform/OS/...
Therefore a tick can be a different amount of time on different targets.
For the following targets, the ticks are specified as follows. For other 
targets they may change, until documented.
Windows: tick = millisecond
Linux: tick = millisecond
OSx/Mac/Darwin: tick = ?
The minimum resolution may vary, and may be more than one tick.
The function itself may also take a varying amount of ticks, and the 
returned result may on top of resolution issues be outdated by any 
amount of ticks.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] += property bug?

2019-08-11 Thread Alexander Grotewohl

d.x += 10; // makes even more sense

On 8/11/2019 2:21 PM, Ryan Joseph wrote:



On Aug 11, 2019, at 11:41 AM, Sven Barth via fpc-pascal 
 wrote:

This is forbidden by design.

Why? It makes sense it should resolve to: d.setter(d.getter + 10) but maybe 
there’s a problem?

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] why isn't the 'exit' in the finally end clause executed?

2019-06-23 Thread Alexander Grotewohl
delphi apparently functions the same if I've read the docs right. something about returning control to the exception handler BEFORE your program gets control back.--Alexander Grotewohlhttp://dcclost.comOn Jun 23, 2019 3:08 AM, Dennis  wrote:Using fpc 3.0.4, Lazarus 2.0, the following simple program
program tryfinally;
begin
   try
     Writeln('before finally');
   finally
  Writeln('inside finally. Before Exit');
  exit; //tryfinally.exe
before finally
inside finally. Before Exit
after try finally block
I have tried putting the try finally block inside a procedure, the same 
happened.
program tryfinally;
procedure Test;
begin
     try
   Writeln('before finally');
     finally
    Writeln('inside finally. Before Exit');
    exit;
     end;
     Writeln('after try finally block');
end;
begin
   Test;
end.
Dennis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Getting multiple files from GetOpenFileNameA

2019-05-23 Thread Alexander Grotewohl
The whole structure is documented herehttps://docs.microsoft.com/en-us/windows/desktop/api/commdlg/ns-commdlg-tagofnaI just read through it and noticed that. My guess is anything that takes multiple strings that way.--Alexander Grotewohlhttp://dcclost.comOn May 23, 2019 12:09 PM, James Richters  wrote:I’m not clear about when they need one #0 or two.  I thought it was just .lpstrFile to make it clear there weren’t more file names in it.. so one #0 between each name and double #0 at the end.. maybe they all need double #0 at the end? James From: fpc-pascal  On Behalf Of Alexander GrotewohlSent: Thursday, May 23, 2019 11:56 AMTo: FPC-Pascal users discussions Subject: Re: [fpc-pascal] Getting multiple files from GetOpenFileNameA I did notice lpstrFilter is terminated by one #0 instead of two. Other than that not at a pc to test.--Alexander Grotewohlhttp://dcclost.com On May 23, 2019 7:52 AM, James Richters  wrote:I have put together a program that demonstrates the issue I am having.  I have re-structured it a bit to try to make it more clear where the problem is.While putting this together, I was able to get it to run fine with no problems if I did not try to put GetOpenFileNameA back to the directory of the last file I processed. Including a file sent in as a parameter.   If I set Open_File.lpstrFile:=Pchar(Target_File+#0+#0); where Target_File is the complete path and file name of the last file I processed,  If I select only one file, then the next time around it DOES work.. and will put me in the directory of Target_File and will show the filename of Target_File as a default, but if I select more than one file, the next time around, it crashes.. I have detailed the crash information in the sameple program comments.Another way I wish to run this is to leave Open_File.lpstrFile alone and use Open_File.lpstrInitialDir to put me in the directory of the last processed file, but not specify a default filename.  I can’t get this to work correctly at all, but if I use Open_File.lpstrInitialDir without Open_File.lpstrFile then it does not crash,  I am just not put in the directory I expect to be in.   Any Advice or suggestions on any of this, or on how I could improve the structure or methods of this program are greatly appreciated. James   {$mode objfpc}{$H+}//   https://docs.microsoft.com/en-us/windows/desktop/api/commdlg/nf-commdlg-getopenfilenamea//   https://docs.microsoft.com/en-us/windows/desktop/api/commdlg/ns-commdlg-tagofnaUses  sysutils,Windows,Commdlg,Classes,CRT;VarOpen_File  : TOpenFileNameA;ret    : array[0..10] of char;Filenum    : Word;Target_File    : AnsiString;File_Stringlist    : tstringList;{=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=}Procedure Display_File_StringList(Var Display_String_List:tStringList);Var  SL_Loop : Word;Begin   If Display_String_List.Count=0 then  Begin Textcolor(12); Writeln('0 Files Selected')  End   Else   If Display_String_List.Count=1 then  Begin TextColor(10); Writeln(Display_String_List[0]); Textcolor(14); Writeln('1 Files Selected');  End   Else  Begin TextColor(13); Writeln('Path for all files: ',Display_String_List[0]); TextColor(10); For SL_Loop:= 1 to Display_String_List.Count-1 Do    Writeln('File #',SL_Loop,': ',Display_String_List[SL_Loop]); Textcolor(14); Writeln(Display_String_List.Count-1,' Files Selected');  End;End;{=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=}Function Get_Files_Into_Stringlist(Var String_List:tStringList):Boolean;Var   Open_File_Result  : Boolean;   Position_of_Filename  : Word;Begin   String_List.Clear;   Open_File_Result:=GetOpenFileNameA(@Open_File);   If Open_File_Result then  Begin Position_of_Filename:=0; Repeat    String_List.add(StrPas(@Open_File.lpstrFile[Position_of_Filename]));    inc(Position_of_Filename,length(String_List[String_List.Count-1])+1); Until Open_File.lpstrFile[Position_of_Filename]=#0;  End;   Writeln(Open_File_Result);   Get_Files_Into_Stringlist:=Open_File_Result;End;{=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=}Procedure Process_File(Some_File: AnsiString);Begin   TextColor(11);   Writeln('Processing File: ',Some_File);End;{=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=}Begin {Main Program}   fillchar(Open_File, sizeof(Open_File), 0);   fillchar(ret, sizeof(ret), 0);   Open_File.lStructSize:=sizeof(Open_File);   Open_File.hwndOwner:=0;   Open_File.lpstrFile:=ret;   Open_File.lpstrFile[0]:=#0;   Open_File.nMaxFile:=10;   Open_File.Flags := OFN_EXPLORER or OFN_FILEMUSTEXIST or OFN_ALLOWMULTISELECT;   Open_File.lpstrDefExt:='.txt';   Open_File.lpstrTitle:='My Program - Open File';   Open_File.lpstrFilter:='All Files 

Re: [fpc-pascal] Getting multiple files from GetOpenFileNameA

2019-05-23 Thread Alexander Grotewohl
I did notice lpstrFilter is terminated by one #0 instead of two. Other than that not at a pc to test.--Alexander Grotewohlhttp://dcclost.comOn May 23, 2019 7:52 AM, James Richters  wrote:I have put together a program that demonstrates the issue I am having.  I have re-structured it a bit to try to make it more clear where the problem is.While putting this together, I was able to get it to run fine with no problems if I did not try to put GetOpenFileNameA back to the directory of the last file I processed. Including a file sent in as a parameter.   If I set Open_File.lpstrFile:=Pchar(Target_File+#0+#0); where Target_File is the complete path and file name of the last file I processed,  If I select only one file, then the next time around it DOES work.. and will put me in the directory of Target_File and will show the filename of Target_File as a default, but if I select more than one file, the next time around, it crashes.. I have detailed the crash information in the sameple program comments.Another way I wish to run this is to leave Open_File.lpstrFile alone and use Open_File.lpstrInitialDir to put me in the directory of the last processed file, but not specify a default filename.  I can’t get this to work correctly at all, but if I use Open_File.lpstrInitialDir without Open_File.lpstrFile then it does not crash,  I am just not put in the directory I expect to be in.   Any Advice or suggestions on any of this, or on how I could improve the structure or methods of this program are greatly appreciated. James   {$mode objfpc}{$H+}//   https://docs.microsoft.com/en-us/windows/desktop/api/commdlg/nf-commdlg-getopenfilenamea//   https://docs.microsoft.com/en-us/windows/desktop/api/commdlg/ns-commdlg-tagofnaUses  sysutils,Windows,Commdlg,Classes,CRT;VarOpen_File  : TOpenFileNameA;ret    : array[0..10] of char;Filenum    : Word;Target_File    : AnsiString;File_Stringlist    : tstringList;{=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=}Procedure Display_File_StringList(Var Display_String_List:tStringList);Var  SL_Loop : Word;Begin   If Display_String_List.Count=0 then  Begin Textcolor(12); Writeln('0 Files Selected')  End   Else   If Display_String_List.Count=1 then  Begin TextColor(10); Writeln(Display_String_List[0]); Textcolor(14); Writeln('1 Files Selected');  End   Else  Begin TextColor(13); Writeln('Path for all files: ',Display_String_List[0]); TextColor(10); For SL_Loop:= 1 to Display_String_List.Count-1 Do    Writeln('File #',SL_Loop,': ',Display_String_List[SL_Loop]); Textcolor(14); Writeln(Display_String_List.Count-1,' Files Selected');  End;End;{=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=}Function Get_Files_Into_Stringlist(Var String_List:tStringList):Boolean;Var   Open_File_Result  : Boolean;   Position_of_Filename  : Word;Begin   String_List.Clear;   Open_File_Result:=GetOpenFileNameA(@Open_File);   If Open_File_Result then  Begin Position_of_Filename:=0; Repeat    String_List.add(StrPas(@Open_File.lpstrFile[Position_of_Filename]));    inc(Position_of_Filename,length(String_List[String_List.Count-1])+1); Until Open_File.lpstrFile[Position_of_Filename]=#0;  End;   Writeln(Open_File_Result);   Get_Files_Into_Stringlist:=Open_File_Result;End;{=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=}Procedure Process_File(Some_File: AnsiString);Begin   TextColor(11);   Writeln('Processing File: ',Some_File);End;{=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=}Begin {Main Program}   fillchar(Open_File, sizeof(Open_File), 0);   fillchar(ret, sizeof(ret), 0);   Open_File.lStructSize:=sizeof(Open_File);   Open_File.hwndOwner:=0;   Open_File.lpstrFile:=ret;   Open_File.lpstrFile[0]:=#0;   Open_File.nMaxFile:=10;   Open_File.Flags := OFN_EXPLORER or OFN_FILEMUSTEXIST or OFN_ALLOWMULTISELECT;   Open_File.lpstrDefExt:='.txt';   Open_File.lpstrTitle:='My Program - Open File';   Open_File.lpstrFilter:='All Files (*.*)'+#0+'*.*'+#0;   File_Stringlist:=TStringlist.Create;   If paramstr(1)<>'' then  Begin Target_File:=paramstr(1); Process_File(Target_File);  End   else  Target_File:='';   Repeat  If Target_File<>'' then Begin    // The following line seems to cause my program to crash.    // It does seem to work as I expect.  It puts me in the directory    // of the file and shows the file name, but for some reason if I select    // more than one file than I get    // An unhandled exception occurred at $0040B428:    // EAccessViolation:    // $0040B428    // $0040A03D    // $00414447    // $0040AE1E    // $0040A03D    // $00414447    // 

Re: [fpc-pascal] Debug Advice needed

2019-05-21 Thread Alexander Grotewohl
I'm not sure your familiarity with debuggers but you would set a breakpoint inside your code and step through until it crashes, perhaps watching a few variables to ensure their contents are correct.Since it would work similar to turbo pascal and by extension, more modern "clone"/work-alikes, the virtual pascal VP21USER.PDF debugging section might be useful for learning that stuff.--Alexander Grotewohlhttp://dcclost.comOn May 21, 2019 7:34 AM, James Richters  wrote:I have this program that is confounding me.    It obtains a file name with GetOpenFileNameA then it processes the file and draws stuff on the screen, then loops back and gets another file name until GetOpenFileNameA returns a false… so as long as I keep giving it files it keeps running and if I cancel the file selection, it exits.    It will run in a loop like this various numbers of times… sometimes 4 times, sometimes 8 times, sometimes twice, sometimes 30 times and then I get this access violation like this: An unhandled exception occurred at $0040ED07:EAccessViolation: Access violation  $0040ED07  $00411A6C  $00411F25  $00402255  PLOTDRAWPAX,  line 76 of i:/programming/gcode/mill/plotdraw.pax.pas  $00402705  main,  line 119 of i:/programming/gcode/mill/plotdraw.pax.pas Line 76 is the a call to a procedure in another unit that’s very complicated and calls a lot of other functions and procedures.I keep testing with the same 5 files over and over, and each file has processed fine many times so there isn’t a problem with the data in my files or the way I am processing it….  and there doesn’t seem to be a particular file that causes this.   I’m thinking I have some memory issue or something is not freeing or ?  It’s also not always the same exact message.. sometimes I get  An unhandled exception occurred at $0040ED07:EAccessViolation: Access violation  $0040ED07  $004026DB  main,  line 118 of i:/programming/gcode/mill/plotdraw.pax.pas Line 118 is a call to a function that is in no way related to the procedure that is called on line 76… it’s actually a ridiculously simple function.  Exactly one line of code to it, and I have run that function millions of times with other programs that use the same unit. The FPC text IDE is reporting runtime error 217 which doesn’t tell me much.. just an unhandled exception occurred. My question is… how do I track these kinds of things down?    Is there a way I can use the hex addresses to see more precisely what caused the error?  I’m confused why sometimes I get very detailed debug reports that get me to the exact command that caused the problem and other times I have some information but then it just stops and I have nothing following the hex addresses. James___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] The keyboard unit

2019-05-10 Thread Alexander Grotewohl
if it's not being used, remove it :)but really though, do any of the fleshed out examples on the website work? like the one from here?:https://www.freepascal.org/docs-html/rtl/keyboard/getkeyevent.html--Alexander Grotewohlhttp://dcclost.com___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Record helper properties

2019-04-23 Thread Alexander Grotewohl
http://wiki.freepascal.org/Helper_typesunder the checklistbox extender example.I'd guess it's looking for THelper.GetX and THelper.SetX in your  and not finding them--Alexander Grotewohlhttp://dcclost.com___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] how to customize so Pandroid would be usable from Lazarus for windows

2019-04-18 Thread Alexander Grotewohl

Don't bring OS/2 into this. The creators of REXX are saints. lmao

On 4/18/19 7:48 PM, Tomas Hajny wrote:

On Thu, April 18, 2019 20:33, Sven Barth via fpc-pascal wrote:

  .
  .

Huh? What about

=== code begin ===

if CONDITION (
      BLA1
      BLA2
      BLA3
)

=== code end ===

I'm using that construct quite often at work...

OK, sorry; MS managed to make at least some progress in batch files since
the DOS (and OS/2) times, I wasn't aware of that. ;-) I didn't miss it
though, because the goto and call solutions still allow handling all
required cases.

Tomas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC-based http/s server

2018-12-10 Thread Alexander Grotewohl
Mr. Bee, you could use stunnel in the meantime, and look into 
implementing fcgi into simpleserver? :)


What's your objective? Small servers like mini_httpd can be made to run 
freepascal binaries with little fuss, and would be sufficient for 
everything up until professional usage. At which point I would advise 
using apache or nginx anyways.


Michael, neat, didn't know that was in there. Will have to check it out.

Alex

On 12/10/2018 6:08 AM, Michael Van Canneyt wrote:



On Mon, 10 Dec 2018, Mr Bee via fpc-pascal wrote:

Hi all, Is there any open source, maintained and updated HTTP server 
using

FPC out there?  I need a lightweight HTTP server written in FPC that
supports Linux/Unix, F/CGI app, and HTTPS.  It'd be better if it doesn't
need external or third-party units such as Indy or Synapse, but only 
pure
FPC standard units such as fpHTTP* and fpWeb* units.  Google only 
gave me

some old (back to early 2000) and abandoned projects written in Delphi
mixed with inline assembler and Windows' API, also don't support HTTPS.


FPC has a HTTP server. See the simpleserver demo under fcl-web.

It does not support https yet, but this is planned for the near future.
(I expect to work on it between this Christmas and new year)

It does not support forwarding requests to (F)CGI but this is easy 
enough to

add.

Michael.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Windows programming tutorials for FPC

2018-11-12 Thread Alexander Grotewohl

This line:

Writeln(GetSaveFileNameA(@TFilename));

What does it write when you select a file vs when you click x/cancel?
:-):-)

On 11/12/2018 4:31 AM, James wrote:

I've been using the example below to use the Save-as dialog in my console 
program, and it works great, but I would like to be able to detect if the user 
pushes either the red X or the cancel button in the dialog.   I am supplying a 
suggested default name, and what's happening is if the user cancels or hits the 
red X, it just saves the file using the suggested default name, but the correct 
behavior would be to not save anything.   I'm not sure how this is normally 
done with GetSaveFileNameA.


-Original Message-
From: fpc-pascal  On Behalf Of 
Alexander Grotewohl
Sent: Sunday, November 4, 2018 11:48 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Windows programming tutorials for FPC

Program TestGetSaveFileNameA;
Uses windows, commdlg;

Var
 TFilename  : TOpenFileNameA;

 ret: array[0..100] of char;

Begin
 Writeln('Start');

 fillchar(TFileName, sizeof(TFileName), 0);
 TFileName.lStructSize:=sizeof(TFileName);

 TFileName.hwndOwner:=0;
 TFileName.lpstrFile:=ret;
 TFileName.lpstrFile[0]:=#0;
 TFileName.lpstrFilter:='Text Files (*.txt)'+#0+'*.txt'+#0;
 TFileName.nMaxFile:=100;
 TFileName.Flags := OFN_EXPLORER or OFN_FILEMUSTEXIST or OFN_HIDEREADONLY;
 TFileName.lpstrDefExt:='txt';

 Writeln(GetSaveFileNameA(@TFilename));
 Writeln('Finished with '+strpas(TFileName.lpstrFile));
 Readln;
End.


On 11/4/2018 11:21 AM, James wrote:

This is very interesting, thank you for the code on how to define the 
GetSaveFileNameA function.  I wrote a sample program to get it to work, but I 
think I have some syntax wrong, or maybe I'm not initializing something 
correctly.   It compiles ok, but it doesn't execute even my writeln's, I just 
get an exit code = 1

James

Program TestGetSaveFileNameA;
Uses CRT,Classes,Sysutils,windows;
Type
TOpenFileNameAHookProc = function(Wnd: HWND; Msg: UINT; wParam:
WPARAM;
lParam: LPARAM): UINT stdcall;

TOpenFileNameA = Packed Record
lStructSize: DWord;
hWndOwner: HWND;
hInstance: HINST;
lpstrFilter: PChar;
lpstrCustomFilter: PChar;
nMaxCustFilter: DWord;
nFilterIndex: DWord;
lpstrFile: PChar;
nMaxFile: DWord;
lpstrFileTitle: PChar;
nMaxFileTitle: DWord;
lpstrInitialDir: PChar;
lpstrTitle: PChar;
Flags: DWord;
nFileOffset: Word;
nFileExtension: Word;
lpstrDefExt: PChar;
lCustData: LPARAM;
lpfnHook: TOpenFileNameAHookProc;
lpTemplateName: PChar;
lpEditInfo: Pointer;// Undocumented?
lpstrPrompt: PChar;
_Reserved1: Pointer;
_Reserved2: DWord;
FlagsEx: DWord;
End;
POpenFileNameA = ^TOpenFileNameA;

Function GetSaveFileNameA(arg: POpenFileNameA): windows.bool; stdcall;
external 'comdlg32' name 'GetSaveFileNameA';

Var
 TFilename  : TOpenFileNameA;
 PFilename  : POpenFileNameA;

Begin
 Writeln('Start');
 TFilename.lpstrInitialDir:=Pchar('I:\');
 Pfilename:=@Tfilename;
 Writeln(GetSaveFileNameA(PFilename));
 Writeln('Finished');
 Readln;
End.





-Original Message-
From: fpc-pascal  On Behalf
Of Ewald
Sent: Sunday, November 4, 2018 8:06 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Windows programming tutorials for FPC

On 11/03/2018 09:04 PM, James wrote:

So my question is, how can I use Ifilesavedialog with just FreePascal
in a console application?

First off, the IFileSaveDialog is an interface, not a simple function.
So, you'll need to:
- Include the right units from freepascal (ActiveX and comobj
 IIRC)
- Initialize and finalize the COM subsystem (see CoInitialize
 and CoUninitialize)
- Use the CoCreateInstance to instantiate an IFileSaveDialog,
 etc.. I've never used the IFileSaveDialog myself, so have a
 look at
https://msdn.microsoft.com/en-us/library/windows/desktop/bb776913%28v=
vs.85%29.aspx#usage

That's the nice thing about the GetSaveFileNameA function: one call,
and you're done :-)

Now, if this function is not defined in the windows unit (which could
be the case), you can either look into some other units or simply
define it
yourself:

=== code begin ===
Type
TOpenFileNameAHookProc = function(Wnd: HWND; Msg: UINT; wParam:
WPARAM;
lParam: LPARAM): UINT stdcall;

TOpenFileNameA = Packed Record
lStructSize: DWord

Re: [fpc-pascal] Windows programming tutorials for FPC

2018-11-04 Thread Alexander Grotewohl

Program TestGetSaveFileNameA;
Uses windows, commdlg;

Var
   TFilename  : TOpenFileNameA;

   ret: array[0..100] of char;

Begin
   Writeln('Start');

   fillchar(TFileName, sizeof(TFileName), 0);
   TFileName.lStructSize:=sizeof(TFileName);

   TFileName.hwndOwner:=0;
   TFileName.lpstrFile:=ret;
   TFileName.lpstrFile[0]:=#0;
   TFileName.lpstrFilter:='Text Files (*.txt)'+#0+'*.txt'+#0;
   TFileName.nMaxFile:=100;
   TFileName.Flags := OFN_EXPLORER or OFN_FILEMUSTEXIST or 
OFN_HIDEREADONLY;

   TFileName.lpstrDefExt:='txt';

   Writeln(GetSaveFileNameA(@TFilename));
   Writeln('Finished with '+strpas(TFileName.lpstrFile));
   Readln;
End.


On 11/4/2018 11:21 AM, James wrote:

This is very interesting, thank you for the code on how to define the 
GetSaveFileNameA function.  I wrote a sample program to get it to work, but I 
think I have some syntax wrong, or maybe I'm not initializing something 
correctly.   It compiles ok, but it doesn't execute even my writeln's, I just 
get an exit code = 1

James

Program TestGetSaveFileNameA;
Uses CRT,Classes,Sysutils,windows;
Type
TOpenFileNameAHookProc = function(Wnd: HWND; Msg: UINT; wParam: WPARAM;
lParam: LPARAM): UINT stdcall;

TOpenFileNameA = Packed Record
lStructSize: DWord;
hWndOwner: HWND;
hInstance: HINST;
lpstrFilter: PChar;
lpstrCustomFilter: PChar;
nMaxCustFilter: DWord;
nFilterIndex: DWord;
lpstrFile: PChar;
nMaxFile: DWord;
lpstrFileTitle: PChar;
nMaxFileTitle: DWord;
lpstrInitialDir: PChar;
lpstrTitle: PChar;
Flags: DWord;
nFileOffset: Word;
nFileExtension: Word;
lpstrDefExt: PChar;
lCustData: LPARAM;
lpfnHook: TOpenFileNameAHookProc;
lpTemplateName: PChar;
lpEditInfo: Pointer;// Undocumented?
lpstrPrompt: PChar;
_Reserved1: Pointer;
_Reserved2: DWord;
FlagsEx: DWord;
End;
POpenFileNameA = ^TOpenFileNameA;

Function GetSaveFileNameA(arg: POpenFileNameA): windows.bool; stdcall; external 
'comdlg32' name 'GetSaveFileNameA';

Var
TFilename  : TOpenFileNameA;
PFilename  : POpenFileNameA;

Begin
Writeln('Start');
TFilename.lpstrInitialDir:=Pchar('I:\');
Pfilename:=@Tfilename;
Writeln(GetSaveFileNameA(PFilename));
Writeln('Finished');
Readln;
End.





-Original Message-
From: fpc-pascal  On Behalf Of Ewald
Sent: Sunday, November 4, 2018 8:06 AM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Windows programming tutorials for FPC

On 11/03/2018 09:04 PM, James wrote:

So my question is, how can I use Ifilesavedialog with just FreePascal
in a console application?

First off, the IFileSaveDialog is an interface, not a simple function.
So, you'll need to:
- Include the right units from freepascal (ActiveX and comobj
IIRC)
- Initialize and finalize the COM subsystem (see CoInitialize
and CoUninitialize)
- Use the CoCreateInstance to instantiate an IFileSaveDialog,
etc.. I've never used the IFileSaveDialog myself, so have a
look at
https://msdn.microsoft.com/en-us/library/windows/desktop/bb776913%28v=vs.85%29.aspx#usage

That's the nice thing about the GetSaveFileNameA function: one call, and you're 
done :-)

Now, if this function is not defined in the windows unit (which could be the 
case), you can either look into some other units or simply define it
yourself:

=== code begin ===
Type
TOpenFileNameAHookProc = function(Wnd: HWND; Msg: UINT; wParam: WPARAM;
lParam: LPARAM): UINT stdcall;

TOpenFileNameA = Packed Record
lStructSize: DWord;
hWndOwner: HWND;
hInstance: HINST;
lpstrFilter: PChar;
lpstrCustomFilter: PChar;
nMaxCustFilter: DWord;
nFilterIndex: DWord;
lpstrFile: PChar;
nMaxFile: DWord;
lpstrFileTitle: PChar;
nMaxFileTitle: DWord;
lpstrInitialDir: PChar;
lpstrTitle: PChar;
Flags: DWord;
nFileOffset: Word;
nFileExtension: Word;
lpstrDefExt: PChar;
lCustData: LPARAM;
lpfnHook: TOpenFileNameAHookProc;
lpTemplateName: PChar;
lpEditInfo: Pointer;// Undocumented?
lpstrPrompt: PChar;
_Reserved1: Pointer;
_Reserved2: DWord;
FlagsEx: DWord;
End;

Re: [fpc-pascal] Using REST based Services

2018-10-08 Thread Alexander Grotewohl
A bit off topic for the list but I've used a program called "Insomnia" 
which is a client for debugging REST APIs and it was incredibly handy. 
Especially so you don't try everything under the sun before, for 
example, realizing your API key is incorrect.


Alex


On 10/7/2018 4:03 PM, Marc Santhoff wrote:

On Sun, 2018-10-07 at 00:23 +0200, Michael Van Canneyt wrote:

On Sat, 6 Oct 2018, Marc Santhoff wrote:


Hi,

being rather agnostic regarding web techniques I have to ask:

What module or unit is best for being used when calling web services?

fphttpclient is what you need.

OK, fine. I have used that already.


I want to try using Apache Tika running as a server for extracting the
contents of files. Files are transferred using HTTP PUT method-

See there for a quick overview:
https://wiki.apache.org/tika/TikaJAXRS#Services

Rest services are not very standardized. Each service is different, and
therefor the lowest common denominator is the use of the HTTP protocol.

I see. It is simple enough to put a request together like when using curl in a
terminal.


Which is exactly what is encapsulated in the fphttpclient unit.

The demo programs for fphttpclient should get you going.

Many thanks!
Marc



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Management operators question

2018-05-25 Thread Alexander Grotewohl

I don't really know why this NewPascal stuff is on this mailing list.


On 05/25/2018 11:59 AM, Maciej Izak wrote:
2018-05-25 16:10 GMT+02:00 Tomas Hajny >:


I assume that the functionality added to trunk (and as far as I
remember
also announced in the list) was finished to the extent that it
works and
may be used (although with some possible limitations), otherwise there
would be no sense in adding it to trunk at all. As such, it's as
supported
as any other part of FPC (i.e. bug reports and feature requests may be
created, etc.). If it doesn't work and noone can fix it, it might be
removed (as with any other unfinished and not working feature), but I
don't have any information about this. Could we focus the
discussion to
real problems, if necessary, rather then speculations?


Sorry if any part of my message sounds like speculation. Is really 
hard to say anything without communication with core team (almost no 
communication - just ban). I was asking/talking in more private or 
public places but almost no one was interested to write any concrete 
reply.


I am always trying to act like professional, sometimes it is hard :). 
For sure removing MO from trunk is not good for me and means more work 
on my side for NewPascal, but the main goal of MO was introduction of 
smart pointers, nullable types and simplified ARC objects. Also in 
this context FastRTTI is very important, more extensive usage of smart 
pointers/nullable types/arc objects mean much faster final code. Every 
element is related: FastRTTI , MO and all smart pointers variants. So 
removing MO from trunk has sense if FastRTTI is not finished or smart 
pointers are not planned in near time.


If any of the core member is interested to finish this (FastRTTI, 
smart pointers, etc) I will be very happy, finally core has many more 
talented programmers than me. If someone other will finish this I will 
be happy too (finally the end effect will be good or even better for 
whole community).


Also the good solution may be to remove temporary MO from trunk, I can 
finish this in NewPascal (maybe I will be able to create more end-user 
friendly form, so temporary may be good to not break 
backward-compatibility) and we can talk how to merge things back.


I am always opened to any cooperation. For less frustration for both 
sides would be good to keeps both projects alive. I can continue 
NewPascal with my ideas and vision but at the same time I see no 
reason why FPC should not benefit from my work in less "neuralgic" 
code parts. If the core will change opinions about new features from 
NewPascal (I can also change any features or re-implement any of 
feature if FPC core wish that) any of feature can be merged back into 
FPC trunk. IMO this path is beneficial for all. In the worst scenario 
I will "burn out" (which is not planned by me) but in general FPC will 
be better.


--
Best regards,
Maciej Izak


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Copy dynamic array

2018-05-16 Thread Alexander Grotewohl
What would the expected behavior be for pointers inside records? What if 
the record is actually a linked list? Or includes classes and objects? 
Do we run the constructor or no? If the record has file handles do we 
attempt to recreate their state? (perhaps running assign again, and 
crossing our fingers the file hasn't been deleted - which at least on 
Linux is definitely possible)


On 05/16/2018 04:24 AM, denisgolovan wrote:

Doing the same conceptual thing using different syntax does not seem right as 
generics, macros and other nice stuff become clumsy and too verbose.

See

//
program project1;
{$mode objfpc}

type
TRec= record
   A:array of integer;
   S:string;
end;

var R1,R2:TRec;
begin
SetLength(R1.A, 3);
R1.A[0]:=1;
R1.A[1]:=2;
R1.A[2]:=3;
R1.S:='123';

R2:=R1; // shallow copying <> full clone
R2.A[0]:=10;
R2.S[1]:='S';

// does not work as expected (no copy-on-write/cloning)
writeln(R1.A[0]); // prints 10
writeln(R2.A[0]); // prints 10

// works fine
writeln(R1.S[1]); // prints 1
writeln(R2.S[1]); // prints S
end.
//

BR,
Denis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Copy dynamic array

2018-05-15 Thread Alexander Grotewohl
I should probably also note that you shouldn't use move with records 
that have ansistrings or other dynamically allocated variables in them..



On 5/15/2018 6:49 PM, Alexander Grotewohl wrote:

type
  TRec = record
    s1:string;
    i1:integer;
  end;

var
  S1,S2:string;
  R1,R2:TRec;
begin
  S1:='123';
  S2:=S1; // lol

  R1.s1:='123';
  R1.i1:=1;
  move(R1, R2, sizeof(TRec));
  writeln(R2.s1, ' ', R2.i1);
end.


On 5/15/2018 2:39 PM, denisgolovan wrote:

Well.

"Copy" works for arrays only.
Neither strings nor records work.
Tested in pretty old svn rev. 37656

//=
program project1;

{$mode objfpc}{$H+}

type
   TRec = record
 s1:string;
 i1:integer;
   end;

var S1,S2:string;
 A1,A2:array of integer;
 R1,R2:TRec;
begin
   A1:=[1,2,3];
   A2:=Copy(A1);
   A2[0]:=10;
   writeln(A1[0]);
   writeln(A2[0]);

   S1:='123';
   S2:=Copy(S1);

   R1.s1:='123';
   R1.i1:=1;
   R2:=Copy(R1);
end.
//===

BR,
Denis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Copy dynamic array

2018-05-15 Thread Alexander Grotewohl

type
  TRec = record
s1:string;
i1:integer;
  end;

var
  S1,S2:string;
  R1,R2:TRec;
begin
  S1:='123';
  S2:=S1; // lol

  R1.s1:='123';
  R1.i1:=1;
  move(R1, R2, sizeof(TRec));
  writeln(R2.s1, ' ', R2.i1);
end.


On 5/15/2018 2:39 PM, denisgolovan wrote:

Well.

"Copy" works for arrays only.
Neither strings nor records work.
Tested in pretty old svn rev. 37656

//=
program project1;

{$mode objfpc}{$H+}

type
   TRec = record
 s1:string;
 i1:integer;
   end;

var S1,S2:string;
 A1,A2:array of integer;
 R1,R2:TRec;
begin
   A1:=[1,2,3];
   A2:=Copy(A1);
   A2[0]:=10;
   writeln(A1[0]);
   writeln(A2[0]);

   S1:='123';
   S2:=Copy(S1);

   R1.s1:='123';
   R1.i1:=1;
   R2:=Copy(R1);
end.
//===

BR,
Denis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC on Android tablets: ARM, x86_64

2018-05-11 Thread Alexander Grotewohl
FPC for ARM works correctly with termux, but the program to generate 
fpc.cfg does not, requiring some manual configuration to get it to find 
the included units, etc.



On 05/10/2018 07:19 AM, Mark Morgan Lloyd wrote:
Has anybody come across https://wiki.termux.com/wiki/Main_Page which 
I've seen mentioned elsewhere?


It's supposedly a Linux environment into which one can install 
standard development tools etc.




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Stack alias for ARC like memory management?

2018-04-25 Thread Alexander Grotewohl
Well with an attitude like that, here's hoping you leave the pascal 
community sooner than later :)



On 04/25/2018 11:19 AM, Ryan Joseph wrote:



On Apr 25, 2018, at 10:07 PM, Alexander Grotewohl <a...@dcclost.com> wrote:

At work I've recently used Free Pascal to interface our accounting system to 
our WordPress WooCommerce store using Free Pascal's built in JSON support, 
fphttpclient, etc.

I could list off a bunch of new languages with goofy names that could have done 
it, but Free Pascal did it just fine.

If all your writing is a one pass script then JSON and HTTP is so easy with 
PHP. Anytime I’m looking to write some crappy code that works just well enough 
for the task I go to PHP. I’m surprised they let you use Pascal at work even. :)

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Stack alias for ARC like memory management?

2018-04-25 Thread Alexander Grotewohl
At work I've recently used Free Pascal to interface our accounting 
system to our WordPress WooCommerce store using Free Pascal's built in 
JSON support, fphttpclient, etc.


I could list off a bunch of new languages with goofy names that could 
have done it, but Free Pascal did it just fine.


Just a few years ago I might have been writing a wrapper around someone 
else's command line utility or trying to interface with some DLL file 
written in C/C++


That stuff is definitely a huge deal. :) (and to whomever might be 
reading this that worked on those, thanks!)



On 04/25/2018 10:18 AM, Michael Van Canneyt wrote:



On Wed, 25 Apr 2018, Ryan Joseph wrote:




On Apr 25, 2018, at 8:42 PM, Michael Van Canneyt 
 wrote:


'make it competitive with new entries in the market' is not a goal 
of the

free pascal team.

This is a hobby project for most devs. Monetary gain is not a goal.

Probably sounds like an anachronism in this day and age, but there 
you are...


That’s what I thought initially.  I understand Pascal is a hobby for 
many

here and they’re doing their best to keep the language alive in the face
of an ever changing market.  Personally I just want Pascal to be the 
best

it can be so I can continue to use it in the future without making more
and more compromises in productivity.


I want the same for pascal.

But I really still need to see convincing evidence that language 
features contribute to productivity.


Available libraries for common programming tasks - and I mean this on 
a high-level

level - are infinitely more important, so I don't need to get down to the
gory details of many tasks:

* Creating a PDF. * Creating a good-looking report from Data. * Have 
an API that reads google protocol data.

* A good ORM/OPF.
* Reading a smartcard.
* Access a Google,Facebook,Twitter, MS or what-have-you-not REST API. 
* A wizard that makes a Data entry form based on a TDataset or object.

* Classes to make a REST API.
* Classes to make/consume a SOAP service.
* Code that transforms a JSON structure to object classes plus the 
code to

* read/write the JSON.

These are things that make me win time.

a low-level feature such as Memory management is really the least of 
my worries. Use TComponent or reference counted interfaces if such 
things bothers you.


Michael.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] pointerful

2018-04-22 Thread Alexander Grotewohl

imagine a linked list.. with nothing but the pointers.. lol


On 4/22/2018 1:05 PM, Jonas Maebe wrote:

On 22/04/18 17:00, Mattias Gaertner wrote:


Is this a bug or a feature:

type
   Pint = ^int;
   int = PInt;

?


It's a bug.


Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Where to download OpenSSL (for windows 64 bit) that is used by fphttpclient

2018-04-18 Thread Alexander Grotewohl

IIRC I used these: http://gnuwin32.sourceforge.net/packages/openssl.htm

Not sure about the file naming, but just put the .dll files in the same 
directory as your executable. You'll know pretty quick if it works :)



On 04/18/2018 12:57 PM, Dennis wrote:
According to http://wiki.lazarus.freepascal.org/fphttpclient, I need 
the openssl library if I want to use fphttpclient for 
https://www.yahoo.com/


From the wiki, it went to https://wiki.openssl.org/index.php/Binaries 
for the binary dll but I tried the link https://indy.fulgan.com/SSL/  
in the wiki and it did not work.


Anyone with a successful experience can give me a direct url for the 
openssl dll?


By the way, for those zip files I tried, although they are named 
xxx-win64, the dll contained in them are named ssleay32.dll and 
libeay32.dll.

Is that normal for a win64 bit dll to be named xxx32.dll?

Dennis
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] The unfortunate deprecation of GetTickCount

2018-04-11 Thread Alexander Grotewohl
Just to be clear, the 64 in GetTickCount64 has nothing to do with 
whether a machine is 32bit or 64bit.


Alex


On 04/11/2018 01:23 PM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Wed, 11 Apr 2018, Michael Van Canneyt wrote:


personally I use this 64 bit emulation:

For my purpose I'm perfectly happy with GetTickCount. I'd understand the
deprecation if GetTickCount64 would be a reliable substitute. It isn't.

Only on XP. On all other platforms, it is the better solution.

Actually... I kinda disklike this depreciation too. Better is just such a
bad word for software engineering. (Almost) everything has its purpose.

GetTickCount is clearly a Windows API function, does not directly exist in
Delphi itself, so this is an FPC addition to the Sysutils unit for
Delphi-compatible platform idependence - and to my knowledge, Microsoft
did not deprecate the 32bit variant, instead it documented that it rolls
over after 49.7 days, which we could also do just fine.

Especially because extending the result to 64bit is *NOT* the only way to
get around the 32bit overflow problem of a timer, and for a lot of
purposes it's perfectly fine, especially on 32bit systems, which are still
numerous.

Which means, the workaround for the deprecation message on Windows is
actually using the GetTickCount from Windows unit directly, which is
supported everywhere and even Delphi compatible (no GetTickCount/64 in
sysutils there, according to the docs I can find, but fix me?).

BTW, for additional fun, the Windows RTL system unit itself still uses
the 32bit Windows API GetTickCount to initialize its RandSeed...

Charlie
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] The unfortunate deprecation of GetTickCount

2018-04-11 Thread Alexander Grotewohl
It's deprecated by Microsoft. If I had to guess, it's likely not going 
anywhere until 32bit binary support in Windows is long gone.


Should you use GetTickCount on any Windows system that supports 
(natively) GetTickCount64? NO, not in new code.


That's exactly what deprecated means.

IMO compiling code targeting Windows >= Vista that has GetTickCount in 
it is no good.


Alex


On 04/11/2018 12:57 PM, Luca Olivetti wrote:

El 11/04/18 a les 18:42, Michael Van Canneyt ha escrit:



On Wed, 11 Apr 2018, Luca Olivetti wrote:


El 11/04/18 a les 13:59, Tobias Giesen ha escrit:

Hello,

personally I use this 64 bit emulation:


For my purpose I'm perfectly happy with GetTickCount. I'd understand 
the deprecation if GetTickCount64 would be a reliable substitute. It 
isn't.


Only on XP. On all other platforms, it is the better solution.


It depends. If you just want to keep track of intervals less than 49 
days, GetTickCount is perfectly good (provided you cast the difference 
between the current tick and the previous one to dword) *and* it works 
on XP (which, unfortunately, I still have to support).

I see no reason to deprecate it.

BTW, advancedipc.pp uses

  until (GetTickCount64-xStart > aTimeOut);

so it could hang if used in windows XP.


Bye


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] The unfortunate deprecation of GetTickCount

2018-04-11 Thread Alexander Grotewohl
The documentation seems fine. I can use it to approximate that a minute 
has elapsed, or to keep track of frames per second for a game, but I'm 
not going to use it to control complex machinery.


The GetTickCount documentation offers that most system timers are within 
the 10 to 16 millisecond range. So if windows (internally) updates 
GetTickCount every millisecond, it's count might look like this from boot:






- 10 more times
0014
0014
0014
0014
0014
- maybe 9 more times
0027
0027
0027
0027
0027
- maybe 8 or 9 more times
0042

So in this example, if you want to time something to happen EXACTLY 
every 10 milliseconds, you'd miss 10ms by 4, 20ms by 7, and you'd skip 30ms.


This is why you do stuff like:

if (gettickcount - previous) > 10 then /* do something here */


A solution for the gettickcount overflow I liked was something like:

current:=gettickcount;
if (current >= previous) then
elapsed:=current - previous
else
elapsed:=(high(dword) - previous) + current;
previous:=current;
if (elapsed > ...)


Alex


On 04/11/2018 09:40 AM, Paulo Costa wrote:

Unfortunate is the obscure wording you find on the documentation:

https://www.freepascal.org/docs-html/rtl/sysutils/gettickcount.html

"Description
GetTickCount returns an increasing clock tick count. It is useful for 
time measurements, but no assumtions should be made as to the interval 
between the ticks. This function is provided for Delphi compatibility, 
use GetTickCount64 instead."


One would think that GetTickCount64 would clarify things about the 
interval between the ticks (just to be useful for time measurements) but:

https://www.freepascal.org/docs-html/rtl/sysutils/gettickcount64.html

"Description
GetTickCount64 returns an increasing clock tick count. It is useful 
for time measurements, but no assumtions should be made as to the 
interval between the ticks."


How can it be useful for time measurements if we don't know the units?

Contrast to the Microsoft Documentation:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724408(v=vs.85).aspx 



"Return value
The return value is the number of milliseconds that have elapsed since 
the system was started."


Of course, it is followed by some remarks about the real limitations 
but at least we have some idea on what to expect.


I know that, by being cross platform, GetTickCount64 can behave in 
different ways on other environments but, just because of that, the 
user should not be kept in the dark when using it.


I know that the documentation effort is hard and many times we don't 
appreciate the effort as we should, but please don't be so vague on 
this entry.


Paulo Costa
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Inline scoped enums

2018-04-07 Thread Alexander Grotewohl
indeed. there are other type declarations where 'set of' is valid, so 
maybe it inadvertently piggybacks on those


to correct the code.. something like:

{$scopedenums on}
type
  bar = (a, b, c);
var
  foo: set of bar;
begin
  foo:=[bar.a, bar.c];
  if bar.a in foo then
writeln('yay obscure pascal features! :)');
end.

On 4/7/2018 9:33 PM, Роман via fpc-pascal wrote:

>> How can this code
>> {$scopedenums on}
>> type
>> Bar = set of (A, B, C);
>> refer to A, B, C?
> Bar.A
>
Actually Bar.A won't work, notice the "set of".
Same problem with var x: (a, b, c).
I wonder could they make such code to not compile at all...
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Prorammatically sending file using HTTP POST?

2018-04-07 Thread Alexander Grotewohl
Those newsgroups are a horrid suggestion. The most recent messages are 
from 2016. It seems they only leave it up for posterity.



On 04/07/2018 05:13 AM, Graeme Geldenhuys wrote:

On 2018-04-04 16:05, Bo Berglund wrote:

Yes, I use Indy since the Delphi days but I have not used it to send
files before.

Yes, there is no problem in using Indy with FPC - I've done it for
years. So no need to switch components.


Indy has a TIdHTTP object/component, which presumably can be used but
there are no good examples

Have you actually tried asking the question in the official Indy support
newsgroup?

   NNTP Server:  news.atozed.com
   Groups:  atozedsoftware.indy.general
atozedsoftware.indy.fpc
atozedsoftware.indy.protocol.*
atozedsoftware.indy.non-tech
... and many others

I've always gotten very quick responses from them.

Have you tried this?

 http://lmgtfy.com/?q=delphi+indy+sending+file+via+http+post

I see many answers listed there. ;-)


Regards,
   Graeme



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Proposal for new Free Pascal logo

2018-04-01 Thread Alexander Grotewohl
I can't help but feel like they'd still just download regular fpc and 
use it at the console with the help of a minimal syntax highlighting 
editor. Don't get me wrong, that's exactly how I like to use fpc, but I 
already know lazarus is awesome for all the bells and whistles.


The problem with the types of classes that use pascal for teaching is 
the same as the ones that use BASIC: They just want to teach you looping 
and using variables and stuff. The absolute basics. In these instances 
it doesn't matter how cool the language is if you're not an experienced 
enough programmer to use it. Perhaps a decent target would be a database 
course, where Lazarus has a better chance to shine, and the users 
actually have a chance to see what's in the RTL/LCL/etc.


As an aside, I don't think the pascal community is that small, it's just 
spread out. There are a lot of other implementations people cling to 
(myself included).


Alex

On 3/31/2018 7:57 AM, Mr Bee via fpc-pascal wrote:


2018-03-30 16:19 GMT+07:00 Ingemar Ragnemalm >:



The logo is very good, and well connected to the tradtion set by
the animated gif. The alternative would be to use a frame of the
animation, or similar sideways cheetah, but scaled up so it can
have different resolutions. But the head is more compact, which
speaks in its favor.


Thank you.

I am not sure how bit the *need* is but it doesn't hurt to have an
official still image logo.


If we want the young generation to know Pascal with a new paradigm, a 
modern programming language paradigm, I think this branding effort is 
quite important. There are so many people still think that Pascal 
today is still the old 70's Pascal. I even found many universities, at 
least in my country, that still teach Pascal using Turbo Pascal. When 
I introduced them to new and modern Pascal, the FPC/Lazarus (or 
Delphi), they were amazed at how modern Pascal is!


--

Regards,


–Mr Bee


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal