Re: [fpc-devel] http..www.stack.nl..~marcov..buildfaq.pdf

2008-09-30 Thread Marco van de Voort
In our previous episode, Mehmet Erol Sanliturk said:
> 
> is seen here in
> 
> Windows XP
> Adobe Reader 8.0
> Version 8.0.0
> 
> with a very low contrast with letter color ( black )
> and background color ( white ) .

It's optimized for printing, not viewing. And I do work typically on a
1600x1200 resolution, so the tradeoffs may differ.

There is a html version here:
http://www.stack.nl/~marcov/buildfaq/buildfaq.html

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] [PATCH] unix/serial.pp mods for darwin

2008-09-30 Thread Brad Campbell

These additions/changes make serial.pp work for me on MacOS X 10.4 and 10.5, 
both PPC and Intel.

Comments?

Regards,
Brad
--
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.
Index: rtl/unix/serial.pp
===
--- rtl/unix/serial.pp	(revision 11843)
+++ rtl/unix/serial.pp	(working copy)
@@ -70,7 +70,14 @@
 
 function SerOpen(const DeviceName: String): TSerialHandle;
 begin
+  {$IFDEF DARWIN}
+  Result := fpopen(DeviceName, O_RDWR or O_NOCTTY or O_NONBLOCK);
+  { Remove the O_NONBLOCK }
+  If Result > 0 then
+FpFCNTL(Result, F_SETFL, 0);
+  {$ELSE}
   Result := fpopen(DeviceName, O_RDWR or O_NOCTTY);
+  {$ENDIF}
 end;
 
 procedure SerClose(Handle: TSerialHandle);
@@ -127,7 +134,11 @@
   tios.c_ispeed := tios.c_cflag;
   tios.c_ospeed := tios.c_ispeed;
 
+{$ifndef DARWIN}
   tios.c_cflag := tios.c_cflag or CREAD or CLOCAL;
+{$else}
+  tios.c_cflag := CREAD or CLOCAL;
+{$endif}
 
   case ByteSize of
 5: tios.c_cflag := tios.c_cflag or CS5;
@@ -146,9 +157,10 @@
 
   if RtsCtsFlowControl in Flags then
 tios.c_cflag := tios.c_cflag or CRTSCTS;
-
+{$IFNDEF DARWIN}
   tcflush(Handle, TCIOFLUSH);
-  tcsetattr(Handle, TCSANOW, tios)
+{$ENDIF}
+  tcsetattr(Handle, TCSANOW, tios);
 end;
 
 function SerSaveState(Handle: TSerialHandle): TSerialState;
Index: rtl/darwin/Makefile.fpc
===
--- rtl/darwin/Makefile.fpc	(revision 11843)
+++ rtl/darwin/Makefile.fpc	(working copy)
@@ -16,7 +16,7 @@
   errors terminfo termio video crt mouse keyboard console \
   variants dateutils convutils stdconvs \
   sysconst cthreads strutils rtlconsts cwstring bsd fmtbcd \
-  clocale
+  clocale serial
 implicitunits=exeinfo
 
 rsts=math varutils typinfo classes variants dateutils sysconst rtlconsts

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] [PATCH] unix/serial.pp mods for darwin

2008-09-30 Thread Jonas Maebe


On 30 Sep 2008, at 17:06, Brad Campbell wrote:

These additions/changes make serial.pp work for me on MacOS X 10.4  
and 10.5, both PPC and Intel.


Comments?


Do you also know why these changes are necessary? Adding special cases  
from a particular platform without any comments (other than "it works  
now") is unlikely to work in the long term.



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] Makefile deletion script

2008-09-30 Thread Terry Kemp
Hi

Because I cross-compile svn for arm a lot I end up with Makefiles with
revision numbers and littered with Mine through them from
fpcmake -r -Tall etc. 

It takes time to manually delete each offending one and restore from svn
so I have a script (attached)

I have made it so that you can pass any file name as argument and it
will recursively delete it without touching the .svn folders
There is also a test (display) version if your scared of it ;)

./disp_files.sh Makefile - shows what it will delete,
./rm_files Makefile  - will blitz them,
svn up gets the correct ones back again


Could this be useful in utils or tools?


Terry




disp_files.sh
Description: application/shellscript


rm_files.sh
Description: application/shellscript
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Makefile deletion script

