mac-rom/Libs/InterfaceSrcs/PackagesGlue.a
Elliot Nunn 4325cdcc78 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-12-26 09:52:23 +08:00

553 lines
21 KiB
Plaintext

;
; File: PACKAGES.a
;
; Contains: Implementation for C-style interfaces to packages (from high-level languages).
;
; Copyright: © 1984-1992 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM1> 11/5/92 SWC Moved the contents of PACKAGES.a here because of a name conflict
; with an equates file.
; <3> 7/6/92 DCL Added Support for new synonyms.
; <2> 6/20/90 PKE Combined the glue for iudatestring and iutimestring. Combined
; the glue for iudatepstring and iutimepstring, and added in
; iuldatestring and iultimestring. Added glue for new 7.0 routines
; iucomppstring, iuequalpstring, and iustringorder. Copied iuXXX
; selector names from PackMacs.a and used them here, but changed
; them to iuSelXxx to avoid potential name conflicts. Added BBS
; header.
; <1> 1/19/90 HJR Adding for the first time into BBS.
;
; (old change history)
; 12/4/89 JAL Moved numtostring to runtime.o
; *** MPW 3.0d4 from here up ***
; 2/11/88 KLH Changed C headers to work with new C compiler:
; Changed to using standard glue in Interface.o, so
; much glue removed from CInterface.o.
; *** MPW 3.0d2 from here up ***
; 2/24/87 KLH DIUnload spelling corrected to match Inside Mac.
;___________________________________________________________________________________________________
LOAD 'StandardEqu.d'
BLANKS ON
STRING ASIS
CASE OBJ
; Equates for INTERNATIONAL PACKAGE routine selectors <2>
iuSelGetIntl EQU 6
iuSelSetIntl EQU 8
iuSelDateString EQU 0
iuSelDatePString EQU 14
iuSelTimeString EQU 2
iuSelTimePString EQU 16
iuSelMetric EQU 4
iuSelMagString EQU 10
iuSelMagIDString EQU 12
iuSelLDateString EQU 20
iuSelLTimeString EQU 22
iuSelClearCache EQU 24
iuSelMagPString EQU 26
iuSelMagIDPString EQU 28
iuSelScriptOrder EQU 30
iuSelLangOrder EQU 32
iuSelTextOrder EQU 34
iuSelGetItlTable EQU 36
; The following flag indicates that we are adding glue here for some System 7 <2>
; International Utilities routines.
AddIUVer7Glue EQU 1 ; <2>
; short iucompstring(char *aStr,char *bStr);
iucompstring proc EXPORT ; short iucompstring(char *aStr,char *bStr);
move.l d3,-(sp) ; save d3, ROM bug workaround
move.l d2,-(sp) ; save register d2
clr.w -(sp) ; reserve space for result
; stack at this point
; 18(sp).l char *bStr (MPW C convention, rightmost parameter pushed first)
; 14(sp).l char *aStr
; 10(sp).l return addr
; 6(sp).l saved d3
; 2(sp).l saved d2
; 0(sp).w space for result
move.l 14(sp),a0 ; char *aStr
move.l 18(sp),a1 ; char *bStr
move.l a0,-(sp) ; push aPtr
move.l a1,-(sp) ; push bPtr
move.w #-1,d0 ; aLength
@1 add.w #1,d0 ; aLength += 1
tst.b (a0)+ ; end of string ?
bne.s @1 ; branch if not end of string
move.w d0,-(sp) ; push aLength
move.w #-1,d0 ; bLength
@2 add.w #1,d0 ; bLength += 1
tst.b (a1)+ ; end of string ?
bne.s @2 ; branch if not end of string
move.w d0,-(sp) ; push bLength
move.w #iuSelMagString,-(sp) ; push selector for IUMagString <2>
_Pack6 ; trap to International Utils <2>
move.w (sp)+,d0 ; load result
ext.l d0 ; extend result to long
move.l (sp)+,d2 ; restore register d2
move.l (sp)+,d3 ; restore d3, ROM bug workaround
rts ; return
; short iuequalstring(char *aStr,char *bStr);
iuequalstring proc EXPORT ; iuequalstring(s,t) char *s,*t;
move.l d2,-(sp) ; save register d2
clr.w -(sp) ; reserve space for result
move.l 10(sp),a0 ; char *s
move.l 14(sp),a1 ; char *t
move.l a0,-(sp) ; push aPtr
move.l a1,-(sp) ; push bPtr
move.w #-1,d0 ; aLength
@1 add.w #1,d0 ; aLength += 1
tst.b (a0)+ ; end of string ?
bne.s @1 ; branch if not end of string
move.w d0,-(sp) ; push aLength
move.w #-1,d0 ; bLength
@2 add.w #1,d0 ; bLength += 1
tst.b (a1)+ ; end of string ?
bne.s @2 ; branch if not end of string
move.w d0,-(sp) ; push bLength
move.w #iuSelMagIDString,-(sp) ; push selector for IUMagIDString <2>
_Pack6 ; trap to International Utils <2>
move.w (sp)+,d0 ; load result
ext.l d0 ; extend result to long
move.l (sp)+,d2 ; restore register d2
rts
IF AddIUVer7Glue THEN ; <2>
;---------------
; short comparestring(char *aStr,char *bStr,Handle intlParam);
; short identicalstring(char *aStr,char *bStr,Handle intlParam);
proc
export comparestring
export iucomppstring ; obsolete old procedure name
export identicalstring
export iuequalpstring ; obsolete old procedure name
comparestring
iucomppstring ; obsolete old procedure name
moveq #iuSelMagPString,d1 ; which selector? <2>
iumagpstringcommon
move.l d2,-(sp) ; save register d2
clr.w -(sp) ; reserve space for result
; stack at this point
; 18(sp).l Handle intlParam (MPW C convention, rightmost parameter pushed first)
; 14(sp).l char *bStr
; 10(sp).l char *aStr
; 6(sp).l return addr
; 2(sp).l saved d2
; 0(sp).w space for result
move.l 10(sp),a0 ; char *aStr
move.l 14(sp),a1 ; char *bStr
move.l a0,-(sp) ; push aPtr
move.l a1,-(sp) ; push bPtr
move.w #-1,d0 ; aLength
@1 add.w #1,d0 ; aLength += 1
tst.b (a0)+ ; end of string ?
bne.s @1 ; branch if not end of string
move.w d0,-(sp) ; push aLength
move.w #-1,d0 ; bLength
@2 add.w #1,d0 ; bLength += 1
tst.b (a1)+ ; end of string ?
bne.s @2 ; branch if not end of string
move.w d0,-(sp) ; push bLength
move.l 30(sp),-(sp) ; push Handle intlParam <2>
move.w d1,-(sp) ; push selector <2>
_Pack6 ; trap to International Utils <2>
move.w (sp)+,d0 ; load result
ext.l d0 ; extend result to long
move.l (sp)+,d2 ; restore register d2
rts
identicalstring
iuequalpstring ; obsolete old procedure name
moveq #iuSelMagIDPString,d1 ; which selector? <2>
bra.s iumagpstringcommon ; <2>
endproc
; short stringorder(char *aStr,char *bStr,ScriptCode aScript,ScriptCode bScript,LangCode aLang,LangCode bLang);
stringorder proc export
export iustringorder ; obsolete old procedure name
iustringorder ; obsolete old procedure name
move.l d2,-(sp) ; save register d2
clr.w -(sp) ; reserve space for result
; stack at this point
; 24(sp).w LangCode bLang
; 22(sp).w LangCode aLang
; 20(sp).w ScriptCode bScript
; 18(sp).w ScriptCode aScript
; 14(sp).l char *bStr
; 10(sp).l char *aStr
; 6(sp).l return addr
; 2(sp).l saved d2
; 0(sp).w space for result
move.l 10(sp),a0 ; char *aStr
move.l 14(sp),a1 ; char *bStr
move.l a0,-(sp) ; push aPtr
move.l a1,-(sp) ; push bPtr
move.w #-1,d0 ; aLength
@1 add.w #1,d0 ; aLength += 1
tst.b (a0)+ ; end of string ?
bne.s @1 ; branch if not end of string
move.w d0,-(sp) ; push aLength
move.w #-1,d0 ; bLength
@2 add.w #1,d0 ; bLength += 1
tst.b (a1)+ ; end of string ?
bne.s @2 ; branch if not end of string
move.w d0,-(sp) ; push bLength
move.w 30(sp),-(sp) ; push ScriptCode aScript <2>
move.w 34(sp),-(sp) ; push ScriptCode bScript <2>
move.w 38(sp),-(sp) ; push LangCode aLang <2>
move.w 42(sp),-(sp) ; push LangCode bLang <2>
move.w #iuSelTextOrder,-(sp) ; push selector <2>
_Pack6 ; trap to International Utils <2>
move.w (sp)+,d0 ; load result
ext.l d0 ; extend result to long
move.l (sp)+,d2 ; restore register d2
rts
endproc
;---------------
ENDIF ; <2>
; void stringtonum(char *theString,long *theNum);
stringtonum proc EXPORT ; stringtonum(s,n) char *s, int *n;
import c2pstr ; c2pstr(s) char *s;
import p2cstr ; p2cstr(s) char *s;
move.l d2,-(sp) ; save register d2
move.l 8(sp),-(sp) ; push copy of theString
jsr c2pstr ; convert to Pascal string
move.l (sp),a0 ; char *theString
move.w #1,-(sp) ; push secondary trap number
dc.w $A9EE ; trap to stringtonum
move.l 16(sp),a0 ; int *theNum
move.l d0,(a0) ; return theNum
jsr p2cstr ; convert back to C string
addq.w #4,sp ; remove theString
move.l (sp)+,d2 ; restore register d2
rts ; return
;;DILoad proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; move.w #2,-(sp) ; push secondary trap number
;; dc.w $A9E9 ; trap to DILoad
;; move.l (sp)+,d2 ; restore register d2
;; rts
;;
;;DIUnload proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; move.w #4,-(sp) ; push secondary trap number
;; dc.w $A9E9 ; trap to DIUnload
;; move.l (sp)+,d2 ; restore register d2
;; rts
dibadmount proc EXPORT
move.l d2,-(sp) ; save register d2
clr.w -(sp) ; reserve space for result
move.l 10(sp),a0 ; load address of first parameter
move.l (a0),-(sp) ; push value of first parameter
move.l 18(sp),-(sp) ; push copy of second parameter
move.w #0,-(sp) ; push secondary trap number
dc.w $A9E9 ; trap to dibadmount
move.w (sp)+,d0 ; load result
ext.l d0 ; extend result to long
move.l (sp)+,d2 ; restore register d2
rts
;;DIFormat proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; clr.w -(sp) ; reserve space for result
;; move.w 12(sp),-(sp) ; push copy of first parameter
;; move.w #6,-(sp) ; push secondary trap number
;; dc.w $A9E9 ; trap to DIFormat
;; move.w (sp)+,d0 ; load result
;; ext.l d0 ; extend result to long
;; move.l (sp)+,d2 ; restore register d2
;; rts
;;DIVerify proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; clr.w -(sp) ; reserve space for result
;; move.w 12(sp),-(sp) ; push copy of first parameter
;; move.w #8,-(sp) ; push secondary trap number
;; dc.w $A9E9 ; trap to DIVerify
;; move.w (sp)+,d0 ; load result
;; ext.l d0 ; extend result to long
;; move.l (sp)+,d2 ; restore register d2
;; rts
dizero proc EXPORT
import c2pstr ; c2pstr(s) char *s;
import p2cstr ; p2cstr(s) char *s;
move.l d2,-(sp) ; save register d2
clr.w -(sp) ; reserve space for result
move.w 12(sp),-(sp) ; push copy of first parameter
move.l 16(sp),-(sp) ; push copy of second parameter
jsr c2pstr ; convert to Pascal string
move.w #10,-(sp) ; push secondary trap number
dc.w $A9E9 ; trap to dizero
move.l 14(sp),-(sp) ; push copy of second paramter
jsr p2cstr ; convert back to C string
add.w #4,sp ; balance stack
move.w (sp)+,d0 ; load result
ext.l d0 ; extend result to long
move.l (sp)+,d2 ; restore register d2
rts
sfputfile proc EXPORT
import c2pstr ; c2pstr(s) char *s;
import p2cstr ; p2cstr(s) char *s;
move.l d2,-(sp) ; save register d2
move.l 8(sp),a0 ; load address of first parameter
move.l (a0),-(sp) ; push value of first parameter
move.l 16(sp),-(sp) ; push copy of second parameter
jsr c2pstr ; convert to Pascal string
move.l 24(sp),-(sp) ; push copy of third parameter
jsr c2pstr ; convert to Pascal string
move.l 32(sp),-(sp) ; push copy of fourth parameter
move.l 40(sp),-(sp) ; push copy of fifth parameter
move.w #1,-(sp) ; push secondary trap number
dc.w $A9EA ; trap to sfputfile
move.l 12(sp),-(sp) ; push copy of second paramter
jsr p2cstr ; convert back to C string
move.l 20(sp),-(sp) ; push copy of third paramter
jsr p2cstr ; convert back to C string
add.w #8,sp ; balance stack
move.l (sp)+,d2 ; restore register d2
rts
sfpputfile proc EXPORT
import c2pstr ; c2pstr(s) char *s;
import p2cstr ; p2cstr(s) char *s;
move.l d2,-(sp) ; save register d2
move.l 8(sp),a0 ; load address of first parameter
move.l (a0),-(sp) ; push value of first parameter
move.l 16(sp),-(sp) ; push copy of second parameter
jsr c2pstr ; convert to Pascal string
move.l 24(sp),-(sp) ; push copy of third parameter
jsr c2pstr ; convert to Pascal string
move.l 32(sp),-(sp) ; push copy of fourth parameter
move.l 40(sp),-(sp) ; push copy of fifth parameter
move.w 50(sp),-(sp) ; push copy of sixth parameter
move.l 54(sp),-(sp) ; push copy of seventh parameter
move.w #3,-(sp) ; push secondary trap number
dc.w $A9EA ; trap to sfpputfile
move.l 12(sp),-(sp) ; push copy of second paramter
jsr p2cstr ; convert back to C string
move.l 20(sp),-(sp) ; push copy of third paramter
jsr p2cstr ; convert back to C string
add.w #8,sp ; balance stack
move.l (sp)+,d2 ; restore register d2
rts
sfgetfile proc EXPORT
import c2pstr ; c2pstr(s) char *s;
import p2cstr ; p2cstr(s) char *s;
move.l d2,-(sp) ; save register d2
move.l 8(sp),a0 ; load address of first parameter
move.l (a0),-(sp) ; push value of first parameter
move.l 16(sp),-(sp) ; push copy of second parameter
jsr c2pstr ; convert to Pascal string
move.l 24(sp),-(sp) ; push copy of third parameter
move.w 34(sp),-(sp) ; push copy of fourth parameter
move.l 38(sp),-(sp) ; push copy of fifth parameter
move.l 46(sp),-(sp) ; push copy of sixth parameter
move.l 54(sp),-(sp) ; push copy of seventh parameter
move.w #2,-(sp) ; push secondary trap number
dc.w $A9EA ; trap to sfgetfile
move.l 12(sp),-(sp) ; push copy of second paramter
jsr p2cstr ; convert back to C string
add.w #4,sp ; balance stack
move.l (sp)+,d2 ; restore register d2
rts
sfpgetfile proc EXPORT
import c2pstr ; c2pstr(s) char *s;
import p2cstr ; p2cstr(s) char *s;
move.l d2,-(sp) ; save register d2
move.l 8(sp),a0 ; load address of first parameter
move.l (a0),-(sp) ; push value of first parameter
move.l 16(sp),-(sp) ; push copy of second parameter
jsr c2pstr ; convert to Pascal string
move.l 24(sp),-(sp) ; push copy of third parameter
move.w 34(sp),-(sp) ; push copy of fourth parameter
move.l 38(sp),-(sp) ; push copy of fifth parameter
move.l 46(sp),-(sp) ; push copy of sixth parameter
move.l 54(sp),-(sp) ; push copy of seventh parameter
move.w 64(sp),-(sp) ; push copy of eighth parameter
move.l 68(sp),-(sp) ; push copy of ninth parameter
move.w #4,-(sp) ; push secondary trap number
dc.w $A9EA ; trap to sfpgetfile
move.l 12(sp),-(sp) ; push copy of second paramter
jsr p2cstr ; convert back to C string
add.w #4,sp ; balance stack
move.l (sp)+,d2 ; restore register d2
rts
; void iudatestring(long dateTime,DateForm longFlag,char *result);
; void iutimestring(long dateTime,Boolean wantSeconds,char *result);
proc ; common iudatestring/iutimestring <2>
export iudatestring
export iutimestring
import p2cstr ; p2cstr(s) char *s;
iudatestring
moveq #iuSelDateString,d0 ; which selector? <2>
iudatetimecommon ; <2>
; stack at this point
;
; 12(sp).l char *result
; 11(sp).b DateForm longFlag (or) Boolean wantSeconds (both are bytes in low byte of long)
; 4(sp).l long dateTime
; 0(sp).l return addr
move.l d2,-(sp) ; save register d2
move.l 8(sp),-(sp) ; push copy of first parameter
move.b 19(sp),-(sp) ; push copy of second parameter
move.l 22(sp),-(sp) ; push copy of third parameter
move.w d0,-(sp) ; push selector <2>
_Pack6 ; trap to International Utils <2>
move.l 16(sp),-(sp) ; push copy of third paramter
jsr p2cstr ; convert back to C string
add.w #4,sp ; balance stack
move.l (sp)+,d2 ; restore register d2
rts
iutimestring
moveq #iuSelTimeString,d0 ; which selector? <2>
bra.s iudatetimecommon ; <2>
endproc ; <2>
; void datestring(long dateTime,DateForm longFlag,char *result,Handle intlParam);
; void timestring(long dateTime,Boolean wantSeconds,char *result,Handle intlParam);
; void longdatestring(LongDateTime *dateTime,DateForm longFlag,char *result,Handle intlParam);
; void longtimestring(LongDateTime *dateTime,Boolean wantSeconds,char *result,Handle intlParam);
proc ; common iudatepstring/iutimepstring <2>
export datestring
export iudatepstring ; obsolete old procedure name
export timestring
export iutimepstring ; obsolete old procedure name
export longdatestring ; <2>
export iuldatestring ; obsolete old procedure name <2>
export longtimestring ; <2>
export iultimestring ; obsolete old procedure name <2>
import p2cstr ; p2cstr(s) char *s;
datestring
iudatepstring
moveq #iuSelDatePString,d0 ; which selector? <2>
iudatetimepcommon ; <2>
; stack at this point
;
; 16(sp).l Handle intlParam
; 12(sp).l char *result
; 11(sp).b DateForm longFlag (or) Boolean wantSeconds (both are bytes in low byte of long)
; 4(sp).l long dateTime (or) LongDateTime *dateTime (both are longs)
; 0(sp).l return addr
move.l d2,-(sp) ; save register d2
move.l 8(sp),-(sp) ; push copy of first parameter
move.b 19(sp),-(sp) ; push copy of second parameter
move.l 22(sp),-(sp) ; push copy of third parameter
move.l 30(sp),-(sp) ; push copy of fourth parameter
move.w d0,-(sp) ; push selector <2>
_Pack6 ; trap to International Utils <2>
move.l 16(sp),-(sp) ; push copy of third paramter
jsr p2cstr ; convert back to C string
add.w #4,sp ; balance stack
move.l (sp)+,d2 ; restore register d2
rts
timestring
iutimepstring
moveq #iuSelTimePString,d0 ; which selector? <2>
bra.s iudatetimepcommon ; <2>
longdatestring
iuldatestring ; <2>
moveq #iuSelLDateString,d0 ; which selector? <2>
bra.s iudatetimepcommon ; <2>
longtimestring
iultimestring ; <2>
moveq #iuSelLTimeString,d0 ; which selector? <2>
bra.s iudatetimepcommon ; <2>
endproc ; <2>
;;IUMetric proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; clr.b -(sp) ; reserve space for result
;; move.w #4,-(sp) ; push secondary trap number
;; dc.w $A9ED ; trap to IUMetric
;; move.b (sp)+,d0 ; load result
;; ext.w d0 ; extend result to word
;; ext.l d0 ; extend result to long
;; move.l (sp)+,d2 ; restore register d2
;; rts
;;IUGetIntl proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; clr.l -(sp) ; reserve space for result
;; move.w 14(sp),-(sp) ; push copy of first parameter
;; move.w #6,-(sp) ; push secondary trap number
;; dc.w $A9ED ; trap to IUGetIntl
;; move.l (sp)+,d0 ; load result
;; move.l (sp)+,d2 ; restore register d2
;; rts
;;IUSetIntl proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; move.w 10(sp),-(sp) ; push copy of first parameter
;; move.w 16(sp),-(sp) ; push copy of second parameter
;; move.l 20(sp),-(sp) ; push copy of third parameter
;; move.w #8,-(sp) ; push secondary trap number
;; dc.w $A9ED ; trap to IUSetIntl
;; move.l (sp)+,d2 ; restore register d2
;; rts
;;IUMagString proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; clr.w -(sp) ; reserve space for result
;; move.l 10(sp),-(sp) ; push copy of first parameter
;; move.l 18(sp),-(sp) ; push copy of second parameter
;; move.w 28(sp),-(sp) ; push copy of third parameter
;; move.w 34(sp),-(sp) ; push copy of fourth parameter
;; move.w #10,-(sp) ; push secondary trap number
;; dc.w $A9ED ; trap to IUMagString
;; move.w (sp)+,d0 ; load result
;; ext.l d0 ; extend result to long
;; move.l (sp)+,d2 ; restore register d2
;; rts
;;IUMagIDString proc EXPORT
;; move.l d2,-(sp) ; save register d2
;; clr.w -(sp) ; reserve space for result
;; move.l 10(sp),-(sp) ; push copy of first parameter
;; move.l 18(sp),-(sp) ; push copy of second parameter
;; move.w 28(sp),-(sp) ; push copy of third parameter
;; move.w 34(sp),-(sp) ; push copy of fourth parameter
;; move.w #12,-(sp) ; push secondary trap number
;; dc.w $A9ED ; trap to IUMagIDString
;; move.w (sp)+,d0 ; load result
;; ext.l d0 ; extend result to long
;; move.l (sp)+,d2 ; restore register d2
;; rts
END