char * hb_langName( void ) { char * pszName = ( char * ) hb_xgrab( 128 ); if( s_lang ) hb_snprintf( pszName, 128, "Harbour Language: %s %s (%s)", ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ID + HB_LANG_ITEM_ID_ID ), ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ID + HB_LANG_ITEM_ID_NAME ), ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ID + HB_LANG_ITEM_ID_NAMENAT ) ); else hb_xstrcpy( pszName, "Harbour Language: (not installed)", 0 ); return pszName; }
char * hb_langID( void ) { HB_TRACE( HB_TR_DEBUG, ( "hb_langID()" ) ); if( s_lang ) return ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ID + HB_LANG_ITEM_ID_ID ); else return NULL; }
PHB_ITEM hb_errRT_New_Subst( HB_USHORT uiSeverity, const char * szSubSystem, HB_ERRCODE errGenCode, HB_ERRCODE errSubCode, const char * szDescription, const char * szOperation, HB_ERRCODE errOsCode, HB_USHORT uiFlags ) { PHB_ITEM pError = hb_errNew(); hb_errPutSeverity( pError, uiSeverity ); hb_errPutSubSystem( pError, szSubSystem ? szSubSystem : HB_ERR_SS_BASE ); hb_errPutGenCode( pError, errGenCode ); hb_errPutSubCode( pError, errSubCode ); hb_errPutDescription( pError, szDescription ? szDescription : hb_langDGetItem( HB_LANG_ITEM_BASE_ERRDESC + errGenCode ) ); hb_errPutOperation( pError, szOperation ); hb_errPutOsCode( pError, errOsCode ); hb_errPutFlags( pError, ( HB_USHORT ) ( uiFlags | EF_CANSUBSTITUTE ) ); return pError; }
const char * hb_dateCDOW( int iDay ) { HB_TRACE( HB_TR_DEBUG, ( "hb_dateCDOW(%d)", iDay ) ); return ( iDay >= 1 && iDay <= 7 ) ? hb_langDGetItem( HB_LANG_ITEM_BASE_DAY + iDay - 1 ) : s_nullStr; }
const char * hb_dateCMonth( int iMonth ) { HB_TRACE( HB_TR_DEBUG, ( "hb_dateCMonth(%d)", iMonth ) ); return ( iMonth >= 1 && iMonth <= 12 ) ? hb_langDGetItem( HB_LANG_ITEM_BASE_MONTH + iMonth - 1 ) : s_nullStr; }
char * hb_dateCDOW( int iDay ) { HB_TRACE(HB_TR_DEBUG, ("hb_dateCDOW(%d)", iDay)); return ( iDay >= 1 && iDay <= 7 ) ? ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_DAY + iDay - 1 ) : ( char * ) ""; }
char * hb_dateCMonth( int iMonth ) { HB_TRACE(HB_TR_DEBUG, ("hb_dateCMonth(%d)", iMonth)); return ( iMonth >= 1 && iMonth <= 12 ) ? ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_MONTH + iMonth - 1 ) : ( char * ) ""; }
void hb_errInternalRaw( HB_ERRCODE errCode, const char * szText, const char * szPar1, const char * szPar2 ) { char buffer[ 8192 ]; char file[ HB_PATH_MAX ]; const char * szFile, * szInfo; HB_BOOL fStack, fLang; HB_USHORT uiLine; int iLevel; FILE * hLog; HB_TRACE( HB_TR_DEBUG, ( "hb_errInternal(%d, %s, %s, %s)", errCode, szText, szPar1, szPar2 ) ); if( szPar1 == NULL ) szPar1 = ""; if( szPar2 == NULL ) szPar2 = ""; fStack = hb_stackId() != NULL; fLang = fStack && hb_langID() != NULL; szFile = fStack ? hb_setGetCPtr( HB_SET_HBOUTLOG ) : NULL; if( ! szFile ) szFile = "hb_out.log"; hLog = hb_fopen( szFile, "a+" ); if( hLog ) { char szTime[ 9 ]; int iYear, iMonth, iDay; hb_dateToday( &iYear, &iMonth, &iDay ); hb_dateTimeStr( szTime ); fprintf( hLog, "Application Internal Error - %s\n", hb_cmdargARGVN( 0 ) ); fprintf( hLog, "Terminated at: %04d-%02d-%02d %s\n", iYear, iMonth, iDay, szTime ); szInfo = fStack ? hb_setGetCPtr( HB_SET_HBOUTLOGINFO ) : NULL; if( szInfo && *szInfo ) fprintf( hLog, "Info: %s\n", szInfo ); } hb_conOutErr( hb_conNewLine(), 0 ); if( fLang ) hb_snprintf( buffer, sizeof( buffer ), hb_langDGetItem( HB_LANG_ITEM_BASE_ERRINTR ), errCode ); else hb_snprintf( buffer, sizeof( buffer ), "Unrecoverable error %d: ", errCode ); hb_conOutErr( buffer, 0 ); if( hLog ) fprintf( hLog, "%s", buffer ); if( ! szText && fLang ) szText = hb_langDGetItem( HB_LANG_ITEM_BASE_ERRINTR + errCode - 9000 ); if( szText ) hb_snprintf( buffer, sizeof( buffer ), szText, szPar1, szPar2 ); else buffer[ 0 ] = '\0'; hb_conOutErr( buffer, 0 ); hb_conOutErr( hb_conNewLine(), 0 ); if( hLog ) fprintf( hLog, "%s\n", buffer ); if( fStack && hb_stackTotalItems() ) { iLevel = 0; while( hb_procinfo( iLevel++, buffer, &uiLine, file ) ) { char msg[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 32 ]; hb_snprintf( msg, sizeof( msg ), "Called from %s(%hu)%s%s\n", buffer, uiLine, *file ? " in " : "", file ); hb_conOutErr( msg, 0 ); if( hLog ) fprintf( hLog, "%s", msg ); } } if( hLog ) { fprintf( hLog, "------------------------------------------------------------------------\n" ); fclose( hLog ); } }
static const char * hb_nationGetMsg( int iMsg ) { HB_TRACE( HB_TR_DEBUG, ( "hb_nationGetMsg(%u)", iMsg ) ); return ( iMsg >= 1 && iMsg <= 13 ) ? hb_langDGetItem( HB_LANG_ITEM_BASE_NATMSG + iMsg - 1 ) : ""; }
char * hb_langDGetErrorDesc( ULONG ulIndex ) { HB_TRACE( HB_TR_DEBUG, ( "hb_langDGetErrorDesc(%lu)", ulIndex ) ); return ( char * ) hb_langDGetItem( HB_LANG_ITEM_BASE_ERRDESC + ulIndex ); }