Apple
AppleExtras
Bridges
ObjcBridge
Python
Compilers
Concurrency
Thread
Digests
MD5
SHA1
UUID
Encryption
Blowfish
Filesystem
AsyncRequest
Math
BigNum
ContinuedFraction
Random
Rational
Server
Curses
EditLine
NullAddon
ReadLine
Syslog
SystemCall
User
UserInterface
Clutter
binding
CFFI
Apple
AppleExtras
AppleSensors
A singleton which on Apple computers can:
  • get and set display and keyboard brightness
  • read left and right ambient light sensors (laptops only)
  • read accelerometer sensor (laptops only)
Example use;
	
sensors = AppleSensors clone
value := sensors getRightLightSensor
getDisplayBrightness
Returns a number for the display brightness.
getKeyboardBrightness
Returns a number for the keyboard brightness.
getLeftLightSensor
Returns a number for the left ambient light sensor.
getRightLightSensor
Returns a number for the right ambient light sensor.
setDisplayBrightness(aNumber)
Sets the display brightness. Returns self.
setKeyboardBrightness(aNumber)
Sets the keyboard brightness. Returns self.
smsVector(aVector)
Sets aVector to the current x, y and z accelerometer values. Returns true on success and false on failure.
Audio
LibSndFile
LibSndFile
An object for encoding and decoding audio files (principally WAV and AIFF) using the Libsndfile library.
channels
Returns channels read from the audio file.
close
Closes the file if it is open. Returns self.
format
Returns format read from the audio file.
formatNames
Returns a list of strings with the names of the supported codecs.
openForReading
Opens the file at the path specified in the path slot and sets the following slots:
frames
sampleRate
channels
format
seekable
Returns self.
openForWriting
Opens the file at the path specified in the path slot for writing. The following slots should be set first to specify the output format:
sampleRate
channels
format
Returns self.
outputBuffer
Returns the output buffer.
path
Returns path to audio file.
read(numberOfFrames)
Read a given number of frames (sample pairs). Returns self.
sampleRate
Returns sample rate read from the audio file.
setFormat(aSeq)
Sets the format used for writing. Use the formatNames method to get a list of supported format names. Returns self.
setPath(aPath)
Sets path to audio file.
write(aSeq)
Writes aSeq using the format specified by the slots:
sampleRate
channels
format
Returns the number of frames written.
Sound
Encapsulates a audio file. Usefull for reading an audio file using LibSndFile.
buffer
Returns the buffer used to read the audio file.
format
Returns format read from the audio file.
load
Returns Loads the file data into the buffer in interleaved stereo 32bit float format and sets the sampleRate, channels and format slots. Returns self.
path
Returns path to audio file.
sampleRate
Returns number of channels read from the audio file.
setPath(aPath)
Sets path to audio file.
Ogg
OggPacket
A wrapper around the libogg ogg_packet object. No methods - used internally.
OggPage
A wrapper around the libogg ogg_page object.
bos
Indicates if the current page is the beginning of the stream.
continued
Indicates if the current page contains a continued packet from the last page.
eos
Indicates if the current page is the end of the stream.
granulepos
Returns the precise playback location of this page.
packets
Returns the number of packets in the page.
pageno
Returns the sequential page number for this page.
serialno
Returns the unique serial number of the logical bitstream associated with this page.
setChecksum
Computes and sets the checksum for this page.
version
Returns the ogg_page version that this page uses.
OggStreamState
A wrapper around the libogg ogg_stream_state object.
clear
Clears the storage within the Ogg stream.
eos
Indicates whether we are at the end of the stream.
packetout(packet)
Outputs a packet to the codec-specific decoding engine.
packetpeek(packet)
Provides access to the next packet in the bitstream without advancing decoding.
pagein(page)
Submits a complete page to the stream layer.
reset
Resets the stream status to its initial position.
setSerialNumber
Sets the serial number for this stream.
OggSyncState
A wrapper around the libogg ogg_sync_state object.
clear
Free's any internal storage and resets to the initial state.
pageout(page)
Outputs a page from the synchronisation layer.
pageseek(page)
Finds the borders of pages and resynchronises the stream.
reset
Resets the synchronization status to initial values.
write(seq)
Copies the data from the sequence into the synchronisation layer.
PortAudio
AudioDevice
The AudioDevice object can used to write audio data as if directly to the audio buffer.
asyncRead
Returns the audio read buffer.
asyncWrite(aBuffer)
Writes aBuffer to the audio output buffer and returns immediately.
close
Close the audio stream.
error
Returns an error string if an error has occured, Nil otherwise.
isActive
Returns self if the receiver is active, Nil otherwise.
needsData
Returns true if the receiver can read more data.
open
Open an audio output stream.
openForReadingAndWriting
Open audio output and input streams.
streamTime
Returns the audio stream time as a number.
write(aSeq)
Writes aSeq to the inputBuffer and yields until the receiver is ready for more input data. Returns self.
writeBufferIsEmpty
Returns the true if the audio buffer is empty, false otherwise.
AudioMixer
A minimal audio mixer.
appendSource(aSource)
Adds aSource to sources list. Returns self.
isRunning
Returns true if the mixer is running, false otherwise..
process(sampleCount)
Internal method used for processing a chunk of the input sources. Returns self.
processedSamples
Returns the number of processed samples.
removeSource(aSource)
Removes aSource to sources list. Returns self.
start
Start the mixer loop processing 1/64th of a second chunks by calling process(22050) in a loop. Will not return until stop is called. Returns self.
stop
Stops the mixer if it is running.
streamDestination
The output stream object.
SampleRateConverter
SampleRateConverter
A binding for libsamplerate useful for up or downconverting the sample rate of a raw audio stream. Streams are assumed to be in 32bit float interleaved stereo.
inputBuffer
Returns the input buffer.
outputBuffer
Returns the output buffer.
process
Process the input buffer to perform the conversion. Returns self.
setEndOFInput(aBool)
Sets the end of input flag. Returns self.
setOutputToInputRatio(aNumber)
Returns the output to input ration for the conversion.
start
Stops processing. Returns self.
SoundTouch
SoundTouch
Used to change the tempo and/or pitch of an audio stream. Input and output are in 32 bit floats in 2 channels at a rate of 44100 samples per second.
inputBuffer
Returns the input buffer.
outputBuffer
Returns the output buffer.
process
Processes a chunk of the inputBuffer and appends the results to the outputBuffer.
setChannels(aNumber)
Sets the number of input channels.
setPitchSemitones(aNumber)
Sets the output increase in pitch semitones.
setSampleRate(aNumber)
Sets the input sample rate in Hz.
setTempo(aNumber)
Sets the tempo.
setTempoChange(aNumber)
Sets the tempo change amount.
start
Cleans up SoundTouch.
TagLib
TagLib
Used to set meta data tags on the following audio formats:
ape
flac
mp3
mpc
mpeg
ogg
Supports reading and writing the following attributes:
title
artist
album
year
track
genre 
And reading the attributes:
bitRate
sampleRate
channels
length
Example use (load and modify a track genre):
t := TagLib clone setPath("foo.mp3") load
writeln("genre = ", t genre)
t setGenre("ambient")
t save
load
Loads tag data from the file specified in the path slot. Returns self.
path
Returns the path to the file.
save
Saves the tag settings and returns self.
setPath(aSeq)
Sets the path to the file.
Bridges
ObjcBridge
ObjcBridge
autoLookupClassNamesOn
Removes the ObjC forward method from the Lobby. Returns self.
classNamed(aSeq)
Returns a proxy to the ObjC class with the specified name or nil if no match is found.
debug
On Turns debugging off. Returns self
main
Calls NSApplicationMain().
Python
Python
This object provides access the world of python.
Compilers
Loki
Linker
An object that enables low level introspection into a running Io VM.
bytesToHexSeq(aSeq)
Returns a Sequence containing a hex representation of aSeq.
hexSeqToBytes(aSeq)
Returns a Sequence containing a binary representation of the hex data in aSeq.
makeCFunction(aSeq, slotName, object)
Creates a CFunction which users the beginning address of the data in aSeq as its function pointer and adds the CFunction to the given object on slot slotName.
Compression
LZO
LZO
The LZO object can be used to compress and uncompress data using the Lempel-Ziv-Oberhumer (LZO) lossless data compression algorithm.

Example use;

compressedData := LZO compress(uncompressedData)
uncompressedData := LZO uncompress(compressedData)
compress(aSeq)
Returns a compressed version of aSeq.
uncompress(aSeq)
Returns a uncompressed version of aSeq.
LZODecoder
The LZO object can be used to uncompress data using the Lempel-Ziv-Oberhumer (LZO) lossless data compression algorithm.

Example use;

	
z = LZODecoder clone
z beginProcessing
z inputBuffer appendSeq("this is a message")
z process
z endProcess
result := z outputBuffer 
beginProcessing
Initializes the algorithm.
endProcessing
Finish processing remaining bytes of inputBuffer.
process
Process the inputBuffer and appends the result to the outputBuffer. The processed inputBuffer is emptied except for the spare bytes at the end which don't fit into a cipher block.
LZOEncoder
The LZOEncoder object can be used to compress data using the Lempel-Ziv-Oberhumer (LZO) lossless data compression algorithm.

Example use;

	
z = LZOEncoder clone
z beginProcessing
z inputBuffer appendSeq("this is a message")
z process
z endProcess
result := z outputBuffer 
beginProcessing
Initializes the algorithm.
endProcessing
Finish processing remaining bytes of inputBuffer.
process
Process the inputBuffer and appends the result to the outputBuffer. The processed inputBuffer is emptied except for the spare bytes at the end which don't fit into a cipher block.
Zlib
Zlib
The Zlib object can be used to compress and uncompress data using the zlib lossless data compression algorithm.

Example use;

compressedData := Zlib compress(uncompressedData)
uncompressedData := Zlib uncompress(compressedData)
compress(aSeq)
Returns a compressed version of aSeq.
uncompress(aSeq)
Returns a uncompressed version of aSeq.
ZlibDecoder
For Zlib uncompression. Example use;
	
z = ZlibDecoder clone
z beginProcessing
z inputBuffer appendSeq(inputData)
z process
z endProcess
result := z outputBuffer 
beginProcessing
Initializes the algorithm.
endProcessing
Finish processing remaining bytes of inputBuffer.
inputBuffer
The input buffer for decoding.
outputBuffer
The output buffer for decoding.
process
Process the inputBuffer and appends the result to the outputBuffer. The processed inputBuffer is empties except for the spare bytes at the end which don't fit into a cipher block.
ZlibEncoder
For Zlib compression. Example use:

	
z = ZlibEncoder clone
z beginProcessing
z inputBuffer appendSeq("this is a message")
z process
z endProcess
result := z outputBuffer
beginProcessing
Initializes the algorithm.
endProcessing
Finish processing remaining bytes of inputBuffer.
inputBuffer
The input buffer for decoding.
outputBuffer
The output buffer for decoding.
process
Process the inputBuffer and appends the result to the outputBuffer. The processed inputBuffer is empties except for the spare bytes at the end which don't fit into a cipher block.
Concurrency
Thread
Thread
For native threads. Example use;
	
Thread createThread("1+1") // evals 1+1 in a new thread and an independent Io VM
createThread(aSequence)
Creates a new IoState and evals aSequence in it using a new OS thread. Returns self immediately.
endCurrentThread
Ends the currently running OS thread.
threadCount
Returns the number of OS threads currently running in the process.
Core
Core
Block
Blocks are anonymous functions (messages with their own locals object). They are typically used to represent object methods.
Formatter
Helper object for the asString method.
argumentNames
Returns a List of strings containing the argument names of the receiver.
asSimpleString
Returns a short description of the receiver.
asString
Returns a full description of the receiver with decompiled code.
call(arg0, arg1, ...)
Activates the receiver with the provided arguments.
code
Returns a string containing the decompiled code of the receiver.
justSerialized(stream)
Writes the receiver's code into the stream.
message
Returns the root message of the receiver.
passStops
Returns whether or not the receiver passes return/continue/break to caller.
performOn(anObject, optionalLocals, optionalMessage, optionalSlotContext)
Activates the receiver in the target context of anObject. Returns the result.
print
prints an Io source code representation of the block/method
println
Same as print.
profilerTime
Returns clock() time spent in compiler in seconds.
scope
Returns the scope used when the block is activated or Nil if the target of the message is the scope.
setArgumentNames(aListOfStrings)
Sets the receiver's argument names to those specified in aListOfStrings. Returns self.
setCode(aString)
Set's the receiver's message to a compiled version of aString. Returns self
setMessage(aMessage)
Sets the root message of the receiver to aMessage.
setPassStops(aBool)
Sets whether the receiver passes return/continue/break to caller.
setProfilerOn(aBool)
If aBool is true, the global block profiler is enabled, if false it is disabled. Returns self.
setScope(anObjectOrNil)
If argument is an object, when the block is activated, it will set the proto and self slots of its locals to the specified object. If Nil, it will set them to the target of the message.
CFunction
A container for a pointer to a C function binding. CFunction's can only be defined from the C side and act like blocks in that when placed in a slot, are called when the slot is activated. The for, if, while and clone methods of the Lobby are examples of CFunctions. CFunctions are useful for implementing methods that require the speed of C or binding to a C library.
==(anObject)
Returns self if the argument is a CFunction with the same internal C function pointer.
asSimpleString
Returns the CFunction name.
asString
Same as asSimpleString.
id
Returns a number containing a unique id for the receiver's internal C function.
name
Returns the CFunction name in the form CFunction_Pointer.")
performOn(target, blockLocals, optionalMessage, optionalContext)
Activates the CFunctions with the supplied settings.
typeName
Returns the owning type of the CFunction or nil if the CFunction can be called on any object.
uniqueName
Returns the name given to the CFunction.
Call
Call stores slots related to activation.
activated
Returns the activated value.
argAt(argNumber)
Returns the message's argNumber arg. Shorthand for same as call message argAt(argNumber).
argCount
Returns the number of arguments for the call. Shortcut for "call message argCount".
coroutine
Returns the coroutine in which the message was sent.
delegateTo(target, altSender)
Sends the call's message to target (and relays its stop status). The sender is set to altSender, if it is supplied. Returns the result of the message.
delegateToMethod(target, methodName)
Sends the call's message to target via the method specified by methodName. Returns the result of the message.
description
Returns a description of the receiver as a String.
evalArgAt(argNumber)
Evaluates the specified argument of the Call's message in the context of it's sender.
evalArgs
Returns a list containing the call message arguments evaluated in the context of the sender.
hasArgs
Returns true if the call was passed arguments.
message
Returns the message value.
relayStopStatus(arg)
Sets sender's stop status (Normal, Return, Break, Continue etc.) and returns evaluated argument.
resetStopStatus(arg)
Sets stop status to Normal. See also Call setStopStatus.
sender
Returns the sender value.
setStopStatus(aStatusObject)
Sets the stop status on the call.
slotContext
Returns the slotContext value.
stopStatus
Returns the stop status on the call. (description of stopStatus will be added once we decide whether or not to keep it)
target
Returns the target value.
Collector
A singleton containing methods related to Io's garbage collector. Io currently uses a incremental, non-moving, generational collector based on the tri-color (black/gray/white) algorithm with a write-barrier.

Every N number of object allocs, the collector will walk some of the objects marked as gray, marking their connected white objects as gray and turning themselves black. Every M allocs, it will pause for a sweep where it makes sure all grays are marked black and io_frees all whites.

If the sweepsPerGeneration is set to zero, it will immediately mark all blacks as white again and mark the root objects as gray. Otherwise, it will wait until the sweepsPerGeneration count is reached to do this. By adjusting the allocsPerSweep and sweepsPerGeneration appropriately, the collector can be tuned efficiently for various usage cases. Generally, the more objects in your heap, the larger you'll want this number.

