All functions

JSONdecode()[in json]

Decode an item stored in JSON format.

JSONdecode( source )

sourceA string or a stream from which to read the JSON data.
Returns: a string containing the JSON string, if stream is nil
Raises:
JSONErrorif the input data cannot be parsed.
IoErrorin case of error on the source stream.

JSONencode()[in json]

Encode an item in JSON format.

JSONencode( item, [stream], [uenc], [pretty], [readable] )

itemthe item to be encoded in JSON format.
streamA stream on which to send the encoded result.
uencEncode every character outside the ASCII printable range as \\uXXXX.
prettyAdd spacing around separators and puntaction.
readablePut each item in lists on a separate line.
Returns: a string containing the JSON string, if stream is nil
Raises:
JSONErrorif the passed item cannot be turned into a JSON representation.
IoErrorin case of error on target stream.

add()[in funcext]

Adds two items along the rules of VM '+' operator.

add( a, b )

aFirst operand
bSecond operand
Returns:The result of the sum.

This function operates also on strings, arrays and dictionaries replicating the behavior of the "+" operator as it is performed by the VM.

adler32()[in hash]

Convenience function that calculates a 32 bits long Adler32 checksum

adler32

Returns:A lowercase hexadecimal string with the adler32 checksum.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function adler32(...)
        hash = Adler32()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a Adler32 object, nor finalization.

at()[in funcext]

Passe-par-tout accessor function.

at( item, access, [value] )

itemAn array, string, or any accessible item or collection.
accessA number, a range or a string to access the item.
valueIf given, will substitue the given item or range (new value).
Raises:
AccessErrorin case the accessor is invalid for the given item type.

This function emulates all the language-level accessors provided by Falcon. Subscript accessors ([]) accepting numbers, ranges and generic items (for dictionaries) and property accessors (.) accepting strings are fully supported. When two parameters are passed, the function works in access semantics, while when the value parameter is also given, the function will work as an accessor/subscript assignment. In example, to change a string the at function can be used as a range accessor:

   string = "hello"
   string[0:1] = "H"          //first letter up
   at( string, [1:], "ELLO" ) // ...all up
   > string
   > "First letter: ", at( string, 0 ) 
                       // ^^^ same as string[0]

This function is also able to access and modify the bindings of arrays (i.e. like accessing the arrays using the "." operator), members of objects and instances and static methods of classes. Properties and bindings can be accessed by names as strings. In example:

   // making a binding
   // ... equivalent to "array.bind = ..."
   array = []
   at( array, "bind", "binding value" )
   > array.bind
   
   //... accessing a property
   at( CurrentTime(), "toRFC2822" )()

Trying to access an item with an incompatible type of accessor (i.e. trying to access an object with a range, or a string with a string).

Note: At the moment, the at function doesn't support BOM methods.

crc32()[in hash]

Convenience function that calculates a 32 bits long CRC32 checksum

crc32

Returns:A lowercase hexadecimal string with the crc32 checksum.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function crc32(...)
        hash = CRC32()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a CRC32 object, nor finalization.

deq()[in funcext]

Performs a deep equality check.

deq( a, b )

aFirst operand
bSecond operand
Returns:true if the two items are deeply equal (same content).

div()[in funcext]

Divides two numeric operands along the rules of VM '/' operator.

div( a, b )

aFirst operand
bSecond operand
Returns:The result of the division.

equal()[in funcext]

Performs a lexicographic check for the first operand being equal to the second.

equal( a, b )

aFirst operand
bSecond operand
Returns:true if a == b, false otherwise.

exec()[in Process]

Launches a process in place of the host process.

exec( command )

commandA single string with the system command, or an array of parameters.
Returns:Never returns.
Raises:
ProcessErrorif the process couldn't be created

On Unix-like systems, and wherever this feature is present, exec() calls an underlying OS request that swaps out the host process and executes the required command. This feature is often desirable for scripts that has just to setup an environment for a program they call thereafter, or for scripts selecting one program to execute from a list of possible programs. Where this function call is not provided, exec is implemented by calling the required process passing the current environment and then quitting the host program in the fastest possible way.

