New functions GetFlag and SetFlag
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7561 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
fff590d2e5
commit
0c71a1f3ba
2 changed files with 31 additions and 2 deletions
|
|
@ -372,6 +372,21 @@ DohGetChar(DOH *obj, const DOH *name) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DohGetFlag()
|
||||
* A flag is unset if the attribute (name) does not exist on the node (obj),
|
||||
* or it is set to "0". If the attribute is set to any other value, the flag is set.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
DohGetFlag(DOH *obj, const DOH *name) {
|
||||
DOH *val;
|
||||
val = Getattr(obj,(DOH *) name);
|
||||
if (!val) return 0;
|
||||
return (Strcmp(val, "0") != 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DohGetVoid()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -417,6 +432,15 @@ DohSetChar(DOH *obj, const DOH *name, char *value) {
|
|||
Setattr(obj,(DOH *) name,NewString(value));
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DohSetFlag()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
DohSetFlag(DOH *obj, const DOH *name) {
|
||||
Setattr(obj,(DOH *) name,NewString("1"));
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* DohSetVoid()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
|
|||
|
|
@ -188,10 +188,13 @@ extern int DohSetattr(DOH *obj, const DOHString_or_char *name, const D
|
|||
extern int DohDelattr(DOH *obj, const DOHString_or_char *name);
|
||||
extern DOH *DohKeys(DOH *obj);
|
||||
extern int DohGetInt(DOH *obj, const DOHString_or_char *name);
|
||||
extern double DohGetDouble(DOH *obj, const DOHString_or_char *name);
|
||||
extern char *DohGetChar(DOH *obj, const DOHString_or_char *name);
|
||||
extern void DohSetInt(DOH *obj, const DOHString_or_char *name, int);
|
||||
extern double DohGetDouble(DOH *obj, const DOHString_or_char *name);
|
||||
extern void DohSetDouble(DOH *obj, const DOHString_or_char *name, double);
|
||||
extern char *DohGetChar(DOH *obj, const DOHString_or_char *name);
|
||||
extern void DohSetChar(DOH *obj, const DOH *name, char *value);
|
||||
extern int DohGetFlag(DOH *obj, const DOHString_or_char *name);
|
||||
extern void DohSetFlag(DOH *obj, const DOHString_or_char *name);
|
||||
extern void *DohGetVoid(DOH *obj, const DOHString_or_char *name);
|
||||
extern void DohSetVoid(DOH *obj, const DOHString_or_char *name, void *value);
|
||||
|
||||
|
|
@ -356,10 +359,12 @@ extern void DohMemoryDebug(void);
|
|||
#define GetDouble DohGetDouble
|
||||
#define GetChar DohGetChar
|
||||
#define GetVoid DohGetVoid
|
||||
#define GetFlag DohGetFlag
|
||||
#define SetInt DohSetInt
|
||||
#define SetDouble DohSetDouble
|
||||
#define SetChar DohSetattr
|
||||
#define SetVoid DohSetVoid
|
||||
#define SetFlag DohSetFlag
|
||||
#define Readline DohReadline
|
||||
#define Replace DohReplace
|
||||
#define Chop DohChop
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue