Miscellaneous ABC Capabilities

There are a number of auxilliary types which provide such functionality as time, date, random numbers, operating system functions, exceptions, events and tasks.

Time

Type Time provides the functionality to get the current time and perform time arithmetic. For additional functionality, refer to Type PartsList.

Parts

hours:Integer
minutes:Integer
seconds:Integer

Type Methods

This section lists methods available when Type Time is receiver.

fromString timeStr:String

Converts timeStr which should have the format hh:mm:ss to a Time object.
SIGNAL "Bad time format for 'sssss'"

clock
REPLY Integer

Returns the number of milliseconds since the beginning of the session.

new

Returns a new time with the current time.

now

Returns a new time with the current time.

Instance Methods

set hrs:Integer / min:Integer / sec:Integer

Sets me to the given time.
SIGNAL "Invalid seconds"
SIGNAL "Invalid minutes"
SIGNAL "Invalid hours"

setinSeconds sec:Integer

Sets me to the time in seconds.
SIGNAL "Seconds must be positive"

= aTime:Time
REPLY Boolean

REPLY TRUE if the me and aTime are equal.

after aTime:Time
REPLY Boolean

REPLY TRUE if me is after aTime.

before aTime:Time
REPLY Boolean

REPLY TRUE if me is before aTime.

+ aTime:Time

REPLY with the sum of me and aTime.

- aTime:Time

REPLY with the difference of me and aTime.

inSeconds
REPLY Integer

REPLY with me in seconds.

asString
REPLY String

Reply with the string representation of me (i.e. hh:mm:ss).

Date

Type Date provides the functionality to get the current date and perform date arithmetic. For additional functionality, refer to Type PartsList.

Parts

month:Integer (1-12)
day:Integer (1-31)
year:Integer (0-?)

Type Methods

This section lists methods available when Type Date is receiver.

new

Reply with today's date.

today

Reply with today's date.

nameOfMonth m:Integer
REPLY String

Reply with 3 letter string for month 1-12 (e.g. ``Jan'',''Feb'').
SIGNAL "Invalid month number"

isLeapYear year:Integer
REPLY Boolean

Reply TRUE if year is a leap year.

daysInMonth m:Integer forYear y:Integer
REPLY Integer

Reply with number of days in month m for year y.

Instance Methods

This section lists methods which are available to instances of Date.

set m:Integer / d:Integer / y:Integer

Set date to given m,d and y.
SIGNAL "Invalid year"
SIGNAL "Invalid month"
SIGNAL "Invalid day"

dayOfWeek
REPLY String

Reply with three letter abbreviation for date of week for me.

setInDays days:Integer

Set the date based on the number of days since 1/1/0000.

inDays
REPLY Integer

Reply with the number of days me is from 1/1/0000.

= aDate:Date
REPLY Boolean

Reply TRUE if me is the same date as aDate.

after aDate:Date
REPLY Boolean

Reply TRUE if me is after aDate.

before aDate:Date
REPLY Boolean

Reply TRUE if me is before aDate.

+ days:Integer

Reply with a date days days from now.

- days:Integer

Reply with a date days days before now.

asString
REPLY String

Reply with a string of the form ``mm/dd/yyyy''.

asStringWithNames
REPLY String

Reply with a string of the form ``Jun 13, 1993''.

Random

Type Random provides the functionality of generating random numbers. For additional functionality, refer to Type PartsList.

Parts

seed:Integer

Type Methods

This section lists methods available when Type Random is receiver.

new

Reply with a new random distribution. The seed is based on the current time.

Instance Methods

This section lists methods which are available to instances of Random.

between min:Real and max:Real
REPLY Real

Reply with a random number between min and max. Min is included but not max.

next
REPLY Real

Reply with the next random number. The random number is between 0.0 and 1.0 not including 1.0.

Opsystem

Type Opsystem provides the functionality to access operating system utilities. Use the variable 'system' to access the instance methods. For additional functionality, refer to Type PartsList.

Instance Methods

This section lists methods which are available to instances of Opsystem.

importObject filename:String
REPLY Object

Reply with the object defined in filename. The file must be in ASM format.

commandLine
REPLY Array

Reply with an array of strings, each string being a command line argument.

