- 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>
136 lines
4.6 KiB
ObjectPascal
136 lines
4.6 KiB
ObjectPascal
{ dbio.pas }
|
|
program Dbio;
|
|
|
|
{$IfDef VER80}
|
|
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
|
|
DbiProcs, DbiTypes, DbiErrs;
|
|
{$Else}
|
|
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
|
|
SnipTool, SnipData;
|
|
{$EndIf}
|
|
|
|
const
|
|
iNUMDB = 5;
|
|
|
|
{=====================================================================
|
|
Code: DatabaseIOSample();
|
|
|
|
Input: None.
|
|
|
|
Return: None.
|
|
|
|
Description:
|
|
This example shows how to open a number of Databases and get
|
|
information about those Databases.
|
|
===================================================================== }
|
|
|
|
var
|
|
rslt: DBIResult; { Value returned from IDAPI functions }
|
|
hDb: array[0..iNUMDB] of hDBIDb; { Array of handles to Databases }
|
|
hCur: hDBICur; { Handle to the table }
|
|
TblProps: CURProps; { Properties of the table }
|
|
szDir: array[0..DBIMAXPATHLEN] of CHAR; { String to hold the directory }
|
|
szMessage: array[0..100] of CHAR; { String to hold messages }
|
|
bBlank: BOOL; { Used to determine if a field is blank }
|
|
iOpenedDatabases: UINT16; { Count of the opened Databases }
|
|
iLoop: UINT16; { Loop variable }
|
|
DbDes: DbDesc; { Information about the databases}
|
|
|
|
begin
|
|
Screen('*** Database Manipulation Example ***');
|
|
|
|
Screen(' Initializing IDAPI...');
|
|
InitOutput;
|
|
if (ChkRslt(DbiInit(nil), DBIERR_NONE, ' Error - Init.')
|
|
<> DBIERR_NONE) then { Check if successfull }
|
|
begin
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
CloseOutput;
|
|
exit;
|
|
end;
|
|
|
|
{ Open up to iNUMDB databases. }
|
|
for iOpenedDatabases := 0 to iNUMDB-1 do
|
|
begin
|
|
Screen(' Open Database# '+IntToStr(iOpenedDatabases+1));
|
|
{ Open a database }
|
|
rslt := DbiOpenDatabase('', nil, dbiREADWRITE, dbiOPENSHARED,
|
|
nil, 0, nil, nil,
|
|
hDb[iOpenedDatabases]);
|
|
|
|
if (rslt <> DBIERR_NONE) then
|
|
begin
|
|
{ Know how to deal with running out of Database handles }
|
|
if (rslt = DBIERR_DBLIMIT) then
|
|
break;
|
|
ChkRslt(rslt, DBIERR_NONE, ' Error - OpenDatabase.');
|
|
|
|
DbiExit;
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
CloseOutput;
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
Screen('');
|
|
Screen(' Get the default directory for the first database...');
|
|
ChkRslt(DbiGetDirectory(hDb[0], FALSE, szDir),
|
|
DBIERR_NONE, ' Error - GetDirectory.');
|
|
|
|
Screen(' The working directory: '+StrPas(szDir)+' ');
|
|
|
|
Screen(' Change the directory which the first database uses...');
|
|
ChkRslt(DbiSetDirectory(hDb[0], pCHAR(szTblDirectory)),
|
|
DBIERR_NONE, ' Error - SetDirectory.');
|
|
|
|
{ Display information about the available databases.
|
|
Note that this example reads the data from the schema table
|
|
directly into a structure defined in IDAPI.H. This should
|
|
only be done with schema tables. }
|
|
rslt := DbiOpenDatabaseList(hCur);
|
|
|
|
if ( rslt = DBIERR_NONE ) then
|
|
begin
|
|
Screen('');
|
|
Screen(' Display information about the available databases:');
|
|
|
|
while (DbiGetNextRecord(hCur, dbiNOLOCK, @DbDes, nil) = DBIERR_NONE) do
|
|
begin
|
|
Screen('');
|
|
Screen(' Logical Name: '+StrPas(DbDes.szName)+' ');
|
|
Screen(' Description: '+StrPas(DbDes.szText)+' ');
|
|
Screen(' Physical name/path: '+StrPas(DbDes.szPhyName)+' ');
|
|
Screen(' Database type: '+StrPas(DbDes.szDbType)+' ');
|
|
end;
|
|
if (rslt <> DBIERR_EOF) then
|
|
begin
|
|
ChkRslt(rslt, DBIERR_NONE, ' Error - GetNextRecord.');
|
|
end;
|
|
end;
|
|
|
|
{ Place an empty line in the output edit control }
|
|
Screen('');
|
|
|
|
{ Clean up and return }
|
|
for iLoop := 0 to iOpenedDatabases do
|
|
begin
|
|
Screen(' Close Database# '+IntToStr(iLoop + 1)+' ');
|
|
{ Prepare the message to be displayed in case the closing
|
|
of the Database fails. }
|
|
StrPCopy(szMessage, ' Error - Close DB #'+IntToStr(iLoop+1)+' ');
|
|
rslt := ChkRslt(DbiCloseDatabase(hDb[iLoop]), DBIERR_NONE,
|
|
szMessage);
|
|
end;
|
|
|
|
Screen('');
|
|
Screen(' Clean up IDAPI');
|
|
DbiExit;
|
|
|
|
Screen('');
|
|
CloseOutput;
|
|
Screen('*** End of Example ***');
|
|
|
|
end.
|