- 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>
193 lines
4.3 KiB
C++
193 lines
4.3 KiB
C++
/*------------------------------------------------------------------------*/
|
|
/* */
|
|
/* LIST.H */
|
|
/* */
|
|
/* Copyright Borland International 1991, 1993 */
|
|
/* All Rights Reserved */
|
|
/* */
|
|
/*------------------------------------------------------------------------*/
|
|
|
|
#if !defined( __LIST_H )
|
|
#define __LIST_H
|
|
|
|
#define BI_OLDNAMES
|
|
|
|
#if !defined( __MEMMGR_H )
|
|
#include "classlib\MemMgr.h"
|
|
#endif // __MEMMGR_H
|
|
|
|
#if !defined( __COLLECT_H )
|
|
#include "classlib\obsolete\Collect.h"
|
|
#endif // __COLLECT_H
|
|
|
|
#pragma option -Vo-
|
|
#if defined( __BCOPT__ ) && !defined( __FLAT__ ) && !defined( _ALLOW_po )
|
|
#pragma option -po-
|
|
#endif
|
|
|
|
_CLASSDEF(List)
|
|
_CLASSDEF(ListIterator)
|
|
|
|
class _CLASSTYPE ListBlockInitializer
|
|
{
|
|
|
|
protected:
|
|
|
|
ListBlockInitializer();
|
|
~ListBlockInitializer();
|
|
|
|
static unsigned count;
|
|
|
|
};
|
|
|
|
class _CLASSTYPE List : public Collection, private ListBlockInitializer
|
|
{
|
|
|
|
public:
|
|
|
|
List() :
|
|
headEntry( 0, &tailEntry ),
|
|
tailEntry( 0, &tailEntry ),
|
|
head(&headEntry),
|
|
tail(&tailEntry),
|
|
itemsInContainer(0)
|
|
{
|
|
}
|
|
|
|
virtual ~List()
|
|
{
|
|
flush();
|
|
}
|
|
|
|
Object _FAR & peekHead() const
|
|
{
|
|
return ptrToRef(head->next->data);
|
|
}
|
|
|
|
void add( Object _FAR & );
|
|
virtual void detach( Object _FAR &, DeleteType = NoDelete );
|
|
virtual void flush( DeleteType = DefDelete );
|
|
|
|
virtual int isEmpty() const
|
|
{
|
|
return itemsInContainer == 0;
|
|
}
|
|
|
|
virtual countType getItemsInContainer() const
|
|
{
|
|
return itemsInContainer;
|
|
}
|
|
|
|
virtual ContainerIterator _FAR & initIterator() const;
|
|
|
|
virtual classType isA() const
|
|
{
|
|
return listClass;
|
|
}
|
|
|
|
virtual char _FAR *nameOf() const
|
|
{
|
|
return "List";
|
|
}
|
|
|
|
private:
|
|
|
|
class _CLASSTYPE ListElement
|
|
{
|
|
|
|
public:
|
|
|
|
ListElement( Object _FAR *o, ListElement _FAR *n = 0 )
|
|
{
|
|
data = o; next = n;
|
|
}
|
|
|
|
private:
|
|
|
|
ListElement _FAR *next;
|
|
Object _FAR *data;
|
|
|
|
void _FAR *operator new( size_t sz )
|
|
{
|
|
PRECONDITION( mgr != 0 );
|
|
return mgr->allocate( sz );
|
|
}
|
|
void operator delete( void _FAR *b )
|
|
{
|
|
PRECONDITION( mgr != 0 );
|
|
mgr->free( b );
|
|
}
|
|
|
|
static MemBlocks _FAR *mgr;
|
|
|
|
friend class List;
|
|
friend class ListIterator;
|
|
friend class ListBlockInitializer;
|
|
|
|
};
|
|
|
|
ListElement _FAR *head;
|
|
ListElement _FAR *tail;
|
|
|
|
ListElement headEntry, tailEntry;
|
|
|
|
unsigned itemsInContainer;
|
|
|
|
ListElement _FAR *findPred( const Object _FAR & o );
|
|
|
|
friend class ListIterator;
|
|
friend class ListBlockInitializer;
|
|
|
|
};
|
|
|
|
inline ListBlockInitializer::ListBlockInitializer()
|
|
{
|
|
PRECONDITION( count != UINT_MAX );
|
|
if( count++ == 0 )
|
|
List::ListElement::mgr =
|
|
new MemBlocks( sizeof(List::ListElement), 20 );
|
|
}
|
|
|
|
inline ListBlockInitializer::~ListBlockInitializer()
|
|
{
|
|
PRECONDITION( count != 0 );
|
|
if( --count == 0 )
|
|
{
|
|
delete List::ListElement::mgr;
|
|
List::ListElement::mgr = 0;
|
|
}
|
|
}
|
|
|
|
class _CLASSTYPE ListIterator : public ContainerIterator
|
|
{
|
|
|
|
public:
|
|
|
|
ListIterator( const List _FAR & );
|
|
virtual ~ListIterator();
|
|
|
|
virtual operator int();
|
|
virtual Object _FAR & current();
|
|
virtual Object _FAR & operator ++ ( int );
|
|
virtual Object _FAR & operator ++ ();
|
|
virtual void restart();
|
|
|
|
private:
|
|
|
|
List::ListElement _FAR *currentElement;
|
|
List::ListElement _FAR *startingElement;
|
|
};
|
|
|
|
inline ListIterator::ListIterator( const List _FAR & toIterate )
|
|
{
|
|
startingElement = currentElement = toIterate.head->next;
|
|
}
|
|
|
|
#if defined( __BCOPT__ ) && !defined( __FLAT__ ) && !defined( _ALLOW_po )
|
|
#pragma option -po.
|
|
#endif
|
|
#pragma option -Vo.
|
|
|
|
#endif // __LIST_H
|
|
|