(DohGetInt, DohGetDouble): Cast args to atoi()' and atof()'
to `char *', respectively. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@439 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
250b280a50
commit
0deaef77eb
1 changed files with 67 additions and 67 deletions
|
|
@ -1,13 +1,13 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* base.c
|
* base.c
|
||||||
*
|
*
|
||||||
* This file contains the function entry points for dispatching methods on
|
* This file contains the function entry points for dispatching methods on
|
||||||
* DOH objects. A number of small utility functions are also included.
|
* DOH objects. A number of small utility functions are also included.
|
||||||
*
|
*
|
||||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2000. The University of Chicago
|
* Copyright (C) 1999-2000. The University of Chicago
|
||||||
* See the file LICENSE for information on usage and redistribution.
|
* See the file LICENSE for information on usage and redistribution.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static char cvsroot[] = "$Header$";
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
@ -79,7 +79,7 @@ DohDebug(int d) {
|
||||||
* destructor if the reference count is zero after the decrement.
|
* destructor if the reference count is zero after the decrement.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
DohDelete(DOH *obj) {
|
DohDelete(DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohDelete %x\n",obj);
|
DohTrace(DOH_CALLS,"DohDelete %x\n",obj);
|
||||||
|
|
@ -88,13 +88,13 @@ DohDelete(DOH *obj) {
|
||||||
if (b->flags & DOH_FLAG_INTERN) return;
|
if (b->flags & DOH_FLAG_INTERN) return;
|
||||||
b->refcount--;
|
b->refcount--;
|
||||||
if (b->refcount <= 0) {
|
if (b->refcount <= 0) {
|
||||||
if (b->objinfo->doh_del) (b->objinfo->doh_del)(obj);
|
if (b->objinfo->doh_del) (b->objinfo->doh_del)(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohIntern()
|
* DohIntern()
|
||||||
*
|
*
|
||||||
* Flips the intern bit on an object forcing it to be never be garbage collected.
|
* Flips the intern bit on an object forcing it to be never be garbage collected.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -150,14 +150,14 @@ DohClear(DOH *obj) {
|
||||||
* DohStr()
|
* DohStr()
|
||||||
*
|
*
|
||||||
* Create a string representation of an object. If the object has no str method
|
* Create a string representation of an object. If the object has no str method
|
||||||
* a generic representation of the form <Object 'name' at %x> is created.
|
* a generic representation of the form <Object 'name' at %x> is created.
|
||||||
* Non-DOH objects are assumed to
|
* Non-DOH objects are assumed to
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
DOH *
|
DOH *
|
||||||
DohStr(const 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);
|
||||||
if (DohCheck(b)) {
|
if (DohCheck(b)) {
|
||||||
if (b->objinfo->doh_str) {
|
if (b->objinfo->doh_str) {
|
||||||
|
|
@ -239,7 +239,7 @@ DohHashval(const DOH *obj) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohData()
|
* DohData()
|
||||||
*
|
*
|
||||||
* Return pointer to the raw data stored inside an object (when applicable).
|
* Return pointer to the raw data stored inside an object (when applicable).
|
||||||
|
|
@ -268,7 +268,7 @@ DohData(const DOH *obj) {
|
||||||
* Return the line number associated with an object or -1 if unspecified.
|
* Return the line number associated with an object or -1 if unspecified.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohGetline(DOH *obj) {
|
DohGetline(DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohGetline %x\n",obj);
|
DohTrace(DOH_CALLS,"DohGetline %x\n",obj);
|
||||||
|
|
@ -286,11 +286,11 @@ DohGetline(DOH *obj) {
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohSetLine()
|
* DohSetLine()
|
||||||
*
|
*
|
||||||
* Set the line number associated with an object.
|
* Set the line number associated with an object.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
DohSetline(DOH *obj, int line) {
|
DohSetline(DOH *obj, int line) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohSetline %x, %d\n",obj, line);
|
DohTrace(DOH_CALLS,"DohSetline %x, %d\n",obj, line);
|
||||||
|
|
@ -307,7 +307,7 @@ DohSetline(DOH *obj, int line) {
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohGetfile()
|
* DohGetfile()
|
||||||
*
|
*
|
||||||
* Get the file associated with an object.
|
* Get the file associated with an object.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@ DohSetfile(DOH *obj, DOH *file) {
|
||||||
* Compare two objects. If either of the objects are non-DOH objects, the
|
* Compare two objects. If either of the objects are non-DOH objects, the
|
||||||
* objects are compared using strcmp().
|
* objects are compared using strcmp().
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohCmp(const DOH *obj1, const DOH *obj2) {
|
DohCmp(const DOH *obj1, const DOH *obj2) {
|
||||||
DohBase *b1, *b2;
|
DohBase *b1, *b2;
|
||||||
|
|
@ -371,7 +371,7 @@ DohCmp(const DOH *obj1, const DOH *obj2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
* Mapping Interface
|
* Mapping Interface
|
||||||
* ---------------------------------------------------------------------- */
|
* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -380,7 +380,7 @@ DohCmp(const DOH *obj1, const DOH *obj2) {
|
||||||
* Return 1 if an object defines a mapping interface.
|
* Return 1 if an object defines a mapping interface.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsMapping(const DOH *obj) {
|
DohIsMapping(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
|
|
@ -404,20 +404,20 @@ DohGetattr(DOH *obj, const DOH *name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DohCheck(b)) {
|
if (DohCheck(b)) {
|
||||||
DohTrace(DOH_UNSUPPORTED,"No getattr method defined for type '%s'\n", b->objinfo->objname);
|
DohTrace(DOH_UNSUPPORTED,"No getattr method defined for type '%s'\n", b->objinfo->objname);
|
||||||
} else {
|
} else {
|
||||||
DohTrace(DOH_UNKNOWN,"Unknown object %x passed to Getattr.\n", obj);
|
DohTrace(DOH_UNKNOWN,"Unknown object %x passed to Getattr.\n", obj);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohSetattr()
|
* DohSetattr()
|
||||||
*
|
*
|
||||||
* Set an attribute in a mapping object.
|
* Set an attribute in a mapping object.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohSetattr(DOH *obj, const DOH *name, const 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);
|
||||||
|
|
@ -509,15 +509,15 @@ DohNextkey(DOH *obj) {
|
||||||
* Return an element as an integer.
|
* Return an element as an integer.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohGetInt(DOH *obj, const 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,(DOH *) 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((char *) Data(val));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -530,30 +530,30 @@ DohGetInt(DOH *obj, const DOH *name) {
|
||||||
double
|
double
|
||||||
DohGetDouble(DOH *obj, const 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,(DOH *) 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((char *) Data(val));
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohGetChar()
|
* DohGetChar()
|
||||||
*
|
*
|
||||||
* Return an element as a char *
|
* Return an element as a char *
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
DohGetChar(DOH *obj, const 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,(DOH *) 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);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -566,7 +566,7 @@ DohGetChar(DOH *obj, const DOH *name) {
|
||||||
void *
|
void *
|
||||||
DohGetVoid(DOH *obj, const DOH *name) {
|
DohGetVoid(DOH *obj, const DOH *name) {
|
||||||
DOH *val;
|
DOH *val;
|
||||||
DohTrace(DOH_CALLS,"DohGetVoid %x, %x\n",obj,name);
|
DohTrace(DOH_CALLS,"DohGetVoid %x, %x\n",obj,name);
|
||||||
val = Getattr(obj,(DOH *) name);
|
val = Getattr(obj,(DOH *) name);
|
||||||
if (!val) return 0;
|
if (!val) return 0;
|
||||||
return (void *) Data(val);
|
return (void *) Data(val);
|
||||||
|
|
@ -587,7 +587,7 @@ DohSetInt(DOH *obj, const DOH *name, int value) {
|
||||||
Setattr(obj,(DOH *) name,temp);
|
Setattr(obj,(DOH *) name,temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohSetDouble()
|
* DohSetDouble()
|
||||||
*
|
*
|
||||||
* Set an attribute as a double
|
* Set an attribute as a double
|
||||||
|
|
@ -640,7 +640,7 @@ DohSetVoid(DOH *obj, const DOH *name, void *value) {
|
||||||
* Return 1 if an object supports sequence methods.
|
* Return 1 if an object supports sequence methods.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsSequence(const DOH *obj) {
|
DohIsSequence(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
|
|
@ -657,7 +657,7 @@ DohIsSequence(const DOH *obj) {
|
||||||
DOH *
|
DOH *
|
||||||
DohGetitem(DOH *obj, int index) {
|
DohGetitem(DOH *obj, int index) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohGetitem %x, %d\n",obj,index);
|
DohTrace(DOH_CALLS,"DohGetitem %x, %d\n",obj,index);
|
||||||
if (DohIsSequence(obj)) {
|
if (DohIsSequence(obj)) {
|
||||||
if (b->objinfo->doh_sequence->doh_getitem) {
|
if (b->objinfo->doh_sequence->doh_getitem) {
|
||||||
return (b->objinfo->doh_sequence->doh_getitem)(obj,index);
|
return (b->objinfo->doh_sequence->doh_getitem)(obj,index);
|
||||||
|
|
@ -676,11 +676,11 @@ DohGetitem(DOH *obj, int index) {
|
||||||
*
|
*
|
||||||
* Set an item in a sequence.
|
* Set an item in a sequence.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohSetitem(DOH *obj, int index, const 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,(DOH *) value);
|
return (b->objinfo->doh_sequence->doh_setitem)(obj,index,(DOH *) value);
|
||||||
|
|
@ -695,11 +695,11 @@ DohSetitem(DOH *obj, int index, const DOH *value) {
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohDelitem()
|
* DohDelitem()
|
||||||
*
|
*
|
||||||
* Delete an item in a sequence.
|
* Delete an item in a sequence.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohDelitem(DOH *obj, int index) {
|
DohDelitem(DOH *obj, int index) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohDelitem %x, %d\n",obj,index);
|
DohTrace(DOH_CALLS,"DohDelitem %x, %d\n",obj,index);
|
||||||
|
|
@ -715,13 +715,13 @@ DohDelitem(DOH *obj, int index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohInsertitem()
|
* DohInsertitem()
|
||||||
*
|
*
|
||||||
* Insert an item into a sequence.
|
* Insert an item into a sequence.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohInsertitem(DOH *obj, int index, const DOH *value) {
|
DohInsertitem(DOH *obj, int index, const DOH *value) {
|
||||||
int no = 0;
|
int no = 0;
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
|
|
@ -738,7 +738,7 @@ DohInsertitem(DOH *obj, int index, const DOH *value) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohFirstitem()
|
* DohFirstitem()
|
||||||
*
|
*
|
||||||
* Get the first item in a sequence
|
* Get the first item in a sequence
|
||||||
|
|
@ -761,7 +761,7 @@ DohFirstitem(DOH *obj) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohNextitem()
|
* DohNextitem()
|
||||||
*
|
*
|
||||||
* Get the next item in a sequence.
|
* Get the next item in a sequence.
|
||||||
|
|
@ -785,7 +785,7 @@ DohNextitem(DOH *obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* File methods
|
* File methods
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -794,7 +794,7 @@ DohNextitem(DOH *obj) {
|
||||||
* Return 1 if an object supports file methods.
|
* Return 1 if an object supports file methods.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsFile(const DOH *obj) {
|
DohIsFile(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
|
|
@ -808,7 +808,7 @@ DohIsFile(const DOH *obj) {
|
||||||
* Read bytes from an object. Implicitly converts to a FILE *.
|
* Read bytes from an object. Implicitly converts to a FILE *.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohRead(DOH *obj, void *buffer, int length) {
|
DohRead(DOH *obj, void *buffer, int length) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohRead %x, %x, %d\n",obj,buffer,length);
|
DohTrace(DOH_CALLS,"DohRead %x, %x, %d\n",obj,buffer,length);
|
||||||
|
|
@ -825,13 +825,13 @@ DohRead(DOH *obj, void *buffer, int length) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohWrite()
|
* DohWrite()
|
||||||
*
|
*
|
||||||
* Write bytes to an object. Implicitly converts to a FILE *
|
* Write bytes to an object. Implicitly converts to a FILE *
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohWrite(DOH *obj, void *buffer, int length) {
|
DohWrite(DOH *obj, void *buffer, int length) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohWrite %x, %x, %d\n",obj,buffer,length);
|
DohTrace(DOH_CALLS,"DohWrite %x, %x, %d\n",obj,buffer,length);
|
||||||
|
|
@ -855,7 +855,7 @@ DohWrite(DOH *obj, void *buffer, int length) {
|
||||||
* Seek to a new position.
|
* Seek to a new position.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohSeek(DOH *obj, long offset, int whence) {
|
DohSeek(DOH *obj, long offset, int whence) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohSeek %x, %d, %d\n",obj,offset,whence);
|
DohTrace(DOH_CALLS,"DohSeek %x, %d, %d\n",obj,offset,whence);
|
||||||
|
|
@ -878,7 +878,7 @@ DohSeek(DOH *obj, long offset, int whence) {
|
||||||
* Return current file pointer.
|
* Return current file pointer.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
long
|
long
|
||||||
DohTell(DOH *obj) {
|
DohTell(DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohTell %x\n",obj);
|
DohTrace(DOH_CALLS,"DohTell %x\n",obj);
|
||||||
|
|
@ -895,13 +895,13 @@ DohTell(DOH *obj) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohGetc()
|
* DohGetc()
|
||||||
*
|
*
|
||||||
* Return a character
|
* Return a character
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohGetc(DOH *obj) {
|
DohGetc(DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohGetc %x\n",obj);
|
DohTrace(DOH_CALLS,"DohGetc %x\n",obj);
|
||||||
|
|
@ -924,7 +924,7 @@ DohGetc(DOH *obj) {
|
||||||
* Put a character.
|
* Put a character.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohPutc(int ch, DOH *obj) {
|
DohPutc(int ch, DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohPutc '%c',%x\n",ch,obj);
|
DohTrace(DOH_CALLS,"DohPutc '%c',%x\n",ch,obj);
|
||||||
|
|
@ -947,7 +947,7 @@ DohPutc(int ch, DOH *obj) {
|
||||||
* Put a character back on the input stream.
|
* Put a character back on the input stream.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohUngetc(int ch, DOH *obj) {
|
DohUngetc(int ch, DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohUngetc '%c',%x\n",ch,obj);
|
DohTrace(DOH_CALLS,"DohUngetc '%c',%x\n",ch,obj);
|
||||||
|
|
@ -955,7 +955,7 @@ DohUngetc(int ch, DOH *obj) {
|
||||||
if (b->objinfo->doh_file->doh_ungetc) {
|
if (b->objinfo->doh_file->doh_ungetc) {
|
||||||
return (b->objinfo->doh_file->doh_ungetc)(obj,ch);
|
return (b->objinfo->doh_file->doh_ungetc)(obj,ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!DohCheck(b)) {
|
if (!DohCheck(b)) {
|
||||||
DohTrace(DOH_CONVERSION,"Unknown object %x converted to FILE * in DohUngetc\n",b);
|
DohTrace(DOH_CONVERSION,"Unknown object %x converted to FILE * in DohUngetc\n",b);
|
||||||
return ungetc(ch,(FILE *) b);
|
return ungetc(ch,(FILE *) b);
|
||||||
|
|
@ -970,7 +970,7 @@ DohUngetc(int ch, DOH *obj) {
|
||||||
* Close a file object.
|
* Close a file object.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohClose(DOH *obj) {
|
DohClose(DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohClose %x\n",obj);
|
DohTrace(DOH_CALLS,"DohClose %x\n",obj);
|
||||||
|
|
@ -997,7 +997,7 @@ DohClose(DOH *obj) {
|
||||||
* Return 1 if an object supports string methods.
|
* Return 1 if an object supports string methods.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsString(const DOH *obj) {
|
DohIsString(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
|
|
@ -1011,7 +1011,7 @@ DohIsString(const DOH *obj) {
|
||||||
* Perform string replacement.
|
* Perform string replacement.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohReplace(DOH *src, const DOH *token, const 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);
|
||||||
|
|
@ -1034,7 +1034,7 @@ DohReplace(DOH *src, const DOH *token, const DOH *rep, int flags) {
|
||||||
* Chop whitespace at the end of a string.
|
* Chop whitespace at the end of a string.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
DohChop(DOH *src) {
|
DohChop(DOH *src) {
|
||||||
DohBase *b = (DohBase *) src;
|
DohBase *b = (DohBase *) src;
|
||||||
DohTrace(DOH_CALLS, "DohChop %x\n", src);
|
DohTrace(DOH_CALLS, "DohChop %x\n", src);
|
||||||
|
|
@ -1060,7 +1060,7 @@ DohChop(DOH *src) {
|
||||||
* Return 1 if an object supports callable methods.
|
* Return 1 if an object supports callable methods.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int
|
||||||
DohIsCallable(const DOH *obj) {
|
DohIsCallable(const DOH *obj) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
if (!DohCheck(b)) return 0;
|
if (!DohCheck(b)) return 0;
|
||||||
|
|
@ -1077,7 +1077,7 @@ DohIsCallable(const DOH *obj) {
|
||||||
|
|
||||||
DOH *
|
DOH *
|
||||||
DohCall(DOH *obj, DOH *args) {
|
DohCall(DOH *obj, DOH *args) {
|
||||||
DohBase *b = (DohBase *) obj;
|
DohBase *b = (DohBase *) obj;
|
||||||
DohTrace(DOH_CALLS,"DohCall %x\n",obj);
|
DohTrace(DOH_CALLS,"DohCall %x\n",obj);
|
||||||
if (DohCheck(b)) {
|
if (DohCheck(b)) {
|
||||||
if ((b->objinfo->doh_callable) && (b->objinfo->doh_callable->doh_call)) {
|
if ((b->objinfo->doh_callable) && (b->objinfo->doh_callable->doh_call)) {
|
||||||
|
|
@ -1087,13 +1087,13 @@ DohCall(DOH *obj, DOH *args) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohInit()
|
* DohInit()
|
||||||
*
|
*
|
||||||
* Initialize an object.
|
* Initialize an object.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
DohInit(DOH *b) {
|
DohInit(DOH *b) {
|
||||||
DohBase *bs = (DohBase *) b;
|
DohBase *bs = (DohBase *) b;
|
||||||
bs->refcount = 1;
|
bs->refcount = 1;
|
||||||
|
|
@ -1127,7 +1127,7 @@ DohXBase_getfile(DOH *ho) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohXBase_setline()
|
* DohXBase_setline()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
DohXBase_setline(DOH *ho, int l) {
|
DohXBase_setline(DOH *ho, int l) {
|
||||||
DohXBase *h = (DohXBase *) ho;
|
DohXBase *h = (DohXBase *) ho;
|
||||||
h->line = l;
|
h->line = l;
|
||||||
|
|
@ -1136,7 +1136,7 @@ DohXBase_setline(DOH *ho, int l) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* DohXBase_getline()
|
* DohXBase_getline()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
int
|
int
|
||||||
DohXBase_getline(DOH *ho) {
|
DohXBase_getline(DOH *ho) {
|
||||||
DohXBase *h = (DohXBase *) ho;
|
DohXBase *h = (DohXBase *) ho;
|
||||||
return h->line;
|
return h->line;
|
||||||
|
|
@ -1154,7 +1154,7 @@ static DohPositionalMethods XBasePositionalMethods = {
|
||||||
*
|
*
|
||||||
* Initialize an extended object.
|
* Initialize an extended object.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
DohXInit(DOH *b) {
|
DohXInit(DOH *b) {
|
||||||
DohXBase *bs = (DohXBase *) b;
|
DohXBase *bs = (DohXBase *) b;
|
||||||
bs->file = 0;
|
bs->file = 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue