#include "macro.h"
#include "options.h"
#include "output.h"
#include "cqp.h"
#include "hash.h"
#include "eval.h"
#include "ranges.h"
#include "targets.h"
#include "corpmanag.h"
#include "parser.tab.h"
#include "../cl/macros.h"
#include <assert.h>
#include <strings.h>
#include <string.h>
#define MACRO_HASH_BUCKETS 8000 |
Referenced by init_macros().
typedef struct _InputBuffer * InputBuffer |
typedef struct _MacroEntry * MacroEntry |
typedef struct _MacroHashTable * MacroHashTable |
typedef struct _MacroSegment * MacroSegment |
int define_macro | ( | char * | name, | |
int | args, | |||
char * | argstr, | |||
char * | definition | |||
) |
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 | ) |
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 | ) |
References cqpmessage(), define_macro(), Error, MACRO_HASH_BUCKETS, and MakeMacroHash().
Referenced by initialize_cqp().
void list_macros | ( | char * | prefix | ) |
static int list_macros_sort | ( | const void * | p1, | |
const void * | p2 | |||
) | [static] |
Referenced by list_macros().
void load_macro_file | ( | char * | filename | ) |
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_debug_newline_indent | ( | void | ) |
References buf, and _InputBuffer::next.
Referenced by expand_macro(), and yy_input_char().
void macro_iterator_new | ( | void | ) |
References iterator_bucket.
char* macro_iterator_next | ( | char * | prefix, | |
int * | nargs | |||
) |
References _MacroEntry::args, macro_iterator_next_macro(), and _MacroEntry::name.
MacroEntry macro_iterator_next_macro | ( | char * | prefix | ) |
References enable_macros, _MacroHashTable::hash, iterator_bucket, _MacroEntry::name, _MacroEntry::next, and _MacroHashTable::size.
Referenced by macro_iterator_next(), and macro_iterator_next_prototype().
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 | ) |
References _MacroHashTable::hash, _MacroEntry::next, and _MacroHashTable::size.
Referenced by main().
MacroSegment MacroAddSegment | ( | MacroEntry | macro | ) |
References _MacroSegment::arg, cl_malloc(), _MacroSegment::next, _MacroEntry::replacement, and _MacroSegment::string.
Referenced by define_macro().
MacroEntry MacroHashAdd | ( | char * | str, | |
int | args | |||
) |
References _MacroEntry::active, _MacroEntry::argnames, _MacroEntry::args, cl_malloc(), cl_strdup(), cqpmessage(), Error, _MacroHashTable::hash, hash_macro(), _MacroEntry::name, _MacroEntry::next, _MacroEntry::replacement, and _MacroHashTable::size.
Referenced by define_macro().
void MacroHashDelete | ( | MacroEntry | macro | ) |
MacroEntry MacroHashLookup | ( | char * | str, | |
int | args | |||
) |
References _MacroEntry::args, cqpmessage(), Error, _MacroHashTable::hash, hash_macro(), _MacroEntry::name, _MacroEntry::next, and _MacroHashTable::size.
Referenced by define_macro(), expand_macro(), and print_macro_definition().
void MakeMacroHash | ( | int | size | ) |
References bytes, cl_malloc(), find_prime(), _MacroHashTable::hash, and _MacroHashTable::size.
Referenced by init_macros().
char* parse_macro_name | ( | char * | text, | |
int * | nr_of_args, | |||
char ** | prototype | |||
) |
References cl_malloc().
Referenced by load_macro_file().
void PopInputBuffer | ( | void | ) |
References _MacroEntry::active, _InputBuffer::data, _InputBuffer::macro, and _InputBuffer::next.
Referenced by delete_macro_buffers(), and yy_input_char().
char* preprocess_input_line | ( | char * | line | ) |
Referenced by load_macro_file().
void print_macro_definition | ( | char * | name, | |
int | args | |||
) |
InputBuffer PushInputBuffer | ( | int | size | ) |
References cl_malloc(), _InputBuffer::data, _InputBuffer::macro, _InputBuffer::next, and _InputBuffer::position.
Referenced by expand_macro().
int yy_input_char | ( | void | ) |
References buf, cqp_input_string, cqp_input_string_position, cqpmessage(), _InputBuffer::data, 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 | ) |
int yylex | ( | void | ) |
Referenced by expand_macro().
InputBuffer InputBufferList = NULL |
int iterator_bucket = -1 |
Referenced by macro_iterator_new(), and macro_iterator_next_macro().
MacroEntry iterator_entry = NULL |
char* macro_arg[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} |
Referenced by expand_macro().
MacroHashTable MacroHash = NULL |
unsigned int pseudo_arg_counter = 0 |
Referenced by expand_macro().
FILE* yyin |
char* yytext |
Referenced by expand_macro().