SWISH-3
view release on metacpan or search on metacpan
MODULE = SWISH::3 PACKAGE = SWISH::3
PROTOTYPES: enable
void
_setup(CLASS)
char* CLASS;
CODE:
/* Perl has its own setenv/putenv, which can break when libswish3 uses native setenv().
* This magic Perl var seems to fix it, per this thread:
* http://grokbase.com/post/2004/11/11/suse-s-perl-safe-putenf-diff/IQxdco6nM5eY6zUPwmOkuMRH3vo
* Where the compile-time def was used, this var is not available (e.g. Solaris).
*/
#ifndef PERL_USE_SAFE_PUTENV
PL_use_safe_putenv = 1;
#endif /* PERL_USE_SAFE_PUTENV */
swish_setup();
0.08_08 20 Oct 2010
- bumped required Perl to 5.8.9 as PL_use_safe_putenv did not appear till
5.8.6 and sv_usepvn_flags() did not appear till 5.8.9.
- dropped err.h from libswish3.c as Solaris (for one) does not seem to
have it.
- added alloca.h to libswish3.c as Solaris (for one) seems to need it.
0.08_07 11 Oct 2010
- fix (finally, I hope) the mysterious segfaults on freebsd tests. The
problem was Perl's my_setenv() interfering with the native setenv().
- fix "Bad realloc() ignored" error on freebsd by using sv_usepvn_flags()
instead of sv_usepvn_mg().
0.08_06 08 Oct 2010
- tweek tests to allow for any locale with UTF-8 encoding
- dump %Config to try and trace freebsd setenv/putenv/malloc issue (more
of same issue addressed in 0.08_05)
0.08_05 13 Sept 2010
- revert debugging from 0.08_04
- check for USE_MYMALLOC in %Config and abort Makefile.PL
0.08_04 1 June 2010
- add some debugging on stderr for cpantesters only.
0.08_03 19 May 2010
libswish3.c view on Meta::CPAN
/*
=cut
*/
/*
=head2 Global Functions
*/
void swish_setup();
const char * swish_lib_version();
const char * swish_libxml2_version();
void swish_setenv(char * name, char * value, int override);
/*
=cut
*/
/*
=head2 Top-Level Functions
*/
swish_3 * swish_3_init( void (*handler) (swish_ParserData *), void *stash );
void swish_3_free( swish_3 *s3 );
int swish_parse_file( swish_3 * s3, xmlChar *filename );
libswish3.c view on Meta::CPAN
static void
get_env_vars(
)
{
/*
* init the global env vars, but don't override if already set
*/
swish_setenv("SWISH_PARSER_WARNINGS", "1", 0);
SWISH_PARSER_WARNINGS = swish_string_to_int(getenv("SWISH_PARSER_WARNINGS"));
if (SWISH_DEBUG) {
SWISH_PARSER_WARNINGS = SWISH_DEBUG;
}
}
unsigned int
swish_parse_fh(
libswish3.c view on Meta::CPAN
if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER)
SWISH_DEBUG_MSG("encoding = %s", enc);
}
else {
if (SWISH_DEBUG & SWISH_DEBUG_TOKENIZER)
SWISH_DEBUG_MSG("no encoding in %s, using %s", loc, SWISH_DEFAULT_ENCODING);
enc = (xmlChar *)SWISH_DEFAULT_ENCODING;
}
swish_setenv("SWISH_ENCODING", (char *)enc, 0); /* remember in env var, if not already set */
if (!loc) {
SWISH_WARN("can't get locale via setlocale()");
}
else if (SWISH_DEBUG) {
SWISH_DEBUG_MSG("current locale and encoding: %s %s", loc, enc);
}
if (u8_is_locale_utf8(loc)) {
/* a-ok */
libswish3.c view on Meta::CPAN
swish_config_free(s3->config);
}
if (s3->ref_cnt != 0) {
SWISH_WARN("s3 ref_cnt != 0: %d\n", s3->ref_cnt);
}
swish_xfree(s3);
}
void
swish_setenv(
char * name,
char * value,
int override
)
{
int ret;
ret = setenv(name, value, override);
if (ret != 0) {
SWISH_CROAK("setenv failed with %d: %s", errno, strerror(errno));
}
}
/* MUST call this before instantiating any swish_3 objects */
void
swish_setup(
)
{
/* global var that scripts can check to determine what version of Swish they are
* using. the second 0 indicates that it will not override it if already set */
swish_setenv("SWISH3", "1", 0);
/* global debug flag */
swish_setenv("SWISH_DEBUG", "0", 0);
swish_setenv("SWISH_DEBUG_MEMORY", "0", 0);
swish_setenv("SWISH_DEBUG_CONFIG", "0", 0);
swish_setenv("SWISH_DEBUG_DOCINFO", "0", 0);
swish_setenv("SWISH_DEBUG_IO", "0", 0);
swish_setenv("SWISH_DEBUG_TOKENLIST", "0", 0);
swish_setenv("SWISH_DEBUG_TOKENIZER", "0", 0);
swish_setenv("SWISH_DEBUG_PARSER", "0", 0);
swish_setenv("SWISH_DEBUG_NAMEDBUFFER", "0", 0);
swish_setenv("SWISH_WARNINGS", "1", 0);
if (!SWISH_DEBUG) {
SWISH_DEBUG += swish_string_to_int(getenv("SWISH_DEBUG"));
/* additional env vars just increase the global var value */
if (swish_string_to_int(getenv("SWISH_DEBUG_MEMORY"))) {
SWISH_DEBUG += SWISH_DEBUG_MEMORY;
}
if (swish_string_to_int(getenv("SWISH_DEBUG_CONFIG"))) {
libswish3.h view on Meta::CPAN
/*
=cut
*/
/*
=head2 Global Functions
*/
void swish_setup();
const char * swish_lib_version();
const char * swish_libxml2_version();
void swish_setenv(char * name, char * value, int override);
/*
=cut
*/
/*
=head2 Top-Level Functions
*/
swish_3 * swish_3_init( void (*handler) (swish_ParserData *), void *stash );
void swish_3_free( swish_3 *s3 );
int swish_parse_file( swish_3 * s3, xmlChar *filename );
magic_regdatum_get|||
magic_regdatum_set|||
magic_scalarpack|||
magic_set_all_env|||
magic_setamagic|||
magic_setarylen|||
magic_setbm|||
magic_setcollxfrm|||
magic_setdbline|||
magic_setdefelem|||
magic_setenv|||
magic_setfm|||
magic_setglob|||
magic_setisa|||
magic_setmglob|||
magic_setnkeys|||
magic_setpack|||
magic_setpos|||
magic_setregexp|||
magic_setsig|||
magic_setsubstr|||
my_letohi|||n
my_letohl|||n
my_letohs|||n
my_lstat|||
my_memcmp||5.004000|n
my_memset|||n
my_ntohl|||
my_pclose||5.004000|
my_popen_list||5.007001|
my_popen||5.004000|
my_setenv|||
my_socketpair||5.007003|n
my_stat|||
my_strftime||5.007002|
my_swabn|||n
my_swap|||
my_unexec|||
my|||
newANONATTRSUB||5.006000|
newANONHASH|||
newANONLIST|||
scan_word|||
scope|||
screaminstr||5.005000|
seed|||
set_context||5.006000|n
set_csh|||
set_numeric_local||5.006000|
set_numeric_radix||5.006000|
set_numeric_standard||5.006000|
setdefout|||
setenv_getix|||
share_hek_flags|||
share_hek|||
si_dup|||
sighandler|||n
simplify_sort|||
skipspace|||
sortsv||5.007003|
ss_dup|||
stack_grow|||
start_glob|||
( run in 0.871 second using v1.01-cache-2.11-cpan-6aa56a78535 )