[fpc-pascal] converting TjanSQL

Bisma Jayadi bisma at brawijaya.ac.id
Tue Mar 21 09:47:59 CET 2006


> Turn on delphi mode for the package and/or add {$mode delphi} everywhere.
> (big chance that you have to change the @'s back).

I just did this, turn on Delphi mode on every single unit. To make sure the 
class is compiled correctly, though I'd change them later to FPC_OBJFPC mode for 
better and cleaner syntax. But I'll do it later, after this convertion is done 
and the code run as expected (within Delphi mode).

> Without it, it is possible that you now have shortstrings in a lot of
> places.

I also did this, turn on LongString mode on every single unit.

And, unfortunately... I stuck at janSQL unit (main unit of TjanSQL class) at the 
class constructor method. It's at FEParser.onGetVariable assignment, for 
precise. Now, FPC can't compile it because of this. Here is the code of the 
class' constructor:

---
constructor TjanSQL.create;
begin
   DecimalSeparator:='.';
   FQueries:=TList.create;
   gen:=TStringList.create;
   FSQL:=TStringList.create;
   FNameSpace:=TmwStringHashList.create
               (tinyhash,HashSecondaryOne,HashCompare);
   FEParser:=TjanSQLExpression2.create;

   FEParser.onGetVariable:=getvariable; // <- here the compiler stucked!

   FrecordSets:=TjanRecordSetList.Create;
end;
---

The error message is "Incompatible type for arg no.1: Got...". If I changed the 
line into this

FEParser.onGetVariable:=@getvariable;

still FPC failed to compile. And the error message is "Variable identifier 
expected". Now... it can't be compiled at all. :(

I think it's because the "type incompatibility" between the getvariable() 
procedure in TjanSQL class and TSubExpressionEvent type in janSQLTOkenizer unit, 
though they both are perfectly equal. I wonder why FPC considered them 
incompatible. I don't know how to fix this, yet. I'll search more informations 
on the FPC documentation.

I'll still working on this and hope it'll be solved today because I have to do 
something else at the next day. Any helps will be very much appreciated. Thank you.

Regards,

-Bee-

has Bee.ography at
http://beeography.wordpress.com



More information about the fpc-pascal mailing list