Embedders may be willing to turn off this feature by unexporting the exec symbol before linking the process module in the VM.

The command parameter may be a complete string holding the command line of the program to be executed, or it may be an array where the first element is the program, and the other elements will be passed as parameters. If the program name is not an absolute path, it is searched in the system execution search path.

ge()[in funcext]

Performs a lexicographic check for the first operand being greater or equal to the second.

ge( a, b )

aFirst operand
bSecond operand
Returns:true if a >= b, false otherwise.

getHostName()[in Socket]

Retreives the host name of the local machine.

getHostName

Returns:A string containing the local machine name.
Raises:
NetErrorif the host name can't be determined.

Returns the network name under which the machine is known to itself. By calling resolveAddress on this host name, it is possible to determine all the addressess of the interfaces that are available for networking.

If the system cannot provide an host name for the local machine, a NetError is raised.

Note: If the function fails, it is possible to retreive local addresses using through resolveAddress using the the name "localhost".

getSupportedHashes()[in hash]

Returns an array containing the names of all supported hashes.

getSupportedHashes

Returns:An array containing the names of all hashes supported by this module

This function can be used to check if different versions of the module support a specific hash.

glog()[in Logging support]

Shortcut to log on the generic area.

glog( level, message, [code] )

levelThe level of the log entry.
messageThe message to be logged.
codeA numeric code representing an application specific message ID.

This method is equivalent to call log on the GeneralLog object, that is, on the default log area.

It is provided in this module for improved performance.

The level parameter can be an integer number, or one of the following conventional constants representing levels:

glogd()[in Logging support]

Shortcut to log a debug message on the generic area.

glogd( message, [code] )

messageThe message to be logged at debug level.
codeA numeric code representing an application specific message ID.

This method is equivalent to call log on the GeneralLog object, that is, on the default log area, indicating the debug level.

It is provided in this module for improved performance.

gloge()[in Logging support]

Shortcut to log an error on the generic area.

gloge( message, [code] )

messageThe message to be logged at error level.
codeA numeric code representing an application specific message ID.

This method is equivalent to call log on the GeneralLog object, that is, on the default log area, indicating the error level.

It is provided in this module for improved performance.

glogf()[in Logging support]

Shortcut to log a fatal error on the generic area.

glogf( message, [code] )

messageThe message to be logged at fatal level.
codeA numeric code representing an application specific message ID.

This method is equivalent to call log on the GeneralLog object, that is, on the default log area, indicating the fatal error level.

It is provided in this module for improved performance.

glogi()[in Logging support]

Shortcut to log an information message on the generic area.

glogi( message, [code] )

messageThe message to be logged at info level.
codeA numeric code representing an application specific message ID.

This method is equivalent to call log on the GeneralLog object, that is, on the default log area, indicating the info level.

It is provided in this module for improved performance.

glogw()[in Logging support]

Shortcut to log a warning on the generic area.

glogw( message, [code] )

messageThe message to be logged at warn level.
codeA numeric code representing an application specific message ID.

This method is equivalent to call log on the GeneralLog object, that is, on the default log area, indicating the warn level.

It is provided in this module for improved performance.

gminlog()[in Logging support]

Determines what is the minimum log severity active on the GeneircLog area.

gminlog

Returns:A number representing a log severity, or -1

This function is actually a shortcut to LogArea.minlog applied on GeneralLog.

gt()[in funcext]

Performs a lexicographic check for the first operand being greater than the second.

gt( a, b )

aFirst operand
bSecond operand
Returns:true if a > b, false otherwise.

hash()[in hash]

Convenience function that calculates a hash.

hash( raw, which, [data...] )

