[fpc-pascal] Re: help: converting windows API to linux

2008-04-11 Thread Guillermo Martínez Jiménez
May be you can use the Wine library. It is a library created to help
porting applications from Windows to *NIX. Visit www.winehq.org

Regards.
Ñuño Martínez.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Looking for a Firebird book?

2008-04-11 Thread Tom York
On Wed, Apr 9, 2008 at 5:53 AM, Codebue Fabio - P-Soft [EMAIL PROTECTED]
wrote:

 Take a look to a new Firebird 2.1 next month and probably you will change
 your idea about it...
 UDF: FreeAdHocUDF, a lot of internal SQL function...
 and if you wanna a good book www.ibphoenix.com Helen Borrie book... a
 MUST!


Will 2.1 have a true auto increment attribute?  A boolean field perhaps?
Those are the only things that I miss when using FB.  I am aware that all of
these issues can be resolved by using generators/triggers and a validating
domain.  That is what I like about MySQL, MSSQL and others that are missing
from FB.

Do not misunderstand though.  I've used FB for 8+ years with great success
in embedded, small and large transactional systems without flaw.  Never had
a corrupt DB.  AFAIK, never had a corrupt backup.  Most of the time, I
deploy FB on Linux servers and backup using gbak.

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

[fpc-pascal] Installing fpc 2.2.0 deb packages

2008-04-11 Thread syraxes
Hello,


Are there better ways to install fpc 2.2.0 on ubuntu besides downloading ~15 
debs
from sourceforge ?   I'm thinking that it would be much more convenient to have 
all those
debs packaged into a single tar . Or maybe there is some deb repository 
available ?


Thanks,
Adrian Maier
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Installing fpc 2.2.0 deb packages

2008-04-11 Thread Vincent Snijders

[EMAIL PROTECTED] schreef:

Hello,


Are there better ways to install fpc 2.2.0 on ubuntu besides downloading ~15 
debs
from sourceforge ?   I'm thinking that it would be much more convenient to have 
all those
debs packaged into a single tar . Or maybe there is some deb repository 
available ?


tar: 
http://sourceforge.net/project/showfiles.php?group_id=89339package_id=204004
repo: 
http://wiki.lazarus.freepascal.org/Getting_Lazarus#Getting_Lazarus_from_our_Ubuntu_repository


Vincent

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


Re: [fpc-pascal] Installing fpc 2.2.0 deb packages

2008-04-11 Thread syraxes
On Fri, Apr 11, 2008 at 10:29:57AM +0200, Vincent Snijders wrote:
 [EMAIL PROTECTED] schreef:
 Hello,
 
 
 Are there better ways to install fpc 2.2.0 on ubuntu besides downloading 
 ~15 debs
 from sourceforge ?   I'm thinking that it would be much more convenient to 
 have all those
 debs packaged into a single tar . Or maybe there is some deb repository 
 available ?
 
 tar: 
 http://sourceforge.net/project/showfiles.php?group_id=89339package_id=204004
 repo: 
 http://wiki.lazarus.freepascal.org/Getting_Lazarus#Getting_Lazarus_from_our_Ubuntu_repository

Thanks for the links Vincent !
It's nice to see that the issue has long been adressed already  ...


The reason why I haven't found the tarred debs is that I've searched
them starting from www.freepascal.org --  downloads --  sourceforge .
Perhaps it's worth considering to upload fpc_all_i386_deb.tgz   
here as well :
http://sourceforge.net/project/showfiles.php?group_id=2174



Thanks!
Adrian Maier


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


Re: [fpc-pascal] Looking for a Firebird book?

2008-04-11 Thread Matt Emson

Michael Van Canneyt wrote:

And it is exactly why I can't use MySQL, MSSQL: they don't have sequences or
generators. I need the ID  BEFORE I insert the record, not after.
  


YES!! This is also missing from SQL Server... or at least, using a GUID 
is complete overkill. The mechanisms SQL Server has for retrieving the 
last interted identity value are completely unsane too. Yes, they do 
work, but things get tricky in real world situations. I have no idea how 
anyone wrote reliable code to insert a record and retern the IDENTITY 
value prior to SQL Server 2005.


