source: trunk/Distribution/Scripts/Saxon.CMD@ 3

Last change on this file since 3 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

  • Property svn:keywords set to Author Revision Date HeadURL Id
File size: 4.5 KB
Line 
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
31OuterEnv = SetLocal()
32
33CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
34CALL SysLoadFuncs
35
36ScriptDir = GetScriptPath()
37RootDir = GetParentDirectory(ScriptDir)
38
39JavaCommand = "java.exe"
40JavaX = " -Xmx100M" /* was 300 */
41
42JavaCP = " -cp " || RootDir || "\SW\Saxon;"
43JavaCP = JavaCP || RootDir || "\SW\Saxon\resolver.jar;"
44JavaCP = JavaCP || RootDir || "\SW\Saxon\saxon.jar;"
45JavaCP = JavaCP || RootDir || "\SW\Saxon\xercesImpl.jar;"
46JavaCP = JavaCP || RootDir || "\SW\Saxon\xmlParserAPIs.jar;"
47JavaCP = JavaCP || RootDir || "\SW\Saxon\saxon-jdom.jar;"
48JavaCP = JavaCP || RootDir || "\SW\Saxon\saxon-xml-apis.jar;"
49JavaCP = JavaCP || RootDir || "\SW\Saxon\saxon643.jar;"
50
51JavaD1 = " -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration"
52JavaD2 = " -Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl"
53JavaD3 = " -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl"
54
55MainClass = " com.icl.saxon.StyleSheet"
56
57ResolverX = " -x com.sun.resolver.tools.ResolvingXMLReader"
58ResolverY = " -y com.sun.resolver.tools.ResolvingXMLReader"
59ResolverR = " -r com.sun.resolver.tools.CatalogResolver"
60
61Arguments = ARG(1)
62
63FinalCommand = JavaCommand || JavaX || JavaCP || JavaD1 || JavaD2 || JavaD3 || MainClass || ResolverX || ResolverY || ResolverR || " " || Arguments
64
65/*
66 * Set catalog environment variables
67 */
68CatalogSGML = RootDir || "\SW\Jade\catalog;" || RootDir || "\ISOEntities\isoent.cat;" || RootDir || "\DTD\docbook.cat"
69CatalogXML = "file:///" || TRANSLATE(RootDir, '/', '\') || "/catalog.xml"
70
71CALL SetEnvironment "SGML_CATALOG_FILES", CatalogSGML
72CALL SetEnvironment "XML_CATALOG_FILES", CatalogXML
73
74/*
75 * Execute the final command
76 */
77FinalCommand
78
79CALL EndLocal
80EXIT
81
82
83/***********************************************************************************************/
84/* Procedures and functions */
85/***********************************************************************************************/
86
87
88/*
89 * Sets an environment variable or appends a value to it.
90 */
91AddEnvironment: PROCEDURE
92PARSE ARG VarName, VarValue
93IF (Value(VarName, , "OS2ENVIRONMENT")="")
94 THEN CALL SetEnvironment VarName, VarValue
95 ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT"
96RETURN
97
98
99/*
100 * Sets an environment variable, overwriting its previous value.
101 */
102SetEnvironment: PROCEDURE
103PARSE ARG VarName, VarValue
104CALL Value VarName, VarValue, "OS2ENVIRONMENT"
105RETURN
106
107
108/*
109 * Returns the value of an environment variable.
110 */
111GetEnvironment: PROCEDURE
112PARSE ARG VarName
113RETURN Value(VarName, , "OS2ENVIRONMENT")
114
115
116/*
117 * Returns the current script name.
118 */
119GetScriptName: PROCEDURE
120PARSE SOURCE Result
121RETURN WORD(Result, 3)
122
123
124/*
125 * Returns the current script path, without "\" at the end.
126 */
127GetScriptPath: PROCEDURE
128ScriptName = GetScriptName()
129RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1)
130
131
132/*
133 * Returns True if the given file exists.
134 */
135FileExists: PROCEDURE
136PARSE ARG FileName
137CALL SysFileTree FileName, Result
138RETURN Result.0 > 0
139
140
141/*
142 * Returns the current directory, without "\" at the end.
143 */
144GetCurrentDir: PROCEDURE
145RETURN DIRECTORY()
146
147
148/*
149 * Returns the parent directory of the directory passed as argument, without "\" at the end
150 */
151GetParentDirectory: PROCEDURE
152PARSE ARG DirName
153RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1)
Note: See TracBrowser for help on using the repository browser.