rawIf set to true, return a raw MemBuf instead of a string.
whichHash that should be used
data...Arbitrary amount of parameters that should be fed into the chosen hash function.
Returns: A lowercase hexadecimal string with the output of the chosen hash if raw is false, or a 1-byte wide MemBuf if true.
Raises:
ParamError in case which is a string and a hash with that name was not found; or if which is not a hash object.
AccessError if which is a hash object that was already finalized.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

Param which can contain a String with the name of the hash, a hash class constructor, a not-finalized hash object, or a function that returns any of the latter.

Note: Use getSupportedHashes() to check which hash names are supported.

Note: If which is a hash object, it will be finalized by calling this function.

hmac()[in hash]

Provides HMAC authentication for a block of data

hmac( raw, which, key, data )

rawIf set to true, return a raw MemBuf instead of a string.
whichHash that should be used
keySecret authentication key
dataThe data to be authenticated
Returns: A lowercase hexadecimal string with the HMAC-result of the chosen hash if raw is false, or a 1-byte wide MemBuf if true.
Raises:
ParamError in case which is a string and a hash with that name was not found; or if which does not evaluate to a hash object.
AccessError if which evaluates to a hash object that was already finalized.

Param key can be a String or a MemBuf.

Param which can contain a String with the name of the hash, a hash class constructor, or a function that returns a useable hash object. Unlike the hash() function, it is not possible to pass a hash object directly, because it would have to be used 3 times, which is not possible because of finalization.

In total, this function evaluates which 3 times, creating 3 hash objects internally.

Note: Use getSupportedHashes() to check which hash names are supported.

le()[in funcext]

Performs a lexicographic check for the first operand being less or equal to the second.

le( a, b )

aFirst operand
bSecond operand
Returns:true if a <= b, false otherwise.

lt()[in funcext]

Performs a lexicographic check for the first operand being less than the second.

lt( a, b )

aFirst operand
bSecond operand
Returns:true if a < b, false otherwise.

makeHash()[in hash]

Creates a hash object based on the algorithm name

makeHash( name, [silent] )

nameThe name of the algorithm (case insensitive)
silent Return nil instead of throwing an exception, if the hash was not found
Returns:A new instance of a hash object of the the given algorithm name
Raises:
ParamErrorin case a hash with that name was not found

Note: Use getSupportedHashes() to check which hash names are supported.

md2()[in hash]

Convenience function that calculates a 128 bits long MD2 hash

md2

Returns:A lowercase hexadecimal string with the MD2 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function md2(...)
        hash = MD2Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a MD2Hash object, nor finalization.

md4()[in hash]

Convenience function that calculates a 128 bits long MD4 hash

md4

Returns:A lowercase hexadecimal string with the MD4 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function md4(...)
        hash = MD4Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a MD4Hash object, nor finalization.

md5()[in hash]

Convenience function that calculates a 128 bits long MD5 hash

md5

Returns:A lowercase hexadecimal string with the MD5 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function md5(...)
        hash = MD5Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a MD5Hash object, nor finalization.

mod()[in funcext]

Performs a modulo division on numeric operands along the rules of VM '%' operator.

mod( a, b )

aFirst operand
bSecond operand
Returns:The result of the modulo.

mul()[in funcext]

Multiplies two items along the rules of VM '*' operator.

mul( a, b )

aFirst operand
bSecond operand
Returns:The result of the multiplication.

This function operates also on strings, arrays and dictionaries replicating the behavior of the "*" operator as it is performed by the VM.

neq()[in funcext]

Performs a lexicographic check for the first operand being not equal to the second.

neq( a, b )

aFirst operand
bSecond operand
Returns:true if a == b, false otherwise.

pread()[in Process]

Executes an external process and waits for its termination.

pread( command, background )

commandThe command to be executed.
backgroundIf given and true, the process runs hidden.
Returns:The full output generated by the rpcess.
Raises:
ProcessErrorif the process couldn't be created.

This function launches an external system command and waits until the command execution is terminated, returning the exit code of the child process. All the

for example:

 dir_contents = pread( "ls" )
