Re: [fpc-pascal]Program is busy

2003-07-19 Thread MichaƂ Kamburelis
If you're doing anything time-consumig (like reading data from internet 
socket) and you want your program to respond to user actions (to Windows 
/ XWindows / any-other-event-driven-environment events), to repaint its 
windows etc. you have to merge event loop with your data-reading code.

Something like that:

procedure Read_Data_And_Process_Some_Events;
begin
  while (not end of data stream) do
  begin
read some data
process some events
  end;
end;
If you're reading from a file, "read some data" can be something like 
"read next 1000 bytes from a stream". BUT if you're reading from an 
internet socket you don't know how long it will take to get "next 1000 
bytes" so you should rather limit your reading code by time. Something like
  time:=Now;
  while (Now-time < 5 seconds) do
  begin
peek if there are some data in a stream, if there are - read them
  end;

However, that kind of loop is called busy-waiting because if the stream 
has no more data yet, your program will use a lot of processor time just 
for peeking. It can be solved by doing Sleep() after every unsuccesful peek (that's an easy but poor solution) 
or by doing time-limited waiting for data using OS functions, like 
select() on sockets (and that's a corect solution).

"process some events" under WinAPI should be something like
  if PeekMessage(msg, 0, 0, 0, PM_REMOVE) then
  begin
if msg.message=WM_QUIT then break;
TranslateMessage(msg);
DispatchMessage(msg);
  end;
If you want only to repaint your windows you can ignore all events 
except WM_PAINT. In general, you should disable some menus/buttons
etc. before calling Read_Data_And_Process_Some_Events. This should make 
 things easier, and it will prevent Read_Data_And_Process_Some_Events 
from being invoked recursively.

Hope this helps,
Michalis Kamburelis
--
[EMAIL PROTECTED]
http://www.camelot.homedns.org/~michalis/ (in Polish)
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Problem linking TESTIB.PP

2003-07-19 Thread Michael . VanCanneyt


On Fri, 18 Jul 2003, Eduardo Lopez wrote:

> Hello all:
>
> I'm trying to compile te TESTIB.PP and I get the following error:
>
> Linking testib.exe
> c:\pp\bin\win32\ldw.exe: cannot find -ldl
> testib.pp(89,1) Error: Error while linking
> Closing script ppas.bat

Remove the {$linklib dl} from the source code, or put it between
{$ifndef win32}

{$endif}
it is only needed on Linux.

Michael.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Problem linking TESTIB.PP

2003-07-19 Thread Marco van de Voort
> On Fri, 18 Jul 2003, Eduardo Lopez wrote:
> 
> > Hello all:
> >
> > I'm trying to compile te TESTIB.PP and I get the following error:
> >
> > Linking testib.exe
> > c:\pp\bin\win32\ldw.exe: cannot find -ldl
> > testib.pp(89,1) Error: Error while linking
> > Closing script ppas.bat
> 
> Remove the {$linklib dl} from the source code, or put it between
> {$ifndef win32}
> 
> {$endif}
> it is only needed on Linux.

If it will be fixed in CVS:

It's not needed in *BSD either, so please make it really Linux only.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Problem linking TESTIB.PP

2003-07-19 Thread Michael . VanCanneyt


On Sat, 19 Jul 2003, Marco van de Voort wrote:

> > On Fri, 18 Jul 2003, Eduardo Lopez wrote:
> >
> > > Hello all:
> > >
> > > I'm trying to compile te TESTIB.PP and I get the following error:
> > >
> > > Linking testib.exe
> > > c:\pp\bin\win32\ldw.exe: cannot find -ldl
> > > testib.pp(89,1) Error: Error while linking
> > > Closing script ppas.bat
> >
> > Remove the {$linklib dl} from the source code, or put it between
> > {$ifndef win32}
> >
> > {$endif}
> > it is only needed on Linux.
>
> If it will be fixed in CVS:
>
> It's not needed in *BSD either, so please make it really Linux only.

Done.

Michael.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]Using FPC

2003-07-19 Thread Israel Simas
Hi everyone,

I'm a student of Data Processing college and in its labs i always wrote code
using Turbo Pascal. For self development as a programmer, i started to
search some way to study pascal at home, and found FPC.
But i couldn't use it as i expected.
I've downloaded the w321010full file, and installed it as explained, but the
compiling test failed. I've set the variable as recommended to...
I ask you to please help me and give me hints about how to use FPC. Do i
have to write code in a simple text editor and compile it in DOS mode?? My
OS is Windows ME.

Thank you,

Israel Simas
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.493 / Virus Database: 292 - Release Date: 25/6/2003


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal