Skip to content

Commit

Permalink
Merge pull request #4832 from ibuclaw/symbols
Browse files Browse the repository at this point in the history
Remove Symbols_create, and Symbols typedef from arraytypes.h
  • Loading branch information
yebblies committed Jul 26, 2015
2 parents e30c4a1 + 25194e6 commit 494a91d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/arraytypes.h
Expand Up @@ -70,6 +70,4 @@ typedef Array<class TemplateInstance *> TemplateInstances;

typedef Array<struct block *> Blocks;

typedef Array<struct Symbol *> Symbols;

#endif
4 changes: 1 addition & 3 deletions src/magicport.json
Expand Up @@ -1024,8 +1024,7 @@
"typedef ReturnStatements",
"typedef GotoStatements",
"typedef TemplateInstances",
"typedef Blocks",
"typedef Symbols"
"typedef Blocks"
]
},
{
Expand Down Expand Up @@ -2594,7 +2593,6 @@
"function parse_arch_arg",
"function parse_conf_arg",
"function Dsymbols_create",
"function Symbols_create",
"function VarDeclarations_create",
"function Blocks_create",
"function Expressions_create"
Expand Down
1 change: 0 additions & 1 deletion src/mars.c
Expand Up @@ -1913,7 +1913,6 @@ static const char* parse_conf_arg(Strings *args)
}

Dsymbols *Dsymbols_create() { return new Dsymbols(); }
Symbols *Symbols_create() { return new Symbols(); }
VarDeclarations *VarDeclarations_create() { return new VarDeclarations(); }
Blocks *Blocks_create() { return new Blocks(); }
Expressions *Expressions_create() { return new Expressions(); }
13 changes: 6 additions & 7 deletions src/tocsym.c
Expand Up @@ -43,11 +43,12 @@
#include "outbuf.h"
#include "irstate.h"

typedef Array<struct Symbol *> Symbols;

void slist_add(Symbol *s);
void slist_reset();

Classsym *fake_classsym(Identifier *id);
Symbols *Symbols_create();
type *Type_toCtype(Type *t);
dt_t **ClassReferenceExp_toInstanceDt(ClassReferenceExp *ce, dt_t **pdt);
dt_t **Expression_toDt(Expression *e, dt_t **pdt);
Expand Down Expand Up @@ -649,18 +650,16 @@ Symbol *aaGetSymbol(TypeAArray *taa, const char *func, int flags)
#endif

// Dumb linear symbol table - should use associative array!
static Symbols *sarray = NULL;
static Symbols sarray;

//printf("aaGetSymbol(func = '%s', flags = %d, key = %p)\n", func, flags, key);
char *id = (char *)alloca(3 + strlen(func) + 1);
sprintf(id, "_aa%s", func);
if (!sarray)
sarray = Symbols_create();

// See if symbol is already in sarray
for (size_t i = 0; i < sarray->dim; i++)
for (size_t i = 0; i < sarray.dim; i++)
{
Symbol *s = (*sarray)[i];
Symbol *s = sarray[i];
if (strcmp(id, s->Sident) == 0)
{
#ifdef DEBUG
Expand All @@ -682,7 +681,7 @@ Symbol *aaGetSymbol(TypeAArray *taa, const char *func, int flags)
t->Tmangle = mTYman_c;
s->Stype = t;

sarray->push(s); // remember it
sarray.push(s); // remember it
return s;
}

Expand Down

0 comments on commit 494a91d

Please sign in to comment.