Update of /cvsroot/tvision/tvision/examples/bhelp
In directory sc8-pr-cvs1:/tmp/cvs-serv11038/examples/bhelp
Added Files:
.tvrc bhelp.cc bhelp.h rhide.env thelp.cc thelp.gpr thelp.mak
Log Message:
* Added: A new example: a Borland's Help files reader. It can read TC++ and
BC++ help files. Contributed by Jan Van Buggenhout <Chipzz@...>.
--- NEW FILE: .tvrc ---
[TV]
{
# This is needed because Borland files are encoded in ANSI CP 437
AppCP=437
Font10x20=1
}
--- NEW FILE: bhelp.cc ---
/**[txh]********************************************************************
Copyright (c) 2002 by Jan Van Buggenhout <Chipzz@...>
Based on code:
Copyright (c) 1994 by Borland International
Modified by Sergio Sigala <ssigala@...>
Modified by Salvador E. Tropea <set@...>, <set@...>
Copyright (c) 1999 by Andreas F. Gorup von Besanez <besanez@...>
Covered by the GPL license.
Description:
This is a class derived from THelpFile to read Borland help files.
***************************************************************************/
#define Uses_ctype
#define Uses_limits
#define Uses_string
#define Uses_stdlib
#define Uses_sys_stat
#define Uses_filelength
#define Uses_TCollection
#define Uses_TStreamableClass
#define Uses_THelpFile
#define Uses_fpstream
#include <tv.h>
#include "bhelp.h"
char *read0String(fpstream & s)
{
int l;
long p = s.tellg();
for (l = 1; s.readByte(); l++) ;
char *buffer = new char[l];
s.seekg(p);
s.readBytes(buffer, l);
return buffer;
}
// TBorlandHelpTopic
const char *const TBorlandHelpTopic::name = "TBorlandHelpTopic";
TBorlandHelpTopic::TBorlandHelpTopic(fpstream & s, char *comp)
{
char type;
unsigned short datalength, refslength;
s >> type;
s >> datalength;
unsigned char *data = new(unsigned char)[datalength];
char *text = new char[datalength * 9];
char *curtext = text;
s.readBytes(data, datalength);
unsigned short noRefs;
s >> type;
s >> refslength;
s >> previous;
s >> next;
s >> noRefs;
setNumCrossRefs(0);
refslength -= 6;
unsigned short *refs = (unsigned short *) (new(unsigned char)[refslength]);
unsigned short *curref = refs;
s.readBytes(refs, refslength);
for (long k = 0; k < datalength * 2; k++)
{
unsigned char Nibble;
Nibble = (data[k / 2] >> ((k & 1) * 4)) & 0xf;
switch (Nibble)
{
case 0:
*curtext++ = 0;
break;
case 0xe: /* Rep */
{
unsigned short RepCount;
k++;
RepCount = ((data[k / 2] >> ((k & 1) * 4)) & 0xf) + 2;
k++;
Nibble = (data[k / 2] >> ((k & 1) * 4)) & 0xf;
if (Nibble < 0xe)
{
memset(curtext, comp[Nibble], RepCount);
curtext += RepCount;
}
else if (Nibble == 0xf)
{
k++;
Nibble = data[k / 2] >> ((k & 1) * 4);
k++;
memset(curtext,
Nibble | ((data[k / 2] >> ((k & 1) * 4)) << 4), RepCount);
curtext += RepCount;
}
break;
}
case 0xf: /* Raw */
k++;
Nibble = data[k / 2] >> ((k & 1) * 4);
k++;
*curtext++ = Nibble | ((data[k / 2] >> ((k & 1) * 4)) << 4);
break;
default:
*curtext++ = comp[Nibble];
break;
}
}
for (char *para = text; (para < curtext) && (*para != 1);
para += strlen(para) + 1)
{
for (char *ref = strchr(para, 2); ref; ref = strchr(ref, 2))
{
char *endref = strchr(ref + 1, 2) - 1;
int length = endref - ref;
TCrossRef cref;
cref.offset = ref - text + 1;
cref.length = length;
cref.ref = *curref++;
addCrossRef(cref);
memmove(ref, ref + 1, length);
memmove(endref, endref + 2, curtext - endref);
curtext -= 2;
}
TParagraph *paragraph = new TParagraph;
paragraph->text = strdup(para);
paragraph->size = strlen(para) + 1;
paragraph->wrap = False;
addParagraph(paragraph);
}
free(data);
free(text);
free(refs);
}
TStreamableClass RBorlandHelpTopic(TBorlandHelpTopic::name,
TBorlandHelpTopic::build,
__DELTA(TBorlandHelpTopic));
// TBorlandHelpIndex
const char *const TBorlandHelpIndex::name = "TBorlandHelpIndex";
TBorlandHelpIndex::TBorlandHelpIndex(fpstream & s):THelpIndex()
{
unsigned short length;
unsigned char *buffer;
s >> length;
buffer = new(unsigned char)[length];
s.readBytes(buffer, length);
size = *((unsigned short *) buffer);
index = new long[size];
buffer += 2;
for (int k = 0; k < size * 3; k += 3)
index[k/3] = ((buffer[k + 2] & 0x80) << 24) +
(buffer[k] + (buffer[k + 1] << 8) + ((buffer[k + 2] & 0x7f) << 16));
}
void *TBorlandHelpIndex::read(ipstream & is)
{
// FIXME
return 0;
}
TStreamable *TBorlandHelpIndex::build()
{
return new TBorlandHelpIndex(streamableInit);
}
TStreamableClass RBorlandHelpIndex(TBorlandHelpIndex::name,
TBorlandHelpIndex::build,
__DELTA(TBorlandHelpIndex));
// TBorlandHelpFile
TBorlandHelpFile::TBorlandHelpFile(fpstream & s):THelpFile(s)
{
char *Stamp;
char FormatVersion;
modified=false;
stream->seekg(0);
Stamp = read0String(*stream);
stream->seekg(14, ios::cur);
*stream >> FormatVersion;
stream->seekg(1, ios::cur);
while (!stream->eof())
{
char type;
unsigned short length;
unsigned char *buffer;
*stream >> type;
if (type != 1)
{
*stream >> length;
buffer = (unsigned char *) malloc(length);
stream->readBytes(buffer, length);
}
switch (type)
{
case 0: /* FileHeader */
{
ushort *o = (ushort *) buffer;
options = o[0];
indexscreen = o[1];
height = buffer[6];
width = buffer[7];
margin = buffer[8];
break;
}
case 1: /* ConText */
index = new TBorlandHelpIndex(*stream);
break;
case 2: /* Text */
stream->seekg(-(length + 3), ios::cur);
return;
case 3: /* KeyWord */
stream->seekg(-(length + 3), ios::cur);
return;
case 4: /* Index */
{
char temp[41];
*temp = 0;
glossaryItems = *((ushort *) buffer);
glossary = new (char *) [glossaryItems];
char *g = (char *) buffer + 2;
for (int i = 0; i < glossaryItems; i++)
{
uchar lengthcode = *g++;
ushort carry = (lengthcode & 0xe0) >> 5;
ushort unique = lengthcode & 0x1f;
glossary[i] = new char[carry + unique + 3];
strncpy(temp + carry, g, unique);
temp[carry + unique] = 0;
g += unique;
strncpy(temp + carry + unique + 1, g, 2);
g += 2;
memcpy(glossary[i], temp, carry + unique + 3);
}
break;
}
case 5: /* Compression */
*compressiontable = 0;
memcpy(compressiontable + 1, buffer + 2, 13);
break;
case 6: /* IndexTags */
break;
}
if (type != 1)
free(buffer);
}
}
class TSearchResults : public TCollection
{
public:
TSearchResults() : TCollection(0, 1) {};
virtual void *readItem( ipstream& ) { return 0; };
virtual void writeItem( void *, opstream& ) {};
};
TCollection *TBorlandHelpFile::search(char *s)
{
char *ss = strdup(s);
if (!(options & 4)) strupr(ss);
int found = 0;
int length = strlen(s);
TCollection *coll = new TSearchResults();
for (int i = 0; i < glossaryItems; i++)
{
if (!strncmp(ss, glossary[i], length))
{
found = 1;
coll->insert(glossary[i]);
}
else if (found) break;
}
free(ss);
return coll;
}
THelpTopic *TBorlandHelpFile::getTopic(int i)
{
long pos = index->position(i);
if (pos > 0)
{
stream->seekg(pos);
return new TBorlandHelpTopic(*stream, compressiontable);
}
else
return (invalidTopic());
}
--- NEW FILE: bhelp.h ---
/**[txh]********************************************************************
Copyright (c) 2002 by Jan Van Buggenhout <Chipzz@...>
Based on code:
Copyright (c) 1994 by Borland International
Modified by Sergio Sigala <ssigala@...>
Modified by Salvador E. Tropea <set@...>, <set@...>
Copyright (c) 1999 by Andreas F. Gorup von Besanez <besanez@...>
Covered by the GPL license.
Description:
This is a class derived from THelpFile to read Borland help files.
***************************************************************************/
#if !defined(TBorlandHelpFile_Included)
#define TBorlandHelpFile_Included
class TBorlandHelpTopic: public THelpTopic
{
public:
TBorlandHelpTopic( fpstream & s, char * comp );
short int previous, next;
protected:
virtual void *read( ipstream& ) { return 0; };
public:
static const char * const name;
static TStreamable *build() { return 0; };
};
// TBorlandHelpIndex
class TBorlandHelpIndex : public THelpIndex
{
public:
TBorlandHelpIndex( fpstream & );
TBorlandHelpIndex( StreamableInit ) {};
protected:
virtual void *read( ipstream& );
public:
static const char * const name;
static TStreamable *build();
};
// TBorlandHelpFile
class TBorlandHelpFile : public THelpFile
{
public:
TBorlandHelpFile( fpstream & );
TCollection *search(char *sstr);
virtual THelpTopic *getTopic( int );
ushort options, indexscreen;
uchar height, width, margin;
ushort glossaryItems;
char ** glossary;
char compressiontable[13];
};
#endif // Uses_TBorlandHelpFile && !TBorlandHelpFile_Included
--- NEW FILE: rhide.env ---
#
# This include file have rhide options for all the subprojects.
#
include ../rhide.env
--- NEW FILE: thelp.cc ---
/**[txh]********************************************************************
Copyright (c) 1999 by Andreas F. Gorup von Besanez <besanez@...>
Copyright (c) 2002 by Jan Van Buggenhout <Chipzz@...>
Copyright (c) 2002 by Salvador E. Tropea <set@...>
Covered by the GPL license.
Description:
This program reads the help files used by Turbo C++ and Borland C++
compilers.
***************************************************************************/
#define Uses_stdlib
#define Uses_stdio
#define Uses_access
#define Uses_TKeys
#define Uses_ifpstream
#define Uses_IOS_BIN
#define Uses_TCollection
#define Uses_THelpWindow
#define Uses_TApplication
#define Uses_TDialog
#define Uses_TButton
#define Uses_TListBox
#define Uses_TPalette
#define Uses_TDeskTop
#define Uses_getopt
#define Uses_MsgBox
#include <tv.h>
#include "bhelp.h"
class THelp:public TApplication
{
public:
THelp();
virtual TPalette& getPalette() const;
static TDeskTop *initDeskTop( TRect r );
virtual void getEvent(TEvent& event);
virtual void run();
static void ParseCommandLine(int argc, char *argv[]);
static const char *fileName;
};
const char *THelp::fileName="tchelp.tch";
THelp::THelp():TProgInit(0, 0, &THelp::initDeskTop)
{
}
#define cpAppColor \
"\x71\x70\x78\x74\x20\x28\x24\x17\x1F\x1A\x31\x31\x1E\x71\x1F" \
"\x37\x3F\x3A\x13\x13\x3E\x21\x3F\x70\x7F\x7A\x13\x13\x70\x7F\x7E" \
"\x70\x7F\x7A\x13\x13\x70\x70\x7F\x7E\x20\x2B\x2F\x78\x2E\x70\x30" \
"\x3F\x3E\x1F\x2F\x1A\x20\x72\x31\x31\x30\x2F\x3E\x31\x13\x38\x00" \
"\x17\x1F\x1A\x71\x71\x1E\x17\x1F\x1E\x20\x2B\x2F\x78\x2E\x10\x30" \
"\x3F\x3E\x70\x2F\x7A\x20\x12\x31\x31\x30\x2F\x3E\x31\x13\x38\x00" \
"\x37\x3F\x3A\x13\x13\x3E\x30\x3F\x3E\x20\x2B\x2F\x78\x2E\x30\x70" \
"\x7F\x7E\x1F\x2F\x1A\x20\x32\x31\x71\x70\x2F\x7E\x71\x13\x78\x00" \
"\x37\x3F\x3A\x13\x13\x30\x3E\x1E" // help colors
TPalette& THelp::getPalette() const
{
static TPalette helpcolor ( cpAppColor , sizeof( cpAppColor )-1 );
return helpcolor;
}
TDeskTop *THelp::initDeskTop( TRect r )
{
return new TDeskTop( r );
}
void THelp::getEvent(TEvent &event)
{
if (event.what == evKeyDown)
{
switch (event.keyDown.keyCode)
{
case kbF5:
event.what = evCommand;
event.message.infoPtr = 0;
event.message.command = cmZoom;
return;
case kbCtrlF5:
event.what = evCommand;
event.message.infoPtr = 0;
event.message.command = cmResize;
return;
}
}
TApplication::getEvent(event);
}
char *searchstring = NULL;
int maxlength = 0;
int which = 0;
class TSearchDialog : public TDialog
{
public:
TSearchDialog(TCollection *results) :
TDialog (TRect (0, 0, maxlength + 4, results->getCount() + 6), "Select Result"),
TWindowInit( &TSearchDialog::initFrame )
{
TRect r = getExtent();
r.grow(-2,-2);
r.b.y -= 2;
options |= ofCentered;
TListBox *resultList = new TListBox( r, 1, 0);
resultList->newList(results);
insert(resultList);
r.a.x--;
r.a.y = r.b.y + 1;
r.b.y += 3;
insert(new TButton(r, "~V~iew", cmOK, bfDefault));
setCurrent(resultList, normalSelect);
};
};
void setmaxlength(void *str, void *u)
{
int l = strlen((char *) str);
if ( l > maxlength) maxlength = l;
}
ushort getContext(TCollection *results)
{
char *result = (char *) results->at(which);
char *res = result + strlen(result) + 1;
return *((ushort *) res);
}
void THelp::run()
{
if (access(fileName,R_OK)!=0)
{
messageBox(_("File not found"), mfOKButton | mfError);
endModal(cmQuit);
return;
}
fpstream *helpStrm = new fpstream(fileName, ios::in);
TBorlandHelpFile *helpFile = new TBorlandHelpFile(*helpStrm);
ushort start = helpFile->indexscreen;
if (searchstring && *searchstring)
{
TCollection *results = helpFile->search(searchstring);
switch (results->getCount())
{
case 0:
break;
case 1:
start = getContext(results);
break;
default:
{
results->forEach(setmaxlength, 0);
TDialog *SD = new TSearchDialog(results);
if (execView(SD) == cmOK)
{
char* rec = (char *) malloc(SD->dataSize());
SD->getData(rec);
which = *((int *) (rec + 4));
start = getContext(results);
}
break;
}
}
}
THelpWindow *helpWindow = new THelpWindow(helpFile, start);
execView(validView(helpWindow));
}
static
struct CLY_option longopts[] =
{
{ "file", 0, 0, 'f' },
{ "help", 0, 0, 'h' },
{ 0, 0, 0, 0 }
};
void THelp::ParseCommandLine(int argc, char *argv[])
{
int optc;
while ((optc=CLY_getopt_long(argc,argv,"f:h",longopts,0))!=EOF)
{
switch (optc)
{
case 'f':
fileName=CLY_optarg;
break;
case 'h':
default:
printf("Borland's Help file viewer\n");
printf("Copyright (c) 1999 by Andreas F. Gorup von Besanez <besanez@...");
printf("Copyright (c) 2002 by Jan Van Buggenhout <Chipzz@...");
printf("Copyright (c) 2002 by Salvador E. Tropea <set@...");
printf("This program is covered by the GPL license.\n");
printf("\n\n");
printf("%s [--file Name] Text_to_search\n");
printf("--file Name : Name of the help file\n");
printf("--help : This text\n");
exit(1);
}
}
}
int main(int argc, char ** argv)
{
THelp::ParseCommandLine(argc,argv);
THelp app;
if (argc == 2)
searchstring = argv[1];
app.run();
app.shutDown();
return 0;
}
--- NEW FILE: thelp.gpr ---
__RHIDE_project-file>
-fpeephole
-Wimplicit
-trigraphs
@interface@private
@protected @protocol@public @selector __alignof__alignof____asm__asm____attribute
__attribute__ __complex__complex____const __const__
__extension____imag__imag____inline
__inline__
__iterator__iterator__ __label____null__real__real__
__signature____signed
__signed__ __sigof____typeof
__typeof__
__volatile__volatile__ __wchar_tandand_eqasmautobitandbitorboolbreakbycopycasecatchcharclasscomplconst
const_castcontinuedefaultdeletedodoubledynamic_castelseenumexplicitexternfalsefloatforfriendgotoidifininlineinoutintlongmutable namespacenewnotnot_eqonewayoperatororor_eqoutprivate protectedpublicregisterreinterpret_castreturnshort signaturesignedsigofsizeofstaticstatic_caststructswitchtemplatethisthrowtruetrytypedeftypeidtypenametypeofunionunsignedusingvirtualvoidvolatilewhilexorxor_eq
DestructorDivDoDowntoElseEndExportExportsFileForFunctionGotoIfImplementationImportIn InheritedInline InterfaceIsLabelLibraryModModuleNilNotObjectOfOnlyOperatorOrOr_else OtherwisePackedPow ProcedureProgramProperty Protected QualifiedRecordRepeat
RestrictedSetShlShrThenToTypeUnitUntilUsesValueVarViewVirtualWhileWithXor
-fpedantic
-fno-debug
-fno-zeros
cdeilmptuwÿ][>>
DestructorDisposeDivDoDowntoElseEndExceptExportExportsExternalFailFalseFarFileFinallyForForwardFunctionGotoIfImplementationIn InheritedInitializationInline Interface InterruptIsLabelLibraryModNearNewNilNotObjectOfOnOperatorOr OtherwisePackedPrivate ProcedureProgramProperty ProtectedPublicRaiseRecordRepeatSelfSetShlShrStringThenToTrueTypeUnitUntilUsesVarVirtualWhileWithXor
--- NEW FILE: thelp.mak ---
# This file is automatically generated by RHIDE 1.4.9.1
# created with the command:
# gpr2mak thelp.gpr
vpath_header=$(TVSRC) .
vpath %.h $(vpath_header)
vpath %.hpp $(vpath_header)
vpath %.ha $(vpath_header)
vpath %.hd $(vpath_header)
FLAGS_FOR_SUBPROJECTS=RHIDE_OS_="$(RHIDE_OS_)" CFLAGS="$(CFLAGS)"\
CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)"
RHIDE_OS=$(RHIDE_OS_)
ifeq ($(strip $(RHIDE_OS)),)
ifneq ($(strip $(DJDIR)),)
RHIDE_OS_:=DJGPP
else
RHIDE_OS_:=$(patsubst CYGWIN%,CYGWIN,$(shell uname))
endif
endif
INCLUDE_DIRS=$(TVSRC) .
LIB_DIRS=$(TVOBJ)
C_DEBUG_FLAGS=-g
C_OPT_FLAGS=
C_WARN_FLAGS=
C_C_LANG_FLAGS=
C_CXX_LANG_FLAGS=
C_P_LANG_FLAGS=
C_FPC_LANG_FLAGS=
C_F_LANG_FLAGS=
C_ADA_LANG_FLAGS=
LIBS=rhtv
LD_EXTRA_FLAGS=
C_EXTRA_FLAGS=
LOCAL_OPT=$(subst ___~~~___, ,$(subst $(notdir $<)___,,$(filter $(notdir\
$<)___%,$(LOCAL_OPTIONS))))
OBJFILES=bhelp.o thelp.o
ALL_OBJFILES=bhelp.o thelp.o
LIBRARIES=
SOURCE_NAME=$<
OUTFILE=$@
SPECIAL_CFLAGS=
SPECIAL_LDFLAGS=
PROG_ARGS=
SRC_DIRS=
WUC=
EDITORS=
MAIN_TARGET=thelp.exe
PROJECT_ITEMS=bhelp.cc thelp.cc
DEFAULT_MASK=*
RHIDE_BIN_DIR=/usr/bin
PASCAL_TYPE=GPC
GET_HOME=$(HOME)
CLEAN_FILES=$(MAIN_TARGET) $(OBJFILES)
RHIDE_GCC=gcc
RHIDE_AS=gcc
RHIDE_GXX=gcc
RHIDE_GPC=gpc
RHIDE_FPC=ppc386
RHIDE_AR=ar
RHIDE_LD=gcc
RHIDE_G77=g77
RHIDE_NASM=nasm
RHIDE_LD_PASCAL=gpc
RHIDE_LD_FPC=$(RHIDE_FPC) -E+
RHIDE_GNATBIND=gnatbind
RHIDE_RM=rm
RHIDE_ARFLAGS=rcs
RHIDE_TYPED_LIBS.f=g2c m
RHIDE_TYPED_LIBS.for=$(RHIDE_TYPED_LIBS.f)
RHIDE_TYPED_LIBS.F=$(RHIDE_TYPED_LIBS.f)
RHIDE_TYPED_LIBS.fpp=$(RHIDE_TYPED_LIBS.f)
RHIDE_TYPED_LIBS_GPC=gpc m
RHIDE_TYPED_LIBS_FPC=fpc
RHIDE_TYPED_LIBS.p=$(RHIDE_TYPED_LIBS_$(PASCAL_TYPE))
RHIDE_TYPED_LIBS.pas=$(RHIDE_TYPED_LIBS.p)
RHIDE_TYPED_LIBS.pp=$(RHIDE_TYPED_LIBS_FPC)
RHIDE_TYPED_LIBS_$(RHIDE_OS).cc=stdc++
RHIDE_TYPED_LIBS_Linux.cc=stdc++
RHIDE_TYPED_LIBS_DJGPP.cc=stdcxx
RHIDE_TYPED_LIBS.cc=$(RHIDE_TYPED_LIBS_$(RHIDE_OS).cc)
RHIDE_TYPED_LIBS.cpp=$(RHIDE_TYPED_LIBS.cc)
RHIDE_TYPED_LIBS.cxx=$(RHIDE_TYPED_LIBS.cc)
RHIDE_TYPED_LIBS.C=$(RHIDE_TYPED_LIBS.cc)
RHIDE_TYPED_LIBS.ii=$(RHIDE_TYPED_LIBS.cc)
RHIDE_TYPED_LIBS.l=fl
RHIDE_TYPED_LIBS.m=objc
RHIDE_TYPED_LIBS.adb=gnat
RHIDE_TYPED_LIBS_SUFFIXES=$(sort $(foreach item,$(PROJECT_ITEMS),$(suffix\
$(item))))
RHIDE_TYPED_LIBS=$(foreach\
suff,$(RHIDE_TYPED_LIBS_SUFFIXES),$(RHIDE_TYPED_LIBS$(suff)))
RHIDE_INCLUDES=$(SPECIAL_CFLAGS) $(addprefix -I,$(INCLUDE_DIRS))
RHIDE_LIBDIRS=$(addprefix -L,$(LIB_DIRS))
RHIDE_LIBS=$(addprefix -l,$(LIBS) $(RHIDE_TYPED_LIBS) $(RHIDE_OS_LIBS))
RHIDE_LDFLAGS=$(SPECIAL_LDFLAGS) $(addprefix -Xlinker ,$(LD_EXTRA_FLAGS))
RHIDE_NASM_TARGET_DJGPP=coff
RHIDE_NASM_TARGET_Linux=elf
RHIDE_NASM_TARGET=$(RHIDE_NASM_TARGET_$(RHIDE_OS))
RHIDE_COMPILE_NASM=$(RHIDE_NASM) -f $(RHIDE_NASM_TARGET) $(LOCAL_OPT) -o\
$(OUTFILE) $(SOURCE_NAME)
RHIDE_COMPILE_FORTRAN=$(RHIDE_G77) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_F_LANG_FLAGS) $(C_EXTRA_FLAGS)\
$(LOCAL_OPT) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_FORTRAN_FORCE=$(RHIDE_G77) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_F_LANG_FLAGS) $(C_EXTRA_FLAGS)\
-x f77 $(LOCAL_OPT) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_C=$(RHIDE_GCC) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS) $(C_EXTRA_FLAGS)\
$(RHIDE_OS_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(LOCAL_OPT) -c\
$(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_C_FORCE=$(RHIDE_GCC) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS) $(C_EXTRA_FLAGS)\
-x c $(RHIDE_OS_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(LOCAL_OPT) -c\
$(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_CC=$(RHIDE_GXX) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS)\
$(C_CXX_LANG_FLAGS) $(C_EXTRA_FLAGS) $(RHIDE_OS_CXXFLAGS)\
$(CPPFLAGS) $(CXXFLAGS) $(LOCAL_OPT) -c $(SOURCE_NAME) -o\
$(OUTFILE)
RHIDE_COMPILE_CC_FORCE=$(RHIDE_GXX) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS)\
$(C_CXX_LANG_FLAGS) $(C_EXTRA_FLAGS) $(RHIDE_OS_CXXFLAGS)\
$(CPPFLAGS) $(CXXFLAGS) -x c++ $(LOCAL_OPT) -c $(SOURCE_NAME) -o\
$(OUTFILE)
RHIDE_COMPILE_ASM=$(RHIDE_AS) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_EXTRA_FLAGS) $(LOCAL_OPT) -c\
$(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_ASM_FORCE=$(RHIDE_AS) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_EXTRA_FLAGS) -x assembler\
$(LOCAL_OPT) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_GPC_FLAGS=$(RHIDE_INCLUDES) $(C_DEBUG_FLAGS) $(C_OPT_FLAGS)\
$(C_WARN_FLAGS) $(C_P_LANG_FLAGS) $(C_EXTRA_FLAGS)
RHIDE_COMPILE_GPC=$(RHIDE_GPC) $(RHIDE_GPC_FLAGS) $(LOCAL_OPT) -c\
$(SOURCE_NAME) -o $(OUTFILE)
RHIDE_COMPILE_GPC_FORCE=$(RHIDE_GPC) $(RHIDE_GPC_FLAGS) -x pascal\
$(LOCAL_OPT) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_FPC_FLAGS=$(C_FPC_LANG_FLAGS) $(LOCAL_OPT) $(addprefix\
-Up,$(INCLUDE_DIRS)) $(C_EXTRA_FLAGS)
RHIDE_COMPILE_FPC=$(RHIDE_FPC) $(RHIDE_FPC_FLAGS) -E- $(SOURCE_NAME)
RHIDE_COMPILE_FPC_FORCE=$(RHIDE_FPC) $(RHIDE_FPC_FLAGS) -B -E-\
$(SOURCE_NAME)
RHIDE_COMPILE_LINK=$(RHIDE_LD) $(RHIDE_LIBDIRS) $(C_EXTRA_FLAGS) -o\
$(OUTFILE) $(OBJFILES) $(LIBRARIES) $(LDFLAGS) $(RHIDE_LDFLAGS)\
$(RHIDE_LIBS)
RHIDE_COMPILE_LINK_GPC=$(RHIDE_LD_PASCAL) $(RHIDE_LIBDIRS) $(C_EXTRA_FLAGS)\
-o $(OUTFILE) $(OBJFILES) $(LIBRARIES) $(RHIDE_LDFLAGS) $(LDFLAGS)\
$(RHIDE_LIBS)
RHIDE_COMPILE_LINK_GPC_AUTOMAKE=$(RHIDE_LD_PASCAL) $(RHIDE_LIBDIRS) -o\
$(OUTFILE) --automake $(RHIDE_GPC_FLAGS) $(SOURCE_NAME)\
$(LIBRARIES) $(LDFLAGS) $(RHIDE_LDFLAGS) $(RHIDE_LIBS)
RHIDE_COMPILE_PASCAL=$(RHIDE_COMPILE_$(PASCAL_TYPE))
RHIDE_COMPILE_PASCAL_FORCE=$(RHIDE_COMPILE_$(PASCAL_TYPE)_FORCE)
RHIDE_COMPILE_LINK_PASCAL_AUTOMAKE=$(RHIDE_COMPILE_LINK_$(PASCAL_TYPE)_AUTOMAKE)
RHIDE_COMPILE_LINK_PASCAL=$(RHIDE_COMPILE_LINK_$(PASCAL_TYPE))
RHIDE_FPC_LIBDIRS_$(RHIDE_OS)=/usr/local/lib /usr/lib /lib
RHIDE_FPC_LIBDIRS_Linux=/usr/local/lib /usr/lib /lib
RHIDE_FPC_LIBDIRS_DJGPP=$(DJDIR)/lib
RHIDE_FPC_LIBDIRS=$(RHIDE_FPC_LIBDIRS_$(RHIDE_OS))
RHIDE_FPC_LINK_FLAGS_$(RHIDE_OS)=$(RHIDE_LIBDIRS) $(addprefix\
-L,$(RHIDE_FPC_LIBDIRS))
RHIDE_FPC_LINK_FLAGS_Linux=$(RHIDE_LIBDIRS) $(addprefix\
-L,$(RHIDE_FPC_LIBDIRS))
RHIDE_FPC_LINK_FLAGS_DJGPP=-O coff-go32-exe $(RHIDE_LIBDIRS) $(addprefix\
-L,$(RHIDE_FPC_LIBDIRS))
RHIDE_FPC_LINK_FLAGS=$(RHIDE_FPC_LINK_FLAGS_$(RHIDE_OS))
RHIDE_COMPILE_LINK_FPC=echo 'separate linking for FPK is not supported.\
Please define a main source file in Project/Primary file.' 1>&2
RHIDE_COMPILE_LINK_FPC_AUTOMAKE=$(RHIDE_FPC) -o$(OUTFILE) $(SOURCE_NAME)\
$(RHIDE_FPC_FLAGS) -E+
RHIDE_COMPILE_ARCHIVE=$(RHIDE_AR) $(RHIDE_ARFLAGS) $(OUTFILE)\
$(ALL_OBJFILES)
RHIDE_COMPILE_ADA=$(RHIDE_GCC) $(RHIDE_INCLUDES) $(C_DEBUG_FLAGS)\
$(C_OPT_FLAGS) $(C_WARN_FLAGS) $(C_C_LANG_FLAGS) $(C_EXTRA_FLAGS)\
$(LOCAL_OPT) $(C_ADA_LANG_FLAGS) $(RHIDE_OS_CFLAGS) $(CPPFLAGS)\
$(CFLAGS) -c $(SOURCE_NAME) -o $(OUTFILE)
RHIDE_ADA_BIND_FILE=$(addprefix _,$(setsuffix .c,$(OUTFILE)))
RHIDE_COMPILE_LINK_ADA_BIND=$(RHIDE_GNATBIND) -o $(RHIDE_ADA_BIND_FILE)\
$(setsuffix .ali,$(OUTFILE))
RHIDE_COMPILE_LINK_ADA_LINK=$(RHIDE_LD) $(RHIDE_LIBDIRS) $(C_EXTRA_FLAGS) -o\
$(OUTFILE) $(RHIDE_ADA_BIND_FILE) $(OBJFILES) $(LIBRARIES)\
$(LDFLAGS) $(RHIDE_LDFLAGS) $(RHIDE_LIBS)
_RHIDE_COMPILE_LINK_ADA=$(RHIDE_COMPILE_LINK_ADA_BIND);\
$(RHIDE_COMPILE_LINK_ADA_LINK); $(RHIDE_RM)\
$(RHIDE_ADA_BIND_FILE)
RHIDE_COMPILE_LINK_ADA=gnatbl $(RHIDE_LIBDIRS) $(C_EXTRA_FLAGS) -o\
$(OUTFILE) $(setsuffix .ali,$(OUTFILE)) $(LIBRARIES) $(LDFLAGS) \
$(RHIDE_LDFLAGS) $(RHIDE_LIBS)
RHIDE_COMPILE.c.o=$(RHIDE_COMPILE_C)
RHIDE_COMPILE.cc.o=$(RHIDE_COMPILE_CC)
RHIDE_COMPILE.p.o=$(RHIDE_COMPILE_PASCAL)
RHIDE_COMPILE.pas.o=$(RHIDE_COMPILE.p.o)
RHIDE_COMPILE.pp.o=$(RHIDE_COMPILE_FPC)
RHIDE_COMPILE.pas.s.GPC=$(subst -c $(SOURCE_NAME),-S\
$(SOURCE_NAME),$(RHIDE_COMPILE_GPC))
RHIDE_COMPILE.pas.s.FPC=$(RHIDE_COMPILE_FPC) -a -s
RHIDE_COMPILE.pas.s=$(RHIDE_COMPILE.pas.s.$(PASCAL_TYPE))
RHIDE_COMPILE.f.o=$(RHIDE_COMPILE_FORTRAN)
RHIDE_COMPILE.nsm.o=$(RHIDE_COMPILE_NASM)
RHIDE_COMPILE.s.o=$(RHIDE_COMPILE_ASM)
RHIDE_COMPILE.c.s=$(subst -c $(SOURCE_NAME),-S\
$(SOURCE_NAME),$(RHIDE_COMPILE_C))
RHIDE_COMPILE.c.i=$(subst -c $(SOURCE_NAME),-E\
$(SOURCE_NAME),$(RHIDE_COMPILE_C))
RHIDE_COMPILE.i.s=$(RHIDE_COMPILE.c.s)
RHIDE_COMPILE.cc.s=$(subst -c $(SOURCE_NAME),-S\
$(SOURCE_NAME),$(RHIDE_COMPILE_CC))
RHIDE_COMPILE.cc.ii=$(subst -c $(SOURCE_NAME),-E\
$(SOURCE_NAME),$(RHIDE_COMPILE_CC))
RHIDE_COMPILE.ii.s=$(RHIDE_COMPILE.cc.s)
RHIDE_COMPILE.cpp.o=$(RHIDE_COMPILE.cc.o)
RHIDE_COMPILE.cxx.o=$(RHIDE_COMPILE.cc.o)
RHIDE_COMPILE.C.o=$(RHIDE_COMPILE.cc.o)
RHIDE_COMPILE.pas.o=$(RHIDE_COMPILE.p.o)
RHIDE_COMPILE.for.o=$(RHIDE_COMPILE.f.o)
RHIDE_COMPILE.F.o=$(RHIDE_COMPILE.f.o)
RHIDE_COMPILE.fpp.o=$(RHIDE_COMPILE.f.o)
RHIDE_COMPILE.asm.o=$(RHIDE_COMPILE.nsm.o)
RHIDE_COMPILE.cpp.s=$(RHIDE_COMPILE.cc.s)
RHIDE_COMPILE.cxx.s=$(RHIDE_COMPILE.cc.s)
RHIDE_COMPILE.C.s=$(RHIDE_COMPILE.cc.s)
RHIDE_COMPILE.cpp.ii=$(RHIDE_COMPILE.cc.ii)
RHIDE_COMPILE.cxx.ii=$(RHIDE_COMPILE.cc.ii)
RHIDE_COMPILE.C.ii=$(RHIDE_COMPILE.cc.ii)
RHIDE_COMPILE.adb.o=$(RHIDE_COMPILE_ADA)
RHIDE_FSDB=fsdb $(OUTFILE) $(addprefix -p ,$(SRC_DIRS)) $(PROG_ARGS)
RHIDE_GDB=gdb $(OUTFILE) $(addprefix -d ,$(SRC_DIRS))
DEFAULT_GREP_MASK=*.[cfhmnps]*
RHIDE_GREP=grep -n $(prompt arguments for GREP,$(WUC) $(DEFAULT_GREP_MASK))
RHIDE_GPROF=gprof $(OUTFILE)
RHIDE_RLOG=$(shell rlog -R $(rlog_arg))
RHIDE_CO=$(shell co -q $(co_arg))
RHIDE_STANDARD_INCLUDES_$(RHIDE_OS)=$(addprefix /usr/,include include/sys\
include/g++ include/g++/std)
RHIDE_STANDARD_INCLUDES_Linux=$(addprefix /usr/,include include/sys\
include/g++ include/g++/std)
RHIDE_STANDARD_INCLUDES_DJGPP=$(addprefix $(DJDIR)/,include include/sys\
lang/cxx lang/cxx/std)
RHIDE_STANDARD_INCLUDES=$(RHIDE_STANDARD_INCLUDES_$(RHIDE_OS))
RHIDE_CONFIG_DIRS_$(RHIDE_OS)=/usr/local/share/rhide /usr/share/rhide \
/local/share/rhide /share/rhide
RHIDE_CONFIG_DIRS_Linux=/usr/local/share/rhide /usr/share/rhide \
/local/share/rhide /share/rhide
RHIDE_CONFIG_DIRS_DJGPP=$(DJDIR)/share/rhide
RHIDE_CONFIG_DIRS_COMMON=$(RHIDE_CONFIG_DIRS_$(RHIDE_OS))\
$(RHIDE_BIN_DIR)/../share/rhide
RHIDE_CONFIG_DIRS=. $(RHIDE_SHARE) $(GET_HOME) $(RHIDE_CONFIG_DIRS_COMMON)\
$(addsuffix /SET,$(RHIDE_CONFIG_DIRS_COMMON)) $(SET_FILES)
RHIDE_PATH_SEPARATOR_$(RHIDE_OS)=:
RHIDE_PATH_SEPARATOR_Linux=:
RHIDE_PATH_SEPARATOR_DJGPP=;
RHIDE_PATH_SEPARATOR=$(RHIDE_PATH_SEPARATOR_$(RHIDE_OS))
RHIDE_EMPTY=
RHIDE_SPACE=$(RHIDE_EMPTY) $(RHIDE_EMPTY)
RHIDE_GCC=gcc
RHIDE_GXX=gcc
RHIDE_LD=gcc
RHIDE_AR=ar
RHIDE_ARFLAGS=rcs
RHIDE_OS_CFLAGS=-O2 -gstabs+3 -pipe
RHIDE_OS_CXXFLAGS=-O2 -gstabs+3 -pipe
RHIDE_STDINC=/usr/include /usr/local/include /usr/include/g++\
/usr/local/include/g++ /usr/lib/gcc-lib /usr/local/lib/gcc-lib\
/usr/X11R6/include
TVSRC=../../include /usr/src/tvision-head/include /usr/include/rhtvision
RHIDE_OS_LIBS= ncurses m gpm X11 Xmu
TVOBJ= /usr/lib ../../linuxso /usr/src/tvision-head/linuxso ../../linux\
/usr/src/tvision-head/linux /usr/X11R6/lib
RHIDE_GCC=gcc
RHIDE_GXX=gcc
RHIDE_LD=gcc
RHIDE_AR=ar
RHIDE_ARFLAGS=rcs
RHIDE_OS_CFLAGS=-O2 -gstabs+3 -pipe
RHIDE_OS_CXXFLAGS=-O2 -gstabs+3 -pipe
RHIDE_STDINC=/usr/include /usr/local/include /usr/include/g++\
/usr/local/include/g++ /usr/lib/gcc-lib /usr/local/lib/gcc-lib\
/usr/X11R6/include
TVSRC=../../include /usr/src/tvision-head/include /usr/include/rhtvision
RHIDE_OS_LIBS= ncurses m gpm X11 Xmu
TVOBJ= /usr/lib ../../linuxso /usr/src/tvision-head/linuxso ../../linux\
/usr/src/tvision-head/linux /usr/X11R6/lib
%.o: %.c
$(RHIDE_COMPILE.c.o)
%.o: %.i
$(RHIDE_COMPILE_C)
%.o: %.cc
$(RHIDE_COMPILE.cc.o)
%.o: %.cpp
$(RHIDE_COMPILE.cpp.o)
%.o: %.cxx
$(RHIDE_COMPILE.cxx.o)
%.o: %.C
$(RHIDE_COMPILE.C.o)
%.o: %.ii
$(RHIDE_COMPILE_CC)
%.o: %.s
$(RHIDE_COMPILE.s.o)
%.o: %.S
$(RHIDE_COMPILE_ASM)
%.s: %.c
$(RHIDE_COMPILE.c.s)
%.s: %.i
$(RHIDE_COMPILE.i.s)
%.s: %.cc
$(RHIDE_COMPILE.cc.s)
%.s: %.cpp
$(RHIDE_COMPILE.cpp.s)
%.s: %.cxx
$(RHIDE_COMPILE.cxx.s)
%.s: %.C
$(RHIDE_COMPILE.C.s)
%.o: %.pas
$(RHIDE_COMPILE.pas.o)
%.o: %.p
$(RHIDE_COMPILE.p.o)
%.o: %.pp
$(RHIDE_COMPILE.pp.o)
%.s: %.pas
$(RHIDE_COMPILE.pas.s)
%.o: %.m
$(RHIDE_COMPILE_OBJC)
%.o: %.f
$(RHIDE_COMPILE.f.o)
%.o: %.for
$(RHIDE_COMPILE.for.o)
%.o: %.F
$(RHIDE_COMPILE.F.o)
%.o: %.fpp
$(RHIDE_COMPILE.fpp.o)
%.o: %.asm
$(RHIDE_COMPILE.asm.o)
%.o: %.nsm
$(RHIDE_COMPILE.nsm.o)
%.o: %.adb
$(RHIDE_COMPILE.adb.o)
%.i: %.c
$(RHIDE_COMPILE.c.i)
%.s: %.c
$(RHIDE_COMPILE.c.s)
%.ii: %.cc
$(RHIDE_COMPILE.cc.ii)
%.s: %.cc
$(RHIDE_COMPILE.cc.s)
%.ii: %.cpp
$(RHIDE_COMPILE.cpp.ii)
%.s: %.cpp
$(RHIDE_COMPILE.cpp.s)
%.ii: %.cxx
$(RHIDE_COMPILE.cxx.ii)
%.s: %.cxx
$(RHIDE_COMPILE.cxx.s)
%.ii: %.C
$(RHIDE_COMPILE.C.ii)
%.s: %.C
$(RHIDE_COMPILE.C.s)
include rhide.env
all::
clean::
rm -f $(CLEAN_FILES)
DEPS_0= bhelp.o thelp.o
NO_LINK=
LINK_FILES=$(filter-out $(NO_LINK),$(DEPS_0))
thelp.exe:: $(DEPS_0)
$(RHIDE_COMPILE_LINK)
DEPS_1=bhelp.cc bhelp.h
bhelp.o:: $(DEPS_1)
$(RHIDE_COMPILE.cc.o)
DEPS_2=thelp.cc bhelp.h
thelp.o:: $(DEPS_2)
$(RHIDE_COMPILE.cc.o)
all:: thelp.exe
|