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>
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma hdrstop
|
||||
|
||||
#include "idehook.h"
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
static char realCppPreprocess[] = "CppPreprocessor";
|
||||
static char myPreprocessorName[] = "CppPreprocessAndSee";
|
||||
|
||||
|
||||
class _HOOKCLASS LocalToolClient : public ToolClient
|
||||
{
|
||||
public:
|
||||
ToolReturn _HOOKEP RunPreprocessor( ToolInvokeArgs * );
|
||||
|
||||
void RegisterMyCallBacks( ToolServer * );
|
||||
|
||||
private:
|
||||
|
||||
int registered;
|
||||
static ToolRegisterPack entryPoints[];
|
||||
|
||||
};
|
||||
|
||||
static LocalToolClient localToolClient;
|
||||
|
||||
ToolRegisterPack LocalToolClient::entryPoints[] =
|
||||
{
|
||||
{ myPreprocessorName, (ToolMethod)&LocalToolClient::RunPreprocessor },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
void
|
||||
LocalToolClient::RegisterMyCallBacks( ToolServer * ts )
|
||||
{
|
||||
if( !registered )
|
||||
{
|
||||
registered = 1;
|
||||
ts->ToolRegisterImplementor( this, entryPoints );
|
||||
}
|
||||
}
|
||||
|
||||
ToolReturn _HOOKEP
|
||||
LocalToolClient::RunPreprocessor( ToolInvokeArgs * args )
|
||||
{
|
||||
ToolReq server;
|
||||
|
||||
ProjectNode node = args->numNodes ? *args->nodeArray : 0;
|
||||
|
||||
ToolObj preprocessor = server->ToolFind( realCppPreprocess );
|
||||
ToolObj editTool = 0;
|
||||
|
||||
if( preprocessor )
|
||||
{
|
||||
if( server->ToolInvoke( preprocessor, node, 0 ) == Success )
|
||||
{
|
||||
if( (editTool = server->ToolFind( "EditText" )) == 0 )
|
||||
{
|
||||
::MessageBox( ::GetActiveWindow(),
|
||||
"Can't find editor!",
|
||||
"Error!",
|
||||
MB_ICONEXCLAMATION | MB_OK );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
::MessageBox( ::GetActiveWindow(),
|
||||
"CppPreprocess did not complete ok!",
|
||||
"Error!",
|
||||
MB_ICONEXCLAMATION | MB_OK );
|
||||
}
|
||||
}
|
||||
|
||||
if( editTool )
|
||||
{
|
||||
ProjectNodeInfo nodeInfo;
|
||||
ProjectReq projectServer;
|
||||
|
||||
projectServer->QueryNodeInfo( node, nodeInfo );
|
||||
|
||||
char * str = new char [ strlen( nodeInfo.outputLocation ) + 3 ];
|
||||
|
||||
strcpy( str, nodeInfo.outputLocation );
|
||||
|
||||
char * pdot = strrchr( str, '.' );
|
||||
|
||||
if( pdot )
|
||||
*pdot = 0;
|
||||
|
||||
strcat( str, ".i" );
|
||||
|
||||
return( server->ToolInvoke( editTool, str ) );
|
||||
}
|
||||
|
||||
return( Errors );
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Project stuff
|
||||
//
|
||||
class _HOOKCLASS LocalProjClient : public ProjectClient
|
||||
{
|
||||
public:
|
||||
LocalProjClient();
|
||||
|
||||
virtual void _HOOKEP OpenNotify
|
||||
(
|
||||
const char * name
|
||||
);
|
||||
|
||||
virtual void _HOOKEP CloseNotify();
|
||||
|
||||
virtual void _HOOKEP NodeDeleteNotify
|
||||
(
|
||||
ProjectNode
|
||||
);
|
||||
|
||||
virtual void _HOOKEP DependencyQueryResponder
|
||||
(
|
||||
ProjectNode ,
|
||||
const char *
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
static LocalProjClient LocalProjClient;
|
||||
|
||||
LocalProjClient::LocalProjClient()
|
||||
{
|
||||
ProjectReq ps;
|
||||
|
||||
ps->RegisterProjectClient(this);
|
||||
}
|
||||
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::OpenNotify
|
||||
(
|
||||
const char * // name
|
||||
)
|
||||
{
|
||||
ToolReq ts;
|
||||
|
||||
localToolClient.RegisterMyCallBacks( ts );
|
||||
|
||||
if( !ts->ToolFind( myPreprocessorName ) )
|
||||
{
|
||||
ToolObj realPreProcessor;
|
||||
|
||||
if( (realPreProcessor = ts->ToolFind( realCppPreprocess )) != 0 )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
ts->QueryToolInfo( realPreProcessor, toolInfo );
|
||||
|
||||
toolInfo.toolType = Viewer;
|
||||
toolInfo.name = myPreprocessorName;
|
||||
toolInfo.menuName = "&Preprocess and see";
|
||||
toolInfo.defCmdLine = 0;
|
||||
toolInfo.helpHint = "Preprocess a c/c++ file and dump"
|
||||
" into editor";
|
||||
toolInfo.launchId = CALLBACK_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::CloseNotify()
|
||||
{
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::NodeDeleteNotify
|
||||
(
|
||||
ProjectNode
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::DependencyQueryResponder
|
||||
(
|
||||
ProjectNode ,
|
||||
const char *
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
LIBRARY CPPNSEE
|
||||
DESCRIPTION 'Frank Borland'
|
||||
EXETYPE WINDOWS
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
HEAPSIZE 4096
|
||||
SEGMENTS
|
||||
_TEXT PRELOAD MOVEABLE
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME
|
||||
IDELIBMAIN @2
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma hdrstop
|
||||
|
||||
#include "idehook.h"
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
// Editor addon
|
||||
|
||||
static char szClassHeader[] =
|
||||
{
|
||||
"//\n"
|
||||
"// Class:\n"
|
||||
"//\n"
|
||||
"// Description:\n"
|
||||
"//\n"
|
||||
"// Last modified date:\n"
|
||||
"// Last modified by: \n"
|
||||
"//\n"
|
||||
};
|
||||
|
||||
|
||||
int KeyStrokeTest2( KeyStroke * )
|
||||
{
|
||||
EditorReq editor;
|
||||
|
||||
long line;
|
||||
long col;
|
||||
|
||||
editor->inq_position( &line, &col );
|
||||
while( col-- )
|
||||
editor->left();
|
||||
editor->down();
|
||||
|
||||
editor->insert( szClassHeader );
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int KeyStrokeTest1( KeyStroke * )
|
||||
{
|
||||
EditorReq editor;
|
||||
|
||||
long line;
|
||||
long col;
|
||||
|
||||
editor->inq_position( &line, &col );
|
||||
while( col-- )
|
||||
editor->left();
|
||||
editor->drop_anchor();
|
||||
editor->end_of_line();
|
||||
editor->raise_anchor();
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Project stuff
|
||||
//
|
||||
|
||||
class _HOOKCLASS LocalProjClient : public ProjectClient
|
||||
{
|
||||
public:
|
||||
LocalProjClient();
|
||||
|
||||
virtual void _HOOKEP OpenNotify( const char * name );
|
||||
virtual void _HOOKEP CloseNotify() {}
|
||||
virtual void _HOOKEP NodeDeleteNotify(ProjectNode) {}
|
||||
virtual void _HOOKEP DependencyQueryResponder(ProjectNode,const char*) {}
|
||||
|
||||
int _registered;
|
||||
|
||||
};
|
||||
|
||||
LocalProjClient::LocalProjClient()
|
||||
{
|
||||
ProjectReq ps;
|
||||
|
||||
ps->RegisterProjectClient(this);
|
||||
}
|
||||
|
||||
static LocalProjClient LocalProjClient;
|
||||
|
||||
|
||||
#define NUM_KEYSTROKES (sizeof(keyStrokes)/sizeof(keyStrokes[0]))
|
||||
|
||||
static KeyStroke keyStrokes[] =
|
||||
{
|
||||
{ WM_KEYDOWN, VK_F11, NoModifier, KeyStrokeTest2 },
|
||||
{ WM_KEYDOWN, VK_F11, Shift, KeyStrokeTest1 }
|
||||
};
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::OpenNotify
|
||||
(
|
||||
const char * // name
|
||||
)
|
||||
{
|
||||
if( !_registered )
|
||||
{
|
||||
EditorReq editor;
|
||||
|
||||
editor->register_keyhit_handlers( keyStrokes, NUM_KEYSTROKES );
|
||||
|
||||
_registered = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
LIBRARY EDHOOK
|
||||
DESCRIPTION 'Frank Borland'
|
||||
EXETYPE WINDOWS
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
HEAPSIZE 4096
|
||||
SEGMENTS
|
||||
_TEXT PRELOAD MOVEABLE
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME
|
||||
IDELIBMAIN @2
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma hdrstop
|
||||
|
||||
#include "idehook.h"
|
||||
#include "pathspec.h"
|
||||
#include <cstring.h>
|
||||
|
||||
static char genVbxTransferName[] = "VbxHeaderGen";
|
||||
static char genVbxViewerName[] = "VbxHeaderNodeGen";
|
||||
static char genVbxTranslatorName[] = "VbxTranslator";
|
||||
static char genVbxPath[] = "vbxgen.exe";
|
||||
static char genVbxMenuName[] = "&Generate VBX Header";
|
||||
static char genVbxHelpHint[] = "Generate header files for VBX controls";
|
||||
|
||||
|
||||
static char VBXFilter[] = "VBX Controls (*.vbx)|*.vbx|"
|
||||
"All Files (*.*)|*.*|";
|
||||
static char DotHFilter[] = "Header File (*.h)|*.h|"
|
||||
"All Files (*.*)|*.*|";
|
||||
|
||||
|
||||
|
||||
class _HOOKCLASS LocalToolClient : public ToolClient
|
||||
{
|
||||
public:
|
||||
ToolReturn _HOOKEP RunVbxHeaderGen( ToolInvokeArgs * );
|
||||
|
||||
void RegisterMyCallBacks( ToolServer * );
|
||||
|
||||
private:
|
||||
int registered;
|
||||
static ToolRegisterPack entryPoints[];
|
||||
|
||||
};
|
||||
|
||||
static LocalToolClient localToolClient;
|
||||
|
||||
ToolRegisterPack LocalToolClient::entryPoints[] =
|
||||
{
|
||||
{ genVbxViewerName, (ToolMethod)&LocalToolClient::RunVbxHeaderGen },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
void
|
||||
LocalToolClient::RegisterMyCallBacks( ToolServer * ts )
|
||||
{
|
||||
if( !registered )
|
||||
{
|
||||
registered = 1;
|
||||
ts->ToolRegisterImplementor( this, entryPoints );
|
||||
}
|
||||
}
|
||||
|
||||
ToolReturn _HOOKEP
|
||||
LocalToolClient::RunVbxHeaderGen( ToolInvokeArgs * args )
|
||||
{
|
||||
PathSpec vbxPath;
|
||||
PathSpec headerPath;
|
||||
|
||||
if( vbxPath.openFileDialog( VBXFilter ) )
|
||||
{
|
||||
headerPath.path( vbxPath.path() );
|
||||
headerPath.ext( ".h" );
|
||||
|
||||
if( headerPath.newFileDialog( DotHFilter ) )
|
||||
{
|
||||
ToolReq ts;
|
||||
|
||||
ToolObj vbxGenner = ts->ToolFind( genVbxTransferName );
|
||||
|
||||
string cmdLine;
|
||||
|
||||
cmdLine = vbxPath.path();
|
||||
cmdLine += " ";
|
||||
cmdLine += headerPath.path();
|
||||
|
||||
if
|
||||
(
|
||||
( ts->ToolInvoke( vbxGenner, (const char *)0, cmdLine.c_str() ) )
|
||||
== Success
|
||||
)
|
||||
{
|
||||
ProjectReq project;
|
||||
|
||||
int count = args->numNodes;
|
||||
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
ProjectNode parent = args->nodeArray[i];
|
||||
|
||||
project->NodeAdd( parent, headerPath.path() );
|
||||
}
|
||||
|
||||
ts->ToolInvoke( ts->ToolFind( "EditText" ), headerPath.path() );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return( Success );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Project stuff
|
||||
//
|
||||
|
||||
class _HOOKCLASS LocalProjClient : public ProjectClient
|
||||
{
|
||||
public:
|
||||
LocalProjClient();
|
||||
|
||||
virtual void _HOOKEP OpenNotify ( const char * name );
|
||||
virtual void _HOOKEP CloseNotify() {}
|
||||
virtual void _HOOKEP NodeDeleteNotify( ProjectNode ) {}
|
||||
virtual void _HOOKEP DependencyQueryResponder(ProjectNode,const char *) {}
|
||||
};
|
||||
|
||||
static LocalProjClient LocalProjClient;
|
||||
|
||||
LocalProjClient::LocalProjClient()
|
||||
{
|
||||
ProjectReq ps;
|
||||
|
||||
ps->RegisterProjectClient(this);
|
||||
}
|
||||
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::OpenNotify
|
||||
(
|
||||
const char * // name
|
||||
)
|
||||
{
|
||||
ToolReq ts;
|
||||
|
||||
localToolClient.RegisterMyCallBacks( ts );
|
||||
|
||||
if( !ts->ToolFind( genVbxTransferName ) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
// //
|
||||
// Install this as simple 'Tool' menu transfer //
|
||||
// It will run the tool 'straight' //
|
||||
// //
|
||||
|
||||
toolInfo.toolType = Transfer;
|
||||
toolInfo.name = genVbxTransferName;
|
||||
toolInfo.path = genVbxPath;
|
||||
toolInfo.flags = OnToolsMenu;
|
||||
toolInfo.menuName = genVbxMenuName;
|
||||
toolInfo.helpHint = genVbxHelpHint;
|
||||
toolInfo.defCmdLine = "$PROMPT";
|
||||
toolInfo.appliesTo = 0;
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = DEFAULT_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
|
||||
// //
|
||||
// Install this as a Viewer on [.c] and [.cpp] //
|
||||
// We will implement the tool here (above) by //
|
||||
// putting put our own FileOpen dialogs and //
|
||||
// adding the results into tree. //
|
||||
// //
|
||||
|
||||
toolInfo.toolType = Viewer;
|
||||
toolInfo.name = genVbxViewerName;
|
||||
toolInfo.path = 0;
|
||||
toolInfo.flags = OnLocalMenu;
|
||||
toolInfo.menuName = genVbxMenuName;
|
||||
toolInfo.helpHint = genVbxHelpHint;
|
||||
toolInfo.defCmdLine = 0;
|
||||
toolInfo.appliesTo = ".cpp;.c;";
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = CALLBACK_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
|
||||
// //
|
||||
// Install this as a translator on [.vbx] nodes //
|
||||
// with the output being a [.h] //
|
||||
// //
|
||||
|
||||
toolInfo.toolType = Translator;
|
||||
toolInfo.name = genVbxTranslatorName;
|
||||
toolInfo.path = genVbxPath;
|
||||
toolInfo.flags = OnLocalMenu;
|
||||
toolInfo.menuName = genVbxMenuName;
|
||||
toolInfo.helpHint = genVbxHelpHint;
|
||||
toolInfo.defCmdLine = "$EDNAME $OUTNAME";
|
||||
toolInfo.appliesTo = ".vbx";
|
||||
toolInfo.defaultFor = ".vbx";
|
||||
toolInfo.translateTo = ".h";
|
||||
toolInfo.launchId = DEFAULT_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
LIBRARY GENVBXH
|
||||
DESCRIPTION 'Frank Borland'
|
||||
EXETYPE WINDOWS
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
HEAPSIZE 4096
|
||||
SEGMENTS
|
||||
_TEXT PRELOAD MOVEABLE
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME
|
||||
IDELIBMAIN @2
|
||||
|
||||
@@ -0,0 +1,919 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// IdeHook can be used to customize and enhance the functionality
|
||||
// of the Borland C++ Integrated Development Environment.
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// FEATURE OVERVIEW:
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// With IdeHook.h (and the accompanying .obj file) users can
|
||||
// incorporate many powerful features seamlessly into the IDE.
|
||||
// For example:
|
||||
// 1) Install tools onto the 'Tools' menu
|
||||
// 2) Install tools onto the SpeedMenu of specific node types
|
||||
// 3) Provide an implementation of tools through call-backs into a .DLL
|
||||
// 4) Monitor IDE events (such as Project Open and Close) and
|
||||
// perform customized actions on these events
|
||||
//
|
||||
// IdeHook gives users access to the following areas of the IDE:
|
||||
//
|
||||
// 1) Tool Server Lets you install, query and invoke
|
||||
// any tool in the IDE.
|
||||
// 2) Project Manager Gives you full access to the dependency tree
|
||||
// of the currently open project, including the
|
||||
// ability to add new nodes, query the tree, and
|
||||
// get and set persistent properties in the project.
|
||||
// 3) TargetExpert Allows callers to create and query targets
|
||||
// on any platform.
|
||||
// 4) StyleSheets Gives access to the setting and getting of
|
||||
// options on any node in the project tree.
|
||||
// 5) Make Gives access to the make engine, including
|
||||
// make notifications.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// HOW TO USE IDEHOOK:
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IdeHook is easy to use:
|
||||
//
|
||||
// 1) Create one or more .CPP modules that include a customized
|
||||
// version IDEHOOK.H to perform your specific functionality.
|
||||
// 2) Create a .DLL module using you own modules and the IDEHOOK.OBJ
|
||||
// file provided with IDEHOOK.
|
||||
// 3) In the end-users Windows directory, modify BCW.INI to
|
||||
// add the following section and key-value(s):
|
||||
// [AddOns]
|
||||
// addon000=<yourdll.dll>
|
||||
// In this section, <yourdll.dll> is the name of the .DLL you
|
||||
// created in Step 2 of this procedure.
|
||||
//
|
||||
// There are a few examples included to help you get on your way.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// TIPS AND CAVEATS
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// It is important to remember some things when using IdeHook:
|
||||
//
|
||||
// 1) You can use the IDE to make your addon (the examples were
|
||||
// done that way). However, you must modify your BCW.INI whenever
|
||||
// you test the addon. Because of this, you must remember to
|
||||
// *remove* the addon item when you are not testing.
|
||||
//
|
||||
// 2) To debug your addon, you must use the standalone debugger (TDW.EXE)
|
||||
// on BCW.EXE, then load your addon into the debugger using the 'name'
|
||||
// field in the Load Modules dialog box (press F3 in TDW).
|
||||
//
|
||||
// 3) Link order is *very* important when making the .DLL. Always
|
||||
// use the following order:
|
||||
// <yourLibMainModule>
|
||||
// idehook.obj
|
||||
// <your modules...>
|
||||
//
|
||||
// 4) If you GP the IDE, the IDE will *not* unload your .DLL. You
|
||||
// must either use a .DLL unloader program or restart Windows.
|
||||
//
|
||||
// 5) The IDE expects the key/value pairs of the [addons] section of
|
||||
// BCW.INI to be in numeric sequential order. It important that you
|
||||
// respect other addon vendors in this regard. For example, by the
|
||||
// time your addon is installed at an end-user sight, there might be
|
||||
// several addons already installed; BCW.INI might have the following:
|
||||
// [AddOns]
|
||||
// addon000=somedll.dll
|
||||
// addon001=another.dll
|
||||
// addon002=evenmore.dll
|
||||
// It is *your* responsibility to install your addon at the end of
|
||||
// this list (as 'addon003'). It is even more important to keep the
|
||||
// addons sequential when you uninstall your addon. If there have
|
||||
// been other addons installed after yours, you must decrement the
|
||||
// numbers back to maintain a non-interrupted numeric sequence.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
#ifndef __IDEHOOK_H
|
||||
#define __IDEHOOK_H
|
||||
|
||||
#ifndef __IDEHOOKT_H
|
||||
# include "idehookt.h"
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// CLIENTS AND SERVERS
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The IDE is built on an API exchange architecture. The APIs are
|
||||
// well defined and understood by all parties; the implementors
|
||||
// of these APIs are responsible for registering themselves as
|
||||
// such and servicing requests for the given API.
|
||||
//
|
||||
// IdeHook exposes serveral IDE servers:
|
||||
//
|
||||
// ToolServer
|
||||
// ProjectServer
|
||||
// TargetExpert
|
||||
// OptionSetServer
|
||||
// MakeServer
|
||||
//
|
||||
// In order to gain access to these servers, each one comes with a
|
||||
// 'requestor' that implements the proper request and release sequence:
|
||||
//
|
||||
// Server Requestor
|
||||
// ---------------- ------------------
|
||||
// ToolServer ToolReq
|
||||
// ProjectServer ProjectReq
|
||||
// TargetExpert TargetExpertReq
|
||||
// OptionSetServer OptionSetReq
|
||||
// MakeServer MakeReq
|
||||
//
|
||||
// To get a service, just instantiate its requestor:
|
||||
//
|
||||
// {
|
||||
// ToolReq toolServer; // This gets a ToolServer
|
||||
//
|
||||
// toolServer->ToolInvoke( ... ); // Call the server
|
||||
//
|
||||
// } // Release the tool server
|
||||
//
|
||||
//
|
||||
// NOTE: Some servers provide a 'client' class which you must implement
|
||||
// and register with the server in order to get call backs for event
|
||||
// notifications, tool invocations, or query responders.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// TOOL CLIENT/SERVER //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// ToolClient
|
||||
//
|
||||
// Use this class as a shell for your implementation of tool call-backs.
|
||||
//
|
||||
class _HOOKCLASS ToolClient
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// ToolServer
|
||||
//
|
||||
// This is the IDE's tool server, use it to query, add, remove,
|
||||
// and invoke any tool in the IDE.
|
||||
//
|
||||
// There are two types of tool installing:
|
||||
//
|
||||
// 1) 'Installing' a tool into the user's project. Tools
|
||||
// installed in this manner appear on either the IDE Tool
|
||||
// menu or on the SpeedMenu of a specific node type. These
|
||||
// tools are implemented as either standalone .EXEs or as
|
||||
// call-backs into your addon .DLLs. Tools installed like
|
||||
// this are done on a project-by-project basis.
|
||||
//
|
||||
// 2) 'Registering' the implementor of a call-back style tool that
|
||||
// was installed in Step 1). This only needs to be done
|
||||
// once per instance of BCW.EXE.
|
||||
//
|
||||
class _HOOKCLASS ToolServer
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Register one or many tool call-back implementors
|
||||
//
|
||||
virtual void _HOOKEP ToolRegisterImplementor
|
||||
(
|
||||
ToolClient *,
|
||||
ToolRegisterPack *
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Install a tool into the user's project
|
||||
//
|
||||
virtual ToolObj _HOOKEP ToolAdd
|
||||
(
|
||||
ToolInfo *
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Query the existance of a tool in the current project
|
||||
//
|
||||
virtual ToolObj _HOOKEP ToolFind
|
||||
(
|
||||
const char * name
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Remove a tool from the current project
|
||||
//
|
||||
virtual void _HOOKEP ToolRemove
|
||||
(
|
||||
const char * name
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Query the detailed information of a tool
|
||||
//
|
||||
virtual void _HOOKEP QueryToolInfo
|
||||
(
|
||||
ToolObj,
|
||||
ToolInfo &
|
||||
) = 0;
|
||||
|
||||
// //
|
||||
// Invoke any tool in the IDE. If 'ProjectNode' is zero, the //
|
||||
// tool is invoked on the 'currently selected object' in the //
|
||||
// IDE, as determined by the IDE. //
|
||||
// //
|
||||
virtual ToolReturn _HOOKEP ToolInvoke
|
||||
(
|
||||
ToolObj,
|
||||
ProjectNode = 0,
|
||||
const char * cmdLineOverride = 0
|
||||
) = 0;
|
||||
|
||||
virtual ToolReturn _HOOKEP ToolInvoke
|
||||
(
|
||||
ToolObj,
|
||||
const char * edName,
|
||||
const char * cmdLineOverride = 0
|
||||
) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// PROJECT SERVER/CLIENT //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// ProjectClient
|
||||
//
|
||||
// Client class for notification of project events and
|
||||
// query call-backs.
|
||||
//
|
||||
// For example, if you wish to get notified of every
|
||||
// Project Open event, derive and implement this class,
|
||||
// then register by calling the method
|
||||
// ProjectServer::RegisterProjectClient.
|
||||
//
|
||||
|
||||
class _HOOKCLASS ProjectClient
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Project Open notify event: This is called every time
|
||||
// a user successfully opens a project.
|
||||
//
|
||||
virtual void _HOOKEP OpenNotify
|
||||
(
|
||||
const char * name
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Project Close notify event: This is called every time
|
||||
// a user closes a project (either explicitly using
|
||||
// Project|Close Project, or by opening another project).
|
||||
//
|
||||
virtual void _HOOKEP CloseNotify() = 0;
|
||||
|
||||
//
|
||||
// Node delete event: This is called every time the
|
||||
// user explicitly deletes a node.
|
||||
//
|
||||
virtual void _HOOKEP NodeDeleteNotify
|
||||
(
|
||||
ProjectNode
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// This is used as a call back to the method
|
||||
// ProjectServer::QueryDependencies.
|
||||
//
|
||||
virtual void _HOOKEP DependencyQueryResponder
|
||||
(
|
||||
ProjectNode ,
|
||||
const char * outputName
|
||||
) = 0;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ProjectServer
|
||||
//
|
||||
// Provides access to the current project's dependency tree.
|
||||
//
|
||||
// The 'ProjectNode' cookie passed around in this (and others)
|
||||
// is a persistent 32-bit entity across sessions. You can safely
|
||||
// store this value in your own supplemental files, then refer to
|
||||
// the value during later sessions.
|
||||
//
|
||||
class _HOOKCLASS ProjectServer
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Register your implementation of a project client
|
||||
//
|
||||
virtual void _HOOKEP RegisterProjectClient
|
||||
(
|
||||
ProjectClient *
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Release your implementation of a project client
|
||||
//
|
||||
virtual void _HOOKEP UnregisterProjectClient
|
||||
(
|
||||
ProjectClient *
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Add a node to the project tree. If 'parent' is 0, then the node
|
||||
// is added as a second level node (as a dependent of the [.ide]
|
||||
// node). If 'type' is 0, then 'name' is assumed to be a file name,
|
||||
// and the extension is used as the node type. For example:
|
||||
//
|
||||
// To add a file:
|
||||
// NodeAdd( parent, "foo.cpp" ); // OR:
|
||||
// NodeAdd( parent, "foo", ".cpp" );
|
||||
//
|
||||
// To add a SourcePool:
|
||||
// NodeAdd( parent, "The Shared Sources", "SourcePool" );
|
||||
//
|
||||
virtual ProjectNode _HOOKEP NodeAdd
|
||||
(
|
||||
ProjectNode parent,
|
||||
const char * name,
|
||||
const char * type = 0
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Find any instance of a node in the tree
|
||||
//
|
||||
virtual ProjectNode _HOOKEP NodeFind
|
||||
(
|
||||
const char * name
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Remove a node and all its dependencies from the tree
|
||||
//
|
||||
virtual ProjectNode _HOOKEP NodeRemove
|
||||
(
|
||||
ProjectNode
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Return the top level [.ide] node from the tree
|
||||
//
|
||||
virtual ProjectNode _HOOKEP QueryTopNode() = 0;
|
||||
|
||||
//
|
||||
// Query detailed information about a given node in the tree
|
||||
//
|
||||
virtual void _HOOKEP QueryNodeInfo
|
||||
(
|
||||
ProjectNode,
|
||||
ProjectNodeInfo &
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Query the dependencies of a given node in the tree. (This
|
||||
// method 'collapses' SourcePool nodes by recursing into
|
||||
// them as if they were not there.) This function calls every
|
||||
// dependency found with the ProjectClient::DependencyQueryResponder()
|
||||
// method when it's called with both the 'ProjectNode' and output
|
||||
// location for that node.
|
||||
//
|
||||
virtual void _HOOKEP QueryDependencies
|
||||
(
|
||||
ProjectNode,
|
||||
ProjectClient *
|
||||
) = 0;
|
||||
|
||||
|
||||
//
|
||||
// NodePropertySet/Get/Remove lets you create and maintain
|
||||
// persistent named properties on any node in any project. The
|
||||
// 'propertyName' field must be unique to every property on a
|
||||
// given node. Because of this, it's recommended you use some
|
||||
// kind of trademark (such as a name or initials) so as to not
|
||||
// conflict with other addon vendors.
|
||||
//
|
||||
virtual void _HOOKEP NodePropertySet
|
||||
(
|
||||
ProjectNode node,
|
||||
const char * propertyName,
|
||||
void * data,
|
||||
size_t dataSize
|
||||
) = 0;
|
||||
|
||||
virtual size_t _HOOKEP NodePropertyFind
|
||||
(
|
||||
ProjectNode node,
|
||||
const char * propertyName,
|
||||
const void * & data
|
||||
) = 0;
|
||||
|
||||
virtual void _HOOKEP NodePropertyRemove
|
||||
(
|
||||
ProjectNode node,
|
||||
const char * propertyName
|
||||
) = 0;
|
||||
|
||||
|
||||
//
|
||||
// Return the user's currently selected nodes in the project
|
||||
//
|
||||
virtual int _HOOKEP QuerySelectedNodes
|
||||
(
|
||||
ProjectNode * & nodeArray,
|
||||
int & numNodes
|
||||
) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// OPTIONSET SERVER //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// OptionSetServer
|
||||
//
|
||||
// Access certain local overrides on node's project options.
|
||||
// The options available are given in an enum in IDEHOOKT.H
|
||||
// called OptionsStringIds.
|
||||
//
|
||||
class _HOOKCLASS OptionSetServer
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Set the node's local override for the given option
|
||||
//
|
||||
virtual void _HOOKEP OptionApply
|
||||
(
|
||||
ProjectNode node,
|
||||
OptionsStringIds oid,
|
||||
const char * value
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Get the node's local override for the given option
|
||||
//
|
||||
virtual size_t _HOOKEP OptionGet
|
||||
(
|
||||
ProjectNode node,
|
||||
OptionsStringIds oid,
|
||||
const char * & value
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Remove the node's local override for the given option. This
|
||||
// removes *all* local overrides if oid == OID_RemoveAll.
|
||||
//
|
||||
virtual void _HOOKEP OptionRemove
|
||||
(
|
||||
ProjectNode node,
|
||||
OptionsStringIds oid
|
||||
) = 0;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// TARGET EXPERT //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// TargetExpert
|
||||
//
|
||||
// Allows for adding and querying target nodes in the
|
||||
// dependency tree. The TargetExpert expert automatically
|
||||
// creates the proper library skeleton and sets the proper
|
||||
// options for the given platform, memory model, and so on.
|
||||
//
|
||||
class _HOOKCLASS TargetExpert
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// Add a target into the project dependency tree
|
||||
//
|
||||
virtual ProjectNode _HOOKEP TargetAdd
|
||||
(
|
||||
const char * name,
|
||||
TargetPlatforms platform,
|
||||
TargetStdLibs libs,
|
||||
TargetModel image,
|
||||
ProjectNode parent = 0,
|
||||
const char * type = 0
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Query if a ProjectNode is actually a target
|
||||
//
|
||||
virtual int _HOOKEP NodeIsTarget
|
||||
(
|
||||
ProjectNode
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Climb 'up' the dependency tree and return the node's target
|
||||
//
|
||||
virtual ProjectNode _HOOKEP FindNodesTarget
|
||||
(
|
||||
ProjectNode
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Query whether a given node (target or not) supports the
|
||||
// given platform, libraries and/or image. If any of the
|
||||
// query parameters are 0, then that attribute is not part
|
||||
// of the query. For example:
|
||||
//
|
||||
// To see if a node is a Win32 compile:
|
||||
// QuerySupports( node, Win32, 0, 0 );
|
||||
//
|
||||
// To see if a node is an OWL node:
|
||||
// QuerySupports( node, 0, OWL, 0 );
|
||||
//
|
||||
// To see if a node is a large model Dos overly with BGI:
|
||||
// QuerySupports( node, DosOverlay, BGI, Large );
|
||||
//
|
||||
virtual int _HOOKEP QuerySupports
|
||||
(
|
||||
ProjectNode node,
|
||||
TargetPlatforms platform,
|
||||
TargetStdLibs libs,
|
||||
TargetModel image
|
||||
) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// MAKE //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
class _HOOKCLASS MakeClient
|
||||
{
|
||||
public:
|
||||
virtual void MakeBeginNotify() = 0;
|
||||
virtual void MakeEndNotify() = 0;
|
||||
};
|
||||
|
||||
class _HOOKCLASS MakeServer
|
||||
{
|
||||
public:
|
||||
virtual void _HOOKEP RegisterMakeClient
|
||||
(
|
||||
MakeClient *
|
||||
) = 0;
|
||||
|
||||
virtual void _HOOKEP UnRegisterMakeClient
|
||||
(
|
||||
MakeClient *
|
||||
) = 0;
|
||||
|
||||
virtual void _HOOKEP MakeNodes
|
||||
(
|
||||
MakeMode,
|
||||
ProjectNode *,
|
||||
int numNodes = 1
|
||||
) = 0;
|
||||
|
||||
virtual long _HOOKEP NodeInputAge
|
||||
(
|
||||
ProjectNode
|
||||
) = 0;
|
||||
|
||||
virtual long _HOOKEP NodeOutputAge
|
||||
(
|
||||
ProjectNode
|
||||
) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// EDITOR //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
class _HOOKCLASS EditorServer
|
||||
{
|
||||
public:
|
||||
|
||||
//
|
||||
// This first section is taken from the BRIEF macro language guide,
|
||||
// where these routines are documented. The few differences from
|
||||
// those semantics are listed here. String manipulation routines
|
||||
// are not listed because the caller may use RTL functions.
|
||||
//
|
||||
|
||||
virtual int _HOOKEP beginning_of_line() = 0;
|
||||
|
||||
virtual int _HOOKEP backspace() = 0;
|
||||
|
||||
//
|
||||
// This version ignores buffer_name and system
|
||||
//
|
||||
virtual BufferId _HOOKEP create_buffer
|
||||
(
|
||||
char * buffer_name,
|
||||
char * file_name,
|
||||
int system = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP delete_block() = 0;
|
||||
|
||||
//
|
||||
// Delete a buffer from memory if there are no windows containing
|
||||
// views on the buffer
|
||||
//
|
||||
virtual int _HOOKEP delete_buffer
|
||||
(
|
||||
BufferId buffer_id
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP delete_char
|
||||
(
|
||||
int num_to_delete = 1
|
||||
) = 0;
|
||||
|
||||
virtual void _HOOKEP delete_line() = 0;
|
||||
|
||||
virtual void _HOOKEP delete_to_eol() = 0;
|
||||
|
||||
virtual long _HOOKEP distance_to_tab() = 0;
|
||||
|
||||
virtual int _HOOKEP down() = 0;
|
||||
|
||||
virtual void _HOOKEP drop_anchor
|
||||
(
|
||||
char mark_type = 1
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP end_of_buffer() = 0;
|
||||
|
||||
virtual int _HOOKEP end_of_line() = 0;
|
||||
|
||||
virtual int _HOOKEP end_of_window() = 0;
|
||||
|
||||
virtual int _HOOKEP goto_line
|
||||
(
|
||||
long line
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP goto_old_line
|
||||
(
|
||||
long line
|
||||
) = 0;
|
||||
|
||||
virtual BufferId _HOOKEP inq_buffer
|
||||
(
|
||||
char * fileName = 0
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Returns the length of the current line in characters
|
||||
//
|
||||
virtual int _HOOKEP inq_line_length() = 0;
|
||||
|
||||
virtual int _HOOKEP inq_modified() = 0;
|
||||
|
||||
virtual void _HOOKEP inq_names
|
||||
(
|
||||
char * full_name = 0,
|
||||
char * extension = 0,
|
||||
char * buffer_name = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP inq_position
|
||||
(
|
||||
long * line = 0,
|
||||
long * col = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP inq_views
|
||||
(
|
||||
BufferId buffer_id = 0
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// Add only the control string
|
||||
//
|
||||
virtual void _HOOKEP insert
|
||||
(
|
||||
char * control_string
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP left() = 0;
|
||||
|
||||
virtual int _HOOKEP move_abs
|
||||
(
|
||||
long line = 0,
|
||||
long column = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP move_rel
|
||||
(
|
||||
long num_lines = 0,
|
||||
long num_columns = 0
|
||||
) = 0;
|
||||
|
||||
virtual BufferId _HOOKEP next_buffer
|
||||
(
|
||||
int system_too = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP next_char
|
||||
(
|
||||
int num_chars = 1
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP page_down() = 0;
|
||||
|
||||
virtual int _HOOKEP page_up() = 0;
|
||||
|
||||
virtual int _HOOKEP prev_char
|
||||
(
|
||||
int num_chars = 1
|
||||
) = 0;
|
||||
|
||||
virtual void _HOOKEP raise_anchor() = 0;
|
||||
|
||||
//
|
||||
// NOTE: Be sure to call free_string() with the value returned here.
|
||||
//
|
||||
virtual char * _HOOKEP read
|
||||
(
|
||||
int length = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP read_file
|
||||
(
|
||||
char * filename
|
||||
) = 0;
|
||||
|
||||
virtual void _HOOKEP refresh() = 0;
|
||||
|
||||
virtual int _HOOKEP right() = 0;
|
||||
|
||||
virtual int _HOOKEP search_back
|
||||
(
|
||||
const char* pattern,
|
||||
int regex = 1,
|
||||
int caseSen = 1,
|
||||
int block = 0,
|
||||
long * total_length = 0,
|
||||
int grep = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP search_fwd
|
||||
(
|
||||
const char * pattern,
|
||||
int regex = 1,
|
||||
int caseSen = 1,
|
||||
int block = 0,
|
||||
long * total_length = 0,
|
||||
int grep = 0
|
||||
) = 0;
|
||||
|
||||
virtual BufferId _HOOKEP set_buffer
|
||||
(
|
||||
BufferId buffer_id
|
||||
) = 0;
|
||||
|
||||
virtual void _HOOKEP set_top_left
|
||||
(
|
||||
long top_line = 0,
|
||||
long left_col = 0,
|
||||
ViewId window_id = 0,
|
||||
long line = 0,
|
||||
long col = 0,
|
||||
BufferId buffer_id = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP top_of_buffer() = 0;
|
||||
|
||||
virtual int _HOOKEP top_of_window() = 0;
|
||||
|
||||
virtual int _HOOKEP translate
|
||||
(
|
||||
char * pattern,
|
||||
char * replacment,
|
||||
int global_flag,
|
||||
int regex = 1,
|
||||
int caseSen = 1,
|
||||
int block = 0,
|
||||
int forward = 1,
|
||||
int grep = 0
|
||||
) = 0;
|
||||
|
||||
virtual int _HOOKEP up() = 0;
|
||||
|
||||
virtual int _HOOKEP write_buffer() = 0;
|
||||
|
||||
//----------------------------------------------------------------
|
||||
// This section consists of additional routines that cannot
|
||||
// be built with the BRIEF primitives.
|
||||
//
|
||||
|
||||
//
|
||||
// Free storage allocated by calls to read
|
||||
//
|
||||
virtual void _HOOKEP free_string
|
||||
(
|
||||
char * str // string to free
|
||||
) = 0;
|
||||
|
||||
//
|
||||
// show_buffer moves an MDI window on the current buffer to the
|
||||
// top of the window stack. If no such window exists, one is created.
|
||||
//
|
||||
virtual void _HOOKEP show_buffer() = 0;
|
||||
|
||||
virtual int _HOOKEP save_buffer() = 0;
|
||||
|
||||
virtual int _HOOKEP register_keyhit_handlers
|
||||
(
|
||||
KeyStroke * keyStrokes,
|
||||
int numKeyStrokes
|
||||
) = 0;
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Service implementation //
|
||||
// //
|
||||
// See the notes above for usage information. //
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
extern void * QueryService( int );
|
||||
extern void ReleaseService( int, void * );
|
||||
|
||||
template <class T, int id>
|
||||
class __Req
|
||||
{
|
||||
public:
|
||||
__Req() : _id( id ) { _server = (T *)QueryService( id ); }
|
||||
~__Req() { if( _server )
|
||||
ReleaseService( id, (void *)_server ); }
|
||||
operator T * () { return( _server ); }
|
||||
T * operator -> () { return( _server ); }
|
||||
int operator ! () { return( !_server ); }
|
||||
|
||||
private:
|
||||
T * _server;
|
||||
int _id;
|
||||
};
|
||||
|
||||
|
||||
#define SRVR_PROJECT 1
|
||||
#define SRVR_TOOL 2
|
||||
#define SRVR_OPTIONSET 3
|
||||
#define SRVR_TARGETEXPERT 4
|
||||
#define SRVR_MAKE 5
|
||||
#define SRVR_EDITOR 6
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Service usage... //
|
||||
// //
|
||||
// Use the following typedefs when you are //
|
||||
// accessing a service, when you are coming into //
|
||||
// the scope the __Req where the service is //
|
||||
// made, or when going out of the scope where //
|
||||
// the service is released. //
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
typedef __Req<ProjectServer, SRVR_PROJECT > ProjectReq;
|
||||
typedef __Req<ToolServer, SRVR_TOOL > ToolReq;
|
||||
typedef __Req<OptionSetServer,SRVR_OPTIONSET > OptionSetReq;
|
||||
typedef __Req<TargetExpert, SRVR_TARGETEXPERT> TargetExpertReq;
|
||||
typedef __Req<MakeServer, SRVR_MAKE > MakeReq;
|
||||
typedef __Req<EditorServer, SRVR_EDITOR > EditorReq;
|
||||
|
||||
|
||||
#endif __IDEHOOK_H
|
||||
|
||||
// End of file
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,207 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#ifndef __IDEHOOKT_H
|
||||
#define __IDEHOOKT_H
|
||||
|
||||
#ifndef __STDDEF_H
|
||||
# include <stddef.h>
|
||||
#endif
|
||||
|
||||
|
||||
// Some generic defines and types
|
||||
|
||||
#ifndef _UNIQUE_COOKIE
|
||||
# define _UNIQUE_COOKIE(name) typedef const struct name##__ _near* name
|
||||
# define _UNIQUE_COOKIE32(name) typedef const struct name##__ _far* name
|
||||
#endif
|
||||
|
||||
#define _HOOKCLASS _huge
|
||||
#define _HOOKEP _pascal _loadds
|
||||
|
||||
|
||||
// Tool enums and helper structs
|
||||
|
||||
_UNIQUE_COOKIE32( ToolObj ); // ToolObj is not persistent
|
||||
_UNIQUE_COOKIE32( ToolLaunchId );
|
||||
_UNIQUE_COOKIE32( ProjectNode ); // ProjectNode is persistent
|
||||
|
||||
#define DEFAULT_LAUNCH_ID ToolLaunchId(0)
|
||||
#define CALLBACK_LAUNCH_ID ToolLaunchId(-1)
|
||||
|
||||
enum ToolTypes
|
||||
{
|
||||
Transfer = -4,
|
||||
Viewer,
|
||||
Translator,
|
||||
};
|
||||
|
||||
enum ToolFlags
|
||||
{
|
||||
TargetTranslator = 0x0001,
|
||||
OnLocalMenu = 0x1000,
|
||||
OnToolsMenu = 0x2000,
|
||||
};
|
||||
|
||||
struct ToolInfo
|
||||
{
|
||||
ToolTypes toolType;
|
||||
const char * name;
|
||||
const char * path;
|
||||
ToolFlags flags;
|
||||
const char * menuName;
|
||||
const char * helpHint;
|
||||
const char * defCmdLine;
|
||||
union {
|
||||
const char *appliesTo;
|
||||
const char *translateFrom;
|
||||
};
|
||||
const char * defaultFor;
|
||||
const char * translateTo;
|
||||
ToolLaunchId launchId;
|
||||
};
|
||||
|
||||
enum ToolReturn
|
||||
{
|
||||
NotHandled = -1,
|
||||
Success,
|
||||
Warnings,
|
||||
Errors,
|
||||
FatalError
|
||||
};
|
||||
|
||||
class _HOOKCLASS ToolClient;
|
||||
|
||||
struct ToolInvokeArgs
|
||||
{
|
||||
const char * cmdLine;
|
||||
ProjectNode *nodeArray;
|
||||
int numNodes;
|
||||
};
|
||||
|
||||
typedef ToolReturn _HOOKEP
|
||||
(ToolClient::*ToolMethod)( ToolInvokeArgs * );
|
||||
|
||||
struct ToolRegisterPack
|
||||
{
|
||||
const char * toolName;
|
||||
ToolMethod toolMethod;
|
||||
unsigned long resv1;
|
||||
};
|
||||
|
||||
|
||||
// Project helper types
|
||||
|
||||
struct ProjectNodeInfo
|
||||
{
|
||||
const char * name;
|
||||
const char * nodeType;
|
||||
const char * description;
|
||||
const char * inputLocation;
|
||||
const char * outputLocation;
|
||||
ProjectNode parent;
|
||||
ProjectNode firstChild;
|
||||
ProjectNode nextSibling;
|
||||
};
|
||||
|
||||
// Option set ids
|
||||
|
||||
enum OptionsStringIds
|
||||
{
|
||||
OID_null,
|
||||
OID_RemoveAll = OID_null,
|
||||
OID_Include,
|
||||
OID_Library,
|
||||
OID_Source,
|
||||
OID_Intermediate,
|
||||
OID_Final,
|
||||
OID_Defines,
|
||||
OID_CmdlineOverride,
|
||||
|
||||
OID_Invalid
|
||||
};
|
||||
|
||||
|
||||
// Target expert types
|
||||
|
||||
enum TargetPlatforms
|
||||
{
|
||||
Win16 = 0x0001,
|
||||
Win32 = 0x0002,
|
||||
Dos16 = 0x0008,
|
||||
DosOverlay = 0x0010,
|
||||
};
|
||||
|
||||
enum TargetStdLibs
|
||||
{
|
||||
Framework = 0x0001,
|
||||
RTL = 0x0004,
|
||||
BIDS = 0x0002,
|
||||
OWL = Framework,
|
||||
BWCC = 0x0008,
|
||||
BGI = BWCC,
|
||||
|
||||
FloatingMath = 0x0010,
|
||||
FloatingEmu = 0x0020,
|
||||
FloatingStartup = 0x0040,
|
||||
|
||||
Static = 0x0100,
|
||||
Dynamic = 0x0200,
|
||||
|
||||
MultiThread = 0x2000,
|
||||
|
||||
Diagnostic = 0x8000,
|
||||
};
|
||||
|
||||
enum TargetModel
|
||||
{
|
||||
Tiny = 0x01,
|
||||
Small = 0x02,
|
||||
Medium = 0x04,
|
||||
Compact = 0x08,
|
||||
Large = 0x10,
|
||||
Huge = 0x20,
|
||||
|
||||
GUI = 0x0100,
|
||||
Console = 0x0200
|
||||
};
|
||||
|
||||
|
||||
// Make stuff
|
||||
|
||||
enum MakeMode
|
||||
{
|
||||
Make,
|
||||
Build,
|
||||
Translate
|
||||
};
|
||||
|
||||
// Editor stuff
|
||||
|
||||
_UNIQUE_COOKIE32( BufferId );
|
||||
_UNIQUE_COOKIE32( ViewId );
|
||||
|
||||
struct KeyStroke;
|
||||
|
||||
typedef int (*KeyHitHandler)(KeyStroke *);
|
||||
|
||||
enum KeyModifier
|
||||
{
|
||||
NoModifier,
|
||||
Shift = 0x0001,
|
||||
Control = 0x0002,
|
||||
Alt = 0x0004
|
||||
};
|
||||
|
||||
struct KeyStroke
|
||||
{
|
||||
unsigned short msg;
|
||||
unsigned short key;
|
||||
KeyModifier modifier;
|
||||
KeyHitHandler handler;
|
||||
};
|
||||
|
||||
#endif __IDEHOOKT_H
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#include "windows.h"
|
||||
|
||||
int FAR PASCAL LibMain( HINSTANCE , WORD ,WORD wHeapSize, LPSTR )
|
||||
{
|
||||
if ( wHeapSize )
|
||||
UnlockData( 0 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,580 @@
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright <c> Borland International, 1994
|
||||
//
|
||||
// Example Tools added for common OLE development.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// To enable the tools:
|
||||
// --------------------
|
||||
// 1) Build the OLETOOLS.DLL target.
|
||||
// 2) Add the following to the [AddOns] section of your BCW.INI file:
|
||||
// Addon000=Drive:Path\OLETOOLS.DLL
|
||||
// Note: The 000 must actually be the next numeric value in sequence.
|
||||
// That is, if you already have an entry with 000, use 001 etc...
|
||||
// If the [AddOns] section doesn't exist you may create it.
|
||||
// 3) On certain environments you will need to verify that the STDOLE.DLL
|
||||
// resides in your windows system directory.
|
||||
//
|
||||
// Tools Descriptions:
|
||||
// ------------------
|
||||
// translateODLtoTLB
|
||||
// Convert .odl to .tlb files.
|
||||
// (Requires Non-Borland distributed MkTypLib.exe)
|
||||
// msMKTypLib
|
||||
// Internal (to example) tool used for converting from ODL to TLB files.
|
||||
// extractAndBindTLB
|
||||
// Create .tlb from .exe/.dll bind .tlb back into .dll/.exe
|
||||
// oleRegister
|
||||
// Internal (to example) tool used to invoke register.exe
|
||||
// oleExtractTLB
|
||||
// Extract TypeLib Information
|
||||
// oleExtractReg
|
||||
// Create a .reg file from .exe/.dll
|
||||
// oleRegEditAdvanced
|
||||
// Tools Menu option to invoke regedit with /v parameter.
|
||||
// generateAndAddSource
|
||||
// Create nodes (.cxx [.cpp] /.hxx [.h] ) in your target from .exe/.dll
|
||||
// oleAutoGen
|
||||
// Internal (to example) tool used to invoke Autogen.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
#pragma hdrstop
|
||||
// Standard include files.
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include <dir.h>
|
||||
|
||||
// IDEHOOK include file.
|
||||
#include "idehook.h"
|
||||
|
||||
// OLE Tool names.
|
||||
static char translateODLtoTLB[] = "OLE_ODLtoTLB";
|
||||
static char msMkTypLib[] = "OLE_IMkTypeLib";
|
||||
static char extractAndBindTLB[] = "OLE_ExtractAndBindTypeInfo";
|
||||
static char oleRegister[] = "OLE_IRegister";
|
||||
static char oleExtractTLB[] = "OLE_ExtractTypeInfo";
|
||||
static char oleExtractReg[] = "OLE_ExtractReg";
|
||||
static char oleRegEditAdvanced[] = "OLE_RegEditAdvanced";
|
||||
static char generateAndAddSource[] = "OLE_GenerateAndAddSource";
|
||||
static char oleAutoGen[] = "OLE_IAutoGen";
|
||||
|
||||
// Existing tool names provided by BCW
|
||||
static char realLinker[] = "LinkTarget";
|
||||
static char realResCompiler[] = "CompileResources";
|
||||
static char realCppPreprocess[] = "CppPreprocessor";
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// LocalToolClient ctor
|
||||
// Encapsulates the callback routines for tools.
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
class _HOOKCLASS LocalToolClient : public ToolClient
|
||||
{
|
||||
public:
|
||||
|
||||
// Callback routines.
|
||||
ToolReturn _HOOKEP RunGenerateAndAddSource( ToolInvokeArgs * );
|
||||
ToolReturn _HOOKEP RunExtractAndBind( ToolInvokeArgs * );
|
||||
ToolReturn _HOOKEP RunTypeLibrary( ToolInvokeArgs * );
|
||||
|
||||
// Registers Callback routines
|
||||
void RegisterMyCallBacks( ToolServer * );
|
||||
|
||||
private:
|
||||
|
||||
int registered;
|
||||
static ToolRegisterPack entryPoints[];
|
||||
};
|
||||
|
||||
// Instantiated LocalToolClient object.
|
||||
static LocalToolClient localToolClient;
|
||||
|
||||
// Static ToolRegisterPack object.
|
||||
ToolRegisterPack LocalToolClient::entryPoints[] =
|
||||
{
|
||||
{ ::generateAndAddSource, (ToolMethod)&LocalToolClient::RunGenerateAndAddSource },
|
||||
{ ::extractAndBindTLB, (ToolMethod)&LocalToolClient::RunExtractAndBind },
|
||||
{ ::translateODLtoTLB, (ToolMethod)&LocalToolClient::RunTypeLibrary },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// LocalToolClient::RegisterMyCallBacks
|
||||
// Register tool callback routines.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
void
|
||||
LocalToolClient::RegisterMyCallBacks( ToolServer * ts )
|
||||
{
|
||||
// Have these been registered before?
|
||||
if (!registered)
|
||||
{
|
||||
registered = 1;
|
||||
ts->ToolRegisterImplementor( this, entryPoints );
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// LocalToolClient::generateAndAddSource
|
||||
// Create nodes (.cxx [.cpp] /.hxx [.h] ) in your target from .exe/.dll
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
ToolReturn _HOOKEP
|
||||
LocalToolClient::RunGenerateAndAddSource(ToolInvokeArgs * args)
|
||||
{
|
||||
ToolReq trTool; // Tool Requestor.
|
||||
ProjectReq prProject; // Project Requestor
|
||||
ToolReturn trReturn = FatalError; // Return Value.
|
||||
|
||||
ProjectNode pnParent = args->numNodes ? *args->nodeArray : 0;
|
||||
|
||||
if (pnParent)
|
||||
{
|
||||
// Obtain code generation tool.
|
||||
ToolObj toAutoGen = trTool->ToolFind(::oleAutoGen);
|
||||
|
||||
if (toAutoGen)
|
||||
{
|
||||
// Base used for new file names.
|
||||
char acBaseName[10];
|
||||
|
||||
// Project Node Information.
|
||||
ProjectNodeInfo pniParent;
|
||||
|
||||
// Get filename from node information.
|
||||
prProject->QueryNodeInfo(pnParent,pniParent);
|
||||
|
||||
// Extract base file name.
|
||||
fnsplit(pniParent.name,NULL,NULL,acBaseName,NULL);
|
||||
|
||||
// Check for valid name.
|
||||
if (acBaseName[0] != 0)
|
||||
{
|
||||
char acNodeNameCXX[14];
|
||||
char acNodeNameHXX[14];
|
||||
|
||||
// Create New Node Names
|
||||
wsprintf(acNodeNameCXX,"%s.cxx",acBaseName);
|
||||
wsprintf(acNodeNameHXX,"%s.hxx",acBaseName);
|
||||
|
||||
ToolObj regServer = trTool->ToolFind( oleRegister );
|
||||
|
||||
if (regServer)
|
||||
{
|
||||
// Create needed .olb file.
|
||||
if (trTool->ToolInvoke( regServer, pnParent, "$TARGET -TypeLib=$NAME($TARGET).olb") == Success)
|
||||
{
|
||||
// Invoke tool and generate new source modules.
|
||||
// upon success, add new source modules to the project.
|
||||
if (trTool->ToolInvoke( toAutoGen, (const char *)0, "$NAME($TARGET).olb" ) == Success )
|
||||
{
|
||||
// Add generated source code to project.
|
||||
ProjectNode pnCpp = prProject->NodeAdd(pnParent,acNodeNameCXX,".cpp");
|
||||
prProject->NodeAdd(pnCpp,acNodeNameHXX,".h");
|
||||
trReturn = Success;
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"AutoGen Reported Failure","Error",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"Register Reported Failure","Error",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"REGISTER.EXE Not Found","Error",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"Base File Name Not Found","Error",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"AUTOGEN.EXE Not Found","Error",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"Parent Node Invalid","Error",MB_ICONEXCLAMATION | MB_OK);
|
||||
|
||||
return (trReturn);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// extractAndBindTLB
|
||||
// Create .tlb from .exe/.dll bind .tlb back into .dll/.exe
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
ToolReturn _HOOKEP
|
||||
LocalToolClient::RunExtractAndBind( ToolInvokeArgs * args )
|
||||
{
|
||||
ProjectReq ps;
|
||||
EditorReq editor;
|
||||
ToolReq server;
|
||||
|
||||
ToolReturn trReturn = FatalError;
|
||||
|
||||
ProjectNode targetNode = args->numNodes ? *args->nodeArray : 0;
|
||||
|
||||
if (targetNode)
|
||||
{
|
||||
// Extract the .tlb from the .dll/.exe
|
||||
ToolObj regServer = server->ToolFind( oleRegister );
|
||||
|
||||
if (regServer)
|
||||
{
|
||||
server->ToolInvoke( regServer, targetNode, "$TARGET -TypeLib=__temp.tlb" );
|
||||
|
||||
// Create a .rc node
|
||||
static char rcNodeName[] = "__temp.rc";
|
||||
|
||||
ProjectNode rcNode = ps->NodeAdd( targetNode, rcNodeName );
|
||||
|
||||
if (rcNode)
|
||||
{
|
||||
// Create a edit buffer for the .rc script
|
||||
static char rcStatement[] = "TYPELIB 1 __temp.tlb";
|
||||
|
||||
BufferId newBuffer_id = editor->create_buffer( 0, rcNodeName, 0 );
|
||||
BufferId currBuffer_id = editor->set_buffer(newBuffer_id);
|
||||
|
||||
editor->insert( rcStatement );
|
||||
|
||||
// Resource compile the .rc script
|
||||
ToolObj resCompiler = server->ToolFind( realResCompiler );
|
||||
|
||||
if (resCompiler)
|
||||
{
|
||||
server->ToolInvoke( resCompiler, rcNode, 0);
|
||||
|
||||
// Run the linker (this re-bind the .dll with the new .res)
|
||||
ToolObj linker = server->ToolFind( realLinker );
|
||||
|
||||
if (linker)
|
||||
{
|
||||
server->ToolInvoke( linker, targetNode, 0 );
|
||||
trReturn = Success;
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"Internal Linker Not Found","Error!",MB_ICONEXCLAMATION | MB_OK);
|
||||
|
||||
// Re-register now that the .tlb is inside the .dll/.exe
|
||||
server->ToolInvoke( regServer, targetNode, "$TARGET -RegServer" );
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"Internal Resource Compiler Not Found","Error!",MB_ICONEXCLAMATION | MB_OK);
|
||||
|
||||
// Restore the user's editor state
|
||||
editor->set_buffer( currBuffer_id );
|
||||
editor->delete_buffer( newBuffer_id );
|
||||
|
||||
// Remove temporary node.
|
||||
ps->NodeRemove(rcNode);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"Unable to create a temporary node.","Error!",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"REGISTER.EXE Not Found","Error!",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"Target Node Not Found","Error!",MB_ICONEXCLAMATION | MB_OK);
|
||||
|
||||
return( trReturn );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// translateODLtoTLB
|
||||
// Convert .odl to .tlb files. (Requires Non-Borland distributed MkTypLib.exe?)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
ToolReturn _HOOKEP
|
||||
LocalToolClient::RunTypeLibrary( ToolInvokeArgs * args )
|
||||
{
|
||||
static char cppCmdLine[]
|
||||
= "+$RSP(-D__MKTYPLIB__;$DEF -I$INC -P- -otlbt@@@.tm~) $EDNAME";
|
||||
|
||||
ToolReq server;
|
||||
|
||||
ProjectNode node = args->numNodes ? *args->nodeArray : 0;
|
||||
|
||||
ToolObj preprocessor = server->ToolFind( realCppPreprocess );
|
||||
ToolObj msTool = 0;
|
||||
|
||||
if ( preprocessor )
|
||||
{
|
||||
if ( server->ToolInvoke( preprocessor, node, cppCmdLine) == Success )
|
||||
{
|
||||
if ((msTool = server->ToolFind( ::msMkTypLib )) == 0)
|
||||
::MessageBox(::GetActiveWindow(),"Can't find mktyplib.exe tool", "Error!",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
else
|
||||
::MessageBox(::GetActiveWindow(),"CppPreprocess did not complete ok!","Error!",MB_ICONEXCLAMATION | MB_OK);
|
||||
}
|
||||
|
||||
if ( msTool )
|
||||
return( server->ToolInvoke( msTool, node, args->cmdLine ) );
|
||||
|
||||
return( Errors );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Project Client Implementation
|
||||
// Encapsulates Project Manager Notifications
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
class _HOOKCLASS LocalProjClient : public ProjectClient
|
||||
{
|
||||
public:
|
||||
|
||||
// Ctor
|
||||
LocalProjClient();
|
||||
|
||||
// Required pure virtual implementations.
|
||||
virtual void _HOOKEP OpenNotify(const char * name);
|
||||
virtual void _HOOKEP CloseNotify();
|
||||
virtual void _HOOKEP NodeDeleteNotify(ProjectNode);
|
||||
virtual void _HOOKEP DependencyQueryResponder(ProjectNode ,const char *);
|
||||
|
||||
};
|
||||
|
||||
// Instantiated LocalProjectClient object.
|
||||
static LocalProjClient LocalProjClient;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// LocalProjectClient Ctor
|
||||
// Register Project Client with IDE using a Project requestor.
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
LocalProjClient::LocalProjClient()
|
||||
{
|
||||
ProjectReq ps;
|
||||
ps->RegisterProjectClient(this);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// LocalProjectClient::OpenNotify
|
||||
// Register Callbacks.
|
||||
// Add Tools to Project Manager.
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
void _HOOKEP
|
||||
LocalProjClient::OpenNotify(const char * /*name */)
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Register Callbacks
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Obtain a ToolRequestor.
|
||||
ToolReq ts;
|
||||
|
||||
// Register callbacks for tools.
|
||||
localToolClient.RegisterMyCallBacks( ts );
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Add Tools
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
// translateODLtoTLB
|
||||
// Convert .odl to .tlb files.
|
||||
if ( !ts->ToolFind( ::translateODLtoTLB ) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Translator;
|
||||
toolInfo.name = ::translateODLtoTLB;
|
||||
toolInfo.path = 0;
|
||||
toolInfo.flags = OnLocalMenu;
|
||||
toolInfo.menuName = "OLE Compile to .TLB";
|
||||
toolInfo.helpHint = "Translate an ODL script to automation type library";
|
||||
toolInfo.defCmdLine = 0;
|
||||
toolInfo.translateFrom = ".odl";
|
||||
toolInfo.defaultFor = ".odl";
|
||||
toolInfo.translateTo = ".tlb";
|
||||
toolInfo.launchId = CALLBACK_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
// msMKTypLib
|
||||
// Internal (to example) tool used for converting from ODL to TLB files.
|
||||
if (!ts->ToolFind( ::msMkTypLib ) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Transfer;
|
||||
toolInfo.name = ::msMkTypLib;
|
||||
toolInfo.path = "mktyplib.exe";
|
||||
toolInfo.flags = ToolFlags(0);
|
||||
toolInfo.menuName = 0;
|
||||
toolInfo.helpHint = 0;
|
||||
toolInfo.defCmdLine = "/W0 /nocpp /nologo /tlb $OUTNAME tlbt@@@.tm~ ";
|
||||
toolInfo.translateFrom = 0;
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = DEFAULT_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
// oleRegister
|
||||
// Internal (to example) tool used to invoke register.exe
|
||||
if ( !ts->ToolFind( oleRegister ) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Transfer;
|
||||
toolInfo.name = ::oleRegister;
|
||||
toolInfo.path = "register.exe";
|
||||
toolInfo.flags = ToolFlags(0);
|
||||
toolInfo.menuName = 0;
|
||||
toolInfo.helpHint = 0;
|
||||
toolInfo.defCmdLine = 0;
|
||||
toolInfo.translateFrom = 0;
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = DEFAULT_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
// extractAndBindTLB
|
||||
// Create .tlb from .exe/.dll bind .tlb back into .dll/.exe
|
||||
if ( !ts->ToolFind( ::extractAndBindTLB ) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Translator;
|
||||
toolInfo.name = ::extractAndBindTLB;
|
||||
toolInfo.path = 0;
|
||||
toolInfo.flags = TargetTranslator | OnLocalMenu;
|
||||
toolInfo.menuName = "OLE Bind TypeLib";
|
||||
toolInfo.helpHint = "Extract Typelibrary and re-link target with .tlb";
|
||||
toolInfo.defCmdLine = "$TARGET";
|
||||
toolInfo.translateFrom = ".dll;.exe;AppExpert;AppExpertDLL;";
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = CALLBACK_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
// oleExtractTLB
|
||||
// Extract TypeLib Information
|
||||
if ( !ts->ToolFind( ::oleExtractTLB) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Translator;
|
||||
toolInfo.name = ::oleExtractTLB;
|
||||
toolInfo.path = "register.exe";
|
||||
toolInfo.flags = OnLocalMenu;
|
||||
toolInfo.menuName = "OLE Extract TypeLib";
|
||||
toolInfo.helpHint = "Extract automation type library from module";
|
||||
toolInfo.defCmdLine = "$TARGET -TypeLib=$NAME($TARGET).olb";
|
||||
toolInfo.translateFrom = ".exe;.dll;AppExpert;AppExpertDLL;";
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = ".olb";
|
||||
toolInfo.launchId = DEFAULT_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
// oleExtractReg
|
||||
// Create a .reg file from .exe/.dll
|
||||
if ( !ts->ToolFind( ::oleExtractReg) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Translator;
|
||||
toolInfo.name = ::oleExtractReg;
|
||||
toolInfo.path = "register.exe";
|
||||
toolInfo.flags = OnLocalMenu;
|
||||
toolInfo.menuName = "OLE Extract Register";
|
||||
toolInfo.helpHint = "Extract Registry database script from module";
|
||||
toolInfo.defCmdLine = "$TARGET -RegServer=$NAME($TARGET).reg";
|
||||
toolInfo.translateFrom = ".exe;.dll;AppExpert;AppExpertDLL;";
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = ".reg";
|
||||
toolInfo.launchId = DEFAULT_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
// oleRegEditAdvanced
|
||||
// Tools Menu option to invoke regedit with /v parameter.
|
||||
if ( !ts->ToolFind(::oleRegEditAdvanced))
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Transfer;
|
||||
toolInfo.name = ::oleRegEditAdvanced;
|
||||
toolInfo.path = "RegEdit.exe";
|
||||
toolInfo.flags = OnToolsMenu | OnLocalMenu;
|
||||
toolInfo.menuName = "OLE RegEdit Advanced";
|
||||
toolInfo.helpHint = "Invoke RegEdit using advanced display";
|
||||
toolInfo.defCmdLine = "/v";
|
||||
toolInfo.translateFrom = 0;
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = DEFAULT_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
// generateAndAddSource
|
||||
// Create nodes (.cxx [.cpp] /.hxx [.h] ) in your target from .exe/.dll
|
||||
if ( !ts->ToolFind(::generateAndAddSource))
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Translator;
|
||||
toolInfo.name = ::generateAndAddSource;
|
||||
toolInfo.path = 0;
|
||||
toolInfo.flags = OnLocalMenu;
|
||||
toolInfo.menuName = "OLE Generate Source";
|
||||
toolInfo.helpHint = "Generate class interface source";
|
||||
toolInfo.defCmdLine = 0;
|
||||
toolInfo.translateFrom = ".exe;.dll;AppExpert;AppExpertDLL;";
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = CALLBACK_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
// oleAutoGen
|
||||
// Internal (to example) tool used to invoke Autogen.
|
||||
if ( !ts->ToolFind( ::oleAutoGen ) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Transfer;
|
||||
toolInfo.name = ::oleAutoGen;
|
||||
toolInfo.path = "autogen.exe";
|
||||
toolInfo.flags = ToolFlags(0);
|
||||
toolInfo.menuName = 0;
|
||||
toolInfo.helpHint = 0;
|
||||
toolInfo.defCmdLine = 0;
|
||||
toolInfo.translateFrom = 0;
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = DEFAULT_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// LocalProjectClient::CloseNotify, forced pure virtual implementation.
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
void _HOOKEP
|
||||
LocalProjClient::CloseNotify()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// LocalProjectClient::NodeDeleteNotify, forced pure virtual implementation.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void _HOOKEP
|
||||
LocalProjClient::NodeDeleteNotify(ProjectNode)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// LocalProjectClient::DependencyQueryResponder, forced pure virtual implementation.
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
void _HOOKEP
|
||||
LocalProjClient::DependencyQueryResponder(ProjectNode ,const char *)
|
||||
{
|
||||
}
|
||||
|
||||
// End of file
|
||||
@@ -0,0 +1,13 @@
|
||||
LIBRARY OLETOOLS
|
||||
DESCRIPTION 'Common tools used in OLE development'
|
||||
EXETYPE WINDOWS
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
HEAPSIZE 4096
|
||||
SEGMENTS
|
||||
_TEXT PRELOAD MOVEABLE
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME
|
||||
IDELIBMAIN @2
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,280 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma hdrstop
|
||||
#include <string.h>
|
||||
#include <dos.h>
|
||||
#include <commdlg.h>
|
||||
#include "pathspec.h"
|
||||
|
||||
|
||||
// //
|
||||
// class PathSpec implementation //
|
||||
// //
|
||||
|
||||
int
|
||||
PathSpec::split()
|
||||
{
|
||||
return( _flags = ::fnsplit( _path, _drive, _dir, _file, _ext ) );
|
||||
}
|
||||
|
||||
void
|
||||
PathSpec::merge()
|
||||
{
|
||||
::fnmerge( _path, _drive, _dir, _file, _ext );
|
||||
}
|
||||
|
||||
void
|
||||
PathSpec::path(const char *path)
|
||||
{
|
||||
strcpy( _path, path );
|
||||
split();
|
||||
}
|
||||
|
||||
void
|
||||
PathSpec::drive(const char *drive)
|
||||
{
|
||||
strcpy( _drive, drive );
|
||||
merge();
|
||||
}
|
||||
|
||||
void
|
||||
PathSpec::dir(const char *dir)
|
||||
{
|
||||
strcpy( _dir, dir );
|
||||
merge();
|
||||
}
|
||||
|
||||
void
|
||||
PathSpec::file(const char *file)
|
||||
{
|
||||
strcpy( _file, file );
|
||||
merge();
|
||||
}
|
||||
|
||||
void
|
||||
PathSpec::ext(const char *ext)
|
||||
{
|
||||
strcpy( _ext, ext );
|
||||
merge();
|
||||
}
|
||||
|
||||
void
|
||||
PathSpec::fileext( const char *fileExt )
|
||||
{
|
||||
char * p = (char *)(strchr(fileExt,'.'));
|
||||
|
||||
if( !p )
|
||||
p = "";
|
||||
|
||||
ext( p );
|
||||
*p = 0;
|
||||
|
||||
file( fileExt );
|
||||
}
|
||||
|
||||
int
|
||||
PathSpec::first()
|
||||
{
|
||||
if( ::findfirst( _path, &_dta, 0 ) == -1 )
|
||||
return(0);
|
||||
|
||||
fileext( _dta.ff_name );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
int
|
||||
PathSpec::next()
|
||||
{
|
||||
if( ::findnext( &_dta ) == -1 )
|
||||
return( 0 );
|
||||
|
||||
fileext( _dta.ff_name );
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
int
|
||||
PathSpec::sameDrive( PathSpec & other )
|
||||
{
|
||||
if( *_drive == *other._drive )
|
||||
return(1);
|
||||
|
||||
if( !*_drive )
|
||||
{
|
||||
_drive[0] = ::getdisk() + 'A' - 1;
|
||||
_drive[1] = ':';
|
||||
_drive[2] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !*other._drive )
|
||||
{
|
||||
other._drive[0] = ::getdisk() + 'A' - 1;
|
||||
other._drive[1] = ':';
|
||||
other._drive[2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
char s[3];
|
||||
|
||||
s[0] = *_drive;
|
||||
s[1] = *other._drive;
|
||||
s[2] = 0;
|
||||
|
||||
strlwr( s );
|
||||
|
||||
return( s[0] == s[1] );
|
||||
}
|
||||
|
||||
int
|
||||
PathSpec::isDirectory()
|
||||
{
|
||||
int lastCharPos = strlen( _path ) - 1;
|
||||
|
||||
char lastChar;
|
||||
|
||||
if(((lastChar = _path[lastCharPos]) == '\\') || (lastChar == '/'))
|
||||
_path[lastCharPos] = 0;
|
||||
|
||||
int ret = (::findfirst( _path, &_dta, FA_DIREC ) != -1 ) &&
|
||||
( _dta.ff_attrib & FA_DIREC );
|
||||
|
||||
_path[ lastCharPos ] = lastChar;
|
||||
|
||||
return( ret );
|
||||
}
|
||||
|
||||
char *
|
||||
PathSpec::stripTrailingSlash()
|
||||
{
|
||||
int lastCharPos = strlen( _path ) - 1;
|
||||
|
||||
if( (_path[lastCharPos] == '\\') || (_path[lastCharPos] == '/') )
|
||||
_path[lastCharPos] = 0;
|
||||
|
||||
return( _path );
|
||||
}
|
||||
|
||||
void
|
||||
PathSpec::addTrailingSlash()
|
||||
{
|
||||
int lastCharPos = strlen( _path ) - 1;
|
||||
|
||||
if( (_path[lastCharPos] != '\\') && (_path[lastCharPos] != '/') )
|
||||
{
|
||||
strcat( _path, "\\" );
|
||||
split();
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
PathSpec::newFileDialog
|
||||
(
|
||||
const char * filter,
|
||||
const char * initialDir,
|
||||
unsigned long hwndParent
|
||||
)
|
||||
{
|
||||
return(
|
||||
fileDialog
|
||||
(
|
||||
filter,
|
||||
initialDir,
|
||||
hwndParent,
|
||||
OFN_HIDEREADONLY |
|
||||
OFN_PATHMUSTEXIST
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
int
|
||||
PathSpec::openFileDialog
|
||||
(
|
||||
const char * filter,
|
||||
const char * initialDir,
|
||||
unsigned long hwndParent
|
||||
)
|
||||
{
|
||||
return(
|
||||
fileDialog
|
||||
(
|
||||
filter,
|
||||
initialDir,
|
||||
hwndParent,
|
||||
OFN_HIDEREADONLY |
|
||||
OFN_PATHMUSTEXIST |
|
||||
OFN_FILEMUSTEXIST
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
int
|
||||
PathSpec::fileDialog
|
||||
(
|
||||
const char * filter,
|
||||
const char * initialDir,
|
||||
unsigned long hwndParent,
|
||||
unsigned long flags
|
||||
)
|
||||
{
|
||||
char szFile[256];
|
||||
char *szFilter;
|
||||
|
||||
strcpy( szFile, file() );
|
||||
if( *szFile )
|
||||
strcat( szFile, ext() );
|
||||
|
||||
if( !filter )
|
||||
filter = "All files (*.*)|(*.*)|";
|
||||
szFilter = new char[ strlen(filter) + 1 ];
|
||||
strcpy( szFilter, filter );
|
||||
|
||||
for ( unsigned short i = 0; szFilter[i] != 0; i++)
|
||||
{
|
||||
if (szFilter[i] == '|' )
|
||||
szFilter[i] = 0;
|
||||
}
|
||||
|
||||
/* Set all structure members to zero. */
|
||||
|
||||
OPENFILENAME ofn;
|
||||
|
||||
memset( &ofn, 0, sizeof(ofn) );
|
||||
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = (HWND)(hwndParent);
|
||||
ofn.lpstrFilter = szFilter;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFile = szFile;
|
||||
ofn.nMaxFile = sizeof(szFile);
|
||||
ofn.lpstrInitialDir = initialDir;
|
||||
ofn.Flags = flags;
|
||||
|
||||
|
||||
int ret;
|
||||
|
||||
if ( (ret = GetOpenFileName(&ofn)) == 0 )
|
||||
{
|
||||
DWORD Errval = ::CommDlgExtendedError();
|
||||
|
||||
if (Errval != 0) // 0 value means user selected Cancel
|
||||
{
|
||||
char szErr[80];
|
||||
|
||||
wsprintf( szErr, "GetOpenFile error: %ld", Errval );
|
||||
::MessageBox( ::GetActiveWindow(),szErr,"OpenFile",
|
||||
MB_ICONEXCLAMATION | MB_OK );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
path( ofn.lpstrFile );
|
||||
}
|
||||
|
||||
delete szFilter;
|
||||
|
||||
return( ret );
|
||||
}
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#ifndef __PATHSPEC_H
|
||||
#define __PATHSPEC_H
|
||||
|
||||
#ifndef __DIR_H
|
||||
# include <dir.h>
|
||||
#endif
|
||||
|
||||
// //
|
||||
// class PathSpec for manipulation file paths //
|
||||
// //
|
||||
|
||||
class PathSpec
|
||||
{
|
||||
public:
|
||||
// ctor //
|
||||
|
||||
PathSpec( const char * = "" );
|
||||
|
||||
// accessors //
|
||||
|
||||
const char * path();
|
||||
const char * drive();
|
||||
const char * dir();
|
||||
const char * file();
|
||||
const char * ext();
|
||||
|
||||
void path(const char *);
|
||||
void drive(const char *);
|
||||
void dir(const char *);
|
||||
void file(const char *);
|
||||
void ext(const char *);
|
||||
void fileext( const char * );
|
||||
|
||||
long age();
|
||||
|
||||
// flags() returns FILENAME, WILDCARDS etc. flags found in dir.h //
|
||||
|
||||
int flags();
|
||||
|
||||
// explicit splitter/merger //
|
||||
|
||||
int split();
|
||||
void merge();
|
||||
|
||||
// disk manipulation and polling //
|
||||
|
||||
int exists();
|
||||
int first();
|
||||
int next();
|
||||
|
||||
// Are this and another PathSpec referring to the same drive? //
|
||||
|
||||
int sameDrive( PathSpec & );
|
||||
|
||||
// Is this PathSpec really representing a directory? //
|
||||
|
||||
int isDirectory();
|
||||
|
||||
void addTrailingSlash();
|
||||
|
||||
// Strip the trailing slash from the path() element and return //
|
||||
// the path(). (Calling this invalidates the use dir(), file() //
|
||||
// and ext()). //
|
||||
|
||||
char * stripTrailingSlash();
|
||||
|
||||
// //
|
||||
// Do a FileOpen dialog on this pathSpec... //
|
||||
// 'filter' should use the pipe character ('|')//
|
||||
// as a separator //
|
||||
// (e.g. "All files (*.*)|*.*|") //
|
||||
// NOTE: In this implementation 'hwndParent' //
|
||||
// is a Windows' HWND. //
|
||||
// //
|
||||
|
||||
int openFileDialog
|
||||
(
|
||||
const char * filter = 0,
|
||||
const char * initialDir = 0,
|
||||
unsigned long hwndParent = 0
|
||||
);
|
||||
|
||||
int newFileDialog
|
||||
(
|
||||
const char * filter = 0,
|
||||
const char * initialDir = 0,
|
||||
unsigned long hwndParent = 0
|
||||
);
|
||||
|
||||
int fileDialog
|
||||
(
|
||||
const char * filter = 0,
|
||||
const char * initialDir = 0,
|
||||
unsigned long hwndParent = 0,
|
||||
unsigned long flags = 0
|
||||
);
|
||||
private:
|
||||
|
||||
char _path [ MAXPATH ];
|
||||
char _drive[ MAXDRIVE ];
|
||||
char _dir [ MAXDIR ];
|
||||
char _file [ MAXFILE ];
|
||||
char _ext [ MAXEXT ];
|
||||
int _flags;
|
||||
|
||||
struct ffblk _dta;
|
||||
};
|
||||
|
||||
inline
|
||||
PathSpec::PathSpec( const char * apath )
|
||||
{
|
||||
path( apath );
|
||||
}
|
||||
|
||||
inline const char *
|
||||
PathSpec::path()
|
||||
{
|
||||
return( _path );
|
||||
}
|
||||
|
||||
inline const char *
|
||||
PathSpec::drive()
|
||||
{
|
||||
return( _drive );
|
||||
}
|
||||
|
||||
inline const char *
|
||||
PathSpec::dir()
|
||||
{
|
||||
return( _dir );
|
||||
}
|
||||
|
||||
inline const char *
|
||||
PathSpec::file()
|
||||
{
|
||||
return( _file );
|
||||
}
|
||||
|
||||
inline const char *
|
||||
PathSpec::ext()
|
||||
{
|
||||
return( _ext );
|
||||
}
|
||||
|
||||
inline int
|
||||
PathSpec::flags()
|
||||
{
|
||||
return( _flags );
|
||||
}
|
||||
|
||||
inline int
|
||||
PathSpec::exists()
|
||||
{
|
||||
return( first() );
|
||||
}
|
||||
|
||||
inline long
|
||||
PathSpec::age()
|
||||
{
|
||||
if( exists() )
|
||||
{
|
||||
unsigned long date = _dta.ff_fdate;
|
||||
unsigned long time = _dta.ff_ftime;
|
||||
|
||||
return( (long)( (date << 16) | time ) );
|
||||
}
|
||||
return( -1L );
|
||||
}
|
||||
|
||||
#endif __PATHSPEC_H
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma hdrstop
|
||||
|
||||
#include "idehook.h"
|
||||
#include "pathspec.h"
|
||||
#include <string.h>
|
||||
|
||||
static char realCppCompileName[] = "CppCompile";
|
||||
static char sectionCppCompileName[] = "SectionCppCompile";
|
||||
|
||||
|
||||
class _HOOKCLASS LocalToolClient : public ToolClient
|
||||
{
|
||||
public:
|
||||
ToolReturn _HOOKEP RunSectionCompiler( ToolInvokeArgs * );
|
||||
|
||||
void RegisterMyCallBacks( ToolServer * );
|
||||
|
||||
private:
|
||||
|
||||
int registered;
|
||||
static ToolRegisterPack entryPoints[];
|
||||
|
||||
};
|
||||
|
||||
static LocalToolClient localToolClient;
|
||||
|
||||
ToolRegisterPack LocalToolClient::entryPoints[] =
|
||||
{
|
||||
{ sectionCppCompileName, (ToolMethod)&LocalToolClient::RunSectionCompiler },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
void
|
||||
LocalToolClient::RegisterMyCallBacks( ToolServer * ts )
|
||||
{
|
||||
if( !registered )
|
||||
{
|
||||
registered = 1;
|
||||
ts->ToolRegisterImplementor( this, entryPoints );
|
||||
}
|
||||
}
|
||||
|
||||
ToolReturn _HOOKEP
|
||||
LocalToolClient::RunSectionCompiler( ToolInvokeArgs * args )
|
||||
{
|
||||
ProjectNode node = args->numNodes ? *args->nodeArray : 0;
|
||||
|
||||
if( node )
|
||||
{
|
||||
OptionSetReq optSetServer;
|
||||
const char * defines;
|
||||
|
||||
optSetServer->OptionGet( node, OID_Defines, defines );
|
||||
|
||||
const char * pSectionText;
|
||||
static char szSection[] = "SECTION=";
|
||||
|
||||
if( (pSectionText = strstr( defines, szSection)) != 0 )
|
||||
{
|
||||
ProjectNodeInfo nodeInfo;
|
||||
ProjectReq projectServer;
|
||||
|
||||
projectServer->QueryNodeInfo( node, nodeInfo );
|
||||
|
||||
PathSpec outPath( nodeInfo.outputLocation );
|
||||
|
||||
char newName[ MAXFILE + 2 ];
|
||||
|
||||
strcpy( newName, outPath.file() );
|
||||
|
||||
int numberIndex = strlen(newName);
|
||||
|
||||
if( numberIndex == 8 )
|
||||
--numberIndex;
|
||||
|
||||
newName[ numberIndex++ ] = *(pSectionText + (sizeof(szSection)-1));
|
||||
newName[ numberIndex ] = 0;
|
||||
|
||||
outPath.file( newName );
|
||||
|
||||
optSetServer->OptionApply( node, OID_Intermediate, outPath.path() );
|
||||
|
||||
}
|
||||
|
||||
ToolReq server;
|
||||
ToolObj realCompiler = server->ToolFind( realCppCompileName );
|
||||
|
||||
return( server->ToolInvoke( realCompiler, node ) );
|
||||
|
||||
}
|
||||
|
||||
return( NotHandled );
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Project stuff
|
||||
//
|
||||
|
||||
class _HOOKCLASS LocalProjClient : public ProjectClient
|
||||
{
|
||||
public:
|
||||
LocalProjClient();
|
||||
|
||||
virtual void _HOOKEP OpenNotify
|
||||
(
|
||||
const char * name
|
||||
);
|
||||
|
||||
virtual void _HOOKEP CloseNotify();
|
||||
|
||||
virtual void _HOOKEP NodeDeleteNotify
|
||||
(
|
||||
ProjectNode
|
||||
);
|
||||
|
||||
virtual void _HOOKEP DependencyQueryResponder
|
||||
(
|
||||
ProjectNode ,
|
||||
const char *
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
static LocalProjClient LocalProjClient;
|
||||
|
||||
LocalProjClient::LocalProjClient()
|
||||
{
|
||||
ProjectReq ps;
|
||||
|
||||
ps->RegisterProjectClient(this);
|
||||
}
|
||||
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::OpenNotify
|
||||
(
|
||||
const char * // name
|
||||
)
|
||||
{
|
||||
ToolReq ts;
|
||||
|
||||
localToolClient.RegisterMyCallBacks( ts );
|
||||
|
||||
if( !ts->ToolFind( sectionCppCompileName ) )
|
||||
{
|
||||
ToolObj realCppCompiler;
|
||||
|
||||
if( (realCppCompiler = ts->ToolFind( realCppCompileName )) != 0 )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
ts->QueryToolInfo( realCppCompiler, toolInfo );
|
||||
|
||||
toolInfo.name = sectionCppCompileName;
|
||||
toolInfo.menuName = "&Section Compiler";
|
||||
toolInfo.helpHint = "Munge outname of node then C++ Compile";
|
||||
toolInfo.launchId = CALLBACK_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::CloseNotify()
|
||||
{
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::NodeDeleteNotify
|
||||
(
|
||||
ProjectNode
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::DependencyQueryResponder
|
||||
(
|
||||
ProjectNode ,
|
||||
const char *
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
LIBRARY SECTCOMP
|
||||
DESCRIPTION 'Frank Borland'
|
||||
EXETYPE WINDOWS
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
HEAPSIZE 4096
|
||||
SEGMENTS
|
||||
_TEXT PRELOAD MOVEABLE
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME
|
||||
IDELIBMAIN @2
|
||||
|
||||
@@ -0,0 +1,204 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma hdrstop
|
||||
|
||||
#include "idehook.h"
|
||||
#include "pathspec.h"
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
static char targetExeSnipName[] = "TargetExeSnippets";
|
||||
static char targetDllSnipName[] = "TargetDllSnippets";
|
||||
|
||||
#define CRLF "\n"
|
||||
|
||||
static char szExeWinMain[] =
|
||||
"//" CRLF
|
||||
"// This is the WinMain snippet" CRLF
|
||||
"//" CRLF
|
||||
"#include <windows.h>" CRLF
|
||||
CRLF
|
||||
"int WINAPI WinMain" CRLF
|
||||
"(" CRLF
|
||||
" HINSTANCE /* hInstance */," CRLF
|
||||
" HINSTANCE /* hPrevInstance */, " CRLF
|
||||
" LPSTR /* lpCmdLine */," CRLF
|
||||
" int /* howShow */" CRLF
|
||||
")" CRLF
|
||||
"{" CRLF
|
||||
" return(0);" CRLF
|
||||
"}" CRLF
|
||||
;
|
||||
|
||||
static char szExeOwlMain[] =
|
||||
"//" CRLF
|
||||
"// This is the OwlMain snippet" CRLF
|
||||
"//" CRLF
|
||||
"#include <owl/applicat.h>" CRLF
|
||||
CRLF
|
||||
"int OwlMain( int /* argc */ , char ** /* argv */ )" CRLF
|
||||
"{" CRLF
|
||||
" return( TApplication().Run() );" CRLF
|
||||
"}" CRLF
|
||||
;
|
||||
|
||||
static char szExeDefSnip[] =
|
||||
"EXETYPE WINDOWS" CRLF
|
||||
"CODE PRELOAD MOVEABLE DISCARDABLE" CRLF
|
||||
"DATA PRELOAD MOVEABLE MULTIPLE" CRLF
|
||||
"HEAPSIZE 4096" CRLF
|
||||
"STACKSIZE 8192" CRLF
|
||||
;
|
||||
|
||||
class _HOOKCLASS LocalToolClient : public ToolClient
|
||||
{
|
||||
public:
|
||||
ToolReturn _HOOKEP RunTargetExeSnips( ToolInvokeArgs * );
|
||||
ToolReturn _HOOKEP RunTargetDllSnips( ToolInvokeArgs * );
|
||||
|
||||
void RegisterMyCallBacks( ToolServer * );
|
||||
|
||||
private:
|
||||
int registered;
|
||||
static ToolRegisterPack entryPoints[];
|
||||
|
||||
};
|
||||
|
||||
static LocalToolClient localToolClient;
|
||||
|
||||
ToolRegisterPack LocalToolClient::entryPoints[] =
|
||||
{
|
||||
{ targetExeSnipName, (ToolMethod)&LocalToolClient::RunTargetExeSnips },
|
||||
// { targetDllSnipName, (ToolMethod)&LocalToolClient::RunTargetDllSnips },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
void
|
||||
LocalToolClient::RegisterMyCallBacks( ToolServer * ts )
|
||||
{
|
||||
if( !registered )
|
||||
{
|
||||
registered = 1;
|
||||
ts->ToolRegisterImplementor( this, entryPoints );
|
||||
}
|
||||
}
|
||||
|
||||
ToolReturn _HOOKEP
|
||||
LocalToolClient::RunTargetExeSnips( ToolInvokeArgs * args )
|
||||
{
|
||||
ToolReq server;
|
||||
|
||||
ProjectNode node = args->numNodes ? *args->nodeArray : 0;
|
||||
|
||||
if( node )
|
||||
{
|
||||
ProjectNodeInfo nodeInfo;
|
||||
ProjectReq project;
|
||||
PathSpec nodePath;
|
||||
EditorReq editor;
|
||||
|
||||
project->QueryNodeInfo( node, nodeInfo );
|
||||
|
||||
nodePath.path( nodeInfo.outputLocation );
|
||||
|
||||
// //
|
||||
// Do the [.cpp] main source node //
|
||||
// //
|
||||
|
||||
nodePath.ext( ".cpp" );
|
||||
|
||||
project->NodeAdd( node, nodePath.path() );
|
||||
|
||||
editor->set_buffer( editor->create_buffer( 0,
|
||||
(char *)nodePath.path(),
|
||||
0 ) );
|
||||
|
||||
TargetExpertReq targetExpert;
|
||||
|
||||
const char * mainSnip;
|
||||
|
||||
if( targetExpert->QuerySupports( node, 0, OWL, 0 ) )
|
||||
mainSnip = szExeOwlMain;
|
||||
else
|
||||
mainSnip = szExeWinMain;
|
||||
|
||||
editor->insert( (char *)mainSnip );
|
||||
|
||||
editor->show_buffer();
|
||||
|
||||
// //
|
||||
// Do the [.def] main source node //
|
||||
// //
|
||||
|
||||
nodePath.ext( ".def" );
|
||||
project->NodeAdd( node, nodePath.path() );
|
||||
editor->set_buffer( editor->create_buffer( 0,
|
||||
(char *)nodePath.path(),
|
||||
0 ) );
|
||||
editor->insert( szExeDefSnip );
|
||||
}
|
||||
|
||||
return( Success );
|
||||
|
||||
}
|
||||
|
||||
// //
|
||||
// Project stuff //
|
||||
// //
|
||||
|
||||
class _HOOKCLASS LocalProjClient : public ProjectClient
|
||||
{
|
||||
public:
|
||||
LocalProjClient();
|
||||
|
||||
virtual void _HOOKEP OpenNotify( const char * name );
|
||||
virtual void _HOOKEP CloseNotify() {}
|
||||
virtual void _HOOKEP NodeDeleteNotify( ProjectNode ) {}
|
||||
virtual void _HOOKEP DependencyQueryResponder(ProjectNode,const char *) {}
|
||||
|
||||
};
|
||||
|
||||
static LocalProjClient LocalProjClient;
|
||||
|
||||
LocalProjClient::LocalProjClient()
|
||||
{
|
||||
ProjectReq ps;
|
||||
|
||||
ps->RegisterProjectClient(this);
|
||||
}
|
||||
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::OpenNotify
|
||||
(
|
||||
const char * // name
|
||||
)
|
||||
{
|
||||
ToolReq ts;
|
||||
|
||||
localToolClient.RegisterMyCallBacks( ts );
|
||||
|
||||
if( !ts->ToolFind( targetExeSnipName ) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Viewer;
|
||||
toolInfo.name = targetExeSnipName;
|
||||
toolInfo.path = 0;
|
||||
toolInfo.flags = OnLocalMenu;
|
||||
toolInfo.menuName = "&Target snippets";
|
||||
toolInfo.helpHint = "Generate a skeleton for a target";
|
||||
toolInfo.defCmdLine = 0;
|
||||
toolInfo.appliesTo = ".exe;";
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = CALLBACK_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
LIBRARY trgsnps
|
||||
DESCRIPTION 'Frank Borland'
|
||||
EXETYPE WINDOWS
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
HEAPSIZE 4096
|
||||
SEGMENTS
|
||||
_TEXT PRELOAD MOVEABLE
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME
|
||||
IDELIBMAIN @2
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// IdeHook - (C) Copyright 1994 by Borland International
|
||||
//----------------------------------------------------------------------------
|
||||
#pragma hdrstop
|
||||
|
||||
#include "idehook.h"
|
||||
#include <string.h>
|
||||
|
||||
static char wipeOptsName[] = "OptionsWiper";
|
||||
|
||||
|
||||
class _HOOKCLASS LocalToolClient : public ToolClient
|
||||
{
|
||||
public:
|
||||
ToolReturn _HOOKEP RunOptionWiper( ToolInvokeArgs * );
|
||||
|
||||
void RegisterMyCallBacks( ToolServer * );
|
||||
|
||||
private:
|
||||
|
||||
void WipeNodeOptions( ProjectNode, ProjectServer *, OptionSetServer * );
|
||||
|
||||
int registered;
|
||||
static ToolRegisterPack entryPoints[];
|
||||
|
||||
};
|
||||
|
||||
static LocalToolClient localToolClient;
|
||||
|
||||
ToolRegisterPack LocalToolClient::entryPoints[] =
|
||||
{
|
||||
{ wipeOptsName, (ToolMethod)&LocalToolClient::RunOptionWiper },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
void
|
||||
LocalToolClient::RegisterMyCallBacks( ToolServer * ts )
|
||||
{
|
||||
if( !registered )
|
||||
{
|
||||
registered = 1;
|
||||
ts->ToolRegisterImplementor( this, entryPoints );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LocalToolClient::WipeNodeOptions
|
||||
(
|
||||
ProjectNode node,
|
||||
ProjectServer * projectServer,
|
||||
OptionSetServer * optSetServer
|
||||
)
|
||||
{
|
||||
optSetServer->OptionRemove( node, OID_RemoveAll );
|
||||
|
||||
ProjectNodeInfo nodeInfo;
|
||||
|
||||
projectServer->QueryNodeInfo( node, nodeInfo );
|
||||
|
||||
node = nodeInfo.firstChild;
|
||||
|
||||
while( node )
|
||||
{
|
||||
WipeNodeOptions( node, projectServer, optSetServer );
|
||||
|
||||
projectServer->QueryNodeInfo( node, nodeInfo );
|
||||
|
||||
node = nodeInfo.nextSibling;
|
||||
}
|
||||
}
|
||||
|
||||
ToolReturn _HOOKEP
|
||||
LocalToolClient::RunOptionWiper( ToolInvokeArgs * args )
|
||||
{
|
||||
int count = args->numNodes;
|
||||
|
||||
ProjectReq projectServer;
|
||||
OptionSetReq optSetServer;
|
||||
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
ProjectNode node = args->nodeArray[i];
|
||||
|
||||
WipeNodeOptions( node, projectServer, optSetServer );
|
||||
}
|
||||
|
||||
return( Success );
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Project stuff
|
||||
//
|
||||
|
||||
class _HOOKCLASS LocalProjClient : public ProjectClient
|
||||
{
|
||||
public:
|
||||
LocalProjClient();
|
||||
|
||||
virtual void _HOOKEP OpenNotify
|
||||
(
|
||||
const char * name
|
||||
);
|
||||
|
||||
virtual void _HOOKEP CloseNotify();
|
||||
|
||||
virtual void _HOOKEP NodeDeleteNotify
|
||||
(
|
||||
ProjectNode
|
||||
);
|
||||
|
||||
virtual void _HOOKEP DependencyQueryResponder
|
||||
(
|
||||
ProjectNode ,
|
||||
const char *
|
||||
);
|
||||
};
|
||||
|
||||
static LocalProjClient LocalProjClient;
|
||||
|
||||
LocalProjClient::LocalProjClient()
|
||||
{
|
||||
ProjectReq ps;
|
||||
|
||||
ps->RegisterProjectClient(this);
|
||||
}
|
||||
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::OpenNotify
|
||||
(
|
||||
const char * // name
|
||||
)
|
||||
{
|
||||
ToolReq ts;
|
||||
|
||||
localToolClient.RegisterMyCallBacks( ts );
|
||||
|
||||
if( !ts->ToolFind( wipeOptsName ) )
|
||||
{
|
||||
ToolInfo toolInfo;
|
||||
|
||||
toolInfo.toolType = Transfer;
|
||||
toolInfo.name = wipeOptsName;
|
||||
toolInfo.path = 0;
|
||||
toolInfo.flags = OnToolsMenu;
|
||||
toolInfo.menuName = "&Options Wiper";
|
||||
toolInfo.helpHint = "Delete the local overrides for node(s)";
|
||||
toolInfo.defCmdLine = 0;
|
||||
toolInfo.appliesTo = 0;
|
||||
toolInfo.defaultFor = 0;
|
||||
toolInfo.translateTo = 0;
|
||||
toolInfo.launchId = CALLBACK_LAUNCH_ID;
|
||||
|
||||
ts->ToolAdd( &toolInfo );
|
||||
}
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::CloseNotify()
|
||||
{
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::NodeDeleteNotify
|
||||
(
|
||||
ProjectNode
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
void _HOOKEP
|
||||
LocalProjClient::DependencyQueryResponder
|
||||
(
|
||||
ProjectNode ,
|
||||
const char *
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
// End of file
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
LIBRARY WIPEOPTS
|
||||
DESCRIPTION 'Frank Borland'
|
||||
EXETYPE WINDOWS
|
||||
CODE LOADONCALL MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE SINGLE
|
||||
HEAPSIZE 4096
|
||||
SEGMENTS
|
||||
_TEXT PRELOAD MOVEABLE
|
||||
|
||||
EXPORTS
|
||||
WEP @1 RESIDENTNAME
|
||||
IDELIBMAIN @2
|
||||
|
||||
Reference in New Issue
Block a user