source: GTP/trunk/Lib/Vis/Preprocessing/manual/code/c2tex.tex @ 2066

Revision 2066, 43.7 KB checked in by mattausch, 18 years ago (diff)

worked on integration manual

RevLine 
[2066]1\input default.mac
2\symbol{}\leftline{ }
3\comment{}\leftline{ 1:\ \ \ /************************************************************************** }
4\leftline{ 2:\ \ \ c2tex\ -\ Konverze\ C++\ do\ TeXu }
5\leftline{ 3:\ \ \ Jiri\ Bittner,\ Cerven\ 1996 }
6\leftline{ 4:\ \ \ **************************************************************************/\symbol{} }
7\leftline{ 5:\ \ \  }
8\keyb{}\leftline{ 6:\ \ \ \#include\symbol{}\ <\normal{}stdlib.h\symbol{}> }
9\keyb{}\leftline{ 7:\ \ \ \#include\symbol{}\ <\normal{}stdio.h\symbol{}> }
10\keyb{}\leftline{ 8:\ \ \ \#include\symbol{}\ <\normal{}string.h\symbol{}> }
11\keyb{}\leftline{ 9:\ \ \ \#include\symbol{}\ <\normal{}iostream.h\symbol{}> }
12\keyb{}\leftline{10:\ \ \ \#include\symbol{}\ <\normal{}fstream.h\symbol{}> }
13\leftline{11:\ \ \  }
14\leftline{12:\ \ \  }
15\keyb{}\leftline{13:\ \ \ \#define\symbol{}\ \ \ \ \ \ \ \ \normal{}KEYWORD1\symbol{}\ \ \ \ \ \ \ \normal{}1\symbol{}\ \ \ \ \ \comment{}//\ kody\ pro\ jednotlive\ znacky }
16\keyb{}\leftline{14:\ \ \ \#define\symbol{}\ \ \ \ \ \ \ \ \normal{}KEYWORD2\symbol{}\ \ \ \ \ \ \ \normal{}2\symbol{} }
17\keyb{}\leftline{15:\ \ \ \#define\symbol{}\ \ \ \ \ \ \ \ \normal{}SYMBOL\symbol{}\ \ \ \ \ \ \ \ \ \normal{}3\symbol{} }
18\keyb{}\leftline{16:\ \ \ \#define\symbol{}\ \ \ \ \ \ \ \ \normal{}COMMENT\symbol{}\ \ \ \ \ \ \ \ \normal{}4\symbol{} }
19\keyb{}\leftline{17:\ \ \ \#define\symbol{}\ \ \ \ \ \ \ \ \normal{}NORMAL\symbol{}\ \ \ \ \ \ \ \ \ \normal{}5\symbol{} }
20\leftline{18:\ \ \  }
21\keyb{}\leftline{19:\ \ \ \#define\symbol{}\ \ \ \ \ \ \ \ \normal{}WORD\symbol{}\ \ \ \normal{}10\symbol{} }
22\leftline{20:\ \ \  }
23\keyb{}\leftline{21:\ \ \ \#define\symbol{}\ \ \ \ \ \ \ \ \normal{}S_LEN\symbol{}\ \ \normal{}256\symbol{} }
24\leftline{22:\ \ \  }
25\keya{}\leftline{23:\ \ \ int\symbol{}\ \normal{}usePascal\symbol{}=\normal{}0\symbol{}; }
26\leftline{24:\ \ \  }
27\keya{}\leftline{25:\ \ \ char\symbol{}\ \normal{}comment_1b\symbol{}='/',\normal{}comment_2b\symbol{}='*',\normal{}comment_1e\symbol{}='*',\normal{}comment_2e\symbol{}='/'; }
28\leftline{26:\ \ \  }
29\keya{}\leftline{27:\ \ \ class\symbol{}\ \normal{}BaseC\symbol{} }
30\leftline{28:\ \ \ $\{$ }
31\leftline{29:\ \ \  }
32\leftline{30:\ \ \ $\}$; }
33\leftline{31:\ \ \  }
34\leftline{32:\ \ \  }
35\keya{}\leftline{33:\ \ \ typedef\symbol{}\ \keya{}double\symbol{}\ \normal{}Real\symbol{}; }
36\leftline{34:\ \ \  }
37\leftline{35:\ \ \  }
38\keya{}\leftline{36:\ \ \ class\symbol{}\ \normal{}OptionsC\symbol{}\ :\ \keya{}public\symbol{}\ \normal{}BaseC\symbol{} }
39\leftline{37:\ \ \ $\{$ }
40\keya{}\leftline{38:\ \ \ public\symbol{}: }
41\leftline{39:\ \ \  }
42\leftline{40:\ \ \ \ \ \keya{}int\symbol{}\ \ \ \ \normal{}number\symbol{}; }
43\leftline{41:\ \ \ \ \ \keya{}char\symbol{}\ **\normal{}strings\symbol{}; }
44\leftline{42:\ \ \ \ \  }
45\comment{}\leftline{43:\ \ \ //\ \ OptionsC()\ $\{$\ number=0;\ $\}$ }
46\symbol{}\leftline{44:\ \ \ \ \ \normal{}OptionsC\symbol{}(\keya{}int\symbol{}\ \normal{}n\symbol{},\keya{}char\symbol{}\ **\normal{}a\symbol{})\ $\{$\ \normal{}init\symbol{}(\normal{}n\symbol{},\normal{}a\symbol{});\ $\}$ }
47\leftline{45:\ \ \  }
48\leftline{46:\ \ \ \ \ \keya{}void\symbol{}\ \normal{}init\symbol{}(\keya{}int\symbol{}\ \normal{}n\symbol{},\keya{}char\symbol{}\ **\normal{}s\symbol{})\ $\{$\ \normal{}number\symbol{}=\normal{}n\symbol{};\ \normal{}strings\symbol{}=\normal{}s\symbol{};\ $\}$ }
49\leftline{47:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}isOption\symbol{}(\keya{}char\symbol{}\ *\normal{}string\symbol{}); }
50\leftline{48:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}isOption\symbol{}(\keya{}char\symbol{}\ *\normal{}string\symbol{},\keya{}int\symbol{}\ *\normal{}number\symbol{}); }
51\leftline{49:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}getParam\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{},\keya{}int\symbol{}\ \normal{}n\symbol{}=\normal{}1\symbol{}); }
52\leftline{50:\ \ \  }
53\leftline{51:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}getOptionValue\symbol{}(\keya{}char\symbol{}\ *\normal{}string\symbol{},\keya{}int\symbol{}\ *\normal{}result\symbol{}); }
54\leftline{52:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}getOptionValue\symbol{}(\keya{}char\symbol{}\ *\normal{}string\symbol{},\normal{}Real\symbol{}\ *\normal{}r\symbol{}); }
55\leftline{53:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}getOptionValue\symbol{}(\keya{}char\symbol{}\ *\normal{}string\symbol{},\keya{}char\symbol{}\ *\normal{}result\symbol{}); }
56\leftline{54:\ \ \  }
57\leftline{55:\ \ \ $\}$; }
58\leftline{56:\ \ \  }
59\leftline{57:\ \ \  }
60\keya{}\leftline{58:\ \ \ class\symbol{}\ \normal{}LexanC\symbol{}:\ \keya{}public\symbol{}\ \normal{}BaseC\symbol{} }
61\leftline{59:\ \ \ $\{$ }
62\keya{}\leftline{60:\ \ \ public\symbol{}: }
63\normal{}\leftline{61:\ \ \ FILE\symbol{}\ *\normal{}file\symbol{}; }
64\leftline{62:\ \ \  }
65\keya{}\leftline{63:\ \ \ int\symbol{}\ \ \ \ \normal{}nsep\symbol{},\normal{}nkey\symbol{}[\normal{}2\symbol{}]; }
66\keya{}\leftline{64:\ \ \ char\symbol{}\ \ \ *\normal{}separators\symbol{}; }
67\keya{}\leftline{65:\ \ \ char\symbol{}\ \ \ **\normal{}key\symbol{}[\normal{}2\symbol{}]; }
68\leftline{66:\ \ \  }
69\normal{}\leftline{67:\ \ \ LexanC\symbol{}()$\{$\normal{}init\symbol{}("\normal{}default.lex\symbol{}");$\}$ }
70\leftline{68:\ \ \  }
71\keya{}\leftline{69:\ \ \ int\symbol{}\ \ \ \ \normal{}isSeparator\symbol{}(\keya{}int\symbol{}\ \normal{}c\symbol{})$\{$\ \keya{}return\symbol{}\ \normal{}strchr\symbol{}(\normal{}separators\symbol{},\normal{}c\symbol{})!=\normal{}NULL\symbol{};\ $\}$ }
72\keya{}\leftline{70:\ \ \ int\symbol{}\ \ \ \ \normal{}isKey\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{}); }
73\leftline{71:\ \ \  }
74\keya{}\leftline{72:\ \ \ int\symbol{}\ \ \ \ \normal{}init\symbol{}(\keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}lexname\symbol{}); }
75\keya{}\leftline{73:\ \ \ int\symbol{}\ \ \ \ \normal{}open\symbol{}(\keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}filename\symbol{}); }
76\leftline{74:\ \ \  }
77\keya{}\leftline{75:\ \ \ int\symbol{}\ \ \ \ \normal{}readWord\symbol{}(\normal{}FILE\symbol{}\ *\normal{}f\symbol{},\keya{}char\symbol{}\ *\normal{}string\symbol{}); }
78\leftline{76:\ \ \  }
79\keya{}\leftline{77:\ \ \ int\symbol{}\ \ \ \ \normal{}read\symbol{}(\keya{}char\symbol{}\ *\normal{}string\symbol{}); }
80\keya{}\leftline{78:\ \ \ void\symbol{}\ \ \ \normal{}close\symbol{}()$\{$\normal{}fclose\symbol{}(\normal{}file\symbol{});$\}$ }
81\leftline{79:\ \ \  }
82\keya{}\leftline{80:\ \ \ virtual\symbol{}\ \ \ \ \ \ \ \ \normal{}ostream\symbol{}\&\ \keya{}operator\symbol{}>>(\normal{}ostream\symbol{}\ \&\normal{}s\symbol{})\ $\{$\  }
83\leftline{81:\ \ \ \ \ \ \ \ \ \ \normal{}s\symbol{}<<\normal{}nsep\symbol{}<<"\\normal{}n\symbol{}"<<\normal{}nkey\symbol{}[\normal{}0\symbol{}]<<"\\normal{}n\symbol{}"<<\normal{}nkey\symbol{}[\normal{}1\symbol{}]<<"\\normal{}n\symbol{}"; }
84\leftline{82:\ \ \ \ \ \ \ \ \ \ \keya{}return\symbol{}\ \normal{}s\symbol{}; }
85\leftline{83:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\}$ }
86\leftline{84:\ \ \ \~{}\normal{}LexanC\symbol{}()$\{$\normal{}fclose\symbol{}(\normal{}file\symbol{});$\}$ }
87\leftline{85:\ \ \ $\}$; }
88\leftline{86:\ \ \  }
89\keya{}\leftline{87:\ \ \ class\symbol{}\ \normal{}TexC\symbol{}:\ \keya{}public\symbol{}\ \normal{}BaseC\symbol{} }
90\leftline{88:\ \ \ $\{$ }
91\keya{}\leftline{89:\ \ \ public\symbol{}: }
92\leftline{90:\ \ \ \ \ \normal{}FILE\symbol{}\ *\normal{}file\symbol{}; }
93\leftline{91:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}numbers\symbol{}; }
94\leftline{92:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}lnumber\symbol{}; }
95\leftline{93:\ \ \ \ \  }
96\leftline{94:\ \ \ \ \ \normal{}TexC\symbol{}()$\{$\normal{}numbers\symbol{}=\normal{}0\symbol{};\ \normal{}init\symbol{}("\normal{}output.tex\symbol{}");$\}$ }
97\leftline{95:\ \ \ \ \ \normal{}TexC\symbol{}(\keya{}int\symbol{}\ \normal{}n\symbol{},\ \keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}s\symbol{})$\{$ }
98\leftline{96:\ \ \ \ \ \ \ \normal{}lnumber\symbol{}=\normal{}0\symbol{}; }
99\leftline{97:\ \ \ \ \ \ \ \normal{}numbers\symbol{}=\normal{}n\symbol{};\ \normal{}init\symbol{}(\normal{}s\symbol{});$\}$ }
100\leftline{98:\ \ \ \ \  }
101\leftline{99:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}init\symbol{}(\keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}filename\symbol{}); }
102\leftline{100:\ \ \ \ \ \keya{}int\symbol{}\ \normal{}write\symbol{}(\keya{}const\symbol{}\ \keya{}int\symbol{}\ \normal{}code\symbol{},\keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}string\symbol{}); }
103\leftline{101:\ \ \ \ \ \~{}\normal{}TexC\symbol{}()\ $\{$\ \comment{}/*\ fprintf(file,"\n\\bye\n");\ */\symbol{}\ \normal{}fclose\symbol{}(\normal{}file\symbol{});$\}$ }
104\leftline{102:\ \ \  }
105\leftline{103:\ \ \ $\}$; }
106\leftline{104:\ \ \  }
107\leftline{105:\ \ \  }
108\leftline{106:\ \ \  }
109\leftline{107:\ \ \  }
110\leftline{108:\ \ \  }
111\leftline{109:\ \ \  }
112\leftline{110:\ \ \  }
113\leftline{111:\ \ \  }
114\keya{}\leftline{112:\ \ \ int\symbol{}\ \normal{}OptionsC\symbol{}::\normal{}isOption\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{}) }
115\leftline{113:\ \ \ $\{$ }
116\keya{}\leftline{114:\ \ \ int\symbol{}\ \normal{}found\symbol{}=\normal{}0\symbol{}; }
117\leftline{115:\ \ \ \  }
118\leftline{116:\ \ \ \ \keya{}for\symbol{}\ (\keya{}int\symbol{}\ \normal{}i\symbol{}=\normal{}1\symbol{};\normal{}i\symbol{}<\normal{}number\symbol{};\normal{}i\symbol{}++) }
119\leftline{117:\ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}strcmp\symbol{}(\normal{}s\symbol{},\normal{}strings\symbol{}[\normal{}i\symbol{}])==\normal{}0\symbol{})\ $\{$\ \normal{}found\symbol{}\ =\ \normal{}i\symbol{};\ \keya{}break\symbol{};$\}$ }
120\leftline{118:\ \ \  }
121\leftline{119:\ \ \ \ \keya{}return\symbol{}\ \normal{}found\symbol{}; }
122\leftline{120:\ \ \ $\}$ }
123\leftline{121:\ \ \  }
124\keya{}\leftline{122:\ \ \ int\symbol{}\ \normal{}OptionsC\symbol{}::\normal{}isOption\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{},\keya{}int\symbol{}\ *\normal{}n\symbol{}) }
125\leftline{123:\ \ \ $\{$ }
126\keya{}\leftline{124:\ \ \ int\symbol{}\ \normal{}found\symbol{}=\normal{}0\symbol{}; }
127\leftline{125:\ \ \  }
128\keya{}\leftline{126:\ \ \ for\symbol{}\ (\keya{}int\symbol{}\ \normal{}i\symbol{}=\normal{}1\symbol{};\normal{}i\symbol{}<\normal{}number\symbol{};\normal{}i\symbol{}++) }
129\leftline{127:\ \ \ \ \ \keya{}if\symbol{}\ (\normal{}strcmp\symbol{}(\normal{}s\symbol{},\normal{}strings\symbol{}[\normal{}i\symbol{}])==\normal{}0\symbol{}) }
130\leftline{128:\ \ \ \ \ \ \ $\{$ }
131\leftline{129:\ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}i\symbol{}+\normal{}1\symbol{}<\normal{}number\symbol{}) }
132\leftline{130:\ \ \ \ \ \ \ \ \ \ $\{$ }
133\leftline{131:\ \ \ \ \ \ \ \ \ \ \ \ *\normal{}n\symbol{}=\normal{}atoi\symbol{}(\normal{}strings\symbol{}[\normal{}i\symbol{}+\normal{}1\symbol{}]); }
134\leftline{132:\ \ \ \ \ \ \ \ \ \ \ \ \normal{}found\symbol{}\ =\ \normal{}i\symbol{}; }
135\leftline{133:\ \ \ \ \ \ \ \ \ \ \ \ \keya{}break\symbol{}; }
136\leftline{134:\ \ \ \ \ \ \ \ \ \ $\}$ }
137\leftline{135:\ \ \ \ \ \ \ $\}$ }
138\leftline{136:\ \ \  }
139\keya{}\leftline{137:\ \ \ return\symbol{}\ \normal{}found\symbol{}; }
140\leftline{138:\ \ \ $\}$ }
141\leftline{139:\ \ \  }
142\leftline{140:\ \ \  }
143\comment{}\leftline{141:\ \ \ //\ search\ for\ occurence\ of\ non-option }
144\keya{}\leftline{142:\ \ \ int\symbol{}\ \normal{}OptionsC\symbol{}::\normal{}getParam\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{},\keya{}int\symbol{}\ \normal{}n\symbol{}) }
145\leftline{143:\ \ \ $\{$ }
146\keya{}\leftline{144:\ \ \ int\symbol{}\ \normal{}i\symbol{},\normal{}k\symbol{}=\normal{}1\symbol{},\normal{}found\symbol{}=\normal{}0\symbol{}; }
147\leftline{145:\ \ \  }
148\keya{}\leftline{146:\ \ \ for\symbol{}\ (\normal{}i\symbol{}=\normal{}1\symbol{};\normal{}i\symbol{}<\normal{}number\symbol{};\normal{}i\symbol{}++) }
149\leftline{147:\ \ \ \ \ \keya{}if\symbol{}\ (\normal{}strings\symbol{}[\normal{}i\symbol{}][\normal{}0\symbol{}]!='-') }
150\leftline{148:\ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}k\symbol{}==\normal{}n\symbol{})\ $\{$\ \normal{}found\symbol{}=\normal{}1\symbol{};\ \keya{}break\symbol{};$\}$ }
151\leftline{149:\ \ \ \ \ \ \ \ \ \ \keya{}else\symbol{} }
152\leftline{150:\ \ \ \ \ \ \ \ \ \ \ \normal{}k\symbol{}++; }
153\leftline{151:\ \ \  }
154\keya{}\leftline{152:\ \ \ if\symbol{}\ (\normal{}found\symbol{})\ \normal{}strcpy\symbol{}(\normal{}s\symbol{},\normal{}strings\symbol{}[\normal{}i\symbol{}]); }
155\leftline{153:\ \ \  }
156\keya{}\leftline{154:\ \ \ return\symbol{}\ \normal{}found\symbol{}; }
157\leftline{155:\ \ \ $\}$ }
158\leftline{156:\ \ \  }
159\leftline{157:\ \ \  }
160\leftline{158:\ \ \  }
161\keya{}\leftline{159:\ \ \ int\symbol{}\ \normal{}OptionsC\symbol{}::\normal{}getOptionValue\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{},\keya{}int\symbol{}\ *\normal{}result\symbol{}) }
162\leftline{160:\ \ \ $\{$ }
163\keya{}\leftline{161:\ \ \ int\symbol{}\ \normal{}found\symbol{}=\normal{}0\symbol{}; }
164\keya{}\leftline{162:\ \ \ char\symbol{}\ *\normal{}pp\symbol{}; }
165\leftline{163:\ \ \  }
166\keya{}\leftline{164:\ \ \ for\symbol{}\ (\keya{}int\symbol{}\ \normal{}i\symbol{}=\normal{}1\symbol{};\normal{}i\symbol{}<\normal{}number\symbol{};\normal{}i\symbol{}++) }
167\leftline{165:\ \ \ \ \ $\{$ }
168\leftline{166:\ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}strstr\symbol{}(\normal{}strings\symbol{}[\normal{}i\symbol{}],\normal{}s\symbol{})) }
169\leftline{167:\ \ \ \ \ \ \ $\{$ }
170\leftline{168:\ \ \ \ \ \ \ \ \ \normal{}pp\symbol{}=\normal{}strings\symbol{}[\normal{}i\symbol{}]+\normal{}strlen\symbol{}(\normal{}s\symbol{}); }
171\leftline{169:\ \ \ \ \ \ \ \ \ *\normal{}result\symbol{}=\normal{}atoi\symbol{}(\normal{}pp\symbol{}); }
172\leftline{170:\ \ \ \ \ \ \ \ \ \normal{}found\symbol{}\ =\ \normal{}i\symbol{}; }
173\leftline{171:\ \ \ \ \ \ \ \ \ \keya{}break\symbol{}; }
174\leftline{172:\ \ \ \ \ \ \ $\}$ }
175\leftline{173:\ \ \ \ \ $\}$ }
176\keya{}\leftline{174:\ \ \ return\symbol{}\ \normal{}found\symbol{}; }
177\leftline{175:\ \ \ $\}$ }
178\leftline{176:\ \ \  }
179\keya{}\leftline{177:\ \ \ int\symbol{} }
180\normal{}\leftline{178:\ \ \ OptionsC\symbol{}::\normal{}getOptionValue\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{},\normal{}Real\symbol{}\ *\normal{}result\symbol{}) }
181\leftline{179:\ \ \ $\{$ }
182\keya{}\leftline{180:\ \ \ int\symbol{}\ \normal{}found\symbol{}=\normal{}0\symbol{}; }
183\keya{}\leftline{181:\ \ \ char\symbol{}\ *\normal{}pp\symbol{}; }
184\leftline{182:\ \ \  }
185\keya{}\leftline{183:\ \ \ for\symbol{}\ (\keya{}int\symbol{}\ \normal{}i\symbol{}=\normal{}1\symbol{};\normal{}i\symbol{}<\normal{}number\symbol{};\normal{}i\symbol{}++) }
186\leftline{184:\ \ \ \ \ $\{$ }
187\leftline{185:\ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}strstr\symbol{}(\normal{}strings\symbol{}[\normal{}i\symbol{}],\normal{}s\symbol{})) }
188\leftline{186:\ \ \ \ \ \ \ $\{$ }
189\leftline{187:\ \ \ \ \ \ \ \ \ \normal{}pp\symbol{}=\normal{}strings\symbol{}[\normal{}i\symbol{}]+\normal{}strlen\symbol{}(\normal{}s\symbol{}); }
190\leftline{188:\ \ \ \ \ \ \ \ \ *\normal{}result\symbol{}=\normal{}atof\symbol{}(\normal{}pp\symbol{}); }
191\leftline{189:\ \ \ \ \ \ \ \ \ \normal{}found\symbol{}\ =\ \normal{}i\symbol{}; }
192\leftline{190:\ \ \ \ \ \ \ \ \ \keya{}break\symbol{}; }
193\leftline{191:\ \ \ \ \ \ \ $\}$ }
194\leftline{192:\ \ \ \ \ $\}$ }
195\keya{}\leftline{193:\ \ \ return\symbol{}\ \normal{}found\symbol{}; }
196\leftline{194:\ \ \ $\}$ }
197\leftline{195:\ \ \  }
198\keya{}\leftline{196:\ \ \ int\symbol{}\ \normal{}OptionsC\symbol{}::\normal{}getOptionValue\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{},\keya{}char\symbol{}\ *\normal{}result\symbol{}) }
199\leftline{197:\ \ \ $\{$ }
200\keya{}\leftline{198:\ \ \ int\symbol{}\ \normal{}found\symbol{}=\normal{}0\symbol{}; }
201\keya{}\leftline{199:\ \ \ char\symbol{}\ *\normal{}pp\symbol{}; }
202\leftline{200:\ \ \  }
203\keya{}\leftline{201:\ \ \ for\symbol{}\ (\keya{}int\symbol{}\ \normal{}i\symbol{}=\normal{}1\symbol{};\normal{}i\symbol{}<\normal{}number\symbol{};\normal{}i\symbol{}++) }
204\leftline{202:\ \ \ \ \ $\{$ }
205\leftline{203:\ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}strstr\symbol{}(\normal{}strings\symbol{}[\normal{}i\symbol{}],\normal{}s\symbol{})) }
206\leftline{204:\ \ \ \ \ \ \ $\{$ }
207\leftline{205:\ \ \ \ \ \ \ \ \ \normal{}pp\symbol{}=\normal{}strings\symbol{}[\normal{}i\symbol{}]+\normal{}strlen\symbol{}(\normal{}s\symbol{}); }
208\leftline{206:\ \ \ \ \ \ \ \ \ \normal{}strcpy\symbol{}(\normal{}result\symbol{},\normal{}pp\symbol{}); }
209\leftline{207:\ \ \ \ \ \ \ \ \ \normal{}found\symbol{}\ =\ \normal{}i\symbol{}; }
210\leftline{208:\ \ \ \ \ \ \ \ \ \keya{}break\symbol{}; }
211\leftline{209:\ \ \ \ \ \ \ $\}$ }
212\leftline{210:\ \ \ \ \ $\}$ }
213\keya{}\leftline{211:\ \ \ return\symbol{}\ \normal{}found\symbol{}; }
214\leftline{212:\ \ \ $\}$ }
215\leftline{213:\ \ \  }
216\leftline{214:\ \ \  }
217\keya{}\leftline{215:\ \ \ int\symbol{}\ \normal{}TexC\symbol{}::\normal{}write\symbol{}(\keya{}const\symbol{}\ \keya{}int\symbol{}\ \normal{}code\symbol{},\keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}string\symbol{}) }
218\leftline{216:\ \ \ $\{$ }
219\keya{}\leftline{217:\ \ \ static\symbol{}\ \keya{}int\symbol{}\ \normal{}line\symbol{}=\normal{}1\symbol{}; }
220\keya{}\leftline{218:\ \ \ static\symbol{}\ \keya{}int\symbol{}\ \normal{}i\symbol{}=\normal{}0\symbol{}; }
221\keya{}\leftline{219:\ \ \ const\symbol{}\ \keya{}char\symbol{}\ *\normal{}sp\symbol{}; }
222\leftline{220:\ \ \  }
223\keya{}\leftline{221:\ \ \ switch\symbol{}(\normal{}code\symbol{})\ $\{$ }
224\leftline{222:\ \ \ \ \  }
225\leftline{223:\ \ \ \ \keya{}case\symbol{}\ \normal{}KEYWORD1\symbol{}\ :\ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}keya\symbol{}$\{$$\}$");\ \keya{}break\symbol{}; }
226\leftline{224:\ \ \ \ \keya{}case\symbol{}\ \normal{}KEYWORD2\symbol{}\ :\ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}keyb\symbol{}$\{$$\}$");\ \keya{}break\symbol{}; }
227\leftline{225:\ \ \ \ \keya{}case\symbol{}\ \normal{}COMMENT\symbol{}\ \ :\ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}comment\symbol{}$\{$$\}$");\ \keya{}break\symbol{}; }
228\leftline{226:\ \ \ \ \keya{}case\symbol{}\ \normal{}SYMBOL\symbol{}\ \ \ :\ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}symbol\symbol{}$\{$$\}$");\ \keya{}break\symbol{}; }
229\leftline{227:\ \ \ \ \keya{}case\symbol{}\ \normal{}NORMAL\symbol{}\ \ \ :\ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}normal\symbol{}$\{$$\}$");\ \keya{}break\symbol{}; }
230\leftline{228:\ \ \ $\}$ }
231\leftline{229:\ \ \ \  }
232\leftline{230:\ \ \ \ \keya{}for\symbol{}(\normal{}sp\symbol{}=\normal{}string\symbol{};*\normal{}sp\symbol{}!=\normal{}0\symbol{};\normal{}sp\symbol{}++,\normal{}i\symbol{}++) }
233\leftline{231:\ \ \ \ \ \ $\{$ }
234\leftline{232:\ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}line\symbol{})\ $\{$ }
235\leftline{233:\ \ \ \ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}leftline\symbol{}$\{$");\ \normal{}line\symbol{}=\normal{}0\symbol{}; }
236\leftline{234:\ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}strstr\symbol{}(\normal{}string\symbol{},\ "\keya{}Algorithm\symbol{}")\ ==\ \normal{}string\symbol{}) }
237\leftline{235:\ \ \ \ \ \ \ \ \ \ \ \normal{}lnumber\symbol{}\ =\ \normal{}0\symbol{}; }
238\leftline{236:\ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}numbers\symbol{}\ \&\&\ \normal{}lnumber\symbol{}) }
239\leftline{237:\ \ \ \ \ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\normal{}\%2d\symbol{}:\\\ \\\ \\\ ",\normal{}lnumber\symbol{}); }
240\leftline{238:\ \ \ \ \ \ \ \ \ \ \normal{}lnumber\symbol{}++; }
241\leftline{239:\ \ \ \ \ \ \ \ $\}$ }
242\leftline{240:\ \ \ \ \ \ \ \  }
243\leftline{241:\ \ \ \ \ \ \ \ \keya{}switch\symbol{}(*\normal{}sp\symbol{})\ $\{$ }
244\leftline{242:\ \ \ \ \ \ \ \ \ \  }
245\keyb{}\leftline{243:\ \ \ \#define\symbol{}\ \normal{}TAB_SIZE\symbol{}\ \ \ \ \ \ \ \normal{}8\symbol{} }
246\leftline{244:\ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '\\normal{}t\symbol{}'\ :\ \ \ \ \ \ \  }
247\leftline{245:\ \ \ \ \ \ \ \ \ \ \comment{}//\ \ \ \ \ \ \ \ \ \ \ fprintf(file,"\\tab");\ break; }
248\symbol{}\leftline{246:\ \ \ \ \ \ \ \ \ \ \keya{}int\symbol{}\ \normal{}n\symbol{},\normal{}j\symbol{}; }
249\leftline{247:\ \ \ \ \ \ \ \ \ \ \normal{}n\symbol{}=((\normal{}i\symbol{}/\normal{}TAB_SIZE\symbol{})+\normal{}1\symbol{})*\normal{}TAB_SIZE\symbol{}-\normal{}i\symbol{}; }
250\leftline{248:\ \ \ \ \ \ \ \ \ \ \keya{}for\symbol{}(\normal{}j\symbol{}=\normal{}0\symbol{};\normal{}j\symbol{}<\normal{}n\symbol{};\normal{}j\symbol{}++)\ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\ "); }
251\leftline{249:\ \ \ \ \ \ \ \ \ \ \keya{}break\symbol{}; }
252\leftline{250:\ \ \ \ \ \ \ \ \ \  }
253\leftline{251:\ \ \ \ \ \ \ \ \ \  }
254\leftline{252:\ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '\\normal{}n\symbol{}':\ \ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\ $\}$\\normal{}n\symbol{}"); }
255\leftline{253:\ \ \ \ \ \ \ \ \ \ \normal{}line\symbol{}=\normal{}1\symbol{};\ \normal{}i\symbol{}=\normal{}0\symbol{}; }
256\leftline{254:\ \ \ \ \ \ \ \ \ \ \keya{}break\symbol{}; }
257\leftline{255:\ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '\ '\ :\ \ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\ "); }
258\leftline{256:\ \ \ \ \ \ \ \ \ \keya{}break\symbol{}; }
259\leftline{257:\ \ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '\&'\ :\ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\&");\ \keya{}break\symbol{}; }
260\leftline{258:\ \ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '\normal{}\#\symbol{}'\ :\ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}\#\symbol{}");\ \keya{}break\symbol{}; }
261\leftline{259:\ \ \ \ \ \ \ \ \ \ \comment{}//\ \ \ \ \ \ case\ '_'\ :\ \ \ \ fprintf(file,"\\_$\{$$\}$");\ break; }
262\symbol{}\leftline{260:\ \ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '\normal{}_\symbol{}'\ :\ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\normal{}_\symbol{}");\ \keya{}break\symbol{}; }
263\leftline{261:\ \ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '\^{}'\ :\ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\^{}$\{$$\}$");\ \keya{}break\symbol{}; }
264\leftline{262:\ \ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '\normal{}\%\symbol{}'\ :\ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}\%\%\symbol{}");\ \keya{}break\symbol{}; }
265\leftline{263:\ \ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '$\{$'\ :\ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\normal{}$\symbol{}\\$\{$\normal{}$\symbol{}");\ \keya{}break\symbol{}; }
266\leftline{264:\ \ \ \ \ \ \ \ \ \keya{}case\symbol{}\ '$\}$'\ :\ \ \ \ \ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\normal{}$\symbol{}\\$\}$\normal{}$\symbol{}");\ \keya{}break\symbol{}; }
267\leftline{265:\ \ \ \ \ \ \ \ \ \ \comment{}//\ \ case\ '\\'\ :\ \ \ \ \ \ \ fprintf(file,"$\\backslash$");\ break; }
268\symbol{}\leftline{266:\ \ \ \ \ \ \ \ \ \ \comment{}//\ \ case\ '$'\ :\ \ \ \ \ \ \ \ fprintf(file,"\\$");\ break; }
269\symbol{}\leftline{267:\ \ \ \ \ \ \ \comment{}//\ \ case\ '<'\ :\ \ \ \ \ fprintf(file,"\\<");\ break; }
270\symbol{}\leftline{268:\ \ \ \ \ \ \ \comment{}//\ \ case\ '>'\ :\ \ \ \ \ fprintf(file,"\\>");\ break; }
271\symbol{}\leftline{269:\ \ \  }
272\leftline{270:\ \ \ \ \ \keya{}case\symbol{}\ '\~{}'\ :\ \ \ \normal{}fprintf\symbol{}(\normal{}file\symbol{},"\\\~{}$\{$$\}$");\ \keya{}break\symbol{}; }
273\leftline{271:\ \ \ \ \ \ \ \ \  }
274\leftline{272:\ \ \ \ \ \ \  }
275\leftline{273:\ \ \ \ \ \keya{}default\symbol{}\ \ :\ \ \ \normal{}fputc\symbol{}(*\normal{}sp\symbol{},\normal{}file\symbol{}); }
276\leftline{274:\ \ \ \ \ $\}$ }
277\leftline{275:\ \ \ $\}$ }
278\keya{}\leftline{276:\ \ \ return\symbol{}\ \normal{}1\symbol{}; }
279\leftline{277:\ \ \ $\}$ }
280\leftline{278:\ \ \  }
281\leftline{279:\ \ \  }
282\keya{}\leftline{280:\ \ \ int\symbol{}\ \ \ \ \normal{}LexanC\symbol{}::\normal{}isKey\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{}) }
283\leftline{281:\ \ \ $\{$ }
284\keya{}\leftline{282:\ \ \ int\symbol{}\ \normal{}i\symbol{},\normal{}j\symbol{}; }
285\leftline{283:\ \ \  }
286\keya{}\leftline{284:\ \ \ for\symbol{}\ (\normal{}i\symbol{}=\normal{}0\symbol{};\normal{}i\symbol{}<\normal{}2\symbol{};\normal{}i\symbol{}++) }
287\leftline{285:\ \ \ \ \keya{}for\symbol{}(\normal{}j\symbol{}=\normal{}0\symbol{};\normal{}j\symbol{}<\normal{}nkey\symbol{}[\normal{}i\symbol{}];\normal{}j\symbol{}++) }
288\leftline{286:\ \ \ \ \ \keya{}if\symbol{}(\normal{}strcmp\symbol{}(\normal{}s\symbol{},\normal{}key\symbol{}[\normal{}i\symbol{}][\normal{}j\symbol{}])==\normal{}0\symbol{})\ \keya{}return\symbol{}\ \normal{}i\symbol{}+\normal{}1\symbol{}; }
289\leftline{287:\ \ \  }
290\keya{}\leftline{288:\ \ \ return\symbol{}\ \normal{}0\symbol{}; }
291\leftline{289:\ \ \ $\}$ }
292\leftline{290:\ \ \  }
293\leftline{291:\ \ \  }
294\keya{}\leftline{292:\ \ \ int\symbol{}\ \ \ \ \normal{}LexanC\symbol{}::\normal{}readWord\symbol{}(\normal{}FILE\symbol{}\ *\normal{}f\symbol{},\keya{}char\symbol{}\ *\normal{}s\symbol{}) }
295\leftline{293:\ \ \ $\{$ }
296\keya{}\leftline{294:\ \ \ int\symbol{}\ \ \ \ \normal{}i\symbol{}=\normal{}0\symbol{}; }
297\keya{}\leftline{295:\ \ \ int\symbol{}\ \ \ \ \normal{}c\symbol{}; }
298\leftline{296:\ \ \  }
299\keya{}\leftline{297:\ \ \ do\symbol{} }
300\leftline{298:\ \ \ $\{$ }
301\leftline{299:\ \ \ \ \ \ \ \ \ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}f\symbol{}); }
302\leftline{300:\ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}c\symbol{}==\normal{}EOF\symbol{})\ \keya{}return\symbol{}\ \normal{}0\symbol{}; }
303\leftline{301:\ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (!\normal{}isSeparator\symbol{}(\normal{}c\symbol{}))\ \keya{}break\symbol{}; }
304\leftline{302:\ \ \ $\}$\ \keya{}while\symbol{}(\normal{}1\symbol{}); }
305\leftline{303:\ \ \  }
306\leftline{304:\ \ \  }
307\keya{}\leftline{305:\ \ \ do\symbol{} }
308\leftline{306:\ \ \ $\{$ }
309\leftline{307:\ \ \ \ \ \ \ \ \ \ \normal{}s\symbol{}[\normal{}i\symbol{}++]=\normal{}c\symbol{}; }
310\leftline{308:\ \ \ \ \ \ \ \ \ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}f\symbol{}); }
311\leftline{309:\ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}c\symbol{}==\normal{}EOF\symbol{})\ \keya{}break\symbol{}; }
312\leftline{310:\ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}isSeparator\symbol{}(\normal{}c\symbol{}))\ \keya{}break\symbol{}; }
313\leftline{311:\ \ \ $\}$\ \keya{}while\symbol{}(\normal{}1\symbol{}); }
314\leftline{312:\ \ \  }
315\normal{}\leftline{313:\ \ \ s\symbol{}[\normal{}i\symbol{}]=\normal{}0\symbol{}; }
316\keya{}\leftline{314:\ \ \ return\symbol{}\ \normal{}1\symbol{}; }
317\leftline{315:\ \ \ $\}$ }
318\leftline{316:\ \ \  }
319\leftline{317:\ \ \  }
320\keya{}\leftline{318:\ \ \ int\symbol{}\ \ \ \ \normal{}LexanC\symbol{}::\normal{}init\symbol{}(\keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}lexname\symbol{}) }
321\leftline{319:\ \ \ $\{$ }
322\normal{}\leftline{320:\ \ \ FILE\symbol{}\ *\normal{}f\symbol{}; }
323\leftline{321:\ \ \  }
324\keya{}\leftline{322:\ \ \ if\symbol{}\ ((\normal{}f\symbol{}=\normal{}fopen\symbol{}(\normal{}lexname\symbol{},"\normal{}rt\symbol{}"))==\normal{}NULL\symbol{})\ \keya{}return\symbol{}\ \normal{}0\symbol{}; }
325\leftline{323:\ \ \  }
326\leftline{324:\ \ \  }
327\keyb{}\leftline{325:\ \ \ \#define\symbol{}\ \ \ \ \ \ \ \ \normal{}NKEY\symbol{}\ \ \normal{}512\symbol{} }
328\leftline{326:\ \ \  }
329\normal{}\leftline{327:\ \ \ separators\symbol{}\ =\ \keya{}new\symbol{}\ \keya{}char\symbol{}[\normal{}256\symbol{}]; }
330\normal{}\leftline{328:\ \ \ key\symbol{}[\normal{}0\symbol{}]\ \ \ =\ \keya{}new\symbol{}\ \keya{}char\symbol{}*[\normal{}NKEY\symbol{}]; }
331\normal{}\leftline{329:\ \ \ key\symbol{}[\normal{}1\symbol{}]\ \ \ =\ \keya{}new\symbol{}\ \keya{}char\symbol{}*[\normal{}NKEY\symbol{}]; }
332\leftline{330:\ \ \  }
333\normal{}\leftline{331:\ \ \ nsep\symbol{}=\normal{}0\symbol{}; }
334\normal{}\leftline{332:\ \ \ separators\symbol{}[\normal{}nsep\symbol{}++]='\ '; }
335\normal{}\leftline{333:\ \ \ separators\symbol{}[\normal{}nsep\symbol{}++]='\\normal{}n\symbol{}'; }
336\normal{}\leftline{334:\ \ \ separators\symbol{}[\normal{}nsep\symbol{}++]='\\normal{}t\symbol{}'; }
337\leftline{335:\ \ \  }
338\normal{}\leftline{336:\ \ \ fgets\symbol{}(\normal{}separators\symbol{}+\normal{}nsep\symbol{},\normal{}100\symbol{},\normal{}f\symbol{}); }
339\normal{}\leftline{337:\ \ \ nsep\symbol{}=\normal{}strlen\symbol{}(\normal{}separators\symbol{}); }
340\leftline{338:\ \ \  }
341\keya{}\leftline{339:\ \ \ int\symbol{}\ \normal{}i\symbol{}=\normal{}0\symbol{},\normal{}type\symbol{}=\normal{}0\symbol{}; }
342\keya{}\leftline{340:\ \ \ char\symbol{}\ \normal{}s\symbol{}[\normal{}64\symbol{}]; }
343\leftline{341:\ \ \  }
344\keya{}\leftline{342:\ \ \ while\symbol{}(\normal{}readWord\symbol{}(\normal{}f\symbol{},\normal{}s\symbol{})) }
345\leftline{343:\ \ \ \ \ \ \ \ \ \ $\{$ }
346\leftline{344:\ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}strcmp\symbol{}(\normal{}s\symbol{},"\normal{}KEYWORDS2\symbol{}")==\normal{}0\symbol{})\  }
347\leftline{345:\ \ \ \ \ \ \ \ \ \ $\{$ }
348\leftline{346:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}printf\symbol{}("\normal{}KEYWORDS2\symbol{}\\normal{}n\symbol{}"); }
349\leftline{347:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}nkey\symbol{}[\normal{}type\symbol{}]=\normal{}i\symbol{};\  }
350\leftline{348:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}type\symbol{}++;\  }
351\leftline{349:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}i\symbol{}=\normal{}0\symbol{};\ \  }
352\leftline{350:\ \ \ \ \ \ \ \ \ \ $\}$ }
353\leftline{351:\ \ \ \ \ \ \ \ \ \ \keya{}else\symbol{} }
354\leftline{352:\ \ \ \ \ \ \ \ \ \ $\{$ }
355\leftline{353:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}printf\symbol{}("\normal{}\%s\symbol{}\\normal{}n\symbol{}",\normal{}s\symbol{});\ \ \ \  }
356\leftline{354:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}key\symbol{}[\normal{}type\symbol{}][\normal{}i\symbol{}]=\keya{}new\symbol{}\ \keya{}char\symbol{}[\normal{}strlen\symbol{}(\normal{}s\symbol{})+\normal{}1\symbol{}]; }
357\leftline{355:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}strcpy\symbol{}(\normal{}key\symbol{}[\normal{}type\symbol{}][\normal{}i\symbol{}],\normal{}s\symbol{}); }
358\leftline{356:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}i\symbol{}++; }
359\leftline{357:\ \ \ \ \ \ \ \ \ \ $\}$ }
360\leftline{358:\ \ \ \ \ \ \ \ \ \ $\}$ }
361\leftline{359:\ \ \  }
362\normal{}\leftline{360:\ \ \ nkey\symbol{}[\normal{}type\symbol{}]=\normal{}i\symbol{};\  }
363\leftline{361:\ \ \  }
364\normal{}\leftline{362:\ \ \ fclose\symbol{}(\normal{}f\symbol{}); }
365\leftline{363:\ \ \  }
366\leftline{364:\ \ \ \  }
367\keya{}\leftline{365:\ \ \ return\symbol{}\ \normal{}1\symbol{}; }
368\leftline{366:\ \ \ $\}$ }
369\leftline{367:\ \ \  }
370\keya{}\leftline{368:\ \ \ int\symbol{}\ \ \ \ \normal{}LexanC\symbol{}::\normal{}open\symbol{}(\keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}filename\symbol{}) }
371\leftline{369:\ \ \ $\{$ }
372\normal{}\leftline{370:\ \ \ file\symbol{}=\normal{}fopen\symbol{}(\normal{}filename\symbol{},"\normal{}rt\symbol{}"); }
373\keya{}\leftline{371:\ \ \ return\symbol{}\ \normal{}file\symbol{}!=\normal{}NULL\symbol{}; }
374\leftline{372:\ \ \ $\}$ }
375\leftline{373:\ \ \  }
376\keya{}\leftline{374:\ \ \ int\symbol{}\ \ \ \ \normal{}LexanC\symbol{}::\normal{}read\symbol{}(\keya{}char\symbol{}\ *\normal{}s\symbol{}) }
377\leftline{375:\ \ \ $\{$ }
378\keya{}\leftline{376:\ \ \ int\symbol{}\ \ \ \ \normal{}i\symbol{}=\normal{}0\symbol{}; }
379\keya{}\leftline{377:\ \ \ int\symbol{}\ \ \ \ \normal{}type\symbol{}=\normal{}EOF\symbol{}; }
380\keya{}\leftline{378:\ \ \ int\symbol{}\ \ \ \ \normal{}wasSlash\symbol{}=\normal{}0\symbol{}; }
381\keya{}\leftline{379:\ \ \ static\symbol{}\ \keya{}int\symbol{}\ \ \ \ \ \normal{}c\symbol{}=-\normal{}2\symbol{}; }
382\leftline{380:\ \ \  }
383\keya{}\leftline{381:\ \ \ if\symbol{}\ (\normal{}c\symbol{}==-\normal{}2\symbol{})\ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}); }
384\leftline{382:\ \ \  }
385\keya{}\leftline{383:\ \ \ if\symbol{}\ (\normal{}c\symbol{}==\normal{}EOF\symbol{})\ \keya{}return\symbol{}\ \normal{}c\symbol{}; }
386\leftline{384:\ \ \  }
387\keya{}\leftline{385:\ \ \ do\symbol{}$\{$ }
388\keya{}\leftline{386:\ \ \ if\symbol{}\ (\normal{}isSeparator\symbol{}(\normal{}c\symbol{}))\ $\{$ }
389\leftline{387:\ \ \ \ \ \ \ \ \ \ \normal{}type\symbol{}=\normal{}SYMBOL\symbol{}; }
390\leftline{388:\ \ \ \ \ \ \ \ \ \ \normal{}s\symbol{}[\normal{}i\symbol{}++]=\normal{}c\symbol{}; }
391\leftline{389:\ \ \  }
392\leftline{390:\ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}(\normal{}wasSlash\symbol{})\ $\{$ }
393\leftline{391:\ \ \ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}(\normal{}c\symbol{}==\normal{}comment_1b\symbol{})\ \ \comment{}//\ line\ comment }
394\symbol{}\leftline{392:\ \ \ \ \ \ \ \ \ \ \ \ \ \ $\{$\  }
395\leftline{393:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}i\symbol{}>\normal{}2\symbol{})\ $\{$\ \normal{}c\symbol{}=\normal{}s\symbol{}[\normal{}i\symbol{}-\normal{}2\symbol{}];\ \normal{}fseek\symbol{}(\normal{}file\symbol{},-\normal{}1\symbol{},\normal{}SEEK_CUR\symbol{});\ \normal{}s\symbol{}[\normal{}i\symbol{}-\normal{}2\symbol{}]=\normal{}0\symbol{};\  }
396\leftline{394:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}return\symbol{}\ \normal{}type\symbol{};\ $\}$ }
397\leftline{395:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}fgets\symbol{}(\normal{}s\symbol{}+\normal{}i\symbol{},\normal{}S_LEN\symbol{},\normal{}file\symbol{});\  }
398\leftline{396:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}); }
399\leftline{397:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}return\symbol{}\ \normal{}COMMENT\symbol{}; }
400\leftline{398:\ \ \ \ \ \ \ \ \ \ \ \ \ \ $\}$ }
401\leftline{399:\ \ \ \ \ \ \ \ \ \ \ \ \keya{}else\symbol{} }
402\leftline{400:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}(\normal{}c\symbol{}==\normal{}comment_2b\symbol{})\ \ \comment{}//\ line\ comment }
403\symbol{}\leftline{401:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\{$\  }
404\leftline{402:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}i\symbol{}>\normal{}2\symbol{})\ $\{$\ \normal{}c\symbol{}=\normal{}s\symbol{}[\normal{}i\symbol{}-\normal{}2\symbol{}];\ \normal{}fseek\symbol{}(\normal{}file\symbol{},-\normal{}1\symbol{},\normal{}SEEK_CUR\symbol{});\ \normal{}s\symbol{}[\normal{}i\symbol{}-\normal{}2\symbol{}]=\normal{}0\symbol{};\  }
405\leftline{403:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}return\symbol{}\ \normal{}type\symbol{};\ $\}$ }
406\leftline{404:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}); }
407\leftline{405:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}(\normal{}c\symbol{}!=\normal{}EOF\symbol{}) }
408\leftline{406:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\{$ }
409\leftline{407:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}s\symbol{}[\normal{}i\symbol{}++]=\normal{}c\symbol{}; }
410\leftline{408:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}int\symbol{}\ \normal{}count\symbol{}=\normal{}1\symbol{}; }
411\leftline{409:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}do\symbol{}$\{$ }
412\leftline{410:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}); }
413\leftline{411:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}(\normal{}c\symbol{}==\normal{}EOF\symbol{})\ \keya{}break\symbol{}; }
414\leftline{412:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}s\symbol{}[\normal{}i\symbol{}++]=\normal{}c\symbol{}; }
415\leftline{413:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}s\symbol{}[\normal{}i\symbol{}-\normal{}2\symbol{}]==\normal{}comment_1e\symbol{}\ \&\&\ \normal{}s\symbol{}[\normal{}i\symbol{}-\normal{}1\symbol{}]==\normal{}comment_2e\symbol{})\ \normal{}count\symbol{}--; }
416\leftline{414:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}s\symbol{}[\normal{}i\symbol{}-\normal{}2\symbol{}]==\normal{}comment_1b\symbol{}\ \&\&\normal{}s\symbol{}[\normal{}i\symbol{}-\normal{}1\symbol{}]==\normal{}comment_2b\symbol{})\ \normal{}count\symbol{}++; }
417\leftline{415:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\}$\ \keya{}while\symbol{}(\normal{}count\symbol{}!=\normal{}0\symbol{}); }
418\leftline{416:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\}$ }
419\leftline{417:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}s\symbol{}[\normal{}i\symbol{}]=\normal{}0\symbol{}; }
420\leftline{418:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}); }
421\leftline{419:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \keya{}return\symbol{}\ \normal{}COMMENT\symbol{}; }
422\leftline{420:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\}$ }
423\leftline{421:\ \ \ \ \ \ \ \ \ \ \ \ \ \ $\}$ }
424\leftline{422:\ \ \ \ \ \ \ \ \ \ \ \ \keya{}else\symbol{} }
425\leftline{423:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \normal{}wasSlash\symbol{}=(\normal{}c\symbol{}==\normal{}comment_1b\symbol{});\  }
426\leftline{424:\ \ \ $\}$\ \keya{}else\symbol{} }
427\leftline{425:\ \ \ \ \ \keya{}if\symbol{}\ (\normal{}c\symbol{}=='')\ $\{$ }
428\leftline{426:\ \ \ \ \ \ \ if\ (i>=1)\ $\{$ }
429\leftline{427:\ \ \ \ \ \ \ \ \ s[i]=0; }
430\leftline{428:\ \ \ \ \ \ \ \ \ return\ type; }
431\leftline{429:\ \ \ \ \ \ \ $\}$ }
432\leftline{430:\ \ \ \ \ \ \ c=fgetc(file); }
433\leftline{431:\ \ \ \ \ \ \ while(c!='\symbol{}')\ $\{$ }
434\leftline{432:\ \ \ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}c\symbol{}==\normal{}EOF\symbol{})\ \keya{}break\symbol{}; }
435\leftline{433:\ \ \ \ \ \ \ \ \ \normal{}s\symbol{}[\normal{}i\symbol{}++]=\normal{}c\symbol{}; }
436\leftline{434:\ \ \ \ \ \ \ \ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}); }
437\leftline{435:\ \ \ \ \ \ \ $\}$ }
438\leftline{436:\ \ \ \ \ \ \ \normal{}s\symbol{}[\normal{}i\symbol{}]=\normal{}0\symbol{}; }
439\leftline{437:\ \ \ \ \ \ \ \normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}); }
440\leftline{438:\ \ \ \ \ \ \ \keya{}return\symbol{}\ \normal{}WORD\symbol{}; }
441\leftline{439:\ \ \ \ \ $\}$\ \keya{}else\symbol{}\ $\{$ }
442\leftline{440:\ \ \ \ \ \ \ \keya{}if\symbol{}\ (\normal{}type\symbol{}==\normal{}EOF\symbol{})\ \normal{}type\symbol{}=\normal{}WORD\symbol{}; }
443\leftline{441:\ \ \ \ \ \ \ \keya{}break\symbol{}; }
444\leftline{442:\ \ \ \ \ $\}$ }
445\leftline{443:\ \ \ $\}$\ \keya{}while\symbol{}((\normal{}c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}))!=\normal{}EOF\symbol{}); }
446\leftline{444:\ \ \ \  }
447\keya{}\leftline{445:\ \ \ if\symbol{}\ (\normal{}c\symbol{}!=\normal{}EOF\symbol{}) }
448\keya{}\leftline{446:\ \ \ if\symbol{}\ (\normal{}type\symbol{}==\normal{}WORD\symbol{}) }
449\leftline{447:\ \ \ $\{$ }
450\keya{}\leftline{448:\ \ \ do\symbol{} }
451\leftline{449:\ \ \ $\{$ }
452\normal{}\leftline{450:\ \ \ s\symbol{}[\normal{}i\symbol{}++]=\normal{}c\symbol{}; }
453\normal{}\leftline{451:\ \ \ c\symbol{}=\normal{}fgetc\symbol{}(\normal{}file\symbol{}); }
454\keya{}\leftline{452:\ \ \ if\symbol{}\ (\normal{}c\symbol{}==\normal{}EOF\symbol{})\ \keya{}break\symbol{}; }
455\leftline{453:\ \ \ $\}$\ \keya{}while\symbol{}(!\normal{}isSeparator\symbol{}(\normal{}c\symbol{})); }
456\leftline{454:\ \ \  }
457\normal{}\leftline{455:\ \ \ s\symbol{}[\normal{}i\symbol{}]=\normal{}0\symbol{}; }
458\keya{}\leftline{456:\ \ \ int\symbol{}\ \normal{}k\symbol{}=\normal{}isKey\symbol{}(\normal{}s\symbol{}); }
459\keya{}\leftline{457:\ \ \ if\symbol{}\ (\normal{}k\symbol{}==\normal{}0\symbol{})\ \keya{}return\symbol{}\ \normal{}NORMAL\symbol{}; }
460\keya{}\leftline{458:\ \ \ return\symbol{}\ \normal{}k\symbol{}; }
461\leftline{459:\ \ \ $\}$ }
462\leftline{460:\ \ \  }
463\normal{}\leftline{461:\ \ \ s\symbol{}[\normal{}i\symbol{}]=\normal{}0\symbol{}; }
464\keya{}\leftline{462:\ \ \ return\symbol{}\ \normal{}type\symbol{}; }
465\leftline{463:\ \ \  }
466\leftline{464:\ \ \ $\}$ }
467\leftline{465:\ \ \  }
468\keya{}\leftline{466:\ \ \ int\symbol{}\ \normal{}TexC\symbol{}::\normal{}init\symbol{}(\keya{}const\symbol{}\ \keya{}char\symbol{}\ *\normal{}filename\symbol{}) }
469\leftline{467:\ \ \ $\{$ }
470\normal{}\leftline{468:\ \ \ file\symbol{}=\normal{}fopen\symbol{}(\normal{}filename\symbol{},"\normal{}wt\symbol{}"); }
471\normal{}\leftline{469:\ \ \ fprintf\symbol{}(\normal{}file\symbol{},"\\\normal{}input\symbol{}\ \normal{}default.mac\symbol{}\\normal{}n\symbol{}"); }
472\keya{}\leftline{470:\ \ \ return\symbol{}\ \normal{}file\symbol{}!=\normal{}NULL\symbol{}; }
473\leftline{471:\ \ \ $\}$ }
474\leftline{472:\ \ \  }
475\leftline{473:\ \ \  }
476\keya{}\leftline{474:\ \ \ void\symbol{}\ \normal{}Help\symbol{}() }
477\leftline{475:\ \ \ $\{$ }
478\leftline{476:\ \ \ \ \ \normal{}printf\symbol{}("\normal{}Syntax\symbol{}\ :\ \normal{}c2tex\symbol{}\ \normal{}in_file\symbol{}\ [\normal{}out_file\symbol{}]\ [-\normal{}usePascal\symbol{}]\ [-\normal{}numbers\symbol{}]\\normal{}n\symbol{}\\normal{}n\symbol{}"); }
479\leftline{477:\ \ \ \ \ \normal{}printf\symbol{}("\normal{}Default\symbol{}\ \normal{}out_file\symbol{}\ \normal{}is\symbol{}\ \normal{}output.tex.\symbol{}\\normal{}n\symbol{}"); }
480\leftline{478:\ \ \ \ \ \normal{}printf\symbol{}("-\normal{}usePascal\symbol{}\ \ \ \ \ \normal{}use\symbol{}\ \normal{}usePascal\symbol{}\ \normal{}comments\symbol{}\ (*\ *)\normal{}.\symbol{}\\normal{}n\symbol{}"); }
481\leftline{479:\ \ \ \ \ \normal{}printf\symbol{}("-\normal{}numbers\symbol{}\ \ \ \ \normal{}print\symbol{}\ \normal{}line\symbol{}\ \normal{}numbers.\symbol{}\\normal{}n\symbol{}"); }
482\leftline{480:\ \ \ \ \ \normal{}exit\symbol{}(\normal{}1\symbol{}); }
483\leftline{481:\ \ \ $\}$ }
484\leftline{482:\ \ \  }
485\keya{}\leftline{483:\ \ \ int\symbol{}\ \normal{}main\symbol{}(\keya{}int\symbol{}\ \normal{}argc\symbol{},\ \keya{}char\symbol{}\ **\normal{}argv\symbol{}) }
486\leftline{484:\ \ \ $\{$ }
487\keya{}\leftline{485:\ \ \ char\symbol{}\ \ \ \normal{}s\symbol{}[\normal{}16384\symbol{}];\ \comment{}//\ docasny\ buffer }
488\symbol{}\leftline{486:\ \ \  }
489\normal{}\leftline{487:\ \ \ OptionsC\symbol{}\ \normal{}options\symbol{}(\normal{}argc\symbol{},\normal{}argv\symbol{}); }
490\leftline{488:\ \ \ \  }
491\leftline{489:\ \ \ \ \keya{}if\symbol{}\ (\normal{}argc\symbol{}<\normal{}2\symbol{})\ \normal{}Help\symbol{}(); }
492\leftline{490:\ \ \ \ \keya{}if\symbol{}\ (\normal{}argc\symbol{}>=\normal{}3\symbol{}\ \&\&\ (*\normal{}argv\symbol{}[\normal{}2\symbol{}]!='-')\ ) }
493\leftline{491:\ \ \ \ \ \ \normal{}strcpy\symbol{}(\normal{}s\symbol{},\normal{}argv\symbol{}[\normal{}2\symbol{}]); }
494\leftline{492:\ \ \ \ \keya{}else\symbol{} }
495\leftline{493:\ \ \ \ \ \ \normal{}strcpy\symbol{}(\normal{}s\symbol{},"\normal{}output.tex\symbol{}"); }
496\leftline{494:\ \ \ \  }
497\leftline{495:\ \ \ \ \keya{}if\symbol{}\ (\normal{}options.isOption\symbol{}("-\normal{}usePascal\symbol{}"))\ $\{$ }
498\leftline{496:\ \ \ \ \ \ \ \normal{}usePascal\symbol{}=\normal{}1\symbol{}; }
499\leftline{497:\ \ \ \ \ \ \ \normal{}comment_1b\symbol{}='('; }
500\leftline{498:\ \ \ \ \ \ \ \normal{}comment_2b\symbol{}='*'; }
501\leftline{499:\ \ \ \ \ \ \ \normal{}comment_1e\symbol{}='*'; }
502\leftline{500:\ \ \ \ \ \ \ \normal{}comment_2e\symbol{}=')'; }
503\leftline{501:\ \ \ \ $\}$ }
504\leftline{502:\ \ \  }
505\leftline{503:\ \ \ \ \keya{}int\symbol{}\ \normal{}numbers\symbol{}; }
506\leftline{504:\ \ \ \  }
507\leftline{505:\ \ \ \ \normal{}numbers\symbol{}\ =\ \normal{}options.isOption\symbol{}("-\normal{}numbers\symbol{}"); }
508\leftline{506:\ \ \ \  }
509\leftline{507:\ \ \ \  }
510\leftline{508:\ \ \ \ \ \normal{}LexanC\symbol{}\ \ \ \ \ \ \ \normal{}lexan\symbol{}; }
511\leftline{509:\ \ \ \ \ \normal{}TexC\symbol{}\ \normal{}tex\symbol{}(\normal{}numbers\symbol{},\ \normal{}s\symbol{}); }
512\leftline{510:\ \ \ \ \ \normal{}lexan.open\symbol{}(\normal{}argv\symbol{}[\normal{}1\symbol{}]); }
513\leftline{511:\ \ \  }
514\leftline{512:\ \ \ \ \ \keya{}int\symbol{}\ \ \normal{}t\symbol{}; }
515\leftline{513:\ \ \ \ \ \normal{}cout\symbol{}<<\normal{}tex.numbers\symbol{}; }
516\leftline{514:\ \ \  }
517\leftline{515:\ \ \ \ \  }
518\leftline{516:\ \ \ \ \ \keya{}while\symbol{}((\normal{}t\symbol{}=\normal{}lexan.read\symbol{}(\normal{}s\symbol{}))!=\normal{}EOF\symbol{}) }
519\leftline{517:\ \ \ \ \ \ \ $\{$ }
520\leftline{518:\ \ \ \ \ \ \ \ \ \comment{}//printf("Type\ :\ \%d\ -\ \%s\n",t,s); }
521\symbol{}\leftline{519:\ \ \ \ \ \ \ \ \ \normal{}printf\symbol{}("\normal{}\%s\symbol{}",\normal{}s\symbol{}); }
522\leftline{520:\ \ \ \ \ \ \ \ \ \normal{}tex.write\symbol{}(\normal{}t\symbol{},\normal{}s\symbol{}); }
523\leftline{521:\ \ \ \ \ \ \ \ \ \comment{}//getchar(); }
524\symbol{}\leftline{522:\ \ \ \ \ \ \ $\}$ }
525\leftline{523:\ \ \  }
526\keya{}\leftline{524:\ \ \ return\symbol{}\ \normal{}0\symbol{}; }
527\leftline{525:\ \ \ $\}$ }
528\leftline{526:\ \ \  }
529\leftline{527:\ \ \  }
530\leftline{528:\ \ \  }
531\leftline{529:\ \ \  }
532\leftline{530:\ \ \  }
Note: See TracBrowser for help on using the repository browser.