Skip to content

Commit 53fb3b3

Browse files
committed
Resolved all but 7 warings
1 parent 8ecd7ea commit 53fb3b3

23 files changed

+185
-261
lines changed

Rhodus_Version_3/RhodusVersionThreeProject.dproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<FrameworkType>None</FrameworkType>
66
<MainSource>RhodusVersionThreeProject.dpr</MainSource>
77
<Base>True</Base>
8-
<Config Condition="'$(Config)'==''">Release</Config>
8+
<Config Condition="'$(Config)'==''">Debug</Config>
99
<Platform Condition="'$(Platform)'==''">Win32</Platform>
1010
<TargetedPlatforms>3</TargetedPlatforms>
1111
<AppType>Console</AppType>
0 Bytes
Binary file not shown.

Rhodus_Version_3/uBuiltInConfig.pas

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ TBuiltInConfig= class (TModuleLib)
2626

2727
implementation
2828

29-
Uses Windows, uSymboLTable, uVM, uStringObject, uListObject, uMemoryManager, uRhodusEngine;
29+
Uses Windows,
30+
uSymboLTable,
31+
uVM,
32+
uStringObject,
33+
uListObject,
34+
uMemoryManager,
35+
uMachineStack,
36+
uRhodusEngine;
3037

3138
// --------------------------------------------------------------------------------------------
3239

@@ -55,7 +62,7 @@ procedure TBuiltInConfig.showByteCode (vm : TObject);
5562

5663
procedure TBuiltInConfig.getVersion (vm : TObject);
5764
begin
58-
TVM (vm).push (TStringObject.create(RHODUS_VERSION));
65+
TVM (vm).push (TStringObject.create(string (RHODUS_VERSION)));
5966
end;
6067

6168

Rhodus_Version_3/uBuiltInFile.pas

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ procedure TBuiltInFile.openFile (vm : TObject);
156156

157157
procedure TBuiltInFile.closeFile (vm : TObject);
158158
var fileHandle : integer;
159-
f : TStreamReader;
160159
fr : TFileRecord;
161160
begin
162161
fileHandle := TVM (vm).popInteger;

Rhodus_Version_3/uBuiltInGlobal.pas

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ procedure computeBaseLineMemoryAllocated;
1818
procedure addGlobalMethodsToModule (module : TModuleLib);
1919

2020
var mainModule : TModuleLib;
21-
baseLineMemoryAllocated : integer;
21+
baseLineMemoryAllocated : UInt64;
2222

2323
procedure createGlobalBuiltIns;
2424

@@ -100,7 +100,7 @@ procedure argMustBeNumber;
100100

101101
function getMemoryAllocated : integer;
102102
var st: TMemoryManagerState; sb: TSmallBlockTypeState;
103-
value : integer;
103+
value : UInt64;
104104
begin
105105
getMemoryManagerState(st);
106106
value := st.TotalAllocatedMediumBlockSize + st.TotalAllocatedLargeBlockSize;
@@ -227,7 +227,7 @@ function countElements (alist : TListObject) : integer;
227227

228228
function getDimensions (alist : TListObject; count : integer) : TIndexArray;
229229
var firstdim : integer;
230-
i, n, dimIndex : integer;
230+
n, dimIndex : integer;
231231
aitem : TListItem;
232232
begin
233233
firstdim := alist.list.Count;
@@ -410,13 +410,13 @@ procedure TBuiltInGlobal.readString (vm : TObject);
410410
nArgs := TVM (vm).popInteger;
411411
case nArgs of
412412
0 : prompt := '';
413-
1 : prompt := TVM (vm).popString ().value;
413+
1 : prompt := AnsiString (TVM (vm).popString ().value);
414414
else
415415
raise ERuntimeException.Create('readString takes a single string argument or none at all');
416416
end;
417417

