-
Notifications
You must be signed in to change notification settings - Fork 0
/
ats_acl_full.pas
4344 lines (3808 loc) · 110 KB
/
ats_acl_full.pas
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit ats_acl_full;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, Menus, CPort, CPortCtl, ToolWin, printers, ExtCtrls,
QuickRpt, Qrctrls, ImgList, Buttons, SynEditHighlighter,
SynHighlighterGeneral, SynEdit, SynCompletionProposal, mdMailSlot, jpeg, inifiles,
Db, DBTables, ScktComp;
//---- Controle da utilização do robosoft pelo usuario -------------------------
type TUsuario = class
private
nome_usuario: string;
nome_computador: string;
connect: integer;
public
constructor create;
procedure setusuario;
procedure setcomputador;
procedure SetConnect(conn: integer);
function GetConnect: integer;
function Getusuario: string;
function Getcomputador: string;
end;
//---- Classe de controle dos comandos de variáveis ----------------------------
type TComandos = class
private
n_vardefine: integer;
n_varglobal: integer;
conta: integer;
contag: integer;
define_var: array[0..100] of string;
global_var: array[0..100] of string;
public
procedure ini;
constructor create;
procedure setvardefine(s: string; l: integer);
procedure definestorage(s: string);
procedure liststorage;
procedure setvarglobal(s: string; l: integer);
procedure globalstorage(s: string);
procedure liststorageg;
function Umespaco(s: string): string;
end;
//----- Classe de controle das definições das posições off-line ----------------
type TPosicao = class
private
l_positions: integer;
l_endpos: integer;
public
function sendpos: boolean;
function findpos: boolean;
function findendpos: boolean;
procedure setlpositions(l:integer);
procedure setlendpos(l:integer);
function getlposition: integer;
function getlendpos: integer;
end;
//----- Classe de mensagens ao usuario -------------------------------------
type TMensagens = class
private
erro: string;
errot2: string;
alerta: string;
msg: string;
cool: string;
linha_msg: integer;
linha_erro: integer;
public
procedure setcool(s: string);
procedure getcool;
procedure seterro(s: string);
procedure geterro;
procedure seterrot2(s: string;l: integer);
procedure geterrot2;
procedure setmsg(s: string;l: integer);
procedure setalerta(s: string);
procedure getalerta;
procedure getmsg;
constructor create;
end;
//------ Classe que controla alguns valores de controle do programa ------------
type TControle = class
private
sinal : integer;
resp: integer;
mail: integer;
soma: integer;
page: integer;
name_pc: string;
public
constructor create;
function esp_prompt: string;
procedure no_echo;
procedure echo;
procedure setsinal(si: integer);
function getsinal: integer;
procedure setResp(r: integer);
function getResp: integer;
procedure setMail(m: integer);
function getMail: integer;
procedure setsoma;
procedure resetsoma;
function getsoma: integer;
procedure setpage(p: integer);
function getpage: integer;
procedure setnamepc(n: string);
function getnamepc: string;
end;
//------- Classe que controla a posição do programa no editor e avalia a linha -
type TProgram = class
private
l_program: integer;
l_end: integer;
nomedoprograma: string;
n_progs: integer;
n_ends: integer;
public
constructor create;
procedure setnumprogs;
function getnumprogs: integer;
procedure setnumends;
function getnumends: integer;
procedure setini;
function sendprog: boolean;
function findprog: boolean;
procedure setnomeprog(p: string);
function getnomeprog: string;
function findend: boolean;
procedure setlprogram(l:integer);
procedure setlend(l:integer);
function getlprogram: integer;
function getlend: integer;
function tiracom(s: string): string;
function get_esp_carac(s: string): boolean;
end;
//----- Controla a posição do FOR no programa e conta o numero total -----------
type TFindFor = class
private
n_for: integer;
l_for: integer;
public
constructor create;
procedure setfor;
procedure setini;
function getfor: integer;
function getlfor: integer;
end;
//------Controla a posição do ENDFOR programa e conta o numero total -----------
type TFindEndFor = class
private
n_endfor: integer;
l_endfor: integer;
public
constructor create;
procedure setendfor;
procedure setini;
function getendfor: integer;
function getlendfor: integer;
end;
//------------------------------------------------------------------------------
type TCompEstrut = class
public
function setcomparafor: boolean;
function setcomparaif: boolean;
end;
//------------------------------------------------------------------------------
type TFindIf = class
private
n_if: integer;
l_if: integer;
public
constructor create;
procedure setif;
procedure setini;
function getif: integer;
function getlif: integer;
end;
//------------------------------------------------------------------------------
type TFindEndIf = class
private
n_endif: integer;
l_endif: integer;
public
constructor create;
procedure setendif;
procedure setini;
function getendif: integer;
function getlendif: integer;
end;
//------------------------------------------------------------------------------
type TListaerros = class
public
function FatalTA(s,s1: string;l: integer): integer;
function FatalTB(s,s1: string;l: integer): integer;
function FatalQQ(s: string;l: integer): integer;
end;
//------------------------------------------------------------------------------
type TVerCommands = class
public
function FindCommad: boolean;
end;
//------------------------------------------------------------------------------
type
TRoboMain = class(TForm)
ComPort1: TComPort;
MainMenu1: TMainMenu;
File1: TMenuItem;
Exit1: TMenuItem;
N1: TMenuItem;
Print1: TMenuItem;
N2: TMenuItem;
SaveAs1: TMenuItem;
Open1: TMenuItem;
Help1: TMenuItem;
About1: TMenuItem;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
PrintDialog1: TPrintDialog;
ComPort2: TComPort;
Fe1: TMenuItem;
Download1: TMenuItem;
ComunanicaodaEstao1: TMenuItem;
BotesdeControle1: TMenuItem;
Configuraes1: TMenuItem;
Reconectar1: TMenuItem;
RunHomes1: TMenuItem;
R1: TMenuItem;
N3: TMenuItem;
ControlEnable1: TMenuItem;
ControlDisable1: TMenuItem;
Iinitc1: TMenuItem;
ComDataPacket1: TComDataPacket;
SynGeneralSyn1: TSynGeneralSyn;
PopupMenu2: TPopupMenu;
Copiar1: TMenuItem;
Copiar2: TMenuItem;
Recortar1: TMenuItem;
N6: TMenuItem;
Novo1: TMenuItem;
PopupMenu3: TPopupMenu;
RunHomes2: TMenuItem;
RunShutd1: TMenuItem;
RunINITC1: TMenuItem;
N7: TMenuItem;
Configuraes2: TMenuItem;
RemoveroPrograma1: TMenuItem;
ListaroPrograma1: TMenuItem;
SynCompletionProposal1: TSynCompletionProposal;
ImageList2: TImageList;
N4: TMenuItem;
Help2: TMenuItem;
ComDataPacket2: TComDataPacket;
mdMailSlot1: TmdMailSlot;
Splitter1: TSplitter;
Splitter2: TSplitter;
Panel2: TPanel;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
Panel3: TPanel;
Panel1: TPanel;
SpeedButton17: TSpeedButton;
SpeedButton18: TSpeedButton;
SpeedButton19: TSpeedButton;
SpeedButton20: TSpeedButton;
SpeedButton21: TSpeedButton;
ComTerminal1: TComTerminal;
Panel4: TPanel;
Panel5: TPanel;
Panel7: TPanel;
ListView3: TListView;
Panel6: TPanel;
ListView2: TListView;
Panel8: TPanel;
BitBtn9: TBitBtn;
BitBtn10: TBitBtn;
BitBtn8: TBitBtn;
BitBtn7: TBitBtn;
Panel9: TPanel;
RichEdit1: TRichEdit;
ComboBox2: TComboBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Panel10: TPanel;
RichEdit2: TRichEdit;
SpeedButton22: TSpeedButton;
ImageList3: TImageList;
Panel11: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton7: TSpeedButton;
Panel12: TPanel;
Image1: TImage;
SpeedButton8: TSpeedButton;
Label1: TLabel;
Panel13: TPanel;
ProgressBar1: TProgressBar;
PageControl2: TPageControl;
Image2: TImage;
SpeedButton9: TSpeedButton;
Controlador1: TMenuItem;
SpeedButton2: TSpeedButton;
FindDialog1: TFindDialog;
SpeedButton10: TSpeedButton;
StatusBar1: TStatusBar;
SpeedButton12: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton11: TSpeedButton;
TabSheet4: TTabSheet;
ListView4: TListView;
Panel14: TPanel;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
Panel15: TPanel;
ListView1: TListView;
Panel16: TPanel;
ListView5: TListView;
Userdados: TMenuItem;
ClientSocket1: TClientSocket;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure Open1Click(Sender: TObject);
procedure SaveAs1Click(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure Print1Click(Sender: TObject);
procedure About1Click(Sender: TObject);
function Esp_interroga : string;
function Esp_prompt : string;
procedure salvar;
procedure abrir;
procedure download_A;
procedure download_B;
procedure imprimir;
procedure novo;
procedure SpeedButton1MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton2MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton3MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure Download1Click(Sender: TObject);
procedure Configuraes1Click(Sender: TObject);
procedure Reconectar1Click(Sender: TObject);
procedure RunHomes1Click(Sender: TObject);
procedure R1Click(Sender: TObject);
procedure ControlEnable1Click(Sender: TObject);
procedure ControlDisable1Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton6MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton7MouseMove(Sender: TObject; Shift: TShiftState; X,y: Integer);
procedure Copiar2Click(Sender: TObject);
procedure Copiar1Click(Sender: TObject);
procedure Recortar1Click(Sender: TObject);
procedure Download2Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure Novo1Click(Sender: TObject);
procedure RunHomes2Click(Sender: TObject);
procedure RunShutd1Click(Sender: TObject);
procedure RunINITC1Click(Sender: TObject);
procedure Reconectar2Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure Removerprograma1Click(Sender: TObject);
procedure reconect;
procedure config;
procedure Configuraes2Click(Sender: TObject);
procedure ComDataPacket1Packet(Sender: TObject; const Str: String);
procedure ComTerminal1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure ComTerminal1KeyPress(Sender: TObject; var Key: Char);
procedure Iinitc1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
procedure SpeedButton10Click(Sender: TObject);
procedure ToolButton9Click(Sender: TObject);
procedure ExecutaroPrograma1Click(Sender: TObject);
procedure ListaroPrograma1Click(Sender: TObject);
procedure RemoveroPrograma1Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure SpeedButton5MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton9MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton8MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton4MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure SpeedButton11Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton10MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton11MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton12MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton13Click(Sender: TObject);
procedure SpeedButton14Click(Sender: TObject);
procedure SpeedButton13MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton14MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton15MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton16MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure SpeedButton16Click(Sender: TObject);
procedure habilita_botoes;
procedure desabilita_botoes;
procedure executar;
procedure ComDataPacket2Packet(Sender: TObject; const Str: String);
procedure mdMailSlot1MessageAvail(Sender: TObject; Msg: String);
procedure BitBtn7Click(Sender: TObject);
procedure BitBtn8Click(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
procedure BitBtn9Click(Sender: TObject);
procedure BitBtn10Click(Sender: TObject);
function GetComputerNetName: string;
procedure RichEdit1KeyPress(Sender: TObject; var Key: Char);
procedure RichEdit1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure RichEdit1KeyUp(Sender: TObject; var Key: Word;Shift: TShiftState);
procedure ListBox1Click(Sender: TObject);
procedure TabSheet1Show(Sender: TObject);
procedure TabSheet2Show(Sender: TObject);
procedure TabSheet3Show(Sender: TObject);
procedure SpeedButton17Click(Sender: TObject);
procedure SpeedButton18Click(Sender: TObject);
procedure SpeedButton19Click(Sender: TObject);
procedure SpeedButton20Click(Sender: TObject);
procedure SpeedButton21Click(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure SpeedButton22Click(Sender: TObject);
procedure SpeedButton17MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton18MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton19MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton20MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton21MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure SpeedButton22MouseMove(Sender: TObject; Shift: TShiftState; X,Y: Integer);
procedure novo_editor;
procedure select_edit;
procedure remove_proj;
procedure deselect_edit;
procedure modo_terminal;
procedure Controlador1Click(Sender: TObject);
procedure FindDialog1Find(Sender: TObject);
procedure ComTerminal1StrRecieved(Sender: TObject; var Str: String);
function test_download: integer;
function test_comunica: integer;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Help2Click(Sender: TObject);
function caracter_especial(str_f: string;linha_cont:integer) : integer;
procedure UserdadosClick(Sender: TObject);
procedure ClientSocket1Error(Sender: TObject; Socket: TCustomWinSocket;
ErrorEvent: TErrorEvent; var ErrorCode: Integer);
procedure ClientSocket1Connect(Sender: TObject;
Socket: TCustomWinSocket);
procedure ClientSocket1Disconnect(Sender: TObject;
Socket: TCustomWinSocket);
procedure Timer1Timer(Sender: TObject);
published
Editor0:tsynedit;
Editor1:tsynedit;
Editor2:tsynedit;
Editor3:tsynedit;
Editor4:tsynedit;
Editor5:tsynedit;
editor6:tsynedit;
editor7:tsynedit;
editor8:tsynedit;
editor9:tsynedit;
editor10:tsynedit;
editor11:tsynedit;
Editor12:tsynedit;
editor13:tsynedit;
editor14:tsynedit;
editor15:tsynedit;
editor16:tsynedit;
editor17:tsynedit;
editor18:tsynedit;
editor19:tsynedit;
editor20:tsynedit;
editor21:tsynedit;
editor22:tsynedit;
editor23:tsynedit;
editor24:tsynedit;
editor25:tsynedit;
editor26:tsynedit;
editor27:tsynedit;
editor28:tsynedit;
editor29:tsynedit;
editor30:tsynedit;
editor31:tsynedit;
editor: tsynedit;
listitem: TListItem;
private
{ Private declarations }
public
{ Public declarations }
procedure WMGetMinMaxInfo(var MSG: TMessage); message WM_GetMinMaxInfo;
end;
var
RoboMain: TRoboMain;
Controle: TControle;
Posicao: TPosicao;
Programa: TProgram;
Mensagem: TMensagens;
NFor: TFindFor;
NEndFor: TFindEndFor;
NIf: TFindIf;
NEndIf: TFindEndIf;
Estrutura: TCompEstrut;
ListaErro: TListaErros;
VerCommands: TVerCommands;
Comands: Tcomandos;
UserStat: TUsuario;
//------------------------------------------------------------------------------
ini: TINIFile;
implementation
uses remove_form_4, form2_report, Log_Term, menu_download, Splash, log_tcpip,
l_coman_help, comandos,user;
{$R *.DFM}
constructor TUsuario.create;
begin
connect:=0;
end;
procedure TUsuario.SetConnect(conn: integer);
begin
connect:=conn;
end;
function TUsuario.GetConnect: integer;
begin
result:=connect;
end;
function TUsuario.Getusuario: string;
begin
result:=nome_usuario;
end;
function TUsuario.Getcomputador: string;
begin
result:=nome_computador;
end;
procedure TUsuario.setusuario;
var
username: string;
usernamelen: Dword;
begin
Usernamelen:= 255;
setlength(username, usernamelen);
if getusername(Pchar(username), usernamelen) then
nome_usuario:= lowercase(copy(username,1,usernamelen-1))
else
nome_usuario:= 'Usuário desconhecido';
end;
//*****************************
procedure TUsuario.setcomputador;
var
computername: string;
computernamelen: dword;
begin
computernamelen:=255;
setlength(computername,computernamelen);
if getcomputername(Pchar(computername), computernamelen) then
nome_computador := lowercase(copy(computername,1,computernamelen))
else
nome_computador:= 'Desconhecido';
end;
//******************************************************************************
constructor TComandos.create;
var
i: integer;
begin
n_vardefine:=0;
n_varglobal:=0;
conta:=0;
contag:=0;
for i:=0 to 100 do
begin
define_var[i]:=' ';
global_var[i]:=' ';
end;
end;
procedure TComandos.ini;
var
i: integer;
begin
n_vardefine:=0;
n_varglobal:=0;
conta:=0;
contag:=0;
for i:=0 to 100 do
begin
define_var[i]:=' ';
global_var[i]:=' ';
end;
end;
function TComandos.Umespaco(s: string): string;
var
tam,i, posi: integer;
str, aux: string;
begin
str:=trim(s)+' ';
tam:=length(str);
aux:='';
posi:=1;
for i:=1 to tam do
begin
if str[i] = ' ' then
begin
aux:= trim(aux) + ' ' + trim(copy(str,posi,i-posi));
posi:=i;
end;
end;
result:= trim(aux);
end;
procedure TComandos.definestorage(s: string);
begin
define_var[conta]:=s;
end;
procedure TComandos.liststorage;
var
i: integer;
begin
//for i:=n_vardefine to conta-1 do
if conta>0 then
begin
for i:=0 to conta-1 do
begin
with robomain.listview5 do
begin
robomain.ListItem:=Items.Add;
robomain.listitem.ImageIndex:=6;
robomain.ListItem.Caption:='LOCAL';
robomain.ListItem.SubItems.Add(trim(lowercase(define_var[i])));
robomain.listview5.Refresh;
end;
end;
end;
end;
procedure TComandos.globalstorage(s: string);
begin
global_var[contag]:=s;
end;
procedure TComandos.liststorageg;
var
i: integer;
begin
//for i:=n_varglobal to contag-1 do
if contag > 0 then
begin
for i:=0 to contag-1 do
begin
with robomain.listview5 do
begin
robomain.ListItem:=Items.Add;
robomain.listitem.ImageIndex:=7;
robomain.ListItem.Caption:='GLOBAL';
robomain.ListItem.SubItems.Add(trim(lowercase(global_var[i])));
robomain.listview5.Refresh;
end;
end;
end;
end;
procedure TComandos.setvardefine(s: string; l: integer);
var
str: string;
tam,i,aux,soma: integer;
begin
str := Umespaco(s) + ' ';
tam := length(str);
soma:= 0;
aux := 0;
for i:=1 to tam do
begin
if str[i] = ' ' then
begin
definestorage(copy(str,aux,i-aux));
inc(soma);
inc(conta);
aux:=i;
end;
end;
if soma > 12 then
begin
listaerro.FatalQQ('1000',l);
end else begin
n_vardefine:=conta;
end;
end;
procedure TComandos.setvarglobal(s: string; l: integer);
var
str: string;
tam,i,aux,soma: integer;
begin
str := Umespaco(s) + ' ';
tam:= length(str);
soma:=0;
aux:=0;
for i:=1 to tam do
begin
if str[i] = ' ' then
begin
globalstorage(copy(str,aux,i-aux));
inc(soma);
inc(contag);
aux:=i;
end;
end;
if soma > 12 then
begin
listaerro.FatalQQ('1001',l);
end else begin
n_varglobal:=contag;
end;
end;
function TVerCommands.FindCommad: boolean;
var
str,s, argumentos: string;
i,f,x,r1,r2,tam : integer;
begin
result:=true;
robomain.select_edit;
r2:=0;
for x:=programa.getlprogram+1 to programa.getlend - 1 do
begin
r1:=0;
s:= trim(uppercase(programa.tiracom(robomain.Editor.Lines[x]))) + ' ';
tam:= length(trim(s));
f:=pos(' ',s);
str:=trim(copy(s,0,f));
argumentos:=trim(copy(s,f,(tam-f)+1));
if (programa.get_esp_carac(s) = true) and (s<>'') then
begin
mensagem.seterrot2('Utilização de caracter especial.',x+1);
mensagem.geterrot2;
inc(r2);
end;
if str<>'' then
begin
for i:=0 to robomain.SynGeneralSyn1.KeyWords.Count - 1 do
begin
if str = robomain.SynGeneralSyn1.KeyWords.Strings[i] then //verifica o comando
begin
inc(r1);
if uppercase(str) = 'DEFINE' then comands.setvardefine(argumentos,x+1);
if uppercase(str) = 'GLOBAL' then comands.setvarglobal(argumentos,x+1);
end;
end;
if r1 = 0 then
begin
mensagem.seterrot2('Comando desconhecido: ' + trim(uppercase(programa.tiracom(str))), x + 1);
mensagem.geterrot2;
result:=false;
end;
end;
end;
if r2>0 then result:=false;
end;
//--------------- Erros gerais para verifação antes do download
function TListaErros.FatalQQ(s:string;l: integer): integer;
begin
result:=0;
if s = '1000' then
begin
result:=2;
mensagem.setmsg(' Foi definido mais de 12 variáveis em DEFINE, pode ocorrer falhas na execução do programa. ',l);
mensagem.getmsg;
end;
if s = '1001' then
begin
result:=2;
mensagem.setmsg(' Foi definido mais de 12 variáveis em GLOBAL, pode ocorrer falhas na execução do programa. ',l);
mensagem.getmsg;
end;
if s = '1002' then
begin
result:=2;
mensagem.setmsg('Variável com mais de 5 caracteres. ',l);
mensagem.getmsg;
end;
end;
function TListaErros.FatalTB(s,s1: string;l: integer): integer;
begin
result:=0;
if pos('(3)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Comando desconhecido: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(6)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Programa especificado não existe: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(39)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Número incorreto de argumentos: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(63)',uppercase(trim(s))) <> 0 then
begin
result:=2;
mensagem.setmsg('Nome da variável já existe: ' + trim(uppercase(s1)),l);
mensagem.getmsg;
end;
if pos('(100)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Sem memória - PROGRAMAS ' + trim(uppercase(s1)),0);
mensagem.geterrot2;
end;
if pos('(101)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Erros sintaxe: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(102)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Variável indefinida: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(103)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Argumento desconhecido: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(104)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Programa indefinido: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(105)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Variável indefinida - PRIORITY: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(106)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Variável indefinida - PEND/POST/QPEND/QPOST: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(109)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Sem memória - LINHAS DE PROGRAMA: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(110)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Posição indefinida, não gravada: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(111)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Sem memória - VARIÁVEIS ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(113)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Nome da posição inválido: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(114)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Primeira variável indefinida: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(115)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Segunda variável indefinida: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(116)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Variável indefinida - SPEED: ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(117)',uppercase(trim(s))) <> 0 then
begin
result:=1;
mensagem.seterrot2('Sem memória - STRINGS ' + trim(uppercase(s1)),l+1);
mensagem.geterrot2;
end;
if pos('(118)',uppercase(trim(s))) <> 0 then
begin
result:=1;