The Filp Command Reference
This reference documents version 1.0.0-rc4-dev of the Filp Programming Language.
By Category
Array commands
Boolean commands
Code execution commands
Control structures
Documentation commands
File and directory commands
List processing commands
Math commands
Output commands
Special commands
Special constants
- NULL
- false
- filp_arch
- filp_compile_date
- filp_compile_options
- filp_compile_time
- filp_uname
- filp_version
- license
- true
Special variables
- ARGV
- STDERR
- STDIN
- STDOUT
- errno
- filp_bareword
- filp_error
- filp_error_info
- filp_error_strings
- filp_lang
- filp_real
- filp_stack_elems
- filp_stack_size
Stack manipulation commands
String manipulation commands
Symbol management commands
System commands
By Source
filp_lib.c
- ARGV
- NULL
- abseek
- add
- adel
- adump
- aget
- ains
- and
- array
- aseek
- aset
- asort
- chop
- defined
- div
- dumper
- dup
- dupnz
- enum
- eq
- eval
- exec
- false
- filp_bareword
- filp_compile_date
- filp_compile_time
- filp_error
- filp_error_info
- filp_error_strings
- filp_real
- filp_stack_elems
- filp_stack_size
- filp_version
- for
- forall
- foreach
- getdoc
- gt
- idup
- if
- ifelse
- index
- instr
- join
- length
- license
- load
- loop
- lsize
- lt
- map
- mod
- mul
- or
- pop
- repeat
- reverse
- rot
- safe
- seek
- set
- setdoc
- size
- sort
- split
- sprintf
- sscanf
- strcat
- sub
- substr
- swap
- sweep
- switch
- swstack
- symbol
- tpop
- tpush
- true
- type
- unless
- unset
- val
- while
filp_slib.c
- STDERR
- STDIN
- STDOUT
- bread
- bwrite
- close
- errno
- filp_arch
- filp_compile_options
- filp_lang
- filp_uname
- getenv
- glob
- mkdir
- open
- printwn
- putenv
- read
- regex
- shell
- strerror
- time
- timer
- write
Alphabetical
- ARGV - Array of command-line arguments.
- NULL - Stores a NULL value on the top of stack.
- STDERR - Standard error file descriptor.
- STDIN - Standard input file descriptor.
- STDOUT - Standard output file descriptor.
- abseek - Seeks a sorted array for a scalar.
- add - Math sum.
- adel - Deletes an element from an array.
- adump - Dumps an array as a list.
- aget - Gets an element from an array.
- ains - Inserts a value into an array.
- and - Boolean and.
- array - Creates an array.
- aseek - Seeks an array for a scalar.
- aset - Assigns a value to an element of an array.
- asort - Sorts an array.
- bread - Reads a block of bytes from a file.
- bwrite - Writes a block of bytes to a file.
- chop - Chops the last character of a string.
- close - Closes a file.
- defined - Tests if a symbol is defined.
- div - Math division.
- dumper - Dumps a value (probably an array) as a tree.
- dup - Duplicates the value in the top of stack.
- dupnz - Duplicates the value in the top of stack if true.
- enum - Defines a group of constants.
- eq - String equality test.
- errno - The C library errno variable.
- eval - Executes a value as filp code and returns its error code.
- exec - Executes a value as filp code.
- false - Stores a false value on the top of stack.
- filp_arch - Architecture id string.
- filp_bareword - Use of barewords flag.
- filp_compile_date - Compilation date.
- filp_compile_options - Compilation options information.
- filp_compile_time - Compilation time.
- filp_error - Last error code.
- filp_error_info - Text info about the last error.
- filp_error_strings - Array of error strings.
- filp_lang - Two letter code of the preferred language.
- filp_real - Use of real numbers instead of integers flag.
- filp_stack_elems - Number of elements currently in the stack.
- filp_stack_size - Maximum size of the stack.
- filp_uname - Operating system information.
- filp_version - Version of filp.
- for - Executes a block incrementing a value.
- forall - Executes a block of code for all elements of the array
- foreach - Executes a block of code for each element of a list.
- getdoc - Gets documentation from a symbol.
- getenv - Obtains the value of an environment string.
- glob - Returns a list with a file expansion set.
- gt - String 'greater than' test.
- idup - Duplicates a specific value from the stack.
- if - Conditional execution of code.
- ifelse - Conditional execution of code.
- index - Extract an element from a list by subscript.
- instr - Search a string inside another.
- join - Joins a list into a string.
- length - Returns the length of a string.
- license - Returns the filp license.
- load - Loads a filp source code file and executes it.
- loop - The infinite loop.
- lsize - Returns the size of a list.
- lt - String 'lower than' test.
- map - Executes a block of code for all elements of the array modifying
- mkdir - Creates a directory.
- mod - Math modulo.
- mul - Math multiply.
- open - Opens a file.
- or - Boolean or.
- pop - Drops a value from the top of stack.
- print - Prints a value to the standard output.
- printwn - Prints a value to the standard output without newline.
- putenv - Sets the value of an environment string.
- read - Reads a line from a file.
- regex - Matches a POSIX regular expression.
- repeat - Executes a block of code a number of times.
- reverse - Reverses a list.
- rot - Rotates the stack.
- safe - Enters isolate mode
- seek - Seeks an element in a list.
- set - Sets the value of a symbol.
- setdoc - Set documentation for a symbol.
- shell - Executes an external program.
- size - Returns the size of a value.
- sort - Sorts a list.
- split - Splits a string into substrings.
- sprintf - Formats into a string.
- sscanf - Scans a string and extracts values.
- strcat - Concatenates two strings.
- strerror - Returns the system error string.
- sub - Math substraction.
- substr - Extracts a substring.
- swap - Swaps the two values on top of the stack.
- sweep - Collects garbage.
- switch - Multiple conditional execution.
- swstack - Swaps between the two stacks.
- symbol - Sends symbol names to the stack.
- time - Returns the time in seconds.
- timer - millisecond timer
- tpop - Stores the top of stack into the temporal variable.
- tpush - Pushes the temporal variable to the stack.
- true - Stores a true value on the top of stack.
- type - Returns a string describing the type of a value.
- unless - Conditional execution of code.
- unset - Undefines a variable.
- val - Returns the value of a symbol.
- while - Conditional loop.
- write - Writes a string to a file.
ARGV
Name
ARGV - Array of command-line arguments.
Synopsis
ARGV
Description
This array contains the command-line arguments when used from the filp interpreter, or an empty array if used from an embedded version of the filp library.
Categories
NULL
Name
NULL - Stores a NULL value on the top of stack.
Synopsis
NULL NULL [ NULL ( NULL
Description
Stores a NULL value on the top of stack. Though [ is used as a delimiter for lists and ( for arrays, in practice all of them are the same.
Categories
STDERR
Name
STDERR - Standard error file descriptor.
Synopsis
STDERR
Description
This is the standard error file descriptor.
Categories
STDIN
Name
STDIN - Standard input file descriptor.
Synopsis
STDIN
Description
This is the standard input file descriptor.
Categories
STDOUT
Name
STDOUT - Standard output file descriptor.
Synopsis
STDOUT
Description
This is the standard output file descriptor.
Categories
abseek
Name
abseek - Seeks a sorted array for a scalar.
Synopsis
array scalar abseek subscript
Arguments
- array
- the array to be searched into
- scalar
- the value to be found
Description
Seeks a sorted array in search of a string. Returns the subscript where the scalar is if positive, or the position where it should be if negative.
Categories
add
Name
add - Math sum.
Synopsis
op1 op2 add result op1 op2 + result
Arguments
- op1
- first operand
- op2
- second operand
Description
Sums both values and sends the result to the stack. If filp_real is set, the operation is made in real mode, or integer otherwise.
Categories
adel
Name
adel - Deletes an element from an array.
Synopsis
array_symbol subscript adel array subscript adel modified_array
Arguments
- array
- the array or array symbol
- subscript
- subscript of the element to be deleted
Description
Deletes an element from an array. The array shrinks. If subscript is zero, the last element is deleted and if it's out of range, nothing happens.
Categories
adump
Name
adump - Dumps an array as a list.
Synopsis
array adump [ array_elements ]
Arguments
- array
- the array to be dumped.
Description
Dumps an array as a list.
Categories
aget
Name
aget - Gets an element from an array.
Synopsis
array subscript @ element array subscript aget element
Arguments
- array
- the array
- subscript
- the number of the element to be taken
Description
Gets the element number subscript from the array. If subscript is out of range, NULL is returned instead. The array subscripts in filp starts at 1; the 0 element contains the total number of elements in the array.
Categories
ains
Name
ains - Inserts a value into an array.
Synopsis
array_symbol subscript value ains array subscript value ains modified_array
Arguments
- array
- the array or array symbol
- subscript
- the subscript number of the insertion position
- value
- the value to be inserted
Description
Inserts a value into the subscript position of an array. The elements with greater subscripts move up one position, incrementing the total size of the array by 1. Remember that the array subscripts in filp start at 1. If the subscript is 0 (array size), the element is added to the end.
Categories
and
Name
and - Boolean and.
Synopsis
bool1 bool2 and bool_result bool1 bool2 && bool_result
Arguments
- bool1
- first boolean value.
- bool2
- second boolean value.
Description
Returns true if both values are true. The command && can be used as a synonym.
Categories
array
Name
array - Creates an array.
Synopsis
( value value ... ) new_array ( value value array new_array
Arguments
- value
- values that are part of the array.
Description
Creates an array. The ) character can be used as a synonym, and it's preferred as it's more intuitive. The new array value is left on the top of stack, ready to be asigned or used.
Categories
aseek
Name
aseek - Seeks an array for a scalar.
Synopsis
array scalar aseek subscript
Arguments
- array
- the array to be searched into
- scalar
- the value to be found
Description
Seeks an array in search of a string. Returns the subscript where the scalar is, or 0 if not found.
Categories
aset
Name
aset - Assigns a value to an element of an array.
Synopsis
array_symbol subscript value aset array subscript value aset modified_array
Arguments
- array
- the array or array symbol
- subscript
- the subscript number to be asigned
- value
- the value to be set
Description
Assigns a value to the element subscript of an array. Remember that the array subscripts in filp start at 1. The @= command can be used as a synonym.
Categories
asort
Name
asort - Sorts an array.
Synopsis
array_symbol asort array asort sorted_array
Arguments
- array
- array or array symbol to be sorted
Description
Sorts (alfabetically) an array.
Categories
bread
Name
bread - Reads a block of bytes from a file.
Synopsis
size fdes bread size data
Arguments
- size
- number of bytes to be read
- fdes
- file descriptor
Description
Reads a block of bytes from a file. The block of data and its size is returned. On EOF, the returned size will be zero.
Categories
bwrite
Name
bwrite - Writes a block of bytes to a file.
Synopsis
size data fdes bwrite
Arguments
- size
- size of the block of data
- data
- the block of data
- fdes
- the file descriptor
Description
Writes a block of bytes to a file.
Categories
chop
Name
chop - Chops the last character of a string.
Synopsis
string chop strin
Arguments
- string
- the string to be chopped
Description
Chops the last character of a string. Mainly to be used to cut the trailing \n character of a line read from a file.
Categories
close
Name
close - Closes a file.
Synopsis
fdes close
Arguments
- fdes
- file descriptor to be closed.
Description
Closes a file.
Categories
defined
Name
defined - Tests if a symbol is defined.
Synopsis
symbol defined bool_result
Arguments
- symbol
- the symbol name to be tested
Description
Returns a boolean value telling whether the symbol is defined or not.
Categories
div
Name
div - Math division.
Synopsis
divd divs div result divd divs / result
Arguments
- divd
- dividend
- divs
- divisor
Description
Divides divd by divs and sends the result to the stack. If filp_real is set, the operation is made in real mode, or integer otherwise.
Categories
dumper
Name
dumper - Dumps a value (probably an array) as a tree.
Synopsis
value dumper value_tree
Arguments
- value
- the value to be dumped
Description
Dumps a value (probably an array) as a filp-parseable tree.
dup
Name
dup - Duplicates the value in the top of stack.
Synopsis
value dup value value
Arguments
- value
- the value to be duplicated
Description
Duplicates the value in the top of stack.
Categories
dupnz
Name
dupnz - Duplicates the value in the top of stack if true.
Synopsis
value dupnz value value
Arguments
- value
- the value to be duplicated
Description
Duplicates the value in the top of stack if it has a 'true' value.
Categories
enum
Name
enum - Defines a group of constants.
Synopsis
[ list_elements ] first enum
Arguments
- list
- the list of constants to set
- first
- the value of the first element
Description
Defines a group of constants. The first (deeper in the stack) will have a value of first and so on, increasingly.
Categories
eq
Name
eq - String equality test.
Synopsis
string1 string2 eq bool_value
Arguments
- string1
- the first string
- string2
- the second string
Description
Compares the two strings and returns true if both are equal.
Categories
errno
Name
errno - The C library errno variable.
Synopsis
errno
Description
This variable contains the C library errno variable.
Categories
eval
Name
eval - Executes a value as filp code and returns its error code.
Synopsis
value eval error_code
Arguments
- value
- value to be executed
Description
Executes a value as filp code. It can be a string or a block of code. The error code will be put on the top of stack, and the execution is never interrupted.
Categories
exec
Name
exec - Executes a value as filp code.
Synopsis
value exec
Arguments
- value
- value to be executed
Description
Executes a value as filp code. It can be a string or a block of code.
Categories
false
Name
false - Stores a false value on the top of stack.
Synopsis
false false_value
Description
Stores a conditional value equal to 'false' on the top of stack.
Categories
filp_arch
Name
filp_arch - Architecture id string.
Synopsis
filp_arch
Description
This string contains 'linux' if filp is running under any flavour of linux, 'win32' if under any flavour of MS Windows, 'beos' if under BeOS or 'unix' otherwise.
Categories
filp_bareword
Name
filp_bareword - Use of barewords flag.
Synopsis
filp_bareword
Description
If this flag is set, barewords (not-quoted words that are not recognized as commands) are treated as literal strings. Barewords are dangerous and hard to debug. Don't use it.
Categories
filp_compile_date
Name
filp_compile_date - Compilation date.
Synopsis
filp_compile_date
Description
This string contains the date of compilation of the filp library.
Categories
filp_compile_options
Name
filp_compile_options - Compilation options information.
Synopsis
filp_compile_options
Description
This string contains human-readable information about possible compilation options or limitations.
Categories
filp_compile_time
Name
filp_compile_time - Compilation time.
Synopsis
filp_compile_time
Description
This string contains the time of compilation of the filp library.
Categories
filp_error
Name
filp_error - Last error code.
Synopsis
filp_error
Description
This variable contains the last error code. Can be used as an offset to the filp_error_strings filp array.
Categories
filp_error_info
Name
filp_error_info - Text info about the last error.
Synopsis
filp_error_info
Description
This string contain additional info about the last error.
Categories
filp_error_strings
Name
filp_error_strings - Array of error strings.
Synopsis
filp_error_strings
Description
This array contains the message associated to an error message contained in filp_error.
Categories
filp_lang
Name
filp_lang - Two letter code of the preferred language.
Synopsis
filp_lang
Description
This variable contains the two letter code of the preferred language defined by the user. It mainly takes its value from the LANG environment variable, but other sources (mainly for win32) are tried as well.
Categories
filp_real
Name
filp_real - Use of real numbers instead of integers flag.
Synopsis
filp_real
Description
This flag tells filp if it must perform mathematical operations using integers (by default) or real numbers.
Categories
filp_stack_elems
Name
filp_stack_elems - Number of elements currently in the stack.
Synopsis
filp_stack_elems
Description
The number of elements currently stored in the stack.
Categories
filp_stack_size
Name
filp_stack_size - Maximum size of the stack.
Synopsis
filp_stack_size
Description
The maximum number of values the stack is allowed to store. By default is 16384. Just to avoid mad code from devouring all the available memory.
Categories
filp_uname
Name
filp_uname - Operating system information.
Synopsis
filp_uname
Description
This string contains human-readable information about the operating system filp is running on.
Categories
filp_version
Name
filp_version - Version of filp.
Synopsis
filp_version
Description
This string holds the current version of filp.
Categories
for
Name
for - Executes a block incrementing a value.
Synopsis
from inc to code_block for
Arguments
- from
- initial value
- inc
- increment to the value
- to
- final value
Description
Executes the block of code, sending previously a value to the stack. This value ranges from the initial from value, being incremented by inc until to (inclusive). The block of code must take this value from the stack.
Categories
forall
Name
forall - Executes a block of code for all elements of the array
Synopsis
array { code } forall
Arguments
- array
- the array
- code
- the code to be executed
Description
Executes a block of code for each element of array after pushing each one to the stack. The code block must take the values from the top of stack on each iteration.
Categories
foreach
Name
foreach - Executes a block of code for each element of a list.
Synopsis
[ list_elements ... ] code_block foreach
Arguments
- list_elements
- the list elements
- code_block
- block of code
Description
Executes a block of code for each element of a list, that is, until there is a NULL in the top of stack. The code block must take the values from the top of stack on each iteration. The NULL value is automatically dropped.
Categories
getdoc
Name
getdoc - Gets documentation from a symbol.
Synopsis
symbol getdoc documentation_string
Arguments
- symbol
- the symbol
Description
Gets documentation from a symbol. If it hasn't any, it's name is returned instead.
Categories
getenv
Name
getenv - Obtains the value of an environment string.
Synopsis
envvar getenv value
Arguments
- envvar
- the environment string name.
Description
Obtains the value of an environment string (as PATH or HOME). Returns the value or NULL if the variable does not exist.
Categories
glob
Name
glob - Returns a list with a file expansion set.
Synopsis
filespec glob [ file_list ]
Arguments
- filespec
- the filespec
Description
Returns a list with all the files that matches the filespec
expression. This filespec is system dependent, but any combination
of characters plus * or ? should work in all systems. The directory
separator is /, though \ can also be used on MS Windows; anyway, the
output list will always have / separators, that can also be used
in all supported systems as an argument for open()
or similar.
Categories
gt
Name
gt - String 'greater than' test.
Synopsis
string1 string2 gt bool_value
Arguments
- string1
- the first string
- string2
- the second string
Description
Compares the two strings and returns true if the first one is greater (in ASCII) than the second one.
Categories
idup
Name
idup - Duplicates a specific value from the stack.
Synopsis
val#i val#i-1 ... val#1 i idup val#i
Arguments
- i
- the position number of the value to be duplicated.
Description
Creates a copy of the element number i from the stack, and leaves it in the first position. Stack elements start from 1.
Categories
if
Name
if - Conditional execution of code.
Synopsis
bool code_block if
Arguments
- bool
- boolean value
- code_block
- code block to execute
Description
Executes the block of code if bool is true.
Categories
ifelse
Name
ifelse - Conditional execution of code.
Synopsis
bool code_block_true code_block_false ifelse
Arguments
- bool
- boolean value
- code_block_true
- code block to execute when bool is true
- code_block_false
- code block to execute when bool is false
Description
Executes the first block of code if bool is true or the second if false.
Categories
index
Name
index - Extract an element from a list by subscript.
Synopsis
[ elements_of_list ] offset index value
Arguments
- elements_of_list
- the elements of the list
- offset
- offset of the element to be extracted
Description
Extract the element number offset from the list, and puts it on the top of stack. If the offset is out of range (i.e. there are less elements in the list), NULL is returned instead.
Categories
instr
Name
instr - Search a string inside another.
Synopsis
string substring instr offset
Arguments
- string
- the string to be searched into
- substring
- the substring to be searched
Description
Search a substring inside a string. If it's found, the offset is returned, or 0 instead. Remember that string offsets start from 1.
Categories
join
Name
join - Joins a list into a string.
Synopsis
[ list_elements ] joiner join string
Arguments
- joiner
- the joiner string
- list_elements
- the elements of the list
Description
Joins a list into a string, using the string joiner as a glue.
Categories
length
Name
length - Returns the length of a string.
Synopsis
string length len
Arguments
- string
- the string
Description
Returns the length of the string.
Categories
license
Name
license - Returns the filp license.
Synopsis
license license_text
Description
Returns a text string containing the license of the filp library (The GNU Public License, GPL).
Categories
load
Name
load - Loads a filp source code file and executes it.
Synopsis
file_name load
Arguments
- file_name
- the name of the file to be executed.
Description
Loads a filp source code file and executes it.
Categories
loop
Name
loop - The infinite loop.
Synopsis
code_block loop
Arguments
- code_block
- the block of code to execute eternally
Description
Executes code_block until the end of times.
Categories
lsize
Name
lsize - Returns the size of a list.
Synopsis
[ list_elements ] lsize number
Arguments
- list
- the list
Description
Returns the number of elements of a list.
Categories
lt
Name
lt - String 'lower than' test.
Synopsis
string1 string2 lt bool_value
Arguments
- string1
- the first string
- string2
- the second string
Description
Compares the two strings and returns true if the first one is lower (in ASCII) than the second one.
Categories
map
Name
map - Executes a block of code for all elements of the array modifying
Synopsis
array_symbol { code } map array { code } map modified_array
Arguments
- array
- the array or array symbol
- code
- the code to be executed
Description
Executes a block of code for each element of array after pushing each one to the stack. At the end of the block, the value in the top of stack will be assigned to the element. If array is an immediate value (i.e. not a symbol), the modified array is left on the stack.
Categories
mkdir
Name
mkdir - Creates a directory.
Synopsis
dirname mkdir
Arguments
- dirname
- directory name
Description
Creates a directory.
Categories
mod
Name
mod - Math modulo.
Synopsis
divd divs mod remainder divd divs % remainder
Arguments
- divd
- dividend
- divs
- divisor
Description
Divides divd by divs and sends the remainder to the stack. This operation is always made in integer mode regardless of the value of filp_real.
Categories
mul
Name
mul - Math multiply.
Synopsis
op1 op2 mul result op1 op2 * result
Arguments
- op1
- first operand
- op2
- second operand
Description
Multiplies both values and sends the result to the stack. If filp_real is set, the operation is made in real mode, or integer otherwise.
Categories
open
Name
open - Opens a file.
Synopsis
"filename" open fdes ">filename" open fdes ">>filename" open fdes "+filename" open fdes "+>filename" open fdes "|program" open fdes "program|" open fdes
Arguments
- filename
- the name of the file to be opened.
Description
Opens a file. If no prefix is used, the file is open for reading; The valid prefixes are: '>', open for writing; '>>', open for appending; '+', reading and writing, positioned in the beginning; '+>', reading and writing, truncating; '|', treat the file name as a program which standard input will be the file. The valid suffixes are: '|', treat the file name as a program which standard output will be the file. Pipes doesn't work in MS Windows by now. Returns a file descriptor, or NULL if file could not be opened.
Categories
or
Name
or - Boolean or.
Synopsis
bool1 bool2 or bool_result bool1 bool2 || bool_result
Arguments
- bool1
- first boolean value.
- bool2
- second boolean value.
Description
Returns true if any value are true. The command || can be used as a synonym.
Categories
pop
Name
pop - Drops a value from the top of stack.
Synopsis
value pop
Arguments
- value
- the value to be dropped
Description
Drops a value from the top of stack. The value is destroyed.
Categories
Name
print - Prints a value to the standard output.
Synopsis
value print value ?
Arguments
- value
- value to be printed
Description
Prints a value to the standard output followed by a newline (\n). The command ? can be used as a synonym.
Categories
printwn
Name
printwn - Prints a value to the standard output without newline.
Synopsis
value printwn value ??
Arguments
- value
- value to be printed
Description
Prints a value to the standard output. The command ?? can be used as a synonym.
Categories
putenv
Name
putenv - Sets the value of an environment string.
Synopsis
envvar value putenv
Arguments
- envvar
- the environment string name
- value
- the scalar value to be stored
Description
Sets the value of an environment string.
Categories
read
Name
read - Reads a line from a file.
Synopsis
fdes read line
Arguments
- fdes
- file descriptor
Description
Reads a line from a file. Returns the line or NULL on EOF.
Categories
regex
Name
regex - Matches a POSIX regular expression.
Synopsis
str re =~ bool_value str re regex bool_value
Arguments
- re
- string containing the regular expression
- str
- the string to test
Description
Tests if str matches the re POSIX regular expression. Returns true if the string matches. See the regex(7) man page for more information about POSIX regular expressions.
Categories
repeat
Name
repeat - Executes a block of code a number of times.
Synopsis
times code_block repeat
Arguments
- times
- number of repetitions
- code_block
- block of code to execute
Description
Executes a block of code a number of times.
Categories
reverse
Name
reverse - Reverses a list.
Synopsis
[ elem-1 elem-2 ... elem-n ] reverse [ elem-n ... elem-2 elem-1 ]
Arguments
- elem-1
- elements of the list
Description
Reverses a list.
Categories
rot
Name
rot - Rotates the stack.
Synopsis
val#i val#i-1 ... val#1 i rot val#i-1 ... val#1 val#i
Arguments
- i
- the element number from where the stack will be rotated.
Description
Rotates the stack. The element number i moves to the top of the stack, shifting all the upper ones one position down.
Categories
safe
Name
safe - Enters isolate mode
Synopsis
safe
Description
Enters isolate mode, so all potentially dangerous commands as file access, environment variable definitions and external command executions are disabled. There is no turning back. When executed inside an 'eval' code, isolate mode operates only inside it.
seek
Name
seek - Seeks an element in a list.
Synopsis
[ elements_of_list ] value seek offset
Arguments
- elements_of_list
- elements of the list
- value
- value to be searched for
Description
Seeks an element in the list. If the element is found, its offset is returned on the top of stack; in not, 0 is returned instead. Take note that list elements are numbered from 1.
Categories
set
Name
set - Sets the value of a symbol.
Synopsis
variable content set variable content def variable content = command { content } set
Arguments
- symbol
- symbol name
- content
- content to be stored in the symbol
Description
Sets the value of a symbol. If the content is code surrounded by { } , the symbol is marked as executable and becomes a command, otherwise it will be a plain variable. The commands def and = can be used as synonyms of set.
Categories
setdoc
Name
setdoc - Set documentation for a symbol.
Synopsis
documentation_string symbol setdoc
Arguments
- documentation_string
- String to be associated to the symbol
- symbol
- the symbol
Description
Stores documentation for a symbol.
Categories
shell
Name
shell - Executes an external program.
Synopsis
program shell output_from_program
Description
Executes an external program and sends all of its output to the stack.
Categories
size
Name
size - Returns the size of a value.
Synopsis
value size size_in_bytes
Arguments
- value
- the value which size is queried
Description
Returns the size in bytes of the value. Note that this number is not necessary the same as the length.
Categories
sort
Name
sort - Sorts a list.
Synopsis
[ list_elements ] sort [ sorted_elements ]
Arguments
- list
- the list
Description
Sorts a list.
Categories
split
Name
split - Splits a string into substrings.
Synopsis
string separator split [ string_slices ]
Arguments
- string
- the string to be splitted
- separator
- the separator
Description
Splits a string into a list by the separator. If separator is an empty string, string is splitted by char.
Categories
sprintf
Name
sprintf - Formats into a string.
Synopsis
value [ value ... ] format_string sprintf result_string
Arguments
- value
- values to be inserted
- format_string
- printf style formatting string
Description
Makes a printf()
-like formatting into a string. As in that
function, the percent char is used as a placeholder for
a formatting command.
Categories
sscanf
Name
sscanf - Scans a string and extracts values.
Synopsis
string format_string sscanf value1 value2 ...
Arguments
- string
- the string to be scanned
- format_string
- the format string
Description
Scans a string and extracts values using a scanf()
-like
format string.
Categories
strcat
Name
strcat - Concatenates two strings.
Synopsis
str1 str2 strcat str1str2 str1 str2 . str1str2
Arguments
- str1
- the first string
- str2
- the second string
Description
Concatenates two strings. The . command can be used as a synonym.
Categories
strerror
Name
strerror - Returns the system error string.
Synopsis
errno strerror
Arguments
- errno
- the error number
Description
Returns the system error string. errno must be the value of the filp_errno variable.
Categories
sub
Name
sub - Math substraction.
Synopsis
min subt sub result min subt - result
Arguments
- min
- minuend
- subt
- subtrahend
Description
Substracts subt from min and sends the result to the stack. If filp_real is set, the operation is made in real mode, or integer otherwise.
Categories
substr
Name
substr - Extracts a substring.
Synopsis
string offset size substr substring
Arguments
- string
- the string to be extracted from
- offset
- offset of the first character in string
- size
- number of characters to be extracted
Description
Extracts a substring from the string, starting at offset. Take note that string subscripts start from 1.
Categories
swap
Name
swap - Swaps the two values on top of the stack.
Synopsis
value2 value1 swap value1 value2 value2 value1 xchg value1 value2 value2 value1 # value1 value2
Arguments
- val2
- second value
- val1
- first value
Description
Swaps the two values on top of the stack. The commands xchg or # are synonyms.
Categories
sweep
Name
sweep - Collects garbage.
Synopsis
sweep
Description
Calls the internal garbage collector.
Categories
switch
Name
switch - Multiple conditional execution.
Synopsis
[ condition_code execute_code ... ] switch
Arguments
- condition_code
- Code to be executed for the condition test
- execution_code
- Code to be executed if condition is true
Description
Executes from top to down the condition block codes and, if
one of them returns a true value, executes the associated execution
code block and continues on the next instruction. The first
condition / execution code pairs being run are the nearest to
the switch instruction, and all of them are really a list, so
the [ terminator must not be forgotten. To implement a clause
similar to the 'default' one from the C language switch()
command,
it must be the last one and its condition code be always true.
Categories
swstack
Name
swstack - Swaps between the two stacks.
Synopsis
swstack
Description
Filp has two stacks, one on use and the other 'dormant'. This command swaps between the two stacks. It's used basicly when a running process can destroy valid information stored in the current stack, so this command puts it in a safe place. The variable filp_stack_elems is set accordingly.
Categories
symbol
Name
symbol - Sends symbol names to the stack.
Synopsis
prefix symbol [ symbols ... ]
Arguments
- prefix
- prefix of the symbol names to send to the stack
Description
Sends to the stack as a list all symbol names beginning with prefix. If prefix is "" (the empty string), all symbol names will be pushed.
Categories
time
Name
time - Returns the time in seconds.
Synopsis
time time_t
Description
Returns the time in seconds. This is the value returned by the
C function time()
.
Categories
timer
Name
timer - millisecond timer
Synopsis
timer msec_timer
Description
Returns a millisecond timer.
Categories
tpop
Name
tpop - Stores the top of stack into the temporal variable.
Synopsis
value tpop
Arguments
- value
- value to be stored
Description
Stores the top of stack into the temporal variable ($_
).
Categories
tpush
Name
tpush - Pushes the temporal variable to the stack.
Synopsis
tpush value
Description
Pushes the temporal variable ($_
) to the stack.
Categories
true
Name
true - Stores a true value on the top of stack.
Synopsis
true true_value
Description
Stores a conditional value equal to 'true' on the top of stack.
Categories
type
Name
type - Returns a string describing the type of a value.
Synopsis
value type type_string
Arguments
- value
- the symbol or value.
Description
Returns a string describing the type of a value. If value is a name of a symbol, the type of its content is returned; otherwise, the value type itself is returned. The returned value can be one of SCALAR, CODE, BIN_CODE, EXT_INT, EXT_REAL, EXT_STRING, NULL, FILE or ARRAY.
Categories
unless
Name
unless - Conditional execution of code.
Synopsis
bool code_block unless
Arguments
- bool
- boolean value
- code_block
- code block to execute
Description
Executes the block of code if bool is false.
Categories
unset
Name
unset - Undefines a variable.
Synopsis
<variable> unset <variable> undef
Arguments
- variable
- variable name to be undefined
Description
Undefines a variable. The command undef is a synonym.
Categories
val
Name
val - Returns the value of a symbol.
Synopsis
string val content
Arguments
- string
- the symbol name which value has to be gotten
Description
Treats the string as a symbol name and returns its value. If it does not exist as a symbol, NULL is returned instead.
Categories
while
Name
while - Conditional loop.
Synopsis
condition_code repeat_code while
Arguments
- condition_code
- Code to execute to evaluate condition
- repeat_code
- Code to execute if condition code is not NULL
Description
While the execution of condition_code returns a non-NULL value, repeat_code is also executed, having that value available in the top of stack for being processed. The NULL result of condition_code is clean from the stack.
Categories
write
Name
write - Writes a string to a file.
Synopsis
string fdes write
Arguments
- string
- string to be written to the file
- fdes
- file descriptor
Description
Writes a string to a file.
Categories
Angel Ortega - angel@triptico.com - Built with mp_doccer 1.2.2-dev