Browse Source

* Removed all procedures, variables and types which are dependent on dbf from the parser units by moving them to among others dbf_parser. So now the parser can be used by TBufDataset without any dependencies on dbf-specific stuff.

git-svn-id: trunk@5589 -
joost 18 years ago
parent
commit
229c70d300

+ 2 - 0
fcl/db/db.pp

@@ -38,6 +38,7 @@ type
 
 {LargeInt}
   LargeInt = Int64;
+  PLargeInt= ^LargeInt;
 
 { Auxiliary type }
   TStringFieldBuffer = Array[0..dsMaxStringSize] of Char;
@@ -116,6 +117,7 @@ type
 { TDateTimeRec }
 
   TDateTimeAlias = type TDateTime;
+  PDateTimeRec = ^TdateTimeRec;
   TDateTimeRec = record
     case TFieldType of
       ftDate: (Date: Longint);

+ 0 - 5
fcl/db/dbase/dbf_common.inc

@@ -209,11 +209,6 @@
 {$ifndef CPUI386}
   {$undef USE_ASSEMBLER_486_UP}
 {$endif}
-// Joost, 12-12-2006 Check temporarily disabled, until TDbf is properly changed so that
-// dbf_prscore is compilable without any dependencies on Dbf (and dbf_common.inc)
-{ifndef FPC_LITTLE_ENDIAN}
-  {message error TDbf is not compatible with non little-endian CPUs. Please contact the author.}
-{endif}
 
 {$ifdef USE_ASSEMBLER_486_UP}
   {$asmmode intel}

+ 6 - 51
fcl/db/dbase/dbf_common.pas

@@ -4,6 +4,11 @@ interface
 
 {$I dbf_common.inc}
 
+{$ifndef FPC_LITTLE_ENDIAN}
+  {$message error TDbf is not compatible with non little-endian CPUs. Please contact the author.}
+{$endif}
+
+
 uses
   SysUtils, Classes, DB
 {$ifndef WIN32}
@@ -38,15 +43,7 @@ type
 //-------------------------------------
 
   PDateTime = ^TDateTime;
-{$ifdef FPC_VERSION}
-  TDateTimeAlias = type TDateTime;
-  TDateTimeRec = record
-    case TFieldType of
-      ftDate: (Date: Longint);
-      ftTime: (Time: Longint);
-      ftDateTime: (DateTime: TDateTimeAlias);
-  end;
-{$else}
+{$ifndef FPC_VERSION}
   PtrInt = Longint;
 {$endif}
 
@@ -94,8 +91,6 @@ function GetCompleteFileName(const Base, FileName: string): string;
 function IsFullFilePath(const Path: string): Boolean; // full means not relative
 function DateTimeToBDETimeStamp(aDT: TDateTime): double;
 function BDETimeStampToDateTime(aBT: double): TDateTime;
-function  GetStrFromInt(Val: Integer; const Dst: PChar): Integer;
-procedure GetStrFromInt_Width(Val: Integer; const Width: Integer; const Dst: PChar; const PadChar: Char);
 {$ifdef SUPPORT_INT64}
 function  GetStrFromInt64(Val: Int64; const Dst: PChar): Integer;
 procedure GetStrFromInt64_Width(Val: Int64; const Width: Integer; const Dst: PChar; const PadChar: Char);
@@ -179,17 +174,6 @@ begin
   result := lpath;
 end;
 
-// it seems there is no pascal function to convert an integer into a PChar???
-
-procedure GetStrFromInt_Width(Val: Integer; const Width: Integer; const Dst: PChar; const PadChar: Char);
-var
-  Temp: array[0..10] of Char;
-  I, J: Integer;
-  NegSign: boolean;
-begin
-  {$I getstrfromint.inc}
-end;
-
 {$ifdef SUPPORT_INT64}
 
 procedure GetStrFromInt64_Width(Val: Int64; const Width: Integer; const Dst: PChar; const PadChar: Char);
@@ -203,35 +187,6 @@ end;
 
 {$endif}
 
-// it seems there is no pascal function to convert an integer into a PChar???
-// NOTE: in dbf_dbffile.pas there is also a convert routine, but is slightly different
-
-function GetStrFromInt(Val: Integer; const Dst: PChar): Integer;
-var
-  Temp: array[0..10] of Char;
-  I, J: Integer;
-begin
-  Val := Abs(Val);
-  // we'll have to store characters backwards first
-  I := 0;
-  J := 0;
-  repeat
-    Temp[I] := Chr((Val mod 10) + Ord('0'));
-    Val := Val div 10;
-    Inc(I);
-  until Val = 0;
-
-  // remember number of digits
-  Result := I;
-  // copy value, remember: stored backwards
-  repeat
-    Dst[J] := Temp[I-1];
-    Inc(J);
-    Dec(I);
-  until I = 0;
-  // done!
-end;
-
 {$ifdef SUPPORT_INT64}
 
 function GetStrFromInt64(Val: Int64; const Dst: PChar): Integer;

+ 1 - 1
fcl/db/dbase/dbf_dbffile.pas

@@ -197,7 +197,7 @@ uses
   BaseUnix,
 {$endif}
 {$endif}
-  dbf_str, dbf_lang;
+  dbf_str, dbf_lang, dbf_prssupp;
 
 const
   sDBF_DEC_SEP = '.';

+ 1 - 0
fcl/db/dbase/dbf_idxfile.pas

@@ -400,6 +400,7 @@ uses
   dbf_dbffile,
   dbf_fields,
   dbf_str,
+  dbf_prssupp,
   dbf_lang;
 
 const

File diff suppressed because it is too large
+ 2 - 993
fcl/db/dbase/dbf_parser.pas


+ 1176 - 1
fcl/db/dbase/dbf_prscore.pas

@@ -13,7 +13,7 @@ interface
 uses
   SysUtils,
   Classes,
-  dbf_common,
+  Db,
   dbf_prssupp,
   dbf_prsdef;
 
@@ -101,6 +101,139 @@ type
   end;
 
 
