} static object * lib_repr(amigalibobject *ao) { char buf[300]; sprintf(buf, "<amiga library '%.256s', V %ld.%ld, base %lx, at %lx>", ao->libbase->lib_Node.ln_Name, ao->libbase->lib_Version, ao->libbase->lib_Revision, ao->libbase,(long)ao); return newstringobject(buf); } static typeobject Amigalibtype = { OB_HEAD_INIT(&Typetype) 0, /*ob_size*/ "amigalib", /*tp_name*/ sizeof(amigalibobject), /*tp_size*/ 0, /*tp_itemsize*/ /* methods */ (destructor)lib_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)lib_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ (reprfunc)lib_repr, /*tp_repr*/ };
last_exception = ob; } void print_exception() { if (last_exception != NULL) { printobj(last_exception, stderr); } fprintf(stderr, "\n"); } void clear_exception() { last_exception = NULL; } EmTypeObject Exceptiontype = { OB_HEAD_INIT(&Typetype), // set type and refcnt to 1 0, // nitems "exception", // tp_name sizeof(EmExceptionObject), // tp_size 0, // tp_itemsize exceptionobject_free, // tp_dealloc exceptionobject_print, // tp_print 0, // tp_tostr 0, // tp_getattr 0, // tp_setattr exceptionobject_compare, // tp_compare 0, // tp_hashfunc exceptionobject_boolean, // tp_boolean 0, // tp_as_number
#endif #ifndef LONG_BIT #define LONG_BIT (CHAR_BIT * sizeof(long)) #endif long getmaxint() { return LONG_MAX; /* To initialize sys.maxint */ } /* Standard Booleans */ intobject FalseObject = { OB_HEAD_INIT(&Inttype) 0 }; intobject TrueObject = { OB_HEAD_INIT(&Inttype) 1 }; static object * err_ovf(msg) char *msg; { err_setstr(OverflowError, msg); return NULL; }