Files
TeslaRel410/BORLAND/BC45/INCLUDE/OWL/APPDICT.H
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

128 lines
3.3 KiB
C++

//----------------------------------------------------------------------------
// ObjectWindows
// (C) Copyright 1991, 1994 by Borland International, All Rights Reserved
//
// Defines class TAppDictionary. This class manages associations between
// processes/tasks and TApplication pointers.
//----------------------------------------------------------------------------
#if !defined(OWL_APPDICT_H)
#define OWL_APPDICT_H
#if !defined(OWL_OWLDEFS_H)
# include <owl/owldefs.h>
#endif
class _OWLCLASS TApplication;
#if !defined(BI_PLAT_WIN32)
inline unsigned GetCurrentProcessId() {return (unsigned)GetCurrentTask();}
#endif
//
// class TAppDictionary
// ----- --------------
//
class _OWLCLASS TAppDictionary {
public:
struct TEntry {
unsigned Pid;
TApplication* App;
};
typedef void (*TEntryIterator)(TEntry&);
public:
TAppDictionary();
~TAppDictionary();
TApplication* GetApplication(unsigned pid = 0); // default to current pid
void Add(TApplication* app, unsigned pid = 0);
void Remove(TApplication* app);
void Remove(unsigned pid);
void Condemn(TApplication* app);
bool DeleteCondemned();
void Iterate(TEntryIterator iter);
private:
#if defined(BI_APP_DLL) || defined(_OWLDLL) || defined(BI_PLAT_WIN32)
class TAppDictImp* Imp;
#else
TEntry E;
#endif
};
//
// Global exported TAppDictionary in Owl. User Component DLLs should have a
// similar 'AppDictionary'.
//
extern TAppDictionary _OWLDATA OwlAppDictionary;
//
// Global function that calls GetApplication() on owl's app-dictionary.
// Used by EXEs, or DLLs statically linking Owl. Never returns 0, will make
// an alias app if needed. Primarily for compatibility
//
TApplication* _OWLFUNC GetApplicationObject(unsigned pid = 0);
//
// Convenient macro to define a 'AppDictionary' ref and object as needed
// for use in component DLLs and EXEs
//
#if defined(BI_APP_DLL) && defined(_OWLDLL)
# define DEFINE_APP_DICTIONARY(AppDictionary) \
TAppDictionary AppDictionary
#else
# define DEFINE_APP_DICTIONARY(AppDictionary) \
TAppDictionary& AppDictionary = ::OwlAppDictionary
#endif
//----------------------------------------------------------------------------
// inlines
#if !defined(BI_APP_DLL) && !defined(_OWLDLL) && !defined(BI_PLAT_WIN32)
inline TAppDictionary::TAppDictionary() {
E.App = 0;
E.Pid = 0;
}
inline TAppDictionary::~TAppDictionary() {DeleteCondemned();}
inline TApplication* TAppDictionary::GetApplication(unsigned /*pid*/) {
return E.App;
}
inline void TAppDictionary::Add(TApplication* app, unsigned pid) {
E.App = app;
E.Pid = pid;
}
inline void TAppDictionary::Remove(TApplication* /*app*/) {
E.App = 0;
}
inline void TAppDictionary::Remove(unsigned /*pid*/) {
E.App = 0;
}
inline void TAppDictionary::Condemn(TApplication* /*app*/) {
E.Pid = 0;
}
inline bool TAppDictionary::DeleteCondemned() {
if (!E.Pid) {
delete E.App;
E.App = 0;
}
return false;
}
inline void TAppDictionary::Iterate(TEntryIterator iter) {
(*iter)(E);
}
#endif // !defined(BI_APP_DLL) && !defined(_OWLDLL)
#endif // OWL_APPDICT_H