[Synopsis-cvs] CVS: Synopsis/Synopsis/Parser/C++/ucpp README,1.4 assert.c,1.5 cpp.c,1.9 cpp.h,1.5 eval.c,1.6 lexer.c,1.5 macro.c,1.10 mem.c,1.4 mem.h,1.4 sample.c,1.4 tune.h,1.9 ucpp.1,1.4 ucppi.h,1.4
Stephen Davies chalky at users.sourceforge.netThu Sep 19 02:11:08 UTC 2002
- Next message: [Synopsis-cvs] CVS: Synopsis/Synopsis/Parser/C++/occ parse.cc,1.23
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /cvsroot/synopsis/Synopsis/Synopsis/Parser/C++/ucpp
In directory usw-pr-cvs1:/tmp/cvs-serv12335
Modified Files:
README assert.c cpp.c cpp.h eval.c lexer.c macro.c mem.c mem.h
sample.c tune.h ucpp.1 ucppi.h
Log Message:
Upgraded to ucpp 1.2, and fixed bug in macro support due to ambiguous specs.
Index: assert.c
===================================================================
RCS file: /cvsroot/synopsis/Synopsis/Synopsis/Parser/C++/ucpp/assert.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** assert.c 23 Aug 2002 20:15:39 -0000 1.4
--- assert.c 19 Sep 2002 09:10:41 -0000 1.5
***************
*** 35,39 ****
#include "ucppi.h"
#include "mem.h"
! #include "hashtable.h"
#include "tune.h"
--- 35,39 ----
#include "ucppi.h"
#include "mem.h"
! #include "hash.h"
#include "tune.h"
***************
*** 53,69 ****
}
static void del_assertion(void *va)
{
struct assert *a = va;
! size_t i, j;
if (a->name) freemem(a->name);
! for (i = 0; i < a->nbval; i ++) {
! for (j = 0; j < a->val[i].nt; j ++)
! if (S_TOKEN(a->val[i].t[j].type))
! freemem(a->val[i].t[j].name);
! if (a->val[i].nt) freemem(a->val[i].t);
! }
if (a->nbval) freemem(a->val);
}
--- 53,74 ----
}
+ static void del_token_fifo(struct token_fifo *tf)
+ {
+ int i;
+
+ for (i = 0; i < tf->nt; i ++)
+ if (S_TOKEN(tf->t[i].type)) freemem(tf->t[i].name);
+ if (tf->nt) freemem(tf->t);
+ }
+
static void del_assertion(void *va)
{
struct assert *a = va;
! size_t i;
if (a->name) freemem(a->name);
! for (i = 0; i < a->nbval; i ++) del_token_fifo(a->val + i);
if (a->nbval) freemem(a->val);
+ freemem(a);
}
***************
*** 205,208 ****
--- 210,214 ----
fputs(")\n", emit_output);
}
+ freemem(atl);
return 0;
***************
*** 210,221 ****
error(l, "unfinished #assert");
handle_assert_error:
! if (atl && atl->nt) {
! for (i = 0; i < atl->nt; i ++)
! if (S_TOKEN(atl->t[i].type)) freemem(atl->t[i].name);
! freemem(atl->t);
}
return ret;
handle_assert_warp_ign:
while (!next_token(ls) && ls->ctok->type != NEWLINE);
return ret;
}
--- 216,234 ----
error(l, "unfinished #assert");
handle_assert_error:
! if (atl) {
! del_token_fifo(atl);
! freemem(atl);
! }
! if (ina) {
! freemem(a->name);
! freemem(a);
}
return ret;
handle_assert_warp_ign:
while (!next_token(ls) && ls->ctok->type != NEWLINE);
+ if (ina) {
+ freemem(a->name);
+ freemem(a);
+ }
return ret;
}
***************
*** 228,232 ****
int ltww;
struct token t;
! struct token_fifo *atl = 0;
struct assert *a;
int ret = -1;
--- 241,245 ----
int ltww;
struct token t;
! struct token_fifo atl;
struct assert *a;
int ret = -1;
***************
*** 235,238 ****
--- 248,252 ----
size_t i;
+ atl.art = atl.nt = 0;
while (!next_token(ls)) {
if (ls->ctok->type == NEWLINE) break;
***************
*** 265,270 ****
handle_unassert_next2:
- atl = getmem(sizeof(struct token_fifo));
- atl->art = atl->nt = 0;
for (nnp = 1, ltww = 1; nnp && !next_token(ls);) {
if (ls->ctok->type == NEWLINE) break;
--- 279,282 ----
***************
*** 277,281 ****
t.type = ls->ctok->type;
if (S_TOKEN(t.type)) t.name = sdup(ls->ctok->name);
! aol(atl->t, atl->nt, t, TOKEN_LIST_MEMG);
}
goto handle_unassert_trunc;
--- 289,293 ----
t.type = ls->ctok->type;
if (S_TOKEN(t.type)) t.name = sdup(ls->ctok->name);
! aol(atl.t, atl.nt, t, TOKEN_LIST_MEMG);
}
goto handle_unassert_trunc;
***************
*** 287,307 ****
}
}
! if (atl->nt && ttMWS(atl->t[atl->nt - 1].type) && (-- atl->nt) == 0)
! freemem(atl->t);
! if (atl->nt == 0) {
error(l, "void assertion in #unassert");
- freemem(atl);
return ret;
}
! for (i = 0; i < a->nbval && cmp_token_list(atl, a->val + i); i ++);
if (i != a->nbval) {
/* we have it, undefine it */
if (i < (a->nbval - 1))
mmvwo(a->val + i, a->val + i + 1, (a->nbval - i - 1)
* sizeof(struct token_fifo));
! a->nbval --;
if (emit_assertions) {
fprintf(emit_output, "#unassert %s(", a->name);
! print_token_fifo(atl);
fputs(")\n", emit_output);
}
--- 299,319 ----
}
}
! if (atl.nt && ttMWS(atl.t[atl.nt - 1].type) && (-- atl.nt) == 0)
! freemem(atl.t);
! if (atl.nt == 0) {
error(l, "void assertion in #unassert");
return ret;
}
! for (i = 0; i < a->nbval && cmp_token_list(&atl, a->val + i); i ++);
if (i != a->nbval) {
/* we have it, undefine it */
+ del_token_fifo(a->val + i);
if (i < (a->nbval - 1))
mmvwo(a->val + i, a->val + i + 1, (a->nbval - i - 1)
* sizeof(struct token_fifo));
! if ((-- a->nbval) == 0) freemem(a->val);
if (emit_assertions) {
fprintf(emit_output, "#unassert %s(", a->name);
! print_token_fifo(&atl);
fputs(")\n", emit_output);
}
***************
*** 313,321 ****
error(l, "unfinished #unassert");
handle_unassert_finish:
! if (atl && atl->nt) {
! for (i = 0; i < atl->nt; i ++)
! if (S_TOKEN(atl->t[i].type)) freemem(atl->t[i].name);
! freemem(atl->t);
! }
return ret;
handle_unassert_warp:
--- 325,329 ----
error(l, "unfinished #unassert");
handle_unassert_finish:
! if (atl.nt) del_token_fifo(&atl);
return ret;
handle_unassert_warp:
***************
*** 373,381 ****
/*
* initialize the assertion table
*/
void init_assertions(void)
{
! if (assertions) killHT(assertions);
assertions = newHT(128, cmp_struct, hash_struct, del_assertion);
}
--- 381,398 ----
/*
+ * erase the assertion table
+ */
+ void wipe_assertions(void)
+ {
+ if (assertions) killHT(assertions);
+ assertions = 0;
+ }
+
+ /*
* initialize the assertion table
*/
void init_assertions(void)
{
! wipe_assertions();
assertions = newHT(128, cmp_struct, hash_struct, del_assertion);
}
***** Bogus filespec: ucppi.h,1.4
- Next message: [Synopsis-cvs] CVS: Synopsis/Synopsis/Parser/C++/occ parse.cc,1.23
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Synopsis-changes mailing list