GDB (xrefs)
Classes | Functions
/home/stan/gdb/src/gdb/macroexp.c File Reference
#include "defs.h"
#include "gdb_obstack.h"
#include "bcache.h"
#include "macrotab.h"
#include "macroexp.h"
#include "gdb_assert.h"
#include "c-lang.h"

Go to the source code of this file.

Classes

struct  macro_buffer
struct  macro_name_list

Functions

static void init_buffer (struct macro_buffer *b, int n)
static void init_shared_buffer (struct macro_buffer *buf, char *addr, int len)
static void free_buffer (struct macro_buffer *b)
static char * free_buffer_return_text (struct macro_buffer *b)
static void cleanup_macro_buffer (void *untyped_buf)
static void resize_buffer (struct macro_buffer *b, int n)
static void appendc (struct macro_buffer *b, int c)
static void appendmem (struct macro_buffer *b, char *addr, int len)
int macro_is_whitespace (int c)
int macro_is_digit (int c)
int macro_is_identifier_nondigit (int c)
static void set_token (struct macro_buffer *tok, char *start, char *end)
static int get_comment (struct macro_buffer *tok, char *p, char *end)
static int get_identifier (struct macro_buffer *tok, char *p, char *end)
static int get_pp_number (struct macro_buffer *tok, char *p, char *end)
static int get_character_constant (struct macro_buffer *tok, char *p, char *end)
static int get_string_literal (struct macro_buffer *tok, char *p, char *end)
static int get_punctuator (struct macro_buffer *tok, char *p, char *end)
static int get_token (struct macro_buffer *tok, struct macro_buffer *src)
static void append_tokens_without_splicing (struct macro_buffer *dest, struct macro_buffer *src)
static void stringify (struct macro_buffer *dest, const char *arg, int len)
char * macro_stringify (const char *str)
static int currently_rescanning (struct macro_name_list *list, const char *name)
static struct macro_buffergather_arguments (const char *name, struct macro_buffer *src, int nargs, int *argc_p)
static void scan (struct macro_buffer *dest, struct macro_buffer *src, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton)
static int find_parameter (const struct macro_buffer *tok, int is_varargs, const struct macro_buffer *va_arg_name, int argc, const char *const *argv)
static void substitute_args (struct macro_buffer *dest, struct macro_definition *def, int is_varargs, const struct macro_buffer *va_arg_name, int argc, struct macro_buffer *argv, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton)
static int expand (const char *id, struct macro_definition *def, struct macro_buffer *dest, struct macro_buffer *src, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton)
static int maybe_expand (struct macro_buffer *dest, struct macro_buffer *src_first, struct macro_buffer *src_rest, struct macro_name_list *no_loop, macro_lookup_ftype *lookup_func, void *lookup_baton)
char * macro_expand (const char *source, macro_lookup_ftype *lookup_func, void *lookup_func_baton)
char * macro_expand_once (const char *source, macro_lookup_ftype *lookup_func, void *lookup_func_baton)
char * macro_expand_next (const char **lexptr, macro_lookup_ftype *lookup_func, void *lookup_baton)

Function Documentation

static void append_tokens_without_splicing ( struct macro_buffer dest,
struct macro_buffer src 
) [static]
static void appendc ( struct macro_buffer b,
int  c 
) [static]
static void appendmem ( struct macro_buffer b,
char *  addr,
int  len 
) [static]
static void cleanup_macro_buffer ( void *  untyped_buf) [static]

Definition at line 130 of file macroexp.c.

References free_buffer().

Referenced by expand(), macro_expand(), and macro_expand_next().

static int currently_rescanning ( struct macro_name_list list,
const char *  name 
) [static]

Definition at line 738 of file macroexp.c.

References macro_name_list::name, and macro_name_list::next.

Referenced by maybe_expand().

static int expand ( const char *  id,
struct macro_definition def,
struct macro_buffer dest,
struct macro_buffer src,
struct macro_name_list no_loop,
macro_lookup_ftype lookup_func,
void *  lookup_baton 
) [static]
static int find_parameter ( const struct macro_buffer tok,
int  is_varargs,
const struct macro_buffer va_arg_name,
int  argc,
const char *const argv 
) [static]

Definition at line 924 of file macroexp.c.

References macro_buffer::is_identifier, macro_buffer::len, memcmp(), and macro_buffer::text.

Referenced by substitute_args().

