HB_USHORT hb_errRT_BASE( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ULONG ulArgCount, ... ) { HB_USHORT uiAction; PHB_ITEM pError; PHB_ITEM pArray; va_list va; HB_ULONG ulArgPos; /* I replaced EF_CANRETRY with EF_NONE for Clipper compatibility * If it's wrong and I missed something please fix me, Druzus. */ pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_BASE, errGenCode, errSubCode, szDescription, szOperation, 0, EF_NONE /* EF_CANRETRY */ ); /* Build the array from the passed arguments. */ switch( ulArgCount ) { case 0: pArray = NULL; break; case HB_ERR_ARGS_BASEPARAMS: pArray = hb_pcount() ? hb_arrayBaseParams() : NULL; break; case HB_ERR_ARGS_SELFPARAMS: pArray = hb_arraySelfParams(); break; default: pArray = hb_itemArrayNew( ulArgCount ); va_start( va, ulArgCount ); for( ulArgPos = 1; ulArgPos <= ulArgCount; ulArgPos++ ) { PHB_ITEM pArg = va_arg( va, PHB_ITEM ); if( pArg ) hb_itemArrayPut( pArray, ulArgPos, pArg ); } va_end( va ); } if( pArray ) { /* Assign the new array to the object data item. */ hb_errPutArgsArray( pError, pArray ); /* Release the Array. */ hb_itemRelease( pArray ); } /* Ok, launch... */ uiAction = hb_errLaunch( pError ); /* Release. */ hb_errRelease( pError ); return uiAction; }
PHB_ITEM hb_errRT_BASE_Subst( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ULONG ulArgCount, ... ) { PHB_ITEM pRetVal; PHB_ITEM pError; PHB_ITEM pArray; va_list va; HB_ULONG ulArgPos; pError = hb_errRT_New_Subst( ES_ERROR, HB_ERR_SS_BASE, errGenCode, errSubCode, szDescription, szOperation, 0, EF_NONE ); /* Build the array from the passed arguments. */ switch( ulArgCount ) { case 0: pArray = NULL; break; case HB_ERR_ARGS_BASEPARAMS: pArray = hb_pcount() ? hb_arrayBaseParams() : NULL; break; case HB_ERR_ARGS_SELFPARAMS: pArray = hb_arraySelfParams(); break; default: pArray = hb_itemArrayNew( ulArgCount ); va_start( va, ulArgCount ); for( ulArgPos = 1; ulArgPos <= ulArgCount; ulArgPos++ ) { PHB_ITEM pArg = va_arg( va, PHB_ITEM ); if( pArg ) hb_itemArrayPut( pArray, ulArgPos, pArg ); } va_end( va ); } if( pArray ) { /* Assign the new array to the object data item. */ hb_errPutArgsArray( pError, pArray ); /* Release the Array. */ hb_itemRelease( pArray ); } /* Ok, launch... */ pRetVal = hb_errLaunchSubst( pError ); hb_errRelease( pError ); return pRetVal; }
static PHB_CODEPAGE _hb_jsonCdpPar( int iParam ) { if( hb_pcount() >= iParam ) { const char * szCdp = hb_parc( iParam ); if( szCdp ) return hb_cdpFindExt( szCdp ); } return NULL; }
static PHB_CODEPAGE _hb_jsonCdpPar( int iParam, HB_BOOL lVmCp ) { if( hb_pcount() >= iParam ) { const char * szCdp = hb_parc( iParam ); if( szCdp ) return hb_cdpFindExt( szCdp ); } else if( lVmCp ) return hb_vmCDP(); return NULL; }
static PHB_FFIND _hb_fileStart( HB_BOOL fNext, HB_BOOL fAny ) { PHB_FFDATA pFFData = HB_GET_FFDATA(); if( hb_pcount() > 0 ) { const char * szFile = hb_parc( 1 ); if( pFFData->ffind ) { hb_fsFindClose( pFFData->ffind ); pFFData->ffind = NULL; } if( szFile ) { HB_FATTR ulAttr; ulAttr = ( HB_FATTR ) hb_parnldef( 2, fAny ? HB_FA_ANY : HB_FA_ALL ); pFFData->ulAttr = hb_parl( 3 ) ? ulAttr : 0; pFFData->ffind = hb_fsFindFirst( szFile, ulAttr ); while( pFFData->ffind && pFFData->ulAttr && HB_FF_ATTR( pFFData->ffind ) != pFFData->ulAttr ) { if( ! hb_fsFindNext( pFFData->ffind ) ) { hb_fsFindClose( pFFData->ffind ); pFFData->ffind = NULL; } } } } else if( fNext && pFFData->ffind ) { do { if( ! hb_fsFindNext( pFFData->ffind ) ) { hb_fsFindClose( pFFData->ffind ); pFFData->ffind = NULL; break; } } while( pFFData->ulAttr && HB_FF_ATTR( pFFData->ffind ) != pFFData->ulAttr ); } return pFFData->ffind; }
static void hb_errRT_OLE( HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, HB_ERRCODE errOsCode, const char * szDescription, const char * szOperation ) { PHB_ITEM pError; pError = hb_errRT_New( ES_ERROR, "WINOLE", errGenCode, errSubCode, szDescription, szOperation, errOsCode, EF_NONE ); if( hb_pcount() != 0 ) { /* HB_ERR_ARGS_BASEPARAMS */ PHB_ITEM pArray = hb_arrayBaseParams(); hb_errPutArgsArray( pError, pArray ); hb_itemRelease( pArray ); } hb_errLaunch( pError ); hb_errRelease( pError ); }
/* This function creates an array item using 'iDimension' as an index * to retrieve the number of elements from the parameter list. */ static void hb_arrayNewRagged( PHB_ITEM pArray, int iDimension ) { HB_SIZE nElements; HB_TRACE( HB_TR_DEBUG, ( "hb_arrayNewRagged(%p, %d)", pArray, iDimension ) ); nElements = hb_parns( iDimension ); /* create an array */ hb_arrayNew( pArray, nElements ); if( ++iDimension <= hb_pcount() ) { /* call self recursively to create next dimensions */ while( nElements ) hb_arrayNewRagged( hb_arrayGetItemPtr( pArray, nElements-- ), iDimension ); } }
/* throwing a CT-subsystem error without value substitution - function adapted from errorapi.c */ HB_USHORT ct_error( HB_USHORT uiSeverity, HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode, HB_USHORT uiFlags, HB_ULONG ulArgCount, ... ) { HB_USHORT uiAction; PHB_ITEM pError; PHB_ITEM pArray; va_list va; HB_ULONG ulArgPos; HB_TRACE( HB_TR_DEBUG, ( "ct_error(%hu, %d, %d, %s, %s, %d, %hu, %lu)", uiSeverity, errGenCode, errSubCode, szDescription, szOperation, errOsCode, uiFlags, ulArgCount ) ); pError = hb_errRT_New( uiSeverity, CT_SUBSYSTEM, errGenCode, errSubCode, szDescription, szOperation, errOsCode, uiFlags ); /* Build the array from the passed arguments. */ if( ulArgCount == 0 ) { pArray = NULL; } else if( ulArgCount == HB_ERR_ARGS_BASEPARAMS ) { if( hb_pcount() == 0 ) pArray = NULL; else pArray = hb_arrayBaseParams(); } else if( ulArgCount == HB_ERR_ARGS_SELFPARAMS ) { pArray = hb_arraySelfParams(); } else { pArray = hb_itemArrayNew( ulArgCount ); va_start( va, ulArgCount ); for( ulArgPos = 1; ulArgPos <= ulArgCount; ulArgPos++ ) { hb_itemArrayPut( pArray, ulArgPos, va_arg( va, PHB_ITEM ) ); } va_end( va ); } if( pArray ) { /* Assign the new array to the object data item. */ hb_vmPushSymbol( hb_dynsymGetSymbol( "_ARGS" ) ); hb_vmPush( pError ); hb_vmPush( pArray ); hb_vmSend( 1 ); /* Release the Array. */ hb_itemRelease( pArray ); } /* launch error codeblock */ uiAction = hb_errLaunch( pError ); /* release error codeblock */ hb_errRelease( pError ); return uiAction; }