Important: The information in this document is obsolete and should not be used for new development.
How Calls Are Dispatched
WorldScript II does not implement all of the script utilities because some of them (such asGetScriptManagerVariable
) are handled by the script management system itself. The script utilities that the script management system does not handle are listed in Table A-11 on page A-26. For those, the script management system passes execution to the WorldScript II dispatch routine, which in turn uses the script system's dispatch table to call the appropriate utility routine in WorldScript II.When the WorldScript II dispatch routine calls a script utility, it replaces the selector of a normal script utility call with the address of the script record of the font script. It then calls the script utility. For instance:
The script's dispatch routine passes the script record to the WorldScript II script utilities so that they can use the script-specific information (such as the byte-type tables) in the script's international resources.
- In assembly language, when you call
CharacterByteType
, you typically call it through a macro in the following way:
subq.w #2, sp ; room for result.
move.l textPtr,-(sp) ; push text pointer.
clr.w -(sp) ; push text offset.
CharacterByteType
; find out whether it is 1-byte or
; 2-byte character.
tst.w (sp)+ ; is it 1-byte?- The
CharacterByteType
macro expands into
move.l $82060010,-(sp) ; push the selector.
ScriptUtil ; call Script Manager trap.- For this example, the stack looks like the following when the trap has been called:
return address (long) <-- top of stack routine selector (long) text offset (word) text pointer (long) result (word) - If the Script Manager does not handle the call, it passes the call to the current script's dispatch routine. The dispatch routine figures out by the value of the routine selector whether the call is in the range of calls it handles. If it is not, the dispatch routine strips the stack and returns without doing anything.
- If the call is in the valid range, the dispatch routine performs these tasks:
- It gets the address of the WorldScript II version of the script utility from the script's dispatch table.
- It gets the address of the script record and replaces the selector on the stack with the address of the script record.
- It jumps into the routine.
- So the stack becomes
return address (long) <-- top of stack address of script record (long) text offset (word) text pointer (long) result (word)