- 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>
174 lines
5.8 KiB
ObjectPascal
174 lines
5.8 KiB
ObjectPascal
{ format.pas }
|
|
program Format;
|
|
|
|
{$IfDef VER80}
|
|
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
|
|
DbiProcs, DbiTypes, DbiErrs;
|
|
{$Else}
|
|
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
|
|
SnipTool, SnipData;
|
|
{$EndIf}
|
|
|
|
const
|
|
szTblName = 'FORMAT'; { Name of table to be created. }
|
|
szTblType = szPARADOX; { Table type to use. }
|
|
|
|
|
|
{ Field Descriptor used in creating a table }
|
|
fldDes: array[0..1] of FLDDesc = (
|
|
( { Field 1 - DATE }
|
|
iFldNum: 1;
|
|
szName: 'DATE';
|
|
iFldType: fldDATE;
|
|
iSubType: fldUNKNOWN;
|
|
iUnits1: 0;
|
|
iUnits2: 0;
|
|
iOffset: 0;
|
|
iLen: 0;
|
|
iNullOffset: 0;
|
|
efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
),
|
|
( { Field 2 - TIME }
|
|
iFldNum: 2; szName: 'TIME';
|
|
iFldType: fldTIME; iSubType: fldUNKNOWN;
|
|
iUnits1: 0; iUnits2: 0;
|
|
iOffset: 0; iLen: 0;
|
|
iNullOffset: 0; efldvVchk: fldvNOCHECKS;
|
|
efldrRights: fldrREADWRITE
|
|
)
|
|
); { Array of field descriptors }
|
|
|
|
|
|
{=====================================================================
|
|
Function:
|
|
Format();
|
|
|
|
Description:
|
|
This example shows how to change the formatting of
|
|
Date and Time fields.
|
|
===================================================================== }
|
|
|
|
var
|
|
hDb: hDBIDb; { Handle to the database }
|
|
hCur: hDBICur; { Handle to the table }
|
|
crTblDes: CRTblDesc; { Create table descriptor }
|
|
frmtDate: FMTDate; { Date format }
|
|
frmtTime: FMTTime; { Time format }
|
|
uNumFields: UINT16;
|
|
const
|
|
uDispNumRecs: UINT16 = 10; { Number of records to add and
|
|
display. }
|
|
|
|
begin
|
|
Screen('*** Changing the format of Date and Time ***');
|
|
Screen('');
|
|
|
|
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(crTblDes, sizeof(CRTblDesc), #0);
|
|
StrCopy(crTblDes.szTblName, szTblName);
|
|
StrCopy(crTblDes.szTblType, szTblType);
|
|
crTblDes.iFldCount := uNumFields;
|
|
crTblDes.pfldDesc := @fldDes;
|
|
|
|
Screen(' Creating the "'+szTblName+'" table...');
|
|
if (ChkRslt(DbiCreateTable(hDb, TRUE, crTblDes), 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 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...');
|
|
CloseDbAndExit(hDb);
|
|
Screen('');
|
|
Screen('*** End of Example ***');
|
|
exit;
|
|
end;
|
|
|
|
Screen(' Display the "'+szTblName+'" table with default date '+
|
|
'and time formats...');
|
|
DisplayTable(hCur, uDispNumRecs);
|
|
|
|
{ Get the format of the date }
|
|
ChkRslt(DbiGetDateFormat(frmtDate), DBIERR_NONE,
|
|
' Error - GetDateFormat.');
|
|
|
|
Screen('');
|
|
Screen(' Change the Date format: toggle between MM/DD/YY and'+
|
|
' DD/MM/YY...');
|
|
if (BYTE(frmtDate.iDateMode) <> 0) then
|
|
frmtDate.iDateMode := 0
|
|
else
|
|
frmtDate.iDateMode := 1;
|
|
|
|
{ Change the format of the date }
|
|
ChkRslt(DbiSetDateFormat(frmtDate), DBIERR_NONE,
|
|
' Error - SetDateFormat.');
|
|
|
|
{ Get the time format }
|
|
ChkRslt(DbiGetTimeFormat(frmtTime), DBIERR_NONE,
|
|
' Error - GetTimeFormat.');
|
|
|
|
Screen(' Change the Time format: toggle between 12 and 24 hour'+
|
|
' clock...');
|
|
if (frmtTime.bTwelveHour) then
|
|
frmtTime.bTwelveHour := FALSE
|
|
else
|
|
frmtTime.bTwelveHour := TRUE;
|
|
|
|
{ Change the time format }
|
|
ChkRslt(DbiSetTimeFormat(frmtTime), DBIERR_NONE,
|
|
' Error - SetDateFormat.');
|
|
|
|
ChkRslt(DbiSetToBegin(hCur), DBIERR_NONE, ' Error - SetToBegin.');
|
|
|
|
Screen(' Display the "'+szTblName+'" table with the Date and time'+
|
|
' formats changed...');
|
|
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('');
|
|
Screen('*** End of Example ***');
|
|
|
|
end.
|