diff options
author | Adrian Thurston <thurston@complang.org> | 2014-12-25 16:02:14 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2014-12-25 16:02:14 -0500 |
commit | e9a6e75710c42ab1a80c3cf54c5131e2bc4329e1 (patch) | |
tree | 1037ec581e8d9e88b46a3dd26812512cdc44bb48 /src/struct.c | |
parent | 4bd915e48b6b6278ed8c4b7be95781535f2ce10a (diff) | |
download | colm-e9a6e75710c42ab1a80c3cf54c5131e2bc4329e1.tar.gz |
converted the global object to a struct
Diffstat (limited to 'src/struct.c')
-rw-r--r-- | src/struct.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/struct.c b/src/struct.c index 8a13e9b5..5b37cb27 100644 --- a/src/struct.c +++ b/src/struct.c @@ -1,6 +1,9 @@ #include <colm/program.h> #include <colm/struct.h> +#include <stdlib.h> +#include <string.h> + struct colm_struct *colm_new_struct( Program *prg, int id ) { int structSize = prg->rtd->selInfo[id].size; @@ -22,3 +25,12 @@ struct colm_struct *colm_new_struct( Program *prg, int id ) return item; } + +void colm_delete_struct( Program *prg, Tree **sp, struct colm_struct *el ) +{ + short *t = prg->rtd->selInfo[el->id].trees; + int i, len = prg->rtd->selInfo[el->id].treesLen; + for ( i = 0; i < len; i++ ) + treeDownref( prg, sp, ((Tree**)(el+1))[t[i]] ); + free( el ); +} |