System Library


Abstract

The VCSSL System library is a standard library providing fundamental functions that are essential for general use.

The System library is automatically loaded by the implementation before the target VCSSL program itself is loaded.For this reason, the System library can exceptionally be used without import.

The reason why this exceptional treatment is applied is thatthe functions provided by the System library are used far more frequently than those of the other standard libraries.The System library does not collect functions for a specific field in the way other standard libraries do.Instead, it collects functions that are expected to be used particularly frequently in general usage regardless of field.Probably, the functions provided by the System library are essential in almost all VCSSL programs.Conversely, VCSSL is designed so that even only the functions provided by the System library, that is, without explicitly importing other standard libraries,can cover a certain practical range as a simple scripting language.

Specific examples of functions in the System library include basic operations and conversions for variables and arrays,input and output with the user, file input and output, simple interaction with the file system,and execution of operating-system commands.Some of these also have more advanced and complex counterparts provided by standard libraries specialized for each field.The design concept of standard libraries in VCSSL assumes that, for simple uses, the functions of the System library are used by default,and when those are insufficient, specialized libraries are imported and used as needed.

In the System library, the naming rules of identifiers are also somewhat different from those of the other standard libraries, as an exception prioritizing convenience in simple use cases.In principle, identifiers in VCSSL standard libraries are named in lower camel case without abbreviating English words.However, in the System library, many abbreviated identifier names are adopted, shortening English words to reduce typing and supplementing meaning with prefixes or suffixes when necessary.


Index

