summaryrefslogtreecommitdiff
path: root/vms/cvthelp.tpu
blob: 8c60369f4273f319076a5f00273f0aa1138b82ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
!       TITLE   CVTHELP.TPU
!       IDENT   01-001
!
!++
! Copyright (c) 1990-2001 Info-ZIP.  All rights reserved.
!
! See the accompanying file LICENSE, version 2000-Apr-09 or later
! (the contents of which are also included in zip.h) for terms of use.
! If, for some reason, all these files are missing, the Info-ZIP license
! also may be found at:  ftp://ftp.info-zip.org/pub/infozip/license.html
!
!++
!
!  Program:     CVTHELP.TPU
!
!  Author:      Hunter Goatley
!
!  Date:        January 12, 1992
!
!  Purpose:     Convert .HELP files to RUNOFF .RNH files.  Substitutes
!               RUNOFF commands for tags imbedded in the .HELP file.
!
!  Calling sequence:
!
!       $ EDIT/TPU/NOJOURNAL/NODISPLAY/COMMAND=CVTHELP file.HELP
!
!  Modified by:
!
!       01-001          Hunter Goatley            7-FEB-2001 15:40
!               Added <NEXT> for qualifier separators.
!
!       01-000          Hunter Goatley           12-JAN-1992 15:15
!               Original version.
!
!--
Procedure eve_convert_help
Local   temp
        ,x
        ;

   qualifier_level := 0;
   hg$substitute_topic(current_buffer, "<MAIN>", ".indent-3", "1");
   hg$substitute_topic(current_buffer, "<QUALIFIER>", ".sk;.indent-3", "");
   hg$substitute_topic(current_buffer, "<TOPIC>", ".indent-3", "2");
   hg$substitute_topic(current_buffer, "<SUBTOPIC>", ".indent-3", "3");
   hg$substitute_topic(current_buffer, "<SUBSUBTOPIC>", ".indent-3", "4");
   hg$substitute_comment(current_buffer,"<QUALIFIERS>",".indent-3;2 Qualifiers");
   hg$substitute_comment(current_buffer,"<PARAMETER>",".indent-2");
   hg$substitute_comment(current_buffer,"<PTEXT>",".lm+3");
   hg$substitute_comment(current_buffer,"<TXETP>",".lm-3");
   hg$substitute_comment(current_buffer,"<ETEXT>",".lm+4");
   hg$substitute_comment(current_buffer,"<TXETE>",".lm-4");
   hg$substitute_comment(current_buffer,"<INIT>",".noflags;.lm3;.rm70");
   hg$substitute_comment(current_buffer,"<LITERAL>",".lm+4;.literal");
   hg$substitute_comment(current_buffer,"<LARETIL>",".end literal;.lm-4");
   hg$substitute_comment(current_buffer,"<LITERAL0>",".literal");
   hg$substitute_comment(current_buffer,"<0LARETIL>",".end literal");
   hg$substitute_comment(current_buffer,"<DOT1LIST>",'.list 1,"o"');
   hg$substitute_comment(current_buffer,"<DOT0LIST>",'.list 0,"o"');
   hg$substitute_comment(current_buffer,"<ENTRY>",".le");
   hg$substitute_comment(current_buffer,"<TSIL>",".end list");
   hg$substitute_comment(current_buffer,"<CENTER>",".center");
   hg$substitute_comment(current_buffer,"<FORMAT>",".sk;.indent2");
   hg$substitute_comment(current_buffer,"<NOTE>",".note");
   hg$substitute_comment(current_buffer,"<ETON>",".end note");
   hg$substitute_comment(current_buffer, LINE_BEGIN & LINE_END,".sk");
   hg$substitute_comment(current_buffer, LINE_BEGIN & "|", "");
   hg$substitute_comment(current_buffer,"<NEXT>",".br");

EndProcedure;           ! eve_convert_help

Procedure hg$substitute_comment (the_buffer, target, new)
Local   temp
        ,save_pos
        ,x
        ;
  on_error;
  endon_error;

  save_pos := mark(none);
  position(beginning_of(the_buffer));
  loop
        x := search(target, forward);
        exitif x = 0;
        position (x);
        erase_character(length(x));
        copy_text(new);
  endloop;

  position(save_pos);

EndProcedure;           ! hg$substitute_comment

Procedure hg$substitute_topic (the_buffer, target, new, level)
Local   temp
        ,save_pos
        ,x
        ;
  on_error;
  endon_error;

  save_pos := mark(none);
  position(beginning_of(the_buffer));
  loop
        x := search(target, forward);
        exitif x = 0;
        position (x);
        erase_character(length(x));
        move_vertical(-1);
        if (length(current_line) = 0)
        then copy_text("|");
        endif;
        move_vertical(1);
        copy_text(".!------------------------------------------------------");
        split_line;
        copy_text(new);
        move_horizontal(-current_offset);
        move_vertical(1);
        if level <> "" then
                copy_text(level + " ");
!       else
!           if qualifier_level = 0
!           then
!               copy_text("2 Qualifiers");
!               split_line; split_line;
!               copy_text(new); split_line;
!               qualifier_level := 1;
!           endif;
        endif;
        move_horizontal(-current_offset);
        move_vertical(1);
        if length(current_line) = 0
        then
            if (target = "<MAIN>") OR (target = "<TOPIC>")
                OR (target = "<SUBTOPIC>") or (target = "<SUBSUBTOPIC>")
            then copy_text(".br");
            else copy_text(".sk");
            endif;
        endif;
  endloop;

  position(save_pos);

EndProcedure;           ! hg$substitute_topic

!===============================================================================
Procedure tpu$init_procedure
Local   temp
        ,orig_filespec
        ,f
        ;

   on_error
   endon_error;

 !Prompt user for information

  orig_filespec := get_info(command_line, "file_name");
  if orig_filespec = ""
  then
        message("No .HELP file given");
        quit;
  endif;
  f := file_parse(orig_filespec, ".HELP");              !Add .LIS ending

    ! Create a buffer and window for editing

  main_buf := create_buffer ("MAIN",f);
  set (eob_text, main_buf, "[End of buffer]");

  position (beginning_of(main_buf));

  eve_convert_help;

  f := file_parse(orig_filespec,"","",NAME);

  write_file (main_buf, f+".RNH");

 quit;
EndProcedure;           !TPU$INIT_PROCEDURE

tpu$init_procedure;