Dale Welch | 1 Jul 2006 18:00

dos.pp GetLongName and GetShortName for mswindows

file  rtl/win/dos.pp

typo / problem in function GetLongName and GetShortName 
it has 
   if ret = 0 then
it should be
  if ret <> 0 then
then it will work correctly. :-)

because the ret value is 0 if invalid file / directory passed.
ret is > then the passed bufferlen "255" if it needs a larger buffer to store it in
or it is between 1 and 255 if a valid value.

same error with GetShortName

reference
  http://windowssdk.msdn.microsoft.com/en-us/library/ms685896.aspx
  http://windowssdk.msdn.microsoft.com/en-us/library/ms685885.aspx

--- dale
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Martin Schreiber | 2 Jul 2006 09:05
Picon
Favicon

MSEide+MSEgui rev. 0.9

Version 0.9 of MSEide+MSEgui is released:

http://mypage.bluewin.ch/msegui/

Screenshots:

http://sourceforge.net/project/screenshots.php?group_id=165409

Have a lot of fun!

Martin
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Ole J. Røtne | 2 Jul 2006 11:52
Picon
Picon

writeln in threads on linux


Can anyone explain why i get output like this in a small test program:
Inside Thread
		 Main Loop
Inside Thread
		 Main Loop
Inside Thread
		 Main Loop

On Windows the output are lined up just as I would expect:
Inside Thread
Main Loop
Inside Thread
Main Loop

Here's a snip of the code:

// Main Prog

Thr := threadtest.Create;

Repeat
  k := PollKeyEvent;
  WriteLn('Mein Loop');
  Sleep(100);
Until k <> 0;

And the ThreadTest.Execute i just:

Procedure ThreadTest.Execute;
(Continue reading)

Antal | 2 Jul 2006 12:32
Favicon

Re: writeln in threads on linux

> Can anyone explain why i get output like this in a small test program:
> Inside Thread
> 		 Main Loop
> Inside Thread
> 		 Main Loop
> Inside Thread
> 		 Main Loop
That's because the line terminator!
#10#13 or #13#10 acts differently
So, check in the source code which one is used, because the first one is 
not suitable in Windows!
As you supposedly know, the end line terminator is different on Mac, Unix 
and Windows.
Mac only uses #13
Unix only uses #10
Windows uses #13#10 (CRLF)
This comes from the fact that telex machines needed to complete two 
different actions in order to start writing in a new line (just like what 
you have to do on a normal typewriter): first to step on the next row, 
then to put the head at the beginning of the row.
So, basically #10 means Line-Feed (LF) (step to the next row)
While #13 means Carriage Return (CR) which means "move the carriage -the 
printing head- to the beginning of the row) - or what you are doing on a 
typewriter by hand, using that lever from the right upper part of the 
machine.
so, when OS-es split up, the kept what they wanted, although MS had had to 
preserve the standard as long as they was part of IBM those times, and IBM 
telex machines needed the time of two caracter printing to complete a CRLF 
operation.
But I I've seen, sometimes in FP source codes the CRLF is using as LFCR 
(Continue reading)

Ole J. Røtne | 2 Jul 2006 12:43
Picon
Picon

SV: Re: writeln in threads on linux

> > Can anyone explain why i get output like this in a small 
> test program:
> > Inside Thread
> > 		 Main Loop
> > Inside Thread
> > 		 Main Loop
> > Inside Thread
> > 		 Main Loop
> That's because the line terminator!
> #10#13 or #13#10 acts differently
> So, check in the source code which one is used, because the 
> first one is not suitable in Windows!
> As you supposedly know, the end line terminator is different 
> on Mac, Unix and Windows.
> Mac only uses #13
> Unix only uses #10
> Windows uses #13#10 (CRLF)

This I do know :)

> So just look out for this in the source-code.
> Or just use
> write('Main Loop',#13#10);
> :^)

If I do this I get this instead:
Inside Thread

Main Loop

(Continue reading)

Florian Klaempfl | 2 Jul 2006 12:45
Favicon

Re: writeln in threads on linux