OT: does anyone know of a reliable generator style atomic robust multi 
user friendly auto IDENTITY generation mechanism for SQL Server? I'd 
love to be able to define one, but I don't think I have seen one yet 
that *really* works well.




So: Each his taste :-


Generators and For select .. into .. suspend  are the features I 
really miss from Interbase/Firebird.


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


Re: [fpc-pascal] Looking for a Firebird book?

2008-04-11 Thread Michael Van Canneyt


On Wed, 9 Apr 2008, Tom York wrote:

 On Wed, Apr 9, 2008 at 5:53 AM, Codebue Fabio - P-Soft [EMAIL PROTECTED]
 wrote:
 
  Take a look to a new Firebird 2.1 next month and probably you will change
  your idea about it...
  UDF: FreeAdHocUDF, a lot of internal SQL function...
  and if you wanna a good book www.ibphoenix.com Helen Borrie book... a
  MUST!
 
 
 Will 2.1 have a true auto increment attribute?  A boolean field perhaps?
 Those are the only things that I miss when using FB.  I am aware that all of
 these issues can be resolved by using generators/triggers and a validating
 domain.  That is what I like about MySQL, MSSQL and others that are missing
 from FB.

And it is exactly why I can't use MySQL, MSSQL: they don't have sequences or
generators. I need the ID  BEFORE I insert the record, not after.

So: Each his taste :-)

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


Re: [fpc-pascal] Looking for a Firebird book?

2008-04-11 Thread Inoussa OUEDRAOGO
2008/4/11, Matt Emson [EMAIL PROTECTED]:
 Michael Van Canneyt wrote:

  And it is exactly why I can't use MySQL, MSSQL: they don't have sequences
 or
  generators. I need the ID  BEFORE I insert the record, not after.
 
 

  YES!! This is also missing from SQL Server... or at least, using a GUID is
 complete overkill. The mechanisms SQL Server has for retrieving the last
 interted identity value are completely unsane too. Yes, they do work, but
 things get tricky in real world situations. I have no idea how anyone wrote
 reliable code to insert a record and retern the IDENTITY value prior to SQL
 Server 2005.

  OT: does anyone know of a reliable generator style atomic robust multi
 user friendly auto IDENTITY generation mechanism for SQL Server? I'd love to
 be able to define one, but I don't think I have seen one yet that *really*
 works well.

Have you try SCOPE_IDENTITY() ? Available at least since SQL SERVER 2000.
I have used it with success.

from MSDN :
quote
  Returns the last identity value inserted into an identity column in
  the same scope. A scope is a module: a stored procedure, trigger,
  function, or batch. Therefore, two statements are in the same scope
  if they are in the same stored procedure, function, or batch.
/quote

