public final class Macro extends Object
Local macros are a convenient tool for passing command options to Java.
public static int getOptions(String[] args) {
// options filename and level are passed through local macros
String fileName = Macro.getLocal("filename");
if (fileName == null) {
return (198);
}
int level = 95;
try {
level = Integer.parseInt(Macro.getLocalSafe("level"));
}
catch (NumberFormatException e) {}
SFIToolkit.displayln("filename: " + fileName);
SFIToolkit.displayln("level: " + level);
return 0;
}
| Modifier and Type | Field and Description |
|---|---|
static int |
TYPE_CRETURN |
static int |
TYPE_ERETURN |
static int |
TYPE_GLOBAL |
static int |
TYPE_RETURN |
static int |
TYPE_RRETURN |
static int |
TYPE_SRETURN |
static int |
VTYPE_HIDDEN |
static int |
VTYPE_HISTORICAL |
static int |
VTYPE_VISIBLE |
| Modifier and Type | Method and Description |
|---|---|
static String |
getGlobal(String name)
Get the contents of a global macro.
|
static String |
getGlobal(String name,
int type)
Get the contents of a global macro.
|
static String |
getGlobalSafe(String name)
Get the contents of a global macro without returning null.
|
static String |
getGlobalSafe(String name,
int type)
Get the contents of a global macro without returning null.
|
static String |
getLocal(String name)
Get the contents of a local macro.
|
static String |
getLocalSafe(String name)
Get the contents of a local macro without returning null.
|
static int |
setGlobal(String name,
String value)
Set the value of a global macro.
|
static int |
setGlobal(String name,
String value,
int type)
Set the value of a global macro.
|
static int |
setGlobal(String name,
String value,
int type,
int vtype)
Set the value of a global macro.
|
static int |
setGlobal(String name,
String value,
int type,
String version)
Set the value of a global macro.
|
static int |
setLocal(String name,
String value)
Set the value of a local macro.
|
public static final int TYPE_GLOBAL
public static final int TYPE_RETURN
public static final int TYPE_RRETURN
public static final int TYPE_ERETURN
public static final int TYPE_CRETURN
public static final int TYPE_SRETURN
public static final int VTYPE_VISIBLE
public static final int VTYPE_HIDDEN
public static final int VTYPE_HISTORICAL
public static String getLocal(String name)
name - Name of the macro.public static String getLocalSafe(String name)
name - Name of the macro.public static String getGlobal(String name)
name - Name of the macro.public static String getGlobal(String name, int type)
name - Name of the macro.type - Type of the macro; may be
TYPE_GLOBAL,
TYPE_RETURN,
TYPE_RRETURN,
TYPE_ERETURN,
TYPE_CRETURN,
or TYPE_SRETURN.public static String getGlobalSafe(String name)
name - Name of the macro.public static String getGlobalSafe(String name, int type)
name - Name of the macro.type - Type of the macro; may be
TYPE_GLOBAL,
TYPE_RETURN,
TYPE_RRETURN,
TYPE_ERETURN,
TYPE_CRETURN,
or TYPE_SRETURN.public static int setLocal(String name, String value)
name - Name of the macro.value - Value to store in the macro.public static int setGlobal(String name, String value)
name - Name of the macro.value - Value to store in the macro.public static int setGlobal(String name, String value, int type)
name - Name of the macro.value - Value to store in the macro.type - Type of the macro; may be
TYPE_GLOBAL,
TYPE_RETURN,
TYPE_RRETURN,
TYPE_ERETURN,
or TYPE_SRETURN.public static int setGlobal(String name, String value, int type, int vtype)
name - Name of the macro.value - Value to store in the macro.type - Type of the macro; may be
TYPE_GLOBAL,
TYPE_RETURN,
TYPE_RRETURN,
TYPE_ERETURN,
or TYPE_SRETURN.vtype - If the macro is a type of return value,
sets whether the return value is
VTYPE_VISIBLE,
VTYPE_HIDDEN,
or VTYPE_HISTORICAL.
This parameter is ignored with TYPE_GLOBAL
or TYPE_SRETURN.public static int setGlobal(String name, String value, int type, String version)
name - Name of the macro.value - Value to store in the macro.type - Type of the macro; may be
TYPE_GLOBAL,
TYPE_RETURN,
TYPE_RRETURN,
TYPE_ERETURN,
or TYPE_SRETURN.version - If the macro is a type of return value,
sets the release number in the form
#[#][.[#[#]]]
for a return result.
This parameter is ignored with
TYPE_GLOBAL
or TYPE_SRETURN.