- 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>
175 lines
6.0 KiB
ObjectPascal
175 lines
6.0 KiB
ObjectPascal
{ Range.pas }
|
|
program Range;
|
|
|
|
{$IfDef VER80}
|
|
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
|
|
DbiProcs, DbiTypes, DbiErrs;
|
|
{$Else}
|
|
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
|
|
SnipTool, SnipData;
|
|
{$EndIf}
|
|
|
|
const
|
|
szTblName = 'stock'; { Name of the table }
|
|
szTblType = szPARADOX; { Table type to use. }
|
|
|
|
{=====================================================================
|
|
Code: Range();
|
|
|
|
Input: None.
|
|
|
|
Return: None.
|
|
|
|
Description:
|
|
This example shows how to limit the accessible records
|
|
within a table using ranges.
|
|
===================================================================== }
|
|
|
|
var
|
|
hDb: hDBIDb; { Handle to the Database }
|
|
hCur: hDBICur; { Handle to the table }
|
|
TblProps: CURProps; { Table Properties }
|
|
pRecBufLow: pBYTE; { Record Buffer }
|
|
pRecBufHigh: pBYTE; { Record Buffer }
|
|
sLowRange, sHighRange: String;
|
|
const
|
|
uNumRecs: UINT32 = 0; { Number of records to display }
|
|
fLowRange: FLOAT = 2315.0; { Lowest Stock number to display }
|
|
fHighRange: FLOAT = 5313.0; { Highest Stock number to display }
|
|
fLowVendRange: FLOAT = 4000.0; { Lowest Vendor Number to display }
|
|
fHighVendRange: FLOAT = 6000.0; { Highest Vendor Number to display }
|
|
|
|
begin
|
|
Screen('*** Range Operations Example ***');
|
|
|
|
Screen(' Initializing IDAPI...');
|
|
if (InitAndConnect(hDb) <> DBIERR_NONE) then { Terminate example if }
|
|
begin { Initialization fails }
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
Screen(' Setting the default Database directory...');
|
|
ChkRslt(DbiSetDirectory(hDb, pCHAR(szTblDirectory)), DBIERR_NONE,
|
|
' Error - SetDirectory.');
|
|
|
|
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
|
|
CloseDbAndExit(hDb);
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
ChkRslt(DbiGetCursorProps(hCur, TblProps), DBIERR_NONE,
|
|
' Error - GetCursorProps.');
|
|
|
|
{ Allocate space for the Record Buffer }
|
|
GetMem(pRecBufLow, TblProps.iRecBufSize * sizeof(BYTE));
|
|
if not Assigned (pRecBufLow) then
|
|
begin
|
|
Screen(' Error - Could not allocate memory.');
|
|
CloseDbAndExit(hDb);
|
|
Screen('');
|
|
Screen('*** End of example ***');
|
|
exit;
|
|
end;
|
|
|
|
GetMem(pRecBufHigh, TblProps.iRecBufSize * sizeof(BYTE));
|
|
if not Assigned (pRecBufHigh) then
|
|
begin
|
|
Screen(' Error - Could not allocate memory.');
|
|
FreeMem(pRecBufLow, TblProps.iRecBufSize * sizeof(BYTE));
|
|
CloseDbAndExit(hDb);
|
|
Screen('');
|
|
Screen('*** End of example ***');
|
|
exit;
|
|
end;
|
|
|
|
Str(fLowRange:7:2, sLowRange);
|
|
Str(fHighRange:7:2, sHighRange);
|
|
Screen('');
|
|
Screen(' Change the range of the table: only display records');
|
|
Screen(' which have a "Stock No" between '+
|
|
' '+sLowRange+' and '+sHighRange+' ');
|
|
|
|
ChkRslt(DbiPutField(hCur, 1, pRecBufLow, @(fLowRange)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
ChkRslt(DbiPutField(hCur, 1, pRecBufHigh, @(fHighRange)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
ChkRslt(DbiSetRange(hCur, FALSE, 0, 0, pRecBufLow, FALSE, 0, 0,
|
|
pRecBufHigh, TRUE), DBIERR_NONE,
|
|
' Error - SetRange.');
|
|
|
|
ChkRslt(DbiSetToBegin(hCur), DBIERR_NONE,
|
|
' Error - SetToBegin.');
|
|
|
|
Screen('');
|
|
Screen(' Display the '+szTblName+' table...');
|
|
ChkRslt(DisplayInMemoryTable(hCur, uNumRecs), DBIERR_NONE,
|
|
' Error - DisplayInMemoryTable.');
|
|
|
|
Screen('');
|
|
Screen(' Change the range of the table: no range set');
|
|
ChkRslt(DbiResetRange(hCur), DBIERR_NONE, ' Error - SetRange.');
|
|
|
|
ChkRslt(DbiSetToBegin(hCur), DBIERR_NONE,
|
|
' Error - SetToBegin.');
|
|
|
|
Screen(' Display the '+szTblName+' table...');
|
|
ChkRslt(DisplayInMemoryTable(hCur, uNumRecs), DBIERR_NONE,
|
|
' Error - DisplayInMemoryTable.');
|
|
|
|
Screen('');
|
|
Screen(' Change to the secondary index on field two...');
|
|
ChkRslt(DbiSwitchToIndex(hCur, nil, nil, 2, FALSE),
|
|
DBIERR_NONE, ' Error - SwitchToIndex.');
|
|
|
|
Str(fLowVendRange:7:2, sLowRange);
|
|
Str(fHighVendRange:7:2, sHighRange);
|
|
Screen('');
|
|
Screen(' Change the range of the table: only display');
|
|
Screen(' records which have a Vendor No between '+
|
|
' '+sLowRange+' and '+sHighRange+' ');
|
|
|
|
ChkRslt(DbiPutField(hCur, 2, pRecBufLow, @(fLowVendRange)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
ChkRslt(DbiPutField(hCur, 2, pRecBufHigh, @(fHighVendRange)),
|
|
DBIERR_NONE, ' Error - PutField.');
|
|
|
|
ChkRslt(DbiSetRange(hCur, FALSE, 0, 0, pRecBufLow, FALSE, 0, 0,
|
|
pRecBufHigh, FALSE), DBIERR_NONE,
|
|
' Error - SetRange.');
|
|
|
|
ChkRslt(DbiSetToBegin(hCur), DBIERR_NONE,
|
|
' Error - SetToBegin.');
|
|
|
|
Screen('');
|
|
Screen(' Display the '+szTblName+' table...');
|
|
ChkRslt(DisplayInMemoryTable(hCur, uNumRecs), DBIERR_NONE,
|
|
' Error - DisplayInMemoryTable.');
|
|
|
|
{ Release allocated memory }
|
|
FreeMem(pRecBufLow, TblProps.iRecBufSize * sizeof(BYTE));
|
|
FreeMem(pRecBufHigh, TblProps.iRecBufSize * sizeof(BYTE));
|
|
|
|
Screen('');
|
|
Screen(' Close the '+szTblName+' table...');
|
|
ChkRslt(DbiCloseCursor(hCur), DBIERR_NONE,
|
|
' Error - CloseCursor.');
|
|
|
|
Screen(' Close the Database and exit IDAPI...');
|
|
CloseDbAndExit(hDb);
|
|
|
|
Screen('*** End of Example ***');
|
|
|
|
end.
|