Skip to content

Commit dcadeff

Browse files
committed
source code
This contain the basic code source of the scripting language
1 parent 25c68fe commit dcadeff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+16670
-0
lines changed

lib/dev lib/eval.~pas

+441
Large diffs are not rendered by default.

lib/dev lib/geval.dcu

21.4 KB
Binary file not shown.

lib/dev lib/geval.pas

+911
Large diffs are not rendered by default.

lib/dev lib/geval.~pas

+909
Large diffs are not rendered by default.

lib/libscreval.dll

552 KB
Binary file not shown.

src/DLG/DLG_SCR_ERROR.dcu

6.45 KB
Binary file not shown.

src/DLG/DLG_SCR_ERROR.ddp

51 Bytes
Binary file not shown.

src/DLG/DLG_SCR_ERROR.dfm

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
object E_form: TE_form
2+
Left = 197
3+
Top = 210
4+
BorderIcons = [biSystemMenu, biMaximize]
5+
BorderStyle = bsSingle
6+
Caption = 'Error'
7+
ClientHeight = 394
8+
ClientWidth = 601
9+
Color = clBtnFace
10+
Font.Charset = DEFAULT_CHARSET
11+
Font.Color = clWindowText
12+
Font.Height = -11
13+
Font.Name = 'MS Sans Serif'
14+
Font.Style = []
15+
OldCreateOrder = False
16+
PixelsPerInch = 96
17+
TextHeight = 13
18+
object Panel1: TPanel
19+
Left = 0
20+
Top = 0
21+
Width = 601
22+
Height = 137
23+
Align = alTop
24+
BevelOuter = bvSpace
25+
TabOrder = 0
26+
OnResize = Panel1Resize
27+
object Label1: TLabel
28+
Left = 176
29+
Top = 104
30+
Width = 39
31+
Height = 13
32+
Caption = 'Label1'
33+
Font.Charset = DEFAULT_CHARSET
34+
Font.Color = clWindowText
35+
Font.Height = -11
36+
Font.Name = 'MS Sans Serif'
37+
Font.Style = [fsBold]
38+
ParentFont = False
39+
Visible = False
40+
end
41+
object Button1: TButton
42+
Left = 518
43+
Top = 96
44+
Width = 75
45+
Height = 25
46+
Caption = 'Fermer'
47+
Default = True
48+
ModalResult = 1
49+
TabOrder = 0
50+
end
51+
object Button2: TButton
52+
Left = 96
53+
Top = 96
54+
Width = 75
55+
Height = 25
56+
Caption = 'Detail>>'
57+
TabOrder = 1
58+
OnClick = Button2Click
59+
end
60+
object Button3: TButton
61+
Left = 8
62+
Top = 96
63+
Width = 75
64+
Height = 25
65+
Caption = 'Go to error'
66+
TabOrder = 2
67+
OnClick = Button3Click
68+
end
69+
object Descript_text: TMemo
70+
Left = 8
71+
Top = 16
72+
Width = 585
73+
Height = 73
74+
Color = clBtnFace
75+
Font.Charset = ANSI_CHARSET
76+
Font.Color = clRed
77+
Font.Height = -13
78+
Font.Name = 'Courier New'
79+
Font.Style = []
80+
ParentFont = False
81+
ReadOnly = True
82+
ScrollBars = ssVertical
83+
TabOrder = 3
84+
end
85+
end
86+
object Panel2: TPanel
87+
Left = 0
88+
Top = 137
89+
Width = 601
90+
Height = 257
91+
Align = alClient
92+
Caption = 'Panel2'
93+
TabOrder = 1
94+
object detail: TRichEdit
95+
Left = 1
96+
Top = 1
97+
Width = 599
98+
Height = 233
99+
Align = alClient
100+
Font.Charset = ANSI_CHARSET
101+
Font.Color = clWindowText
102+
Font.Height = -13
103+
Font.Name = 'Courier New'
104+
Font.Style = []
105+
Lines.Strings = (
106+
'detail')
107+
ParentFont = False
108+
ReadOnly = True
109+
ScrollBars = ssBoth
110+
TabOrder = 0
111+
WordWrap = False
112+
OnChange = detailChange
113+
OnKeyPress = detailKeyPress
114+
OnMouseUp = detailMouseUp
115+
end
116+
object StatusBar1: TStatusBar
117+
Left = 1
118+
Top = 234
119+
Width = 599
120+
Height = 22
121+
Panels = <
122+
item
123+
Width = 50
124+
end>
125+
end
126+
end
127+
end

src/DLG/DLG_SCR_ERROR.pas

