File: GtkSpell.xs

package info (click to toggle)
libgtk2-spell-perl 1.04-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 140 kB
  • ctags: 5
  • sloc: perl: 40; ansic: 7; makefile: 4
file content (102 lines) | stat: -rw-r--r-- 2,361 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * 
 * Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the full
 * list)
 * 
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Library General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307  USA.
 *
 * $Id$
 */

/* TODO: error handling could stand to be improved, or at least thought about */

#include "gtk2spellperl.h"

GtkSpell * 
SvGtkSpell (SV * sv)
{
	if (!sv || !SvOK (sv) || sv == &PL_sv_undef || ! SvROK (sv))
		return NULL;
	if( !sv_derived_from (sv, "Gtk2::Spell"))
		croak("variable is not of type Gtk2::Spell");

	return (GtkSpell*)SvIV(SvRV(sv));
}

SV *
newSVGtkSpell (GtkSpell * spell)
{
	SV * sv;

	if( !spell )
		return &PL_sv_undef;

	sv = newSV(0);
	sv_setref_pv(sv, "Gtk2::Spell", spell);

	return(sv);
}

MODULE = Gtk2::Spell	PACKAGE = Gtk2::Spell	PREFIX = gtkspell_

GtkSpell *
gtkspell_new (class, view, lang=NULL)
	GtkTextView * view
	const gchar * lang
    ALIAS:
	Gtk2::Spell::new_attach = 1
    PREINIT:
	GError * error = NULL;
    CODE:
	RETVAL = gtkspell_new_attach(view, lang, &error);
	if( !RETVAL )
		gperl_croak_gerror("Gtk2::Spell->new_attach", error);
    OUTPUT:
	RETVAL
    CLEANUP:
	PERL_UNUSED_VAR (ix);

GtkSpell * 
gtkspell_get_from_text_view (class, view)
	GtkTextView * view
    CODE:
	RETVAL = gtkspell_get_from_text_view(view);
	if( !RETVAL )
		XSRETURN_UNDEF;
    OUTPUT:
	RETVAL

void 
gtkspell_detach (spell)
	GtkSpell * spell

gboolean 
gtkspell_set_language (spell, lang)
	GtkSpell    * spell
	const gchar * lang
    PREINIT:
	GError * error = NULL;
    CODE:
	RETVAL = gtkspell_set_language(spell, lang, &error);
	if( !RETVAL )
		gperl_croak_gerror("Gtk2::Spell->set_language", error);
    OUTPUT:
	RETVAL
	

void 
gtkspell_recheck_all (spell)
	GtkSpell * spell