Interesting article ( 10 Things You Shouldn't Do with SQL Server ) :
  
http://www.sqljunkies.ddj.com/Article/92CC4817-604D-4344-8BE0-4490F8ED24B6.scuk

-- 
Inoussa O.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Looking for a Firebird book?

2008-04-11 Thread Matt Emson

Inoussa OUEDRAOGO wrote:

Have you try SCOPE_IDENTITY() ? Available at least since SQL SERVER 2000.
I have used it with success.
  


Well, yeah. But it's not perfect. I want generators, as in:

create generator an_atomic_counter;
set an_atomic_counter = 1 /*or something like that*/


declare variable next_atomic_value int
begin
 next_atomic_value = gen_id(an_atomic_counter, 1);
end

next_atomic_is is alway a unique incremental id, and is *not* tied to a 
specific table. It's not so much the ability to generate a unique id, 
it's the use auto inc IDENTITY fields or be damned attitude that Sql 
Server has. The only other option is a GUID. Microsoft's insane SET 
IDENTITY_INSERT ON|OFF is also dangerous. Have you ever tried to 
migrate data between to databases using Sql Server? Nightmare!



from MSDN :
quote
  Returns the last identity value inserted into an identity column in
  the same scope. A scope is a module: a stored procedure, trigger,
  function, or batch. Therefore, two statements are in the same scope
  if they are in the same stored procedure, function, or batch.
/quote

Interesting article ( 10 Things You Shouldn't Do with SQL Server ) :
  
http://www.sqljunkies.ddj.com/Article/92CC4817-604D-4344-8BE0-4490F8ED24B6.scuk

  


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


Re[2]: [fpc-pascal] Building-Block Design - or putting it all together ; -)

2008-04-11 Thread MPDJ
Thanks, I'll check that one out.

Andy


PN I can't help you with your problem directly, but perhaps this newsgroup for
PN object orient programming could help:

PN News server:newsgroups.borland.com
PN news group:borland.public.delphi.oodesign

PN It is for Delphi, but it would be equally valid for freepascal as both use
PN object pascal...

PN cheers,
PN Paul 

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


Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Marco van de Voort
 I am planning to improve, if possible, the serial units for both Linux 
 and Windows, but have a few questions before I proceed any further:
 
 1- I guess the unit rtl\win\wininc\struct.inc has 2 bugs:
   a- bm_DCB_fRtsControl = $3000. It should be $2000.
   b- bm_DCB_fDtrControl = $30. It should be $20.
 Can anybody confirm this?

No, they are correct. If you look into the headers you'll see:

 DWORD DCBlength;  /* sizeof(DCB) */
DWORD BaudRate;   /* Baudrate at which running   */
DWORD fBinary: 1; /* Binary Mode (skip EOF check)*/
DWORD fParity: 1; /* Enable parity checking  */
DWORD fOutxCtsFlow:1; /* CTS handshaking on output   */
DWORD fOutxDsrFlow:1; /* DSR handshaking on output   */
DWORD fDtrControl:2;  /* DTR Flow control*/
DWORD fDsrSensitivity:1; /* DSR Sensitivity  */
DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
DWORD fOutX: 1;   /* Enable output X-ON/X-OFF*/
DWORD fInX: 1;/* Enable input X-ON/X-OFF */
DWORD fErrorChar: 1;  /* Enable Err Replacement  */
DWORD fNull: 1;   /* Enable Null stripping   */
DWORD fRtsControl:2;  /* Rts Flow control*/ 
DWORD fAbortOnError:1; /* Abort all reads and writes on Error */
DWORD fDummy2:17; /* Reserved*/
WORD wReserved;   /* Not currently used  */
WORD XonLim;  /* Transmit X-ON threshold */
WORD XoffLim; /* Transmit X-OFF threshold*/
BYTE ByteSize;/* Number of bits/byte, 4-8*/
BYTE Parity;  /* 0-4=None,Odd,Even,Mark,Space*/
BYTE StopBits;/* 0,1,2 = 1, 1.5, 2   */
char XonChar; /* Tx and Rx X-ON character*/
char XoffChar;/* Tx and Rx X-OFF character   */
char ErrorChar;   /* Error replacement char  */
char EofChar; /* End of Input character  */
char EvtChar; /* Received Event character*/
WORD wReserved1;  /* Fill for now.   */
} DCB, *LPDCB;

Note the :2 with frts and fdtr. These are two bit values, not one bit, so a
mask that masks 2 bits makes sense
 
 2- I will define TSerialFlags = set of (XOnXOffFlowControl, 
 RtsCtsFlowControl);
 What flags do we have to set in Linux to have XOnXOff handshaking? The 
 number of parameters in tios is mind boggling.

Well the existance of flags are named  IXON, IXOFF and IXANY might
provide a clue when googled.

 3- The Linux SerOpen function (based on fpopen) claims to return 0 if 
 the device could not be found. Shouldn't it be -1?

Probably. In 1.0.x times FPC unix functions had own error conventions.
 
 4- Windows SerOpen function (based on CreateFile) returns an 
 INVALID_HANDLE_VALUE if the device could not be found. How to unify for 
 both Linux  Windows? Is it safe to return instead -1 (as in the Linux 
 case)?

See Tomas, it is define
 
 5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx 
 for Linux?

No, since e.g a serial port on some other device might have a different
state. And strictly, this is even possible for Windows. Always keep naming
configurable and overridable. Those series are extremely common, but not
that 

