/*
 * This file was generated automatically by ExtUtils::ParseXS version 3.45 from the
 * contents of TextUI.xs. Do not edit this file, edit TextUI.xs instead.
 *
 *    ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "TextUI.xs"
#define PERL_NO_GET_CONTEXT
#include "module.h"
#include "wrapper_buffer_line.h"

void perl_statusbar_init(void);
void perl_statusbar_deinit(void);

static int initialized = FALSE;

static SV *buffer_line_bless(TEXT_BUFFER_REC *buffer, LINE_REC *line)
{
	return perl_buffer_line_bless(perl_wrap_buffer_line(buffer, line));
}

static void perl_main_window_fill_hash(HV *hv, MAIN_WINDOW_REC *window)
{
	(void) hv_store(hv, "active", 6, plain_bless(window->active, "Irssi::UI::Window"), 0);

	(void) hv_store(hv, "first_line", 10, newSViv(window->first_line), 0);
	(void) hv_store(hv, "last_line", 9, newSViv(window->last_line), 0);
	(void) hv_store(hv, "width", 5, newSViv(window->width), 0);
	(void) hv_store(hv, "height", 6, newSViv(window->height), 0);

	(void) hv_store(hv, "statusbar_lines", 15, newSViv(window->statusbar_lines), 0);
}

static void perl_text_buffer_fill_hash(HV *hv, TEXT_BUFFER_REC *buffer)
{
	(void) hv_store(hv, "first_line", 10, buffer_line_bless(buffer, buffer->first_line), 0);
	(void) hv_store(hv, "lines_count", 11, newSViv(buffer->lines_count), 0);
	(void) hv_store(hv, "cur_line", 8, buffer_line_bless(buffer, buffer->cur_line), 0);
	(void) hv_store(hv, "last_eol", 8, newSViv(buffer->last_eol), 0);
}

static void perl_text_buffer_view_fill_hash(HV *hv, TEXT_BUFFER_VIEW_REC *view)
{
	(void) hv_store(hv, "buffer", 6, plain_bless(view->buffer, "Irssi::TextUI::TextBuffer"), 0);
	(void) hv_store(hv, "width", 5, newSViv(view->width), 0);
	(void) hv_store(hv, "height", 6, newSViv(view->height), 0);

	(void) hv_store(hv, "default_indent", 14, newSViv(view->default_indent), 0);
	(void) hv_store(hv, "longword_noindent", 17, newSViv(view->longword_noindent), 0);
	(void) hv_store(hv, "scroll", 6, newSViv(view->scroll), 0);

	(void) hv_store(hv, "ypos", 4, newSViv(view->ypos), 0);

	(void) hv_store(hv, "startline", 9, buffer_line_bless(view->buffer, view->startline), 0);
	(void) hv_store(hv, "subline", 7, newSViv(view->subline), 0);
	(void) hv_store(hv, "hidden_level", 12, newSViv(view->hidden_level), 0);

	(void) hv_store(hv, "bottom_startline", 16,
	                buffer_line_bless(view->buffer, view->bottom_startline), 0);
	(void) hv_store(hv, "bottom_subline", 14, newSViv(view->bottom_subline), 0);

	(void) hv_store(hv, "empty_linecount", 15, newSViv(view->empty_linecount), 0);
	(void) hv_store(hv, "bottom", 6, newSViv(view->bottom), 0);
}

static void perl_line_fill_hash(HV *hv, struct Buffer_Line_Wrapper *line)
{
	(void) hv_store(hv, "info", 4, plain_bless(&Line(line)->info, "Irssi::TextUI::LineInfo"),
	                0);
}

static void perl_line_cache_fill_hash(HV *hv, LINE_CACHE_REC *cache)
{
	(void) hv_store(hv, "last_access", 11, newSViv(cache->last_access), 0);
	(void) hv_store(hv, "count", 5, newSViv(cache->count), 0);
	/*LINE_CACHE_SUB_REC lines[1];*/
}

static void perl_line_info_fill_hash(HV *hv, LINE_INFO_REC *info)
{
	(void) hv_store(hv, "level", 5, newSViv(info->level), 0);
	(void) hv_store(hv, "time", 4, newSViv(info->time), 0);
}

static void perl_statusbar_item_fill_hash(HV *hv, SBAR_ITEM_REC *item)
{
	(void) hv_store(hv, "min_size", 8, newSViv(item->min_size), 0);
	(void) hv_store(hv, "max_size", 8, newSViv(item->max_size), 0);
	(void) hv_store(hv, "xpos", 4, newSViv(item->xpos), 0);
	(void) hv_store(hv, "size", 4, newSViv(item->size), 0);
	if (item->bar->parent_window != NULL)
		(void) hv_store(hv, "window", 6, plain_bless(item->bar->parent_window->active, "Irssi::UI::Window"), 0);
}

