コード例 #1
0
ファイル: errapi.c プロジェクト: emazv72/core
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;
}
コード例 #2
0
ファイル: errapi.c プロジェクト: emazv72/core
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;
}
コード例 #3
0
ファイル: ctc.c プロジェクト: Petewg/V-harbour-core
/* 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;
}