equal
deleted
inserted
replaced
21 unit uCommands; |
21 unit uCommands; |
22 |
22 |
23 interface |
23 interface |
24 |
24 |
25 var isDeveloperMode: boolean; |
25 var isDeveloperMode: boolean; |
26 type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean); |
26 type TVariableType = (vtCommand, vtLongInt, vtBoolean); |
27 TCommandHandler = procedure (var params: shortstring); |
27 TCommandHandler = procedure (var params: shortstring); |
28 |
28 |
29 procedure initModule; |
29 procedure initModule; |
30 procedure freeModule; |
30 procedure freeModule; |
31 procedure RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean); |
31 procedure RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean); |
73 c: char; |
73 c: char; |
74 begin |
74 begin |
75 //WriteLnToConsole(CmdStr); |
75 //WriteLnToConsole(CmdStr); |
76 if CmdStr[0]=#0 then exit; |
76 if CmdStr[0]=#0 then exit; |
77 c:= CmdStr[1]; |
77 c:= CmdStr[1]; |
78 if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/'; |
78 if (c = '/') or (c = '$') then Delete(CmdStr, 1, 1) else c:= '/'; |
79 s:= ''; |
79 s:= ''; |
80 SplitBySpace(CmdStr, s); |
80 SplitBySpace(CmdStr, s); |
81 AddFileLog('[Cmd] ' + c + CmdStr + ' (' + inttostr(length(s)) + ')'); |
81 AddFileLog('[Cmd] ' + c + CmdStr + ' (' + inttostr(length(s)) + ')'); |
82 t:= Variables; |
82 t:= Variables; |
83 while t <> nil do |
83 while t <> nil do |
94 if s[0]=#0 then |
94 if s[0]=#0 then |
95 begin |
95 begin |
96 str(PLongInt(t^.Handler)^, s); |
96 str(PLongInt(t^.Handler)^, s); |
97 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
97 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
98 end else val(s, PLongInt(t^.Handler)^); |
98 end else val(s, PLongInt(t^.Handler)^); |
99 vthwFloat: if c='$' then |
|
100 if s[0]=#0 then |
|
101 begin |
|
102 //str(PhwFloat(t^.Handler)^:4:6, s); |
|
103 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
|
104 end else; //val(s, PhwFloat(t^.Handler)^, i); |
|
105 vtBoolean: if c='$' then |
99 vtBoolean: if c='$' then |
106 if s[0]=#0 then |
100 if s[0]=#0 then |
107 begin |
101 begin |
108 str(ord(boolean(t^.Handler^)), s); |
102 str(ord(boolean(t^.Handler^)), s); |
109 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |
103 WriteLnToConsole('$' + CmdStr + ' is "' + s + '"'); |