7fd59977 |
1 | -- File: Draw_Interpretor.cdl |
2 | -- Created: Thu Feb 23 16:59:40 1995 |
3 | -- Author: Remi LEQUETTE |
4 | -- <rle@bravox> |
5 | ---Copyright: Matra Datavision 1995 |
6 | |
7 | |
8 | class Interpretor from Draw |
9 | |
10 | ---Purpose: Provides an encapsulation of the TCL interpretor |
11 | -- to define Draw commands. |
12 | |
13 | uses |
14 | |
15 | PInterp from Draw, |
16 | CommandFunction from Draw, |
17 | AsciiString from TCollection, |
18 | ExtendedString from TCollection |
19 | |
20 | is |
21 | |
22 | Create returns Interpretor from Draw; |
23 | |
24 | Init(me : in out); |
25 | |
26 | Add(me : in out; Command : CString; |
27 | Help : CString; |
28 | Function : CommandFunction from Draw; |
29 | Group : CString = "User Commands"); |
30 | ---Purpose: Creates a new command with name <Command>, help |
31 | -- string <Help> in group <Group>. |
32 | -- <Function> implement the function. |
33 | |
34 | Add(me : in out; Command : CString; |
35 | Help : CString; |
36 | FileName : CString ; |
37 | Function : CommandFunction from Draw; |
38 | Group : CString = "User Commands"); |
39 | ---Purpose: Creates a new command with name <Command>, help |
40 | -- string <Help> in group <Group>. <Function> |
41 | -- implement the function. |
42 | -- <FileName> is the name of the file that contains |
43 | -- the implementation of the command |
44 | -- |
45 | |
46 | Remove(me : in out; Command : CString) |
47 | returns Boolean; |
48 | ---Purpose: Removes <Command>, returns true if success (the |
49 | -- command existed). |
50 | |
51 | -- |
52 | -- The result |
53 | -- |
54 | |
55 | Result(me) returns CString; |
56 | |
57 | Reset(me : in out); |
58 | ---Purpose: Resets the result to empty string |
59 | |
60 | Append(me : in out; Result : CString) returns Interpretor from Draw; |
61 | ---Purpose: Appends to the result |
62 | ---C++: return & |
63 | ---C++: alias operator<< |
64 | |
65 | Append(me : in out; Result : AsciiString from TCollection) |
66 | returns Interpretor from Draw; |
67 | ---Purpose: Appends to the result |
68 | ---C++: return & |
69 | ---C++: alias operator<< |
70 | |
71 | Append(me : in out; Result : ExtendedString from TCollection) |
72 | returns Interpretor from Draw; |
73 | ---Purpose: Appends to the result |
74 | ---C++: return & |
75 | ---C++: alias operator<< |
76 | |
77 | Append(me : in out; Result : Integer) returns Interpretor from Draw; |
78 | ---Purpose: Appends to the result |
79 | ---C++: return & |
80 | ---C++: alias operator<< |
81 | |
82 | Append(me : in out; Result : Real) returns Interpretor from Draw; |
83 | ---Purpose: Appends to the result |
84 | ---C++: return & |
85 | ---C++: alias operator<< |
86 | |
87 | Append(me : in out; Result : SStream) returns Interpretor from Draw; |
88 | ---Purpose: Appends to the result |
89 | ---C++: return & |
90 | ---C++: alias operator<< |
91 | |
92 | AppendElement(me : in out; Result : CString); |
93 | ---Purpose: Appends to the result the string as a list element |
94 | |
95 | |
96 | |
97 | -- |
98 | -- Interpetation |
99 | -- |
100 | |
101 | Eval(me : in out; Script : CString) |
102 | returns Integer; |
103 | ---Purpose: Eval the script and returns OK = 0, ERROR = 1 |
104 | |
105 | RecordAndEval(me : in out; Script : CString; Flags : Integer = 0) |
106 | returns Integer; |
107 | ---Purpose: Eval the script and returns OK = 0, ERROR = 1 |
108 | -- Store the script in the history record. |
109 | |
110 | EvalFile(me : in out; FileName : CString) |
111 | returns Integer; |
112 | ---Purpose: Eval the content on the file and returns status |
113 | |
114 | Complete(myclass; Script : CString) returns Boolean; |
115 | ---Purpose: Returns True if the script is complete, no pending |
116 | -- closing braces. (}) |
117 | |
118 | Destroy(me : in out); |
119 | ---C++: alias ~ |
120 | |
121 | -- |
122 | -- Access to Tcl_Interp |
123 | -- |
124 | |
125 | Create(anInterp : PInterp from Draw) |
126 | returns Interpretor from Draw; |
127 | |
128 | Set(me : in out; anInterp : PInterp from Draw); |
129 | |
130 | Interp (me) returns PInterp from Draw; |
131 | |
132 | fields |
133 | |
134 | isAllocated : Boolean from Standard; |
135 | myInterp : PInterp from Draw; |
136 | |
137 | end Interpretor; |