allObjects
Returns a List containing all objects known to the collector.
allocatedStep
Return the allocation step value as a Number.
cleanAllObjects
Sets all objects as clean. Returns self.
collect
Runs garbage collector. Returns the number of items collected.
dirtyObjects
Returns a List containing all dirty objects known to the collector.
marksPerAlloc
Return the number of allocations per collector mark pass.
maxAllocatedBytes
Returns the maximum number of bytes allocated by the collector.
objectWithUniqueId(aNumber)
Returns an object whose uniqueId is aNumber or nil if no match is found. Warning: This lookup currently scans all objects, so it is not efficient, though it should handle thousands of lookups per second.
resetMaxAllocatedBytes
Resets maximum number of bytes allocated by the collector. Returns self.
setAllocatedStep(aNumber)
Sets the allocatedStep (can have a fractional component, but must be larger than 1). A collector sweep is forced when the number of allocated objects exceeds the allocatedSweepLevel. After a sweep, the allocatedSweepLevel is set to the allocated object count times the allocatedStep. Returns self.
setDebug(aBool)
Turns on/off printing of collector debugging messages. Returns self.
setMarksPerAlloc(aNumber)
Sets the number of incremental collector marks per object allocation (can be fractional). Returns self.
showStats
Prints the collector's stats to standard output.
timeUsed
Return the time used so far by the collector in seconds.
Compiler
Contains methods related to the compiling code.
messageForString(aString, optionalLabelString)
Returns the compiled message object for aString.
messageForString2(aString)
Returns the compiled message object for aString. (Runs raw string against lexer directly.)
messageForTokens(aList)
Returns the compiled message object for the given token list.
tokensForString(aString)
Returns a list of token objects lexed from the input string.
Coroutine
Coroutine is an primitive for Io's lightweight cooperative C-stack based threads.
backTraceString
Returns a formatted callStack output along with exception info (if any). In case of CGI script, wraps output with <code> tag.
callStack
Returns a list of Call objects.
currentCoroutine
Returns currently running coroutine in Io state.
debugWriteln
See Object debugWriteln.
exception
Returns the current exception or nil if there is none.
freeStack
Frees all the internal data from the receiver's stack. Returns self.
ignoredCoroutineMethodNames
List of methods to ignore when building a callStack.
implementation
Returns coroutine implementation type: "fibers", "ucontext" or "setjmp"
inException
Set to true when processing an exception in the coroutine.
ioStack
Returns List of values on this coroutine's stack.
isCurrent
Returns true if the receiver is currently running coroutine.
isYielding
Returns true if the receiver is yielding (not paused or running).
label
A label slot useful for debugging purposes.
main
[Seems to be obsolete!] Executes runMessage, resumes parent coroutine.
parentCoroutine
Returns the parent coroutine this one was chained from or nil if it wasn't chained. When a Coroutine ends, it will attempt to resume its parent.
pause
Removes current coroutine from the yieldingCoros queue and yields to another coro. System exit is executed if no coros left.
You can resume a coroutine using either resume or resumeLater message.
pauseCurrentAndResumeSelf
Pauses current coroutine and yields to a receiver.
raiseException
Sets exception in the receiver and resumes parent coroutine.
result
The result set when the coroutine ends.
resume
Yields to the receiver. Runs the receiver if it is not running yet. Returns self.
resumeLater
Promotes receiver to the top of the yieldingCoros queue, but not yielding to it. When current coroutine yields, receiver will resume.
resumeParentCoroutine
Pauses current coroutine and resumes parent.
run
Runs receiver and returns self.
runLocals
The locals object in whose context the coroutine will send its run message.
runMessage
The message to send to the runTarget when the coroutine starts.
runTarget
The object which the coroutine will send a message to when it starts.
setException
setInException(aBool)
Set the inException status. Returns self.
setLabel(aLabel)
Sets the comment label for the Coro. Return self.
setMessageDebugging(aBoolean)
Turns on message level debugging for this coro. When on, this coro will send a vmWillSendMessage message to the Debugger object before each message send and pause itself. See the Debugger object documentation for more information.
setParentCoroutine(aCoro)
Sets the parent coroutine. Returns self.
setResult
setRunLocals
setRunMessage
setRunTarget(anObject)
setStackSize(aNumber)
Sets the stack size in bytes to allocate for new Coros. Returns self.
showStack
Writes backTraceString to STDOUT.
showYielding
Prints a list of yielding coroutines to STDOUT.
stackSize
Stack size allocated for each new coroutine. Coroutines will automatically chain themselves as need if more stack space is required.
typeId
Returns _ string.
yield
Yields to another coroutine in the yieldingCoros queue. Does nothing if yieldingCoros is empty.
yieldCurrentAndResumeSelf
Yields to a receiver.
yieldingCoros
Reference to Scheduler yieldingCoros.
Date
+(aDuration)
Return a new Date with the receiver's value plus an amount of time specified by aDuration object to the receiver.
+=(aDuration)
Add aDuration to the receiver. Returns self.
-(aDurationOrDate)
Return a new Date with the receiver's value minus an amount of time specified by aDuration to the receiver. Returns self.
-=(aDuration)
Subtract aDuration from the receiver. Returns self.
asAtomDate
Returns the date formatted as a valid atom date (rfc4287) in the system's timezone.
asNumber
Returns the date as seconds since 1970 UTC.
asSerialization
Returns a serialization (sequence) of the date that allows for perfect reconstruction of the timestamp.
asString(optionalFormatString)
Returns a string representation of the receiver using the receivers format. If the optionalFormatString argument is present, the receiver's format is set to it first. Formatting is according to ANSI C date formatting rules.

	
%a abbreviated weekday name (Sun, Mon, etc.)
%A full weekday name (Sunday, Monday, etc.)
%b abbreviated month name (Jan, Feb, etc.)
%B full month name (January, February, etc.)
%c full date and time string
%d day of the month as two-digit decimal integer (01-31)
%H hour as two-digit 24-hour clock decimal integer (00-23)
%I hour as two-digit 12-hour clock decimal integer (01-12)
%m month as a two-digit decimal integer (01-12)
%M minute as a two-digit decimal integer (00-59)
%p either "AM" or "PM"
%S second as a two-digit decimal integer (00-59)
%U number of week in the year as two-digit decimal integer (00-52)
with Sunday considered as first day of the week
%w weekday as one-digit decimal integer (0-6) with Sunday as 0
%W number of week in the year as two-digit decimal integer (00-52)
with Monday considered as first day of the week
%x full date string (no time); in the C locale, this is equivalent
to "%m/%d/%y".
%y year without century as two-digit decimal number (00-99)
%Y year with century as four-digit decimal number
%Z time zone name (e.g. EST);
null string if no time zone can be obtained
%% stands for '%' character in output string.
asUTC
Changes the timezone of this date to utc
clock
Returns a number containing the number of seconds of processor time since the beginning of the program or -1 if unavailable.
convertToLocal
Converts self date from a UTC date to the equivalent local date
convertToUTC
Converts self from a local date to the equivalent UTC date
convertToZone(offset, isDST)
Converts self to an equivalent data in a zone with offset (minutes west) and DST (true, false).
copy(aDate)
Sets the receiver to be the same date as aDate. Returns self.
cpuSecondsToRun(expression)
Evaluates message and returns a Number whose value is the cpu seconds taken to do the evaluation.
day
Returns a number containing the day of the month of the receiver.
format
Returns the format string for the receiver. The default is "%Y-%m-%d %H:%M:%S %Z".
fromNumber(aNumber)
Sets the receiver to be aNumber seconds since 1970.
fromSerialization
Sets the date based on the serialization sequence. Return self.
fromString(aString, formatString)
Sets the receiver to the date specified by aString as parsed according to the given formatString. See the Date asString method for formatting rules. Returns self.
gmtOffset
Returns the system's timezone string. E.g., +1300 or -0500.
gmtOffsetSeconds
Returns the system's seconds east of UTC.
hour
Returns a number containing the hour of the day(0-23) of the receiver.
isDST
Returns true if the Date is set to use DST. Posix only.
isDaylightSavingsTime
Returns self if Daylight Saving Time is in effect for the receiver, otherwise returns Nil.
isPast
Returns true if the receiver is a date in the past.
isToday
Returns true if the receiver's date is today's date.
isValidTime(hour, min, sec)
Returns self if the specified time is valid, otherwise returns Nil. A negative value will count back; i.e., a value of -5 for the hour, will count back 5 hours to return a value of 19. No adjustment is done for values above 24.
minute
Returns a number containing the minute of the hour(0-59) of the receiver.
month
Returns a number containing the month(1-12) of the year of the receiver.
now
Sets the receiver to the current time. Returns self.
print
Prints the receiver. Returns self.
second
Returns a number containing the seconds of the minute(0-59) of the receiver. This number may contain fractions of seconds.
secondsSince(aDate)
Returns a number of seconds of between aDate and the receiver.
secondsSinceNow(aDate)
Returns the number of seconds since aDate.
secondsToRun(expression)
Evaluates message and returns a Number whose value is the number of seconds taken to do the evaluation
setDay(aNumber)
Sets the day of the receiver. Returns self.
setGmtOffset
Set the number of minutes west of GMT for this Date's zone
setHour(aNumber)
Sets the hour of the receiver. Returns self.
setMinute(aNumber)
Sets the minute of the receiver. Returns self.
setMonth(aNumber)
Sets the month(1-12) of the receiver. Returns self.
setSecond(aNumber)
Sets the second of the receiver. Returns self.
setYear(aNumber)
Sets the year of the receiver.
today
Set the receiver to the current date, no time information is included. See `now' for the current date and time.
year
Returns a number containing the year of the receiver.
zone
Returns a string containing the system's time zone code.
Debugger
Contains methods related to the IoVM debugger.
debuggerCoroutine
Returns the coroutine used for the debugger.
description
To start debugging a coroutine, call Coroutine currentCoroutine setMessageDebugging(true) Then each message sent within that coroutine will cause the Debugger vmWillSendMessage slot to be activated and the Debugger slots: messageCoroutine, messageSelf, messageLocals, and message will be set with the values related to the current message send. You can override vmWillSendMessage to implement your own debugging mechanisms.
start
Starts the debugger.
vmWillSendMessage
Override this method to implement your own debugging mechanisms. Default behavior is to print every message sent.
Directory
The Directory object supports accessing filesystem directories. A note on paths; if a path begins with a "/" it's the root, if it beings with a "./" it's the launch path, if not specified, "./" is assumed.""")
accessibleAncestors
Returns a list of accessizble ancestor directories.
accessibleParents
Deprecated. Replaced by accessibleAncestors.
ancestorDirectories
Returns a list of ancestor directories.
at(aString)
Returns a File or Directory object matching the name specified by aString or Nil if no such file or directory exists.
create
Create the directory if it doesn't exist. Returns self on success (or if the directory already exists), nil on failure.
createFileNamed(name)
Deprecated. Returns a new file object in the directory with the specified name.
createIfAbsent
Creates the directory (and any missing ancestor directories) if they don't exist. Returns self.
createSubdirectory(name)
Create a subdirectory with the specified name.
currentWorkingDirectory
Returns the current working directory path.
directories
Returns a list of subdirectories in the receiver.
directoryNamed(aName)
Returns a Directory object for the specified file name whether or not it exists.
exists(optionalPath)
Returns true if the Directory path exists, and false otherwise. If optionalPath string is provided, it tests the existence of that path instead.
fileNamed(aName)
Returns a File object for the specified file name whether it exists or not.
fileNames
Returns a list of strings for the names of the files (no subdirectories) in the directory.
files
Returns a list of File objects for the files in the Directory (no directories).
filesWithExtension(aString)
Returns a list of File objects for the files in the Directory (no directories) with the specified file extension.
folderNamed(aName)
Deprecated. Replaced by directoryNamed().
folderNamedCreateIfAbsent(name)
Deprecated. Returns a new Directory object in the directory with the specified name.
folders
Deprecated. Replaced by directories().
isAccessible
Returns true if the directory can be accessed, false otherwise.
items
Returns a list object containing File and Directory objects for the files and directories of the receiver's path.
moveTo(aPath)
Moves the directory to the specified path.
name
Returns the receiver's last path component.
parentDirectory
Returns the parent directory object or nil if there is no parent directory.
parents
Deprecated. Replaced by ancestorDirectories.
path
Returns the directory path. The default path is '.'.
recursiveFilesOfTypes(suffixes)
Returns a list containing all files in the directory or any subdirectory that has any of the specified suffixes.
remove
Removes the directory.
setCurrentWorkingDirectory(pathString)
Sets the current working directory path. Returns true on success or false on error.
setPath(aString)
Sets the directory path. Returns self.
size
Returns a Number containing the number of file and directory objects at the receiver's path.
with(aPath)
Returns a new instance with the provided path.
DynLib
A DLL Loader by Kentaro A. Kurahone.
call(functionName, , , ...)
Call's the dll function of the specified name with the arguments provided. Returns the a Number with the result value.
callPluginInit(functionName)
Call's the dll function of the specified name. Returns the result as a Number or raises an exception on error.
close
Closes the library. Returns self.
freeFuncName
Returns the io_free function name.
initFuncName
Returns the initialization function name.
isOpen
Returns true if the library is open, or false otherwise.
open
Opens the dynamic library and returns self or raises a DynLoad.open Error if there is an error.
path
Returns the path to the dynamic library.
setFreeFuncName(aString)
Sets the io_free function name. Returns self.
setInitFuncName(aString)
Sets the initialization function name for the dynamic library. Returns self.
setPath(aString)
Sets the path to the dynamic library. Returns self.
voidCall(functionName, , , ...)
Same as call but for functions with no return value. Returns nil.
Error
An object that contains error information and flow control based on errors.
ifError(code)
Evaluates code in the context of sender. Returns self.
Another form is Error ifError(error, code). Note: error slot is set in the context of sender, Locals object is not created!
isError
Returns true.
raiseIfError
Raises exception.
returnIfError
Returns self from the context of sender.
with(message)
Returns new error with message slot set.
Exception
The Exception proto is used for raising exceptions and instances are used to hold rexception related info.

Raise

An exception can be raised by calling raise() on an exception proto. Exception raise("generic foo exception")

Try and Catch

To catch an exception, the try() method of the Object proto is used. try() will catch any exceptions that occur within it and return the caught exception or nil if no exception is caught.

e := try()
To catch a particular exception, the Exception catch() method can be used. Example:
e := try(
    // ...
) 

e catch(Exception,
    writeln(e coroutine backtraceString)
)
The first argument to catch indicates which types of exceptions will be caught. catch() returns the exception if it doesn't match and nil if it does.

Pass

To re-raise an exception caught by try(), use the pass method. This is useful to pass the exception up to the next outer exception handler, usually after all catches failed to match the type of the current exception:

e := try(
    // ...
) 

e catch(Error,
    // ...
) catch(Exception,
    // ...
) pass

Custom Exceptions

Custom exception types can be implemented by simply cloning an existing Exception type:

MyErrorType := Error clone
catch(exceptionProto)
Catch an exception with the specified exception prototype.
caughtMessage
Returns the message object associated with the exception.
error
Returns the coroutine that the exception occurred in.
nestedException
Returns the nestedException if there is one.
originalCall
Returns the call object associated with the exception.
pass
Pass the exception up the stack.
raise(error, optionalNestedException)
Raise an exception with the specified error message.
showStack
Print the exception and related stack.
File
Encapsulates file i/o. Here's an example of opening a file, and reversing its lines:
	
file := File clone openForUpdating("/tmp/test")
lines := file readLines reverse
file rewind
lines foreach(line, file write(line, "\n"))
file close
appendToContents(aSeq)
Appends to the contents of the file with aSeq. Returns self.
asBuffer
Opens the receiver in read only mode, reads the whole contents of the file into a buffer object, closes the file and returns the buffer.
at(aNumber)
Returns a Number containing the byte at the specified byte index or Nil if the index is out of bounds.
atPut(positionNumber, byteNumber)
Writes the byte value of byteNumber to the file position positionNumber. Returns self.
baseName
Returns File's name without an extension (returned Sequence consists of all characters up to final period ["."] character).
close
Closes the receiver if open, otherwise does nothing. Returns self. When the file was opened via popen, sets either exitStatus or termSignal to the exit status on normal exit, or the signal causing abnormal termination.
containingDirectory
Deprecated. See parentDirectory.
contents
Returns contents of the file as a mutable Sequence of bytes.
copyToPath(destinationPath)
Copies the file to the specified path.
copyToPathWithoutYielding(destinationPath)
Copies the file to the specified path without yielding.
create
Creates an empty file at the file's path. Returns self on success, nil on failure.
descriptor
Returns the file's descriptor as a number.
exists(optionalPath)
Returns true if the file path exists, and false otherwise. If optionalPath string is provided, it tests the existance of that path instead.
exitStatus
System's close status (after file close).
flush
Forces any buffered data to be written to disk. Returns self.
foreach(optionalIndex, value, message)
For each byte, set index to the index of the byte and value to the number containing the byte value and execute aMessage. Example usage:

	
aFile foreach(i, v, writeln("byte at ", i, " is ", v))
aFile foreach(v, writeln("byte ", v))
foreachLine(optionalLineNumber, line, message)
For each line, set index to the line number of the line and line and execute aMessage. Example usage:
	
aFile foreachLine(i, v, writeln("Line ", i, ": ", v))
aFile foreach(v, writeln("Line: ", v))
groupId
Returns a Number containing the group id associated with the file's path.
isAtEnd
Returns true if the file is at its end. Otherwise returns false.
isDirectory
Returns true if the receiver's path points to a directory, false otherwise.
isLink
Returns true if the receiver's path points to a link, false otherwise.
isOpen
Returns self if the file is open. Otherwise returns Nil.
isPipe
Returns true if the receiver is a pipe, false otherwise.
isRegularFile
Returns true if the receiver's file descriptor is a regular file, false otherwise.
isSocket
Returns true if the receiver's file descriptor is a Socket, false otherwise.
isUserExecutable
Returns true if the receiver is user group executable, false otherwise.
lastAccessDate
Returns a Date object containing the last date and time the file was accessed.
lastDataChangeDate
Returns a Date object containing the last date and time the file's contents were changed.
lastInfoChangeDate
Returns a Date object containing the last date and time the file's meta info was changed.
mode
Returns the open mode of the file(either read, update or append).
moveTo(pathString)
Moves the file specified by the receiver's path to the new path pathString. Raises an File doesNotExist exception if the file does not exist or a File nameConflict exception if the file nameString already exists.
name
Returns the last path component of the file path.
open(optionalPathString)
Opens the file. Creates one if it does not exist. If the optionalPathString argument is provided, the path is set to it before opening. Returns self or raises an File exception on error.
openForAppending(optionalPathString)
Sets the file mode to append (writing to the end of the file) and calls open(optionalPathString).
openForReading(optionalPathString)
Sets the file mode to read (reading only) and calls open(optionalPathString).
openForUpdating(optionalPathString)
Sets the file mode to update (reading and writing) and calls open(optionalPathString). This will not delete the file if it already exists. Use the remove method first if you need to delete an existing file before opening a new one.
parentDirectory
Returns a File for the directory that is the parent directory of this object's path.
path
Returns the file path of the receiver.
popen
Open the file as a pipe. Return self. Closing a popen'ed file sets exitStatus or termSignal to reflect the status or cause of the child processes' termination.
position
Returns the current file pointer byte position as a Number.
positionAtEnd
Sets the file position pointer to the end of the file.
protectionMode
Returns a Number containing the protection mode associated with the file's path.
readBufferOfLength(aNumber)
Reads a Buffer of the specified length and returns it. Returns Nil if the end of the file has been reached.
readLine
Reads the next line of the file and returns it as a string without the return character. Returns Nil if the end of the file has been reached.
readLines
Returns list containing all lines in the file.
readStringOfLength(aNumber)
Reads a String of the specified length and returns it. Returns Nil if the end of the file has been reached.
readToBufferLength(aBuffer, aNumber)
Reads at most aNumber number of items and appends them to aBuffer. Returns number of items read.
readToEnd(chunkSize)
Reads chunkSize bytes (4096 by default) at a time until end of file is reached. Returns a sequence containing the bytes read from the file.
remove
Removes the file specified by the receiver's path. Raises an error if the file exists but is not removed. Returns self.
reopen(otherFile, mode)
Reopen's otherFile and redirects its stream to this file's path using mode. If mode is omitted, it is copied from otherFile. Returns self or raises a File exception on error.
rewind
Sets the file position pointer to the beginning of the file.
setContents(aSeq)
Replaces the contents for the file with aSeq. Returns self.
setPath(aString)
Sets the file path of the receiver to pathString. The default path is an empty string. Returns self.
setPosition(aNumber)
Sets the file position pointer to the byte specified by aNumber. Returns self.
setStreamDestination(aBuffer)
Set the buffer to be used for future stream operations.
size
Returns the file size in bytes.
standardError
Returns a new File whose stream is set to the standard error stream.
standardInput
Returns a new File whose stream is set to the standard input stream.
standardOutput
Returns a new File whose stream is set to the standard output stream.
startStreaming
Begin streamed read to stream destination set by setStreamDestination(aBuffer).
stat
Updates the receiver's meta info cache.
statSize
Returns the file's size in bytes as a Number.
streamDestination
The buffer object to be used for future stream operations.
streamReadSize
Size of stream buffer used for streaming operations
streamTo(aBuffer)
Perform streamed reading to given buffer. The buffer will be appended with chunks of size streamReadSize until EOF. The final chunk may be less than streamReadSize.
streamToWithoutYielding(aBuffer)
Perform streamed reading to given buffer without yielding between reads.
temporaryFile
Returns a new File object with an open temporary file. The file is automatically deleted when the returned File object is closed or garbage collected.
termSignal
Pipe's terminating signal (after file close opened via popen).
thisSourceFile
Returns a File representing the system file in which this Io code exists.
truncateToSize(numberOfBytes)
Trunctates the file's size to the numberOfBytes. Returns self.
userId
Returns a Number containing the user id associated with the file's path.
with(aPath)
Returns a new instance with the provided path.
write(aSequence1, aSequence2, ...)
Writes the arguments to the receiver file. Returns self.
List
A mutable array of values. The first index is 0.
anyOne
Returns a random element of the receiver or nil if the receiver is empty.
append(anObject1, anObject2, ...)
Appends the arguments to the end of the list. Returns self.
appendIfAbsent(anObject)
Adds each value not already contained by the receiver, returns self.
appendSeq(aList1, aList2, ...)
Add the items in the lists to the receiver. Returns self.
asEncodedList
Returns a Sequence with an encoding of the list. Nil, Number and Symbol objects are copied into the encoding, for other object types, referenceIdForObject(item) will be called to request a reference id for the object. Also see: List fromEncodedList.
asJson
Returns JSON encoded representation of a List.
asMap
The reverse of Map asList: converts a list of lists (key-value pairs) into a Map. The first item of each pair list must be a sequence. The second item is the value.
asMessage
Converts each element in the list to unnamed messages with their cached result set to the value of the element (without activating).Returns an unnamed message whose arguments map 1:1 with the elements (after being converted to messages themselves).
at(index)
Returns the value at index. Returns Nil if the index is out of bounds.
atInsert(index, anObject)
Inserts anObject at the index specified by index. Adds anObject if the index equals the current count of the receiver. Raises an exception if the index is out of bounds. Returns self.
atPut(index, anObject)
Replaces the existing value at index with anObject. Raises an exception if the index is out of bounds. Returns self.
average
Returns the average of the items.
capacity
Returns the number of potential elements the receiver can hold before it needs to grow.
contains(anObject)
Returns true if the receiver contains anObject, otherwise returns false.
containsAll(list)
Returns true the target contains all of the items in the argument list.
containsAny(list)
Returns true the target contains any of the items in the argument list.
containsIdenticalTo(anObject)
Returns true if the receiver contains a value identical to anObject, otherwise returns false.
copy(v)
Replaces self with v list items. Returns self.
cursor
Returns a ListCursor for the receiver.
detect(optionalIndex, value, message)
Returns the first value for which the message evaluates to a non-nil. Example: list(1, 2, 3, 4) detect(i, v, v > 2) ==> 3 list(1, 2, 3, 4) detect(v, v > 2) ==> 3
difference(list)
Returns a new list containing items from the target list which aren't in the argument list.
empty
Removes all items from the receiver.
first(optionalSize)
Returns the first item or Nil if the list is empty. If optionalSize is provided, that number of the first items in the list are returned.
flatten
Creates a new list, with all contained lists flattened into the new list. For example: list(1,2,list(3,4,list(5))) flatten ==> list(1, 2, 3, 4, 5)
foreach(optionalIndex, value, message)
Loops over the list values setting the specified index and value slots and executing the message. Returns the result of the last execution of the message. Example:

list(1, 2, 3) foreach(i, v, writeln(i, " = ", v))
list(1, 2, 3) foreach(v, writeln(v))
fromEncodedList(aSeq)
Returns a List with the decoded Nils, Symbols and Numbers from the input raw array. For each object reference encounters, objectForReferenceId(id) will be called to allow the reference to be resolved. Also see: List asEncodedList.
indexOf(anObject)
Returns the index of the first occurrence of anObject in the receiver. Returns Nil if the receiver doesn't contain anObject.
insertAfter(item, afterItem)
Inserts item after first occurance of afterItem and returns self. If afterItem is not found, item is appended to the end of the list.
insertAt(item, index)
Inserts item at the specified index. Raises an exception if the index is out of bounds. Returns self.
insertBefore(item, beforeItem)
Inserts item before first occurance of beforeItem or to the end of the list if beforeItem is not found. Returns self.
intersect(list)
Returns a new list containing the common values from the target and argument lists.
itemCopy
Returns a new list containing the items from the receiver.
join(optionalSeparator)
Returns a Sequence of the concatenated items with optionalSeparator between each item or simply the concatenation of the items if no optionalSeparator is supplied.
join(optionalSeperator)
Returns a String with the elements of the receiver concatenated into one String. If optionalSeperator is provided, it is used to separate the concatenated strings. This operation does not respect string encodings.
justSerialized(stream)
Writes the receiver's code into the stream.
last(optionalSize)
Returns the last item or Nil if the list is empty. If optionalSize is provided, that number of the last items in the list are returned.
map(optionalIndex, value, message)
Same as calling mapInPlace() on a clone of the receiver, but more efficient.
mapInPlace
Same as map, but result replaces self.
pop
Returns the last item in the list and removes it from the receiver. Returns nil if the receiver is empty.
preallocateToSize(aNumber)
Preallocates array memory to hold aNumber number of items.
prepend(anObject1, anObject2, ...)
Inserts the values at the beginning of the list. Returns self.
push(anObject1, anObject2, ...)
Same as add(anObject1, anObject2, ...).
reduce
Also known as foldl or inject. Combines values in target starting on the left. If no initial value is paseed the head of the list is used.
Io> list(1, 2, 3) reduce(+) ==> 6 Io> list(1, 2, 3) reduce(xs, x, xs + x) ==> 6 Io> list(1, 2, 3) reduce(+, -6) // Passing the initial value. ==> 0 Io> list(1, 2, 3) reduce(xs, x, xs + x, -6) ==> 0
remove(anObject, ...)
Removes all occurrences of the arguments from the receiver. Returns self.
removeAt(index)
Removes the item at the specified index and returns the value removed. Raises an exception if the index is out of bounds.
removeFirst
Returns the first item and removes it from the list. nil is returned if the list is empty.
removeLast
Returns the last item and removes it from the list. nil is returned if the list is empty.
removeSeq
Removes each of the items from the current list which are contained in the sequence passed in.
rest
Returns a copy of the list but with the first element removed.
reverse
Reverses the ordering of all the items of the receiver. Returns copy of receiver.
reverseForeach(index, value, message)
Same as foreach, but in reverse order.
reverseInPlace
Reverses the ordering of all the items in the receiver. Returns self.
reverseReduce
Also known as foldr or inject. Combines values in target starting on the right. If no initial value is paseed the head of the list is used. See List reverse for examples.
second
Returns third element (same as at(2))
select(optionalIndex, value, message)
Like foreach, but the values for which the result of message are non-nil are returned in a new List. Example: list(1, 5, 7, 2) select(i, v, v > 3) print ==> 5, 7 list(1, 5, 7, 2) select(v, v > 3) print ==> 5, 7
select(optionalIndex, value, message)",
"Like foreach, but the values for which the result of message are non-nil are returned in a new List. Example: list(1, 5, 7, 2) select(i, v, v > 3) print ==> 5, 7 list(1, 5, 7, 2) select(v, v > 3) print ==> 5, 7
selectInPlace
Same as select, but result replaces self.
setSize
Sets the size of the receiver by either removing excess items or adding nils as needed.
shuffle
Randomizes the ordering of all the items of the receiver. Returns copy of receiver.
shuffleInPlace
Randomizes the order of the elements in the receiver. Returns self.
size
Returns the number of items in the receiver.
slice(startIndex, endIndex, step)
Returns a new string containing the subset of the receiver from the startIndex to the endIndex. The endIndex argument is optional. If not given, it is assumed to be the end of the string. Step argument is also optional and defaults to 1, if not given. However, since Io supports positional arguments only, you need to explicitly specify endIndex, if you need a custom step.
sliceInPlace(startIndex, endIndex, step)
Returns the receiver containing the subset of the receiver from the startIndex to the endIndex. The endIndex argument is optional. If not given, it is assumed to be the end of the string. Step argument is also optional and defaults to 1.
sort
Returns a new list containing the sorted items from the receiver.
sortBy(aBlock)
Returns a new list containing the items from the receiver, sorted using aBlock as compare function. Example: list(1, 3, 2, 4, 0) sortBy(block(a, b, a > b)) ==> list(4, 3, 2, 1, 0)
sortInPlace(optionalExpression)
Sorts the list using the compare method on the items. Returns self. If an optionalExpression is provided, the sort is done on the result of the evaluation of the optionalExpression on each value.
sortInPlaceBy(aBlock)
Sort the list using aBlock as the compare function. Returns self.
sum
Returns the sum of the items.
swapIndices(index1, index2)
Exchanges the object at index1 with the object at index2. Raises an exception if either index is out of bounds. Returns self.
union(list)
Returns a new list containing items from the target and items which are only in the argument list.
unique
Returns a new list containing all the values in the target, but no duplicates.
uniqueCount
Returns a list of list(value, count) for each unique value in self.
with(anObject, ...)
Returns a new List containing the arguments.
Map
A key/value dictionary appropriate for holding large key/value collections.
asJson
Converts a Map to a string that represents contents in JSON-compilant form
asList
Converts a Map to a list of lists. Each element in the returned list will be a list of two elements: the key, and the value.
asObject
Create a new Object whose slotDescriptionMap will be equal to self
asQueryString
Returns an escaped query string representation of this map
at(keyString, optionalDefaultValue)
Returns the value for the key keyString. Returns nil if the key is absent.
atIfAbsentPut(keyString, aValue)
If a value is present at the specified key, the value is returned. Otherwise, inserts/sets aValue and returns aValue.
atPut(keyString, aValue)
Inserts/sets aValue with the key keyString. Returns self.
detect(optionalIndex, optionalValue, message)
Returns a random value for which message evals to non-nil.
empty
Removes all keys from the receiver. Returns self.
foreach(optionalKey, value, message)
For each key value pair, sets the locals key to the key and value to the value and executes message. Example:
	aMap foreach(k, v, writeln(k, " = ", v))
aMap foreach(v, write(v))
Example use with a block:
	myBlock = block(k, v, write(k, " = ", v, "\n"))
aMap foreach(k, v, myBlock(k, v))
hasKey(keyString)
Returns true if the key is present or false otherwise.
hasValue(aValue)
Returns true if the value is one of the Map's values or false otherwise.
isEmpty
returns true if this map doesn't contain any pairs.
isNotEmpty
returns true if this map contains at least one pair.
justSerialized(stream)
Writes the receiver's code into the stream.
keys
Returns a List of the receivers keys.
map(key, value, message)
Create a List of results of message applied to self's items in a random order.
merge(anotherMap)
Returns a new map created by merging the pairs from anotherMap into this map
mergeInPlace(anotherMap)
Merges the pairs from anotherMap into this map
removeAt(keyString)
Removes the specified keyString if present. Returns self.
reverseMap
Create a new Map using values as keys and keys as values
select(optionalIndex, optionalValue, message)
Create a new Map with keys,values of self for which message evaluated to non-nil.
size
Returns the number of key/value pairs in the receiver.
values
Returns a List of the receivers values.
with(key1, value1, key2, value2, ...)
Returns a new map containing the given keys and values
Message
A Message object encapsulates the action of a message send. Blocks are composed of a Message and its children.

Terminology

Example:
  Io> msg := message(A B(C D); E F)
  ==> A B(C D); E F
  
In the above example:
  msg name            =>  A
  msg next            =>  B(C D); E F
  msg next arguments  =>  list(C D)
  msg next next name  =>  ;
  msg next next next  =>  E F
Important: Modifying the message tree of a block currently in use may cause a crash if a garbage collection cycle occurs. If the implementation were changed to retain every called message, this could be avoided. But the cost to performance seems to outweigh the need to cover this case for now.
appendArg(aMessage)
Adds aMessage to the argument list of receiver. Examples,
	
Io> message(a) appendArg(message(b))
==> a(b)

Io> message(a(1,2)) appendArg(message(3))
==> a(1, 2, 3)
appendCachedArg(aValue)
Adds aValue to the argument list of receiver as a cachedResult.
argAt(indexNumber)
Returns Message object for the specified argument or Nil if none exists.
argCount
Returns the number of arguments this message has. A faster way to do, msg arguments size. Examples,
	
Io> message(a(1,2,3)) argCount
==> 3

Io> message(a) argCount
==> 0
argsEvaluatedIn(anObject)
Returns a List containing the argument messages evaluated in the context of anObject.
arguments
Returns a list of the message objects that act as the receiver's arguments. Modifying this list will not alter the actual list of arguments. Use the arguments_() method to do that.
asMessageWithEvaluatedArgs(optionalContext)
Returns a copy of receiver with arguments evaluated in the context of sender if optionalContext is nil.
asSimpleString
Returns one-line string representation up to 40 characters long.
asStackEntry
Returns a string containing message name, file and line.
asString
Same as code().
cachedResult
Returns the cached result of the Message or Nil if there is none.
characterNumber
Returns the message character number. The charcter number is typically the beginning character index in the source text from with the message was read.
clone
Returns a Message that is a deep copy of the receiver.
code
Returns a String containing a decompiled code representation of the receiver.
codeOfLength(n)
Same as Message code, but returns first n characters only.
description
Returns a string containing a short description of the method.
doInContext(anObject, locals)
Evaluates the receiver in the context of anObject. Optional locals object is used as message sender. anObject is used as sender otherwise.
evaluatedArgs
Returns a List containing the argument messages evaluated in the context.
fluxPath
The directory where the .io files for the Flux views are located. This directory is added to the Importer searchPaths.
fluxSource
The directory of Flux where Flux.io is located. This directory is added to the Importer searchPaths.
fromString(aString)
Returns a new Message object for the compiled(but not executed) result of aString.
hasCachedResult
Returns true if there is a cached result. Nil is a valid cached result.
isEndOfLine
Returns true if the message marks the end of the line. A ';' message.
label
Returns the message label. The label is typically set to the name of the file from which the source code for the message was read.
last
Returns the last message in the chain.
lastBeforeEndOfLine
Returns the last message in the chain before the EndOfLine or nil.
lineNumber
Returns the line number of the message. The charcter number is typically the line number in the source text from with the message was read.
name
Returns the name of the receiver.
next
Returns the next message in the message chain or nil if there is no next message.
nextIgnoreEndOfLines
Returns the next message in the message chain which is not an EndOfLine or nil if there is no next message.
previous
Returns the previous message in the message chain or Nil if there is no previous message.
removeCachedResult
Removes the cached result of the Message.
setArguments(aListOfMessages)
Sets the arguments of the receiver to deep copies of those contained in aListOfMessages. Returns self.
setCachedArgs(listOfValues)
Appends evaluated arguments to a message. Returns self.
setCachedResult(anObject)
Sets the cached result of the message. Returns self.
setCharacterNumber(aNumber)
Sets the character number of the message. Returns self.
setLabel(aString)
Sets the label of the message and its children. Returns self.
setLineNumber(aNumber)
Sets the line number of the message. Returns self.
setName(aString)
Sets the name of the receiver. Returns self.
setNext(aMessageOrNil)
Sets the next message in the message chain to a deep copy of aMessage or it removes the next message if aMessage is nil.
setPrevious(aMessageOrNil)
Sets the previous message in the message chain to a deep copy of aMessage or it removes the previous message if aMessage is Nil.
union(other) Creates a union of the receiver and the other parameter.
Returns a new message object with the receivers message as the first argument of the returned message, and the other parameter's arguments as each successive argument to the new message.
  Io> message(a) union(message(b))
  ==> [unnamed](a, b)
  
Number
A container for a double (a 64bit floating point number on most platforms).
%(aNumber)
Returns the receiver modulus aNumber.
&(aNumber)
Returns a new number with the bitwise AND of the receiver and aNumber.
*(aNumber)
Returns a new number that is the product of the receiver and aNumber.
**(aNumber)
Same as pow(aNumber).
+(aNumber)
Returns a new number that is the sum of the receiver and aNumber.
-(aNumber)
Returns a new number that is the difference of the receiver and aNumber.
/(aNumber)
Returns a new number with the value of the receiver divided by aNumber.
<<(aNumber)
Shifts the bits of the receiver left by the number of places specified by aNumber.
>>(aNumber)
Shifts the bits of the receiver right by the number of places specified by aNumber.
^(aNumber)
Returns the bitwise xor with the receiver (both numbers are converted to longs for the operation).
abs
Returns a number with the absolute value of the receiver.
acos
Returns a number with the arc cosine of the receiver.
asBinary
Returns the number as binary digits inside a string. 42 asBinary -> "101010"
asBuffer(optionalNumberOfBytes)
Returns a Buffer containing a the number of bytes specified by optionalNumberOfBytes (up to the size of a double on the platform) of the receiver. If no optionalNumberOfBytes is specified, it is assumed to be the number of bytes in a double on the host platform.
asCharacter
Returns a String containing a single character whose value is the value of the first byte of the receiver. Returns nil if the number has no valid UCS mapping.
asHex
Returns the number as hex digits inside a string. 97 asHex -> "61"
asLowercase
Returns a new Number containing a lower case version of the receiver.
asNumber
Returns self.
asOctal
Returns the number as octal digits inside a string. 436 asOctal -> "664"
asString(optionalIntegerDigits, optionalFactionDigits)
Returns a string representation of the receiver. For example:
1234.5678 asString(0, 2)
would return:
1234.57
asUint32Buffer
Returns a Sequence containing a 4 byte representation of the uint32 value of the receiver.
asUppercase
Returns a new Number containing a upper case version of the receiver.
asin
Returns a number with the arc sine of the receiver.
at(bitIndexNumber)
Returns a new Number containing 1 if the receiver cast to a long has its bit set to 1 at bitIndexNumber. Otherwise returns 0.
atan
Returns a number with the arc tangent of the receiver.
atan2(aNumber)
Returns a number with the arc tangent of y/x where y is the receiver and x is aNumber.
between(aNumber1, aNumber2)
Returns true if the receiver's value is between or equal to aNumber1 and aNumber2, otherwise returns false.
bitwiseAnd(aNumber)
Returns a new number with the bitwise AND of the receiver and aNumber.
bitwiseComplement
Returns a new number with the bitwise complement of the receiver. (The 0 bits become 1s and the 1 bits become 0s. )
bitwiseOr(aNumber)
Returns a new number with the bitwise AND of the receiver and aNumber.
bitwiseXor(aNumber)
Returns a new number with the bitwise XOR of the receiver and aNumber.
ceil
Returns the a number with the receiver's value rounded up to the nearest integer if its fractional component is greater than 0.
clip(aNumber1, aNumber2)
Returns self if the receiver is between aNumber1 and aNumber2. Returns aNumber1 if it is less than aNumber1. Returns aNumber2 if it is greater than aNumber2.
combinations(size)
Returns the combinations where the receiver is the number of different objects and size is the number to be arranged.
constants
Object containing number constants e, inf, nan and pi.
cos
Returns the cosine of the receiver.
cubed
Returns the cube of the receiver.
doubleMin
Returns the minimum double precision float value.
e
Returns the constant e.
exp
Returns e to the power of the receiver.
factorial
Returns the factorial of the receiver.
floatMax
Returns the maximum double precision float value.
floatMin
Returns the minimum float value.
floor
Returns a number with the receiver's value rounded down to the nearest integer if its fractional component is not 0.
inf
Returns a not-a-number constant.
integerMax
Returns the maximum integer value.
integerMin
Returns the minimum integer value.
isAlphaNumeric
Returns true if receiver is an alphanumeric character value , false otherwise.
isControlCharacter
Returns true if receiver is a control character value , false otherwise.
isDigit
Returns true if receiver is a numeric digit value , false otherwise.
isEven
Returns true if integer form of the receiver is even , false otherwise.
isGraph
Returns true if the receiver is a printing character value except space , false otherwise.
isHexDigit
Returns true if the receiver is a hexadecimal character value , false otherwise.
isInASequenceSet
Return true if receiver is in one of the Sequence sequenceSets, otherwise false.
isLetter
Returns true if receiver is a letter character value , false otherwise.
isLowercase
Returns true if the receiver is a lowercase character value , false otherwise.
isNan
Returns true if the receiver is not a number. Otherwise returns false.
isOdd
Returns true if integer form of the receiver is odd , false otherwise.
isPrint
Returns true if the receiver is a printing character value, including space , false otherwise.
isPunctuation
Returns true if the receiver is a punctuation character value , false otherwise.
isSpace
Returns true if the receiver is a space, formfeed, newline carriage return, tab or vertical tab character value , false otherwise.
isUppercase
Returns true if the receiver is a uppercase character value , false otherwise.
justSerialized(stream)
Writes the receiver's code into the stream.
log
Returns the logarithm of the receiver. The base is taken as the value of the first argument or the constant e if the first argument is omitted.
log10
Returns the base 10 logarithm of the receiver.
log2
Returns the base 2 logarithm of the receiver.
longMax
Returns the maximum long value.
longMin
Returns the minimum long value.
max(aNumber)
Returns the greater of the receiver and aNumber.
min(aNumber)
Returns the lesser of the receiver and aNumber.
minMax(low, high)
Returns a number between or equal to low and high. If the receiver is equal to or between low and high, the receiver is returned. If the receiver is less than low, low is returned. If the receiver is greater than high, high is returned.
mod(aNumber)
Returns the receiver modulus aNumber.
nan
Returns a infinity constant.
negate
Returns new number that is negated version of the receiver.
permutations(size)
Returns the permutations where the receiver is the number of different objects and size is the number to be arranged.
pi
Returns the constant pi.
pow(aNumber)
Returns the value of the receiver to the aNumber power.
print
Prints the number.
repeat(optionalIndex, expression)
Evaluates message a number of times that corresponds to the receivers integer value. This is significantly faster than a for() or while() loop.
round
Returns a number with the receiver's value rounded up to the nearest integer if its fraction component is >= .5 or rounded up to the nearest integer otherwise.
roundDown
Returns a number with the receiver's value rounded down to the nearest integer if its fraction component is <= .5 or rounded up the the nearest integer otherwise.
shortMax
Returns the maximum short value.
shortMin
Returns the minimum short value.
sin
Returns the sine of the receiver.
sqrt
Returns the square root of the receiver.
squared
Returns the square of the receiver.
tan
Returns the tangent of the receiver.
toBase(base)
Returns the number in another base. 42 toBase(2) -> "101010"
toBaseWholeBytes(base)
Returns the number in another base printing out entire bytes. 42 toBaseWholeBytes(2) -> "00101010"
toggle
Returns 1 if the receiver is 0. Returns 0 otherwise.
unsignedIntMax
Returns the maximum unsigned int value.
unsignedLongMax
Returns the maximum unsigned long value.
unsignedShortMax
Returns the minimum unsigned int value.
|(aNumber)
Returns a new number with the bitwise OR of the receiver and aNumber.
Object
An Object is a key/value dictionary with string keys and values of any type. The prototype Object contains a clone slot that is a CFuntion that creates new objects. When cloned, an Object will call its init slot (with no arguments).
!=(aValue)
Returns true the receiver is not equal to aValue, false otherwise.
(expression)
The '' method evaluates the argument and returns the result.
-(aNumber)
Returns the negative version of aNumber. Raises an exception if argument is not a number.
..(arg)
.. is an alias for: method(arg, self asString append(arg asString))
<(expression)
Evaluates argument and returns self if self is less or Nil if not.
<=(expression)
Evaluates argument and returns self if self is less than or equal to it, or Nil if not.
==(aValue)
Returns true if receiver and aValue are equal, false otherwise.
>(expression)
Evaluates argument and returns self if self is greater than it, or Nil if not.
>=(expression)
Evaluates argument and returns self if self is greater than or equal to it, or Nil if not.
?(aMessage)
description: Sends the message aMessage to the receiver if it can respond to it. Example:
	MyObject test // performs test
	MyObject ?test // performs test if MyObject has a slot named test
	
The search for the slot only follows the receivers proto chain.
@
Sends asynchronous message to an object, returns a FutureProxy.
Caller coroutine is paused when proxy is accessed (i.e. message is sent) till result is ready. Proxy will become an actual result when it is ready.
See IoGuide for more information.
Usage: obj @someMethod(a, b, c)
@@
Same as Object @, but returns nil instead of FutureProxy.
Might be useful in a command line or as a last expression in a block/method when you don't want to return a future.
NullCharacter
A sequence with a single zero byte.
actorProcessQueue
Processes each message in a queue, yielding between each message.
actorRun
Starts actor mode if not started already. Basically, sets actorProcessQueue for later execution.
ancestorWithSlot(slotName)
Returns the first ancestor of the receiver that contains a slot of the specified name or Nil if none is found.
ancestors
Returns a list of all of the receiver's ancestors as found by recursively following the protos links.
and(arg)
Evaluates argument and returns the result.
appendProto(anObject)
Appends anObject to the receiver's proto list. Returns self.
apropos
Prints out Protos Core slot descriptions.
argIsActivationRecord
Note: seems to be an obsolete method.
argIsCall(arg)
Returns true if arg is an activation context (i.e. Call object)
Note: this is used internally in one place only (Coroutine callStack). Refactoring should be considered.
asSimpleString
Returns _ string.
asString
Same as slotSummary.
become(anotherObject)
Replaces receiver with anotherObject and returns self. Useful for implementing transparent proxies. See also FutureProxy and Object @.
Note: primitives cannot become new values.
block(args..., body)
Creates a block and binds it to the sender context (i.e. lexical context). In other words, block locals' proto is sender's locals. args is a list of formal arguments (can be empty).
body is evaluated in the context of Locals object.
See also Object method.
	Io> block(x, x*2) scope == thisContext
  ==> true
	
break(optionalReturnValue)
Break the current loop, if any.
checkMemory()
accesses memory in the IoObjectData struct that should be accessible. Should cause a memory access exception if memory is corrupt.
clone
Returns a clone of the receiver.
cloneWithoutInit
Returns a clone of the receiver but does not call init.
compact
Compact the memory for the object if possible. Returns self.
compactState
Attempt to compact the memory of the IoState if possible.
compare(anObject)
Returns a number containing the comparison value of the target with anObject.
contextWithSlot(slotName)
Returns the first context (starting with the receiver and following the lookup path) that contains a slot of the specified name or Nil if none is found.
continue
Skip the rest of the current loop iteration and start on the next, if any.
coroDo(code)
Creates a new coro to be run in a context of sender and yields to it. Returns a coro.
coroDoLater(code)
Returns a new coro to be run in a context of sender. New coro is moved to the top of the yieldingCoros queue to be executed when current coro yields.
Note: run target is self (i.e. receiver), not call sender as in coroDo.
coroFor(code)
Returns a new coro to be run in a context of sender.
coroWith(code)
Returns a new coro to be run in a context of receiver.
currentCoro
Returns the currently running coroutine.
debugOff
Sets debugWriteln to nil. Returns self.
debugOn
Sets debugWriteln to writeln. Returns self.
debugWriteln
Method for writing debug messages (nil/writeln by default)
deprecatedWarning(optionalNewName)
Prints a warning message that the current method is deprecated. If optionalNewName is supplied, the warning will suggest using that instead. Returns self.
do(expression)
Evaluates the message in the context of the receiver. Returns self.
doFile(pathString)
Evaluates the File in the context of the receiver. Returns the result. pathString is relative to the current working directory.
doMessage(aMessage, optionalContext)
Evaluates the message object in the context of the receiver. Returns the result. optionalContext can be used to specific the locals context in which the message is evaluated.
doRelativeFile(pathString)
Evaluates the File in the context of the receiver. Returns the result. pathString is relative to the file calling doRelativeFile. (Duplicate of relativeDoFile)
doString(aString)
Evaluates the string in the context of the receiver. Returns the result.
doURL(urlString)
Fetches the URL and evals it in the context of the receiver.
evalArg(expression)
The '' method evaluates the argument and returns the result.
evalArgAndReturnNil(expression)
Evaluates the argument and returns nil.
evalArgAndReturnSelf(expression)
Evaluates the argument and returns the target.
for(, , , )
A for-loop control structure. See the io Programming Guide for a full description.
foreach([name,] value, message)
For each slot, set name to the slot's name and value to the slot's value and execute message. Examples:

myObject foreach(n, v,
	writeln("slot ", n, " = ", v type)
)

myObject foreach(v,
	writeln("slot type ", v type)
)
foreachSlot(slotName, slotValue, code)
Iterates over all the slots in a receiver. Provides slotValue (non-activated) along with slotName. Code is executed in context of sender. slotName and slotValue become visible in the receiver (no Locals created! Maybe, it is not the best decision).
  Io> thisContext foreachSlot(n, v, n println)
  Lobby
  Protos
  exit
  forward
  n
  v
  ==> false
  
forward
Called when the receiver is sent a message it doesn't recognize. Default implementation raises an "Object doesNotRespond" exception. Subclasses can override this method to implement proxies or special error handling.

Example:

myProxy forward = method(
	messageName := thisMessage name
	arguments := thisMessage arguments
	myObject doMessage(thisMessage)
)
getLocalSlot(slotNameString)
Returns the value of the slot named slotNameString (not looking in the object's protos) or nil if no such slot is found.
getSlot(slotNameString)
Returns the value of the slot named slotNameString (following the lookup path) or nil if no such slot is found.
handleActorException(exception)
Callback for handling exceptions during asynchronous message processing.
Default value: method(e, e showStack)
hasLocalSlot(slotNameString)
Returns true if the slot exists in the receiver or false otherwise.
hasProto(anObject)
Returns true if anObject is found in the proto path of the target, false otherwise.
hasSlot(name)
Returns true if slot is found somewhere in the inheritance chain (including receiver itself).
if(, , )
Evaluates trueMessage if condition evaluates to a non-Nil. Otherwise evaluates optionalFalseMessage if it is present. Returns the result of the evaluated message or Nil if none was evaluated.
ifDebug(code)
Executes code if debugWriteln is not nil.
ifError
Does nothing, returns self.
ifNil(arg)
Does nothing, returns self.
ifNilEval(arg)
Does nothing, returns self.
ifNonNil(arg)
Evaluates argument and returns self.
ifNonNilEval(arg)
Evaluates argument and returns the result.
in(aList)
Same as: aList contains(self)
inlineMethod
Creates a method which is executed directly in a receiver (no Locals object is created).
  Io> m := inlineMethod(x := x*2)
  Io> x := 1
  ==> 1
  Io> m
  ==> 2
  Io> m
  ==> 4
  Io> m
  ==> 8
  
isActivatable
Returns true if the receiver is activatable, false otherwise.
isError
Returns false if not an error.
isIdenticalTo(aValue)
Returns true if the receiver is identical to aValue, false otherwise.
isKindOf(anObject)
Returns true if anObject is in the receiver's ancestors.
isLaunchScript
Returns true if the current file was run on the command line. Io's version of Python's __file__ == "__main__"
isNil
Returns false.
isTrue
Returns true.
justSerialized(stream)
Writes serialized representation to a SerializationStream. Returns stream contents. [This is unintended side effect! Returned value may change in the future.]
launchFile(pathString)
Eval file at pathString as if from the command line in its folder.
lazySlot(code)
Defines a slot with a lazy initialization code. Code is run only once: the first time slot is accessed. Returned value is stored in a regular slot.
  Io> x := lazySlot("Evaluated!" println; 17)
  Io> x
  Evaluated!
  ==> 17
  Io> x
  ==> 17
  Io> x
  ==> 17
  

Another form is lazySlot(name, code):
  Io> lazySlot("x", "Evaluated!" println; 17)
  Io> x
  Evaluated!
  ==> 17
  Io> x
  ==> 17
  Io> x
  ==> 17
  
list(...)
Returns a List containing the arguments.
localsForward
CFunction used by Locals prototype for forwarding.
localsUpdateSlot(slotNameString, valueObject)
Local's version of updateSlot mthod.
loop(expression)
Keeps evaluating message until a break.
markClean
Cleans object's slots.
memorySize
Return the amount of memory used by the object.
memorySizeOfState
Returns the number of bytes in the IoState (this may not include memory allocated by C libraries).
message(expression)
Return the message object for the argument or Nil if there is no argument. Note: returned object is a mutable singleton. Use "message(foo) clone" if you wish to modify it.
method(args..., body)
Creates a method. args is a list of formal arguments (can be empty).
body is evaluated in the context of Locals object.
Locals' proto is a message receiver (i.e. self).
Slot with a method is activatable. Use getSlot(name) to retrieve method object without activating it (i.e. calling).
See also Object block.
newSlot(slotName, aValue)
Creates a getter and setter for the slot with the name slotName and sets its default value to aValue. Returns self. For example, newSlot("foo", 1) would create slot named foo with the value 1 as well as a setter method setFoo().
not
Returns nil.
or(arg)
Returns true.
ownsSlots
A debug method.
pSlots
PDB extension to set a list of slots to persist with PDB. Creates the specified slots using newSlot and sets them to nil.
pause
Removes current coroutine from the yieldingCoros queue and yields to another coro. Exits if no coros left.
See Coroutine documentation for more details.
perform(methodName, , , ...)
Performs the method corresponding to methodName with the arguments supplied.
performWithArgList(methodName, argList)
Performs the method corresponding to methodName with the arguments in the argList.
persist
Force immediate persistence of this object with PDB.
persistData
Force immediate persistence of this object's serialized form (using asSerialization) into PDB, if possible.
persistMetaData
Force immediate persistence of this object's type data into PDB
persistSlots
Force immediate persistence of this object's dirty slots into PDB.
ppid
This PDB extension returns a unique identifier for this object and registers it for persistence with PDB.
prependProto(anObject)
Prepends anObject to the receiver's proto list. Returns self.
print
Prints a string representation of the object. Returns Nil.
println
Same as print, but also prints a new line. Returns self.
proto
Same as; method(self protos first)
protos
Returns a copy of the receiver's protos list.
raiseIfError
Does nothing, returns self.
relativeDoFile(pathString)
Evaluates the File in the context of the receiver. Returns the result. pathString is relative to the file calling doRelativeFile. (Duplicate of doRelativeFile)
removeAllProtos
Removes all of the receiver's protos. Returns self.
removeAllSlots
Removes all of the receiver's slots. Returns self.
removeProto(anObject)
Removes anObject from the receiver's proto list if it is present. Returns self.
removeSlot(slotNameString)
Removes the specified slot (only) in the receiver if it exists. Returns self.
resend
Send the message used to activate the current method to the Object's proto. For example:
  Dog := Mammal clone do(
    init := method(
  	  resend
    )
  )
  
Calling Dog init will send an init method to Mammal, but using the Dog's context.
return(anObject)
Return anObject from the current execution block.
returnIfError
Does nothing, returns self.
returnIfNonNil
Returns the receiver from the current execution block if it is non nil. Otherwise returns the receiver locally.
self
Returns self.
serialized
Returns a serialized representation of the receiver.
  Io> Object clone do(x:=1) serialized
  ==> Object clone do(
  	x := 1
  )
  
serializedSlots(stream)
Writes all slots to a stream.
serializedSlotsWithNames(names, stream)
Writes selected slots to a stream.
setIsActivatable(aValue)
When called with a non-Nil aValue, sets the object to call its activate slot when accessed as a value. Turns this behavior off if aValue is Nil. Only works on Objects which are not Activatable Primitives (such as CFunction or Block). Returns self.
setPpid
PDB extension to set the value returned by ppid.
setProto(anObject)
Sets the first proto of the receiver to anObject, replacing the current one, if any. Returns self.
setProtos(aList)
Replaces the receiver's protos with a copy of aList. Returns self.
setSlot(slotNameString, valueObject)
Sets the slot slotNameString in the receiver to hold valueObject. Returns valueObject.
setSlotWithType(slotNameString, valueObject)
Sets the slot slotNameString in the receiver to hold valueObject and sets the type slot of valueObject to be slotNameString. Returns valueObject.
shallowCopy
Returns a shallow copy of the receiver.
shouldPersistByDefault
PDB boolean flag indicating whether this object should be considered for persistence when persistence has not been specifically requested by calling ppid() or PDB addObjectToPersist. Always false by default for Object.
slotDescriptionMap
Returns raw map of slot names and short values' descriptions. See also Object slotSummary.
slotNames
Returns a list of strings containing the names of the slots in the receiver (but not in its lookup path).
slotSummary
Returns a formatted slotDescriptionMap.
  Io> slotSummary
  ==>  Object_0x30c590:
    Lobby            = Object_0x30c590
    Protos           = Object_0x30c880
    exit             = method(...)
    forward          = method(...)
  
slotValues
Returns a list of the values held in the slots of the receiver.
stopStatus
Returns the internal IoState->stopStatus.
super(aMessage)
Sends the message aMessage to the receiver's proto with the context of self. Example:
	self test(1, 2)   // performs test(1, 2) on self
	super(test(1, 2)) // performs test(1, 2) on self proto but with the context of self
	
switch(, , , , ...)
Execute an expression depending on the value of the caller. (This is an equivalent to C switch/case) hour := Date hour switch( 12, "midday", 0, "midnight", 17, "teatime", Date hour asString )
tailCall(expression)
Does a tailCall on the currently executing Block. Example:
	
Io> a := method(x, x = x + 1; if(x > 10, return x); tailCall(x))
==> method(x, updateSlot("x", x +(1));
		if(x >(10), return(x));
		tailCall(x))
Io> a(1)
==> 11
thisContext
Synonym to self.
thisLocalContext
Returns current locals.
thisMessage
Returns the calling message (i.e. thisMessage itself, huh).
try(code)
Executes particular code in a new coroutine. Returns exception or nil if no exception is caught.
See also documentation for Exception catch and pass.
type
Returns a string containing the name of the type of Object (Number, String, etc).
uniqueHexId
Returns uniqueId in a hexadecimal form (with a "0x" prefix)
  Io> Object uniqueId
  ==> 3146784
  Io> Object uniqueHexId
  ==> 0x300420
  
uniqueId
Returns a Number containing a unique id for the receiver.
unpersist
PDB extension to populate this object with the data associated with this object's ppid from PDB.
updateSlot(slotNameString, valueObject)
Same as setSlot(), but raises an error if the slot does not already exist in the receiver's slot lookup path.
wait(s)
Pauses current coroutine for at least s seconds.
Note: current coroutine may wait much longer than designated number of seconds depending on circumstances.
while(, expression)
Keeps evaluating message until condition return Nil. Returns the result of the last message evaluated or Nil if none were evaluated.
write()
Sends a print message to the evaluated result of each argument. Returns Nil.
writeln()
Same as write() but also writes a return character at the end. Returns Nil.
yield
Yields to another coroutine. Does nothing if yieldingCoros queue is empty.
See Coroutine documentation for more details.
Profiler
Basic support for profiling Io code execution.
reset
Resets the profilerTime on all Block objects in the system.
timedObjects
Returns a list of objects found in the system that have profile times.
Sandbox
Sandbox can be used to run separate instances of Io within the same process.
doSandboxString(aString)
Evaluate aString inside the Sandbox.
messageCount
Returns a number containing the messageCount limit of the Sandbox.
printCallback(string)
default implementation is; method(string, string print)
setMessageCount(anInteger)
Sets the messageCount limit of the receiver.
setTimeLimit(aDouble)
Sets the time limit of the Sandbox.
timeLimit
Returns a number containing the time limit of calls made to the Sandbox.
Scheduler
Io's coroutine scheduler.
currentCoroutine
Returns the currently running coroutine.
setTimers(aListOfTimers)
Sets the list of active timers.
setYieldingCoros(aListOfCoros)
Sets the list of yielding Coroutine objects.
timers
The List of active timers.
yieldingCoros
The List of yielding Coroutine objects.
Sequence
A Sequence is a container for a list of data elements. Typically these elements are each 1 byte in size. A Sequence can be either mutable or immutable. When immutable, only the read-only methods can be used.

Terminology

  • Buffer: A mutable Sequence of single byte elements, typically in a binary encoding
  • Symbol or String: A unique immutable Sequence, typically in a character encoding
*(aSeq)
Multiplies the values of aSeq to the corresponding values of the receiver returning a new vector with the result. Only works on Sequences whose item type is numeric.
*=(aSeq)
Multiplies the values of aSeq to the corresponding values of the receiver. Only works on Sequences whose item type is numeric. Returns self.
+(aSeq)
Vector addition - Adds the values of aSeq to the corresponding values of the receiver returning a new vector with the result. Only works on Sequences whose item type is numeric.
+=(aSeq)
Vector addition - adds the values of aSeq to those of the receiver. Only works on Sequences whose item type is numeric. Returns self.
-=(aSeq)
Vector subtraction - subtracts the values of aSeq to those of the receiver. Only works on Sequences whose item type is numeric. Returns self.
..(aSequence)
Returns a copy of the receiver with aSequence appended to it.
/(aSeq)
Divides the values of aSeq to the corresponding values of the receiver returning a new vector with the result. Only works on Sequences whose item type is numeric.
/=(aSeq)
Divides the values of aSeq to the corresponding values of the receiver. Only works on Sequences whose item type is numeric. Returns self.
Max
Returns the maximum value in the sequence.
Min
Returns the minimum value in the sequence.
abs
Sets each value of the Sequence to its absolute value. Returns self.
acos
Sets each value of the Sequence to the trigonometric arcsine of it's value. Returns self.
afterSeq(aSequence)
Returns the slice of the receiver (as a Symbol) after aSequence or nil if aSequence is not found. If aSequence is empty, the receiver (or a copy of the receiver if it is mutable) is returned.
alignCenter(width, [padding]) ""
Example: Io> "abc" alignCenter(10, "-") ==> ---abc---- Io> "abc" alignCenter(10, "-=") ==> -=-abc-=-=
alignLeft(width, [padding])
Example:

Io> "abc" alignLeft(10, "+") ==> abc+++++++ Io> "abc" alignLeft(10, "-=") ==> abc-=-=-=-

alignLeftInPlace(width, [padding])
Same as align left but operation is performed on the receiver.
alignRight(width, [padding])
Example:

Io> "abc" alignRight(10, "-") ==> -------abc Io> "abc" alignRight(10, "-=") ==> -=-=-=-abc

allMatchesOfRegex(aRegexOrString)
Returns a List containing all matches of the given regex found in the receiver.
append(aNumber)
Appends aNumber (cast to a byte) to the receiver. Returns self.
appendPathSeq(aSeq)
Appends argument to the receiver such that there is one and only one path separator between the two. Returns self.
appendSeq(object1, object2, ...)
Calls asString on the arguments and appends the string to the receiver. Returns self.
asBase64(optionalCharactersPerLine)
Returns an immutable, base64 encoded (according to RFC 1421) version of self. optionalCharactersPerLine describes the number of characters between line breaks and defaults to 0.
asBinaryNumber
Returns a Number containing the first 8 bytes of the receiver without casting them to a double. Endian is same as machine.
asBinarySignedInteger
Returns a Number with the bytes of the receiver interpreted as a binary signed integer. Endian is same as machine.
asBinaryUnsignedInteger
Returns a Number with the bytes of the receiver interpreted as a binary unsigned integer. Endian is same as machine.
asCapitalized
Returns a copy of the receiver with the first charater made uppercase.
asFile
Returns a new File object with the receiver as its path.
asFixedSizeType
Returns a new sequence with the receiver encoded in the minimal fixed width text encoding that its characters can fit into (either, ascii, utf8, utf16 or utf32).
asHTML
SGML extension to interpret the Sequence as HTML and return an SGML object using SGMLParser elementForString
asHex
Returns a hex string for the receiving sequence, e.g., \"abc\" asHex -> \"616263\".")
asIoPath
Returns a Io style path for an OS style path.
asJid
Converts Sequence to JID object.
"cow@moo.com/Scandinavia" asJid
asJson
Converts to form that could be interpreted as json if it already contains json, e.g. {"aaa":"bbb"} --> "{\"aaa\":\"bbb\"}"
asLowercase
Returns a symbol containing the reveiver made lowercase.
asMessage(optionalLabel)
Returns the compiled message object for the string.
asMutable
Returns a mutable copy of the receiver.
asNumber
Returns the receiver converted to a number. Initial whitespace is ignored.
asOSPath
Returns a OS style path for an Io style path.
asRegex
Returns a new Regex created from the receiver.
asSGML
SGML extension to interpret the Sequence as SGML and return an SGML object using SGMLParser elementForString
asStruct(memberList)
For a sequence that contains the data for a raw memory data structure (as used in C), this method can be used to extract its members into an Object. The memberList argument specifies the layout of the datastructure. Its form is:

list(memberType1, memberName1, memberType2, memberName2, ...)

Member types include:

int8, int16, int32, int64
uint8, uint16, uint32, uint64
float32, float64 
Example:
pointObject := structPointSeq asStruct(list("float32", "x", "float32", "y"))
The output pointObject would contain x and y slots with Number objects.
asSymbol
Returns a immutable Sequence (aka Symbol) version of the receiver.
asUCS2
Returns a new copy of the receiver converted to UCS2 (fixed character width UTF16) encoding.
asUCS4
Returns a new copy of the receiver converted to UCS4 (fixed character width UTF32) encoding.
asURL
Returns a new URL object instance with the receiver as its url string.
asUTF8
Returns a new copy of the receiver converted to utf8 encoding.
asUppercase
Returns a symbol containing the reveiver made uppercase.
asUrl
Shortcut for HCUrl with(aUrlSeq)
asXML
SGML extension to interpret the Sequence as XML and return an SGML object using SGMLParser elementForString
asin
Sets each value of the Sequence to the trigonometric arcsine of it's value. Returns self.
at(aNumber)
Returns a value at the index specified by aNumber. Returns nil if the index is out of bounds.
atInsertSeq(indexNumber, object)
Calls asString on object and inserts the string at position indexNumber. Returns self.
atPut(aNumberIndex, aNumber)
Sets the value at the index specified by aNumberIndex to aNumber. Returns self.
atan
Sets each value of the Sequence to the trigonometric arctangent of it's value. Returns self.
beforeSeq(aSequence)
Returns the slice of the receiver (as a Symbol) before aSequence or self if aSequence is not found.
beginsWithSeq(aSequence)
Returns true if the receiver begins with aSequence, false otherwise.
betweenSeq(aSequence, anotherSequence)
Returns a new Sequence containing the bytes between the occurrence of aSequence and anotherSequence in the receiver. If aSequence is empty, this method is equivalent to beforeSeq(anotherSequence). If anotherSequence is nil, this method is equivalent to afterSeq(aSequence). nil is returned if no match is found.
bitAt(bitIndex)
Returns a Number containing the bit at the bit index value.
bitCount
Returns the number of bits in the sequence.
bitwiseAnd(aSequence)
Updates the receiver to be the result of a bitwiseAnd with aSequence. Returns self.
bitwiseNot(aSequence)
Updates the receiver to be the result of a bitwiseNot with aSequence. Returns self.
bitwiseOr(aSequence)
Updates the receiver to be the result of a bitwiseOr with aSequence. Returns self.
bitwiseXor(aSequence)
Updates the receiver to be the result of a bitwiseXor with aSequence. Returns self.
byteAt(byteIndex)
Returns a Number containing the byte at the byte index value.
capitalize
First charater of the receiver is made uppercase.
ceil
Round each value to smallest integral value not less than x. Returns self.
clear
Set all values in the sequence to 0. Returns self.
clipAfterSeq(aSequence)
Removes the contents of the receiver after the end of the first occurance of aSequence. Returns true if anything was removed, or false otherwise.
clipAfterStartOfSeq(aSequence)
Removes the contents of the receiver after the beginning of the first occurance of aSequence. Returns true if anything was removed, or false otherwise.
clipBeforeEndOfSeq(aSequence)
Removes the contents of the receiver before the end of the first occurance of aSequence. Returns true if anything was removed, or false otherwise.
clipBeforeSeq(aSequence)
Clips receiver before aSequence.
cloneAppendPath(aSequence)
Appends argument to a copy the receiver such that there is one and only one path separator between the two and returns the result.
contains(aNumber)
Returns true if the receiver contains an element equal in value to aNumber, false otherwise.
containsAnyCaseSeq(aSequence)
Returns true if the receiver contains the aSequence regardless of casing, false otherwise.
containsSeq(aSequence)
Returns true if the receiver contains the substring aSequence, false otherwise.
convertToItemType(aTypeName)
Converts the underlying machine type for the elements, expanding or contracting the size of the Sequence as needed. Valid names are uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, and float64. Note that 64 bit types are only available on platforms that support such types. Returns self.
copy(aSequence)
Replaces the bytes of the receiver with a copy of those in aSequence. Returns self.
cos
Sets each value of the Sequence to the trigonometric cosine of it's value. Returns self.
cosh
Sets each value of the Sequence to the hyperbolic cosine of its value. Returns self.
distanceTo(aSeq)
Returns a number with the square root of the sum of the square of the differences of the items between the sequences.
dotProduct(aSeq)
Returns a new Sequence containing the dot product of the receiver with aSeq.
duplicateIndexes
Duplicates all indexes in the receiver. For example, list(1,2,3) duplicateIndexes == list(1,1,2,2,3,3). Returns self.
empty
Sets all bytes in the receiver to 0x0 and sets its length to 0. Returns self.
encoding
Returns the encoding of the elements.
endsWithSeq(aSequence)
Returns true if the receiver ends with aSequence, false otherwise.
escape
Escape characters in the receiver are replaced with escape codes. For example a string containing a single return character would contain the following 2 characters after being escaped: "\n". Returns self.
escapeRegexChars
Returns a clone of the receiver with all special regular expression characters ("^", "$", etc) backslashed. Useful if you have a string that contains such characters, but want it to be treated as a literal string.
exclusiveSlice(inclusiveStartIndex, exclusiveEndIndex)
Returns a new string containing the subset of the receiver from the inclusiveStartIndex to the exclusiveEndIndex. The exclusiveEndIndex argument is optional. If not given, it is assumed to be one beyond the end of the string.
exp
Sets each value of the Sequence to e**value. Returns self.
fileName
Returns the last path component sans the path extension.
findNthSeq(aSequence, n)
Returns a number with the nth occurence of aSequence.
findRegex(aRegexOrString, [startIndex])
Returns the first match of the given regex in the receiver, after the given start index. If you don't specify a start index, the search will start at the beginning of the receiver. The method returns nil if no match is found.
findSeq(aSequence, optionalStartIndex)
Returns a number with the first occurrence of aSequence in the receiver after the startIndex. If no startIndex is specified, the search starts at index 0. nil is returned if no occurences are found.
findSeqs(listOfSequences, optionalStartIndex)
Returns an object with two slots - an \"index\" slot which contains the first occurrence of any of the sequences in listOfSequences found in the receiver after the startIndex, and a \"match\" slot, which contains a reference to the matching sequence from listOfSequences. If no startIndex is specified, the search starts at index 0. nil is returned if no occurences are found.
floor
Round each value to largest integral value not greater than x. Returns self.
foreach(optionalIndex, value, message)
For each element, set index to the index of the element and value to the element value and execute message. Example:
	
aSequence foreach(i, v, writeln("value at index ", i, " is ", v))
aSequence foreach(v, writeln("value ", v))
fromBase(aNumber)
Returns a number with a base 10 representation of the receiver converted from the specified base. Only base 2 through 32 are currently supported.
fromBase64
Returns an immutable, base64 decoded (according to RFC 1421) version of self.
greaterThan(aSeq)
Returns true if the receiver is greater than aSeq, false otherwise.
greaterThanOrEqualTo(aSeq)
Returns true if the receiver is greater than or equal to aSeq, false otherwise.
hasMatchOfRegex(aRegexOrString)
Returns true if the string contains one or more matches of the given regex.
hash
Returns a Number containing a hash of the Sequence.
inclusiveSlice(inclusiveStartIndex, inclusiveEndIndex)
Returns a new string containing the subset of the receiver from the inclusiveStartIndex to the inclusiveEndIndex. The inclusiveEndIndex argument is optional. If not given, it is assumed to be the end of the string.
interpolate(ctx)
Returns immutable copy of self with interpolateInPlace(ctx) passed to the copy.
interpolateInPlace(optionalContext)
Replaces all #{expression} with expression evaluated in the optionalContext. If optionalContext not given, the current context is used. Returns self.
isEmpty
Returns true if the size of the receiver is 0, false otherwise.
isEqualAnyCase(aSequence)
Returns true if aSequence is equal to the receiver ignoring case differences, false otherwise.
isLowercase
Returns self if all the characters in the string are lower case.
isMutable
Returns true if the receiver is a mutable Sequence or false otherwise.
isSymbol
Returns true if the receiver is a immutable Sequence (aka, a Symbol) or false otherwise.
isUppercase
Returns self if all the characters in the string are upper case.
isZero
Returns true if all elements are 0, false otherwise.
itemCopy
Returns a new sequence containing the items from the receiver.
itemSize
Returns number of bytes in each element.
itemType
Returns machine type of elements.
justSerialized(stream)
Writes the receiver's code into the stream.
lastPathComponent
Returns a string containing the receiver clipped up to the last path separator.
lessThan(aSeq)
Returns true if the receiver is less than aSeq, false otherwise.
lessThanOrEqualTo(aSeq)
Returns true if the receiver is less than or equal to aSeq, false otherwise.
linePrint
Prints the Sequence and a newline character.
log
Sets each value of the Sequence to the natural log of its value. Returns self.
log10
Sets each value of the Sequence to the base 10 log of its value. Returns self.
logicalAnd(aSequence)
Updates the receiver's values to be the result of a logical OR operations with the values of aSequence. Returns self.
logicalOr(aSequence)
Updates the receiver's values to be the result of a logical OR operations with the values of aSequence. Returns self.
lowercase
Makes all the uppercase characters in the receiver lowercase. Returns self.
lstrip(aSequence)
Strips the characters in aSequence stripped from the beginning of the receiver. Example:

	
"Keep the tail" lstrip(" eKp")
==> "the tail"
makeFirstCharacterLowercase
Receiver must be mutable (see also asMutable). Returns receiver.
  Io> "ABC" asMutable makeFirstCharacterLowercase
  ==> aBC
  
makeFirstCharacterUppercase
Receiver must be mutable (see also asMutable). Returns receiver.
  Io> "abc" asMutable makeFirstCharacterUppercase
  ==> Abc
  
matchesOfRegex(aRegexOrString)
Returns a RegexMatches object that enumerates all matches of the given regex in the receiver.
matchesRegex(aRegexOrString)
Returns true if the receiver matches the given regex, false if not.
max
Returns the maximum value of the Sequence.
mean
Returns the arithmetic mean of the sequence.
meanSquare
Returns the arithmetic mean of the sequence's values after they have been squared.
min
Returns the minimum value of the Sequence.
negate
Negates the values of the receiver. Returns self.
normalize
Divides each value of the Sequence by the max value of the sequence. Returns self.
occurancesOfSeq(aSeq)
Returns count of aSeq in the receiver.
pathComponent
Returns a slice of the receiver before the last path separator as a symbol.
pathExtension
Returns a string containing the receiver clipped up to the last period.
preallocateToSize(aNumber)
If needed, resize the memory alloced for the receivers byte array to be large enough to fit the number of bytes specified by aNumber. This is useful for pio_reallocating the memory so it doesn't keep getting allocated as the Sequence is appended to. This operation will not change the Sequence's length or contents. Returns self.
prependSeq(object1, object2, ...)
Prepends given objects asString in reverse order to the receiver. Returns self.")
print
Prints contents of a sequence.
product
Returns the product of all the sequence's values multipled together.
rangeFill
Sets the values of the Sequence to their index values. Returns self.
removeAt(index)
Removes the item at index. Returns self.
removeEvenIndexes
Removes even indexes in the receiver. For example, list(1,2,3) removeEvenIndexes == list(1, 3). Returns self.
removeLast
Removes the last element from the receiver. Returns self.
removeOddIndexes
Removes odd indexes in the receiver. For example, list(1,2,3) removeOddIndexes == list(2). Returns self.
removePrefix(aSequence)
If the receiver begins with aSequence, it is removed. Returns self.
removeSeq(aSequence)
Removes occurances of aSequence from the receiver.
removeSlice(startIndex, endIndex)
Removes the items from startIndex to endIndex. Returns self.
removeSuffix(aSequence)
If the receiver end with aSequence, it is removed. Returns self.
repeated(n)
Returns a new sequence containing the receiver repeated n number of times.
replaceFirstSeq(aSequence, anotherSequence, optionalStartIndex)
Returns a new Sequence with the first occurance of aSequence replaced with anotherSequence in the receiver. If optionalStartIndex is provided, the search for aSequence begins at that index. Returns self.
replaceMap(aMap)
In the receiver, the keys of aMap replaced with its values. Returns self.
replaceSeq(aSequence, anotherSequence)
Returns a new Sequence with all occurances of aSequence replaced with anotherSequence in the receiver. Returns self.
reverse
Reverses the ordering of all the items of the receiver. Returns copy of receiver.
reverseFindSeq(aSequence, startIndex)
Returns a number with the first occurrence of aSequence in the receiver before the startIndex. The startIndex argument is optional. By default reverseFind starts at the end of the string. Nil is returned if no occurrences are found.
reverseInPlace
Reverses the bytes in the receiver, in-place.
rstrip(aSequence)
Strips the characters in aSequence stripped from the end of the receiver. Example:
	
"Cut the tail off" rstrip(" afilot")
==> "Cut the"
set(aNumber1, aNumber2, ...)
Sets the values of the receiver to the sequences of numbers in the arguments. Unset values will remain unchanged. Returns self.
setEncoding(encodingName)
Sets the encoding flag of the receiver (only the encoding flag, itemSize and itemType will change, no conversion is done between UTF encodings - you can use convertToUTF8, etc methods for conversions). Valid encodings are number, utf8, utf16, and utf32. Returns self.
setItemType(aTypeName)
Sets the underlying machine type for the elements. Valid names are uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, and float64. Note that 64 bit types are only available on platforms that support such types. Returns self.
setItemsToDouble(aNumber)
Sets all items in the Sequence to the double floating point value of aNumber.
setItemsToLong(aNumber)
Sets all items in the Sequence to the long integer value of aNumber.
setSize(aNumber)
Sets the length in bytes of the receiver to aNumber. Return self.
sin
Sets each value of the Sequence to the trigonometric sine of it's value. Returns self.
sinh
Sets each value of the Sequence to the hyperbolic sine of its value. Returns self.
size
Returns the length in number of items (which may or may not be the number of bytes, depending on the item type) of the receiver. For example,

	
"abc" size == 3
sizeInBytes
Returns the length in bytes of the receiver.
slice
Deprecated method. Use exSlice instead.
slicesBetween(startSeq, endSeq)
Returns a list of slices delimited by startSeq and endSeq.
  Io> "" slicesBetween("<", ">")
  ==> list("a", "b", "/b", "/a")
  
sort
Sorts the characters/numbers in the array. Returns self.
split Returns a list containing the sub-sequences of the receiver divided by the given arguments.
If no arguments are given the sequence is split on white space.
split(optionalArg1, optionalArg2, ...)
Returns a list containing the sub-sequences of the receiver divided by the given arguments. If no arguments are given the sequence is split on white space. Examples:
	
"a b c d" split == list("a", "b", "c", "d")
"a*b*c*d" split("*") == list("a", "b", "c", "d")
"a*b|c,d" split("*", "|", ",") == list("a", "b", "c", "d")
"a   b  c d" split == list("a", "", "", "", "b", "", "", "c", "", "d")
splitAt(indexNumber)
Returns a list containing the two parts of the receiver as split at the given index.
splitAtRegex(aRegexOrString)
Splits the receiver into pieces using the given regex as the delimiter and returns the pieces as a list of strings.
splitNoEmpties(optionalArg1, optionalArg2, ...)
Returns a list containing the non-empty sub-sequences of the receiver divided by the given arguments. If no arguments are given the sequence is split on white space. Examples: "a b c d" splitNoEmpties => list("a", "b", "c", "d") "a***b**c*d" splitNoEmpties("*") => list("a", "b", "c", "d") "a***b||c,d" splitNoEmpties("*", "|", ",") => list("a", "b", "c", "d")
sqrt
Sets each value of the Sequence to the square root of its value. Returns self.
square
Sets each value of the Sequence to the square of its value. Returns self.
strip(optionalSequence)
Trims the whitespace (or optionalSequence) off both ends:

	
"   Trim this string   \r\n" strip
==> "Trim this string"
sum
Returns the sum of the Sequence.
tan
Sets each value of the Sequence to the trigonometric tangent of it's value. Returns self.
tanh
Sets each value of the Sequence to the hyperbolic tangent of its value. Returns self.
toBase(aNumber)
Returns a Sequence containing the receiver (which is assumed to be a base 10 number) converted to the specified base. Only base 8 and 16 are currently supported.
translate(fromChars, toChars)
In the receiver, the characters in fromChars are replaced with those in the same positions in toChars. Returns self.
unescape
Escape codes replaced with escape characters. Returns self.
uppercase
Makes all characters of the receiver uppercase.
whiteSpaceStrings
Returns a List of strings. Each string contains a different whitespace character.
with(aSequence, ...)
Returns a new Sequence which is the concatination of the arguments. The returned sequence will have the same mutability status as the receiver.
withStruct(memberList)
This method is useful for producing a Sequence containing a raw datastructure with the specified types and values. The memberList format is:

list(memberType1, memberName1, memberType2, memberName2, ...)

Member types include:

int8, int16, int32, int64
uint8, uint16, uint32, uint64
float32, float64 
Example:
pointStructSeq := Sequence withStruct(list("float32", 1.2, "float32", 3.5))
The output pointStructSeq would contain 2 raw 32 bit floats.
System
Contains methods related to the IoVM.
activeCpus
Returns the number of active CPUs.
args
Returns the list of command line argument strings the program was run with.")
daemon(dontChroot, dontRedirectOutputStreams)
Become a daemon process. If dontChroot is false, the process will change its directory to /. If dontRedirectOutputStreams is false, stdout and stderr are redirected to /dev/null.
distribution
Returns the Io distribution name as a string.
errorNumber
Returns the C errno string.
exit(optionalReturnCodeNumber)
Shutdown the IoState (io_free all objects) and return control to the calling program (if any).
getEnvironmentVariable(nameString)
Returns a string with the value of the environment variable whose name is specified by nameString.
getOptions(args)
This primitive is used to get command line options similar to Cs getopt(). It returns a map in containing the left side of the argument, with the value of the right side. (The key will not contain the beginning dashes (--).

Example:

	options := System getOptions(args)
	options foreach(k, v,
	  if(v type == List type,
		v foreach(i, j, writeln(\"Got unnamed argument with value: \" .. j))
		continue
	  )
	  writeln(\"Got option: \" .. k .. \" with value: \" .. v)
	)
	
installPrefix
Returns the root path where io was installed. The default is /usr/local.
ioPath
Returns the path of io installation. The default is $INSTALL_PREFIX/lib/io.
launchPath
Returns a pathComponent of the launch file.
launchScript
Returns the path of the io file run on the command line. Returns nil if no file was run.
maxRecycledObjects
Returns the max number of recycled objects used.
platform
Returns a string description of the platform.
platformVersion
Returns the version id of the OS.
recycledObjectCount
Returns the current number of objects being held for recycling.
runCommand
Calls system and redirects stdout/err to tmp files. Returns object with exitStatus, stdout and stderr slots.
setEnvironmentVariable(keyString, valueString)
Sets the environment variable keyString to the value valueString.
setLobby(anObject)
Sets the root object of the garbage collector.
setMaxRecycledObjects(aNumber)
Sets the max number of recycled objects used.
sleep(secondsNumber)
Performs a *blocking* sleep call for specified number of seconds.
symbols
Returns a List containing all Symbols currently in the system.
system(aString)
Makes a system call and returns a Number for the return value.
thisProcessPid()
Return the process id (pid) for this Io process.
userInterruptHandler
Called when control-c is hit. Override to add custom behavior. Returns self.
version
Returns a version number for Io.
WeakLink
A WeakLink is a primitive that can hold a reference to an object without preventing the garbage collector from collecting it. The link reference is set with the setLink() method. After the garbage collector collects an object, it informs any (uncollected) WeakLink objects whose link value pointed to that object by calling their "collectedLink" method.
link
Returns the link pointer or Nil if none is set.
setLink(aValue)
Sets the link pointer. Returns self.
Flux
Message
A Message object encapsulates the action of a message send. Blocks are composed of a Message and its children.

Terminology

Example:
  Io> msg := message(A B(C D); E F)
  ==> A B(C D); E F
  
In the above example:
  msg name            =>  A
  msg next            =>  B(C D); E F
  msg next arguments  =>  list(C D)
  msg next next name  =>  ;
  msg next next next  =>  E F
Important: Modifying the message tree of a block currently in use may cause a crash if a garbage collection cycle occurs. If the implementation were changed to retain every called message, this could be avoided. But the cost to performance seems to outweigh the need to cover this case for now.
appendArg(aMessage)
Adds aMessage to the argument list of receiver. Examples,
	
Io> message(a) appendArg(message(b))
==> a(b)

Io> message(a(1,2)) appendArg(message(3))
==> a(1, 2, 3)
appendCachedArg(aValue)
Adds aValue to the argument list of receiver as a cachedResult.
argAt(indexNumber)
Returns Message object for the specified argument or Nil if none exists.
argCount
Returns the number of arguments this message has. A faster way to do, msg arguments size. Examples,
	
Io> message(a(1,2,3)) argCount
==> 3

Io> message(a) argCount
==> 0
argsEvaluatedIn(anObject)
Returns a List containing the argument messages evaluated in the context of anObject.
arguments
Returns a list of the message objects that act as the receiver's arguments. Modifying this list will not alter the actual list of arguments. Use the arguments_() method to do that.
asMessageWithEvaluatedArgs(optionalContext)
Returns a copy of receiver with arguments evaluated in the context of sender if optionalContext is nil.
asSimpleString
Returns one-line string representation up to 40 characters long.
asStackEntry
Returns a string containing message name, file and line.
asString
Same as code().
cachedResult
Returns the cached result of the Message or Nil if there is none.
characterNumber
Returns the message character number. The charcter number is typically the beginning character index in the source text from with the message was read.
clone
Returns a Message that is a deep copy of the receiver.
code
Returns a String containing a decompiled code representation of the receiver.
codeOfLength(n)
Same as Message code, but returns first n characters only.
description
Returns a string containing a short description of the method.
doInContext(anObject, locals)
Evaluates the receiver in the context of anObject. Optional locals object is used as message sender. anObject is used as sender otherwise.
evaluatedArgs
Returns a List containing the argument messages evaluated in the context.
fluxPath
The directory where the .io files for the Flux views are located. This directory is added to the Importer searchPaths.
fluxSource
The directory of Flux where Flux.io is located. This directory is added to the Importer searchPaths.
fromString(aString)
Returns a new Message object for the compiled(but not executed) result of aString.
hasCachedResult
Returns true if there is a cached result. Nil is a valid cached result.
isEndOfLine
Returns true if the message marks the end of the line. A ';' message.
label
Returns the message label. The label is typically set to the name of the file from which the source code for the message was read.
last
Returns the last message in the chain.
lastBeforeEndOfLine
Returns the last message in the chain before the EndOfLine or nil.
lineNumber
Returns the line number of the message. The charcter number is typically the line number in the source text from with the message was read.
name
Returns the name of the receiver.
next
Returns the next message in the message chain or nil if there is no next message.
nextIgnoreEndOfLines
Returns the next message in the message chain which is not an EndOfLine or nil if there is no next message.
previous
Returns the previous message in the message chain or Nil if there is no previous message.
removeCachedResult
Removes the cached result of the Message.
setArguments(aListOfMessages)
Sets the arguments of the receiver to deep copies of those contained in aListOfMessages. Returns self.
setCachedArgs(listOfValues)
Appends evaluated arguments to a message. Returns self.
setCachedResult(anObject)
Sets the cached result of the message. Returns self.
setCharacterNumber(aNumber)
Sets the character number of the message. Returns self.
setLabel(aString)
Sets the label of the message and its children. Returns self.
setLineNumber(aNumber)
Sets the line number of the message. Returns self.
setName(aString)
Sets the name of the receiver. Returns self.
setNext(aMessageOrNil)
Sets the next message in the message chain to a deep copy of aMessage or it removes the next message if aMessage is nil.
setPrevious(aMessageOrNil)
Sets the previous message in the message chain to a deep copy of aMessage or it removes the previous message if aMessage is Nil.
union(other) Creates a union of the receiver and the other parameter.
Returns a new message object with the receivers message as the first argument of the returned message, and the other parameter's arguments as each successive argument to the new message.
  Io> message(a) union(message(b))
  ==> [unnamed](a, b)
  
NotificationCenter
Notification
name
Returns the name of the notification.
post
Posts the notification to the NotificationCenter.
sender
Returns the sender of the notification.
setName(anObject)
Sets the name of the Notification. Returns self.
setSender(anObject)
Sets the sender of the Notification. Returns self.
NotificationCenter
An NotificationCenter similar to the one found in Apple's FoundationKit.

Example use:

// in listener
listener := NotificationListener clone setTarget(self) setName("FeedDownloadedFile") start

// in sender
Notification clone setSender(self) setName("FeedDownloadedFile") post

// note: notifications can also be reused, and any extra data can be added in it's slots

// to stop listening
listener stop
addListener(aNotificationListener)
Removes aNotificationListener from listeners list. Returns self.
listeners
Returns list of NotificationListeners.
postNotification(aNotification)
Sends aNotification to be handled by listeners. Returns self. Implementation:
listeners foreach(handleNotification(n))
NotificationListener
action
Returns the name of the message that is sent to the target when a matching notification is found.
handleNotification(aNotification)
Checks to see if aNotification matches the listener criteria and if so, sends it to the target. Implementation:
if((name == nil or name == n name) and(object == nil or sender == n sender),
	target perform(action, n)
)
name
Returns the message name that the listener wants to receive messages for.
sender
Returns the sender that the listener wants to receive messages from.
setAction(messageName)
Sets the name of the message that is sent to the target when a matching notification is found. Returns self.
setName(aSeq)
Sets the message name that the listener wants to receive messages for. Returns self.
setSender(anObject)
Sets the sender that the listener wants to receive messages from. Returns self.
setTarget(anObject)
Sets the target that the receiver sends matching messages to. Returns self.
start
Removes the receiver to the NotificationCenter set of listeners. Returns self.
target
Returns the target that the receiver sends matching messages to.
Range
Range
Simple datastructure representing the items at and between two specific points.
asList
Returns a list containing all the items within and including the ranges starting and ending points.
at(position)
Rewinds the range, skips forward until we're at the supplied position then returns the value at that position. Raises an exception if the position is out of bounds.
contains
Returns a boolean value if the range contains the argument.
first
Moves the current cursor to the beginning of the range, and returns it.
foreach(optionalIndex, value, message)
Iterates over each item beginning with the starting point, and finishing at the ending point inclusive. This method can operate several ways; these include: (1) Takes one argument, the message tree to be executed during each iteration; (2) Takes two arguments, the first argument is the name of the current value being iterated over, and the second is the message tree to be executed during each iteration; (3) Takes three arguments: the first is the current index within the range, the second is the name of the current value being iterated over, and the third is the message tree to be executed during each iteration. For example:
// First method (operating on numbers)
1 to(10) foreach("iterating" print) // prints "iterating" 10 times
// Second method (operating on numbers)
1 to(10) foreach(v, v print) // prints each value
// Third method (operating on numbers)
1 to(10) foreach(i, v, writeln(i .. ": " .. v)) // prints "index: value"
index
Returns the current index number starting from zero and extending outward up to the maximum number of items in the range.
indexOf(aValue)
Calculates each value, checking to see if it matches the aValue parameter. If so, return the position within the range. NOTE: This method rewinds the range before searching. If you need to revert back to your original position, make a duplicate of the range, and use indexOf on it instead.
last
Moves the current cursor to the end of the range, and returns it.
levenshtein(other)
Returns the levenshtein distance to other.
map(optionalIndex, value, message)
Returns a new list which contains the result of the 'body' for every element stepped over in the range, from the starting point to the ending point inclusive. This method can operate several ways; these include: (1) Takes one argument, the message tree to be executed during each iteration; (2) Takes two arguments, the first argument is the name of the current value being iterated over, and the second is the message tree to be executed during each iteration; (3) Takes three arguments: the first is the current index within the range, the second is the name of the current value being iterated over, and the third is the message tree to be executed during each iteration. For example:
# First method (operating on numbers)
1 to(10) map(*2) # multiply each value by two
# Second method (operating on numbers)
1 to(10) map(v, "#{v}" interpolate) # returns string representation of each value as list
# Third method (operating on numbers)
1 to(10) map(i, v, i*v) #  multiply each value by index
next
Sets the current item in the range to the next item in the range, and returns a boolean value indicating whether it is not at the end of the range.
nextInSequence(skipVal)
Returns the next item in the sequence. The optional skipVal parameter allows you to skip ahead skipVal places.
previous
Sets the current item in the range to the previous item in the range, and returns a boolean value indicating whether it is not at the beginning of the range.
rewind
Sets the current item and the index to the values the receiver started out with.
select
Operates the same as 'List select'
setRange(start, end, increment)
Has several modes of operation. First, if only two parameters are specified, the increment value is set to 1 by default, while the first parameter represents the point to start from, and the second parameter represents the point to end at. If the second parameter is smaller than the first, the range will operate backwards. If the third parameter is specified, a custom iteration value will be used instead of 1.
slice(start, end, [by])
Returns a list containing the values from the Range starting at the start parameter, ending at the end parameter, and optionally incremented by the by parameter.
to
Convenience constructor that returns a cursor object representing the range of numbers from the receiver to the 'endingPoint' parameter. Increments over each item in that range by 1.
to(endpoint)
Convenience constructor that returns a range of sequences from the receiver to the endpoint argument. Increments over each item in that range by 1.
toBy(endingPoint, incrementValue)
Convenience constructor that returns a cursor object representing the range of numbers from the receiver to the 'endingPoint' parameter. Increments over each item in that range by the 'incrementValue' parameter.
toBy(endpoint, increment)
Convenience constructor that returns a range of sequences from the receiver to the endpoint argument. Increments over each item in that range by the value of the increment parameter. The increment parameter must be positive.
value
Returns the value of the current item in the range.
Databases
DBI
DBI
An object for wrapping libdbi to allow Io access to a multitude of database systems transparently.
drivers
Get a list of drivers and its associated information:
  1. name
  2. description
  3. filename
  4. version
  5. date compiled
  6. maintainer
  7. url
init
Initialize the DBI environment with the default driver path.
initWithDriversPath
Initialize the DBI environment with the specified libdbi driver path.
version
Return string version of libdbi being used.
with(driverName)
Get a new connection with the given driver.
DBIConn
An object that represents a DBI Connection.
close
Close the connection to the database.
connect
Connect to the database server.
driver
Return database driver name.
execute(sql_query)
Perform a database query that expects no results. Returns the number of rows affected.
option(key)
Retrieve an option value for the connection.
optionClear(key)
Clear a specific option associated with the connection.
optionPut(key,value)
Add an option key, value pair to the connection.
options
Retrieve an option list of the connection.
optionsClear
Clear all options associated with the connection
ping
Ping the database to see if it's alive. Will return true if it is, otherwise false.
query(sql_query)
Perform a database query returning a DBIResult object.
queryOne([object], sql)
Perform a query and return the first result. If [object] is supplied, the object is populated with the contents of the result, the result is marked done and the object is returned.
quote(value)
Quote a string value according to the database server's specifications.
sequenceLast([name])
Return the last inserted sequence value.
sequenceNext([name])
Return the next sequence that will be used during an INSERT query.
DBIRecord
A DBI Record. When utilizing `foreach' or `populate' methods of a DBIResult object, you can pass an optional Object cloned from DBIRecord. This object will be populated with the row contents making it possible to write objects that represent your SQL results. A simple example would be:
Person := DBIRecord clone do (fullName := method(firstName.." "..lastName))
q := conn query("SELECT id, firstName, lastName FROM people")
q foreach(Person, p, writeln("Name = ", p fullName))
As you can see, fullName was not in the SQL query, however, a dynamic method in your Person class. DBIRecord in and of itself provides no real functionality. It simply acts as an Object and stores the values from the SQL query into a Map. You can access the field information:
o := r populate(Person)
o firstName            // would retrieve the firstName value of the SQL query
o setFirstName("John") // would update the object's firstName value to be John
Do not confuse the above example as updating the actual database. The call to setFirstName only updates the objects representation of firstName.
forward
Private method that implements getting and setting values.
with(aMap)
Returns a new DBIRecord instance for the given value map.
DBIResult
A DBI Result created by a call to DBIConn query.
at(index_or_name)
Returns the contents of the given field. The parameter can be a field index or a field name.
done
Close and free the result. This must be called on each result. Failure to do so will cause memory leaks and open queries with the database server.
fields
Returns a list of field names in the result.
first
Move the cursor to the first record.
foreach([Object], value, message)
Loops over the records in the result starting at either the first result (if the cursor has never been moved) or its current location if moved. i.e.
r := conn query("SELECT * FROM people")
r foreach(r, r at(1))
The above would start at the first row, however, you can move around in the result set and then foreach would pickup where you left off, for instance, say you wanted to skip the first three rows:
r := conn query("SELECT * FROM people")
r seek(4)
r foreach(r, r at (1))
The above would start at the record #4, not at the beginning. The optional Object parameter would cause a decendent of DBIRecord to be populate instead of the index being set. This allows for advanced functionality. Please see `DBIRecord' for further information and an example.
last
Move the cursor to the last record.
next
Move the cursor to the next record.
populate(object)
Populates a decendent of DBIRecord with the current record's contents. See `DBIRecord' for further explanation and an example.
position
Return the current row's position (or index).
previous
Move the cursor to the previous record.
seek(row_number)
Move the cursor to the nth record.
size
Returns the number of rows available.
Memcached
Memcached
memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Memcached is an Io client library for memcached, based on C libmemcached.
add(key, value[, expiration])
Asks memcached to store the value identified by the key, but only if the server *doesn't* already hold data for this key. Returns true on success, false in case of a collision. Otherwise raises an exception.
addServer(address)
Adds a memcached server. address is a "host:port" string, e.g., "127.0.0.1:11211" Returns self.
append(key, value)
Asks memcached to add this value to an existing key after existing value. Returns true on success, otherwise raises an exception. value should be a Sequence. Supported by memcached 1.2.4+
at(key, optionalDefaultValue)
Asks memcached to retrieve data corresponding to the key. Returns nil if the data is not there (or if the data *is* nil).
atIfAbsentPut(key, value[, expiration])
If a value is present at the specified key, its value is returned. Otherwise, inserts the new value and returns it.
atPut(key, value[, expiration])
Asks memcached to store the value identified by the key. Same as Memcached set, but returns self.
decr([offset])
Asks memcached to decrement data for some item in place. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Default offset is 1. Returns the new value.
delete(key[, time])
Asks memcached to delete an item with the given key. time is the amount of time in seconds (or Unix time until which) the client wishes the server to refuse "add" and "replace" commands with this key. Returns true on success, false if there is no item with the given key. Otherwise raises an exception.
flushAll([expiration])
Asks memcached to invalidate all existing items immediately (by default) or after the expiration specified. Always returns true.
get(key)
Asks memcached to retrieve data corresponding to the key. Raises "NOT FOUND" if the data is not there.
getMulti(keys)
Asks memcached to retrieve data corresponding to the list of keys. Returns a Map with the results. If some of the keys appearing in a retrieval request are not sent back by the server in the item list this means that the server does not hold items with such keys
incr([offset])
Asks memcached to increment data for some item in place. The data for the item is treated as decimal representation of a 64-bit unsigned integer. If the current data value does not conform to such a representation, the commands behave as if the value were 0. Default offset is 1. Returns the new value.
prepend(key, value)
Asks memcached to add this value to an existing key before existing value. Returns true on success, otherwise raises an exception. value should be a Sequence. Supported by memcached 1.2.4+
removeAt(key)
Asks memcached to remove value with a given key. Returns self.
replace(key, value[, expiration])
Asks memcached to store the value identified by the key, but only if the server *does* already hold data for this key. Returns true on success, false if there is already data for this key. Otherwise raises an exception.
set(key, value[, expiration])
Asks memcached to store the value identified by the key. Returns true on success, otherwise raises an exception.
stats
Returns a Map with servers' statistics. Keys are server addresses, values are maps with actual stats.
with(servers)
Returns a new instance of Memcached. Accepts a Sequence or a List of server addresses.
MySQL
MySQL
MySQL is a fast, multi-threaded, multi-user SQL database server. IoMySQL is a MySQL binding for Io, by Min-hee Hong.

