-
Notifications
You must be signed in to change notification settings - Fork 0
/
tau.dpr
62 lines (56 loc) · 1.35 KB
/
tau.dpr
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
50
51
52
53
54
55
56
57
58
59
60
61
62
{-----------------------------------------------------------------------------
Text-Mode interface to TAU.
-----------------------------------------------------------------------------}
program tau;
{$APPTYPE CONSOLE}
uses
SysUtils,
uMath,
uMathOutputStdout,
uMathDimensions,
uFunctions,
uFunctionsSymbolics,
uFunctionsStatistics;
function GetInput: string;
var
s: string;
begin
Write('> ');
Result:= '';
Readln(s);
while (s>'') and (s[length(s)]='\') do begin
Result:= Result + Copy(s,1,length(s)-1);
Readln(s);
end;
Result:= Result + s;
end;
var
cmd: string;
mk: TMathSystem;
begin
mk:= TMathSystem.Create(TOutputStdOut.Create);
try
mk.RegisterPackage(TPackageDimensions.Create);
mk.RegisterPackage(TPackageTrig.Create);
mk.RegisterPackage(TPackageElementary.Create);
mk.RegisterPackage(TPackageNumerical.Create);
mk.RegisterPackage(TPackageLists.Create);
mk.RegisterPackage(TPackageData.Create);
mk.RegisterPackage(TPackageStatistics.Create);
mk.RegisterPackage(TPackageSymbolics.Create);
cmd:= GetInput;
while cmd>'' do begin
Writeln('');
try
mk.Run(cmd);
except
on e: Exception do
mk.Output.Error(E.Message, []);
end;
Writeln;
cmd:= GetInput;
end;
finally
FreeAndNil(mk);
end;
end.