comparison gpf/BIN/mkdoc.bat @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 @setlocal
2 @echo off
3 loadbtm on
4
5 @if x%_4ver% == x goto need4NT
6
7 @rem initialize vars
8 set dest=%DEV%\com\doc
9 set sap_root=
10 set aim_root=
11 set pdfcmdline=
12 set action=-help
13 set debug=false
14
15 @rem check command line options
16 :check_options
17 @rem Check Parameters
18 if "x%1" == "x" goto create_action
19 iff "%1" == "-sr" then
20 if "x%2" == "x" (echo Missing root directory information for SAP docs for "-sr" & goto useerror)
21 set sap_root=%2
22 shift 2
23 goto check_options
24 elseiff "%1" == "-ar" then
25 if "x%2" == "x" (echo Missing root directory information for AIM docs for "-ar" & goto useerror)
26 set aim_root=%2
27 shift 2
28 goto check_options
29 elseiff "%1" == "-d" then
30 if "x%2" == "x" (echo Missing destination directory information for documentation for "-d" & goto useerror)
31 set dest=%2
32 shift 2
33 goto check_options
34 elseiff "%1" == "--debug" then
35 echo mkdoc.bat script is running in debug mode now!
36 set DELETE=rem
37 echo on
38 shift 1
39 set debug=true
40 goto check_options
41 elseiff "%1" == "-pdf" .or. "%1" == "-pdf1" .or. "%1" == "-reviewdoc" then
42 if not "%action%"=="-help" (echo Only one action can be executed at a time & goto useerror)
43 if "x%2" == "x" (echo Missing name of document for which documentation is to be created & goto useerror)
44 if not "%3"=="sap" .and. not "%3"=="aim" (echo Missing type of document for which documentation is to be created ("sap" or "aim") & goto useerror)
45 set action=%1
46 set convdoc=%2
47 set convdoctype=%3
48 shift 3
49 goto check_options
50 elseiff "%1" == "--?" .or. "%1" == "-help" .or. "%1" == "-h" then
51 gosub how2use
52 goto end
53 elseiff "%1" == "-html" then
54 if not "%action%"=="-help" (echo Only one action can be executed at a time & goto useerror)
55 set action=%1
56 shift 1
57 else
58 echo Unknown parameter: %1
59 goto useerror
60 endiff
61
62 :create_action
63
64 set errorlevel=0
65
66 iff not isdir %dest%\sapedoc then
67 mkdir %dest%\sapedoc
68 endiff
69 set dest=%dest%\sapedoc
70
71 iff "%action%"=="-help" then
72 gosub how2use
73 goto end
74 elseiff "%action%"=="-html" .or. "%action%"=="-pdf1" then
75
76 @rem ********** Legacy code - begin **********
77
78 @rem Create html documentation.
79 if not "x%sap_root%" == "x" set htmlcmdline=%htmlcmdline% -sr %sap_root%
80 if not "x%aim_root%" == "x" set htmlcmdline=%htmlcmdline% -ar %aim_root%
81
82 @rem Sub process of pdf generation?
83 iff not "x%convdoc%" == "x" then
84 if "x%dest%" == "x" set dest=%DEV%\com\doc
85 set htmlcmdline=%htmlcmdline% -d %dest%\__sapehtml_tmp %convdoc% %convdoctype%
86 else
87 if not "x%dest%" == "x" set htmlcmdline=%htmlcmdline% -d %dest%
88 endiff
89
90 echo Calling "mkhtmldoc.bat" to generate html documentation:
91 call %GPF%\util\sape\bin\mkhtmldoc.bat %htmlcmdline%
92 if "%errorlevel%"!="0" goto end
93
94 @rem Create ps/pdf documentation.
95 iff not "x%convdoc%" == "x" then
96 set errorlevel=0
97 if not "x%dest%" == "x" set pscmdline=%pscmdline% -hr %dest%\__sapehtml_tmp\sapehtml -d %dest%
98 set pscmdline=%pscmdline% %convdoc% %convdoctype%
99 echo.
100 echo Calling "mkpsdoc.bat" to generate ps and pdf documentation:
101 call %GPF%\util\sape\bin\mkpsdoc.bat %pscmdline%
102 set mkpsdoc_err=%errorlevel%
103 iff not "x%dest%" == "x" then
104 echo Deleting temporary html version of documentation..
105 del /QESXY %dest%\__sapehtml_tmp
106 endiff
107 if "%mkpsdoc_err%"!="0" goto end
108 endiff
109
110 @rem ********** Legacy code - end **********
111
112 elseiff "%action%"=="-pdf" then
113 @rem Create pdf documentation.
114 set errorlevel=0
115 if not "x%sap_root%" == "x" set pdfcmdline=%pdfcmdline% -sr %sap_root%
116 if not "x%aim_root%" == "x" set pdfcmdline=%pdfcmdline% -ar %aim_root%
117 if not "x%dest%" == "x" set pdfcmdline=%pdfcmdline% -d %dest%
118 if "%debug%" == "true" set pdfcmdline=%pdfcmdline% --debug
119 set pdfcmdline=%pdfcmdline% %convdoc% %convdoctype%
120 echo.
121 echo Calling "mkpdfdoc.bat" to generate pdf documentation:
122 call %GPF%\util\sape\bin\mkpdfdoc.bat %pdfcmdline%
123 set mkpdfdoc_err=%errorlevel%
124 if "%mkpdfdoc_err%"!="0" goto end
125 elseiff "%action%"=="-reviewdoc" then
126 @rem Create doc documentation.
127 set errorlevel=0
128 if not "x%sap_root%" == "x" set pdfcmdline=%pdfcmdline% -sr %sap_root%
129 if not "x%aim_root%" == "x" set pdfcmdline=%pdfcmdline% -ar %aim_root%
130 if not "x%dest%" == "x" set pdfcmdline=%pdfcmdline% -d %dest%
131 if "%debug%" == "true" set pdfcmdline=%pdfcmdline% --debug
132 set pdfcmdline=%pdfcmdline% %convdoc% %convdoctype%
133 echo.
134 echo Calling "mkrtfdoc.bat" to generate rtf/doc documentation:
135 call %GPF%\util\sape\bin\mkrtfdoc.bat %pdfcmdline%
136 set mkpdfdoc_err=%errorlevel%
137 if "%mkpdfdoc_err%"!="0" goto end
138 else
139 (echo Unknown type of action. & goto useerror)
140 endiff
141
142 if "x%dest%" == "x" set dest=%DEV%\com\doc
143 echo Generated documentation can be found in "%dest%".
144
145 goto end
146
147 :need4NT
148 echo This script only runs under 4NT shell environment!
149 goto error
150
151 :end
152 endlocal
153 quit 0
154
155 :useerror
156 gosub how2Use
157
158 :error
159 endlocal
160 quit 1
161
162 :how2Use
163 text
164 mkdoc : Create SAP and AIM documentation
165 Usage : mkdoc [-sr <sapRootDir>] [-ar <aimRootDir>] [-d <destDir>]
166 [-help | ((-pdf | -pdf1 | -reviewdoc) <docName> (sap|aim)) | -html]
167 Example : mkdoc -sr .\SAP -ar .\AIM -pdf DTI2 sap
168 ;creates pdf documentation for DTI2 in sapepdf directory
169 -sr : set <sapRootDir> as directory for the SAP documents (*.sap)
170 -ar : set <aimRootDir> as directory for the AIM documents (*.aim)
171 -d : set <destDir> as root directory for the documentation
172 -pdf : generate pdf format documentation.
173 -pdf1: generate legacy version of ps/pdf format documentation.
174 -reviewdoc:
175 generate Word document format version of documentation
176 for review purposes.
177 <docName>
178 Name of the document for which documentation is to be generated,
179 without suffix.
180 -html: generate HTML version of documentation for all SAP/AIM documents.
181 -help: display this message
182
183 --debug : run script in debug mode
184 endtext
185 echo.
186 return