+//--Expression functions-----------------------------------------------------
+
+procedure FuncFloatToStr(Param: PExpressionRec);
+procedure FuncIntToStr_Gen(Param: PExpressionRec; Val: Integer);
+procedure FuncIntToStr(Param: PExpressionRec);
+procedure FuncDateToStr(Param: PExpressionRec);
+procedure FuncSubString(Param: PExpressionRec);
+procedure FuncUppercase(Param: PExpressionRec);
+procedure FuncLowercase(Param: PExpressionRec);
+procedure FuncAdd_F_FF(Param: PExpressionRec);
+procedure FuncAdd_F_FI(Param: PExpressionRec);
+procedure FuncAdd_F_II(Param: PExpressionRec);
+procedure FuncAdd_F_IF(Param: PExpressionRec);
+{$ifdef SUPPORT_INT64}
+procedure FuncAdd_F_FL(Param: PExpressionRec);
+procedure FuncAdd_F_IL(Param: PExpressionRec);
+procedure FuncAdd_F_LL(Param: PExpressionRec);
+procedure FuncAdd_F_LF(Param: PExpressionRec);
+procedure FuncAdd_F_LI(Param: PExpressionRec);
+{$endif}
+procedure FuncSub_F_FF(Param: PExpressionRec);
+procedure FuncSub_F_FI(Param: PExpressionRec);
+procedure FuncSub_F_II(Param: PExpressionRec);
+procedure FuncSub_F_IF(Param: PExpressionRec);
+{$ifdef SUPPORT_INT64}
+procedure FuncSub_F_FL(Param: PExpressionRec);
+procedure FuncSub_F_IL(Param: PExpressionRec);
+procedure FuncSub_F_LL(Param: PExpressionRec);
+procedure FuncSub_F_LF(Param: PExpressionRec);
+procedure FuncSub_F_LI(Param: PExpressionRec);
+{$endif}
+procedure FuncMul_F_FF(Param: PExpressionRec);
+procedure FuncMul_F_FI(Param: PExpressionRec);
+procedure FuncMul_F_II(Param: PExpressionRec);
+procedure FuncMul_F_IF(Param: PExpressionRec);
+{$ifdef SUPPORT_INT64}
+procedure FuncMul_F_FL(Param: PExpressionRec);
+procedure FuncMul_F_IL(Param: PExpressionRec);
+procedure FuncMul_F_LL(Param: PExpressionRec);
+procedure FuncMul_F_LF(Param: PExpressionRec);
+procedure FuncMul_F_LI(Param: PExpressionRec);
+{$endif}
+procedure FuncDiv_F_FF(Param: PExpressionRec);
+procedure FuncDiv_F_FI(Param: PExpressionRec);
+procedure FuncDiv_F_II(Param: PExpressionRec);
+procedure FuncDiv_F_IF(Param: PExpressionRec);
+{$ifdef SUPPORT_INT64}
+procedure FuncDiv_F_FL(Param: PExpressionRec);
+procedure FuncDiv_F_IL(Param: PExpressionRec);
+procedure FuncDiv_F_LL(Param: PExpressionRec);
+procedure FuncDiv_F_LF(Param: PExpressionRec);
+procedure FuncDiv_F_LI(Param: PExpressionRec);
+{$endif}
+procedure FuncStrI_EQ(Param: PExpressionRec);
+procedure FuncStrIP_EQ(Param: PExpressionRec);
+procedure FuncStrI_NEQ(Param: PExpressionRec);
+procedure FuncStrI_LT(Param: PExpressionRec);
+procedure FuncStrI_GT(Param: PExpressionRec);
+procedure FuncStrI_LTE(Param: PExpressionRec);
+procedure FuncStrI_GTE(Param: PExpressionRec);
+procedure FuncStrP_EQ(Param: PExpressionRec);
+procedure FuncStr_EQ(Param: PExpressionRec);
+procedure FuncStr_NEQ(Param: PExpressionRec);
+procedure FuncStr_LT(Param: PExpressionRec);
+procedure FuncStr_GT(Param: PExpressionRec);
+procedure FuncStr_LTE(Param: PExpressionRec);
+procedure FuncStr_GTE(Param: PExpressionRec);
+procedure Func_FF_EQ(Param: PExpressionRec);
+procedure Func_FF_NEQ(Param: PExpressionRec);
+procedure Func_FF_LT(Param: PExpressionRec);
+procedure Func_FF_GT(Param: PExpressionRec);
+procedure Func_FF_LTE(Param: PExpressionRec);
+procedure Func_FF_GTE(Param: PExpressionRec);
+procedure Func_FI_EQ(Param: PExpressionRec);
+procedure Func_FI_NEQ(Param: PExpressionRec);
+procedure Func_FI_LT(Param: PExpressionRec);
+procedure Func_FI_GT(Param: PExpressionRec);
+procedure Func_FI_LTE(Param: PExpressionRec);
+procedure Func_FI_GTE(Param: PExpressionRec);
+procedure Func_II_EQ(Param: PExpressionRec);
+procedure Func_II_NEQ(Param: PExpressionRec);
+procedure Func_II_LT(Param: PExpressionRec);
+procedure Func_II_GT(Param: PExpressionRec);
+procedure Func_II_LTE(Param: PExpressionRec);
+procedure Func_II_GTE(Param: PExpressionRec);
+procedure Func_IF_EQ(Param: PExpressionRec);
+procedure Func_IF_NEQ(Param: PExpressionRec);
+procedure Func_IF_LT(Param: PExpressionRec);
+procedure Func_IF_GT(Param: PExpressionRec);
+procedure Func_IF_LTE(Param: PExpressionRec);
+procedure Func_IF_GTE(Param: PExpressionRec);
+{$ifdef SUPPORT_INT64}
+procedure Func_LL_EQ(Param: PExpressionRec);
+procedure Func_LL_NEQ(Param: PExpressionRec);
+procedure Func_LL_LT(Param: PExpressionRec);
+procedure Func_LL_GT(Param: PExpressionRec);
+procedure Func_LL_LTE(Param: PExpressionRec);
+procedure Func_LL_GTE(Param: PExpressionRec);
+procedure Func_LF_EQ(Param: PExpressionRec);
+procedure Func_LF_NEQ(Param: PExpressionRec);
+procedure Func_LF_LT(Param: PExpressionRec);
+procedure Func_LF_GT(Param: PExpressionRec);
+procedure Func_LF_LTE(Param: PExpressionRec);
+procedure Func_LF_GTE(Param: PExpressionRec);
+procedure Func_FL_EQ(Param: PExpressionRec);
+procedure Func_FL_NEQ(Param: PExpressionRec);
+procedure Func_FL_LT(Param: PExpressionRec);
+procedure Func_FL_GT(Param: PExpressionRec);
+procedure Func_FL_LTE(Param: PExpressionRec);
+procedure Func_FL_GTE(Param: PExpressionRec);
+procedure Func_LI_EQ(Param: PExpressionRec);
+procedure Func_LI_NEQ(Param: PExpressionRec);
+procedure Func_LI_LT(Param: PExpressionRec);
+procedure Func_LI_GT(Param: PExpressionRec);
+procedure Func_LI_LTE(Param: PExpressionRec);
+procedure Func_LI_GTE(Param: PExpressionRec);
+procedure Func_IL_EQ(Param: PExpressionRec);
+procedure Func_IL_NEQ(Param: PExpressionRec);
+procedure Func_IL_LT(Param: PExpressionRec);
+procedure Func_IL_GT(Param: PExpressionRec);
+procedure Func_IL_LTE(Param: PExpressionRec);
+procedure Func_IL_GTE(Param: PExpressionRec);
+{$endif}
+procedure Func_AND(Param: PExpressionRec);
+procedure Func_OR(Param: PExpressionRec);
+procedure Func_NOT(Param: PExpressionRec);
+
+var
+  DbfWordsSensGeneralList, DbfWordsInsensGeneralList: TExpressList;
+  DbfWordsSensPartialList, DbfWordsInsensPartialList: TExpressList;
+  DbfWordsSensNoPartialList, DbfWordsInsensNoPartialList: TExpressList;
+  DbfWordsGeneralList: TExpressList;
+
 implementation
 
 { TCustomExpressionParser }