my := MySQL establish("localhost", "user", "password", "database")

# Get rows by Map
my queryThenMap("SELECT * FROM rel") foreach(at("col") println)
# Get rows by List
my query("SELECT * FROM rel") foreach(at(0) println)

my close
close
Closes a previously opened connection.
connect(host, user, password, database, port, unixSocket, useSSL)
Connect to a MySQL database.
connected
Returns true if connected to the database, false otherwise.
establish
Establish a connection to a MySQL database.
lastInsertRowId
Returns the value generated for an AUTO_INCREMENT column by the previous INSERT or UPDATE statement.
query(aQueryString)
Perform a SQL query and return a list of results.
	db query("SELECT * FROM accounts") foreach(println)
	
Obsidian
Obsidian
A double key/value database with cursors on first key. Basis for PDB.
close
Closes the persistence database file.
delete
Removes the persistence database file set via setPath.
onAt
Return the value associated with slotName of stored object whose ppid is objId.
ObsidianClient
ObsidianServer
A network interface for Obsidian.

Starting a Server

oServer := ObsidianServer clone
oServer localObject setName("foo") open
oServer start

Example Client Code

client := MDOConnection clone setHost("127.0.0.1") setPort(8000) connect
client onAtPut("1", "aKey", "aSlot")
client onAtPut("1", "cKey", "cSlot")
client onAtPut("1", "bKey", "bSlot")
client first("1", 5) println
a := client onAt("1", "aKey")
writeln("a = ", a)
b := client onAt("1", "bKey")
writeln("b = ", b)
client close
The messages accepted by the Obsidian server include:
onAtPut(id, key, value)
onAt(id, key)
onRemoveAt(id, key)
onFirst(id, count)
onLast(id, count)
onAfter(id, key, count)
onBefore(id, key, count)
PDB
An arbitrary graph database with support for on-disk garbage collection. Example use:

