| 1 | /*
|
|---|
| 2 | *************************************************************************************
|
|---|
| 3 | *
|
|---|
| 4 | * DocBook Framework for OS/2 and eComStation
|
|---|
| 5 | * Convert Formatting Objects to Maker Interchange Format
|
|---|
| 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 FO file to a MIF file.
|
|---|
| 16 | *
|
|---|
| 17 | *************************************************************************************
|
|---|
| 18 | *
|
|---|
| 19 | * $Author: jkacer $
|
|---|
| 20 | * $Revision: 2 $
|
|---|
| 21 | * $Date: 2007-09-05 20:07:46 +0000 (Wed, 05 Sep 2007) $
|
|---|
| 22 | * $HeadURL: trunk/Distribution/Scripts/FO2MIF.CMD $
|
|---|
| 23 | *
|
|---|
| 24 | *************************************************************************************
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | OuterEnv = SetLocal()
|
|---|
| 28 |
|
|---|
| 29 | CALL RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
|
|---|
| 30 | CALL SysLoadFuncs
|
|---|
| 31 |
|
|---|
| 32 | SAY "Sorry, this feature is not available yet."
|
|---|
| 33 |
|
|---|
| 34 | /*
|
|---|
| 35 | Arguments = ARG(1)
|
|---|
| 36 |
|
|---|
| 37 | IF WORDS(Arguments) = 1
|
|---|
| 38 | THEN DO
|
|---|
| 39 | InputFile = WORD(Arguments, 1)
|
|---|
| 40 | OutputFile = SUBSTR(InputFile, 1, LASTPOS(".", InputFile)-1) || ".MIF"
|
|---|
| 41 | CALL FOP "-fo " || InputFile || " -mif " || OutputFile
|
|---|
| 42 | END
|
|---|
| 43 | ELSE DO
|
|---|
| 44 | CALL PrintUsage
|
|---|
| 45 | END
|
|---|
| 46 | */
|
|---|
| 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, Formatting Objects --> Maker Interchange Format"
|
|---|
| 130 | SAY "Usage: FO2MIF <Formatting Objects>"
|
|---|
| 131 | RETURN
|
|---|
| 132 |
|
|---|