home *** CD-ROM | disk | FTP | other *** search
-
- procedure update_filename (ext : extension);
-
- begin
- if (ext <> '') then
- begin
- ii := length(filename);
- repeat
- dec(ii);
- ch := filename[ii];
- until ((ch = '.') or (ii <= 1));
-
- if (ch = '.') then
- delete(filename,ii,12);
-
- filename := filename + '.' + ext;
- end;
- filename := upstring(filename);
- end;
-
-
-
- procedure syntax_check (s : awtyp);
-
- var
- oende,
- pende,
- zende,
- bitwert,
- bstadr : boolean;
- operationstr,
- operandstr,
- bststr,
- bitstr : awtyp;
-
-
- procedure p_oende;
-
- begin
- if not pende then
- begin
- oende := true;
- operandstr := operandstr + s[i];
- end
- else
- bststr := bststr + s[i];
- end;
-
-
- begin
- oende := false;
- pende := false;
- sende := false;
- zende := false;
- bitwert := true;
- bstadr := true;
- status := 0;
- operationstr := '';
- operandstr := '';
- bststr := '';
- bitstr := '';
-
- for i := 1 to length(s) do
- begin
- case s[i] of
- 'M','K','T' : p_oende;
- 'A' : if ((i = 2) and (operationstr[1] = 'S') and (s[i+1] = 'T')) then
- begin
- operationstr := operationstr+ s[i]
- end
- else
- p_oende;
- 'E' : if ((i = 2) and (operationstr[1] in ['B','S'])) then
- begin
- operationstr := operationstr+ s[i]
- end
- else
- p_oende;
- 'Z' : if (i > 1) then
- p_oende
- else
- operationstr := operationstr+ s[i];
-
- '.' : bstadr := false;
-
- '0'..'9' : if bstadr then
- begin
- pende := true;
- bststr := bststr + s[i];
- end
- else
- bitstr := bitstr + s[i];
- else
- if not oende then
- operationstr := operationstr + s[i]
- else
- if not pende then
- operandstr := operandstr + s[i]
- else
- if bstadr then
- bststr := bststr + s[i]
- else
- bitstr := bitstr + s[i];
- end;
- end;
-
- if (length(operationstr) = 0) then
- status := -3;
-
- if (status = 0) then
- begin
- j := 0;
- for i := 1 to maxoperationen do
- if (operationstr = operationen[i]) then
- j := i;
- if (j = 0) then
- status := -4
- else if ((j in [3..7]) and (operandstr <> 'T')) then
- status := -6
- else
- status := 0;
- if (j < 11) then
- sende := true; (* Strompfadende *)
- if (j > 15) then
- zende := true; (* Bausteinende/Klammern *)
-
- if (j = 18) then (* KLammer Zu *)
- klammern := pred(klammern);
- if (j > 18) then (* Operation+Klammer Auf *)
- klammern := succ(klammern);
-
- end;
-
- if (status = 0) then
- begin
- if zende and ((length(operandstr) > 0) or (length(bststr) > 0)) then
- status := -5;
- if not zende then
- if (length(operandstr) = 0) then
- status := -7
- else
- if (length(bststr) = 0) then
- status := -9;
- end;
-
- if (status = 0) and not zende then
- if (length(operandstr)=1) and (operandstr[1] in ['E','A','M','T','Z']) then
- status := 0
- else
- if ((length(operandstr)=2) and (operandstr[1] = 'K') and (operandstr[2] in ['T','Z'])) then
- status := 0 (* L KT/Z ... *)
- else
- status := -6;
-
- if ((operandstr[1] in ['T','Z']) or ((operandstr[1] = 'K') and (operandstr[2] = 'Z'))) then
- bitwert := false;
-
- if (status = 0) and not zende then
- begin
- status := -8;
- val(bststr,bst,ii);
- val(bitstr,bit,jj);
-
- if ((ii = 0) and ((jj = 0) and (bit in [0..7])) or not bitwert) then
- begin
- status := -10;
- case operandstr[1] of
- 'E' : if (bst <= maxe) then
- begin
- status := 0;
- if (maxopr[1] < bst) then
- maxopr[1]:= bst;
- end;
- 'A' : if (bst <= maxa) then
- begin
- status := 0;
- if (maxopr[2] < bst) then
- maxopr[2]:= bst;
- end;
- 'M' : if (bst <= maxm) then
- begin
- status := 0;
- if (maxopr[3] < bst) then
- maxopr[3]:= bst;
- end;
- 'T' : if (bst <= maxt) then
- begin
- status := 0;
- if (maxopr[4] < bst) then
- maxopr[4]:= bst;
- end;
- 'Z' : if (bst <= maxz) then
- begin
- status := 0;
- if (maxopr[5] < bst) then
- maxopr[5]:= bst;
- end;
- end;
- case operandstr[2] of
- 'T' : if (bst <= maxkt) and (bit in [0..3]) then
- begin
- status := 0;
- end;
- 'Z' : if (bst <= maxkz) then
- begin
- status := 0;
- end;
- end;
- end;
- end;
-
- (* Oder von Und *)
- if ((operationstr = 'O') and (operandstr = '')) then
- begin
- zende := true;
- status := 0;
- end;
-
- if (status = 0) then
- begin
- with awl[anzaw] do
- begin
- operation := operationstr;
- if zende then
- begin
- operand := '';
- baustein := -1;
- bitnr := -1;
- end
- else
- begin
- operand := operandstr;
- baustein := bst;
- if bitwert then
- bitnr := bit
- else
- bitnr := -1;
- end;
- end;
- if (operationstr = 'BE') then
- status := 1;
- end;
- gotoxy (17, 4);
- write (' - ',operationstr,' ',operandstr,' ',bststr,'.',bitstr,' ');
- end;
-
-
-
- procedure fehlerbehandlung;
-
- begin
- gotoxy ( 2, 6);
- write ('Fehler entdeckt - ');
- writeln(fehlermeldung[abs(status)]);
-
- if (status < -2) then
- begin
- gotoxy ( 2, 8);
- write ('Neue Anweisung : ');
- readln (aw);
- if (aw > ' ') then
- begin
- status := 2;
- anzaw := pred(anzaw);
- korrektur := true;
- gotoxy ( 1, 6);
- clreol;
- gotoxy ( 1, 8);
- clreol;
- end;
- end;
- end;