Added DohChop

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@92 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-01-13 20:53:38 +00:00
commit c53e05e028
2 changed files with 18 additions and 1 deletions

View file

@ -831,6 +831,21 @@ int DohReplace(DOH *src, DOH *token, DOH *rep, int flags) {
return 0;
}
void DohChop(DOH *src) {
DohBase *b = (DohBase *) src;
DohError(DOH_CALLS, "DohChop %x\n", src);
if (DohIsString(src)) {
if (b->objinfo->doh_string->doh_chop) {
(b->objinfo->doh_string->doh_chop)(src);
}
}
if (DohCheck(b)) {
DohError(DOH_UNSUPPORTED, "No chop method defined for type '%s'\n", b->objinfo->objname);
} else {
DohError(DOH_UNKNOWN,"Unknown object %x passed to Chop\n", b);
}
}
/* -----------------------------------------------------------------------------
* Callable methods
* ----------------------------------------------------------------------------- */

View file

@ -84,6 +84,7 @@ typedef struct {
/* String methods */
typedef struct {
int (*doh_replace)(DOH *obj, DOH *old, DOH *rep, int flags);
void (*doh_chop)(DOH *obj);
} DohStringMethods;
/* Callable */
@ -205,6 +206,7 @@ extern void DohEncoding(char *name, DOH *(*fn)(DOH *s));
extern int DohPrintf(DOH *obj, char *format, ...);
extern int DohvPrintf(DOH *obj, char *format, va_list ap);
extern int DohReplace(DOH *src, DOH *token, DOH *rep, int flags);
extern void DohChop(DOH *src);
extern DOH *DohReadline(DOH *in);
extern DOH *DohCall(DOH *obj, DOH *args);
@ -259,6 +261,7 @@ extern DOH *DohCall(DOH *obj, DOH *args);
#define Nextitem DohNextitem
#define Readline DohReadline
#define Replace DohReplace
#define Chop DohChop
#define NewScope DohNewScope
#define DelScope DohDelScope
#define Call DohCall
@ -307,7 +310,6 @@ typedef struct {
extern DOH *NewString(char *c);
extern int String_check(DOH *s);
extern void String_chop(DOH *s);
/* String replacement flags */