Re: [fpc-pascal] Missing GetLastOSError() in DOS and MacOS

2010-06-10 Thread Tomas Hajny
On Thu, June 10, 2010 06:29, Bihar Anwar wrote:
 I don't see SysUtils.GetLastOSError() in DOS. Looking at a glance, I think
 it will be a trivial effort by just returning Dos.DosError variable
 content.

Thanks for the notification, I'll have a look at it (creating a bug report
to make sure it isn't forgotten would be even better).

I'm not sure if taking DosError is sufficient though. I need to look up
the specification in order to check whether the function is supposed to
provide the last error result for SysUtils (or RTL in general), or whether
it should return the last OS error for what OS function invoked recently
(also directly without using RTL). If it's the latter (I believe that this
is the case in Delphi and also existing FPC implementations for other
platforms), it would be probably more appropriate to use the DOS API
function providing this information.


 Also, I notice that SysUtils.GetLastOSError() in MacOS is defined but it's
 implementation is empty. I've no knowledge on MacOS, so my question is...
 Is this by designed?

Sorry, I cannot answer this one.

Tomas


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


Re: [fpc-pascal] how to use odbc Allow multiple statements

2010-06-10 Thread Michael Van Canneyt


Just use 2 TSQLQuery statements at once. Each will set up a connection to
MySQL, as far as I remember.

Michael.

On Thu, 10 Jun 2010, liuzg2 wrote:


how to use odbc  Allow  multiple statements  Connection   mssql
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


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


Re: [fpc-pascal] how to use odbc Allow multiple statements

2010-06-10 Thread Graeme Geldenhuys
Op 2010-06-10 08:23, Michael Van Canneyt het geskryf:
 
 Just use 2 TSQLQuery statements at once. Each will set up a connection to
 MySQL, as far as I remember.

[...maybe he meant the following...]

Is there a SQL Script component in SqlDB? So that you can pass it a DDL
script file which will contain many sql statements to setup a DB or upgrade
an existing one?



Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

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


Re: [fpc-pascal] Negative RTL Error Codes in Some Platforms

2010-06-10 Thread Tomas Hajny
On Thu, June 10, 2010 05:44, Bihar Anwar wrote:
 I look at the FPC RTL source codes and notice that in some OSes (e.g.
 OS/2, DOS) every RTL functions which call OS API functions will return the
 OS error code as a negative number. What is the reason behind this? I
 don't find such a convention in the official documentation of thouse OSes.

If I remember correctly, it's been done in order to differentiate standard
error codes (supposedly cross-platform and mostly inherited from TP/BP)
from all other error codes which may be triggered there and which are
completely platform specific. It's well possible that this convention has
never been documented and possibly not followed in implementations for
other platforms either. However, you shouldn't rely on the returned values
too much anyway. They depend not only on the underlying platform, but
possibly partly also on the specific implementation for the particular
platform - i.e. one RTL function originally based on a single OS API call
in the DOS (TP) times may require several subsequent OS API calls in an
implementation for another platform and you wouldn't really know which of
the calls returned the value and why unless you trace the implementation.

Tomas


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


Re: [fpc-pascal] Missing GetLastOSError() in DOS and MacOS

2010-06-10 Thread Bihar Anwar
On June 
10, 2010 1:00:27 PM, Tomas Hajny wrote:
... or whether it should return the last OS error for what OS function 
invoked recently (also directly without using RTL).


Yes, I think this one is agreed with other similar RTL functions.



  

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


Re: [fpc-pascal] Mozilla XPCOM

2010-06-10 Thread Frank Peelo

On 09/06/10 15:50, Marcos Douglas wrote:

On Tue, Jun 8, 2010 at 3:44 PM, Luiz Americo Pereira Camara
luiz...@oi.com.br  wrote:
   

Marcos Douglas escreveu:
 

Exactly.
Therefore I always used 'const' only at 'strings' params. I thought it
had changed, but not.  ;-)
   

It can be useful for record parameters also

 

If the record have strings, I think.

   
Surely it's for any parameter which the called procedure does not 
change, which would be more efficiently passed as a reference? That 
would include any record larger than a few bytes, and arrays.


FP

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


Re: [fpc-pascal] Missing GetLastOSError() in DOS and MacOS

2010-06-10 Thread Jonas Maebe


On 10 Jun 2010, at 06:29, Bihar Anwar wrote:

Also, I notice that SysUtils.GetLastOSError() in MacOS is defined  
but it's implementation is empty. I've no knowledge on MacOS, so my  
question is... Is this by designed?


MacOS in the RTL stands for System 7.5 - Mac OS 9.2.x, i.e., the  
classic Mac OS which preceded Mac OS X. I don't think the sysutils  
unit was ever completely ported for that platform.



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


Re: [fpc-pascal] how to use odbc Allow multiple statements

2010-06-10 Thread Michael Van Canneyt



On Thu, 10 Jun 2010, Graeme Geldenhuys wrote:


Op 2010-06-10 08:23, Michael Van Canneyt het geskryf:


Just use 2 TSQLQuery statements at once. Each will set up a connection to
MySQL, as far as I remember.


[...maybe he meant the following...]

Is there a SQL Script component in SqlDB? So that you can pass it a DDL
script file which will contain many sql statements to setup a DB or upgrade
an existing one?


In that case, the answer is: yes there is: TSQLScript. It will parse the
script and send the SQL statements one by one to the connection.

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


Re: [fpc-pascal] Negative RTL Error Codes in Some Platforms

2010-06-10 Thread Bihar Anwar
On June 
10, 2010 1:46:39 PM, Tomas Hajny wrote:

If I remember correctly, it's been done in order to differentiate standard
error 
codes (supposedly cross-platform and mostly inherited from TP/BP)
from all other error codes which may be 
triggered there and which are
completely platform specific. It's well possible that this convention has
never been documented and possibly not followed in implementations for
other platforms either. However, you shouldn't rely on the returned values
too much anyway. They 
depend not only on the underlying platform, but
possibly partly also 
on the specific implementation for the particular
platform - i.e. one RTL function originally based on a single OS API call
in the DOS 
(TP) times may require several subsequent OS API calls in an
implementation for another platform and you wouldn't really know which of
the calls returned the value and why unless you trace the implementation.

Thanks Tomas for your detail explanation. It's a logical reason.

However, you shouldn't rely on the returned values
too much anyway.

No, I just rely on such a returned values in a very few cases. For example, In 
Windows/OS2/DOS, when FindNext() encounters the end of a directory content, it 
returns ERROR_NO_MORE_FILES (18 or -18); whereas in UNIX, it returns -1 and 
errno is not set. Thus UNIX doesn;t consider it as an error, and this is more 
acceptable by me. So, my file searching function will return 0 in this 
situation. I'm certainly sure such a convention for the basic operations will 
never be changed in those OSes, so I attempt to handle this.

Thanks in advance. Cheers.



  

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


Re: [fpc-pascal] Missing GetLastOSError() in DOS and MacOS

2010-06-10 Thread Bihar Anwar
June 
10, 2010 3:03:45 PM, Jonas Maebe wrote:

MacOS in the RTL stands for System 7.5 - Mac OS 9.2.x, i.e., the classic 
Mac OS which 
preceded Mac OS X. I don't think the sysutils unit was ever completely ported 
for that 
platform.


Thanks Jonas, your clarification strengthens my thought before. I saw other 
several defects in MacOS SysUtils, just mention the implementation of FindNext:

   Result:=DoFind (Rslt);  // whereas DoFind() is declared as a procedure

How can that be compiled?

I think, I will increase the requirement of my base units to at least the MacOS 
X.



  

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


Re: [fpc-pascal] Missing GetLastOSError() in DOS and MacOS

2010-06-10 Thread Jonas Maebe


On 10 Jun 2010, at 12:13, Bihar Anwar wrote:

Thanks Jonas, your clarification strengthens my thought before. I  
saw other several defects in MacOS SysUtils, just mention the  
implementation of FindNext:


  Result:=DoFind (Rslt);  // whereas DoFind() is declared as a  
procedure


How can that be compiled?


Maybe it was a function in the past.

I think, I will increase the requirement of my base units to at  
least the MacOS X.


That's definitely a good idea.


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


Re: [fpc-pascal] Negative RTL Error Codes in Some Platforms

2010-06-10 Thread Tomas Hajny
On Thu, June 10, 2010 12:01, Bihar Anwar wrote:
 On June 10, 2010 1:46:39 PM, Tomas Hajny wrote:
 .
 .
However, you shouldn't rely on the returned values
too much anyway.

 No, I just rely on such a returned values in a very few cases. For
 example, In Windows/OS2/DOS, when FindNext() encounters the end of a
 directory content, it returns ERROR_NO_MORE_FILES (18 or -18); whereas in
 UNIX, it returns -1 and errno is not set. Thus UNIX doesn;t consider it as
 an error, and this is more acceptable by me. So, my file searching
 function will return 0 in this situation. I'm certainly sure such a
 convention for the basic operations will never be changed in those OSes,
 so I attempt to handle this.

OK, this is a slightly different story then. Win32 API function FindFirst
(and thus also the Delphi function FindFirst provided in SysUtils) returns
the search handle (positive value) in case of a success and -1 in case
of an error. The implementation for OS/2 and DOS passes the error
information directly (rather than relying on a subsequent call to
GetLastError, which is again a Win32 API call and not directly
transferable, or using GetLastOSError and relying on the fact that no
other OS API has been used by the RTL in the meantime), but it needs to
use a negative value in order to differentiate from possitive values
meaning success. The same logic is then in turn also used for FindNext
(although that one does never return search handles even on Windows).

Tomas


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


Re: [fpc-pascal] Negative RTL Error Codes in Some Platforms

2010-06-10 Thread Bihar Anwar
On June 10, 2010 6:12:42 PM, Tomas Hajny wrote:


OK, this is a slightly different story then. Win32 API function FindFirst
(and thus also the Delphi function FindFirst provided in SysUtils) returns
the search handle (positive value) in case of a success and -1 in case
of an error. The implementation for OS/2 and DOS passes the error
information directly (rather than relying on a subsequent call to
GetLastError, which is again a Win32 API call and not directly
transferable, or using GetLastOSError and relying on the fact that no
other OS API has been used by the RTL in the meantime), but it needs to
use a negative value in order to differentiate from possitive values
meaning success. The same logic is then in turn also used for FindNext
(although that one does never return search handles even on Windows).

Thanks Tomas, that explanation even makes me understand this FPC decision 
better.



  

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


[fpc-pascal] would like to open source Ansi C parser

2010-06-10 Thread Albert Almeida
Hi,

I've an Ansi C parser written in Delphi that has been lying around my
HD for some time. It supports almost all language features and the
preprocessor is almost complete too.

I was wondering if there were any volunteers out there willing to
continue development of this as an Open Source project. This tool may
become a full fledged C Header to Pascal conversion tool.

-albert




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


Re: [fpc-pascal] would like to open source Ansi C parser

2010-06-10 Thread dmitry boyarintsev
On Fri, Jun 11, 2010 at 2:19 AM, Albert Almeida mago67...@yahoo.com wrote:
 I was wondering if there were any volunteers out there willing to
 continue development of this as an Open Source project. This tool may
 become a full fledged C Header to Pascal conversion tool.

I've written an ObjC parser myself, but since it doesn't support all
features of C-language, I'm interested in using other C parser.

like the one here: http://sourceforge.net/projects/topas/

So, if you start the open source project, please let me know.

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


[fpc-pascal] Re: how to use odbc Allow multiple statements

2010-06-10 Thread liuzg2
but

can  TSQLScript result as  tdateset?
1:
select top 1 * into #x from 
r_sale;

select * from #x
2:declare @busno VARCHAR(10)
select @busno='0001'
CREATE TABLE #wareid ..
select * from #wareid
where  bus...@busno

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


[fpc-pascal] how to use odbc Allow multiple statements

2010-06-10 Thread liuzg2
but can TSQLScript result as tdateset?
1: select top 1 * into #x from r_sale; select * from #x

2:declare @busno VARCHAR(10)
select @busno='0001'
CREATE TABLE #wareid ..
select * from #wareid where bus...@busno
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal