Skip to content

Commit

Permalink
use .gh file extension for generated help topics header file
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalak committed Dec 31, 2020
1 parent 0648964 commit 0bf57e2
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 33 deletions.
3 changes: 2 additions & 1 deletion bld/browser/h/brwhelp.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2020 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -31,7 +32,7 @@


#include "wsyshelp.hpp"
#include "wbrw.h"
#include "wbrw.gh"

#define BRH_SELECT_ROOTS HLP_MANIPULATING_THE_TREE_VIEWS
#define BRH_QUERY_CONFIGURATION HLP_GLOBAL_SYMBOL_QUERIES
Expand Down
6 changes: 3 additions & 3 deletions bld/browser/master.mif
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ browse_trmem = 1

docs_host_dir = $(docs_dir)/$(host_os)

additional_clean = $(docs_host_dir)/wbrw.h
additional_clean = $(docs_host_dir)/wbrw.gh

.extensions: .gpp

Expand Down Expand Up @@ -99,7 +99,7 @@ objs_dbg = debuglog.obj
#
# EXE
#
exetarg_prebuild_objs = $(docs_host_dir)/wbrw.h
exetarg_prebuild_objs = $(docs_host_dir)/wbrw.gh
exetarg_objs = $(objs) $(objs_dbg)
exetarg_libs_dos = $(ui_lib)
exetarg_libs = $(gui_lib) $(exetarg_libs_$(host_os)) $(dwarfr_lib) $(wclass_lib)
Expand Down Expand Up @@ -142,7 +142,7 @@ curr_dir=$+$(%__CWD__)$-
$(docs_host_dir) : .SYMBOLIC
$(noecho)cd $@

$(docs_host_dir)/wbrw.h : $(docs_host_dir) .ALWAYS
$(docs_host_dir)/wbrw.gh : $(docs_host_dir) .ALWAYS
$(noecho)!$(nested_wmake) -h -f ../mif/onebook.mif hbook=wbrw header=1 dotarget=$(host_os)
$(noecho)cd $(curr_dir)

Expand Down
2 changes: 1 addition & 1 deletion bld/ide/ide/cpp/vpemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#include "wflashp.hpp"
#include "vhelpstk.hpp"
#include "veditdlg.hpp"
#include "ide.h"
#include "ide.gh"
#include "autoenv.h"

#include "clibext.h"
Expand Down
2 changes: 1 addition & 1 deletion bld/ide/ide/cpp/vpemain2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
#include "wflashp.hpp"
#include "vhelpstk.hpp"
#include "veditdlg.hpp"
#include "ide.h"
#include "ide.gh"
#include "mitem.hpp"
#include "inifile.hpp"

Expand Down
6 changes: 3 additions & 3 deletions bld/ide/ide/master.mif
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_win = win

docs_host_dir = $(docs_dir)/$(host_os)

additional_clean = $(docs_host_dir)/ide.h
additional_clean = $(docs_host_dir)/ide.gh

!include cproj.mif
!include defrule.mif
Expand Down Expand Up @@ -70,7 +70,7 @@ extra_l_flags = op eliminate op description 'Open Watcom IDE'
#
# EXE
#
exetarg_prebuild_objs = $(docs_host_dir)/ide.h
exetarg_prebuild_objs = $(docs_host_dir)/ide.gh
exetarg_objs = $(objs)
exetarg_libs = $(idelib_lib) $(wclass_lib) $(gui_lib) $(wres_lib)
exetarg_res_version_res_exe_nt_386 = exever.res
Expand Down Expand Up @@ -102,6 +102,6 @@ curr_dir=$+$(%__CWD__)$-
$(docs_host_dir) : .SYMBOLIC
$(noecho)cd $@

$(docs_host_dir)/ide.h: $(docs_host_dir) .ALWAYS
$(docs_host_dir)/ide.gh : $(docs_host_dir) .ALWAYS
$(noecho)!$(nested_wmake) -h -f ../mif/onebook.mif hbook=ide header=1 dotarget=$(host_os)
$(noecho)cd $(curr_dir)
42 changes: 34 additions & 8 deletions bld/whpcvt/c/whpcvt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* Open Watcom Project
*
* Copyright (c) 2002-2019 The Open Watcom Contributors. All Rights Reserved.
* Copyright (c) 2002-2020 The Open Watcom Contributors. All Rights Reserved.
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
Expand Down Expand Up @@ -57,6 +57,7 @@
pick( ARG_OL, "ol" ) \
pick( ARG_UL, "ul" ) \
pick( ARG_H, "h" ) \
pick( ARG_HF, "hf" ) \
pick( ARG_HH, "hh" ) \
pick( ARG_HN, "hn" ) \
pick( ARG_B, "b" ) \
Expand Down Expand Up @@ -136,6 +137,8 @@ const char Fonttype_courier[] = "courier";

