/******************************************************************************* 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. *******************************************************************************/ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* NOTE the following restictions for this data type when */ /* the SDT Validator is to be used. These restrictions do */ /* not apply to Simulations or Applications. */ /* */ /* 1. The PId_Lit operators may only be applied to process */ /* types with the number of instances (N, N), where N>0. */ /* 2. No process type with the number of instances equal to */ /* (N, N), where N>0, may contain any Stop symbol. */ /* */ /* If you violate any of these rules the behavior of the SDT */ /* Validator is undefined. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ SYNONYM EnvPId Pid = #code('xEnv'); NEWTYPE xPrsIdNode /*#NAME 'xPrsIdNode'*/ LITERALS Dummy; /*#ADT(TA(S)E(S)R(S)W(S)D(H)) */ ENDNEWTYPE; SYNTYPE PIdListIndex = Integer constants 1:10 ENDSYNTYPE; NEWTYPE PIdList Array(PIdListIndex, Pid) ADDING OPERATORS PId_Lit /*#NAME 'PId_Lit1'*/ : xPrsIdNode -> Pid; PId_Lit /*#NAME 'PId_Lit2'*/ : xPrsIdNode, Integer -> Pid; PId_Lit /*#NAME 'PId_Lit3'*/ : xPrsIdNode -> PIdList; /*#ADT(TA(S)E(S)D(H)R(S)W(S)K(H)X(H)M(H)HP) #TYPE typedef SDL_PId * #(PIdList); #HEADING extern SDL_PId PId_Lit1 XPP(( xPrsIdNode PNode )); extern SDL_PId PId_Lit2 XPP(( xPrsIdNode PNode, SDL_Integer InstNr )); extern #(PIdList) PId_Lit3 XPP(( xPrsIdNode PNode )); #define yExtr_#(PIdList)(v,i) v[i] #BODY #ifndef XVALIDATOR #ifdef xFirstActivePrs #undef xFirstActivePrs #endif #define xFirstActivePrs(PNode) (*PNode->ActivePrsList) #ifdef xNextActivePrs #undef xNextActivePrs #endif #define xNextActivePrs(P) P->NextPrs #endif #ifdef XRTOSTIME ERROR: This version of pidlist.pr only works with Light Integrations. Please instead use the pidlist.pr found in the .../RTOS/SDL directory. #endif #ifndef XNOPROTO extern SDL_PId PId_Lit1 ( xPrsIdNode PNode ) #else extern SDL_PId PId_Lit1 ( PNode ) xPrsIdNode PNode; #endif { #ifdef XOPERRORF if ( PNode == (xPrsIdNode)0 ) { xSDLOpError("PId_Lit (1) in sort PIdList", "IdNode parameter is 0"); return SDL_NULL; } if ( PNode->EC != xProcessEC ) { xSDLOpError("PId_Lit (1) in sort PIdList", "IdNode parameter does not represent process"); return SDL_NULL; } if ( xFirstActivePrs(PNode) == (xPrsNode)0 ) { xSDLOpError("PId_Lit (1) in sort PIdList", "No active instance of process"); return SDL_NULL; } if ( xNextActivePrs(xFirstActivePrs(PNode)) != (xPrsNode)0 ) { xSDLOpError("PId_Lit (1) in sort PIdList", "Several active instances of process"); } #endif return xFirstActivePrs(PNode)->Self; } #ifndef XNOPROTO extern SDL_PId PId_Lit2 ( xPrsIdNode PNode, SDL_Integer InstNr ) #else extern SDL_PId PId_Lit2 ( PNode, InstNr ) xPrsIdNode PNode; SDL_Integer InstNr; #endif { xPrsNode P; SDL_Integer I; #ifdef XOPERRORF if ( PNode == (xPrsIdNode)0 ) { xSDLOpError("PId_Lit (2) in sort PIdList", "IdNode parameter is 0"); return SDL_NULL; } if ( PNode->EC != xProcessEC ) { xSDLOpError("PId_Lit (2) in sort PIdList", "IdNode parameter does not represent process"); return SDL_NULL; } #endif I = 0; for ( P = xFirstActivePrs(PNode); P != (xPrsNode)0; P = xNextActivePrs(P) ) I++; #ifdef XOPERRORF if ( InstNr > I || InstNr < 1 ) { xSDLOpError("PId_Lit (2) in sort PIdList", "Illegal instance number"); return SDL_NULL; } #endif I = I-InstNr; P = xFirstActivePrs(PNode); while ( I-- > 0 ) P = xNextActivePrs(P); return P->Self; } #ifndef XNOPROTO extern #(PIdList) PId_Lit3 ( xPrsIdNode PNode ) #else extern #(PIdList) PId_Lit3 ( PNode ) xPrsIdNode PNode; #endif { xPrsNode P; SDL_Integer I; #(PIdList) Result; #ifdef XOPERRORF if ( PNode == (xPrsIdNode)0 ) { xSDLOpError("PId_Lit (3) in sort PIdList", "IdNode parameter is 0"); return (#(PIdList))0; } if ( PNode->EC != xProcessEC ) { xSDLOpError("PId_Lit (3) in sort PIdList", "IdNode parameter does not represent process"); return (#(PIdList))0; } if ( xFirstActivePrs(PNode) == (xPrsNode)0 ) { xSDLOpError("PId_Lit (3) in sort PIdList", "No active instance of process"); return (#(PIdList))0; } #endif I = 0; for ( P = xFirstActivePrs(PNode); P != (xPrsNode)0; P = xNextActivePrs(P) ) I++; #ifdef XPIDLIT_FROM_ZERO Result = (#(PIdList))xAlloc((xptrint)(I*sizeof(SDL_PId))); for ( P = xFirstActivePrs(PNode); P != (xPrsNode)0; P = xNextActivePrs(P)) Result[--I] = P->Self; #else Result = (#(PIdList))xAlloc((xptrint)((I+1)*sizeof(SDL_PId))); for ( P = xFirstActivePrs(PNode); P != (xPrsNode)0; P = xNextActivePrs(P) ) Result[I--] = P->Self; #endif return Result; } */ ENDNEWTYPE PIdList;