Files
TeslaRel410/BORLAND/BDE/EXAMPLES/SNIPIT/ERRVAL.C
T
CydandClaude Fable 5 63312e07f9 source410: literal 4.10 source reconstruction + BC++ 4.52 fleet toolchain archived
- BORLAND/: Borland C++ 4.52 (chosen over 4.5 by byte-match: CODE/RP/CW32.LIB
  is identical to 4.52's install lib). BCC32/TLINK32/TLIB/MAKE run natively on
  Win11; CODE/BT/OPT.MAK is the shipped BTL4OPT.EXE's exact flag recipe
  (extender = Borland PowerPack DPMI32, not Phar Lap TNT).
- restoration/source410/: the literal 1995-form reconstruction of the missing
  BT game source (never mixed into CODE/). Round 1-3 state:
  * 6 of 10 surviving original TUs COMPILE CLEAN under the period toolchain
    (BTMSSN, BTCNSL, BTSCNRL, BTTEAM, BTL4MODE, BTL4ARND) - first builds
    since 1996.
  * BT_L4/BTL4APP.CPP pilot reconstruction: 12/12 functions, Fail() lands on
    its binary-recorded line 400 exactly.
  * BT/BTCNSL.HPP: console wire IDs recovered from the binary's ctors
    (Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1];
    TeamScore=12 flagged [T4]).
  * MUNGA/: 8 engine-header backfills back-dated from the BT412 WinTesla tree
    (VDATA numbering decomp-verified; AUDREND's OpenAL-era virtual removed -
    the period compiler is the drift detector).
  * Tooling: backdate.py (WinTesla->1995 header transform), compile410.sh
    (per-TU verification sweep under authentic OPT.MAK flags).
  * README: corrected roadmap - MECH.HPP is the capstone grown with the mech
    TU reconstructions; BTREG.CPP green = the header-family milestone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 07:33:26 -05:00

98 lines
3.7 KiB
C++

// BDE - (C) Copyright 1995 by Borland International
// errval.c
#include "snipit.h"
//=====================================================================
// Function:
// ErrVal();
//
// Description:
// IDAPI functions return error codes to inform the calling
// program if the function succeeded or failed. The return value
// will be equal to DBIERR_NONE when the function was
// successful.
// This example shows how to get information about an error
// when an IDAPI function returns a value other than DBIERR_NONE.
//=====================================================================
void
ErrVal (void)
{
DBIResult rslt; // Value returned from IDAPI functions
hDBIDb hDb; // Handle to the database
DBIMSG dbi_status; // Error String
DBIErrInfo ErrInfo; // Contains information about the error
Screen("*** Getting Error Information ***\r\n");
BREAK_IN_DEBUGGER();
// Open a standard database (used to access Paradox and dBASE
// tables), by using a NULL database type. Note that this will fail
// because we have not initialized IDAPI.
Screen(" Attempt to open the database...");
Screen(" Error Expected - Engine not initialized.");
rslt = DbiOpenDatabase("", NULL, dbiREADWRITE, dbiOPENSHARED,
NULL, 0, NULL, NULL, &hDb);
if ((rslt != DBIERR_CANTFINDODAPI) && (rslt != DBIERR_NOTINITIALIZED))
{
if (rslt != DBIERR_NONE)
{
// Note - make certain to call DbiGetErrorInfo() right after
// the error as it will only give information about the most
// recent error.
DbiGetErrorInfo(TRUE, &ErrInfo);
// Check to see if DbiGetErrorInfo is reporting information
// on the same error that you have. (Done in case DbiGetErrorInfo
// was not called immediately after the function which failed.)
if (ErrInfo.iError == rslt)
{
Screen(" ERROR - Cat:Code = [%xh:%xh]"
"\r\n %s",
ErrCat(ErrInfo.iError), ErrCode(ErrInfo.iError),
ErrInfo.szErrCode);
// Need to check how much information was provided -
// different errors return different amounts of information.
if (strcmp(ErrInfo.szContext1, ""))
{
Screen(" %s", ErrInfo.szContext1);
}
if (strcmp(ErrInfo.szContext2, ""))
{
Screen(" %s", ErrInfo.szContext2);
}
if (strcmp(ErrInfo.szContext3, ""))
{
Screen(" %s", ErrInfo.szContext3);
}
if (strcmp(ErrInfo.szContext4, ""))
{
Screen(" %s", ErrInfo.szContext4);
}
}
else
{
DbiGetErrorString(rslt, dbi_status);
Screen(" ERROR - Cat:Code [%xh:%xh]"
"\r\n %s", ErrCat(rslt), ErrCode(rslt),
dbi_status);
}
}
}
else
{
Screen(" Engine not initialized.");
}
// Check if this is the expected error.
if (rslt != DBIERR_NOTINITIALIZED)
{
Screen(" Unexpected Condition - terminating example");
}
Screen("\r\n*** End of Example ***");
}