Skip to content

Commit 8c8cc4f

Browse files
committed
Fixed ? help system
1 parent 624395f commit 8c8cc4f

File tree

6 files changed

+60
-24
lines changed

6 files changed

+60
-24
lines changed

Rhodus_Version_3/RhodusVersionThreeProject.dpr

Lines changed: 51 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,60 @@ var sourceCode : string;
8484

8585

8686
function searchHelp (const helpStr : string) : string;
87-
var i, index : integer;
87+
var i, j, index : integer;
88+
astr : TArray<string>;
89+
symbol1, symbol2: TSymbol;
8890
begin
89-
if helpstr = '?' then
91+
// Search places for any help whcih will be of the form X or X.Y
92+
astr := SplitString(helpStr, '.');
93+
if length (astr) = 1 then
9094
begin
91-
result := 'Builtin functions:' + sLineBreak;
92-
//result := builtinList[0].name;
93-
//for i := 1 to builtinList.Count - 1 do
94-
// result := result + ', ' + builtinList[i].name;
95-
exit;
95+
// Its either in the global space or its a module name
96+
if mainModule.symbolTable.find(astr[0], symbol1) then
97+
begin
98+
if symbol1.symbolType = symModule then
99+
result := symbol1.mValue.helpStr
100+
else
101+
result := 'Unable to locate symbol';
102+
end
103+
else
104+
begin
105+
// Check the global space
106+
if mainModule.symbolTable.find(TSymbol.globalId, symbol1) then
107+
begin
108+
if symbol1.mValue.symbolTable.find(astr[0], symbol2) then
109+
begin
110+
result := symbol2.fValue.helpStr;
111+
end
112+
else
113+
result := 'Unable to locate symbol';
114+
end
115+
else
116+
result := 'Internal error: global space could not be located';
117+
end;
118+
end
119+
else
120+
begin
121+
if length (astr) = 2 then
122+
begin
123+
if mainModule.symbolTable.find(astr[0], symbol1) then
124+
begin
125+
if symbol1.symbolType = symModule then
126+
begin
127+
if symbol1.mValue.symbolTable.find (astr[1], symbol2) then
128+
case symbol2.symbolType of
129+
symUserFunc : result := symbol2.fValue.helpStr;
130+
else
131+
result := symbol2.helpStr
132+
end;
133+
end;
134+
end
135+
else
136+
result := 'Unable to locate the module: ' + astr[0];
137+
end
138+
else
139+
result := 'Don''t know how to search what you indicated: ' + helpstr;
96140
end;
97-
98-
// Search places for any help
99-
//if builtinList.find(helpStr, index) then
100-
// result := builtinList[index].helpStr
101-
//else
102-
// result := 'No help found';
103141
end;
104142

105143

Rhodus_Version_3/RhodusVersionThreeProject.dproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@
137137
<DCC_RangeChecking>true</DCC_RangeChecking>
138138
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
139139
<VerInfo_MajorVer>3</VerInfo_MajorVer>
140-
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=3.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
140+
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=3.0.0.1;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
141+
<VerInfo_Build>1</VerInfo_Build>
141142
</PropertyGroup>
142143
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
143144
<DCC_MapFile>3</DCC_MapFile>
Binary file not shown.

Rhodus_Version_3/uBuiltInGlobal.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ procedure TBuiltInGlobal.myHelp (vm : TObject);
211211
case x.stackType of
212212
stInteger : TVM (vm).push (TStringObject.create ('Integer Value'));
213213
stBoolean : TVM (vm).push (TStringObject.create ('Boolean Value'));
214-
stDouble : TVM (vm).push (TStringObject.create ('Double Value'));
214+
stDouble : TVM (vm).push (TStringObject.create ('Double value: ' + floattostr (x.dValue)));
215215
stString : TVM (vm).push (TStringObject.create ('String Value'));
216216
stList : TVM (vm).push (TStringObject.create ('List Value'));
217217
stModule : TVM (vm).push (TStringObject.create (getModuleHelp (x.module)));

Rhodus_Version_3/uCommands.pas

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111

1212
interface
1313

14-
Uses
15-
{$IFDEF DEBUG}
16-
//FastMM4,
17-
{$ENDIF}
18-
Windows, Classes, SysUtils, StrUtils, Generics.Collections, uVM, uRunCode;
14+
Uses Windows, Classes, SysUtils, StrUtils, Generics.Collections, uVM, uRunCode;
1915

2016
type
2117
TCallCommand = function (argument : string) : boolean;
@@ -101,9 +97,12 @@ procedure displayHelp;
10197
writeln ('symbols'#9#9'Display symbols in main module');
10298
writeln ('tests'#9#9'Run the tests');
10399
writeln ('');
104-
writeln ('?name'#9#9'Get help about object name');
105-
writeln ('??'#9#9'List help topics');
100+
writeln ('?X or ?M.X'#9'Get help about a symbol, X, or a symbol in a module, M');
101+
writeln ('Type dir() to get a list of global functions. Note, no space beteen dir and ()');
102+
writeln ('Type modules() to get a list of loaded modules');
103+
writeln ('Type dir() on any module to get the list of methods, eg math.dir()');
106104
writeln;
105+
107106
writeln ('To run a script, type run followed by its filename. Note: there is no need to specify the .rh extension');
108107
end;
109108

Rhodus_Version_3/uGlobal.pas

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
interface
1212

13-
var mainModuleId : string = '_ main_';
14-
1513
implementation
1614

1715
end.

0 commit comments

Comments
 (0)