/* * This file was generated automatically by xsubpp version 1.9508 from the * contents of Themes.xs. Do not edit this file, edit Themes.xs instead. * * ANY CHANGES MADE HERE WILL BE LOST! * */ #line 1 "Themes.xs" #include "module.h" static void printformat_perl(TEXT_DEST_REC *dest, char *format, char **arglist) { char *module; int formatnum; module = g_strdup(perl_get_package()); formatnum = format_find_tag(module, format); if (formatnum < 0) { die("printformat(): unregistered format '%s'", format); g_free(module); return; } printformat_module_dest_charargs(module, dest, formatnum, arglist); g_free(module); } static void perl_unregister_theme(const char *package) { FORMAT_REC *formats; int n; formats = g_hash_table_lookup(default_formats, package); if (formats == NULL) return; for (n = 0; formats[n].def != NULL; n++) { g_free(formats[n].tag); g_free(formats[n].def); } g_free(formats); theme_unregister_module(package); } static void sig_script_destroyed(PERL_SCRIPT_REC *script) { perl_unregister_theme(script->package); } void perl_themes_init(void) { signal_add("script destroyed", (SIGNAL_FUNC) sig_script_destroyed); } void perl_themes_deinit(void) { signal_remove("script destroyed", (SIGNAL_FUNC) sig_script_destroyed); } #line 61 "Themes.c" XS(XS_Irssi_current_theme); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi_current_theme) { dXSARGS; if (items != 0) Perl_croak(aTHX_ "Usage: Irssi::current_theme()"); { Irssi__UI__Theme RETVAL; #line 57 "Themes.xs" RETVAL = current_theme; #line 73 "Themes.c" ST(0) = plain_bless(RETVAL, "Irssi::UI::Theme"); sv_2mortal(ST(0)); } XSRETURN(1); } XS(XS_Irssi_EXPAND_FLAG_IGNORE_REPLACES); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi_EXPAND_FLAG_IGNORE_REPLACES) { dXSARGS; if (items != 0) Perl_croak(aTHX_ "Usage: Irssi::EXPAND_FLAG_IGNORE_REPLACES()"); { int RETVAL; dXSTARG; #line 64 "Themes.xs" RETVAL = EXPAND_FLAG_IGNORE_REPLACES; #line 93 "Themes.c" XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); } XS(XS_Irssi_EXPAND_FLAG_IGNORE_EMPTY); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi_EXPAND_FLAG_IGNORE_EMPTY) { dXSARGS; if (items != 0) Perl_croak(aTHX_ "Usage: Irssi::EXPAND_FLAG_IGNORE_EMPTY()"); { int RETVAL; dXSTARG; #line 71 "Themes.xs" RETVAL = EXPAND_FLAG_IGNORE_EMPTY; #line 111 "Themes.c" XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); } XS(XS_Irssi_EXPAND_FLAG_RECURSIVE_MASK); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi_EXPAND_FLAG_RECURSIVE_MASK) { dXSARGS; if (items != 0) Perl_croak(aTHX_ "Usage: Irssi::EXPAND_FLAG_RECURSIVE_MASK()"); { int RETVAL; dXSTARG; #line 78 "Themes.xs" RETVAL = EXPAND_FLAG_RECURSIVE_MASK; #line 129 "Themes.c" XSprePUSH; PUSHi((IV)RETVAL); } XSRETURN(1); } XS(XS_Irssi_theme_register); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi_theme_register) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Irssi::theme_register(formats)"); { SV * formats = ST(0); #line 86 "Themes.xs" AV *av; FORMAT_REC *formatrecs; char *key, *value; int len, n, fpos; #line 149 "Themes.c" #line 92 "Themes.xs" if (!SvROK(formats)) croak("formats is not a reference to list"); av = (AV *) SvRV(formats); len = av_len(av)+1; if (len == 0 || (len & 1) != 0) croak("formats list is invalid - not divisible by 2 (%d)", len); formatrecs = g_new0(FORMAT_REC, len/2+2); formatrecs[0].tag = g_strdup(perl_get_package()); formatrecs[0].def = g_strdup("Perl script"); for (fpos = 1, n = 0; n < len; n++, fpos++) { key = SvPV(*av_fetch(av, n, 0), PL_na); n++; value = SvPV(*av_fetch(av, n, 0), PL_na); formatrecs[fpos].tag = g_strdup(key); formatrecs[fpos].def = g_strdup(value); formatrecs[fpos].params = MAX_FORMAT_PARAMS; } theme_register_module(perl_get_package(), formatrecs); #line 172 "Themes.c" } XSRETURN_EMPTY; } XS(XS_Irssi_printformat); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi_printformat) { dXSARGS; if (items < 2) Perl_croak(aTHX_ "Usage: Irssi::printformat(level, format, ...)"); { int level = (int)SvIV(ST(0)); char * format = (char *)SvPV_nolen(ST(1)); #line 119 "Themes.xs" TEXT_DEST_REC dest; char *arglist[MAX_FORMAT_PARAMS+1]; int n; #line 191 "Themes.c" #line 123 "Themes.xs" format_create_dest(&dest, NULL, NULL, level, NULL); memset(arglist, 0, sizeof(arglist)); for (n = 2; n < items && n < MAX_FORMAT_PARAMS+2; n++) { arglist[n-2] = SvPV(ST(n), PL_na); } printformat_perl(&dest, format, arglist); #line 200 "Themes.c" } XSRETURN_EMPTY; } XS(XS_Irssi_abstracts_register); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi_abstracts_register) { dXSARGS; if (items != 1) Perl_croak(aTHX_ "Usage: Irssi::abstracts_register(abstracts)"); { SV * abstracts = ST(0); #line 135 "Themes.xs" AV *av; char *key, *value; int i, len; #line 218 "Themes.c" #line 139 "Themes.xs" if (!SvROK(abstracts)) croak("abstracts is not a reference to list"); av = (AV *) SvRV(abstracts); len = av_len(av)+1; if (len == 0 || (len & 1) != 0) croak("abstracts list is invalid - not divisible by 2 (%d)", len); for (i = 0; i < len; i++) { key = SvPV(*av_fetch(av, i, 0), PL_na); i++; value = SvPV(*av_fetch(av, i, 0), PL_na); theme_set_default_abstract(key, value); } themes_reload(); #line 234 "Themes.c" } XSRETURN_EMPTY; } XS(XS_Irssi_themes_reload); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi_themes_reload) { dXSARGS; if (items != 0) Perl_croak(aTHX_ "Usage: Irssi::themes_reload()"); { themes_reload(); } XSRETURN_EMPTY; } XS(XS_Irssi__Server_printformat); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi__Server_printformat) { dXSARGS; if (items < 4) Perl_croak(aTHX_ "Usage: Irssi::Server::printformat(server, target, level, format, ...)"); { Irssi__Server server = irssi_ref_object(ST(0)); char * target = (char *)SvPV_nolen(ST(1)); int level = (int)SvIV(ST(2)); char * format = (char *)SvPV_nolen(ST(3)); #line 168 "Themes.xs" TEXT_DEST_REC dest; char *arglist[MAX_FORMAT_PARAMS+1]; int n; #line 269 "Themes.c" #line 172 "Themes.xs" format_create_dest(&dest, server, target, level, NULL); memset(arglist, 0, sizeof(arglist)); for (n = 4; n < items && n < MAX_FORMAT_PARAMS+4; n++) { arglist[n-4] = SvPV(ST(n), PL_na); } printformat_perl(&dest, format, arglist); #line 278 "Themes.c" } XSRETURN_EMPTY; } XS(XS_Irssi__UI__Window_printformat); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi__UI__Window_printformat) { dXSARGS; if (items < 3) Perl_croak(aTHX_ "Usage: Irssi::UI::Window::printformat(window, level, format, ...)"); { Irssi__UI__Window window = irssi_ref_object(ST(0)); int level = (int)SvIV(ST(1)); char * format = (char *)SvPV_nolen(ST(2)); #line 190 "Themes.xs" TEXT_DEST_REC dest; char *arglist[MAX_FORMAT_PARAMS+1]; int n; #line 298 "Themes.c" #line 194 "Themes.xs" format_create_dest(&dest, NULL, NULL, level, window); memset(arglist, 0, sizeof(arglist)); for (n = 3; n < items && n < MAX_FORMAT_PARAMS+3; n++) { arglist[n-3] = SvPV(ST(n), PL_na); } printformat_perl(&dest, format, arglist); #line 307 "Themes.c" } XSRETURN_EMPTY; } XS(XS_Irssi__Windowitem_printformat); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi__Windowitem_printformat) { dXSARGS; if (items < 3) Perl_croak(aTHX_ "Usage: Irssi::Windowitem::printformat(item, level, format, ...)"); { Irssi__Windowitem item = irssi_ref_object(ST(0)); int level = (int)SvIV(ST(1)); char * format = (char *)SvPV_nolen(ST(2)); #line 212 "Themes.xs" TEXT_DEST_REC dest; char *arglist[MAX_FORMAT_PARAMS+1]; int n; #line 327 "Themes.c" #line 216 "Themes.xs" format_create_dest(&dest, item->server, item->visible_name, level, NULL); memset(arglist, 0, sizeof(arglist)); for (n = 3; n < items && n < MAX_FORMAT_PARAMS+3; n++) { arglist[n-3] = SvPV(ST(n), PL_na); } printformat_perl(&dest, format, arglist); #line 336 "Themes.c" } XSRETURN_EMPTY; } XS(XS_Irssi__UI__Theme_format_expand); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi__UI__Theme_format_expand) { dXSARGS; if (items < 2 || items > 3) Perl_croak(aTHX_ "Usage: Irssi::UI::Theme::format_expand(theme, format, flags=0)"); SP -= items; { Irssi__UI__Theme theme = irssi_ref_object(ST(0)); char * format = (char *)SvPV_nolen(ST(1)); int flags; #line 234 "Themes.xs" char *ret; #line 355 "Themes.c" if (items < 3) flags = 0; else { flags = (int)SvIV(ST(2)); } #line 236 "Themes.xs" if (flags == 0) { ret = theme_format_expand(theme, format); } else { ret = theme_format_expand_data(theme, (const char **) &format, 'n', 'n', NULL, NULL, EXPAND_FLAG_ROOT | flags); } XPUSHs(sv_2mortal(new_pv(ret))); g_free_not_null(ret); #line 371 "Themes.c" PUTBACK; return; } } XS(XS_Irssi__UI__Theme_get_format); /* prototype to pass -Wmissing-prototypes */ XS(XS_Irssi__UI__Theme_get_format) { dXSARGS; if (items != 3) Perl_croak(aTHX_ "Usage: Irssi::UI::Theme::get_format(theme, module, tag)"); { Irssi__UI__Theme theme = irssi_ref_object(ST(0)); char * module = (char *)SvPV_nolen(ST(1)); char * tag = (char *)SvPV_nolen(ST(2)); #line 251 "Themes.xs" MODULE_THEME_REC *modtheme; FORMAT_REC *formats; int i; #line 392 "Themes.c" char * RETVAL; dXSTARG; #line 255 "Themes.xs" formats = g_hash_table_lookup(default_formats, module); if (formats == NULL) croak("Unknown module: %s", module); for (i = 0; formats[i].def != NULL; i++) { if (formats[i].tag != NULL && g_strcasecmp(formats[i].tag, tag) == 0) break; } if (formats[i].def == NULL) croak("Unknown format tag: %s", tag); modtheme = g_hash_table_lookup(theme->modules, module); RETVAL = modtheme == NULL ? NULL : modtheme->formats[i]; if (RETVAL == NULL) RETVAL = formats[i].def; #line 413 "Themes.c" sv_setpv(TARG, RETVAL); XSprePUSH; PUSHTARG; } XSRETURN(1); } #ifdef __cplusplus extern "C" #endif XS(boot_Irssi__UI__Themes); /* prototype to pass -Wmissing-prototypes */ XS(boot_Irssi__UI__Themes) { dXSARGS; char* file = __FILE__; XS_VERSION_BOOTCHECK ; newXSproto("Irssi::current_theme", XS_Irssi_current_theme, file, ""); newXSproto("Irssi::EXPAND_FLAG_IGNORE_REPLACES", XS_Irssi_EXPAND_FLAG_IGNORE_REPLACES, file, ""); newXSproto("Irssi::EXPAND_FLAG_IGNORE_EMPTY", XS_Irssi_EXPAND_FLAG_IGNORE_EMPTY, file, ""); newXSproto("Irssi::EXPAND_FLAG_RECURSIVE_MASK", XS_Irssi_EXPAND_FLAG_RECURSIVE_MASK, file, ""); newXSproto("Irssi::theme_register", XS_Irssi_theme_register, file, "$"); newXSproto("Irssi::printformat", XS_Irssi_printformat, file, "$$;@"); newXSproto("Irssi::abstracts_register", XS_Irssi_abstracts_register, file, "$"); newXSproto("Irssi::themes_reload", XS_Irssi_themes_reload, file, ""); newXSproto("Irssi::Server::printformat", XS_Irssi__Server_printformat, file, "$$$$;@"); newXSproto("Irssi::UI::Window::printformat", XS_Irssi__UI__Window_printformat, file, "$$$;@"); newXSproto("Irssi::Windowitem::printformat", XS_Irssi__Windowitem_printformat, file, "$$$;@"); newXSproto("Irssi::UI::Theme::format_expand", XS_Irssi__UI__Theme_format_expand, file, "$$;$"); newXSproto("Irssi::UI::Theme::get_format", XS_Irssi__UI__Theme_get_format, file, "$$$"); XSRETURN_YES; }