Files
TeslaRel410/BORLAND/BC45/EXAMPLES/OCF/AUTOCALC/AUTOCALC.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

141 lines
4.6 KiB
C++

//----------------------------------------------------------------------------
// ObjectComponents - (C) Copyright 1994 by Borland International
//----------------------------------------------------------------------------
#include <ocf/ocfpch.h>
#include <ocf/automacr.h>
#include <ocf/ocreg.h>
#include "autocalc.rh"
class TUpdate : public TAutoProxy {
public:
TUpdate() : TAutoProxy(0x409) {}
void SetResult(long);
};
class TCalcButton : public TAutoBase {
public:
TCalcButton(HWND hWnd) : HWnd(hWnd) {}
HWND HWnd;
bool GetPush() {return (::SendMessage(HWnd, BM_GETSTATE, 0, 0) & 4) != 0;}
void SetPush(bool state) {::SendMessage(HWnd, BM_SETSTATE, state, 0);}
void SetText(char* text) {::SetWindowText(HWnd, text);}
char* GetText(){static char b[21]; return ::GetWindowText(HWnd,b,20)? b:0;}
DECLARE_AUTOCLASS(TCalcButton)
AUTOPROP (Push, GetPush, SetPush, TAutoBool,)
AUTOPROP (Text, GetText, SetText, TAutoString,)
};
class TCalcWindow;
class TCalcButtons { // class used only to temporarily expose collection
public:
TCalcButtons(HWND window) : HWnd(window) {}
short GetCount() { return IDC_LASTID - IDC_FIRSTID; }
HWND GetButton(short i) {return ::GetDlgItem(HWnd, i + IDC_FIRSTID+1);}
HWND HWnd;
DECLARE_AUTOCLASS(TCalcButtons)
AUTOFUNC0 (Count, GetCount, short,)
AUTOFUNC1 (Item, GetButton, TAutoObjectByVal<TCalcButton>, short,
AUTOVALIDATE(Arg1 >= 0 && Arg1 < This->GetCount()) )
AUTOITERATOR(int Id, Id = IDC_FIRSTID+1, Id <= IDC_LASTID, Id++,
TAutoObjectByVal<TCalcButton>(::GetDlgItem(This->HWnd,Id)))
};
class TCalcWindow : public TAutoBase {
public:
TCalcWindow() : hWnd(0), Background(0) {}
~TCalcWindow() { if (hWnd) ::DestroyWindow(hWnd); }
operator bool() {return hWnd != 0;}
operator HWND() {return hWnd;}
void SetCaption(const char far* text);
const char* GetCaption();
int GetWidth();
void SetWidth(int);
int GetHeight();
void SetHeight(int);
unsigned long GetBackground() { return Background; }
void SetBackground(long color);
long Background;
HWND hWnd;
DECLARE_AUTOCLASS(TCalcWindow)
AUTOPROP (Caption, GetCaption,SetCaption, TAutoString,)
AUTOPROP (Height, GetHeight,SetHeight, int,)
AUTOPROP (Width, GetWidth,SetWidth, int,)
AUTOPROP (Background, GetBackground,SetBackground, unsigned long,)
AUTODATARO(Buttons, hWnd, TAutoObjectByVal<TCalcButtons>,)
};
enum operators {
OP_NONE = 0,
OP_PLUS,
OP_MINUS,
OP_MULT,
OP_DIV,
OP_EQUALS,
OP_CLEAR,
};
#define COUNT 10
class TMyArray { // class used only to temporarily expose collection
public:
TMyArray(short* array) : Array(array) {}
short* Array;
long GetCount() {return COUNT;}
short GetItem(short index) {return Array[index];}
DECLARE_AUTOCLASS(TMyArray)
AUTOFUNC0 (Count, GetCount, long,)
AUTOFUNC1 (Item, GetItem, short, short,AUTOVALIDATE(Arg1>=0 && Arg1<COUNT))
AUTOITERATOR(int Index, Index=0, Index<COUNT, Index++, (This->Array)[Index])
};
class TCalc : public TAutoBase {
public:
TCalc(HINSTANCE hInst, uint32 options);
void Closed() {Window.hWnd = 0;}
// automated methods and properties
bool GetVisible();
void SetVisible(bool show);
bool Eval();
void Clear();
void Display();
bool Button(const char far* button);
TCalcWindow& GetWindow() { return Window; }
long LookAtWindow(const TCalcWindow& wnd) {return wnd.Background;}
int ButtonPush(int button); // not exposed via automation
uint32 Options;
private:
TUpdate Update; // callback to controller
TCalcWindow Window;
bool Entry;
// automated data members
short Op;
long Opnd;
long Accum;
short Elem[COUNT];
DECLARE_AUTOCLASS(TCalc)
AUTODATA (Accum, Accum, long, )
AUTODATA (Opnd, Opnd, long, )
AUTODATA (Op, Op, short, AUTOVALIDATE(Val>=OP_NONE && Val<=OP_CLEAR))
AUTOFUNC0 (Eval, Eval, TAutoBool, )
AUTOFUNC0V(Clear, Clear, )
AUTOFUNC0V(Display, Display, )
AUTOFUNC1 (Button, Button, TAutoBool, TAutoString,)
AUTOPROPRO(Window, GetWindow, TAutoObject<TCalcWindow>, )
AUTOFUNC1 (LookAt, LookAtWindow, long, TAutoObject<const TCalcWindow>,)
AUTODATARO(MyArray, Elem, TAutoObjectByVal<TMyArray>,)
AUTOPROXY (Update, Update, )
AUTOPROP (Visible, GetVisible, SetVisible, TAutoBool,)
};