418418
if Assigned (TVM (vm).readStringCallbackPtr) then
419-
s := TVM (vm).readStringCallbackPtr(prompt);
419+
s := string (AnsiString (TVM (vm).readStringCallbackPtr(prompt)));
420420
sobj := TStringObject.create (s);
421421
TVM (vm).push (sObj);
422422
end;
@@ -432,20 +432,20 @@ procedure TBuiltInGlobal.readNumber (vm : TObject);
432432
nArgs := TVM (vm).popInteger;
433433
case nArgs of
434434
0 : prompt := '';
435-
1 : prompt := TVM (vm).popString ().value;
435+
1 : prompt := AnsiString (TVM (vm).popString ().value);
436436
else
437437
raise ERuntimeException.Create('readString takes a single string argument or none at all');
438438
end;
439439

440440
if Assigned (TVM (vm).readStringCallbackPtr) then
441-
s := TVM (vm).readStringCallbackPtr(prompt);
441+
s := string (AnsiString (TVM (vm).readStringCallbackPtr(prompt)));
442442

443443
while (not TryStrToInt(s, iValue)) and (not TryStrToFloat(s, dValue)) do
444444
begin
445445
if assigned (TVM (vm).printlnCallbackPtr) then
446-
TVM (vm).printlnCallbackPtr ('Number error: ' + s + ' is not a number, try again');
446+
TVM (vm).printlnCallbackPtr (AnsiString ('Number error: ' + s + ' is not a number, try again'));
447447
if Assigned (TVM (vm).readStringCallbackPtr) then
448-
s := TVM (vm).readStringCallbackPtr(prompt);
448+
s := string (AnsiString (TVM (vm).readStringCallbackPtr(prompt)));
449449
end;
450450
if TryStrToInt(s, iValue) then
451451
TVM (vm).push (iValue)

Rhodus_Version_3/uBuiltInMatrix.pas

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ procedure TBuiltInMatrix.getTranspose (vm : TObject);
147147

148148

149149
procedure TBuiltInMatrix.getAdd (vm : TObject);
150-
var m1, m2, ar : TArrayObject;
150+
var m1, m2 : TArrayObject;
151151
begin
152152
m2 := TVM (vm).popArray;
153153
m1 := TVM (vm).popArray;
@@ -159,7 +159,7 @@ procedure TBuiltInMatrix.getAdd (vm : TObject);
159159

160160