+244
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
unit DLG_SCR_ERROR;
2+
3+
interface
4+
5+
uses
6+
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7+
Dialogs, StdCtrls,script,eval, ComCtrls, ExtCtrls;
8+
9+
10+
//function ShowScrError(EpInfo:PEpInfo;scr:pscrInfo;Errmsg:string;texte:string):integer;
11+
function ShowScrErrDlg(line:integer;msg,scrfile,source:pchar;scrcount,flag:integer):integer;
12+
13+
type
14+
TE_form = class(TForm)
15+
Panel1: TPanel;
16+
Button1: TButton;
17+
Button2: TButton;
18+
Button3: TButton;
19+
Descript_text: TMemo;
20+
Label1: TLabel;
21+
Panel2: TPanel;
22+
detail: TRichEdit;
23+
StatusBar1: TStatusBar;
24+
procedure Button3Click(Sender: TObject);
25+
procedure detailMouseUp(Sender: TObject; Button: TMouseButton;
26+
Shift: TShiftState; X, Y: Integer);
27+
procedure detailKeyPress(Sender: TObject; var Key: Char);
28+
procedure detailChange(Sender: TObject);
29+
procedure Button2Click(Sender: TObject);
30+
procedure Panel1Resize(Sender: TObject);
31+
private
32+
{ Private declarations }
33+
public
34+
{ Public declarations }
35+
36+
err_pos:integer;
37+
procedure UpdateCursorPos;
38+
39+
end;
40+
41+
var
42+
E_form: TE_form;
43+
lastheight:integer;
44+
resourcestring
45+
S_PLUS_DETAIL='Détail >>';
46+
S_MIN_DETAIL='<< Détail';
47+
E_DESCRIPTION='Erreur d''évaluation à la ligne %d';
48+
E_ParseDESCRIPTION='Parsing Error at line %d';
49+
50+
implementation
51+
52+
{$R *.dfm}
53+
54+
{---------------------------------------
55+
affiche une boite de dialogue pour montrer l'erreur dans
56+
l'expression à l'utilisateur
57+
->Date:?,revisé:29.07.2008 , 26.04.2011
58+
-----------------------------------------}
59+
function ShowScrErrDlg(line:integer;msg,scrfile,source:pchar;scrcount,flag:integer):integer;
60+
begin
61+
E_form.detail.Lines.Clear;
62+
E_form.detail.Lines.Append(source);
63+
//showmessage(source);
64+
e_form.detail.SelStart:=SendMessage(E_form.detail.Handle, EM_LINEINDEX, line-1, 0);
65+
e_form.detail.SelLength:=SendMessage(E_form.detail.Handle, EM_LINELENGTH, e_form.detail.SelStart, 0);
66+
//showmessage(inttostr(e_form.detail.SelLength));
67+
e_form.detail.SelAttributes.Color:=rgb(255,10,10);
68+
e_form.detail.SelAttributes.Style:=[fsbold];
69+
70+
if (flag=1) then
71+
E_form.label1.caption:=(Format(E_PARSEDESCRIPTION,[line]))
72+
else
73+
E_form.label1.caption:=(Format(E_DESCRIPTION,[line]));
74+
75+
E_form.Descript_text.Clear;
76+
E_form.Descript_text.Lines.Add('>'+E_form.label1.caption+ ' , '+format('source: "%s"',[scrfile]));
77+
E_Form.Descript_text.Lines.Add(format(':.(line %d) %s',[ line,msg]));
78+
E_Form.ShowModal;
79+
80+
end;
81+
(*
82+
function ShowScrError(EpInfo:PEpInfo;scr:PscrInfo;Errmsg:string;text:string):integer;
83+
var
84+
i,a,gpos:integer; html:TstringList;str,str2:string;
85+
msg:string;
86+
line,col,scrfilepos:integer;
87+
source,scrFile:string;
88+
errScr:PscrInfo;
89+
nsId:integer;
90+
begin
91+
92+
html:=TstringList.Create;
93+
//E_Form.label1.caption:='Cause:';
94+
if (scr.error_namespace=scr.name) then
95+
begin
96+
line:=scr.error_line;
97+
msg:=scr.error_msg ;
98+
source:=scr.texte;
99+
scrfile:=scr.scrFileName;
100+
//showmessage('kjkj single');
101+
//showmessage(source);
102+
end
103+
else
104+
begin
105+
//showmessage('kjkjkjkjkjkjk '+scr.error_namespace);
106+
errScr:=PScrInfo(namespacelist[indexfromNamespace(scr.error_namespace)]);
107+
scrfilepos:=errScr.scrFilePos;
108+
//showmessage(inttostr(errscr.error_line));
109+
//showmessage(errscr.Namespace+ ' namespace '+errscr.parentNamespace);
110+
//showmessage('file name: '+errscr.scrFileName);
111+
msg:=errScr.error_msg;
112+
//if errscr.scrFileName='#parent#' then showmessage('file name: '+errscr.scrFileName);
113+
//showmessage(inttostr(errscr.ParentIndex));
114+
line:= errScr.error_line; {ligne uniquement à l'échelle du namespace local}
115+
while (errscr.scrFileName='#parent#') do
116+
begin
117+
nsid:=indexFromNameSpace(errScr.parent);
118+
if (nsid=-1) then break;
119+
errScr:=PscrInfo(namespacelist[nsid]);
120+
121+
end;
122+
source:=errScr.texte;
123+
line:=line+xcount_delimiter(#13#10,copy(source,0,scrfilepos));
124+
//showmessage(copy(source,0,scrfilepos));
125+
126+
scrfile:=errScr.scrFileName;
127+
128+
end;
129+
E_form.label1.caption:=(Format(E_DESCRIPTION,[line]));
130+
if Epinfo=nil then
131+
E_form.label1.caption:=(Format(E_PARSEDESCRIPTION,[line]));
132+
E_form.Descript_text.Clear;
133+
E_form.Descript_text.Lines.Add('>'+E_form.label1.caption+ ' , '+format('source: "%s"',[scrfile]));
134+
135+
E_Form.Descript_text.Lines.Add(format(':.(line %d) %s',[ line,msg]));
136+
137+
{
138+
i:=0;
139+
html.Text:=scr.texte;
140+
141+
str:=copy(scr.texte,1,scr.instructions[EpInfo.scr_index].position);
142+
str:=str+'<strong class="errmsg">';
143+
str2:=copy(scr.texte,scr.instructions[EpInfo.scr_index].position,pos(#13#10,html.text));
144+
if str2='' then
145+
str2:=copy(scr.texte,scr.instructions[EpInfo.scr_index].position,+1);
146+
html.Text:=str+'</strong>'+str2;
147+
}
148+
149+
{if (pos(#13#10,str) >0) then a:=pos(#13#10,str) else a:=length(str);
150+
while(a>0) do
151+
begin
152+
html.Text:=html.Text+inttostr(i)+':'+copy(str,1,a);
153+
inc(i);
154+
str:=copy(str,a+2,length(str)- a);
155+
a:=pos(#13#10,str)
156+
end;
157+
html.SaveToFile('c:\SCRIPT_SCHEDIT_ERROR.html');
158+
E_Form.detail.Lines.LoadFromFile('c:\SCRIPT_SCHEDIT_ERROR.html');
159+
}
160+
//E_Form.detail.Show;
161+
E_form.detail.Lines.Text:= source;
162+
163+
//showmessage(source);
164+
165+
e_form.detail.SelStart:=SendMessage(E_form.detail.Handle, EM_LINEINDEX, line-1, 0);
166+
167+
e_form.detail.SelLength:=SendMessage(E_form.detail.Handle, EM_LINELENGTH, e_form.detail.SelStart, 0);
168+
//showmessage(inttostr(e_form.detail.SelLength));
169+
e_form.detail.SelAttributes.Color:=rgb(255,10,10);
170+
e_form.detail.SelAttributes.Style:=[fsbold];
171+
//e_form.detail.SelLength:=length(scr.instructions[epInfo.scr_index].text);
172+
// showmessage('jkjk');
173+
if epInfo<>nil then
174+
e_form.err_pos:=scr.instructions[epInfo.scr.index].position;
175+
E_Form.ShowModal;
176+
177+
178+
end;
179+
*)
180+
181+
182+
procedure TE_form.Button3Click(Sender: TObject);
183+
begin
184+
detail.SelStart:=err_pos;
185+
if panel2.Visible then
186+
detail.SetFocus;
187+
end;
188+
procedure TE_Form.UpdateCursorPos;
189+
var
190+
CharPos: TPoint;
191+
begin
192+
CharPos.Y := SendMessage(detail.Handle, EM_LINEFROMCHAR,detail.SelStart ,0 );
193+
CharPos.X := (detail.SelStart -
194+
SendMessage(detail.Handle, EM_LINEINDEX, CharPos.Y, 0));
195+
Inc(CharPos.Y);
196+
Inc(CharPos.X);
197+
StatusBar1.Panels[0].Text := Format('line:%d,column:%d', [CharPos.Y, CharPos.X]);
198+
end;
199+
procedure TE_form.detailMouseUp(Sender: TObject; Button: TMouseButton;
200+
Shift: TShiftState; X, Y: Integer);
201+
begin
202+
UpdateCursorPos;
203+
end;
204+
205+
procedure TE_form.detailKeyPress(Sender: TObject; var Key: Char);
206+
begin
207+
UpdateCursorPos;
208+
end;
209+
210+
procedure TE_form.detailChange(Sender: TObject);
211+
begin
212+
UpdateCursorPos
213+
end;
214+
215+
procedure TE_form.Button2Click(Sender: TObject);
216+
begin
217+
if panel2.Visible then
218+
begin
219+
panel2.Align:=alnone;
220+
lastheight:=self.ClientHeight;
221+
self.ClientHeight:=panel1.Height;
222+
button2.Caption:=S_PLUS_DETAIL;
223+
224+
panel2.Visible:=false;
225+
end
226+
else
227+
begin
228+
self.ClientHeight:=lastheight;
229+
panel2.Visible:=true;
230+
panel2.Align:=alclient;
231+
button2.Caption:=S_MIN_DETAIL;
232+
detail.SetFocus;
233+
end;
234+
235+
236+
end;
237+
238+
procedure TE_form.Panel1Resize(Sender: TObject);
239+
begin
240+
descript_text.Width:=self.ClientWidth-20;
241+
button1.Left:=self.ClientWidth-button1.Width-10;
242+
end;
243+
244+
end.

src/DLG/DLG_SCR_ERROR.~ddp

51 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)