diff -r fd35f6cb5f28 -r 0a9a5902beaa common.h --- a/common.h Tue Jul 17 20:35:43 2012 +0300 +++ b/common.h Sat Jul 28 17:41:24 2012 +0300 @@ -47,6 +47,7 @@ #include "bots.h" #include "str.h" +// Application name and version #define APPNAME "botc" #define VERSION_MAJOR 0 #define VERSION_MINOR 0 @@ -57,10 +58,10 @@ #define FILE_CASEINSENSITIVE #endif -// Where is the parser at? +// Parser mode: where is the parser at? enum parsermode { MODE_TOPLEVEL, // at top level - MODE_EVENT, // inside event definition + MODE_EVENT, // inside event definition MODE_MAINLOOP, // inside mainloop MODE_ONENTER, // inside onenter MODE_ONEXIT, // inside onexit @@ -72,18 +73,21 @@ exit (1); \ } +// Shortcut for formatting #define PERFORM_FORMAT(in, out) \ va_list v; \ va_start (v, in); \ char* out = vdynformat (in, v, 256); \ va_end (v); +// Plural expression #define PLURAL(n) (n != 1) ? "s" : "" void error (const char* text, ...); char* ObjectFileName (str s); bool fexists (char* path); +// Make the parser's variables globally available #ifndef __PARSER_CXX__ extern int g_NumStates; extern int g_NumEvents; @@ -92,7 +96,7 @@ #endif // Power function -template T pow (T a, T b) { +template T pow (T a, int b) { if (!b) return 1; @@ -112,4 +116,7 @@ return (c <= 32 || c == 127 || c == 255); } +// Byte datatype +typedef unsigned long int byte; + #endif // __COMMON_H__ \ No newline at end of file