CWB
|
#define MACRO_FILE_MAX_LINE_LENGTH CL_MAX_LINE_LENGTH |
The maximum length of a line in a macro definition file.
As of 3.2.x, this has been modified to be the same as CL_MAX_LINE_LENGTH (for sake of simplicity).
Referenced by load_macro_file().
int define_macro | ( | char * | name, |
int | args, | ||
char * | argstr, | ||
char * | definition | ||
) |
define a new macro: name = macro name args = # of arguments (0 .
. 9); alternatively, specify: argstr = macro argument string (e.g. ``$0=name $1=label'') definition = macro definition ... this string is substituted for /<name>(...) $0 .. $9 refer to the macro's arguments and CAN NOT be escaped returns 1 if macro definition was successful, 0 on syntax error
References _MacroSegment::arg, _MacroEntry::argnames, cl_malloc(), cqpmessage(), Error, MacroAddSegment(), MacroHashAdd(), MacroHashDelete(), MacroHashLookup(), silent, and _MacroSegment::string.
Referenced by init_macros(), and load_macro_file().
int delete_macro_buffers | ( | int | trace | ) |
delete active input buffers
References _MacroEntry::args, _InputBuffer::data, _InputBuffer::macro, _MacroEntry::name, PopInputBuffer(), and _InputBuffer::position.
int expand_macro | ( | char * | name | ) |
expand macro <name>:
References _MacroEntry::active, _MacroSegment::arg, buf, cl_free, cl_strdup(), cqpmessage(), _InputBuffer::data, Error, _InputBuffer::macro, macro_arg, macro_debug, macro_debug_newline_indent(), MacroHashLookup(), _MacroSegment::next, pseudo_arg_counter, PushInputBuffer(), _MacroEntry::replacement, _MacroSegment::string, yylex(), and yytext.
void init_macros | ( | void | ) |
Initialises the macro hash and defines built-in macros.
References cqpmessage(), define_macro(), Error, MACRO_HASH_BUCKETS, and MakeMacroHash().
Referenced by initialize_cqp().
void list_macros | ( | char * | prefix | ) |
list all defined macros on stdout
References _MacroEntry::args, cl_malloc(), enable_macros, end_indented_list(), _MacroHashTable::hash, list_macros_sort(), _MacroEntry::name, _MacroEntry::next, pretty_print, print_indented_list_br(), print_indented_list_item(), _MacroHashTable::size, and start_indented_list().
void load_macro_file | ( | char * | name | ) |
References cl_free, cl_realloc(), cl_strdup(), cqpmessage(), define_macro(), Error, input_line, line, load_macro_file(), MACRO_FILE_MAX_LINE_LENGTH, parse_macro_name(), and preprocess_input_line().
Referenced by load_macro_file().
void macro_iterator_new | ( | void | ) |
Resets the module-global iterator_bucket and iterator_entry variables.
References iterator_bucket.
char* macro_iterator_next | ( | char * | prefix, |
int * | nargs | ||
) |
References _MacroEntry::args, macro_iterator_next_macro(), and _MacroEntry::name.
char* macro_iterator_next_prototype | ( | char * | prefix | ) |
References _MacroEntry::argnames, _MacroEntry::args, cl_malloc(), macro_iterator_next_macro(), and _MacroEntry::name.
void macro_statistics | ( | void | ) |
Prints macro hash statistics on stderr.
References _MacroHashTable::hash, _MacroEntry::next, and _MacroHashTable::size.
Referenced by main().
void print_macro_definition | ( | char * | name, |
int | args | ||
) |
print definition of macro on stdout
References _MacroSegment::arg, _MacroEntry::argnames, cqpmessage(), enable_macros, Error, MacroHashLookup(), _MacroSegment::next, _MacroEntry::replacement, and _MacroSegment::string.
int yy_input_char | ( | void | ) |
Get a character for the lexer/parser.
This function reads one character (byte) of input from InputBufferList[top], ... , InputBufferList[bottom], cqp_input_string, yyin in that order of precedence.
It adds the character to query buffer, and returns it.
Used by the lexer to get its characters; see parser.l where YY_INPUT() is redefined to a macro calling this function. (Not clear why it's in macro.c when it is not specific to just macros.)
References buf, cqp_input_string, cqp_input_string_position, cqpmessage(), _InputBuffer::data, InputBufferList, macro_debug, macro_debug_newline_indent(), PopInputBuffer(), _InputBuffer::position, QUERY_BUFFER_SIZE, QueryBuffer, QueryBufferOverflow, QueryBufferP, reading_cqprc, Warning, write_history_file, yy_input_char(), and yyin.
Referenced by yy_input_char().
int yy_input_from_macro | ( | void | ) |
checks if input is being read from macro expansion