[2] | 1 | /*
|
---|
| 2 | *************************************************************************************
|
---|
| 3 | *
|
---|
| 4 | * DocBook Framework for OS/2 and eComStation
|
---|
| 5 | * Convert DocBook to Eclipse Help
|
---|
| 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 converts a DocBook document into a set of HTML and XML files that can be
|
---|
| 16 | * directly used by the Eclipse IDE.
|
---|
| 17 | *
|
---|
| 18 | *************************************************************************************
|
---|
| 19 | *
|
---|
| 20 | * $Author: jkacer $
|
---|
| 21 | * $Revision: 2 $
|
---|
| 22 | * $Date: 2007-09-05 20:07:46 +0000 (Wed, 05 Sep 2007) $
|
---|
| 23 | * $HeadURL: trunk/Distribution/Scripts/DB2EclipseHelp.CMD $
|
---|
| 24 | *
|
---|
| 25 | *************************************************************************************
|
---|
| 26 | */
|
---|
| 27 |
|
---|
| 28 | OuterEnv = SetLocal()
|
---|
| 29 |
|
---|
| 30 | CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
|
---|
| 31 | CALL SysLoadFuncs
|
---|
| 32 |
|
---|
| 33 | ScriptDir = GetScriptPath()
|
---|
| 34 | RootDir = GetParentDirectory(ScriptDir)
|
---|
| 35 |
|
---|
| 36 | Arguments = ARG(1)
|
---|
| 37 |
|
---|
| 38 | IF WORDS(Arguments) = 2
|
---|
| 39 | THEN DO
|
---|
| 40 | InputFile = WORD(Arguments, 1)
|
---|
| 41 | PluginID = WORD(Arguments, 2)
|
---|
| 42 | CALL Saxon InputFile || " " || RootDir || "\XSL\eclipse\eclipse.xsl eclipse.plugin.id=" || PluginID
|
---|
| 43 | END
|
---|
| 44 | ELSE DO
|
---|
| 45 | CALL PrintUsage
|
---|
| 46 | END
|
---|
| 47 |
|
---|
| 48 | CALL EndLocal
|
---|
| 49 | EXIT
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | /***********************************************************************************************/
|
---|
| 53 | /* Procedures and functions */
|
---|
| 54 | /***********************************************************************************************/
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * Sets an environment variable or appends a value to it.
|
---|
| 59 | */
|
---|
| 60 | AddEnvironment: PROCEDURE
|
---|
| 61 | PARSE ARG VarName, VarValue
|
---|
| 62 | IF (Value(VarName, , "OS2ENVIRONMENT")="")
|
---|
| 63 | THEN CALL SetEnvironment VarName, VarValue
|
---|
| 64 | ELSE CALL Value VarName, GetEnvironment(VarName) || ";" || VarValue, "OS2ENVIRONMENT"
|
---|
| 65 | RETURN
|
---|
| 66 |
|
---|
| 67 |
|
---|
| 68 | /*
|
---|
| 69 | * Sets an environment variable, overwriting its previous value.
|
---|
| 70 | */
|
---|
| 71 | SetEnvironment: PROCEDURE
|
---|
| 72 | PARSE ARG VarName, VarValue
|
---|
| 73 | CALL Value VarName, VarValue, "OS2ENVIRONMENT"
|
---|
| 74 | RETURN
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | /*
|
---|
| 78 | * Returns the value of an environment variable.
|
---|
| 79 | */
|
---|
| 80 | GetEnvironment: PROCEDURE
|
---|
| 81 | PARSE ARG VarName
|
---|
| 82 | RETURN Value(VarName, , "OS2ENVIRONMENT")
|
---|
| 83 |
|
---|
| 84 |
|
---|
| 85 | /*
|
---|
| 86 | * Returns the current script name.
|
---|
| 87 | */
|
---|
| 88 | GetScriptName: PROCEDURE
|
---|
| 89 | PARSE SOURCE Result
|
---|
| 90 | RETURN WORD(Result, 3)
|
---|
| 91 |
|
---|
| 92 |
|
---|
| 93 | /*
|
---|
| 94 | * Returns the current script path, without "\" at the end.
|
---|
| 95 | */
|
---|
| 96 | GetScriptPath: PROCEDURE
|
---|
| 97 | ScriptName = GetScriptName()
|
---|
| 98 | RETURN SUBSTR(ScriptName, 1, LASTPOS("\", ScriptName)-1)
|
---|
| 99 |
|
---|
| 100 |
|
---|
| 101 | /*
|
---|
| 102 | * Returns True if the given file exists.
|
---|
| 103 | */
|
---|
| 104 | FileExists: PROCEDURE
|
---|
| 105 | PARSE ARG FileName
|
---|
| 106 | CALL SysFileTree FileName, Result
|
---|
| 107 | RETURN Result.0 > 0
|
---|
| 108 |
|
---|
| 109 |
|
---|
| 110 | /*
|
---|
| 111 | * Returns the current directory, without "\" at the end.
|
---|
| 112 | */
|
---|
| 113 | GetCurrentDir: PROCEDURE
|
---|
| 114 | RETURN DIRECTORY()
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | /*
|
---|
| 118 | * Returns the parent directory of the directory passed as argument, without "\" at the end.
|
---|
| 119 | */
|
---|
| 120 | GetParentDirectory: PROCEDURE
|
---|
| 121 | PARSE ARG DirName
|
---|
| 122 | RETURN SUBSTR(DirName, 1, LASTPOS("\", DirName)-1)
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 | /*
|
---|
| 126 | * Prints out a short help on how to call this script.
|
---|
| 127 | */
|
---|
| 128 | PrintUsage: PROCEDURE
|
---|
| 129 | SAY "DocBook Framework for OS/2, DocBook --> Eclipse Help"
|
---|
| 130 | SAY "Usage: DB2EclipseHelp <DocBook Source> <Eclipse Plugin ID>"
|
---|
| 131 | RETURN
|
---|
| 132 |
|
---|