void load_library(const char *path) { __asm POP HL POP DE PCALL(LOADLIBRARY) PUSH DE PUSH HL __endasm; path; }
virtual ~CModPerl() { if (m_pPerl) { PSTART; PCALL("ZNC::Core::UnloadAll"); PEND; perl_destruct(m_pPerl); perl_free(m_pPerl); PERL_SYS_TERM(); } }
void free(void *ptr) { __asm POP HL EX (SP), IX PCALL(FREE) EX (SP), IX JP (HL) __endasm; ptr; }
CPerlTimer::~CPerlTimer() { CPerlModule* pMod = AsPerlModule(GetModule()); if (pMod) { PSTART; PUSH_STR(pMod->GetPerlID()); PUSH_STR(GetPerlID()); PCALL("ZNC::Core::RemoveTimer"); PEND; } }
void CPerlTimer::RunJob() { CPerlModule* pMod = AsPerlModule(GetModule()); if (pMod) { PSTART; PUSH_STR(pMod->GetPerlID()); PUSH_STR(GetPerlID()); PCALL("ZNC::Core::CallTimer"); PEND; } }
virtual EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule, bool& bSuccess, CString& sRetMsg) { PSTART; PUSH_STR(sModule); PCALL("ZNC::Core::GetModInfo"); EModRet result = CONTINUE; if (SvTRUE(ERRSV)) { bSuccess = false; sRetMsg = PString(ERRSV); } else if (0 < ret) { switch(static_cast<ELoadPerlMod>(SvUV(ST(0)))) { case Perl_NotFound: result = CONTINUE; break; case Perl_Loaded: result = HALT; if (3 == ret) { ModInfo.SetGlobal(false); ModInfo.SetDescription(PString(ST(2))); ModInfo.SetName(sModule); ModInfo.SetPath(PString(ST(1))); bSuccess = true; } else { bSuccess = false; sRetMsg = "Something weird happened"; } break; case Perl_LoadError: result = HALT; bSuccess = false; if (2 == ret) { sRetMsg = PString(ST(1)); } else { sRetMsg = "Something weird happened"; } } } else { result = HALT; bSuccess = false; sRetMsg = "Something weird happened"; } PEND; DEBUG(__PRETTY_FUNCTION__ << " " << sRetMsg); return result; }
ELoadPerlMod LoadPerlModule(const CString& sModule, const CString& sArgs, CUser* pUser, CString& sRetMsg) { ELoadPerlMod result = Perl_LoadError; PSTART; PUSH_STR(sModule); PUSH_STR(sArgs); PUSH_PTR(CUser*, pUser); PCALL("ZNC::Core::LoadModule"); if (SvTRUE(ERRSV)) { sRetMsg = PString(ERRSV); } else if (2 == ret) { result = static_cast<ELoadPerlMod>(SvUV(ST(0))); sRetMsg = PString(ST(1)); } DEBUG(__PRETTY_FUNCTION__ << " " << sRetMsg); PEND; return result; }
virtual EModRet OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) { CPerlModule* pMod = AsPerlModule(pModule); if (pMod) { CString sModName = pMod->GetModName(); PSTART; PUSH_PTR(CPerlModule*, pMod); PCALL("ZNC::Core::UnloadModule"); if (SvTRUE(ERRSV)) { bSuccess = false; sRetMsg = PString(ERRSV); } else { bSuccess = true; sRetMsg = "Module [" + sModName + "] unloaded"; } DEBUG(__PRETTY_FUNCTION__ << " " << sRetMsg); return HALT; } return CONTINUE; }
virtual EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule, bool& bSuccess, CString& sRetMsg) { PSTART; PUSH_STR(sModule); PUSH_PTR(CModInfo*, &ModInfo); PCALL("ZNC::Core::GetModInfo"); EModRet result = CONTINUE; if (SvTRUE(ERRSV)) { bSuccess = false; sRetMsg = PString(ERRSV); } else if (0 < ret) { switch(static_cast<ELoadPerlMod>(SvUV(ST(0)))) { case Perl_NotFound: result = CONTINUE; break; case Perl_Loaded: result = HALT; if (1 == ret) { bSuccess = true; } else { bSuccess = false; sRetMsg = "Something weird happened"; } break; case Perl_LoadError: result = HALT; bSuccess = false; if (2 == ret) { sRetMsg = PString(ST(1)); } else { sRetMsg = "Something weird happened"; } } } else { result = HALT; bSuccess = false; sRetMsg = "Something weird happened"; } PEND; return result; }