const string VER
Represents the VCSSL version code supported by the implementation.
const string REV
Represents the development revision code of the implementation.
const complex I
The imaginary unit of the complex type.
const varcomplex VCI
The imaginary unit of the varcomplex type.
const float INF
The Inf, that is, infinity, value of the float type.
const float NAN
The NaN, that is, not-a-number, value of the float type. Note that NaN is not equal to any value. In other words, comparisons such as value == NAN cannot be used to determine whether a variable value is NaN. To test for NaN, use the nan function.
const float FLOAT_MAX
The maximum value of the float type.
const float FLOAT_MIN_ABS_NORMAL
The smallest non-zero positive value representable by the float type within the range of normalized numbers.
const float FLOAT_MIN_ABS_DENORMAL
The smallest non-zero positive value representable by the float type including the range of denormalized numbers.
const float FLOAT_MIN
Equivalent to FLOAT_MIN_ABS_DENORMAL.Because this shorter name is somewhat ambiguous in meaning and specification, use of the more explicit namesFLOAT_MIN_ABS_DENORMAL orFLOAT_MIN_ABS_NORMAL is generally recommended.
const int INT_MAX
The maximum value of the int type.
const int INT_MIN
The minimum value of the int type.
const string EOL
The environment-dependent newline code. It stores the value appropriate for the current environment, such as CR, LF, or CR+LF.
const string CR
The newline code CR, that is, 0x0D.
const string LF
The newline code LF, that is, 0x0A.
const string OS
A string for roughly distinguishing the type or generation of the operating system in the execution environment, usually the OS name. Note that numbers representing generations in product branding are often included in this OS name rather than treated as version numbers.
const string OSVER
A string useful as a reference when distinguishing the generation of the operating system in the execution environment, specifically information such as the OS development or internal version. Note that it may differ from the version used in product information for general users.
const string READ
The file input/output mode for reading. It is used by the open function.
const string WRITE
The file input/output mode for writing. It is used by the open function.
const string APPEND
The file input/output mode for append writing. It is used by the open function.
const string READ_TSV
The file input/output mode for TSV reading. It is used by the open function.
const string WRITE_TSV
The file input/output mode for TSV writing. It is used by the open function.
const string APPEND_TSV
The file input/output mode for TSV append writing. It is used by the open function.
const string READ_CSV
The file input/output mode for CSV reading. It is used by the open function.
const string WRITE_CSV
The file input/output mode for CSV writing. It is used by the open function.
const string APPEND_CSV
The file input/output mode for CSV append writing. It is used by the open function.
const string READ_BINARY
The file input/output mode for binary reading. It is used by the open function.
const string WRITE_BINARY
The file input/output mode for binary writing. It is used by the open function.
const string APPEND_BINARY
The file input/output mode for binary append writing. It is used by the open function.
const string STDIN
A special file path for using file input/output functions with standard input.
const string STDOUT
A special file path for using file input/output functions with standard output.
const string STDERR
A special file path for using file input/output functions with standard error output.
const int UP
A rounding mode that performs upward rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
const int UP_SIGNIF
A rounding mode that performs upward rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "UP" before VCSSL 3.3.
const int DOWN
A rounding mode that performs downward rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
const int DOWN_SIGNIF
A rounding mode that performs downward rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "DOWN" before VCSSL 3.3.
const int HALF_UP
A rounding mode that performs half-up rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
const int HALF_UP_SIGNIF
A rounding mode that performs half-up rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "HALF_UP" before VCSSL 3.3.
const int HALF_DOWN
A rounding mode that performs half-down rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
const int HALF_DOWN_SIGNIF
A rounding mode that performs half-down rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "HALF_DOWN" before VCSSL 3.3.
const int HALF_TO_EVEN
A rounding mode that performs half-to-even rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
const int HALF_TO_EVEN_SIGNIF
A rounding mode that performs half-to-even rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "HALF_EVEN" before VCSSL 3.3.
macro print(...)
Outputs strings to the console. The arguments may be of any type and are automatically converted to strings.If multiple arguments are specified, how they are formatted in the output depends on the implementation.Normally, they will probably be output separated by spaces.
macro println(...)
Outputs strings to the console and then outputs a newline. The arguments may be of any type and are automatically converted to strings.If multiple arguments are specified, how they are formatted in the output depends on the implementation.Normally, they will probably be output separated by spaces.
macro output(...)
Outputs strings to the area for displaying the processing result of the program.The arguments may be of any type and are automatically converted to strings.If multiple arguments are specified, how they are formatted in the output depends on the implementation.Normally, they will probably be output separated by spaces.
macro input(...)
Accepts an arbitrary string input from the user.The arguments may be of any type and are automatically converted to strings and displayed as the message of the input field.If multiple arguments are specified, how they are displayed depends on the implementation.Normally, they will probably be displayed separated by newlines.Note that the last argument is used as the default value of the input field.
macro select(...)
Presents choices to the user and obtains the selected item.The arguments may be of any type and are automatically converted to strings and displayed as the choices.
macro alert(...)
Outputs a message to an alert window and waits until the user acknowledges it.If multiple arguments are specified, how they are displayed depends on the implementation.Normally, they will probably be displayed separated by newlines.For output of messages without a warning intention, the popup function with nearly the same function is available since VCSSL 3.4.From now on, alert is recommended for messages intended as warnings.
macro popup(...)
Outputs a message to a popup window and waits until the user acknowledges it.If multiple arguments are specified, how they are displayed depends on the implementation.Normally, they will probably be displayed separated by newlines.At present, this function behaves exactly the same as alert, but it was newly supported since VCSSL 3.4 for outputting messages without a warning intention.By distinguishing it from alert, it becomes clear in code whether the displayed message is intended as a warning or as a normal message.In the future, the display icon on the window and so on may become different from alert.
macro pop(...)
Equivalent to the popup function.This function had the same name as the pop function of the data.Stack library,so the popup function with the same behavior was added later for cases where it is desirable to make it easier to see in code which one is being called.Note that the pop function of the Stack library has type parameters, and in current VCSSL those type parameters cannot be omitted,so there is at least currently no possibility of a signature conflict with this function.This function is supported for compatibility and can continue to be used,but to avoid confusion as much as possible, it is recommended to prefer popup unless there is a special reason not to.
macro confirm(...)
Outputs a message and presents the user with the two choices of acceptance or rejection.If multiple arguments are specified, how they are displayed depends on the implementation.Normally, they will probably be displayed separated by newlines.
string[ ] choose()
Presents the user with a file selection dialog and waits until a file is selected.
string[ ] choose(string message)
Presents the user with a file selection dialog and waits until a file is selected.
string[ ] choose(string message, string directory)
Presents the user with a file selection dialog and waits until a file is selected.
void beep()
Sounds a beep. However, whether it can actually be sounded depends on the environment.In some cases, a sound other than a beep, such as an operating-system warning sound, may be played.
void beep(int repeat)
Sounds a beep. However, whether it can actually be sounded depends on the environment.In some cases, a sound other than a beep, such as an operating-system warning sound, may be played.
void beep(int repeat, int wait)
Sounds a beep. However, whether it can actually be sounded depends on the environment.In some cases, a sound other than a beep, such as an operating-system warning sound, may be played.
void clear()
Clears the contents of the console. However, the behavior of this function depends on the implementation.For example, when console contents are displayed in a window attached to the implementation, the result will probably be as expected.However, in an implementation based only on standard input and output without a console window, it will probably do nothing.
void hide()
Hides the console. However, the behavior of this function depends on the implementation.For example, when console contents are displayed in a window attached to the implementation, the result will probably be as expected.However, in an implementation based only on standard input and output without a console window, it will probably do nothing.
void show()
Shows the console if it has been hidden. However, the behavior of this function depends on the implementation.For example, when console contents are displayed in a window attached to the implementation, the result will probably be as expected.However, in an implementation based only on standard input and output without a console window, it will probably do nothing.
int time()
Returns the elapsed time since the start of program execution, in milliseconds.
macro sleep(int milliSecond)
Suspends execution of the program temporarily.
void exit()
Ends execution of the program.Note that this function requests termination of the program to the implementation, and it does not necessarily guarantee that execution will end immediately.The ideal timing for calling this function is when the implementation is in an idle state, such as at the final line of the program after leaving all loops and branches.If this function is called while the implementation is performing high-speed processing, it can become close to a forced termination.Details depend on the implementation and its optimization policy, but when this function is called, the implementation may be in the middle of a sequence of operations that cannot be interrupted immediately.In that case, a time lag may occur and execution may continue for a short while even after the call.
void exit(int code)
Ends execution of the program with a specified exit status code.Note that this function requests termination of the program to the implementation, and it does not necessarily guarantee that execution will end immediately.The ideal timing for calling this function is when the implementation is in an idle state, such as at the final line of the program after leaving all loops and branches.If this function is called while the implementation is performing high-speed processing, it can become close to a forced termination.Details depend on the implementation and its optimization policy, but when this function is called, the implementation may be in the middle of a sequence of operations that cannot be interrupted immediately.In that case, a time lag may occur and execution may continue for a short while even after the call.
void reset(string programName, string args[ ])
Resets the implementation and executes another program.
macro error(...)
Outputs an error message.After outputting the error message, whether program execution ends or continues depends on the implementation.If you want to ensure termination, call exit afterward.
macro assert(bool expectedCondition)
Evaluates the value of an expression, does nothing if it is true, and outputs an error message if it is false.Program execution will probably be terminated. This function is used for testing.
macro exec(...)
Executes an operating-system command or an external program asynchronously in another process.Execution of the calling program does not wait for completion of the process. It continues in parallel with the created process.If you want to wait for execution to finish or control standard input and output, use the Process library.
macro system(...)
Executes an operating-system command or an external program synchronously.Execution of the calling program waits until the process completes.
macro alloc(...)
Changes the number of elements of an array.Elements at the same indices keep the same values before and after the change.
macro free(...)
Sets the number of elements of all dimensions of an array to 0.
bool exists(string filePath)
Checks whether a file exists.
void mkdir(string directoryPath)
Creates a new directory, that is, a folder. If the directory already exists, nothing is done.
bool isdir(string filePath)
Checks whether a file is a directory.
string[ ] listdir(string directoryPath)
Returns the list of file names in a directory.
macro rank(...)
Returns the number of dimensions of an array.For example, for an array a[11][28][32], rank(a) is 3.
macro length(...)
Returns the number of elements of an array. The second argument specifies the dimension whose element count is to be obtained, as an index counted from the left as 0, 1, 2, and so on.For example, for an array a[11][28][32], length(a, 0) is 11, length(a, 1) is 28, and length(a, 2) is 32.
bool nan( float value )
Determines whether a float variable or value is NaN, that is, not a number.
bool inf( float value )
Determines whether a float variable or value is Inf, that is, infinity.
string bin( int number )
Returns a string representing an int variable or value in binary. The prefix 0b is added at the beginning.
string oct( int number )
Returns a string representing an int variable or value in octal. The prefix 0 is added at the beginning.
string hex( int number )
Returns a string representing an int variable or value in hexadecimal. The prefix 0x is added at the beginning.
macro digit(arg)
Specifies the number of operation digits for the varfloat type or the varcomplex type.
macro digit()
Gets the number of operation digits for the varfloat type or the varcomplex type.
float round(float value, int digit, int mode)
Rounds a float value to the specified number of digits in the specified mode.Note that float values are stored internally as binary floating-point data, while rounding is performed on a decimal basis, so care is required regarding binary-decimal conversion errors.In general, conversions between binary and decimal floating-point numbers may not fit into a finite number of digits, and small errors may occur.Therefore, the internal data of a float value may differ slightly from the value you imagine in decimal notation.Accordingly, if the target value is very close to the rounding boundary, the result may appear strange at first glance, although it is internally correct.Also, the relationship between the result of this function and the result obtained when converting a float value to a string or displaying it with the print function may sometimes seem strange,but this is because implicit rounding is also performed internally in the latter case. If you want to apply additional rounding to that displayed result, convert the argument value to string before passing it.
string round(string value, int digit, int mode)
Interprets the contents of a string value as a number, and rounds it to the specified number of digits in the specified mode.This function is used when you want to apply additional rounding based on the same content that is obtained when a float value is converted to a string or displayed by the print function,where implicit rounding is performed internally. Compared with rounding a float value directly, the effect of binary-decimal conversion errors may differ slightly.For details, refer to the description for the case where the argument value is of float type.
complex round(complex value, int digit, int mode)
Rounds a complex value to the specified number of digits in the specified mode.Note that the real and imaginary parts of a complex value are stored internally as binary floating-point data, while rounding is performed on a decimal basis, so care is required regarding binary-decimal conversion errors.For details, refer to the description for the case where the argument value is of float type.
varfloat round(varfloat value, varint digit, int mode)
Rounds a varfloat value to the specified number of digits in the specified mode.
varcomplex round(varcomplex value, varint digit, int mode)
Rounds a varcomplex value to the specified number of digits in the specified mode.
void round(int mode)
Specifies the default rounding mode for calculations on varfloat and varcomplex values.Note that rounding control for varfloat and varcomplex values, and the implementation of this function, are currently introduced on an experimental basis.At present, it is not always guaranteed that rounding control will be performed exactly as specified for all operations.Be sure to verify the behavior in advance before using it.Rounding control for varfloat and varcomplex values, and the implementation of this round function, are planned to be officially introduced in VCSSL 4 or later after this trial period.
float re( complex value )
Returns the real part of a complex value.
float im( complex value )
Returns the imaginary part of a complex value.
void re( complex value, float realValue )
Sets the real part of a complex value.
void im( complex value, float imagValue )
Sets the imaginary part of a complex value.
varfloat re( varcomplex value )
Returns the real part of a varcomplex value.
varfloat im( varcomplex value )
Returns the imaginary part of a varcomplex value.
void re( varcomplex value, varfloat realValue )
Sets the real part of a varcomplex value.
void im( varcomplex value, varfloat imagValue )
Sets the imaginary part of a varcomplex value.
macro save(string filePath, content)
A simple file output function. Saves the contents held by a string variable to a file.
void save(string filePath)
A simple file output function. Saves the contents currently displayed on the console to a file. However, the behavior of this function depends on the implementation.For example, if the console contents are displayed in a window provided by the implementation, you will probably get the expected result.However, in a standard-input/output-based implementation that has no console window, this function will probably do nothing.
string load(string filePath)
A simple file input function. Reads the entire contents of a file and returns them as a string. The file is closed automatically after reading.
string load()
A simple file input function. Obtains the contents currently displayed on the console and returns them as a string. However, the behavior of this function depends on the implementation.For example, if the console contents are displayed in a window provided by the implementation, you will probably get the expected result.However, in a standard-input/output-based implementation that has no console window, this function will probably obtain nothing.
int open(string filePath, string mode)
Opens a file, assigns and returns a unique identifier for it, called a file ID.Normally, specify a file name or path for the argument filePath,but you can also specify STDIN, STDOUT, or STDERR to read from or write to the standard input/output streams instead.
int open(string filePath, string mode, string textEncoding)
Opens a file, assigns and returns a unique identifier for it, called a file ID.Normally, specify a file name or path for the argument filePath,but you can also specify STDIN, STDOUT, or STDERR to read from or write to the standard input/output streams instead.
macro openw(...)
This function belongs to the VCSSL 1.0 generation, and opens a file with the same behavior as open( filePath, "wtsv" ). This function is supported for compatibility.
macro opencsvw(...)
This function belongs to the VCSSL 1.0 generation, and opens a file with the same behavior as open( filePath, "wcsv" ). This function is supported for compatibility.
macro openr(...)
This function belongs to the VCSSL 1.0 generation, and opens a file with the same behavior as open( filePath, "rtsv" ). This function is supported for compatibility.
macro opencsvr(...)
This function belongs to the VCSSL 1.0 generation, and opens a file with the same behavior as open( filePath, "rcsv" ). This function is supported for compatibility.
void close(int fileID)
Closes a file. All buffered output is flushed at that time.
void flush(int fileID)
Flushes buffered output for a file.
macro write(int fileID, ...)
Writes content to a file. The content may be of any type, and it is converted to a string when written.If multiple pieces of content are specified, how they are written depends on the file I/O mode. In "w" or WRITE mode : The written contents are concatenated as they are. , In "wtsv" or WRITE_TSV mode : The written contents are concatenated with tab separators. , In "wcsv" or WRITE_CSV mode : The written contents are concatenated with comma separators. , Note that this function inserted a line break in VCSSL 2.1 and earlier, but does not insert one in VCSSL 2.2 and later. The behavior with a line break is provided by the writeln function.
macro writeln(int fileID, ...)
Writes content to a file and then inserts a line break. The content may be of any type, and it is converted to a string when written.If multiple pieces of content are specified, how they are written depends on the file I/O mode. In "w" or WRITE mode : The written contents are concatenated as they are. , In "wtsv" or WRITE_TSV mode : The written contents are concatenated with tab separators. , In "wcsv" or WRITE_CSV mode : The written contents are concatenated with comma separators. , The line break code is automatically chosen appropriately for the execution environment.If you want to use a specific line break code such as LF or CR,use the write function instead of this function,and write the content with LF or CR appended to it.
string[ ] read(int fileID)
Reads the entire contents of a file.The return value is a string array, and how the read contents are stored in it depends on the file I/O mode. In "r" or READ mode : The entire contents of the file are returned as a string array with one element. , In "rtsv" or READ_TSV mode : The contents of the file are returned in a string array separated by whitespace and line breaks. Tab characters and half-width spaces are treated as the same. , In "rcsv" or READ_CSV mode : The contents of the file are returned in a string array separated by commas and line breaks. , In CSV and TSV reading, enclosures and delimiters are not interpreted, and the contents are simply split at the positions where separator characters exist. Also, in TSV, tab characters and half-width spaces are not distinguished.If you want to control this behavior more strictly, use the file.TextFile library.Note that this function read data line by line in VCSSL 2.1 and earlier, but was changed in VCSSL 2.2 and later to read the entire contents. The old line-by-line behavior is provided by the readln function.
string[ ] readln(int fileID)
Reads one line of content from a file.The return value is a string array, and how the read contents are stored in it depends on the file I/O mode. In "r" or READ mode : The line contents are returned as a string array with one element. , In "rtsv" or READ_TSV mode : The line contents are returned in a string array separated by whitespace. Tab characters and half-width spaces are treated as the same. , In "rcsv" or READ_CSV mode : The line contents are returned in a string array separated by commas. , In CSV and TSV reading, enclosures and delimiters are not interpreted, and the contents are simply split at the positions where separator characters exist. Also, in TSV, tab characters and half-width spaces are not distinguished.If you want to control this behavior more strictly, use the file.TextFile library.
string load(int fileID)
Reads the entire contents of a file and returns them as a string.
string loadln(int fileID)
Reads an entire line from a file and returns it as a string.
int countln(int fileID)
Counts the number of lines in a file.
macro eval(string expression)
Evaluates a string as an expression. Variables and functions can also be accessed within lexical scope, and assignments can be performed as well.The value of the expression is returned after being converted to a string array (if the value of the expression is non-array, the returned array has one element).A string array is the type with the greatest conversion flexibility, and can be assigned to arrays and non-arrays of any primitive type (assignment to a non-array is possible only when the number of elements is one).On the other hand, if you want to evaluate expressions repeatedly at high speed, especially when the return value is of int or float type, type conversion through strings can become a bottleneck.In such cases, you can avoid that bottleneck by assigning the result to a variable within the evaluated expression and discarding the return value instead of using it.
macro eval(string expression, literalType)
Evaluates a string as an expression. Unlike the eval function with one argument, this version lets you specify how numeric literals without explicit suffixes are interpreted.For example, the expression "1 / 2" is normally treated as division between int values, so the result is 0. If you want it to be treated as division between float values and obtain 0.5, specify a float value such as 0.0 as the second argument.Note that only the type of the second argument is meaningful, and its value is ignored (however, since some meaning may be added to it in the future, it is recommended to specify 0 or 0.0 unless you have a particular reason not to).
macro feval(string expression)
Evaluates a string as an expression, and returns the value as a non-array float.
macro feval(string expression, literalType)
Evaluates a string as an expression, and returns the value as a non-array float.
macro ieval(string expression)
Evaluates a string as an expression, and returns the value as a non-array int.
macro ieval(string expression, literalType)
Evaluates a string as an expression, and returns the value as a non-array int.
macro ceval(string expression)
Evaluates a string as an expression, and returns the value as a non-array complex.
macro ceval(string expression, literalType)
Evaluates a string as an expression, and returns the value as a non-array complex.
macro beval(string expression)
Evaluates a string as an expression, and returns the value as a non-array bool.
macro beval(string expression, literalType)
Evaluates a string as an expression, and returns the value as a non-array bool.
macro seval(string expression)
Evaluates a string as an expression, and returns the value as a non-array string.
macro seval(string expression, literalType)
Evaluates a string as an expression, and returns the value as a non-array string.
macro vfeval(string expression)
Evaluates a string as an expression, and returns the value as a non-array varfloat.
macro vfeval(string expression, literalType)
Evaluates a string as an expression, and returns the value as a non-array varfloat.
macro vieval(string expression)
Evaluates a string as an expression, and returns the value as a non-array varint.
macro vieval(string expression, literalType)
Evaluates a string as an expression, and returns the value as a non-array varint.
macro vceval(string expression)
Evaluates a string as an expression, and returns the value as a non-array varcomplex.
macro vceval(string expression, literalType)
Evaluates a string as an expression, and returns the value as a non-array varcomplex.
macro evaluable(string expression)
Determines whether the contents of an expression are syntactically correct.If the eval function fails in parsing, processing speed decreases, so if you want to evaluate an expression repeatedly at high speed, it is recommended to check its validity in advance with this function.
macro evaluable(string expression, literalType)
Determines whether the contents of an expression are syntactically correct.If the eval function fails in parsing, processing speed decreases, so if you want to evaluate an expression repeatedly at high speed, it is recommended to check its validity in advance with this function.
macro evaltr(string expression)
Evaluates a string as an expression, and returns internal processing information of the implementation. The contents are completely implementation-dependent.Note that the expressions that can be used are subject to implementation-dependent restrictions, and the returned contents do not necessarily correspond exactly to those of normal expression evaluation.In addition, this function generally cannot be used with expressions that have side effects. This function is mainly intended for development and debugging.
macro evaltr(string expression, literalType)
Evaluates a string as an expression, and returns internal processing information of the implementation. The contents are completely implementation-dependent.Note that the expressions that can be used are subject to implementation-dependent restrictions, and the returned contents do not necessarily correspond exactly to those of normal expression evaluation.In addition, this function generally cannot be used with expressions that have side effects. This function is mainly intended for development and debugging.
macro override(string functionName, string argumentType[ ], string functionCode)
Changes the implementation of a function at runtime.Since the eval function cannot declare local variables or execute multiple statements, use this function when you want to perform such processing by dynamic evaluation.Note that this function can only change the implementation of an existing function, and cannot declare a new function.
string lf()
Returns the environment-dependent line break code. In VCSSL 3 and later, the constant EOL can be used directly as the line break code.This function wastes the overhead of a function call. In new programs, using the constant EOL is recommended.This function is supported for compatibility.
string linefeed()
Returns the environment-dependent line break code. In VCSSL 3 and later, the constant EOL can be used directly as the line break code.This function wastes the overhead of a function call. In new programs, using the constant EOL is recommended.This function is supported for compatibility.

