PAB3

 view release on metacpan or  search on metacpan

xs/PAB3/PAB3.xs  view on Meta::CPAN

_new( class, ... )
	SV *class;
PREINIT:
	dMY_CXT;
	my_thread_var_t *tv;
	SV *sv;
	HV *hv;
	int itemp;
	STRLEN lkey, lval;
	char *key, *val;
PPCODE:
	sv = sv_2mortal( (SV*) newHV() );
	tv = my_thread_var_add( &MY_CXT, sv );
	for( itemp = 1; itemp < items - 1; itemp += 2 ) {
		if( ! SvPOK( ST(itemp) ) ) continue;
		key = SvPVx( ST(itemp), lkey );
		/*printf( "item %u %s\n", itemp, key );*/
		if( strcmp( key, "path_template" ) == 0 ) {
			val = SvPVx( ST(itemp + 1), lval );
			New( 1, tv->path_template, lval + 2, char );
			Copy( val, tv->path_template, lval, char );

xs/PAB3/PAB3.xs  view on Meta::CPAN

#/*****************************************************************************
# * reset( this )
# *****************************************************************************/

void
reset( this )
	SV *this;
PREINIT:
	dMY_CXT;
	my_thread_var_t *tv;
PPCODE:
	if( ( tv = my_thread_var_find( &MY_CXT, this ) ) != NULL ) {
		my_parser_session_cleanup( tv );
		my_loop_def_cleanup( tv );
		my_hashmap_cleanup( tv );
	}


#/*****************************************************************************
# * _parse_template( this, template )
# *****************************************************************************/

xs/PAB3/PAB3.xs  view on Meta::CPAN

	SV *this;
	SV *template;
	SV *cache;
PREINIT:
	dMY_CXT;
	my_thread_var_t *tv;
	STRLEN ltmp, ltpl;
	char *tmp, *p1;
	char tpl[256], cac[256];
	/*PerlIO *pfile;*/
PPCODE:
	if( (tv = my_thread_var_find( &MY_CXT, this )) == NULL )
		goto ferror;
	tv->last_error[0] = '\0';
	tmp = SvPVx( template, ltpl );
	if( ltpl + tv->path_template_length < 256 ) {
		if( tv->path_template != NULL ) {
			p1 = my_strcpy( tpl, tv->path_template );
			ltpl += tv->path_template_length;
		}
		else

xs/PAB3/PAB3.xs  view on Meta::CPAN

#/*****************************************************************************
# * error( this )
# *****************************************************************************/

void
error( this )
	SV *this;
PREINIT:
	dMY_CXT;
	my_thread_var_t *tv;
PPCODE:
	if( ( tv = my_thread_var_find( &MY_CXT, this ) ) == NULL ) goto error;
	if( tv->last_error[0] != '\0' ) {
		XPUSHs( sv_2mortal( newSVpvn( tv->last_error, strlen( tv->last_error ) ) ) );
	}
	goto exit;
error:
	XPUSHs( &PL_sv_undef );
exit:
	{}

xs/PAB3/PAB3.xs  view on Meta::CPAN

# * set_error( this, msg )
# ******************************************************************************/

void
set_error( this, msg )
	SV *this;
	char *msg;
PREINIT:
	dMY_CXT;
	my_thread_var_t *tv;
PPCODE:
	if( ( tv = my_thread_var_find( &MY_CXT, this ) ) == NULL ) return;
	my_strncpy( tv->last_error, msg, sizeof( tv->last_error ) );


#/*****************************************************************************
# * DESTROY( this )
# *****************************************************************************/

void
DESTROY( this )
	SV *this;
PREINIT:
	dMY_CXT;
	my_thread_var_t *tv;
PPCODE:
	if( ( tv = my_thread_var_find( &MY_CXT, this ) ) == NULL ) return;
	_debug( __PACKAGE__ " destroying tv: 0x%08X\n", tv );
	my_thread_var_rem( &MY_CXT, tv );


#/*****************************************************************************
# * _cleanup()
# *****************************************************************************/

void

xs/PAB3/Utils/Utils.xs  view on Meta::CPAN

# * new( class, ... )
# *****************************************************************************/

void
new( class, ... )
	SV *class;
PREINIT:
	dMY_CXT;
	SV *sv;
	HV *hv;
PPCODE:
	sv = sv_2mortal( newSVuv( 0 ) );
	SvUV_set( sv, (size_t) sv );
	hv = gv_stashpv( SvPVX( class ), FALSE );
	XPUSHs( sv_bless( sv_2mortal( newRV( sv ) ), hv ) );


#/*****************************************************************************
# * str_trim( string )
# *****************************************************************************/

xs/PAB3/Utils/Utils.xs  view on Meta::CPAN

# *****************************************************************************/

void
_localtime( tid, ... )
	UV tid;
PREINIT:
	dMY_CXT;
	time_t timer;
	my_vdatetime_t *tim;
	my_thread_var_t *tv;
PPCODE:
	find_or_create_tv( &MY_CXT, tv, tid );
	if( items < 2 )
		timer = time( 0 );
	else
		timer = (time_t) SvUV( ST(1) );
	tim = apply_timezone( tv, &timer );
	EXTEND( SP, 9 );
	XPUSHs( sv_2mortal( newSVuv( tim->tm_sec ) ) );
	XPUSHs( sv_2mortal( newSVuv( tim->tm_min ) ) );
	XPUSHs( sv_2mortal( newSVuv( tim->tm_hour ) ) );



( run in 1.692 second using v1.01-cache-2.11-cpan-5511b514fd6 )