@@ -1060,5 +1193,1047 @@ begin
         end;
 end;
 
+
+//--Expression functions-----------------------------------------------------
+
+procedure FuncFloatToStr(Param: PExpressionRec);
+var
+  width, numDigits, resWidth: Integer;
+  extVal: Extended;
+begin
+  with Param^ do
+  begin
+    // get params;
+    numDigits := 0;
+    if Args[1] <> nil then
+      width := PInteger(Args[1])^
+    else
+      width := 18;
+    if Args[2] <> nil then
+      numDigits := PInteger(Args[2])^;
+    // convert to string
+    Res.AssureSpace(width);
+    extVal := PDouble(Args[0])^;
+    resWidth := FloatToText(Res.MemoryPos^, extVal, {$ifndef FPC_VERSION}fvExtended,{$endif} ffFixed, 18, numDigits);
+    // always use dot as decimal separator
+    if numDigits > 0 then
+      Res.MemoryPos^[resWidth-numDigits-1] := '.';
+    // result width smaller than requested width? -> add space to compensate
+    if (Args[1] <> nil) and (resWidth < width) then
+    begin
+      // move string so that it's right-aligned
+      Move(Res.MemoryPos^^, (Res.MemoryPos^)[width-resWidth], resWidth);
+      // fill gap with spaces
+      FillChar(Res.MemoryPos^^, width-resWidth, ' ');
+      // resWidth has been padded, update
+      resWidth := width;
+    end else if resWidth > width then begin
+      // result width more than requested width, cut
+      resWidth := width;
+    end;
+    // advance pointer
+    Inc(Res.MemoryPos^, resWidth);
+    // null-terminate
+    Res.MemoryPos^^ := #0;
+  end;
+end;
+
+procedure FuncIntToStr_Gen(Param: PExpressionRec; Val: Integer);
+var
+  width: Integer;
+begin
+  with Param^ do
+  begin
+    // width specified?
+    if Args[1] <> nil then
+    begin
+      // convert to string
+      width := PInteger(Args[1])^;
+      GetStrFromInt_Width(Val, width, Res.MemoryPos^, #32);
+      // advance pointer
+      Inc(Res.MemoryPos^, width);
+      // need to add decimal?
+      if Args[2] <> nil then
+      begin
+        // get number of digits
+        width := PInteger(Args[2])^;
+        // add decimal dot
+        Res.MemoryPos^^ := '.';
+        Inc(Res.MemoryPos^);
+        // add zeroes
+        FillChar(Res.MemoryPos^^, width, '0');
+        // go to end
+        Inc(Res.MemoryPos^, width);
+      end;
+    end else begin
+      // convert to string
+      width := GetStrFromInt(Val, Res.MemoryPos^);
+      // advance pointer
+      Inc(Param^.Res.MemoryPos^, width);
+    end;
+    // null-terminate
+    Res.MemoryPos^^ := #0;
+  end;
+end;
+
+procedure FuncIntToStr(Param: PExpressionRec);
+begin
+  FuncIntToStr_Gen(Param, PInteger(Param^.Args[0])^);
+end;
+
+procedure FuncDateToStr(Param: PExpressionRec);
+var
+  TempStr: string;
+begin
+  with Param^ do
+  begin
+    // create in temporary string
+    DateTimeToString(TempStr, 'yyyymmdd', PDateTimeRec(Args[0])^.DateTime);
+    // copy to buffer
+    Res.Append(PChar(TempStr), Length(TempStr));
+  end;
+end;
+
+procedure FuncSubString(Param: PExpressionRec);
+var
+  srcLen, index, count: Integer;
+begin
+  with Param^ do
+  begin
+    srcLen := StrLen(Args[0]);
+    index := PInteger(Args[1])^ - 1;
+    count := PInteger(Args[2])^;
+    if index + count <= srcLen then
+      Res.Append(Args[0]+index, count)
+    else
+      Res.MemoryPos^^ := #0;
+  end;
+end;
+
+procedure FuncUppercase(Param: PExpressionRec);
+var
+  dest: PChar;
+begin
+  with Param^ do
+  begin
+    // first copy
+    dest := (Res.MemoryPos)^;
+    Res.Append(Args[0], StrLen(Args[0]));
+    // make uppercase
+    AnsiStrUpper(dest);
+  end;
+end;
+
+procedure FuncLowercase(Param: PExpressionRec);
+var
+  dest: PChar;
+begin
+  with Param^ do
+  begin
+    // first copy
+    dest := (Res.MemoryPos)^;
+    Res.Append(Args[0], StrLen(Args[0]));
+    // make lowercase
+    AnsiStrLower(dest);
+  end;
+end;
+
+procedure FuncAdd_F_FF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ + PDouble(Args[1])^;
+end;
+
+procedure FuncAdd_F_FI(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ + PInteger(Args[1])^;
+end;
+
+procedure FuncAdd_F_II(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInteger(Res.MemoryPos^)^ := PInteger(Args[0])^ + PInteger(Args[1])^;
+end;
+
+procedure FuncAdd_F_IF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PInteger(Args[0])^ + PDouble(Args[1])^;
+end;
+
+{$ifdef SUPPORT_INT64}
+
+procedure FuncAdd_F_FL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ + PInt64(Args[1])^;
+end;
+
+procedure FuncAdd_F_IL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInteger(Args[0])^ + PInt64(Args[1])^;
+end;
+
+procedure FuncAdd_F_LL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInt64(Args[0])^ + PInt64(Args[1])^;
+end;
+
+procedure FuncAdd_F_LF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PInt64(Args[0])^ + PDouble(Args[1])^;
+end;
+
+procedure FuncAdd_F_LI(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInt64(Args[0])^ + PInteger(Args[1])^;
+end;
+
+{$endif}
+
+procedure FuncSub_F_FF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ - PDouble(Args[1])^;
+end;
+
+procedure FuncSub_F_FI(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ - PInteger(Args[1])^;
+end;
+
+procedure FuncSub_F_II(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInteger(Res.MemoryPos^)^ := PInteger(Args[0])^ - PInteger(Args[1])^;
+end;
+
+procedure FuncSub_F_IF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PInteger(Args[0])^ - PDouble(Args[1])^;
+end;
+
+{$ifdef SUPPORT_INT64}
+
+procedure FuncSub_F_FL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ - PInt64(Args[1])^;
+end;
+
+procedure FuncSub_F_IL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInteger(Args[0])^ - PInt64(Args[1])^;
+end;
+
+procedure FuncSub_F_LL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInt64(Args[0])^ - PInt64(Args[1])^;
+end;
+
+procedure FuncSub_F_LF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PInt64(Args[0])^ - PDouble(Args[1])^;
+end;
+
+procedure FuncSub_F_LI(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInt64(Args[0])^ - PInteger(Args[1])^;
+end;
+
+{$endif}
+
+procedure FuncMul_F_FF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ * PDouble(Args[1])^;
+end;
+
+procedure FuncMul_F_FI(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ * PInteger(Args[1])^;
+end;
+
+procedure FuncMul_F_II(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInteger(Res.MemoryPos^)^ := PInteger(Args[0])^ * PInteger(Args[1])^;
+end;
+
+procedure FuncMul_F_IF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PInteger(Args[0])^ * PDouble(Args[1])^;
+end;
+
+{$ifdef SUPPORT_INT64}
+
+procedure FuncMul_F_FL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ * PInt64(Args[1])^;
+end;
+
+procedure FuncMul_F_IL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInteger(Args[0])^ * PInt64(Args[1])^;
+end;
+
+procedure FuncMul_F_LL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInt64(Args[0])^ * PInt64(Args[1])^;
+end;
+
+procedure FuncMul_F_LF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PInt64(Args[0])^ * PDouble(Args[1])^;
+end;
+
+procedure FuncMul_F_LI(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInt64(Args[0])^ * PInteger(Args[1])^;
+end;
+
+{$endif}
+
+procedure FuncDiv_F_FF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ / PDouble(Args[1])^;
+end;
+
+procedure FuncDiv_F_FI(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ / PInteger(Args[1])^;
+end;
+
+procedure FuncDiv_F_II(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInteger(Res.MemoryPos^)^ := PInteger(Args[0])^ div PInteger(Args[1])^;
+end;
+
+procedure FuncDiv_F_IF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PInteger(Args[0])^ / PDouble(Args[1])^;
+end;
+
+{$ifdef SUPPORT_INT64}
+
+procedure FuncDiv_F_FL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PDouble(Args[0])^ / PInt64(Args[1])^;
+end;
+
+procedure FuncDiv_F_IL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInteger(Args[0])^ div PInt64(Args[1])^;
+end;
+
+procedure FuncDiv_F_LL(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInt64(Args[0])^ div PInt64(Args[1])^;
+end;
+
+procedure FuncDiv_F_LF(Param: PExpressionRec);
+begin
+  with Param^ do
+    PDouble(Res.MemoryPos^)^ := PInt64(Args[0])^ / PDouble(Args[1])^;
+end;
+
+procedure FuncDiv_F_LI(Param: PExpressionRec);
+begin
+  with Param^ do
+    PInt64(Res.MemoryPos^)^ := PInt64(Args[0])^ div PInteger(Args[1])^;
+end;
+
+{$endif}
+
+procedure FuncStrI_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrIComp(Args[0], Args[1]) = 0);
+end;
+
+procedure FuncStrIP_EQ(Param: PExpressionRec);
+var
+  arg0len, arg1len: integer;
+  match: boolean;
+  str0, str1: string;
+begin
+  with Param^ do
+  begin
+    arg1len := StrLen(Args[1]);
+    if Args[1][0] = '*' then
+    begin
+      if Args[1][arg1len-1] = '*' then
+      begin
+        str0 := AnsiStrUpper(Args[0]);
+        str1 := AnsiStrUpper(Args[1]+1);
+        setlength(str1, arg1len-2);
+        match := AnsiPos(str0, str1) = 0;
+      end else begin
+        arg0len := StrLen(Args[0]);
+        // at least length without asterisk
+        match := arg0len >= arg1len - 1;
+        if match then
+          match := AnsiStrLIComp(Args[0]+(arg0len-arg1len+1), Args[1]+1, arg1len-1) = 0;
+      end;
+    end else
+    if Args[1][arg1len-1] = '*' then
+    begin
+      arg0len := StrLen(Args[0]);
+      match := arg0len >= arg1len - 1;
+      if match then
+        match := AnsiStrLIComp(Args[0], Args[1], arg1len-1) = 0;
+    end else begin
+      match := AnsiStrIComp(Args[0], Args[1]) = 0;
+    end;
+    Res.MemoryPos^^ := Char(match);
+  end;
+end;
+
+procedure FuncStrI_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrIComp(Args[0], Args[1]) <> 0);
+end;
+
+procedure FuncStrI_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrIComp(Args[0], Args[1]) < 0);
+end;
+
+procedure FuncStrI_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrIComp(Args[0], Args[1]) > 0);
+end;
+
+procedure FuncStrI_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrIComp(Args[0], Args[1]) <= 0);
+end;
+
+procedure FuncStrI_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrIComp(Args[0], Args[1]) >= 0);
+end;
+
+procedure FuncStrP_EQ(Param: PExpressionRec);
+var
+  arg0len, arg1len: integer;
+  match: boolean;
+begin
+  with Param^ do
+  begin
+    arg1len := StrLen(Args[1]);
+    if Args[1][0] = '*' then
+    begin
+      if Args[1][arg1len-1] = '*' then
+      begin
+        Args[1][arg1len-1] := #0;
+        match := AnsiStrPos(Args[0], Args[1]+1) <> nil;
+        Args[1][arg1len-1] := '*';
+      end else begin
+        arg0len := StrLen(Args[0]);
+        // at least length without asterisk
+        match := arg0len >= arg1len - 1;
+        if match then
+          match := AnsiStrLComp(Args[0]+(arg0len-arg1len+1), Args[1]+1, arg1len-1) = 0;
+      end;
+    end else
+    if Args[1][arg1len-1] = '*' then
+    begin
+      arg0len := StrLen(Args[0]);
+      match := arg0len >= arg1len - 1;
+      if match then
+        match := AnsiStrLComp(Args[0], Args[1], arg1len-1) = 0;
+    end else begin
+      match := AnsiStrComp(Args[0], Args[1]) = 0;
+    end;
+    Res.MemoryPos^^ := Char(match);
+  end;
+end;
+
+procedure FuncStr_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrComp(Args[0], Args[1]) = 0);
+end;
+
+procedure FuncStr_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrComp(Args[0], Args[1]) <> 0);
+end;
+
+procedure FuncStr_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrComp(Args[0], Args[1]) < 0);
+end;
+
+procedure FuncStr_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrComp(Args[0], Args[1]) > 0);
+end;
+
+procedure FuncStr_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrComp(Args[0], Args[1]) <= 0);
+end;
+
+procedure FuncStr_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(AnsiStrComp(Args[0], Args[1]) >= 0);
+end;
+
+procedure Func_FF_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   =  PDouble(Args[1])^);
+end;
+
+procedure Func_FF_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <> PDouble(Args[1])^);
+end;
+
+procedure Func_FF_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <  PDouble(Args[1])^);
+end;
+
+procedure Func_FF_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   >  PDouble(Args[1])^);
+end;
+
+procedure Func_FF_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <= PDouble(Args[1])^);
+end;
+
+procedure Func_FF_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   >= PDouble(Args[1])^);
+end;
+
+procedure Func_FI_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   =  PInteger(Args[1])^);
+end;
+
+procedure Func_FI_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <> PInteger(Args[1])^);
+end;
+
+procedure Func_FI_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <  PInteger(Args[1])^);
+end;
+
+procedure Func_FI_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   >  PInteger(Args[1])^);
+end;
+
+procedure Func_FI_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <= PInteger(Args[1])^);
+end;
+
+procedure Func_FI_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   >= PInteger(Args[1])^);
+end;
+
+procedure Func_II_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  =  PInteger(Args[1])^);
+end;
+
+procedure Func_II_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <> PInteger(Args[1])^);
+end;
+
+procedure Func_II_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <  PInteger(Args[1])^);
+end;
+
+procedure Func_II_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  >  PInteger(Args[1])^);
+end;
+
+procedure Func_II_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <= PInteger(Args[1])^);
+end;
+
+procedure Func_II_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  >= PInteger(Args[1])^);
+end;
+
+procedure Func_IF_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  =  PDouble(Args[1])^);
+end;
+
+procedure Func_IF_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <> PDouble(Args[1])^);
+end;
+
+procedure Func_IF_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <  PDouble(Args[1])^);
+end;
+
+procedure Func_IF_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  >  PDouble(Args[1])^);
+end;
+
+procedure Func_IF_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <= PDouble(Args[1])^);
+end;
+
+procedure Func_IF_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  >= PDouble(Args[1])^);
+end;
+
+{$ifdef SUPPORT_INT64}
+
+procedure Func_LL_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    =  PInt64(Args[1])^);
+end;
+
+procedure Func_LL_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <> PInt64(Args[1])^);
+end;
+
+procedure Func_LL_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <  PInt64(Args[1])^);
+end;
+
+procedure Func_LL_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    >  PInt64(Args[1])^);
+end;
+
+procedure Func_LL_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <= PInt64(Args[1])^);
+end;
+
+procedure Func_LL_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    >= PInt64(Args[1])^);
+end;
+
+procedure Func_LF_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    =  PDouble(Args[1])^);
+end;
+
+procedure Func_LF_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <> PDouble(Args[1])^);
+end;
+
+procedure Func_LF_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <  PDouble(Args[1])^);
+end;
+
+procedure Func_LF_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    >  PDouble(Args[1])^);
+end;
+
+procedure Func_LF_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <= PDouble(Args[1])^);
+end;
+
+procedure Func_LF_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    >= PDouble(Args[1])^);
+end;
+
+procedure Func_FL_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   =  PInt64(Args[1])^);
+end;
+
+procedure Func_FL_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <> PInt64(Args[1])^);
+end;
+
+procedure Func_FL_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <  PInt64(Args[1])^);
+end;
+
+procedure Func_FL_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   >  PInt64(Args[1])^);
+end;
+
+procedure Func_FL_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   <= PInt64(Args[1])^);
+end;
+
+procedure Func_FL_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PDouble(Args[0])^   >= PInt64(Args[1])^);
+end;
+
+procedure Func_LI_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    =  PInteger(Args[1])^);
+end;
+
+procedure Func_LI_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <> PInteger(Args[1])^);
+end;
+
+procedure Func_LI_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <  PInteger(Args[1])^);
+end;
+
+procedure Func_LI_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    >  PInteger(Args[1])^);
+end;
+
+procedure Func_LI_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    <= PInteger(Args[1])^);
+end;
+
+procedure Func_LI_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInt64(Args[0])^    >= PInteger(Args[1])^);
+end;
+
+procedure Func_IL_EQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  =  PInt64(Args[1])^);
+end;
+
+procedure Func_IL_NEQ(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <> PInt64(Args[1])^);
+end;
+
+procedure Func_IL_LT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <  PInt64(Args[1])^);
+end;
+
+procedure Func_IL_GT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  >  PInt64(Args[1])^);
+end;
+
+procedure Func_IL_LTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  <= PInt64(Args[1])^);
+end;
+
+procedure Func_IL_GTE(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(PInteger(Args[0])^  >= PInt64(Args[1])^);
+end;
+
+{$endif}
+
+procedure Func_AND(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(Boolean(Args[0]^) and Boolean(Args[1]^));
+end;
+
+procedure Func_OR(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(Boolean(Args[0]^) or Boolean(Args[1]^));
+end;
+
+procedure Func_NOT(Param: PExpressionRec);
+begin
+  with Param^ do
+    Res.MemoryPos^^ := Char(not Boolean(Args[0]^));
+end;
+
+initialization
+
+  DbfWordsGeneralList := TExpressList.Create;
+  DbfWordsInsensGeneralList := TExpressList.Create;
+  DbfWordsInsensNoPartialList := TExpressList.Create;
+  DbfWordsInsensPartialList := TExpressList.Create;
+  DbfWordsSensGeneralList := TExpressList.Create;
+  DbfWordsSensNoPartialList := TExpressList.Create;
+  DbfWordsSensPartialList := TExpressList.Create;
+
+  with DbfWordsGeneralList do
+  begin
+    // basic function functionality
+    Add(TLeftBracket.Create('(', nil));
+    Add(TRightBracket.Create(')', nil));
+    Add(TComma.Create(',', nil));
+
+    // operators - name, param types, result type, func addr, precedence
+    Add(TFunction.CreateOper('+', 'SS', etString,   nil,          40));
+    Add(TFunction.CreateOper('+', 'FF', etFloat,    FuncAdd_F_FF, 40));
+    Add(TFunction.CreateOper('+', 'FI', etFloat,    FuncAdd_F_FI, 40));
+    Add(TFunction.CreateOper('+', 'IF', etFloat,    FuncAdd_F_IF, 40));
+    Add(TFunction.CreateOper('+', 'II', etInteger,  FuncAdd_F_II, 40));
+{$ifdef SUPPORT_INT64}
+    Add(TFunction.CreateOper('+', 'FL', etFloat,    FuncAdd_F_FL, 40));
+    Add(TFunction.CreateOper('+', 'IL', etLargeInt, FuncAdd_F_IL, 40));
+    Add(TFunction.CreateOper('+', 'LF', etFloat,    FuncAdd_F_LF, 40));
+    Add(TFunction.CreateOper('+', 'LL', etLargeInt, FuncAdd_F_LI, 40));
+    Add(TFunction.CreateOper('+', 'LI', etLargeInt, FuncAdd_F_LL, 40));
+{$endif}
+    Add(TFunction.CreateOper('-', 'FF', etFloat,    FuncSub_F_FF, 40));
+    Add(TFunction.CreateOper('-', 'FI', etFloat,    FuncSub_F_FI, 40));
+    Add(TFunction.CreateOper('-', 'IF', etFloat,    FuncSub_F_IF, 40));
+    Add(TFunction.CreateOper('-', 'II', etInteger,  FuncSub_F_II, 40));
+{$ifdef SUPPORT_INT64}
+    Add(TFunction.CreateOper('-', 'FL', etFloat,    FuncSub_F_FL, 40));
+    Add(TFunction.CreateOper('-', 'IL', etLargeInt, FuncSub_F_IL, 40));
+    Add(TFunction.CreateOper('-', 'LF', etFloat,    FuncSub_F_LF, 40));
+    Add(TFunction.CreateOper('-', 'LL', etLargeInt, FuncSub_F_LI, 40));
+    Add(TFunction.CreateOper('-', 'LI', etLargeInt, FuncSub_F_LL, 40));
+{$endif}
+    Add(TFunction.CreateOper('*', 'FF', etFloat,    FuncMul_F_FF, 40));
+    Add(TFunction.CreateOper('*', 'FI', etFloat,    FuncMul_F_FI, 40));
+    Add(TFunction.CreateOper('*', 'IF', etFloat,    FuncMul_F_IF, 40));
+    Add(TFunction.CreateOper('*', 'II', etInteger,  FuncMul_F_II, 40));
+{$ifdef SUPPORT_INT64}
+    Add(TFunction.CreateOper('*', 'FL', etFloat,    FuncMul_F_FL, 40));
+    Add(TFunction.CreateOper('*', 'IL', etLargeInt, FuncMul_F_IL, 40));
+    Add(TFunction.CreateOper('*', 'LF', etFloat,    FuncMul_F_LF, 40));
+    Add(TFunction.CreateOper('*', 'LL', etLargeInt, FuncMul_F_LI, 40));
+    Add(TFunction.CreateOper('*', 'LI', etLargeInt, FuncMul_F_LL, 40));
+{$endif}
+    Add(TFunction.CreateOper('/', 'FF', etFloat,    FuncDiv_F_FF, 40));
+    Add(TFunction.CreateOper('/', 'FI', etFloat,    FuncDiv_F_FI, 40));
+    Add(TFunction.CreateOper('/', 'IF', etFloat,    FuncDiv_F_IF, 40));
+    Add(TFunction.CreateOper('/', 'II', etInteger,  FuncDiv_F_II, 40));
+{$ifdef SUPPORT_INT64}
+    Add(TFunction.CreateOper('/', 'FL', etFloat,    FuncDiv_F_FL, 40));
+    Add(TFunction.CreateOper('/', 'IL', etLargeInt, FuncDiv_F_IL, 40));
+    Add(TFunction.CreateOper('/', 'LF', etFloat,    FuncDiv_F_LF, 40));
+    Add(TFunction.CreateOper('/', 'LL', etLargeInt, FuncDiv_F_LI, 40));
+    Add(TFunction.CreateOper('/', 'LI', etLargeInt, FuncDiv_F_LL, 40));
+{$endif}
+
+    Add(TFunction.CreateOper('=', 'FF', etBoolean, Func_FF_EQ , 80));
+    Add(TFunction.CreateOper('<', 'FF', etBoolean, Func_FF_LT , 80));
+    Add(TFunction.CreateOper('>', 'FF', etBoolean, Func_FF_GT , 80));
+    Add(TFunction.CreateOper('<=','FF', etBoolean, Func_FF_LTE, 80));
+    Add(TFunction.CreateOper('>=','FF', etBoolean, Func_FF_GTE, 80));
+    Add(TFunction.CreateOper('<>','FF', etBoolean, Func_FF_NEQ, 80));
+    Add(TFunction.CreateOper('=', 'FI', etBoolean, Func_FI_EQ , 80));
+    Add(TFunction.CreateOper('<', 'FI', etBoolean, Func_FI_LT , 80));
+    Add(TFunction.CreateOper('>', 'FI', etBoolean, Func_FI_GT , 80));
+    Add(TFunction.CreateOper('<=','FI', etBoolean, Func_FI_LTE, 80));
+    Add(TFunction.CreateOper('>=','FI', etBoolean, Func_FI_GTE, 80));
+    Add(TFunction.CreateOper('<>','FI', etBoolean, Func_FI_NEQ, 80));
+    Add(TFunction.CreateOper('=', 'II', etBoolean, Func_II_EQ , 80));
+    Add(TFunction.CreateOper('<', 'II', etBoolean, Func_II_LT , 80));
+    Add(TFunction.CreateOper('>', 'II', etBoolean, Func_II_GT , 80));
+    Add(TFunction.CreateOper('<=','II', etBoolean, Func_II_LTE, 80));
+    Add(TFunction.CreateOper('>=','II', etBoolean, Func_II_GTE, 80));
+    Add(TFunction.CreateOper('<>','II', etBoolean, Func_II_NEQ, 80));
+    Add(TFunction.CreateOper('=', 'IF', etBoolean, Func_IF_EQ , 80));
+    Add(TFunction.CreateOper('<', 'IF', etBoolean, Func_IF_LT , 80));
+    Add(TFunction.CreateOper('>', 'IF', etBoolean, Func_IF_GT , 80));
+    Add(TFunction.CreateOper('<=','IF', etBoolean, Func_IF_LTE, 80));
+    Add(TFunction.CreateOper('>=','IF', etBoolean, Func_IF_GTE, 80));
+    Add(TFunction.CreateOper('<>','IF', etBoolean, Func_IF_NEQ, 80));
+{$ifdef SUPPORT_INT64}
+    Add(TFunction.CreateOper('=', 'LL', etBoolean, Func_LL_EQ , 80));
+    Add(TFunction.CreateOper('<', 'LL', etBoolean, Func_LL_LT , 80));
+    Add(TFunction.CreateOper('>', 'LL', etBoolean, Func_LL_GT , 80));
+    Add(TFunction.CreateOper('<=','LL', etBoolean, Func_LL_LTE, 80));
+    Add(TFunction.CreateOper('>=','LL', etBoolean, Func_LL_GTE, 80));
+    Add(TFunction.CreateOper('<>','LL', etBoolean, Func_LL_NEQ, 80));
+    Add(TFunction.CreateOper('=', 'LF', etBoolean, Func_LF_EQ , 80));
+    Add(TFunction.CreateOper('<', 'LF', etBoolean, Func_LF_LT , 80));
+    Add(TFunction.CreateOper('>', 'LF', etBoolean, Func_LF_GT , 80));
+    Add(TFunction.CreateOper('<=','LF', etBoolean, Func_LF_LTE, 80));
+    Add(TFunction.CreateOper('>=','LF', etBoolean, Func_LF_GTE, 80));
+    Add(TFunction.CreateOper('<>','FI', etBoolean, Func_LF_NEQ, 80));
+    Add(TFunction.CreateOper('=', 'LI', etBoolean, Func_LI_EQ , 80));
+    Add(TFunction.CreateOper('<', 'LI', etBoolean, Func_LI_LT , 80));
+    Add(TFunction.CreateOper('>', 'LI', etBoolean, Func_LI_GT , 80));
+    Add(TFunction.CreateOper('<=','LI', etBoolean, Func_LI_LTE, 80));
+    Add(TFunction.CreateOper('>=','LI', etBoolean, Func_LI_GTE, 80));
+    Add(TFunction.CreateOper('<>','LI', etBoolean, Func_LI_NEQ, 80));
+    Add(TFunction.CreateOper('=', 'FL', etBoolean, Func_FL_EQ , 80));
+    Add(TFunction.CreateOper('<', 'FL', etBoolean, Func_FL_LT , 80));
+    Add(TFunction.CreateOper('>', 'FL', etBoolean, Func_FL_GT , 80));
+    Add(TFunction.CreateOper('<=','FL', etBoolean, Func_FL_LTE, 80));
+    Add(TFunction.CreateOper('>=','FL', etBoolean, Func_FL_GTE, 80));
+    Add(TFunction.CreateOper('<>','FL', etBoolean, Func_FL_NEQ, 80));
+    Add(TFunction.CreateOper('=', 'IL', etBoolean, Func_IL_EQ , 80));
+    Add(TFunction.CreateOper('<', 'IL', etBoolean, Func_IL_LT , 80));
+    Add(TFunction.CreateOper('>', 'IL', etBoolean, Func_IL_GT , 80));
+    Add(TFunction.CreateOper('<=','IL', etBoolean, Func_IL_LTE, 80));
+    Add(TFunction.CreateOper('>=','IL', etBoolean, Func_IL_GTE, 80));
+    Add(TFunction.CreateOper('<>','IL', etBoolean, Func_IL_NEQ, 80));
+{$endif}
+
+    Add(TFunction.CreateOper('NOT', 'B',  etBoolean, Func_NOT, 85));
+    Add(TFunction.CreateOper('AND', 'BB', etBoolean, Func_AND, 90));
+    Add(TFunction.CreateOper('OR',  'BB', etBoolean, Func_OR, 100));
+
+    // Functions - name, description, param types, min params, result type, Func addr
+    Add(TFunction.Create('STR',       '',      'FII', 1, etString, FuncFloatToStr, ''));
+    Add(TFunction.Create('STR',       '',      'III', 1, etString, FuncIntToStr, ''));
+    Add(TFunction.Create('DTOS',      '',      'D',   1, etString, FuncDateToStr, ''));
+    Add(TFunction.Create('SUBSTR',    'SUBS',  'SII', 3, etString, FuncSubString, ''));
+    Add(TFunction.Create('UPPERCASE', 'UPPER', 'S',   1, etString, FuncUppercase, ''));
+    Add(TFunction.Create('LOWERCASE', 'LOWER', 'S',   1, etString, FuncLowercase, ''));
+  end;
+
+  with DbfWordsInsensGeneralList do
+  begin
+    Add(TFunction.CreateOper('<', 'SS', etBoolean, FuncStrI_LT , 80));
+    Add(TFunction.CreateOper('>', 'SS', etBoolean, FuncStrI_GT , 80));
+    Add(TFunction.CreateOper('<=','SS', etBoolean, FuncStrI_LTE, 80));
+    Add(TFunction.CreateOper('>=','SS', etBoolean, FuncStrI_GTE, 80));
+    Add(TFunction.CreateOper('<>','SS', etBoolean, FuncStrI_NEQ, 80));
+  end;
+
+  with DbfWordsInsensNoPartialList do
+    Add(TFunction.CreateOper('=', 'SS', etBoolean, FuncStrI_EQ , 80));
+
+  with DbfWordsInsensPartialList do
+    Add(TFunction.CreateOper('=', 'SS', etBoolean, FuncStrIP_EQ, 80));
+
+  with DbfWordsSensGeneralList do
+  begin
+    Add(TFunction.CreateOper('<', 'SS', etBoolean, FuncStr_LT , 80));
+    Add(TFunction.CreateOper('>', 'SS', etBoolean, FuncStr_GT , 80));
+    Add(TFunction.CreateOper('<=','SS', etBoolean, FuncStr_LTE, 80));
+    Add(TFunction.CreateOper('>=','SS', etBoolean, FuncStr_GTE, 80));
+    Add(TFunction.CreateOper('<>','SS', etBoolean, FuncStr_NEQ, 80));
+  end;
+
+  with DbfWordsSensNoPartialList do
+    Add(TFunction.CreateOper('=', 'SS', etBoolean, FuncStr_EQ , 80));
+
+  with DbfWordsSensPartialList do
+    Add(TFunction.CreateOper('=', 'SS', etBoolean, FuncStrP_EQ , 80));
+
+finalization
+
+  DbfWordsGeneralList.Free;
+  DbfWordsInsensGeneralList.Free;
+  DbfWordsInsensNoPartialList.Free;
+  DbfWordsInsensPartialList.Free;
+  DbfWordsSensGeneralList.Free;
+  DbfWordsSensNoPartialList.Free;
+  DbfWordsSensPartialList.Free;
 end.
 

+ 1 - 3
fcl/db/dbase/dbf_prsdef.pas

@@ -7,7 +7,7 @@ interface
 uses
   SysUtils,
   Classes,
-  dbf_common,
+  Db,
   dbf_prssupp;
 
 const
@@ -344,8 +344,6 @@ const
 
 function ExprCharToExprType(ExprChar: Char): TExpressionType;
 
-
-
 implementation
 
 function ExprCharToExprType(ExprChar: Char): TExpressionType;

+ 43 - 0
fcl/db/dbase/dbf_prssupp.pas

@@ -49,10 +49,53 @@ type
     procedure FreeItem(Item: Pointer); override;
   end;
 
+function GetStrFromInt(Val: Integer; const Dst: PChar): Integer;
+procedure GetStrFromInt_Width(Val: Integer; const Width: Integer; const Dst: PChar; const PadChar: Char);
+
 implementation
 
 uses SysUtils;
 
+// it seems there is no pascal function to convert an integer into a PChar???
+// NOTE: in dbf_dbffile.pas there is also a convert routine, but is slightly different
+
+function GetStrFromInt(Val: Integer; const Dst: PChar): Integer;
+var
+  Temp: array[0..10] of Char;
+  I, J: Integer;
+begin
+  Val := Abs(Val);
+  // we'll have to store characters backwards first
+  I := 0;
+  J := 0;
+  repeat
+    Temp[I] := Chr((Val mod 10) + Ord('0'));
+    Val := Val div 10;
+    Inc(I);
+  until Val = 0;
+
+  // remember number of digits
+  Result := I;
+  // copy value, remember: stored backwards
+  repeat
+    Dst[J] := Temp[I-1];
+    Inc(J);
+    Dec(I);
+  until I = 0;
+  // done!
+end;
+
+// it seems there is no pascal function to convert an integer into a PChar???
+
+procedure GetStrFromInt_Width(Val: Integer; const Width: Integer; const Dst: PChar; const PadChar: Char);
+var
+  Temp: array[0..10] of Char;
+  I, J: Integer;
+  NegSign: boolean;
+begin
+  {$I getstrfromint.inc}
+end;
+
 destructor TOCollection.Destroy;
 begin
   FreeAll;

Some files were not shown because too many files changed in this diff