| 1 |
! TITLE CVTHELP.TPU |
| 2 |
! IDENT 01-001 |
| 3 |
! |
| 4 |
!++ |
| 5 |
! Copyright (c) 1990-2001 Info-ZIP. All rights reserved. |
| 6 |
! |
| 7 |
! See the accompanying file LICENSE, version 2000-Apr-09 or later |
| 8 |
! (the contents of which are also included in zip.h) for terms of use. |
| 9 |
! If, for some reason, all these files are missing, the Info-ZIP license |
| 10 |
! also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html |
| 11 |
! |
| 12 |
!++ |
| 13 |
! |
| 14 |
! Program: CVTHELP.TPU |
| 15 |
! |
| 16 |
! Author: Hunter Goatley |
| 17 |
! |
| 18 |
! Date: January 12, 1992 |
| 19 |
! |
| 20 |
! Purpose: Convert .HELP files to RUNOFF .RNH files. Substitutes |
| 21 |
! RUNOFF commands for tags imbedded in the .HELP file. |
| 22 |
! |
| 23 |
! Calling sequence: |
| 24 |
! |
| 25 |
! $ EDIT/TPU/NOJOURNAL/NODISPLAY/COMMAND=CVTHELP file.HELP |
| 26 |
! |
| 27 |
! Modified by: |
| 28 |
! |
| 29 |
! 01-001 Hunter Goatley 7-FEB-2001 15:40 |
| 30 |
! Added <NEXT> for qualifier separators. |
| 31 |
! |
| 32 |
! 01-000 Hunter Goatley 12-JAN-1992 15:15 |
| 33 |
! Original version. |
| 34 |
! |
| 35 |
!-- |
| 36 |
Procedure eve_convert_help |
| 37 |
Local temp |
| 38 |
,x |
| 39 |
; |
| 40 |
|
| 41 |
qualifier_level := 0; |
| 42 |
hg$substitute_topic(current_buffer, "<MAIN>", ".indent-3", "1"); |
| 43 |
hg$substitute_topic(current_buffer, "<QUALIFIER>", ".sk;.indent-3", ""); |
| 44 |
hg$substitute_topic(current_buffer, "<TOPIC>", ".indent-3", "2"); |
| 45 |
hg$substitute_topic(current_buffer, "<SUBTOPIC>", ".indent-3", "3"); |
| 46 |
hg$substitute_topic(current_buffer, "<SUBSUBTOPIC>", ".indent-3", "4"); |
| 47 |
hg$substitute_comment(current_buffer,"<QUALIFIERS>",".indent-3;2 Qualifiers"); |
| 48 |
hg$substitute_comment(current_buffer,"<PARAMETER>",".indent-2"); |
| 49 |
hg$substitute_comment(current_buffer,"<PTEXT>",".lm+3"); |
| 50 |
hg$substitute_comment(current_buffer,"<TXETP>",".lm-3"); |
| 51 |
hg$substitute_comment(current_buffer,"<ETEXT>",".lm+4"); |
| 52 |
hg$substitute_comment(current_buffer,"<TXETE>",".lm-4"); |
| 53 |
hg$substitute_comment(current_buffer,"<INIT>",".noflags;.lm3;.rm70"); |
| 54 |
hg$substitute_comment(current_buffer,"<LITERAL>",".lm+4;.literal"); |
| 55 |
hg$substitute_comment(current_buffer,"<LARETIL>",".end literal;.lm-4"); |
| 56 |
hg$substitute_comment(current_buffer,"<LITERAL0>",".literal"); |
| 57 |
hg$substitute_comment(current_buffer,"<0LARETIL>",".end literal"); |
| 58 |
hg$substitute_comment(current_buffer,"<DOT1LIST>",'.list 1,"o"'); |
| 59 |
hg$substitute_comment(current_buffer,"<DOT0LIST>",'.list 0,"o"'); |
| 60 |
hg$substitute_comment(current_buffer,"<ENTRY>",".le"); |
| 61 |
hg$substitute_comment(current_buffer,"<TSIL>",".end list"); |
| 62 |
hg$substitute_comment(current_buffer,"<CENTER>",".center"); |
| 63 |
hg$substitute_comment(current_buffer,"<FORMAT>",".sk;.indent2"); |
| 64 |
hg$substitute_comment(current_buffer,"<NOTE>",".note"); |
| 65 |
hg$substitute_comment(current_buffer,"<ETON>",".end note"); |
| 66 |
hg$substitute_comment(current_buffer, LINE_BEGIN & LINE_END,".sk"); |
| 67 |
hg$substitute_comment(current_buffer, LINE_BEGIN & "|", ""); |
| 68 |
hg$substitute_comment(current_buffer,"<NEXT>",".br"); |
| 69 |
|
| 70 |
EndProcedure; ! eve_convert_help |
| 71 |
|
| 72 |
Procedure hg$substitute_comment (the_buffer, target, new) |
| 73 |
Local temp |
| 74 |
,save_pos |
| 75 |
,x |
| 76 |
; |
| 77 |
on_error; |
| 78 |
endon_error; |
| 79 |
|
| 80 |
save_pos := mark(none); |
| 81 |
position(beginning_of(the_buffer)); |
| 82 |
loop |
| 83 |
x := search(target, forward); |
| 84 |
exitif x = 0; |
| 85 |
position (x); |
| 86 |
erase_character(length(x)); |
| 87 |
copy_text(new); |
| 88 |
endloop; |
| 89 |
|
| 90 |
position(save_pos); |
| 91 |
|
| 92 |
EndProcedure; ! hg$substitute_comment |
| 93 |
|
| 94 |
Procedure hg$substitute_topic (the_buffer, target, new, level) |
| 95 |
Local temp |
| 96 |
,save_pos |
| 97 |
,x |
| 98 |
; |
| 99 |
on_error; |
| 100 |
endon_error; |
| 101 |
|
| 102 |
save_pos := mark(none); |
| 103 |
position(beginning_of(the_buffer)); |
| 104 |
loop |
| 105 |
x := search(target, forward); |
| 106 |
exitif x = 0; |
| 107 |
position (x); |
| 108 |
erase_character(length(x)); |
| 109 |
move_vertical(-1); |
| 110 |
if (length(current_line) = 0) |
| 111 |
then copy_text("|"); |
| 112 |
endif; |
| 113 |
move_vertical(1); |
| 114 |
copy_text(".!------------------------------------------------------"); |
| 115 |
split_line; |
| 116 |
copy_text(new); |
| 117 |
move_horizontal(-current_offset); |
| 118 |
move_vertical(1); |
| 119 |
if level <> "" then |
| 120 |
copy_text(level + " "); |
| 121 |
! else |
| 122 |
! if qualifier_level = 0 |
| 123 |
! then |
| 124 |
! copy_text("2 Qualifiers"); |
| 125 |
! split_line; split_line; |
| 126 |
! copy_text(new); split_line; |
| 127 |
! qualifier_level := 1; |
| 128 |
! endif; |
| 129 |
endif; |
| 130 |
move_horizontal(-current_offset); |
| 131 |
move_vertical(1); |
| 132 |
if length(current_line) = 0 |
| 133 |
then |
| 134 |
if (target = "<MAIN>") OR (target = "<TOPIC>") |
| 135 |
OR (target = "<SUBTOPIC>") or (target = "<SUBSUBTOPIC>") |
| 136 |
then copy_text(".br"); |
| 137 |
else copy_text(".sk"); |
| 138 |
endif; |
| 139 |
endif; |
| 140 |
endloop; |
| 141 |
|
| 142 |
position(save_pos); |
| 143 |
|
| 144 |
EndProcedure; ! hg$substitute_topic |
| 145 |
|
| 146 |
!=============================================================================== |
| 147 |
Procedure tpu$init_procedure |
| 148 |
Local temp |
| 149 |
,orig_filespec |
| 150 |
,f |
| 151 |
; |
| 152 |
|
| 153 |
on_error |
| 154 |
endon_error; |
| 155 |
|
| 156 |
!Prompt user for information |
| 157 |
|
| 158 |
orig_filespec := get_info(command_line, "file_name"); |
| 159 |
if orig_filespec = "" |
| 160 |
then |
| 161 |
message("No .HELP file given"); |
| 162 |
quit; |
| 163 |
endif; |
| 164 |
f := file_parse(orig_filespec, ".HELP"); !Add .LIS ending |
| 165 |
|
| 166 |
! Create a buffer and window for editing |
| 167 |
|
| 168 |
main_buf := create_buffer ("MAIN",f); |
| 169 |
set (eob_text, main_buf, "[End of buffer]"); |
| 170 |
|
| 171 |
position (beginning_of(main_buf)); |
| 172 |
|
| 173 |
eve_convert_help; |
| 174 |
|
| 175 |
f := file_parse(orig_filespec,"","",NAME); |
| 176 |
|
| 177 |
write_file (main_buf, f+".RNH"); |
| 178 |
|
| 179 |
quit; |
| 180 |
EndProcedure; !TPU$INIT_PROCEDURE |
| 181 |
|
| 182 |
tpu$init_procedure; |