/* local variables */

static char *h_file_name = NULL;

static const char *Help_info[] = {
"Usage: whpcvt [options] <in_file> [<out_file>]",
" Options for all help file types:",
Expand Down Expand Up @@ -502,6 +505,14 @@ static int process_args( int argc, char *argv[] )
case ARG_H:
Do_def = true;
break;
case ARG_HF:
start_arg++;
if( start_arg < argc ) {
h_file_name = normalize_fname( h_file_name, argv[start_arg], NULL );
} else {
error_err( ERR_BAD_ARGS );
}
break;
case ARG_HH:
Do_hdef = true;
break;
Expand Down Expand Up @@ -2058,8 +2069,12 @@ int main( int argc, char *argv[] )
In_file = NULL;

if( Do_ctx_ids ) {
strcpy( strrchr( file, '.' ), EXT_DEF_FILE );
In_file = fopen( file, "r" );
if( h_file_name != NULL ) {
In_file = fopen( h_file_name, "r" );
} else {
strcpy( strrchr( file, '.' ), EXT_DEF_FILE );
In_file = fopen( file, "r" );
}
if( In_file != NULL ) {
read_ctx_ids();
fclose( In_file );
Expand All @@ -2069,11 +2084,19 @@ int main( int argc, char *argv[] )
set_ctx_ids();

if( Do_def ) {
strcpy( strrchr( file, '.' ), EXT_DEF_FILE );
Def_file = fopen( file, "w" );
if( Def_file == NULL ) {
printf( "Could not open define file: %s\n", file );
goto error_exit;
if( h_file_name != NULL ) {
Def_file = fopen( h_file_name, "w" );
if( Def_file == NULL ) {
printf( "Could not open define file: %s\n", h_file_name );
goto error_exit;
}
} else {
strcpy( strrchr( file, '.' ), EXT_DEF_FILE );
Def_file = fopen( file, "w" );
if( Def_file == NULL ) {
printf( "Could not open define file: %s\n", file );
goto error_exit;
}
}
}

Expand Down Expand Up @@ -2139,6 +2162,9 @@ int main( int argc, char *argv[] )

error_exit:

if( h_file_name != NULL ) {
free( h_file_name );
}
if( Header_File != NULL ) {
free( Header_File );
}
Expand Down
4 changes: 2 additions & 2 deletions docs/makehhp.awk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ BEGIN {
gsub( /\"> (.*) <\/h.>/, "", file )

# "Index_of_Topics" should be included since it is
# defined in the .h file, but we'll place it last
# defined in the .gh file, but we'll place it last
# since it shouldn't be our first page
if (file == "Index_of_Topics") {
last_file = file
Expand Down Expand Up @@ -64,7 +64,7 @@ END {
print ""

print "[MAP]"
print "#include " hbook ".h"
print "#include " hbook ".gh"
print ""

# Directly write aliases into the project rather
Expand Down
2 changes: 1 addition & 1 deletion docs/mif/clean.mif
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ clean : .procedure
@if exist *.bmp rm -f *.bmp
@if exist *.hlp rm -f *.hlp
@if exist *.cnt rm -f *.cnt
@if exist *.h rm -f *.h
@if exist *.gh rm -f *.gh
@if exist *.ipf rm -f *.ipf
@if exist *.inf rm -f *.inf
@if exist *.tmp rm -f *.tmp
Expand Down
28 changes: 15 additions & 13 deletions docs/mif/onebook.mif
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,22 @@ bmp2eps = bmp2eps
#

!ifeq header 1
dep_nt = $(hbook).h
dep_nt = $(hbook).gh
!else ifneq hc_nt
dep_nt = $(hbook).hlp $(hbook).cnt
!endif
!ifeq header 1
dep_win = $(hbook).h
dep_win = $(hbook).gh
!else
dep_win = $(hbook).hlp
!endif
!ifeq header 1
dep_os2 = $(hbook).h
dep_os2 = $(hbook).gh
!else
dep_os2 = $(hbook).inf $(hbook).hlp
!endif
!ifeq header 1
dep_dos = $(hbook).h
dep_dos = $(hbook).gh
!else
dep_dos = $(hbook).ihp
!endif
Expand Down Expand Up @@ -193,7 +193,7 @@ $(hbook).cnt : $(hbook).cn1
awk -f ../makecnt2.awk -v file=$(hbook).hlp -v title="$(book_title)" -v multi=$(book_multi_chapter) $[@ > $(hbook).cnt
!endif

$(hbook).rtf $(hbook).cn1 $(hbook).h $(hbook).hh : $(book_objs) $(proj_objs)
$(hbook).rtf $(hbook).cn1 $(hbook).gh $(hbook).hh : $(book_objs) $(proj_objs)
@%make compile_gml_to_xxx

####################################################
Expand All @@ -211,7 +211,7 @@ $(hbook).hlp : $(hbook).hpj $(hbook).rtf $(hbook).hh
$(hbook).hpj : $(proj_objs)
@%make compile_hpj_win

$(hbook).rtf $(hbook).h $(hbook).hh : $(book_objs) $(proj_objs)
$(hbook).rtf $(hbook).gh $(hbook).hh : $(book_objs) $(proj_objs)
@%make compile_gml_to_xxx

####################################################
Expand All @@ -226,7 +226,7 @@ $(hbook).rtf $(hbook).h $(hbook).hh : $(book_objs) $(proj_objs)
$(hbook).ihp : $(hbook).ib
$(hcdos) -h 25 -w 80 $(hbook).ib $(hbook).ihp

$(hbook).ib $(hbook).h : $(book_objs) $(proj_objs)
$(hbook).ib $(hbook).gh : $(book_objs) $(proj_objs)
@%make compile_gml_to_xxx


Expand All @@ -246,12 +246,12 @@ $(hbook).ib $(hbook).h : $(book_objs) $(proj_objs)

.EXTENSIONS: .chm

$(hbook).chm : $(hbook).htm $(hbook).h
$(hbook).chm : $(hbook).htm $(hbook).gh
@if not exist $(hbook) mkdir $(hbook)
!ifdef book_bmroot
$(noecho)cp -f $(book_bmroot)/*.bmp $(hbook)/ > $(nulldevice)
!endif
cp -f $(hbook).h $(hbook)/$(hbook).h > $(nulldevice)
cp -f $(hbook).gh $(hbook)/$(hbook).gh > $(nulldevice)
awk -f ../splithtm.awk -v dir=$(hbook) $(hbook).htm
awk -f ../makehha.awk $(hbook).htm >$(hbook)/$(hbook).hha
awk -f ../makehhc.awk $(hbook).htm >$(hbook)/$(hbook).hhc
Expand Down Expand Up @@ -323,7 +323,7 @@ $(hbook).hlp : $(hbook).ipf
$(hbook).hlp : .symbolic
!endif

$(hbook).ipf $(hbook).h : $(book_objs) $(proj_objs)
$(hbook).ipf $(hbook).gh : $(book_objs) $(proj_objs)
@%make compile_gml_to_xxx

!endif
Expand Down Expand Up @@ -363,7 +363,7 @@ $(hbook).ps : $(book_objs) $(book_objs_ps) $(proj_objs)

.EXTENSIONS: .htm

$(hbook).h $(hbook).htm : $(book_objs) $(proj_objs)
$(hbook).gh $(hbook).htm : $(book_objs) $(proj_objs)
!ifneq dotarget htmlhelp
!ifdef book_bmroot
$(noecho)cp -f $(book_bmroot)/*.bmp . > $(nulldevice)
Expand Down Expand Up @@ -413,6 +413,8 @@ prepare_whpcvt_opts : .PROCEDURE
@%append $(whpcvt_optfile) -k
@%append $(whpcvt_optfile) -up
!endif
@%append $(whpcvt_optfile) -hf
@%append $(whpcvt_optfile) $*.gh
@%append $(whpcvt_optfile) -hn
@%append $(whpcvt_optfile) -i

Expand Down Expand Up @@ -574,8 +576,8 @@ compile_gml_to_xxx : .PROCEDURE
$(noecho)%ren $(wgml_tmpfile) $*.ptf
@if exist $*.mix @%erase $*.mix
@%ren $(wgml_sysfile_01) $*.mix
@if exist $*.h @%erase $*.h
@%ren $(wgml_sysfile_02) $*.h
@if exist $*.gh @%erase $*.gh
@%ren $(wgml_sysfile_02) $*.gh
@if exist $*.cn1 @%erase $*.cn1
@%ren $(wgml_sysfile_03) $*.cn1
whpcvt -h -@ $(whpcvt_optfile) $*.ptf
Expand Down

0 comments on commit 0bf57e2

Please sign in to comment.