- 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>
261 lines
11 KiB
ObjectPascal
261 lines
11 KiB
ObjectPascal
{ cr8pxtbl.pas }
|
|
program Cr8PxTbl;
|
|
|
|
{$IfDef VER80}
|
|
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
|
|
DbiProcs, DbiTypes, DbiErrs;
|
|
{$Else}
|
|
uses WinTypes, WinProcs, WinCrt, Strings, DbiProcs,
|
|
DbiTypes, DbiErrs, SnipTool, SnipData;
|
|
{$EndIf}
|
|
|
|
const
|
|
szTblName = 'CR8PXTBL'; { Name of table to be created. }
|
|
szTblType = szPARADOX; { Table type to use. }
|
|
|
|
{ Field Descriptor used in creating a table }
|
|
const
|
|
fldDes: array[0..16] of FLDDesc = (
|
|
( { Field 1 - AUTOINC }
|
|
iFldNum: 1; { Field Number }
|
|
szName: 'AUTOINC'; { Field Name }
|
|
iFldType: fldINT32; { Field Type }
|
|
iSubType: fldstAUTOINC; { Field Subtype }
|
|
iUnits1: 0; { Field Size }
|
|
iUnits2: 0; { Decimal places ( 0 ) }
|
|
iOffset: 0; { Offset in record ( 0 ) }
|
|
iLen: 0; { Length in Bytes ( 0 ) }
|
|
iNullOffset: 0; { For Null Bits ( 0 ) }
|
|
efldvVchk: fldvNOCHECKS; { Validiy checks ( 0 ) }
|
|
efldrRights: fldrREADWRITE { Rights }
|
|
),
|
|
( { Field 2 - ALPHA }
|
|
iFldNum: 2; szName: 'ALPHA';
|
|
iFldType: fldZSTRING; iSubType: fldUNKNOWN;
|
|
iUnits1: 10; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 3 - NUMERIC }
|
|
iFldNum: 3; szName: 'NUMERIC';
|
|
iFldType: fldFLOAT; iSubType: fldUNKNOWN;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 5 - MONEY }
|
|
iFldNum: 4; szName: 'MONEY';
|
|
iFldType: fldFLOAT; iSubType: fldstMONEY;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 4 - DATE }
|
|
iFldNum: 5; szName: 'DATE';
|
|
iFldType: fldDATE; iSubType: fldUNKNOWN;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 4 - SHORT }
|
|
iFldNum: 6; szName: 'SHORT';
|
|
iFldType: fldINT16; iSubType: fldUNKNOWN;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 7 - TIME }
|
|
iFldNum: 7; szName: 'TIME';
|
|
iFldType: fldTIME; iSubType: fldUNKNOWN;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 8 - TIMESTAMP }
|
|
iFldNum: 8; szName: 'TIMESTAMP';
|
|
iFldType: fldTIMESTAMP; iSubType: fldUNKNOWN;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 9 - LONG }
|
|
iFldNum: 9; szName: 'LONG';
|
|
iFldType: fldINT32; iSubType: fldUNKNOWN;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 10 - BOOL }
|
|
iFldNum: 10; szName: 'BOOL';
|
|
iFldType: fldBOOL; iSubType: fldUNKNOWN;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 11 - BYTES }
|
|
iFldNum: 11; szName: 'BYTES';
|
|
iFldType: fldBYTES; iSubType: fldUNKNOWN;
|
|
iUnits1: 20; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 12 - BCD }
|
|
iFldNum: 12; szName: 'BCD';
|
|
iFldType: fldBCD; iSubType: fldUNKNOWN;
|
|
iUnits1: 24; iUnits2: 5;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 13 - MEMO }
|
|
iFldNum: 13; szName: 'MEMO';
|
|
iFldType: fldBLOB; iSubType: fldstMEMO;
|
|
iUnits1: 20; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
|
|
),
|
|
( { Field 14 - BINARYBLOB }
|
|
iFldNum: 14; szName: 'BINARYBLOB';
|
|
iFldType: fldBLOB; iSubType: fldstBINARY;
|
|
iUnits1: 20; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 15 - FMTMEMO }
|
|
iFldNum: 15; szName: 'FMTMEMO';
|
|
iFldType: fldBLOB; iSubType: fldstFMTMEMO;
|
|
iUnits1: 20; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 16 - OLEOBJ }
|
|
iFldNum: 16; szName: 'OLEOBJ';
|
|
iFldType: fldBLOB; iSubType: fldstOLEOBJ;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 17 - GRAPHIC }
|
|
iFldNum: 17; szName: 'GRAPHIC';
|
|
iFldType: fldBLOB; iSubType: fldstGRAPHIC;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
)
|
|
); { Array of field descriptors }
|
|
|
|
|
|
{=====================================================================
|
|
Procedure: CreateAndFillSamplePX();
|
|
|
|
Input: None.
|
|
|
|
Return: None.
|
|
|
|
Description:
|
|
This sample code will create a Paradox table, append
|
|
10 records to the table, and then delete the table.
|
|
|
|
Note: The new, Paradox 5.0 Field types are used as part of this
|
|
example. Because of this, the table generated by this
|
|
example cannot be viewed in Paradox 4.5.
|
|
===================================================================== }
|
|
|
|
var
|
|
hDb: hDBIDb; { Handle to the database }
|
|
hCur: hDBICur; { Handle to the table }
|
|
TblDesc: CRTblDesc; { Create table descriptor }
|
|
uNumFields: INT16;
|
|
const
|
|
uDispNumRecs: UINT16 = 10; { Number of records to add and
|
|
display. }
|
|
|
|
begin
|
|
Screen('*** Create/Open/Fill Table Example ***');
|
|
|
|
Screen(' Initializing IDAPI...');
|
|
if (InitAndConnect(hDb) <> DBIERR_NONE) then
|
|
begin
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
{ The number of fields in the table - note that fldDesc is defined
|
|
globally }
|
|
uNumFields := trunc(sizeof(fldDes) / sizeof (fldDes[0]));
|
|
|
|
Screen(' Setting the default Database directory...');
|
|
ChkRslt(DbiSetDirectory(hDb, pCHAR(szTblDirectory)), DBIERR_NONE,
|
|
' Error - SetDirectory.');
|
|
|
|
Screen(' Initializing the table descriptor...');
|
|
FillChar(TblDesc, sizeof(CRTblDesc), #0);
|
|
lStrCpy(TblDesc.szTblName, szTblName);
|
|
lStrCpy(TblDesc.szTblType, szTblType);
|
|
TblDesc.iFldCount := uNumFields;
|
|
TblDesc.pfldDesc := @fldDes;
|
|
|
|
Screen(' Creating the '+szTblName+' Paradox table...');
|
|
if (ChkRslt(DbiCreateTable(hDb, TRUE, TblDesc), DBIERR_NONE,
|
|
' Error - CreateTable.') <> DBIERR_NONE) then
|
|
begin
|
|
Screen(' Close the Database and exit IDAPI...');
|
|
CloseDbAndexit(hDb);
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
Screen(' Fill the '+szTblName+' table with Random Data...');
|
|
FillTable(hDb, pCHAR(szTblName), pCHAR(szTblType), uDispNumRecs);
|
|
|
|
Screen(' Open the '+szTblName+' table...');
|
|
if (ChkRslt(DbiOpenTable(hDb, pCHAR(szTblName), pCHAR(szTblType),
|
|
nil, nil, 0, dbiREADWRITE, dbiOPENSHARED,
|
|
xltFIELD, FALSE, nil, hCur),
|
|
DBIERR_NONE, ' Error - OpenTable.') <> DBIERR_NONE) then
|
|
begin
|
|
Screen(' Close the Database and exit IDAPI...');
|
|
DbiDeleteTable(hDb, pCHAR(szTblName), pCHAR(szTblType));
|
|
CloseDbAndexit(hDb);
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
Screen(' Display the '+szTblName+' table which we just created...');
|
|
DisplayTable(hCur, uDispNumRecs);
|
|
|
|
Screen('');
|
|
Screen(' Close the '+szTblName+' Table...');
|
|
ChkRslt(DbiCloseCursor(hCur), DBIERR_NONE,
|
|
' Error - CloseCursor.');
|
|
|
|
Screen(' Deleting the '+szTblName+' table...');
|
|
ChkRslt(DbiDeleteTable(hDb, pCHAR(szTblName), pCHAR(szTblType)),
|
|
DBIERR_NONE, ' Error - DeleteTable.');
|
|
|
|
Screen(' Close the Database and exit IDAPI...');
|
|
CloseDbAndexit(hDb);
|
|
|
|
Screen('*** End of Example ***');
|
|
|
|
end.
|