// Free an ARexx message void LIBFUNC L_FreeRexxMsgEx(REG(a0, struct RexxMsg *msg)) { short args; // Need rexx library if (!RexxSysBase) return; // Get argument count args=msg->rm_Action&RXARGMASK; // If this says there are no arguments, but Arg0 is non-null, we'll free it anyway if (args==0 && msg->rm_Args[0]) args=1; // Free all arguments ClearRexxMsg(msg,args); // Is this a DOpus message? if (msg->rm_Node.mn_Node.ln_Name==RexxMsgIdentifier) { struct List *list; // Get list pointer if ((list=(struct List *)msg->rm_avail)) { struct RexxStem *node,*next; // Go through list for (node=(struct RexxStem *)list->lh_Head; node->rs_Node.ln_Succ; node=next) { // Cache next next=(struct RexxStem *)node->rs_Node.ln_Succ; // Free this node FreeVec(node); } // Free list FreeVec(list); } } // Delete the message DeleteRexxMsg(msg); }
void arexx_cleanup(void) { if (arexx_port) { RemPort(arexx_port); DeleteMsgPort(arexx_port); } while (arexx_execute_out) { struct RexxMsg *rxmsg; WaitPort(arexx_execute_port); while ((rxmsg = (struct RexxMsg *)GetMsg(arexx_execute_port))) { arexx_execute_out--; ClearRexxMsg(rxmsg,1); DeleteRexxMsg(rxmsg); } } if (arexx_execute_port) DeleteMsgPort(arexx_execute_port); }