From: Maël Hörz <ma...@us...> - 2008-10-25 23:30:37
|
Update of /cvsroot/synedit/SynEdit/SynGen In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10116/SynGen Modified Files: Tag: Unicode_2004_08_31 GenLex.pas SynGenUnit.pas Log Message: Compatibility fixes for Delphi 7 Index: GenLex.pas =================================================================== RCS file: /cvsroot/synedit/SynEdit/SynGen/GenLex.pas,v retrieving revision 1.4.2.3 retrieving revision 1.4.2.4 diff -u -d -r1.4.2.3 -r1.4.2.4 --- GenLex.pas 25 Oct 2008 23:15:48 -0000 1.4.2.3 +++ GenLex.pas 25 Oct 2008 23:30:31 -0000 1.4.2.4 @@ -42,7 +42,7 @@ interface uses - SysUtils, Windows, Messages, Classes, Controls, LongIntList; + SysUtils, Windows, Messages, Classes, Controls, LongIntList, SynUnicode; var Identifiers: array[#0..#255] of ByteBool; @@ -75,20 +75,20 @@ TGenLex = class(TObject) private fIgnoreComments: Boolean; - fOrigin: PChar; + fOrigin: PWideChar; fProcTable: array[#0..#255] of procedure of object; fFuncTable: array[#0..#255] of function: TIdTokenKind of object; Run: Integer; Walker: LongInt; Running: LongInt; fStringLen: Integer; - fToIdent: PChar; + fToIdent: PWideChar; fTokenizing: Boolean; FLinePosList: TLongIntList; FTokenPositionsList: TLongIntList; fIdentFuncTable: array[0..150] of function: TIdTokenKind of object; - function KeyHash(ToHash: PChar): Integer; - function KeyComp(aKey: string): Boolean; + function KeyHash(ToHash: PWideChar): Integer; + function KeyComp(aKey: UnicodeString): Boolean; function Func49: TIdTokenKind; function Func60: TIdTokenKind; function Func67: TIdTokenKind; @@ -118,12 +118,12 @@ function UnknownFunc: TIdTokenKind; function AltFunc: TIdTokenKind; procedure InitIdent; - function IdentKind(MayBe: PChar): TIdTokenKind; - procedure SetOrigin(NewValue: PChar); + function IdentKind(MayBe: PWideChar): TIdTokenKind; + procedure SetOrigin(NewValue: PWideChar); procedure SetRunPos(Value: Integer); procedure MakeMethodTables; function GetRunId: TIdTokenKind; - function GetRunToken: string; + function GetRunToken: UnicodeString; protected public constructor Create; @@ -131,12 +131,12 @@ procedure Tokenize; procedure Next; property IgnoreComments: Boolean read fIgnoreComments write fIgnoreComments; - property Origin: PChar read fOrigin write SetOrigin; + property Origin: PWideChar read fOrigin write SetOrigin; property RunPos: Integer read Run write SetRunPos; - function NextToken: string; + function NextToken: UnicodeString; function EOF: Boolean; property RunId: TIdTokenKind read GetRunId; - property RunToken: string read GetRunToken; + property RunToken: UnicodeString read GetRunToken; published end; @@ -184,21 +184,21 @@ end; end; -function TGenLex.KeyHash(ToHash: PChar): Integer; +function TGenLex.KeyHash(ToHash: PWideChar): Integer; begin Result := 0; while CharInSet(ToHash^, ['_', '0'..'9', 'a'..'z', 'A'..'Z']) do begin - Inc(Result, mHashTable[ToHash^]); + Inc(Result, mHashTable[Char(ToHash^)]); Inc(ToHash); end; fStringLen := ToHash - fToIdent; end; { KeyHash } -function TGenLex.KeyComp(aKey: string): Boolean; +function TGenLex.KeyComp(aKey: UnicodeString): Boolean; var I: Integer; - Temp: PChar; + Temp: PWideChar; begin Temp := fToIdent; if Length(aKey) = fStringLen then @@ -206,7 +206,7 @@ Result := True; for i := 1 to fStringLen do begin - if mHashTable[Temp^] <> mHashTable[aKey[i]] then + if mHashTable[Char(Temp^)] <> mHashTable[Char(aKey[i])] then begin Result := False; break; @@ -311,7 +311,7 @@ Result := IdIdentifier; end; -function TGenLex.IdentKind(MayBe: PChar): TIdTokenKind; +function TGenLex.IdentKind(MayBe: PWideChar): TIdTokenKind; var HashKey: Integer; begin @@ -389,7 +389,7 @@ FLinePosList.Free; end; { Destroy } -procedure TGenLex.SetOrigin(NewValue: PChar); +procedure TGenLex.SetOrigin(NewValue: PWideChar); begin fOrigin := NewValue; Run := 0; @@ -490,7 +490,7 @@ procedure TGenLex.IdentProc; begin inc(Walker); - while Identifiers[fOrigin[Walker]] do + while Identifiers[Char(fOrigin[Walker])] do inc(Walker); end; @@ -568,10 +568,10 @@ function TGenLex.GetRunId: TIdTokenKind; begin Running := FTokenPositionsList[Run]; - Result := fFuncTable[fOrigin[Running]]; + Result := fFuncTable[Char(fOrigin[Running])]; end; -function TGenLex.GetRunToken: string; +function TGenLex.GetRunToken: UnicodeString; var StartPos, EndPos, StringLen: Integer; begin @@ -585,7 +585,7 @@ begin fTokenizing := True; repeat - fProcTable[fOrigin[Walker]]; + fProcTable[Char(fOrigin[Walker])]; FTokenPositionsList.Add(Walker); until fOrigin[Walker] = #0; fTokenizing := False; @@ -596,7 +596,7 @@ Inc(Run); end; -function TGenLex.NextToken: string; +function TGenLex.NextToken: UnicodeString; var StartPos, EndPos, Len: LongInt; begin Index: SynGenUnit.pas =================================================================== RCS file: /cvsroot/synedit/SynEdit/SynGen/SynGenUnit.pas,v retrieving revision 1.18.2.10 retrieving revision 1.18.2.11 diff -u -d -r1.18.2.10 -r1.18.2.11 --- SynGenUnit.pas 25 Oct 2008 23:15:48 -0000 1.18.2.10 +++ SynGenUnit.pas 25 Oct 2008 23:30:31 -0000 1.18.2.11 @@ -57,7 +57,7 @@ uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, GenLex, ComCtrls, Menus; + StdCtrls, GenLex, ComCtrls, Menus, SynUnicode; var mKeyHashTable: array[#0..#255] of Integer; @@ -195,7 +195,7 @@ {$IFDEF SYN_COMPILER_6_UP} StrUtils, {$ENDIF} - Registry, SynUnicode, HashTableGen; + Registry, HashTableGen; const BoolStrs: array[Boolean] of string = ('False', 'True'); // Do not localize @@ -850,10 +850,12 @@ Writeln(OutFile, ' QGraphics,'); Writeln(OutFile, ' QSynEditTypes,'); Writeln(OutFile, ' QSynEditHighlighter,'); + Writeln(OutFile, ' QSynUnicode,'); Writeln(OutFile, '{$ELSE}'); Writeln(OutFile, ' Graphics,'); Writeln(OutFile, ' SynEditTypes,'); Writeln(OutFile, ' SynEditHighlighter,'); + Writeln(OutFile, ' SynUnicode,'); Writeln(OutFile, '{$ENDIF}'); Writeln(OutFile, ' SysUtils,'); Writeln(OutFile, ' Classes;'); |