> dir_contents

If the process cannot be started if it fails to start, an error is raised.

\note This function uses the standard system shell to execute the passed commands, so it is possible to pipe applications and redirect streams via the standard "|" and ">" command line characters.

processId()[in Process]

Returns the process ID of the process hosting the Falcon VM.

processId

Returns:a numeric process ID.

For command line Falcon interpreter, this ID may be considered the ID of the Falcon program being executed; in embedding applications, the function will return the process ID associated with the host application.

processKill()[in Process]

Terminates the given process given its ID, if possible.

processKill( pid, [severe] )

pidThe Process ID of the process that should be terminated.
severeIf given and true, use the maximum severity allowable to stop the given process.
Returns:True on success, false on failure.

The process having the given PID is terminated. On UNIX systems, a TERM signal is sent to the process. If severe is true, the process is stopped in the most hard way the system provides; i.e. in UNIX, KILL signal is sent.

resolveAddress()[in Socket]

Resolve a network address in a list of numeric IP fields.

resolveAddress( address )

addressAn host name, quad dot IP address or IPV6 address.
Returns:An array of IPv4 or IPv6 addresses.
Raises:
NetErrorif the name resolution service is not available.

This function tries to resolve an address or an host name into a list of addresses that can be used to connect directly via the protocols that are available on the machine. The way in which the function can resolve the addresses depends on the string that has been given, on the underlying system and on the name resolution services that the system can access. Also, the time by which a positive or negative result can be returned varies greatly between different systems. The caller must consider this function as potentially blocking the VM for a long time.

The other members of the Socket module do not need to be provided with already resolved addresses. In example, the connect method of the TCPSocket class can be provided with a host name or with an IP address; in the first case, the connect method will resolve the target address on its own.

This function can be used on the value returned by getHostName, or using "localhost" as the address parameter, to receive a list of the interfaces that are available under the network name of the host the VM is running on. This is useful to i.e. bind some services only to one of the available interfaces.

The values in the returned array are the ones provided by the underlying name resolution system. They are not necessarily unique, and their order may change across different calls.

If the function cannot find any host with the given name, an empty array is returned; if the name resolution service is not accessible, or if accessing it causes a system error, the function will raise a NetError.

ripemd128()[in hash]

Convenience function that calculates a 128 bits long RIPEMD128 hash

ripemd128

Returns:A lowercase hexadecimal string with the RIPEMD128 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function ripemd128(...)
        hash = RIPEMD128Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a RIPEMD128Hash object, nor finalization.

ripemd160()[in hash]

Convenience function that calculates a 160 bits long RIPEMD160 hash

ripemd160

Returns:A lowercase hexadecimal string with the RIPEMD160 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function ripemd160(...)
        hash = RIPEMD160Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a RIPEMD160Hash object, nor finalization.

ripemd256()[in hash]

Convenience function that calculates a 256 bits long RIPEMD256 hash.

ripemd256

Returns:A lowercase hexadecimal string with the RIPEMD256 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function ripemd256(...)
        hash = RIPEMD256Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a RIPEMD256Hash object, nor finalization.

ripemd320()[in hash]

Convenience function that calculates a 320 bits long RIPEMD320 hash

ripemd320

Returns:A lowercase hexadecimal string with the RIPEMD320 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function ripemd320(...)
        hash = RIPEMD320Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a RIPEMD320Hash object, nor finalization.

sha1()[in hash]

Convenience function that calculates a 160 bits long SHA1 hash

sha1

Returns:A lowercase hexadecimal string with the SHA1 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function sha1(...)
        hash = SHA1Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a SHA1Hash object, nor finalization.

sha224()[in hash]

Convenience function that calculates a 224 bits long SHA224 hash

sha224

Returns:A lowercase hexadecimal string with the SHA224 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function sha224(...)
        hash = SHA224Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a SHA224Hash object, nor finalization.

sha256()[in hash]

Convenience function that calculates a 256 bits long SHA256 hash

