2 typedef struct __locale_struct {
9 typedef struct _IO_FILE FILE;
18 _IO_cookie_io_functions_t;
19 extern struct _IO_FILE *stderr;
20 extern int fprintf (FILE *__restrict __stream, __const char *__restrict __format, ...);
23 kPOVMSObjectClassID = 'OCLA', kPOVMSMessageClassID = 'MCLA', kPOVMSMessageIdentID = 'MIDE', kPOVMSSourceAddressID = 'MSRC', kPOVMSDestinationAddressID = 'MDST', kPOVMSMessageTimeoutID = 'TOUT', kPOVMSMessageErrorID = 'MERR' };
24 typedef void * POVMSContext;
25 typedef struct POVMSData POVMSObject, *POVMSObjectPtr;
26 typedef struct POVMSData POVMSAttribute, *POVMSAttributePtr;
27 typedef struct POVMSData POVMSAttributeList, *POVMSAttributeListPtr;
32 struct POVMSNode *root;
36 struct POVMSNode *next;
38 struct POVMSData data;
40 int POVMSObject_Set (POVMSObjectPtr object, POVMSAttributePtr attr, unsigned int key);
41 int POVMSAttr_Copy (POVMSAttributePtr sourceattr, POVMSAttributePtr destattr);
42 int POVMSUtil_GetType (POVMSObjectPtr object, unsigned int key, unsigned int *typevalue);
45 kNoError = 0, kNoErr = kNoError, kParamErr = -1, kMemFullErr = -2, kOutOfMemoryErr = kMemFullErr, kInvalidDataSizeErr = -3, kCannotHandleDataErr = -4, kNullPointerErr = -5, kChecksumErr = -6, kParseErr = -7, kCannotOpenFileErr = -8, kInvalidDestAddrErr = -9, kCannotConnectErr = -10, kDisconnectedErr = -11, kHostDisconnectedErr = -12, kNetworkDataErr = -13, kNetworkConnectionErr = -14, kObjectAccessErr = -15, kVersionErr = -16, kFileDataErr = -17, kAuthorisationErr = -18, kDataTypeErr = -19, kTimeoutErr = -20, kInvalidContextErr = -21 };
47 using namespace pov_base;
48 struct POVMSContextData {
50 int POVMS_AssertFunction (int cond, const char *str, const char *filename, int line);
51 int POVMS_OpenContext(POVMSContext *contextrefptr) {
52 POVMSContextData *context = __null;
53 if(contextrefptr == __null) return kParamErr;
54 if(POVMS_AssertFunction(context != __null, "POVMS_Open_Context failed, out of memory", "povms.cpp", 283) == false) return kMemFullErr;
57 int POVMS_AssertFunction(int cond, const char *str, const char *filename, int line) {
59 fprintf(stderr, "POVMS_ASSERT failed in %s line %d: %s\n", filename, (int)line, str);
62 int POVMSObject_Copy(POVMSObjectPtr sourceobject, POVMSObjectPtr destobject) {
63 POVMSNode *cur = __null;
67 if(destobject == __null) return kParamErr;
68 if(POVMSUtil_GetType(sourceobject, kPOVMSObjectClassID, &t1) != kNoErr) return kObjectAccessErr;
69 if(POVMSUtil_GetType(sourceobject, kPOVMSObjectClassID, &t2) != kNoErr) return kObjectAccessErr;
70 if(t1 != t2) return kDataTypeErr;
71 for(cur = sourceobject->root;
74 if(POVMS_AssertFunction(POVMSAttr_Copy(&(cur->data), &attr) == kNoErr, "POVMSObject_Merge failed, out of memory", "povms.cpp", 2084) == false) {
76 if(POVMS_AssertFunction(POVMSObject_Set(destobject, &attr, cur->key) == kNoErr, "POVMSObject_Merge failed, out of memory", "povms.cpp", 2090) == false) {
81 int POVMSObject_Set(POVMSObjectPtr object, POVMSAttributePtr attr, unsigned int key) {
83 int POVMSAttrList_Copy(POVMSAttributeListPtr sourcelist, POVMSAttributeListPtr destlist) {
86 if(sourcelist == __null) return kParamErr;
87 if(destlist == __null) return kParamErr;
88 if(sourcelist == destlist) return kParamErr;
89 if(sourcelist->size < 0) return kParamErr;
90 if(sourcelist->size > 0) {
91 if(sourcelist->ptr != __null) {
92 if(POVMS_AssertFunction(destlist->ptr != __null, "POVMSAttrList_Copy failed, out of memory", "povms.cpp", 3020) == false) return -1;
95 cnt < sourcelist->size;