Ole J. Røtne wrote:
>  
> Can anyone explain why i get output like this in a small test program:
> Inside Thread
> 		 Main Loop
> Inside Thread
> 		 Main Loop
> Inside Thread
> 		 Main Loop
> 
> 
> On Windows the output are lined up just as I would expect:
> Inside Thread
> Main Loop
> Inside Thread
> Main Loop
> 
> Here's a snip of the code:
> 
> // Main Prog
> 
> Thr := threadtest.Create;
> 
> Repeat
>   k := PollKeyEvent;
>   WriteLn('Mein Loop');
>   Sleep(100);
> Until k <> 0;
> 
> And the ThreadTest.Execute i just:
(Continue reading)

Picon

Re: Re: writeln in threads on linux

On 7/2/06, Antal <antal@...> wrote:
> So just look out for this in the source-code.
> Or just use
> write('Main Loop',#13#10);
> :^)

Isn´t it better to use:

write('Main Loop',LineEnding);

this way the RTL will substitue LineEnding with the appropriate one
for that platform.

--

-- 
Felipe Monteiro de Carvalho
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

J.L. Blom | 2 Jul 2006 15:42
Picon

fpc & Lazarus with 64-bit

Hi,
I recently retrieved fpc-pascal 2.0.2a from the Lazarus download site
together with Lazarus 0.9.16.
System: AMD64 1 Gb mem. sufficient disk space, Linux 2.6.17-1.2139_FC5.
My problems:
1.
Starting "fp" freezes the terminal window. When I do "fp &", the window
is accessible but the first keystroke stops fp.
"fpc hello" (as said in the manual) doesn't work (neither from root nor
from a user-terminal).
"fpc helloworld" when in the helloworld directory works.
2. (I don't know if this is the right place)
Installing Lazarus gives:
"error: Failed dependencies:libgdk_pixbuf.so.2 is needed by
lazarus-0.9.16-0.i386"
However "locate libgdk_pixbuf.so.2" gives:
"/usr/lib64/libgdk_pixbuf.so.2
/usr/lib64/libgdk_pixbuf.so.2.0.0"
I did this with the fpc retrieved from the lazarus site.
TAfter removing fpc completely I installed fpc 2.0.2-4.fc5 (Fedora site)
which of course caused lazarus to refuse to install.
My conclusions:
1. fpc will compile programs on a 64-bit system.
2. The IDE is not tuned to a 64-bit system (strange however for a fedora
64-bit system)
3. The Lazarus rpm is not rigged for the 64-bit fpc.
My questions:
1. Can programs compiled on a 64-bit system run on a 32-bit system (or
is there a setting for it).
2. Does anybody have a solution as I'm a Pascal programmer from way back
(Continue reading)

Ole J. Røtne | 2 Jul 2006 16:32
Picon
Picon

SV: writeln in threads on linux


> -----Opprinnelig melding-----
> Fra: fpc-pascal-bounces@... 
> [mailto:fpc-pascal-bounces@...] På vegne av 
> Florian Klaempfl
> Sendt: 2. juli 2006 12:46
> Til: FPC-Pascal users discussions
> Emne: Re: [fpc-pascal] writeln in threads on linux
> 
> > And if this is a "wrong way" of doing this thing, could 
> someone tell 
> > me how it should be..
> 
> You probably want to guard the output with mutexes or semaphores.
> Writing unsynchronized to a stream has always unexpected results.
> 

Did try to wrap both of the WriteLn() with
EnterCriticalSection/LeaveCriticalSection. 
Same result..

And to answer another post at the same time..

If I use: Writeln('.....', LineEnding);
I get the double lineshift thing all over again, same as using #13#10..

Inside Thread
	
		 Main Program

(Continue reading)

Florian Klaempfl | 2 Jul 2006 16:43
Favicon

Re: SV: writeln in threads on linux

Ole J. Røtne wrote:
>  
> 
>> -----Opprinnelig melding-----
>> Fra: fpc-pascal-bounces@... 
>> [mailto:fpc-pascal-bounces@...] På vegne av 
>> Florian Klaempfl
>> Sendt: 2. juli 2006 12:46
>> Til: FPC-Pascal users discussions
>> Emne: Re: [fpc-pascal] writeln in threads on linux
>>
>>> And if this is a "wrong way" of doing this thing, could 
>> someone tell 
>>> me how it should be..
>> You probably want to guard the output with mutexes or semaphores.
>> Writing unsynchronized to a stream has always unexpected results.
>>
> 
> Did try to wrap both of the WriteLn() with
> EnterCriticalSection/LeaveCriticalSection. 
> Same result..
> 

Please post the complete code.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Gmane