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