Setup

PDB open
PDB root atPut("users", PMap clone)
PDB sync
PDB close
PMap is a Map/Dictionary whose keys are lazily loaded from the database. PDB root is the root PMap in the database and the root object used for PDB's garbage collector. PDB sync needs to be called to write any changes to the database.

Defining a Persistent Object

User := Object clone pSlots(name, email)
The pSlots(), declares which slots on the object should be persisted. The List, Date, Sequence and Number primitives already know how to persist themselves.

Inserting a Persistent Object

PDB open 
user := User clone setName("steve") setEmail("steve@foo.com")
PDB root users atPut("steve", user)
PDB sync
PDB close

Accessing a Persistent Object

user := PDB root users at("steve")
writeln("user name = ", user name, " email = ", user email)

Updating a Persistent Object

user setEmail("steve@newDomain.com")
PDB sync 
PDB sync will scan all persistent objects in the vm and save any with changes to their persistent slots. If the object was already in the database, only its updated slots will be written.

Removing an entry in a PMap

PDB root users removeAt("steve")

Removing a persistent object

This is never done explicitly, instead calling:
PDB collectGarbage
Will remove all objects unreachable by the reference graph from the root PMap.

Notes: Currently, PDB is a singleton.

addObjectToPersist
Register an object to be persisted in the next PDB sync.
close
Close the persistence database.
collectGarbage
Remove from PDB all objects not accessible via the root object.
newId
Generate a new PDB id number for use as a persistent object's ppid.
objectAtPpid
Return the object associated in the database with a ppid.
reopen
Sync, close and reopen the PDB store.
root
Return the root PMap object used to store and retrieve persistent objects and their slots.
show
Print to standard output a listing of all objects and IDs stored in PDB.
sync
Immediately persist data for all objects marked dirty by Collector whose shouldPersistByDefault is true, or that have specifically requested to be persisted since the last sync via addObjectToPersist.
PMap
PMap stores persistent data in a Map-like fashion and lazily loads available slots from the PDB backing store. Values stored or loaded are cached into local object slots.
at(slotName)
Tries to obtain a value for slot slotName from a local slot of that name, or tries to load it from the PDB if the local slot does not exist. When all else fails, returns nil.

