File: generate_help.csh

package info (click to toggle)
fis-gtm 6.3-007-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,284 kB
  • sloc: ansic: 328,861; asm: 5,182; csh: 5,102; sh: 1,918; awk: 291; makefile: 69; sed: 13
file content (114 lines) | stat: -rwxr-xr-x 3,263 bytes parent folder | download | duplicates (3)
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
#################################################################
#								#
# Copyright (c) 2014-2018 Fidelity National Information		#
# Services, Inc. and/or its subsidiaries. All rights reserved.	#
#								#
#	This source code contains the intellectual property	#
#	of its copyright holder(s), and is made available	#
#	under a license.  If you do not know the terms of	#
#	the license, please stop and do not read further.	#
#								#
#################################################################

#
# (re)Generate GT.M and Utility Help global directories and files on demand
#
# Parameters:
#   HLP file location (defaults to $gtm_pct)
#   Error log file (used to redirect output to error file in comlist.csh)

set hlpdir = $1
if ("" == "${hlpdir}") then
	if (0 == $?gtm_pct) then
		echo "HLP file location was not supplied and \$gtm_pct is not defined"
		exit -1
	endif
	set hlpdir = ${gtm_pct}
	if (! -e ${hlpdir}) then
		echo "HLP file location does not exist"
		exit -2
	endif
endif

alias do_log '\!:*'
if ("" != "${2}") alias do_log '\!:* >>& '$2''

# Need write permissions to $gtm_dist
if (! -w ${gtm_dist}) then
	set restorePerms = `filetest -P $gtm_dist`
	chmod ugo+w ${gtm_dist}
	if ($status) then
		echo "User does not have sufficient privileges to get write access to $gtm_dist, cannot update help"
		exit -3
	endif
endif

set script_stat = 0
foreach hlp (${hlpdir}/*.hlp)
	# Extract the HLP file name and fix-up the mumps to gtm
	set prefix=${hlp:t:r:s/mumps/gtm/}

	# If the HLP files are newer than the help database create a new one, otherwise skip it
	if ( -C ${hlp} > -C $gtm_dist/${prefix}help.dat ) then
		\rm -f  ${gtm_dist}/${prefix}help.gld ${gtm_dist}/${prefix}help.dat
	else
		continue
	endif

	echo "Generating ${prefix}help.gld and ${prefix}help.dat"

	# Either help info does not exist or needs to be regenerated

	# Define the global directory with the same prefix as the HLP file and
	# use ${gtm_dist} in the file name to ensure dynamic lookup of the DAT
	# for help information
	setenv gtmgbldir ${gtm_dist}/${prefix}help.gld
	${gtm_dist}/mumps -run GDE <<GDE_in_help
Change -segment DEFAULT	-block=2048	-file=\$gtm_dist/${prefix}help.dat
Change -region DEFAULT -record=1020 -key=255 -qdbrundown -nostats
GDE_in_help

	if ($status) then
		@ script_stat++
		do_log echo "genreatehelp-E-hlp, Error creating GLD for ${hlp}"
		continue
	endif

	${gtm_dist}/mupip create

	if ($status) then
		@ script_stat++
		do_log echo "genreatehelp-E-hlp, Error creating DAT for ${hlp}"
		continue
	endif

	${gtm_dist}/mumps -direct <<GTM_in_gtmhelp
Do ^GTMHLPLD
${hlp}
Halt
GTM_in_gtmhelp

	if ($status) then
		@ script_stat++
		do_log echo "genreatehelp-E-hlp, Error while processing ${hlp}"
		continue
	endif
	if ("gtm" == "$prefix") then
		${gtm_dist}/mumps -run GTMDEFINEDTYPESTODB
		if ($status) then
			@ script_stat++
			do_log echo "generatehelp-E-hlp, Error during GTMDEFINEDTYPESTODB ${hlp}"
			continue
		endif
	endif
	echo "Setting read-only for ${gtm_dist}/${prefix}help.{gld,dat} regions"
	${gtm_dist}/mupip set -read_only -acc=MM -reg "*" >& /dev/null
	chmod ugo-x ${gtm_dist}/${prefix}help.{gld,dat}
end

# Restore read-only status
if ($?restorePerms) then
	chmod ${restorePerms} ${gtm_dist}
endif

exit ${script_stat}