Hey
Ich habe Narses Tutorial angefangen, aber ich hänge schon bei dem Termchar Tutorial.
In der Pdf steht es so drin:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33:
| TForm1 = class(TForm) [...] procedure ParseBuffer; function GetCmdToken(const StrToken: String): TCmdToken; procedure Execute(const Command: TCmdToken; Data: TStringList); [...] procedure TForm1.ParseBuffer; var Data: TStringList; Current: TCmdToken; OutOfArg: Boolean; begin Data := TStringList.Create; try Data.Text := ReceiveBuffer; OutOfArg := FALSE; while ( (Data.Count > 0) and (NOT OutOfArg) ) do begin Current := GetCmdToken(UpperCase(Data.Strings[0])); if (Data.Count >= Syntax[Current].ArgCount) then Execute(Current,Data) else OutOfArg := TRUE; end; ReceiveBuffer := Data.Text; finally Data.Free; end; end; |
Bei mir ist es so:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ScktComp;
const SERVER_PORT = 6786; Syntax: Array[TCmdToken] of TCmdSyntax = ( (Text: ''; ArgCount: 1), (Text: 'SAID'; ArgCount: 3), (Text: 'USER'; ArgCount: 2), (Text: ''; ArgCount: 1) ); type TCmdSyntax = record Text: ShortString; ArgCount: Integer; end; TCmdToken = ( cmdNOP = 0, cmdSAID, cmdUSER, cmdERROR );
TCmdSyntax = record Text: ShortString; ArgCount: Integer; end;
TCmdToken = ( cmdNOP = 0, cmdSAID, cmdUSER, cmdERROR );
TMyConState = ( mcsOffline, mcsPending, mcsOnline );
TForm1 = class(TForm) |
Ich bekomme folgende Fehlermeldungen:
[Error] Unit1.pas(12): Undeclared identifier: 'TCmdToken'
[Error] Unit1.pas(12): Undeclared identifier: 'TCmdSyntax'
[Error] Unit1.pas(12): Data type too large: exceeds 2 GB
[Error] Unit1.pas(13): '(' expected but ':' found
[Error] Unit1.pas(13): '..' expected but ')' found
[Error] Unit1.pas(14): '(' expected but ':' found
[Error] Unit1.pas(14): Identifier redeclared: 'ArgCount'
[Error] Unit1.pas(15): '(' expected but ':' found
[Error] Unit1.pas(15): Identifier redeclared: 'ArgCount'
[Error] Unit1.pas(16): '(' expected but ':' found
[Error] Unit1.pas(16): Identifier redeclared: 'ArgCount'
[Error] Unit1.pas(17): Expression expected but ';' found
[Error] Unit1.pas(19): Identifier redeclared: 'TCmdSyntax'
[Error] Unit1.pas(24): Identifier redeclared: 'TCmdToken'
[Error] Unit1.pas(31): Identifier redeclared: 'TCmdSyntax'
[Error] Unit1.pas(36): Identifier redeclared: 'TCmdToken'
[Error] Unit1.pas(37): Identifier redeclared: 'cmdNOP'
[Error] Unit1.pas(3

: Identifier redeclared: 'cmdSAID'
[Error] Unit1.pas(39): Identifier redeclared: 'cmdUSER'
[Error] Unit1.pas(40): Identifier redeclared: 'cmdERROR'
[Error] Unit1.pas(201): ')' expected but identifier 'ArgCount' found
[Error] Unit1.pas(213): Undeclared identifier: 'i'
[Error] Unit1.pas(257): 'DO' expected but identifier 'ArgCount' found
[Fatal Error] Client.dpr(5): Could not compile used unit 'Unit1.pas'