161161
procedure TBuiltInMatrix.getSub (vm : TObject);
162-
var m1, m2, ar : TArrayObject;
162+
var m1, m2 : TArrayObject;
163163
begin
164164
m2 := TVM (vm).popArray;
165165
m1 := TVM (vm).popArray;
@@ -266,8 +266,6 @@ procedure TBuiltInMatrix.matrixGeneralMult (vm : TObject; m : TArrayObject; x :
266266

267267
procedure TBuiltInMatrix.getMult (vm : TObject);
268268
var m1, m2 : PMachineStackRecord;
269-
ar : TArrayObject;
270-
sum : double;
271269
begin
272270
m2 := TVM (vm).pop;
273271
m1 := TVM (vm).pop;

Rhodus_Version_3/uBuiltInSys.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ constructor TBuiltInSys.Create;
4646
begin
4747
inherited Create ('sys', 'System module');
4848

49-
addStringValue ('version', uBuiltInConfig.RHODUS_VERSION, 'returns the current version number for Rhodus', True);
49+
addStringValue ('version', string (uBuiltInConfig.RHODUS_VERSION), 'returns the current version number for Rhodus', True);
5050
addStringValue ('doubleFormat', TBuiltInSys.defaultDoubleFormat, 'default output format string for double values', False);
5151
addStringValue ('integerFormat', TBuiltInSys.defaultIntegerFormat, 'default output format string for integer values', False);
5252

Rhodus_Version_3/uConstructAST.pas

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ TConstructAST = class(TObject)
5454

5555
function expect(thisToken: TTokenCode) : TASTNode;
5656
function variable: TASTNode;
57-
function parseList: TASTNode;
5857
function parseIndexOrSlice : TASTNode;
5958
function parseIndexedVariable : TASTNode;
6059
function parseFunctionCall: TASTNode;
@@ -251,21 +250,6 @@ function TConstructAST.variable: TASTNode;
251250
end;
252251
end;
253252

254-
// Parse a list of the form: expression ',' expression ','' etc.
255-
// Returns the number of items found in the list
256-
function TConstructAST.parseList: TASTNode;
257-
var node : TASTNodeList;
258-
begin
259-
node := TASTNodeList.Create (ntNodeList);
260-
node.list.Add(expression);
261-
while sc.token = tComma do
262-
begin
263-
sc.nextToken;
264-
node.list.Add(expression);
265-
end;
266-
exit (node);
267-
end;
268-
269253

270254
// Parse: x:y :y x: : x
271255
function TConstructAST.parseIndexOrSlice : TASTNode;
@@ -301,8 +285,7 @@ function TConstructAST.parseIndexOrSlice : TASTNode;
301285
// Parse something of the form variable '[' expressionList ']'
302286
// Such indexing applies to lists and strings
303287
function TConstructAST.parseIndexedVariable : TASTNode;
304-
var node : TASTNode;
305-
nodeList : TASTNodeList;
288+
var nodeList : TASTNodeList;
306289
exp : TASTNode;
307290
begin
308291
nodelist := TASTNodeList.Create (ntNodeList);
@@ -1323,7 +1306,7 @@ function TConstructAST.forStatement: TASTNode;
13231306
breakStack: TStack<integer>;
13241307
assignment: TASTAssignment;
13251308
iterationBlock: TASTIterationBlock;
1326-
rightSide, body, node: TASTNode;
1309+
body, node: TASTNode;
13271310
lower, upper : TASTExpression;
13281311
id : TASTIdentifier;
13291312
begin

Rhodus_Version_3/uObjectSupport.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ implementation
3636

3737
Uses uListObject,
3838
uStringObject,
39+
uMachineStack,
3940
uVM;
4041

4142
constructor TMethodsBase.Create;
@@ -53,9 +54,8 @@ destructor TMethodsBase.Destroy;
5354

5455
procedure TMethodsBase.dir(vm: TObject);
5556
var ls : TListObject;
56-
md : TMethodDetails;
5757
begin
58-
md := TVM (vm).popMethodDetails;
58+
TVM (vm).popMethodDetails;
5959
ls := TListObject.create (0);
6060
for var i := 0 to methodList.Count - 1 do
6161
begin

Rhodus_Version_3/uRepl.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function myRead (const prompt : AnsiString) : PAnsiChar;
6161

6262
procedure setColor (acolor : AnsiString);
6363
begin
64-
uTerminal.setColor(aColor);
64+
uTerminal.setColor(string (aColor));
6565
end;
6666

6767

@@ -153,7 +153,7 @@ function executeCommand (src : string) : boolean;
153153
var index : integer;
154154
helpStr : string;
155155
begin
156-
result := False;
156+
//result := False;
157157

158158
if listOfCommands.find (getCommand (src), index) then
159159
begin

Rhodus_Version_3/uRhodusEngine.pas

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function TRhodus.compileToAST (sourceCode : string; var syntaxError : TSyntaxErr
167167
begin
168168
root := ast.constructAST ();
169169
if bolShowTree then
170-
printLnCallBack (displayAST (root));
170+
printLnCallBack (AnsiString (displayAST (root)));
171171
end
172172
else
173173
result := False;
@@ -226,7 +226,7 @@ function TRhodus.compileCode (const src : string; var module : TModuleLib; inter
226226
error : TSyntaxError;
227227
compilerError : TCompilerError;
228228
begin
229-
result := True;
229+
result := True; root := nil;
230230
// Note we don't clear the symboltables because the next script
231231
// may need to refer to entries in the symbol table.
232232
module.clearCode;
@@ -239,19 +239,19 @@ function TRhodus.compileCode (const src : string; var module : TModuleLib; inter
239239
try
240240
if not syntaxParser.syntaxCheck (error) then
241241
begin
242-
printLnCallBack ('ERROR ' + '[line ' + inttostr (error.lineNumber) + ', column: ' + inttostr (error.columnNumber) + '] ' + error.errorMsg);
242+
printLnCallBack (AnsiString ('ERROR ' + '[line ' + inttostr (error.lineNumber) + ', column: ' + inttostr (error.columnNumber) + '] ' + error.errorMsg));
243243
result := False;
244244
exit;
245245
end;
246246
root := ast.constructAST;
247247

248248
if bolShowByteCode then
249-
printLnCallBack (displayAST (root));
249+
printLnCallBack (AnsiString (displayAST (root)));
250250
try
251251
if not compiler.startCompilation (module, root, compilerError) then
252252
begin
253253
//setGreen;
254-
printLnCallBack ('ERROR ' + '[line ' + inttostr (compilerError.lineNumber) + ', column: ' + inttostr (compilerError.columnNumber) + '] ' + compilerError.errorMsg);
254+
printLnCallBack (AnsiString ('ERROR ' + '[line ' + inttostr (compilerError.lineNumber) + ', column: ' + inttostr (compilerError.columnNumber) + '] ' + compilerError.errorMsg));
255255
//setWhite;
256256
result := False;
257257
exit;
@@ -262,7 +262,7 @@ function TRhodus.compileCode (const src : string; var module : TModuleLib; inter
262262
on e: ERuntimeException do
263263
begin
264264
//setGreen;
265-
printLnCallBack ('ERROR: ' + e.Message);
265+
printLnCallBack (AnsiString ('ERROR: ' + e.Message));
266266
//setWhite;
267267
result := False;
268268
end;
@@ -277,7 +277,7 @@ function TRhodus.compileCode (const src : string; var module : TModuleLib; inter
277277
on e:exception do
278278
begin
279279
//setGreen;
280-
printLnCallBack ('ERROR ' + '[line ' + inttostr (sc.tokenElement.lineNumber) + ', column: ' + inttostr (sc.tokenElement.columnNumber) + '] ' + e.Message);
280+
printLnCallBack (AnsiString ('ERROR ' + '[line ' + inttostr (sc.tokenElement.lineNumber) + ', column: ' + inttostr (sc.tokenElement.columnNumber) + '] ' + e.Message));
281281
//setWhite;
282282
result := False;
283283
end;
@@ -287,7 +287,7 @@ function TRhodus.compileCode (const src : string; var module : TModuleLib; inter
287287

288288
function TRhodus.memAllocatedByVm : integer;
289289
var vm : TVM;
290-
start : integer;
290+
start : UInt64;
291291
begin
292292
start := getMemoryAllocated();
293293
vm := TVM.Create;
@@ -304,9 +304,9 @@ procedure TRhodus.showByteCodeMethod (module : TModule);
304304
if mainModule.symbolTable.Items[key].symbolType = symUserFunc then
305305
begin
306306
if not mainModule.symbolTable.items[key].fValue.isbuiltInFunction then
307-
printLnCallBack (dissassemble(mainModule, mainModule.symbolTable.items[key].fValue.codeBlock));
307+
printLnCallBack (AnsiString (dissassemble(mainModule, mainModule.symbolTable.items[key].fValue.codeBlock)));
308308
end;
309-
printLnCallBack (dissassemble(mainModule, mainModule.moduleProgram));
309+
printLnCallBack (AnsiString (dissassemble(mainModule, mainModule.moduleProgram)));
310310
end;
311311

312312

@@ -367,28 +367,28 @@ function TRhodus.runCode (module : TModule; interactive : boolean) : boolean;
367367
stNone : begin end;
368368
stInteger : begin
369369
fmt := SysLibraryRef.find ('integerFormat').sValue.value;
370-
printLnCallBack (Format (fmt, [st.iValue]));
370+
printLnCallBack (AnsiString (Format (fmt, [st.iValue])));
371371
end;
372-
stBoolean : printLnCallBack (BoolToStr(st.bValue, True));
372+
stBoolean : printLnCallBack (AnsiString (BoolToStr(st.bValue, True)));
373373
stDouble : begin
374374
fmt := SysLibraryRef.find ('doubleFormat').sValue.value;
375-
printLnCallBack (Format(fmt, [st.dValue]));
375+
printLnCallBack (AnsiString (Format(fmt, [st.dValue])));
376376
end;
377-
stString : printLnCallBack (st.sValue.value);
378-
stList : printLnCallBack (st.lValue.listToString());
379-
stArray : printLnCallBack (st.aValue.arrayToString());
380-
stModule : printLnCallBack ('Module: ' + st.module.name + ' ' + st.module.helpStr);
381-
stFunction: printLnCallBack ('Function: ' + st.fValue.moduleRef.name + '.' + st.fValue.name);
382-
stObjectMethod : begin printLnCallBack ('Object Method: ' + st.oValue.helpStr); vm.pop(); end; // pop the operand
377+
stString : printLnCallBack (AnsiString (st.sValue.value));
378+
stList : printLnCallBack (AnsiString (st.lValue.listToString()));
379+
stArray : printLnCallBack (AnsiString (st.aValue.arrayToString()));
380+
stModule : printLnCallBack (AnsiString ('Module: ' + st.module.name + ' ' + st.module.helpStr));
381+
stFunction: printLnCallBack (AnsiString ('Function: ' + st.fValue.moduleRef.name + '.' + st.fValue.name));
382+
stObjectMethod : begin printLnCallBack (AnsiString ('Object Method: ' + st.oValue.helpStr)); vm.pop(); end; // pop the operand
383383
else
384-
printLnCallBack ('Unrecognized type of value returned from virtual machine');
384+
printLnCallBack (AnsiString ('Unrecognized type of value returned from virtual machine'));
385385
end;
386386
end;
387387
except
388388
on e:exception do
389389
begin
390390
setColor('Cyan');
391-
printLnCallBack ('ERROR: ' + e.Message);
391+
printLnCallBack (AnsiString ('ERROR: ' + e.Message));
392392
setWhite;
393393
result := False;
394394
end;
@@ -426,14 +426,14 @@ procedure TRhodus.compileAndRun (const src : string; interactive : boolean);
426426
st := vm.pop;
427427
case st.stackType of
428428
stNone : begin end;
429-
stInteger : printLnCallBack (Format ('%d', [st.iValue]));
430-
stBoolean : printLnCallBack (BoolToStr(st.bValue, True));
431-
stDouble : printLnCallBack (Format('%g', [st.dValue]));
432-
stString : printLnCallBack (st.sValue.value);
433-
stList : printLnCallBack (st.lValue.listToString());
434-
stArray : printLnCallBack (st.aValue.arrayToString());
435-
stModule : printLnCallBack ('Module: ' + st.module.name + ' ' + st.module.helpStr);
436-
stFunction: printLnCallBack ('Function: ' + st.fValue.moduleRef.name + '.' + st.fValue.name);
429+
stInteger : printLnCallBack (AnsiString (Format ('%d', [st.iValue])));
430+
stBoolean : printLnCallBack (AnsiString (BoolToStr(st.bValue, True)));
431+
stDouble : printLnCallBack (AnsiString (Format('%g', [st.dValue])));
432+
stString : printLnCallBack (AnsiString (st.sValue.value));
433+
stList : printLnCallBack (AnsiString (st.lValue.listToString()));
434+
stArray : printLnCallBack (AnsiString (st.aValue.arrayToString()));
435+
stModule : printLnCallBack (AnsiString ('Module: ' + st.module.name + ' ' + st.module.helpStr));
436+
stFunction: printLnCallBack (AnsiString ('Function: ' + st.fValue.moduleRef.name + '.' + st.fValue.name));
437437
else
438438
printLnCallBack ('Unrecognized type of value returned from virtual machine');
439439
end;
@@ -447,16 +447,16 @@ procedure TRhodus.compileAndRun (const src : string; interactive : boolean);
447447
if mainModule.symbolTable.items[key].fValue.isbuiltInFunction then
448448
printLnCallBack ('No code for builtin function')
449449
else
450-
printLnCallBack (dissassemble(mainModule, mainModule.symbolTable.items[key].fValue.codeBlock));
450+
printLnCallBack (AnsiString (dissassemble(mainModule, mainModule.symbolTable.items[key].fValue.codeBlock)));
451451
end;
452-
printLnCallBack (dissassemble(mainModule, mainModule.moduleProgram));
452+
printLnCallBack (AnsiString (dissassemble(mainModule, mainModule.moduleProgram)));
453453
end;
454454

455455
except
456456
on e:exception do
457457
begin
458458
setGreen;
459-
printLnCallBack ('ERROR: ' + e.Message);
459+
printLnCallBack (AnsiString ('ERROR: ' + e.Message));
460460
setWhite;
461461
end;
462462
end;

0 commit comments

Comments
 (0)