Event Handlers

void main( )
This is the so-called main function.It is called automatically after processing of the global scope in all modules(for example, initialization of global constants) has been completed.If main functions exist in multiple modules, only the one defined lastaccording to the module loading order is called (this differs from ordinary event handlers).
void main( string args[ ] )
This is the so-called main function.It is called automatically after processing of the global scope in all modules(for example, initialization of global constants) has been completed.If main functions exist in multiple modules, only the one defined lastaccording to the module loading order is called (this differs from ordinary event handlers).

Structs

- None -


Variables

Name VER
Declaration const string VER
Description Represents the VCSSL version code supported by the implementation.
Name REV
Declaration const string REV
Description Represents the development revision code of the implementation.
Name I
Declaration const complex I
Description The imaginary unit of the complex type.
Name VCI
Declaration const varcomplex VCI
Description The imaginary unit of the varcomplex type.
Name INF
Declaration const float INF
Description The Inf, that is, infinity, value of the float type.
Name NAN
Declaration const float NAN
Description The NaN, that is, not-a-number, value of the float type. Note that NaN is not equal to any value. In other words, comparisons such as value == NAN cannot be used to determine whether a variable value is NaN. To test for NaN, use the nan function.
Name FLOAT_MAX
Declaration const float FLOAT_MAX
Description The maximum value of the float type.
Name FLOAT_MIN_ABS_NORMAL
Declaration const float FLOAT_MIN_ABS_NORMAL
Description The smallest non-zero positive value representable by the float type within the range of normalized numbers.
Name FLOAT_MIN_ABS_DENORMAL
Declaration const float FLOAT_MIN_ABS_DENORMAL
Description The smallest non-zero positive value representable by the float type including the range of denormalized numbers.
Name FLOAT_MIN
Declaration const float FLOAT_MIN
Description Equivalent to FLOAT_MIN_ABS_DENORMAL.Because this shorter name is somewhat ambiguous in meaning and specification, use of the more explicit namesFLOAT_MIN_ABS_DENORMAL orFLOAT_MIN_ABS_NORMAL is generally recommended.
Name INT_MAX
Declaration const int INT_MAX
Description The maximum value of the int type.
Name INT_MIN
Declaration const int INT_MIN
Description The minimum value of the int type.
Name EOL
Declaration const string EOL
Description The environment-dependent newline code. It stores the value appropriate for the current environment, such as CR, LF, or CR+LF.
Name CR
Declaration const string CR
Description The newline code CR, that is, 0x0D.
Name LF
Declaration const string LF
Description The newline code LF, that is, 0x0A.
Name OS
Declaration const string OS
Description A string for roughly distinguishing the type or generation of the operating system in the execution environment, usually the OS name. Note that numbers representing generations in product branding are often included in this OS name rather than treated as version numbers.
Name OSVER
Declaration const string OSVER
Description A string useful as a reference when distinguishing the generation of the operating system in the execution environment, specifically information such as the OS development or internal version. Note that it may differ from the version used in product information for general users.
Name READ
Declaration const string READ
Description The file input/output mode for reading. It is used by the open function.
Name WRITE
Declaration const string WRITE
Description The file input/output mode for writing. It is used by the open function.
Name APPEND
Declaration const string APPEND
Description The file input/output mode for append writing. It is used by the open function.
Name READ_TSV
Declaration const string READ_TSV
Description The file input/output mode for TSV reading. It is used by the open function.
Name WRITE_TSV
Declaration const string WRITE_TSV
Description The file input/output mode for TSV writing. It is used by the open function.
Name APPEND_TSV
Declaration const string APPEND_TSV
Description The file input/output mode for TSV append writing. It is used by the open function.
Name READ_CSV
Declaration const string READ_CSV
Description The file input/output mode for CSV reading. It is used by the open function.
Name WRITE_CSV
Declaration const string WRITE_CSV
Description The file input/output mode for CSV writing. It is used by the open function.
Name APPEND_CSV
Declaration const string APPEND_CSV
Description The file input/output mode for CSV append writing. It is used by the open function.
Name READ_BINARY
Declaration const string READ_BINARY
Description The file input/output mode for binary reading. It is used by the open function.
Name WRITE_BINARY
Declaration const string WRITE_BINARY
Description The file input/output mode for binary writing. It is used by the open function.
Name APPEND_BINARY
Declaration const string APPEND_BINARY
Description The file input/output mode for binary append writing. It is used by the open function.
Name STDIN
Declaration const string STDIN
Description A special file path for using file input/output functions with standard input.
Name STDOUT
Declaration const string STDOUT
Description A special file path for using file input/output functions with standard output.
Name STDERR
Declaration const string STDERR
Description A special file path for using file input/output functions with standard error output.
Name UP
Declaration const int UP
Description A rounding mode that performs upward rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
Name UP_SIGNIF
Declaration const int UP_SIGNIF
Description A rounding mode that performs upward rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "UP" before VCSSL 3.3.
Name DOWN
Declaration const int DOWN
Description A rounding mode that performs downward rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
Name DOWN_SIGNIF
Declaration const int DOWN_SIGNIF
Description A rounding mode that performs downward rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "DOWN" before VCSSL 3.3.
Name HALF_UP
Declaration const int HALF_UP
Description A rounding mode that performs half-up rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
Name HALF_UP_SIGNIF
Declaration const int HALF_UP_SIGNIF
Description A rounding mode that performs half-up rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "HALF_UP" before VCSSL 3.3.
Name HALF_DOWN
Declaration const int HALF_DOWN
Description A rounding mode that performs half-down rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
Name HALF_DOWN_SIGNIF
Declaration const int HALF_DOWN_SIGNIF
Description A rounding mode that performs half-down rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "HALF_DOWN" before VCSSL 3.3.
Name HALF_TO_EVEN
Declaration const int HALF_TO_EVEN
Description A rounding mode that performs half-to-even rounding by specifying the number of digits in the fractional part relative to zero, that is, the decimal part. It is used by the round function.
Name HALF_TO_EVEN_SIGNIF
Declaration const int HALF_TO_EVEN_SIGNIF
Description A rounding mode that performs half-to-even rounding by specifying the number of digits in the significant part. It is used by the round function. This mode had been introduced experimentally as "HALF_EVEN" before VCSSL 3.3.

Functions

Name print
Declaration macro print(...)
Description Outputs strings to the console. The arguments may be of any type and are automatically converted to strings.If multiple arguments are specified, how they are formatted in the output depends on the implementation.Normally, they will probably be output separated by spaces.
Parameters ( type) ... : The contents to be output, as variable-length arguments of arbitrary types.
Name println
Declaration macro println(...)
Description Outputs strings to the console and then outputs a newline. The arguments may be of any type and are automatically converted to strings.If multiple arguments are specified, how they are formatted in the output depends on the implementation.Normally, they will probably be output separated by spaces.
Parameters ( type) ... : The contents to be output, as variable-length arguments of arbitrary types.
Name output
Declaration macro output(...)
Description Outputs strings to the area for displaying the processing result of the program.The arguments may be of any type and are automatically converted to strings.If multiple arguments are specified, how they are formatted in the output depends on the implementation.Normally, they will probably be output separated by spaces.
Parameters ( type) ... : The contents to be output, as variable-length arguments of arbitrary types.
Name input
Declaration macro input(...)
Description Accepts an arbitrary string input from the user.The arguments may be of any type and are automatically converted to strings and displayed as the message of the input field.If multiple arguments are specified, how they are displayed depends on the implementation.Normally, they will probably be displayed separated by newlines.Note that the last argument is used as the default value of the input field.
Parameters ( type) ... : The message of the input field as variable-length arguments of arbitrary types. The last argument is the default value.
Return The input value entered by the user.
Name select
Declaration macro select(...)
Description Presents choices to the user and obtains the selected item.The arguments may be of any type and are automatically converted to strings and displayed as the choices.
Parameters ( type) ... : The choices as variable-length arguments of arbitrary types.
Return The selected value.
Name alert
Declaration macro alert(...)
Description Outputs a message to an alert window and waits until the user acknowledges it.If multiple arguments are specified, how they are displayed depends on the implementation.Normally, they will probably be displayed separated by newlines.For output of messages without a warning intention, the popup function with nearly the same function is available since VCSSL 3.4.From now on, alert is recommended for messages intended as warnings.
Parameters ( type) ... : The contents of the message as variable-length arguments of arbitrary types.
Name pop
Declaration macro pop(...)
Description Equivalent to the popup function.This function had the same name as the pop function of the data.Stack library,so the popup function with the same behavior was added later for cases where it is desirable to make it easier to see in code which one is being called.Note that the pop function of the Stack library has type parameters, and in current VCSSL those type parameters cannot be omitted,so there is at least currently no possibility of a signature conflict with this function.This function is supported for compatibility and can continue to be used,but to avoid confusion as much as possible, it is recommended to prefer popup unless there is a special reason not to.
Name confirm
Declaration macro confirm(...)
Description Outputs a message and presents the user with the two choices of acceptance or rejection.If multiple arguments are specified, how they are displayed depends on the implementation.Normally, they will probably be displayed separated by newlines.
Parameters ( type) ... : The contents of the message as variable-length arguments of arbitrary types.
Return Returns true if the user accepts, or false if the user rejects.
Name choose
Declaration string[ ] choose()
Description Presents the user with a file selection dialog and waits until a file is selected.
Return (string[] type) The path of the selected file.
Name choose
Declaration string[ ] choose(string message)
Description Presents the user with a file selection dialog and waits until a file is selected.
Parameters (string type) message : The message of the file selection dialog.
Return (string[] type) The path of the selected file.
Name choose
Declaration string[ ] choose(string message, string directory)
Description Presents the user with a file selection dialog and waits until a file is selected.
Parameters (string type) message : The message of the file selection dialog.
(string type) directory : The displayed directory when the file selection dialog is opened.
Return (string[] type) The path of the selected file.
Name beep
Declaration void beep()
Description Sounds a beep. However, whether it can actually be sounded depends on the environment.In some cases, a sound other than a beep, such as an operating-system warning sound, may be played.
Return (void type)
Name beep
Declaration void beep(int repeat)
Description Sounds a beep. However, whether it can actually be sounded depends on the environment.In some cases, a sound other than a beep, such as an operating-system warning sound, may be played.
Parameters (int type) repeat : The number of times to sound it.
Return (void type)
Name beep
Declaration void beep(int repeat, int wait)
Description Sounds a beep. However, whether it can actually be sounded depends on the environment.In some cases, a sound other than a beep, such as an operating-system warning sound, may be played.
Parameters (int type) repeat : The number of times to sound it.
(int type) wait : The interval between beeps in milliseconds.
Return (void type)
Name clear
Declaration void clear()
Description Clears the contents of the console. However, the behavior of this function depends on the implementation.For example, when console contents are displayed in a window attached to the implementation, the result will probably be as expected.However, in an implementation based only on standard input and output without a console window, it will probably do nothing.
Return (void type)
Name hide
Declaration void hide()
Description Hides the console. However, the behavior of this function depends on the implementation.For example, when console contents are displayed in a window attached to the implementation, the result will probably be as expected.However, in an implementation based only on standard input and output without a console window, it will probably do nothing.
Return (void type)
Name show
Declaration void show()
Description Shows the console if it has been hidden. However, the behavior of this function depends on the implementation.For example, when console contents are displayed in a window attached to the implementation, the result will probably be as expected.However, in an implementation based only on standard input and output without a console window, it will probably do nothing.
Return (void type)
Name time
Declaration int time()
Description Returns the elapsed time since the start of program execution, in milliseconds.
Return (int type) The elapsed time since the start of program execution, in milliseconds.
Name sleep
Declaration macro sleep(int milliSecond)
Description Suspends execution of the program temporarily.
Parameters (int type) milliSecond : The time to suspend, in milliseconds.
Name exit
Declaration void exit()
Description Ends execution of the program.Note that this function requests termination of the program to the implementation, and it does not necessarily guarantee that execution will end immediately.The ideal timing for calling this function is when the implementation is in an idle state, such as at the final line of the program after leaving all loops and branches.If this function is called while the implementation is performing high-speed processing, it can become close to a forced termination.Details depend on the implementation and its optimization policy, but when this function is called, the implementation may be in the middle of a sequence of operations that cannot be interrupted immediately.In that case, a time lag may occur and execution may continue for a short while even after the call.
Return (void type)
Name exit
Declaration void exit(int code)
Description Ends execution of the program with a specified exit status code.Note that this function requests termination of the program to the implementation, and it does not necessarily guarantee that execution will end immediately.The ideal timing for calling this function is when the implementation is in an idle state, such as at the final line of the program after leaving all loops and branches.If this function is called while the implementation is performing high-speed processing, it can become close to a forced termination.Details depend on the implementation and its optimization policy, but when this function is called, the implementation may be in the middle of a sequence of operations that cannot be interrupted immediately.In that case, a time lag may occur and execution may continue for a short while even after the call.
Parameters (int type) code : The exit status code.
Return (void type)
Name reset
Declaration void reset(string programName, string args[ ])
Description Resets the implementation and executes another program.
Parameters (string type) programName : The program name or path.
(string[] type) args : The arguments passed to the main function.
Return (void type)
Name error
Declaration macro error(...)
Description Outputs an error message.After outputting the error message, whether program execution ends or continues depends on the implementation.If you want to ensure termination, call exit afterward.
Parameters ( type) ... : The error message as variable-length arguments of arbitrary types.
Name assert
Declaration macro assert(bool expectedCondition)
Description Evaluates the value of an expression, does nothing if it is true, and outputs an error message if it is false.Program execution will probably be terminated. This function is used for testing.
Parameters expression : The expression to be evaluated.
Name exec
Declaration macro exec(...)
Description Executes an operating-system command or an external program asynchronously in another process.Execution of the calling program does not wait for completion of the process. It continues in parallel with the created process.If you want to wait for execution to finish or control standard input and output, use the Process library.
Parameters The : absolute path of the command or external program as a string, followed by argument 1, argument 2, and so on as arbitrary types.
Return The identifier of the created process, that is, the process ID.
Name system
Declaration macro system(...)
Description Executes an operating-system command or an external program synchronously.Execution of the calling program waits until the process completes.
Parameters The : absolute path of the command or external program as a string, followed by argument 1, argument 2, and so on as arbitrary types.
Return The exit status code of the executed command or external program.
Name alloc
Declaration macro alloc(...)
Description Changes the number of elements of an array.Elements at the same indices keep the same values before and after the change.
Parameters The : array as an arbitrary type, followed by the number of elements of the leftmost dimension, the next dimension, and so on up to the rightmost dimension.
Name free
Declaration macro free(...)
Description Sets the number of elements of all dimensions of an array to 0.
Parameters The : array as an arbitrary type.
Name exists
Declaration bool exists(string filePath)
Description Checks whether a file exists.
Parameters (string type) filePath : The file name or path.
Return (bool type) Returns true if the file exists, or false otherwise.
Name mkdir
Declaration void mkdir(string directoryPath)
Description Creates a new directory, that is, a folder. If the directory already exists, nothing is done.
Parameters (string type) directoryPath : The directory name or path.
Return (void type)
Name isdir
Declaration bool isdir(string filePath)
Description Checks whether a file is a directory.
Parameters (string type) filePath : The file name or path of the file to be checked.
Return (bool type) Returns true if it is a directory, or false otherwise.
Name listdir
Declaration string[ ] listdir(string directoryPath)
Description Returns the list of file names in a directory.
Parameters (string type) directoryPath : The directory name or path.
Return (string[] type) The list of file names in the directory.
Name rank
Declaration macro rank(...)
Description Returns the number of dimensions of an array.For example, for an array a[11][28][32], rank(a) is 3.
Parameters ( type) ... : The array whose number of dimensions is to be obtained, as variable-length arguments of arbitrary types.
Return The number of dimensions of the array.
Name length
Declaration macro length(...)
Description Returns the number of elements of an array. The second argument specifies the dimension whose element count is to be obtained, as an index counted from the left as 0, 1, 2, and so on.For example, for an array a[11][28][32], length(a, 0) is 11, length(a, 1) is 28, and length(a, 2) is 32.
Parameters ( type) ... : The array whose element count is to be obtained and the dimension index, as variable-length arguments.
Return The number of elements of the array.
Name nan
Declaration bool nan( float value )
Description Determines whether a float variable or value is NaN, that is, not a number.
Parameters (float type) value : The variable or value to be checked.
Return (bool type) Returns true if it is NaN, or false otherwise.
Name inf
Declaration bool inf( float value )
Description Determines whether a float variable or value is Inf, that is, infinity.
Parameters (float type) value : The variable or value to be checked.
Return (bool type) Returns true if it is Inf, or false otherwise.
Name bin
Declaration string bin( int number )
Description Returns a string representing an int variable or value in binary. The prefix 0b is added at the beginning.
Parameters (int type) number : The variable or value to be represented in binary.
Return (string type) The string representing it in binary.
Name oct
Declaration string oct( int number )
Description Returns a string representing an int variable or value in octal. The prefix 0 is added at the beginning.
Parameters (int type) number : The variable or value to be represented in octal.
Return (string type) The string representing it in octal.
Name hex
Declaration string hex( int number )
Description Returns a string representing an int variable or value in hexadecimal. The prefix 0x is added at the beginning.
Parameters (int type) number : The variable or value to be represented in hexadecimal.
Return (string type) The string representing it in hexadecimal.
Name digit
Declaration macro digit(arg)
Description Specifies the number of operation digits for the varfloat type or the varcomplex type.
Parameters ( type) arg : The number of digits.
Name digit
Declaration macro digit()
Description Gets the number of operation digits for the varfloat type or the varcomplex type.
Return The number of digits.
Name round
Declaration float round(float value, int digit, int mode)
Description Rounds a float value to the specified number of digits in the specified mode.Note that float values are stored internally as binary floating-point data, while rounding is performed on a decimal basis, so care is required regarding binary-decimal conversion errors.In general, conversions between binary and decimal floating-point numbers may not fit into a finite number of digits, and small errors may occur.Therefore, the internal data of a float value may differ slightly from the value you imagine in decimal notation.Accordingly, if the target value is very close to the rounding boundary, the result may appear strange at first glance, although it is internally correct.Also, the relationship between the result of this function and the result obtained when converting a float value to a string or displaying it with the print function may sometimes seem strange,but this is because implicit rounding is also performed internally in the latter case. If you want to apply additional rounding to that displayed result, convert the argument value to string before passing it.
Parameters (float type) value : The value to be rounded.
(int type) digit : The number of digits after rounding.
(int type) mode : The rounding mode ( UP_SIGNIF, DOWN_SIGNIF, HALF_UP_SIGNIF, HALF_DOWN_SIGNIF, HALF_TO_EVEN_SIGNIF, UP, DOWN, HALF_UP, HALF_DOWN, HALF_TO_EVEN ).
Return (float type) The rounded value.
Name round
Declaration string round(string value, int digit, int mode)
Description Interprets the contents of a string value as a number, and rounds it to the specified number of digits in the specified mode.This function is used when you want to apply additional rounding based on the same content that is obtained when a float value is converted to a string or displayed by the print function,where implicit rounding is performed internally. Compared with rounding a float value directly, the effect of binary-decimal conversion errors may differ slightly.For details, refer to the description for the case where the argument value is of float type.
Parameters (string type) value : The value to be rounded.
(int type) digit : The number of digits after rounding.
(int type) mode : The rounding mode ( UP_SIGNIF, DOWN_SIGNIF, HALF_UP_SIGNIF, HALF_DOWN_SIGNIF, HALF_TO_EVEN_SIGNIF, UP, DOWN, HALF_UP, HALF_DOWN, HALF_TO_EVEN ).
Return (string type) The rounded value.
Name round
Declaration complex round(complex value, int digit, int mode)
Description Rounds a complex value to the specified number of digits in the specified mode.Note that the real and imaginary parts of a complex value are stored internally as binary floating-point data, while rounding is performed on a decimal basis, so care is required regarding binary-decimal conversion errors.For details, refer to the description for the case where the argument value is of float type.
Parameters (complex type) value : The value to be rounded.
(int type) digit : The number of digits after rounding.
(int type) mode : The rounding mode ( UP_SIGNIF, DOWN_SIGNIF, HALF_UP_SIGNIF, HALF_DOWN_SIGNIF, HALF_TO_EVEN_SIGNIF, UP, DOWN, HALF_UP, HALF_DOWN, HALF_TO_EVEN ).
Return (complex type) The rounded value.
Name round
Declaration varfloat round(varfloat value, varint digit, int mode)
Description Rounds a varfloat value to the specified number of digits in the specified mode.
Parameters (varfloat type) value : The value to be rounded.
(varint type) digit : The number of digits after rounding.
(int type) mode : The rounding mode ( UP_SIGNIF, DOWN_SIGNIF, HALF_UP_SIGNIF, HALF_DOWN_SIGNIF, HALF_TO_EVEN_SIGNIF, UP, DOWN, HALF_UP, HALF_DOWN, HALF_TO_EVEN ).
Return (varfloat type) The rounded value.
Name round
Declaration varcomplex round(varcomplex value, varint digit, int mode)
Description Rounds a varcomplex value to the specified number of digits in the specified mode.
Parameters (varcomplex type) value : The value to be rounded.
(varint type) digit : The number of digits after rounding.
Return (varcomplex type) The rounded value.
Name round
Declaration void round(int mode)
Description Specifies the default rounding mode for calculations on varfloat and varcomplex values.Note that rounding control for varfloat and varcomplex values, and the implementation of this function, are currently introduced on an experimental basis.At present, it is not always guaranteed that rounding control will be performed exactly as specified for all operations.Be sure to verify the behavior in advance before using it.Rounding control for varfloat and varcomplex values, and the implementation of this round function, are planned to be officially introduced in VCSSL 4 or later after this trial period.
Parameters (int type) mode : The rounding mode ( UP_SIGNIF, DOWN_SIGNIF, HALF_UP_SIGNIF, HALF_DOWN_SIGNIF, HALF_TO_EVEN_SIGNIF ).
Return (void type)
Name re
Declaration float re( complex value )
Description Returns the real part of a complex value.
Parameters (complex type) value : The variable or value whose real part is to be obtained.
Return (float type) The real part.
Name im
Declaration float im( complex value )
Description Returns the imaginary part of a complex value.
Parameters (complex type) value : The variable or value whose imaginary part is to be obtained.
Return (float type) The imaginary part.
Name re
Declaration void re( complex value, float realValue )
Description Sets the real part of a complex value.
Parameters (complex type) value : The variable or value whose real part is to be set.
(float type) realValue : The value of the real part.
Return (void type)
Name im
Declaration void im( complex value, float imagValue )
Description Sets the imaginary part of a complex value.
Parameters (complex type) value : The variable or value whose imaginary part is to be set.
(float type) imagValue : The value of the imaginary part.
Return (void type)
Name re
Declaration varfloat re( varcomplex value )
Description Returns the real part of a varcomplex value.
Parameters (varcomplex type) value : The variable or value whose real part is to be obtained.
Return (varfloat type) The real part.
Name im
Declaration varfloat im( varcomplex value )
Description Returns the imaginary part of a varcomplex value.
Parameters (varcomplex type) value : The variable or value whose imaginary part is to be obtained.
Return (varfloat type) The imaginary part.
Name re
Declaration void re( varcomplex value, varfloat realValue )
Description Sets the real part of a varcomplex value.
Parameters (varcomplex type) value : The variable or value whose real part is to be set.
(varfloat type) realValue : The value of the real part.
Return (void type)
Name im
Declaration void im( varcomplex value, varfloat imagValue )
Description Sets the imaginary part of a varcomplex value.
Parameters (varcomplex type) value : The variable or value whose imaginary part is to be set.
(varfloat type) imagValue : The value of the imaginary part.
Return (void type)
Name save
Declaration macro save(string filePath, content)
Description A simple file output function. Saves the contents held by a string variable to a file.
Parameters (string type) filePath : The file name or path.
( type) content : The content to be saved to the file.
Name save
Declaration void save(string filePath)
Description A simple file output function. Saves the contents currently displayed on the console to a file. However, the behavior of this function depends on the implementation.For example, if the console contents are displayed in a window provided by the implementation, you will probably get the expected result.However, in a standard-input/output-based implementation that has no console window, this function will probably do nothing.
Parameters (string type) filePath : The file name or path.
Return (void type)
Name load
Declaration string load(string filePath)
Description A simple file input function. Reads the entire contents of a file and returns them as a string. The file is closed automatically after reading.
Parameters (string type) filePath : The file name or path.
Return (string type) The loaded contents.
Name load
Declaration string load()
Description A simple file input function. Obtains the contents currently displayed on the console and returns them as a string. However, the behavior of this function depends on the implementation.For example, if the console contents are displayed in a window provided by the implementation, you will probably get the expected result.However, in a standard-input/output-based implementation that has no console window, this function will probably obtain nothing.
Return (string type) The contents obtained from the console.
Name open
Declaration int open(string filePath, string mode)
Description Opens a file, assigns and returns a unique identifier for it, called a file ID.Normally, specify a file name or path for the argument filePath,but you can also specify STDIN, STDOUT, or STDERR to read from or write to the standard input/output streams instead.
Parameters (string type) filePath : The file name or path.
(string type) mode : The file I/O mode ( "r" or READ, "w" or WRITE, "a" or APPEND, "rtsv" or READ_TSV, "wtsv" or WRITE_TSV, "atsv" or APPEND_TSV, "rcsv" or READ_CSV, "wcsv" or WRITE_CSV, "acsv" or APPEND_CSV, "rb" or READ_BINARY, "wb" or WRITE_BINARY, "ab" or APPEND_BINARY ).
Return (int type) The file ID.
Name open
Declaration int open(string filePath, string mode, string textEncoding)
Description Opens a file, assigns and returns a unique identifier for it, called a file ID.Normally, specify a file name or path for the argument filePath,but you can also specify STDIN, STDOUT, or STDERR to read from or write to the standard input/output streams instead.
Parameters (string type) filePath : The file name or path.
(string type) mode : The file I/O mode ( "r" or READ, "w" or WRITE, "a" or APPEND, "rtsv" or READ_TSV, "wtsv" or WRITE_TSV, "atsv" or APPEND_TSV, "rcsv" or READ_CSV, "wcsv" or WRITE_CSV, "acsv" or APPEND_CSV, "rb" or READ_BINARY, "wb" or WRITE_BINARY, "ab" or APPEND_BINARY ).
(string type) textEncoding : The text encoding ( "Shift_JIS", "UTF-8", or "EUC-JP" ).
Return (int type) The file ID.
Name openw
Declaration macro openw(...)
Description This function belongs to the VCSSL 1.0 generation, and opens a file with the same behavior as open( filePath, "wtsv" ). This function is supported for compatibility.
Name opencsvw
Declaration macro opencsvw(...)
Description This function belongs to the VCSSL 1.0 generation, and opens a file with the same behavior as open( filePath, "wcsv" ). This function is supported for compatibility.
Name openr
Declaration macro openr(...)
Description This function belongs to the VCSSL 1.0 generation, and opens a file with the same behavior as open( filePath, "rtsv" ). This function is supported for compatibility.
Name opencsvr
Declaration macro opencsvr(...)
Description This function belongs to the VCSSL 1.0 generation, and opens a file with the same behavior as open( filePath, "rcsv" ). This function is supported for compatibility.
Name close
Declaration void close(int fileID)
Description Closes a file. All buffered output is flushed at that time.
Parameters (int type) fileID : The file ID.
Return (void type)
Name flush
Declaration void flush(int fileID)
Description Flushes buffered output for a file.
Parameters (int type) fileID : The file ID.
Return (void type)
Name write
Declaration macro write(int fileID, ...)
Description Writes content to a file. The content may be of any type, and it is converted to a string when written.If multiple pieces of content are specified, how they are written depends on the file I/O mode.
In "w" or WRITE mode
The written contents are concatenated as they are.
In "wtsv" or WRITE_TSV mode
The written contents are concatenated with tab separators.
In "wcsv" or WRITE_CSV mode
The written contents are concatenated with comma separators.
Note that this function inserted a line break in VCSSL 2.1 and earlier, but does not insert one in VCSSL 2.2 and later. The behavior with a line break is provided by the writeln function.
Parameters (int type) fileID : The file ID.
( type) ... : The content to be written (any type, variable-length arguments).
Name writeln
Declaration macro writeln(int fileID, ...)
Description Writes content to a file and then inserts a line break. The content may be of any type, and it is converted to a string when written.If multiple pieces of content are specified, how they are written depends on the file I/O mode.
In "w" or WRITE mode
The written contents are concatenated as they are.
In "wtsv" or WRITE_TSV mode
The written contents are concatenated with tab separators.
In "wcsv" or WRITE_CSV mode
The written contents are concatenated with comma separators.
The line break code is automatically chosen appropriately for the execution environment.If you want to use a specific line break code such as LF or CR,use the write function instead of this function,and write the content with LF or CR appended to it.
Parameters (int type) fileID : The file ID.
( type) ... : The content to be written (any type, variable-length arguments).
Name read
Declaration string[ ] read(int fileID)
Description Reads the entire contents of a file.The return value is a string array, and how the read contents are stored in it depends on the file I/O mode.
In "r" or READ mode
The entire contents of the file are returned as a string array with one element.
In "rtsv" or READ_TSV mode
The contents of the file are returned in a string array separated by whitespace and line breaks. Tab characters and half-width spaces are treated as the same.
In "rcsv" or READ_CSV mode
The contents of the file are returned in a string array separated by commas and line breaks.
In CSV and TSV reading, enclosures and delimiters are not interpreted, and the contents are simply split at the positions where separator characters exist. Also, in TSV, tab characters and half-width spaces are not distinguished.If you want to control this behavior more strictly, use the file.TextFile library.Note that this function read data line by line in VCSSL 2.1 and earlier, but was changed in VCSSL 2.2 and later to read the entire contents. The old line-by-line behavior is provided by the readln function.
Parameters (int type) fileID : The file ID.
Return (string[] type) The loaded contents as a string array.
Name readln
Declaration string[ ] readln(int fileID)
Description Reads one line of content from a file.The return value is a string array, and how the read contents are stored in it depends on the file I/O mode.
In "r" or READ mode
The line contents are returned as a string array with one element.
In "rtsv" or READ_TSV mode
The line contents are returned in a string array separated by whitespace. Tab characters and half-width spaces are treated as the same.
In "rcsv" or READ_CSV mode
The line contents are returned in a string array separated by commas.
In CSV and TSV reading, enclosures and delimiters are not interpreted, and the contents are simply split at the positions where separator characters exist. Also, in TSV, tab characters and half-width spaces are not distinguished.If you want to control this behavior more strictly, use the file.TextFile library.
Parameters (int type) fileID : The file ID.
Return (string[] type) The loaded contents as a string array.
Name load
Declaration string load(int fileID)
Description Reads the entire contents of a file and returns them as a string.
Parameters (int type) fileID : The file ID.
Return (string type) The loaded contents.
Name loadln
Declaration string loadln(int fileID)
Description Reads an entire line from a file and returns it as a string.
Parameters (int type) fileID : The file ID.
Return (string type) The loaded contents.
Name countln
Declaration int countln(int fileID)
Description Counts the number of lines in a file.
Parameters (int type) fileID : The file ID.
Return (int type) The number of lines in the file.
Name eval
Declaration macro eval(string expression)
Description Evaluates a string as an expression. Variables and functions can also be accessed within lexical scope, and assignments can be performed as well.The value of the expression is returned after being converted to a string array (if the value of the expression is non-array, the returned array has one element).A string array is the type with the greatest conversion flexibility, and can be assigned to arrays and non-arrays of any primitive type (assignment to a non-array is possible only when the number of elements is one).On the other hand, if you want to evaluate expressions repeatedly at high speed, especially when the return value is of int or float type, type conversion through strings can become a bottleneck.In such cases, you can avoid that bottleneck by assigning the result to a variable within the evaluated expression and discarding the return value instead of using it.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression.
Name eval
Declaration macro eval(string expression, literalType)
Description Evaluates a string as an expression. Unlike the eval function with one argument, this version lets you specify how numeric literals without explicit suffixes are interpreted.For example, the expression "1 / 2" is normally treated as division between int values, so the result is 0. If you want it to be treated as division between float values and obtain 0.5, specify a float value such as 0.0 as the second argument.Note that only the type of the second argument is meaningful, and its value is ignored (however, since some meaning may be added to it in the future, it is recommended to specify 0 or 0.0 unless you have a particular reason not to).
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as a string array.
Name feval
Declaration macro feval(string expression)
Description Evaluates a string as an expression, and returns the value as a non-array float.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression as float.
Name feval
Declaration macro feval(string expression, literalType)
Description Evaluates a string as an expression, and returns the value as a non-array float.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as float.
Name ieval
Declaration macro ieval(string expression)
Description Evaluates a string as an expression, and returns the value as a non-array int.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression as int.
Name ieval
Declaration macro ieval(string expression, literalType)
Description Evaluates a string as an expression, and returns the value as a non-array int.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as int.
Name ceval
Declaration macro ceval(string expression)
Description Evaluates a string as an expression, and returns the value as a non-array complex.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression as complex.
Name ceval
Declaration macro ceval(string expression, literalType)
Description Evaluates a string as an expression, and returns the value as a non-array complex.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as complex.
Name beval
Declaration macro beval(string expression)
Description Evaluates a string as an expression, and returns the value as a non-array bool.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression as bool.
Name beval
Declaration macro beval(string expression, literalType)
Description Evaluates a string as an expression, and returns the value as a non-array bool.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as bool.
Name seval
Declaration macro seval(string expression)
Description Evaluates a string as an expression, and returns the value as a non-array string.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression as string.
Name seval
Declaration macro seval(string expression, literalType)
Description Evaluates a string as an expression, and returns the value as a non-array string.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as string.
Name vfeval
Declaration macro vfeval(string expression)
Description Evaluates a string as an expression, and returns the value as a non-array varfloat.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression as varfloat.
Name vfeval
Declaration macro vfeval(string expression, literalType)
Description Evaluates a string as an expression, and returns the value as a non-array varfloat.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as varfloat.
Name vieval
Declaration macro vieval(string expression)
Description Evaluates a string as an expression, and returns the value as a non-array varint.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression as varint.
Name vieval
Declaration macro vieval(string expression, literalType)
Description Evaluates a string as an expression, and returns the value as a non-array varint.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as varint.
Name vceval
Declaration macro vceval(string expression)
Description Evaluates a string as an expression, and returns the value as a non-array varcomplex.
Parameters (string type) expression : The expression to be evaluated.
Return The value of the expression as varcomplex.
Name vceval
Declaration macro vceval(string expression, literalType)
Description Evaluates a string as an expression, and returns the value as a non-array varcomplex.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return The value of the expression as varcomplex.
Name evaluable
Declaration macro evaluable(string expression)
Description Determines whether the contents of an expression are syntactically correct.If the eval function fails in parsing, processing speed decreases, so if you want to evaluate an expression repeatedly at high speed, it is recommended to check its validity in advance with this function.
Parameters (string type) expression : The expression to be checked.
Return Returns true if the expression is syntactically correct, or false otherwise.
Name evaluable
Declaration macro evaluable(string expression, literalType)
Description Determines whether the contents of an expression are syntactically correct.If the eval function fails in parsing, processing speed decreases, so if you want to evaluate an expression repeatedly at high speed, it is recommended to check its validity in advance with this function.
Parameters (string type) expression : The expression to be checked.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return Returns true if the expression is syntactically correct, or false otherwise.
Name evaltr
Declaration macro evaltr(string expression)
Description Evaluates a string as an expression, and returns internal processing information of the implementation. The contents are completely implementation-dependent.Note that the expressions that can be used are subject to implementation-dependent restrictions, and the returned contents do not necessarily correspond exactly to those of normal expression evaluation.In addition, this function generally cannot be used with expressions that have side effects. This function is mainly intended for development and debugging.
Parameters (string type) expression : The expression to be evaluated.
Return Internal processing information of the implementation as a string array.
Name evaltr
Declaration macro evaltr(string expression, literalType)
Description Evaluates a string as an expression, and returns internal processing information of the implementation. The contents are completely implementation-dependent.Note that the expressions that can be used are subject to implementation-dependent restrictions, and the returned contents do not necessarily correspond exactly to those of normal expression evaluation.In addition, this function generally cannot be used with expressions that have side effects. This function is mainly intended for development and debugging.
Parameters (string type) expression : The expression to be evaluated.
( type) literalType : The type to be assigned to numeric literals without suffixes (specified by a variable of that type).
Return Internal processing information of the implementation as a string array.
Name override
Declaration macro override(string functionName, string argumentType[ ], string functionCode)
Description Changes the implementation of a function at runtime.Since the eval function cannot declare local variables or execute multiple statements, use this function when you want to perform such processing by dynamic evaluation.Note that this function can only change the implementation of an existing function, and cannot declare a new function.
Parameters (string type) functionName : The function name.
(string[] type) argumentType : An array describing the argument types as strings (for example, storing "int" or "float").
(string type) functionCode : The description of the function body as program code.
Name lf
Declaration string lf()
Description Returns the environment-dependent line break code. In VCSSL 3 and later, the constant EOL can be used directly as the line break code.This function wastes the overhead of a function call. In new programs, using the constant EOL is recommended.This function is supported for compatibility.
Return (string type) The environment-dependent line break code.
Name linefeed
Declaration string linefeed()
Description Returns the environment-dependent line break code. In VCSSL 3 and later, the constant EOL can be used directly as the line break code.This function wastes the overhead of a function call. In new programs, using the constant EOL is recommended.This function is supported for compatibility.
Return (string type) The environment-dependent line break code.

Event Handlers

Name main
Declaration void main( )
Description This is the so-called main function.It is called automatically after processing of the global scope in all modules(for example, initialization of global constants) has been completed.If main functions exist in multiple modules, only the one defined lastaccording to the module loading order is called (this differs from ordinary event handlers).
Return (void type)
Name main
Declaration void main( string args[ ] )
Description This is the so-called main function.It is called automatically after processing of the global scope in all modules(for example, initialization of global constants) has been completed.If main functions exist in multiple modules, only the one defined lastaccording to the module loading order is called (this differs from ordinary event handlers).
Parameters args[] : The arguments specified when the program was launched from a command-line terminal and so on, passed as an array split by spaces.
Return (void type)