home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------ *)
- (* MAKESTM.PAS *)
- (* *)
- (* Erzeugen des KeyCode-Streams KBCONST.STM aus der ent- *)
- (* sprechenden Textdatei KBCONST.TXT *)
- (* (C) 1992 by Christian Ohr & DMV-Verlag *)
- (* ------------------------------------------------------ *)
- {$R-,S-,I-,B-,D-,L-,V-,A+,F+,O+,X+}
-
-
- PROGRAM MakeStm;
-
- USES
- XMacro, Objects;
-
-
- VAR
- T: TEXT;
- S: STRING;
- KeyStream: tDosStream;
- CreateKeyCol: pKeyCol;
-
-
-
- PROCEDURE StoreKeyRec(VAR S: STRING);
- VAR
- P: BYTE;
- Value: WORD;
- Key: STRING;
- ValueStr: STRING;
- Error: INTEGER;
- BEGIN
- Key := Copy(S, 1, Pred(Pos(' ', S)));
-
- P := 1;
- WHILE (S[P] <> '=') AND (P <= Length(S)) DO Inc(P);
- IF P > 1 THEN BEGIN
- Move(S[P], S[1], Succ(Length(S) - P));
- Dec(S[0], Pred(P));
- END;
-
- Move(S[2], S[1], Pred(Length(S)));
- Dec(S[0]);
-
- P := 1;
- WHILE (S[P] = ' ') AND (P <= Length(S)) DO Inc(P);
- IF P > 1 THEN BEGIN
- Move(S[P], S[1], Succ(Length(S) - P));
- Dec(S[0], Pred(P));
- END;
-
- ValueStr := Copy(S, 1, Pred(Pos(';', S)));
- Val(ValueStr, Value, Error);
- IF Error <> 0 THEN BEGIN
- WriteLn('Ungültige Quelldatei. Stream nicht angelegt.');
- Halt(1);
- END;
- CreateKeyCol^.InsertKey(Key, Value);
- END;
-
-
- BEGIN
- RegisterXMacro;
-
- CreateKeyCol := New(pKeyCol, Init(50,10));
- Assign(T, 'KBCONST.TXT');
- Reset(T);
- IF IOResult = 0 THEN BEGIN
- Write('Generiere Konstanten-Stream...');
- WHILE NOT EoF(T) DO BEGIN
- ReadLn(T, S);
- StoreKeyRec(S);
- END;
- Close(T);
- WITH KeyStream DO BEGIN
- Init('KBCONST.STM', stCreate);
- Put(CreateKeyCol);
- IF Status <> stOk THEN
- WriteLn('Fehler beim Erzeugen von KBCONST.STM');
- Done;
- END;
- WriteLn('erfolgreich beendet.');
- END ELSE
- WriteLn(#7'KBCONST.TXT nicht gefunden.');
- Dispose(CreateKeyCol, Done);
- END.
-
-
- (* ------------------------------------------------------ *)
- (* Ende von MAKESTM.PAS *)
-