--- morph.c.vanilla Wed Dec 4 00:15:22 2002 +++ morph.c Wed Dec 4 00:20:03 2002 @@ -13,6 +13,13 @@ #include "morph.h" #include "deflex.h" +#define CHECK_CODE_PTR(x) do { \ + unsigned long xul = (unsigned long)(x); \ + if (xul!=0 && (xul<0x40000000 || xul>0x50000000)){ \ + __asm__ ("\tint $0x03\n"); \ + } \ +}while(0) + /* * Struct for calling dictionaries * All of this methods are optional, but @@ -146,9 +153,12 @@ } for (i = 1; i < lengthof(dicts); i++) - if (needinit[i] && dicts[i].init) + if (needinit[i] && dicts[i].init){ + CHECK_CODE_PTR(dicts[i].init); dictobjs[i] = (*(dicts[i].init)) (); + } + CHECK_CODE_PTR((void*)0xdeadbeef); //Here we have the lib loaded, load syms here inited = true; return; } @@ -158,7 +168,13 @@ { int2 nd; int i; - DICT *dict; + DICT *xdict; + + if (type<0 || type >= lengthof(mapdict)) + CHECK_CODE_PTR((void*)0xbadc0de); + + if (*len == 0) + return NULL; for (i = 0; i < MAXNDICT; i++) { @@ -175,9 +191,15 @@ } else { - dict = &dicts[nd]; + xdict = &dicts[nd]; + + #define dict (&dicts[nd]) + + CHECK_CODE_PTR(dict->is_stoplemm); if (dict->is_stoplemm && (*(dict->is_stoplemm)) (dictobjs[nd], word, *len)) return NULL; + + CHECK_CODE_PTR(dict->lemmatize); if (dict->lemmatize) { int oldlen = *len; @@ -186,6 +208,7 @@ /* word is recognized by distionary */ if (newword != word || *len != oldlen) { + CHECK_CODE_PTR(dict->is_stemstoplemm); if (dict->is_stemstoplemm && (*(dict->is_stemstoplemm)) (dictobjs[nd], word, *len)) { @@ -196,6 +219,8 @@ return newword; } } + + #undef dict } }