Files
TeslaRel410/BORLAND/BDE/EXAMPLES/SNIPIT/SNIPIT.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

175 lines
5.7 KiB
C++

// BDE - (C) Copyright 1994 by Borland International
#ifndef __SNIP_IT_H
#define __SNIP_IT_H
// Put all include files in one place to optimize pre-compiled headers
#include <windows.h>
#include <windowsx.h>
#include <stdarg.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <io.h> // access
#include <stdio.h> // sprintf
#include <direct.h> // getcwd
#include <idapi.h> // Only include needed for IDAPI...
#include "id_defs.h"
// Define used to break to the debugger
#define BREAK_IN_DEBUGGER() _asm int 3;
// Define used for Microsoft compilers
#if defined(_MSC_VER)
#define farmalloc(parm) _fmalloc(parm)
#define farfree(parm) _ffree(parm)
// Leave it blank on purpose as VC++ minds having far declared.
#define SNIPFAR
#endif
#if defined(__TURBOC__) && defined(_Windows)
#define SNIPFAR far
#endif
// General defines
#define NUM_RESOURCES 13
#define SUCCESS 1
#define FAILURE 0
#define GOOD_STR_COMPARE 0
#define BASE_MIN_WIDTH 320
#define BASE_MIN_HEIGHT 226
#define MAX_VIEW_CODE_MODULES 100
// These definitions help us to paint the screen
typedef enum
{
resBUTTON = 0,
resCOMBOBOX = 1,
resEDIT = 2,
resEDIT64 = 3,
resGROUP = 4,
resLISTBOX = 5,
resSTATIC = 6,
resSHADE = 7
} TypeRes;
typedef struct
{
TypeRes Res;
int Id;
char Text[80];
int X1, Y1;
int X2, Y2;
DWORD Attrib;
BOOL Resize;
} ResStruct;
// These defines are used during search_text()
typedef struct
{
pCHAR pText;
pCHAR pLastSearch;
pCHAR pSearchStr;
BOOL bCaseSens, bCancelPressed;
} SrchStruct;
// Defines related to WinMsg() input parameters
#define MSG_INFO 0 // Message box styles...
#define MSG_STOP 1
#define MSG_QUESTION 2
#define MSG_EXCLAMATION 3
#define BTN_OK 4 // Button styles...
#define BTN_YES_NO 5
#define BTN_OK_CANCEL 6
#define BTN_RETRY_CANCEL 7
#define BTN_YES_NO_CANCEL 8
// Global data
extern HINSTANCE hInst;
extern RECT DeskRect;
extern pCHAR GlobBuf;
extern ResStruct MainRes[];
extern HWND hMainWnd, hViewEdit, hDescEdit;
extern INT16 DialogWidthUnits, DialogHeightUnits, MinHeight, MinWidth;
extern WNDPROC fpStdEditBoxProc, fnTabEditBox[];
extern SrchStruct Search;
// Directory in which the tables exist. Full path name will be generated
// by the application
extern char far szTblDirectory[];
extern char far szPrivDirectory[];
// IDAPI specific data
extern hDBIDb SnipItDb;
// Structure used to define input array information
typedef struct
{
pCHAR pCodeName;
void (*pFunc)(void);
pCHAR pSourceFile;
UINT16 CodeDescId;
} VIEW_INPUT;
extern VIEW_INPUT far InputData[];
// Function prototypes for SNIPTOOL.C
void Screen(pCHAR Format, ...);
DBIResult ChkRslt(DBIResult rslt, pCHAR pMsg);
INT16 WinMsg(pCHAR pMsg, INT16 TypeMsg, INT16 TypeBtn);
DBIResult InitAndConnect(phDBIDb phDb);
DBIResult InitAndConnect2(phDBIDb phDb);
DBIResult CloseDbAndExit(phDBIDb phDb);
DBIResult FillTable(hDBIDb hDb, pCHAR TblName, pCHAR TblType,
FLOAT NumRecs);
DBIResult CreateAndFillTable(hDBIDb hDb, pCRTblDesc pTblDesc, FLOAT NumRecs,
phDBICur phCur);
DBIResult DisplayInMemoryTable(hDBICur hCur, UINT32 uDisplayNRecs);
DBIResult DisplayTable(hDBICur hCur, UINT32 uDisplayNRecs);
int MakeFullPath(pCHAR pszDirectory, pCHAR pszRelativeDirectory);
DBIResult DisplayNextRecord(hDBICur hCur);
DBIResult DisplayCurrentRecord(hDBICur hCur);
DBIResult PutFieldSample(hDBICur hCur, pBYTE pRecBuf,
UINT16 FldNum, pFLDDesc pfldDesc);
DBIResult SetupFields(CURProps TblProps, pFLDDesc pFldDescs,
CHAR** pszField, UINT16 uDefLength);
DBIResult GetFields(hDBICur hCur, pFLDDesc pFldDescs,
pBYTE pRecBuf, CHAR** pszField,
UINT16 uDefLength);
DBIResult FormatDate(DATE Date, pCHAR szDate);
DBIResult FormatTime(TIME Time, pCHAR szDate);
DBIResult FormatTimeStamp(TIMESTAMP TimeStamp, pCHAR szTime);
DBIResult FormatNumber(pCHAR szNumber);
// Function prototypes for SNIPUTIL.C
INT16 get_array_offset(void);
void yield_control(void);
void clear_multi_line_edit_box(HWND hWnd, INT16 EditId);
void fill_in_description(void);
void run_sample_code(void);
void view_sample_code(void);
// Function prototypes for exported functions
long FAR PASCAL _export MainWndProc(HWND, UINT, UINT, LONG);
BOOL FAR PASCAL _export AboutDlgProc(HWND, WORD, WORD, LONG);
BOOL FAR PASCAL _export ConnectDlgProc(HWND, WORD, WORD, LONG);
BOOL FAR PASCAL _export SearchDlgProc(HWND, WORD, WORD, LONG);
long FAR PASCAL _export TabEditBox(HWND, UINT, WORD, LONG);
// Function prototypes for SNIPMAIN.C
INT16 get_array_offset(void);
void yield_control(void);
void clear_multi_line_edit_box(HWND hWnd, INT16 EditId);
void fill_in_description(void);
void run_sample_code(void);
void view_sample_code(void);
void search_text(HWND hWnd, BOOL bSearchFirst);
char * StrStr(pCHAR pSourceString, pCHAR pSearchString);
BOOL CaseInsensitiveCompare(CHAR Char1, CHAR Char2);
void resize_resources(int MainWidth, int MainHeight);
FARPROC setup_tab_edit_box(HWND hWnd, int EditId);
void reset_connect_dialog(HWND hWnd, BOOL bResetAll);
LRESULT SendMsg(int Id, UINT Msg, WPARAM wParam, LPARAM lParam);
#endif