Also note that serial.pp is a general unix unit, not just linux. So it needs
to work on FreeBSD too. (and maybe Mac, but I have no serial on my mac
anymore)

I've acquired a serial device suitable for testing with FreeBSD if needed.

 6- Is it OK for TSerialState to include DCB for Windows and tios for Linux?

I don't understand what you mean with this.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Jeff Wormsley





Marco van de Voort wrote:

  
5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx 
for Linux?

  
  
No, since e.g a serial port on some other device might have a different
state. And strictly, this is even possible for Windows. Always keep naming
configurable and overridable. Those series are extremely common, but not
that 
  

While not exactly the same situation, for one of my Windows apps in
Delphi, I had to support real serial ports, virtual serial ports, and
PC/SC card readers. I found it easier to present a string list of all
devices and allow the user to select from the string list the
port/device needed. Something similar can probably be done here, where
the Windows ports can be read from the registry (a tricky process when
virtual ports are involved such as com redirection over tcp/ip) and
*nix can read the /dev/ttyS* entries. Then port selection is simply
passing in the string selected from the string list. Completely Delphi
incompatible, but probably the only way to get truly cross platform.
You can't just assume a 1 is COM1 on Windows and /dev/ttyS1 on *nix.
Windows can name ports "Virtual COM1" instead of "COM1" and then your
attempt at passing '1' to build 'COM1' won't work. Likewise, on Linux,
you might have /dev/modem for a serial port (in theory anyway, not sure
if you'd access that as just a serial port). Of course, this just
makes building the list the hard part.

Jeff.
--
I haven't smoked for 1 year, 7 months and 3 weeks, saving $2,716.59 and
not smoking 18,110.61 cigarettes.


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

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Stephano

Tomas Hajny wrote:

If I read the Windows unit sources correctly, INVALID_HANDLE_VALUE = -1
too. However, I believe that you might consider returning UnusedHandle
constant defined in System unit for all the platforms (that's -1 for at
least most of them anyway, but I believe that it may be still better from
portability point of view to refer to it using this constant).
I cannot rely on what the actual value of INVALID_HANDLE_VALUE really is 
as it could in theory change. But nevertheless your suggestion to return 
the UnusedHandle constant, once I locate it :), is very logical.

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


Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Stephano

Marco van de Voort wrote:

No, they are correct. If you look into the headers you'll see:

 DWORD DCBlength;  /* sizeof(DCB) */
DWORD BaudRate;   /* Baudrate at which running   */
DWORD fBinary: 1; /* Binary Mode (skip EOF check)*/
DWORD fParity: 1; /* Enable parity checking  */
DWORD fOutxCtsFlow:1; /* CTS handshaking on output   */
DWORD fOutxDsrFlow:1; /* DSR handshaking on output   */
DWORD fDtrControl:2;  /* DTR Flow control*/
DWORD fDsrSensitivity:1; /* DSR Sensitivity  */
DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */
DWORD fOutX: 1;   /* Enable output X-ON/X-OFF*/
DWORD fInX: 1;/* Enable input X-ON/X-OFF */
DWORD fErrorChar: 1;  /* Enable Err Replacement  */
DWORD fNull: 1;   /* Enable Null stripping   */
DWORD fRtsControl:2;  /* Rts Flow control*/ 
DWORD fAbortOnError:1; /* Abort all reads and writes on Error */

DWORD fDummy2:17; /* Reserved*/
WORD wReserved;   /* Not currently used  */
WORD XonLim;  /* Transmit X-ON threshold */
WORD XoffLim; /* Transmit X-OFF threshold*/
BYTE ByteSize;/* Number of bits/byte, 4-8*/
BYTE Parity;  /* 0-4=None,Odd,Even,Mark,Space*/
BYTE StopBits;/* 0,1,2 = 1, 1.5, 2   */
char XonChar; /* Tx and Rx X-ON character*/
char XoffChar;/* Tx and Rx X-OFF character   */
char ErrorChar;   /* Error replacement char  */
char EofChar; /* End of Input character  */
char EvtChar; /* Received Event character*/
WORD wReserved1;  /* Fill for now.   */
} DCB, *LPDCB;