static void free_buffer ( struct macro_buffer b) [static]

Definition at line 109 of file macroexp.c.

References gdb_assert, macro_buffer::shared, macro_buffer::size, macro_buffer::text, and xfree().

Referenced by cleanup_macro_buffer().

static char* free_buffer_return_text ( struct macro_buffer b) [static]

Definition at line 120 of file macroexp.c.

References gdb_assert, macro_buffer::shared, macro_buffer::size, and macro_buffer::text.

Referenced by macro_stringify().

static struct macro_buffer* gather_arguments ( const char *  name,
struct macro_buffer src,
int  nargs,
int argc_p 
) [static, read]
static int get_character_constant ( struct macro_buffer tok,
char *  p,
char *  end 
) [static]

Definition at line 328 of file macroexp.c.

References _, c_parse_escape(), error(), gdb_assert_not_reached, and set_token().

Referenced by get_token().

static int get_comment ( struct macro_buffer tok,
char *  p,
char *  end 
) [static]

Definition at line 225 of file macroexp.c.

References _, error(), and set_token().

Referenced by get_token().

static int get_identifier ( struct macro_buffer tok,
char *  p,
char *  end 
) [static]
static int get_pp_number ( struct macro_buffer tok,
char *  p,
char *  end 
) [static]

Definition at line 289 of file macroexp.c.

References macro_is_digit(), macro_is_identifier_nondigit(), set_token(), and strchr().

Referenced by get_token().

static int get_punctuator ( struct macro_buffer tok,
char *  p,
char *  end 
) [static]

Definition at line 439 of file macroexp.c.

References len, memcmp(), and set_token().

Referenced by get_token().

static int get_string_literal ( struct macro_buffer tok,
char *  p,
char *  end 
) [static]

Definition at line 389 of file macroexp.c.

References _, c_parse_escape(), error(), gdb_assert_not_reached, and set_token().

Referenced by get_token().

static int get_token ( struct macro_buffer tok,
struct macro_buffer src 
) [static]
static void init_buffer ( struct macro_buffer b,
int  n 
) [static]
static void init_shared_buffer ( struct macro_buffer buf,
char *  addr,
int  len 
) [static]
char* macro_expand ( const char *  source,
macro_lookup_ftype lookup_func,
void *  lookup_func_baton 
)
char* macro_expand_next ( const char **  lexptr,
macro_lookup_ftype lookup_func,
void *  lookup_baton 
)
char* macro_expand_once ( const char *  source,
macro_lookup_ftype lookup_func,
void *  lookup_func_baton 
)

Definition at line 1434 of file macroexp.c.

References _, and error().

Referenced by macro_expand_once_command().

Definition at line 198 of file macroexp.c.

Referenced by extract_identifier(), get_identifier(), and get_pp_number().

Definition at line 205 of file macroexp.c.

Referenced by extract_identifier(), get_identifier(), and get_pp_number().

Definition at line 187 of file macroexp.c.

Referenced by get_token(), skip_ws(), and stringify().

char* macro_stringify ( const char *  str)

Definition at line 703 of file macroexp.c.

References appendc(), free_buffer_return_text(), init_buffer(), len, and stringify().

Referenced by fixup_definition().

static int maybe_expand ( struct macro_buffer dest,
struct macro_buffer src_first,
struct macro_buffer src_rest,
struct macro_name_list no_loop,
macro_lookup_ftype lookup_func,
void *  lookup_baton 
) [static]
static void resize_buffer ( struct macro_buffer b,
int  n 
) [static]

Definition at line 139 of file macroexp.c.

References gdb_assert, macro_buffer::shared, macro_buffer::size, macro_buffer::text, and xrealloc().

Referenced by appendc(), and appendmem().

static void scan ( struct macro_buffer dest,
struct macro_buffer src,
struct macro_name_list no_loop,
macro_lookup_ftype lookup_func,
void *  lookup_baton 
) [static]
static void set_token ( struct macro_buffer tok,
char *  start,
char *  end 
) [static]
static void stringify ( struct macro_buffer dest,
const char *  arg,
int  len 
) [static]
static void substitute_args ( struct macro_buffer dest,
struct macro_definition def,
int  is_varargs,
const struct macro_buffer va_arg_name,
int  argc,
struct macro_buffer argv,
struct macro_name_list no_loop,
macro_lookup_ftype lookup_func,
void *  lookup_baton 
) [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines