1 | /*
|
---|
2 | *************************************************************************************
|
---|
3 | *
|
---|
4 | * DocBook Framework for OS/2 and eComStation
|
---|
5 | * Start Saxon
|
---|
6 | *
|
---|
7 | * More info on the web:
|
---|
8 | * http://www.kacer.biz/os2/docbook-framework/
|
---|
9 | *
|
---|
10 | * Author:
|
---|
11 | * Jarda Kacer <mailto:jarda@kacer.biz>
|
---|
12 | *
|
---|
13 | *************************************************************************************
|
---|
14 | *
|
---|
15 | * This script invokes Saxon and passes all user arguments to it.
|
---|
16 | * It also sets environment variables SGML_CATALOG_FILES and XML_CATALOG_FILES
|
---|
17 | * before Saxon is launched. Make sure you use DocBook v. 4.3, the catalog files
|
---|
18 | * are written for this version only. When using other version than 4.3, Saxon
|
---|
19 | * will always connect to the Internet.
|
---|
20 | *
|
---|
21 | *************************************************************************************
|
---|
22 | *
|
---|
23 | * $Author: jkacer $
|
---|
24 | * $Revision: 2 $
|
---|
25 | * $Date: 2007-09-05 20:07:46 +0000 (Wed, 05 Sep 2007) $
|
---|
26 | * $HeadURL: trunk/Distribution/Scripts/Saxon.CMD $
|
---|
27 | *
|
---|
28 | *************************************************************************************
|
---|
29 | */
|
---|
30 |
|
---|
31 | OuterEnv = SetLocal()
|
---|
32 |
|
---|
33 | CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
|
---|
34 | CALL SysLoadFuncs
|
---|
35 |
|
---|
36 | ScriptDir = GetScriptPath()
|
---|
37 | RootDir = GetParentDirectory(ScriptDir)
|
---|
38 |
|
---|
39 | JavaCommand = "java.exe"
|
---|
40 | JavaX = " -Xmx100M" /* was 300 */
|
---|
41 |
|
---|
42 | JavaCP = " -cp " || RootDir || "\SW\Saxon;"
|
---|
43 | JavaCP = JavaCP || RootDir || "\SW\Saxon\resolver.jar;"
|
---|
44 | JavaCP = JavaCP || RootDir || "\SW\Saxon\saxon.jar;"
|
---|
45 | JavaCP = JavaCP || RootDir || "\SW\Saxon\xercesImpl.jar;"
|
---|
46 | JavaCP = JavaCP || RootDir || "\SW\Saxon\xmlParserAPIs.jar;"
|
---|
47 | JavaCP = JavaCP || RootDir || "\SW\Saxon\saxon-jdom.jar;"
|
---|
48 | JavaCP = JavaCP || RootDir || "\SW\Saxon\saxon-xml-apis.jar;"
|
---|
49 | JavaCP = JavaCP || RootDir || "\SW\Saxon\saxon643.jar;"
|
---|
50 |
|
---|
51 | JavaD1 = " -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration"
|
---|
52 | JavaD2 = " -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
|
---|
53 | JavaD3 = " -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"
|
---|
54 |
|
---|
55 | MainClass = " com.icl.saxon.StyleSheet"
|
---|
56 |
|
---|
57 | ResolverX = " -x com.sun.resolver.tools.ResolvingXMLReader"
|
---|
58 | ResolverY = " -y com.sun.resolver.tools.ResolvingXMLReader"
|
---|
59 | ResolverR = " -r com.sun.resolver.tools.CatalogResolver"
|
---|
60 |
|
---|
61 | Arguments = ARG(1)
|
---|
62 |
|
---|
63 | FinalCommand = JavaCommand || JavaX || JavaCP || JavaD1 || JavaD2 || JavaD3 || MainClass || ResolverX || ResolverY || ResolverR || " " || Arguments
|
---|
64 |
|
---|
65 | /*
|
---|
66 | * Set catalog environment variables
|
---|
67 | */
|
---|
68 | CatalogSGML = RootDir || "\SW\Jade\catalog;" || RootDir || "\ISOEntities\isoent.cat;" || RootDir || "\DTD\docbook.cat"
|
---|
69 | CatalogXML = "file:///" || TRANSLATE(RootDir, '/', '\') || "/catalog.xml"
|
---|
70 |
|
---|
71 | CALL SetEnvironment "SGML_CATALOG_FILES", CatalogSGML
|
---|
72 | CALL SetEnvironment "XML_CATALOG_FILES", CatalogXML
|
---|
73 |
|
---|
74 | /*
|
---|
75 | * Execute the final command
|
---|
76 | */
|
---|
77 | FinalCommand
|
---|
78 |
|
---|
79 | CALL EndLocal
|
---|
80 | EXIT
|
---|
81 |
|
---|
82 |
|
---|
83 | /***********************************************************************************************/
|
---|
84 | /* Procedures and functions */
|
---|
85 | /***********************************************************************************************/
|
---|
86 |
|
---|
87 |
|
---|
88 | /*
|
---|
89 | * Sets an environment variable or appends a value to it.
|
---|
90 | */
|
---|
91 | AddEnvironment: PROCEDURE
|
---|
92 | PARSE ARG VarName, VarValue
|
---|
93 | IF (Value(VarName, , "OS2ENVIRONMENT")="")
|
---|
94 | THEN CALL SetEnvironment VarName, VarValue
|
---|
95 | ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT"
|
---|
96 | RETURN
|
---|
97 |
|
---|
98 |
|
---|
99 | /*
|
---|
100 | * Sets an environment variable, overwriting its previous value.
|
---|
101 | */
|
---|
102 | SetEnvironment: PROCEDURE
|
---|
103 | PARSE ARG VarName, VarValue
|
---|
104 | CALL Value VarName, VarValue, "OS2ENVIRONMENT"
|
---|
105 | RETURN
|
---|
106 |
|
---|
107 |
|
---|
108 | /*
|
---|
109 | * Returns the value of an environment variable.
|
---|
110 | */
|
---|
111 | GetEnvironment: PROCEDURE
|
---|
112 | PARSE ARG VarName
|
---|
113 | RETURN Value(VarName, , "OS2ENVIRONMENT")
|
---|
114 |
|
---|
115 |
|
---|
116 | /*
|
---|
117 | * Returns the current script name.
|
---|
118 | */
|
---|
119 | GetScriptName: PROCEDURE
|
---|
120 | PARSE SOURCE Result
|
---|
121 | RETURN WORD(Result, 3)
|
---|
122 |
|
---|
123 |
|
---|
124 | /*
|
---|
125 | * Returns the current script path, without "\" at the end.
|
---|
126 | */
|
---|
127 | GetScriptPath: PROCEDURE
|
---|
128 | ScriptName = GetScriptName()
|
---|
129 | RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1)
|
---|
130 |
|
---|
131 |
|
---|
132 | /*
|
---|
133 | * Returns True if the given file exists.
|
---|
134 | */
|
---|
135 | FileExists: PROCEDURE
|
---|
136 | PARSE ARG FileName
|
---|
137 | CALL SysFileTree FileName, Result
|
---|
138 | RETURN Result.0 > 0
|
---|
139 |
|
---|
140 |
|
---|
141 | /*
|
---|
142 | * Returns the current directory, without "\" at the end.
|
---|
143 | */
|
---|
144 | GetCurrentDir: PROCEDURE
|
---|
145 | RETURN DIRECTORY()
|
---|
146 |
|
---|
147 |
|
---|
148 | /*
|
---|
149 | * Returns the parent directory of the directory passed as argument, without "\" at the end
|
---|
150 | */
|
---|
151 | GetParentDirectory: PROCEDURE
|
---|
152 | PARSE ARG DirName
|
---|
153 | RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1)
|
---|