execute command:String
REPLY Integer

Execute the operating system function specified in command. (Not available for the MacIntosh).

symbol aName:String
REPLY String

Reply with the value of the environment variable aName. (Not available for the MacIntosh).

input
REPLY String

Reply with the string entered by the user from the input window.

print data:String
REPLY String

Print the string data to the output window.

import filename:String
REPLY Object

Import objects from the loadfile filename. The file must be in loadfile format which specifies the objects to be loaded and the names they are to be stored under.

export anObject:Object to filename:String

Write the ASM representation for anObject to filename.

halt

Save current changes and quit.

printLine data:String

Print the string data and newline to the output window.

checkPoint

Save current changes but continue to run.

invalidateCache

Method and part references are cached for performance reasons. This method will clear out the cache and force methods and parts to looked up again. This is primarily used when methods or types are being changed and the cache may contain references which are no longer valid.

Exception

When an abnormal condition occurs, an exception is signalled. The reason for the exception and the task which caused the exception are stored in the exception object. For additional functionality, refer to Type PartsList.

Parts

reason:String (reason for exception)
info:Array (additional information associated with exception)
exceptTask:Task (task which caused exception)

Instance Methods

This section lists methods which are available to instances of Exception.

report

Generate the Oops dialogbox to report the exception.

Event

Type Event stores the information needed whenever an event occurs in the user interface. Common events include, buttonPress, buttonRelease, keyPress, keyRelease, motion, expose etc. For additional functionality, refer to Type PartsList.

Parts

widgetID:Integer (widget identifier in which event occurred)
reason:Integer (event type)
x:Integer (x location of cursor in widget)
y:Integer (y location of cursor in widget)
xroot:Integer (absolute x location)
yroot:Integer (absolute y location)
d1:Integer (data relative to reason)
d2:Integer (data relative to reason)

Type Methods

This section lists methods available when Type Event is receiver.

names
REPLY Array

Reply with list of event names.

indexOf aName:String
REPLY Integer

Reply with index number of event aName.

Instance Methods

This section lists methods which are available to instances of Event.

asString
REPLY String

Reply with string form of event reason (e.g. ``buttonPress'').

widget
REPLY Widget

Reply with widget which received event.

is hashval:Integer
REPLY Boolean

Reply TRUE if me has same the hash value as hashval. For example, if anEvent is a motion Event, then (anEvent is #motion) would be TRUE.

keyModifierIs hval:Integer
REPLY Boolean

Reply TRUE If me is a keyPress or keyRelease event and the key modifier is the same as hval. Valid values for hval are #none, #shift, #lock, #ctrl, #shiftctrl, #shiftlock, #ctrllock or #shiftctrllock.

Task

Every computation in ABC occurs while executing some task. Type Task supports the functionality associated with creating, executing, pausing and deleting tasks. The task queue is a circular queue in which tasks are executed round-robin. Fair scheduling is enforced by giving each task a quota of method calls. Once the quota is exhausted, the task must relinquish control to another ready task. The current executing task is pointed to by the system variable 'myTask'. For additional functionality, refer to Type PartsList.

Parts

next:Task (next task in queue)
context:Dictionary (option context information for task)
state:Array (contents of stack when not executing)
ready:Boolean (TRUE if ready to execute)
quota:Integer (quota of method calls)

Type Methods

This section lists methods available when Type Task is receiver.

new method:Method with parameters:Array

Reply with new task which will execute method with given parameters. Part ready will be set to FALSE.

reschedule

Give up control of processor by myTask and execute next ready task if there is one.

next

Reply with next ready task.

Instance Methods

This section lists methods which are available to instances of Task.

terminate

Remove me from the task queue and delete.

activate

Set me to ready. Execution of me will not resume immediately but will wait until other ready tasks ahead of me can execute.

suspend

Set me to not ready.

wait msec:Integer

Put me to sleep for msec milliseconds and execute next ready task.

sleep msec:Integer

Put me on a sleep queue to be awakened in msec milliseconds. When awakened, ready will be set to TRUE. Note that this will apparently do nothing if you continue to execute being called. Normally you should use method wait:.

execute

Begin execution of me.

debug
REPLY Bugman

Reply with a Bug manager session to debug me.