2008-09-30 Thread Jonas Maebe


On 30 Sep 2008, at 22:49, Terry Kemp wrote:


Because I cross-compile svn for arm a lot I end up with Makefiles with
revision numbers and littered with Mine through them from
fpcmake -r -Tall etc.

It takes time to manually delete each offending one and restore from  
svn

so I have a script (attached)


You can use "svn revert -R ." to restore all files in the current  
directory and below to their checked out svn version (without having  
to delete them first). This even does not require network access.



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Makefile deletion script

2008-09-30 Thread Terry Kemp
On Tue, 2008-09-30 at 22:54 +0200, Jonas Maebe wrote:

> You can use "svn revert -R ." to restore all files in the current  
> directory and below to their checked out svn version (without having  
> to delete them first). This even does not require network access.
> 
> 
> Jonas

Thats cool. 
Do you know how long it took me to work out the bash script ;(

One thing tho - "svn revert -R ." will nail any of my modified files
that I want to keep different to trunk. Can you tell it to just revert
Makefile?

Terry  

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Makefile deletion script

2008-09-30 Thread Joao Morais

Terry Kemp wrote:

On Tue, 2008-09-30 at 22:54 +0200, Jonas Maebe wrote:

You can use "svn revert -R ." to restore all files in the current  
directory and below to their checked out svn version (without having  
to delete them first). This even does not require network access.




Thats cool. 
Do you know how long it took me to work out the bash script ;(


One thing tho - "svn revert -R ." will nail any of my modified files
that I want to keep different to trunk. Can you tell it to just revert
Makefile?


$ svn revert Makefile
or
$ svn revert -R Makefile

Joao Morais
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests

2008-09-30 Thread ABorka
OK, after 4 days of pulling my (remaining) hair out I was able to 
compile a basic C apache module on Ubuntu 8.04 (apache 2.2.8).


It seems both fpc/lazarus (not working apache module) and the C compiled 
(working apache module) one shows


sizeof(request_rec) =  412
sizeof(module_struct) = 56

So the length seems to be the same for for both. Still, the Lazarus 
compiled apache module doesn't even load in apache (mod_hello.pp or any 
of the other examples included in fpc).

If the exports is included then it loads but doesn't work at all:

modified "mod_hello.pp" from fpc/packages/httpd22/examples/
{***
*  Test library of the Apache Pascal Headers
***}
library mod_hello;

{***
*  The mode must be objfpc on this unit because the unix code uses
* some extensions introduced on Free Pascal
***}
{$ifdef fpc}
  {$mode objfpc}{$H+}
{$endif}

{$IFDEF WIN32}
  {$DEFINE WINDOWS}
{$ENDIF}

{$define Apache2_2}

uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif};

var
 test_module: module; public name 'test_module';
 default_module_ptr: Pmodule;

const
  MODULE_NAME = 'mod_hello.so';

{***
*  Free Pascal only supports exporting variables on Windows
***}
{ $ifdef WINDOWS}//commented out, exports work in Linux now
exports
 test_module name 'test_module';
{ $endif}//commented out, exports work in Linux now
.
.snip
.


Not sure why the Lazarus/fpc apache modules do not work on apache 2.2.8 
or 2.2.9 on Ubuntu.
The above module is loaded, the handler registering function is called, 
but the handler never gets triggered when the module is called from a 
browser.



Michael Van Canneyt wrote:


Any suggestions?


Yes: please print the size of the Request_rec (or TRequest_Rec) and the
same record in C. Compare if they are equal. Same for the module record.
If they are not equal, then we know it is a problem with the pascal 
definition of this record. I've had to do this exercise about 30 times 
myself on various platforms to get it right. Maybe they changed the 
size again.


Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Lazarus Apache module crashes during concurrent requests

2008-09-30 Thread ABorka
Nevermind, on Ubuntu the request_rec is only 384 bytes for FPC instead 
of 412.


But that still does not explain why the handler function is not even 
getting called by apache.



ABorka wrote:
OK, after 4 days of pulling my (remaining) hair out I was able to 
compile a basic C apache module on Ubuntu 8.04 (apache 2.2.8).


It seems both fpc/lazarus (not working apache module) and the C compiled 
(working apache module) one shows


sizeof(request_rec) =  412
sizeof(module_struct) = 56

