Vnano System Plug-in Group
(org.vcssl.nano.plugin.system package)
Abstract
Plug-ins in this package/subpackages provide basic features available in scripts of the Vnano (VCSSL nano), e.g.: I/O features, utility features, and so on.
Features provided by these plug-ins is a subset of the VCSSL System Library which is a standard library of the VCSSL,
so same features are also available in scripts of the VCSSL by default.
List of Provided Plug-ins and Features
- SystemEnvironmentXnci1Plugin
-
Provides environment-related variables.
Variables: EOL / LF / CR
- SystemDataTypeXnci1Plugin
-
Provides data-type-utility functions/variables.
Variables: INT_MAX / INT_MIN / FLOAT_MAX / FLOAT_MIN_ABS_NORMAL / FLOAT_MIN_ABS_DENORMAL / NAN / INF
Functions: nan(value) / inf(value) / length(array, dimIndex) / rank(array)
- SystemTerminalIOXnci1Plugin
-
Provides I/O functions from/to the terminal.
Functions: print(...) / println(...)
- SystemUserIOXnci1Plugin
-
Provides interactive I/O functions from/to the user.
Functions: popup(message) / alert(message) / confirm(message) / input(message) / input(message, defaultValue)
- SystemTimeXnci1Plugin
-
Provides time-utility functions.
Functions: time() / sleep(sleepTime)
- SystemTerminationXnci1Plugin
-
Provides functions for terminating scripts.
Functions: exit() / exit(exitStatusCode) / error(errorMessage)
- SystemTestXnci1Plugin
-
Provides utility functions for testing.
Functions: assert(expectedCondition)
License
All of the above plug-ins are released under CC0.
SystemEnvironmentXnci1Plugin
(org.vcssl.nano.plugin.system.xnci1.SystemEnvironmentXnci1Plugin)
The plug-in providing environment-related variables.
Variables
Variable |
EOL |
Value |
Storing the end-of-line code depending on environment. |
Data Type |
string (constant) |
Variable |
LF |
Value |
Storing a kind of end-of-line code "LF". |
Data Type |
string (constant) |
Variable |
CR |
Value |
Storing a kind of end-of-line code "CR". |
Data Type |
string (constant) |
SystemDataTypeXnci1Plugin
(org.vcssl.nano.plugin.system.xnci1.SystemDataTypeXnci1Plugin)
The plug-in providing data-type-utility functions/variables.
Variables
Variable |
INT_MAX |
Value |
Storing the maximum (positive) value in all representable values of "int" type. |
Data Type |
int (constant) |
Variable |
INT_MIN |
Value |
Storing the minimum (negative) value in all representable values of "int" type. |
Data Type |
int (constant) |
Variable |
FLOAT_MAX |
Value |
Storing the maximum (positive) value in all representable values of "float" type. |
Data Type |
float (constant) |
Variable |
FLOAT_MIN_ABS_NORMAL |
Value |
Storing the minimum absolute (positive, non-zero) value in all representable normal numbers of "float" type. |
Data Type |
float (constant) |
Variable |
FLOAT_MIN_ABS_DENORMAL |
Value |
Storing the minimum absolute (positive, non-zero) value in all representable numbers of "float" type containing denormal numbers. |
Data Type |
float |
Variable |
NAN |
Value |
Storing the value of "NaN". The "NaN" represents the special value as a result of invalid floating-point operations. Also, the NaN does not equal any values containing the NaN itself, so we can not check whether a value is NaN or not by comparing this value by "==" operation. For checking a value is nan or not, use nan(value) function. |
Data Type |
float (constant) |
Variable |
INF |
Value |
Storing the value of the (positive) infinity of "float" type. |
Data Type |
float (constant) |
Functions
Function |
nan(value) |
Feature |
Checks whether the passed value is the NaN or not. Not that the NaN does not equal any values containing the NaN itself, so we can not check whether a value is NaN or not by comparing this value by "==" operation. Therefore, use this function for checking it. |
Singature |
bool nan(float value) |
Params |
(float type) value: The value to be checked. |
Return |
(bool type) "true" if the passed value is the NaN, "false" if it isn't. |
Example |
print( nan(0.0/0.0) ); // true |
Function |
inf(value) |
Feature |
Checks whether the passed value is the (positive or negative) infinity. |
Singature |
bool inf(float value) |
Params |
(float type) value: The value to be checked. |
Return |
(bool type) "true" if the passed value is the (positive or negative) infinity, "false" if it isn't. |
Example |
print( inf(1.0/0.0) ); // true |
Function |
length(array, dimIndex) |
Feature |
Gets the length of the specified dimention as "dimIndex" of the specified array "array". |
Signature |
int length(any array[...], int dimIndex) |
Params |
(any type, any arrayrank) array: The array you want to get the length of it.
(int型) dimIndex: The index of the array-dimension you want to get the length on it (regarding the most left dimension as 0-th).
|
Return |
(int type) The length on the specified dimension of the specified array. |
Example |
int a[10][11][12]; println( length(a,0) ); // 10 println( length(a,1) ); // 11 println( length(a,2) ); // 12 |
Function |
arrayrank(array) |
Feature |
Gets the number of dimensions (array rank) of the specified array. |
Signature |
int arrayrank(any array[...]) |
Params |
(any type, any rank) array: The array you want to get the number of dimensions of it.
|
Return |
(int type) The number of dimensions of the specified array. |
Example |
int a[10][11][12]; print( arrayrank(a) ); // 3 |
SystemTerminalIOXnci1Plugin
(org.vcssl.nano.plugin.system.xnci1.SystemTerminalIOXnci1Plugin)
The plug-in providing I/O functions from/to the terminal.
When the option "UI_MODE" of the script engine is set to "CUI",
I/O will be performed from/to the standard input/output.
When the option "UI_MODE" of the script engine is set to "GUI",
a window like a terminal will be launched,
and I/O will be performed from/to it.
Functions
Function |
print(...) |
Feature |
Outputs values to the terminal with delimiting by spaces (tabs). |
Signature |
void print(...) |
Params |
(any data-types, any ranks, any numbers) Values to be printed. |
Return |
None |
Example |
print( "Hello", 123, 4.56, true ); // Hello 123, 4.56, true |
Function |
println(...) |
Feature |
Outputs values to the terminal with delimiting by spaces (tabs), and go to the new line on the terminal. |
Signature |
void println(...) |
Params |
(any data-types, any ranks, any numbers) Values to be printed. |
Return |
None |
Example |
println( "Hello", 123, 4.56, true ); // Hello 123, 4.56, true (line feed) |
SystemUserIOXnci1Plugin
(org.vcssl.nano.plugin.system.xnci1.SystemUserIOXnci1Plugin)
The plug-in providing interactive I/O functions from/to the user.
When the option "UI_MODE" of the script engine is set to "CUI",
I/O will be performed from/to the standard input/output.
When the option "UI_MODE" of the script engine is set to "GUI",
a pop-up window will be displayed,
and I/O will be performed interactively by user's actions on the window.
Functions
Function |
alert(message) |
Feature |
Displays a message. Compared with "popup" function, the window title, behaviour, and so on are tuned for displaying warning messages. |
Signature |
void alert(string message) |
Params |
(string type) message: The message to be displayed. |
Return |
None |
Example |
alert( "Oops" ); |
Function |
confirm(message) |
Feature |
Displays a confirmation message, and asks for the answer in the form of: Yes (y) or No (n). |
Signature |
bool confirm(string message) |
Params |
(string type) message: The message to be displayed. |
Return |
(bool type) Returns true if the user has answered "Yes" (or inputted "y" on the CUI mode). |
Example |
bool isYes = confirm( "OK?" ); |
SystemTimeXnci1Plugin
(org.vcssl.nano.plugin.system.xnci1.SystemTimeXnci1Plugin)
The plug-in providing time-utility functions
Functions
Function |
time() |
Feature |
Measures the elapsed time from the beginning of the execution of the current script, in the unit of millisecond. |
Signature |
int time() |
Params |
None |
Return |
(int type) The elapsed time from the beginning of the execution of the current script, in the unit of millisecond. |
Example |
int t = time(); print( t ); |
Function |
sleep(sleepTime) |
Feature |
Stops the execution of the script, during the specified time in the unit of millisecond. |
Singature |
void sleep( int sleepTime ) |
Params |
(int type) sleepTime: The time in the unit of millisecond, for which the script to be stopped. |
Return |
None |
Example |
sleep(1000); // Stops 1 second |
SystemTerminationXnci1Plugin
(org.vcssl.nano.plugin.system.xnci1.SystemTerminationXnci1Plugin)
The plug-in providing functions for terminating scripts
Functions
Function |
exit() |
Feature |
Terminates the execution of the script without generating errors. |
Signature |
void exit() |
Parameters |
None |
Return |
None |
Example |
exit(); |
Function |
exit(exitStatusCode) |
Feature |
Terminates the execution of the script without generating errors, with specifying the exit status code. |
Signature |
void exit(int exitStatusCode) |
Params |
(int type) exitStatusCode: The exit status code (it is depends on implementations of the script engine and the host application that how it will be handled) |
Return |
None |
Example |
exit(1); |
Function |
error(errorMessage) |
Feature |
Terminates the execution of the script with generating an error having the specified message. |
Signature |
void error(string errorMessage) |
Parameters |
(string type) errorMessage: The content of the error message to be notified to the user of the script. |
Return |
None |
Example |
error( "something is wrong !" ); |
SystemTestXnci1Plugin
(org.vcssl.nano.plugin.system.xnci1.SystemTestXnci1Plugin)
The XNCI1 plug-in providing utility functions for testing.
Functions
Function |
assert(expectedCondition) |
Feature |
Do nothing if the value of the expected condition specified as an argument is "true", and generates an error if it is "false". |
Signature |
void assert( bool expectedCondition ) |
Params |
(bool type) expectedCondition: The value of the expected condition. |
Return |
None |
Example |
int x; x = 1; assert( 0 < x ); // OK x = -1; assert( 0 < x ) ; // Error |