blob: 470ac7ff862e3847604123c2466e1669e1480f3e [file] [log] [blame]
Mark Slee31985722006-05-24 21:45:31 +00001#ifndef T_MAIN_H
2#define T_MAIN_H
3
Mark Sleef0712dc2006-10-25 19:03:57 +00004#include <string>
Mark Slee30152872006-11-28 01:24:07 +00005#include "parse/t_const.h"
Mark Slee7ff32452007-02-01 05:26:18 +00006#include "parse/t_field.h"
Mark Sleef0712dc2006-10-25 19:03:57 +00007
Mark Sleef5377b32006-10-10 01:42:59 +00008/**
9 * Defined in the flex library
10 */
Mark Slee31985722006-05-24 21:45:31 +000011
Mark Sleef0712dc2006-10-25 19:03:57 +000012int yylex(void);
13
14int yyparse(void);
Mark Slee31985722006-05-24 21:45:31 +000015
Mark Sleef5377b32006-10-10 01:42:59 +000016/**
17 * Expected to be defined by Flex/Bison
18 */
Mark Sleef0712dc2006-10-25 19:03:57 +000019void yyerror(char* fmt, ...);
Mark Slee31985722006-05-24 21:45:31 +000020
Mark Sleef5377b32006-10-10 01:42:59 +000021/**
Mark Sleef0712dc2006-10-25 19:03:57 +000022 * Parse debugging output, used to print helpful info
Mark Sleef5377b32006-10-10 01:42:59 +000023 */
Mark Sleef0712dc2006-10-25 19:03:57 +000024void pdebug(char* fmt, ...);
25
26/**
27 * Parser warning
28 */
29void pwarning(int level, char* fmt, ...);
30
31/**
32 * Failure!
33 */
Mark Slee30152872006-11-28 01:24:07 +000034void failure(const char* fmt, ...);
35
36/**
37 * Check constant types
38 */
39void validate_const_type(t_const* c);
Mark Sleef0712dc2006-10-25 19:03:57 +000040
41/**
Mark Slee7ff32452007-02-01 05:26:18 +000042 * Check constant types
43 */
44void validate_field_value(t_field* field, t_const_value* cv);
45
46/**
Mark Sleef0712dc2006-10-25 19:03:57 +000047 * Converts a string filename into a thrift program name
48 */
49std::string program_name(std::string filename);
50
51/**
52 * Gets the directory path of a filename
53 */
54std::string directory_name(std::string filename);
55
56/**
57 * Get the absolute path for an include file
58 */
59std::string include_file(std::string filename);
Mark Sleef5377b32006-10-10 01:42:59 +000060
61/**
62 * Flex utilities
63 */
64
Mark Slee31985722006-05-24 21:45:31 +000065extern int yylineno;
66extern char yytext[];
67extern FILE* yyin;
68
69#endif