static SV *perl_line_signal_arg_conv(LINE_REC *line, TEXT_BUFFER_VIEW_REC *view, WINDOW_REC *window)
{
	if (view != NULL)
		return buffer_line_bless(view->buffer, line);
	else if (window != NULL)
		return buffer_line_bless(WINDOW_GUI(window)->view->buffer, line);
	else
		return &PL_sv_undef;
}

static PLAIN_OBJECT_INIT_REC textui_plains[] = {
	{ "Irssi::TextUI::MainWindow", (PERL_OBJECT_FUNC) perl_main_window_fill_hash },
	{ "Irssi::TextUI::TextBuffer", (PERL_OBJECT_FUNC) perl_text_buffer_fill_hash },
	{ "Irssi::TextUI::TextBufferView", (PERL_OBJECT_FUNC) perl_text_buffer_view_fill_hash },
	{ "Irssi::TextUI::Line", (PERL_OBJECT_FUNC) perl_line_fill_hash },
	{ "Irssi::TextUI::LineCache", (PERL_OBJECT_FUNC) perl_line_cache_fill_hash },
	{ "Irssi::TextUI::LineInfo", (PERL_OBJECT_FUNC) perl_line_info_fill_hash },
	{ "Irssi::TextUI::StatusbarItem", (PERL_OBJECT_FUNC) perl_statusbar_item_fill_hash },

	{ NULL, NULL }
};

#line 120 "TextUI.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 264 "TextUI.c"

XS_EUPXS(XS_Irssi__TextUI_init); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi__TextUI_init)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
#line 117 "TextUI.xs"
	if (initialized) return;
	perl_api_version_check("Irssi::TextUI");
	initialized = TRUE;

        irssi_add_plains(textui_plains);
	irssi_add_signal_arg_conv("Irssi::TextUI::Line",
	                          (PERL_BLESS_FUNC) perl_line_signal_arg_conv);
	perl_statusbar_init();
#line 282 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi__TextUI_deinit); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi__TextUI_deinit)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
#line 129 "TextUI.xs"
	if (!initialized) return;
        perl_statusbar_deinit();
	initialized = FALSE;
#line 299 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_gui_printtext); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_printtext)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "xpos, ypos, str");
    {
	int	xpos = (int)SvIV(ST(0))
;
	int	ypos = (int)SvIV(ST(1))
;
	char *	str = (char *)SvPV_nolen(ST(2))
;

	gui_printtext(xpos, ypos, str);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_gui_input_set); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_set)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "str");
    {
	char *	str = (char *)SvPV_nolen(ST(0))
;
#line 145 "TextUI.xs"
	gui_entry_set_text(active_entry, str);
#line 336 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_gui_input_set_extent); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_set_extent)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "pos, text");
    {
	int	pos = (int)SvIV(ST(0))
;
	char *	text = (char *)SvPV_nolen(ST(1))
;
#line 152 "TextUI.xs"
	char *tt;
#line 355 "TextUI.c"
#line 154 "TextUI.xs"
	tt = text != NULL ? format_string_expand(text, NULL) : NULL;
	gui_entry_set_extent(active_entry, pos, tt);
	g_free(tt);
#line 360 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_gui_input_set_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_set_extents)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "pos, len, left, right");
    {
	int	pos = (int)SvIV(ST(0))
;
	int	len = (int)SvIV(ST(1))
;
	char *	left = (char *)SvPV_nolen(ST(2))
;
	char *	right = (char *)SvPV_nolen(ST(3))
;
#line 165 "TextUI.xs"
	char *tl;
	char *tr;
#line 384 "TextUI.c"
#line 168 "TextUI.xs"
	tl = left != NULL ? format_string_expand(left, NULL) : NULL;
	tr = right != NULL ? format_string_expand(right, NULL) : NULL;
	gui_entry_set_extents(active_entry, pos, len, tl, tr);
	g_free(tl);
	g_free(tr);
#line 391 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_gui_input_clear_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_clear_extents)
{
    dVAR; dXSARGS;
    if (items < 1 || items > 2)
       croak_xs_usage(cv,  "pos, len = 0");
    {
	int	pos = (int)SvIV(ST(0))
;
	int	len;

	if (items < 2)
	    len = 0;
	else {
	    len = (int)SvIV(ST(1))
;
	}
#line 179 "TextUI.xs"
	gui_entry_clear_extents(active_entry, pos, len);
#line 416 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_gui_input_get_extent); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_get_extent)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "pos");
    {
	int	pos = (int)SvIV(ST(0))
;
	char *	RETVAL;
	dXSTARG;
#line 185 "TextUI.xs"
	RETVAL = gui_entry_get_extent(active_entry, pos);
#line 435 "TextUI.c"
	sv_setpv(TARG, RETVAL);
	XSprePUSH;
	PUSHTARG;
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Irssi_gui_input_get_text_and_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_get_text_and_extents)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 192 "TextUI.xs"
	GSList *ret, *tmp;
#line 455 "TextUI.c"
#line 194 "TextUI.xs"
	ret = gui_entry_get_text_and_extents(active_entry);
	for (tmp = ret; tmp != NULL; tmp = tmp->next) {
		XPUSHs(sv_2mortal(new_pv(tmp->data)));
	}
	g_slist_free_full(ret, g_free);
#line 462 "TextUI.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Irssi_gui_input_set_text_and_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_set_text_and_extents)
{
    dVAR; dXSARGS;
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 203 "TextUI.xs"
	GSList *list;
	int i;
#line 481 "TextUI.c"
#line 206 "TextUI.xs"
	list = NULL;
	for (i = items; i > 0; i--) {
		list = g_slist_prepend(list, SvPV_nolen(ST(i-1)));
	}
	gui_entry_set_text_and_extents(active_entry, list);
	g_slist_free(list);
#line 489 "TextUI.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Irssi_gui_input_get_pos); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_get_pos)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	int	RETVAL;
	dXSTARG;
#line 216 "TextUI.xs"
	RETVAL = gui_entry_get_pos(active_entry);
#line 507 "TextUI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Irssi_gui_input_set_pos); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_gui_input_set_pos)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "pos");
    {
	int	pos = (int)SvIV(ST(0))
;
#line 224 "TextUI.xs"
	gui_entry_set_pos(active_entry, pos);
#line 526 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_wcwidth); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_wcwidth)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "c");
    {
	char *	c = (char *)SvPV_nolen(ST(0))
;
	int	RETVAL;
	dXSTARG;
#line 230 "TextUI.xs"
	if (term_type == TERM_TYPE_UTF8) {
		unichar chr = g_utf8_get_char_validated((const char *) c, -1);

		if (chr & 0x80000000) {
			RETVAL = 1;
		} else {
			RETVAL = i_wcwidth(chr);
		}
	} else if (term_type != TERM_TYPE_BIG5 ||
		   c[1] == '\0' ||
		   !is_big5((unsigned char) c[0], (unsigned char) c[1])) {
		RETVAL = i_wcwidth((unsigned char) *c);
	} else {
		RETVAL = 2;
	}
#line 559 "TextUI.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Irssi__UI__Window_print_after); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi__UI__Window_print_after)
{
    dVAR; dXSARGS;
    if (items < 4 || items > 5)
       croak_xs_usage(cv,  "window, prev, level, str, time = 0");
    {
	Irssi__UI__Window	window = irssi_ref_object(ST(0))
;
	Irssi__TextUI__Line	prev = irssi_ref_buffer_line_wrap(ST(1))
;
	int	level = (int)SvIV(ST(2))
;
	char *	str = (char *)SvPV_nolen(ST(3))
;
	time_t	time;
#line 258 "TextUI.xs"
	TEXT_DEST_REC dest;
	char *text;
	char *text2;
#line 587 "TextUI.c"

	if (items < 5)
	    time = 0;
	else {
	    time = (time_t)SvNV(ST(4))
;
	}
#line 262 "TextUI.xs"
	format_create_dest(&dest, NULL, NULL, level, window);
	text = format_string_expand(str, NULL);
	text2 = g_strconcat(text, "\n", NULL);
	gui_printtext_after_time(&dest, Line(prev), text2, time);
	g_free(text);
	g_free(text2);
#line 602 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi__UI__Window_gui_printtext_after); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi__UI__Window_gui_printtext_after)
{
    dVAR; dXSARGS;
    if (items < 4 || items > 5)
       croak_xs_usage(cv,  "window, prev, level, str, time = 0");
    {
	Irssi__UI__Window	window = irssi_ref_object(ST(0))
;
	Irssi__TextUI__Line	prev = irssi_ref_buffer_line_wrap(ST(1))
;
	int	level = (int)SvIV(ST(2))
;
	char *	str = (char *)SvPV_nolen(ST(3))
;
	time_t	time;
#line 277 "TextUI.xs"
	TEXT_DEST_REC dest;
#line 626 "TextUI.c"

	if (items < 5)
	    time = 0;
	else {
	    time = (time_t)SvNV(ST(4))
;
	}
#line 279 "TextUI.xs"
	format_create_dest(&dest, NULL, NULL, level, window);
	gui_printtext_after_time(&dest, Line(prev), str, time);
#line 637 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi__UI__Window_last_line_insert); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi__UI__Window_last_line_insert)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "window");
    {
	Irssi__UI__Window	window = irssi_ref_object(ST(0))
;
	Irssi__TextUI__Line	RETVAL;
#line 286 "TextUI.xs"
	RETVAL = perl_wrap_buffer_line(WINDOW_GUI(window)->view->buffer,
	                               WINDOW_GUI(window)->insert_after);
#line 656 "TextUI.c"
	{
	    SV * RETVALSV;
	    RETVALSV = perl_buffer_line_bless(RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Irssi__Server_gui_printtext_after); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi__Server_gui_printtext_after)
{
    dVAR; dXSARGS;
    if (items < 5 || items > 6)
       croak_xs_usage(cv,  "server, target, prev, level, str, time = 0");
    {
	Irssi__Server	server = irssi_ref_object(ST(0))
;
	char *	target = (char *)SvPV_nolen(ST(1))
;
	Irssi__TextUI__Line	prev = irssi_ref_buffer_line_wrap(ST(2))
;
	int	level = (int)SvIV(ST(3))
;
	char *	str = (char *)SvPV_nolen(ST(4))
;
	time_t	time;
#line 302 "TextUI.xs"
	TEXT_DEST_REC dest;
#line 688 "TextUI.c"

	if (items < 6)
	    time = 0;
	else {
	    time = (time_t)SvNV(ST(5))
;
	}
#line 304 "TextUI.xs"
	format_create_dest(&dest, server, target, level, NULL);
	gui_printtext_after_time(&dest, Line(prev), str, time);
#line 699 "TextUI.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_term_refresh_freeze); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_term_refresh_freeze)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {

	term_refresh_freeze();
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Irssi_term_refresh_thaw); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Irssi_term_refresh_thaw)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {

	term_refresh_thaw();
    }
    XSRETURN_EMPTY;
}

#ifdef __cplusplus
extern "C"
#endif
XS_EXTERNAL(boot_Irssi__TextUI); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Irssi__TextUI)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

        (void)newXSproto_portable("Irssi::TextUI::init", XS_Irssi__TextUI_init, file, "");
        (void)newXSproto_portable("Irssi::TextUI::deinit", XS_Irssi__TextUI_deinit, file, "");
        (void)newXSproto_portable("Irssi::gui_printtext", XS_Irssi_gui_printtext, file, "$$$");
        (void)newXSproto_portable("Irssi::gui_input_set", XS_Irssi_gui_input_set, file, "$");
        (void)newXSproto_portable("Irssi::gui_input_set_extent", XS_Irssi_gui_input_set_extent, file, "$$");
        (void)newXSproto_portable("Irssi::gui_input_set_extents", XS_Irssi_gui_input_set_extents, file, "$$$$");
        (void)newXSproto_portable("Irssi::gui_input_clear_extents", XS_Irssi_gui_input_clear_extents, file, "$;$");
        (void)newXSproto_portable("Irssi::gui_input_get_extent", XS_Irssi_gui_input_get_extent, file, "$");
        (void)newXSproto_portable("Irssi::gui_input_get_text_and_extents", XS_Irssi_gui_input_get_text_and_extents, file, "");
        (void)newXSproto_portable("Irssi::gui_input_set_text_and_extents", XS_Irssi_gui_input_set_text_and_extents, file, ";@");
        (void)newXSproto_portable("Irssi::gui_input_get_pos", XS_Irssi_gui_input_get_pos, file, "");
        (void)newXSproto_portable("Irssi::gui_input_set_pos", XS_Irssi_gui_input_set_pos, file, "$");
        (void)newXSproto_portable("Irssi::wcwidth", XS_Irssi_wcwidth, file, "$");
        (void)newXSproto_portable("Irssi::UI::Window::print_after", XS_Irssi__UI__Window_print_after, file, "$$$$;$");
        (void)newXSproto_portable("Irssi::UI::Window::gui_printtext_after", XS_Irssi__UI__Window_gui_printtext_after, file, "$$$$;$");
        (void)newXSproto_portable("Irssi::UI::Window::last_line_insert", XS_Irssi__UI__Window_last_line_insert, file, "$");
        (void)newXSproto_portable("Irssi::Server::gui_printtext_after", XS_Irssi__Server_gui_printtext_after, file, "$$$$$;$");
        (void)newXSproto_portable("Irssi::term_refresh_freeze", XS_Irssi_term_refresh_freeze, file, "");
        (void)newXSproto_portable("Irssi::term_refresh_thaw", XS_Irssi_term_refresh_thaw, file, "");

    /* Initialisation Section */

#line 308 "TextUI.xs"
	irssi_boot(TextUI__Statusbar);
	irssi_boot(TextUI__TextBuffer);
	irssi_boot(TextUI__TextBufferView);

#line 787 "TextUI.c"

    /* End of Initialisation Section */

#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

