filename.jxn
filename.jxn
in the Windows File Explorerfilename~log.jxn
or if no filename is associated with the session in ~unnamed~log.jxn
.'='
result of the previous statement'?'
diagnostic message':'
command or result output for an included jxn file (see below)#filespec
special command is needed for reconstruction therefore all included lines are prefixed with ':'
#if
... executed from the include file#if
... conditions can be enabled with: $this.setStaticShowConditional(true)
or $this.addDebug(4)
#function
... line is shown for functions defined in an included jxn file':'
lines as they will be overwritten by subsequent runs, if required rather edit the included jxn file'.'
line was not executed because of #if
... #else
... conditions'='
, '?'
or ':'
are updated, lines starting with '.'
are activated if necessary#keyword
or #filespec
are jxn special commands
#function
definitions#if
, #ifdef
, #ifndef
, ... are allowed only inside a jxn script file (or also from a JxnEditor window using the Run menu)#if
, #ifdef
, #ifndef
, ... outside
and inside #function
definitions are handled differently:#function
definitions the special commands are processed (like preprocessor directives) while reading the jxn file:#function
definition the special commands are parsed as control structures and stored internally while reading the jxn file:#filespec.jxn
#filespec.jxn
includes the given jxn file into the interactive session or the including jxn file
filespec
may be a path relative to the including jxn filefilespec.startsWith( "JXN:" )
a path relative to the JxnPortable folder e.g. #JXN:user/myScript.jxn
".jxn"
may be omitted, if filespec
does not contain blanks#filespec.jxn( arg1, arg2, ... )
#filespec_without_blanks( arg1, arg2, ... ) ! ".jxn"
may be omitted#filespec.jxn expression !
single argument without brackets for single parameter $1
$1, $2,
...#ifdef $2
or the method call $this.isDefined("$2")
$0
contains filespec
#function
definition and class JxnFunction
JxnFunction
si = @JxnFunction( $this, "x -> sin x / x" )
may be entered in the jxn input line as well as used within script files
#function ... #endfunction
special commands are limited to jxn script files but allow to define control structures
like #if ... #else ... #endif
and #while ... #endwhile
using special commands from the table below
'$'
e.g. $myVarName
defines a lokal variable accessible only
within an included jxn file or within a jxn function'$'
jxn function parameters are always local variables (possibly hiding an identically named global variable)KmgFormelInterpreter
control intermedeate steps shown during jxn script file processing:$this.setDebug(…)
is called on the predefined instance $this
and controls the output for the given jxn fileKmgFormelInterpreter.setStaticShowConditional(…)
controls the output uniformly for all jxn filesJxnFunction
control intermedeate steps shown during #function
execution:function_name.setDebug(…)
is called on the JxnFunction
instance and controls the output of the function';'
to suppress result outputjxn special command (syntax) | allowed in | description | ||
input field (interactive) | jxn file or from JxnEditor | #function definition | ||
#edit | yes | no | no | copies the output list of the JxnSession into a new JxnEditor window (same as menu: File > Edit… in the JxnSession window) shows the result of command in a new JxnEditor window e.g. #edit Color.class.getMethods() |
#reinit | yes | no | no | resets the jxn session (same as menu: File > New in JxnSession window) |
#exit | yes | no | no | terminates jxn (same as menu: File > Exit or [x] in JxnSession window) |
#filespec[.jxn] | yes | yes | no | includes jxn file (".jxn" may be omitted for filespec without blanks) - … with arguments for parameters $1, $2, ... used inside the included file- single argument without brackets for parameter $1 |
#this(...) | deprecated | deprecated | no | continues processing from the top of the current jxn file ((must use #ifdef $1 … #return to prevent an infinite loop!)) |
#remove variable_name | yes | yes | no | forgets variable |
#import package_path | yes | yes | no | adds package or class to list searched for classes |
#remove package package_path | removes package or class from list searched for classes Note: #remove without the keyword package may,unintendedly forget a variable named class_name .#remove package class_name only removes a class defined by #import | |||
#import static class_name | yes | yes | no | adds class to list of classes searched for static methods (other than java jxn does not support single static method names here) |
#remove static class_name | removes class from list of classes searched for static methods | |||
#function function_name | no | yes | no | start of function definition (see class JxnFunction) - without parameters (no arguments expected) - … with named parameters |
#endfunction | end of function definition (required) | |||
… function_name() … | yes | yes | yes | jxn function call - … with arguments for the defined parameters - with single argument without brackets for a single parameter |
#if statement | no | yes | yes | start of if structure: lines after the #if are executed, if statement is true or not 0 or not null or a char from 1TtYy |
#else if statement | (optional) | |||
#else | (optional) | |||
#endif | end of if structure (required) | |||
#while statement | no | inside function | yes | start of while loop: lines in the loop are executed, while statement is true or ... see #if |
#break | exits from the current loop (optional) | |||
#continue | skips the rest of the current loop and continues with #while … (optional, be aware of infinite loop!) | |||
#endwhile | end of while loop (required) | |||
#return | no | yes | yes | returns from the current jxn file or function |
#return statement | no | inside function | yes | returns the result of statement from the function |