88 int g_NextMark = 0; |
88 int g_NextMark = 0; |
89 |
89 |
90 int main (int argc, char** argv) { |
90 int main (int argc, char** argv) { |
91 // Intepret command-line parameters: |
91 // Intepret command-line parameters: |
92 // -l: list commands |
92 // -l: list commands |
|
93 // I guess there should be a better way to do this. |
93 if (argc == 2 && !strcmp (argv[1], "-l")) { |
94 if (argc == 2 && !strcmp (argv[1], "-l")) { |
94 ReadCommands (); |
95 ReadCommands (); |
95 printf ("Begin list of commands:\n"); |
96 printf ("Begin list of commands:\n"); |
96 printf ("------------------------------------------------------\n"); |
97 printf ("------------------------------------------------------\n"); |
97 |
98 |
111 |
112 |
112 // Include revision if non-zero |
113 // Include revision if non-zero |
113 if (VERSION_REVISION) |
114 if (VERSION_REVISION) |
114 header.appendformat (".%d", VERSION_REVISION); |
115 header.appendformat (".%d", VERSION_REVISION); |
115 |
116 |
116 headerline.repeat ((header.len()/2)-1); |
117 headerline *= (header.len() / 2) - 1; |
117 headerline += '-'; |
118 headerline += '-'; |
118 printf ("%s\n%s\n", header.chars(), headerline.chars()); |
119 printf ("%s\n%s\n", header.chars(), headerline.chars()); |
119 |
120 |
120 if (argc < 2) { |
121 if (argc < 2) { |
121 fprintf (stderr, "usage: %s <infile> [outfile] # compiles botscript\n", argv[0]); |
122 fprintf (stderr, "usage: %s <infile> [outfile] # compiles botscript\n", argv[0]); |
225 // Mutates given filename to an object filename |
226 // Mutates given filename to an object filename |
226 char* ObjectFileName (str s) { |
227 char* ObjectFileName (str s) { |
227 // Locate the extension and chop it out |
228 // Locate the extension and chop it out |
228 unsigned int extdot = s.last ("."); |
229 unsigned int extdot = s.last ("."); |
229 if (extdot >= s.len()-4) |
230 if (extdot >= s.len()-4) |
230 s.trim (s.len() - extdot); |
231 s -= (s.len() - extdot); |
231 |
232 |
232 s += ".o"; |
233 s += ".o"; |
233 return s.chars(); |
234 return s.chars(); |
234 } |
235 } |
235 |
236 |