home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1991: Code Warrior / bincue / Code Warrior.bin / Development Platforms (Moof!) / LISP Related / Goal-Plan-Code Editor / library / Traps.lisp < prev   
Encoding:
Text File  |  1990-07-06  |  46.3 KB  |  1,273 lines  |  [TEXT/CCL ]

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;Trap.Lisp Version 1.2
  3. ;;
  4. ;;Copyright 1986-88, Coral Software Corp.
  5. ;;
  6. ;;
  7. ;;   This file contains trap definitions for most Macintosh traps provided
  8. ;;   by the Macintosh Plus, and some additional traps from later Macintoshes
  9. ;;   (e.g. color Quickdraw traps).
  10. ;;
  11. ;;  Additional trap definitions can be added easily.  All you need is the trap
  12. ;;  number, from Inside Macintosh.
  13. ;;
  14. ;;  To access traps from Allegro CL, load this file.  The traps can then be
  15. ;;  called using the format described in chapter 12 of the Allegro CL User's
  16. ;;  Guide.
  17. ;;
  18. ;;  Note that traps are defined as macros, so this file must be loaded before
  19. ;;  compiling functions which use the traps.
  20. ;;
  21. ;;  If memory is short, you may want to comment-out unused traps.
  22. ;;  Loading this entire file will use of about 60K of memory.
  23. ;;
  24. ;;
  25.  
  26. ;;
  27. ;;The following mechanism is used to define traps:
  28. ;;
  29. ;;   For each trap _Foo, this file defines a lisp constant _Foo (which has
  30. ;;   as its value the trap number) and a macro _Foo which expands into a call
  31. ;;   to the function STACK-TRAP or the function REGISTER-TRAP.
  32. ;;
  33. ;;   The file contains four functions which generate these constants and macros.
  34. ;;   Each function produces trap calls of a slightly different format (to
  35. ;;   support stack-traps, register-traps, hfs-traps, and package-traps).
  36. ;;
  37. ;;   Each of these functions is mapped over an array of
  38. ;;   trap-names/trap-numbers.
  39. ;;
  40. ;;   To add trap definitions, add trap-name/trap-number pairs to the appropriate
  41. ;;   array definition.  To remove trap definitions, comment-out
  42. ;;   trap-name/trap-number pairs from the array definition.
  43. ;;
  44. ;;
  45.  
  46.  
  47.  
  48. (in-package "CCL")
  49.  
  50.  
  51.  
  52. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  53. ;;stack-trap-macro-function
  54. ;;
  55. ;;function used for defining stack-traps
  56. ;;
  57. ;;it transforms a call that looks like this
  58. ;;
  59. ;;                              (_Foo [:check-error] . args)
  60. ;;
  61. ;;into one that looks like this
  62. ;;
  63. ;;                              (stack-trap [:check-error] _Foo . args)
  64.  
  65.  
  66. (defun stack-trap-macro-function (call env &aux (name (car call)))
  67.    (declare (ignore env))
  68.    (setq call (cdr call))
  69.    (cons 'stack-trap
  70.       (if (memq (car call) *error-check-keywords*)
  71.           (list* (car call) name (cdr call))
  72.         (cons name call))))
  73.  
  74.  
  75. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  76. ;;register-trap-macro-function
  77. ;;
  78. ;;function used for defining register-traps
  79. ;;
  80. ;;it transforms a call that looks like this
  81. ;;
  82. ;;                              (_Foo [:check-error] . args)
  83. ;;
  84. ;;into one that looks like this
  85. ;;
  86. ;;                              (register-trap [:check-error] _Foo . args)
  87.  
  88.   
  89. (defun register-trap-macro-function (call env &aux (name (car call)))
  90.    (declare (ignore env))
  91.    (setq call (cdr call))
  92.    (cons 'register-trap
  93.       (if (memq (car call) *error-check-keywords*)
  94.           (list* (car call) name (cdr call))
  95.         (cons name call))))
  96.  
  97.  
  98.  
  99. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  100. ;;hfs-trap-macro-function
  101. ;;
  102. ;;function used for defining hfs-traps
  103. ;;
  104. ;;it transforms a call that looks like this
  105. ;;
  106. ;;                (_Foo [:check-error] . args)
  107. ;;
  108. ;;into one that looks like this
  109. ;;
  110. ;;                (register-trap [:check-error] _HFSDispatch :d0 _Foo . args)
  111. ;;
  112.  
  113. (defun hfs-trap-macro-function (call env &aux (name (car call)))
  114.    (declare (ignore env))
  115.    (setq call (cdr call))
  116.    (cons 'register-trap
  117.      (if (memq (car call) *error-check-keywords*)
  118.         (list* (car call) #xA260 :d0 name (cdr call))
  119.        (list* #xA260 :d0 name call))))
  120.  
  121. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  122. ;;dispatch-stack-trap-macro-function
  123. ;;
  124. ;;function used for defining dispatching stack-traps
  125. ;;
  126. ;;it transforms a call that looks like this
  127. ;;
  128. ;;                      (_Foo [:check-error] . args )
  129. ;;
  130. ;;into one that looks like this
  131. ;;
  132. ;;                      (stack-trap [:check-error] trap# ..args.. :word _Foo)
  133. ;;
  134.  
  135. (defun dispatch-stack-trap-macro-function (call env
  136.                                                 &aux (name (car call))
  137.                                                 (trap (get (car call) 'dispatching-trap)))
  138.    (declare (ignore env))
  139.    (setq call (list-reverse (cdr call)))
  140.    (setq call
  141.      (list-reverse
  142.       (if (and call (assq (car call) *stack-trap-output-keywords*))
  143.          (list* (car call) name :word (cdr call))
  144.         (list* name :word call))))
  145.    (cons 'stack-trap
  146.      (if (memq (car call) *error-check-keywords*)
  147.         (list* (car call) trap (cdr call))
  148.        (cons trap call))))
  149.  
  150. (defun long-dispatch-stack-trap-macro-function (call env
  151.                                                 &aux (num (symbol-value (car call)))
  152.                                                 (trap (get (car call) 'dispatching-trap)))
  153.    (declare (ignore env))
  154.    (setq call (list-reverse (cdr call)))
  155.    (setq call
  156.      (list-reverse
  157.       (if (and call (assq (car call) *stack-trap-output-keywords*))
  158.          (list* (car call) (ash num -16) :word (logand num #xffff) :word (cdr call))
  159.         (list* (ash num -16) :word (logand num #xffff) :word call))))
  160.    (cons 'stack-trap
  161.      (if (memq (car call) *error-check-keywords*)
  162.         (list* (car call) trap (cdr call))
  163.        (cons trap call))))
  164.  
  165. ;; ####################################################################
  166. ;; ########################## Stack Traps #############################
  167. ;; ####################################################################
  168.  
  169. (let ((macro-fn #'stack-trap-macro-function)
  170.       (traps '#(
  171.                 ;**************************************************
  172.                 ;Control Manager traps:
  173.  
  174.                 (_DisposControl . #xA955)
  175.                 (_DragControl . #xA967)
  176.                 (_DrawControls . #xA969)
  177.                 (_FindControl . #xA96C)
  178.                 (_Draw1Control . #xA96D)
  179.                 (_GetCRefCon . #xA95A)
  180.                 (_GetCTitle . #xA95E)
  181.                 (_GetCtlAction . #xA96A)
  182.                 (_GetCtlValue . #xA960)
  183.                 (_GetMaxCtl . #xA962)
  184.                 (_GetMinCtl . #xA961)
  185.                 (_GetNewControl . #xA9BE)
  186.                 (_HideControl . #xA958)
  187.                 (_HiliteControl . #xA95D)
  188.                 (_KillControls . #xA956)
  189.                 (_MoveControl . #xA959)
  190.                 (_NewControl . #xA954)
  191.                 (_SetCRefCon . #xA95B)
  192.                 (_SetCTitle . #xA95F)
  193.                 (_SetCtlAction . #xA96B)
  194.                 (_SetCtlValue . #xA963)
  195.                 (_SetMaxCtl . #xA965)
  196.                 (_SetMinCtl . #xA964)
  197.                 (_ShowControl . #xA957)
  198.                 (_SizeControl . #xA95C)
  199.                 (_TestControl . #xA966)
  200.                 (_TrackControl . #xA968)
  201.  
  202.                 (_UpdtControls . #xA953)
  203.  
  204.                 ;**************************************************
  205.                 ;Desk Accessory traps:
  206.  
  207.                 (_CloseDeskAcc . #xA9B7)
  208.                 (_OpenDeskAcc . #xA9B6)
  209.                 (_SysEdit . #xA9C2)
  210.                 (_SystemClick . #xA9B3)
  211.                 (_SystemEvent . #xA9B2)
  212.                 (_SystemMenu . #xA9B5)
  213.                 (_SystemTask . #xA9B4)
  214.  
  215.  
  216.                 ;**************************************************
  217.                 ;Dialog Manager traps:
  218.  
  219.                 (_Alert . #xA985)
  220.                 (_CautionAlert . #xA988)
  221.                 (_CloseDialog . #xA982)
  222.                 (_CouldAlert . #xA989)
  223.                 (_CouldDialog . #xA979)
  224.                 (_DialogSelect . #xA980)
  225.                 (_DisposDialog . #xA983)
  226.                 (_DrawDialog . #xA981)
  227.                 (_ErrorSound . #xA98C)
  228.                 (_FreeAlert . #xA98A)
  229.                 (_FreeDialog . #xA97A)
  230.                 (_GetDItem . #xA98D)
  231.                 (_GetIText . #xA990)
  232.                 (_GetNewDialog . #xA97C)
  233.                 (_InitDialogs . #xA97B)
  234.                 (_IsDialogEvent . #xA97F)
  235.                 (_ModalDialog . #xA991)
  236.                 (_NewDialog . #xA97D)
  237.                 (_NoteAlert . #xA987)
  238.                 (_ParamText . #xA98B)
  239.                 (_SelIText . #xA97E)
  240.                 (_SetDItem . #xA98E)
  241.                 (_SetIText . #xA98F)
  242.                 (_StopAlert . #xA986)
  243.  
  244.                 (_FindDItem . #xA984)
  245.                 (_HideDItem . #xA827)
  246.                 (_ShowDItem . #xA828)
  247.                 (_UpdtDialog . #xA978)
  248.  
  249.                 ;**************************************************
  250.                 ;Event Manager traps:
  251.  
  252.                 (_Button . #xA974)
  253.                 (_EventAvail . #xA971)
  254.                 (_GetKeys . #xA976)
  255.                 (_GetMouse . #xA972)
  256.                 (_WaitNextEvent . #xA860)
  257.                 (_GetNextEvent . #xA970)
  258.                 (_StillDown . #xA973)
  259.                 (_TickCount . #xA975)
  260.                 (_WaitMouseUp . #xA977)
  261.  
  262.                 ;**************************************************
  263.                 ;Font Manager traps:
  264.  
  265.                 (_FMSwapFont . #xA901)
  266.                 (_GetFName . #xA8FF)
  267.                 (_GetFNum . #xA900)
  268.                 (_InitFonts . #xA8FE)
  269.                 (_RealFont . #xA902)
  270.                 (_SetFontLock . #xA903)
  271.  
  272.                 (_FontMetrics . #xA835)
  273.                 (_SetFScaleDisable . #xA834)
  274.  
  275.                 ;**************************************************
  276.                 ;Menu Manager traps:
  277.  
  278.                 (_AddResMenu . #xA94D)
  279.                 (_AppendMenu . #xA933)
  280.                 (_CalcMenuSize . #xA948)
  281.                 (_CheckItem . #xA945)
  282.                 (_ClearMenuBar . #xA934)
  283.                 (_CountMItems . #xA950)
  284.                 (_DeleteMenu . #xA936)
  285.                 (_DisableItem . #xA93A)
  286.                 (_DisposMenu . #xA932)
  287.                 (_DrawMenuBar . #xA937)
  288.                 (_EnableItem . #xA939)
  289.                 (_FlashMenuBar . #xA94C)
  290.                 (_GetItem . #xA946)
  291.                 (_GetItmIcon . #xA93F)
  292.                 (_GetItmMark . #xA943)
  293.                 (_GetItmStyle . #xA941)
  294.                 (_GetMenuBar . #xA93B)
  295.                 (_GetMHandle . #xA949)
  296.                 (_GetNewMBar . #xA9C0)
  297.                 (_GetRMenu . #xA9BF)
  298.                 (_HiliteMenu . #xA938)
  299.                 (_InitMenus . #xA930)
  300.                 (_InsertMenu . #xA935)
  301.                 (_InsertResMenu . #xA951)
  302.                 (_MenuKey . #xA93E)
  303.                 (_MenuSelect . #xA93D)
  304.                 (_NewMenu . #xA931)
  305.                 (_SetItem . #xA947)
  306.                 (_SetItmIcon . #xA940)
  307.                 (_SetItmMark . #xA944)
  308.                 (_SetItmStyle . #xA942)
  309.                 (_SetMenuBar . #xA93C)
  310.                 (_SetMFlash . #xA94A)
  311.                 (_DelMenuItem . #xA952)
  312.                 (_InsMenuItem . #xA826)
  313.  
  314.  
  315.                 ;**************************************************
  316.                 ;Package Manager traps:
  317.  
  318.                 (_InitAllPacks . #xA9E6)
  319.                 (_InitPack . #xA9E5)
  320.                 (_Pack0 . #xA9E7)
  321.                 (_Pack1 . #xA9E8)
  322.                 (_Pack2 . #xA9E9)
  323.                 (_dskInit . #xA9E9)  ;Non-standard name
  324.                 (_Pack3 . #xA9EA)
  325.                 (_STDFile . #xA9EA)  ;Non-standard name
  326.                 (_Pack4 . #xA9EB)
  327.                 (_fp68k . #xA9EB)
  328.                 (_Pack5 . #xA9EC)
  329.                 (_elems68k . #xA9EC)
  330.                 (_Pack6 . #xA9ED)
  331.                 (_intUtil . #xA9ED) ;Non-standard name
  332.                 (_Pack7 . #xA9EE)
  333.                 (_DecStr68K . #xA9EE)
  334.                 (_Pack8 . #xA816)
  335.                 (_Pack9 . #xA82B)
  336.                 (_Pack10 . #xA82C)
  337.                 (_Pack11 . #xA82D)
  338.                 (_Pack12 . #xA82E)
  339.                 (_Pack13 . #xA82F)
  340.                 (_Pack14 . #xA830)
  341.                 (_Pack15 . #xA831)
  342.  
  343.                 ;**************************************************
  344.                 ;QuickDraw traps:
  345.  
  346.                 (_AddPt . #xA87E)
  347.                 (_ANGLEFROMSLOPE . #xA8C4)
  348.                 (_BackColor . #xA863)
  349.                 (_BackPat . #xA87C)
  350.                 (_CharWidth . #xA88D)
  351.                 (_ClipRect . #xA87B)
  352.                 (_ClosePgon . #xA8CC)
  353.                 (_ClosePicture . #xA8F4)
  354.                 (_ClosePort . #xA87D)
  355.                 (_CloseRgn . #xA8DB)
  356.                 (_ColorBit . #xA864)
  357.                 (_CopyBits . #xA8EC)
  358.                 (_CopyRgn . #xA8DC)
  359.                 (_DiffRgn . #xA8E6)
  360.                 (_DisposRgn . #xA8D9)
  361.                 (_DrawChar . #xA883)
  362.                 (_DrawPicture . #xA8F6)
  363.                 (_DrawString . #xA884)
  364.                 (_DrawText . #xA885)
  365.                 (_EmptyRect . #xA8AE)
  366.                 (_EmptyRgn . #xA8E2)
  367.                 (_EqualPt . #xA881)
  368.                 (_EqualRect . #xA8A6)
  369.                 (_EqualRgn . #xA8E3)
  370.                 (_EraseArc . #xA8C0)
  371.                 (_EraseOval . #xA8B9)
  372.                 (_ErasePoly . #xA8C8)
  373.                 (_EraseRect . #xA8A3)
  374.                 (_EraseRgn . #xA8D4)
  375.                 (_EraseRoundRect . #xA8B2)
  376.                 (_FillArc . #xA8C2)
  377.                 (_FillOval . #xA8BB)
  378.                 (_FillPoly . #xA8CA)
  379.                 (_FillRect . #xA8A5)
  380.                 (_FillRgn . #xA8D6)
  381.                 (_FillRoundRect . #xA8B4)
  382.                 (_ForeColor . #xA862)
  383.                 (_FrameArc . #xA8BE)
  384.                 (_FrameOval . #xA8B7)
  385.                 (_FramePoly . #xA8C6)
  386.                 (_FrameRect . #xA8A1)
  387.                 (_FrameRgn . #xA8D2)
  388.                 (_FrameRoundRect . #xA8B0)
  389.                 (_GetClip . #xA87A)
  390.                 (_GetFontInfo . #xA88B)
  391.                 (_GetPen . #xA89A)
  392.                 (_GetPenState . #xA898)
  393.                 (_GetPixel . #xA865)
  394.                 (_GetPort . #xA874)
  395.                 (_GlobalToLocal . #xA871)
  396.                 (_GrafDevice . #xA872)
  397.                 (_HideCursor . #xA852)
  398.                 (_HidePen . #xA896)
  399.                 (_InitCursor . #xA850)
  400.                 (_InitGraf . #xA86E)
  401.                 (_InitPort . #xA86D)
  402.                 (_InsetRect . #xA8A9)
  403.                 (_InsetRgn . #xA8E1)
  404.                 (_InverRect . #xA8A4)
  405.                 (_InverRgn . #xA8D5)
  406.                 (_InverRoundRect . #xA8B3)
  407.                 (_InvertArc . #xA8C1)
  408.                 (_InvertOval . #xA8BA)
  409.                 (_InvertPoly . #xA8C9)
  410.                 (_KillPicture . #xA8F5)
  411.                 (_KillPoly . #xA8CD)
  412.                 (_Line . #xA892)
  413.                 (_LineTo . #xA891)
  414.                 (_LocalToGlobal . #xA870)
  415.                 (_MapPoly . #xA8FC)
  416.                 (_MapPt . #xA8F9)
  417.                 (_MapRect . #xA8FA)
  418.                 (_MapRgn . #xA8FB)
  419.                 (_MOOV . #xA894) 
  420.                 (_Move . #xA894)
  421.                 (_MovePortTo . #xA877)
  422.                 (_MoveTo . #xA893)
  423.                 (_NewRgn . #xA8D8)
  424.                 (_ObscureCursor . #xA856)
  425.                 (_OffsetPoly . #xA8CE)
  426.                 (_OffsetRect . #xA8A8)
  427.                 (_OFSETRGN . #xA8E0) 
  428.                 (_OffsetRgn . #xA8E0)
  429.                 (_OpenPicture . #xA8F3)
  430.                 (_OpenPoly . #xA8CB)
  431.                 (_OpenPort . #xA86F)
  432.                 (_OpenRgn . #xA8DA)
  433.                 (_PackBits . #xA8CF)
  434.                 (_PaintArc . #xA8BF)
  435.                 (_PaintOval . #xA8B8)
  436.                 (_PaintPoly . #xA8C7)
  437.                 (_PaintRect . #xA8A2)
  438.                 (_PaintRgn . #xA8D3)
  439.                 (_PaintRoundRect . #xA8B1)
  440.                 (_PenMode . #xA89C)
  441.                 (_PenNormal . #xA89E)
  442.                 (_PenPat . #xA89D)
  443.                 (_PenSize . #xA89B)
  444.                 (_PicComment . #xA8F2)
  445.                 (_PortSize . #xA876)
  446.                 (_Pt2Rect . #xA8AC)
  447.                 (_PtInRect . #xA8AD)
  448.                 (_PtInRgn . #xA8E8)
  449.                 (_PtToAngle . #xA8C3)
  450.                 (_Random . #xA861)
  451.                 (_RectInRgn . #xA8E9)
  452.                 (_RectRgn . #xA8DF)
  453.                 (_ScalePt . #xA8F8)
  454.                 (_ScriptUtil . #xA8B5)
  455.                 (_ScrollRect . #xA8EF)
  456.                 (_SectRect . #xA8AA)
  457.                 (_SectRgn . #xA8E4)
  458.                 (_SetClip . #xA879)
  459.                 (_SetCursor . #xA851)
  460.                 (_SetEmptyRgn . #xA8DD)
  461.                 (_SetOrigin . #xA878)
  462.                 (_SetPBits . #xA875)
  463.                 (_SetPenState . #xA899)
  464.                 (_SetPort . #xA873)
  465.                 (_SetPt . #xA880)
  466.                 (_SetRecRgn . #xA8DE)
  467.                 (_SetRect . #xA8A7)
  468.                 (_SetStdProcs . #xA8EA)
  469.                 (_ShowCursor . #xA853)
  470.                 (_ShowPen . #xA897)
  471.                 (_ShutDown . #xA895)
  472.                 (_SLOPEFROMANGLE . #xA8BC)
  473.                 (_SpaceExtra . #xA88E)
  474.                 (_StdArc . #xA8BD)
  475.                 (_StdBits . #xA8EB)
  476.                 (_StdComment . #xA8F1)
  477.                 (_StdGetPic . #xA8EE)
  478.                 (_StdLine . #xA890)
  479.                 (_StdOval . #xA8B6)
  480.                 (_StdPoly . #xA8C5)
  481.                 (_StdPutPic . #xA8F0)
  482.                 (_StdRect . #xA8A0)
  483.                 (_StdRgn . #xA8D1)
  484.                 (_StdRRect . #xA8AF)
  485.                 (_StdText . #xA882)
  486.                 (_StdTxMeas . #xA8ED)
  487.                 (_StringWidth . #xA88C)
  488.                 (_StuffHex . #xA866)
  489.                 (_SubPt . #xA87F)
  490.                 (_TextFace . #xA888)
  491.                 (_TextFont . #xA887)
  492.                 (_TextMode . #xA889)
  493.                 (_TextSize . #xA88A)
  494.                 (_TextWidth . #xA886)
  495.                 (_Unimplemented . #xa89f)
  496.                 (_UnionRect . #xA8AB)
  497.                 (_UnionRgn . #xA8E5)
  498.                 (_UnpackBits . #xA8D0)
  499.                 (_XOrRgn . #xA8E7)
  500.                 (_CalcMask . #xA838)
  501.                 (_CopyMask . #xA817)
  502.                 (_GetMaskTable . #xA836)
  503.                 (_MeasureText . #xA837)
  504.                 (_SeedFill . #xA839)
  505.  
  506.                 ;**************************************************
  507.                 ;Color traps:
  508.                 
  509.                 (_OPENCPORT . #xAA00) 
  510.                 (_INITCPORT . #xAA01) 
  511.                 (_CLOSECPORT . #xA87D) 
  512.                 (_NEWPIXMAP . #xAA03) 
  513.                 (_DISPOSPIXMAP . #xAA04) 
  514.                 (_COPYPIXMAP . #xAA05) 
  515.                 (_SETCPORTPIX . #xAA06) 
  516.                 (_NEWPIXPAT . #xAA07) 
  517.                 (_DISPOSPIXPAT . #xAA08) 
  518.                 (_COPYPIXPAT . #xAA09) 
  519.                 (_PENPIXPAT . #xAA0A) 
  520.                 (_BACKPIXPAT . #xAA0B) 
  521.                 (_GETPIXPAT . #xAA0C) 
  522.                 (_MAKERGBPAT . #xAA0D) 
  523.                 (_FILLCRECT . #xAA0E) 
  524.                 (_FILLCOVAL . #xAA0F) 
  525.                 (_FILLCROUNDRECT . #xAA10) 
  526.                 (_FILLCARC . #xAA11) 
  527.                 (_FILLCRGN . #xAA12) 
  528.                 (_FILLCPOLY . #xAA13) 
  529.                 (_RGBFORECOLOR . #xAA14) 
  530.                 (_RGBBACKCOLOR . #xAA15) 
  531.                 (_SETCPIXEL . #xAA16) 
  532.                 (_GETCPIXEL . #xAA17) 
  533.                 (_GETCTABLE . #xAA18) 
  534.                 (_GETFORECOLOR . #xAA19) 
  535.                 (_GETBACKCOLOR . #xAA1A) 
  536.                 (_GETCCURSOR . #xAA1B) 
  537.                 (_SETCCURSOR . #xAA1C) 
  538.                 (_ALLOCCURSOR . #xAA1D) 
  539.                 (_GETCICON . #xAA1E) 
  540.                 (_PLOTCICON . #xAA1F) 
  541.                 (_OPCOLOR . #xAA21) 
  542.                 (_HILITECOLOR . #xAA22) 
  543.                 (_CHAREXTRA . #xAA23) 
  544.                 (_DISPOSCTABLE . #xAA24) 
  545.                 (_DISPOSCICON . #xAA25) 
  546.                 (_DISPOSCCURSOR . #xAA26) 
  547.                 (_SEEDCFILL . #xAA50) 
  548.                 (_CALCCMASK . #xAA4F) 
  549.                 (_GETMAXDEVICE . #xAA27) 
  550.                 (_GETCTSEED . #xAA28) 
  551.                 (_GETDEVICELIST . #xAA29) 
  552.                 (_GETMAINDEVICE . #xAA2A) 
  553.                 (_GETNEXTDEVICE . #xAA2B) 
  554.                 (_TESTDEVICEATTRIBUTE . #xAA2C) 
  555.                 (_SETDEVICEATTRIBUTE . #xAA2D) 
  556.                 (_INITGDEVICE . #xAA2E) 
  557.                 (_NEWGDEVICE . #xAA2F) 
  558.                 (_DISPOSGDEVICE . #xAA30) 
  559.                 (_SETGDEVICE . #xAA31) 
  560.                 (_GETGDEVICE . #xAA32) 
  561.                 (_COLOR2INDEX . #xAA33) 
  562.                 (_INDEX2COLOR . #xAA34) 
  563.                 (_INVERTCOLOR . #xAA35) 
  564.                 (_REALCOLOR . #xAA36) 
  565.                 (_GETSUBTABLE . #xAA37) 
  566.                 (_MAKEITABLE . #xAA39) 
  567.                 (_ADDSEARCH . #xAA3A) 
  568.                 (_ADDCOMP . #xAA3B) 
  569.                 (_SETCLIENTID . #xAA3C) 
  570.                 (_PROTECTENTRY . #xAA3D) 
  571.                 (_RESERVEENTRY . #xAA3E) 
  572.                 (_SETENTRIES . #xAA3F) 
  573.                 (_QDERROR . #xAA40) 
  574.                 (_SAVEENTRIES . #xAA49) 
  575.                 (_RESTOREENTRIES . #xAA4A) 
  576.                 (_DELSEARCH . #xAA4C) 
  577.                 (_DELCOMP . #xAA4D) 
  578.                 (_SETSTDCPROCS . #xAA4E) 
  579.                 (_STDOPCODEPROC . #xABF8) 
  580.                 (_SETWINCOLOR . #xAA41) 
  581.                 (_GETAUXWIN . #xAA42) 
  582.                 (_SETCTLCOLOR . #xAA43) 
  583.                 (_GETAUXCTL . #xAA44) 
  584.                 (_NEWCWINDOW . #xAA45) 
  585.                 (_GETNEWCWINDOW . #xAA46) 
  586.                 (_SETDESKCPAT . #xAA47) 
  587.                 (_GETCWMGRPORT . #xAA48) 
  588.                 (_GETCVARIANT . #xA809) 
  589.                 (_GETWVARIANT . #xA80A) 
  590.                 (_DELMCENTRIES . #xAA60) 
  591.                 (_GETMCINFO . #xAA61) 
  592.                 (_SETMCINFO . #xAA62) 
  593.                 (_DISPMCINFO . #xAA63) 
  594.                 (_GETMCENTRY . #xAA64) 
  595.                 (_SETMCENTRIES . #xAA65) 
  596.                 (_MENUCHOICE . #xAA66) 
  597.                 (_SETFRACTENABLE . #xA814) 
  598.                 (_NEWCDIALOG . #xAA4B)
  599.                 (_InitPalettes . #xAA90)
  600.                 (_NewPalette     . #xAA91)
  601.                 (_GetNewPalette . #xAA92)
  602.                 (_DisposePalette . #xAA93)
  603.                 (_ActivatePalette . #xAA94)
  604.                 (_SetPalette     . #xAA95)
  605.                 (_GetPalette     . #xAA96)
  606.                 (_PmForeColor . #xAA97)
  607.                 (_PmBackColor . #xAA98)
  608.                 (_AnimateEntry . #xAA99)
  609.                 (_AnimatePalette . #xAA9A) 
  610.                 (_GetEntryColor . #xAA9B)
  611.                 (_SetEntryColor . #xAA9C)
  612.                 (_GetEntryUsage . #xAA9D) 
  613.                 (_SetEntryUsage . #xAA9E)
  614.                 (_CTab2Palette . #xAA9F) 
  615.                 (_Palette2CTab . #xAAA0)
  616.  
  617.  
  618.                 ;**************************************************
  619.                 ;Resource Manager traps:
  620.  
  621.                 ;_AddReference    trapw    #xA9AC    removed in Mac+
  622.                 (_AddResource . #xA9AB)
  623.                 (_ChangedResData . #xA9AA)
  624.                 (_CloseResFile . #xA99A)
  625.                 (_CountResources . #xA99C)
  626.                 (_CountTypes . #xA99E)
  627.                 (_CreateResFile . #xA9B1)
  628.                 (_CurResFile . #xA994)
  629.                 (_DetachResource . #xA992)
  630.                 (_GetIndResource . #xA99D)
  631.                 (_GetIndType . #xA99F)
  632.                 (_GetNamedResource . #xA9A1)
  633.                 (_GetResAttrs . #xA9A6)
  634.                 (_GetResFileAttrs . #xA9F6)
  635.                 (_GetResInfo . #xA9A8)
  636.                 (_GetResource . #xA9A0)
  637.                 (_HomeResFile . #xA9A4)
  638.                 (_InitResource . #xA995)
  639.                 (_LoadResource . #xA9A2)
  640.                 (_OpenResFile . #xA997)
  641.                 (_ReleaseResource . #xA9A3)
  642.                 (_ResError . #xA9AF)
  643.                 ;_RmveReference    trapw    #xA9AE    removed in Mac+
  644.                 (_RmveResource . #xA9AD)
  645.                 (_RsrcZoneInit . #xA996)
  646.                 (_SetResAttrs . #xA9A7)
  647.                 (_SetResFileAttrs . #xA9F7)
  648.                 (_SetResInfo . #xA9A9)
  649.                 (_SetResLoad . #xA99B)
  650.                 (_SetResPurge . #xA993)
  651.                 (_SizeResource . #xA9A5)
  652.                 (_UniqueID . #xA9C1)
  653.                 (_UpdateResFile . #xA999)
  654.                 (_UseResFile . #xA998)
  655.                 (_WriteResource . #xA9B0)
  656.                 (_Count1Resources . #xA80D)
  657.                 (_Count1Types . #xA81C)
  658.                 (_Get1IndResource . #xA80E)
  659.                 (_Get1IndType . #xA80F)
  660.                 (_GET1IXRESOURCE . #xA80E) 
  661.                 (_GET1IXTYPE . #xA80F)
  662.                 (_Get1NamedResource . #xA820)
  663.                 (_Get1Resource . #xA81F)
  664.                 (_MaxSizeRsrc . #xA821)
  665.                 (_OpenRFPerm . #xA9C4)
  666.                 (_RsrcMapEntry . #xA9C5)
  667.                 (_Unique1ID . #xA810)
  668.                 (_XMUNGER . #xA819) 
  669.  
  670.                 ;**************************************************
  671.                 ;Scrap Manager traps:
  672.  
  673.                 (_GetScrap . #xA9FD)
  674.                 (_InfoScrap . #xA9F9)
  675.                 (_LodeScrap . #xA9FB)
  676.                 (_PutScrap . #xA9FE)
  677.                 (_UnlodeScrap . #xA9FA)
  678.                 (_ZeroScrap . #xA9FC)
  679.  
  680.                 ;**************************************************
  681.                 ;Segment Loader traps:
  682.  
  683.                 (_ExitToShell . #xA9F4)
  684.                 (_GetAppParms . #xA9F5)
  685.                 (_LoadSeg . #xA9F0)
  686.                 (_UnloadSeg . #xA9F1)
  687.  
  688.                 ;**************************************************
  689.                 ;Text Edit traps:
  690.  
  691.                 (_TEActivate . #xA9D8)
  692.                 (_TECalText . #xA9D0)
  693.                 (_TEClick . #xA9D4)
  694.                 (_TECopy . #xA9D5)
  695.                 (_TECut . #xA9D6)
  696.                 (_TEDeactivate . #xA9D9)
  697.                 (_TEDelete . #xA9D7)
  698.                 (_TEDispose . #xA9CD)
  699.                 (_TEGetText . #xA9CB)
  700.                 (_TEIdle . #xA9DA)
  701.                 (_TEInit . #xA9CC)
  702.                 (_TEInsert . #xA9DE)
  703.                 (_TEKey . #xA9DC)
  704.                 (_TENew . #xA9D2)
  705.                 (_TEPaste . #xA9DB)
  706.                 (_TEScroll . #xA9DD)
  707.                 (_TESetJust . #xA9DF)
  708.                 (_TESetSelect . #xA9D1)
  709.                 (_TESetText . #xA9CF)
  710.                 (_TEUpdate . #xA9D3)
  711.                 (_TextBox . #xA9CE)
  712.                 (_TEAutoView . #xA813)
  713.                 (_TEPinScroll . #xA812)
  714.                 (_TESelView . #xA811)
  715.  
  716.                 ;**************************************************
  717.                 ;Toolbox Utilities traps:
  718.  
  719.                 (_BitAnd . #xA858)
  720.                 (_BitClr . #xA85F)
  721.                 (_BitNot . #xA85A)
  722.                 (_BitOr . #xA85B)
  723.                 (_BitSet . #xA85E)
  724.                 (_BitShift . #xA85C)
  725.                 (_BitTst . #xA85D)
  726.                 (_BitXOr . #xA859)
  727.                 (_FixMul . #xA868)
  728.                 (_FixRatio . #xA869)
  729.                 (_FixRound . #xA86C)
  730.                 (_GetCursor . #xA9B9)
  731.                 (_GetIcon . #xA9BB)
  732.                 (_GetPattern . #xA9B8)
  733.                 (_GetPicture . #xA9BC)
  734.                 (_GetString . #xA9BA)
  735.                 (_HiWord . #xA86A)
  736.                 (_LongMul . #xA867)
  737.                 (_LoWord . #xA86B)
  738.                 (_Munger . #xA9E0)
  739.                 (_NewString . #xA906)
  740.                 (_PlotIcon . #xA94B)
  741.                 (_SetString . #xA907)
  742.                 (_ShieldCursor . #xA855)
  743.                 (_FixAtan2 . #xA818)
  744.                 (_FixDiv . #xA84D)
  745.                 (_Fix2Frac . #xA841)
  746.                 (_Fix2Long . #xA840)
  747.                 (_Fix2X . #xA843)
  748.                 (_FracCos . #xA847)
  749.                 (_FracDiv . #xA84B)
  750.                 (_FracMul . #xA84A)
  751.                 (_FracSin . #xA848)
  752.                 (_FracSqrt . #xA849)
  753.                 (_Frac2Fix . #xA842)
  754.                 (_Frac2X . #xA845)
  755.                 (_Long2Fix . #xA83F)
  756.                 (_X2Fix . #xA844)
  757.                 (_X2Frac . #xA846)
  758.  
  759.                 ;**************************************************
  760.                 ;Window Manager traps:
  761.  
  762.                 (_BeginUpdate . #xA922)
  763.                 (_BringToFront . #xA920)
  764.                 (_CalcVBehind . #xA90A)
  765.                 (_CalcVis . #xA909)
  766.                 (_CheckUpdate . #xA911)
  767.                 (_ClipAbove . #xA90B)
  768.                 (_CloseWindow . #xA92D)
  769.                 (_DisposWindow . #xA914)
  770.                 (_DragGrayRgn . #xA905)
  771.                 (_DragTheRgn . #xA926)
  772.                 (_DragWindow . #xA925)
  773.                 (_DrawGrowIcon . #xA904)
  774.                 (_DrawNew . #xA90F)
  775.                 (_EndUpdate . #xA923)
  776.                 (_FindWindow . #xA92C)
  777.                 (_FrontWindow . #xA924)
  778.                 (_GetNewWindow . #xA9BD)
  779.                 (_GetWindowPic . #xA92F)
  780.                 (_GetWMgrPort . #xA910)
  781.                 (_GetWRefCon . #xA917)
  782.                 (_GetWTitle . #xA919)
  783.                 (_GrowWindow . #xA92B)
  784.                 (_HideWindow . #xA916)
  785.                 (_HiliteWindow . #xA91C)
  786.                 (_InitWindows . #xA912)
  787.                 (_InvalRect . #xA928)
  788.                 (_InvalRgn . #xA927)
  789.                 (_MoveWindow . #xA91B)
  790.                 (_NewWindow . #xA913)
  791.                 (_PaintBehind . #xA90D)
  792.                 (_PaintOne . #xA90C)
  793.                 (_PinRect . #xA94E)
  794.                 (_SaveOld . #xA90E)
  795.                 (_SelectWindow . #xA91F)
  796.                 (_SendBehind . #xA921)
  797.                 (_SetWindowPic . #xA92E)
  798.                 (_SetWRefCon . #xA918)
  799.                 (_SetWTitle . #xA91A)
  800.                 (_ShowHide . #xA908)
  801.                 (_ShowWindow . #xA915)
  802.                 (_SizeWindow . #xA91D)
  803.                 (_TrackGoAway . #xA91E)
  804.                 (_ValidRect . #xA92A)
  805.                 (_ValidRgn . #xA929)
  806.                 (_TrackBox . #xA83B)
  807.                 (_ZoomWindow . #xA83A)
  808.  
  809.                 ;**************************************************
  810.                 ; Sound Manager Traps
  811.  
  812.                 ;<according to Apple, these *don't* begin with underbars>
  813.     
  814.                 (_SndDoCommand . #xA803)
  815.                 (_SndDoImmediat . #xA804)
  816.                 (_SndAddModifier . #xA802)
  817.                 (_SndNewChanne . #xA807)
  818.                 (_SndDisposeChannel . #xA801)
  819.                 (_SndPlay . #xA805)
  820.                 (_SndControl . #xA806)
  821.  
  822.                 ;**************************************************
  823.                 ;Misc. traps:
  824.  
  825.                 (_SCSIDispatch . #xA815)
  826.                 (_SysBeep . #xA9C8)
  827.                 ;the below added by cfry 10/22/87
  828.                 (_SCRNBITMAP . #xA833) 
  829.                 (_DELTAPOINT . #xA94F) 
  830.                 (_UPDTCONTROL . #xA953) 
  831.                 (_INITRESOURCES . #xA995) 
  832.                 (_SIZERSRC . #xA9A5) 
  833.                 (_CHANGEDRESOURCE . #xA9AA) 
  834.                 (_ADDREFERENCE . #xA9AC) 
  835.                 (_RMVEREFERENCE . #xA9AE) 
  836.                 (_METHODDISPATCH . #xA9F8) 
  837.                 (_DEBUGGER . #xA9FF)
  838.                 (_DEBUGSTR . #xABFF)
  839.                 (_RGETRESOURCE . #xA80C) 
  840.                 (_INITPROCMENU . #xA808) 
  841.                 (_GETITEMCMD . #xA84E) 
  842.                 (_SETITEMCMD . #xA84F) 
  843.                 (_POPUPMENUSELECT . #xA80B) 
  844.                 (_KEYTRANS . #xA9C3) 
  845.                 (_TEGETOFFSET . #xA83C) 
  846.                 (_TEDISPATCH . #xA83D) 
  847.                 (_TESTYLENEW . #xA83E)
  848.                 (_PrintDispatch . #xA8FD)
  849.  
  850.                )))
  851.   (dotimes (i (length traps))
  852.     (let ((data (svref traps i)))
  853.       (export (car data))
  854.       (define-constant (car data) (cdr data))
  855.       (%macro-have (car data) macro-fn))))
  856.  
  857. ;; ####################################################################
  858. ;; ######################## Register Traps ############################
  859. ;; ####################################################################
  860. (let ((macro-fn #'register-trap-macro-function)
  861.       (traps '#(
  862.                 ;**************************************************
  863.                 ;Event Manager traps:
  864.                 (_FlushEvents . #xA032)
  865.                 (_PostEvent . #xA02F)
  866.  
  867.                 ;**************************************************
  868.                 ;Device Manager traps:
  869.  
  870.                 (_Control . #xA004)
  871.                 (_AControl . #xA404)
  872.                 (_KillIO . #xA006)
  873.                 (_Status . #xA005)
  874.  
  875.                 ;**************************************************
  876.                 ;File Manager traps:
  877.  
  878.                 (_AddDrive . #xA04E)
  879.                 (_Allocate . #xA010)
  880.                 (_AllocContig . #xA210)
  881.                 (_Close . #xA001)
  882.                 (_Create . #xA008)
  883.                 (_Delete . #xA009)
  884.                 (_Eject . #xA017)
  885.                 (_FINITQUEUE . #xA016) 
  886.                 (_FlushFile . #xA045)
  887.                 (_FlushVol . #xA013)
  888.                 (_GetEOF . #xA011)
  889.                 (_GetFileInfo . #xA00C)
  890.                 (_GetFPos . #xA018)
  891.                 (_GetVol . #xA014)
  892.                 (_GetVolInfo . #xA007)
  893.                 (_HCreate . #xA208)
  894.                 (_HDelete . #xA209)
  895.                 (_HGetFileInfo . #xA20C)
  896.                 (_HGetVInfo . #xA207)
  897.                 (_HGetVol . #xA214)
  898.                 (_HOpen . #xA200)
  899.                 (_HOpenRF . #xA20A)
  900.                 (_HRename . #xA20B)
  901.                 (_HRstFLock . #xA242)
  902.                 (_HSetFileInfo . #xA20D)
  903.                 (_HSetFLock . #xA241)
  904.                 (_HSetVol . #xA215)
  905.                 (_InitQueue . #xA016)
  906.                 (_MountVol . #xA00F)
  907.                 (_Offline . #xA035)
  908.                 (_Open . #xA000)
  909.                 (_OpenRF . #xA00A)
  910.                 (_Read . #xA002)
  911.                 (_Rename . #xA00B)
  912.                 (_RstFilLock . #xA042)
  913.                 (_SetEOF . #xA012)
  914.                 (_SetFileInfo . #xA00D)
  915.                 (_SetFilLock . #xA041)
  916.                 (_SetFilType . #xA043)
  917.                 (_SetFPos . #xA044)
  918.                 (_SetPEOF . #xA212)
  919.                 (_SetVol . #xA015)
  920.                 (_UnmountVol . #xA00E)
  921.                 (_Write . #xA003)
  922.                 (_HFSDispatch . #xA260)
  923.  
  924.                 ;**************************************************
  925.                 ;Memory Manager traps:
  926.  
  927.                 (_BlockMove . #xA02E)
  928.                 (_CompactMem . #xA14C)
  929.                 (_DisposHandle . #xA023)
  930.                 (_DisposPtr . #xA01F)
  931.                 (_EmptyHandle . #xA02B)
  932.                 (_FreeMem . #xA01C)
  933.                 (_GetHandleSize . #xA025)
  934.                 (_GetPtrSize . #xA021)
  935.                 (_GetZone . #xA11A)
  936.                 (_HandleZone . #xA126)
  937.                 (_HLock . #xA029)
  938.                 (_HNoPurge . #xA04A)
  939.                 (_HPurge . #xA049)
  940.                 (_HUnlock . #xA02A)
  941.                 (_InitApplZone . #xA02C)
  942.                 (_InitZone . #xA019)
  943.                 (_MaxMem . #xA11D)
  944.                 (_MoreMasters . #xA036)
  945.                 (_NewHandle . #xA122)
  946.                 (_NewPtr . #xA11E)
  947.                 (_PtrZone . #xA148)
  948.                 (_PurgeMem . #xA14D)
  949.                 (_ReallocHandle . #xA027)
  950.                 (_RecoverHandle . #xA128)
  951.                 (_ReservMem . #xA140)
  952.                 (_SetAppBase . #xA857)
  953.                 (_SetApplLimit . #xA02D)
  954.                 (_SetGrowZone . #xA04B)
  955.                 (_SetHandleSize . #xA024)
  956.                 (_SetPtrSize . #xA020)
  957.                 (_SetZone . #xA01B)
  958.                 (_HClrRBit . #xA068)
  959.                 (_HGetState . #xA069)
  960.                 (_HSetRBit . #xA067)
  961.                 (_HSetState . #xA06A)
  962.                 (_MaxApplZone . #xA063)
  963.                 (_MaxBlock . #xA061)
  964.                 (_MoveHHi . #xA064)
  965.                 (_NewEmptyHandle . #xA066)
  966.                 (_PurgeSpace . #xA062)
  967.                 (_StackSpace . #xA065)
  968.  
  969.                 ;**************************************************
  970.                 ;OS Event Manager traps:
  971.  
  972.                 (_GetOSEvent . #xA031)
  973.                 (_OSEventAvail . #xA030)
  974.  
  975.                 ;**************************************************
  976.                 ;OS Utilities traps:
  977.  
  978.                 (_CmpString . #xA03C)
  979.                 (_Date2Secs . #xA9C7)
  980.                 (_Delay . #xA03B)
  981.                 (_Dequeue . #xA96E)
  982.                 (_DrvrInstall . #xA03D)
  983.                 (_DrvrRemove . #xA03E)
  984.                 (_Enqueue . #xA96F)
  985.                 (_GetTrapAddress . #xA146)
  986.                 (_HandAndHand . #xA9E4)
  987.                 (_HandToHand . #xA9E1)
  988.                 (_InitUtil . #xA03F)
  989.                 (_PtrAndHand . #xA9EF)
  990.                 (_PtrToHand . #xA9E3)
  991.                 (_PtrToXHand . #xA9E2)
  992.                 (_RDrvrInstall . #xA04F)
  993.                 (_ReadParm . #xA037)
  994.                 (_PutIcon . #xA9CA)
  995.                 (_ReadDateTime . #xA039)
  996.                 (_Secs2Date . #xA9C6)
  997.                 (_SetDateTime . #xA03A)
  998.                 (_SetTrapAddress . #xA047)
  999.                 (_SysError . #xA9C9)
  1000.                 (_UprString . #xA854)
  1001.                 (_VInstall . #xA033)
  1002.                 (_VRemove . #xA034)
  1003.                 (_WriteParam . #xA038)
  1004.                 (_Chain . #xA9F3)
  1005.                 (_Launch . #xA9F2)
  1006.                 (_RelString . #xA050)
  1007.  
  1008.                 ;**************************************************
  1009.                 ;Miscellaneous new register traps:
  1010.  
  1011.                 (_PPOSTEVENT . #xA12F) 
  1012.                 (_RESRVMEM . #xA040) 
  1013.                 (_SETAPPLBASE . #xA057) 
  1014.                 (_READXPRAM . #xA051) 
  1015.                 (_WRITEXPRAM . #xA052) 
  1016.                 (_INSTIME . #xA058) 
  1017.                 (_RMVTIME . #xA059) 
  1018.                 (_PRIMETIME . #xA05A) 
  1019.                 (_INITFS . #xA06C) 
  1020.                 (_INITEVENTS . #xA06D) 
  1021.                 (_STRIPADDRESS . #xA055) 
  1022.                 (_SWAPMMUMODE . #xA05D) 
  1023.                 (_SLOTVINSTALL . #xA06F) 
  1024.                 (_SLOTVREMOVE . #xA070) 
  1025.                 (_ATTACHVBL . #xA071) 
  1026.                 (_DOVBLTASK . #xA072) 
  1027.                 (_SINTINSTALL . #xA075) 
  1028.                 (_SINTREMOVE . #xA076) 
  1029.                 (_COUNTADBS . #xA077) 
  1030.                 (_GETINDADB . #xA078) 
  1031.                 (_GETADBINFO . #xA079) 
  1032.                 (_SETADBINFO . #xA07A) 
  1033.                 (_ADBREINIT . #xA07B) 
  1034.                 (_ADBOP . #xA07C) 
  1035.                 (_GETDEFAULTSTARTUP . #xA07D) 
  1036.                 (_SETDEFAULTSTARTUP . #xA07E) 
  1037.                 (_INTERNALWAIT . #xA07F)
  1038.                 (_GETVIDEODEFAULT . #xA080) 
  1039.                 (_SETVIDEODEFAULT . #xA081) 
  1040.                 (_DTINSTALL . #xA082) 
  1041.                 (_SETOSDEFAULT . #xA083) 
  1042.                 (_GETOSDEFAULT . #xA084)
  1043.                 (_SYSENVIRONS . #xA090)
  1044.                 (_OSDispatch . #xA88F)
  1045.  
  1046.  
  1047.                )))
  1048.   (dotimes (i (length traps))
  1049.     (let ((data (svref traps i)))
  1050.       (export (car data))
  1051.       (define-constant (car data) (cdr data))
  1052.       (%macro-have (car data) macro-fn))))
  1053.    ;end of REGISTER TRAPS
  1054.  
  1055.  
  1056. ;; ####################################################################
  1057. ;; ######################### Dispatching Traps ########################
  1058. ;; ####################################################################
  1059. (let ((macro-fn #'dispatch-stack-trap-macro-function)
  1060.       (traps '#(
  1061.                 (_DIBadMount 0 . _Pack2)
  1062.                 (_DILoad 2 . _Pack2)
  1063.                 (_DIUnload 4 . _Pack2)
  1064.                 (_DIFormat 6 . _Pack2)
  1065.                 (_DIVerify 8 . _Pack2)
  1066.                 (_DIZero 10 . _Pack2)
  1067.                 (_LActivate 0 . _Pack0)
  1068.                 (_LAddColumn 4 . _Pack0)
  1069.                 (_LAddRow 8 . _Pack0)
  1070.                 (_LAddToCell 12 . _Pack0)
  1071.                 (_LAutoScroll 16 . _Pack0)
  1072.                 (_LCellSize 20 . _Pack0)
  1073.                 (_LClick 24 . _Pack0)
  1074.                 (_LClrCell 28 . _Pack0)
  1075.                 (_LDelColumn 32 . _Pack0)
  1076.                 (_LDelRow 36 . _Pack0)
  1077.                 (_LDispose 40 . _Pack0)
  1078.                 (_LDoDraw 44 . _Pack0)
  1079.                 (_LDraw 48 . _Pack0)
  1080.                 (_LFind 52 . _Pack0)
  1081.                 (_LGetCell 56 . _Pack0)
  1082.                 (_LGetSelect 60 . _Pack0)
  1083.                 (_LLastClick 64 . _Pack0)
  1084.                 (_LNew 68 . _Pack0)
  1085.                 (_LNextCell 72 . _Pack0)
  1086.                 (_LRect 76 . _Pack0)
  1087.                 (_LScroll 80 . _Pack0)
  1088.                 (_LSearch 84 . _Pack0)
  1089.                 (_LSetCell 88 . _Pack0)
  1090.                 (_LSetSelect 92 . _Pack0)
  1091.                 (_LSize 96 . _Pack0)
  1092.                 (_LUpdate 100 . _Pack0)
  1093.  
  1094.                 (_SFPutFile 1 . _Pack3)
  1095.                 (_SFGetFile 2 . _Pack3)
  1096.                 (_SFPPutFile 3 . _Pack3)
  1097.                 (_SFPGetFile 4 . _Pack3)
  1098.  
  1099.                 (_iuDateString 0 . _Pack6)
  1100.                 (_iuTimeString 2 . _Pack6)
  1101.                 (_iuMetric 4 . _Pack6)
  1102.                 (_iuGetIntl 6 . _Pack6)
  1103.                 (_iuSetIntl 8 . _Pack6)
  1104.                 (_iuMagString 10 . _Pack6)
  1105.                 (_iuMagIDString 12 . _Pack6)
  1106.                 (_iuDatePString 14 . _Pack6)
  1107.                 (_iuTimePString 16 . _Pack6)
  1108.  
  1109.                 ;Unfortunately the args are in registers but package selector is on stack.
  1110.                 ;(_numtostring 0 . _Pack7)
  1111.                 ;(_stringtonum 1 . _Pack7)
  1112.  
  1113.                 (_Fix2SmallFract 1 . _Pack12)
  1114.                 (_SmallFract2Fix 2 . _Pack12)
  1115.                 (_CMY2RGB 3 . _Pack12)
  1116.                 (_RGB2CMY 4 . _Pack12)
  1117.                 (_HSL2RGB 5 . _Pack12)
  1118.                 (_RGB2HSL 6 . _Pack12)
  1119.                 (_HSV2RGB 7 . _Pack12)
  1120.                 (_RGB2HSV 8 . _Pack12)
  1121.                 (_GetColor 9 . _Pack12)
  1122.  
  1123.                 ;;The following are the new TextEdit traps
  1124.                 (_TEStylPaste 0 . _TEDispatch)
  1125.                 (_TESetStyle 1 . _TEDispatch)
  1126.                 (_TEReplaceStyle 2 . _TEDispatch)
  1127.                 (_TEGetStyle 3 . _TEDispatch)
  1128.                 (_GetStylHandle 4 . _TEDispatch)
  1129.                 (_SetStylHandle 5 . _TEDispatch)
  1130.                 (_GetStylScrap 6 . _TEDispatch)
  1131.                 (_TEStylInsert 7 . _TEDispatch)
  1132.                 (_TEGetPoint 8 . _TEDispatch)
  1133.                 (_TEGetHeight 9 . _TEDispatch)
  1134.  
  1135.                 ;;Multifinder Traps
  1136.         (_MFMaxMem 21 . _OSDispatch)
  1137.                 (_MFFreeMem 24 . _OSDispatch)
  1138.                 (_MFTempNewHandle 29 . _OSDispatch)
  1139.         (_MFTempHLock 30 . _OSDispatch)
  1140.         (_MFTempHUnLock 31 . _OSDispatch)
  1141.         (_MFTempDisposHandle 32 . _OSDispatch)
  1142.  
  1143.                 ;;Shutdown Manager
  1144.                 (_SDPowerOff 1 . _ShutDown)
  1145.                 (_SDRestart 2 . _ShutDown)
  1146.                 (_SDInstall 3 . _ShutDown)
  1147.                 (_SDRemove 4 . _ShutDown)
  1148.  
  1149.                 ;;SCSI Manager
  1150.                 (_SCSIReset 0 . _SCSIDispatch)
  1151.                 (_SCSIGet 1 . _SCSIDispatch)
  1152.                 (_SCSISelect 2 . _SCSIDispatch)
  1153.                 (_SCSICmd 3 . _SCSIDispatch)
  1154.                 (_SCSIComplete 4 . _SCSIDispatch)
  1155.                 (_SCSIRead 5 . _SCSIDispatch)
  1156.                 (_SCSIWrite 6 . _SCSIDispatch)
  1157.                 (_SCSIRBlind 8 . _SCSIDispatch)
  1158.                 (_SCSIWBlind 9 . _SCSIDispatch)
  1159.                 (_SCSIStat 10 . _SCSIDispatch)
  1160.                 (_SCSISelAtn 11 . _SCSIDispatch)
  1161.                 (_SCSIMsgIn 12 . _SCSIDispatch)
  1162.                 (_SCSIMsgOut 13 . _SCSIDispatch)
  1163.  
  1164.                )))
  1165.   (dotimes (i (length traps))
  1166.     (let ((data (svref traps i)))
  1167.       (export (car data))
  1168.       (define-constant (car data) (cadr data))
  1169.       (put (car data) 'dispatching-trap (cddr data))
  1170.       (%macro-have (car data) macro-fn))))
  1171.  
  1172. ;; ####################################################################
  1173. ;; ##################### Long Dispatching Traps #######################
  1174. ;; ####################################################################
  1175. (let ((macro-fn #'long-dispatch-stack-trap-macro-function)
  1176.       (traps '#(
  1177.                 ;;Script Manager
  1178.                 (_FontScript    #x82000000 . _ScriptUtil)
  1179.         (_IntlScript    #x82000002 . _ScriptUtil)
  1180.         (_KeyScript     #x80020004 . _ScriptUtil)
  1181.         (_Font2Script   #x82020006 . _ScriptUtil)
  1182.         (_GetEnvirons   #x84020008 . _ScriptUtil)
  1183.         (_SetEnvirons   #x8206000A . _ScriptUtil)
  1184.         (_GetScript     #x8404000C . _ScriptUtil)
  1185.         (_SetScript     #x8208000E . _ScriptUtil)
  1186.         (_CharByte      #x82060010 . _ScriptUtil)
  1187.         (_CharType      #x82060012 . _ScriptUtil)
  1188.         (_Pixel2Char    #x820E0014 . _ScriptUtil)
  1189.         (_Char2Pixel    #x820C0016 . _ScriptUtil)
  1190.         (_Transliterate #x820E0018 . _ScriptUtil)
  1191.         (_FindWord      #x8012001A . _ScriptUtil)
  1192.         (_HiliteText    #x800E001C . _ScriptUtil)
  1193.         (_DrawJust      #x8008001E . _ScriptUtil)
  1194.         (_MeasureJust   #x800C0020 . _ScriptUtil)
  1195.         (_ParseTable    #x82040022 . _ScriptUtil)
  1196.  
  1197.                 ;;Print Manager Calls
  1198.                 (_PrOpenDoc #x04000C00 . _PrintDispatch)
  1199.                 (_PrClosDoc #x0800048 . _PrintDispatch)
  1200.                 (_PrOpenPage #x10000808 . _PrintDispatch)
  1201.                 (_PrClosPage #x1800040C . _PrintDispatch)
  1202.                 (_PrintDefault #x20040480 . _PrintDispatch)
  1203.                 (_PrStlDialog #x2A040484 . _PrintDispatch)
  1204.                 (_PrJobDialog #x32040488 . _PrintDispatch)
  1205.                 (_PrStlInit #x3C04040C . _PrintDispatch)
  1206.                 (_PrJobInit #x44040410 . _PrintDispatch)
  1207.                 (_PrDlgMain #x4A040894 . _PrintDispatch)
  1208.                 (_PrValidate #x52040498 . _PrintDispatch)
  1209.                 (_PrJobMerge #x5804089C . _PrintDispatch)
  1210.                 (_PrPicFile #x60051480 . _PrintDispatch)
  1211.                 (_PrHack #x6C070C80 . _PrintDispatch)
  1212.                 (_PrGeneral #x70070480 . _PrintDispatch)
  1213.                 (_PrDrvrOpen #x80000000 . _PrintDispatch)
  1214.                 (_PrDrvrClose #x88000000 . _PrintDispatch)
  1215.                 (_PrDrvrDCE #x94000000 . _PrintDispatch)
  1216.                 (_PrDrvrVers #x9A000000 . _PrintDispatch)
  1217.                 (_PrCtlCall #xA0000E00 . _PrintDispatch)
  1218.                 (_PrPurge #xA8000000 . _PrintDispatch)
  1219.                 (_PrNoPurge #xB0000000 . _PrintDispatch)
  1220.                 (_PrErro #xBA000000 . _PrintDispatch)
  1221.                 (_PrSetError #xC0000200 . _PrintDispatch)
  1222.                 (_PrOpen #xC8000000 . _PrintDispatch)
  1223.                 (_PrClose #xD0000000 . _PrintDispatch)
  1224.  
  1225.                )))
  1226.   (dotimes (i (length traps))
  1227.     (let ((data (svref traps i)))
  1228.       (export (car data))
  1229.       (define-constant (car data) (cadr data))
  1230.       (put (car data) 'dispatching-trap (cddr data))
  1231.       (%macro-have (car data) macro-fn))))
  1232.  
  1233. ;; ####################################################################
  1234. ;; ########################### HFS Traps ##############################
  1235. ;; ####################################################################
  1236. (let ((macro-fn #'hfs-trap-macro-function)
  1237.       (traps '#((_FSControl . 0)
  1238.                 (_OpenWD . 1)
  1239.                 (_CloseWD . 2)
  1240.                 (_CatMove . 5)
  1241.                 (_DirCreate . 6)
  1242.                 (_GetWDInfo . 7)
  1243.                 (_GetFCBInfo . 8)
  1244.                 (_GetCatInfo . 9)
  1245.                 (_SetCatInfo . 10)
  1246.                 (_SetVolInfo . 11)
  1247.                 (_SetPMSP . 12)
  1248.                 (_LockRng . 16)
  1249.                 (_UnlockRng . 17)
  1250.                 (_GetVolParms .#x30)
  1251.                 (_GetLogInInfo . #x31)
  1252.                 (_GetDirAccess . #x32)
  1253.                 (_SetDirAccess . #x33)
  1254.                 (_MapID    . #x34)
  1255.                 (_MapName . #x35)
  1256.                 (_CopyFile . #x36)
  1257.                 (_MoveRename . #x37)
  1258.                 (_OpenDeny . #x38)
  1259.                 (_OpenRFDeny . #x39)
  1260.                )))
  1261.   (dotimes (i (length traps))
  1262.     (let ((data (svref traps i)))
  1263.       (export (car data))
  1264.       (define-constant (car data) (cdr data))
  1265.       (%macro-have (car data) macro-fn))))
  1266.  
  1267.  
  1268. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1269. ;;
  1270. ;;almost all done
  1271.  
  1272. (provide 'traps)
  1273. (pushnew :traps *features*)