-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtmsgc.pas
More file actions
85 lines (68 loc) · 1.82 KB
/
tmsgc.pas
File metadata and controls
85 lines (68 loc) · 1.82 KB
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
{$I-}
Program tMsgC;
Uses
Objects,
tMisc,
tGlob,
tMsgLib;
Const
ResName : Array [1..3] Of String [8] = ('Params', 'Messages', 'Help');
OutFile : String = 'tornado.msg';
{$I ver.inc}
Var
C : PBigCollection;
i : Byte;
LineNum : LongInt;
S : String;
F : Text;
Begin
WriteLn;
WriteLn ('Tornado messages resource files compiler.');
WriteLn ('(C) by Konstantin Klyagin, 1996-97');
WriteLn;
If ParamCount < 3 Then
Begin
WriteLn ('Command line usage:');
WriteLn (' tmsgc.exe <param_names> <messages_list> <help_text> [output]');
WriteLn;
Exit;
End;
If ParamCount >= 4 Then OutFile := ParamStr (4);
If FileExists (OutFile) Then tDeleteFile (OutFile);
C := New (PBigCollection, Init (512, 16));
For i := 1 To 3 Do
Begin
WriteLn ('Compiling ', ResName [i], ': ', UpString (DefaultName
(ParamStr (i), 'tmf', '')));
Assign (F, DefaultName (ParamStr (i), 'tmf', ''));
ReSet (F);
If IOResult <> 0 Then
Begin
WriteLn ('Unable to open file ' + UpString (DefaultName
(ParamStr (i), 'tmf', '')) + '!');
Halt;
End;
LineNum := 0;
While Not Eof (F) Do
Begin
ReadLn (F, S);
Inc (LineNum);
If S = '' Then Continue;
If (S [1] <> S [Length (S)]) And (S [1] <> '[') And (S [Length (S)] <> ']') Then
Begin
WriteLn ('Error line #', LineNum, ' in file ', UpString
(DefaultName (ParamStr (i), 'tmf', '')));
WriteLn;
Halt;
End;
S := Copy (S, 2, Length (S)-2);
C^. InsLine (S);
End;
Close (F);
SaveCollection (OutFile, C, ResName [i], tMsgC. NameVer);
C^. DeleteAll;
End;
WriteLn;
WriteLn ('Done.');
Dispose (C, Done);
End.