sha256

Returns:A lowercase hexadecimal string with the SHA256 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function sha256(...)
        hash = SHA256Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a SHA256Hash object, nor finalization.

sha384()[in hash]

Convenience function that calculates a 384 bits long SHA384 hash

sha384

Returns:A lowercase hexadecimal string with the SHA384 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function sha384(...)
        hash = SHA384Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a SHA384Hash object, nor finalization.

sha512()[in hash]

Convenience function that calculates a 512 bits long SHA512 hash

sha512

Returns:A lowercase hexadecimal string with the SHA512 hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function sha512(...)
        hash = SHA512Hash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a SHA512Hash object, nor finalization.

socketErrorDesc()[in Socket]

Describe the meaning of a networking related system error code.

socketErrorDesc( code )

codeThe error code to be described.
Returns:A string with a textual description of the error.

This function invokes the system code-to-meaning translation for networking errors. The language in which the error code is described depends on the underlying system,

The function can be applied to the fsError field of the NetError class to get a descriptive reason of why some operation failed, or on Socket.lastError.

sub()[in funcext]

Subtracts two items along the rules of VM '-' operator.

sub( a, b )

aFirst operand
bSecond operand
Returns:The result of the subtraction.

This function operates also on strings, arrays and dictionaries replicating the behavior of the "-" operator as it is performed by the VM.

system()[in Process]

Executes an external process via command shell, and waits for its termination.

system( command, background )

commandThe command to be executed.
backgroundIf given and true, the process runs hidden.
Returns:Exit status of the process.
Raises:
ProcessErrorif the process couldn't be created.

This function launches an external system command and waits until the command execution is complete, returning the exit code of the child process. The process is actually executed by passing the command string to the system command shell. In this way, it is possible to execute commands that are parsed by the shell.

This includes internal commands as "dir" in Windows systems, or small scripts as "for file in $(ls); do touch $file; done" if the system shell is sh. However, loading the shell may generate a needless overhead for the most common usages of system(). Use systemCall() if there isn't the need to have the system shell to parse the command.

If the background parameter is true, the execution of the child process is hidden; in example, on systems allocating virtual consoles to new processes, the child is given the parent's console instead. When running inside Window Managers and graphical systems, icons representing the process are usually not visible when this option is set.

systemCall()[in Process]

Executes an external process and waits for its termination.

systemCall( command, background )

commandThe command to be executed.
backgroundIf given and true, the process runs hidden.
Returns:Exit status of the process.
Raises:
ProcessErrorif the process couldn't be created.

This function launches an external system command and waits until the command execution is terminated, returning the exit code of the child process. The command is searched in the system path, if an absolute path is not given. A simple parsing is performed on the string executing the command, so that parameters between quotes are sent to the child process as a single parameter; in example:

 retval = systemCall( "myprog alfa beta \"delta gamma\" omega" )

In this case, the child process will receive four parameters, the third of which being the two words between quotes. Those quotes are not passed to the child process.

If the background parameter is true, the execution of the child process is hidden; in example, on systems allocating virtual consoles to new processes, the child is given the parent's console instead. Icons representing the process are usually not visible when this option is set.

tiger()[in hash]

Convenience function that calculates a 192 bits long Tiger hash

tiger

Returns:A lowercase hexadecimal string with the Tiger hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function tiger(...)
        hash = TigerHash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a TigerHash object, nor finalization.

whirlpool()[in hash]

Convenience function that calculates a 512 bits long Whirlpool hash

whirlpool

Returns:A lowercase hexadecimal string with the Whirlpool hash.

This function takes an arbitrary amount of parameters. See HashBase.update() for details.

The semantics are equal to:

    function whirlpool(...)
        hash = WhirlpoolHash()
        hash.update(...)
        hash.finalize()
        return hash.toString()
    end

Note: This is a shortcut function that does neither require creation of a WhirlpoolHash object, nor finalization.


Made with faldoc 2.2.1