ARSperl
view release on metacpan or search on metacpan
supportrev.c view on Meta::CPAN
return -1;
}
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARArchiveInfoStruct: hash value is not a hash reference" );
return -1;
}
}
}else if( p->archiveType == AR_ARCHIVE_NONE ){
/* do nothing */
}else{
sprintf( errText, "rev_ARArchiveInfoStruct: invalid switch value %d", p->archiveType );
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, errText );
}
}
if( SvTYPE(SvRV(*val)) == SVt_PVHV ){
int i = 0, num = 0;
HV *h = (HV* ) SvRV((SV*) *val);
char k[256];
k[255] = '\0';
{
SV **val;
strncpy( k, "archiveFrom", 255 );
val = hv_fetch( h, "archiveFrom", 11, 0 );
if( val && *val && SvOK(*val) ){
strncpy( p->archiveFrom, SvPV_nolen(*val), sizeof(p->archiveFrom) );
}else{
strcpy( p->archiveFrom, "" );
}
}
{
SV **val;
strncpy( k, "query", 255 );
val = hv_fetch( h, "query", 5, 0 );
if( val && *val && SvOK(*val) ){
rev_ARQualifierStruct( ctrl, h, k, &(p->query) );
}else{
p->query.operation = AR_COND_OP_NONE;
}
}
{
SV **val;
strncpy( k, "enable", 255 );
val = hv_fetch( h, "enable", 6, 0 );
if( val && *val ){
{
int flag = 0;
if( !strcmp(SvPV_nolen(*val),"true") ){
p->enable = TRUE;
flag = 1;
}
if( !strcmp(SvPV_nolen(*val),"false") ){
p->enable = FALSE;
flag = 1;
}
if( flag == 0 ){
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARArchiveInfoStruct: invalid key value" );
ARError_add( AR_RETURN_ERROR, AP_ERR_CONTINUE, SvPV_nolen(*val) );
}
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"enable\"" );
return -1;
}
}
{
SV **val;
strncpy( k, "TmHourMask", 255 );
val = hv_fetch( h, "TmHourMask", 10, 0 );
if( val && *val ){
{
p->archiveTime.hourmask = SvIV(*val);
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"TmHourMask\"" );
return -1;
}
}
{
SV **val;
strncpy( k, "TmWeekDayMask", 255 );
val = hv_fetch( h, "TmWeekDayMask", 13, 0 );
if( val && *val ){
{
p->archiveTime.weekday = SvIV(*val);
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"TmWeekDayMask\"" );
return -1;
}
}
{
SV **val;
strncpy( k, "TmMinute", 255 );
val = hv_fetch( h, "TmMinute", 8, 0 );
if( val && *val ){
{
p->archiveTime.minute = SvIV(*val);
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"TmMinute\"" );
return -1;
}
}
{
SV **val;
strncpy( k, "TmMonthDayMask", 255 );
val = hv_fetch( h, "TmMonthDayMask", 14, 0 );
supportrev.c view on Meta::CPAN
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARArchiveInfoStruct: hash value is not a hash reference" );
return -1;
}
}
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARArchiveInfoStruct: hv_fetch returned null");
return -2;
}
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARArchiveInfoStruct: key doesn't exist");
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, k );
return -2;
}
}else{
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARArchiveInfoStruct: first argument is not a hash");
return -1;
}
return 0;
}
#endif
int
rev_ARArithOpStruct( ARControlStruct *ctrl, HV *h, char *k, ARArithOpStruct *p ){
SV **val;
int i = 0;
if( !p ){
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARArithOpStruct: AR Object param is NULL" );
return -1;
}
if( SvTYPE((SV*) h) == SVt_PVHV ){
// printf( "ARArithOpStruct: k = <%s>\n", k );
if( hv_exists(h,k,strlen(k)) ){
val = hv_fetch( h, k, strlen(k), 0 );
if( val && *val ){
{
if( SvTYPE(SvRV(*val)) == SVt_PVHV ){
int i = 0, num = 0;
HV *h = (HV* ) SvRV((SV*) *val);
char k[256];
k[255] = '\0';
{
SV **val;
strncpy( k, "oper", 255 );
val = hv_fetch( h, "oper", 4, 0 );
if( val && *val ){
{
int flag = 0;
if( !strcmp(SvPV_nolen(*val),"/") ){
p->operation = AR_ARITH_OP_DIVIDE;
flag = 1;
}
if( !strcmp(SvPV_nolen(*val),"%") ){
p->operation = AR_ARITH_OP_MODULO;
flag = 1;
}
if( !strcmp(SvPV_nolen(*val),"+") ){
p->operation = AR_ARITH_OP_ADD;
flag = 1;
}
/*
if( !strcmp(SvPV_nolen(*val),"-") ){
p->operation = AR_ARITH_OP_NEGATE;
flag = 1;
}
*/
if( !strcmp(SvPV_nolen(*val),"*") ){
p->operation = AR_ARITH_OP_MULTIPLY;
flag = 1;
}
if( !strcmp(SvPV_nolen(*val),"-") ){
p->operation = AR_ARITH_OP_SUBTRACT;
flag = 1;
}
if( flag == 0 ){
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARArithOpStruct: invalid key value" );
ARError_add( AR_RETURN_ERROR, AP_ERR_CONTINUE, SvPV_nolen(*val) );
}
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"oper\"" );
return -1;
}
}
{
SV **val;
strncpy( k, "left", 255 );
val = hv_fetch( h, "left", 4, 0 );
if( val && *val ){
{
rev_ARFieldValueOrArithStruct( ctrl, h, k, &(p->operandLeft) );
}
}else{
if( p->operation == AR_ARITH_OP_SUBTRACT ){
p->operation = AR_ARITH_OP_NEGATE;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"left\"" );
return -1;
}
}
}
{
SV **val;
strncpy( k, "right", 255 );
val = hv_fetch( h, "right", 5, 0 );
if( val && *val ){
{
rev_ARFieldValueOrArithStruct( ctrl, h, k, &(p->operandRight) );
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"right\"" );
return -1;
}
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARArithOpStruct: hash value is not a hash reference" );
return -1;
}
}
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARArithOpStruct: hv_fetch returned null");
return -2;
}
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARArithOpStruct: key doesn't exist");
supportrev.c view on Meta::CPAN
p->queryFromAlias[pos] = '\0';
p->fieldId = atoi( &(str[pos+1]) );
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARMultiSchemaFieldIdStruct: not a char value");
return -2;
}
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARMultiSchemaFieldIdStruct: hv_fetch returned null");
return -2;
}
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARMultiSchemaFieldIdStruct: key doesn't exist");
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, k );
return -2;
}
}else{
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARMultiSchemaFieldIdStruct: first argument is not a hash");
return -1;
}
return 0;
}
#endif
#if AR_CURRENT_API_VERSION >= 14
int
rev_ARMultiSchemaArithOpStruct( ARControlStruct *ctrl, HV *h, char *k, ARMultiSchemaArithOpStruct *p ){
SV **val;
int i = 0;
if( !p ){
ARError_add(AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARMultiSchemaArithOpStruct: AR Object param is NULL" );
return -1;
}
if( SvTYPE((SV*) h) == SVt_PVHV ){
// printf( "ARMultiSchemaArithOpStruct: k = <%s>\n", k );
if( hv_exists(h,k,strlen(k)) ){
val = hv_fetch( h, k, strlen(k), 0 );
if( val && *val ){
{
if( SvTYPE(SvRV(*val)) == SVt_PVHV ){
int i = 0, num = 0;
HV *h = (HV* ) SvRV((SV*) *val);
char k[256];
k[255] = '\0';
{
SV **val;
strncpy( k, "oper", 255 );
val = hv_fetch( h, "oper", 4, 0 );
if( val && *val ){
{
int flag = 0;
if( !strcmp(SvPV_nolen(*val),"/") ){
p->operation = AR_ARITH_OP_DIVIDE;
flag = 1;
}
if( !strcmp(SvPV_nolen(*val),"%") ){
p->operation = AR_ARITH_OP_MODULO;
flag = 1;
}
if( !strcmp(SvPV_nolen(*val),"+") ){
p->operation = AR_ARITH_OP_ADD;
flag = 1;
}
/*
if( !strcmp(SvPV_nolen(*val),"-") ){
p->operation = AR_ARITH_OP_NEGATE;
flag = 1;
}
*/
if( !strcmp(SvPV_nolen(*val),"*") ){
p->operation = AR_ARITH_OP_MULTIPLY;
flag = 1;
}
if( !strcmp(SvPV_nolen(*val),"-") ){
p->operation = AR_ARITH_OP_SUBTRACT;
flag = 1;
}
if( flag == 0 ){
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARMultiSchemaArithOpStruct: invalid key value" );
ARError_add( AR_RETURN_ERROR, AP_ERR_CONTINUE, SvPV_nolen(*val) );
}
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"oper\"" );
return -1;
}
}
{
SV **val;
strncpy( k, "left", 255 );
val = hv_fetch( h, "left", 4, 0 );
if( val && *val ){
{
rev_ARMultiSchemaFieldValueOrArithStruct( ctrl, h, k, &(p->operandLeft) );
}
}else{
if( p->operation == AR_ARITH_OP_SUBTRACT ){
p->operation = AR_ARITH_OP_NEGATE;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"left\"" );
return -1;
}
}
}
{
SV **val;
strncpy( k, "right", 255 );
val = hv_fetch( h, "right", 5, 0 );
if( val && *val ){
{
rev_ARMultiSchemaFieldValueOrArithStruct( ctrl, h, k, &(p->operandRight) );
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "hv_fetch error: key \"right\"" );
return -1;
}
}
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_GENERAL, "rev_ARMultiSchemaArithOpStruct: hash value is not a hash reference" );
return -1;
}
}
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARMultiSchemaArithOpStruct: hv_fetch returned null");
return -2;
}
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL, "rev_ARMultiSchemaArithOpStruct: key doesn't exist");
( run in 0.904 second using v1.01-cache-2.11-cpan-39bf76dae61 )