Debian Codegraph @

vms/build_gawk_pcsi_text.com

raw
1 $! File: build_gawk_pcsi_text.com
2 $!
3 $! Build the *.pcsi$text file from the four components:
4 $! 1. Generated =product header section
5 $! 2. readme. file from the Gawk distribution, modified to fit
6 $! a pcsi$text file format.
7 $! 3. copying file from the Gawk distribution, modified to fit
8 $! a pcsi$text file format.
9 $! 4. Generated Producer section.
10 $!
11 $! Set the name of the release notes from the GNV_PCSI_FILENAME_BASE
12 $!
13 $!
14 $! 02-Jan-2014 J. Malmberg - Gawk version
15 $!
16 $!===========================================================================
17 $!
18 $ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
19 $ if kit_name .eqs. ""
20 $ then
21 $ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run."
22 $ goto all_exit
23 $ endif
24 $ producer = f$trnlnm("GNV_PCSI_PRODUCER")
25 $ if producer .eqs. ""
26 $ then
27 $ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run."
28 $ goto all_exit
29 $ endif
30 $ producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME")
31 $ if producer_full_name .eqs. ""
32 $ then
33 $ write sys$output "@MAKE_PCSI_GAWK_KIT_NAME.COM has not been run."
34 $ goto all_exit
35 $ endif
36 $!
37 $!
38 $! Parse the kit name into components.
39 $!---------------------------------------
40 $ producer = f$element(0, "-", kit_name)
41 $ base = f$element(1, "-", kit_name)
42 $ product = f$element(2, "-", kit_name)
43 $ mmversion = f$element(3, "-", kit_name)
44 $ majorver = f$extract(0, 3, mmversion)
45 $ minorver = f$extract(3, 2, mmversion)
46 $ updatepatch = f$element(4, "-", kit_name)
47 $ if updatepatch .eqs. "-" then updatepatch = ""
48 $!
49 $!
50 $ product_line = "=product ''producer' ''base' ''product'"
51 $ if updatepatch .eqs. ""
52 $ then
53 $ product_name = " ''majorver'.''minorver'"
54 $ else
55 $ product_name = " ''majorver'.''minorver'-''updatepatch'"
56 $ endif
57 $ product_line = product_line + " ''product_name' full"
58 $!
59 $!
60 $! If this is VAX and the file is on NFS, the names may be mangled.
61 $!-----------------------------------------------------------------
62 $ readme_file = ""
63 $ if f$search("readme.") .nes. ""
64 $ then
65 $ readme_file = "readme."
66 $ else
67 $ if f$search("$README.") .nes. ""
68 $ then
69 $ readme_file = "$README."
70 $ else
71 $ write sys$output "Can not find readme file."
72 $ goto all_exit
73 $ endif
74 $ endif
75 $ copying_file = ""
76 $ if f$search("copying.") .nes. ""
77 $ then
78 $ copying_file = "copying."
79 $ else
80 $ if f$search("$COPYING.") .nes. ""
81 $ then
82 $ copying_file = "$COPYING."
83 $ else
84 $ write sys$output "Can not find copying file."
85 $ goto all_exit
86 $ endif
87 $ endif
88 $!
89 $! Create the file as a VMS text file.
90 $!----------------------------------------
91 $ base_file = kit_name
92 $ create 'base_file'.pcsi$text
93 $!
94 $!
95 $! Start building file.
96 $!----------------------
97 $ open/append ptxt 'base_file'.pcsi$text
98 $ write ptxt product_line
99 $!
100 $!
101 $! First insert the Readme file.
102 $!
103 $ open/read rf 'readme_file'
104 $!
105 $ write ptxt "1 'PRODUCT"
106 $ write ptxt "=prompt ''producter' ''product' for OpenVMS"
107 $!
108 $rf_loop:
109 $ read/end=rf_loop_end rf line_in
110 $ if line_in .nes. ""
111 $ then
112 $! PCSI files use the first character in for their purposes.
113 $!--------------------------------------------------------------
114 $ first_char = f$extract(0, 1, line_in)
115 $ if first_char .nes. " " then line_in = " " + line_in
116 $ endif
117 $ write ptxt line_in
118 $ goto rf_loop
119 $rf_loop_end:
120 $ close rf
121 $!
122 $!
123 $! Now add in the copying file
124 $!--------------------------------
125 $ write ptxt ""
126 $ write ptxt "1 'NOTICE"
127 $ write ptxt ""
128 $!
129 $ open/read cf 'copying_file'
130 $!
131 $cf_loop:
132 $ read/end=cf_loop_end cf line_in
133 $ if line_in .nes. ""
134 $ then
135 $! PCSI files use the first character in for their purposes.
136 $!--------------------------------------------------------------
137 $ first_char = f$extract(0, 1, line_in)
138 $ if first_char .nes. " " then line_in = " " + line_in
139 $ endif
140 $ write ptxt line_in
141 $ goto cf_loop
142 $cf_loop_end:
143 $ close cf
144 $!
145 $! Now we need the rest of the boiler plate.
146 $!--------------------------------------------
147 $ write ptxt ""
148 $ write ptxt "1 'PRODUCER"
149 $ write ptxt "=prompt ''producer_full_name'"
150 $ write ptxt -
151 "This software product is provided by ''producer_full_name' with no warranty."
152 $!
153 $ arch_type = f$getsyi("ARCH_NAME")
154 $ node_swvers = f$getsyi("node_swvers")
155 $ vernum = f$extract(1, f$length(node_swvers), node_swvers)
156 $ majver = f$element(0, ".", vernum)
157 $ minverdash = f$element(1, ".", vernum)
158 $ minver = f$element(0, "-", minverdash)
159 $ dashver = f$element(1, "-", minverdash)
160 $ if dashver .eqs. "-" then dashver = ""
161 $ vmstag = majver + minver + dashver
162 $ code = f$extract(0, 1, arch_type)
163 $!
164 $ write ptxt "1 NEED_VMS''vmstag'"
165 $ write ptxt -
166 "=prompt OpenVMS ''vernum' or later is not installed on your system."
167 $ write ptxt "This product requires OpenVMS ''vernum' or later to function."
168 $ write ptxt "1 SOURCE"
169 $ write ptxt "=prompt Source modules for ''product'"
170 $ write ptxt "The Source modules for ''product' will be installed."
171 $ write ptxt "1 RELEASE_NOTES"
172 $ write ptxt "=prompt Release notes are available in the [SYSHLP] directory."
173 $!
174 $ close ptxt
175 $!
176 $!
177 $!
178 $all_exit:
179 $ exit