public static final class JZtxtcmdExecuter.ExecuteLevel extends java.lang.Object implements javax.script.ScriptContext, FilePath.FilePathEnvAccess, java.io.Closeable
CalculatorExpr.calcDataAccess(Map, Object...)
to generate an expression independent of an environment.Modifier and Type | Field and Description |
---|---|
private boolean |
bForHasNext
Used while a for-container loop runs.
|
boolean |
bWriteErrorInOutput
Flag, write error in the current output if set to true.
|
int |
cmdErrorlevel
The error level which is returned from an operation system cmd invocation.
|
CmdExecuter |
cmdExecuter
Initialize firstly on demand.
|
(package private) int |
ctNesting
Counts nesting of
#execute(org.vishia.cmd.JZtxtcmdScript.StatementList, StringFormatter, int, boolean, Map, int)
1->0: leaf execution of this level, close cmdExecuter |
java.io.File |
currdir
The current directory of this level.
|
private boolean |
debug_dataAccessArguments |
(package private) JZtxtcmdScript.JZcmdClass |
jzClass |
(package private) JZtxtcmdExecuter.JzTcMain |
jzcmdMain |
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> |
localVariables
Generated content of local variables in this nested level including the
JZtxtcmdExecuter.scriptLevel() . |
JZtxtcmdExecuter.ExecuteLevel |
parent
Not used yet.
|
(package private) java.lang.String |
sCurrdir
The current directory of this level.
|
(package private) JZtxtcmdScript.Subroutine |
subRoutine |
(package private) JZtxtcmdThreadData |
threadData |
Modifier | Constructor and Description |
---|---|
protected |
ExecuteLevel(JZtxtcmdExecuter.JzTcMain acc,
JZtxtcmdScript.Subroutine subRoutine,
JZtxtcmdScript.JZcmdClass jzClass,
JZtxtcmdThreadData threadData,
JZtxtcmdExecuter.ExecuteLevel parent,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> parentVariables)
Constructs data for a local execution level.
|
protected |
ExecuteLevel(JZtxtcmdExecuter.JzTcMain acc,
JZtxtcmdThreadData threadData)
Constructs data for the script execution level.
|
Modifier and Type | Method and Description |
---|---|
(package private) short |
appendExpr(JZtxtcmdScript.AssignExpr statement)
Executes a
appendExpr::= [{ < datapath? |
private short |
assignObj(JZtxtcmdScript.AssignExpr statement,
java.lang.Object val,
boolean bEval)
Executes a
assignment::= [{ < datapath? |
private short |
assignStatement(JZtxtcmdScript.JZcmditem statement) |
private void |
calculateArguments(DataAccess dataAccess) |
private CalculatorExpr.Value |
calculateExpression(CalculatorExpr expr)
This routine invokes
CalculatorExpr.calcDataAccess(Map, Object...) , but before
the arguments of all operations will be calculated if necessary. |
protected void |
changeCurrDir(java.lang.CharSequence arg)
Executes the cd command: changes the directory in this execution level.
|
void |
close() |
(package private) JZtxtcmdFilepath |
convert2FilePath(java.lang.Object osrc)
Check whether osrc is a filepath, or create one.
|
java.lang.String |
currdir()
Returns the absolute canonical path of the currdir variable. currdir is a
File . |
(package private) java.lang.Object |
dataAccess(JZtxtcmdScript.JZcmdDataAccess dataAccess,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> dataPool,
boolean accessPrivate,
boolean bContainer,
boolean bVariable,
DataAccess.Dst dst)
Accesses the data.
|
void |
debug_dataAccessArguments() |
(package private) void |
debug() |
(package private) int |
debug(JZtxtcmdScript.JZcmditem statement) |
(package private) short |
defineExpr(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables,
JZtxtcmdScript.DefVariable statement)
Executes a
DefObjVar::= < variable? |
private void |
endExecution() |
boolean |
evalCondition(JZtxtcmdScript.JZcmditem arg) |
java.lang.Object |
evalDatapathOrExpr(JZtxtcmdScript.Argument arg)
Checks either the
JZtxtcmdScript.JZcmditem.dataAccess or, if it is null,
the JZtxtcmdScript.JZcmditem.expression . |
java.lang.Object |
evalObject(JZtxtcmdScript.JZcmditem arg,
boolean bContainer)
Gets the value of the given Argument.
|
java.lang.CharSequence |
evalString(JZtxtcmdScript.JZcmditem arg) |
java.lang.Object |
evalSubroutine(JZtxtcmdScript.Subroutine substatement,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> args,
StringFormatter out,
int indentOut)
This routine is called only from org.vishia.zcmd.JZcmd#evalSub(....) which may be not used in praxis?.
|
CalculatorExpr.Value |
evalValue(JZtxtcmdScript.JZcmditem arg,
boolean bContainer)
Gets the value of the given Argument.
|
java.lang.CharSequence |
excStacktraceinfo()
Returns a one-line-information about the last Exception with Stacktrace information (max 20 levels).
|
protected short |
exec_addClassLoader(JZtxtcmdScript.DefClasspathVariable statement,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables) |
private short |
exec_Call(JZtxtcmdScript.CallStatement callStatement,
java.util.List<DataAccess.Variable<java.lang.Object>> additionalArgs,
StringFormatter out,
int indentOut,
int nDebug) |
(package private) short |
exec_ChangeCurrDir(JZtxtcmdScript.JZcmditem statement) |
(package private) short |
exec_CmdError(JZtxtcmdScript.Onerror statement,
StringFormatter out,
int indentOut) |
private void |
exec_cmdline(JZtxtcmdScript.CmdInvoke statement) |
(package private) void |
exec_Copy(JZtxtcmdScript.FileOpArg statement) |
(package private) short |
exec_createFilepath(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables,
JZtxtcmdScript.DefVariable statement) |
(package private) short |
exec_createFileSet(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables,
JZtxtcmdScript.UserFileset statement) |
private short |
exec_Datatext(JZtxtcmdScript.DataText statement,
StringFormatter out,
int indentOut,
int nDebug)
Inserts <&a_Datapath> in the out.
|
(package private) short |
exec_DebugOp(JZtxtcmdScript.JZcmditem statement) |
protected short |
exec_DefClassVariable(JZtxtcmdScript.DefClassVariable statement,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables) |
(package private) void |
exec_DefCodeblockVariable(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables,
JZtxtcmdScript.Subroutine statement,
boolean isConst)
It defines a variable type 'X' and stores the given subroutine reference to execute that statements on evaluating the variable
|
protected short |
exec_DefList(JZtxtcmdScript.DefContainerVariable statement,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables) |
protected short |
exec_DefMapVariable(JZtxtcmdScript.DefVariable statement,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables) |
(package private) void |
exec_DefVariable(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables,
JZtxtcmdScript.DefVariable statement,
char type,
java.lang.Object valueArg,
boolean isConst) |
(package private) void |
exec_Delete(JZtxtcmdScript.FileOpArg statement) |
(package private) short |
exec_dowhileStatement(JZtxtcmdScript.CondStatement whileStatement,
StringFormatter out,
int indentOut,
int nDebug)
Executes a dowhile statement.
|
private short |
exec_forContainer(JZtxtcmdScript.ForStatement statement,
StringFormatter out,
int indentOut,
int nDebug) |
(package private) short |
exec_hasNext(JZtxtcmdScript.JZcmditem statement,
StringFormatter out,
int indentOut,
int nDebug)
Executes the statements or output the text if in textArg if a for-container has a next element.
|
(package private) short |
exec_IfStatement(JZtxtcmdScript.IfStatement ifStatement,
StringFormatter out,
int indentOut,
int nDebug)
it contains maybe more as one if block and else.
|
(package private) short |
exec_MkDir(JZtxtcmdScript.JZcmditem statement) |
(package private) void |
exec_Move(JZtxtcmdScript.FileOpArg statement) |
private short |
exec_NestedLevel(JZtxtcmdScript.JZcmditem script,
StringFormatter out,
int indentOut,
int nDebug)
Executes an internal statement block.
|
(package private) short |
exec_Openfile(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables,
JZtxtcmdScript.DefVariable statement)
Creates a new FileWriter with the given name
#evalString(org.vishia.cmd.JZtxtcmdScript.Argument)
of the statement. |
(package private) StringFormatter |
exec_OpenTextOut(JZtxtcmdScript.JZcmditem statement,
StringFormatter outTextprev,
boolean bAppend)
Closes an existing text out and opens a new one with the given name in the current directory.
|
(package private) void |
exec_SetColumn(JZtxtcmdScript.TextColumn statement,
StringFormatter out) |
private short |
exec_Subroutine(JZtxtcmdScript.Subroutine statement,
JZtxtcmdExecuter.ExecuteLevel sublevel,
java.util.List<JZtxtcmdScript.Argument> actualArgs,
java.util.List<DataAccess.Variable<java.lang.Object>> additionalArgs,
StringFormatter out,
int indentOut,
int nDebug)
Core routine to execute a sub routine.
|
short |
exec_Subroutine(JZtxtcmdScript.Subroutine subroutine,
java.util.List<DataAccess.Variable<java.lang.Object>> args,
StringFormatter out,
int indentOut)
Executes a subroutine invoked from user space, with given
JZtxtcmdExecuter.ExecuteLevel as this. |
short |
exec_Subroutine(JZtxtcmdScript.Subroutine subroutine,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> args,
StringFormatter out,
int indentOut)
Executes a subroutine invoked from user space, with given
JZtxtcmdExecuter.ExecuteLevel as this. |
(package private) void |
exec_Text(JZtxtcmdScript.JZcmditem statement,
java.lang.Appendable out,
int indentOut)
Outputs the given constant text
|
(package private) short |
exec_TextAppendToOut(JZtxtcmdScript.JZcmditem statement,
StringFormatter out,
int nDebug)
Invocation for <:>text<.+>.
|
(package private) short |
exec_TextAppendToVar(JZtxtcmdScript.TextOut statement,
int nDebug)
Invocation for <+name>text<.+>.
|
private short |
exec_Thread(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables,
JZtxtcmdScript.ThreadBlock statement)
executes statements in another thread.
|
(package private) void |
exec_Throw(JZtxtcmdScript.JZcmditem statement) |
(package private) void |
exec_Throwonerror(JZtxtcmdScript.Onerror statement)
Throws an
JZtxtcmdExecuter.CmdErrorLevelException if the errorlevel is >= statement.errorLevel. |
(package private) short |
exec_whileStatement(JZtxtcmdScript.CondStatement whileStatement,
StringFormatter out,
int indentOut,
int nDebug)
Executes a while statement.
|
private short |
exec_zmake(JZtxtcmdScript.Zmake statement,
StringFormatter out,
int indentOut,
int nDebug)
Executes a Zmake subroutine call.
|
(package private) short |
execute(JZtxtcmdScript.StatementList statementList,
StringFormatter outText,
int indentOutArg,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables,
int nDebugP)
Processes the statement of the current node in the JZcmditem.
|
short |
executeNewlevel(JZtxtcmdScript.StatementList contentScript,
StringFormatter out,
int indentOut,
int nDebug)
Executes an inner script part maybe with a new level of nested local variables.
|
JZtxtcmdExecuter.JzTcMain |
executer() |
protected void |
finishThread(JZtxtcmdThreadData thread) |
java.lang.Object |
getAttribute(java.lang.String name) |
java.lang.Object |
getAttribute(java.lang.String name,
int scope) |
int |
getAttributesScope(java.lang.String name) |
javax.script.Bindings |
getBindings(int scope) |
java.lang.CharSequence |
getCurrentDir()
Returns the current directory of the context necessary to build an absolute path in
FilePath . |
java.io.Writer |
getErrorWriter() |
java.io.Reader |
getReader() |
java.util.List<java.lang.Integer> |
getScopes() |
java.lang.Object |
getValue(java.lang.String variable)
Returns the Object which is addressed by the name.
|
java.io.Writer |
getWriter() |
JZtxtcmdExecuter.ExecuteLevel |
levelForSubroutine(JZtxtcmdScript.Subroutine subroutine)
Creates a new level for the subroutine with this given level.
|
LogMessage |
log()
Returns the log interface from the environment class.
|
java.lang.Object |
removeAttribute(java.lang.String name,
int scope) |
protected void |
runThread(JZtxtcmdExecuter.ExecuteLevel executeLevel,
JZtxtcmdScript.ThreadBlock statement,
JZtxtcmdThreadData threadVar) |
JZtxtcmdEngine |
scriptEngine() |
void |
setAttribute(java.lang.String name,
java.lang.Object value,
int scope) |
void |
setBindings(javax.script.Bindings bindings,
int scope) |
void |
setCmdExecuter(CmdExecuter executer)
Use the given CmdExecuter especially for a
JZtxtcmdExecuter#execSub(org.vishia.cmd.JZtxtcmdScript.Subroutine, List, boolean, Appendable, File)
after levelForSubroutine(org.vishia.cmd.JZtxtcmdScript.Subroutine) . |
void |
setErrorWriter(java.io.Writer writer) |
void |
setLocalVariable(java.lang.String name,
char type,
java.lang.Object content,
boolean isConst) |
void |
setReader(java.io.Reader reader) |
void |
setWriter(java.io.Writer writer) |
(package private) void |
storeValue(DataAccess dataAccess,
java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> dataPool,
java.lang.Object value,
boolean accessPrivate) |
(package private) void |
throwIllegalDstArgument(java.lang.CharSequence text,
DataAccess dst,
JZtxtcmdScript.JZcmditem statement) |
final JZtxtcmdExecuter.JzTcMain jzcmdMain
public final JZtxtcmdExecuter.ExecuteLevel parent
int ctNesting
#execute(org.vishia.cmd.JZtxtcmdScript.StatementList, StringFormatter, int, boolean, Map, int)
1->0: leaf execution of this level, close cmdExecuter
final JZtxtcmdThreadData threadData
final JZtxtcmdScript.JZcmdClass jzClass
final JZtxtcmdScript.Subroutine subRoutine
public java.io.File currdir
java.lang.String sCurrdir
public boolean bWriteErrorInOutput
public final java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> localVariables
JZtxtcmdExecuter.scriptLevel()
.localVariables
.
The variables are type invariant on language level. The type is checked and therefore
errors are detected on runtime only.public CmdExecuter cmdExecuter
private boolean bForHasNext
private boolean debug_dataAccessArguments
public int cmdErrorlevel
#execCmdError(org.vishia.cmd.JZtxtcmdScript.Onerror)
.protected ExecuteLevel(JZtxtcmdExecuter.JzTcMain acc, JZtxtcmdScript.Subroutine subRoutine, JZtxtcmdScript.JZcmdClass jzClass, JZtxtcmdThreadData threadData, JZtxtcmdExecuter.ExecuteLevel parent, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> parentVariables)
parentVariables
- if given this variable are copied to the local ones.
They contains the script variables too. If not given (null), only the script variables
are copied into the localVariables
. Note that subroutines do not know the
local variables of its calling routine! This argument is only set if nested statement blocks
are to execute.protected ExecuteLevel(JZtxtcmdExecuter.JzTcMain acc, JZtxtcmdThreadData threadData)
public void setCmdExecuter(CmdExecuter executer)
JZtxtcmdExecuter#execSub(org.vishia.cmd.JZtxtcmdScript.Subroutine, List, boolean, Appendable, File)
after levelForSubroutine(org.vishia.cmd.JZtxtcmdScript.Subroutine)
.executer
- may be opened, should not be in process, will be used then.public JZtxtcmdExecuter.JzTcMain executer()
public JZtxtcmdEngine scriptEngine()
public LogMessage log()
public void setLocalVariable(java.lang.String name, char type, java.lang.Object content, boolean isConst) throws java.lang.IllegalAccessException
java.lang.IllegalAccessException
public short executeNewlevel(JZtxtcmdScript.StatementList contentScript, StringFormatter out, int indentOut, int nDebug) throws java.lang.Exception
JZtxtcmdScript.StatementList.bContainsVariableDef
) then this level is used,
it prevents a non necessary instantiation of an JZtxtcmdExecuter.ExecuteLevel
and copying of local variables.
If new variables are to build in the statements, a new instance of JZtxtcmdExecuter.ExecuteLevel
is created
and all variables of this.localVariables
are copied to it. It means the nested level
knows the same variables but it can add new variables without effect to this level. Changing
of existing variables effects all outer levels. That is necessary, an outer-defined variable can be changed
in an inner level. That is guaranteed because only the reference is changed.contentScript
- of the inner level.out
- The main outputbContainerHasNext
- only used for for-statementjava.io.IOException
java.lang.Exception
short execute(JZtxtcmdScript.StatementList statementList, StringFormatter outText, int indentOutArg, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables, int nDebugP)
statementList
- outText
- The current output. Either it is a special output channel for <+channel>...<.+>
or it is the threadData.out or it is null if threadData.out is not initialized yet.indentOutArg
- The indentation in the script.bContainerHasNext
- Especially for <:for:element:container>SCRIPT<.for> to implement <:hasNext>newVariables
- Destination instance for newly created variables. It is localVariables
usual
but in special cases new variables are stored in an own Map, especially on { nDebugP
- JZtxtcmdExecuter.kSuccess
==0, JZtxtcmdExecuter.kBreak
, JZtxtcmdExecuter.kReturn
or JZtxtcmdExecuter.kException
java.lang.Exception
private void endExecution()
void exec_Text(JZtxtcmdScript.JZcmditem statement, java.lang.Appendable out, int indentOut) throws java.io.IOException
statement
- contains the textout
- out channel to appendindentOut
- Number of characters in a new line which are skipped from begin. Indentation in the script, no indentation in outputted textjava.io.IOException
void exec_SetColumn(JZtxtcmdScript.TextColumn statement, StringFormatter out) throws java.lang.Exception
java.lang.Exception
void exec_DefVariable(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables, JZtxtcmdScript.DefVariable statement, char type, java.lang.Object valueArg, boolean isConst) throws java.lang.Exception
newVariables
- statement
- JZtxtcmdScript.DefVariable.defVariable
contains the type.type
- unused, see statementvalue
- isConst
- java.lang.Exception
void exec_DefCodeblockVariable(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables, JZtxtcmdScript.Subroutine statement, boolean isConst) throws java.lang.Exception
newVariables
- statement
- Subroutine referencetype
- not used, type is 'C'value
- isConst
- java.lang.Exception
protected short exec_DefList(JZtxtcmdScript.DefContainerVariable statement, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables) throws java.lang.Exception
java.lang.Exception
protected short exec_DefMapVariable(JZtxtcmdScript.DefVariable statement, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables) throws java.lang.Exception
java.lang.Exception
protected short exec_DefClassVariable(JZtxtcmdScript.DefClassVariable statement, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables) throws java.lang.Exception
java.lang.Exception
protected short exec_addClassLoader(JZtxtcmdScript.DefClasspathVariable statement, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables) throws java.lang.Exception
java.lang.Exception
short exec_createFilepath(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables, JZtxtcmdScript.DefVariable statement) throws java.lang.Exception
java.lang.Exception
short exec_createFileSet(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables, JZtxtcmdScript.UserFileset statement) throws java.lang.Exception
java.lang.Exception
private short exec_forContainer(JZtxtcmdScript.ForStatement statement, StringFormatter out, int indentOut, int nDebug) throws java.lang.Exception
java.lang.Exception
short exec_hasNext(JZtxtcmdScript.JZcmditem statement, StringFormatter out, int indentOut, int nDebug) throws java.lang.Exception
statement
- the hasnext-Statement.out
- indentOut
- nDebug
- java.lang.Exception
short exec_IfStatement(JZtxtcmdScript.IfStatement ifStatement, StringFormatter out, int indentOut, int nDebug) throws java.lang.Exception
JZtxtcmdExecuter.kBreak
if a break statement was found.java.lang.Exception
short exec_whileStatement(JZtxtcmdScript.CondStatement whileStatement, StringFormatter out, int indentOut, int nDebug) throws java.lang.Exception
java.lang.Exception
short exec_dowhileStatement(JZtxtcmdScript.CondStatement whileStatement, StringFormatter out, int indentOut, int nDebug) throws java.lang.Exception
java.lang.Exception
short exec_TextAppendToOut(JZtxtcmdScript.JZcmditem statement, StringFormatter out, int nDebug) throws java.lang.Exception
execute(JZtxtcmdScript.StatementList, StringFormatter, int, Map, int)
with it. The arg 'indentOutArg' is set from the JZtxtcmdScript.JZcmditem.srcColumn
of the statement.statement
- the statementjava.lang.Exception
short exec_TextAppendToVar(JZtxtcmdScript.TextOut statement, int nDebug) throws java.lang.Exception
execute(JZtxtcmdScript.StatementList, StringFormatter, int, Map, int)
with it. The arg 'indentOutArg' is set from the JZtxtcmdScript.JZcmditem.srcColumn
of the statement.statement
- the statementjava.lang.Exception
private short exec_Call(JZtxtcmdScript.CallStatement callStatement, java.util.List<DataAccess.Variable<java.lang.Object>> additionalArgs, StringFormatter out, int indentOut, int nDebug) throws java.lang.IllegalArgumentException, java.lang.Exception
java.lang.IllegalArgumentException
java.lang.Exception
public java.lang.Object evalSubroutine(JZtxtcmdScript.Subroutine substatement, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> args, StringFormatter out, int indentOut) throws javax.script.ScriptException
substatement
- args
- out
- indentOut
- javax.script.ScriptException
public short exec_Subroutine(JZtxtcmdScript.Subroutine subroutine, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> args, StringFormatter out, int indentOut)
JZtxtcmdExecuter.ExecuteLevel
as this.
This routine should be used if args are given as Map of Variable.
Internally the #exec_Subroutine(Subroutine, List, StringFormatter, int)
is called.substatement
- Statement of the subroutineargs
- Any given arguments in form of a map. It is proper to build a Map with JZcmd script features better than a list.
The execution needs a List of Variables, the Variables of the map are copied to a temporary List instance.out
- outputindentOut
- java.lang.Exception
public short exec_Subroutine(JZtxtcmdScript.Subroutine subroutine, java.util.List<DataAccess.Variable<java.lang.Object>> args, StringFormatter out, int indentOut)
JZtxtcmdExecuter.ExecuteLevel
as this.
This routine should be used if args are given as List of Variable.
The routine creates an own level to execute the sub routine unless the subroutine is marked with JZtxtcmdScript.Subroutine.useLocals
.
It calls levelForSubroutine(org.vishia.cmd.JZtxtcmdScript.Subroutine)
therefore.
Internally the private #exec_Subroutine(org.vishia.cmd.JZtxtcmdScript.Subroutine, ExecuteLevel, List, List, StringFormatter, int, int)
is called.substatement
- Statement of the subroutineargs
- Any given arguments in form of a List. It is proper for user calling.out
- outputindentOut
- java.lang.Exception
#exec_Subroutine(Subroutine, Map, StringFormatter, int)
was existing and contains this content.public final JZtxtcmdExecuter.ExecuteLevel levelForSubroutine(JZtxtcmdScript.Subroutine subroutine)
JZtxtcmdScript.Subroutine.useLocals
then a new level is not created,
instead this is returned.subroutine
- private short exec_Subroutine(JZtxtcmdScript.Subroutine statement, JZtxtcmdExecuter.ExecuteLevel sublevel, java.util.List<JZtxtcmdScript.Argument> actualArgs, java.util.List<DataAccess.Variable<java.lang.Object>> additionalArgs, StringFormatter out, int indentOut, int nDebug) throws java.lang.Exception
statement
- sublevel
- actualArgs
- additionalArgs
- out
- indentOut
- nDebug
- java.lang.Exception
private short exec_zmake(JZtxtcmdScript.Zmake statement, StringFormatter out, int indentOut, int nDebug) throws java.lang.IllegalArgumentException, java.lang.Exception
exec_Call(org.vishia.cmd.JZtxtcmdScript.CallStatement, List, StringFormatter, int, int)
a ZmakeTarget
will be prepared and stored as 'target' in the localVariables of the sublevel.statement
- out
- indentOut
- java.lang.IllegalArgumentException
java.lang.Exception
private short exec_Thread(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables, JZtxtcmdScript.ThreadBlock statement) throws java.lang.Exception
java.lang.Exception
private short exec_NestedLevel(JZtxtcmdScript.JZcmditem script, StringFormatter out, int indentOut, int nDebug) throws java.lang.Exception
script
- out
- #execute(org.vishia.cmd.JZtxtcmdScript.StatementList, Appendable, int, boolean)
A JZtxtcmdExecuter.kBreak
inside the statementlist is not returned. The break is only valid
inside the block. All other return values of execute are returned.java.io.IOException
java.lang.Exception
private void exec_cmdline(JZtxtcmdScript.CmdInvoke statement) throws java.lang.IllegalArgumentException, java.lang.Exception
java.lang.IllegalArgumentException
java.lang.Exception
short exec_CmdError(JZtxtcmdScript.Onerror statement, StringFormatter out, int indentOut) throws java.lang.Exception
java.lang.Exception
short exec_DebugOp(JZtxtcmdScript.JZcmditem statement) throws java.lang.Exception
java.lang.Exception
short exec_ChangeCurrDir(JZtxtcmdScript.JZcmditem statement) throws java.lang.Exception
java.lang.Exception
short exec_MkDir(JZtxtcmdScript.JZcmditem statement) throws java.lang.Exception
java.lang.Exception
StringFormatter exec_OpenTextOut(JZtxtcmdScript.JZcmditem statement, StringFormatter outTextprev, boolean bAppend) throws java.lang.Exception
JZtxtcmdExecuter.JzTcMain.outFromCmdlineArg
is given than System.out.
Elsewhere it closes the given output and opens the new one if possible.statement
- builds a pathoutTextprev
- previously used textOut, it is returned if it is not changed. Because it is used locally in the script execution.bAppend
- for <+:append>path/to...
evalString(org.vishia.cmd.JZtxtcmdScript.JZcmditem)
of the statement.
elsewhere the new outText or the given outTextprevjava.lang.Exception
protected void changeCurrDir(java.lang.CharSequence arg) throws java.lang.IllegalAccessException, java.io.FileNotFoundException
arg
- maybe a relative path. If it is a StringBuilder, it will be changed on normalizePath.java.lang.IllegalAccessException
java.io.FileNotFoundException
private short exec_Datatext(JZtxtcmdScript.DataText statement, StringFormatter out, int indentOut, int nDebug) throws java.lang.IllegalArgumentException, java.lang.Exception
statement
- The statement which contains the access path etc.out
- java.lang.IllegalArgumentException
java.lang.Exception
void exec_Move(JZtxtcmdScript.FileOpArg statement) throws java.lang.IllegalArgumentException, java.lang.Exception
java.lang.IllegalArgumentException
java.lang.Exception
void exec_Copy(JZtxtcmdScript.FileOpArg statement) throws java.lang.Exception
java.lang.Exception
void exec_Delete(JZtxtcmdScript.FileOpArg statement) throws java.lang.Exception
java.lang.Exception
short exec_Openfile(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables, JZtxtcmdScript.DefVariable statement) throws java.lang.IllegalArgumentException, java.lang.Exception
#evalString(org.vishia.cmd.JZtxtcmdScript.Argument)
of the statement. If the file name is local, the actual value of $CD is set as pre-path.
The current directory of the file system is not proper to use because the current directory of this
execution level should be taken therefore. If the path is faulty or another exception is thrown,
the exception is forwarded to the execution level (onerror-statement).statement
- java.lang.IllegalArgumentException
java.lang.Exception
private short assignStatement(JZtxtcmdScript.JZcmditem statement) throws java.lang.IllegalArgumentException, java.lang.Exception
java.lang.IllegalArgumentException
java.lang.Exception
private short assignObj(JZtxtcmdScript.AssignExpr statement, java.lang.Object val, boolean bEval) throws java.lang.IllegalArgumentException, java.lang.Exception
assignment::= [{ < datapath?assign > = }] < expression > ;.
.
If the datapath to assign is only a localVariable (one simple name), then the expression
is assigned to this local variable, a new variable will be created.
If the datapath to assign is more complex, the object which is described with it
will be gotten. Then an assignment will be done depending on its type:
statement
- val
- value to assign. If not null then bEval should be false.bEval
- if true then the value will be evaluate from the statement.java.lang.IllegalArgumentException
java.lang.Exception
short defineExpr(java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> newVariables, JZtxtcmdScript.DefVariable statement) throws java.lang.IllegalArgumentException, java.lang.Exception
DefObjVar::= < variable?defVariable> [ = < objExpr?>]
.
If the datapath to assign is only a localVariable (one simple name), then the expression
is assigned to this local variable, a new variable will be created.
If the datapath to assign is more complex, the object which is described with it
will be gotten. Then an assignment will be done depending on its type:
statement
- java.lang.IllegalArgumentException
java.lang.Exception
short appendExpr(JZtxtcmdScript.AssignExpr statement) throws java.lang.IllegalArgumentException, java.lang.Exception
appendExpr::= [{ < datapath?assign > += }] < expression > ;.
.statement
- java.lang.IllegalArgumentException
java.lang.Exception
void exec_Throw(JZtxtcmdScript.JZcmditem statement) throws java.lang.Exception
java.lang.Exception
void exec_Throwonerror(JZtxtcmdScript.Onerror statement) throws JZtxtcmdExecuter.CmdErrorLevelException
JZtxtcmdExecuter.CmdErrorLevelException
if the errorlevel is >= statement.errorLevel.statement
- JZtxtcmdExecuter.CmdErrorLevelException
public java.lang.Object evalDatapathOrExpr(JZtxtcmdScript.Argument arg) throws java.lang.Exception
JZtxtcmdScript.JZcmditem.dataAccess
or, if it is null,
the JZtxtcmdScript.JZcmditem.expression
. Returns either the Object which is gotten
by the DataAccess#access(Map, boolean, boolean)
or which is calculated
by the expression. Returns an instance of CalculatorExpr.Value
if it is
a result by an expression.arg
- java.lang.Exception
public java.lang.CharSequence evalString(JZtxtcmdScript.JZcmditem arg) throws java.lang.Exception
java.lang.Exception
java.lang.Object dataAccess(JZtxtcmdScript.JZcmdDataAccess dataAccess, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> dataPool, boolean accessPrivate, boolean bContainer, boolean bVariable, DataAccess.Dst dst) throws java.lang.Exception
#datapath()
are calculated with the capability of JZcmd.dataPool
- accessPrivate
- bContainer
- bVariable
- dst
- java.lang.Exception
void storeValue(DataAccess dataAccess, java.util.Map<java.lang.String,DataAccess.Variable<java.lang.Object>> dataPool, java.lang.Object value, boolean accessPrivate) throws java.lang.Exception
java.lang.Exception
private CalculatorExpr.Value calculateExpression(CalculatorExpr expr) throws java.lang.Exception
CalculatorExpr.calcDataAccess(Map, Object...)
, but before
the arguments of all operations will be calculated if necessary.
All operations are gotten with CalculatorExpr.listOperations()
.
with that dataPath calculateArguments(DataAccess)
is called.
withexpr
- java.lang.Exception
private void calculateArguments(DataAccess dataAccess) throws java.lang.Exception
java.lang.Exception
public java.lang.Object evalObject(JZtxtcmdScript.JZcmditem arg, boolean bContainer) throws java.lang.Exception
JZtxtcmdScript.JZcmditem.textArg
JZtxtcmdScript.JZcmditem.dataAccess
JZtxtcmdScript.JZcmditem.statementlist
if not 'M'
JZtxtcmdScript.JZcmditem.elementType
== 'M'.
it is d 'dataStruct'.
JZtxtcmdScript.JZcmditem.expression
.
JZtxtcmdScript.Argument
- an argument of a call subroutine, then
JZtxtcmdScript.Argument#filepath
is set, then that FilePath
is transfered
to a JZtxtcmdFilepath
and returned.
A JZtxtcmdFilepath
contains the reference to this execution level.
JZtxtcmdScript.Argument#accessFileset
is set, then that JZtxtcmdScript.AccessFilesetname
is transfered to an instance of JZtxtcmdAccessFileset
and that instance is returned.
arg
- java.lang.Exception
- any Exception while evaluating.public CalculatorExpr.Value evalValue(JZtxtcmdScript.JZcmditem arg, boolean bContainer) throws java.lang.Exception
JZtxtcmdScript.JZcmditem.expression
arg
- java.lang.Exception
public boolean evalCondition(JZtxtcmdScript.JZcmditem arg) throws java.lang.Exception
java.lang.Exception
JZtxtcmdFilepath convert2FilePath(java.lang.Object osrc)
osrc
- protected void runThread(JZtxtcmdExecuter.ExecuteLevel executeLevel, JZtxtcmdScript.ThreadBlock statement, JZtxtcmdThreadData threadVar)
protected void finishThread(JZtxtcmdThreadData thread)
public java.lang.String currdir()
File
.
The file separator is '/'.int debug(JZtxtcmdScript.JZcmditem statement)
public void debug_dataAccessArguments()
void debug()
public java.lang.CharSequence excStacktraceinfo()
void throwIllegalDstArgument(java.lang.CharSequence text, DataAccess dst, JZtxtcmdScript.JZcmditem statement) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface javax.script.ScriptContext
public java.lang.Object getAttribute(java.lang.String name, int scope)
getAttribute
in interface javax.script.ScriptContext
public int getAttributesScope(java.lang.String name)
getAttributesScope
in interface javax.script.ScriptContext
public javax.script.Bindings getBindings(int scope)
getBindings
in interface javax.script.ScriptContext
public java.io.Writer getErrorWriter()
getErrorWriter
in interface javax.script.ScriptContext
public java.io.Reader getReader()
getReader
in interface javax.script.ScriptContext
public java.util.List<java.lang.Integer> getScopes()
getScopes
in interface javax.script.ScriptContext
public java.io.Writer getWriter()
getWriter
in interface javax.script.ScriptContext
public java.lang.Object removeAttribute(java.lang.String name, int scope)
removeAttribute
in interface javax.script.ScriptContext
public void setAttribute(java.lang.String name, java.lang.Object value, int scope)
setAttribute
in interface javax.script.ScriptContext
public void setBindings(javax.script.Bindings bindings, int scope)
setBindings
in interface javax.script.ScriptContext
public void setErrorWriter(java.io.Writer writer)
setErrorWriter
in interface javax.script.ScriptContext
public void setReader(java.io.Reader reader)
setReader
in interface javax.script.ScriptContext
public void setWriter(java.io.Writer writer)
setWriter
in interface javax.script.ScriptContext
public java.lang.CharSequence getCurrentDir()
FilePath.FilePathEnvAccess
FilePath
.getCurrentDir
in interface FilePath.FilePathEnvAccess
public java.lang.Object getValue(java.lang.String variable) throws java.lang.NoSuchFieldException
FilePath.FilePathEnvAccess
getValue
in interface FilePath.FilePathEnvAccess
variable
- The namejava.lang.NoSuchFieldException
- if the variable is not found (optional, recommended).public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable