![]() |
Phasor 2.2.0
Stack VM based Programming Language
|
Standard library Contains all the standard library functions. More...
#include <StdLib.hpp>
Static Public Member Functions | |
| static void | registerFunctions (VM &vm) |
| Register all standard library functions. | |
| static void | checkArgCount (const std::vector< Value > &args, size_t minimumArguments, const std::string &name, bool allowMoreArguments=false) |
Static Public Attributes | |
| static char ** | argv = nullptr |
| Command line arguments. | |
| static int | argc = 0 |
| Number of command line arguments. | |
| static char ** | envp = nullptr |
| Environment variables. | |
Static Private Member Functions | |
| static int | dupenv (std::string &out, const char *name, char *const argp[]) |
| static Value | registerMathFunctions (const std::vector< Value > &args, VM *vm) |
| static Value | registerStringFunctions (const std::vector< Value > &args, VM *vm) |
| static Value | registerTypeConvFunctions (const std::vector< Value > &args, VM *vm) |
| static Value | registerFileFunctions (const std::vector< Value > &args, VM *vm) |
| static Value | registerSysFunctions (const std::vector< Value > &args, VM *vm) |
| static Value | registerIOFunctions (const std::vector< Value > &args, VM *vm) |
| static Value | registerRegexFunctions (const std::vector< Value > &args, VM *vm) |
| static Value | math_sqrt (const std::vector< Value > &args, VM *vm) |
| Square root. | |
| static Value | math_pow (const std::vector< Value > &args, VM *vm) |
| Power. | |
| static Value | math_abs (const std::vector< Value > &args, VM *vm) |
| Absolute value. | |
| static Value | math_floor (const std::vector< Value > &args, VM *vm) |
| Floor. | |
| static Value | math_ceil (const std::vector< Value > &args, VM *vm) |
| Ceiling. | |
| static Value | math_round (const std::vector< Value > &args, VM *vm) |
| Round. | |
| static Value | math_min (const std::vector< Value > &args, VM *vm) |
| Minimum. | |
| static Value | math_max (const std::vector< Value > &args, VM *vm) |
| Maximum. | |
| static Value | math_log (const std::vector< Value > &args, VM *vm) |
| Natural logarithm. | |
| static Value | math_exp (const std::vector< Value > &args, VM *vm) |
| Exponential. | |
| static Value | math_sin (const std::vector< Value > &args, VM *vm) |
| Sine. | |
| static Value | math_cos (const std::vector< Value > &args, VM *vm) |
| Cosine. | |
| static Value | math_tan (const std::vector< Value > &args, VM *vm) |
| Tangent. | |
| static Value | file_read (const std::vector< Value > &args, VM *vm) |
| Read file. | |
| static Value | file_write (const std::vector< Value > &args, VM *vm) |
| Write to file. | |
| static Value | file_exists (const std::vector< Value > &args, VM *vm) |
| Check if file exists. | |
| static Value | file_read_line (const std::vector< Value > &args, VM *vm) |
| Read a line from file. | |
| static Value | file_write_line (const std::vector< Value > &args, VM *vm) |
| Write a line to file. | |
| static Value | file_append (const std::vector< Value > &args, VM *vm) |
| Append to file. | |
| static Value | file_delete (const std::vector< Value > &args, VM *vm) |
| Delete file. | |
| static Value | file_rename (const std::vector< Value > &args, VM *vm) |
| Rename file. | |
| static Value | file_current_directory (const std::vector< Value > &args, VM *vm) |
| Get/set working directory. | |
| static Value | file_copy (const std::vector< Value > &args, VM *vm) |
| Copy file. | |
| static Value | file_move (const std::vector< Value > &args, VM *vm) |
| Move file. | |
| static Value | file_property_edit (const std::vector< Value > &args, VM *vm) |
| static Value | file_property_get (const std::vector< Value > &args, VM *vm) |
| static Value | file_create (const std::vector< Value > &args, VM *vm) |
| static Value | file_read_directory (const std::vector< Value > &args, VM *vm) |
| static Value | file_statistics (const std::vector< Value > &args, VM *vm) |
| static Value | file_create_directory (const std::vector< Value > &args, VM *vm) |
| static Value | file_remove_directory (const std::vector< Value > &args, VM *vm) |
| static Value | sys_time (const std::vector< Value > &args, VM *vm) |
| Current time. | |
| static Value | sys_time_formatted (const std::vector< Value > &args, VM *vm) |
| Current time formatted. | |
| static Value | sys_sleep (const std::vector< Value > &args, VM *vm) |
| Sleep for a specified amount of time. | |
| static Value | sys_clear (const std::vector< Value > &args, VM *vm) |
| Clear the console. | |
| static Value | sys_os (const std::vector< Value > &args, VM *vm) |
| Get the current OS. | |
| static Value | sys_env (const std::vector< Value > &args, VM *vm) |
| Get the current environment variables. | |
| static Value | sys_argv (const std::vector< Value > &args, VM *vm) |
| Get the current command line arguments. | |
| static Value | system_get_free_memory (const std::vector< Value > &args, VM *vm) |
| Get current free memory. | |
| static Value | sys_argc (const std::vector< Value > &args, VM *vm) |
| Get the current number of command line arguments. | |
| static Value | sys_wait_for_input (const std::vector< Value > &args, VM *vm) |
| Wait for input. | |
| static Value | sys_exec (const std::vector< Value > &args, VM *vm) |
| Run a shell command. | |
| static Value | sys_exec_get_output (const std::vector< Value > &args, VM *vm) |
| Run a shell command and get output. | |
| static Value | sys_exec_get_error (const std::vector< Value > &args, VM *vm) |
| Run a shell command and get error output. | |
| static Value | sys_crash (const std::vector< Value > &args, VM *vm) |
| Crash the VM / Program. | |
| static Value | sys_reset (const std::vector< Value > &args, VM *vm) |
| Reset the VM. | |
| static Value | sys_shutdown (const std::vector< Value > &args, VM *vm) |
| Shutdown the VM. | |
| static Value | sys_pid (const std::vector< Value > &args, VM *vm) |
| Get the current process ID. | |
| static Value | to_int (const std::vector< Value > &args, VM *vm) |
| Convert to integer. | |
| static Value | to_float (const std::vector< Value > &args, VM *vm) |
| Convert to float. | |
| static Value | to_string (const std::vector< Value > &args, VM *vm) |
| Convert to string. | |
| static Value | to_bool (const std::vector< Value > &args, VM *vm) |
| Convert to boolean. | |
| static Value | str_len (const std::vector< Value > &args, VM *vm) |
| Get string length. | |
| static Value | str_char_at (const std::vector< Value > &args, VM *vm) |
| Get character at index. | |
| static Value | str_substr (const std::vector< Value > &args, VM *vm) |
| Get substring. | |
| static Value | str_concat (const std::vector< Value > &args, VM *vm) |
| Concatenate strings. | |
| static Value | str_upper (const std::vector< Value > &args, VM *vm) |
| Convert to uppercase. | |
| static Value | str_lower (const std::vector< Value > &args, VM *vm) |
| Convert to lowercase. | |
| static Value | str_starts_with (const std::vector< Value > &args, VM *vm) |
| Check if string starts with. | |
| static Value | str_ends_with (const std::vector< Value > &args, VM *vm) |
| Check if string ends with. | |
| static Value | sb_new (const std::vector< Value > &args, VM *vm) |
| Create new string builder. | |
| static Value | sb_append (const std::vector< Value > &args, VM *vm) |
| Append to string builder. | |
| static Value | sb_to_string (const std::vector< Value > &args, VM *vm) |
| Convert string builder to string. | |
| static Value | sb_clear (const std::vector< Value > &args, VM *vm) |
| Clear string builder. | |
| static Value | sb_free (const std::vector< Value > &args, VM *vm) |
| Free string builder. | |
| static Value | io_c_format (const std::vector< Value > &args, VM *vm) |
| Format string. | |
| static Value | io_prints (const std::vector< Value > &args, VM *vm) |
| Print string without newline. | |
| static Value | io_printf (const std::vector< Value > &args, VM *vm) |
| Print formatted string. | |
| static Value | io_puts (const std::vector< Value > &args, VM *vm) |
| Print string with newline. | |
| static Value | io_putf (const std::vector< Value > &args, VM *vm) |
| Print formatted string with newline. | |
| static Value | io_gets (const std::vector< Value > &args, VM *vm) |
| Get string. | |
| static Value | io_putf_error (const std::vector< Value > &args, VM *vm) |
| Print formatted string with newline to error output. | |
| static Value | io_puts_error (const std::vector< Value > &args, VM *vm) |
| Print string with newline to error output. | |
| static Value | regex_match (const std::vector< Value > &args, VM *vm) |
| Check if regex matches. | |
| static Value | regex_search (const std::vector< Value > &args, VM *vm) |
| Check if regex is found. | |
| static Value | regex_findall (const std::vector< Value > &args, VM *vm) |
| Find all regex matches. | |
| static Value | regex_split (const std::vector< Value > &args, VM *vm) |
| Split string by regex matches. | |
| static Value | regex_replace (const std::vector< Value > &args, VM *vm) |
| Replace regex matches. | |
Standard library Contains all the standard library functions.
Definition at line 24 of file StdLib.hpp.
|
static |
Definition at line 50 of file StdLib.cpp.
|
staticprivate |
|
static |
Register all standard library functions.
Definition at line 10 of file StdLib.cpp.
|
staticprivate |
Definition at line 7 of file string.cpp.
|
staticprivate |
Definition at line 20 of file system.cpp.
|
staticprivate |
Definition at line 6 of file typeconv.cpp.
Append to string builder.
Definition at line 50 of file string.cpp.
Clear string builder.
Definition at line 80 of file string.cpp.
Free string builder.
Definition at line 71 of file string.cpp.
Create new string builder.
Definition at line 32 of file string.cpp.
Convert string builder to string.
Definition at line 61 of file string.cpp.
Get character at index.
Definition at line 90 of file string.cpp.
Concatenate strings.
Definition at line 123 of file string.cpp.
Check if string ends with.
Definition at line 169 of file string.cpp.
Get string length.
Definition at line 134 of file string.cpp.
Convert to lowercase.
Definition at line 149 of file string.cpp.
Check if string starts with.
Definition at line 157 of file string.cpp.
Get substring.
Definition at line 104 of file string.cpp.
Convert to uppercase.
Definition at line 141 of file string.cpp.
Get the current number of command line arguments.
Definition at line 140 of file system.cpp.
Get the current command line arguments.
Definition at line 118 of file system.cpp.
Clear the console.
Definition at line 84 of file system.cpp.
Definition at line 180 of file system.cpp.
Get the current environment variables.
Definition at line 109 of file system.cpp.
Run a shell command.
Definition at line 159 of file system.cpp.
|
staticprivate |
Run a shell command and get error output.
Definition at line 173 of file system.cpp.
|
staticprivate |
Run a shell command and get output.
Definition at line 166 of file system.cpp.
Get the current OS.
Definition at line 90 of file system.cpp.
Get the current process ID.
Definition at line 203 of file system.cpp.
Reset the VM.
Definition at line 187 of file system.cpp.
Shutdown the VM.
Definition at line 194 of file system.cpp.
Sleep for a specified amount of time.
Definition at line 76 of file system.cpp.
Current time.
Definition at line 43 of file system.cpp.
|
staticprivate |
Current time formatted.
Definition at line 52 of file system.cpp.
|
staticprivate |
Wait for input.
Definition at line 152 of file system.cpp.
|
staticprivate |
Get current free memory.
Definition at line 146 of file system.cpp.
Convert to boolean.
Definition at line 51 of file typeconv.cpp.
Convert to float.
Definition at line 39 of file typeconv.cpp.
Convert to integer.
Definition at line 16 of file typeconv.cpp.
Convert to string.
Definition at line 45 of file typeconv.cpp.
|
static |
Number of command line arguments.
Definition at line 31 of file StdLib.hpp.
|
static |
Command line arguments.
Definition at line 30 of file StdLib.hpp.
|
static |
Environment variables.
Definition at line 32 of file StdLib.hpp.