Note the :2 with frts and fdtr. These are two bit values, not one bit, so a
mask that masks 2 bits makes sense

They are 2 bit values indeed, but each value has a specific function.
fDtrControl can be: DTR_CONTROL_DISABLE, DTR_CONTROL_ENABLE, or 
DTR_CONTROL_HANDSHAKE. The latter is the common DTR/DSR handshaking choice.
fRtsControl can be: RTS_CONTROL_DISABLE, RTS_CONTROL_ENABLE, 
RTS_CONTROL_HANDSHAKE, or RTS_CONTROL_TOGGLE. RTS_CONTROL_HANDSHAKE is 
the normal choice for a RTS/CTS handshaking.

This is what dictated my suggestion for the values of $2000 and $20.


Well the existance of flags are named  IXON, IXOFF and IXANY might
provide a clue when googled.
MAN Stty will give much better results than google for these parameters. 
I had tried a few months ago to have a XOn/XOff serial communication, 
but I failed somewhere. I tried to use the flags you describe, but 
without success unfortunately. Could be something wrong with my hardware 
setup though. I will retry eventually again.


3- The Linux SerOpen function (based on fpopen) claims to return 0 if 
the device could not be found. Shouldn't it be -1?

Probably. In 1.0.x times FPC unix functions had own error conventions.

I will change it then to -1.

4- Windows SerOpen function (based on CreateFile) returns an 
INVALID_HANDLE_VALUE if the device could not be found. How to unify for 
both Linux  Windows? Is it safe to return instead -1 (as in the Linux 
case)?

See Tomas, it is define

Agreed!

5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx 
for Linux?


No, since e.g a serial port on some other device might have a different
state. And strictly, this is even possible for Windows. Always keep naming
configurable and overridable. Those series are extremely common, but not
that
I think you might have misunderstood me. I am in fact saying that we 
should not standardize between Unix ;) and Windows for port names, just 
for the reasons you mentioned. Pls correct me if I am wrong.



Also note that serial.pp is a general unix unit, not just linux. So it needs
to work on FreeBSD too. (and maybe Mac, but I have no serial on my mac
anymore)
I will not change the basic Unix unit except for minor modifications if 
needed.



I've acquired a serial device suitable for testing with FreeBSD if needed.
I have serial devices for testing. You can still test the finished work 
with FreeBSD if you like.



6- Is it OK for TSerialState to include DCB for Windows and tios for Linux?

 I don't understand what you mean with this.
The TSerialState for Windows is defined as:
LineState: integer or so
DCB: TDCB
for Unix, it is:
LineState: ssame
tios: termios structure
I do not think there is a way to unify this.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Koenraad Lelong
Stephano schreef:
 I am planning to improve, if possible, the serial units for both Linux
 and Windows, but have a few questions before I proceed any further:
 
...
 5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx
 for Linux?

FWIW, I have a USB to serial converter. It shows as /dev/ttyUSB0.

Regards,
Koenraad Lelong.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Stephano

Koenraad Lelong wrote:

5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx
for Linux?


FWIW, I have a USB to serial converter. It shows as /dev/ttyUSB0.
I see now how I did not express myself clearly: I meant that I did not 
intend to change the way devices are specified. Under Unix, you will be 
able to (and will have to) specify /dev/ttyUSB0 or any valid devicename 
to open.

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


Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Tomas Hajny
On Fri, April 11, 2008 22:12, Stephano wrote:
 Tomas Hajny wrote:
 If I read the Windows unit sources correctly, INVALID_HANDLE_VALUE = -1
 too. However, I believe that you might consider returning UnusedHandle
 constant defined in System unit for all the platforms (that's -1 for at
 least most of them anyway, but I believe that it may be still better
 from
 portability point of view to refer to it using this constant).
 I cannot rely on what the actual value of INVALID_HANDLE_VALUE really is
 as it could in theory change. But nevertheless your suggestion to return
 the UnusedHandle constant, once I locate it :), is very logical.

Do I understand correctly that you cannot find it? As I wrote above, this
constant is defined in unit System, i.e. always available without any
additions to the uses clause or so.

Tomas


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