If slotName begins with an underscore ("_"), returns the id of the slot from PDB instead of the value.

atPut(slotName, value)
Records value in the slot named slotName.
createIfAbsent
Creates a slot with a new PMap clone if not already present.
init
Initialize a new PMap and automatically add it as a persistent object to PDB.
objectsForKeys
Returns a list of values for each key in the list given. Keys beginning with an underscore ("_") are returned verbatim.
persist
Commits the PMap's slots to PDB.
persistSlots
Cleans up dirty slots by committing them to PDB.
removeAt
Marks a value for removal.
removeSlot
Marks a value for removal.
shouldPersistByDefault
PDB boolean flag indicating whether this object should be considered for persistence when persistence has not been specifically requested by calling ppid() or PDB addObjectToPersist. Always true by default for PMap.
slotCount
Returns the number of slots committed to PDB.
PObject
Postgres
Postgres
QDBM
QDBM
An ordered key/value database that supports transactions and arbitrary kay and value sizes.
abort
Abort transaction. Returns self
at(keySymbol)
Returns a Sequence for the value at the given key or nil if there is no such key.
atPut(keySymbol, valueSequence)
Sets the value of valueSequence with the key keySymbol. Returns self.
atRemove(keySymbol)
Removes the specified key. Returns self
begin
Begin transaction. Returns self
close
Closes the database.
commit
Commit transaction. Returns self
cursorFirst
Move cursor to first record. Returns self
cursorJumpBackward(key)
Move cursor to previous record around key. Returns self
cursorJumpForward(key)
Move cursor to next record around key. Returns self
cursorKey
Returns current cursor key or nil.
cursorLast
Move cursor to last record. Returns self
cursorNext
Move cursor to next record. Returns true if there is another key, or false if there is no next record.
cursorPrevious
Move cursor to previous record. Returns true if there is another key, or false if there is no previous record.
cursorPut(value)
Sets the value at the current cursor postion. Returns self.
cursorRemove
Removes the current cursor postion. Returns self.
cursorValue
Returns current cursor value or nil.
name
Returns the name of the database.
open(path)
Opens the database.
optimize
Optimizes the database. Returns self
size
Returns number of records in database. Returns self
sizeAt(keySymbol)
Returns the size of the value at the given key or nil if there is no such key.
sync
Syncs the database. Returns self
SQLite
SQLite
SQLite provides a embedded simple and fast (2x faster than PostgreSQL or MySQL) SQL database. See http://www.hwaci.com/sw/sqlite/ for details. It's SQL command set is described at http://www.hwaci.com/sw/sqlite/lang.html. SQLite was written by Dr. Richard Hipp who offers consulting services for custom modifications and support of SQLite. Example:
	
