/** * get predicate entry for ap/arity; create it if neccessary * * @param[in] at * * @return module descriptorxs */ static ModEntry *GetModuleEntry(Atom at USES_REGS) { Prop p0; AtomEntry *ae = RepAtom(at); READ_LOCK(ae->ARWLock); p0 = ae->PropsOfAE; while (p0) { ModEntry *me = RepModProp(p0); if (me->KindOfPE == ModProperty) { READ_UNLOCK(ae->ARWLock); return me; } p0 = me->NextOfPE; } READ_UNLOCK(ae->ARWLock); return initMod( (CurrentModule == PROLOG_MODULE ? NULL : AtomOfTerm(CurrentModule)), at); }
void Mind::execAdmin(ircEvent event, std::string &data) { moduleMap::iterator it; std::string msg, cmd, tmp; std::string target; User u; if (event == PRIVMSG) { msg = data.substr(msg.find(":") + 2); msg = msg.substr(msg.find(":") + 1); Utils::eraseCRLF(msg); Utils::trim(msg); cmd = Utils::getToken(msg, " ", 1); if (cmd == "") cmd = msg; target = Utils::getToken(data, " ", 3); if (target[0] != '#' && target[0] != '&') { u = irc::makeUser(data); target = u.getNick(); } if (cmd == ".load") { tmp = Utils::getToken(msg, " ", 2); if (loadMod(tmp)) _irc->privmsg(target, "Module successfully loaded."); else _irc->privmsg(target, "Unable to load module. Please check log file for further information."); try { initMod(tmp); } catch (Exception &e) { _irc->privmsg(target, "Error: Cannot init module. Unloading..."); unloadMod(tmp); } } else if (cmd == ".unload") { tmp = Utils::getToken(msg, " ", 2); if (unloadMod(tmp)) _irc->privmsg(target, "Module successfully unloaded."); else _irc->privmsg(target, "Unable to unload module. Please check log file for further information."); } else if (cmd == ".reload") { tmp = Utils::getToken(msg, " ", 2); if (!unloadMod(tmp)) _irc->privmsg(target, "Unable to reload module. Please check log file for further information."); if (loadMod(tmp)) { try { initMod(tmp); } catch (Exception &e) { _irc->privmsg(target, "Error: Cannot init module. Unloading..."); unloadMod(tmp); } _irc->privmsg(target, "Module successfully reloaded."); } else _irc->privmsg(target, "Unable to reload module. Please check log file for further information."); } else if (cmd == ".rehash") { rehash(); } else if (cmd == ".die") { std::string msg = "Ciao!"; _irc->quit(msg); exit(0); } } }
void CChewALMONDDlg::OnBnClickedButton1() { initMod(); }