So the length seems to be the same for for both. Still, the Lazarus 
compiled apache module doesn't even load in apache (mod_hello.pp or any 
of the other examples included in fpc).

If the exports is included then it loads but doesn't work at all:

modified "mod_hello.pp" from fpc/packages/httpd22/examples/
{***
*  Test library of the Apache Pascal Headers
***}
library mod_hello;

{***
*  The mode must be objfpc on this unit because the unix code uses
* some extensions introduced on Free Pascal
***}
{$ifdef fpc}
  {$mode objfpc}{$H+}
{$endif}

{$IFDEF WIN32}
  {$DEFINE WINDOWS}
{$ENDIF}

{$define Apache2_2}

uses SysUtils, httpd {$ifndef Apache1_3}, apr{$endif};

var
 test_module: module; public name 'test_module';
 default_module_ptr: Pmodule;

const
  MODULE_NAME = 'mod_hello.so';

{***
*  Free Pascal only supports exporting variables on Windows
***}
{ $ifdef WINDOWS}//commented out, exports work in Linux now
exports
 test_module name 'test_module';
{ $endif}//commented out, exports work in Linux now
.
.snip
.


Not sure why the Lazarus/fpc apache modules do not work on apache 2.2.8 
or 2.2.9 on Ubuntu.
The above module is loaded, the handler registering function is called, 
but the handler never gets triggered when the module is called from a 
browser.



Michael Van Canneyt wrote:


Any suggestions?


Yes: please print the size of the Request_rec (or TRequest_Rec) and the
same record in C. Compare if they are equal. Same for the module record.
If they are not equal, then we know it is a problem with the pascal 
definition of this record. I've had to do this exercise about 30 times 
myself on various platforms to get it right. Maybe they changed the 
size again.


Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] [PATCH] unix/serial.pp mods for darwin

2008-09-30 Thread Brad Campbell

Jonas Maebe wrote:


On 30 Sep 2008, at 17:06, Brad Campbell wrote:

These additions/changes make serial.pp work for me on MacOS X 10.4 and 
10.5, both PPC and Intel.


Comments?


Do you also know why these changes are necessary? Adding special cases 
from a particular platform without any comments (other than "it works 
now") is unlikely to work in the long term


Index: rtl/unix/serial.pp
===
--- rtl/unix/serial.pp  (revision 11843)
+++ rtl/unix/serial.pp  (working copy)
@@ -70,7 +70,14 @@

 function SerOpen(const DeviceName: String): TSerialHandle;
 begin

This is requires as MacOS will block on the open unless Carrier Detect is asserted. So you need to 
open the port non-blocking and then clear the non-blocking flag. Found this in some apple sample 
code on the apple dev site.


+  {$IFDEF DARWIN}
+  Result := fpopen(DeviceName, O_RDWR or O_NOCTTY or O_NONBLOCK);
+  { Remove the O_NONBLOCK }
+  If Result > 0 then
+FpFCNTL(Result, F_SETFL, 0);
+  {$ELSE}
   Result := fpopen(DeviceName, O_RDWR or O_NOCTTY);
+  {$ENDIF}
 end;

 procedure SerClose(Handle: TSerialHandle);
@@ -127,7 +134,11 @@
   tios.c_ispeed := tios.c_cflag;
   tios.c_ospeed := tios.c_ispeed;

This is required as Darwin does not use enums for the baud rate, and simply use the whole numbers. 
In this case some of the baud rates end up asserting weird flags in the control bits. Darwin uses 
c_ispeed/c_ospeed rather than extract the baud rate from c_cflag.


+{$ifndef DARWIN}
   tios.c_cflag := tios.c_cflag or CREAD or CLOCAL;
+{$else}
+  tios.c_cflag := CREAD or CLOCAL;
+{$endif}

   case ByteSize of
 5: tios.c_cflag := tios.c_cflag or CS5;
@@ -146,9 +157,10 @@

   if RtsCtsFlowControl in Flags then
 tios.c_cflag := tios.c_cflag or CRTSCTS;

This is actually only required on 10.5 on Intel, but it does not seem to hurt 
on the other versions.
If left in place, this just blocks and stalls the program.

-
+{$IFNDEF DARWIN}
   tcflush(Handle, TCIOFLUSH);
-  tcsetattr(Handle, TCSANOW, tios)
+{$ENDIF}
+  tcsetattr(Handle, TCSANOW, tios);
 end;

--
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel