Unaccent.xs

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 30 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
↑ Summary unac.c »
1 /*
2 * Copyright (C) 2000, 2001, 2002, 2004 Loic Dachary <loic@senga.org>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 #include "EXTERN.h"
19 #include "perl.h"
20 #include "XSUB.h"
21 #include "perlio.h"
22  
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif /* HAVE_CONFIG_H */
26  
27 /*
28 * Perl config.h defines HAS_VPRINTF if printf variants are
29 * available
30 */
31 #ifdef HAS_VPRINTF
32 #define HAVE_VSNPRINTF
33 #endif /* HAS_VPRINTF */
34  
35 #include "unac.h"
36  
37 static char* buffer;
38 static int buffer_length;
39  
40 0 static void unac_debug_print(const char* message, void* data)
41 {
42 0 ▶ if(PerlIO_puts(PerlIO_stderr(), message) != strlen(message))
Branch: 1 branch
BranchTrueFalseTotal
if(PerlIO_puts(PerlIO_stderr(), message) != strlen(message)) 0 0 0
43 0 perror("unac_debug_print");
44 0 }
45  
46 MODULE = Text::Unaccent PACKAGE = Text::Unaccent PREFIX = perl_
47  
48 BOOT:
49 0 buffer = 0;
50 0 buffer_length = 0;
51 {
52 SV* sv;
53 0 sv = get_sv("Text::Unaccent::DEBUG_NONE", TRUE|GV_ADDMULTI);
54 0 sv_setiv(sv, UNAC_DEBUG_NONE);
55 0 sv = get_sv("Text::Unaccent::DEBUG_LOW", TRUE|GV_ADDMULTI);
56 0 sv_setiv(sv, UNAC_DEBUG_LOW);
57 0 sv = get_sv("Text::Unaccent::DEBUG_HIGH", TRUE|GV_ADDMULTI);
58 0 sv_setiv(sv, UNAC_DEBUG_HIGH);
59 }
60  
61 SV*
62 perl_unac_string(charset,in)
63 char* charset
64 char* in
65 PROTOTYPE: $$
66 CODE:
67 STRLEN in_length;
68 0 in_length = SvCUR(ST(1));
69 0 ▶ if(unac_string(charset,
Branch: 1 branch
BranchTrueFalseTotal
if(unac_string(charset, 0 0 0
70 in, in_length,
71 &buffer, &buffer_length) == 0) {
72 0 RETVAL = newSVpv(buffer, buffer_length);
73 } else {
74 0 perror("unac_string");
75 0 RETVAL = &PL_sv_undef;
76 }
77 OUTPUT:
78 RETVAL
79  
80 SV*
81 perl_unac_string_utf16(in)
82 char* in
83 PROTOTYPE: $
84 CODE:
85 STRLEN in_length;
86 0 in_length = SvCUR(ST(0));
87 0 ▶ if(unac_string_utf16(in, in_length,
Branch: 1 branch
BranchTrueFalseTotal
if(unac_string_utf16(in, in_length, 0 0 0
88 &buffer, &buffer_length) == 0) {
89 0 RETVAL = newSVpv(buffer, buffer_length);
90 } else {
91 0 perror("unac_string_utf16");
92 0 RETVAL = &PL_sv_undef;
93 }
94 OUTPUT:
95 RETVAL
96  
97 SV*
98 perl_unac_version()
99 CODE:
100 0 RETVAL = newSVpv((char*)unac_version(), 0);
101 OUTPUT:
102 RETVAL
103  
104 void
105 perl_unac_debug(in)
106 int in
107 PROTOTYPE: $
108 CODE:
109 0 unac_debug_callback(in, unac_debug_print, NULL);
↑ Summary unac.c »