/******************************************************************************* Copyright by Telesoft Europe AB 1990, 1991. Copyright by Telelogic Malmoe AB 1991, 1992, 1993, 1994. Copyright by Telelogic AB 1994 - 1998. This Program is owned by Telelogic and is protected by national copyright laws and international copyright treaties. Telelogic grants you the right to use this Program on one computer or in one local computer network at any one time. Under this License you may only modify the source code for the purpose of adapting it to your environment. You must reproduce and include any copyright and trademark notices on all copies of the source code. You may not use, copy, merge, modify or transfer the Program except as provided in this License. Telelogic does not warrant that the Program will meet your requirements or that the operation of the Program will be uninterrupted and error free. You are solely responsible that the selection of the Program and the modification of the source code will achieve your intended results and that the results are actually obtained. *******************************************************************************/ newtype ObjectInstance /*#NAME 'ObjectInstance'*/ literals Null /*#NAME 'ObjectInstanceNull'*/, NewObject /*#NAME 'NewObject'*/ ; operators refmodify! : ObjectInstance, ObjectDescr -> ObjectInstance; refextract! : ObjectInstance -> ObjectDescr; DisposeObject /*#NAME 'DisposeObject'*/ : ObjectInstance -> ObjectInstance; default Null; /*#ADT(TA(S)E(S)R(S)W(H)D(H)X HP) #TYPE typedef ObjectDescr * ObjectInstance; #define yDef_ObjectInstance(yVar) *(yVar) = (ObjectInstance)0 static ObjectInstance xAvailObjectInstance = (ObjectInstance)0; #define ObjectInstanceNull() (ObjectInstance)0 #define yAddr_ObjectInstance(a,b) (* a) #define yExtr_ObjectInstance(a,b) (* a) #define yExtr_ObjectDescr(a,b) a.b #HEADING #ifdef XREADANDWRITEF extern char * yWri_ObjectInstance XPP((void * Value)); #endif extern ObjectInstance NewObject XPP((void)); extern ObjectInstance DisposeObject XPP((ObjectInstance Object)); #BODY #ifdef XREADANDWRITEF #ifndef XNOPROTO char * yWri_ObjectInstance (void * Value) #else char * yWri_ObjectInstance (Value) void * Value; #endif { static WriteBuf *buf = 0; if ( *(void * *)Value == (void *)0 ) return "Null"; if (!buf) buf = WriteBuf_New(100); else WriteBuf_Clear(buf); xGenericWriteSort(buf, *(void **)Value, (tSDLTypeInfo *)&ySDL_ObjectDescr); return WriteBuf_Data(buf); } #endif #ifndef XNOPROTO ObjectInstance NewObject (void) #else ObjectInstance NewObject () #endif { ObjectInstance Temp; #ifdef XTRACE if ( xShouldBeTraced(xListTraceLevel, (xPrsNode)0) ) xPrintString(" NewObject\n"); #endif if ( xAvailObjectInstance != (ObjectInstance)0 ) { Temp = xAvailObjectInstance; xAvailObjectInstance = (ObjectInstance)Temp->#(SysVar).#(Suc); } else { Temp = (ObjectInstance)xAlloc((xptrint)sizeof(ObjectDescr)); Temp->#(SysVar).#(Pre) = (Queue)0; } Temp->#(SysVar).#(Suc) = (Queue)0; Temp->#(SysVar).#(TypeOfObject) = xOI; return Temp; } #ifndef XNOPROTO ObjectInstance DisposeObject (ObjectInstance Object) #else ObjectInstance DisposeObject (Object) ObjectInstance Object; #endif { #ifdef XTRACE if ( xShouldBeTraced(xListTraceLevel, (xPrsNode)0) ) xPrintString(" DisposeObject\n"); #endif #ifdef XOPERRORF if ( Object==(ObjectInstance)0 ) { xSDLOpError("DisposeObject in sort ObjectInstance", "ObjectInstance parameter is Null"); return (ObjectInstance)0; } #endif if ( Object->#(SysVar).#(Pre) != (Queue)0 ) { ((ObjectDescr *)(Object->#(SysVar).#(Suc)))->#(SysVar).#(Pre) = Object->#(SysVar).#(Pre); ((ObjectDescr *)(Object->#(SysVar).#(Pre)))->#(SysVar).#(Suc) = Object->#(SysVar).#(Suc); Object->#(SysVar).#(Pre) = (Queue)0; } Object->#(SysVar).#(TypeOfObject) = xInAvail; Object->#(SysVar).#(Suc) = (Queue)xAvailObjectInstance; xAvailObjectInstance = Object; return (ObjectInstance)0; } */ endnewtype ObjectInstance;