str shutdownFactoryByName(Client cntxt, Module m, str nme){ Plant pl, plim; InstrPtr p; Symbol s; plim = plants + lastPlant; for (pl = plants; pl < plim; pl++) if (pl->factory ) { MalStkPtr stk; p= getInstrPtr(pl->factory,0); if( strcmp(nme, getFunctionId(p)) != 0) continue; s = findSymbolInModule(m, nme ); if (s == NULL){ throw(MAL, "factory.remove", OPERATION_FAILED " SQL entry '%s' not found", putName(nme)); } stk = pl->stk; MSresetVariables(cntxt, pl->factory, stk, 0); shutdownFactory(cntxt, pl->factory); freeStack(stk); deleteSymbol(m,s); return MAL_SUCCEED; } return MAL_SUCCEED; }
str FCTshutdown(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { str mod = *getArgReference_str(stk, pci, 1); str fcn = *getArgReference_str(stk, pci, 2); Symbol s; (void) mb; s = findSymbol(cntxt->nspace, putName(mod), putName(fcn)); if (s == NULL) throw(MAL, "factories.shutdown", RUNTIME_OBJECT_MISSING); shutdownFactory(cntxt,s->def); return MAL_SUCCEED; }