Exemple #1
0
/*-----------------------------------------------------------------------------
*   create a new symbol, needs to be deleted by OBJ_DELETE()
*	adds a reference to the page were referred to
*----------------------------------------------------------------------------*/
Symbol *Symbol_create(const char *name, long value, sym_type_t type, sym_scope_t scope,
					   Module *module, Section *section )
{
    Symbol *self 	= OBJ_NEW( Symbol );

	self->name = spool_add(name);			/* name in strpool, not freed */
	self->value = value;
	self->type = type;
	self->scope = scope;
	self->module = module;
	self->section = section;
	self->filename = get_error_file();
	self->line_nr = get_error_line();

    return self;              						/* pointer to new symbol */
}
Exemple #2
0
/*-----------------------------------------------------------------------------
*   IF, IFDEF, IFNDEF, ELSE, ENDIF
*----------------------------------------------------------------------------*/
static void start_struct(ParseCtx *ctx, tokid_t open_tok, Bool condition)
{
	OpenStruct *parent_os, os;

	os.open_tok = open_tok;
	os.filename = get_error_file();
	os.line_nr = get_error_line();
	os.active = condition;

	parent_os = (OpenStruct *)utarray_back(ctx->open_structs);
	if (parent_os)
		os.parent_active = parent_os->active && parent_os->parent_active;
	else
		os.parent_active = TRUE;

	utarray_push_back(ctx->open_structs, &os);
}