CWB
Defines | Functions

macro.h File Reference

Defines

Functions


Define Documentation

#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().


Function Documentation

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)
int expand_macro ( char *  name)
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)
void load_macro_file ( char *  name)
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 
)
char* macro_iterator_next_prototype ( char *  prefix)
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 
)
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