db := SQLite clone
db setPath("myDatabase.sqlite")
db open
db exec("CREATE TABLE Dbm (key, value)")
db exec("CREATE INDEX DbmIndex ON Dbm (key)")
db exec("INSERT INTO Dbm ('key', 'value') VALUES ('a', '123')")
db exec("INSERT INTO Dbm ('key', 'value') VALUES ('a', 'efg')")
rows := db exec("SELECT key, value FROM Dbm WHERE key='a'")
db exec("DELETE FROM Dbm WHERE key='a'")
rows := db exec("SELECT key, value FROM Dbm WHERE key='a'")
db close
changes
Returns the number of rows that were changed by the most recent SQL statement. Or Nil if the database is closed.
close
Closes the database if it is open. Returns self. If the database is open when the open is garbage collected, it will be automatically closed.
columnNamesOfTable(tableName)
Returns a list containing the names of all columns in the specified table.
debugOff
Turns off debugging.
debugOn
Turns on debugging.
error
Results a string containing the current error. If there is no error, Nil is returned.
escapeString(aString)
Returns a translated version of aString by making two copies of every single-quote (') character. This has the effect of escaping the end-of-string meaning of single-quote within a string literal.
exec(aString)
Opens the database if it is not already open and executes aString as an sql command. Results a List of Map objects or Nil if there was an error. Each map holds the contents of a row. The key/value pairs of the maps being column name/column value pairs for a row. ")
isOpen
Returns true if the database is open, false otherwise.
lastInsertRowId
Returns the number with the row id of the last row inserted.
open(optionalPathString)
Opens the database.Returns self on success or nil upon failure. If the databse is locked, "yield" will be called until it is accessable or timeoutSeconds has expired.
path
Returns the path to the database file.
setPath(aSeq)
Sets the path to the database file. Returns self.
setTimeoutSeconds(aNumber)
Sets the open timeout to aNumber. If aNumber is 0, an open call will never timeout. Returns self.
tableNames
Returns a list containing the names of all tables in the database.
timeoutSeconds
Returns the number of seconds to wait before timing out an open call. If the number is 0, an open call will never timeout.
version
Results a string the version of SQLite being used.
viewNames
Returns a list containing the names of all views in the database.
SQLite3
SQLite3
SQLite provides a embedded simple and fast (2x faster than PostgreSQL or MySQL) SQL database. See http://www.hwaci.com/sw/sqlite/ for details. It's SQL command set is described at http://www.hwaci.com/sw/sqlite/lang.html. SQLite was written by Dr. Richard Hipp who offers consulting services for custom modifications and support of SQLite. Example:

	
db := SQLite clone
db setPath("myDatabase.sqlite")
db open
db exec("CREATE TABLE Dbm (key, value)")
db exec("CREATE INDEX DbmIndex ON Dbm (key)")
db exec("INSERT INTO Dbm ('key', 'value') VALUES ('a', '123')")
db exec("INSERT INTO Dbm ('key', 'value') VALUES ('a', 'efg')")
rows := db exec("SELECT key, value FROM Dbm WHERE key='a'")
db exec("DELETE FROM Dbm WHERE key='a'")
rows := db exec("SELECT key, value FROM Dbm WHERE key='a'")
db close
changes
Returns the number of rows that were changed by the most recent SQL statement. Or Nil if the database is closed.
close
Closes the database if it is open. Returns self. If the database is open when the open is garbage collected, it will be automatically closed.
columnNamesOfTable(tableName)
Returns a list containing the names of all columns in the specified table.
debugOff
Turns off debugging.
debugOn
Turns on debugging.
error
Results a string containing the current error. If there is no error, Nil is returned.
escapeString(aString)
Returns a translated version of aString by making two copies of every single-quote (') character. This has the effect of escaping the end-of-string meaning of single-quote within a string literal.
exec(aString)
Opens the database if it is not already open and executes aString as an sql command. Results a List of Map objects or Nil if there was an error. Each map holds the contents of a row. The key/value pairs of the maps being column name/column value pairs for a row.
isOpen
Returns true if the database is open, false otherwise.
lastInsertRowId
Returns the number with the row id of the last row inserted.
open(optionalPathString)
Opens the database. If there is an optionalPathString argument, the path is set to it's value before opening the database. If path is "" or ":memory:" a database will be created in-memory, otherwise the file specified by path is opened. Returns self or Nil upon failure. If the databse is locked, "yield" will be called until it is accessable or timeoutSeconds has expired. ""
path
Returns the path to the database file.
setPath
Sets the path to the database file. Returns self.
setTimeoutSeconds(aNumber)
Sets the open timeout to aNumber. If aNumber is 0, an open call will never timeout. Returns self.
tableNames
Returns a list containing the names of all tables in the database.
timeoutSeconds
Returns the number of seconds to wait before timing out an open call. If the number is 0, an open call will never timeout.
version
Results a string the version of SQLite being used.
viewNames
Returns a list containing the names of all views in the database.
SkipDB
SkipDB
An ordered key/value database implemented using a skiplist data structure.
at(keySymbol)
Returns a Sequence for the value at the given key or nil if there is no such key.
atPut(keySymbol, valueSequence)
Sets the value of valueSequence with the key keySymbol. Returns self.
atRemove(keySymbol)
Removes the specified key. Returns self
cursor
Returns a new cursor to enumerate the receiver.
headerPid
Returns the headerPid number.
size
Returns the number of keys in the receiver.
SkipDBCursor
An iterator object for a SkipDB.
first
Move cursor to first item. Returns self.
goto(aKey)
Move cursor to the specified key or nearest preceeding key. Returns self
key
Returns the current cursor key, or nil if the cursor is out of range.
last
Move cursor to last item. Returns self.
next
Move cursor to next item. Returns self.
previous
Move cursor to previous item. Returns self.
value
Returns the current cursor key, or nil if the cursor is out of range.
SkipDBM
SkipDB is a skip-list based key-value database. SkipDBM manages any number of skipdbs within the same file. The root skipdb can be accessed using the root method.
at(pidNumber)
Returns the SkipDB at the specified persistent ID or nil if it is not found.
beginTransaction
Begin a transaction. Returns self.
close
Closes the dbm.
commitTransaction
Commit a transaction. Returns self.
compact
Compacts the database. Returns self.
delete
Deletes the db. Returns self.
open
Opens the dbm. Returns self.
path
Returns the path to the dbm. Returns self.
root
Returns the root SkipDB.
setPath(aString)
Sets the path to the dbm folder. Returns self.
SqlDatabase
SqlDatabase
TagDB
TagDB
Binding for tagdb - a tagging database usefull for flickr-like tag searches.

Example use:

tdb := TagDB clone

tdb setPath("test")
tdb open

writeln("size = ", tdb size)
tdb atKeyPutTags("f430 for sale", list("red", "ferrari"))
tdb atKeyPutTags("lotus esprit", list("lotus", "esprit"))
writeln("size = ", tdb size)
keys := tdb keysForTags(list("lotus"))
writeln("keys = ", tdb symbolForId(keys at(0)))
tdb close
tdb delete
allUniqueTagIds
Returns a list of all unique tag ids.
atKeyPutTags(key, tagNameList)
Sets the tags for key to those in tagNameList. Returns self.
close
Close the tagdb. Returns self.
delete
Deletes all keys in the database.
idForSymbol(aSeq)
Returns the TagDB id Number for the symbol specified by aSeq.
keyAtIndex(indexNumber)
Returns the key at the specified index of nil if the index is out of range.
keysForTags(aTagNameList)
Returns list of keys whose tags contain all of the tags in aTagNameList.
open
Open the tagdb. Returns self.
removeKey(aKey)
Removes the specified key if it is present. Returns self.
setPath(aPath)
Sets the path to the tag database. Returns self.
size
Returns number of keys in the database.
symbolForId(aNumber)
Returns the TagDB symbol for aNumber.
tagsAtKey(key)
Returns the tags for the specified key.
uniqueTagNames
Returns a list of all unique tag names.
TokyoCabinet
TokyoCabinet
An ordered key/value database that supports transactions and arbitrary key and value sizes.
abort
Abort transaction. Returns self
at(keySymbol)
Returns a Sequence for the value at the given key or nil if there is no such key.
atApple(keySymbol, valueSequence)
Appends valueSequence to the current value at keySymbol. Returns self.
atPut(keySymbol, valueSequence)
Sets the value of valueSequence with the key keySymbol. Returns self.
atRemove(keySymbol)
Removes the specified key. Returns self
begin
Begin transaction. Returns self
close
Closes the database.
commit
Commit transaction. Returns self
compareType
Returns the compare type function name used.
cursor
Returns a new cursor object.
open(path)
Opens the database.
optimize
Optimizes the database. Returns self
path
Returns the path of the database file.
prefixCursor
Returns a new prefix cursor object.
setCompareType(name)
Sets the compare type function used to compare keys in the database. Valid compare types include: "lexical", "decimal", "int32", "int64" and "path". Returns self.
setPath(aPath)
Sets the path of the database file. Returns self.
size
Returns number of records in the database. Returns self
sizeAt(keySymbol)
Returns the size of the value at the given key or nil if there is no such key.
sync
Syncs the database. Returns self
transactionalAtPut(key, value)
Transactionally insert the given key and value. Returns self.
transactionalRemoveAt(key)
Transactionally remove the given key. Returns self.
TokyoCabinetCursor
A database cursor.
close
Closes the database.
first
Move cursor to first record. Returns self
jump(key)
Move cursor to record before key. Returns self
key
Returns current cursor key or nil.
last
Move cursor to last record. Returns self
next
Move cursor to next record. Returns true if there is another key, or false if there is no next record.
previous
Move cursor to previous record. Returns true if there is another key, or false if there is no previous record.
put(value)
Sets the value at the current cursor postion. Returns self.
remove
Removes the current cursor postion. Returns self.
value
Returns current cursor value or nil.
TokyoCabinetPrefixCursor
A database cursor.
close
Closes the database.
first
Move cursor to first record. Returns self
jump(key)
Move cursor to record before key. Returns self
key
Returns current cursor key or nil.
last
Move cursor to last record. Returns self
next
Move cursor to next record. Returns true if there is another key, or false if there is no next record.
previous
Move cursor to previous record. Returns true if there is another key, or false if there is no previous record.
put(value)
Sets the value at the current cursor postion. Returns self.
remove
Removes the current cursor postion. Returns self.
value
Returns current cursor value or nil.
Digests
MD5
MD5
An object for calculating MD5 hashes. Each hash calculation should instantiate its own MD5 instance.

Example:

digest := MD5 clone
digest appendSeq("this is a message")
out := digest md5String
appendSeq(aSequence)
Appends aSequence to the hash calculation. Returns self.
md5
Completes the MD5 calculation and returns the hash as a Buffer. Once this method is called, append() should not be called again on the receiver or it will raise an exception.
md5String
Returns a string containing a hexadecimal representation of the md5 hash.
SHA1
SHA1
An object for calculating SHA1 hashes. Each hash calculation should instantiate its own SHA1 instance.

Example:

digest := SHA1 clone
digest appendSeq("this is a message")
out := digest md5String
appendSeq(aSequence)
Appends aSequence to the hash calculation. Returns self.
sha1
Completes the SHA1 calculation and returns the hash as a Buffer. Once this method is called, append() should not be called again on the receiver or it will raise an exception.
sha1String
Returns a string containing a hexadecimal representation of the sha1 hash.
UUID
UUID
Generates Universally Unique Identifiers (UUID/GUID).
urn
Returns the uuid with "urn:uuid:" prepended to it.
uuid
Returns a new uuid in string format.
uuidRandom
Returns a new random uuid (type 4) in string format.
uuidTime
Returns a new time and mac uuid (type 1) in string format.
Encryption
Blowfish
Blowfish
The Blowfish object can be used to do encryption and decryption using the Blowfish keyed, symmetric block cipher.

Example encryption and decription;

	
key := "secret"
data := "this is a message"

encryptedData := Blowfish clone setKey(key) encrypt(data)
decryptedData := Blowfish clone setKey(key) decrypt(encryptedData)
Or using the stream API:
	
key := "secret"
data := "this is a message"

cipher = Blowfish clone
cipher setIsEncrypting(true)
cipher setKey(key)
cipher beginProcessing
cipher inputBuffer appendSeq(data)
cipher process
cipher endProcess
encryptedData := cipher outputBuffer

cipher = Blowfish clone
cipher setIsEncrypting(false)
cipher setKey(key)
cipher beginProcessing
cipher inputBuffer appendSeq(encryptedData)
cipher process
cipher endProcess
decryptedData := cipher outputBuffer
beginProcessing
Sets the key from the key slot and initializes the cipher.
decrypt(aSequence)
Returns an decrypted version of aSequence.
encrypt(aSequence)
Returns an encrypted version of aSequence.
endProcessing
Finish processing remaining bytes of inputBuffer.
inputBuffer
Returns the input buffer.
outputBuffer
Returns the output buffer.
process
Process the inputBuffer and appends the result to the outputBuffer. The processed inputBuffer is emptied except for the spare bytes at the end which don't fit into a cipher block.
setIsEncrypting(aBool)
If aBool is true, encrypting mode is on, otherwise, decrypting mode is on.
Filesystem
AsyncRequest
AsyncRequest
Used for doing asynchronous file i/o. When this addon is loaded, it will override the File proto's readToBufferLength, readBufferOfLength and write methods to automatically use AsyncRequests.

Note: This addon is only needed for async file requests - all socket ops are already asynchronous in Io.

cancel
Cancels the request. Returns nil on error or self otherwise.
copyBufferto(aSeq)
Copies the request buffer's data to aSeq. Returns nil on error or self otherwise.
descriptor
Returns the descriptor for the request.
error
Returns sequence containing the last error or nil otherwise.
isDone
Returns true if the request is done, false otherwise.
numberOfBytes
Returns the number of bytes associated with the request.
position
Returns a Number for the position of the descriptor.
read(aSeq, numberOfBytes)
Submits an async read request. Returns nil on error, self otherwise.
setDescriptor(aDescriptorNumber)
Sets the descriptor for the receiver. Returns self.
sync
Waits for the request to complete. Returns nil on error or self otherwise.
write(fileOffset, aSeq, bufferOffset, numberOfBytesToWrite)
Submits an async write request. Returns nil on error, self otherwise.
Graphics
Box
Box
A primitive for fast operations on rectangles.
Union(aBox)
Returns a new box containing the 2d union of the receiver and aBox.
containsPoint(aPoint)
Returns true if aPoint is within the receiver's bounds, false otherwise.
copy(aBox)
Copies the values of aBox to the receiver.
depth
Same as; size z
height
Same as; size y
intersectsBox(aBox)
Returns true if aBox is within the receiver's bounds, false otherwise.
origin
Returns the point object for the origin of the box.
print
Prints a string representation of the receiver to the standard output.
set(origin, size)
Copies the values in origin and size to set the box's origin and size.
setOrigin(aPoint)
Copies the values in aPoint to the box's origin point.
setSize(aPoint)
Copies the values in aPoint to the box's size point.
size
Returns the point object for the size of the box.
width
Same as; size x
Cairo
Cairo
Cairo is a 2D graphics library. http://cairographics.org/
CairoContext
CairoExtents
CairoFontExtents
CairoFontFace
CairoFontOptions
CairoGlyph
CairoGradient
CairoImageSurface
CairoLinearGradient
CairoMatrix
CairoPath
CairoPathElement
CairoPattern
CairoRadialGradient
CairoRectangle
CairoScaledFont
CairoSolidPattern
CairoSurface
CairoSurfacePattern
CairoTextExtents
Font
Font
The Font object can be used to load and render TypeTrype fonts. Example use;
	
// within a GLUT display callback...

timesFont = Font clone open(\"times.ttf\")
if (timesFont error, write(\"Error loading font: \", timesFont error, \"\n\"); return)
timesFont setPointSize(16)
glColor(0,0,0,1)
timesFont draw(\"This is a test.\")
Rendering fonts using OpenGL textures

Smaller fonts (those having a point size around 30 or smaller, depending on the font) will automatically be cached in and rendered from a texture. This technique is very fast and should support rendering speeds as fast (or faster than) those of typical desktop font rendering systems. Larger font sizes(due to texture memory constraints) will be rendered to a pixelmap when displayed. Thanks to Mike Austin for implementing the font texturing system.

drawString(aString, optionalStartIndex, optionalEndIndex)
Draws aString using the optional start and end indexes, if supplied. Returns self.

Note; Fonts are drawn as RGBA pixel maps. These blending options are recommended:

	
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
error
Returns the current error string or nil if there is no error.
isTextured
Returns true if the font is being cached in and rendered from a texture, false otherwise.
open(optionalPath)
Opens the font. Sets path using optionalPath if supplied. Returns self.
path
Returns the Font path.
pixelHeight
Returns the height of the font measured in pixels.
pixelSize
Returns the font's pixelSize.
setPath(aString)
Sets the Font path. Returns self.
setPixelSize(aNumber)
Sets the size of the font in pixels. Returns self.
stringIndexAtWidth(aString, startIndex, width)
Returns the max index of the character in String (starting at startIndex) that fits within width.
widthOfCharacter(aNumber)
Returns the width of the character specified by aNumber in the receiver's font.
widthOfString(aString)
Returns a Number with the width that aString would render to with the receiver's current settings.
GLFW
GLFW
Image
Image
The Image object can read and draw images and provide the image data as a buffer. Example use:
	
image = Image clone open("curly.png")
image draw
image scaleTo(image width / 2, image height / 2)
image save("curly.tiff")
When loading an attempt will be made to convert the image into whichever of the following formats it is closest to: L8, LA8, RGB8, RGBA8.

Currently supported formats include PNG(which supports alpha), JPG and TIFF.

addAlpha
Adds an opaque alpha component if the image is in RGB format and does not already contain one. Returns self.
averageColor
Returns the average RGB color of all pixels in the image.
baselineHeight
Returns the pixel height (relative to the bottom of the image) which first contains a non-white pixel or -1 if no baseline is found.
bounds(cutoff)
Returns an object continaing the bounds of the image. Cutoff is max bound color value for any color component. If it is negative, it is the min bound color value.
componentCount
Returns the number of color components in the receiver as a Number.
crop(x, y, width, height)
Crops the image to the specified values. Returns self. Raises an exception on error.
data
Returns a Buffer primitive containing the image data (loading it first if needed). Manipulating this data will affect what is drawn when the receiver's draw method is called.
decodingHeightHint
Returns the decoding height hint.
decodingWidthHint
Returns the decoding width hint.
encodingQuality
Returns the encodingQuality setting.
error
Returns a String containing the current error or nil if there is no error.
flipX
Flips the image on the horizonal plane (left/right mirror). Returns self.
flipY
Flips the image on the vertical plane (top/bottom mirror). Returns self.
height
Returns the image hieght.
isL8
Returns true if the receiver is in L8 (8bit Luminance) format, false otherwise.
isLA8
Returns true if the receiver is in LA8 (8bit Luminance-Alpha) format, false otherwise.
isRGB8
Returns true if the receiver is in RGB8 format, false otherwise.
isRGBA8
Returns true if the receiver is in RGBA8 format, false otherwise.
open(optionalPathString)
Sets the path to optionalPathString if provided and opens the image file. Returns self on success, Nil on failure.
path
Returns the image path.
removeAlpha
Removes the alpha component if the image contains one. Returns self.
resizedTo(newWidth, newHeight)
Scales the image up to newWidth x newHeight. Returns the newly scaled image.
resizedTo(width, height)
Returns a new image of the receiver resized to the given width and height. Raises an exception on error.
save(optionalPathString)
Sets the path to optionalPathString if provided and saves the image in the format specified by the path extension. Returns self on success, nil on failure.
setDataWidthHeightComponentCount(aSequence, width, height, componentCount)
Sets the image data and its parameters. Returns self.
setDecodingHeightHint(width)
Sets the decoding height hint. Returns self.
setDecodingWidthHint(width)
Sets the decoding width hint. Returns self.
setEncodingQuality(aNumber)
Sets the image encoding quality (range is 0.0 - 1.0, 1.0 with being the highest).
setPath(aString)
Sets the image path. Returns self.
width
Returns the image width.
OpenGL
Box
A primitive for fast operations on rectangles.
Union(aBox)
Returns a new box containing the 2d union of the receiver and aBox.
containsPoint(aPoint)
Returns true if aPoint is within the receiver's bounds, false otherwise.
copy(aBox)
Copies the values of aBox to the receiver.
depth
Same as; size z
height
Same as; size y
intersectsBox(aBox)
Returns true if aBox is within the receiver's bounds, false otherwise.
origin
Returns the point object for the origin of the box.
print
Prints a string representation of the receiver to the standard output.
set(origin, size)
Copies the values in origin and size to set the box's origin and size.
setOrigin(aPoint)
Copies the values in aPoint to the box's origin point.
setSize(aPoint)
Copies the values in aPoint to the box's size point.
size
Returns the point object for the size of the box.
width
Same as; size x
GLApp
GLScissor
GLU
gluScaleImage(formatIn, widthIn, heightIn, typeIn, dataSeqIn, widthOut, heightOut, typeOut, dataSeqOut)
Scales the image data in dataSeqIn and outputs the result to dataSeqOut. Returns error code as a Number.
GLUQuadric
GLUT
OpenGL
Math
BigNum
BigNum
A wrapper for GNU MP Bignum (arbitrary precision math) library. Warning: GMP uses the restrictive GNU license which can be a problem if you are hard linking it into a distributed application.
%(aNum)
Modulus op (same as mod()). Returns result.
&(aNum)
AND op. Returns result.
*(aNum)
Multiply op. Returns result.
**(aNum)
Power op. Returns result.
+(aNum)
Add op. Returns result.
-(aNum)
Subtract op. Returns result.
/(aNum)
Divide op. Returns result.
<<(aNum)
Shift left (towards higher bits) op. Returns result.
>>(aNum)
Shift right (towards lower bits) op. Returns result.
^(aNum)
XOR op. Returns result.
abs
Absolute op. Returns result.
asNumber
Returns an Io Number for the receiving BigNum.
asSimpleString
Returns simple string representation of the receiver.
asString
Returns a string representation of the receiver.
gcd(aNum)
Greatest common denominator op. Returns result.
hamdist(aNum)
Returns hamming distance between receiver and aNum.
invert(aNum)
?
jacobi(aNum)
?
kronecker
?
lcm(aNum)
Least common denominator op. Returns result.
legendre(aNum)
?
mod(aNum)
Modulus op (same as %). Returns result.
neg
Returns negative version of receiver.
nextprime
Returns next prime larger than the receiver.
popcount
?
pow(aNum)
Returns power of receiver to aNum.
powm(aNum)
?
root(aNum)
Returns the aNum root of the receiver.
scan0(aNum)
?
scan1(aNum)
?
sqrt
Returns square root of the receiver.
tstbit(aNum)
?
with(aNumber)
Returns a BigNum version of the Io number aNumber.
|(aNum)
OR op. Returns result.
ContinuedFraction
ContinuedFraction
?
Random
Random
A high quality and reasonably fast random number generator based on Makoto Matsumoto, Takuji Nishimura, and Eric Landry's implementation of the Mersenne Twister algorithm. The default seed is a xor of the ANSI C time() and clock() return values.
bytes(count)
Returns a Sequence of size count containing random bytes.
flip
Returns a random bit as a true or false object.
gaussian(optionalMean, optionalStandardDeviation)
Returns a pseudo random number between 0 and 1 with a gaussian distribution.
setSeed(aNumber)
Sets the random number generator seed to the unsigned int version of aNumber.
value(optionalArg1, optionalArg2)
If called with:
  • no arguments, it returns a floating point random Number between 0 and 1.
  • one argument, it returns a floating point random Number between 0 and optionalArg1.
  • two arguments, it returns a floating point random Number between optionalArg1 and optionalArg2.
Rational
Rational
!=(other)
Compares two numbers against one another. Returns true if they are equal (represent the same number), false otherwise.
%(aNum)
Returns the receiver modulus aNum
*(aNum)
Returns the value of the receiver multiplied by aNum.
+(aNum)
Returns the value of the receiver added to aNum.
-(aNum)
Returns the value of the receiver subtracted from aNum.
/(aNum)
Returns the value of the receiver divided by aNum.
==(other)
Compares two numbers against one another. Returns true if they are equal (represent the same number), false otherwise.
abs
Returns a Rational number with the absolute value of the receiver.
asNumber
Converts the Rational number to a floating point number.
asRational
Converts the number to a Rational number. CAVEAT: Numbers in Io are floating point entities, which means since they are imprecise, this conversion may yield values not expected.")
asString
Returns a text string representing the Rational number.
compare(other)
Compares two numbers against one another. Returns a positive, zero or negative value based on whether the receiver is larger, equal or less than the argument.
denominator
Returns the denominator.
divmod(aNum)
Returns a list containing the integer value and the receiver modulus aNum.
gcd(aNum)
Calculates the greatest common denominator between the receiver and the argument.
negate
Negates the Rational number.
numerator
Returns the numerator.
pow(aNum)
Returns the value of the receiver to the power of aNum.
reduce
Reduces the numerator and denominator to their lowest terms.
serialized
Returns a bit of code which can be used to serialize the Rational number.
setDenominator(aNumber)
Sets the denominator. Returns self.
setNumerator(aNumber)
Sets the numerator. Returns self.
with(aNumerator, aDenominator)
Convenience constructor. Returns a new Rational number whose numerator and denominator are represented by the arguments aNumerator and aDenominator respectively.")
Networking
Beanstalk
Beanstalk
beanstalkd is a fast, distributed, in-memory workqueue service. See http://xph.us/software/beanstalkd/
An example from http://xph.us/software/beanstalkd/:
First, have one process put a job into the queue:
producer := Beanstalk clone connect("127.0.0.1:11300")
producer put("hello")
Then start another process to take jobs out of the queue and run them:
worker := Beanstalk clone connect("127.0.0.1:11300")
loop(
	job := worker reserve
	job body println # prints "hello"
	job delete
)
See Beanstalk.io code and protocol description (http://github.com/kr/beanstalkd/tree/master/doc/protocol.txt) for details. Both are short and easy to read.
Stat commands depend on YAML.
bury(id, pri)
Puts a job into the "buried" state
connect(address)
Connects to a beanstalk server. address is a "host:port" string, e.g., "127.0.0.1:11300"
delete(id)
Removes a job with a given id from the server, entirely
put(body, pri, delay, ttr)
Inserts a job into the queue.
pri - priority, an integer < 2**32. Jobs with smaller priority values will be scheduled before jobs with larger priorities. The most urgent priority is 0; the least urgent priority is 4294967295.
delay - an integer number of seconds to wait before putting the job in the ready queue. The job will be in the "delayed" state during this time.
ttr - time to run, an integer number of seconds to allow a worker to run this job.
release(id)
Puts a reserved job back into the ready queue
reserve(timeout)
Returns and reserves a job (waits until one becomes available if necessary)
touch(id)
Allows a worker to request more time to work on a job.
CGI
CGI
CGI supports accessing CGI parameters passed in environment variables or standard input by a web servers like Apache. Example use:
#!./ioServer

cgi = CGI clone

redirect = cgi getParameters at("redirurl")
if (redirect and redirect != "",
	redirect clipAfterStartOfSeq("\r")
	redirect clipAfterStartOfSeq("\n")
	cgi redirect(redirect)
	System exit(0)
 )

cgi header("Content-type", "text/html")

cgi write("<html><head><title>test</title><body>")
cgi write("GET Parameters:")
cgi getParameters foreach(k, v,
	cgi write(k .. " = " .. v .. ","))
)

cgi write("POST Parameters:")
cgi postParameters foreach(k, v,
	cgi write(k .. " = " .. v .. ","))
)

cgi write("COOKIES:")
cgi cookies foreach(k, v,
	cgi write(k .. " = " .. v .. ",")
)
contentLength
CONTENT_LENGTH from web server - Size of POST Data
contentType
CONTENT_TYPE from web server
cookies
Returns a Map of cookies provided by the client
decodeUrlParam(aString)
Returns a URL decoded version of aString.
encodeUrlParam(aString)
Returns a URL encoded version of aString.
getParameters
Parses the QUERY_STRING environment variable and returns a Map containing key/value query value pairs. For testing, a QUERY_STRING can be passed to standard in, one line will be read
header(name, value, sendMultiple)
Add a header to the output, may only be called before write() is called. One of each header will be sent unless sendMultiple is true
httpHeader(name)
Fetch a header supplied by the client, such as 'referer'
isInWebScript
Checks to see if this is being called within a CGI request or from the command-line (testing). Simply checks for System getEnvironmentVariable("GATEWAY_INTERFACE")
maxPostSize
Maximum size in bytes, to process from user submitted data. Data greater than this will result in a nil postData slot
maxPostSizeExceeded
Returns true if the POST data exceeds a set maxPostSize
pathInfo
PATH_INFO from web server
pathTranslated
PATH_TRANSLATED from web server
postData
The raw post data sent to the script. Only set if getEnvironmentVariable("REQUEST_METHOD") asLowercase == "post".
postParameters
Parses the POST data, multipart and urlencoded. Returns a map of submitted variables. For uploaded files, an Object is returned with these slots:
fileName
content (raw content of file as Sequence)
contentType
contentEncoding
size (in characters/bytes)
asString (pretty string of name, type, size)
queryString
QUERY_STRING from web server
redirect(url)
Send a location: and redirect the user. May only be called before write() is called. It is left to the caller to stop any further processing.
remoteAddress
REMOTE_ADDR from web server - User's IP
remoteHost
REMOTE_HOST from web server - User's host (often blank)
requestMethod
GET, POST, PUT, etc
requestParameter(name)
Lazy developer's helper funtion. Retrieves a value from GET or POST, POST first
scriptName
SCRIPT_NAME from web server
setCookie(name, value, expiresDate, domain, path, secureBool)
Sets a cookie, keep in mind this will not be available in cookies() until they next visit to the site. Parameters other than name and value are optional.
status(statusCode)
Numeric status code to send to the client. Normally, the server will figure this out on its own, but this allows handling 404s and such.
write(string, [string...])
Send content for the body of the response
DistributedObjects
DOConnection
The DOConnection object is useful for communicating with remote servers in a way that makes it look just like the sending of local messages. Proxies are automatically created on either side for passed objects, with the exception of strings and numbers, which are passed by value. Example:
con := DOConnection clone setHost("127.0.0.1") setPort(8456) connect
result := con serverObject test(1)
writeln(result)
r := result at(0)
writeln(r)
r := result at(1)
writeln(r)
Implementation Notes:

The format of the Distributed Objects message is a list of NullCharacter terminated strings in one of these two formats:

Send message format:

s NullCharacter targetId NullCharacter messageName NullCharacter argCount NullCharacter argType NullCharacter argValue NullCharacter (next arg type and value, etc)
Reply message format:
r NullCharacter argType NullCharacter argvalue NullCharacter
If the argument is not a String, Number or nil then: If it is local to the sender, the type is RemoteObject. If it is a proxy to a remote object, the type is LocalObject. This isn't optimized yet.
close
Close the connection, if it is open. Returns self.
connect
Connect to the remote DOServer. Returns self or an Error, if one occurs.
host
Returns the host ip.
port
Returns the port.
serverObject
A handle to the remote DOServer's root object. Returns result from server or an Error, if one occurs.
setHost(ipString)
Sets the host ip to connect to. Returns self or an Error, if one occurs.
setPort(portNumber)
Sets the port number to connect to. Returns self.
DOProxy
DOServer
An experimental distributed objects server. Example;
Test := Object clone
Test test := method(v, 
	write("got test '", v, "'\n")
	return List clone append(1)
)

doServer := DOServer clone
doServer setRootObject(Test clone)
doServer setPort(8456)
doServer start
setRootObject(anObject)
Sets the root object which incoming messages will be sent to.
MDOConnection
A Minimal Distributed Objects connection. Example;
dateServerCon := MDOConnection clone setHost("127.0.0.1") setPort(8123) connect
writeln("date from date server: ", Date fromNumber(dateServerCon currentDate))
dateServerCon close
See the docs for MDOServer for the DateServer code.

A MDOConnection will pause calling coroutines until the response is received. Mutliple requests can be sent before a single request returns if they are sent from separate coroutines.

MDOServer
A Minimal Distributed Objects server. Example;
DateServer := Object clone do(
	acceptedMessageNames := list("currentDate")
	currentDate := method(Date clone asNumber)
)

mdoServer := MDOServer clone 
mdoServer setHost("127.0.0.1")  setPort(8123) 
mdoServer setLocalObject(DateServer clone)
mdoServer start
GoogleSearch
GooglePage
Object representing one page of search results.
find
Runs the search.
links
Returns the list of link results.
pageNumber
Returns the current page number of results.
searchTerm
Returns the search term.
setSearchTerm(aSeq)
Sets the search term. Returns self.
GoogleSearch
Object for performing web searches via Google. Example:
GoogleSearch clone setSearchTerm("iolanguage") find links foreach(println)
while(Coroutine yieldingCoros size > 1, yield)
find
Runs the search.
links
Returns the list of link results.
maxPages
Returns the max number of pages to fetch results from.
setMaxPages(aNumber)
Sets the max number of pages to fetch results from. Returns self.
HttpClient
HCConnection
Sends an HCRequest using the HTTP protcol and stores the response in an HCResponse
request
An HCRequest describing the HTTP request to be sent
response
An HCResponse describing the response received from the remote host
sendRequest
Send the request and set the response
HCRequest
State describing an HTTP request to be sent by an HCConnection
connection
Clone HCConnect and set its state based on this HCRequest
hasHeader(name)
Returns true if this request has a header with name
header(name)
Returns the value for header with name
host
The host to send this request to
httpMethod
The HTTP method to be sent
port
The port connect to when sending this request
resource
The resource to request
setHeader(name, value)
Sets header with name to value
with(aUrl)
Clones HCResponse and sets its state based on aUrl (HCUrl)
HCResponse
Stores the result of sending an HCRequest using an HCConnection
headerAt(name)
First header value associated with name
headersAt(name)
Header values associated with name
statusCode
Numeric status code. ex: 200
statusDescription
Descriptive status code ex: OK
HCResponseParser
Handles parsing response received during an HCConnection
HCUrl
get
Creates an HCConnection based on this url, sends a request and returns the content of the response
getResponse
Creates an HCConnection based on this url, sends a request and returns the response
port
Returns url's port
url
Returns url's host
with(urlSeq)
Returns a clone of HCUrl with its state set by parsing urlSeq
Loudmouth
JID
Object for representing JIDs.
asString
Converts JID to string with all available parts included.
host
Extracts host's address from JID.
resource
Returns defined resource.
username
Extracts username from JID.
with(jid)
Extracts all parts of a provided Sequence and returns new JID clone.

  j := JID with("cow@moo.com/Alpes")
  j username == "cow"
  j host == "moo.com"
  j resource == "Alpes"
  j asString == "cow@moo.com/Alpes"
Loudmouth
Loudmouth is an async XMPP library written in C. Example usage:
acc := Loudmouth with("user@server.com", "super password") do(
  handleConnect = method(
    "Connected!" println)

  handleMessage = method(msg
    "#{msg from} > #{msg plainBody}" println
    body :=  msg plainBody

    if(body indexOf("#") == 0,
      body = doString(body) asString)

    # This way you can manipulate
    # XML nodes with SGML addon
    XmppChatMessage create\
      setPlainBody(body)\
      setTo(msg from)\
      sendVia(self)

    # or simply send the message (must be a Sequence)
    # (this is obviously faster)
    #self send(msg from, body))
)

acc connect
# Any Io code after this line won't be executed
# (unless called as Loudmouth callback or run in separate thread)
Loudmouth startMainLoop

asString
Converts XML to Sequence.
body
Returns value message's body node. If both XHTML and plain versions are available, XHTML version will be returned.
connect
Connects to the server. Returns self.
disconnect
Disconnects from server and returns true if it succeeds.
from
Returns sender's JID.
handleAuthenticated
Slot called upon successful authentication.
handleAuthenticationFailure
Slot called if username/password combinaton is wrong.
handleConnect
Slot called once connection is established.
handleConnectFailure
Slot called when server is not reachable.
handleDisconnect
Slot called upon closing the connection with the server.
handleMessage(xmppMessage)
Slot called when a message arrives via XMPP stream. xmppMessage is a LoudmouthMessage object.
handleSslFailure
Slot called if SSL-related problems arrive. Method should return true if it wishes to make a connection without SSL, false otherwise.
isConnected
isSslSupported
plainBody
Returns value of message's body node with XHTML markup.
registerAccount(server, username, password)
Registers a new account at XMPP server. Returns true or false.
send(toJid, message)
Sends a message (Sequence) to provided JID (Sequence). Returns true or false.
sendRaw(body)
Sends raw text over XMPP stream. Returns true if no errors occur.
sendVia(loudmouthConnection)
Converts message to sequence and sends it via the provided Loudmouth connection (Loudmouth object). It updates from property and returns true if message is sent.
setFrom(jid)
Sets sender's JID. Returns self.
setPresence(presence[, statusMessage])
Sets availability/presence and status message.
setStatusMessage(statusMessage)
Sets status message.
setXmppType(type)
Sets value of type attribute.
startMainLoop
Starts GMainLoop. Should be called after a connection is established with the server.
status
Returns status connection. Possible return values are:
  • Loudmouth types CLOSED
  • Loudmouth types OPENING
  • Loudmouth types OPEN
  • Loudmouth types AUTHENTICATING
  • Loudmouth types AUTHENTICATED
stopMainLoop
types

Object containing status codes and message types.


  Loudmouth with("username@server.com", "password") do(
    handleConnect = method(
      self setPresence(Loudmouth types AVAILABLE), "Drinking lemonade...")
  )
  
with(jid, password)
Creates a new Loudmouth clone with server details provided in jid.
xmppType
Returns value of type attribute of message node.
LoudmouthMessage

LoudmouthMessage provides SGML interface and convience methods for manipulation of XMPP messages.

setTo(jid)
Sets message receiver to defined JID. JID can be both an Sequence or JID instance. Returns self.
to
Returns JID of receiver.
with(source)
Creates new LoudmouthMessage based on source, which should be valid XML (Sequence).
XmppChatMessage
create
Creates a new LoudmouthMessage with chat type and random id value.
NetworkAdapter
NetworkAdapter
Interface to network adapter functionality.
macAddress
Returns the MAC address for the primary network adapter in a Hex string.
SecureSocket
Certificate
Read-only interface to SSL X509 certificates.
attributes
Returns the attributes.
extensions
Returns the extensions.
issuerName
Returns the issuerName.
notAfter
Returns the notAfter value.
notBefore
Returns the notBefore value.
serialNumber
Returns the serialNumber.
subjectName
Returns the subjectName.
version
Returns the version.
SecureClient
Interface to secure network communication. A SecureClient is a wrapper on an OpenSSL SSL_CTX object and supports both TLSv1 and DTLSv1.
connectionToServer
Returns connectionToServer.
setCAFile(aPath)
Sets the CA file. Returns self.
setCRLFile(aPath)
Sets the CRL file. Returns self.
setCertFile(aPath)
Sets the Certificate file. Returns self.
setKeyFile(aPath)
Sets the key file. Returns self.
useDTLS
Returns useDTLS value.
useTLS
Returns useTLS value.
SecureServer
Interface to secure network communication. A SecureServer is a wrapper on an OpenSSL SSL_CTX object and supports both TLSv1 and DTLSv1. Example:
//...
dispatchUdp
Returns dispatchUdp value.
dtlsWrap
Returns dtlsWrap value.
port
Returns the port on which the server will listen for connections.
setCAFile(path)
Sets the CA file. Returns self.
setCRLFile(path)
Sets the CRL file. Returns self.
setCertFile(path)
Sets the certificate file. Returns self.
setHost(hostName)
Sets the hostName. Returns self.
setKeyFile(path)
Sets the key file. Returns self.
setPort(aNumber)
Sets the port on which the server will listen for connections. Returns self.
setRequiresClientCertificate(aBool)
Sets the requires client certificate attribute. Returns self.
stop
Stops the server if it is running. Returns self.
supportsDTLS
Returns true if server supports DTLS, false otherwise.
tlsWrap
Returns tlsWrap value.
udpRecvIP
Returns udpRecvIP value.
useDTLS
Returns useDTLS value.
useTLS
Returns useTLS value.
SecureSocket
ValidationFail
Returns ValidationFail attribute as a number.
ValidationOkay
Returns ValidationOkay attribute as a number.
asyncAccept
Accept a connection asynchronously.
asyncConnectBIO
Performs asyncConnectBIO.
asyncConnectSSL
Performs asyncConnectSSL.
asyncStreamRead
Read available data and return it.
asyncUdpRead
?
asyncUdpServerRead
?
asyncWrite(aSeq)
Writes aSeq to the socket. Returns self.
descriptorId
Returns descriptorId.
getSocketReadLowWaterMark
Returns ReadLowWaterMark attribute.
getSocketWriteLowWaterMark
Returns WriteLowWaterMark attribute.
isConnected
Returns true if socket is connected, false otherwise.
isDatagram
Returns isDatagram attribute.
isOpen
Returns true if socket is open, false otherwise.
rawCertificate
Returns rawCertificate.
rawPeerCertificate
Returns rawPeerCertificate.
rawValidate
Performs rawValidate.
rbioReady
Returns rbioReady attribute.
setSocketReadBufferSize(numberOfBytes)
Sets read buffer size. Returns self.
setSocketReadLowWaterMark(numberOfBytes)
Sets read low water mark. Returns self.
setSocketWriteBufferSize(numberOfBytes)
Sets write buffer size. Returns self.
setSocketWriteLowWaterMark(numberOfBytes)
Sets write low water mark. Returns self.
shutdown
close the socket connection. Returns self.
supportsDTLS
Returns true if server supports DTLS, false otherwise.
wantsRead
Returns wantsRead attribute.
wantsWrite
Returns IoSecureSocket_wantsWrite attribute.
Socket
DNS
Utility methods related to Domain Name Service lookups.
dnsQueryPacketForHostName(hostNameSeq)
Assembles a DNS query packet for the given host name and returns it in a Sequence.
hostNameAndIPforDNSResponsePacket(dnsResponsePacketSeq)
Dissasembles the given dnsResponsePacketSeq and returns a list object containing the hostName and IP or an error string on error.
localNameServersIPs
Returns a list of local name server IPs as a list of Sequences. Works on OSX, Unix, Windows.
DNSQuery
An object representing an individual DNS query.
addCoro(aCoro)
Private method that adds a coro to coros.
coros
List of coroutines paused waiting for this query. These coros will be resumed when the query completes.
hostName
The host name which the query will request an IP for.
resumeCoros
Resumes all the paused coros. Should this use resumeLater instead?
setHostName(aSeq)
Sets the host name for the query.
waitOn
Pauses the calling coroutine until the query is completed.
DNSServer
An object representing a DNSServer which DNS requests can be sent to.
host
The host name (usually an IP) for the DNSServer.
ipForHostName(hostName, timeout)
Sends a request to the DNS server, waits for a response and returns it. Will try 3 times if there are timeouts. Returns the IP (as a Sequence) if successful, raises an exception otherwise.
setHost(aSeq)
Sets the host name for the DNSServer.
EvConnection
Networking Event.
EvRequest
Networking Event.
Event
Networking Event.
category
Networking
handleEvent(timeout)
waitOnOrExcept(timeout)
EventManager
Object for libevent (kqueue/epoll/poll/select) library. Usefull for getting notifications for descriptor (a socket or file) events. Events include read (the descriptor has unread data or timeout) and write (the descriptor wrote some data or timeout). Also, timer and signal events are supported.
addEvent(event, descriptor, eventType, timeout)
run
Runs the EventManger loop. Does not return. Private - should only be called by resumeIfNeeded.
Host
address
Returns the IP address. A DNS lookup is done in the background if the address is not already known. Returns an error on lookup failure.
name
Returns name.
setName(aString)
Set's the host name. Return self.
IPAddress
Object representation of an Internet Protocol Address.
setHostName(hostName)
Translates hostName to an IP using asynchronous DNS and sets the host attribute. Returns self.
ReadEvent
Object for read events.
Server
The Server object provides a simple interface for running a server. You just need to set the port and define a handleSocket method. Here's an example of an echo server:
Echo := Object clone
Echo handleSocketFromServer := method(aSocket, aServer,
  write("[Got echo connection from ", aSocket host, "]\n")
  while(aSocket isOpen,
   if(aSocket read, aSocket write(aSocket readBuffer asString))
   aSocket readBuffer empty
  )
  write("[Closed ", aSocket host, "]\n")
)

write("[Starting echo server on port 8456]\n")
server := Server clone setPort(8456)
server handleSocket := method(aSocket,
  Echo clone @handleSocketFromServer(aSocket, self)
)
server start
Notes

Io's use of lightweight threading and select for dealing with sockets makes for servers that are much more efficient (both memory and cpu wise) than those written with kernel threads and socket polling.

handleSocket(aSocket)
This method is called when the server accepts a new socket. The new socket is passed as the argument. Override this method in your own server subclass. The default implementation raises an exception.
port
Returns the port on which the server will listen for connections.
setHost(hostName)
Sets the hostName. Returns self.
setPort(aNumber)
Sets the port on which the server will listen for connections. Returns self.
start
Starts the server. This method will not return until server is stopped, so you may want to send the start message as an asynchronous message. Returns self or an Error, if one occurs.
stop
Stops the server if it is running. Returns self.
SignalEvent
Object for signal events.
Socket
Interface to network communication. Sockets will auto yield to other coroutines while waiting on a request. All blocking operations use the timeout settings of the socket. Reads are appended to the socket's read buffer which can be accessed using the readBuffer method. Example:
	
socket := Socket clone setHost("www.yahoo.com") setPort(80) connect
if(socket error) then( write(socket error, "\n"); exit)

socket write("GET /\n\n")

while(socket read, Nop)
if(socket error) then(write(socket error, "\n"); exit)

write("read ", socket readBuffer length, " bytes\n")
acceptTimeout
Returns the length of time in seconds for accept timeouts on the socket.
appendToWriteBuffer(aSequence)
Appends aSequence to the write buffer if it is non-nil. Returns self.
asyncAccept(ipAddressObject)
Immediately returns a socket for a connection if one is available or nil otherwise. Returns an Error object on error.
asyncBind
Binds the socket and returns self immediately or an Error object on error.
asyncConnect(ipAddressObject)
Connects to the given IPAddress and returns self or an Error object on error.
asyncListen
Listens to the socket and returns self immediately or an Error object on error.
asyncStreamOpen
Submits an async request to open the socket in stream mode and returns self immediately or an Error object on error.
asyncStreamRead(aSeq, readSize)
Reads up to readSize number of bytes into aSeq if data is available. Returns self immediately if successful. Returns an error object on Error. Returns nil if the socket is disconnected.
asyncStreamWrite(aSeq, start, writeSize)
Writes the slice of aSeq from start to start + writeSize to the socket. Returns self immediately if successful, otherwise closes the socket. Returns an error object on Error. Returns nil if the socket is disconnected.
asyncUdpOpen
Submits an async request to open the socket in UDP mode and returns self immediately or an Error object on error.
asyncUdpRead(ipAddress, aSeq, readSize)
Reads up to readSize number of bytes from ipAddress into aSeq if data is available. Returns self immediately if successful. Returns an error object on Error. Returns nil if the socket is disconnected.
asyncUdpWrite(ipAddress, aSeq, startIndex, readSize)
Writes readsize bytes from aSeq starting at startIndex to ipAddress. Returns self immediately if successful. Returns an error object on Error. Returns nil if the socket is disconnected.
bytesPerRead
Returns number of bytes to read per read call.
bytesPerWrite
Returns number of bytes to write per write call.
close
Closes the socket and returns self. Returns nil on error.
connect
Connects to the socket's host. Returns self on success or an Error object on error.
connectTimeout
Returns the length of time in seconds for connect timeouts on the socket.
descriptorId
Returns the socket's file descriptor id as a Number.
errorDescription
Returns a description of the last error on the socket as a string.
errorNumber
Returns the socket error number for the last error.
getSocketReadLowWaterMark
Returns the read low water mark for the socket on success or nil on error.
getSocketWriteLowWaterMark
Returns the write low water mark for the socket on success or nil on error.
host
Returns the host for the socket.
ipAddress
Returns the IpAddress object for the socket.
isOpen
Returns true if the socket is open, false otherwise.
isStream
Returns true if the socket is a stream, false otherwise.
isValid
Returns true if the socket is in valid state, closes the socket and returns false otherwise.
port
Returns the port number for the socket.
readBytes(numBytes)
Reads the socket until its readBuffer is numBytes long, then returns a Sequence containing the first numBytes of readBuffer's contents and clips that section from the readBuffer.
readListMessage
A shortcut for List fromEncodedList(socket readMessage).
readMessage
Empties the readBuffer and reads a 4 byte uint32 in network byte order. This number is the number of bytes in the message payload which are then read into the socket's readBuffer. The readBuffer is returned.
readTimeout
Returns the length of time in seconds for read timeouts on the socket.
readUntilSeq(aSequence)
Reads the socket until its readBuffer contains aSequence, then returns a Sequence containing the readBuffer's contents up to (but not including) aSequence and clips that section from the readBuffer.
serverOpen
Opens the socket as a stream, binds it to its ipAddress and calls asyncListen to prepare the socket to accept connections. Returns self on success or an Error object on error.
serverWaitForConnection
Waits for a connection or timeout. When a connection is received, this method returns the connection socket. An Error object is returned on timeour or error.
setAcceptTimeout(seconds)
Sets the length of time in seconds for accept timeouts on the socket. Returns self.
setBytesPerRead(numberOfBytes)
Sets number of bytes to read per read call. Returns self.
setBytesPerWrite(numberOfBytes)
Sets number of bytes to write per write call. Returns self.
setConnectTimeout(seconds)
Sets the length of time in seconds for connect timeouts on the socket. Returns self.
setHost(hostName)
Translates hostName to an IP using asynchronous DNS and sets the host attribute. Returns self.
setHost(hostNameOrIpString)
Set the host for the socket. Returns self on success, an Error object otherwise.
setIpAddress(ipAddressObject)
Sets the ipAddress for the socket. Returns self. The setHost() method should generally be used to set the host instead of this method.
setNoDelay
Sets the socket to be no-delay. Returns self on success or nil on error.
setPort(portNumber)
Sets the port number for the socket, returns self.
setReadTimeout(seconds)
Sets the length of time in seconds for read timeouts on the socket. Returns self.
setSocketReadBufferSize(numberOfBytes)
Sets the read buffer size for the socket. Returns self on success or nil on error.
setSocketReadLowWaterMark(numberOfBytes)
Sets the read low water mark for the socket. Returns self on success or nil on error.
setSocketWriteBufferSize(numberOfBytes)
Sets the write buffer size for the socket. Returns self on success or nil on error.
setSocketWriteLowWaterMark(numberOfBytes)
Sets the write low water mark for the socket. Returns self on success or nil on error.
setWriteTimeout(seconds)
Sets the length of time in seconds for write timeouts on the socket. Returns self.
streamOpen
Opens the socket in stream mode. Returns self.
streamRead(numberOfBytes)
Reads numberOfBytes from the socket into the socket's readBuffer. Returns self when all bytes are read or an Error object on error.
streamReadNextChunk(optionalProgressBlock)
Waits for incoming data on the socket and when found, reads any available data and returns self. Returns self on success or an Error object on error or timeout.
streamReadWhileOpen
Reads the stream into the socket's readBuffer until it closes. Returns self on success or an Error object on error.
streamWrite(buffer, optionalProgressBlock)
Writes buffer to the socket. If optionalProgressBlock is supplied, it is periodically called with the number of bytes written as an argument. Returns self on success or an Error object on error.
udpOpen
Opens the socket in UDP (connectionless) mode. Returns self.
udpRead(ipAddress, numBytes)
Waits for and reads numBytes of udp data from the specified ipAddress into the socket's readBuffer. Returns self on success or an Error object on error.
udpReadNextChunk(ipAddress)
Waits to receive UDP data from the specified ipAddress. As soon as any data is available, it reads all of it into the socket's readBuffer. Returns self on success or an Error object on error.
udpWrite
Same as asyncUdpWrite.
writeFromBuffer(optionalProgressBlock)
Writes the contents of the socket's writeBuffer to the socket. If optionalProgressBlock is supplied, it is periodically called with the number of bytes written as an argument. Returns self on success or an Error object on error.
writeListMessage(aList)
A shortcut for writeMessage(aList asEncodedList).
writeMessage(aSeq)
Writes a 4 byte uint32 in network byte order containing the size of aSeq. Then writes the bytes in aSeq and returns self.
writeTimeout
Returns the length of time in seconds for write timeouts on the socket.
TimerEvent
Object for timer events.
URL
clear
Private method to clear the URL's parsed attributes.
escapeString(aString)
Returns a new String that is aString with the appropriate characters replaced by their URL escape codes.
fetch
Fetches the url and returns the result as a Sequence. Returns an Error, if one occurs.
fetchHttp(optionalProgressBlock)
Private method that fetches an http url.
fetchRaw
Fetch and return the entire response. Note: This may have problems for some request times.
fetchToFile(aFile)
Fetch the url and save the result to the specified File object. Saving is done as the data is read, which helps minimize memory usage. Returns self on success or nil on error.
fetchWithProgress(progressBlock)
Same as fetch, but with each read, progressBlock is called with the readBuffer and the content size as parameters.
headerBreaks
Private method to connect to the host and write the header.
openOnDesktop
Opens the URL in the local default browser. Supports OSX, Windows and (perhaps) other Unixes.
parse
Private method to parse the url.
post(parameters, headers)
Sends an HTTP post message. If parameters is a Map, its key/value pairs are send as the post parameters. If parameters is a Sequence or String, it is sent directly. Any headers in the headers map are sent with the request. Returns a sequence containing the response on success or an Error, if one occurs.
processHttpResponse(optionalProgressBlock)
Private method that processes http response.
referer
Returns the referer String or nil if not set.
requestHeader
Returns a Sequence containing the request header that will be sent.
setReferer(aString)
Sets the referer. Returns self.
setRequest(requestString)
Private method to set the url request.
setResponseHeaderString(headerString)
Private method that parses the responseHeaders.
setURL(urlString)
Sets the url string and parses into the protocol, host, port path, and query slots. Returns self.
stopFetch
Stops the fetch, if there is one. Returns self.
test
Private test method.
unescapeString(aString)
Returns a new String that is aString with the URL escape codes replaced by the appropriate characters.
url
Returns url string.
with(urlString)
Returns a new URL instance for the url in the urlString.
WriteEvent
Object for write events.
Twitter
TwitterAccount
Object representing a twitter account.
account
Returns account associated with this profile.
backgroundColor
Returns the backgroundColor set in the twitter profile.
backgroundImageFile
Returns the backgroundImageFile set in the twitter profile.
deleteStatus(tweetId)
Deletes the specified tweet and returns the results of the request.
description
Returns the description set in the twitter profile.
follow(aScreenName)
Follow the user with the specified screen name. Returns results of the request.
followId(userId)
Follow the user with the specified id. Returns results of the request.
followersCursor
Returns a new TwitterFollowersCursor instance for this account.
friendsCursor
Returns a new TwitterFriendsCursor instance for this account.
hasFollower(aScreenName)
Returns true if the account has the specified follower, false otherwise.
hasFriend(aScreenName)
Returns true if the account has the specified friend, false otherwise.
hasProtectedUpdates
Returns true if the account has protected updates, false otherwise.
imageFile
Returns the imageFile set in the twitter profile.
isLimited
Returns true if the account's rate limit is exceeded, false otherwise.
isSuspended(aScreenName)
Returns true if the specified screenName is a suspended account, false otherwise.
linkColor
Returns the linkColor set in the twitter profile.
location
Returns the geographical location set in the twitter profile.
mentions
Returns mentions for this account.
name
Returns the name associated with the profile.
password
Returns the account password.
profile
Returns the account Profile object.
rateLimitExpiration
Returns the account rateLimitExpiration.
rateLimitRemaining
Returns the account rateLimitRemaining.
request
Returns a new TwitterRequest object for this account.
resultsFor(aRequest)
Returns results for the request.
retweet(tweetId)
Retweets the tweet with tweetId
screenName
Returns the account screenName.
setAccount(anAccount)
Sets the account associated with this profile. Returns self.
setName(aSeq)
Sets the name associated with the profile. Returns self.
setPassword(aSeq)
Sets the account password. Returns self.
setProfile(aProfile)
Sets the account profile. Returns self.
setRateLimitExpiration(aNumber)
Sets the account rateLimitExpiration. Returns self.
setRateLimitRemaining(aNumber)
Sets the account rateLimitRemaining. Returns self.
setScreenName(aSeq)
Sets the account screenName. Returns self.
setSource(aSource)
Sets the account source. Returns self.
show
Returns a Map containing attributes related to the Twitter user associated with this account
showUser(aScreenName)
Returns a Map containing attributes related to the Twitter user associated with aScreenName
showUserWithId(anId)
Returns a Map containing attributes related to the Twitter user associated with anId
sidebarBorderColor
Returns the sidebarBorderColor set in the twitter profile.
sidebarFillColor
Returns the sidebarFillColor set in the twitter profile.
source
Returns the account source (e.g. "API").
textColor
Returns the textColor set in the twitter profile.
tilesBackgroundImage
Returns the tilesBackgroundImage set in the twitter profile.
twitterIdForScreenName(aScreenName)
Returns twitter id for the specified screenName.
unfollow(aScreenName)
Unfollow the user with the specified screen name. Returns self.
unfollowId(userId)
Unfollow the user with the specified screen id. Returns self.
update
Fetch the latest basic profile settings from twitter.
updateBackgroundImage
Fetch the latest background image settings from twitter.
updateColors
Fetch the latest profile color settings from twitter.
updateImage
Fetch the latest image settings from twitter.
updateRateLimits
Updates the rate limits. Returns self.
updateStatus(messageText, tweetId)
Updates the status message and returns the results of the request.
url
Returns the url to the twitter profile.
userExists(aScreenName)
Returns true if the specified user exists, false otherwise.
TwitterAccountProfile
Object representing a twitter account profile.
TwitterException
isAlreadyFollowing
Returns isAlreadyFollowing attribute.
isBadRequest
Returns isBadRequest attribute.
isBlocked
Returns isBlocked attribute.
isBlockedOrSuspendedOrProtected
Returns isBlockedOrSuspendedOrProtected attribute.
isDown
Returns isDown attribute.
isFollowLimit
Returns isFollowLimit attribute.
isFollowedSelf
Returns isFollowedSelf attribute.
isForbidden
Returns isForbidden attribute.
isInternalError
Returns isInternalError attribute.
isNotAuthorized
Returns isNotAuthorized attribute.
isNotFound
Returns isNotFound attribute.
isOverloaded
Returns isOverloaded attribute.
isRateLimited
Returns isRateLimited attribute.
isSuspended
Returns isSuspended attribute.
isUnknown
Returns isUnknown attribute.
userIsMissing
Returns userIsMissing attribute.
wasntFriend
Returns wasntFriend attribute.
TwitterFollowersCursor
Inherits from TwitterFriendsFollowersCursor. requestType is "asFollowerIds".
TwitterFriendsCursor
Inherits from TwitterFriendsFollowersCursor. requestType is "asFriendIds".
TwitterRequest
Represents a Twitter API request and contains its results.
delegate
Delegate for request callbacks.
execute
Sends the request. Returns the response object.
host
"twitter.com"
httpMethod
"get"
password
Returns the password attribute.
path
Request path.
response
This slot holds a TwitterResponse object for this request.
username
Returns the username attribute.
TwitterResponse
body
Returns request to which this is the response.
rateLimitExpiration
Returns the rate limit expiration.
rateLimitRemaining
Returns the rate limit remaining.
results
Returns response results.
TwitterSearch
cursor
Returns the TwitterSearchCursor for the first page.
perPage
Returns the results per page.
query
Returns the search query.
results
Returns the results for the current page.
setPerPage(aSeq)
Sets the results per page. Returns self.
setQuery(aSeq)
Sets the query. Returns self.
sinceUpdateId
Returns the current page number of search results.
TwitterSearchCursor
Volcano
VolcanoServer
A simplified version of HttpServer
Parsers
Fnmatch
Fnmatch
The fnmatch add on adds support for the unix fnmatch function. (See fnmatch man page for details). Note: not all options are supported on all platforms.
caseFoldOff
See caseFoldOn.
caseFoldOn
Ignore case distinctions in both the pattern and the string.
hasMatch
Returns true if a match is found, false otherwise.
leadingDirOff
See leadingDirOn.
leadingDirOn
Ignore rest after successful pattern matching.
matchFor(aString)
Returns self if aString matches the pattern, otherwise returns nil.
noEscapeOff
See noEscapeOn.
noEscapeOn
If not set, a backslash character (\) in pattern followed by any other character will match that second character in string. In particular, "\\" will match a backslash in string. If set, a backslash character will be treated as an ordinary character.
pathNameOff
See pathNameOn.
pathNameOn
If set, a slash (/) character in string will be explicitly matched by a slash in pattern; it will not be matched by either the asterisk (*) or question-mark (?) special characters, nor by a bracket ([]) expression. If not set, the slash character is treated as an ordinary character.
pattern
Returns the pattern string.
periodOff
"See periodOn.
periodOn
If set, a leading period in string will match a period in pattern; where the location of ``leading'' is indicated by the value of FNM_PATHNAME:
  • If FNM_PATHNAME is set, a period is ``leading'' if it is the first character in string or if it immediately follows a slash.
  • If FNM_PATHNAME is not set, a period is ``leading'' only if it is the first character of string.

If not set, no special restrictions are placed on matching a period.

setPattern(aString)
Sets the pattern string. Returns self.
setString(aString)
Sets the string to do matching on.
string
The string to do matching on.
Libxml2
XmlReader
XmlWriter
Regex
Regex

The Regex addon adds support for Perl regular expressions using the PCRE library by Philip Hazel.

Example 1

	
Io> re := "is.*a" asRegex
Io> "This is a test. This is also a test." \
    allMatchesOfRegex("is.*a") replaceAllWith("is not a")
==> "This is not a test. This is not a test.

Example 2

	
Io> "11aabb" allMatchesOfRegex("aa*")
==> list("a", "a")

Io> re := "(wom)(bat)" asRegex
Io> "wombats are cuddly" matchesOfRegex(re) replaceAllWith("$2$1!")
==> batwom!s are cuddly
asRegex
Returns self.
asString
Returns a string containing a textual representation of the receiver.
captureCount
Returns the number of captures defined by the pattern.
caseless
Returns a case insensitive clone of the receiver, or self if the receiver itself is case insensitive:
	
	Io> "WORD" matchesRegex("[a-z]+")
	==> false

	Io> "WORD" matchesRegex("[a-z]+" asRegex caseless)
	==> true
	
dotAll

Returns a clone of the receiver with the dotall option turned on, or self if the receiver itself has the option turned on.

In dotall mode, "." matches any character, including newline. By default it matches any character except newline.

	
	Io> "A\nB" matchesOfRegex(".+") next string
	==> A

	Io> "A\nB" matchesOfRegex(".+" asRegex dotAll) next string
	==> A\nB
	
extended

Returns a clone of the receiver with the extended option turned on, or self if the receiver itself has the option turned on.

In extended mode, a Regex ignores any whitespace character in the pattern except when escaped or inside a character class. This allows you to write clearer patterns that may be broken up into several lines.

Additionally, you can put comments in the pattern. A comment starts with a "#" character and continues to the end of the line, unless the "#" is escaped or is inside a character class.

isCaseless
Returns true if the receiver is case insensitive, false if not.
isDotAll
Returns true if the receiver is in dotall mode, false if not.
isExtended
Returns true if the receiver is in extended mode, false if not.
isMultiline
Returns true if the receiver is in multiline mode, false if not.
matchesIn(aString)
Returns a RegexMatches object that enumerates the matches of the receiver in the given string.
multiline

Returns a clone of the receiver with the multiline option turned on, or self if the receiver itself has the option turned on.

In multiline mode, "^" matches at the beginning of the string and at the beginning of each line; and "$" matches at the end of the string, and at the end of each line. By default "^" only matches at the beginning of the string, and "$" only matches at the end of the string.

	
	Io> "A\nB\nC" allMatchesForRegex("^.")
	==> list("A")

	Io> "A\nB\nC" allMatchesForRegex("^." asRegex multiline)
	==> list("A", "B", "C")
	
nameTable
Returns a list with the name of each capture. The first element will always be nil, because it corresponds to the whole match. The second element will contain the name of the first capture, or nil if the first capture has no name. And so on.
namedCaptures
Returns a Map that contains the index of each named group.
names
Returns a list of the name of each named capture. If there are no named captures, the list will be empty.
notCaseless
The reverse of caseless.
notDotAll
The reverse of dotAll.
notExtended
The reverse of extended.
notMultiline
The reverse of multiline.
pattern
Returns the pattern string that the receiver was created from.
version
Returns a string with PCRE version information.
with(pattern)
Returns a new Regex created from the given pattern string.
RegexMatch
Contains the result of a regular expression match operation. It acts as a read-only list of captured strings. The first item is the entire matched string. Each item after that is a captured sub pattern (anything inbetween parenthesis in the pattern).
Io> match := "37signals" findRegex("([0-9]+)([a-z]+)(!!)?")
==> RegexMatch: "37signals" 

# Item 0 is the entire matched string:
Io> match at(0)
==> 37signals

# Item 1 is the first capture ("[0-9]+"):
Io> match at(1)
==> 37

# Item 2 is the second capture ("[a-z]+"):
Io> match at(2)
==> signals

# The third sub pattern wasn't part of the match, so item 3 is nil:
Io> match at(3)
==> nil

# You can access captures by name:
Io> match at("number")
==> 37
Io> match at("word")
==> signals
asString
Returns a string containing a textual representation of the receiver.
at(indexOrName)
Returns the capture with the given index or name. at(0) is the entire match.
captures
Returns a list of captured strings. The first element is the whole match.
end
Returns the index into the subject at which the match ends.
endOf(indexOrName)
Returns the index into the subject at which the capture with the given index or name ends.
expandTo(templateString)
Returns templateString with capture placeholders replaced with what they represent. $0 is replaced with the whole match, $1 is replaced with the first sub capture, etc. ${name} is replaced with the capture of that name.
foreach([index], capture, message)
Loops through the captures, assigns each capture to capture, and evaluates message. Returns a list with the result of each evaluation.
indexOf(name)
Returns the index of the capture with the given name.
map([index], capture, message)
Like foreach, but the result of each evaluation of message is returned in a list.
nameOf(index)
Returns the name of the capture with the given index.
names
Returns a list of the name of each named capture. If there are no named captures, the list will be empty.
postfix
Returns a slice of the subject string that contains all text after this match. Equivalent to:
	match subject slice(match end)
	
prefix
Returns a slice of the subject string that contains all text before this match. Equivalent to:
	match subject slice(0, match start)
	
range
Returns the range of the match in the subject.
rangeOf(indexOrName)
Returns the range of the capture with the given index or name.
ranges
Returns a list containing the range of each capture.
regex
Returns the Regex that was used to find this match.
select([index], capture, message)
Like foreach, but the values for which the result of evaluating message are non-nil are returned in a list.
size
Returns the number of captures.
sizeInChars
Returns the length of the match, in characters.
slice(startIndex, [endIndex])
Returns a new list containing the subset of the receiver from the startIndex to the endIndex. The endIndex argument is optional. If not given, it is assumed to be the end of the capture list.
start
Returns the index into the subject at which the match starts.
startOf(indexOrName)
Returns the index into the subject at which the capture with the given index or name starts.
string
Returns the matched string.
subject
Returns the string that this match was found in.
RegexMatche
RegexMatches
A regular expression match iterator.
all
Returns a list containing all matches in the string.
allowEmptyMatches
Tells the receiver to allow zero length matches. Empty matches are allowed by default. Returns self.
allowsEmptyMatches
Returns true if the receiver allows empty matches, false if not.
anchored
Like next, but will only match at the current search position.
disallowEmptyMatches
Tells the receiver not to allow zero length matches. Returns self.
endPosition
Returns the index in the string where the receiver stops searching.
foreach(value, message)
Loops through the matches, assigns each match to value, and evaluates message. Returns the result of the last evaluation.
foreachInterval(value, matchMessage, nonMatchMessage)
Like foreach, but takes an extra message that will be evaluated for the non-matching text before each match, and the non-matching text after the last match.
last
Returns the last match in the string.
map(value, message)
Like foreach, but the result of each evaluation of message is returned in a list.
next
Returns the next match, or nil if there is none.
position
Returns the search position as an index in the string.
regex
Returns the Regex that the receiver uses for finding matching.
replace(name, message)
Replaces each match in the string with the result of message and returns the resulting string.
replaceAllWith(templateString)
Same as:
	replace(match, match expandTo(templateString))
	
reset
Resets the search position to the beginning of the string. Returns self.
setEndPosition(anIndex)
Sets the index in the string where the receiver should stop searching. It will be as if the string ends at that index. If index is nil, the end position will be set to the end of string. Returns self.
	Io> "funkadelic" matchesOfRegex("\\w+") setEndPosition(4) next string
	==> funk

	Io> "funkadelic" matchesOfRegex("\\w+") setEndPosition(nil) next string
	==> funkadelic
	
setPosition(aRegexOrString)
Sets the search position to the given index in the string. Returns self.
setRegex(aRegexOrString)
Sets the regex to find matches in. Returns self.
setString(aString)
Sets the string to find matches in. Returns self.
splitString
Splits the string being matched against into pieces using the regex as the delimiter and returns the piece as a list of strings.
string
Returns the string that the receiver finds matches in.
SGML
SGMLElement
asString
Returns a String representation of the tag and all of its subitems.
attributes
Returns a Map containing the tag's attributes.
name
Returns the tag name
setName(aString)
Sets the tag name. Returns self.
subitems
Returns a List containing the tag's subitems.
SGMLParser
This object can be used to parse SGML / HTML / XML.
parse(aSequence)
Parses aSequence and calls the following methods on self;
	
startElement(name)
endElement(name)
newAttribute(key, value)
newText(text)
for each of the items it finds. Returns self.
tagForString(aSequence)
Parses aSequence and returns an SGMLTag object.
Yajl
YajlGenParser
This object can be used to parse YajlGen / HTML / XML.
YajlParser
This object can be used to parse Yajl / HTML / XML.
Physics
ODE
ODEBall
ODEBall binding
ODEBody
ODEBody binding
ODEBox
ODEBox binding
ODEContact
ODEContact binding
ODEContactJoint
ODEContactJoint binding
ODEFixed
ODEFixed binding
ODEHinge
ODEHinge binding
ODEHinge2
ODEJoint binding
ODEJoint
ODEJoint binding
ODEJointGroup
ODEJointGroup binding
ODEMass
ODEMass binding
ODEPlane
ODEPlane binding
ODESimpleSpace
ODESimpleSpace binding
ODEWorld
ODEWorld binding
Server
Curses
Curses
Curses allows writing and reading at arbitrary positions on the terminal. You have to call init to set the terminal to curses mode and end to end curses mode. The terminal is not updated until refresh is called. It is a bad idea to use the standard io's read and write methods when the terminal is in curses mode. The Curses primitive was written by Edwin Zacharias.

Here's an example that prints Hello at column 5 and row 7;

Curses init
Curses move(5, 7) print(\"Hello\")
Curses refresh
Curses end
begin
Sets the terminal to curses mode. This should be called before any other curses methods. Returns self.
cBreak(aString)
Disables line buffering and erase/kill character-processing. cBreak should be on for most purposes. Returns self.
clear
Clears the terminal. Nicer than erase. Returns self.
clearToEndOfLine
Clears the text from the cursor to the end of the line. Returns self.
delete(n)
Deletes n characters at the current position. Text to the right is shifted left. n is optional and defaults to 1. Returns self.
echo
Echoes user input to terminal. Returns self.
end
Ends curses mode. This should be called before standard io's read and write methods are used. Returs self.
get(n)
Returns n characters from the terminal. n is optional and defaults to 1.
getCh
Reads a single-byte character from the terminal associated with the current or specified window. Returns a Number containing the byte.
hasColors
Returns true if the terminal supports color, false otherwise.
height
Returns a Number containing the height of the current screen.
input(n)
Returns user input up to a return, or a maximun of n characters.
insert(aString)
Inserts the string at the current position on the terminal, pushing existing text to the right. Returns self.
move(x, y)
Moves the cursor to column y and row x on the terminal. (0, 0) is at the top-left of the terminal. Returns self.
noCBreak
Allows line buffering and erase/kill character-processing. cBreak should be on for most purposes. Returns self.
noEcho
Does not echo user input to terminal. Returns self.
nodelay(aBoolean)
Enables or disables block during read. If aNumber is zero, nodelay is set to be false, otherwise it is set to be true.
print(aString)
Prints the string to the current position on the terminal, overwriting existing text on the terminal. Returns self.
refresh
Copies the current buffer to the screen. This must be called to make changes to the screen. Returns self.
scroll(num)
Scrolls up num lines. num is optional and defaults to 1. Returns self.
scrollok(aBoolean)
Enables / Disables automatic scrolling. Return self.
setBackgroundBlack
Sets the background color to black.
setBackgroundBlue
Sets the background color to blue.
setBackgroundCyan
Sets the background color to cyan.
setBackgroundGreen
Sets the background color to green.
setBackgroundMagenta
Sets the background color to magenta.
setBackgroundRed
Sets the background color to red.
setBackgroundWhite
Sets the background color to white.
setBackgroundYellow
Sets the background color to yellow.
setForegroundBlack
Sets the foreground color to black.
setForegroundBlue
Sets the foreground color to blue.
setForegroundCyan
Sets the foreground color to cyan.
setForegroundGreen
Sets the foreground color to green.
setForegroundMagenta
Sets the foreground color to magenta.
setForegroundRed
Sets the foreground color to red.
setForegroundWhite
Sets the foreground color to white.
setForegroundYellow
Sets the foreground color to yellow.
setScrollingRegion(top, bottom)
Sets the scrolling region; top and bottom are the line numbers of the top and button margin. Returns self.
width
Returns a Number containing the width of the current screen.
writeCharacter(aCharacter)
Prints the aCharacter to the current position on the terminal, overwriting existing text on the terminal. Returns self.
x
Returns the cursor x position.
y
Returns the cursor y position.
EditLine
EditLine
Binding to libedit (BSD version of readline).
NullAddon
NullAddon
A do-nothing addon for Io, primarily intended to serve as a skeleton for writing your own addons, without having to rewrite all the boilerplate yourself. It implements only one method, hello, which does the obvious job of greeting the world.
ReadLine
ReadLine
Binding to GNU readline.
Syslog
Syslog
Provides access to a Unix system's system logger.

logger = Syslog clone do(
	identity("SyslogTest")
	facility(facilityMap at("LOG_USER"))
	options(List append(optionsMap at("LOG_PID"), optionsMap at("LOG_CONS")))
	priority(priorityMap at("LOG_INFO"))
	open(facility, options)
	mask(List append(maskMap at("LOG_PRIMASK")))
	log(priority, "*** Merely a test ***")
	close
)

Note: This is partially tested. Please let me know of any problems you happen to stumble across, or if it could be better. --Jeremy Tregunna

close
Closes a log that has previously been opened for writing.
facility(optionalFacility)
Specifies the logging facility, which can be one of any of the values found in the facilityMap map. If optionalFacility is omitted, returns the currently set facility.
facilityMap
Contains the following keys, which represent numbers that can be used when opening a log:

  • LOG_KERN
  • LOG_USER
  • LOG_MAIL
  • LOG_DAEMON
  • LOG_AUTH
  • LOG_SYSLOG
  • LOG_LPR
  • LOG_NEWS
  • LOG_UUCP
  • LOG_CRON
  • LOG_AUTHPRIV
  • LOG_FTP
  • LOG_RESERVED0
  • LOG_RESERVED1
  • LOG_RESERVED2
  • LOG_RESERVED3
  • LOG_LOCAL0
  • LOG_LOCAL1
  • LOG_LOCAL2
  • LOG_LOCAL3
  • LOG_LOCAL4
  • LOG_LOCAL5
  • LOG_LOCAL6
  • LOG_LOCAL7
identity(optionalIdentity)
If optionalIdentity is specified, provides an identity for all of the messages you will be sending to the syslog daemon. Returns the identity.
isOpen
Returns self if the log is opened for writing. Otherwise, returns Nil.
log
Writes the supplied data to the log. Requires 2 arguments:

  • Logging Priority
  • Message to log
mask(optionalMask)
If optionalMask is specified, optionalMask is a list which contains any one or more values stored in the maskMap hash that will be OR'd together, to provide the proper mask. Returns the logging mask (as a List).
maskMap
Contains keys/value pairs which represent numbers that specify the logging mask. These values may be any one (or more) of the following:

  • LOG_PRIMASK
  • LOG_FACMASK
open(aPriority, someOptions, optionalIdentity)
Opens the syslog for writing. optionalIdentity need not be entered and will default to the name of the distribution of Io you are running or if you have embedded Io into your application and set Lobby distribution = "foo", it will be set to "foo".
options(optionalOptions)
If optionalOptions is specified, it should represent a list of the logging options you can find in the optionsMap slot. All the values in the supplied aList will be OR'd together when you call the open or reopen slots. Returns the list of options if optionalFacility is omitted.
optionsMap
A map containing key/value pairs holding all available options. These include:

  • LOG_PID
  • LOG_CONS
  • LOG_ODELAY
  • LOG_NDELAY
  • LOG_NOWAIT
  • LOG_PERROR
priority(optionalPriority)
If optionalPriority is specified, sets the value, and returns it. If no value is specified, will return the previously stored value if one has been set previously.
priorityMap
Contains key/value pairs for logging priorities for use when calling the log() method. These include:

  • LOG_EMERG
  • LOG_ALERT
  • LOG_CRIT
  • LOG_ERR
  • LOG_WARNING
  • LOG_NOTICE
  • LOG_INFO
  • LOG_DEBUG
reopen(aFacility, someOptions, optionalIdentity)
Reopens an already open log session. This is useful if you wish to change the facility you are logging to, the options you are logging with, or the identity of the session. Takes the same options as the open slot.
SystemCall
SystemCall
A binding for "callsystem - system() on steorids"
  • asynchonous running of a child process
  • setup of the environment
  • substitution of environment variables
  • connect all 3 standard streams to pipes, null devices, or files
  • pathname handling
Example use;
	
sc = SystemCall clone
asyncRun(command, argList, envMap)
Run the system call.
User
User
This object provides access to the local operating system's information about the current user.
homeDirectory
Returns the current user's home directory as a Directory object.
name
Returns the current user's name.
UserInterface
Clutter
Clutter
Clutter is a GObject based library for creating fast, visually rich, graphical user interfaces. Clutter works by manipulating a scene-graph of 2D surfaces, or 'actors', inside a 3D space. ClutterActor is the base class for such surfaces. All ClutterActors can be positioned, scaled and rotated in 3D space. In addition, other properties can be set, such as 2D clipping, children and opacity. Tranforms applied to a parent actor also apply to any children. Actors are also able to receive events. Subclasses of ClutterActor include ClutterStage, ClutterTexture, ClutterLabel, ClutterRectangle, ClutterEntry and ClutterGroup. ClutterActors are added to a parent, transformed and then made visible. ClutterStage is the top level ClutterActor - it's the representation of a window, or framebuffer. It is created automatically when Clutter is initialised. ClutterStage is a ClutterGroup, a class implementing the ClutterCointainer interface. ClutterTimelines provide the basis for Clutter's animation utilities. Multiple timelines can be synchronised using ClutterScore, and ClutterBehaviour and ClutterEffect allow for the creation of animation effects such as transitions. Clutter further contains a number of utilities, including; ClutterScript - for loading 'UI definition' files formatted in JSON, ClutterShader - a class for applying GPU shaders to actors, ClutterModel - a utility class for MVC list type implementations, and fixed point math utilities. For detailed docs, see clutter-project
fontHinting
Returns true if CLUTTER_FONT_HINTING
grabKeyboard(actor)
grabPointer(actor[, deviceId])
setFontHinting(useFontHinting)
If useFontHinting is false, CLUTTER_FONT_MIPMAPPING flag will be used.
setSharedInt(firstInt, ...)
Video
AVCodec
AVCodec
An object for encoding and decoding audio and video streams.

When an input stream containing audio data is opened, the following slots will be set:

audioChannels
audioSampleRate
audioBitRate
audioDuration
audioFrameCount
When an input stream containing video data is opened, the following slots will be set:
framePeriod
videoDuration
videoFrameCount
audioInputBuffer
Returns the input buffer.
audioOutputBuffer
Returns the output buffer.
close
Closes the input file if it's open. Returns self.
codecName
Returns name of audio or video codec.
decode
Decodes the next chunk of input data. Output (if any) is placed in the outputBuffers. Returns self.
decodeCodecNames
Returns a list of strings with the names of the decode codecs.
didProcess
Called after the receiver processes some more of the input buffer.
encodeCodecNames
Returns a list of strings with the names of the encode codecs.
inputCoro
Returns coroutine currently writing to the receiver.
internalCoro
Returns coroutine used for the AVCodec to process data.
isAtEnd
Returns true if the stream is at its end, false otherwise.
open
Opens the input file. Return self on success or raises an exception on error.
path
Returns path to file the receiver is reading from or writing to.
setCodecName(aSeq)
Sets the codec name. Returns self. See: encodeCodecNames and decodeCodecNames
setInputCoro(aCoro)
Private method for setting inputCoro. Returns self.
setInternalCoro(aCoro)
Private method for setting internalCoro. Returns self.
setPath(aSeq)
Sets the path to file the receiver is reading or writing to. Returns self.
setStreamDestination(anObject)
Sets the streamDestination to anObject. The didProcess method will call:
if(streamDestination, streamDestination write(outputBuffer))
outputBuffer empty
streamDestination
Returns the streamDestination.
videoCodecName
Returns the name of the video codec.
willProcess
Called before the receiver will process more of the input buffer. If inputBuffer is empty, it pauses the receiver's coro.
write(aSequence)
Appends aSequence to the input buffer and resumes the receiver's coroutine in order to process it. The calling coroutine (inputCoroutine) will be scheduled to resume when didProcess is called.
Theora
TheoraComment
A wrapper around the libtheora th_comment object.
count
Returns the number of comments.
TheoraDecodeContext
A wrapper around the libtheora th_dec_ctx object.
TheoraInfo
A wrapper around the libtheora th_info object.
frameHeight
The encoded frame height.
frameRate
The framerate of the video.
frameWidth
The encoded frame width.
TheoraSetupInfo
A wrapper around the libtheora th_setup_info object.
Vorbis
VorbisBlock
A wrapper around the libvorbis vorbis_comment object.
setup
Initialize for decoding using the information obtained from reading the Vorbis headers.
synthesis(packet)
Decode the vorbis data from the packet, storing it in the block.
VorbisComment
A wrapper around the libvorbis vorbis_comment object.
count
Returns number of comments.
VorbisDspState
A wrapper around the libvorbis vorbis_comment object.
blockin(block)
Decodes that data from the block, storing it in the dsp state.
headerin(info, comment, packet)
Try to decode a vorbis header from the packet.
pcmout
Returns array of audio data
setup(info)
Initialize for decoding using the information obtained from reading the Vorbis headers.
VorbisInfo
A wrapper around the libvorbis vorbis_info object.
channels
Returns the number of channels in the vorbis data.
rate
Returns the sample rate of the vorbis data.
version
Returns the vorbis version required for this data.
binding
CFFI
CFFI