本文整理汇总了C++中DohCheck函数的典型用法代码示例。如果您正苦于以下问题:C++ DohCheck函数的具体用法?C++ DohCheck怎么用?C++ DohCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DohCheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fputs
DOH *DohCopy(const DOH *obj) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (!obj)
return 0;
if (!DohCheck(b)) {
#if SWIG_DEBUG_DELETE
fputs("DOH: Fatal error. Attempt to copy a non-doh object.\n", stderr);
abort();
#else
assert(0);
#endif
return 0;
}
objinfo = b->type;
if (objinfo->doh_copy) {
DohBase *bc = (DohBase *) (objinfo->doh_copy) (b);
if ((bc) && b->meta) {
bc->meta = Copy(b->meta);
}
return (DOH *) bc;
}
return 0;
}
示例2: DohObjMalloc
DOHString *DohNewStringWithSize(const DOH *so, int len) {
int l = 0, max;
String *str;
char *s;
if (DohCheck(so)) {
s = (char *) String_data((String *) so);
} else {
s = (char *) so;
}
str = (String *) DohMalloc(sizeof(String));
str->hashkey = -1;
str->sp = 0;
str->line = 1;
str->file = 0;
max = INIT_MAXSIZE;
if (s) {
l = (int) len;
if ((l + 1) > max)
max = l + 1;
}
str->str = (char *) DohMalloc(max);
str->maxsize = max;
if (s) {
strncpy(str->str, s, len);
str->len = l;
str->sp = l;
} else {
str->str[0] = 0;
str->len = 0;
}
return DohObjMalloc(&DohStringType, str);
}
示例3: DohNewString
DOHString *
DohNewString(const DOH *so)
{
int l = 0, max;
String *str;
char *s;
if (DohCheck(so)) s = Char(so);
else s = (char *) so;
str = (String *) DohMalloc(sizeof(String));
str->hashkey = -1;
str->sp = 0;
str->line = 1;
str->file = 0;
max = INIT_MAXSIZE;
if (s) {
l = (int) strlen(s);
if ((l+1) > max) max = l+1;
}
str->str = (char *) DohMalloc(max);
str->maxsize = max;
if (s) {
strcpy(str->str,s);
str->len = l;
str->sp = l;
} else {
str->str[0] = 0;
str->len = 0;
}
return DohObjMalloc(&DohStringType,str);
}
示例4: List_insert
static int List_insert(DOH *lo, int pos, DOH *item) {
List *l = (List *) ObjData(lo);
int i;
if (!item)
return -1;
if (!DohCheck(item)) {
item = NewString(item);
Decref(item);
}
if (pos == DOH_END)
pos = l->nitems;
if (pos < 0)
pos = 0;
if (pos > l->nitems)
pos = l->nitems;
if (l->nitems == l->maxitems)
more(l);
for (i = l->nitems; i > pos; i--) {
l->items[i] = l->items[i - 1];
}
l->items[pos] = item;
Incref(item);
l->nitems++;
return 0;
}
示例5: DohSetmeta
int
DohSetmeta(DOH *ho, const DOH *name, const DOH *value) {
DohBase *h = (DohBase *) ho;
if (!DohCheck(ho)) return 0;
if (!h->meta) h->meta = NewHash();
return DohSetattr(h->meta, name, value);
}
示例6: DohDelmeta
int
DohDelmeta(DOH *ho, const DOH *name) {
DohBase *h = (DohBase *) ho;
if (!DohCheck(ho)) return 0;
if (!h->meta) return 0;
return DohDelattr(h->meta, name);
}
示例7: DohDelete
void DohDelete(DOH *obj) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (!obj)
return;
if (!DohCheck(b)) {
#if SWIG_DEBUG_DELETE
fputs("DOH: Fatal error. Attempt to delete a non-doh object.\n", stderr);
abort();
#else
assert(0);
#endif
return;
}
if (b->flag_intern)
return;
assert(b->refcount > 0);
b->refcount--;
if (b->refcount <= 0) {
objinfo = b->type;
if (objinfo->doh_del) {
(objinfo->doh_del) (b);
} else {
if (b->data)
DohFree(b->data);
}
DohObjFree(b);
}
}
示例8: DohIsString
int
DohIsString(const DOH *obj) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (!DohCheck(b)) return 0;
objinfo = b->type;
if (objinfo->doh_string) return 1;
else return 0;
}
示例9: DohIsSequence
int
DohIsSequence(const DOH *obj) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (!DohCheck(b)) return 0;
objinfo = b->type;
if (objinfo->doh_list) return 1;
else return 0;
}
示例10: DohCmp
int
DohCmp(const DOH *obj1, const DOH *obj2) {
DohBase *b1, *b2;
DohObjInfo *b1info, *b2info;
b1 = (DohBase *) obj1;
b2 = (DohBase *) obj2;
if ((!DohCheck(b1)) || (!DohCheck(b2))) {
if ((b1 == 0) && (b2 == 0)) return 0;
if (b1 && !b2) return 1;
if (!b1 && b2) return -1;
return strcmp((char *) DohData(b1),(char *) DohData(b2));
}
b1info = b1->type;
b2info = b2->type;
if ((b1info == b2info) && (b1info->doh_cmp))
return (b1info->doh_cmp)(b1,b2);
return 1;
}
示例11: DohSeek
int DohSeek(DOH *obj, long offset, int whence) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (DohCheck(obj)) {
objinfo = b->type;
if ((objinfo->doh_file) && (objinfo->doh_file->doh_seek)) {
return (objinfo->doh_file->doh_seek) (b, offset, whence);
}
return -1;
}
return fseek((FILE *) b, offset, whence);
}
示例12: DohTell
long DohTell(DOH *obj) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (DohCheck(obj)) {
objinfo = b->type;
if ((objinfo->doh_file) && (objinfo->doh_file->doh_tell)) {
return (objinfo->doh_file->doh_tell) (b);
}
return -1;
}
return ftell((FILE *) b);
}
示例13: DohUngetc
int DohUngetc(int ch, DOH *obj) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (DohCheck(obj)) {
objinfo = b->type;
if (objinfo->doh_file->doh_ungetc) {
return (objinfo->doh_file->doh_ungetc) (b, ch);
}
return EOF;
}
return ungetc(ch, (FILE *) b);
}
示例14: DohClose
int DohClose(DOH *obj) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (DohCheck(obj)) {
objinfo = b->type;
if (objinfo->doh_file->doh_close) {
return (objinfo->doh_file->doh_close) (b);
}
return 0;
}
return fclose((FILE *) obj);
}
示例15: DohHashval
int
DohHashval(const DOH *obj) {
DohBase *b = (DohBase *) obj;
DohObjInfo *objinfo;
if (DohCheck(b)) {
objinfo = b->type;
if (objinfo->doh_hashval) {
return (objinfo->doh_hashval)(b);
}
}
return 0;
}