Constified a bunch of stuff.... it was bound to happen anyway.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@263 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a04d5c74a4
commit
9823bcf2a6
7 changed files with 80 additions and 80 deletions
|
|
@ -112,14 +112,14 @@ DohIntern(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
DOH *
|
DOH *
|
||||||
DohCopy(DOH *obj) {
|
DohCopy(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohCopy %x\n",obj);
|
DohTrace(DOH_CALLS,"DohCopy %x\n",obj);
|
||||||
if (!DohCheck(b)) {
|
if (!DohCheck(b)) {
|
||||||
DohTrace(DOH_UNKNOWN,"Unknown object %x passed to Copy.\n", obj);
|
DohTrace(DOH_UNKNOWN,"Unknown object %x passed to Copy.\n", obj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (b->objinfo->doh_copy) return (b->objinfo->doh_copy)(obj);
|
if (b->objinfo->doh_copy) return (b->objinfo->doh_copy)(b);
|
||||||
DohTrace(DOH_UNSUPPORTED,"No copy method defined for type '%s'\n", b->objinfo->objname);
|
DohTrace(DOH_UNSUPPORTED,"No copy method defined for type '%s'\n", b->objinfo->objname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -175,7 +175,7 @@ DohSetScope(DOH *obj, int s) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
DOH *
|
DOH *
|
||||||
DohStr(DOH *obj) {
|
DohStr(const DOH *obj) {
|
||||||
DOH *s;
|
DOH *s;
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohStr %x\n",obj);
|
DohTrace(DOH_CALLS,"DohStr %x\n",obj);
|
||||||
|
|
@ -200,7 +200,7 @@ DohStr(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohDump(DOH *obj, DOH *out) {
|
DohDump(const DOH *obj, DOH *out) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohDump %x, %x\n",obj,out);
|
DohTrace(DOH_CALLS,"DohDump %x, %x\n",obj,out);
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
|
|
@ -221,13 +221,13 @@ DohDump(DOH *obj, DOH *out) {
|
||||||
* is invoked on it.
|
* is invoked on it.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
int
|
int
|
||||||
DohLen(DOH *obj) {
|
DohLen(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohLen %x\n",obj);
|
DohTrace(DOH_CALLS,"DohLen %x\n",obj);
|
||||||
if (!b) return 0;
|
if (!b) return 0;
|
||||||
if (DohCheck(b)) {
|
if (DohCheck(b)) {
|
||||||
if (b->objinfo->doh_len) {
|
if (b->objinfo->doh_len) {
|
||||||
return (b->objinfo->doh_len)(obj);
|
return (b->objinfo->doh_len)(b);
|
||||||
}
|
}
|
||||||
DohTrace(DOH_UNSUPPORTED, "No len method defined for type '%s'\n", b->objinfo->objname);
|
DohTrace(DOH_UNSUPPORTED, "No len method defined for type '%s'\n", b->objinfo->objname);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -245,12 +245,12 @@ DohLen(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohHashval(DOH *obj) {
|
DohHashval(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohHashval %x\n",obj);
|
DohTrace(DOH_CALLS,"DohHashval %x\n",obj);
|
||||||
if (DohCheck(b)) {
|
if (DohCheck(b)) {
|
||||||
if (b->objinfo->doh_hash) {
|
if (b->objinfo->doh_hash) {
|
||||||
return (b->objinfo->doh_hash)(obj);
|
return (b->objinfo->doh_hash)(b);
|
||||||
}
|
}
|
||||||
DohTrace(DOH_UNSUPPORTED,"No hash method defined for type '%s'\n", b->objinfo->objname);
|
DohTrace(DOH_UNSUPPORTED,"No hash method defined for type '%s'\n", b->objinfo->objname);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -266,13 +266,13 @@ DohHashval(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void *
|
void *
|
||||||
DohData(DOH *obj) {
|
DohData(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohData %x\n",obj);
|
DohTrace(DOH_CALLS,"DohData %x\n",obj);
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
if (b->objinfo) {
|
if (b->objinfo) {
|
||||||
if (b->objinfo->doh_data) {
|
if (b->objinfo->doh_data) {
|
||||||
return (b->objinfo->doh_data)(obj);
|
return (b->objinfo->doh_data)(b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DohTrace(DOH_UNSUPPORTED,"No data method defined for type '%s'\n", b->objinfo->objname);
|
DohTrace(DOH_UNSUPPORTED,"No data method defined for type '%s'\n", b->objinfo->objname);
|
||||||
|
|
@ -294,7 +294,7 @@ DohGetline(DOH *obj) {
|
||||||
DohTrace(DOH_CALLS,"DohGetline %x\n",obj);
|
DohTrace(DOH_CALLS,"DohGetline %x\n",obj);
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
if (b->objinfo->doh_position && b->objinfo->doh_position->doh_getline) {
|
if (b->objinfo->doh_position && b->objinfo->doh_position->doh_getline) {
|
||||||
return (b->objinfo->doh_position->doh_getline)(obj);
|
return (b->objinfo->doh_position->doh_getline)(b);
|
||||||
} else {
|
} else {
|
||||||
DohTrace(DOH_UNSUPPORTED,"No getline method defined for type '%s'\n", b->objinfo->objname);
|
DohTrace(DOH_UNSUPPORTED,"No getline method defined for type '%s'\n", b->objinfo->objname);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -337,7 +337,7 @@ DohGetfile(DOH *obj) {
|
||||||
DohTrace(DOH_CALLS,"DohGetfile %x\n",obj);
|
DohTrace(DOH_CALLS,"DohGetfile %x\n",obj);
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
if (b->objinfo->doh_position && b->objinfo->doh_position->doh_getfile) {
|
if (b->objinfo->doh_position && b->objinfo->doh_position->doh_getfile) {
|
||||||
return (b->objinfo->doh_position->doh_getfile)(obj);
|
return (b->objinfo->doh_position->doh_getfile)(b);
|
||||||
}
|
}
|
||||||
DohTrace(DOH_UNSUPPORTED,"No getfile method defined for type '%s'\n", b->objinfo->objname);
|
DohTrace(DOH_UNSUPPORTED,"No getfile method defined for type '%s'\n", b->objinfo->objname);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -375,7 +375,7 @@ DohSetfile(DOH *obj, DOH *file) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohCmp(DOH *obj1, DOH *obj2) {
|
DohCmp(const DOH *obj1, const DOH *obj2) {
|
||||||
DohBase *b1, *b2;
|
DohBase *b1, *b2;
|
||||||
DohTrace(DOH_CALLS,"DohCmp %x, %x\n",obj1,obj2);
|
DohTrace(DOH_CALLS,"DohCmp %x, %x\n",obj1,obj2);
|
||||||
b1 = (DohBase *) obj1;
|
b1 = (DohBase *) obj1;
|
||||||
|
|
@ -401,7 +401,7 @@ DohCmp(DOH *obj1, DOH *obj2) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsMapping(DOH *obj) {
|
DohIsMapping(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
if (b->objinfo->doh_mapping) return 1;
|
if (b->objinfo->doh_mapping) return 1;
|
||||||
|
|
@ -415,12 +415,12 @@ DohIsMapping(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
DOH *
|
DOH *
|
||||||
DohGetattr(DOH *obj, DOH *name) {
|
DohGetattr(DOH *obj, const DOH *name) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohGetattr %x, %x\n",obj,name);
|
DohTrace(DOH_CALLS,"DohGetattr %x, %x\n",obj,name);
|
||||||
if (DohIsMapping(b)) {
|
if (DohIsMapping(b)) {
|
||||||
if (b->objinfo->doh_mapping->doh_getattr) {
|
if (b->objinfo->doh_mapping->doh_getattr) {
|
||||||
return (b->objinfo->doh_mapping->doh_getattr)(obj,name);
|
return (b->objinfo->doh_mapping->doh_getattr)(b,(DOH *) name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DohCheck(b)) {
|
if (DohCheck(b)) {
|
||||||
|
|
@ -438,12 +438,12 @@ DohGetattr(DOH *obj, DOH *name) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohSetattr(DOH *obj, DOH *name, DOH *value) {
|
DohSetattr(DOH *obj, const DOH *name, const DOH *value) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohSetattr %x, %x, %x\n",obj,name, value);
|
DohTrace(DOH_CALLS,"DohSetattr %x, %x, %x\n",obj,name, value);
|
||||||
if (DohIsMapping(b)) {
|
if (DohIsMapping(b)) {
|
||||||
if (b->objinfo->doh_mapping->doh_setattr) {
|
if (b->objinfo->doh_mapping->doh_setattr) {
|
||||||
return (b->objinfo->doh_mapping->doh_setattr)(obj,name,value);
|
return (b->objinfo->doh_mapping->doh_setattr)(b,(DOH *) name,(DOH *) value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DohCheck(b)) {
|
if (DohCheck(b)) {
|
||||||
|
|
@ -461,12 +461,12 @@ DohSetattr(DOH *obj, DOH *name, DOH *value) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
DohDelattr(DOH *obj, DOH *name) {
|
DohDelattr(DOH *obj, const DOH *name) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohDelattr %x, %x\n",obj,name);
|
DohTrace(DOH_CALLS,"DohDelattr %x, %x\n",obj,name);
|
||||||
if (DohIsMapping(obj)) {
|
if (DohIsMapping(obj)) {
|
||||||
if (b->objinfo->doh_mapping->doh_delattr) {
|
if (b->objinfo->doh_mapping->doh_delattr) {
|
||||||
(b->objinfo->doh_mapping->doh_delattr)(obj,name);
|
(b->objinfo->doh_mapping->doh_delattr)(b,(DOH *) name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -530,10 +530,10 @@ DohNextkey(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohGetInt(DOH *obj, DOH *name) {
|
DohGetInt(DOH *obj, const DOH *name) {
|
||||||
DOH *val;
|
DOH *val;
|
||||||
DohTrace(DOH_CALLS,"DohGetInt %x, %x\n",obj,name);
|
DohTrace(DOH_CALLS,"DohGetInt %x, %x\n",obj,name);
|
||||||
val = Getattr(obj,name);
|
val = Getattr(obj,(DOH *) name);
|
||||||
if (!val) return 0;
|
if (!val) return 0;
|
||||||
if (DohIsString(val)) {
|
if (DohIsString(val)) {
|
||||||
return atoi(Data(val));
|
return atoi(Data(val));
|
||||||
|
|
@ -548,10 +548,10 @@ DohGetInt(DOH *obj, DOH *name) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
double
|
double
|
||||||
DohGetDouble(DOH *obj, DOH *name) {
|
DohGetDouble(DOH *obj, const DOH *name) {
|
||||||
DOH *val;
|
DOH *val;
|
||||||
DohTrace(DOH_CALLS,"DohGetDouble %x, %x\n",obj,name);
|
DohTrace(DOH_CALLS,"DohGetDouble %x, %x\n",obj,name);
|
||||||
val = Getattr(obj,name);
|
val = Getattr(obj,(DOH *) name);
|
||||||
if (!val) return 0;
|
if (!val) return 0;
|
||||||
if (DohIsString(val)) {
|
if (DohIsString(val)) {
|
||||||
return atof(Data(val));
|
return atof(Data(val));
|
||||||
|
|
@ -566,10 +566,10 @@ DohGetDouble(DOH *obj, DOH *name) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
DohGetChar(DOH *obj, DOH *name) {
|
DohGetChar(DOH *obj, const DOH *name) {
|
||||||
DOH *val;
|
DOH *val;
|
||||||
DohTrace(DOH_CALLS,"DohGetChar %x, %x\n",obj,name);
|
DohTrace(DOH_CALLS,"DohGetChar %x, %x\n",obj,name);
|
||||||
val = Getattr(obj,name);
|
val = Getattr(obj,(DOH *) name);
|
||||||
if (!val) return 0;
|
if (!val) return 0;
|
||||||
if (DohIsString(val)) {
|
if (DohIsString(val)) {
|
||||||
return (char *) Data(val);
|
return (char *) Data(val);
|
||||||
|
|
@ -584,12 +584,12 @@ DohGetChar(DOH *obj, DOH *name) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
DohSetInt(DOH *obj, DOH *name, int value) {
|
DohSetInt(DOH *obj, const DOH *name, int value) {
|
||||||
DOH *temp;
|
DOH *temp;
|
||||||
DohTrace(DOH_CALLS,"DohSetInt %x, %x, %d\n", obj, name, value);
|
DohTrace(DOH_CALLS,"DohSetInt %x, %x, %d\n", obj, name, value);
|
||||||
temp = NewString("");
|
temp = NewString("");
|
||||||
Printf(temp,"%d",value);
|
Printf(temp,"%d",value);
|
||||||
Setattr(obj,name,temp);
|
Setattr(obj,(DOH *) name,temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -599,12 +599,12 @@ DohSetInt(DOH *obj, DOH *name, int value) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
DohSetDouble(DOH *obj, DOH *name, double value) {
|
DohSetDouble(DOH *obj, const DOH *name, double value) {
|
||||||
DOH *temp;
|
DOH *temp;
|
||||||
DohTrace(DOH_CALLS,"DohSetDouble %x, %x, %g\n", obj, name, value);
|
DohTrace(DOH_CALLS,"DohSetDouble %x, %x, %g\n", obj, name, value);
|
||||||
temp = NewString("");
|
temp = NewString("");
|
||||||
Printf(temp,"%0.17f",value);
|
Printf(temp,"%0.17f",value);
|
||||||
Setattr(obj,name,temp);
|
Setattr(obj,(DOH *) name,temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -614,11 +614,11 @@ DohSetDouble(DOH *obj, DOH *name, double value) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
DohSetChar(DOH *obj, DOH *name, char *value) {
|
DohSetChar(DOH *obj, const DOH *name, char *value) {
|
||||||
DOH *temp;
|
DOH *temp;
|
||||||
DohTrace(DOH_CALLS,"DohSetChar %x, %x, %g\n", obj, name, value);
|
DohTrace(DOH_CALLS,"DohSetChar %x, %x, %g\n", obj, name, value);
|
||||||
temp = NewString(value);
|
temp = NewString(value);
|
||||||
Setattr(obj,name,temp);
|
Setattr(obj,(DOH *) name,temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|
@ -632,7 +632,7 @@ DohSetChar(DOH *obj, DOH *name, char *value) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsSequence(DOH *obj) {
|
DohIsSequence(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
if (b->objinfo->doh_sequence) return 1;
|
if (b->objinfo->doh_sequence) return 1;
|
||||||
|
|
@ -669,12 +669,12 @@ DohGetitem(DOH *obj, int index) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohSetitem(DOH *obj, int index, DOH *value) {
|
DohSetitem(DOH *obj, int index, const DOH *value) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohSetitem %x, %d, %x\n",obj,index, value);
|
DohTrace(DOH_CALLS,"DohSetitem %x, %d, %x\n",obj,index, value);
|
||||||
if (DohIsSequence(obj)) {
|
if (DohIsSequence(obj)) {
|
||||||
if (b->objinfo->doh_sequence->doh_setitem) {
|
if (b->objinfo->doh_sequence->doh_setitem) {
|
||||||
return (b->objinfo->doh_sequence->doh_setitem)(obj,index,value);
|
return (b->objinfo->doh_sequence->doh_setitem)(obj,index,(DOH *) value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
|
|
@ -713,13 +713,13 @@ DohDelitem(DOH *obj, int index) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohInsertitem(DOH *obj, int index, DOH *value) {
|
DohInsertitem(DOH *obj, int index, const DOH *value) {
|
||||||
int no = 0;
|
int no = 0;
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohInsertitem %x, %d, %x\n",obj,index, value);
|
DohTrace(DOH_CALLS,"DohInsertitem %x, %d, %x\n",obj,index, value);
|
||||||
if (DohIsSequence(obj)) {
|
if (DohIsSequence(obj)) {
|
||||||
if (b->objinfo->doh_sequence->doh_insitem) {
|
if (b->objinfo->doh_sequence->doh_insitem) {
|
||||||
return (b->objinfo->doh_sequence->doh_insitem)(obj,index,value);
|
return (b->objinfo->doh_sequence->doh_insitem)(obj,index,(DOH *) value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DohCheck(obj)) {
|
if (DohCheck(obj)) {
|
||||||
|
|
@ -786,7 +786,7 @@ DohNextitem(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsFile(DOH *obj) {
|
DohIsFile(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
if (b->objinfo->doh_file) return 1;
|
if (b->objinfo->doh_file) return 1;
|
||||||
|
|
@ -989,7 +989,7 @@ DohClose(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsString(DOH *obj) {
|
DohIsString(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
if (b->objinfo->doh_string) return 1;
|
if (b->objinfo->doh_string) return 1;
|
||||||
|
|
@ -1003,12 +1003,12 @@ DohIsString(DOH *obj) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohReplace(DOH *src, DOH *token, DOH *rep, int flags) {
|
DohReplace(DOH *src, const DOH *token, const DOH *rep, int flags) {
|
||||||
DohBase *b = (DohBase *) src;
|
DohBase *b = (DohBase *) src;
|
||||||
DohTrace(DOH_CALLS, "DohReplace %x\n", src);
|
DohTrace(DOH_CALLS, "DohReplace %x\n", src);
|
||||||
if (DohIsString(src)) {
|
if (DohIsString(src)) {
|
||||||
if (b->objinfo->doh_string->doh_replace) {
|
if (b->objinfo->doh_string->doh_replace) {
|
||||||
return (b->objinfo->doh_string->doh_replace)(src,token,rep,flags);
|
return (b->objinfo->doh_string->doh_replace)(src,(DOH *) token, (DOH *) rep,flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DohCheck(b)) {
|
if (DohCheck(b)) {
|
||||||
|
|
@ -1052,7 +1052,7 @@ DohChop(DOH *src) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsCallable(DOH *obj) {
|
DohIsCallable(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
if (b->objinfo->doh_callable) return 1;
|
if (b->objinfo->doh_callable) return 1;
|
||||||
|
|
|
||||||
|
|
@ -85,11 +85,11 @@ static DOH *encode(char *name, DOH *s) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohvPrintf(DOH *so, char *format, va_list ap)
|
DohvPrintf(DOH *so, const char *format, va_list ap)
|
||||||
{
|
{
|
||||||
static char *fmt_codes = "dioxXucsSfeEgGpn";
|
static char *fmt_codes = "dioxXucsSfeEgGpn";
|
||||||
int state = 0;
|
int state = 0;
|
||||||
char *p = format;
|
const char *p = format;
|
||||||
char newformat[256];
|
char newformat[256];
|
||||||
char obuffer[OBUFLEN];
|
char obuffer[OBUFLEN];
|
||||||
char *fmt = 0;
|
char *fmt = 0;
|
||||||
|
|
@ -376,7 +376,7 @@ DohvPrintf(DOH *so, char *format, va_list ap)
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohPrintf(DOH *obj, char *format, ...) {
|
DohPrintf(DOH *obj, const char *format, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int ret;
|
int ret;
|
||||||
va_start(ap,format);
|
va_start(ap,format);
|
||||||
|
|
|
||||||
|
|
@ -525,7 +525,7 @@ static DohObjInfo HashType = {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
Hash_check(DOH *so) {
|
Hash_check(const DOH *so) {
|
||||||
Hash *h = (Hash *) so;
|
Hash *h = (Hash *) so;
|
||||||
if (!h) return 0;
|
if (!h) return 0;
|
||||||
if (!DohCheck(so)) return 0;
|
if (!DohCheck(so)) return 0;
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ static DohObjInfo ListType = {
|
||||||
* Return 1 if an object is a List object.
|
* Return 1 if an object is a List object.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
int
|
int
|
||||||
List_check(DOH *lo) {
|
List_check(const DOH *lo) {
|
||||||
List *l = (List *) lo;
|
List *l = (List *) lo;
|
||||||
if (!l) return 0;
|
if (!l) return 0;
|
||||||
if (!DohCheck(lo)) return 0;
|
if (!DohCheck(lo)) return 0;
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ InitPools() {
|
||||||
* ---------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohCheck(DOH *ptr) {
|
DohCheck(const DOH *ptr) {
|
||||||
Pool *p = Pools;
|
Pool *p = Pools;
|
||||||
char *cptr = (char *) ptr;
|
char *cptr = (char *) ptr;
|
||||||
while (p) {
|
while (p) {
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ NewString(const DOH *so)
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
DOH *
|
DOH *
|
||||||
NewStringf(DOH *fmt, ...)
|
NewStringf(const DOH *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
DOH *r;
|
DOH *r;
|
||||||
|
|
@ -239,7 +239,7 @@ DelString(DOH *so) {
|
||||||
* int String_check(DOH *s) - Check if s is a string
|
* int String_check(DOH *s) - Check if s is a string
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
int
|
int
|
||||||
String_check(DOH *s)
|
String_check(const DOH *s)
|
||||||
{
|
{
|
||||||
char *c = (char *) s;
|
char *c = (char *) s;
|
||||||
if (!s) return 0;
|
if (!s) return 0;
|
||||||
|
|
|
||||||
|
|
@ -139,7 +139,7 @@ typedef struct DohObjInfo {
|
||||||
extern int DohObjFreeCheck(DOH *ptr); /* Check if already free */
|
extern int DohObjFreeCheck(DOH *ptr); /* Check if already free */
|
||||||
extern void DohInit(DOH *obj); /* Initialize an object */
|
extern void DohInit(DOH *obj); /* Initialize an object */
|
||||||
extern void DohXInit(DOH *obj); /* Initialize extended object */
|
extern void DohXInit(DOH *obj); /* Initialize extended object */
|
||||||
extern int DohCheck(DOH *ptr); /* Check if a DOH object */
|
extern int DohCheck(const DOH *ptr); /* Check if a DOH object */
|
||||||
extern int DohPoolSize(int); /* Set memory alloc size */
|
extern int DohPoolSize(int); /* Set memory alloc size */
|
||||||
extern int DohNewScope(); /* Create a new scope */
|
extern int DohNewScope(); /* Create a new scope */
|
||||||
extern void DohDelScope(int); /* Delete a scope */
|
extern void DohDelScope(int); /* Delete a scope */
|
||||||
|
|
@ -150,35 +150,35 @@ typedef struct DohObjInfo {
|
||||||
/* Basic object methods. Common to most objects */
|
/* Basic object methods. Common to most objects */
|
||||||
|
|
||||||
extern void DohDelete(DOH *obj); /* Delete an object */
|
extern void DohDelete(DOH *obj); /* Delete an object */
|
||||||
extern DOH *DohCopy(DOH *obj);
|
extern DOH *DohCopy(const DOH *obj);
|
||||||
extern void DohClear(DOH *obj);
|
extern void DohClear(DOH *obj);
|
||||||
extern void DohSetScope(DOH *, int scp); /* Set scope of object */
|
extern void DohSetScope(DOH *, int scp); /* Set scope of object */
|
||||||
extern DOH *DohStr(DOH *obj);
|
extern DOH *DohStr(const DOH *obj);
|
||||||
extern void *DohData(DOH *obj);
|
extern void *DohData(const DOH *obj);
|
||||||
extern int DohDump(DOH *obj, DOH *out);
|
extern int DohDump(const DOH *obj, DOH *out);
|
||||||
extern int DohLen(DOH *obj);
|
extern int DohLen(const DOH *obj);
|
||||||
extern int DohHashval(DOH *obj);
|
extern int DohHashval(const DOH *obj);
|
||||||
extern int DohCmp(DOH *obj1, DOH *obj2);
|
extern int DohCmp(const DOH *obj1, const DOH *obj2);
|
||||||
|
|
||||||
/* Mapping methods */
|
/* Mapping methods */
|
||||||
|
|
||||||
extern DOH *DohGetattr(DOH *obj, DOH *name);
|
extern DOH *DohGetattr(DOH *obj, const DOH *name);
|
||||||
extern int DohSetattr(DOH *obj, DOH *name, DOH *value);
|
extern int DohSetattr(DOH *obj, const DOH *name, const DOH *value);
|
||||||
extern void DohDelattr(DOH *obj, DOH *name);
|
extern void DohDelattr(DOH *obj, const DOH *name);
|
||||||
extern DOH *DohFirstkey(DOH *obj);
|
extern DOH *DohFirstkey(DOH *obj);
|
||||||
extern DOH *DohNextkey(DOH *obj);
|
extern DOH *DohNextkey(DOH *obj);
|
||||||
extern int DohGetInt(DOH *obj, DOH *name);
|
extern int DohGetInt(DOH *obj, const DOH *name);
|
||||||
extern double DohGetDouble(DOH *obj, DOH *name);
|
extern double DohGetDouble(DOH *obj, const DOH *name);
|
||||||
extern char *DohGetChar(DOH *obj, DOH *name);
|
extern char *DohGetChar(DOH *obj, const DOH *name);
|
||||||
extern void DohSetInt(DOH *obj, DOH *name, int);
|
extern void DohSetInt(DOH *obj, const DOH *name, int);
|
||||||
extern void DohSetDouble(DOH *obj, DOH *name, double);
|
extern void DohSetDouble(DOH *obj, const DOH *name, double);
|
||||||
|
|
||||||
/* Sequence methods */
|
/* Sequence methods */
|
||||||
|
|
||||||
extern DOH *DohGetitem(DOH *obj, int index);
|
extern DOH *DohGetitem(DOH *obj, int index);
|
||||||
extern int DohSetitem(DOH *obj, int index, DOH *value);
|
extern int DohSetitem(DOH *obj, int index, const DOH *value);
|
||||||
extern int DohDelitem(DOH *obj, int index);
|
extern int DohDelitem(DOH *obj, int index);
|
||||||
extern int DohInsertitem(DOH *obj, int index, DOH *value);
|
extern int DohInsertitem(DOH *obj, int index, const DOH *value);
|
||||||
extern DOH *DohFirstitem(DOH *obj);
|
extern DOH *DohFirstitem(DOH *obj);
|
||||||
extern DOH *DohNextitem(DOH *obj);
|
extern DOH *DohNextitem(DOH *obj);
|
||||||
|
|
||||||
|
|
@ -205,14 +205,14 @@ typedef struct DohObjInfo {
|
||||||
|
|
||||||
/* String Methods */
|
/* String Methods */
|
||||||
|
|
||||||
extern int DohReplace(DOH *src, DOH *token, DOH *rep, int flags);
|
extern int DohReplace(DOH *src, const DOH *token, const DOH *rep, int flags);
|
||||||
extern void DohChop(DOH *src);
|
extern void DohChop(DOH *src);
|
||||||
|
|
||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
|
|
||||||
extern void DohEncoding(char *name, DOH *(*fn)(DOH *s));
|
extern void DohEncoding(char *name, DOH *(*fn)(DOH *s));
|
||||||
extern int DohPrintf(DOH *obj, char *format, ...);
|
extern int DohPrintf(DOH *obj, const char *format, ...);
|
||||||
extern int DohvPrintf(DOH *obj, char *format, va_list ap);
|
extern int DohvPrintf(DOH *obj, const char *format, va_list ap);
|
||||||
extern DOH *DohReadline(DOH *in);
|
extern DOH *DohReadline(DOH *in);
|
||||||
|
|
||||||
/* Miscellaneous */
|
/* Miscellaneous */
|
||||||
|
|
@ -220,11 +220,11 @@ typedef struct DohObjInfo {
|
||||||
extern void DohTrace(int level, char *fmt,...);
|
extern void DohTrace(int level, char *fmt,...);
|
||||||
extern void DohDebug(int d);
|
extern void DohDebug(int d);
|
||||||
|
|
||||||
extern int DohIsMapping(DOH *obj);
|
extern int DohIsMapping(const DOH *obj);
|
||||||
extern int DohIsSequence(DOH *obj);
|
extern int DohIsSequence(const DOH *obj);
|
||||||
extern int DohIsString(DOH *obj);
|
extern int DohIsString(const DOH *obj);
|
||||||
extern int DohIsFile(DOH *obj);
|
extern int DohIsFile(const DOH *obj);
|
||||||
extern int DohIsCallable(DOH *obj);
|
extern int DohIsCallable(const DOH *obj);
|
||||||
|
|
||||||
#ifndef DOH_LONG_NAMES
|
#ifndef DOH_LONG_NAMES
|
||||||
/* Macros to invoke the above functions. Includes the location of
|
/* Macros to invoke the above functions. Includes the location of
|
||||||
|
|
@ -327,9 +327,9 @@ typedef struct {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
extern DOH *NewString(const DOH *c);
|
extern DOH *NewString(const DOH *c);
|
||||||
extern DOH *NewStringf(DOH *fmt, ...);
|
extern DOH *NewStringf(const DOH *fmt, ...);
|
||||||
|
|
||||||
extern int String_check(DOH *s);
|
extern int String_check(const DOH *s);
|
||||||
|
|
||||||
/* String replacement flags */
|
/* String replacement flags */
|
||||||
|
|
||||||
|
|
@ -354,7 +354,7 @@ extern int DohCopyto(DOH *input, DOH *output);
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
extern DOH *NewList();
|
extern DOH *NewList();
|
||||||
extern int List_check(DOH *);
|
extern int List_check(const DOH *);
|
||||||
extern void List_sort(DOH *);
|
extern void List_sort(DOH *);
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -362,7 +362,7 @@ extern void List_sort(DOH *);
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
extern DOH *NewHash();
|
extern DOH *NewHash();
|
||||||
extern int Hash_check(DOH *h);
|
extern int Hash_check(const DOH *h);
|
||||||
extern DOH *Hash_keys(DOH *);
|
extern DOH *Hash_keys(DOH *);
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue