Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 1 | #ifndef T_MAIN_H |
| 2 | #define T_MAIN_H |
| 3 | |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 4 | #include <string> |
Mark Slee | 3015287 | 2006-11-28 01:24:07 +0000 | [diff] [blame] | 5 | #include "parse/t_const.h" |
Mark Slee | 7ff3245 | 2007-02-01 05:26:18 +0000 | [diff] [blame] | 6 | #include "parse/t_field.h" |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 7 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 8 | /** |
| 9 | * Defined in the flex library |
| 10 | */ |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 11 | |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 12 | int yylex(void); |
| 13 | |
| 14 | int yyparse(void); |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 15 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 16 | /** |
| 17 | * Expected to be defined by Flex/Bison |
| 18 | */ |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 19 | void yyerror(char* fmt, ...); |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 20 | |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 21 | /** |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 22 | * Parse debugging output, used to print helpful info |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 23 | */ |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 24 | void pdebug(char* fmt, ...); |
| 25 | |
| 26 | /** |
| 27 | * Parser warning |
| 28 | */ |
| 29 | void pwarning(int level, char* fmt, ...); |
| 30 | |
| 31 | /** |
| 32 | * Failure! |
| 33 | */ |
Mark Slee | 3015287 | 2006-11-28 01:24:07 +0000 | [diff] [blame] | 34 | void failure(const char* fmt, ...); |
| 35 | |
| 36 | /** |
| 37 | * Check constant types |
| 38 | */ |
| 39 | void validate_const_type(t_const* c); |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 40 | |
| 41 | /** |
Mark Slee | 7ff3245 | 2007-02-01 05:26:18 +0000 | [diff] [blame] | 42 | * Check constant types |
| 43 | */ |
| 44 | void validate_field_value(t_field* field, t_const_value* cv); |
| 45 | |
| 46 | /** |
Mark Slee | f0712dc | 2006-10-25 19:03:57 +0000 | [diff] [blame] | 47 | * Converts a string filename into a thrift program name |
| 48 | */ |
| 49 | std::string program_name(std::string filename); |
| 50 | |
| 51 | /** |
| 52 | * Gets the directory path of a filename |
| 53 | */ |
| 54 | std::string directory_name(std::string filename); |
| 55 | |
| 56 | /** |
| 57 | * Get the absolute path for an include file |
| 58 | */ |
| 59 | std::string include_file(std::string filename); |
Mark Slee | f5377b3 | 2006-10-10 01:42:59 +0000 | [diff] [blame] | 60 | |
| 61 | /** |
| 62 | * Flex utilities |
| 63 | */ |
| 64 | |
Mark Slee | 3198572 | 2006-05-24 21:45:31 +0000 | [diff] [blame] | 65 | extern int yylineno; |
| 66 | extern char yytext[]; |
| 67 | extern FILE* yyin; |
| 68 | |
| 69 | #endif |