From 2cfa99195aa70694dcbcd9bbf9149eef331144e7 Mon Sep 17 00:00:00 2001 From: Dave Beazley Date: Sat, 28 Aug 1999 14:51:57 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@20 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/DOH/Doh/Makefile | 4 ++-- Source/DOH/Doh/base.c | 7 +++++-- Source/DOH/Doh/string.c | 5 +++-- Source/DOH/Include/doh.h | 7 +++++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Source/DOH/Doh/Makefile b/Source/DOH/Doh/Makefile index 554a2c09d..7a1de04f0 100644 --- a/Source/DOH/Doh/Makefile +++ b/Source/DOH/Doh/Makefile @@ -9,8 +9,8 @@ # Set your C++ compiler here. g++ works on most machines, # but you might have to change it depending on your installation. # -CC = cc -prefix = /usr/local +CC = gcc +prefix = /home/beazley/SWIG1.2 # Comment out the following line if you're on an SGI or don't have ranlib! RANLIB = ranlib diff --git a/Source/DOH/Doh/base.c b/Source/DOH/Doh/base.c index c5192c64e..3f2751db7 100644 --- a/Source/DOH/Doh/base.c +++ b/Source/DOH/Doh/base.c @@ -87,13 +87,13 @@ static DOH *find_internal(DOH *co) { if (DohCheck(co)) return co; c = (char *) co; if (doh_debug_level) { - DohError(DOH_CONVERSION,"Unknown object %x being treated as 'char *'.\n", c); + DohError(DOH_CONVERSION,"Unknown object '%s' being treated as 'char *'.\n", c); } r = root; s = 0; while (r) { s = r; - /* printf("checking %s\n", r->cstr);*/ + // printf("checking %s\n", r->cstr); d = strcmp(r->cstr,c); if (d == 0) return r->sstr; if (d < 0) r = r->left; @@ -350,6 +350,7 @@ DOH *DohGetattr(DOH *obj, DOH *name) { DOH *name_obj; DohBase *b = (DohBase *) obj; DohError(DOH_CALLS,"DohGetattr %x, %x\n",obj,name); + if (!name) return 0; if (DohIsMapping(b)) { name_obj = find_internal(name); if (b->objinfo->doh_mapping->doh_getattr) { @@ -370,6 +371,7 @@ int DohSetattr(DOH *obj, DOH *name, DOH *value) { DOH *name_obj, *value_obj; DohBase *b = (DohBase *) obj; DohError(DOH_CALLS,"DohSetattr %x, %x, %x\n",obj,name, value); + if ((!name) || (!value)) return 0; if (DohIsMapping(b)) { name_obj = find_internal(name); if (!DohCheck(value)) { @@ -395,6 +397,7 @@ void DohDelattr(DOH *obj, DOH *name) { DOH *name_obj; DohBase *b = (DohBase *) obj; DohError(DOH_CALLS,"DohDelattr %x, %x\n",obj,name); + if (!name) return; if (DohIsMapping(obj)) { name_obj = find_internal(name); if (b->objinfo->doh_mapping->doh_delattr) { diff --git a/Source/DOH/Doh/string.c b/Source/DOH/Doh/string.c index c104af31d..8b46336c2 100644 --- a/Source/DOH/Doh/string.c +++ b/Source/DOH/Doh/string.c @@ -248,7 +248,7 @@ String_cmp(DOH *so1, DOH *so2) if (s2->len < maxlen) maxlen = s2->len; c1 = s1->str; c2 = s2->str; - for (i = 0; i < maxlen; i++) { + for (i = 0; i < maxlen; i++,c1++,c2++) { if (*c1 != *c2) break; } if (i < maxlen) { @@ -268,7 +268,7 @@ int String_hash(DOH *so) { String *s = (String *) so; char *c; int i, h = 0, len; - /* if (s->hashkey >= 0) return s->hashkey; */ + if (s->hashkey >= 0) return s->hashkey; c = s->str; len = s->len > 50 ? 50 : s->len; for (i = 0; i < len; i++) { @@ -716,3 +716,4 @@ String_replace(DOH *stro, DOH *token, DOH *rep, int flags) if (flags & DOH_REPLACE_FIRST) count = 1; replace_internal(str,Char(token),Char(rep),flags,str->str,count); } + diff --git a/Source/DOH/Include/doh.h b/Source/DOH/Include/doh.h index d02bb5853..4ea944407 100644 --- a/Source/DOH/Include/doh.h +++ b/Source/DOH/Include/doh.h @@ -29,6 +29,10 @@ #define DOH_MAJOR_VERSION 0 #define DOH_MINOR_VERSION 1 +#ifdef __cplusplus +extern "C" { +#endif + typedef void DOH; #define DOH_BEGIN -1 @@ -309,5 +313,8 @@ extern DOH *DohSplit(DOH *input, char *chs, int nsplits); #define DOH_CONVERSION 5 #define DOH_CALLS 10 +#ifdef __cplusplus +} +#endif