Files
TeslaRel410/BORLAND/BDE/EXAMPLES/PASCAL/CONFIG.PAS
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

194 lines
6.5 KiB
ObjectPascal

{ config.pas }
program Config;
{$IfDef VER80}
uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs,
DbiProcs, DbiTypes, DbiErrs;
{$Else}
uses WinTypes, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs,
SnipTool, SnipData;
{$EndIf}
{=====================================================================
Procedure: DisplayCfgFile();
Input: CfgPath - Path within the CFG file to the desired
option within the configuration file. Starts
at '\' for the root of the configuration tree.
Level - Depth of Recursion.
Return: None.
Desc: This recursive function is used to display all information
within the configuration file.
===================================================================== }
procedure
DisplayCfgFile(CfgPath: pCHAR; Level: INT16);
var
rslt: DBIResult; { Value to return }
hList: hDBICur; { Handle to the Cursor }
szNode: pCHAR; { String which contains the name of the node }
pCfgDes: pCFGDesc; { Configuration Descriptor }
iLoop: INT16; { Loop variable - used in indenting depending
on the depth of the recursion. }
BaseSize: INT16; { Length of the Current node }
begin
{ Open the Configuration file - returns the configuration options
for the current level in a schema table referenced by hList. }
rslt := ChkRslt(DbiOpenCfgInfoList(nil, dbiREADONLY, cfgPersistent,
CfgPath, hList),
DBIERR_NONE, ' Error - OpenCfgInfoList.');
if (rslt = DBIERR_NONE) then
begin
{ Allocate resources }
GetMem(szNode, 512);
GetMem(pCfgDes, sizeof(CFGDesc));
{ Initialize descriptor to 0 }
FillChar(pCfgDes^, sizeof(CFGDesc), #0);
{ Process all nodes/paths
Get the next record in the table - contains the next option
of the given level in the tree. }
while (DbiGetNextRecord(hList, dbiNOLOCK, pCfgDes, nil)
= DBIERR_NONE) do
begin
{ Clear the szNode variable }
FillChar(szNode^, 512, #0);
{ Indent according to the depth of the configuration option }
for iLoop := 0 to Level do
StrCat(szNode, ' ');
{ Output this node, copying the name of the node to the
szNode variable. }
StrCat(szNode, pCfgDes^.szNodeName);
Screen(StrPas(szNode));
{ Process this node if it has sub-nodes }
if (pCfgDes^.bHasSubnodes) then
begin
{ Determine if this is a base node }
if (Level = 0) then
begin
StrCopy(szNode, CfgPath);
StrCat(szNode, pCfgDes^.szNodeName);
end
else { if not a base node }
begin
StrCopy(szNode, CfgPath);
StrCat(szNode, '\');
StrCat(szNode, pCfgDes^.szNodeName);
end;
{ Recursively call this function to get information about
sub-nodes }
DisplayCfgFile(szNode, (Level + 1));
end
else { Dump node information, as this node does not have }
begin { any sub-nodes }
{ Clear the szNode variable }
FillChar(szNode^, 512, #0);
{ Indent according to the depth of the configuration
option }
for iLoop := 0 to Level do
begin
StrCat(szNode, ' ');
end;
{ Determine the length of the string }
BaseSize := StrLen(szNode);
{ Display the remaining information
Display the Description of the node }
StrPCopy(@szNode[BaseSize], ' Desc: '+
''+pCfgDes^.szDescription+'');
Screen(StrPas(szNode));
{ Display the Type of the node }
StrPCopy(@szNode[BaseSize], ' Type: '+
''+IntToStr(pCfgDes^.iDataType)+'');
Screen(StrPas(szNode));
{ Display the Value of the node }
StrPCopy(@szNode[BaseSize], ' Val: '+pCfgDes^.szValue+' ');
Screen(StrPas(szNode));
end;
{ Initialize descriptor to 0 }
FillChar(pCfgDes^, sizeof(CFGDesc), #0);
end;
{ Clean up }
FreeMem(szNode, 512);
FreeMem(pCfgDes, sizeof(CFGDesc));
if (hList <> nil) then
begin
ChkRslt(DbiCloseCursor(hList), DBIERR_NONE,
' Error - CloseCursor.');
end;
end;
end;
{=====================================================================
Procedure: Configuration();
Input: None.
Return: None.
Description:
This example dumps the information contained in the
IDAPI configuration file, as well as displaying which
configuration file is being used.
===================================================================== }
var
sysConf: SYSConfig; { Used for storing the system configuration
information - used to determine the
location of the configuration file. }
begin
Screen('*** Configuration Example ***');
Screen(' Initializing IDAPI...');
InitOutput;
if (ChkRslt(DbiInit(nil), DBIERR_NONE, ' Error - Init.')
<> DBIERR_NONE) then
begin
CloseOutput;
Screen('*** End of Example ***');
exit;
end;
{ Determine which configuration file is being used... }
ChkRslt(DbiGetSysConfig(sysConf), DBIERR_NONE,
' Error - GetSysConfig.');
Screen(' Display the information in the currently used'+
' configuration file: ');
Screen('');
Screen('');
Screen(' '+StrPas(sysConf.szIniFile));
Screen('');
{ Call the recursive function which dumps information from the
configuration file. }
DisplayCfgFile ('\', 0) ;
Screen('');
Screen(' Exiting IDAPI...');
ChkRslt(Dbiexit, DBIERR_NONE, ' Error - exit');
CloseOutput;
Screen('*** End of Example ***');
end.