diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-22T12·07+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-22T12·07+0000 |
commit | 385c6f87373303f6e4c9f4e67e02507641a268f2 (patch) | |
tree | 0125a5520d218d76cdfc2f775bd1279a28376568 | |
parent | d22d7565f3a1848552f9459e18cb4be4e6d08018 (diff) |
* Supply the 64-bit ATerm patch, but don't apply it (since that
requires rerunning Autoconf/Automake). Interested users should do that themselves.
-rw-r--r-- | externals/Makefile.am | 4 | ||||
-rw-r--r-- | externals/aterm-64-bit.patch | 661 |
2 files changed, 664 insertions, 1 deletions
diff --git a/externals/Makefile.am b/externals/Makefile.am index 75984fce4cd1..5d2a2324d1c7 100644 --- a/externals/Makefile.am +++ b/externals/Makefile.am @@ -47,6 +47,7 @@ $(ATERM).tar.gz: $(ATERM): $(ATERM).tar.gz gunzip < $(srcdir)/$(ATERM).tar.gz | tar xvf - (cd $(ATERM) && $(patch) -p1) < $(srcdir)/aterm-aliasing.patch +# (cd $(ATERM) && $(patch) -p1) < $(srcdir)/aterm-64-bit.patch have-aterm: $(MAKE) $(ATERM) @@ -102,7 +103,8 @@ endif all: build-db build-aterm build-bzip2 -EXTRA_DIST = $(DB).tar.gz $(ATERM).tar.gz $(BZIP2).tar.gz bdb-cygwin.patch aterm-aliasing.patch +EXTRA_DIST = $(DB).tar.gz $(ATERM).tar.gz $(BZIP2).tar.gz \ + bdb-cygwin.patch aterm-aliasing.patch aterm-64-bit.patch ext-clean: $(RM) -f have-db build-db have-aterm build-aterm diff --git a/externals/aterm-64-bit.patch b/externals/aterm-64-bit.patch new file mode 100644 index 000000000000..4618d0883ca3 --- /dev/null +++ b/externals/aterm-64-bit.patch @@ -0,0 +1,661 @@ +diff -rc aterm-2.4.2-orig/aterm/bafio.c aterm-2.4.2/aterm/bafio.c +*** aterm-2.4.2-orig/aterm/bafio.c 2004-02-02 12:24:34.000000000 +0100 +--- aterm-2.4.2/aterm/bafio.c 2006-09-22 13:39:07.000000000 +0200 +*************** +*** 222,227 **** +--- 222,229 ---- + } + } + ++ if (val) return -1; ++ + /* Ok */ + return 0; + } +*************** +*** 544,551 **** + * terms have been sorted by symbol. + */ + +! void gather_top_symbols(sym_entry *cur_entry, int cur_arg, +! int total_top_symbols) + { + int index; + unsigned int hnr; +--- 546,553 ---- + * terms have been sorted by symbol. + */ + +! static void gather_top_symbols(sym_entry *cur_entry, int cur_arg, +! int total_top_symbols) + { + int index; + unsigned int hnr; +*************** +*** 899,905 **** + } else { + switch(ATgetType(t)) { + case AT_INT: +! if(writeBits(ATgetInt((ATermInt)t), HEADER_BITS, writer) < 0) { + return ATfalse; + } + #if 0 +--- 901,908 ---- + } else { + switch(ATgetType(t)) { + case AT_INT: +! /* If ATerm integers are > 32 bits, then this can fail. */ +! if(writeBits(ATgetInt((ATermInt)t), INT_SIZE_IN_BAF, writer) < 0) { + return ATfalse; + } + #if 0 +*************** +*** 1033,1039 **** + /*}}} */ + /*{{{ ATbool write_baf(ATerm t, byte_writer *writer) */ + +! ATbool + write_baf(ATerm t, byte_writer *writer) + { + int nr_unique_terms = 0; +--- 1036,1042 ---- + /*}}} */ + /*{{{ ATbool write_baf(ATerm t, byte_writer *writer) */ + +! static ATbool + write_baf(ATerm t, byte_writer *writer) + { + int nr_unique_terms = 0; +*************** +*** 1233,1239 **** + * Read a single symbol from file. + */ + +! Symbol read_symbol(byte_reader *reader) + { + unsigned int arity, quoted; + int len; +--- 1236,1242 ---- + * Read a single symbol from file. + */ + +! static Symbol read_symbol(byte_reader *reader) + { + unsigned int arity, quoted; + int len; +*************** +*** 1260,1266 **** + * Read all symbols from file. + */ + +! ATbool read_all_symbols(byte_reader *reader) + { + unsigned int val; + int i, j, k, arity; +--- 1263,1269 ---- + * Read all symbols from file. + */ + +! static ATbool read_all_symbols(byte_reader *reader) + { + unsigned int val; + int i, j, k, arity; +*************** +*** 1280,1293 **** + /*}}} */ + /*{{{ Read term count and allocate space */ + +! if(readInt(&val, reader) < 0) + return ATfalse; + read_symbols[i].nr_terms = val; + read_symbols[i].term_width = bit_width(val); +! if(val == 0) +! read_symbols[i].terms = NULL; +! else +! read_symbols[i].terms = (ATerm *)calloc(val, sizeof(ATerm)); + if(!read_symbols[i].terms) + ATerror("read_symbols: could not allocate space for %d terms.\n", val); + ATprotectArray(read_symbols[i].terms, val); +--- 1283,1293 ---- + /*}}} */ + /*{{{ Read term count and allocate space */ + +! if(readInt(&val, reader) < 0 || val == 0) + return ATfalse; + read_symbols[i].nr_terms = val; + read_symbols[i].term_width = bit_width(val); +! read_symbols[i].terms = (ATerm *)calloc(val, sizeof(ATerm)); + if(!read_symbols[i].terms) + ATerror("read_symbols: could not allocate space for %d terms.\n", val); + ATprotectArray(read_symbols[i].terms, val); +*************** +*** 1351,1357 **** + /*}}} */ + /*{{{ ATerm read_term(sym_read_entry *sym, byte_reader *reader) */ + +! ATerm read_term(sym_read_entry *sym, byte_reader *reader) + { + unsigned int val; + int i, arity = sym->arity; +--- 1351,1357 ---- + /*}}} */ + /*{{{ ATerm read_term(sym_read_entry *sym, byte_reader *reader) */ + +! static ATerm read_term(sym_read_entry *sym, byte_reader *reader) + { + unsigned int val; + int i, arity = sym->arity; +*************** +*** 1365,1370 **** +--- 1365,1371 ---- + ATprotectArray(args, arity); + if(!args) + ATerror("could not allocate space for %d arguments.\n", arity); ++ /* !!! leaks memory on the "return NULL" paths */ + } + + /*ATfprintf(stderr, "reading term over symbol %y\n", sym->sym);*/ +*************** +*** 1372,1377 **** +--- 1373,1380 ---- + /*ATfprintf(stderr, " reading argument %d (%d)", i, sym->sym_width[i]);*/ + if(readBits(&val, sym->sym_width[i], reader) < 0) + return NULL; ++ if(val >= sym->nr_topsyms[i]) ++ return NULL; + arg_sym = &read_symbols[sym->topsyms[i][val]]; + /* ATfprintf(stderr, "argument %d, symbol index = %d, symbol = %y\n", + i, val, arg_sym->sym);*/ +*************** +*** 1381,1386 **** +--- 1384,1391 ---- + if(readBits(&val, arg_sym->term_width, reader) < 0) + return NULL; + /* ATfprintf(stderr, "arg term index = %d\n", val);*/ ++ if(val >= arg_sym->nr_terms) ++ return NULL; + if(!arg_sym->terms[val]) { + arg_sym->terms[val] = read_term(arg_sym, reader); + if(!arg_sym->terms[val]) +*************** +*** 1396,1402 **** + case AS_INT: + /*{{{ Read an integer */ + +! if(readBits(&val, HEADER_BITS, reader) < 0) + return NULL; + + result = (ATerm)ATmakeInt((int)val); +--- 1401,1407 ---- + case AS_INT: + /*{{{ Read an integer */ + +! if(readBits(&val, INT_SIZE_IN_BAF, reader) < 0) + return NULL; + + result = (ATerm)ATmakeInt((int)val); +*************** +*** 1494,1502 **** + for(i=0; i<nr_unique_symbols; i++) { + sym_read_entry *entry = &read_symbols[i]; + +! ATunprotectArray(entry->terms); +! if(entry->terms) + free(entry->terms); + if(entry->nr_topsyms) + free(entry->nr_topsyms); + if(entry->sym_width) +--- 1499,1508 ---- + for(i=0; i<nr_unique_symbols; i++) { + sym_read_entry *entry = &read_symbols[i]; + +! if(entry->terms) { +! ATunprotectArray(entry->terms); + free(entry->terms); ++ } + if(entry->nr_topsyms) + free(entry->nr_topsyms); + if(entry->sym_width) +Only in aterm-2.4.2/aterm: config.h.in +diff -rc aterm-2.4.2-orig/aterm/encoding.h aterm-2.4.2/aterm/encoding.h +*** aterm-2.4.2-orig/aterm/encoding.h 2004-06-01 10:29:02.000000000 +0200 +--- aterm-2.4.2/aterm/encoding.h 2006-09-22 13:39:07.000000000 +0200 +*************** +*** 10,15 **** +--- 10,17 ---- + { + #endif/* __cplusplus */ + ++ #include "config.h" ++ + /* + |--------------------------------| + |info|type |arity|quoted|mark|age| +*************** +*** 31,37 **** + #define SHIFT_REMOVE_MARK_AGE 3 + #define MASK_AGE_MARK (MASK_AGE|MASK_MARK) + +! #if AT_64BIT + #define SHIFT_LENGTH 34 + #define HEADER_BITS 64 + typedef unsigned long header_type; +--- 33,39 ---- + #define SHIFT_REMOVE_MARK_AGE 3 + #define MASK_AGE_MARK (MASK_AGE|MASK_MARK) + +! #ifdef AT_64BIT + #define SHIFT_LENGTH 34 + #define HEADER_BITS 64 + typedef unsigned long header_type; +*************** +*** 137,142 **** +--- 139,150 ---- + #define AT_TABLE_SIZE(table_class) (1<<(table_class)) + #define AT_TABLE_MASK(table_class) (AT_TABLE_SIZE(table_class)-1) + ++ ++ /* Integers in BAF are always exactly 32 bits. The size must be fixed so that ++ * BAF terms can be exchanged between platforms. */ ++ #define INT_SIZE_IN_BAF 32 ++ ++ + #ifdef __cplusplus + } + #endif/* __cplusplus */ +diff -rc aterm-2.4.2-orig/aterm/gc.c aterm-2.4.2/aterm/gc.c +*** aterm-2.4.2-orig/aterm/gc.c 2004-06-01 10:29:02.000000000 +0200 +--- aterm-2.4.2/aterm/gc.c 2006-09-22 13:39:07.000000000 +0200 +*************** +*** 154,166 **** + } + + #ifdef AT_64BIT +! odd_term = *((ATerm *)((MachineWord)cur)+4); + real_term = AT_isInsideValidTerm(odd_term); + if (real_term != NULL) { + AT_markTerm(odd_term); + } + +! odd_sym = *((AFun *)((MachineWord)cur)+4); + if (AT_isValidSymbol(odd_sym)) { + /*fprintf(stderr,"mark_memory: AT_markSymbol(%d)\n",odd_sym);*/ + AT_markSymbol(odd_sym); +--- 154,166 ---- + } + + #ifdef AT_64BIT +! odd_term = *((ATerm *)(((MachineWord)cur)+4)); + real_term = AT_isInsideValidTerm(odd_term); + if (real_term != NULL) { + AT_markTerm(odd_term); + } + +! odd_sym = *((AFun *)(((MachineWord)cur)+4)); + if (AT_isValidSymbol(odd_sym)) { + /*fprintf(stderr,"mark_memory: AT_markSymbol(%d)\n",odd_sym);*/ + AT_markSymbol(odd_sym); +*************** +*** 198,210 **** + } + + #ifdef AT_64BIT +! odd_term = *((ATerm *)((MachineWord)cur)+4); + real_term = AT_isInsideValidTerm(odd_term); + if (real_term != NULL) { + AT_markTerm_young(odd_term); + } + +! odd_sym = *((AFun *)((MachineWord)cur)+4); + if (AT_isValidSymbol(odd_sym)) { + /*fprintf(stderr,"mark_memory_young: AT_markSymbol_young(%d)\n",odd_sym);*/ + AT_markSymbol_young(odd_sym); +--- 198,210 ---- + } + + #ifdef AT_64BIT +! odd_term = *((ATerm *)(((MachineWord)cur)+4)); + real_term = AT_isInsideValidTerm(odd_term); + if (real_term != NULL) { + AT_markTerm_young(odd_term); + } + +! odd_sym = *((AFun *)(((MachineWord)cur)+4)); + if (AT_isValidSymbol(odd_sym)) { + /*fprintf(stderr,"mark_memory_young: AT_markSymbol_young(%d)\n",odd_sym);*/ + AT_markSymbol_young(odd_sym); +*************** +*** 225,235 **** + ATerm *start, *stop; + ProtEntry *prot; + +- #ifdef AT_64BIT +- ATerm oddTerm; +- AFun oddSym; +- #endif +- + #ifdef WIN32 + + unsigned int r_eax, r_ebx, r_ecx, r_edx, \ +--- 225,230 ---- +*************** +*** 287,293 **** + /* Traverse possible register variables */ + sigsetjmp(env,0); + +! start = (ATerm *)env; + stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf))); + mark_memory(start, stop); + #endif +--- 282,288 ---- + /* Traverse possible register variables */ + sigsetjmp(env,0); + +! start = (ATerm *)env; /* !!! illegal aliasing */ + stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf))); + mark_memory(start, stop); + #endif +*************** +*** 338,348 **** + ATerm *start, *stop; + ProtEntry *prot; + +- #ifdef AT_64BIT +- ATerm oddTerm; +- AFun oddSym; +- #endif +- + #ifdef WIN32 + + unsigned int r_eax, r_ebx, r_ecx, r_edx, \ +--- 333,338 ---- +*************** +*** 400,406 **** + /* Traverse possible register variables */ + sigsetjmp(env,0); + +! start = (ATerm *)env; + stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf))); + mark_memory_young(start, stop); + #endif +--- 390,396 ---- + /* Traverse possible register variables */ + sigsetjmp(env,0); + +! start = (ATerm *)env; /* !!! illegal aliasing */ + stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf))); + mark_memory_young(start, stop); + #endif +*************** +*** 1047,1053 **** + /*fprintf(stderr,"minor_sweep_phase_young: ensure empty freelist[%d]\n",size);*/ + for(data = at_freelist[size] ; data ; data=data->next) { + if(!EQUAL_HEADER(data->header,FREE_HEADER)) { +! fprintf(stderr,"data = %x header = %x\n",(unsigned int)data,data->header); + } + assert(EQUAL_HEADER(data->header,FREE_HEADER)); + assert(ATgetType(data) == AT_FREE); +--- 1037,1043 ---- + /*fprintf(stderr,"minor_sweep_phase_young: ensure empty freelist[%d]\n",size);*/ + for(data = at_freelist[size] ; data ; data=data->next) { + if(!EQUAL_HEADER(data->header,FREE_HEADER)) { +! fprintf(stderr,"data = %p header = %x\n",data,(unsigned int) data->header); + } + assert(EQUAL_HEADER(data->header,FREE_HEADER)); + assert(ATgetType(data) == AT_FREE); +diff -rc aterm-2.4.2-orig/aterm/Makefile.am aterm-2.4.2/aterm/Makefile.am +*** aterm-2.4.2-orig/aterm/Makefile.am 2005-08-03 11:45:19.000000000 +0200 +--- aterm-2.4.2/aterm/Makefile.am 2006-09-22 13:39:07.000000000 +0200 +*************** +*** 37,43 **** + aterm2.h \ + atypes.h \ + deprecated.h \ +! encoding.h + + PRIVATE_INCL = \ + _afun.h \ +--- 37,44 ---- + aterm2.h \ + atypes.h \ + deprecated.h \ +! encoding.h \ +! config.h + + PRIVATE_INCL = \ + _afun.h \ +diff -rc aterm-2.4.2-orig/aterm/md5.h aterm-2.4.2/aterm/md5.h +*** aterm-2.4.2-orig/aterm/md5.h 2003-09-02 15:32:46.000000000 +0200 +--- aterm-2.4.2/aterm/md5.h 2006-09-22 13:39:07.000000000 +0200 +*************** +*** 24,29 **** +--- 24,31 ---- + documentation and/or software. + */ + ++ #include <stdint.h> ++ + /* GLOBAL.H - RSAREF types and constants + */ + +*************** +*** 46,55 **** + typedef unsigned char *POINTER; + + /* UINT2 defines a two byte word */ +! typedef unsigned short int UINT2; + + /* UINT4 defines a four byte word */ +! typedef unsigned long int UINT4; + + /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. + If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it +--- 48,57 ---- + typedef unsigned char *POINTER; + + /* UINT2 defines a two byte word */ +! typedef uint16_t UINT2; + + /* UINT4 defines a four byte word */ +! typedef uint32_t UINT4; + + /* PROTO_LIST is defined depending on how PROTOTYPES is defined above. + If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it +diff -rc aterm-2.4.2-orig/aterm/memory.c aterm-2.4.2/aterm/memory.c +*** aterm-2.4.2-orig/aterm/memory.c 2005-10-11 13:19:25.000000000 +0200 +--- aterm-2.4.2/aterm/memory.c 2006-09-22 13:39:16.000000000 +0200 +*************** +*** 96,102 **** + #define HASHNUMBER4(t) hash_number(t,4) + #define HASHINT(val) (tmp[0]=(MachineWord)(AT_INT<<SHIFT_TYPE),\ + tmp[1]=(MachineWord)0,\ +! tmp[2]=(MachineWord)val,\ + hash_number(tmp,3)) + + #else +--- 96,102 ---- + #define HASHNUMBER4(t) hash_number(t,4) + #define HASHINT(val) (tmp[0]=(MachineWord)(AT_INT<<SHIFT_TYPE),\ + tmp[1]=(MachineWord)0,\ +! tmp[2]=(MachineWord)((unsigned int) val),\ + hash_number(tmp,3)) + + #else +*************** +*** 127,133 **** + ((MachineWord*)t)[2]),((MachineWord*)t)[3])) + + #define HASHINT(val) \ +! FINISH(COMBINE(START( (AT_INT<<SHIFT_TYPE) ), val)) + + + #endif /* HASHPEM */ +--- 127,133 ---- + ((MachineWord*)t)[2]),((MachineWord*)t)[3])) + + #define HASHINT(val) \ +! FINISH(COMBINE(START( (AT_INT<<SHIFT_TYPE) ), (unsigned int) val)) + + + #endif /* HASHPEM */ +*************** +*** 708,714 **** + at_blocks[size] = newblock; + top_at_blocks[size] = newblock->data; + assert(at_blocks[size] != NULL); +! assert(((int)top_at_blocks[size] % MAX(sizeof(double), sizeof(void *))) == 0); + + /* [pem: Feb 14 02] TODO: fast allocation */ + assert(at_freelist[size] == NULL); +--- 708,714 ---- + at_blocks[size] = newblock; + top_at_blocks[size] = newblock->data; + assert(at_blocks[size] != NULL); +! assert(((long)top_at_blocks[size] % MAX(sizeof(double), sizeof(void *))) == 0); + + /* [pem: Feb 14 02] TODO: fast allocation */ + assert(at_freelist[size] == NULL); +*************** +*** 1009,1018 **** + do { + if(!cur) { + /*printf("freeterm = %d\n",t);*/ +! fprintf(stderr,"### cannot find term %x in hashtable at pos %d header = %x\n", (unsigned int)t, hnr, t->header); +! +! ATabort("### cannot find term %n at %p in hashtable at pos %d" +! ", header = %d\n", t, t, hnr, t->header); + } + if (cur == t) { + if(prev) +--- 1009,1016 ---- + do { + if(!cur) { + /*printf("freeterm = %d\n",t);*/ +! ATabort("### cannot find term %p in hashtable at pos %d" +! ", header = %x\n", t, hnr, t->header); + } + if (cur == t) { + if(prev) +*************** +*** 1728,1733 **** +--- 1726,1733 ---- + hashtable[hnr] = cur; + } + ++ assert((hnr & table_mask) == (hash_number(cur, TERM_SIZE_INT) & table_mask)); ++ + return (ATermInt)cur; + } + +diff -rc aterm-2.4.2-orig/aterm.m4 aterm-2.4.2/aterm.m4 +*** aterm-2.4.2-orig/aterm.m4 2005-08-03 11:45:19.000000000 +0200 +--- aterm-2.4.2/aterm.m4 2006-09-22 13:39:07.000000000 +0200 +*************** +*** 8,15 **** + [AS_HELP_STRING([--with-sharing],[create libraries that do term sharing @<:@yes@:>@])], + [if test "$withval" = "no"; then + AC_MSG_RESULT([no]) +! AC_DEFINE([NO_SHARING]) +! AC_DEFINE([WITH_STATS]) + else + if test "$withval" != "yes"; then + AC_MSG_RESULT([unknown value specified for --with-sharing.]) +--- 8,15 ---- + [AS_HELP_STRING([--with-sharing],[create libraries that do term sharing @<:@yes@:>@])], + [if test "$withval" = "no"; then + AC_MSG_RESULT([no]) +! AC_DEFINE([NO_SHARING], [], [Whether terms are shared.]) +! AC_DEFINE([WITH_STATS], [], [Whether to keep statistics.]) + else + if test "$withval" != "yes"; then + AC_MSG_RESULT([unknown value specified for --with-sharing.]) +*************** +*** 73,78 **** +--- 73,102 ---- + AC_SUBST([OPTIMIZECFLAGS]) + ]) + ++ # ATERM_64_BIT ++ # ------------ ++ # Enable 64-bit mode if pointers are 8 bytes large. ++ AC_DEFUN([ATERM_64_BIT], [ ++ AC_CHECK_SIZEOF(void *) ++ AC_CHECK_SIZEOF(int) ++ AC_CHECK_SIZEOF(long) ++ ++ AC_MSG_CHECKING([what kind of platform this is]) ++ ++ AC_SUBST([AT_64BIT], [0]) ++ if test "$ac_cv_sizeof_void_p" = "8" -a "$ac_cv_sizeof_int" = "4" -a "$ac_cv_sizeof_long" = "8"; then ++ AC_MSG_RESULT([LP64]) ++ AC_SUBST([AT_64BIT], [1]) ++ elif test "$ac_cv_sizeof_void_p" = "8" -a "$ac_cv_sizeof_int" = "8" -a "$ac_cv_sizeof_long" = "8"; then ++ AC_MSG_RESULT([ILP64 - warning, untested]) ++ AC_SUBST([AT_64BIT], [1]) ++ elif test "$ac_cv_sizeof_void_p" = "4" -a "$ac_cv_sizeof_int" = "4" -a "$ac_cv_sizeof_long" = "4"; then ++ AC_MSG_RESULT([32 bits]) ++ else ++ AC_MSG_RESULT([something weird - warning, untested]) ++ fi ++ ]) ++ + # XT_SVN_REVISION + # --------------- + AC_DEFUN([XT_SVN_REVISION], +diff -rc aterm-2.4.2-orig/configure.ac aterm-2.4.2/configure.ac +*** aterm-2.4.2-orig/configure.ac 2005-08-03 11:45:19.000000000 +0200 +--- aterm-2.4.2/configure.ac 2006-09-22 13:39:07.000000000 +0200 +*************** +*** 30,35 **** +--- 30,38 ---- + # Add a configuration option to allow users to control sharing. + ATERM_WITH_SHARING + ++ # Enable 64-bit mode if pointers are 8 bytes large. ++ ATERM_64_BIT ++ + CURDATE=`date` + AC_SUBST([CURDATE]) + +*************** +*** 45,49 **** +--- 48,53 ---- + doc/spec/Makefile + aterm.spec + aterm.pc ++ aterm/config.h + ]) + AC_OUTPUT +diff -rc aterm-2.4.2-orig/utils/dicttoc.c aterm-2.4.2/utils/dicttoc.c +*** aterm-2.4.2-orig/utils/dicttoc.c 2003-10-07 13:57:40.000000000 +0200 +--- aterm-2.4.2/utils/dicttoc.c 2006-09-22 13:39:07.000000000 +0200 +*************** +*** 69,74 **** +--- 69,75 ---- + fprintf(file, "#ifndef __%s_H\n", code_prefix); + fprintf(file, "#define __%s_H\n\n", code_prefix); + fprintf(file, "#include <aterm2.h>\n\n"); ++ fprintf(file, "#include <assert.h>\n\n"); + + while (!ATisEmpty(afuns)) { + ATerm afun, alias, pair = ATgetFirst(afuns); +*************** +*** 244,251 **** + ATfprintf(file, "{\n"); + ATfprintf(file, " ATermList afuns, terms;\n\n"); + +! ATfprintf(file, " _%s = ATreadFromBinaryString(_%s_baf, _%s_LEN);\n\n", + code_prefix, code_prefix, code_prefix); + ATfprintf(file, " ATprotect(&_%s);\n\n", code_prefix); + + ATfprintf(file, " afuns = (ATermList)ATelementAt((ATermList)_%s, 0);\n\n", code_prefix); +--- 245,253 ---- + ATfprintf(file, "{\n"); + ATfprintf(file, " ATermList afuns, terms;\n\n"); + +! ATfprintf(file, " _%s = ATreadFromBinaryString(_%s_baf, _%s_LEN);\n", + code_prefix, code_prefix, code_prefix); ++ ATfprintf(file, " assert(_%s);\n\n", code_prefix); + ATfprintf(file, " ATprotect(&_%s);\n\n", code_prefix); + + ATfprintf(file, " afuns = (ATermList)ATelementAt((ATermList)_%s, 0);\n\n", code_prefix); |