blob: f8828afea90f8c15c511ba2eaa29f799f5a01a07 [file] [log] [blame]
Mark Sleee9ce01c2007-05-16 02:29:53 +00001// 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 Slee31985722006-05-24 21:45:31 +00007#ifndef T_MAIN_H
8#define T_MAIN_H
9
Mark Sleef0712dc2006-10-25 19:03:57 +000010#include <string>
Mark Slee30152872006-11-28 01:24:07 +000011#include "parse/t_const.h"
Mark Slee7ff32452007-02-01 05:26:18 +000012#include "parse/t_field.h"
Mark Sleef0712dc2006-10-25 19:03:57 +000013
Mark Sleef5377b32006-10-10 01:42:59 +000014/**
15 * Defined in the flex library
16 */
Mark Slee31985722006-05-24 21:45:31 +000017
Mark Sleef0712dc2006-10-25 19:03:57 +000018int yylex(void);
19
20int yyparse(void);
Mark Slee31985722006-05-24 21:45:31 +000021
Mark Sleef5377b32006-10-10 01:42:59 +000022/**
23 * Expected to be defined by Flex/Bison
24 */
Mark Sleef0712dc2006-10-25 19:03:57 +000025void yyerror(char* fmt, ...);
Mark Slee31985722006-05-24 21:45:31 +000026
Mark Sleef5377b32006-10-10 01:42:59 +000027/**
Mark Sleef0712dc2006-10-25 19:03:57 +000028 * Parse debugging output, used to print helpful info
Mark Sleef5377b32006-10-10 01:42:59 +000029 */
Mark Sleef0712dc2006-10-25 19:03:57 +000030void pdebug(char* fmt, ...);
31
32/**
33 * Parser warning
34 */
35void pwarning(int level, char* fmt, ...);
36
37/**
38 * Failure!
39 */
Mark Slee30152872006-11-28 01:24:07 +000040void failure(const char* fmt, ...);
41
42/**
43 * Check constant types
44 */
45void validate_const_type(t_const* c);
Mark Sleef0712dc2006-10-25 19:03:57 +000046
47/**
Mark Slee7ff32452007-02-01 05:26:18 +000048 * Check constant types
49 */
50void validate_field_value(t_field* field, t_const_value* cv);
51
52/**
Mark Sleef0712dc2006-10-25 19:03:57 +000053 * Converts a string filename into a thrift program name
54 */
55std::string program_name(std::string filename);
56
57/**
58 * Gets the directory path of a filename
59 */
60std::string directory_name(std::string filename);
61
62/**
63 * Get the absolute path for an include file
64 */
65std::string include_file(std::string filename);
Mark Sleef5377b32006-10-10 01:42:59 +000066
67/**
David Reisscbd4bac2007-08-14 17:12:33 +000068 * Clears any previously stored doctext string.
69 */
70void clear_doctext();
71
72/**
David Reiss1ac05802007-07-30 22:00:27 +000073 * Cleans up text commonly found in doxygen-like comments
74 */
75char* clean_up_doctext(char* doctext);
76
77/**
Mark Sleef5377b32006-10-10 01:42:59 +000078 * Flex utilities
79 */
80
Mark Slee31985722006-05-24 21:45:31 +000081extern int yylineno;
82extern char yytext[];
83extern FILE* yyin;
84
85#endif