home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / da / insidema.sit / Manual < prev    next >
Text File  |  1989-10-08  |  606KB  |  15,627 lines

  1.  ,129
  2. 129
  3. Resource Manager Definitions.
  4.  
  5. CONST
  6.       resSysHeap    = 64;   { System or application heap? }
  7.       resPurgeable  = 32;   { Purgeable resource? }
  8.       resLocked     = 16;   { Load it in locked? }
  9.       resProtected  = 8;    { Protected? }
  10.       resPreload    = 4;    { Load in on OpenResFile? }
  11.       resChanged    = 2;    { Resource changed? }
  12.  
  13.       mapReadOnly   = 128;  { Resource file read-only }
  14.       mapCompact    = 64;   { Compact resource file }
  15.       mapChanged    = 32;   { Write map out at update }
  16.  
  17.       resNotFound   = - 192; { Resource not found }
  18.       resFNotFound  = - 193; { Resource file not found }
  19.       addResFailed  = - 194; { AddResource failed }
  20.       rmvResFailed  = - 196; { RmveResource failed }
  21.       resAttrErr    = -198;  {attribute does not permit operation}
  22.       mapReadErr    = -199;  {map does not permit operation}
  23.  
  24. Resources in 128K ROM:
  25.  
  26. 'CURS'  1   IBeamCursor
  27. 'CURS'  2   CrossCursor
  28. 'CURS'  3   PlusCursor
  29. 'CURS'  4   WatchCursor
  30. 'DRVR'  2   Printer Driver shell (.PRINT)
  31. 'DRVR'  3   Sound Driver  (.SOUND)
  32. 'DRVR'  4   Disk Driver  (.SONY)
  33. 'DRVR'  9   AppleTalk driver  (.MPP)
  34. 'DRVR'  A   AppleTalk driver  (.ATP)
  35. 'FONT'  0   Name of system font
  36. 'FONT'  C   System font
  37. 'MDEF'  0   Default menu definition procedure
  38. 'PACK'  4   Floating-Point Arithmetic Package
  39. 'PACK'  5   Transcendental Functions Package
  40. 'PACK'  7   Binary-Decimal Conversion Package
  41. 'SERD'  0   Serial Driver
  42. 'WDEF'  0   Default window definition function
  43.  
  44. TYPE
  45.  
  46.       ResType = PACKED ARRAY [1..4] OF CHAR;
  47.  
  48. \ ,130
  49. 130
  50. QuickDraw Definitions.
  51.  
  52. CONST
  53.       srcCopy       = 0; { the 16 transfer modes }
  54.       srcOr         = 1;
  55.       srcXor        = 2;
  56.       srcBic        = 3;
  57.       notSrcCopy    = 4;
  58.       notSrcOr      = 5;
  59.       notSrcXor     = 6;
  60.       notSrcBic     = 7;
  61.       patCopy       = 8;
  62.       patOr         = 9;
  63.       patXor        = 10;
  64.       patBic        = 11;
  65.       notPatCopy    = 12;
  66.       notPatOr      = 13;
  67.       notPatXor     = 14;
  68.       notPatBic     = 15;
  69.  
  70.       { QuickDraw color separation constants }
  71.  
  72.       normalBit     = 0; { normal screen mapping }
  73.       inverseBit    = 1; { inverse screen mapping }
  74.       redBit        = 4; { RGB additive mapping }
  75.       greenBit      = 3;
  76.       blueBit       = 2;
  77.       cyanBit       = 8; { CMYBk subtractive mapping }
  78.       magentaBit    = 7;
  79.       yellowBit     = 6;
  80.       blackBit      = 5;
  81.  
  82.       blackColor    = 33; { colors expressed in these mappings }
  83.       whiteColor    = 30;
  84.       redColor      = 205;
  85.       greenColor    = 341;
  86.       blueColor     = 409;
  87.       cyanColor     = 273;
  88.       magentaColor  = 137;
  89.       yellowColor   = 69;
  90.  
  91.       picLParen     = 0;   { standard picture comments }
  92.       picRParen     = 1;
  93.  
  94.       iBeamCursor   = 1; {text selection cursor}
  95.       crossCursor   = 2; {for drawing graphics}
  96.       plusCursor    = 3; {for structured selection}
  97.       watchCursor   = 4; {for indicating a long delay}
  98.  
  99. TYPE
  100.       QDByte = SignedByte;
  101.       QDPtr = Ptr; { blind pointer }
  102.       QDHandle = Handle; { blind handle }
  103.       Pattern = PACKED ARRAY [0..7] OF 0..255;
  104.       Bits16 = ARRAY [0..15] OF INTEGER;
  105.       VHSelect = (v, h);
  106.       GrafVerb = (frame, paint, erase, invert, fill);
  107.       StyleItem = (bold, italic, underline, outline, shadow, condense,
  108.                     extend);
  109.       Style = SET OF StyleItem;
  110.  
  111.       FontInfo = RECORD
  112.                    ascent: INTEGER;
  113.                    descent: INTEGER;
  114.                    widMax: INTEGER;
  115.                    leading: INTEGER;
  116.                  END;
  117.  
  118.       Point = RECORD
  119.                 CASE INTEGER OF
  120.  
  121.                   0:
  122.                     (v: INTEGER;
  123.                      h: INTEGER);
  124.  
  125.                   1:
  126.                     (vh: ARRAY [VHSelect] OF INTEGER);
  127.  
  128.               END;
  129.  
  130.       Rect = RECORD
  131.                CASE INTEGER OF
  132.  
  133.                  0:
  134.                    (top: INTEGER;
  135.                     left: INTEGER;
  136.                     bottom: INTEGER;
  137.                     right: INTEGER);
  138.  
  139.                  1:
  140.                    (topLeft: Point;
  141.                     botRight: Point);
  142.              END;
  143.  
  144.       BitMap = RECORD
  145.                  baseAddr: Ptr;
  146.                  rowBytes: INTEGER;
  147.                  bounds: Rect;
  148.                END;
  149.  
  150.       Cursor = RECORD
  151.                  data: Bits16;
  152.                  mask: Bits16;
  153.                  hotSpot: Point;
  154.                END;
  155.  
  156.       PenState = RECORD
  157.                    pnLoc: Point;
  158.                    pnSize: Point;
  159.                    pnMode: INTEGER;
  160.                    pnPat: Pattern;
  161.                  END;
  162.  
  163.       PolyHandle = ^PolyPtr;
  164.       PolyPtr = ^Polygon;
  165.       Polygon = RECORD
  166.                   polySize: INTEGER;
  167.                   polyBBox: Rect;
  168.                   polyPoints: ARRAY [0..0] OF Point;
  169.                 END;
  170.  
  171.       RgnHandle = ^RgnPtr;
  172.       RgnPtr = ^Region;
  173.       Region = RECORD
  174.                  rgnSize: INTEGER; { rgnSize = 10 for rectangular }
  175.                  rgnBBox: Rect;
  176.                         { plus more data if not rectangular }
  177.                END;
  178.  
  179.       PicHandle = ^PicPtr;
  180.       PicPtr = ^Picture;
  181.       Picture = RECORD
  182.                   picSize: INTEGER;
  183.                   picFrame: Rect;
  184.                           { plus byte codes for picture content }
  185.                 END;
  186.  
  187.       QDProcsPtr = ^QDProcs;
  188.       QDProcs = RECORD
  189.                   textProc: Ptr;
  190.                   lineProc: Ptr;
  191.                   rectProc: Ptr;
  192.                   rRectProc: Ptr;
  193.                   ovalProc: Ptr;
  194.                   arcProc: Ptr;
  195.                   polyProc: Ptr;
  196.                   rgnProc: Ptr;
  197.                   bitsProc: Ptr;
  198.                   commentProc: Ptr;
  199.                   txMeasProc: Ptr;
  200.                   getPicProc: Ptr;
  201.                   putPicProc: Ptr;
  202.                 END;
  203.  
  204.       GrafPtr = ^GrafPort;
  205.       GrafPort = RECORD
  206.                    device: INTEGER;
  207.                    portBits: BitMap;
  208.                    portRect: Rect;
  209.                    visRgn: RgnHandle;
  210.                    clipRgn: RgnHandle;
  211.                    bkPat: Pattern;
  212.                    fillPat: Pattern;
  213.                    pnLoc: Point;
  214.                    pnSize: Point;
  215.                    pnMode: INTEGER;
  216.                    pnPat: Pattern;
  217.                    pnVis: INTEGER;
  218.                    txFont: INTEGER;
  219.                    txFace: Style;
  220.                    txMode: INTEGER;
  221.                    txSize: INTEGER;
  222.                    spExtra: Fixed;
  223.                    fgColor: LongInt;
  224.                    bkColor: LongInt;
  225.                    colrBit: INTEGER;
  226.                    patStretch: INTEGER;
  227.                    picSave: Handle;
  228.                    rgnSave: Handle;
  229.                    polySave: Handle;
  230.                    grafProcs: QDProcsPtr;
  231.                  END;
  232.  
  233.     VAR
  234.       thePort: GrafPtr;
  235.       white: Pattern;
  236.       black: Pattern;
  237.       gray: Pattern;
  238.       ltGray: Pattern;
  239.       dkGray: Pattern;
  240.       arrow: Cursor;
  241.       screenBits: BitMap;
  242.       randSeed: LongInt;
  243.  
  244. \ ,131
  245. 131
  246. Font Manager Definitions.
  247.  
  248. CONST
  249.  
  250.       commandMark   = $11;
  251.       checkMark     = $12;
  252.       diamondMark   = $13;
  253.       appleMark     = $14;
  254.  
  255.       systemFont    = 0;
  256.       applFont      = 1;
  257.       newYork       = 2;
  258.       geneva        = 3;
  259.       monaco        = 4;
  260.       venice        = 5;
  261.       london        = 6;
  262.       athens        = 7;
  263.       sanFran       = 8;
  264.       toronto       = 9;
  265.       cairo         = 11;
  266.       losAngeles    = 12;
  267.       times         = 20;
  268.       helvetica     = 21;
  269.       courier       = 22;
  270.       symbol        = 23;
  271.       mobile        = 24;
  272.  
  273.       propFont      = $9000;
  274.       prpFntH       = $9001;
  275.       prpFntW       = $9002;
  276.       prpFntHW      = $9003;
  277.  
  278.       fixedFont     = $B000;
  279.       fxdFntH       = $B001;
  280.       fxdFntW       = $B002;
  281.       fxdFntHW      = $B003;
  282.  
  283.       fontWid       = $ACB0;
  284.  
  285. TYPE
  286.  
  287.       FMInput = PACKED RECORD
  288.                   family: INTEGER;
  289.                   size: INTEGER;
  290.                   face: Style;
  291.                   needBits: BOOLEAN;
  292.                   device: INTEGER;
  293.                   numer: Point;
  294.                   denom: Point;
  295.                 END;
  296.  
  297.       FMOutPtr = ^FMOutPut;
  298.  
  299.       FMOutPut = PACKED RECORD
  300.                    errNum: INTEGER;
  301.                    fontHandle: Handle;
  302.                    bold: Byte;
  303.                    italic: Byte;
  304.                    ulOffset: Byte;
  305.                    ulShadow: Byte;
  306.                    ulThick: Byte;
  307.                    shadow: Byte;
  308.                    extra: SignedByte;
  309.                    ascent: Byte;
  310.                    descent: Byte;
  311.                    widMax: Byte;
  312.                    leading: SignedByte;
  313.                    unused: Byte;
  314.                    numer: Point;
  315.                    denom: Point;
  316.                  END;
  317.  
  318.       FontRec = RECORD
  319.                   fontType: INTEGER;    { font type }
  320.                   firstChar: INTEGER;   { ASCII code of first character }
  321.                   lastChar: INTEGER;    { ASCII code of last character }
  322.                   widMax: INTEGER;      { maximum character width }
  323.                   kernMax: INTEGER;     { negative of maximum character kern }
  324.                   nDescent: INTEGER;    { negative of descent }
  325.                   fRectWidth: INTEGER;  { width of font rectangle }
  326.                   fRectHeight: INTEGER; { height of font rectangle }
  327.                   oWTLoc: INTEGER;      { offset to offset/width table }
  328.                   ascent: INTEGER;      { ascent }
  329.                   descent: INTEGER;     { descent }
  330.                   leading: INTEGER;     { leading }
  331.                   rowWords: INTEGER;    { row width of bit image / 2 }
  332.                 { bitImage:    ARRAY[1..rowWords,1..fRectHeight]
  333.                                     OF INTEGER;
  334.                   locTable:    ARRAY[firstChar..lastChar+2]
  335.                                     OF INTEGER;
  336.                   owTable:    ARRAY[firstChar..lastChar+2]
  337.                                     OF INTEGER;
  338.                   widthTable: ARRAY[firstChar..lastChar+2]
  339.                                     OF INTEGER;
  340.                   heightTable: ARRAY[firstChar..lastChar+2]
  341.                                     OF INTEGER; }
  342.                 END;
  343.  
  344.       {128K ROM}
  345.  
  346.       FMetricRec = RECORD
  347.                      ascent: Fixed;     {base line to top}
  348.                      descent: Fixed;    {base line to bottom}
  349.                      leading: Fixed;    {leading between lines}
  350.                      widMax: Fixed;     {maximum character width}
  351.                      wTabHandle: Fixed; {handle to font width table}
  352.                    END;
  353.  
  354.       WidTable = RECORD
  355.                    numWidths: INTEGER; {number of entries - 1}
  356.                             {widList: ARRAY[1..numWidths] of WidEntry}
  357.                  END;
  358.  
  359.       WidEntry = RECORD
  360.                    widStyle: INTEGER; {style entry applies to}
  361.                                       {widRec: ARRAY[firstChar..lastChar]
  362.                                         of INTEGER}
  363.                  END;
  364.  
  365.       AsscEntry = RECORD
  366.                     fontSize: INTEGER;
  367.                     fontStyle: INTEGER;
  368.                     fontID: INTEGER; {font resource ID}
  369.                   END;
  370.  
  371.       FontAssoc = RECORD
  372.                     numAssoc: INTEGER; {number of entries - 1}
  373.                             {asscTable: ARRAY[1..numAssoc] OF AsscEntry}
  374.                   END;
  375.  
  376.       StyleTable = RECORD
  377.                      fontClass: INTEGER;
  378.                      offset: LongInt;
  379.                      reserved: LongInt;
  380.                      indexes: ARRAY [0..47] OF Byte;
  381.                    END;
  382.  
  383.       NameTable = RECORD
  384.                     stringCount: INTEGER;
  385.                     baseFontName: STR255;
  386.                                 {strings: ARRAY[2..stringCount]  OF STRING}
  387.                                 {the lengths of the strings are arbitrary}
  388.                   END;
  389.  
  390.       KernPair = RECORD
  391.                    kernFirst: CHAR; {1st character of kerned pair}
  392.                    kernSecond: CHAR; {2nd character of kerned pair}
  393.                    kernWidth: INTEGER; {kerning in 1pt fixed format}
  394.                  END;
  395.  
  396.       KernEntry = RECORD
  397.                     kernLength: INTEGER; {length of this entry}
  398.                     kernStyle: INTEGER; {style the entry applies to}
  399.                              {kernRec: ARRAY[1..(kernLength/4)-1] OF KernPair}
  400.                   END;
  401.  
  402.       KernTable = RECORD
  403.                     numKerns: INTEGER; {number of kerning entries}
  404.                             {kernList: ARRAY[1..numKerns] OF KernEntry}
  405.                   END;
  406.  
  407.       WidthTable = PACKED RECORD
  408.                      tabData: ARRAY [1..256] OF Fixed; {character widths}
  409.                      tabFont: Handle; {font record used to build table}
  410.                      sExtra: LongInt; {space extra used for table}
  411.                      Style: LongInt; {extra due to style}
  412.                      fID: INTEGER; {font family ID}
  413.                      fSize: INTEGER; {font size request}
  414.                      face: INTEGER; {style (face) request}
  415.                      device: INTEGER; {device requested}
  416.                      vInScale: Fixed; {scale factors requested}
  417.                      hInScale: Fixed; {scale factors requested}
  418.                      aFID: INTEGER; {actual font family ID for table}
  419.                      fHand: Handle; {family record used to build up table}
  420.                      usedFam: BOOLEAN; {used fixed point family widths}
  421.                      aFace: Byte; {actual face produced}
  422.                      vOutput: INTEGER; {vertical scale output value}
  423.                      hOutput: INTEGER; {horizontal scale output value}
  424.                      vFactor: INTEGER; {vertical scale output value}
  425.                      hFactor: INTEGER; {horizontal scale output value}
  426.                      aSize: INTEGER; {actual size of actual font used}
  427.                      tabSize: INTEGER; {total size of table}
  428.                    END;
  429.  
  430.       FamRec = RECORD
  431.                  ffFlags: INTEGER; {flags for family}
  432.                  ffFamID: INTEGER; {family ID number}
  433.                  ffFirstChar: INTEGER; {ASCII code of 1st character}
  434.                  ffLastChar: INTEGER; {ASCII code of last character}
  435.                  ffAscent: INTEGER; {maximum ascent for 1pt font}
  436.                  ffDescent: INTEGER; {maximum descent for 1pt font}
  437.                  ffLeading: INTEGER; {maximum leading for 1pt font}
  438.                  ffWidMax: INTEGER; {maximum widMax for 1pt font}
  439.                  ffWTabOff: LongInt; {offset to width table}
  440.                  ffKernOff: LongInt; {offset to kerning table}
  441.                  ffStylOff: LongInt; {offset to style mapping table}
  442.                  ffProperty: ARRAY [1..9] OF INTEGER; {style property info}
  443.                  ffIntl: ARRAY [1..2] OF INTEGER; {for international use}
  444.                  ffVersion: INTEGER; {version number}
  445.                           {ffAssoc:    FontAssoc;} {font association table}
  446.                           {ffWidthTab: WidTable;} {width table}
  447.                           {ffStyTab:   StyleTable;} {style mapping table}
  448.                           {ffKernTab:  KernTable;} {kerning table}
  449.                END;
  450.  
  451. \ ,132
  452. 132
  453. Event Manager Definitions.
  454.  
  455. CONST
  456.  
  457.       everyEvent    = - 1;
  458.       NullEvent     = 0;
  459.       mouseDown     = 1;
  460.       mouseUp       = 2;
  461.       keyDown       = 3;
  462.       keyUp         = 4;
  463.       autoKey       = 5;
  464.       updateEvt     = 6;
  465.       diskEvt       = 7;
  466.       activateEvt   = 8;
  467.       networkEvt    = 10;
  468.       driverEvt     = 11;
  469.       app1Evt       = 12;
  470.       app2Evt       = 13;
  471.       app3Evt       = 14;
  472.       app4Evt       = 15;
  473.  
  474.       { event mask equates }
  475.       mDownMask     = 2;
  476.       mUpMask       = 4;
  477.       keyDownMask   = 8;
  478.       keyUpMask     = 16;
  479.       autoKeyMask   = 32;
  480.       updateMask    = 64;
  481.       diskMask      = 128;
  482.       activMask     = 256;
  483.       networkMask   = 1024;
  484.       driverMask    = 2048;
  485.       app1Mask      = 4096;
  486.       app2Mask      = 8192;
  487.       app3Mask      = 16384;
  488.       app4Mask      = - 32768;
  489.  
  490.       {to decipher event message for keyDown events}
  491.       charCodeMask  = $000000FF;
  492.       keyCodeMask   = $0000FF00;
  493.  
  494.       { modifiers }
  495.       optionKey     = 2048; { Bit 3 of high byte }
  496.       alphaLock     = 1024; { Bit 2 }
  497.       ShiftKey      = 512;  { Bit 1 }
  498.       CmdKey        = 256;  { Bit 0 }
  499.       BtnState      = 128;  { Bit 7 of low byte is mouse button state }
  500.  
  501.       activeFlag    = 1;    { bit 0 of modifiers for activate event }
  502.  
  503.       {error for PostEvent}
  504.       EvtNotEnb     = 1;
  505.  
  506. TYPE
  507.  
  508.       EventRecord = RECORD
  509.                       what: INTEGER;
  510.                       message: LongInt;
  511.                       when: LongInt;
  512.                       where: Point;
  513.                       modifiers: INTEGER;
  514.                     END;
  515.  
  516.       KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  517.  
  518. \ ,133
  519. 133
  520. Window Manager Definitions.
  521.  
  522. CONST
  523.  
  524.       {window messages}
  525.       wDraw     = 0;
  526.       wHit      = 1;
  527.       wCalcRgns = 2;
  528.       wNew      = 3;
  529.       wDispose  = 4;
  530.       wGrow     = 5;
  531.       wDrawGIcon = 6;
  532.  
  533.       {types of windows}
  534.       dialogKind    = 2;
  535.       userKind      = 8;
  536.  
  537.       {desk pattern resource ID}
  538.       deskPatID     = 16;
  539.  
  540.       {window definition procedure IDs}
  541.       documentProc  = 0;
  542.       dBoxProc      = 1;
  543.       plainDBox     = 2;
  544.       altDBoxProc   = 3;
  545.       noGrowDocProc = 4;
  546.       zoomDocProc   = 8;
  547.       zoomNoGrow    = 12;
  548.       rDocProc      = 16;
  549.  
  550.       {FindWindow Result Codes}
  551.       inDesk        = 0;
  552.       inMenuBar     = 1;
  553.       inSysWindow   = 2;
  554.       inContent     = 3;
  555.       inDrag        = 4;
  556.       inGrow        = 5;
  557.       inGoAway      = 6;
  558.  
  559.       {128K ROM}
  560.       inZoomIn      = 7;
  561.       inZoomOut     = 8;
  562.  
  563.       {defProc hit test codes}
  564.       wNoHit        = 0;
  565.       wInContent    = 1;
  566.       wInDrag       = 2;
  567.       wInGrow       = 3;
  568.       wInGoAway     = 4;
  569.  
  570.       {128K ROM}
  571.       wInZoomIn     = 5;
  572.       wInZoomOut    = 6;
  573.  
  574.       {axis constraints for DragGrayRgn call}
  575.       noConstraint  = 0;
  576.       hAxisOnly     = 1;
  577.       vAxisOnly     = 2;
  578.  
  579. TYPE
  580.  
  581.       WindowPtr     = GrafPtr;
  582.       WindowPeek    = ^WindowRecord;
  583.       ControlHandle = ^ControlPtr; {for Control Manager}
  584.  
  585.       WStateData =  RECORD;
  586.         userState:  Rect;   {user state}
  587.         stdState:   Rect    {standard state}
  588.       END;
  589.  
  590.       WindowRecord = RECORD
  591.                        port: GrafPort;
  592.                        windowKind: INTEGER;
  593.                        visible: BOOLEAN;
  594.                        hilited: BOOLEAN;
  595.                        goAwayFlag: BOOLEAN;
  596.                        spareFlag: BOOLEAN;
  597.                        strucRgn: RgnHandle;
  598.                        contRgn: RgnHandle;
  599.                        updateRgn: RgnHandle;
  600.                        windowDefProc: Handle;
  601.                        dataHandle: Handle;
  602.                        titleHandle: StringHandle;
  603.                        titleWidth: INTEGER;
  604.                        ControlList: ControlHandle;
  605.                        nextWindow: WindowPeek;
  606.                        windowPic: PicHandle;
  607.                        refCon: LongInt;
  608.                      END;
  609.  
  610. \ ,134
  611. 134
  612. Control Manager Definitions.
  613.  
  614. CONST
  615.  
  616.       {control messages}
  617.       drawCntl  = 0;
  618.       testCntl  = 1;
  619.       calcCRgns = 2;
  620.       initCntl  = 3;
  621.       dispCntl  = 4;
  622.       posCntl   = 5;
  623.       thumbCntl = 6;
  624.       dragCntl  = 7;
  625.       autoTrack = 8;
  626.  
  627.       {FindControl Result Codes}
  628.       inButton      = 10;
  629.       inCheckbox    = 11;
  630.       inUpButton    = 20;
  631.       inDownButton  = 21;
  632.       inPageUp      = 22;
  633.       inPageDown    = 23;
  634.       inThumb       = 129;
  635.  
  636.       {control definition proc ID's}
  637.       pushButProc   = 0;
  638.       checkBoxProc  = 1;
  639.       radioButProc  = 2;
  640.       scrollBarProc = 16;
  641.  
  642.       useWFont      = 8;
  643.  
  644. TYPE
  645.       ControlPtr = ^ControlRecord;
  646.  
  647.       ControlRecord = PACKED RECORD
  648.                         nextControl: ControlHandle;
  649.                         contrlOwner: WindowPtr;
  650.                         contrlRect: Rect;
  651.                         contrlVis: Byte;
  652.                         contrlHilite: Byte;
  653.                         contrlValue: INTEGER;
  654.                         contrlMin: INTEGER;
  655.                         contrlMax: INTEGER;
  656.                         contrlDefProc: Handle;
  657.                         contrlData: Handle;
  658.                         contrlAction: ProcPtr;
  659.                         contrlrfCon: LongInt;
  660.                         contrlTitle: STR255;
  661.                       END; {ControlRecord}
  662.  
  663.  
  664. \ ,135
  665. 135
  666. Menu Manager Definitions.
  667.  
  668. CONST
  669.       noMark        = 0; { mark symbol for MarkItem }
  670.       TextMenuProc  = 0;
  671.  
  672.       { menu defProc messages }
  673.       mDrawMsg      = 0;
  674.       mChooseMsg    = 1;
  675.       mSizeMsg      = 2;
  676.  
  677. TYPE
  678.       MenuPtr       = ^MenuInfo;
  679.       MenuHandle    = ^MenuPtr;
  680.       MenuInfo      = RECORD
  681.                        menuId: INTEGER;
  682.                        menuWidth: INTEGER;
  683.                        menuHeight: INTEGER;
  684.                        menuProc: Handle;
  685.                        enableFlags: LongInt;
  686.                        menuData: STR255;
  687.                      END;
  688.  
  689. \ ,136
  690. 136
  691. TextEdit Definitions.
  692.  
  693. CONST
  694.       teJustLeft    = 0;
  695.       teJustRight   = - 1;
  696.       teJustCenter  = 1;
  697.  
  698. TYPE
  699.       TERec = RECORD
  700.                 destRect: Rect;         {Destination rectangle}
  701.                 viewRect: Rect;         {view rectangle}
  702.                 selRect: Rect;          {Select rectangle}
  703.                 lineHeight: INTEGER;    {Current font lineheight}
  704.                 fontAscent: INTEGER;    {Current font ascent}
  705.                 selPoint: Point;        {Selection point(mouseLoc)}
  706.  
  707.                 selStart: INTEGER;      {Selection start}
  708.                 selEnd: INTEGER;        {Selection end}
  709.  
  710.                 active: INTEGER;        {<>0 if active}
  711.  
  712.                 wordBreak: ProcPtr;     {Word break routine}
  713.                 clikLoop: ProcPtr;      {Click loop routine}
  714.  
  715.                 clickTime: LongInt;     {Time of first click}
  716.                 clickLoc: INTEGER;      {Char. location of click}
  717.  
  718.                 caretTime: LongInt;     {Time for next caret blink}
  719.                 caretState: INTEGER;    {On/active booleans}
  720.  
  721.                 just: INTEGER;          {fill style}
  722.  
  723.                 teLength: INTEGER;      {Length of text below}
  724.                 hText: Handle;          {Handle to actual text}
  725.  
  726.                 recalBack: INTEGER;     {<>0 if recal in background}
  727.                 recalLines: INTEGER;    {Line being recal'ed}
  728.                 clikStuff: INTEGER;     {click stuff (internal)}
  729.  
  730.                 crOnly: INTEGER;        {Set to -1 if CR line breaks only}
  731.  
  732.                 txFont: INTEGER;        {Text Font}
  733.                 txFace: Style;          {Text Face}
  734.                 txMode: INTEGER;        {Text Mode}
  735.                 txSize: INTEGER;        {Text Size}
  736.  
  737.                 inPort: GrafPtr;        {Grafport}
  738.  
  739.                 highHook: ProcPtr;      {Highlighting hook}
  740.                 caretHook: ProcPtr;     {Highlighting hook}
  741.  
  742.                 nLines: INTEGER;        {Number of lines}
  743.                 lineStarts: ARRAY [0..16000] OF INTEGER;
  744.                                         {Actual line starts
  745.                                         themselves}
  746.               END;                      {RECORD}
  747.       TEPtr = ^TERec;
  748.       TEHandle = ^TEPtr;
  749.  
  750.       CharsHandle = ^CharsPtr;
  751.       CharsPtr = ^Chars;
  752.       Chars = PACKED ARRAY [0..32000] OF CHAR;
  753.  
  754. \ ,137
  755. 137
  756. Dialog Manager Definitions.
  757.  
  758. CONST
  759.       userItem  = 0;
  760.       ctrlItem  = 4;
  761.       btnCtrl   = 0;    { Low two bits specify what kind of control }
  762.       chkCtrl   = 1;
  763.       radCtrl   = 2;
  764.       resCtrl   = 3;
  765.  
  766.       statText      = 8;        { Static text }
  767.       editText      = 16;       { Editable text }
  768.       iconItem      = 32;       { Icon item }
  769.       picItem       = 64;       { Picture item }
  770.       itemDisable   = 128;      { Disable item if set }
  771.  
  772.       ok        = 1;        { OK button is first by convention }
  773.       cancel    = 2;        { Cancel button is second by convention }
  774.  
  775.       stopIcon      = 0;
  776.       noteIcon      = 1;
  777.       cautionIcon   = 2;
  778.  
  779. TYPE
  780.       DialogPtr    = WindowPtr;
  781.       DialogPeek   = ^DialogRecord;
  782.       DialogRecord = RECORD
  783.                        window: WindowRecord;
  784.                        Items: Handle;
  785.                        textH: TEHandle;
  786.                        editField: INTEGER;
  787.                        editOpen: INTEGER;
  788.                        aDefItem: INTEGER;
  789.                      END;
  790.  
  791.       DialogTHndl = ^DialogTPtr;
  792.       DialogTPtr = ^DialogTemplate;
  793.       DialogTemplate = RECORD
  794.                          boundsRect: Rect;
  795.                          procID: INTEGER;
  796.                          visible: BOOLEAN;
  797.                          filler1: BOOLEAN;
  798.                          goAwayFlag: BOOLEAN;
  799.                          filler2: BOOLEAN;
  800.                          refCon: LongInt;
  801.                          ItemsID: INTEGER;
  802.                          title: STR255;
  803.                        END;
  804.  
  805.       StageList = PACKED RECORD
  806.                     boldItm4: 0..1;
  807.                     boxDrwn4: BOOLEAN;
  808.                     sound4: 0..3;
  809.                     boldItm3: 0..1;
  810.                     boxDrwn3: BOOLEAN;
  811.                     sound3: 0..3;
  812.                     boldItm2: 0..1;
  813.                     boxDrwn2: BOOLEAN;
  814.                     sound2: 0..3;
  815.                     boldItm1: 0..1;
  816.                     boxDrwn1: BOOLEAN;
  817.                     sound1: 0..3;
  818.                   END;
  819.  
  820.       AlertTHndl = ^AlertTPtr;
  821.       AlertTPtr = ^AlertTemplate;
  822.       AlertTemplate = RECORD
  823.                         boundsRect: Rect;
  824.                         ItemsID: INTEGER;
  825.                         stages: StageList;
  826.                       END;
  827.  
  828. \ ,138
  829. 138
  830. Desk Manager Definitions.
  831.  
  832. CONST (Assembly-Language)
  833.  
  834. drvrFlags       EQU  $0     ; various flags and permissions [word]
  835. drvrDelay       EQU  $2     ; # of ticks between systask calls [word]
  836. drvrEMask       EQU  $4     ; event mask [word]
  837. drvrMenu        EQU  $6     ; driver menu ID [word]
  838. drvrOpen        EQU  $8     ; open routine offset [word]
  839. drvrPrime       EQU  $A     ; prime routine offset [word]
  840. drvrCtl         EQU  $C     ; control routine offset [word]
  841. drvrStatus      EQU  $E     ; status routine offset [word]
  842. drvrClose       EQU  $10    ; warmstart reset routine offset [word]
  843. drvrName        EQU  $12    ; length byte and name of driver [string]
  844.  
  845. accEvent        EQU  $40    ; event message from SystemEvent
  846. accRun          EQU  $41    ; run message from SystemTask
  847. accCursor       EQU  $42    ; cursor message from SystemTask
  848. accMenu         EQU  $43    ; menu message from SystemMenu
  849. accUndo         EQU  $44    ; undo message from SystemEdit
  850. accCut          EQU  $46    ; cut message from SystemEdit
  851. accCopy         EQU  $47    ; copy message from SystemEdit
  852. accPaste        EQU  $48    ; paste message from SystemEdit
  853. accClear        EQU  $49    ; clear message from SystemEdit
  854.  
  855. goodBye         EQU  -1     ; goodbye message
  856.  
  857. \ ,139
  858. 139
  859. Scrap Manager Definitions.
  860.  
  861. CONST
  862.       noScrapErr    = - 100; {desk scrap isn't initialized}
  863.       noTypeErr     = - 102;
  864.  
  865. TYPE
  866.       ScrapStuff = RECORD
  867.                      scrapSize: LongInt;
  868.                      scrapHandle: Handle;
  869.                      scrapCount: INTEGER;
  870.                      scrapState: INTEGER;
  871.                      scrapName: StringPtr;
  872.                    END;
  873.       pScrapStuff = ^ScrapStuff;
  874.  
  875. \ ,140
  876. 140
  877. Toolbox Utilities Definitions.
  878.  
  879. CONST
  880.       sysPatListID  = 0;    {ID of PAT# which contains 38 patterns}
  881.  
  882.       iBeamCursor   = 1;    {text selection cursor}
  883.       crossCursor   = 2;    {for drawing graphics}
  884.       plusCursor    = 3;    {for structured selection}
  885.       watchCursor   = 4;    {for indicating a long delay}
  886.  
  887. TYPE
  888.       Int64Bit = RECORD
  889.                    hiLong: LongInt;
  890.                    loLong: LongInt;
  891.                  END;
  892.  
  893.       CursPtr = ^Cursor;
  894.       CursHandle = ^CursPtr;
  895.  
  896.       PatPtr = ^Pattern;
  897.       PatHandle = ^PatPtr;
  898.  
  899. \ ,141
  900. 141
  901. Package Manager Definitions.
  902.  
  903. CONST
  904.       listMgr   = 0; {list manager}
  905.       dskInit   = 2; {Disk Initializaton}
  906.       stdFile   = 3; {Standard File}
  907.       flPoint   = 4; {Floating-Point Arithmetic}
  908.       trFunc    = 5; {Transcendental Functions}
  909.       intUtil   = 6; {International Utilities}
  910.       bdConv    = 7; {Binary/Decimal Conversion}
  911.  
  912.          putDlgID = - 3999; {SFPutFile dialog template ID}
  913.  
  914.                         putSave = 1;                         {save button}
  915.                         putCancel = 2;                 {cancel button}
  916.                         putEject = 5;                     {eject button}
  917.                         putDrive = 6;                     {drive button}
  918.                         putName = 7;                         {editTExt item for file name}
  919.             
  920.                         getDlgID = - 4000; {SFGetFile dialog template ID}
  921.             
  922.                         getOpen = 1;                         {open button}
  923.                                   2        {hidden button}
  924.                         getCancel = 3;     {cancel button}
  925.                         getEject = 5;      {eject button}
  926.                         getDrive = 6;      {drive button}
  927.                         getNmList = 7;     {userItem for file name list}
  928.                         getScroll = 8;     {userItem for scroll bar}
  929.                                     9      {hidden text}
  930.  
  931.     TYPE
  932.  
  933.       SFReply = RECORD
  934.                                                             good: BOOLEAN;     {ignore command if FALSE}
  935.                                                             copy: BOOLEAN;     {not used}
  936.                                                             fType: OsType;     {file type or not used}
  937.                                                             vRefNum: INTEGER;  {volume reference number}
  938.                                                             version: INTEGER;  {file's version number}
  939.                                                             fName: String[63]; {file name}
  940.                                                     END;                 {SFReply}
  941.  
  942.       SFTypeList = ARRAY [0..3] OF OsType;
  943.  
  944. \ ,142
  945. 142
  946. Memory Manager Definition.
  947.  
  948. CONST
  949.   MemFullErr    = - 108; { Not enough room in heap zone }
  950.   NilHandleErr  = - 109; { Master Pointer was NIL in HandleZone or other }
  951.   MemWZErr      = - 111; { WhichZone failed (applied to free block) }
  952.   MemPurErr     = - 112; { trying to purge a locked or non-purgeable block }
  953.   MemLockedErr  = - 117; { Block is locked }
  954.   NoErr         = 0;     { All is well }
  955.  
  956. TYPE
  957.       SignedByte    = - 128..127;   { any byte in memory }
  958.       Byte          = 0..255;       { unsigned byte for fontmgr }
  959.       Ptr           = ^SignedByte;  { blind pointer }
  960.       Handle        = ^Ptr;         { pointer to a master pointer }
  961.       ProcPtr       = Ptr;          { pointer to a procedure }
  962.       Fixed         = LongInt;      { fixed point arithmetic type }
  963.  
  964.       Str255        = String[255];  { maximum string size }
  965.       StringPtr     = ^Str255;      { pointer to maximum string }
  966.       StringHandle  = ^StringPtr;   { handle to maximum string }
  967.  
  968.       Zone = RECORD
  969.                BkLim: Ptr;
  970.                PurgePtr: Ptr;
  971.                HFstFree: Ptr;
  972.                ZCBFree: LongInt;
  973.                GZProc: ProcPtr;
  974.                MoreMast: INTEGER;
  975.                Flags: INTEGER;
  976.                CntRel: INTEGER;
  977.                MaxRel: INTEGER;
  978.                CntNRel: INTEGER;
  979.                MaxNRel: INTEGER;
  980.                CntEmpty: INTEGER;
  981.                CntHandles: INTEGER;
  982.                MinCBFree: LongInt;
  983.                PurgeProc: ProcPtr;
  984.                SparePtr: Ptr;       { reserved for future }
  985.                AllocPtr: Ptr;
  986.                HeapData: INTEGER;
  987.              END;
  988.       THz   = ^Zone;    { pointer to the start of a heap zone }
  989.       Size  = LongInt;  { size of a block in bytes }
  990.       OSErr = INTEGER;  { error code }
  991.  
  992.       QElemPtr = ^QElem; {ptr to generic queue element}
  993.  
  994. \ ,143
  995. 143
  996. Segment Loader Definitions.
  997.  
  998. CONST
  999.       appOpen  = 0 ;  { Open the Document (s) }
  1000.       appPrint = 1 ;  { Print the Document (s)}
  1001. TYPE
  1002.       appFile = RECORD
  1003.                   vRefNum: INTEGER;
  1004.                   ftype: OSType;
  1005.                   versNum: INTEGER; {versNum in high byte}
  1006.                   fName: str255;
  1007.                 END; {appFile}
  1008.  
  1009. \ ,144
  1010. 144
  1011. OS Event Definitions.
  1012.  
  1013. CONST
  1014.       NullEvent     = 0;
  1015.       mouseDown     = 1;
  1016.       mouseUp       = 2;
  1017.       keyDown       = 3;
  1018.       keyUp         = 4;
  1019.       autoKey       = 5;
  1020.       updateEvt     = 6;
  1021.       diskEvt       = 7;
  1022.       activateEvt   = 8;
  1023.       networkEvt    = 10;
  1024.       driverEvt     = 11;
  1025.       app1Evt       = 12;
  1026.       app2Evt       = 13;
  1027.       app3Evt       = 14;
  1028.       app4Evt       = 15;
  1029.  
  1030.       { event mask equates }
  1031.       mDownMask     = 2;
  1032.       mUpMask       = 4;
  1033.       keyDownMask   = 8;
  1034.       keyUpMask     = 16;
  1035.       autoKeyMask   = 32;
  1036.       updateMask    = 64;
  1037.       diskMask      = 128;
  1038.       activMask     = 256;
  1039.       networkMask   = 1024;
  1040.       driverMask    = 2048;
  1041.       app1Mask      = 4096;
  1042.       app2Mask      = 8192;
  1043.       app3Mask      = 16384;
  1044.       app4Mask      = -32768;
  1045.  
  1046.       {to decipher event message for keyDown events}
  1047.       charCodeMask  = $000000FF;
  1048.       keyCodeMask   = $0000FF00;
  1049.  
  1050.       { modifiers }
  1051.       optionKey     = 2048; { Bit 3 of high byte }
  1052.       alphaLock     = 1024; { Bit 2 }
  1053.       ShiftKey      = 512;  { Bit 1 }
  1054.       CmdKey        = 256;  { Bit 0 }
  1055.       BtnState      = 128;  { Bit 7 of low byte is mouse button state }
  1056.  
  1057.       activeFlag    = 1;    { bit 0 of modifiers for activate event }
  1058.  
  1059.       {error for PostEvent}
  1060.       EvtNotEnb     = 1;
  1061.  
  1062. TYPE
  1063.       EventRecord = RECORD
  1064.                       what: INTEGER;
  1065.                       message: LongInt;
  1066.                       when: LongInt;
  1067.                       where: Point;
  1068.                       modifiers: INTEGER;
  1069.                     END;
  1070.  
  1071.       evQEl = RECORD
  1072.                 qLink: QElemPtr;
  1073.                 qType: INTEGER;
  1074.                 evtQwhat: INTEGER;
  1075.                 {this part is identical to the EventRecord as...}
  1076.                 evtQmessage: LongInt; {defined in ToolIntf}
  1077.                 evtQwhen: LongInt;
  1078.                 evtQwhere: Point;
  1079.                 evtQmodifiers: INTEGER;
  1080.               END;
  1081.  
  1082. \ ,145
  1083. 145
  1084. File Manager Definitions.
  1085.  
  1086. CONST
  1087.   DirFulErr     = - 33; { Directory full }
  1088.   DskFulErr     = - 34; { disk full }
  1089.   NSVErr        = - 35; { no such volume }
  1090.   IOErr         = - 36; { I/O error }
  1091.   BdNamErr      = - 37; { bad name }
  1092.   FNOpnErr      = - 38; { File not open }
  1093.   EOFErr        = - 39; { End of file }
  1094.   PosErr        = - 40; { tried to position to before start of file (r/w) }
  1095.   MFulErr       = - 41; { memory full(open) or file won't fit (load) }
  1096.   TMFOErr       = - 42; { too many files open }
  1097.   FNFErr        = - 43; { File not found }
  1098.  
  1099.   WPrErr        = - 44; { diskette is write protected }
  1100.   FLckdErr      = - 45; { file is locked }
  1101.   VLckdErr      = - 46; { volume is locked }
  1102.   FBsyErr       = - 47; { File is busy (delete) }
  1103.   DupFNErr      = - 48; { duplicate filename (rename) }
  1104.   OpWrErr       = - 49; { file already open with with write permission }
  1105.   ParamErr      = - 50; { error in user parameter list }
  1106.   RFNumErr      = - 51; { refnum error }
  1107.   GFPErr        = - 52; { get file position error }
  1108.   VolOffLinErr  = - 53; { volume not on line error (was Ejected) }
  1109.   PermErr       = - 54; { permissions error (on file open) }
  1110.   VolOnLinErr   = - 55; { drive volume already on-line at MountVol }
  1111.   NSDrvErr      = - 56; { no such drive (tried to mount a bad drive num) }
  1112.   NoMacDskErr   = - 57; { not a mac diskette (sig bytes are wrong) }
  1113.   ExtFSErr      = - 58; { volume in question belongs to an external fs }
  1114.   FSRnErr       = - 59; { file system rename error }
  1115.   BadMDBErr     = - 60; { bad master directory block }
  1116.   WrPermErr     = - 61; { write permissions error }
  1117.  
  1118.   lastDskErr    = - 64; { last in a range of disk errors }
  1119.   noDriveErr    = - 64; { drive not installed }
  1120.   offLinErr     = - 65; { r/w requested for an off-line drive }
  1121.   noNybErr      = - 66; { couldn't find 5 nybbles in 200 tries }
  1122.   noAdrMkErr    = - 67; { couldn't find valid addr mark }
  1123.   dataVerErr    = - 68; { read verify compare failed }
  1124.   badCkSmErr    = - 69; { addr mark checksum didn't check }
  1125.   badBtSlpErr   = - 70; { bad addr mark bit slip nibbles }
  1126.   noDtaMkErr    = - 71; { couldn't find a data mark header }
  1127.   badDCkSum     = - 72; { bad data mark checksum }
  1128.   badDBtSlp     = - 73; { bad data mark bit slip nibbles }
  1129.   wrUnderRun    = - 74; { write underrun occurred }
  1130.   cantStepErr   = - 75; { step handshake failed }
  1131.   tk0BadErr     = - 76; { track 0 detect doesn't change }
  1132.   initIWMErr    = - 77; { unable to initialize IWM }
  1133.   twoSideErr    = - 78; { tried to read 2nd side on a 1-sided drive }
  1134.   spdAdjErr     = - 79; { unable to correctly adjust disk speed }
  1135.   seekErr       = - 80; { track number wrong on address mark }
  1136.   sectNFErr     = - 81; { sector number never found on a track }
  1137.   firstDskErr   = - 84; { first in a range of disk errors }
  1138.  
  1139.   DirNFErr      = - 120; { Directory not found }
  1140.   TMWDOErr      = - 121; { No free WDCB available }
  1141.   BadMovErr     = - 122; { Move into offspring error }
  1142.   WrgVolTypErr  = - 123; { Wrong volume type error - operation not
  1143.                             supported for MFS}
  1144.   FSDSIntErr    = - 127; { Internal file system error }
  1145.  
  1146.   MaxSize       = $800000; { Max data block size is 8 megabytes }
  1147.  
  1148.       {finder constants}
  1149.       fOnDesk       = 1;
  1150.       fHasBundle    = 8192;
  1151.       fInvisible    = 16384;
  1152.       fTrash        = - 3;
  1153.       fDesktop      = - 2;
  1154.       fDisk         = 0;
  1155.  
  1156.       {io constants}
  1157.  
  1158.       {ioPosMode values}
  1159.       fsAtMark      = 0;
  1160.       fsFromStart   = 1;
  1161.       fsFromLEOF    = 2;
  1162.       fsFromMark    = 3;
  1163.       rdVerify      = 64;
  1164.  
  1165.       {ioPermission values}
  1166.       fsCurPerm     = 0;
  1167.       fsRdPerm      = 1;
  1168.       fsWrPerm      = 2;
  1169.       fsRdWrPerm    = 3;
  1170.       fsRdWrShPerm  = 4;
  1171.  
  1172. TYPE
  1173.   ParamBlkType = (IOParam, FileParam, VolumeParam, CntrlParam);
  1174.  
  1175.   OSType = PACKED ARRAY [1..4] OF CHAR; {same as rsrc mgr's Restype}
  1176.  
  1177.   FInfo = RECORD                {record of finder info}
  1178.             fdType: OSType;     {the type of the file}
  1179.             fdCreator: OSType;  {file's creator}
  1180.             fdFlags: INTEGER;   {flags ex. hasbundle,invisible,locked,
  1181.                                     etc.}
  1182.             fdLocation: Point;  {file's location in folder}
  1183.             fdFldr: INTEGER;    {folder containing file}
  1184.           END; {FInfo}
  1185.  
  1186.  
  1187.   FXInfo = RECORD
  1188.              fdIconID: INTEGER;         {Icon ID}
  1189.              fdUnused: ARRAY [1..4] OF INTEGER; {unused but reserved 8 bytes}
  1190.              fdComment: INTEGER;        {Comment ID}
  1191.              fdPutAway: LongInt;        {Home Dir ID}
  1192.            END;
  1193.  
  1194.   DInfo = RECORD
  1195.             frRect: Rect;       {folder rect}
  1196.             frFlags: INTEGER;   {Flags}
  1197.             frLocation: Point;  {folder location}
  1198.             frView: INTEGER;    {folder view}
  1199.           END;
  1200.  
  1201.   DXInfo = RECORD
  1202.              frScroll: Point;       {scroll position}
  1203.              frOpenChain: LongInt;  {DirID chain of open folders}
  1204.              frUnused: INTEGER;     {unused but reserved}
  1205.              frComment: INTEGER;    {comment}
  1206.              frPutAway: LongInt;    {DirID}
  1207.            END;
  1208.  
  1209.  
  1210.   ParamBlockRec = RECORD
  1211.   {12 byte header used by the file and IO system}
  1212.     qLink: QElemPtr;        {queue link in header}
  1213.     qType: INTEGER;         {type byte for safety check}
  1214.     ioTrap: INTEGER;        {FS: the Trap}
  1215.     ioCmdAddr: Ptr;         {FS: address to dispatch to}
  1216.  
  1217.              {common header to all variants}
  1218.     ioCompletion: ProcPtr; {completion routine addr (0 for
  1219.                             synch calls)}
  1220.     ioResult: OSErr;        {result code}
  1221.     ioNamePtr: StringPtr;   {ptr to Vol:FileName string}
  1222.     ioVRefNum: INTEGER;     {volume refnum (DrvNum for Eject and
  1223.                                 MountVol)}
  1224.  
  1225. {different components for the different type of parameter blocks}
  1226.     CASE ParamBlkType OF
  1227.       IOParam:
  1228.         (ioRefNum: INTEGER;     {refNum for I/O operation}
  1229.          ioVersNum: SignedByte; {version number}
  1230.          ioPermssn: SignedByte; {Open: permissions (byte)}
  1231.  
  1232.          ioMisc: Ptr;           {Rename: new name}
  1233.                                 {GetEOF,SetEOF: logical end of file}
  1234.                                 {Open: optional ptr to buffer}
  1235.                                 {SetFileType: new type}
  1236.          ioBuffer: Ptr;         {data buffer Ptr}
  1237.          ioReqCount: LongInt;   {requested byte count; also =
  1238.                                  ioNewDirID}
  1239.          ioActCount: LongInt;   {actual byte count completed}
  1240.          ioPosMode: INTEGER;    {initial file positioning}
  1241.          ioPosOffset: LongInt); {file position offset}
  1242.  
  1243.       FileParam:
  1244.         (ioFRefNum: INTEGER;        {reference number}
  1245.          ioFVersNum: SignedByte;    {version number}
  1246.          filler1: SignedByte;
  1247.          ioFDirIndex: INTEGER;      {GetFInfo directory index}
  1248.          ioFlAttrib: SignedByte;    {GetFInfo: in-use bit=7, lock
  1249.                                         bit=0}
  1250.          ioFlVersNum: SignedByte;   {file version number}
  1251.          ioFlFndrInfo: FInfo;       {user info}
  1252.          ioFlNum: LongInt;          {GetFInfo: file number; TF-
  1253.                                         ioDirID}
  1254.          ioFlStBlk: INTEGER;        {start file block (0 if none)}
  1255.          ioFlLgLen: LongInt;        {logical length (EOF)}
  1256.          ioFlPyLen: LongInt;        {physical lenght}
  1257.          ioFlRStBlk: INTEGER;       {start block rsrc fork}
  1258.          ioFlRLgLen: LongInt;       {file logical length rsrc fork}
  1259.          ioFlRPyLen: LongInt;       {file physical length rsrc fork}
  1260.          ioFlCrDat: LongInt;        {file creation date & time (32
  1261.                                         bits in secs)}
  1262.          ioFlMdDat: LongInt);       {last modified date and time}
  1263.  
  1264.       VolumeParam:
  1265.         (filler2: LongInt;
  1266.          ioVolIndex: INTEGER;   {volume index number}
  1267.          ioVCrDate: LongInt;    {creation date and time}
  1268.          ioVLsBkUp: LongInt;    {last backup date and time}
  1269.          ioVAtrb: INTEGER;      {volume attrib}
  1270.          ioVNmFls: INTEGER;     {number of files in directory}
  1271.          ioVDirSt: INTEGER;     {start block of file directory}
  1272.          ioVBlLn: INTEGER;      {GetVolInfo: length of dir in
  1273.                                     blocks}
  1274.          ioVNmAlBlks: INTEGER;  {GetVolInfo: num blks (of alloc
  1275.                                     size)}
  1276.          ioVAlBlkSiz: LongInt;  {GetVolInfo: alloc blk byte
  1277.                                     size}
  1278.          ioVClpSiz: LongInt;    {GetVolInfo: bytes to allocate at
  1279.                                     a time}
  1280.          ioAlBlSt: INTEGER;     {starting disk(512-byte) block in
  1281.                                     block map}
  1282.          ioVNxtFNum: LongInt;   {GetVolInfo: next free file
  1283.                                     number}
  1284.          ioVFrBlk: INTEGER);    {GetVolInfo: # free alloc blks
  1285.                                     for this vol}
  1286.  
  1287.       CntrlParam:
  1288.         (ioCRefNum: INTEGER;        {refNum for I/O operation}
  1289.          CSCode: INTEGER;           {word for control status code}
  1290.          CSParam: ARRAY [0..10] OF INTEGER); {operation-defined
  1291.                                                 parameters}
  1292.   END; {ParamBlockRec}
  1293.  
  1294.   ParmBlkPtr = ^ParamBlockRec;
  1295.  
  1296. \ ,146
  1297. 146
  1298. Printing Manager Definitions.
  1299.  
  1300. CONST
  1301.   iPrPgFract = 120; {Page scale factor. ptPgSize (below) is in units of
  1302.                      1/iPrPgFract }
  1303.  
  1304.   iPrPgFst      = 1; {Page range constants}
  1305.   iPrPgMax      = 9999;
  1306.  
  1307.   iPrRelease    = 3; {Current version number of the code.} {DC 7/23/84}
  1308.   iPfMaxPgs     = 128; {Max number of pages in a print file.}
  1309.  
  1310.   {Driver constants}
  1311.   iPrBitsCtl    = 4; {The Bitmap Print Proc's ctl number}
  1312.   lScreenBits   = $00000000; {The Bitmap Print Proc's Screen Bitmap
  1313.                                 param}
  1314.   lPaintBits    = $00000001; {The Bitmap Print Proc's Paint [sq pix]
  1315.                                 param}
  1316.   lHiScreenBits = $00000010; {The Bitmap Print Proc's Screen Bitmap
  1317.                                 param}
  1318.   lHiPaintBits  = $00000011; {The Bitmap Print Proc's Paint [sq pix]
  1319.                                 param}
  1320.   iPrIOCtl      = 5; {The Raw Byte IO Proc's ctl number}
  1321.   iPrEvtCtl     = 6; {The PrEvent Proc's ctl number}
  1322.   lPrEvtAll     = $0002FFFD; {The PrEvent Proc's CParam for the entire
  1323.                                 screen}
  1324.   lPrEvtTop     = $0001FFFD; {The PrEvent Proc's CParam for the top
  1325.                                 folder}
  1326.   iPrDevCtl     = 7;         {The PrDevCtl Proc's ctl number}
  1327.   lPrReset      = $00010000; {The PrDevCtl Proc's CParam for reset}
  1328.   lPrPageEnd    = $00020000; {The PrDevCtl Proc's CParam for end page}
  1329.   lPrLineFeed   = $00030000; {The PrDevCtl Proc's CParam for paper
  1330.                                 advance}
  1331.   lPrLFSixth    = $0003FFFF; {The PrDevCtl Proc's CParam for 1/6 th inch
  1332.                                 paper advance}
  1333.   lPrLFEighth   = $0003FFFE; {The PrDevCtl Proc's CParam for 1/8 th inch
  1334.                                 paper advance}
  1335.   iFMgrCtl      = 8;         {The FMgr's Tail-hook Proc's ctl number}
  1336.   { [The Pre-Hook is the status call] }
  1337.  
  1338.   {Error Constants:}
  1339.   iMemFullErr   = - 108;
  1340.   iPrAbort      = 128;
  1341.   iIOAbort      = - 27;
  1342.  
  1343.   {The PrVars lo mem area:}
  1344.   pPrGlobals    = $00000944;
  1345.   bDraftLoop    = 0;
  1346.   bSpoolLoop    = 1;
  1347.   bUser1Loop    = 2;
  1348.   bUser2Loop    = 3;
  1349.  
  1350.   {The Currently supported printers:}
  1351.   bDevCItoh     = 1;
  1352.   iDevCItoh     = $0100; {CItoh}
  1353.   bDevDaisy     = 2;
  1354.   iDevDaisy     = $0200; {Daisy}
  1355.   bDevLaser     = 3;
  1356.   iDevLaser     = $0300; {Laser}
  1357.  
  1358. TYPE
  1359.   TPRect = ^Rect;       {A Rect Ptr}
  1360.   TPBitMap = ^BitMap;   {A BitMap Ptr}
  1361.  
  1362.   {NOTE: Changes will also affect: PrEqu, TCiVars & TPfVars}
  1363.   TPrVars = RECORD {4 longs for printing, see SysEqu for location.}
  1364.               iPrErr: Integer; {Current print error. Set to iPrAbort to
  1365.                                     abort printing.}
  1366.               bDocLoop: SignedByte; {The Doc style: Draft, Spool, ..,
  1367.                                     and .. Currently use low 2 bits; the
  1368.                                     upper 6 are for flags.}
  1369.               bUser1: SignedByte; {Spares used by the print code}
  1370.               lUser1: LongInt;
  1371.               lUser2: LongInt;
  1372.               lUser3: LongInt;
  1373.             END;
  1374.   TPPrVars = ^TPrVars;
  1375.  
  1376.   TPrInfo = RECORD {Print Info Record: The parameters needed for page
  1377.                     composition.}
  1378.               iDev: Integer; {Font mgr/QuickDraw device code}
  1379.               iVRes: Integer; {Resolution of device, in device
  1380.                                 coordinates}
  1381.               iHRes: Integer; { ..note: V before H => compatable with
  1382.                                 Point.}
  1383.               rPage: Rect; {The page (printable) rectangle in device
  1384.                             coordinates.}
  1385.             END;
  1386.   TPPrInfo = ^TPrInfo;
  1387.  
  1388.   {These are types of paper feeders.}
  1389.   TFeed = (feedCut, feedFanfold, feedMechCut, feedOther);
  1390.  
  1391.   TPrStl = RECORD {Printer Style: The printer configuration and usage
  1392.                    information.}
  1393.              wDev: Integer; {The device (driver) number. Hi byte=RefNum,
  1394.                                 Lo byte=variant. f0 = fHiRes,
  1395.                                 f1 = fPortrait, f2 = fSqPix,
  1396.                                 f3 = f2xZoom, f4 = fScroll.}
  1397.              iPageV: Integer; {paper size in units of 1/iPrPgFract}
  1398.              iPageH: Integer; { ..note: V before H => compatable with
  1399.                                 Point.}
  1400.              bPort: SignedByte; {The IO port number. Refnum?}
  1401.              feed: TFeed; {paper feeder type.}
  1402.            END;
  1403.   TPPrStl = ^TPrStl;
  1404.  
  1405.   {Banding data structures. Not of general interest to Apps.}
  1406.   TScan = {Band Scan direction Top-Bottom, Left-Right, etc.}
  1407.   (scanTB, scanBT, scanLR, scanRL);
  1408.  
  1409.   TPrXInfo = RECORD {The print time eXtra information.}
  1410.                iRowBytes: Integer; {The Band's rowBytes.}
  1411.                iBandV: Integer; {Size of band, in device coordinates}
  1412.                iBandH: Integer; { ..note: V before H => compatible with
  1413.                                  Point.}
  1414.                iDevBytes: Integer; {Size for allocation. May be more
  1415.                                     than rBounds size!}
  1416.                iBands: Integer; {Number of bands per page.}
  1417.  
  1418.                bPatScale: SignedByte; {Pattern scaling}
  1419.                bULThick: SignedByte; {3 Underscoring parameters}
  1420.                bULOffset: SignedByte;
  1421.                bULShadow: SignedByte;
  1422.  
  1423.                scan: TScan; {Band scan direction}
  1424.                bXInfoX: SignedByte; {An eXtra byte.}
  1425.              END;
  1426.   TPPrXInfo = ^TPrXInfo;
  1427.  
  1428.   TPrJob = RECORD {Print Job: Print "form" for a single print request.}
  1429.              iFstPage: Integer; {Page Range.}
  1430.              iLstPage: Integer;
  1431.              iCopies: Integer; {No. copies.}
  1432.              bJDocLoop: SignedByte; {The Doc style: Draft, Spool, ..,
  1433.                                         and ..}
  1434.              fFromUsr: Boolean; {Printing from an User's App (not PrApp)
  1435.                                     flag}
  1436.              pIdleProc: ProcPtr; {The Proc called while waiting on IO
  1437.                                     etc.}
  1438.              pFileName: StringPtr; {Spool File Name: NIL for default.}
  1439.              iFileVol: Integer; {Spool File vol, set to 0 initially}
  1440.              bFileVers: SignedByte; {Spool File version, set to 0
  1441.                                         initially}
  1442.              bJobX: SignedByte; {An eXtra byte.}
  1443.            END;
  1444.   TPPrJob = ^TPrJob;
  1445.  
  1446.   TPrint = RECORD {The universal 120 byte printing record}
  1447.              iPrVersion: Integer; {2} {Printing software version}
  1448.              PrInfo: TPrInfo; {14} {the PrInfo data associated with the
  1449.                                     current style.}
  1450.              rPaper: Rect; {8} {The paper rectangle [offset from rPage]}
  1451.              PrStl: TPrStl; {8} {This print request's style.}
  1452.              PrInfoPT: TPrInfo; {14} {Print Time Imaging metrics}
  1453.              PrXInfo: TPrXInfo; {16} {Print-time (expanded) Print info
  1454.                                       record.}
  1455.              PrJob: TPrJob; {20} {The Print Job request}
  1456.                   {82} {Total of the above; 120-82 = 38 bytes needed to
  1457.                         fill 120}
  1458.              PrintX: ARRAY [1..19] OF Integer; {Spare to fill to 120
  1459.                                                 bytes!}
  1460.            END;
  1461.   TPPrint = ^TPrint;
  1462.   THPrint = ^TPPrint;
  1463.  
  1464. {Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.}
  1465.   TPrPort = RECORD {This is the "PrPeek" record.}
  1466.               GPort: GrafPort; {The Printer's graf port.}
  1467.               GProcs: QDProcs; {..and its procs}
  1468.  
  1469.               lGParam1: LongInt; {16 bytes for private parameter storage.}
  1470.               lGParam2: LongInt;
  1471.               lGParam3: LongInt;
  1472.               lGParam4: LongInt;
  1473.  
  1474.               fOurPtr: Boolean;
  1475.                                                         {Whether the PrPort allocation was done by us.}
  1476.               fOurBits: Boolean;
  1477.                                                         {Whether the BitMap allocation was done by us.}
  1478.             END;
  1479.   TPPrPort = ^TPrPort;
  1480.  
  1481.   TPrStatus = RECORD {Print Status: Print information during printing.}
  1482.                 iTotPages: Integer; {Total pages in Print File.}
  1483.                 iCurPage: Integer; {Current page number}
  1484.                 iTotCopies: Integer; {Total copies requested}
  1485.                 iCurCopy: Integer; {Current copy number}
  1486.                 iTotBands: Integer; {Total bands per page.}
  1487.                 iCurBand: Integer; {Current band number}
  1488.                 fPgDirty: Boolean; {True if current page has been written to.}
  1489.                 fImaging: Boolean; {Set while in band's DrawPic call.}
  1490.                 hPrint: THPrint; {Handle to the active Printer record}
  1491.                 pPrPort: TPPrPort; {Ptr to the active PrPort}
  1492.                 hPic: PicHandle; {Handle to the active Picture}
  1493.               END;
  1494.   TPPrStatus = ^TPrStatus;
  1495.  
  1496. {PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!)}
  1497.   TPfPgDir = RECORD
  1498.                iPages: Integer;
  1499.                lPgPos: ARRAY [0..iPfMaxPgs] OF LongInt;
  1500.              END;
  1501.   TPPfPgDir = ^TPfPgDir;
  1502.   THPfPgDir = ^TPPfPgDir;
  1503.  
  1504.   TPfHeader = RECORD {Print File header.}
  1505.                 Print: TPrint;
  1506.                 PfPgDir: TPfPgDir;
  1507.               END;
  1508.   TPPfHeader = ^TPfHeader;
  1509.   THPfHeader = ^TPPfHeader; {Note: Type compatable with an hPrint.}
  1510.  
  1511. { This is the Printing Dialog Record. Only used by folks appending their own dialogs. }
  1512.   TPrDlg = RECORD {Print Dialog: The Dialog Stream object.}
  1513.              Dlg: DialogRecord; {The Dialog window}
  1514.              pFltrProc: ProcPtr; {The Filter Proc.}
  1515.              pItemProc: ProcPtr; {The Item evaluating proc.}
  1516.              hPrintUsr: THPrint; {The user's print record.}
  1517.              fDoIt: Boolean;
  1518.              fDone: Boolean;
  1519.              lUser1: LongInt; {Four longs for user's to hang global data.}
  1520.              lUser2: LongInt;
  1521.              lUser3: LongInt;
  1522.              lUser4: LongInt;
  1523.               {  ...Plus more stuff needed by the particular printing dialog.}
  1524.            END;
  1525.   TPPrDlg = ^TPrDlg; {== a dialog ptr}
  1526. \ ,147
  1527. 147
  1528. Device Manager Definitions.
  1529.  
  1530. \ ,148
  1531. 148
  1532. Disk Driver Definitions.
  1533.  
  1534. \ ,149
  1535. 149
  1536. Sound Driver Definitions.
  1537. \ ,151
  1538. 151
  1539. AppleTalk definitions.
  1540.  
  1541. CONST
  1542.  
  1543.         lapSize = 20;
  1544.         ddpSize = 26;
  1545.         nbpSize = 26;
  1546.         atpSize = 56;
  1547.  
  1548.         {error codes}
  1549.  
  1550.         ddpSktErr = - 91;
  1551.         ddpLenErr = - 92;
  1552.         noBridgeErr = - 93;
  1553.         LAPProtErr = - 94;
  1554.         excessCollsns = - 95;
  1555.  
  1556.         nbpBuffOvr = - 1024;
  1557.         nbpNoConfirm = - 1025;
  1558.         nbpConfDiff = - 1026;
  1559.         nbpDuplicate = - 1027;
  1560.         nbpNotFound = - 1028;
  1561.         nbpNISErr = - 1029;
  1562.  
  1563.         reqFailed = - 1096;
  1564.         tooManyReqs = - 1097;
  1565.         tooManySkts = - 1098;
  1566.         badATPSkt = - 1099;
  1567.         badBuffNum = - 1100;
  1568.         noRelErr = - 1101;
  1569.         cbNotFound = - 1102;
  1570.         noSendResp = - 1103;
  1571.         noDataArea = - 1104;
  1572.         reqAborted = - 1105;
  1573.  
  1574.         buf2SmallErr = - 3101;
  1575.         noMPPErr = - 3102;
  1576.         ckSumErr = - 3103;
  1577.         extractErr = - 3104;
  1578.         readQErr = - 3105;
  1579.         atpLenErr = - 3106;
  1580.         atpBadRsp = - 3107;
  1581.         recNotFnd = - 3108;
  1582.         sktClosedErr = - 3109;
  1583.  
  1584. TYPE
  1585.  
  1586.         ABByte = 1..127;
  1587.  
  1588.         STR32 = STRING[32];
  1589.  
  1590.         ABCallType = (tLAPRead, tLAPWrite, tDDPRead, tDDPWrite, tNBPLookUp,
  1591.                 tNBPConfirm, tNBPRegister, tATPSndRequest, tATPGetRequest,
  1592.                 tATPSdRsp, tATPAddRsp, tATPRequest, tATPResponse);
  1593.  
  1594.         ABProtoType = (lapProto, ddpProto, nbpProto, atpProto);
  1595.  
  1596.         LAPAdrBlock = PACKED RECORD
  1597.                         dstNodeID: Byte;
  1598.                         srcNodeID: Byte;
  1599.                         LAPProtType: ABByte;
  1600.                 END;
  1601.  
  1602.         AddrBlock = PACKED RECORD
  1603.                 aNet: INTEGER;
  1604.                 aNode: Byte;
  1605.                 aSocket: Byte;
  1606.                     END;
  1607.  
  1608.         EntityName = RECORD
  1609.                     objStr: STR32;
  1610.                     typeStr: STR32;
  1611.                     zoneStr: STR32;
  1612.                         END;
  1613.  
  1614.         EntityPtr = ^EntityName;
  1615.  
  1616.         RetransType = PACKED RECORD
  1617.                         retransInterval: Byte;
  1618.                         retransCount: Byte;
  1619.                 END;
  1620.  
  1621.         BitMapType = PACKED ARRAY [0..7] OF BOOLEAN;
  1622.  
  1623.         BDSElement = RECORD
  1624.                     BuffSize: INTEGER;
  1625.                     BuffPtr: Ptr;
  1626.                     DataSize: INTEGER;
  1627.                     UserBytes: LongInt;
  1628.                         END;
  1629.  
  1630.         BDSType = ARRAY [0..7] OF BDSElement;
  1631.  
  1632.         BDSPtr = ^BDSType;
  1633.  
  1634.         ABusRecord = RECORD
  1635.                     abOpCode: ABCallType;
  1636.                     abResult: INTEGER;
  1637.                     abUserReference: LongInt;
  1638.  
  1639.                     CASE ABProtoType OF
  1640.                             lapProto:
  1641.                         (lapAddress: LAPAdrBlock;
  1642.                             lapReqCount: INTEGER;
  1643.                             lapActCount: INTEGER;
  1644.                             lapDataPtr: Ptr; );
  1645.  
  1646.                             ddpProto:
  1647.                         (ddpType: Byte;
  1648.                             ddpSocket: Byte;
  1649.                             ddpAddress: AddrBlock;
  1650.                             ddpReqCount: INTEGER;
  1651.                             ddpActCount: INTEGER;
  1652.                             ddpDataPtr: Ptr;
  1653.                             ddpNodeID: Byte; );
  1654.  
  1655.                             nbpProto:
  1656.                         (nbpEntityPtr: EntityPtr;
  1657.                             nbpBufPtr: Ptr;
  1658.                             nbpBufSize: INTEGER;
  1659.                             nbpDataField: INTEGER;
  1660.                             nbpAddress: AddrBlock;
  1661.                             nbpRetransmitInfo: RetransType; );
  1662.  
  1663.                             atpProto:
  1664.  
  1665.                         (atpSocket: Byte;
  1666.                             atpAddress: AddrBlock;
  1667.                             atpReqCount: INTEGER;
  1668.                             atpDataPtr: Ptr;
  1669.                             atpRspBDSPtr: BDSPtr;
  1670.                             atpBitMap: BitMapType;
  1671.                             atpTransID: INTEGER;
  1672.                             atpActCount: INTEGER;
  1673.                             atpUserData: LongInt;
  1674.                             atpXO: BOOLEAN;
  1675.                             atpEOM: BOOLEAN;
  1676.                             atpTimeOut: Byte;
  1677.                             atpRetries: Byte;
  1678.                             atpNumBufs: Byte;
  1679.                             atpNumRsp: Byte;
  1680.                             atpBDSSize: Byte;
  1681.  
  1682.                             atpRspUData: LongInt;
  1683.                             atpRspBuf: Ptr;
  1684.                             atpRspSize: INTEGER; );
  1685.  
  1686.                         END; {record}
  1687.  
  1688.         ABRecPtr = ^ABusRecord;
  1689.         ABRecHandle = ^ABRecPtr;
  1690.  
  1691. \ ,154
  1692. 154
  1693. List Manager Definitions.
  1694.  
  1695. CONST
  1696.  
  1697. { Masks for selection flags (selFlags) }
  1698.  
  1699.     LOnlyOne = -128;        { 0 = multiple selections, 1 = one }
  1700.     LExtendDrag = 64;       { 1 = drag select without shift key }
  1701.     LNoDisjoint = 32;       { 1 = turn off selections on click }
  1702.     LNoExtend = 16;         { 1 = don't extend shift selections }
  1703.     LNoRect = 8;            { 1 = don't grow (shift,drag) selection as
  1704.                                 rect }
  1705.     LUseSense = 4;          { 1 = shift should use sense of start cell }
  1706.     LNoNilHilite = 2;       { 1 = don't hilite empty cells }
  1707.  
  1708. { Masks for other flags (listFlags) }
  1709.  
  1710.     LDoVAutoscroll = 2;     { 1 = allow vertical autoscrolling }
  1711.     LDoHAutoscroll = 1;     { 1 = allow horizontal autoscrolling }
  1712.  
  1713. { Messages to list definition procedure }
  1714.  
  1715.     LInitMsg = 0;           { tell drawing routines to init themselves }
  1716.     LDrawMsg = 1;           { draw (and de/select) the indicated data }
  1717.     LHiliteMsg = 2;         { invert hilite state of specified cell }
  1718.     LCloseMsg = 3;          { shut down, the list is being disposed }
  1719.  
  1720. TYPE
  1721.  
  1722.     Cell = Point;
  1723.  
  1724.     dataArray  = PACKED ARRAY[0..32000] OF Char;
  1725.     dataPtr    = ^dataArray;
  1726.     dataHandle = ^dataPtr;
  1727.  
  1728.     ListPtr    = ^ListRec;
  1729.     ListHandle = ^ListPtr;
  1730.     ListRec    = RECORD
  1731.             rView : Rect;               {Rect in which we are viewed}
  1732.             port : GrafPtr;             {Grafport that owns us}
  1733.             indent : Point;             {Indent pixels in cell}
  1734.             cellSize : Point;           {Cell size}
  1735.             visible : Rect;             {visible row/column bounds}
  1736.             vScroll : ControlHandle;    {vertical scroll bar (or NIL)}
  1737.             hScroll : ControlHandle;    {horizontal scroll bar (or NIL)}
  1738.             selFlags : SignedByte;      { defines selection characteristics
  1739.             LActive : Boolean;          { active or not }
  1740.             LReserved : SignedByte;     { internally used flags }
  1741.             listFlags : SignedByte;     { other flags }
  1742.             clikTime : Longint;         { save time of last click }
  1743.             clikLoc : Point;            { save position of last click }
  1744.             mouseLoc : Point;           { current mouse position }
  1745.             LClikLoop : Ptr;            { routine called repeatedly during
  1746.                                         ListClick }
  1747.             lastClick : Cell;           { the last cell clicked in }
  1748.             refCon : Longint;           { reference value }
  1749.             listDefProc : Handle;       { Handle to the defProc }
  1750.             userHandle : Handle;        { General purpose handle for user}
  1751.             dataBounds : Rect;          { Total number of rows/columns}
  1752.             cells : dataHandle;         { Handle to data}
  1753.             maxIndex : Integer;         { index past the last element}
  1754.             cellArray : ARRAY[1..1] OF Integer;     { offsets to elements }
  1755.         END;
  1756. \ InitResources
  1757. 1
  1758. FUNCTION InitResources : INTEGER;
  1759.  
  1760.     InitResources is called by the system whcn it starts up, and should
  1761. not be called by the application. It initializes the Resource Manager,
  1762. opens the system resource file, reads the resource map from the file
  1763. into memory, and returns a reference number for the file.
  1764.  
  1765. (note)
  1766.     The application doesn't need the reference number for the 
  1767.     system resource file, because every Resource Manager
  1768.     routine that has a reference number as a parameter
  1769.     interprets » to mean the system resource file.
  1770.  
  1771.  
  1772. \ RsrcZoneInit
  1773. 1
  1774. PROCEDURE RsrcZoneInit;
  1775.  
  1776.     RsrcZoneInit is called automatically when your application starts
  1777. up, to initialize the resource map read from the system resource file;
  1778. normally you'll have no need to call it directly. It "cleans up" after
  1779. any resource access that may have been done by a previous application.
  1780. First it closes all open resource files except the system resource
  1781. file. Then, for every system resource that was read into the
  1782. application heap (that is, whose resSysHeap attribute is »), it
  1783. replaces the handle to that resource in the resource map with NIL.
  1784. This lets the Resource Manager know that the resource will have to be
  1785. read in again (since the previous application heap is no longer
  1786. around).
  1787.  
  1788.  
  1789. \ CreateResFile
  1790. 1
  1791. PROCEDURE CreateResFile (fileName: Str255);
  1792.  
  1793.     CreateResFile creates a resource file containing no resource data or
  1794. copy of the file's directory entry. If there's no file at all with the
  1795. given name, it also creates an empty data fork for the file. If
  1796. there's already a resource file with the given name (that is, a
  1797. resource form that isn't empty), CreateResFile will do nothing and the 
  1798. ResError function will return an appropriate Operating System result
  1799. code.
  1800.  
  1801. (note)
  1802.     Before you can work with the resource file, you need to
  1803.     open it with OpenResFile.
  1804.  
  1805.  
  1806. \ OpenResFile
  1807. 1
  1808. FUNCTION OpenResFile (fileName: Str255) : INTEGER;
  1809.  
  1810.     OpenResFile opens the resource file having the given name and makes
  1811. it the current resource file. It reads the resource map from the file
  1812. into memory and returns a reference number for the file. It also reads
  1813. in every resource whose resPreload attribute is set. If the resource
  1814. file is already open, it doesn't make it the current resource file; it
  1815. simply returns the reference number.
  1816.  
  1817. (note)
  1818.     You don't have to call OpenResFile to open the system
  1819.     Resource file or the application's resource file, because
  1820.     they're opened when the system and the application start
  1821.     up, respectively. To get the reference number of the
  1822.     application's resource file, you can call CurResFile
  1823.     after the application starts up (before you open any
  1824.     other resource file).
  1825.  
  1826.     If the file can't be opened, OpenResFile will return -1 and the
  1827. ResError function will return an appropriate Operating System result
  1828. code. For example, an error occurs if there's no resource file with 
  1829. the given name.
  1830.  
  1831. \ CloseResFile
  1832. 1
  1833. PROCEDURE CloseResFile (refNum: INTEGER);
  1834.  
  1835.     Given the reference number of a resource file, CloseResFile does the
  1836. following:
  1837.  
  1838.     - updates the resource file by calling the UpdateResFile procedure
  1839.  
  1840.     - for each resource in the resource file, releases the memory it
  1841.       occupies by calling the ReleaseResource procedure
  1842.  
  1843.     - releases the memory occupied by the resource map
  1844.  
  1845.     - closes the resource file
  1846.  
  1847.     If there's no resource file open with the given reference number,
  1848. CloseResFile will do nothing and the ResError function will return the
  1849. result code resFNotFound. A refNum of » represents the system resource
  1850. file, but if you ask to close this file, CloseResFile first closes all
  1851. other open resource files.
  1852.  
  1853.     A CloseResFile of every open resource file except the system
  1854. resource file is done automatically when the application terminates. So
  1855. you only need to call CloseResFile if you want to close the system
  1856. resource file, or if you want to close any resource file before the
  1857. application terminates.
  1858.  
  1859.  
  1860. \ ResError
  1861. 1
  1862. FUNCTION ResError : INTEGER;
  1863.  
  1864.     Called after one of the various Resource Manager routines that may
  1865. result in an error condition, ResError returns a result code
  1866. identifying the error, if any. If no error occurred, it returns the
  1867. result code
  1868.  
  1869.     CONST  noErr = »; {no error}
  1870.  
  1871.     If an error occurred at the Operating System level, it returns an
  1872. Operating System result code, such as the File Manager "disk I/O" error
  1873. or the Memory Manager "out of memory" error. (See the File Manager and
  1874. Memory Manager manuals for a list of the result codes.)  If an error
  1875. happened at the Resource Manager level, ResError returns one of the
  1876. following result codes:
  1877.  
  1878.     CONST   resNotFound  =  -192;   {resource not found}
  1879.         resFNotFound =  -193;   {resouce file not found}
  1880.         addResFailed =  -194;   {AddResource failed}
  1881.         rmvResFailed =  -196;   {RmveResource failed}
  1882.  
  1883.     Each routine description tells which errors may occur for that
  1884. routine. You can also check for an error after system startup, which
  1885. calls InitResources, and application startup, which opens the
  1886. application's resource file.
  1887.  
  1888.  
  1889. \ CurResFile
  1890. 1
  1891. FUNCTION CurResFile  : INTEGER;
  1892.  
  1893.     CurResFile returns the reference number of the current resource file
  1894. You can call it when the application starts up to get the reference
  1895. number of its resource file.
  1896.  
  1897. (note)
  1898.     If the system resource file is the current resource file,
  1899.     CurResFile returns the actual reference number of the
  1900.     system reference file (found in the global variable
  1901.     SysMap). You needn't worry about this number being used 
  1902.     (instead of » in the routines that require a reference
  1903.     number; these routines recognize both » and the actual
  1904.     reference number as referring to the system resource
  1905.     file.
  1906.  
  1907. \ HomeResFile
  1908. 1
  1909. FUNCTION HomeResFile  (theResource: Handle)  :  INTEGER
  1910.  
  1911.     Given a handle to a resource, HomeResFile returns the reference
  1912. number of the resource file containing that resource. If the given
  1913. handle isn't a handle to a resource, HomeResFile will return -1 and the 
  1914. ResError function will return the result code resNotFound.
  1915.  
  1916.  
  1917. \ UseResFile
  1918. 1
  1919. PROCEDURE UseResFile  (refNum:  INTEGER);
  1920.  
  1921.     Given the reference number of a resource file, UseResFile sets the
  1922. current resource file to that file. If there's no resource file open
  1923. with the given reference number, UseResFile will do nothing and the
  1924. ResError function will return the result code resFNotFound. A refNum
  1925. of » represents the system resource file.
  1926.  
  1927.     Open resource files are arranged as a linked list; the most recently
  1928. opened file is at the end of the list and is the first one to be
  1929. searched. UseResFile lets you start the search with a file opened
  1930. earlier; the file(s) following it on the list ate then left out of the
  1931. search process. This is best understood with an example. Assume there
  1932. are four open resource files (R» through R3); the search order is R3,
  1933. R2, R1, R». If you call UseResFile(R2), the search order becomes R2,
  1934. R1, R»; R3 is no longer searched. If you then open a fifth resource
  1935. file (R4), it's added to the end of the list and the search order
  1936. becomes R4, R3, R2, R1, R».
  1937.  
  1938.     This procedure is useful if you no longer want to override a system
  1939. resource with one by the same name in your application's resource file. 
  1940. You can call UseResFile(») to leave the application resource file out
  1941. of the search, causing only the system resource file to be searched.
  1942.  
  1943. (warning)
  1944.     Early versions of some desk accessories may, upon
  1945.     closing, always set the current resource file to the one
  1946.     opened just prior to the accessory, ignoring any
  1947.     additional resource files that may have been opened while
  1948.     the accessory was in use. To be safe, whenever desk
  1949.     accessories may have been in use, call UseResFile to
  1950.     ensure access to resource files opened after accessories.
  1951.  
  1952.  
  1953. \ CountTypes
  1954. 1
  1955. FUNCTION CountTypes : INTEGER;
  1956.  
  1957.     CountTypes returns the number of resource types in all open resource
  1958. files.
  1959.  
  1960.  
  1961. \ GetIndType
  1962. 1
  1963. PROCEDURE GetIndType (VAR theType: ResType; index: INTEGER);
  1964.  
  1965.     Given an index ranging from 1 to CountTypes (above, GetIndType
  1966. returns a resource type in theType. Called repeatedly over the entire
  1967. range  for the index, it returns all the resource types in all open
  1968. resource files. If the given index isn't in the range from 1 to
  1969. CountTypes,  GetIndType returns four NUL characters (ASCII code »).
  1970.  
  1971.  
  1972. \ SetResLoad
  1973. 1
  1974. PROCEDURE SetResLoad (load: BOOLEAN);
  1975.  
  1976.     Normally, the routines that return handles to resources read the
  1977. resource data into memory if it's not already in memory.
  1978. SetResLoad(FALSE) affects all those routines so that they will not read
  1979. the resource data into memory and will return an empty handle.
  1980. Resources whose resPreload attrribute is set will still be read in,
  1981. however, when a resource file is opened. SetResLoad(TRUE) restores the
  1982. normal state.
  1983.  
  1984. (warning)
  1985.     If you call SetResLoad(FALSE), be sure to restore the
  1986.     normal state as soon as possible, because other parts of
  1987.     the Toolbox that call the Resource Manager rely on it.
  1988.  
  1989.  
  1990. \ CountResources
  1991. 1
  1992. FUNCTION CountResources (theType: ResType) : INTEGER;
  1993.  
  1994.     CountResources returns the total number of resources of the given
  1995. type in all open resource files.
  1996.  
  1997.  
  1998. \ GetIndResource
  1999. 1
  2000. FUNCTION GetIndResource (theType: ResType; index: INTEGER) : Handle;
  2001.  
  2002.     Given an index ranging from 1 to CountResources(theType),
  2003. GetIndResource returns a handle to a resource of the given type (see
  2004. CountResources, above). Called repeatedly over the entire range for
  2005. the index, it returns handles to all resources of the given type in all
  2006. open resource files. GetIndResource reads the resource data into
  2007. memory if it's not already in memory, unless you've called
  2008. SetResLoad(FALSE).
  2009.  
  2010. (warning)
  2011.     The handle returned will be an empty handle if you've
  2012.     called SetResLoad(FALSE) (and the data isn't already in 
  2013.     memory). The handle will become empty if the resource
  2014.     data for a purgeable resource is read in but later
  2015.     purged. (You can test for an empty handle with, for
  2016.     example, myHndl^= NIL.)  To read in the data and make
  2017.     the handle no longer be empty, you can call LoadResource.
  2018.  
  2019.     GetIndResource returns handles for all resources in the most
  2020. recently opened resource file first, and then for those in the resource
  2021. files opened before it, in the reverse of the order that they were
  2022. opened. If you want to find out how many resources of a given type are
  2023. in a particular resource file, you can do so as follows:  Call
  2024. GetIndResource repeatedly with the index ranging from 1 to the number
  2025. of resources of that type. Pass each handle returned by GetIndResource
  2026. to HomeResFile and count all occurrences where the reference number
  2027. returned is that of the desired file. Be sure to start the index from
  2028. 1, and to call SetResLoad(FALSE) so the resources won't be read in.
  2029.  
  2030. (note)
  2031.     The UseResFile procedure affects which file the Resource
  2032.     Manager searches first when looking for a particular
  2033.     resource but not when getting indexed resources  with
  2034.     GetIndResource.
  2035.  
  2036.     If the given index isn't in the range from 1 to
  2037. CountResources(theType), GetIndResource returns NIL and the ResError
  2038. function will return the result code resNotFound. GetIndResource also
  2039. returns NIL if the resource is to be read into memory but won't fit; in
  2040. this case, ResError will return an appropriate Operating System result
  2041. code.
  2042.  
  2043.  
  2044. \ GetResource
  2045. 1
  2046. FUNCTION Get Resource (theType: ResType; the ID: INTEGER) : Handle;
  2047.  
  2048.     GetResource returns a handle to the resource having the given type
  2049. and ID number, reading the resource data into memory if it's not already
  2050. in memory and if you haven't called SetResLoad(FALSE) (see the warning 
  2051. aboove for GetIndResource). GetResource looks in the current resource
  2052. file and all resource files opened before it, in the reverse of the
  2053. order that they were opened; the system resource file is searched last.
  2054. If it doesn't find the resource, GetResource returns NIL and the 
  2055. ResError function will return the result code resNotFound. GetResource
  2056. also returns NIL if the resource is to be read into memory but won't 
  2057. fit; in this case, ResError will return an appropriate Operating System
  2058. result code.
  2059.  
  2060.  
  2061. \ GetNamedResource
  2062. 1
  2063. FUNCTION GetNamedResource (theType: ResType; name: Str255) : Handle;
  2064.  
  2065.     GetNamedResource is the same as GetResource (above) except that you
  2066. pass a resource name instead of an ID number.
  2067.  
  2068.  
  2069. \ LoadResource
  2070. 1
  2071. PROCEDURE LoadResource (theResource: Handle);
  2072.  
  2073.     Given a handle to a resource (returned by GetIndResource,
  2074. GetResource, or GetNamedResource), LoadResource reads that resource into
  2075. memory. It does nothing if the resource is already in memory or if the
  2076. given handle isn't a handle to a resource; in the latter case, the
  2077. ResError function will return the result code resNotFound. Call this
  2078. procedure if you want to access the data for a resource through its
  2079. handle and either you've called SetResLoad(FALSE) or if the resource is
  2080. purgeable.
  2081.  
  2082.     If you've changed the resource data for a purgeable resource and the 
  2083. resource is purged before being written to the resource file, the
  2084. changes will be lost; LoadResource will reread the original resource
  2085. from the resource file. See the descriptions of ChangedResource and
  2086. SetResPurge for information about how to ensure that changes made to
  2087. purgeable resources will be written to the research file.
  2088.  
  2089.  
  2090. \ ReleaseResource
  2091. 1
  2092. PROCEDURE ReleaseResource (theResource: Handle);
  2093.  
  2094.     Given a handle to a resource, ReleaseResource releases the memory
  2095. occupied by the resource data, if any, and replaces the handle to that
  2096. resource in the resource map with NIL. (See Figure 7.)  The given
  2097. handle will no longer be recognized as a handle to a resource; if the
  2098. Resource Manager is subsequently called to get the released resource, a
  2099. new handle will be allocated. Use this procedure only after you're
  2100. completely through with a resource.
  2101.  
  2102.  
  2103. \ DetachResource
  2104. 1
  2105. PROCEDURE DetachResource (theResource: Handle);
  2106.  
  2107.     Given a handle to a resource, DetachResource replaces the handle to
  2108. that resource in the resource map with NIL. (See Figure 7 above.)  The
  2109. given handle will no longer be recognized as a handle to a resource; if
  2110. the Resource Manager is subsequently called to get the detached
  2111. resource, a new handle will be allocated.
  2112.  
  2113.     DetachResource is useful if you want the resource data to be
  2114. accessed only by yourself through the given handle and not by the
  2115. Resource Manager. DetachResource is also useful in the unusual case
  2116. that you don't want a resource to be released when a resource file is
  2117. closed. To copy a resource, you can call DetachResource followed by
  2118. AddResource (with a new resource ID).
  2119.  
  2120.     If the given handle isn't a handle to a resource, DetachResopurce
  2121. will  do nothing and the ResError function will return the result code
  2122. resNotFound.
  2123.  
  2124.  
  2125. \ UniqueID
  2126. 1
  2127. FUNCTION UniqueID (theType: ResType) : INTEGER;
  2128.  
  2129.     UniqueID returns an ID number greater than » that isn't currently
  2130. assigned to any resource of the given type in any open resource file.
  2131. Using this number when you add a new resource to a resource file
  2132. ensures that you won't duplicate a resource ID and override an existing 
  2133. resource.
  2134.  
  2135. (warning)
  2136.     It's possible that UniqueID will return an ID in the 
  2137.     range reserved for system resources (» to 127). You
  2138.     should check that the ID returned is greater than 127; if
  2139.     it isn't, call UniqueID again.
  2140.  
  2141.  
  2142. \ GetResInfo
  2143. 1
  2144. PROCEDURE GetResInfo (theResource: Handle; VAR the ID: INTEGER; VAR
  2145.         theType: ResType; VAR name: Str255);
  2146.  
  2147.     Given a handle to a resource, GetResInfo returns the ID number,
  2148. type, and name of the resource. If the given handle isn't a handle to a 
  2149. resource, GetResInfo will do nothing and the ResError function will
  2150. return the result code resNotFound.
  2151.  
  2152.  
  2153. \ GetResAttrs
  2154. 1
  2155. FUNCTION GetResAttrs (theResource: Handle) : INTEGER;
  2156.  
  2157.     Given a handle to a resource, GetResAttrs returns the resource
  2158. attributes for the resource. (Resource attributes are described above
  2159. under "Resource References".)  If the given handle isn't a handle to a
  2160. resource, GetResAttrs will do nothing and the ResError function will
  2161. return the result code resNotFound.
  2162.  
  2163.  
  2164. \ SizeResource
  2165. 1
  2166. FUNCTION SizeResource (the Resource: Handle) : LONGINT;
  2167.  
  2168.     Given a handle to a resource, Size Resource returns the size in
  2169. bytes of the resource in the resource file. If the given handle isn't a
  2170. handle  to a resource, SizeResource will return -1 and the ResError
  2171. function will return the result code resNotFound. It's a good idea to
  2172. call SizeResource and ensure that sufficient space is available before
  2173. reading a resource into memory.
  2174.  
  2175.  
  2176. \ SetResInfo
  2177. 1
  2178. PROCEDURE SetResInfo (theResource: Handle; theID: INTEGER;
  2179.                         name: Str255);
  2180.  
  2181.     Given a handle to a resource, SetResInfo changes the ID number and
  2182. name of the resource to the given ID number and name.
  2183.     _______________________________________________________________
  2184.     Assembly-language note:  If you pass NIL for the name parameter,
  2185.     the name will not be changed.
  2186.     _______________________________________________________________
  2187.  
  2188. (warning)
  2189.     It's a dangerous practice to change the ID number and
  2190.     name of a system resource, because other applications may
  2191.     already access the resource and may no longer work
  2192.     properly.
  2193.  
  2194.     The change will be written to the resource file when the file is
  2195. updated if you follow SetResInfo with a call to ChangedResource.
  2196.  
  2197. (warning)
  2198.     Even if you don't call Changed Resource for this resource,
  2199.     the change may be written to the resource file when the
  2200.     file is updated. If you've ever called ChangedResource
  2201.     for any resource in the file, or if you've added or 
  2202.     removed a resource, the Resource Manager will write out
  2203.     the entire resource map when it updates the file, so all
  2204.     changes made to resource information in the map will
  2205.     become permanent. If you want any of the changes to be
  2206.     temprary, you'll have to restore the original 
  2207.     information before the file is updated.
  2208.  
  2209. SetResInfo does nothing in the following cases:
  2210.  
  2211.     - The resProtected attribute for the resource is set.
  2212.  
  2213.     - The given handle isn't a handle to a resource. The ResError
  2214.       function will return the result code resNotFound.
  2215.  
  2216.     - The resource map becomes too large to fit in memory (which can
  2217.       happen if a name is passed) or sufficient space for the modified
  2218.       resource file can't be reserved on the disk. ResError will return 
  2219.       an appropriate Operating System result code.
  2220.  
  2221.  
  2222. \ SetResAttrs
  2223. 1
  2224. PROCEDURE SetResAttrs (theResource: Handle; attrs: INTEGER);
  2225.  
  2226.     Given a handle to a resource, SetResAttrs sets the resource
  2227. attributes for the resource to attrs. (Resource attributes are
  2228. described above under "Resource Refererence".)  The resProtected
  2229. attribute takes effect immediately; the others take effect the next time
  2230. the resource is read in.
  2231.  
  2232. (warning)
  2233.     Do not use SetResAttrs to set the resChanged attribute;
  2234.     you must call Changed Resource instead. Be sure that the
  2235.     attrs parameter passed to SetResAttrs doesn't change the 
  2236.     current setting of this attribute.
  2237.  
  2238.     The attributes set with SetResAttrs will be written to the resource
  2239. file when the file is updated if you follow SetResAttrs with a call to
  2240. ChangedResource. However, even if you don't call ChangedResource for
  2241. this resource, the change may be written to the resource file when the
  2242. file is updated. See the last warning for SetResInfo (above).
  2243.  
  2244.     If the given handle isn't a handle to a resource, SetResAttrs will
  2245. do nothing and the ResError function will return the result code
  2246. resNotFound.
  2247.  
  2248.  
  2249. \ ChangedResource
  2250. 1
  2251. PROCEDURE ChangedResource (theResource: Handle);
  2252.  
  2253.     Call ChangedResource after changing either the information about a
  2254. resource in the resource map (as described above under SetResInfo and
  2255. SetResAttrs) or the resource data for a resource, if you want the
  2256. change to be permanent. Given a handle to a resource, ChangedResource
  2257. sets the resChanged attribute for the resource. This attribute tells
  2258. the Resource Manager to do both of the following:
  2259.  
  2260.     - write the resource data for the resource to the resource file when
  2261.       the file is updated or when WriteResource is called
  2262.  
  2263.     - write the entire resource map to the resource file when the file
  2264.       is updated.
  2265.  
  2266. (warning)
  2267.     If you change information in the resource map with
  2268.     SetResΘnfo or SetResAttrs and then call ChangedResource,
  2269.     remember that not only the resource map but also the
  2270.     resource data will be written out when the resource file
  2271.     is updated.
  2272.  
  2273.     To change the resource data for a purgeable resource and make the
  2274. change permanent, you have to take special precautions to ensure that
  2275. the resource won't be purged while you're changing it. You can make
  2276. the resource temporarily unpurgeable and then write it out with
  2277. WriteResource before making it purgeable again. You have to use the
  2278. Memory Manager procedures  HNoPurge and HPurge to make the resource
  2279. unpurgeable and purgeable; SetResAttrs can't be used because it won't
  2280. take effect immediately. For example:
  2281.  
  2282.     myHndl := GetResource(type,ID;  {or LoadResource(myHndl) if  }
  2283.                     { you've gotten it previously}
  2284.     HNoPurge(myHndl);       {make it unpurgeable}
  2285.       . .  .          {make the changes here}
  2286.     ChangedResource(myHndl);    {mark it changed}
  2287.         WriteResource(myHndl);      {write it out}
  2288.     HPurge(myHndl)          {make it purgeable again}
  2289.  
  2290.     Or, instead of calling WriteResource to write the data out
  2291. immediately, you can call SetResPurge(TRUE) before making any changes to
  2292. purgeable resource data.
  2293.  
  2294. ChangedResource does nothing in the following cases:
  2295.  
  2296.     - The given handle isn't a handle to a resource. The ResError
  2297.       function will return the result code resNotFound.
  2298.  
  2299.     - Sufficient space for the modified resource file can't be reserved
  2300.       on the disk. ResError will return an appropriate Operating System
  2301.       result code.
  2302.  
  2303. (warning)
  2304.     Be aware that ChangedResource (and not WriteResource)
  2305.     checks to see if there's sufficient disk space to write
  2306.     out the modified file; it there isn't enough space, the 
  2307.     resChanged attribute won't be set. This means that when 
  2308.     Write Resource is called,it won't know that the resource
  2309.     file has been changed; it won't write out the modified
  2310.     file and no error will be returned. For this reason,
  2311.     always check to see that ChangedResource returns noErr.
  2312.  
  2313.  
  2314. \ AddResource
  2315. 1
  2316. PROCEDURE AddResource (theData: Handle; theType: ResType; theID:
  2317.         INTEGER; name: Str255);
  2318.  
  2319.     Given a handle to data in memory (not a handle to an existing
  2320. resource), AddResource adds to the current resource file a resource
  2321. reference that points to the data. It sets the resChanged attribute
  2322. for the resource, so the data will be written to the resource file when
  2323. the file is updated or when WriteResource is called. If the given
  2324. handle is empty, zero-length resource data will be written.
  2325. AddResource does nothing in the following cases:
  2326.  
  2327.     - The given handle is NIL or is already a handle to an existing
  2328.       resource. The ResError function will return the result code
  2329.       addResFailed.
  2330.  
  2331.     - The resource map becomes too large to fit in memory or sufficient
  2332.       space for the modified resource file can't be reserved on the 
  2333.       disk. ResError will return an appropriate Operating System result
  2334.       code.
  2335.  
  2336. (warning)
  2337.     AddResource doesn't verify whether the resource ID you've
  2338.     passed is already assigned to another resource of the
  2339.     same type; be sure to call UniqueID before adding a
  2340.     resource.
  2341.  
  2342.  
  2343. \ RmveResource
  2344. 1
  2345. PROCEDURE RmveResource (theResource: Handle);
  2346.  
  2347.     Given a handle to a resource in the current resource file,
  2348. RmveResource removes the resource reference to the resource. The
  2349. resource data will  be removed from the resource file when the file is
  2350. updated.
  2351.  
  2352. (note)
  2353.     RmveResource doesn't release the memory occupied by the 
  2354.     resource data; to do that, call the Memory Manager
  2355.     procedure DisposHandle after calling RmveResource.
  2356.  
  2357.     If the resProtected attribute for the resource is set or if the
  2358. given handle isn't a handle to a resource in the current resource file, 
  2359. Rmve Resource will do nothing and the ResError function will return the
  2360. result code rmvResFailed.
  2361.  
  2362.  
  2363. \ UpdateResFile
  2364. 1
  2365. PROCEDURE UpdateResFile (refNum: INTEGER);
  2366.  
  2367.     Given the reference number of a resource file, UpdateResFile does
  2368. the following:
  2369.  
  2370.     - Changes, adds, or removes resource data in the file as appropriate
  2371.       to match the map. Remember that changed resource data is written
  2372.       out only if you called ChangedResource (and the call was
  2373.       successful); if you did, the resource data will be written out
  2374.       with WriteResource.
  2375.  
  2376.     - Compacts the resource file, closing up any empty space created
  2377.       when a resource was removed or made larger. (If the size of a
  2378.       changed resource is greater than its original size in the resource
  2379.       file, it's written at the end of the file rather than at its
  2380.       original location; the space occupied by the original is then
  2381.       compacted.)  UpdateResFile doesn't close up any empty space
  2382.       created when a resource is made smaller.
  2383.  
  2384.     - Writes out the resource map of the resource file, if you ever
  2385.       called ChangedResource for any resource in the file or if you
  2386.       added or removed a resource. All changes to resource information
  2387.       in the map will become permanent as a result of this, so if you
  2388.       want any such changes to be temporary, you must restore the
  2389.       original information before calling UpdateResFile.
  2390.  
  2391.     If there's no open resource file with the given reference number,
  2392. UpdateResFile will do nothing and the ResError function will return the
  2393. result code resFNotFound. A refNum of » represent the system resource
  2394. file.
  2395.  
  2396.     The CloseResFile procedure calls UpdateResFile before it closes the
  2397. resource file, so you only need to call UpdateResFile yourself if you
  2398. want to update the file without closing it.
  2399.  
  2400.  
  2401. \ WriteResource
  2402. 1
  2403. PROCEDURE WriteResource (theResource: Handle);
  2404.  
  2405.     Given a handle to a resource, WriteResource checks the resChanged
  2406. attribute for that resource and, if it's set (which it will be if you 
  2407. called ChangedResource or AddResource successfully), writes its
  2408. resource data to the resource file and clears its resChanged attribute.
  2409.  
  2410. (warning)
  2411.     Be aware that ChangedResource (and not WriteResource)
  2412.     determines if sufficient disk space is available to write
  2413.     out the modified file; if there isn't it will clear the 
  2414.     resChanged attribute and WriteResource will be unaware of
  2415.     the modifications. For this reason, always verify that
  2416.     ChangedResource returns noErr.
  2417.  
  2418.     If the resource is purgeable and has been purged, zero-length
  2419. resource data will be written. WriteResource does nothing if the
  2420. resProtected attribute for the resource is set or if the given handle
  2421. isn't a handle to a resource; in the latter case, the ResError function
  2422. will return the result code resNotFound.
  2423.  
  2424.     Since the resource file is updated when the application terminates
  2425. or when you call UpdateResFile (or CloseResFile, which calls
  2426. UpdateResFile), you only need to call WriteResource if you want to
  2427. write out just one or a few resources immediately.
  2428.  
  2429. (warning)
  2430.     The maximum size for resources to be written to a
  2431.     resource file is 32K bytes.
  2432.  
  2433.  
  2434. \ SetResPurge
  2435. 1
  2436. PROCEDURE SetResPurge (install: BOOLEAN);
  2437.  
  2438.     SetResPurge(TRUE) sets a  "hook" in the Memory Manager such that
  2439. before purging data specified by a handle,the Memory Manager will first
  2440. pass the handle to the Resource Manager. The Resource Manager will
  2441. determine whether the handle is that of a resource in the application
  2442. heap and, if so, will call WriteResource to write the resource data for
  2443. that resource to the resource file if its resChanged attribute is set
  2444. (see ChangedResource and WriteResource above). SetResPurge(FALSE)
  2445. restores the normal state, clearing the hook so that the Memory Manager
  2446. will once again purge without checking with the Resource Manager.
  2447.  
  2448.     SetResPurge(TRUE) is useful in applications that modify purgeable
  2449. resources. You still have to make the resources temporarily
  2450. unpurgeable while making the changes, as shown in the description of
  2451. ChangedResource, but you can set the purge hook instead of writing the
  2452. data out immediately with WriteResource. Notice that you won't know 
  2453. exactly when the resources are being written out; most applications
  2454. will want more control than this. If you wish, you can set your own
  2455. such hook; for details, refer to the section "Memory Manager Data
  2456. Structures" in the Memory Manager manual.
  2457.  
  2458.  
  2459. \ GetResFileAttrs
  2460. 1
  2461. FUNCTION GetResFileAttrs (refNum: INTEGER) : INTEGER;
  2462.  
  2463.     Given the reference number of a resource file, GetResFileAttrs
  2464. returns the resource file attributes for the file. If there's no
  2465. resource file with the given reference number, GetResFileAttrs will do
  2466. nothing and the ResError function will return the result code
  2467. resFNotFound. A refNum of » represents the system resource file.
  2468.  
  2469.  
  2470. \ SetResFileAttrs
  2471. 1
  2472. PROCEDURE SetResFileAttrs (refNum: INTEGER; attrs: INTEGER);
  2473.  
  2474.     Given the reference number of a resource file, SetResFileAttrs sets
  2475. the  resource file attributes of the file to attrs. If there's no
  2476. resource file with the given reference number, SetResFileAttrs will do
  2477. nothing and the ResError function will return the result code
  2478. resFNotFound. A refNum of  » represents the system resource file, but
  2479. you shouldn't change its resource file attributes.
  2480.  
  2481.  
  2482. \ AddReference
  2483. 1
  2484. PROCEDURE AddReference (theResource: Handle; theID: INTEGER; name:
  2485.       Str255);
  2486.  
  2487.     Given a handle to a system resource, AddReference adds to the
  2488. current resource file a system reference to the resource, giving it the
  2489. ID number and name specified by the parameters. It sets the resChanged
  2490. attribute for the resource, so the reference will be written to the
  2491. resource file when the file is updated. AddReference does nothing in
  2492. the following cases:
  2493.  
  2494.     - The current resource file is the system resource file or already
  2495.       contains a system reference to the specified resource, or the
  2496.       given handle isn't a handle to a system resource. The ResError
  2497.       function will return the result code.
  2498.  
  2499.         CONST addReFailed = -195;  (AddReference failed)
  2500.  
  2501.     - The resource map becomes too large to fit in the memory or
  2502.       sufficient space for the modified resource file can't be
  2503.       reserved on the disk. ResError will return an appropriate
  2504.       »perating System result code.
  2505.  
  2506.  
  2507. \ RmveReference
  2508. 1
  2509. PROCEDURE RmveReference (theResource: Handle);
  2510.  
  2511.     Given a handle to a system resource, RmveReference removes the
  2512. system reference to the resource from the current resource file. (The
  2513. reference will be removed from the resource file when the file is
  2514. updated.)  RmveReference will do nothing and the ResError function will
  2515. return the result code.
  2516.  
  2517.         CONST rmvRefFailed = -197;  (RmveReference failed)
  2518.  
  2519. if any of the following are true:
  2520.  
  2521.     - The resProtected attribute for the resource is set.
  2522.  
  2523.     - There's no system reference to the resource in the current 
  2524.       resource file.
  2525.  
  2526.     - The given handle isn't a handle to a system resource. 
  2527.  
  2528. \ Count1Types
  2529. 1
  2530. FUNCTION Count1Types : INTEGER;
  2531.  
  2532.     Count1Types is the same as CountTypes except that it returns the
  2533. number of resource types in the current resource file only.
  2534.  
  2535. \ Get1IndType
  2536. 1
  2537. PROCEDURE Get1IndType (VAR theType: ResType; index: INTEGER);
  2538. ___________________________________________________________________
  2539.  
  2540. Assembly-language note:  The macro you invoke to call Get1IndType
  2541. from assembly language is named _Get1IxType.
  2542. ___________________________________________________________________
  2543.     Get1IndType is the same as GetIndType except that it searches the
  2544. current resource file only. Given an index ranging from 1 to
  2545. Count1Types (above), Get1IndType returns a resource type in theType.
  2546.  
  2547.     Called repeatedly over the entire range for the index, it returns
  2548. all the resource types in the current resource file. If the given
  2549. index isn╒t in the range from 1 to Count1Types, Get1IndType returns
  2550. four NUL characters (ASCII code 0).
  2551.  
  2552. \ Count1Resources
  2553. 1
  2554. FUNCTION Count1Resources (theType: ResType) : INTEGER;
  2555.  
  2556.     Count1Resources is the same as CountResources except that it returns
  2557. the total number of resources of the given type in the current resource
  2558. file only.
  2559.  
  2560. \ Get1IndResource
  2561. 1
  2562. FUNCTION Get1IndResource (theType: ResType; index: INTEGER) : Handle;
  2563. ___________________________________________________________________
  2564.  
  2565. Assembly-language note:  The macro you invoke to call
  2566. Get1IndResource from assembly language is named _Get1IxResource.
  2567. ___________________________________________________________________
  2568.     Get1IndResource is the same as GetIndResource except that it
  2569. searches the current resource file only. Given an index ranging from 1
  2570. to Count1Resources(theType), Get1IndResource returns a handle to a
  2571. resource of the given type (see Count1Resources, above). Called
  2572. repeatedly over the entire range for the index, it returns handles to
  2573. all resources of the given type in the current resource file.
  2574.  
  2575. \ Get1Resource
  2576. 1
  2577. FUNCTION Get1Resource (theType: ResType; theID: INTEGER) : Handle;
  2578.  
  2579.     Get1Resource is the same as GetResource except that it searches the
  2580. current resource file only.
  2581.  
  2582. \ Get1NamedResource
  2583. 1
  2584. FUNCTION Get1NamedResource (theType: ResType; name: Str255) : Handle;
  2585.  
  2586.     Get1NamedResource is the same as GetNamedResource except that it
  2587. searches the current resource file only.
  2588.  
  2589. \ Unique1ID
  2590. 1
  2591. FUNCTION Unique1ID (theType: ResType) : INTEGER;
  2592.  
  2593.     Unique1ID is the same as UniqueID except that the ID number it
  2594. returns is unique only with respect to resources in the current resource
  2595. file.
  2596.  
  2597. \ MaxSizeRsrc
  2598. 1
  2599. FUNCTION MaxSizeRsrc (theResource: Handle) : LONGINT;
  2600.  
  2601.     MaxSizeRsrc is similar to SizeResource except that it does not cause
  2602. the disk to be read; instead it determines the size (in bytes) of
  2603. the resource from the offsets found in the resource map.
  2604.  
  2605.     Since MaxSizeRsrc does not read from the disk, it returns only the
  2606. maximum size of the resource. In other words, you can count on the
  2607. resource not being larger than the number of bytes reported by
  2608. MaxSizeRsrc; it╒s possible, however, that the resource is actually
  2609. smaller than the resource map indicates (because the file has not
  2610. yet been compacted). If called after UpdateResFile, MaxSizeRsrc will
  2611. return the correct size of the resource.
  2612.  
  2613. \ RsrcMapEntry
  2614. 1
  2615. FUNCTION RsrcMapEntry (theResource: Handle) : LONGINT;
  2616.  
  2617.     RsrcMapEntry  provides a way to access the resource references in
  2618. the resource map. Given a handle to a resource, RsrcMapEntry returns
  2619. the offset of the resource╒s reference from the beginning of the
  2620. resource map. (For more information on resource references and the
  2621. structure of a resource map, see the section ╥Format of a Resource File╙
  2622. in the Resource Manager chapter.)  If it doesn╒t find the resource,
  2623. RsrcMapEntry returns NIL and the ResError function will return the
  2624. result code resNotFound. If you pass it a NIL handle, RsrcMapEntry
  2625. will return garbage but ResError will return the result code noErr.
  2626.  
  2627. Warning:  Since routines are provided for opening, accessing,
  2628.           and changing resources, there╒s really no reason to access
  2629.           resources directly. To avoid damaging the resource file, you
  2630.           should be extremely careful if you use RsrcMapEntry.
  2631.  
  2632.  
  2633. \ OpenRFPerm
  2634. 1
  2635. FUNCTION OpenRFPerm (fileName: Str255; vRefNum: INTEGER; permission: Byte) : INTEGER;
  2636.  
  2637.     OpenRFPerm is similar to OpenResFile except that it allows you to
  2638. specify the read/write permission of the resource file the first time
  2639. it is opened; OpenRFPerm also lets you specify in vRefNum the directory
  2640. or volume on which the file is located (see chapter 19 of this volume
  2641. for more details on directories). Permission can have any of the values
  2642. that you would pass to the File Manager; these values are given
  2643. in ╥Low-Level File Manager Routines╙ in chapter 19 of this volume.
  2644.  
  2645.     OpenRFPerm, like OpenResFile, will not open the specified file twice
  2646. it simply returns the reference number already assigned to the file.
  2647. In other words, OpenRFPerm cannot be used to open a second access
  2648. path to a resource file nor can it be used to change the permission
  2649. of an already open file. Since OpenRFPerm gives no indication of
  2650. whether the file was already open, there╒s no way to tell whether
  2651. the file╒s open permission is what you specified or what was
  2652. specified by an earlier call.
  2653.  
  2654. Note:  The shared read/write permission described in chapter 19
  2655. of this volume has no effect with OpenRFPerm since the Resource
  2656. Manager is unable to deal with a portion of a resource file.
  2657.  
  2658. \ InitGraf
  2659. 2
  2660. PROCEDURE InitGraf (globalPtr: QDPtr);
  2661.  
  2662.     Call InitGraf once and only once at the beginning of your program
  2663. to initialize QuickDraw. It initializes the QuickDraw global variables
  2664. listed below.
  2665.  
  2666.     Variable    Type        Initial Setting
  2667.     -----------------------------------------------
  2668.  
  2669.     thePort     GrafPtr     NIL
  2670.     white       Pattern     all-white pattern
  2671.     black       Pattern     all-black pattern
  2672.     gray        Pattern     50% gray pattern
  2673.     ltGray      Pattern     25% gray pattern
  2674.     dkGray      Pattern     75% gray pattern
  2675.     arrow       Cursor      pointing arrow cursor
  2676.     screenBits  BitMap      Macintosh screen, (»,»,512,342)
  2677.     randSeed    LongInt     1
  2678.  
  2679.     The globalPtr parameter tells QuickDraw where to store its global
  2680. variables, beginning with thePort. From Pascal programs, this
  2681. parameter should always be set to @the Port; assembly-language
  2682. programmers may choose any location, as long as it can accommodate the
  2683. number of bytes specified by GRAFSIZE in GRAFTYPES.TEXT (see "Using 
  2684. QuickDraw from Assembly Language").
  2685.  
  2686. (hand)
  2687.     To initialize the cursor, call InitCursor (described
  2688.     under "Cursor Handling Routines" below).
  2689.  
  2690. \ OpenPort
  2691. 2
  2692. PROCEDURE OpenPort (gp: GrafPtr);
  2693.  
  2694.     OpenPort allocates space for the given grafPort's visRgn and clipRgn 
  2695. initializes the fields of the frafPort as indicated below, and makes
  2696. the grafPort the current port (see SetPort). You must call OpenPort
  2697. before using any graf╕ort; first perform a NEW to create a grafPtr and
  2698. then use  that graf╕tr in the OpenPort call.
  2699.  
  2700.     Field       Type        Initial Setting
  2701.  
  2702.     device      INTEGER     » (Macintosh screen)
  2703.     portBits    BitMap      screenBits (see InitGraf)
  2704.     portRect    Rect        screenBits.bounds (»,»,512,342)
  2705.     visRgn      RgnHandle   handle to the rectangular region
  2706.                             (»,»,512,342)
  2707.     clipRgn     RgnHandle   handle to the rectangular region
  2708.                             (-3»»»»,-3»»»»,3»»»»,3»»»»)
  2709.     bkPat       Pattern     white
  2710.     fillPat     Pattern     black
  2711.     pnLoc       Point       (»,»)
  2712.     pnSize      Point       (1,1)
  2713.     pnMode      INTEGER     patCopy
  2714.     pnPat       Pattern     black
  2715.     pnVis       INTEGER     » (visible)
  2716.     txFont      INTEGER     » (system font)
  2717.     txFace      Style       normal
  2718.     txMode      INTEGER     srcOr
  2719.     txSize      INTEGER     » (Font Manager decides)
  2720.     spExtra     INTEGER     »
  2721.     fgColor     LongInt     blackColor
  2722.     bkColor     LongInt     whiteColor
  2723.     colrBit     INTEGER     »
  2724.     patStretch  INTEGER     »
  2725.     picSave     QDHandle    NIL
  2726.     rgnSave     QDHandle    NIL
  2727.     polySave    QDHandle    NIL
  2728.     grafProcs   QDProcsPtr  Nil
  2729.  
  2730.  
  2731. \ InitPort
  2732. 2
  2733. PROCEDURE InitPort (gp: GrafPtr);
  2734.  
  2735.     Given a pointer to a grafPort that has been opened with OpenPort,
  2736. InitPort reinitializes the fields of the grafPort and makes it the
  2737. current port (if it's not already).
  2738.  
  2739. (hand)
  2740.     InitPort does everything OpenPort does except allocate
  2741.     space for the visRgn and clipRgn.
  2742.  
  2743.  
  2744. \ ClosePort
  2745. 2
  2746. PROCEDURE ClosePort (gp: GrafPtr)
  2747.  
  2748.     ClosePort deallocates the space occupied by the given GrafPort's
  2749. visRgn and clipRgn. When you are completely through with a grafPort,
  2750. call this procedure and then dispose of the grafPort (with a DISPOSE of
  2751. the grafPtr).
  2752.  
  2753. (eye)
  2754.     If you do not call ClosePort before disposing of the
  2755.     grafPort, the memory used by the visRgn and clipRgn will
  2756.     be unrecoverable.
  2757.  
  2758. (eye)
  2759.     After calling ClosePort, be sure not use any copies of
  2760.     the visRgn or clipRgn handles that you may have made.
  2761.  
  2762.  
  2763. \ SetPort
  2764. 2
  2765. PROCEDURE SetPort (gp: GrafPtr);
  2766.  
  2767.     SetPort sets the grafPort indicated by gp to be the current port.
  2768. The global pointer thePort always points to the current port. All
  2769. QuickDraw drawing routines affect the bitMap thePort^.portBits and use
  2770. the local coordinate system of thePort^. Note that OpenPort and
  2771. InitPort do a SetPort to the given port.
  2772.  
  2773. (eye)
  2774.     Never do a SetPort to a port that has not been opened
  2775.     with OpenPort.
  2776.  
  2777.     Each port possesses its own pen and text characteristics which
  2778. remain unchanged when the port is not selected as the current port.
  2779.  
  2780.  
  2781. \ GetPort
  2782. 2
  2783. PROCEDURE GetPort (VAR gp: GrafPtr);
  2784.  
  2785.     GetPort returns a pointer to the current grafPort. If you have a
  2786. program that draws into more than one grafPort, it's extremely useful 
  2787. to have each procedure save the current grafPort (with GetPort), set
  2788. its own grafPort, do drawing or calculations, and then restore the
  2789. previous grafPort (with SetPort). The pointer to the current grafPort
  2790. is also available through the global pointer thePort, but you may
  2791. prefer to use GetPort for better readability of your program text. For
  2792. example, a procedure could do a GetPort (savePort) before setting its
  2793. own grafPort and a SetPort (savePort) afterwards to restore the
  2794. previous port.
  2795.  
  2796.  
  2797. \ GrafDevice
  2798. 2
  2799. PROCEDURE GrafDevice (device: INTEGER);
  2800.  
  2801.     GrafDevice sets thePort^.device to the given number, which
  2802. identifies the logical output device for this grafPort. The Font
  2803. Manager uses this information. The initial device number is », which
  2804. represents the Macintosh screen.
  2805.  
  2806. \ SetPortBits
  2807. 2
  2808. PROCEDURE SetPortBits (bm: BitMap);
  2809.  
  2810.     SetPortBits sets the Port^.portBits to any previously defined
  2811. bitMap. This allows you to perform all normal drawing and calculations
  2812. on a buffer other than the Macintosh screen -- for example, a 64»-by-7
  2813. output buffer for a C. Itoh printer, or a small off-screen image for
  2814. later "stamping" onto the screen.
  2815.  
  2816.     Remember to prepare all fields of the bitMap before you call
  2817. SetPortBits.
  2818.  
  2819.  
  2820. \ PortSize
  2821. 2
  2822. PROCEDURE PortSize (width, height:  INTEGER);
  2823.  
  2824.     PortSize changes the size of the current grafPort's portRect. THIS 
  2825. DOES NOT AFFECT THE SCREEN; it merely changes the size of the "active
  2826. area" of the grafPort. 
  2827.  
  2828. (hand)
  2829.     This procedure is normally called only by the Window
  2830.     Manager.
  2831.  
  2832.     The top left corner of the portRect remains at its same location;
  2833. the width and height of the portRect are set to the given width and
  2834. height. In other words, PortSize moves the bottom right corner of the
  2835. portRect to a position relative to the top left corner.
  2836.  
  2837.     PortSize does not change the clipRgn or the visRgn, nor does it
  2838. affect the local coordinate system of the grafPort: it changes only the
  2839. portRect's width and height. Remember that all drawing occurs only in 
  2840. the intersection of the portBits.bounds  and the portRect, clipped to
  2841. the visRgn and the clipRgn.
  2842.  
  2843.  
  2844. \ MovePortTo
  2845. 2
  2846. PROCEDURE MovePortTo (leftGlobal,topGlobal: INTEGER);
  2847.  
  2848.     MovePortTo changes the position of the current grafPort's portRect.
  2849. THIS DOES NOT AFFECT THE SCREEN; it merely changes the location at
  2850. which subsequent drawing inside the port will appear.
  2851.  
  2852. (hand)
  2853.     This procedure is normally called only by the Window
  2854.     Manager.
  2855.  
  2856.     The leftGlobal and topGlobal parameters set the distance between the
  2857. top left corner of portBits.bounds and the top left corner of the new
  2858. portRect. For example,
  2859.  
  2860.     MovePortTo(256,171);
  2861.  
  2862. will move the top left corner of the portRect to the center of the
  2863. screen (if portBits is the Macintosh screen) regardless of the local
  2864. coordinate system.
  2865.  
  2866. Like PortSize, MovePortTo does not change the clipRgn or the visRgn,
  2867. nor does it affect the local coordinate system of the grafPort.
  2868.  
  2869.  
  2870. \ SetOrigin
  2871. 2
  2872. PROCEDURE SetOrigin (h,v: INTEGER);
  2873.  
  2874.     SetOrigin changes the local coordinate system of the current
  2875. grafPort. THIS DOES NOT AFFECT THE SCREEN; it does, however, affect
  2876. where subsequent drawing and calculation will appear in the grafPort.
  2877. SetOrigin updates the coordinates of the portBits.bounds, the portRect,
  2878. and the visRgn. All subsequent drawing and calculation routines will
  2879. use the new coordinate system.
  2880.  
  2881.     The h and v parameters set the coordinates of the top left corner of
  2882. the portRect. All other coordinates are calculated from this point.
  2883. All relative distances among any elements in the port will remain the
  2884. same; only their absolute local coordinates will change.
  2885.  
  2886. (hand)
  2887.     SetOrigin does not update the coordinates of the clipRgn
  2888.     or the pen; these items stick to the coordinate system
  2889.     (unlike the port's structure, which sticks to the 
  2890.     screen).
  2891.  
  2892.     SetOrigin is useful for adjusting the coordinate system after a
  2893. scrolling operation. (See ScrollRect under "Bit Transfer Operations"
  2894. below.)
  2895.  
  2896.  
  2897. \ SetClip
  2898. 2
  2899. PROCEDURE SetClip (rgn: RgnHandle);
  2900.  
  2901.     SetClip changes the clipping region of the current grafPort to a
  2902. region equivalent to the given region. Note that this does not change
  2903. the region handle, but affects the clipping region itself. Since SetClip
  2904. makes a copy of the given region, any subsequent changes you make to
  2905. makes a copy of the given region, any subsequent changes you make to
  2906. that region will not affect the clipping region of the port.
  2907.  
  2908.     You can set the clipping region to any arbitrary region, to aid you
  2909. in drawing inside the grafPort. The initial clipRgn is an arbitrarily
  2910. large rectangle.
  2911.  
  2912.  
  2913. \ GetClip
  2914. 2
  2915. PROCEDURE GetClip (rgn: RgnHandle);
  2916.  
  2917.     GetClip changes the given region to a region equivalent to the
  2918. clipping region of the current grafPort. This is the reverse of what
  2919. SetClip does. Like SetClip, it does not change the region handle.
  2920.  
  2921.  
  2922. \ ClipRect
  2923. 2
  2924. PROCEDURE ClipRect (r: Rect);
  2925.  
  2926.     ClipRect changes the clipping region of the current grafPort to a
  2927. rectanble equivalent to given rectangle. Note that this does not
  2928. change the region handle, but affects the region itself.
  2929.  
  2930.  
  2931. \ BackPat
  2932. 2
  2933. PROCEDURE BackPat (pat: Pattern);
  2934.  
  2935.     BackPat sets the background pattern of the current grafPort to the
  2936. given pattern. The background pattern is used in ScrollRect and in all
  2937. QuickDraw routines that perform an "erase" operation.
  2938.  
  2939.  
  2940.  
  2941.  
  2942. \ InitCursor
  2943. 2
  2944. PROCEDURE InitCursor;
  2945.  
  2946.     InitCursor sets the current cursor to the predefined arrow cursor,
  2947. an arrow pointing north-northwest, and sets the CURSOR LEVEL to »,
  2948. making the cursor visible. The cursor level, which is initialized to »
  2949. when the system is booted, keeps track of the number of times the cursor
  2950. has been hidden to compensate for nested calls to HideCursor and
  2951. ShowCursor (below).
  2952.  
  2953.     Before you call InitCursor, the cursor is undefined (or, if set by a
  2954. previous process, it's whatever that process set it to).
  2955.  
  2956.  
  2957. \ SetCursor
  2958. 2
  2959. PROCEDURE SetCursor (crsr: Cursor);
  2960.  
  2961.     SetCursor sets the current cursor to the 16-by-16-bit image in crsr.
  2962. If the cursor is hidden, it remains hidden and will attain the new
  2963. appearnce when it's uncovered; if the cursor is already visible, it
  2964. changes to the new appearance immediately.
  2965.  
  2966.     The cursor image is initialized by InitCursor to a north-northwest
  2967. arrow, visible on the screen. There is no way to retrieve the current
  2968. cursor image.
  2969.  
  2970. \ HideCursor
  2971. 2
  2972. PROCEDURE HideCursor;
  2973.  
  2974.     HideCursor removes the cursor from the screen, restoring the bits
  2975. under it, and decrements the cursor level (which InitCursor initialized
  2976. to »). Every call to HideCursor should be balanced by a subsequent call
  2977. to ShowCursor.
  2978.  
  2979.  
  2980. \ ShowCursor
  2981. 2
  2982. PROCEDURE ShowCursor;
  2983.  
  2984.     ShowCursor increments the cursor level, which may have been
  2985. decremented by HideCursor, and displays the cursor on the screen if the
  2986. level becomes ». A call to ShowCursor should balance each previous call
  2987. to HideCursor. The level is not incremented beyond », so extra calls to
  2988. ShowCursor don't hurt.
  2989.  
  2990.     QuickDraw low-level interrupt-driven routines link the cursor with
  2991. the mouse position, so that if the cursor level is » (visible), the
  2992. cursor automatically follows the mouse. You don't need to do anything
  2993. but a ShowCursor to have a cursor track the mouse. There is  no way to
  2994. "disconnect" the cursor from the mouse; you can't force the cursor to a 
  2995. certain position, nor can you easily prevent the cursor from entering a
  2996. certain area of the screen.
  2997.  
  2998.     If the cursor has been changed (with SetCursor) while hidden,
  2999. ShowCursor presents the new cursor.
  3000.  
  3001.     The cursor is initialized by InitCursor to a north-northwest arrow,
  3002. not hidden.
  3003.  
  3004.  
  3005. \ ObscureCursor
  3006. 2
  3007. PROCEDURE ObscureCursor;
  3008.  
  3009.     ObscureCursor hides the cursor until the next time the mouse is
  3010. moved. Unlike HideCursor, it has no effect on the cursor level and must
  3011. not be balanced by a call to ShowCursor.
  3012.  
  3013. \ HidePen
  3014. 2
  3015. PROCEDURE HidePen
  3016.  
  3017.     HidePen decrements the current grafPort's pnVis field, which is 
  3018. initialized to » by OpenPort; whenever pnVis is negative, the pen does
  3019. not draw on the screen. PnVis keeps track of the number of times the
  3020. pen has been hidden to compensate for nested calls to HidePen and
  3021. ShowPen (below). HidePen is called by OpenRgn, OpenPicture, and
  3022. OpenPoly so that you can define regions, pictures, and polygons without
  3023. drawing on the screen.
  3024.  
  3025. \ ShowPen
  3026. 2
  3027. PROCEDURE ShowPen;
  3028.  
  3029.     ShowPen increment the current grafPort's pnVis field, which may have
  3030. been decremented by HidePen; if pnVis becomes », QuickDraw resumes
  3031. drawing on the screen. Extra calls to ShowPen will increment pnVis
  3032. beyond », so every call to ShowPen should be balanced by a subsequent
  3033. call to HidePen. ShowPen is called by CloseRgn, ClosePicture, and
  3034. ClosePoly.
  3035. \ GetPen
  3036. 2
  3037. PROCEDURE GetPen (VAR pt: Point);
  3038.  
  3039.     GetPen returns the current pen location, in the local coordinates of
  3040. the current grafPort.
  3041. \ GetPenState
  3042. 2
  3043. PROCEDURE GetPenState (VAR pnState: PenState);
  3044.  
  3045.     GetPenState saves the pen location, size, pattern, and mode into a
  3046. storage variable, to be restored later with SetPenState (below). This
  3047. is useful when calling short subroutines that operate in the current
  3048. port but must change the graphics pen: each such procedure can save
  3049. the pen's state when it's called, do whatever it needs to do, and
  3050. restore the previous pen state immediately before returning.
  3051.  
  3052.     The PenState data type is not useful for anything except saving the
  3053. pen's state.
  3054. \ SetPenState
  3055. 2
  3056. PROCEDURE SetPenState (pnState: PenState);
  3057.  
  3058.     SetPenState sets the pen location, size, pattern, and mode in the
  3059. current grafPort to the values stored in pnState. This is usually
  3060. called at the end of a procedure that has altered the pen parameters
  3061. and wants to restore them to their state at the beginning of the
  3062. procedure. (See GetPenState, above.)
  3063. \ PenSize
  3064. 2
  3065. PROCEDURE PenSize (width, height: INTEGER);
  3066.  
  3067.     PenSize sets the dimensions of the graphics pen in the current
  3068. grafPort. All subsequent calls to Line, LineTo, and the procedures
  3069. that draw framed shapes in the current grafPort will use the new pen
  3070. dimensions.
  3071.  
  3072.     The pen dimensions can be accessed in the variable thePort^.pnSize,
  3073. which is of type Point. If either of the pen dimensions is set to a
  3074. negative value, the pen assumes the dimensions (»,») and no drawing is
  3075. performed. For a discussion of how the pen draws, see the "General 
  3076. Discussion of Drawing" earlier in this manuel.
  3077. \ PenMode
  3078. 2
  3079. PROCEDURE PenMode (mode: INTEGER);
  3080.  
  3081.     PenMode sets the transfer mode through which the pnPat is
  3082. transferred onto the bitMap when lines or shapes are drawn. The mode
  3083. may be any one of the pattern transfer modes:
  3084.  
  3085.     patCopy     patXor      notPatCopy  notPatXor
  3086.     patOr       patBic      notPatOr    notPatBic
  3087.  
  3088.     If the mode is one of the source transfer modes (or negative), no
  3089. drawing is performed. The current pen mode can be obtained in the
  3090. variable thePort^.pnMode. The initial pen mode is patCopy, in which
  3091. the pen pattern is copied directly to the bitMap.
  3092. \ PenPat
  3093. 2
  3094. PROCEDURE PenPat (pat: Pattern);
  3095.  
  3096.     PenPat sets the pattern that is used by the pen in the current
  3097. grafPort. The standard patterns white, black, gray, ltGray and dkGray
  3098. are predefined; the initial pnPat is black. The current pen pattern
  3099. can be obtained in the variable thePort^.onPat, and this value can be
  3100. assigned (but not compared!) to any other variable of type Pattern.
  3101. \ PenNormal
  3102. 2
  3103. PROCEDURE PenNormal;
  3104.  
  3105.     PenNormal resets the initial state of the pen in the current
  3106. grafPort, as follows:
  3107.  
  3108.     Field       Setting
  3109.     -----           -------
  3110.     pnSize      (1,1)
  3111.     pnMode      patCopy
  3112.     pnPat       black
  3113.  
  3114.     The pen location is not changed.
  3115. \ MoveTo
  3116. 2
  3117. PROCEDURE MoveTo (h,v: INTEGER);
  3118.  
  3119.     MoveTo moves the pen to location  (h,v) in the local coordinates of
  3120. the current grafPort. No drawing is performed.
  3121. \ Move
  3122. 2
  3123. PROCEDURE Move (dh,dv: INTEGER);
  3124.  
  3125.     This procedure moves the pen a distance of dh horizontally and dv
  3126. vertically from its current location; it calls MoveTo(h+dh,v+dv), where
  3127. (h,v) is the current location,  The positive directions are to the
  3128. right and down. No drawing is performed.
  3129. \ LineTo
  3130. 2
  3131. PROCEDURE LineTo (h,v: INTEGER);
  3132.  
  3133.     LineTo draws a line from the current pen location to the location
  3134. specified (in local coordinates) by h and v. The new pen location is
  3135. (h,v) after the line is drawn. See the general discussion of drawing.
  3136.  
  3137.     If a region or polygon is open and being formed, its outline is
  3138. infinitely thin and is not affected by the pnSize, pnMode, or pnPat.
  3139. (See OpenRgn and OpenPoly.)
  3140. \ Line
  3141. 2
  3142. PROCEDURE Line (dh,dv: INTEGER);
  3143.  
  3144.     This procedure draws a line to the location that is a distance of dh
  3145. horizontally and dv vertically from the current pen location; it calls
  3146. LineTo(h+dh,v+dv), where (h,v) is the current location. The positive
  3147. directions are to the right and down. The pen location becomes the
  3148. coordinates of the end of the line after the line is drawn. See the
  3149. general discussion of drawing.
  3150.  
  3151.     If a region or polygon is open and being formed, its outline is
  3152. infinitely thin and is not affected by the pnSize, pnMode, or pnPat.
  3153. (See OpenRgn and OpenPoly.)
  3154. \ TextFont
  3155. 2
  3156. PROCEDURE TextFont (font:INTEGER);
  3157.  
  3158.     TextFont sets the current grafPort's font (thePort^.txFont) to the 
  3159. given font number. The initial font number is », which represents the
  3160. system font.
  3161. \ TextFace
  3162. 2
  3163. PROCEDURE TextFace (face:Style);
  3164.  
  3165.     TextFace sets the current grafPort's character style
  3166. (thePort^.txFace). The Style data type allows you to specify a set of
  3167. one or more of the following predefined constants: bold, italic,
  3168. underline, outline, shadow, condense, and extend. For example:
  3169.  
  3170.     TextFace([bold])                    {bold}
  3171.     TextFace([bold,italic]);            {bold and italic}
  3172.     TextFact(thePort^.txFace+[bold]);   {whatever it was plus bold}
  3173.     TextFace(thePort^.txFace-[bold]);   {whatever it was but not bold}
  3174.     TextFace([]);                       {normal}
  3175. \ TextMode
  3176. 2
  3177. PROCEDURE TextMode (mode: INTEGER);
  3178.  
  3179.     TextMode sets the current grafPort's transfer mode for drawing text
  3180. (thePort^.txMode). The mode should be srcOr, srcXor, or srcBic. The
  3181. initial transfer mode for drawing text is srcOR.
  3182. \ TextSize
  3183. 2
  3184. PROCEDURE TextSize (size: INTEGER);
  3185.  
  3186.     TextSize sets the current grafPort's type size (thePort^.txSize) to
  3187. the given number of points. Any size may be specified, but the result
  3188. will look best if the Font Manager has the font in that size (otherwise
  3189. it will scale a size it does have). The next best result will occur if
  3190. the given state is an even multiple of a size available for the font.
  3191. If » is specified, the Font Manager will choose one of the available
  3192. sizes -- whichever is closest to the system font size. The initial
  3193. txSize setting is ».
  3194. \ SpaceExtra
  3195. 2
  3196. PROCEDURE SpaceExtra (extra: INTEGER);
  3197.  
  3198.     SpaceExtra sets the current grafPort's spExtra field, which
  3199. specifies the number of pixels by which to widen each space in a line of
  3200. text. This is useful when text is being fully justified (that is,
  3201. aligned with both a left and a right margin). Consider, for example, a
  3202. line that contains three spaces; if there would normally be six pixels
  3203. between the end of the line and the right margin, you would call
  3204. SpaceExtra(2) to print the line with full justification. The initial
  3205. spExtra setting is ».
  3206.  
  3207. (hand)
  3208.     Space Extra will also take a negative argument, but be
  3209.     careful not to narrow spaces so much that the text is
  3210.     unreadabe.
  3211.  
  3212.  
  3213. \ DrawChar
  3214. 2
  3215. PROCEDURE DrawChar (ch: CHAR);
  3216.  
  3217.     DrawChar places the given character to the right of the pen
  3218. location, with the left end of its base line at the pen's location, and
  3219. advances the pen accordingly. If the character is not in the font, the
  3220. font's  missing symbol is drawn.
  3221. \ DrawString
  3222. 2
  3223. PROCEDURE DrawString (s: Str255);
  3224.  
  3225.     DrawString performs consecutive calls to DrawChar for each character
  3226. in the supplied string; the string is placed beginning at the current
  3227. pen location and extending right. No formatting (carriage returns, line
  3228. feeds, etc.)  is performed by QuickDraw. The pen location ends up to
  3229. the right of the last character in the string.
  3230. \ DrawText
  3231. 2
  3232. PROCEDURE DrawText (textBuf: QDPtr; firstByte,byteCount: INTEGER);
  3233.  
  3234.     DrawText draws text from an arbitrary structure in memory specified
  3235. by textBuf, starting first Byte bytes into the structure and continuing
  3236. for byteCount bytes. The string of text is placed beginning at the
  3237. current pen location and extending right. No formatting (carriage
  3238. returns, line feeds, etc.) is performed by QuickDraw. The pen location
  3239. ends up to the right of the last character in the string.
  3240. \ CharWidth
  3241. 2
  3242. FUNCTION CharWidth (ch: CHAR) : INTEGER;
  3243.  
  3244.     CharWidth returns the value that will be added to the pen horizontal
  3245. coordinate if the specified character is drawn. CharWidth includes the
  3246. effects of the stylistic variations set with TextFace; if you change
  3247. these after determining the character width but before actually drawing
  3248. the character, the  predetermined width may not be correct. If the
  3249. character is a space, CharWidth also includes the effect of SpaceExtra.
  3250. \ StringWidth
  3251. 2
  3252. FUNCTION StringWidth (s: Str255 ) : INTEGER;
  3253.  
  3254.     StringWidth returns the width of the given text string, which it
  3255. calculates by adding the CharWidths of all the characters in the string
  3256. (see above). This value will be added to the pen horizontal coordinate
  3257. if the specified string is drawn.
  3258. \ TextWidth
  3259. 2
  3260. FUNCTION TextWidth (textBuf: QDPtr; firstByte,byteCount: INTEGER) :
  3261.     INTEGER;
  3262.  
  3263.     TextWidth returns the width of the text stored in the arbitrary
  3264. structure in memory specified by textBuf, starting firstByte bytes into
  3265. the structure and continuing for byteCount bytes. It calculates the
  3266. width by adding the CharWidths of all the characters in the text. (See
  3267. CharWidth, above.)
  3268. \ GetFontInfo
  3269. 2
  3270. PROCEDURE GetFontInfo (VAR into: FontInfo);
  3271.  
  3272.     GetFontInfo returns the following information about the current
  3273. grafPort's character font, taking into consideration the style and size 
  3274. in which the characters will be drawn:  the ascent, descent, maximum
  3275. character width (the greatest distance the pen will move when a
  3276. character is drawn), and leading (the vertical distance between the
  3277. descent line and the ascent line below it), all in pixels. The
  3278. FontInfo data structure is defined as:
  3279.  
  3280.     TYPE FontInfo = RECORD
  3281.             ascent:  INTEGER;
  3282.             descent: INTEGER;
  3283.             widMax:  INTEGER;
  3284.             leading: INTEGER;
  3285.           END;
  3286. \ Forecolor
  3287. 2
  3288. PROCEDURE ForeColor (color: LongInt);
  3289.  
  3290.     ForeColor sets the foreground color for all drawing in the current
  3291. grafPort (^thePort.fgColor) to the given color. The following standard
  3292. colors are predefined:  blackColor, whiteColor, redColor, greenColor,
  3293. blueColor, cyanColor, magentaColor, and yellowColor. The initial
  3294. foreground color is blackColor.
  3295. \ BackColor
  3296. 2
  3297. PROCEDURE BackColor (color: LongInt)
  3298.  
  3299.     BackColor sets the background color for all drawing in the current
  3300. grafPort (^thePort.bkColor) to the given color.  Eight standard colors
  3301. are predefined (see ForeColor above). The initial background color is
  3302. whiteColor.
  3303. \ ColorBit
  3304. 2
  3305. PROCEDURE ColorBit (whichBit: INTEGER);
  3306.  
  3307.     ColorBit is called by printing software for a color printer, or
  3308. other color-imaging software, to set the current grafPort's colrBit
  3309. field to whichBit; this tells QuickDraw which plane of the color picture
  3310. to draw into. QuickDraw will draw into the plane corresponding to bit
  3311. number whichBit. Since QuickDraw can support output devices that have
  3312. up to 32 bits of color information per pixel, the possible range of
  3313. values for whichBit is » through 31. The initial value of the colrBit
  3314. field is ».
  3315. \ SetRect
  3316. 2
  3317. PROCEDURE SetRect (VAR r: Rect; left,top,right, bottom; INTEGER);
  3318.  
  3319.     SetRect assigns the four boundary coordinates to the rectangle. The
  3320. result is a rectangle with coordinates (left,top,right,bottom).
  3321.  
  3322.     This procedure is supplied as a utility to help you shorten your
  3323. program text. If you want a more readable text at the expense of
  3324. length, you can assign integers (or points) directly into the
  3325. rectangle's fields. There is no significant code size or execution 
  3326. speed advantage to either method; one's just easier to write, and the 
  3327. other's easier to read.
  3328. \ OffSetRect
  3329. 2
  3330. PROCEDURE OffsetRect (VAR r: Rect; dh,dv: INTEGER);
  3331.  
  3332.     OffsetRect moves the rectangle by adding dh to each horizontal
  3333. coordinate and dv to each vertical coordinate. If dh and dv are
  3334. positive, the movement is to the right and down; if either is negative,
  3335. the corresponding movement is in the opposite direction. The rectangle
  3336. retains its shape and size; it's merely moved on the coordinate plane. 
  3337. This does not affect the screen unless you subsequently call a routine
  3338. to draw within the rectangle.
  3339. \ InsetRect
  3340. 2
  3341. PROCEDURE InsetRect (VAR r: Rect; dh,dv: INTEGER);
  3342.  
  3343.     InsetRect shrinks or expands the rectangle. The left and right
  3344. sides are moved in by the amount specified by dh; the top and bottom are
  3345. moved towards the center by the amount specified by dv. If dh or dv is
  3346. negative, the appropriate pair of sides is moved outwards instead of
  3347. inwards.  The effect is to alter the size by 2*dh horizontally and 2*dv
  3348. vertically, with the rectangle remaining centered in the same place on
  3349. the coordinate plane.
  3350.  
  3351.     If the resulting width or height becomes less than 1, the rectangle
  3352. is set to the empty rectangle (»,»,»,»).
  3353. \ SectRect
  3354. 2
  3355. FUNCTION SectRect(srcRectA,srcRectB: Rect; VAR dstRect: Rect) :
  3356.     BOOLEAN;
  3357.  
  3358.     SectRect calculates the rectangle that is the intersection of the
  3359. two input rectangles, and returns TRUE if they indeed intersect or FALSE
  3360. if they do not. Rectangles that "touch" at a line or a point are not
  3361. considered intersecting, because their intersection rectangle (really,
  3362. in this case, an intersection line or point) does not enclose any bits
  3363. on the bitMap.
  3364.  
  3365.     If the rectangles do not intersect, the destination rectangle is set
  3366. to (»,»,»,»,). SectRect works correctly even if one of the source
  3367. rectangles is also the destination.
  3368. \ UnionRect
  3369. 2
  3370. PROCEDURE UnionRect (srcRectA,srcRectB: Rect; VAR dstRect: Rect);
  3371.  
  3372.     Union Rect calculates the smallest rectangle which encloses both
  3373. input rectangles. It works correctly even if one of the source
  3374. rectangles is also the destination.
  3375. \ PtInRect
  3376. 2
  3377. FUNCTION PtInRect (pt: Point; r: Rect) : BOOLEAN;
  3378.  
  3379.     PtInRect determines whether the pixel below and to the right of the
  3380. given coordinate point is enclosed in the specified rectangle, and
  3381. returns TRUE if so or FALSE if not.
  3382. \ Pt2Rect
  3383. 2
  3384. PROCEDURE Pt2Rect (ptA,ptB: Point; VAR: dstRect: Rect);
  3385.  
  3386.     Pt2Rect returns the smallest rectangle which encloses the two input
  3387. points.
  3388. \ PtToAngle
  3389. 2
  3390. PROCEDURE PtToAngle (r: Rect; pt: Point; VAR angle: INTEGER);
  3391.  
  3392.     PtToAngle calculates an integer angle between a line from the center
  3393. of the rectangle to the given point and a line from the center of the
  3394. rectangle pointing straight up (12 o'clock high). The angle is in 
  3395. degrees from » to 359, measured clockwise from 12 o'clock, with 9»
  3396. degrees at 3 o'clock, 18» at 6o'clock, and 27» at 9 o'clock. Other
  3397. angles are measured relative to the rectangle: if the line to the
  3398. given point goes through the top right corner of the rectangle, the
  3399. angle returned is 45 degrees, even if the rectangle is not square; if
  3400. it goes through the bottom right corner, the angle is 135 degrees, and
  3401. so on (see Figure 18).
  3402.  
  3403.     The angle returned might be used as input to one of the procedures
  3404. that manipulate arcs and wedges, as described below under "Graphic 
  3405. Operations on Arcs and Wedges".
  3406. \ EqualRect
  3407. 2
  3408. FUNCTION EqualRect (rectA,rectB: Rect) : BOOLEAN;
  3409.  
  3410.     EqualRect compares the two rectangles and returns TRUE if they are
  3411. equal or FALSE if not. The two rectangles must have identical boundary
  3412. coordinates to be considered equal.
  3413.  
  3414.  
  3415. \ EmptyRect
  3416. 2
  3417. FUNCTION EmptyRect (r: Rect) : BOOLEAN;
  3418.  
  3419.     EmptyRect returns TRUE if the given rectangle is an empty rectangle
  3420. or FALSE if not. A rectangle is considered empty if the bottom
  3421. coordinate is equal to or less than the top or the right coordinate is
  3422. equal to or less than the left.
  3423. \ FrameRect
  3424. 2
  3425. PROCEDURE FrameRect (r: Rect);
  3426.  
  3427.     FrameRect draws a hollow outline just inside the specified rectangle
  3428. using the current grafPort's pen pattern, mode, and size. The outline 
  3429. is as wide as the pen width and as tall as the pen height. It is drawn
  3430. with the pnPat, according to the pattern transfer mode specified by
  3431. pnMode. The pen location is not changed by this procedure.
  3432.  
  3433.     If a region is open and being formed, the outside outline of the new
  3434. rectangle is mathematically added to the region's boundary.
  3435. \ PaintRect
  3436. 2
  3437. PROCEDURE PaintRect (r: Rect);
  3438.  
  3439.     PaintRect paints the specified rectangle with the current grafPort's 
  3440. pen pattern and mode. The rectangle on the bitMap is filled with the
  3441. pnPat, according to the pattern transfer mode specified by pnMode. The
  3442. pen location is not changed by this procedure.
  3443. \ EraseRect
  3444. 2
  3445. PROCEDURE EraseRect (r: Rect);
  3446.  
  3447.     EraseRect paints the specified rectangle with the current grafPort's 
  3448. background pattern bkPat (in patCopy mode). The grafPort's pnPat and 
  3449. pnMode are ignored; the pen location is not changed.
  3450. \ InvertRect
  3451. 2
  3452. PROCEDURE InvertRect (r: Rect);
  3453.  
  3454.                 __________________________________________________________________
  3455.                      Assembly-Language note: The macro you invoke to call InvertRect
  3456.                         from  assembly language is named _InverRect.
  3457.                 __________________________________________________________________
  3458.  
  3459.     InvertRect inverts the pixels enclosed by the specified rectangle:
  3460. every white pixel becomes black and every black pixel becomes white.
  3461. The grafPort's pnPat, pnMode, and bkPat are all ignored; the pen 
  3462. location is not changed.
  3463. \ FillRect
  3464. 2
  3465. PROCEDURE FillRect (r: Rect; pat: Pattern);
  3466.  
  3467.     FillRect fills the specified rectangle with the given pattern (in
  3468. patCopy mode). The grafPort's pnPat, pnMode, and bkPat are all 
  3469. ignored; the pen location is not changed.
  3470. \ FrameOval
  3471. 2
  3472. PROCEDURE FrameOval (r: Rect);
  3473.  
  3474.     FrameOval draws a hollow outline just inside the oval that fits
  3475. inside the specified rectangle, using the current grafPort's pen
  3476. pattern, mode, and size. The outline is as wide as the pen width and as
  3477. tall as the pen height. It is drawn with the pnPat, according to the
  3478. pattern transfer mode specified by pnMode. The pen location is not
  3479. changed by this procedure.
  3480.  
  3481.     If a region is open and being formed, the outside outline of the new
  3482. oval is mathematically added to the region's boundary.
  3483. \ PaintOval
  3484. 2
  3485. PROCEDURE PaintOval (r: Rect);
  3486.  
  3487.     PaintOval paints an oval just inside the specified rectangle with
  3488. the current grafPort's pen pattern and mode. The oval on the bitMap is 
  3489. filled with the pnPat, according to the pattern transfer mode specified
  3490. by pnMode. The pen location is not changed by this procedure.
  3491. \ EraseOval
  3492. 2
  3493. PROCEDURE EraseOval (r: Rect);
  3494.  
  3495.     EraseOval paints an oval just inside the specified rectangle with
  3496. the current grafPort's background pattern bkPat (in patCopy mode). The 
  3497. grafPort's pnPat and pnMode are ignored; the pen location is not  
  3498. changed.
  3499. \ InvertOval
  3500. 2
  3501. PROCEDURE InvertOval (r: Rect);
  3502.  
  3503.     InvertOval inverts the pixels enclosed by an oval just inside the
  3504. specified rectangle: every white pixel becomes black and every black
  3505. pixel becomes white. The grafPort's pnPat, pnMode, and bkPat are all 
  3506. ignored; the pen location is not changed.
  3507. \ FillOval
  3508. 2
  3509. PROCEDURE FillOval (r: Rect; pat: Pattern);
  3510.  
  3511.     FillOval fills an oval just inside the specified rectangle with the
  3512. given pattern in patCopy mode). The grafPort's pnPat, pnMode, and 
  3513. bkPat are all ignored; the pen location is not changed.
  3514. \ FrameRoundRect
  3515. 2
  3516. PROCEDURE FrameRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER);
  3517.  
  3518.     FrameRoundRect draws a hollow outline just inside the specified
  3519. rounded-corner rectangle, using the current grafPort's pen pattern, 
  3520. mode, and size. OvalWidth and ovalHeight specify the diameters of
  3521. curvature for the corners (see Figure 19). The outline is as wide as
  3522. the pen width and as tall as the pen height. It is drawn with the
  3523. pnPat, according to the pattern transfer mode specified by pnMode. The
  3524. pen location is not changed by this procedure.
  3525.  
  3526.     If a region is open and being formed, the outside outline of the new
  3527. rounded-corner rectangle is mathematically added to the region's 
  3528. boundary.
  3529. \ PaintRoundRect
  3530. 2
  3531. PROCEDURE PaintRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER);
  3532.  
  3533.     PaintRoundREct paints the specified rounded-corner rectangle with
  3534. the current grafPort's pen pattern and mode. OvalWidth and ovalHeight
  3535. specify the diameters of curvature for the corners. The rounded-corner
  3536. rectangle on the bitMap is filled with the pnPat, according to the
  3537. pattern transfer mode specified by pnMode. The pen location is not
  3538. changed by this procedure.
  3539. \ EraseRoundRect
  3540. 2
  3541. PROCEDURE EraseRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER);
  3542.  
  3543.     EraseRoundRect paints the specified rounded-corner rectangle with
  3544. the current grafPort's background pattern bkPat (in patCopy mode).
  3545.  
  3546.     OvalWidth and ovalHeight specify the diameters of curvature for the
  3547. corners. The grafPort's pnPat and pnMode are ignored; the pen location 
  3548. is not changed.
  3549. \ InvertRoundRect
  3550. 2
  3551. PROCEDURE InvertRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER);
  3552.  
  3553.     InvertRoundRect inverts the pixels enclosed by the specified
  3554. rounded-corner rectangle: every white pixel becomes black and every
  3555. black pixel becomes white. OvalWidth and ovalHeight specify the
  3556. diameters of curvature for the corners. The grafPort's pnPat, pnMode,
  3557. and bkPat are all ignored; the pen location is not changed.
  3558. \ FillRoundRect
  3559. 2
  3560. PROCEDURE FillRoundRect (r: Rect; ovalWidth,ovalHeight: INTEGER; pat:
  3561.                             Pattern);
  3562.  
  3563.     FillRoundRect fills the specified rounded-corner rectangle with the
  3564. given pattern (in patCopy mode). OvalWidth and ovalHeight specify the
  3565. diameters of curvature for the corners. The grafPort's pnPat, pnMode, 
  3566. and bkPat are all ignored; the pen location is not changed.
  3567. \ FrameArc
  3568. 2
  3569. PROCEDURE FrameArc (r: Rect; startAngle,arcAngle: INTEGER);
  3570.  
  3571.     FrameArc draws an arc of the oval that fits inside the specified
  3572. rectangle, using the current grafPort's pen pattern, mode, and size.
  3573. StartAngle indicates where the arc begins and is treated mod 36».
  3574. ArcAngle defines the extent of the arc. The angles are given in
  3575. positive or negative degrees; a positive angle goes clockwise, while a
  3576. negative angle goes counterclockwis. Zero degrees is at l2 o'clock,
  3577. high, 9» (or -27») is at 3 o'clock, 18» (or -18») is at 6 o'clock, and
  3578. 27» (or -9») is at 9 o'clock. Other angles are measured relative to
  3579. the enclosing rectangle:  a line from the center of the rectangle
  3580. through its top right corner is at 45 degrees, even if the rectangle is
  3581. not square; a line through the bottom right corner is at 135 degrees,
  3582. and so on (see Figure 2»).
  3583.  
  3584.     The arc is as wide as the pen width and as tall as the pen height.
  3585. It is drawn with the pnPat, according to the pattern transfer mode
  3586. specified by pnMode. The pen location is not changed by this
  3587. procedure.
  3588.  
  3589. (eye)
  3590.     FrameArc differs from other QuickDraw procedures that
  3591.     frame shapes in that the arc is not mathematically added
  3592.     to the boundary of a region that is open and being
  3593.     formed.
  3594.  
  3595.  
  3596. \ PaintArc
  3597. 2
  3598. PROCEDURE PaintArc (r: Rec; startAngle,arcAngle: INTEGER);
  3599.  
  3600.     PaintArc paints a wedge of the oval just inside the specified
  3601. rectangle with the current grafPort's pen pattern and mode. StartAngle
  3602. and arcAngle define the arc of the wedge as in FrameArc. The wedge on
  3603. the bitMap is filled with the pnPat, according to the pattern transfer
  3604. mode specified by pnMode. The pen location is not changed by this
  3605. procedure.
  3606.  
  3607.  
  3608. \ EraseArc
  3609. 2
  3610. PROCEDURE EraseArc (r: Rect; startAngle,arcAngle: INTEGER);
  3611.  
  3612.     EraseArc paints a wedge of the oval just inside the specified
  3613. rectangle with the current grafPort's background pattern bkPat (in
  3614. patCopy mode). StartAngle and arcAngle define the arc of the wedge as in
  3615. FrameArc. The grafPort's pnPat and pnMode are ignored; the pen location
  3616. is not changed.
  3617. \ InvertArc
  3618. 2
  3619. PROCEDURE InvertArc (r: Rect; startAngle,arcAngle: INTEGER);
  3620.  
  3621.     InvertArc inverts the pixels enclosed by a wedge of the oval just
  3622. inside the specified rectangle:  every white pixel becomes black and
  3623. every black pixel becomes white. StartAngle and arcAngle define the
  3624. arc of the wedge as in FrameArc. The grafPort's pnPat, pnMode, and 
  3625. bkPat are all ignored; the pen location is not changed.
  3626. \ FillArc
  3627. 2
  3628. PROCEDURE FillArc (r: Rect; startAngle,arcAngle: INTEGER; pat:
  3629.     Pattern);
  3630.  
  3631.     FillArc fills a wedge of the oval just inside the specified
  3632. rectangle with the given pattern (in patCopy mode). StartAngle and
  3633. arcAngle define the arc of the wedge as in FrameArc. The grafPort's
  3634. pnPat, pnMode, and bkPat are all ignored; the pen lcoation is not
  3635. changed.
  3636. \ NewRgn
  3637. 2
  3638. FUNCTION NewRgn : RgnHandle;
  3639.  
  3640.     NewRgn allocates space for a new, dynamic, variable-size region,
  3641. initializes it to the empty region (»,»,»,»), and returns a handle to
  3642. the new region. Only this function creates new regions; all other
  3643. procedures just alter the size and shape of regions you create.
  3644. OpenPort calls NewRgn to allocate space for the port's visRgn and 
  3645. clipRgn.
  3646.  
  3647. (eye)
  3648.     Except when using visRgn or clipRgn, you MUST call NewRgn
  3649.     before specifying a region's handle in any drawing or 
  3650.     calculation procedure.
  3651.  
  3652. (eye)
  3653.     Never refer to a region without using its handle.
  3654. \ DisposeRgn
  3655. 2
  3656. PROCEDURE DisposeRgn (rgn: RgnHandle);
  3657.  
  3658.     DisposeRgn deallocates space for the region whose handle is supplied
  3659. and returns the memory used by the region to the free memory pool. Use
  3660. this only after you are completely through with a temporary region.
  3661.  
  3662. (eye)
  3663.     Never use a region once you have deallocated it, or you
  3664.     will risk being hung by dangling pointers!
  3665. \ CopyRgn
  3666. 2
  3667. PROCEDURE CopyRgn (srcRgn,dstRgn: RgnHandle);
  3668.  
  3669.     CopyRgn copies the mathematical structure of arcRgn into dstRgn;
  3670. that is, it makes a duplicate copy of srcRgn. Once this is done, srcRgn
  3671. may be altered (or even disposd of) without affecting dstRgn. COPYRGN
  3672. DOES NOT CREATE THE DESTINATION REGION:  you must use NewRgn to create
  3673. the dstRgn before you call CopyRgn.
  3674. \ SetEmptyRgn
  3675. 2
  3676. PROCEDURE SetEmptyRgn (rgn: RgnHandle);
  3677.  
  3678.     Set EmptyRgn destroys the previous structure of the given region,
  3679. then sets the new structure to the empty region (»,»,»,»).
  3680. \ SetRectRgn
  3681. 2
  3682. PROCEDURE SetRectRgn (rgn: RgnHandle; left,top,right,bottom: INTEGER);
  3683.  
  3684.     SetRectRgn destroys the previous structure of the given region, then
  3685. sets the new structure to the rectangle specified by left, top, right,
  3686. and bottom.
  3687.  
  3688.     If the specified rectangle is empty (i.e., left>=right or
  3689. top>=Bottom), the region is set to the empty region (»,»,»,»).
  3690. \ RectRgn
  3691. 2
  3692. PROCEDURE RectRgn (rgn: RgnHandle; r: Rect);
  3693.  
  3694.     RectRgn destroys the previous structure of the given region, then
  3695. sets the new structure to the rectangle specified by r. This is
  3696. operationally synonymous with SetRectRgn, except the input rectangle is
  3697. defined by a rectangle rather than by four boundary coordinates.
  3698. \ OpenRgn
  3699. 2
  3700. PROCEDURE OpenRgn;
  3701.  
  3702.     OpenRgn tells QuickDraw to allocate temporary space and start saving
  3703. lines and framed shapes for later processing as a region definition.
  3704. While a region is open, all calls to Line, LineTo, and the procedures
  3705. that draw framed shapes (except arcs) affect the outline of the region.
  3706. Only the line endpoints and shape boundaries affect the region
  3707. definition; the pen mode, pattern, and size do not affect it. In fact,
  3708. OpenRgn calls HidePen, so no drawing occurs on the screen while the
  3709. region is open (unless you called ShowPen just after Open Rgn, or you
  3710. called ShowPen previously without balancing it by a call to HidePen).
  3711. Since the pen hangs below and to the right of the pen location, drawing
  3712. lines with even the smallest pen will change bits that lie outside the
  3713. region you define.
  3714.  
  3715.     The outline of a region is mathematically defined and infinitely
  3716. thin, and separates the bitMap into two groups of bits:  those within
  3717. the region and those outside it. A region should consist of one or more
  3718. closed loops. Each framed shape itself constitutes a loop. Any lines
  3719. drawn with Line or LineTo should connect with each other or with a
  3720. framed shape. Even though  the on-screen presentation of a region is
  3721. clipped, the definition of a region is not; you can define a region
  3722. anywhere on the coordinate plane with complete disregard for the
  3723. location of various grafPort entities on that plane.
  3724.  
  3725.     When a region is open, the current grafPort's rgnSave field contains
  3726. a handle to information related to the region definition. If you want
  3727. to temporarily disable the collection of lines and shapes, you can save
  3728. the current value of this field, set the field to NIL, and later
  3729. restore the saved value to resume the region definition.
  3730.  
  3731. (eye)
  3732.     Do not call OpenRgn while another region is already open.
  3733.     All open regions but the most recent will behave
  3734.     strangely.
  3735. \ CloseRgn
  3736. 2
  3737. PROCEDURE CloseRgn (dstRgn: RgnHandle);
  3738.  
  3739.     CloseRgn stops the collection of lines and framed shapes, organizes
  3740. them into a region definition, and saves the resulting region into the
  3741. region indicated by dstRgn. You should perform one and only one
  3742. CloseRgn for every OpnRgn. CloseRgn calls ShowPen, balancing the
  3743. HidePen call made by OpenRgn.
  3744.  
  3745.     Here's an example of how to create and open a region, define a
  3746. barbell shape, close the region, and draw it:
  3747.  
  3748.     barbell := NewRgn;                  {make a new region}
  3749.     OpenRgn;                            {begin collecting stuff}
  3750.        SetRect(tempRect,2»,2»,3»,5»);   {form the left weight}
  3751.        FrameOval(tempRect);
  3752.        SetRect(tempRect,3»,3»,8»,4»);   {form the bar}
  3753.        FrameRect(tempRect);
  3754.        SetRect(tempRect(8»,2»,9»,5»);   {form the right weight}
  3755.        FrameOval(tempRect);
  3756.     CloseRgn(barbell);                  {we're done; save in barbell}
  3757.     FillRgn(barbell,black);             {draw it on the screen}
  3758.     DisposeRgn(barbell);                {we don't need you anymore...}
  3759. \ OffsetRgn
  3760. 2
  3761. PROCEDURE OffsetRgn (rgn: RgnHandle; dh,dv: INTEGER);
  3762.  
  3763.     OffsetRgn moves the region on the coordinate plane, a distance of dh
  3764. horizontally and dv vertically. This does not affect the screen unless
  3765. you subsequently call a routine to draw the region. If dh and dv are
  3766. positive, the movement is to the right and down; if either is negative,
  3767. the corresponding movement is in the opposite direction. The region
  3768. retains its size and shape.
  3769.  
  3770. (hand)
  3771.     OffsetRgn is an especially efficient operation, because
  3772.     most of the data defining a region is stored relative to
  3773.     rgnBBox and so isn't actually changed by OffsetRgn.
  3774. \ InsetRgn
  3775. 2
  3776. PROCEDURE InsetRgn (rgn: RgnHandle; dh,dv: INTEGER);
  3777.  
  3778.     InsetRgn shrinks or expands the region. All points on the region
  3779. boundary are moved inwards a distance of dv vertically and dh
  3780. horizontally; if dh or dv is negative, the points are moved outwards in
  3781. that direction. InsetRgn leaves the region "centered" at the same
  3782. position, but moves the outline in (for positive values of dh and dv)
  3783. or out (for negative values of dh and dv). InsetRgn of a rectangular
  3784. region works just like InsetRect.
  3785. \ SectRgn
  3786. 2
  3787. PROCEDURE SectRgn (srcRgnA,srcRgnB,dstRgn: RgnHandle);
  3788.  
  3789.     SectRgn calculates the intersection of two regions and places the
  3790. intersection in a third region. THIS DOES NOT CREATE THE DESTINATION
  3791. REGION:  you must use NewRgn to create the dstRgn before you call
  3792. SectRgn. The dstRgn can be one of the source regions, if desired.
  3793.  
  3794.     If the regions do not intersect, or one of the regions is empty, the
  3795. destination is set to the empty region (»,»,»,»).
  3796. \ UnionRgn
  3797. 2
  3798. PROCEDURE UnionRgn (srcRgnA,srcRgnB,dstRgn: RgnHandle);
  3799.  
  3800.     UnionRgn calculates the union of two regions and places the union in
  3801. a third region. THIS DOES NOT CREATE THE DESTINATION REGION:  you must
  3802. use NewRgn to create the dstRgn before you call UnionRgn. The dstRgn
  3803. can be one of the source regions, if desired.
  3804.  
  3805.     If both regions are empty, the destination is set to the empty
  3806. region (»,»,»,»).
  3807. \ DiffRgn
  3808. 2
  3809. PROCEDURE DiffRgn (srcRgnA,srcRgnB,dstRgn: RgnHandle);
  3810.  
  3811.     DiffRgn subtracts  srcRgnB from srcRgnA and places the difference in
  3812. a third region. THIS DOES NOT CREATE THE DESTINATION REGION:  You must
  3813. use NewRgn to create the dstRgn before you call DiffRgn. The dstRgn
  3814. can be one of the source regions, if desired.
  3815.  
  3816.     If the first source region is empty, the destination is set to the
  3817. empty region (»,»,»,»).
  3818. \ XorRgn
  3819. 2
  3820. PROCEDURE XorRgn (srcRgnA,srcRgnB,dstRgn: RgnHandle);
  3821.  
  3822.     XorRgn calculates the difference between the union and the
  3823. intersection of two regions and places the result in a third region.
  3824. THIS DOES NOT CREATE THE DESTINATION REGION:  you must use NewRgn to
  3825. create the dstRgn before you call XorRgn. The dstRgn can be one of the
  3826. source regions, if desired.
  3827.  
  3828.     If the regions are coincident, the destination is set to the empty
  3829. region (»,»,»,»).
  3830. \ PtInRgn
  3831. 2
  3832. FUNCTION PtInRgn (pt: Point; rgn: RgnHandle) : BOOLEAN;
  3833.  
  3834.     PtInRgn checks whether the pixel below and to the right of the given
  3835. coordinate point is within the specified region, and returns TRUE if so
  3836. or FALSE if not.
  3837. \ RectInRgn
  3838. 2
  3839. FUNCTION RectInRgn (r: Rect; rgn: RgnHandle) : BOOLEAN;
  3840.  
  3841.     RectInRgn checks whether the given rectangle intersects the
  3842. specified region, and returns TRUE if the intersection encloses at least one bit
  3843. or FALSE if not.
  3844. \ EqualRgn
  3845. 2
  3846. FUNCTION EqualRgn (rgnA,rgnB: RgnHandle) : BOOLEAN;
  3847.  
  3848. EqualRgn compares the two regions and returns TRUE if they are equal
  3849. or FALSE if not. The two regions must have identical sizes, shapes, and
  3850. locations to be considered equal. Any two empty regions are always
  3851. equal.
  3852. \ EmptyRgn
  3853. 2
  3854. FUNCTION EmptyRgn (rgn: RgnHandle) : BOOLEAN;
  3855.  
  3856.     EmptyRgn returns TRUE if the region is an empty region or FALSE if
  3857. not. Some of the circumstances in which an empty region can be created
  3858. are: a NewRgn call; a CopyRgn of an empty region; a SetRectRgn or
  3859. RectRegn with an empty rectangle as an argument; CloseRgn without a
  3860. previous OpenRgn or with no drawing after an OpenRgn; OffsetRgn of an
  3861. empty region; InsetRgn with an empty region or too large an inset;
  3862. SectRgn of nonintersecting regions; UnionRgn of two empty regions; and
  3863. DiffRgn or XorRgn of two identical or nonintersecting regions.
  3864. \ FrameRgn
  3865. 2
  3866. PROCEDURE FrameRgn (rgn: RgnHandle);
  3867.  
  3868.     FrameRgn draws a hollow outline just inside the specified region,
  3869. using the current grafPort's pen pattern, mode, and size. The outline
  3870. is as wide as the pen width and as tall as the pen height; under no
  3871. circumstances will the frame go outside the region boundary. The pen
  3872. location is not changed by this procedure.
  3873.  
  3874.     If a region is open and being formed, the outside outline of the
  3875. region being framed is mathematically added to that region's boundary.
  3876. \ PaintRgn
  3877. 2
  3878. PROCEDURE PaintRgn (rgn: RgnHandle);
  3879.  
  3880.     PaintRgn paints the specified region with the current grafPort's pen 
  3881. pattern and pen mode. The region on the bitMap is filled with the
  3882. pnPat, according to the pattern transfer mode specified by pnMode. The
  3883. pen location is not changed by this procedure.
  3884. \ EraseRgn
  3885. 2
  3886. PROCEDURE EraseRgn (rgn: RgnHandle);
  3887.  
  3888.     EraseRgn paints the specified region with the current grafPort's
  3889. background pattern bkPat (in patCopy mode). The grafPort's pnPat and 
  3890. pnMode are ignored; the pen location is not changed.
  3891. \ InvertRgn
  3892. 2
  3893. PROCEDURE InvertRgn (rgn: RgnHandle);
  3894.  
  3895.     InvertRgn inverts the pixels enclosed by the specified region: every
  3896. white pixel becomes black and every black pixel becomes white. The
  3897. grafPort's pnPat, pnMode, and bkPat are all ignored; the pen lcoation 
  3898. is not changed.
  3899. \ FillRgn
  3900. 2
  3901. PROCEDURE FillRgn (rgn: RgnHandle; pat: Pattern);
  3902.  
  3903.     FillRgn fills the specified region with the given pattern (in
  3904. patCopy mode). The grafPort's pnPat, pnMode, and bkPat are all ignored;
  3905. the pen location is not changed.
  3906. \ ScrollRect
  3907. 2
  3908. PROCEDURE ScrollRect (r: Rect; dh,dv: INTEGER; updateRgn: RgnHandle);
  3909.  
  3910.     ScrollRect shifts ("scrolls") those bits inside the intersection of
  3911. the specified rectangle, visRgn, clipRgn, portRect, and portBits.bounds.
  3912. The bits are shifted a distance of dh horizontally and dv vertically.
  3913. The positive directions are to the right and down. No other bits are
  3914. affected. Bits that are shifted out of the scroll area are lost; they
  3915. are neither placed outside the area nor saved. The grafPort's
  3916. background pattern bkPat fills the space created by the scroll. In
  3917. addition, updateRgn is changed to the area filled with bkPat (see
  3918. Figure 21).
  3919.  
  3920.     Figure 21 shows that the pen location after a ScrollRect is in a
  3921. different position relative to what was scrolled in the rectangle. The
  3922. entire scrolled item has been moved to different coordinates. To
  3923. restore it to its coordinates before the ScrollRect, you can use the
  3924. SetOrigin procedure. For example, suppose the dstRect here is the
  3925. portRect of the grafPort and its top left corner is at (95,12»).
  3926. SetOrigin(1»5,115) will offset the coordinate system to compensate for
  3927. the scroll. Since the clipRgn and pen lcoation are not offset, they
  3928. move down and to the left.
  3929. \ CopyBits
  3930. 2
  3931. PROCEDURE CopyBits (srcBits,dstBits: BitMap; srcRect,dstRect: Rect;
  3932.         mode: INTEGER; maskRgn: RgnHandle);
  3933.  
  3934.     CopyBits transfers a bit image between any two bitMaps and clips the
  3935. result to the area specified by the maskRgn parameter. The transfer
  3936. may be performed in any of the eight source transfer modes. The result
  3937. is always clipped to the maskRgn and the boundary rectangle of the
  3938. destination bitMap; if the destination bitMap is the current grafPort's 
  3939. portBits, it is also clipped to the intersection of the grafPort's 
  3940. clipRgn and visRgn. If you do not want to clip to a maskRgn, just pass
  3941. NIL for the maskRgn parameter.
  3942.  
  3943.     The dstRect and maskRgn coordinates are in terms of the
  3944. dstBits.bounds coordinate system, and the src Rect coordinates are in
  3945. terms of the srcBits.bounds coordinates.
  3946.  
  3947.     The bits enclosed by the source rectangle are transferred into the
  3948. destination rectangle according to the rules of the chosen mode. The
  3949. source transfer modes are as follows:
  3950.  
  3951.     srcCopy     srcXor      notSrcCopy  notSrcXor
  3952.     srcOr       srcBic      notSrcOr    notSrcBic
  3953.  
  3954.     The source rectangle is completely aligned with the destination
  3955. rectangles; if the rectangles are of different sizes, the bit image is
  3956. expanded or shrunk as necessary to fit the destination rectangle. For
  3957. example, if the bit image is a circle in a square source rectangle, and
  3958. the destination rectangle is not square, the bit image appears as an
  3959. oval in the destination (see Figure 22).
  3960. \ OpenPicture
  3961. 2
  3962. FUNCTION  OpenPicture (picFrame: Rect) : PicHandle;
  3963.  
  3964.     OpenPicture returns a hendle to a new picture  which has the given
  3965. rectangle as its picture frame, and tells QuickDraw to start saving as
  3966. the picture definition all calls to drawing routines and all picture
  3967. comments (if any).
  3968.  
  3969.     OpenPicture calls HidePen, so no drawing occurs on the screen while
  3970. the picture is open (unless you call ShowPen just after OpenPicture, or
  3971. you called ShowPen previously without balancing it by a call to HidePen)
  3972.  
  3973.     When a picture is open, the current grafPort's picSave field
  3974. contains a handle to information related to the picture definition. If
  3975. you want to temporarily disable the collection of routine calls and
  3976. picture comments, you can save the current value of this field, set the
  3977. field to NIL, and later restore the saved value to resume the picture
  3978. definition.
  3979.  
  3980. (eye)
  3981.     Do not call OpenPicture while another picture is already
  3982.     open.
  3983. \ ClosePicture
  3984. 2
  3985. PROCEDURE ClosePicture;
  3986.  
  3987.     ClosePicture tells QuickDraw to stop saving routine calls and
  3988. picture comments as the definition of the currently open picture. You
  3989. should perform one and only one ClosePicture for every OpenPicture.
  3990. ClosePicture calls ShowPen, balancing the HidePen call made by
  3991. OpenPicture.
  3992. \ PicComment
  3993. 2
  3994. PROCEDURE PicComment (kind,dataSize: INTEGER; dataHandle: QDHandle);
  3995.  
  3996.     PicComment inserts the specified comment into the definition of the
  3997. currently open picture.  Kind identifies the type of comment.
  3998. DataHandle is a handle to additional data if desired, and dataSize is
  3999. the size of that data in bytes. If there is no additional data for the
  4000. comment, dataHandle should be NIL and dataSize should be ». The
  4001. application that processes the comment must include a procedure to do
  4002. the processing and store a pointer to the procedure in the data
  4003. structure pointed to by the grafProcs field of the grafPort (see
  4004. "Customizing QuickDraw Operations").
  4005. \ DrawPicture
  4006. 2
  4007. PROCEDURE DrawPicture (myPicture: PicHandle; dstRect: Rect);
  4008.  
  4009.     DrawPicture draws the given picture to scale in dstRect, expanding
  4010. or shrinking it as necessary to align the borders of the picture frame
  4011. with dstRect. DrawPicture passes any picture comments to the procedure
  4012. accessed indirectly through the grafProcs field of the grafPort (see
  4013. PicComment above).
  4014. \ KillPicture
  4015. 2
  4016. PROCEDURE KillPicture (myPicture: PicHandle);
  4017.  
  4018.     KillPicture deallocates space for the picture whose handle is
  4019. supplied, and returns the memory used by the picture to the free memory
  4020. pool. Use this only when you are completely through with a picture.
  4021. \ OpenPoly
  4022. 2
  4023. FUNCTION OpenPoly : PlyHandle;
  4024.  
  4025.     OpenPoly returns a handle to a new polygon and tells QuickDraw to
  4026. start saving the polygon definition as specified by calls to
  4027. line-drawing routines. While a polygon is open, all calls to Line and
  4028. LineTo affect the outline of the polygon. Only the line endpoints
  4029. affect the polygon definition; the pen mode, pattern, and size do not
  4030. affect it. In fact OpenPoly calls HidePen, so no drawing occurs on the
  4031. screen while the polygon is open (unless you call ShowPen just after
  4032. OpenPoly, or you called ShowPen previously without balancing it by a
  4033. call to HidePen).
  4034.  
  4035.     A polygon should consist of a sequence of connected lines. Even
  4036. though the on-screen presentation of a polygon is clipped, the
  4037. definition of a polygon is not; you can define a polygon anywhere on the
  4038. coordinate plane with complete disregard for the location of various
  4039. grafPort entities on that plane.
  4040.  
  4041.     When a polygon is open, the current grafPort's polySave field
  4042. contains a handle to information related to the polygon definition. If
  4043. you want to temprarily disable the polygon definition, you can save the
  4044. current value of this field, set the field to NIL, and later restore the
  4045. saved value to resume the polygon definition.
  4046.  
  4047. (eye)
  4048.     Do not call OpenPoly while another polygon is already
  4049.     open.
  4050. \ ClosePoly
  4051. 2
  4052. PROCEDURE ClosePoly;
  4053.  
  4054.     ClosePoly tells QuickDraw to stop saving the definition of the
  4055. currently open polygon and computes the polyBBox rectangle. You should
  4056. perform one and only one ClosePoly for every OpenPoly. ClosePoly calls
  4057. ShowPen, balancing the HidePen call made by OpenPoly.
  4058.  
  4059.     Here's an example of how to open a polygon, define it as a triangle, 
  4060. close it, and draw it:
  4061.  
  4062.     triPoly := OpenPoly;    {save handle and begin collecting stuff}
  4063.       MoveTo (3»»,1»»);     { move to first point and }
  4064.       LineTo(4»»,2»»);      {      form       }
  4065.       LineTo(2»»,2»»);      {       the           }
  4066.       LineTo(3»»,1»»);      {     triangle    }
  4067.     ClosePoly;              {stop collecting stuff}
  4068.     FillPoly(triPoly,gray); {draw it on the screen}
  4069.     KillPoly(triPoly);      {we're all done}
  4070. \ KillPoly
  4071. 2
  4072. PROCEDURE KillPoly (poly: PolyHandle);
  4073.  
  4074.     KillPoly deallocates space for the polygon whose handle is supplied,
  4075. and returns the memory used by the polygon to the free memory pool.
  4076. Use this only after you are completely through with a polygon.
  4077. \ OffsetPoly
  4078. 2
  4079. PROCEDURE OffsetPoly (poly: PolyHandle; dh,dv: INTEGER);
  4080.  
  4081.     OffsetPoly moves the polygon on the coordinate plane, a distance of
  4082. dh horizontally and dv vertically. This does not affect the screen
  4083. unless your subsequently call a routine to draw the polygon. If dh and
  4084. dv are positive, the movement is to the right and down; if either is
  4085. negative, the corresponding movement is in the opposite direction. The
  4086. polygon retains its shape and size.
  4087.  
  4088. (hand)
  4089.     OffsetPoly is an especially efficient operation, because
  4090.     the data defining a polygon is stored relative to
  4091.     polyStart and so isn't actually changed by OffsetPoly.
  4092. \ FramePoly
  4093. 2
  4094. PROCEDURE FramePoly (poly: PolyHandle);
  4095.  
  4096.     FramePoly plays back the line-drawing routine calls that define the
  4097. given polygon, using the current grafPort's pen pattern, mode, and 
  4098. size. The pen will hang below and to the right of each point on the
  4099. boundary of the polygon; thus, the polygon drawn will extend beyond the
  4100. right and bottom edges of poly^^.polyBBox by the pen width and pen
  4101. height, respectively. All other graphic operations occur strictly
  4102. within the boundary of the polygon, as for other shapes. You can see
  4103. this difference in Figure 23, where each of the polygons is shown with
  4104. its polyBBox.
  4105.  
  4106.     If a polygon is open and being formed, FramePoly affects the outline
  4107. of the polygon just as if the line-drawing routines themselves had been
  4108. called. If a region is open and being formed, the outside outline of
  4109. the polygon being framed is mathematically added to the region's
  4110. boundary.
  4111. \ PaintPoly
  4112. 2
  4113. PROCEDURE PaintPoly (poly: PolyHandle);
  4114.  
  4115.     PaintPoly paints the specified polygon with the current grafPort's
  4116. pen pattern and pen mode. The polygon on the bitMap is filled with the
  4117. pnPat, according to the pattern transfer mode specified by pnMode. The
  4118. pen location is not changed by this procedure.
  4119. \ ErasePoly
  4120. 2
  4121. PROCEDURE ErasePoly (poly: PolyHandle);
  4122.  
  4123.     ErasePoly paints the specified polygon with the current grafPort's 
  4124. background pattern bkPat (in patCopy mode). The pnPat and pnMode are
  4125. ignored; the pen location is not changed.
  4126. \ InvertPoly
  4127. 2
  4128. PROCEDURE InvertPoly (poly: PolyHandle);
  4129.  
  4130.     InvertPoly inverts the pixels enclosed by the specified polygon:
  4131. every white pixel becomes black and every black pixel becomes white. The
  4132. grafPort's pnPat, pnMode, and bkPat are all ignored; the pen location
  4133. is not changed.
  4134. \ FillPoly
  4135. 2
  4136. PROCEDURE FillPoly (poly: PolyHandle; pat: Pattern);
  4137.  
  4138.     FillPoly fills the specified polygon with the given pattern (in
  4139. patCopy mode.)  The grafPort's pnPat, pnMode, and bkPat are all ignored;
  4140. the pen location is not changed.
  4141. \ AddPt
  4142. 2
  4143. PROCEDURE AddPt (srcPt: Point; VAR dstPt: Point);
  4144.  
  4145.     AddPt adds the coordinates of srcPt to the coordinates of dstPt, and
  4146. returns the result in dstPt.
  4147. \ SubPt
  4148. 2
  4149. PROCEDURE SubPt (srcPt: Point; VAR dstPt: Point);
  4150.  
  4151.     SubPt subtracts the coordinates of srcPt from the coordinates of
  4152. dstPt, and returns the result in dstPt.
  4153. \ SetPt
  4154. 2
  4155. PROCEDURE SetPt (VAR pt: Point; h,v: INTEGER);
  4156.  
  4157.     SetPt assigns two integer coordinates to a variable of type Point.
  4158. \ EqualPt
  4159. 2
  4160. FUNCTION EqualPt (ptA,ptB: Point) : BOOLEAN;
  4161.  
  4162.     EqualPt compares the two points and returns true if they are equal
  4163. or FALSE if not.
  4164. \ LocalToGlobal
  4165. 2
  4166. PROCEDURE LocalToGlobal (VAR pt: Point);
  4167.  
  4168.     LocalToGlobal converts the given point from the current grafPort's
  4169. local coordinate system into a global coordinate system with the origin
  4170. (»,») at the top left corner of the port's bit image (such as the 
  4171. screen). This global point can then be compared to other global
  4172. points, or be changed into the local coordinates of another grafPort.
  4173.  
  4174.     Since a rectangle is defined by two points, you can convert a
  4175. rectangle into global coordinates by performing two LocalToGlobal calls,
  4176. You can also convert a rectangle, region, or polygon into global
  4177. coordinates by calling OffsetRect, OffsetRgn, or OffsetPoly. For
  4178. examples, see GlobalToLocal below.
  4179. \ GlobalToLocal
  4180. 2
  4181. PROCEDURE GlobalToLocal (VAR pt: Point);
  4182.  
  4183.     GlobalToLocal takes a point expressed in global coordinates (with
  4184. the top left corner of the bitMap as coordinate (»,»)) and converts it
  4185. into the local coordinates of the current grafPort. The global point
  4186. can be obtained with the LocalToGlobal call (see above). For example,
  4187. suppose a game draws a "ball" within a rectangle named ballRect, defined
  4188. in the grafPort named gamePort (as illustrated below in Figure 24). If
  4189. you want to draw that ball in the grafPort named selectPort, you can
  4190. calculate the ball's selectPort coordinates like this:
  4191.  
  4192.     SetPort(gamePort);                  {start in origin port}
  4193.     selectBall:= ballRect;              {make a copy to be moved}
  4194.     LocalToGlobal(selectBall.topLeft);  {put both corners into }
  4195.     LocalToGlobal(selectBall.botRight); {  global coordinates  }
  4196.  
  4197.     SetPort(selectPort);                {switch to destination port}
  4198.     GlobalToLocal(selectBall.topLeft);  {put both corners into     }
  4199.     GlobalToLocal(selectBall.botRight); {  these local coordinates }
  4200.     FillOval(selectBall,ballColor);     {now you have the ball!}
  4201.  
  4202.     You can see from Figure 24 that LocalToGlobal and GlobalToLocal
  4203. simply offset the coordinates of the rectangle by the coordinates of the
  4204. top left corner of the local grafPort's boundary rectangle. You could
  4205. also do this with OffsetRect. In fact the way to convert regions and
  4206. polygons from one coordinate system to another is with OffsetRgn or
  4207. OffsetPoly rather than LocalToGlobal and GlobalToLocal. For example,
  4208. if myRgn were a region enclosed by a rectangle having the same
  4209. coordinates as ballRect in gamePort, you could convert the region to
  4210. global coordinates with
  4211.  
  4212.     OffsetRgn(myRgn, -2», -4»);
  4213.  
  4214. and then convert it to the coordinates of the selectPort grafPort with
  4215.  
  4216.     OffsetRgn(myRgn, l5, -3»);
  4217. \ Random
  4218. 2
  4219. FUNCTION Random : INTEGR;
  4220.  
  4221.     This function returns an integer, uniformly distributedpseudo-
  4222. random, in the range from -32768 through 32767. The value returned
  4223. depends on the global variable randSeed, which InitGraf initializes to
  4224. 1; you can start the sequence over again from where it began by
  4225. resetting randSeed to 1.
  4226. \ GetPixel
  4227. 2
  4228. FUNCTION GetPixel (h,v: INTEGER) : BOOLEAN;
  4229.  
  4230.     GetPixel looks at the pixel associated with the given coordinate
  4231. point and returns TRUE if it is black or FALSE if it is white. The
  4232. selected pixel is immediately below and to the right of the point whose
  4233. coordinates are given in h and v, in the local coordinates of the
  4234. current grafPort. There is no guarantee that the specified pixel
  4235. actually belongs to the port, however; it may have been drawn by a port
  4236. overlapping the current one. To see if the point indeed belongs to the
  4237. current port, perform a PtInRgn(pt,thePort^.visRgn).
  4238. \ StuffHex
  4239. 2
  4240. PROCEDURE StuffHex (thingPtr: QDPtr; s: Str255);
  4241.  
  4242.     StuffHex pokes bits (expressed as a string of hexadecimal digits)
  4243. into any data structure. This is a good way to create cursors, patterns,
  4244. or bit images to be "stamped" onto the screen with CopyBits. For
  4245. example,
  4246.  
  4247.     StuffHex(@stripes,'»1»2»4»81»2»4»8»')
  4248.  
  4249. places a striped pattern into the pattern variable stripes.
  4250.  
  4251. (eye)
  4252.     There is no range checking on the size of the destination
  4253.     variable. It's easy to overrun the variable and destroy 
  4254.     something if you don't know what you're doing.
  4255. \ ScalePt
  4256. 2
  4257. PROCEDURE ScalePt (VAR pt: Point; srcRect,dstRect: Rect);
  4258.  
  4259.     A width and height are passed in pt; the horizontal component of pt
  4260. is the width, and the vertical component of pt is the height. ScalePt
  4261. scales these measurements as follows and returns the result in pt: it
  4262. multiplies the given width by the ratio of dstRect's width to srcRect's
  4263. width, and multiplies the given height by the ratio of dstRec's height 
  4264. to srcRect's height. In Figure 25, where dstRect's width is twice
  4265. srcRect's width and its height is three times srcRect's height, the pen
  4266. width is scaled from 3 to 6 and the pen height is scaled from 2 to 6.
  4267. \ MapPt
  4268. 2
  4269. PROCEDURE MapPt (VAR pt: Point; srcRect,dstRect: Rect);
  4270.  
  4271.     Given a point within srcRect, MapPt maps it to a similarly located
  4272. point within dstRect (that is, to where it would fall if it were part
  4273. of a drawing being expanded or shrunk to fit dstRect). The result is
  4274. returned in pt. A corner point of srcRect would be mapped to the
  4275. corresponding corner point of dstRect, and the center of srcRect to the
  4276. center of dstRect. In Figure 25 above, the point (3.2) in srcRect is
  4277. mapped to (l8,7) in dstRect. FromRect and dstRect may overlap, and pt
  4278. need not actually be within srcRect.
  4279.  
  4280. (eye)
  4281.     Remember, if you are going to draw inside the rectangle
  4282.     in dstRect, you will probably also want to scale the pen
  4283.     size accordingly with ScalePt.
  4284. \ MapRect
  4285. 2
  4286. PROCEDURE MapRect (VAR r: Rect; srcRect,dstRect: Rect);
  4287.  
  4288.     Given a rectangle within srcRect, MapRect maps it to a similarly
  4289. located rectangle within dstRect by calling MapPt to map the top left
  4290. and bottom right corners of the rectangle. The result is returned in
  4291. r.
  4292. \ MapRgn
  4293. 2
  4294. PROCEDURE MapRgn (rgn: RgnHandle; srcRect: Rect);
  4295.  
  4296.     Given a region within srcRec, MapRgn maps it to a similarly located
  4297. region within dstRect by calling MapPt to map all the points in the
  4298. region.
  4299. \ MapPoly
  4300. 2
  4301. PROCEDURE MapPoly (poly: PolyHandle; srcRect,dstRect: Rect);
  4302.  
  4303.     Given a polygon within srcRect, MapPoly maps it to a similarly
  4304. located polygon within dstRect by calling MapPt to map all the pointsthat
  4305. define the polygon.
  4306. \ SetStdProcs
  4307. 2
  4308. PROCEDURE SetStdProcs (VAR procs: QDProcs);
  4309.  
  4310.     This procedure sets all the fields of the given QDProcs record to
  4311. point to the standard low-level routines. You can then change the ones
  4312. you wish to point to your own routines. For example, if your procedure
  4313. that processes picture comments is named MyComments, you will store
  4314. @MyComments in the commentProc field of the QD Procs record.
  4315.  
  4316.     The routines you install must of course have the same calling
  4317. sequences as the standard routines, which are described below. The
  4318. standard drawing routines tell which graphic operation to perform from a
  4319. parameter of type GrafVerb.
  4320.  
  4321.     TYPE GrafVerb = (frame, paint, erase, invert, fill);
  4322.  
  4323.     When the grafVerb is fill, the pattern to use when filling is passed
  4324. in the fillPat field of the grafPort.
  4325. \ StdText
  4326. 2
  4327. PROCEDURE StdText (byteCount: INTEGER; textBuf: QDPtr; numer,denom:
  4328.         INTEGER);
  4329.  
  4330.     StdText is the standard low-level routine for drawing text. It draws
  4331. text from the arbitrary structure in memory specified by textBuf,
  4332. starting from the first byte and continuing for byteCount bytes. Numer
  4333. and denom specify the scaling, if any:  numer.v over denom.v gives the
  4334. vertical scaling, and numer.h over denom.h gives the horizontal
  4335. scaling.
  4336. \ StdLine
  4337. 2
  4338. PROCEDURE StdLine (newPt: Point);
  4339.  
  4340.     StdLine is the standard low-level routine for drawing a line. It
  4341. draws a line from the current pen location to the location specified (in
  4342. local coordinates) by newPt.
  4343. \ StdRect
  4344. 2
  4345. PROCEDURE StdRect (verb; r: Rect);
  4346.  
  4347.     StdRect is the standard low-level routine for drawing a rectangle.
  4348. It draws the given rectangle according to the specified grafVerb.
  4349. \ StdRRect
  4350. 2
  4351. PROCEDURE StdRRect (verb: GrafVerb; r: Rect; ovalwidth,ovalHeight:
  4352.                     INTEGER);
  4353.  
  4354.     StdRrect is the standard low-level routine for drawing a rounded-
  4355. corner rectangle. It draws the given rounded-corner rectangle according
  4356. to the specified grafVerb. OvalWidth and ovalHeight specify the
  4357. diameters of curvature for the corners.
  4358. \ StdOval
  4359. 2
  4360. PROCEDURE StdOval (verb: GrafVerb; r: Rect);
  4361.  
  4362.     StdOval is the standard low-level routine for drawing an oval. It
  4363. draws an oval inside the given rectangle according to the specified
  4364. grafVerb.
  4365. \ StdArc
  4366. 2
  4367. PROCEDURE StdArc (verb: GrafVerb; r: Rect; startAngle,arcAngle:
  4368.                     INTEGER);
  4369.  
  4370.     StdArc is the standard low-level routine for drawing an arc or a
  4371. wedge. It draws an arc or wedge of the oval that fits inside the given
  4372. rectangle. The grafVerb specifies the graphic operation; it it's the 
  4373. frame operation, an arc is drawn; otherwise, a wedge is drawn.
  4374. \ StdPoly
  4375. 2
  4376. PROCEDURE StdPoly (verb: GrafVerb; poly: PolyHandle);
  4377.  
  4378.     StdPoly is the standard low-level routine for drawing a polygon. It
  4379. draws the given polygon according to the specified grafVerb.
  4380. \ StdRgn
  4381. 2
  4382. PROCEDURE StdRgn (verb: GrafVerb; rgn: RgnHandle);
  4383.  
  4384.     StdRgn is the standard low-level routine for drawing a region. It
  4385. draws the given region according to the specified grafVerb.
  4386. \ StdBits
  4387. 2
  4388. PROCEDURE StdBits (VAR srcBits: BitMap; VAR srcRect,dstRect: Rect;
  4389.                     mode: INTEGER; maskRgn: RgnHandle);
  4390.  
  4391.     StdBits is the standard low-level routine for doing bit transfer.It
  4392. transfers a bit image between the given bitMap and thePort^.portBits,
  4393. just as if CopyBits were called with the same parameters and with a
  4394. destination bitMap equal to thePort^.portBits.
  4395. \ StdComment
  4396. 2
  4397. PROCEDURE StdComment (kind,dataSize: INTEGER; dataHandle: QDHandle);
  4398.  
  4399.     StdComment is the standard low-level routine for processing a
  4400. picture comment. Kind identifies the type of comment. DataHandle is a
  4401. handle to additional data, and dataSize is the size of that data in
  4402. bytes. If there is no additional data for the command, dataHandle will
  4403. be NIL and dataSize will be ». StdComment simply ignores the comment.
  4404. \ StdTxMeas
  4405. 2
  4406. FUNCTION StdTxMeas (byteCount: INTEGER; textBuf: QDPtr; VAR
  4407.                     numer,denom: Point; VAR info: FontInfo) : INTEGER;
  4408.  
  4409.     StdTxMeas is the standard low-level routine for measung text width.
  4410. It returns the width of the text stored in the arbitrary structure in
  4411. memory specified by textBuf, starting with the first byte and
  4412. continuing for byteCount bytes. Numer and denom specify the scaling as
  4413. in the StdText procedure; note that StdTxMeas may change them.
  4414. \ StdGetPic
  4415. 2
  4416. PROCEDURE StdGetPic (dataPtr: QDPtr; byteCount: INTEGER);
  4417.  
  4418.     StdGetPic is the standard low-level routine for retrieving
  4419. information from the definition of a picture. It retrieves the next
  4420. byteCount bytes from the definition of the currently open picture and
  4421. stores them in the data structure pointed to by dataPtr.
  4422. \ StdPutPic
  4423. 2
  4424. PROCEDURE StdPutPic (dataPtr: QdPtr; byteCount: INTEGER);
  4425.  
  4426.     StdPutPic is the standard low-level routine for saving information
  4427. as the definition of a picture. It saves as the definition of the
  4428. currently open picture the drawing commands stored in the data
  4429. structure pointed to by dataPtr, starting with the first byte and
  4430. continuing for the next byteCount bytes.
  4431. \ SeedFill
  4432. 2
  4433. PROCEDURE SeedFill (srcPtr,dstPtr: Ptr; srcRow, dstRow, height,
  4434.                     words,seedH,seedV: INTEGER);
  4435.  
  4436.     Given a source bit image, SeedFill computes a destination bit image
  4437. with 1╒s only in the pixels where paint can leak from the starting
  4438. seed point, like the MacPaint paint-bucket tool. SeedH and seedV
  4439. specify horizontal and vertical offsets, in pixels, from the beginning
  4440. of the data pointed to by dstPtr, determining how far into the
  4441. destination bit image filling should begin. Calls to SeedFill are not
  4442. clipped to the current port and are not stored into QuickDraw pictures.
  4443. \ CalcMask
  4444. 2
  4445. PROCEDURE CalcMask (srcPtr,dstPtr: Ptr; srcRow, dstRow, height,
  4446.                     words: INTEGER);
  4447.  
  4448.     Given a source bit image, CalcMask computes a destination bit image
  4449. with 1╒s only in the pixels where paint could not leak from any of
  4450. the outer edges, like the MacPaint lasso tool. Calls to CalcMask are
  4451. not clipped to the current port and are not stored into QuickDraw
  4452. pictures.
  4453. \ CopyMask
  4454. 2
  4455. PROCEDURE CopyMask (srcBits,maskBits,dstBits: BitMap; srcRect,
  4456.                     maskRect,dstRect: Rect);
  4457.  
  4458.     CopyMask is a new version of the CopyBits procedure; it transfers a
  4459. bit image from the source bitmap to the destination bitmap only where
  4460. the corresponding bit of the mask rectangle is a 1. (Note that
  4461. the mask is specified as a rectangle instead of as a handle to a region.)  It can be used along with CalcMask to implement the lasso copy as in MacPaint; it╒s also useful for drawing icons. CopyMask doesn╒t check for overlap between the source and destina
  4462. \ MeasureText
  4463. 2
  4464. PROCEDURE MeasureText (count: INTEGER; textAddr,charLocs: Ptr);
  4465.  
  4466.     This procedure is designed to improve performance in specialized
  4467. applications such as word processors by providing an array version of
  4468. the TextWidth function; it╒s like calling TextWidth repeatedly for a
  4469. given set of characters. TextAddr points to an arbitrary piece of text
  4470. in memory, and count specifies how many characters are to be measured.
  4471.  
  4472.     MeasureText moves along the string and, for each character, computes
  4473. the distance from TextAddr to the right edge of the character.
  4474. CharLocs should point to an array of count + 1 integers. Upon return,
  4475. the first element in the array will always contain 0; the other elements
  4476. will contain pixel positions on the screen for all of the specified
  4477. characters.
  4478.  
  4479. Note:   MeasureText only works with text displayed on the screen;
  4480.         since it doesn╒t go through the QuickDraw procedure StdText, it
  4481.         can╒t be used to measure text to be printed.
  4482.  
  4483. \ GetMaskTable
  4484. 2
  4485.     The function GetMaskTable, accessible only from assembly language,
  4486. returns in register A0 a pointer to a ROM table containing the following
  4487. useful masks:
  4488.  
  4489. .WORD $0000,$8000,$C000,$E000   ;Table of 16 right masks
  4490. .WORD $F000,$F800,$FC00,$FE00
  4491. .WORD $FF00,$FF80,$FFC0,$FFE0
  4492. .WORD $FFF0,$FFF8,$FFFC,$FFFE
  4493.  
  4494. .WORD $FFFF,$7FFF,$3FFF,$1FFF   ;Table of 16 left masks
  4495. .WORD $0FFF,$07FF,$03FF,$01FF
  4496. .WORD $00FF,$007F,$003F,$001F
  4497. .WORD $000F,$0007,$0003,$0001
  4498.  
  4499. .WORD $8000,$4000,$2000,$1000   ;Table of 16 bit masks
  4500. .WORD $0800,$0400,$0200,$0100
  4501. .WORD $0080,$0040,$0020,$0010
  4502. .WORD $0008,$0004,$0002,$0001
  4503.  
  4504. _GetMaskTable : Macro Name.
  4505. \ InitFonts
  4506. 3
  4507. PROCEDURE InitFonts;
  4508.  
  4509.     InitFonts initializes the Font Manager. If the system font isn't
  4510. already in memory, InitFonts reads it into memory. Call this procedure
  4511. once before all other Font Manager routines or any Toolbox routine that
  4512. will call the Font Manager.
  4513. \ GetFontName
  4514. 3
  4515. PROCEDURE GetFontName (fontNum: INTEGER; VAR theName: Str255);
  4516.  
  4517.     GetFontName returns in theName the name of the font having the font
  4518. number fontNum. If there's no such font, GetFontName returns the empty
  4519. string.
  4520. \ GetFNum
  4521. 3
  4522. PROCEDURE GetFNum (fontName: Str255; VAR theNum: INTEGER);
  4523.  
  4524.     GetFNum returns in theNum the font number for the font having the
  4525. given fontName. If there's no such fone getFNum returns ».
  4526. \ RealFont
  4527. 3
  4528. FUNCTION RealFont (fontNum: INTEGER; size: INTEGER) : BOOLEAN;
  4529.  
  4530.     RealFont returns TRUE if the font having the font number fontNum is
  4531. available in the given size in a resource file, or FALSE if the font
  4532. has to be scaled to that size.
  4533. \ SetFontLock
  4534. 3
  4535. PROCEDURE SetFontLock (lockFlag: BOOLEAN);
  4536.  
  4537.     SetFontLock applies to the font in which text was most recently
  4538. drawn; it makes the font unpurgeable if lockFlag is TRUE or purgeable if
  4539. lockFlag is FALSE. Since fonts are normally purgeable, this procedure
  4540. is useful for making a font temporarily unpurgeable.
  4541. \ SwapFont
  4542. 3
  4543. FUNCTION SwapFont (inRec: FMInput) : FMOutPtr;
  4544.  
  4545.     SwapFont returns a pointer to an FMOutput record containing the
  4546. size, style, and other information about an adapted version of the font
  4547. requested in the given FMInput record. (FMInput and FMOutput records
  4548. are explained in the following section.)  SwapFont is called by
  4549. QuickDraw every time a QuickDraw routine that does anything with text
  4550. is used. If you want to call SwapFont yourself, you must build an
  4551. FMInput record and then use the returned pointer to access the
  4552. resulting FMOutput record.
  4553. \ FontMetrics
  4554. 3
  4555. PROCEDURE FontMetrics (VAR theMetrics: FMetricRec);
  4556.  
  4557.     FontMetrics is similar to the QuickDraw procedure GetFontInfo except
  4558. that it returns fixed-point values for greater accuracy in
  4559. high-resolution printing.
  4560.  
  4561. The FMetricRec data structure is defined as follows:
  4562.  
  4563. TYPE FMetricRec = RECORD
  4564.          ascent:    Fixed;  {ascent}
  4565.          descent:   Fixed;  {descent}
  4566.          leading:   Fixed;  {leading}
  4567.          widMax:    Fixed;  {maximum character width}
  4568.          wTabHandle:    Handle; {handle to global width table}
  4569.        END;
  4570.  
  4571.     Ascent, descent, leading, and widMax are identical in function to
  4572. their counterparts in GetFontInfo. WTabHandle is a handle to the
  4573. global width table (described below).
  4574.  
  4575. \ SetFractEnable
  4576. 3
  4577. PROCEDURE SetFractEnable (fractEnable: BOOLEAN)   [Not in ROM]
  4578.  
  4579.     SetFractEnable lets you enable or disable fractional character
  4580. widths. If fractEnable is TRUE, fractional character widths are enabled;
  4581. if it╒s FALSE, the Font Manager uses integer widths. To ensure
  4582. compatibility with existing applications, fractional character widths
  4583. are disabled by default.
  4584. ___________________________________________________________________
  4585.  
  4586. Assembly-language note:  From assembly language, you can change the
  4587. value of the global variable FractEnable.
  4588. ___________________________________________________________________
  4589. \ SetFScaleDisable
  4590. 3
  4591. PROCEDURE SetFScaleDisable (fontScaleDisable: BOOLEAN);
  4592.  
  4593.     SetFScaleDisable lets you disable or enable font scaling.
  4594. If fontScaleDisable is TRUE, font scaling is disabled and
  4595. the Font Manager returns an unscaled font with more space around
  4596. the characters; if it╒s FALSE, the Font Manager scales fonts.
  4597. To ensure compatibility with existing applications, the Font Manager
  4598. defaults to scaling fonts.
  4599.  
  4600.     ______________________________________________________________
  4601.     Assembly-language note:  All programmers should use the
  4602.     SetFScaleDisable procedure to disable and enable font scaling.
  4603.     In particular, setting the global variable FScaleDisable is
  4604.     insufficient.
  4605.     ______________________________________________________________
  4606. \ GetNextEvent
  4607. 4
  4608. FUNCTION GetNextEvent (eventMask: INTEGER; VAR theEvent: EventRecord)
  4609.                         : BOOLEAN;
  4610.  
  4611.     GetNextEvent returns the next available event of a specified type or
  4612. types and, if the event is in the event queue, removes it from the
  4613. queue. The event is returned as the value of the parameter theEvent.
  4614. The eventMask parameter specifies which event types are of interest.
  4615. GetNextEvent returns the next available event of any type designated by
  4616. the mask, subject to the priority rules discussed above under "Priority
  4617. of Events". If no event of any of the designated types is available,
  4618. GetNextEvent returns a null event.
  4619.  
  4620. (note)
  4621.     Events in the queue that aren't designated in the mask 
  4622.     are kept in the queue; if you want to remove them, you
  4623.     can do so by calling the Operating System Event Manager
  4624.     procedure FlushEvents.
  4625.  
  4626.     Before reporting an event to your application, GetNextEvent first
  4627. calls the Desk Manager function System Event to see whether the system
  4628. wants to intercept and respond to the event. If so, or if the event
  4629. being reported is a null event, GetNextEvent returns a function result
  4630. of FALSE; a function result of TRUE means that your application should
  4631. handle the event itself. The Desk Manager intercepts the following
  4632. events:
  4633.  
  4634.     - activate and update events directed to a desk accessory
  4635.  
  4636.     - keyboard events if the currently active window belongs to a desk
  4637.       accessory
  4638.  
  4639. (note)
  4640.     In each case, the event is intercepted by the Desk
  4641.     Manager only if the desk accessory can handle that type
  4642.     of event; however, as a rule all desk accessories should
  4643.     be set up to handle activate, update, and keyboard
  4644.     events.
  4645.  
  4646.     The Desk Manager also intercepts disk-inserted events:  It attempts
  4647. to mount the volume on the disk by calling the File Manager function
  4648. MountVol. GetNextEvent will always return TRUE in this case, though,
  4649. so that your application can take any further appropriate action after
  4650. examining the result code returned by MountVol in the event message.
  4651. (See the Desk Manager and File Manager manuals for further details.)
  4652. GetNextEvent returns TRUE for all other non-null events (including all
  4653. mouse-down events, regardless of which window is active), leaving them
  4654. for your application to handle.
  4655.  
  4656.     GetNextEvent also makes the following processing happen, invisible
  4657. to your program:
  4658.  
  4659.    -If the "alarm" is set and the current time is the alarm time, the
  4660.     alarm goes off (a beep followed by blinking the title of the Apple
  4661.     menu). The user can set the alarm with the Alarm Clock desk
  4662.     accessory.
  4663.  
  4664.    -If the user holds down the Command and Shift keys while pressing a
  4665.     numeric key that has a special effect, that effect occurs. The
  4666.     standard such keys are 1 and 2 for ejecting the disk in the
  4667.     internal or external drive, and 3 and 4 for writing a snapshot of
  4668.     the screen to a MacPaint document or to the printer.
  4669.  
  4670.  (note)
  4671.     Advanced programmers can implement their own code to be
  4672.     executed in response to Command-Shift-number combinations
  4673.     (except for Command-Shift-l and 2, which can't be 
  4674.     changed). The code corresponding to a particular number
  4675.     must be a routine having no parameters, stored in a
  4676.     resource whose type is 'FKEY' and whose ID is the number.
  4677.     The system resource file contains code for the numbers 3
  4678.     and 4.
  4679. \ EventAvail
  4680. 4
  4681. FUNCTION EventAvail (eventMask: INTEGER; VAR theEvent: EventRecord) :
  4682.     BOOLEAN;
  4683.  
  4684.     EventAvail works exactly the same as GetNextEvent except that if the
  4685. event is in the event queue, it's left there.
  4686.  
  4687. (note)
  4688.     An event returned by EventAvail will not be accessible
  4689.     later if in the meantime the queue becomes full and the
  4690.     event is discarded from it; since the events discarded
  4691.     are always the oldest ones in the queue, however, this
  4692.     will happen only in an unusually busy environment.
  4693. \ GetMouse
  4694. 4
  4695. PROCEDURE GetMouse (VAR mouseLoc: Point);
  4696.  
  4697.     GetMouse returns the current mouse location in the mouseLoc
  4698. parameter. The location is given in the local coordinate system of the
  4699. current grafPort (which might be, for example, the currently active
  4700. window). Notice that this differs from the mouse location stored in the
  4701. where field of an event record; that location is always in global
  4702. coordinates.
  4703. \ Button
  4704. 4
  4705. FUNCTION Button : BOOLEAN;
  4706.  
  4707.     The Button function returns TRUE if the mouse button is currently
  4708. down, and FALSE if it isn't.
  4709. \ Stilldown
  4710. 4
  4711. FUNCTION StillDown : BOOLEAN;
  4712.  
  4713.     Usually called after a mouse-down event, StillDown tests whether the
  4714. mouse button is still down. It returns TRUE if the button is currently
  4715. down and there are no more mouse events pending in the event queue.
  4716. This is a true test of whether the button is still down from the
  4717. original press--unlike Button (above), which returns TRUE whenever the
  4718. button is currently down, even it ift has been released and pressed
  4719. again since the original mouse-down event.
  4720. \ WaitMouseUp
  4721. 4
  4722. FUNCTION WaitMouseUp ) BOOLEAN;
  4723.  
  4724.     WaitMouseUp works exactly the same as StillDown (above), excent that
  4725. if the button is not still down from the original press, WaitMouseUp
  4726. removes the preceding mouse-up event before returning FALSE. If, for
  4727. instance, your application attaches some special significance both to
  4728. mouse double-clicks and to mouse-up events, this function would allow
  4729. your application to recognize a double-click without being confused by
  4730. the intervening mouse-up.
  4731. \ GetKeys
  4732. 4
  4733. PROCEDUREGetKeys (VAR theKeys: KeyMap);
  4734.  
  4735.     GetKeys reads the current state of the keyboard (and keypad, if any)
  4736. and returns it in the form of a keyMap:
  4737.  
  4738.     TYPE KeyMap = PACKED ARRAY [»..127] OF BOOLEAN;
  4739.  
  4740.     Each key on the keyboard or keypad corresponds to an element in the
  4741. keyMap. The index into the keyMap for a particular key is the same as
  4742. the key code for that key. (The key codes are shown in Figure 3
  4743. above.)  The keyMap element is TRUE if the corresponding key is down
  4744. and FALSE if it isn't. The maximum number of keys that can be down 
  4745. simultaneously is two character keys plus any combination of the four
  4746. modifier keys.
  4747. \ TickCount
  4748. 4
  4749. FUNCTION TickCount : LONGINT;
  4750.  
  4751.     TickCount returns the current number of ticks (sixtieths of a
  4752. second) since the system was last started up.
  4753. \ GetDblTime
  4754. 4
  4755. FUNCTION GetDblTime : LONGINT; [No trap macro]
  4756.  
  4757.     GetDblTime returns the suggested maximum difference (in ticks) that
  4758. should exist between the times of a mouse-up event and a mouse-down
  4759. event for those two mouse clicks to be considered a double-click. The
  4760. user can adjust this value by means of the Control Panel desk
  4761. accessory.
  4762. \ GetCaretTime
  4763. 4
  4764. FUNCTION GetCaretTime : LONGINT; [No trap macro]
  4765.  
  4766.     GetCareTime returns the time (in ticks) between blinks of the
  4767. "caret" (usually a vertical bar) marking an insertion point in editable
  4768. text. If you aren't using TextEdit, you'll need to cause the caret to
  4769. blink yourself; on every pass through your program's main event loop,
  4770. you should check this value against the elapsed time since the last
  4771. blink of the caret. The user can adjust this value by means of the
  4772. Control Panel desk accessory.
  4773. \ InitWindows
  4774. 5
  4775. PROCEDURE InitWindows;
  4776.  
  4777.     InitWindows initializes the Window Manager. It creates the Window
  4778. Manager port; you can get a pointer to this port with the GetWMgrPort
  4779. procedure. InitWindows draws the desktop and the (empty menu bar.
  4780. Call this procedure once berore all other Window Manager routines.
  4781.  
  4782. (note)
  4783.     InitWindows creates the Window Manager port as a
  4784.     nonrelocatable block in the application heap. For
  4785.     information on how this may affect your application's use
  4786.     of memory, see the Memory Manager manual. ***(A section
  4787.     on how to survive with limited memory will be added to
  4788.     that manual.) ***
  4789. \ GetWMgrPort
  4790. 5
  4791. PROCEDURE GetWMgrPort (VAR wPort:  GrafPtr);
  4792.  
  4793.     GetWMgrPort returns in wPort a pointer to the Window Manager port.
  4794. \ NewWindow
  4795. 5
  4796. FUNCTION NewWindow (wStorage: Ptr; boundsRect: Rect; title: Str255;
  4797.                     visible: BOOLEAN; procID: Integer;behind: WindowPtr;
  4798.                     goAway Flag: BOOLEAN; refCon: LongInt) : WindowPtr;
  4799.  
  4800.     NewWindow creates a window as specified by its parameters, adds it
  4801. to the window list, and returns a windowPtr to the new window. It
  4802. allocates space for the structure and content regions of the window and
  4803. asks the window definition function to calculate those regions.
  4804.  
  4805.     WStorage is a pointer to where to store the window record. For
  4806. example, if you've declared the variable wRecord of type WindowRecord,
  4807. you can pass @wRecord as the first parameter to NewWindow. If you pass
  4808. NIL for wStorage, the window record will be allocated on the heap; in
  4809. that case, though, the record will be nonrelocatable, and so you risk
  4810. ending up with a fragmented heap. You should therefore not pass NIL
  4811. for wStorage unless your program has an unusually large amount of
  4812. memory available or has been set up to dispose of windows dynamically.
  4813. Even then, you should avoid passing NIL for wStorage if there's no 
  4814. limit to the number of windows that your application can open. ***
  4815. (Some of this may be moved to the Memory Manager manual when that
  4816. manual is updated to have a section on how to survive with limited
  4817. memory.) ***
  4818.  
  4819.     BoundsRect, a rectangle given in global coordinates, determines the
  4820. window's size and location. It becomes the portRect of the window's
  4821. grafPort; note, however, that the portRect is in local coordinates.
  4822. New Window makes the QuickDraw call SetOrigin(»,»), so that the top left
  4823. corner of the portRect will be (»,»).
  4824.  
  4825. (note)
  4826.     The bitMap, pen pattern, and other characteristics of the
  4827.     window's grafPort are the same as the default values set
  4828.     by the OpenPort procedure in QuickDraw, except for the
  4829.     character font, which is set to the application font
  4830.     rather than the system font. Note, however, that the
  4831.     SetOrigin(»,») call changes the coordinates of the
  4832.     grafPort's portBits.bounds and visRgn as well as its 
  4833.     PortRect.
  4834.  
  4835.     Title is the window's title. If the title of a document window is 
  4836. longer than will fit in the title bar, only as much of the beginning of
  4837. the title as will fit is displayed.
  4838.  
  4839.     If the visible parameter is TRUE, NewWindow draws the window. First
  4840. it calls the window definition function to draw the window frame; if
  4841. goAwayFlag is also TRUE and the window is frontmost (as specified by
  4842. the behind parameter, below), it draws a go-away region in the frame.
  4843. Then it generates an update event for the entire window contents.
  4844.  
  4845.     ProcID is the window definition ID, which leads to the window
  4846. definition function for this type of window. The window definition IDs
  4847. for the predefined types of windows are listed above under "Windows and 
  4848. Resources". Window definition IDs for windows of your own design are 
  4849. discussed later under "Defining Your Own Windows".
  4850.  
  4851.     The behind parameter determines the window's plane. The new window
  4852. is inserted in back of the window pointed to by this parameter. To put
  4853. the new window behind all other windows, use behind=NIL. To place it
  4854. in front of all other windows, use behind=POINTER(-1); in this case,
  4855. NewWindow will unhighlight the previously active window, highlight the
  4856. window being created, and generate appropriate activate events.
  4857.  
  4858.     RefCon is the window's reference value, set and used only by your 
  4859. application.
  4860.  
  4861.     NewWindow also sets the window class in the window record to
  4862. indicate that the window was created directly by the application.
  4863. \ GetNewWindow
  4864. 5
  4865. FUNCTION GetNewWindow (ID: INTEGER; wStorage: Ptr; behind:
  4866.                         WindowPtr) : WindowPtr;
  4867.  
  4868.     Like NewWindow (above), GetNewWindow creates a window as specified
  4869. by its parameters, adds it to the window list, and returns a windowPtr
  4870. to the new window. The only difference between the two functions is
  4871. that instead of having the parameters boundsRect, title, visible,
  4872. procId, goAwayFlag, and refCon, GetNewWindow has a single windowID
  4873. parameter, where windowID is the resource ID of a window template that
  4874. supplies the same information as those parameters. The wStorage and
  4875. behind parameters of GetNewWindow have the same meaning as in NewWindow.
  4876. \ CloseWindow
  4877. 5
  4878. PROCEDURE CloseWindow (theWindow: WindowPtr);
  4879.  
  4880.     CloseWindow removes the given window from the screen and deletes it
  4881. from the window list. It releases the memory occupied by all data
  4882. structures associated with the window, but not the memory taken up by
  4883. the window record itself. Call this procedure when you're done with a 
  4884. window if you supplied NewWindow or GetNewWindow a pointer to the
  4885. window storage (in the wStorage parameter) when you created the window.
  4886.  
  4887.     Any update events for the window are discarded. If the window was
  4888. the frontmost window and there was another window behind it, the latter
  4889. window is highlighted and an appropriate activate event is generated.
  4890. \ DisposeWindow
  4891. 5
  4892. PROCEDURE DisposeWindow (theWindow: WindowPtr);
  4893.  
  4894.     DisposeWindow calls CloseWindow (above) and then releases the memory
  4895. occupied by the window record. Call this procedure when you're done 
  4896. with a window if you let the window record be allocated on the heap
  4897. when you created the window (by passing NIL as the wStorage parameter
  4898. to NewWindow or GetNewWindow).
  4899. \ SetWTitle
  4900. 5
  4901. PROCEDURE SetWTitle (theWindow: WindowPtr; title: Str255);
  4902.  
  4903.     SetWTitle sets the Window's title to the given string, performing
  4904. any necessary redrawing of the window frame.
  4905. \ GetWTitle
  4906. 5
  4907. PROCEDURE GetWTitle (theWindow: WindowPtr; VAR title: Str255);
  4908.  
  4909.     GetWTitle returns theWindow's title as the value of the title
  4910. parameter.
  4911. \ SelectWindow
  4912. 5
  4913. PROCEDURE SelectWindow (theWindow: WindowPtr);
  4914.  
  4915.     SelectWindow makes theWindow the active window as follows:  it
  4916. unhighlights the previously active window, brings theWindow in front of
  4917. all other windows, highlights theWindow, and generates the appropriate
  4918. activate events. Call this procedure if there's a mouse-down event in 
  4919. the content region of an inactive window.
  4920. \ HideWindow
  4921. PROCEDURE HideWindow (theWindow: WindowPtr);
  4922.  
  4923.     HideWindow makes theWindow invisible. If theWindow is the frontmost
  4924. window and there's a window behind it, HideWindow also unhighlights 
  4925. theWindow, brings the window behind it to the front, highlights that
  4926. window, and generates appropriate activate events (se Figure 6). If
  4927. theWindow is already invisible, HideWindow has no effect.
  4928. \ ShowWindow
  4929. 5
  4930. PROCEDURE ShowWindow (theWindow: WindowPtr);
  4931.  
  4932.     ShowWindow makes theWindow visible. It does not change the front-to-
  4933. back ordering of the windows. Remember that if you previously hid the
  4934. frontmost window with HideWindow, HideWindow will have brought the
  4935. window behind it to the front; so if you then do a ShowWindow of the
  4936. window you hid, it will no longer be frontmost (see Figure 6 above).
  4937. If the Window is already visible, ShowWindow has no effect.
  4938.  
  4939. (note)
  4940.     Although it's inadvisable, you can create a situation 
  4941.     where the frontmost window is invisible. If you do a
  4942.     ShowWindow of such a window, it will highlight the window
  4943.     if it's not already highlighted and will generate an 
  4944.     activate event to force this window from inactive to
  4945.     active.
  4946. \ ShowHide
  4947. 5
  4948. PROCEDURE ShowHide (theWindow: WindowPtr; showFlag: (BOOLEAN);
  4949.  
  4950.     If showFlag is FALSE, ShowHide makes theWindow invisible if it's not
  4951. already invisible and has no effect if it is already invisible. If
  4952. showFlag is TRUE, ShowHide makes the Window visible if it's not already
  4953. visible and has no effect if it is already visible. Unlike HideWindow
  4954. and ShowWindow, ShowHide never changes the highlighting or front-to-
  4955. back ordering of windows or generates activates events.
  4956.  
  4957. (warning)
  4958.     Use this procedure carefully, and only in special
  4959.     circumstances where you need more control than allowed by
  4960.     HideWindow and ShowWindow.
  4961. \ HiliteWindow
  4962. 5
  4963. PROCEDURE HiliteWindow (theWindow: WindowPtr; fHilite: BOOLEAN);
  4964.  
  4965.     If fHilite isTRUE, this procedure highlights theWindow if it's not
  4966. already highlighted and has no effect if it is highlighted. If fHilite
  4967. is FALSE, HiliteWindow unhighlights theWindow if it is highlighted and
  4968. has no effect if it's not highlighted. The exact way a window is 
  4969. highlighted depdnds on its window definition function.
  4970.  
  4971.     Normally you won't have to call this procedure, since you should
  4972. call SelectWindow to make a window active, and SelectWindow takes care
  4973. of the necessary highlighting changes. Highlighting a window that isn't 
  4974. the active window is contrary to the Macintosh User Interface
  4975. Guidelines.
  4976. \ BringToFront
  4977. 5
  4978. PROCEDURE BringToFront (theWindow: WindowPtr);
  4979.  
  4980.     BringToFront brings theWindow to the front of all other windows and
  4981. redraws the window as necessary. Normally you won't have to call this 
  4982. procedure, since you should call SelectWindow to make a window active,
  4983. and SelectWindow takes care of bringing the window to the front. If
  4984. you do call BringToFront, however, remember to call HiliteWindow to
  4985. make the necessary highlighting changes.
  4986. \ SendBehind
  4987. 5
  4988. PROCEDURE SendBehind (theWindow: WindowPtr; behindWindow: WindowPtr);
  4989.  
  4990.     SendBehind sends theWindow behind behindWindow, redrawing any
  4991. exposed windows. If behindWindow is NIL, it sends theWindow behind all
  4992. other windows. If theWindow is the active window, it unhighlights the
  4993. Window, highlights the new active window, and generates the appropriate
  4994. activate events.
  4995.  
  4996. (warning)
  4997.     Do not use SendBehind to deactivate a previously active
  4998.     window. Calling SelectWindow to make a window active
  4999.     takes care of deactivating the previously active window.
  5000.  
  5001. (note)
  5002.     If you're moving theWindow closer to the front (that is,
  5003.     if it's initially even farther behind behind(Window), you
  5004.     must make the following calls after calling SendBehind:
  5005.  
  5006.         wPeek := POINTER(theWindow);
  5007.         PaintOne(wPeek, wPeek^.strucRgn);
  5008.         CalcVis(wPeek)
  5009.  
  5010.     PaintOne and CalcVis are described below under "Low'Level
  5011.     Routines".
  5012. \ FrontWindow
  5013. 5
  5014. FUNCTION FrontWindow : WindowPtr;
  5015.  
  5016.     FrontWindow returns a pointer to the first visible window in the
  5017. window list (that is, the active window). If there are no visible
  5018. windows, it returns NIL.
  5019. \ DrawGrowIcon
  5020. 5
  5021. PROCEDURE DrawGrowIcon (theWindow: WindowPtr).
  5022.  
  5023.     Call DrawGrowIcon in responce to an update or activate event
  5024. involving a window that contains a size box in its content region. If
  5025. theWindow is active (highlighted), DrawGrowIcon draws the size box;
  5026. otherwise, it draws whatever is appropriate to show that thewindow
  5027. temporily cannot be sized. The exact appearance and location of what's
  5028. drawn depend on the window definition function. For an active document
  5029. window, DrawGrowIcon draws the size box icon in the bottom right corner
  5030. of the portRect of the window's grafPort, along with the lines
  5031. delimiting the size box and scroll bar areas (15 pixels in from the
  5032. right edge and bottom of the portRect). It doesn't erase the scroll
  5033. bar areas, so if the window doesn't contain scroll bars you should 
  5034. erase those areas yourself after the window's size changes. For an 
  5035. inactive document window, DrawGrowIcon draws only the delimiting lines
  5036. (again, without erasing anything).
  5037. \ FindWindow
  5038. 5
  5039. FUNCTION FindWindow (thePt: Point; VAR whichWindow: WindowPtr) :
  5040.     INTEGER;
  5041.  
  5042.     When a mouse-down event occurs, the application should call
  5043. FindWindow with thePt equal to the point where the mouse button was
  5044. pressed (in global coordinates, as stored in the where field of the
  5045. event record). FindWindow tells which part of which window, if any, the
  5046. mouse button was pressed in. If it was pressed in a window, the
  5047. whichWindow parameter is set to the window pointer; otherwise, it's set
  5048. to NIL. The integer returned by FindWindow is one of the following
  5049. predefined constants:
  5050.  
  5051. CONST inDesk      = »;  {none of the following}
  5052.       InMenuBar   = 1;  {in menu bar}
  5053.       inSysWindow = 2;  {in system window}
  5054.       inContent   = 3;  {in content region (except grow, if active)}
  5055.       inDrag      = 4;  {in drag region}
  5056.       inGrow      = 5;  {in grow region (active window only)}
  5057.       inGoAway    = 6;  {in go-away region (active window only)}
  5058.       inZoomin    = 7;
  5059.       inZoomOut   = 8;
  5060.  
  5061.     InDesk usually means that the mouse button was pressed on the
  5062. desktop, outside the menu bar or any windows; however, it may also mean
  5063. that the mouse button was pressed inside a window frame but not in the
  5064. drag region or go-away region of the window. Usually one of the last
  5065. four values is returned for windows created by the application.
  5066.  
  5067.     If the window is a documentProc type of window that doesn't contain
  5068. a size box, the application should treat  inGrow the same as inContent;
  5069. if it's a noGrowDocProc type of window, FindWindow will never return 
  5070. inGrow for that window. If the window is a documentProc, noGrowDocProc,
  5071. or rDocProc type of window with no close box, FindWindow will never
  5072. return inGoAway for that window.
  5073. \ TrackGoAway
  5074. 5
  5075. FUNCTION TrackGoAway (theWindow: WindowPtr; thePt: Point) : BOOLEAN;
  5076.  
  5077.     When there's a mouse-down event in the go-away region of theWindow,
  5078. the application should call TrackGoAway with thePt equal to the point
  5079. where the mouse button was pressed (in global coordinates, as stored in
  5080. the where field of the event record). TrackGoAway keeps control until
  5081. the mouse button is released, highlighting the go-away region as long as
  5082. the mouse position remains inside it, and unhighlighting it when the
  5083. mouse moves outside it. The exact way a window's go-away region is 
  5084. highlighted depends on its window definition function; the highlighting
  5085. of a document window's close box is illustrated in Figure 7. When the 
  5086. mouse  button is released, TrackGoAway unhighlights the go-away region
  5087. and returns TRUE if the mouse is inside the go-away region or FALSE if
  5088. it's outside the region (in which case the application should do
  5089. nothing).
  5090. \ MoveWindow
  5091. 5
  5092. PROCEDURE MoveWindow (theWindow: WindowPtr; hGlobal,vGlobal: INTEGER;
  5093.     front: BOOLEAN);
  5094.  
  5095.     MoveWindow moves theWindow to another part of the screen, without
  5096. affecting its size or plane.  The top left corner of the portRect of
  5097. the window's grafPort is moved to the screen point indicated by the 
  5098. global coordinates hGlobal and vGlobal. The local coordinates of the
  5099. top left corner remain the same; MoveWindow saves those coordinates
  5100. before moving the window and calls the QuickDraw procedure SetOrigin to
  5101. restore them before returning. If the front parameter is TRUE and
  5102. theWindow isn't the active window, MoveWindow makes it the active 
  5103. window by calling SelectWindow(theWindow).
  5104. \ DragWindow
  5105. 5
  5106. PROCEDURE DragWindow (theWindow: WindowPtr; startPt: Point; boundsRect:
  5107.     Rect);
  5108.  
  5109.     When there's a mouse-down event in the drag region of theWinow, the 
  5110. application should call DragWindow with StartPt equal to the point
  5111. where the mouse button was pressed (in global coordinates, as stored in
  5112. the where field of the event record). DragWindow pulls a gray outline
  5113. of theWindow around, following the movements of the mouse until the
  5114. button is released. When the mouse button is released, DragWindow
  5115. calls MoveWindow to move theWindow to the location to which it was
  5116. dragged. If theWindow is not the active window and the Command key was
  5117. not being held down, DragWindow makes it the active window (by passing
  5118. TRUE for the front parameter when calling MoveWindow).
  5119.  
  5120.     BoundsRect is also given in global coordinates. If the mouse button
  5121. is released when the mouse position is outside the limits of boundsRect,
  5122. DragWindow returns without moving theWindow or making it the active
  5123. window. For a document window, boundsRect typically will be four
  5124. pixels in from the menu bar and from the other edges of the screen, to
  5125. ensure that there won't be less than a four-pixel-square area of the 
  5126. title bar visible on the screen.
  5127. \ GrowWindow
  5128. 5
  5129. FUNCTION GrowWindow (theWindow: WindowPtr; startPt: Point; sizeRect:
  5130.     Rect) : LongInt;
  5131.  
  5132.     When there's a mouse-down event in the grow region of theWindow, the 
  5133. application should call GrowWindow with startPt equal to the point
  5134. where the mouse button was pressed (in global ccoordinates, as stored in
  5135. the where field of the event record). GrowWindow pulls a GROW IMAGE of
  5136. the window around, following the movements of the mouse until the
  5137. button is released. The grow image for a document window is a gray
  5138. outline of the entire window and also the lines delimiting the title
  5139. bar, size box, and scroll bar areas; Figure 8 illustrates this for a
  5140. document window containing a size box and scroll bars, but the grow
  5141. image would be the same even if the window contained no size box, one
  5142. scroll bar, or no scroll bars. In general, the grow image is defined
  5143. in the window definition function and is whatever is appropriate to
  5144. show that the window's size will change. 
  5145.  
  5146.     The application should subsequently call SizeWindow (see below) to
  5147. change the portRect of the window's grafPort to the new one outlined by 
  5148. the grow image. The sizeRect parameter specifies limits, in pixels, on
  5149. the vertical and horizontal measurements of what will be the new
  5150. portRect. SizeRect.top is the minimum vertical measurement,
  5151. sizeRect.left is the minimum horizontal measurement, sizeRect.bottom is
  5152. the maximum vertical measurement, and sizeRect.right is the maximum
  5153. horizontal measurement.
  5154.  
  5155.     GrowWindow returns the actual size for the new portRect as outlined
  5156. by the grow image when the mouse button is released. The high-order
  5157. word of the LongInt is the vertical measurement in pixels and the
  5158. low-order word is the horizontal measurement. A return value of »
  5159. indicates that the size is the same as that of the current portRect.
  5160.  
  5161. (note)
  5162.     The Toolbox Utility function HiWord takes a long integer
  5163.     as a parameter and returns an integer equal to its high-
  5164.     order word; the function LoWord returns the low-order
  5165.     word.
  5166. \ SizeWindow
  5167. 5
  5168. PROCEDURE SizeWindow (theWindow: WindowPtr; w,h: INTEGER; fUpdate:
  5169.     BOOLEAN);
  5170.  
  5171.     SizeWindow enlarges or shrinks the portRect of the Window's grafPort
  5172. to the width and height specified by w and h, or does nothing if w and h
  5173. are ». The window's position on the screen does not change. The new 
  5174. window frame is drawn; if the width of a document window changes, the
  5175. title is again centered in the title bar, or is truncated at its end if
  5176. it no longer fits. If fUpdate is TRUE, SizeWindow accumulates any
  5177. newly created area of the content region into the update region (see
  5178. figure 9);  normally this is what you'll want. If you pass FALSE for 
  5179. fUpdate, you're responsible for the update region maintenance yourself.
  5180. For more information, see InvalRect and ValidRect below.
  5181.  
  5182. (note)
  5183.     You should change the window's size only when the user 
  5184.     has done something specific to make it change.
  5185. \ InvalRect
  5186. 5
  5187. PROCEDURE InvalRect (badRect: Rect);
  5188.  
  5189.     InvalRect accumulates the given rectangle into the update region of
  5190. the window whose grafPort is the current port. This tells the Window
  5191. Manager that the rectangle has changed and must be updated. The
  5192. rectangle lies within the window's content region and is given in the 
  5193. local coordinates.
  5194.  
  5195.     For example, this procedure is useful when you're calling SizeWindow 
  5196. (described above) for a document window that contains a size box or
  5197. scroll bars. Suppose yuou're going to call SizeWindow with 
  5198. fUpdate=TRUE. If the window is enlarged as shown in Figure 8 above,
  5199. you'll want not only the newly created part of the content region to be 
  5200. updated, but also the two rectangular areas containing the (former)
  5201. size box and scroll bars; before calling SizeWindow, you can call
  5202. InvalRect twice to accumulate those areas into the update region. In
  5203. case the window is made smaller, you'll want the new size box and 
  5204. scroll bar areas to be updated, and so can similarly call InvalRect for
  5205. those areas after calling SizeWindow. See Figure 1» for an
  5206. iillustration of this type of update region maintenance.
  5207.  
  5208.     As another example, suppose your application scrolls up text in a
  5209. document window and wants to show new text added at the bottom of the
  5210. window. You can cause the added text to be redrawn by accumulating
  5211. that area into the update region with InvalRect.
  5212. \ InvalRgn
  5213. 5
  5214. PROCEDURE InvalRgn (badRgn: RgnHandle);
  5215.  
  5216.     InvalRgn is the same as InvalRect (above) but for a region that has
  5217. changed rather than a rectangle.
  5218. \ ValidRect
  5219. 5
  5220. PROCEDURE ValidRect (goodRect: Rect);
  5221.  
  5222.     ValidRect removes goodRect from the update region of the window
  5223. whose grafPort is the current port. This tells the Window Manager that
  5224. the application has already drawn the rectangle and to cancel any
  5225. updates accumulated for that area. The rectangle lies within the
  5226. window's content region and is given in local coordinates. Using
  5227. ValidRect results in better performance and less redundant redrawing in
  5228. the window.
  5229.  
  5230.     For example, suppose you've called SizeWindow (described above) with 
  5231. fUpdate=TRUE for a document window that contains a size box or scroll
  5232. bars. Depending on the dimensions of the newly sized window, the new
  5233. size box and scroll bar areas may or may not have been accumulated into
  5234. the window's update region. After calling SizeWindow, you can redraw
  5235. the size box or scroll bars immediately and then call ValidRect for the
  5236. areas they occupy in case they were in fact accumulated into the update
  5237. region; this will avoid redundant drawing.
  5238. \ ValidRgn
  5239. 5
  5240. PROCEDURE ValidRgn (goodRgn: RgnHandle);
  5241.  
  5242.     ValidRgn is the same as ValidRect (above) but for a region that has
  5243. been drawn rather than a rectangle.
  5244. \ BeginUpdate
  5245. 5
  5246. PROCEDURE BeginUpdate (theWindow: WindowPtr);
  5247.  
  5248.     Call BeginUpdate when an update event occurs for theWindow.
  5249. BeginUpdate replaces the visRgn of the window's grafPort with the 
  5250. intersection of the visRgn and the update region and then sets the
  5251. window's update region to the empty region. You would then usually
  5252. draw the entire content region, though it suffices to draw only the
  5253. visRgn; in either case, only the parts of the window that require
  5254. updating will actually be drwn on the screen. Every call to
  5255. BeginUpdate must be balanced by a call to EndUpdate. (See below, and
  5256. see "How a Window is Drawn".)
  5257. \ EndUpdate
  5258. 5
  5259. PROCEDURE EndUpdate (theWindow: WindowPtr);
  5260.  
  5261.     Call EndUpdate to restore the normal visRgn of theWindow's grafPort, 
  5262. which was changed by BeginUpdate as described above.
  5263. \ SetWRefCon
  5264. 5
  5265. PROCEDURESetWRefCon (theWindow: WindowPtr; data: LongInt);
  5266.  
  5267.     SetWRefCon sets theWindow's reference value to the given data.
  5268. \ GetWRefCon
  5269. 5
  5270. FUNCTION GetWRefCon (theWindow: WindowPtr) : LongInt;
  5271.  
  5272.     GetWRefCon returns theWindow's current reference value. 
  5273. \ SetWindowPic
  5274. 5
  5275. PROCEDURE SetWindowPic (theWindow: WindowPtr; pic: PicHandle);
  5276.  
  5277.     SetWindowPic stores the given picture handle in the window record
  5278. for theWindow, so that when theWindow's contents are to be drawn, the 
  5279. Window Manager will draw this picture rather than generate an update
  5280. event.
  5281. \ GetWindowPic
  5282. 5
  5283. FUNCTION GetWindowPic (theWindow: WindowPtr) : PicHandle;
  5284.  
  5285.     GetWindowPic returns the handle to the picture that draws
  5286. theWindow's contents, previously stored with SetWindowPic (above).
  5287. \ PinRect
  5288. 5
  5289. FUNCTION PinRect (theRect: Rect; thePt: Point) : LongInt;
  5290.  
  5291.     PinRect "pins" thePt inside theRect: The high-order word of the
  5292. function result is the vertical coordinate of thePt or, if thePt lies
  5293. above or below theRect, the vertical coordinate of the top or bottom of
  5294. theRect, respectively. The low-order word of the function result is
  5295. the horizontal coordinate of thePt or, if thePt lies to the left or
  5296. right of theRect, the horizontal coordinate of the left or right edge
  5297. of theRect.
  5298. \ DragGrayRgn
  5299. 5
  5300. FUNCTION DragGrayRgn (theRgn: RgnHandle; startPt: Point;
  5301.     limitRect,slopRect: Rect; axis: INTEGER; actionProc:
  5302.     ProcPtr : LongInt;
  5303.  
  5304.     Called when the mouse button is down inside theRgn, DragGrayRgn
  5305. pulls a gray outline of the region around, following the movements of
  5306. the mouse until the button is released. DragWindow calls this function
  5307. before actually moving the window, and the Control Manager routine
  5308. DragControl similarly calls it for controls. You can call it yourself
  5309. to pull around the outline of any region, and then use the information
  5310. it returns to determine where to move the region.
  5311.  
  5312.     The startPt parameter is assumed to be the point where the mouse
  5313. button was orignally pressed, in the local coordinates of the current
  5314. LimitRect and slopRect are also in the local coordinates of the current
  5315. grafPort. To explain these parameters, the concept of "offset point"
  5316. must be introduced: this is the point whose vertical and horizontal
  5317. offsets from the top left corner of the region's enclosing rectangle 
  5318. are the same as those of startPt. Initially the offset point is the
  5319. same as the mouse position, but they may differ, depending on where the
  5320. user moves the mouse. DragGrayRgn will never move the offset point
  5321. outside limitRect; this limits the travel of the region's outline (but
  5322. not the movements of the mouse). SlopRect, which should completely
  5323. enclose limitRect, allows the user some "slop" in moving the mouse.
  5324. DragGrayRgn's behavior while tracking the mouse depends on the position 
  5325. of the mouse with respect to these two rectangles
  5326.  
  5327.    - when the mouse is inside limitRect, the region's outline follows
  5328.      it normally. If the mouse button is released there, the region
  5329.      should be moved to the mouse position.
  5330.  
  5331.    - When the mouse is outside limitRect but inside slopRect,
  5332.      DragGrayRgn "pins" the offset point to the edge of limitRect. If
  5333.      the mouse button is released there, the region should be moved to
  5334.      this pinned location.
  5335.  
  5336.    - When the mouse is outside slopRect, the outline disappears from
  5337.      screen, but DragGrayRgn continues to follow the mouse; if it
  5338.      moves back into slopRect, the outline reappears. If the mouse
  5339.      button is released outside slopRect, the region should not be
  5340.      moved from its original position.
  5341.  
  5342.     Figure 11 illustrates what happens when the mouse is moved outside
  5343. limitRect but inside slopRect, for a rectangular region. The offset
  5344. point is pinned as the mouse position moves on.
  5345.  
  5346.     If the mouse button is released outside slopRect, DragGrayRgn
  5347. returns -32768 ($8»»»); otherwise, the high-order word of the value
  5348. returned contains the vertical coordinate of the ending mouse point
  5349. minus that of startPt and the low-order word contains the difference
  5350. between the horizontal coordinates.
  5351.  
  5352.     The axis parameter allows you to constrain the outline's motion to
  5353. only one axis. It has one of the following values:
  5354.  
  5355.     CONST noConstraint = »;     {no constraint}
  5356.           hAxis Only   = 1;     {horizontal axis only}
  5357.           vAxis Only   = 2;     {vertical axis only}
  5358.  
  5359.     If noaxis constraint is in effect, the outline will follow the
  5360. mouse's movements along the specified axis only, ignoring motion along
  5361. the other axis. With or without an axis constraint, the mouse must
  5362. still be inside the slop rectangle for the outline to appear at all.
  5363.  
  5364.     The actionProc parameter is a pointer to a procedure that defines
  5365. some action to be performed repeatedly for as long as the user holds
  5366. down the mouse button; the procedure should have no parameters. If
  5367. actionProc is NIL, DragGrayRgn simply retains control until the mouse
  5368. button is released, performing no action while the mouse button is
  5369. down.
  5370. \ CheckUpdate
  5371. 5
  5372. FUNCTION CheckUpdate (VAR the Event: EventRecord) : BOOLEAN;
  5373.  
  5374.     CheckUpdate is called by the Toolbox Event Manager. From the front
  5375. to the back in the window list, it looks for a visible window that needs
  5376. updating (that is, whose update region is not empty). If it finds one
  5377. whose window record contains a picture handle, it draws the picture
  5378. (doing all the necessary region manipulation) and looks for the next
  5379. visible window that needs updating. If it ever finds one whose window
  5380. record doesn't contain a picture handle, it stores an update event for 
  5381. that window in theEvent and returns TRUE. If it never finds such a
  5382. window, it returns FALSE.
  5383. \ ClipAbove
  5384. 5
  5385. PROCEDURE ClipAbove (window: WindowPeek);
  5386.  
  5387.     ClipAbove sets the clipRgn of the Window Manager port to be the
  5388. desktop (global variable grayRgn) intersected with the current clipRgn,
  5389. minus the structure regions of all the windows above the given window.
  5390. \ SaveOld
  5391. 5
  5392. PROCEDURE SaveOld (window: WindowPeek);
  5393.  
  5394.     SaveOld saves the given window's current structure region and
  5395. content region for the DrawNew operation (see below). It must be
  5396. balanced by a subsequent call to DrawNew.
  5397. \ DrawNew
  5398. 5
  5399. PROCEDURE DrawNew (window: WindowPeek; update: BOOLEAN);
  5400.  
  5401.     If the update parameter is TRUE, DrawNew updates the area.
  5402.  
  5403.     (oldStruct XOR newStruct) UNION oldContent XOR newContent)
  5404.  
  5405.     where oldStruct and oldContent are the structure and content regions
  5406. saved by the SaveOld procedures, and newStruct and newContent are the
  5407. current structure and content regions. It paints the area white and
  5408. adds it to the window's update region. If update is FALSE, it only
  5409. paints the area white.
  5410.  
  5411. (warning)
  5412.     SaveOld and DrawNew are not nestable.
  5413. \ PaintOne
  5414. 5
  5415. PROCEDURE PaintOne (window: WindowPeek; clobberedRgn: RgnHandle);
  5416.  
  5417.     PaintOne "paints" the given window, clipped to clobberedRgn and all
  5418. windows above it: it draws the window frame and, if some content is
  5419. exposed, paints the exposed area white and adds it to the window's 
  5420. update region. If the window parameter is NIL, the window is the
  5421. desktop and so is painted gray.
  5422. \ PaintBehind
  5423. 5
  5424. PROCEDURE PaintBehind (startWindow: WindowPeek; clobberedRgn:
  5425.     RgnHandle);
  5426.  
  5427.     PaintBehind calls PaintOne (above for startWindow and all the
  5428. windows behind startWindow, clipped to clobberedRgn.
  5429. \ CalcVis
  5430. 5
  5431. PROCEDURE CalcVis (window: WindowPeek);
  5432.  
  5433.     CalVis calculates the visRgn of the given window by starting with
  5434. its content region and subtracting the structure region of each window
  5435. in front of it.
  5436. \ CalcVisBehind
  5437. 5
  5438. PROCEDURE CalcVisBehind (startWindow: WindowPeek; clobberedRgn:
  5439.     RegHandle;
  5440.  
  5441.     CalcVisBehind calculates the visRgns of start Window and all windows
  5442. behind startWindow that intersect with clobberedRgn. It's called after 
  5443. PaintBehind (see  above).
  5444. \ TrackBox
  5445. 5
  5446. FUNCTION TrackBox (theWindow: WindowPtr; thePt: Point;
  5447.                     partCode: INTEGER) : BOOLEAN;
  5448.  
  5449.     When there╒s a mouse-down event in the zoom-window box of theWindow,
  5450. the application should call TrackBox with thePt equal to the point
  5451. where the mouse button was pressed (in global coordinates, as stored
  5452. in the where field of the event record). The partCode parameter
  5453. contains the constant (either inZoomIn or inZoomOut) returned by
  5454. FindWindow. TrackBox keeps control until the mouse button
  5455. is released; it highlights the zoom-window box in the same way as
  5456. a window╒s close box is highlighted. When the mouse button is released,
  5457. TrackBox unhighlights the zoom-window box and returns TRUE if
  5458. the mouse is inside the zoom-window box or FALSE if it╒s outside
  5459. the box (in which case the application should do nothing).
  5460. \ ZoomWindow
  5461. 5
  5462. PROCEDURE ZoomWindow (theWindow: WindowPtr;
  5463.                         partCode: INTEGER; front: BOOLEAN);
  5464.  
  5465.     Call ZoomWindow after a call to TrackBox that returns TRUE.
  5466. The partCode parameter contains the constant (either inZoomIn or
  5467. inZoomOut) returned by FindWindow. The window will be zoomed either
  5468. out or in, depending on the state of the window specified by partCode.
  5469. If the window is already in the state specified by partCode, ZoomWindow
  5470. does nothing. If the front parameter is TRUE, the window will be
  5471. brought to the front; otherwise, the window is left where it is.
  5472. (This means a window can be zoomed without necessarily becoming
  5473. the active window.)
  5474.  
  5475.     For best results, call the QuickDraw procedure EraseRect with the
  5476. portRect field of theWindow╒s grafPort before calling ZoomWindow.
  5477.  
  5478. Warning:  Using the QuickDraw procedure SetPort, set thePort to the
  5479.           window╒s port before calling ZoomWindow.
  5480.  
  5481. Note:     ZoomWindow is in no way tied to the TrackBox function and
  5482.           could just as easily be called in response to a selection
  5483.           from a menu.
  5484. \ NewControl
  5485. 6
  5486. FUNCTION NewControl (theWindow: WindowPtr; boundsRect: Rect; title:
  5487.                     Str255; visible: BOOLEAN; value: INTEGER;
  5488.                     min,max: INTEGER; procID: INTEGER; refCon: LongInt)
  5489.                     : ControlHandle;
  5490.  
  5491.  
  5492.     NewControl creates a control, adds it to the beginning of
  5493. theWindow's control list, and returns a handle to the new control. The
  5494. values passed as parameters are stored in the corresponding fields of
  5495. the control record, as described below. The field that determines
  5496. highlighting is set to » (no highlighting) and the pointer to the
  5497. default action procedure is set to NIL (none).
  5498.  
  5499. (note)
  5500.     The control definition function may do additional
  5501.     initialization, including changing any of the fields of
  5502.     the control record. The only standard control for which
  5503.     additional initialization is done is the scroll bar; its
  5504.     control definition function allocates space for a region
  5505.     to hold the thumb and stores the region handle in the
  5506.     contrlData field of the control record.
  5507.  
  5508.     TheWindow is the window the new control will belong to. All
  5509. coordinates pertaining to the control will be interpreted in this
  5510. window's local coordinate system.
  5511.  
  5512.     BoundsRect, given in theWindow's local coordinates, is the rectangle 
  5513. that encloses the control and thus determines its size and location.
  5514. Note the following about the enclosing rectangle for the standard
  5515. controls:
  5516.  
  5517.       - Simple buttons are drawn to fit the rectangle exactly. (The
  5518.         control definition function calls the QuickDraw procedure
  5519.     FrameRoundRect.)  To allow for the tallest characters in the
  5520.     system font, there should be at least a 2»-point difference
  5521.     between the top and bottom coordinates of the rectangle.
  5522.  
  5523.       - For check boxes and radio buttons, there should be at least a
  5524.     16-point difference between the top and bottom coordinates.
  5525.  
  5526.       - By convention, scroll bars are 16 pixels wide, so there should be
  5527.     a 16-point difference between the left and right (or top and
  5528.     bottom) coordinates. If there isn't, the scroll bar will be 
  5529.     scaled to fit the rectangle.
  5530.  
  5531.     Title is the control's title, if any (if none, you can just pass the 
  5532. empty string as the title). Be sure the title will fit in the
  5533. control's enclosing rectangle; if it won't, it will be truncated on the
  5534. right for check boxes and radio buttons, or centered and truncated on
  5535. both ends for simple buttons.
  5536.  
  5537.     If the visible parameter is TRUE, NewControl draws the control.
  5538.  
  5539. (note)
  5540.     It does NOT use the standard window updating mechanism,
  5541.     but instead draws the control immediately in the window.
  5542.  
  5543.     The min and max parameters define the control's range of possible 
  5544. settings; the value parameter gives the initial setting. For controls
  5545. that don't retain a setting, such as buttons, the values you supply for 
  5546. these parameters will be stored in the control record but will never be
  5547. used. So it doesn't matter what values you give for those controls--»
  5548. for all three parameters will do. For controls that just retain an
  5549. on-or-off setting, such as check boxes or radio buttons, min should be
  5550. » (meaning the control is off) and max should be 1 (meaning it's on).
  5551. For dials, you can specify whatever values are appropriate for min,
  5552. max, and value.
  5553.  
  5554.     ProcID is the control definition ID, which leads to the control
  5555. definition function for this type of control. The control definition
  5556. IDs for the standard control types are listed above under "Controls and 
  5557. Resources". Control definition IDs for custom control types are 
  5558. discussed later under "Defining Your Own Controls".
  5559.  
  5560.     RefCon is the control's reference value, set and used only by your 
  5561. application.
  5562. \ GetNewControl
  5563. 6
  5564. FUNCTION GetNewControl (controlID: INTEGER; theWindow: WindowPtr)
  5565.                         : ControlHandle;
  5566.  
  5567.     GetNewControl creates a control from a control template stored in a
  5568. resource file, adds it to the beginning of theWindow's control list, 
  5569. and returns a handle to the new control. ControlID is the resource ID
  5570. of the template. GetNewControl works exactly the same as NewControl
  5571. (above), except thatt it gets the initial values for the new control's
  5572. fields from the specified control template instead of accepting them as
  5573. parameters.
  5574. \ DisposeControl
  5575. 6
  5576. PROCEDURE DisposeControl (theControl: ControlHandle);
  5577.  
  5578.     DisposeControl removes theControl from the screen, deletes it from
  5579. its window's control list, and releases the memory occupied by the
  5580. control record and all data structures associated with the control.
  5581. \ KillControls
  5582. 6
  5583. PROCEDURE KillControls (theWindow: WindowPtr);
  5584.  
  5585.     KillControls disposes of all controls associated with theWindow by
  5586. calling DisposeControl (above) for each.
  5587. \ SetCTitle
  5588. 6
  5589. PROCEDURE SetCTitle (theControl: ControlHandle; title: Str255);
  5590.  
  5591.     SetCTitle sets theControl's title to the given string and redraws
  5592. the control.
  5593. \ GetCTitle
  5594. 6
  5595. PROCEDURE GetCTitle (theControl: ControlHandle; VAR title: Str255);
  5596.  
  5597.     GetCTitle returns theControl's title as the value of the title 
  5598. parameter.
  5599. \ HideControl
  5600. 6
  5601. PROCEDURE HideControl (theControl: ControlHandle);
  5602.  
  5603.     HideControl makes theControl invisible. It fills the region the
  5604. control occupies within its window with the background pattern of the
  5605. window's grafPort. It also adds the control's enclosing rectangle to
  5606. the window's update region, so that anything else that was previously 
  5607. obscured by the control will reappear on the screen. If the control is
  5608. already invisible, HideControl has no effect.
  5609. \ ShowControl
  5610. 6
  5611. PROCEDURE ShowControl (theControl: ControlHandle);
  5612.  
  5613.     ShowControl makes theControl visible. The control is drawn in its
  5614. window but may be completely or partially obscured by overlapping
  5615. windows or other objects. If the control is already visible,
  5616. ShowControl has no effect.
  5617. \ DrawControls
  5618. 6
  5619. PROCEDURE DrawControls (theWindow: WindowPtr);
  5620.  
  5621.     DrawControls draws all controls currently visible in theWindow. The
  5622. controls are drawn in reverse order of creation; thus in case of
  5623. overlap the earliest-created controls appear frontmost in the window.
  5624.  
  5625. (note)
  5626.     WindowManager routines such as SelectWindow, ShowWindow,
  5627.     and BringToFront do not automatically call DrawControls
  5628.     to display the window's controls. They just add the 
  5629.     appropriate regions to the window's update region, 
  5630.     generating an update event. Your program should always
  5631.     call DrawControls explicitly upon receiving an update
  5632.     event for a window that contains controls.
  5633. \ HiliteControl
  5634. 6
  5635. PROCEDURE HiliteControl (theControl: ControlHandle; hiliteState:
  5636.                         INTEGER);
  5637.  
  5638.     HiliteControl changes the way theControl is highlighted. HiliteState
  5639. is an integer between » and 255;
  5640.  
  5641.        - A value of » means no highlighting.
  5642.  
  5643.        - A value between 1 and 253 is interpreted as a part code
  5644.          designating the part of the control to be highlighted.
  5645.  
  5646.        - A value of 254 or 255 means that the control is to be made
  5647.          inactive and highlighted accordingly. Usually you'll want to
  5648.          use 254, because it enables you to detect when the mouse button
  5649.          was pressed in the inactive control as opposed to not in any
  5650.          control;
  5651.          for more information, see FindControl under "Mouse Location"
  5652.          below.
  5653.  
  5654.     Hilite Control calls the control definition function to redraw the
  5655. control with its new highlighting.
  5656. \ TestControl
  5657. 6
  5658. FUNCTION TestControl (theControl: ControlHandle; thePoint: Point)
  5659.                         :  INTEGER;
  5660.  
  5661.     If theControl is visible and active, TestControl tests which part of
  5662. the control contains thePoint (in the local coordinates of the
  5663. control's window); it returns the corresponding part code, or » if the 
  5664. point is outside the control. If the control is visible and inactive
  5665. with 254 highlighting, TestControl returns 254. If the control is
  5666. invisible, or inactive with 255 highlighting, TestControl returns ».
  5667. \ FindControl
  5668. 6
  5669. FUNCTION FindControl (thePoint: Point; theWindow: WindowPtr; VAR
  5670.                         whichControl: ControlHandle) : INTEGER;
  5671.  
  5672.     When the Window Manager function FindWindow reports that the mouse
  5673. button was pressed in the content region of a window, and the window
  5674. contains controls, the application should call FindControl with
  5675. theWindow equal to the window pointer and thePoint equal to the point
  5676. where the mouse button was pressed (in the window's local coordinates).
  5677. FindControl tells which of the window's controls, if any, the mouse 
  5678. button was pressed in:
  5679.  
  5680.       - If it was pressed in a visible, active control, FindControl sets
  5681.         the whichControl parameter to the control handle and returns a
  5682.         part code identifying the part of the control that it was
  5683.         pressed in.
  5684.  
  5685.       - If it was pressed in a visible, inactive control with 254
  5686.         highlighting, FindControl sets whichControl to the control
  5687.         handle and returns 254 as its result.
  5688.  
  5689.       - If it was pressed in an invisible control, an inactive control
  5690.         with 255 highlighting, or not in any control, FindControl sets
  5691.         whichControl to NIL and returns » as its result.
  5692.  
  5693. (warning)
  5694.     Notice that FindControl expects the mouse point in the
  5695.     window's local coordinates, whereas FindWindow expects it 
  5696.     in global coordinates. Always be sure to convert the
  5697.     point to local coordinates with the QuickDraw procedure
  5698.     GlobalToLocal before calling FindControl.
  5699.  
  5700. (note)
  5701.     FindControl also returns NIL for whichControl and » as
  5702.     its result if the window is invisible or doesn't contain 
  5703.     the given point. In these cases, however, FindWindow
  5704.     wouldn't have returned this window in the first place, so 
  5705.     the situation should never arise.
  5706. \ TrackControl
  5707. 6
  5708. FUNCTION TrackControl (theControl: ControlHandle; startPt: Point;
  5709.     actionProc: ProcPtr) : INTEGER;
  5710.  
  5711.     When the mouse button is pressed in a visible, active control, the
  5712. application should call TrackControl with theControl equal to the
  5713. control handle and startPt equal to the point where the mouse button
  5714. was pressed (in the local coordinates of the control's window).
  5715. TrackControl follows the movements of the mouse and responds in
  5716. whatever way is appropriate until the mouse button is released; the
  5717. exact response depends on the type of control and the part of the
  5718. control in which the mouse button was pressed. If highlighting is
  5719. appropriate, TrackControl does the highlighting, and undoes it before
  5720. returning. When the mouse button is released, TrackControl returns
  5721. with the part code if the mouse is in the same part of the control that
  5722. it was originally in, or with » if not (in which case the application
  5723. should do nothing.
  5724.  
  5725.     If the mouse button was pressed in an indicator, TrackControl drags
  5726. a gray outline of it to follow the mouse (by calling the Window Manager
  5727. utility function DragGrayRgn). When the mouse button is released,
  5728. TrackControl calls the control definition function to reposition the
  5729. control's indicator. The control definition function for scroll bars 
  5730. responds by redrawing the thumb, calculating  the control's current 
  5731. setting based on the new relative position of the thumb, and storing
  5732. the current setting in the control record; for example, if the minimum
  5733. and maximum settings are  » and 1», and the thumb is in the middle of
  5734. the scroll bar, 5 is stored as the current setting. The application
  5735. must then scroll to the corresponding relative position in the
  5736. document.
  5737.  
  5738.     TrackControl may take additional actions beyond highlighting the
  5739. control or dragging the indicator, depending on the value passed in the
  5740. actionProc parameter, as described below. Here you'll learn what to 
  5741. pass for the standard control types; for a custom control, what you
  5742. pass will depend on how the control is defined.
  5743.  
  5744.       - If actionProc is NIL, TrackControl performs no additional
  5745.         actions. This is appropriate for simple buttons, check boxes,
  5746.         radio buttons, and the thumb of a scroll bar.
  5747.  
  5748.       - ActionProc may be a pointer to an action procedure that defines
  5749.         some action to be performed repeatedly for as long as the user
  5750.         holds down the mouse button. (See below for details)
  5751.  
  5752.       - If actionProc is POINTER(-1), TrackControl looks in the control
  5753.         record for a pointer to the control's default action procedure. 
  5754.         If that field of the control record contains a procedure
  5755.         pointer, TrackControl uses the action procedure it points to; if
  5756.         the field contains POINTER(-1), TrackControl calls the control
  5757.         definition function to perform the necessary action. (If the
  5758.         field contains NIL, TrackControl does nothing.)
  5759.  
  5760.     The action procedure in the control definition function is described
  5761. in the section "Defining Your Own Controls". The following paragraphs
  5762. describe only the action procedure whose pointer is passed in the
  5763. actionProc parameter or stored in the control record.
  5764.  
  5765.     If the mouse button was pressed in an indicator, the action
  5766. procedure (if any) should have no parameters. This procedure must allow
  5767. for the fact that the mouse may not be inside the original control part.
  5768.  
  5769.     If the mouse button was pressed in a control part other than an
  5770. indicator, the action procedure should be of the form
  5771.  
  5772.     PROCEDURE MyAction (theControl: ControlHandle; partCode: INTEGER);
  5773.  
  5774.     In this case, TrackControl passes the control handle and the part
  5775. code to the action procedure. (It passes » in the partCode parameter if
  5776. the mouse has moved outside the original control part.)  As an example
  5777. of this type of action procedure, consider what should happen when the
  5778. mouse button is pressed in a scroll arrow or paging region in a scroll
  5779. bar. For these cases, your action procedure should examine the part
  5780. code to determine exactly where the mouse button was pressed, scroll up
  5781. or down a line or page as appropriate, and call SetCt1Value to change
  5782. the control's setting and redraw the thumb.
  5783.  
  5784. (warning)
  5785.     Since it has a different number of parameters depending
  5786.     on whether the mouse button was pressed in an indicator
  5787.     or elsewhere, the action procedure you pass to
  5788.     TrackControl (or whose pointer you store in the control
  5789.     record) can be set up for only one case or the other. If
  5790.     you store a pointer to a default action procedure in a
  5791.     control record, be sure it will be used only when
  5792.     appropriate for that type of action procedure. The only
  5793.     way to specify actions in response to all mouse-down
  5794.     events in a control, regardless of whether they're in an 
  5795.     indicator, is via the control definition function.
  5796. \ MoveControl
  5797. 6
  5798. PROCEDURE MoveControl (theControl: ControlHandle; h,v: INTEGER);
  5799.  
  5800.     MoveControl moves theControl to a new location within its window.
  5801. The top left corner of the control's enclosing rectangle is moved to the 
  5802. horizontal and vertical coordinates h and v (given in the local
  5803. coordinates of the control's window);  the bottom right corner is 
  5804. adjusted accordingly, to keep the size of the rectangle the same as
  5805. before. If the control is currently visible, it's hidden and then 
  5806. redrawn at its new location.
  5807.  
  5808. \ DragControl
  5809. 6
  5810. PROCEDURE DragControl (theControl: ControlHandle; startPt: Point;
  5811.                         limitRect,slopRect: Rect; axis: INTEGER);
  5812.  
  5813.     Called with the mouse button down inside theControl, DragControl
  5814. pulls a gray outline of the control around the screen, following the
  5815. movements of the mouse until the button is released. When the mouse
  5816. button is released, DragControl calls MoveControl to move the control
  5817. to the location to which it was dragged.
  5818.  
  5819. (note)
  5820.     Before beginning to follow the mouse, DragControl calls
  5821.     the control definition function to allow it to do its own
  5822.     "custom dragging" if it chooses. If the definition
  5823.     function doesn't choose to do any custom dragging, 
  5824.     DragControl uses the default method of dragging described
  5825.     here.
  5826.  
  5827.     DragControl calls the Window Manager utility function DragGrayRgn
  5828. and then moves the control accordingly. The startPt, limitRect,
  5829. slopRect, and axis parameters have the same meaning as for DragGrayRgn.
  5830. These parameters are reviewed briefly below; see the description of
  5831. DragGrayRgn in the Window Manager manual for more details.
  5832.  
  5833.       - StartPt parameter is assumed to be the point where the mouse
  5834.         button was originally pressed, in the local coordinates of the
  5835.         control's window. 
  5836.  
  5837.       - LimitRect limits the travel of the control's outline, and should 
  5838.         normally coincide with or be contained within the window's
  5839.         content region.
  5840.  
  5841.       - SlopRect allows the user some "slop" in moving the mouse; it
  5842.         should completely enclose limitRect.
  5843.  
  5844.       - The axis parameter allows you to constrain the control's motion to
  5845.         only one axis. It has one of the following values:
  5846.  
  5847.     CONST noConstraint  =   »;  {no constraint}
  5848.           hAxis Only    =   1;  {horizontal axis only}
  5849.           vAxis Only    =   2;  {vertical axis only}
  5850. \ SizeControl
  5851. 6
  5852. PROCEDURE SizeControl (theControl: ControlHandle; w,h: INTEGER);
  5853.  
  5854.     SizeControl changes the size of theControl's enclosing rectangle.
  5855. The bottom right corner of the rectangle is adjusted to set the
  5856. rectangle's width and height to the number of pixels specified by w and
  5857. h; the position of the top left corner is not changed. If the control
  5858. is currently visible, it's hidden and then redrawn in its new size.
  5859. \ SetCtlValue
  5860. 6
  5861. PROCEDURE SetCtlValue (theControl: ControlHandle; theValue: INTEGER);
  5862.  
  5863.     SetCtlValue sets theControl's current setting to theValue and
  5864. redraws the control to reflect the new setting. For check boxes and
  5865. radio buttons, the value 1 fills the control with the appropriate mark,
  5866. and » clears it. For scroll bars, SetCtlValue redraws the thumb where
  5867. appropriate.
  5868.  
  5869.     If the specified value is out of range, it's forced to the nearest 
  5870. endpoint of the current range (that is, if theValue is less than the
  5871. minimum setting, SetCtlValue sets the current setting to the minimum;
  5872. if theValue is greater than the maximum setting, it sets the current
  5873. setting to the maximum.
  5874. \ GetCtlValue
  5875. 6
  5876. FUNCTION GetCtlValue (theControl: ControlHandle) : INTEGER;
  5877.  
  5878.     GetCtlValue returns theControl's current setting. 
  5879. \ SetCtlMin
  5880. 6
  5881. PROCEDURE SetCtlMin (theControl: ControlHandle; minValue: INTEGER;
  5882.  
  5883.     SetCtlMin sets theControl's minimum setting to minValue and redraws
  5884. the control to reflect the new range. If the control's current setting
  5885. is less than minValue, the setting is changed to the new minimum.
  5886. \ GetCtlMin
  5887. 6
  5888. FUNCTION GetCtlMin (theControl: ControlHandle) : INTEGER;
  5889.  
  5890.     GetCtlMin returns theControl's minimum setting.
  5891. \ SetCtlMax
  5892. 6
  5893. PROCEDURE SetCtlMax (theControl: ControlHandle; maxValue: INTEGER);
  5894.  
  5895.     SetCtlMax sets theControl maximum setting to maxValue and redraws
  5896. the control to reflect the new range. If maxValue is less than the
  5897. control's current setting, the setting is changed to the new maximum.
  5898. \ GetCtlMax
  5899. 6
  5900. FUNCTION GetCtlMax (theControl: ControlHandle) : INTEGER;
  5901.  
  5902.     GetCtlMax returns theControl's maximum setting.
  5903. \ SetCRefCon
  5904. 6
  5905. PROCEDURE SetCRefCon (theControl: ControlHandle; data: LongInt);
  5906.  
  5907.     SetCRefCon sets theControl's reference value to the given data.
  5908. \ GetCRefCon
  5909. 6
  5910. FUNCTION GetCRefCon (theControl: ControlHandle) : LongInt;
  5911.  
  5912.     GetCRefCon returns theControl's current reference value.
  5913. \ SetCtlAction
  5914. 6
  5915. PROCEDURE SetCtlAction (theControl: ControlHandle; actionProc:
  5916.                         ProcPtr);
  5917.  
  5918.     SetCtlAction sets theControl's default action procedure to
  5919. actionProc.
  5920. \ GetCtlAction
  5921. 6
  5922. FUNCTION GetCtlAction (theControl: ControlHandle) : ProcPtr;
  5923.  
  5924.     GetCtlAction returns a pointer to theControl's default action 
  5925. procedure, if any. (It returns whatever is in that field of the
  5926. control record.)
  5927.  
  5928.  
  5929. The Control Definition Function
  5930. -------------------------------
  5931.  
  5932.     The control definition function may be written in Pascal or assembly
  5933. language; the only requirement is that its entry point must be at the
  5934. beginning. You can give your control definition function any name you
  5935. like. Here's how you would declare one named MyControl:
  5936.  
  5937.     FUNCTION MyControl (varCode: INTEGER; theControl; ControlHandle;
  5938.                         message: INTEGER; param: LongInt) : LongInt;
  5939.  
  5940. VarCode is the variation code, as described above.
  5941.  
  5942. TheControl is a handle to the control that the operation will affect.
  5943.  
  5944. The message parameter identifies the desired operation. It has one of
  5945. the following values:
  5946.  
  5947.   CONST drawCntl = »;   {draw the control (or control part)}
  5948.     testCntl     = 1;   {test where mouse button was pressed}
  5949.     calcCrgns    = 2;   {calculate control's region (or indicator's)}
  5950.     initCntl     = 3;   {do any additional control initialization}
  5951.     dispCntl     = 4;   {take any additional disposal actions}
  5952.     posCntl      = 5;   {reposition control's indicator and update it}
  5953.     thumbCntl    = 6;   {calculate parameters for dragging indicator}
  5954.     dragCntl     = 7;   {drag control (or its indicator)}
  5955.     autoTrack    = 8;   {execute control's action procedure}
  5956.  
  5957.     As described below in the discussions of the routines that perform
  5958. these operations, the value passed for param, the last parameter of the
  5959. control definition function, depends on the operation. Where it's not 
  5960. mentioned below, this parameter is ignored. Similarly, the control
  5961. definition function is expected to return a function result only where
  5962. indicated; in other cases, the function should return ».
  5963.  
  5964. (note)
  5965.     "Routine" here does not necessarily mean a procedure or
  5966.      function. While it's a good idea to set these up as 
  5967.      subprograms inside the control definition function,
  5968.      you're not required to do so.
  5969. \ UpdtControl
  5970. 6
  5971. PROCEDURE UpdtControl (theWindow: WindowPtr; updateRgn: RgnHandle);
  5972.  
  5973.     UpdtControl is a faster version of the DrawControls procedure.
  5974. Instead of drawing all of the controls in theWindow, UpdtControl
  5975. draws only the controls that are in the specified update region.
  5976. UpdtControl is called in response to an update event, and is usually
  5977. bracketed by calls to the Window Manager procedures BeginUpdate and
  5978. EndUpdate. UpdateRgn should be set to the visRgn of theWindow╒s port
  5979. (for more details, see the BeginUpdate procedure in the Window Manager
  5980. chapter).
  5981.  
  5982. Note:  In general, controls are in a dialog box and are automatically
  5983. drawn by the DrawDialog procedure.
  5984. \ Draw1Control
  5985. 6
  5986. PROCEDURE Draw1Control (theControl: ControlHandle);
  5987.  
  5988.     Draw1Control draws the specified control if it╒s visible within the
  5989. window.
  5990. \ InitMenus
  5991. 7
  5992. PROCEDURE InitMenus;
  5993.  
  5994.     InitMenus initializes the Menu Manager. It allocates space for the
  5995. menu list (a relocatable block on the heap large enough for the maximum
  5996. size menu list), and draws the (empty) menu bar. Call InitMenus once
  5997. before all other Menu Manager routines. An application should never
  5998. have to call this procedure more than once; to start afresh with all
  5999. new menus, use ClearMenuBar.
  6000.  
  6001. (note)
  6002.     The Window Manager initialization procedure InitWindows
  6003.     has already drawn the empty menu bar; InitMenus redraws
  6004.     it.
  6005. \ NewMenu
  6006. 7
  6007. FUNCTION NewMenu (menuID: INTEGER; MenuTitle: Str255) : MenuHandle;
  6008.  
  6009.     NewMenu allocates space for a new menu with the given menu ID and
  6010. title, and returns a handle to it. It sets up the menu to use the
  6011. standard menu definition procedure. The new menu (which is created
  6012. empty) is not installed in the menu list. To use this menu, you must
  6013. first call AppendMenu or AddResMenu to fill it with items, InsertMenu
  6014. to place it in the menu list, and DrawMenuBar to update the menu bar to
  6015. include the new title.
  6016.  
  6017.     Application menus should always have positive menu IDs. Negative
  6018. menu IDs are reserved for menus belonging to desk accessories. No menu
  6019. should ever have a menu ID of ».
  6020.  
  6021.     If you want to set up the title of the Apple menu from your program
  6022. instead of reading it in from a resource file, you can use the
  6023. predefined constant appleMark (equal to $14, the value of the apple
  6024. symbol). For example, you can declare the string variable
  6025.  
  6026.     VAR myTitle: STRING[1];
  6027.  
  6028. and do the following:
  6029.  
  6030.     myTitle := ' ';
  6031.     myTitle[1] := CHR(appleMark)
  6032.  
  6033.     To release the memory occupied by a menu that you created with
  6034. NewMenu, call DisposeMenu.
  6035. \ GetMenu
  6036. 7
  6037. FUNCTION GetMenu (resourceID: INTEGER) : MenuHandle;
  6038.  
  6039.     GetMenu returns a menu handle for the menu having the given resource
  6040. ID. It calls the Resource Manager to read the menu from the resource
  6041. file into a menu record in memory. It stores the handle to the menu
  6042. definition procedure in the menu record, reading the procedure from the
  6043. resource file into memory if necessary. To use this menu, you must
  6044. call InsertMenu to place it in the menu list and DrawMenuBar to update
  6045. the menu bar to include the new title.
  6046.  
  6047. (warning)
  6048.     Only call GetMenu once for a particular menu. If you
  6049.     need the menu handle to a menu that's already in memory, 
  6050.     use the Resource Manager function GetResource.
  6051.  
  6052.     To release the memory occupied by a menu that you read from a
  6053. resource file with GetMenu, use the Resource Manager procedure
  6054. ReleaseResource.
  6055. \ DisposeMenu
  6056. 7
  6057. PROCEDURE DisposeMenu (theMenu: MenuHandle);
  6058.  
  6059.     Call DisposeMenu to release the memory occupied by a menu that you
  6060. allocated with NewMenu. (For menus read from a resource file with
  6061. GetMenu, use the Resource Manager procedure ReleaseResource instead.)
  6062. This is useful if you've created temporary menus that you no longer
  6063. need.
  6064.  
  6065. (warning)
  6066.     Make sure you remove the menu from the menu list (with
  6067.     DeleteMenu) before disposing of it. Also be careful not
  6068.     to use the menu handle after disposing of the menu.
  6069.  
  6070.  
  6071. \ AppendMenu
  6072. 7
  6073. PROCEDURE AppendMenu (theMenu: MenuHandle; data: Str255);
  6074.  
  6075.     AppendMenu adds an item or items to the end of the given menu, which
  6076. must previously have been allocated by NewMenu or read from a resource
  6077. file by GetMenu. The data string consists of the text of the menu
  6078. item; it may be blank but should not be the null string. If it begins
  6079. with a hyphen (-), the item will be a dividing line across the width of
  6080. the menu. As described in the section "Creating a Menu in Your 
  6081. Program", the following meta-characters may be embedded in the data
  6082. string:
  6083.  
  6084.    Meta-character     Usage
  6085.    --------------     -----
  6086.  
  6087.     ; or Return       Separates multiple items
  6088.     ^                 Followed by an icon number, adds that icon to
  6089.                       the item
  6090.     !                 Followed by a character, marks the item with
  6091.                       that character
  6092.     <                 Followed by B, I, U, O, or S, sets the
  6093.                       character style of the item
  6094.     /                 Followed by a character, associates a keyboard
  6095.                       equivalent with the item
  6096.     (                 Disables the item
  6097.  
  6098.     Once items have been appended to a menu, they cannot be removed or
  6099. rearranged. AppendMenu works properly whether or not the menu is in
  6100. the menu list.
  6101. \ AddResMenu
  6102. 7
  6103. PROCEDURE AddResMenu (theMenu: MenuHandle; theType: ResType);
  6104.  
  6105.     AddResMenu searches all open resource files for resources of type
  6106. theType and appends the names of all resources it finds to the given
  6107. menu. Each resource name appears in the menu as an enabled item,
  6108. without an icon or mark, and in the normal character style. The
  6109. standard Menu Manager calls can be used to get the name or change its
  6110. appearance, as described below under "Controlling Items' Appearance".
  6111.  
  6112. (note)
  6113.     So that you can have resources of the given type that
  6114.     won't appear in the menu, any resource names that begin 
  6115.     with a period (.) or a percent sign (%) aren't apppended 
  6116.     by AddResMenu.
  6117.  
  6118.     Use this procedure to fill a menu with the names of all available
  6119. fonts or desk accessories. For example, if you declare a variable as
  6120.  
  6121.     VAR fontMenu: MenuHandle;
  6122.  
  6123. you can set up a menu containing all font names as follows:
  6124.  
  6125.     fontMenu := NewMenu(5,'Fonts');
  6126.     AddResMenu(fontMenu,"FONT')
  6127. \ InsertResMenu
  6128. 7
  6129. Procedure InsertResMenu (theMenu: MenuHandle; theType: ResType;
  6130.                         afterItem: INTEGER);
  6131.  
  6132.     InsertResMenu is the same as AddRes≈enu (above) except that it
  6133. inserts the resource names in the menu where specified by the afterItem
  6134. parameter:  if afterItem is », the names are inserted before the first
  6135. menu item; if it's the item number of an item in the menu, they're
  6136. inserted after that item; if it's equal to or greater than the last
  6137. item number, they're appended to the menu.
  6138.  
  6139. (note)
  6140.     InsertResMenu inserts the names in the reverse of the
  6141.     order that AddResMenu appends them. For consistency
  6142.     between the applications in the appearance of menus, use
  6143.     AddResMenu instead of InsertResMenu if possible.
  6144. \ InsertMenu
  6145. 7
  6146. PROCEDURE InsertMenu (theMenu: MenuHandle; before ID: INTEGER);
  6147.  
  6148.     InsertMenu inserts a menu into the menu list before the menu whose
  6149. menu ID equals beforeID. If beforeID is » (or isn't the ID of any menu
  6150. in the menu list), the new menu is added after all others. If the menu
  6151. is already in the menu list or the menu list is already full, InsertMenu
  6152. does nothing. Be sure to call DrawMenuBar to update the menu bar.
  6153. \ DrawMenuBar
  6154. 7
  6155. PROCEDURE DrawMenuBar;
  6156.  
  6157.     DrawMenuBar redraws the menu bar according to the menu list,
  6158. incorporating any changes since the last call to DrawMenuBar. Any
  6159. highlighted menu title remains highlighted when drawn by DrawMenuBar.
  6160. This procedure should always be called after a sequence of InsertMenu
  6161. or DeleteMenu calls, and after ClearMenuBar, SetMenuBar, or any other
  6162. routine that changes the menu list.
  6163. \ DeleteMenu
  6164. 7
  6165. PROCEDURE DeleteMenu (menuID: INTEGER);
  6166.  
  6167.     DeleteMenu deletes a menu from the menu list. If there's no menu
  6168. with the given menu ID in the menu list, DeleteMenu has no effect. Be
  6169. sure to call DrawMenuBar to update the menu bar; the menu titles
  6170. following the deleted menu will move over to fill the vacancy.
  6171.  
  6172. (note)
  6173.     DeleteMenu simply removes the menu from the list of
  6174.     currently available menus; it doesn't release the memory 
  6175.     occupied by the menu data structure.
  6176. \ ClearMenuBar
  6177. 7
  6178. PROCEDURE ClearMenuBar;
  6179.  
  6180.  
  6181.     Call ClearMenuBar to remove all menus from the menu list when you
  6182. want to start afresh with all new menus. Be sure to call DrawMenuBar to
  6183. update the menu bar.
  6184.  
  6185. (note)
  6186.     ClearMenuBar, like Delete Menu, doesn't release the memory 
  6187.     occupied by the menu data structures; it merely removes
  6188.     them from the menu list.
  6189.  
  6190.     You don't have to call ClearMenuBar at the beginning of your
  6191. program, because InitMenus clears the menu list for you.
  6192. \ GetNewMBar
  6193. 7
  6194. FUNCTION GetNewMBar (menuBarID: INTEGER) : Handle;
  6195.  
  6196.     GetNewMBar creates a menu list as defined by the menu bar resource
  6197. having the given resource ID, and returns a handle to it. If the
  6198. resource isn't already in memory, GetNewMBar reads it into memory from 
  6199. the resource file. It calls GetMenu to get each of the individual
  6200. menus.
  6201.  
  6202.     To make the menu list created by  GetNew≈Bar the  current menu list,
  6203. call SetMenuBar. To release the memory occupied by the menu list, use
  6204. the Memory Manager procedure DisposHandle.
  6205.  
  6206. (warning)
  6207.  
  6208.     You don't have to know the indivudual menu IDs to use 
  6209.     GetNewMBar, but that doesn't mean you don't have to know
  6210.     them at all:  to do anything further with a particular
  6211.     menu, you have to know its ID or its handle (which you
  6212.     can get by passing the ID to GetMHandle, as described
  6213.     below under "Miscellaneous Routines").
  6214.  
  6215.  
  6216. \ GetMenuBar
  6217. 7
  6218. FUNCTION GetMenuBar : Handle;
  6219.  
  6220.     GetMenuBar creates a copy of the current menu list and returns a
  6221. handle to the copy. You can then add or remove menus from the menu list
  6222. (with InsertMenu, DeleteMenu, or ClearMenuBar), and later restore the
  6223. saved menu list with SetMenuBar. To release the memory occupied by the
  6224. saved menu list, use the Memory Manager procedure DisposHandle.
  6225.  
  6226. (warning)
  6227.     GetMenuBar doesn't copy the menus themselves, only a list 
  6228.     containing their handles. Do not dispose of any menus
  6229.     that might be in a saved menu list.
  6230. \ SetMenuBar
  6231. 7
  6232. PROCEDURE SetMenuBar (menuList: Handle);
  6233.  
  6234.     SetMenuBar copies the given menu list to the current menu list. You
  6235. can use this procedure to restore a menu list previously saved by
  6236. GetMenuBar, or pass it a handle returned by GetNewMBar. Be sure to
  6237. call DrawMenuBar to update the menu bar.
  6238. \ MenuSelect
  6239. 7
  6240. FUNCTION MenuSelect (startPt: Point) : LONGINT;
  6241.  
  6242.     When there's a mouse-down event in the menu bar, the application
  6243. should call MenuSelect with startPt equal to the point (in global
  6244. coordinates) where the mousebutton was pressed.  MenuSelect keeps
  6245. control until the mouse button is released, tracking the mouse, pulling
  6246. down menus as needed, and highlighting enabled menu items under the
  6247. cursor. When the mouse button is released over an enabled item in an
  6248. application menu, MenuSelect returns a long integer whose high-order
  6249. word is the menu ID of the menu, and whose low-order word is the menu
  6250. item number for the item chosen (see Figure 3). It leaves the selected
  6251. menu title highlighted. After performing the chosen task, your
  6252. application should call HiliteMenu(») to remove the highlighting from
  6253. the menu title.
  6254.  
  6255.     If no choice is made, MenuSelect returns » in the high-order word of
  6256. the long integer, and the low-order word is undefined. This includes
  6257. the case where the mouse button is released over a disabled menu item
  6258. (such as Cut, Copy, Clear, or one of the dividing lines in Figure 3),
  6259. over any menu title, or outside the menu.
  6260.  
  6261.     If the mouse button is released over an enabled item in a menu
  6262. belonging to a desk accessory, MenuSelect passes the menu ID and item
  6263. number to the Desk Manager procedure SystemMenu for processing, and
  6264. returns » to your application in the high-order word of the result.
  6265. \ MenuKey
  6266. 7
  6267. FUNCTION MenuKey (ch: CHAR) : LONGINT;
  6268.  
  6269.     MenuKey maps the given character to the associated menu and item for
  6270. that character. When you get a key-down event with the Command key
  6271. held down--or an auto-key event, if the command being invoked is
  6272. repeatable--call MenuKey with the character that was typed. MenuKey
  6273. highlights the appropriate menu title, and returns a long integer
  6274. containing the menu ID in its high-order word and the menu item number
  6275. in its low-order word, just as MenuSelect does (see Figure 3 above).
  6276. After performing the chosen task, your application should call
  6277. HiliteMenu(») to remove the highlighting from the menu title.
  6278.  
  6279.     If the given character isn't associated with any enabled menu item 
  6280. currently in the menu list, MenuKey returns » in the high-order word of
  6281. the long integer, and the low-order word is undefined.
  6282.  
  6283.     If the given character involes a menu item in a menu belonging to a
  6284. desk accessory, MenuKey (like MenuSelect) passes the menu ID and item
  6285. number to the Desk Manager procedure SystemMenu for processing, and
  6286. returns » to your application in the high-order word of the result.
  6287.  
  6288. (note)
  6289.     There should never be more than one item in the menu list
  6290.     with the same keyboard equivalent, but if there is,
  6291.     MenuKey returns the first such item it encounters,
  6292.     scanning the menus from right to left and their items
  6293.     from top to bottom.
  6294. \ HiliteMenu
  6295. 7
  6296. PROCEDURE HiliteMenu (menuID: INTEGER);
  6297.  
  6298.     Hilite Menu highlights the title of the given menu, or does nothing
  6299. if the title is already highlighted. Since only one menu title can be
  6300. highlighted at a time, it unhighlights any previously highlighted menu
  6301. title. If MenuID is » (or isn't the ID of any menu in the menu list),
  6302. HiliteMenu simply unhighlights whichever menu title is highlighted (if
  6303. any).
  6304.  
  6305.     After MenuSelect or MenuKey, your application should perform the
  6306. chosen task and then call HiliteMenu(») to unhighlight the chosen menu
  6307. title.
  6308. \ SetItem
  6309. 7
  6310. PROCEDURE SetItem (theMenu: MenuHandle; item: INTEGER; itemString:
  6311.     Str255);
  6312.  
  6313.     SetItem changes the text of the given menu item to itemString. It
  6314. doesn't recognize the meta-characters used in AppendMenu; if you
  6315. include them in itemString, they will appear in the text of the menu
  6316. item. The attributes already in effect for this item--its character
  6317. style, icon, and so on--remain in effect. ItemString may be blank but
  6318. should not be the null string.
  6319.  
  6320. (note)
  6321.     It's good practice to store the text of itemString in a 
  6322.     resource file instead of passing it directly.
  6323.  
  6324.     Use SetItem to flip between two alternative menu items--for example,
  6325. to change "Show Clipboard" top "Hide Clipboard" when the Clipboard is
  6326. already showing.
  6327.  
  6328. (note)
  6329.     To avoid confusing the user, don't capriciously change 
  6330.     the text of menu items.
  6331. \ GetItem
  6332. 7
  6333. PROCEDURE GetItem (theMenu: MenuHandle; item: INTEGER; VAR itemString:
  6334.     Str255);
  6335.  
  6336.     GetItem returns the text of the given menu item in itemString. It
  6337. doesn't place any meta-characters in the string. This procedure is 
  6338. useful for getting the name of a menu item that was installed with
  6339. AddResMenu or InsertResMenu.
  6340. \ DisableItem
  6341. 7
  6342. PROCEDURE DisableItem (theMenu: MenuHandle; item: INTEGER);
  6343.  
  6344.     Given a menu item number in the item parameter, DisableItem disables
  6345. that menu item; given » in the item parameter, it disables the entire
  6346. menu.
  6347.  
  6348.     Disabled menu items appear dimmed and are not highlighted when the
  6349. cursor moves over them. MenuSelect and MenuKey return » in the high-
  6350. order word of their result if the user attempts to invoke a disabled
  6351. item. Use DisableItem to disable all menu choices that aren't
  6352. appropriate at a given time (such as a Cut command when there's no text
  6353. selection).
  6354.  
  6355.     All menu items are initially enabled unless you specify otherwise
  6356. (such as by using the "(" meta-character in a call to AppendMenu).
  6357.  
  6358.     Every menu item in a disabled menu is dimmed. The menu title is
  6359. also dimmed, but you must call DrawMenuBar to update the menu bar to
  6360. show the dimmed title.
  6361. \ EnableItem
  6362. 7
  6363. PROCEDURE EnableItem (theMenu:  MenuHandle; item: INTEGER);
  6364.  
  6365.     Given a menu item number in the item parameter, EnableItem enables
  6366. the item; given 0 in the item parameter, it enables the entire menu.
  6367. (The item or menu may have been disabled with the DisableItem procedure,
  6368. or the item may have been disabled with the "(" meta-character in the
  6369. AppendMenu string.)  The item or menu title will no longer appear
  6370. dimmed and can be chosen like any other enabled item or menu.
  6371. \ CheckItem
  6372. 7
  6373. PROCEDURE CheckItem (theMenu:  MenuHandle; item:  INTEGER; checked:
  6374.             BOOLEAN);
  6375.  
  6376.     CheckItem places or removes a check mark at the left of the given
  6377. menu item. After you call CheckItem with checked=TRUE, a check mark
  6378. will appear each subsequent time the menu is pulled down. Calling
  6379. CheckItem with checked=FALSE removes the check mark from the menu item
  6380. (or, if it's marked with a different character, removes that mark).
  6381.  
  6382.     Menu items are initially unmarked unless you specify otherwise (such
  6383. as with the "!" meta-character in a call to AppendMenu).
  6384. \ SetItemMark
  6385. 7
  6386. PROCEDURE SetItemMark (theMenu: MenuHandle; item: INTEGER; markChar:
  6387.              CHAR);
  6388.  
  6389.     SetItemMark marks the given menu item in a more general manner than
  6390. CheckItem. It allows you to place any character in the system font,
  6391. not just the check mark, to the left of the item. You can specify some
  6392. useful values for the markChar parameter with the following predefined
  6393. constants:
  6394.  
  6395.        CONST noMark      = 0;      {NUL character, to remove a mark}
  6396.              commandMark = $11;    {Command key symbol}
  6397.              checkMark   = $12;    {check mark}
  6398.              diamondMark = $13;    {diamond symbol}
  6399.              appleMark   = $14;    {apple symbol}
  6400. \ GetItemMark
  6401. 7
  6402. PROCEDURE GetItemMark (theMenu: MenuHandle; item: INTEGER; VAR
  6403.             markChar: CHAR);
  6404.  
  6405.     GetItemMark returns in markChar whatever character the given menu
  6406. item is marked with, or the NUL character (ASCII code 0) if no mark is
  6407. present.
  6408. \ SetItemIcon
  6409. 7
  6410. PROCEDURE SetItemIcon (theMenu: MenuHandle; item: INTEGER; icon: Byte);
  6411.  
  6412.     SetItemIcon associates the given menu item with an icon. It sets
  6413. the item's icon number to the given value (an integer from 1 to 255).
  6414. The Menu Manager adds 256 to the icon number to get the icon's resource
  6415. ID, which it passes to the Resource Manager to get the corresponding
  6416. icon.
  6417.  
  6418. (warning)
  6419.        If you deal directly with the Resource Manager to read or
  6420.        store menu icons, be sure to adjust your icon numbers
  6421.        accordingly.
  6422.  
  6423. Menu items initially have no icons unless you specify otherwise (such
  6424. as with the "^" meta-character in a call to AppendMenu).
  6425. \ GetItemIcon
  6426. 7
  6427. PROCEDURE GetItemIcon (theMenu: MenuHandle; item: INTEGER; VAR icon:
  6428.                          Byte);
  6429.  
  6430.     GetItemIcon returns the icon number associated with the given menu
  6431. item, as an integer from 1 to 255, or 0 if the item has not been
  6432. associated with an icon. The icon number is 256 less than the icon's 
  6433. resource ID.
  6434. \ SetItemStyle
  6435. 7
  6436. PROCEDURE SetItemStyle (theMenu: MenuHandle; item: INTEGER; chStyle:
  6437.                         Style);
  6438.  
  6439.     SetItemStyle changes the character style of the given menu item to
  6440. chStyle. For example:
  6441.  
  6442.     SetItemStyle(thisMenu,1,[bold,italic])     {bold and italic}
  6443.  
  6444.     Menu items are initially in the normal character style unless you
  6445. specify otherwise (such as with the "<" meta-character in a call to
  6446. AppendMenu).
  6447. \ GetItemStyle
  6448. 7
  6449. PROCEDURE GetItemStyle (theMenu: MenuHandle; item: INTEGER; VAR
  6450.                         chStyle: Style);
  6451.  
  6452.     GetItemStyle returns the character style of the given menu item in
  6453. chStyle.
  6454. \ CalcMenuSize
  6455. 7
  6456. PROCEDURE CalcMenuSize (theMenu: MenuHandle);
  6457.  
  6458.     You can use CalcMenuSize to recalculate the horizontal and vertical
  6459. dimensions of a menu whose contents have been changed (and store them
  6460. in the appropriate fields of the menu record). CalcMenuSize is called
  6461. internally by the Menu Manager after every AppendMenu, SetItem,
  6462. SetItemIcon, and SetItemStyle call.
  6463. \ CountMItems
  6464. 7
  6465. FUNCTION CountMItems (TheMenu: MenuHandle): INTEGER;
  6466.  
  6467.     CountMItems returns the number of menus item in the given menu.
  6468. \ GetMHandle
  6469. 7
  6470. FUNCTION GetMHandle (menuID: INTEGER) : MenuHandle;
  6471.  
  6472.     Given the menu ID of a menu currently installed in the menu list,
  6473. GetMHandle returns a handle to that menu; given any other menu ID, it
  6474. returns NIL.
  6475. \ FlashMenuBar
  6476. 7
  6477. PROCEDURE FlashMenuBar (menuID: INTEGER);
  6478.  
  6479.     If menuID is 0 (or isn't the ID of any menu in the menu list),
  6480. FlashMenuBar inverts the entire menu bar; otherwise, it inverts the
  6481. title of the given menu.
  6482. \ SetMenuFlash
  6483. 7
  6484. PROCEDURE SetMenuFlash (count: INTEGER);
  6485.  
  6486.     When the mouse button is released over an enabled menu item, the
  6487. item blinks briefly to confirm the choice. Normally your application
  6488. shouldn't be concerned with this blinking; the user sets it with the
  6489. Control Panel desk accessory. If you're writing a desk accessory like
  6490. the Control Panel, though, SetMenuFlash allows you to control the
  6491. duration of this blinking. Count is the number of times menu items
  6492. will blink; it's initially 3 if the user hasn't changed it. A count of
  6493. 0 disables blinking. Values greater than 3 can be annoyingly slow.
  6494.  
  6495. (warning)
  6496.     Don't call SetMenuFlash from your main program.     
  6497.  
  6498. (note)
  6499.     Items in both standard and nonstandard menus blink when
  6500.     chosen. The appearance of the blinking for a nonstandard
  6501.     menu depends on the menu definition procedure, as
  6502.     described below.
  6503. \ InsMenuItem
  6504. 7
  6505. PROCEDURE InsMenuItem (theMenu: MenuHandle; itemString: Str255; afterItem: INTEGER);
  6506.  
  6507.     InsMenuItem inserts an item or items into the given menu where
  6508. specified by the afterItem parameter. If afterItem is 0, the items
  6509. are inserted before the first menu item; if it╒s the item number of an
  6510. item in the menu, they╒re inserted after that item; if it╒s equal to or
  6511. greater than the last item number, they╒re appended to the menu.
  6512.  
  6513. Warning:  Only the items contained in itemString are sorted.
  6514.  
  6515.     The contents of itemString are parsed as in the AppendMenu
  6516. procedure. Multiple items are inserted in the reverse of their order in
  6517. itemString.
  6518. \ DelMenuItem
  6519. 7
  6520. PROCEDURE DelMenuItem (theMenu: MenuHandle; item: INTEGER);
  6521.  
  6522.     DelMenuItem deletes the specified item from the given menu.
  6523.  
  6524. Note:  DelMenuItem is intended for maintaining dynamic menus (such as
  6525.        a list of open windows). It should not be used for disabling
  6526.        items; you should use DisableItem instead.
  6527. \ TEInit
  6528. 8
  6529. PROCEDURE TEInit;
  6530.  
  6531.     TEInit initializes TextEdit by allocating a handle for the TextEdit
  6532. scrap. The scrap is initially empty. Calll this procedure once and
  6533. only once at the beginning of your program.
  6534.  
  6535. (note)
  6536.       You should call TEInit even if your application doesn't
  6537.       use TextEdit, so that desk accessories and dialog and
  6538.       alert boxes will work correctly.
  6539. \ TENew
  6540. 8
  6541. FUNCTION TENew (destRect, viewRect: Rect) : TEHandle;
  6542.  
  6543.     TENew allocates a handle for the text, creates and initializes an
  6544. edit record, and returns a handle to the new edit record. DestRect and
  6545. viewRect are the destination and view rectangles, respectively. Both
  6546. rectangles are specified in the current grafPort's coordinates. The
  6547. destination rectangle must always be at least as wide as the first
  6548. character drawn (about 20 pixels is usually a good width). The view
  6549. rectangle must not be empty (for example, don't make its right edge
  6550. less than its left edge if you don't want any text visible--specify a 
  6551. rectangle off the screen instead).
  6552.  
  6553.     Call TENew once for every edit record you want allocated. The edit
  6554. record incorporates the drawing environment of the grafPort, and is
  6555. initialized for left-justified, single-spaced text with an insertion
  6556. point at character position 0.
  6557.  
  6558. (note)
  6559.       The caret won't appear until you call TEActivate.
  6560. \ TEDispose
  6561. 8
  6562. PROCEDURE TEDispose (hTE: TEHandle);
  6563.  
  6564.     TEDispose releases the memory allocated for the edit record and text
  6565. specified by hTE. Call this procedure when you're completely through
  6566. with an edit record.
  6567. \ TESetText
  6568. 8
  6569. PROCEDURE TESetText (text: Ptr; length: LONGINT; hTE: TEHandle);
  6570.  
  6571.     TESetText incorporates a copy of the specified text into the edit
  6572. record specified by hTE. The text parameter points to the text, and
  6573. the length paramenter indicates the number of characters in the text.
  6574. The selection range is set to an insertion point at the end of the
  6575. text. TESetText doesn't affect the text drawn in the destination
  6576. rectangle, so call TEUpdate afterward if necessary. TESetText doesn't 
  6577. dispose of any text currently in the edit record.
  6578. \ TEGetText
  6579. 8
  6580. FUNCTION TEGetText (hTE: TEHandle) : CharsHandle;
  6581.  
  6582.     TEGetText returns a handle to the text of the specified edit record.
  6583. The result is the same as the handle in the hText field of the edit
  6584. record, but has the CharsHandle data type, which is defined as:
  6585.  
  6586.        TYPE CharsHandle = ^CharsPtr;
  6587.             CharsPtr    = ^Chars;
  6588.         Chars       =PACKED ARRAY{0..3200] OF CHAR;
  6589.  
  6590.     You can get the length of the text from the teLength field of the
  6591. edit record.
  6592. \ TEIdle
  6593. 8
  6594. PROCEDURE TEIdle (hTE: TEHandle);
  6595.  
  6596.     Call TEIdle repeatedly to make a blinking caret appear at the
  6597. insertion point (if any) in the text specified by hTE. (The caret
  6598. appears only when the window containing that text is active, of course.)
  6599. TextEdit observes a minimum blink interval:  No mater how often  you
  6600. call TEIdle, the time between blinks will never be less than the
  6601. minimum interval.
  6602.  
  6603. (note)
  6604.       You actually need to call TEIdle only when the window
  6605.       containing the text is active.
  6606. \ TEClick
  6607. 8
  6608. PROCEDURE TEClick (pt: Point; extend: BOOLEAN; hTE: TEHandle);
  6609.  
  6610.     TEClick controls the placement and highlighting of the selection
  6611. range as determined by mouse events. Call TEClick whenever a mouse-down
  6612. event occurs in the view rectangle of the edit record specified by hTE,
  6613. and the window associated with that edit record is active. TEClick
  6614. keeps control until the mouse button is released. Pt is the mouse
  6615. location (in local coordinates) at the time the button was pressed,
  6616. obtainable from the event record.
  6617.  
  6618. (note)
  6619.       Use the QuickDraw procedure GlobalToLocal to convert the
  6620.       global coordinates of the mouse location given in the
  6621.       event record to the local coordinate system for pt.
  6622.  
  6623.     Pass TRUE for the extend parameter if the Event Manager indicates
  6624. that the Shift key was held down at the time of the click (to extend the
  6625. selection).
  6626.  
  6627.     TEClick unhighlights the old selection range unless the selection
  6628. range is being extended. If the mouse moves, meaning that a drag is
  6629. occurring, TEClick expands or shortens the selection range accordingly.
  6630. In the case of a double-click, the word under the cursor becomes the
  6631. selection range; dragging expands or shortens the selection a word at a
  6632. time.
  6633. \ TESetSelect
  6634. 8
  6635. PROCEDURE TESetSelect (selStart,selEnd: LONGINT; hTE: TEHandle);
  6636.  
  6637.     TESetSelect sets the selection range to the text between selStart
  6638. and selEnd in the text specified by hTE. The old selection range is
  6639. unhighlighted, and the new one is highlighted. If selStart equals
  6640. selEnd, the selection range is an insertion point, and a caret is
  6641. displayed
  6642.  
  6643.     SelEnd and selStart can range from 0 to 32767. If selEnd is
  6644. anywhere beyond the last character of the text, the position just past
  6645. the last character is used.
  6646. \ TEActivate
  6647. 8
  6648. PROCEDURE TEActivate (hTE: TEHandle);
  6649.  
  6650.     TEActivate highlights the selection range in the view rectangle of
  6651. the edit record specified by hTE. If the selection range is an
  6652. insertion point, it displays a caret there. This procedure should be
  6653. called every time the Toolbox Event Manager function GetNextEvent
  6654. reports that the window containing the edit record has become active.
  6655. \ TEDeactivate
  6656. 8
  6657. PROCEDURE TEDeactivate (hTE: TEHandle);
  6658.  
  6659.     TEDeactivate unhighlights the selection range in the view rectangle
  6660. of the edit record specified by hTE. If the selection range is an
  6661. insertion point, it removes the caret. This procedure should be called
  6662. every time the Toolbox Event Manager function GetNextEvent reports that
  6663. the window containing the edit record has become inactive.
  6664. \ TEKey
  6665. 8
  6666. PROCEDURE TEKey (key: CHAR; hTE: TEHandle);
  6667.  
  6668.     TEKey replaces the selection range in the text specified by hTE with
  6669. the character given by the key parameter, and leaves an insertion point
  6670. just past the inserted character. If the selection range is an
  6671. insertion point, TEKey just inserts the character there. If the key
  6672. parameter contains a Backspace character, the selection range or the
  6673. character immediately to the left of the insertion point is deleted.
  6674. TEKey redraws the text as necessary. Call TEKey every time the Toolbox
  6675. Event Manager function GetNextEvent reports a keyboard event that your
  6676. application decides should be handled by TextEdit.
  6677.  
  6678. (note)
  6679.       TEKey inserts every character passed in the key
  6680.       parameter, so it's up to your application to filter out
  6681.       all characters that aren't actual text (such as keys
  6682.       typed in conjuction with the Command key).
  6683. \ TECut
  6684. 8
  6685. PROCEDURE TECut (hTE: TEHandle);
  6686.  
  6687.     TECut removes the selection range from the text specified by hTE and
  6688. places it in the TextEdit scrap. The text is redrawn as necessary.
  6689. Anything previously in the scrap is lost. (See Figure 6.)  If the
  6690. selection range is an insertion point, the scrap is emptied.
  6691. \ TECopy
  6692. 8
  6693. PROCEDURE TECopy (hTE: TEHandle);
  6694.  
  6695.     TECopy copies the selection range from the text specified by hTE
  6696. into the TextEdit scrap. Anything previously in the scrap is deleted.
  6697. The selection range is not deleted. If the selection range is an
  6698. insertion point, the scrap is emptied.
  6699. \ TEPaste
  6700. 8
  6701. PROCEDURE TEPaste (hTE: TEHandle);
  6702.  
  6703.     TEPaste replaces the selection range in the text specified by hTE
  6704. with the contents of the TextEdit scrap, and leaves an insertion point
  6705. just past the inserted text. (See Figure 7.)  The text is redrawn as
  6706. necessary. If the scrap is empty, the selection range is deleted. If
  6707. the selection range is an insertion point, TEPaste just inserts the
  6708. scrap there.
  6709. \ TEDelete
  6710. 8
  6711. PROCEDURE TEDelete (hTE: TEHandle);
  6712.  
  6713.     TEDelete removes the selection range from the text specified by hTE,
  6714. and redraws the text as necessary. TEDelete is the same as TECut
  6715. (above) except that it doesn't transfer the selection range to the
  6716. scrap. If the selection range is an insertion point, nothing happens.
  6717. \ TEInsert
  6718. 8
  6719. PROCEDURE TEInsert (text: Ptr; length: LONGINT; hTE: TEHandle);
  6720.  
  6721.     TEInsert takes the specified text and inserts it just before the
  6722. selection range into the text indicated by hTE, redrawing the text as
  6723. necessary. The text parameter points to the text to be inserted, and
  6724. the length parameter indicates the number of characters to be inserted.
  6725. TEInsert doesn't affect either the current  selection range or the
  6726. scrap.
  6727. \ TESetJust
  6728. 8
  6729. PROCEDURE TESetJust (just: INTEGER, hTE: TEHandle);
  6730.  
  6731.     TESetJust sets the justification of the text specified by hTE to
  6732. just. (See"Justification" under "Edit Records".)  TextEdit provides
  6733. three predefined constants for setting justification:
  6734.  
  6735.         CONST: teJustLeft   = 0;
  6736.                teJustCenter = 1;
  6737.                teJustRight  = -1;
  6738.  
  6739.     By default, text is left-justified. If you change the
  6740. justification, call TEUpdate after TESetJust, to redraw the text with
  6741. the new justification.
  6742. \ TEUpdate
  6743. 8
  6744. PROCEDURE TEUpdate (rUpdate: Rect; hTE: TEHandle);
  6745.  
  6746.     TEUpdate draws the text specified by hTE within the rectangle
  6747. specified by rUpdate. The rUpdate rectangle must be given in the
  6748. coordinates of the current grafPort. Call TEUpdate every time the
  6749. Tolbox Event Manager function GetNextEvent reports an update event for a
  6750. text editing window--after you call the Window Manager procedure
  6751. BeginUpdate, and before you call EndUpdate.
  6752.  
  6753. Normally you'll do the following when an update event occurs:
  6754.  
  6755.        BeginUpdate(myWindow);
  6756.        EraseRect(myWindow^.portRect);
  6757.        TEUpdate(myWindow^I.protRect,hTE);
  6758.        EndUpdate(myWindow)
  6759.  
  6760.     If you don't include the EraseRect call, the caret may sometimes
  6761. remain visible when the window is deactivated.
  6762. \ TextBox
  6763. 8
  6764. PROCEDURE TextBox (text: Ptr; length: LONGINT; box: Rect; just:
  6765.             INTEGER);
  6766.  
  6767.     TextBox draws the specified text in the rectangle indicated by the
  6768. box parameter with justification just. (See "justification" under "Edit
  6769. Records".)  The text parameter points to the text, and the length
  6770. parameter indicates the number of characters to draw. The rectangle is
  6771. specified in local coordinates, that must be at least as wide as the
  6772. first character drawn (about 20 pixels is usually a good width).
  6773. TextBox does not create an edit record, nor can the text that it draws
  6774. be edited; it's used solely for drawing text. For example:
  6775.  
  6776.     str := 'String in a box';
  6777.     SetRect(r,100,100,200,200);
  6778.     TextBox(POINTER(ORD(@str)+1),LENGTH(str),r,teJustCenter);
  6779.     FrameRect(r)
  6780.  
  6781.     Because Pascal strings start with a length byte, you must advance
  6782. the pointer one position past the beginning of the string to point to
  6783. the start of the text.
  6784. \ TEScroll
  6785. 8
  6786. PROCEDURE TEScroll (dh,dv: INTEGER; hTE: TEHandle);
  6787.  
  6788.     TEScroll scrolls the text within the view rectangle of the specified
  6789. edit record by the number of pixels specified in the dh and dv
  6790. parameters. The edit record is specified by the hTE parameter.
  6791. Positive dh and dv values move the text right and down, respectively,
  6792. and negative values move the text left and up. For example,
  6793.  
  6794.      TEScroll(0,-hTE^^.lineHeight,hTE)
  6795.  
  6796. scrolls the text up one line. Remember that you scroll text up when
  6797. the user clicks in the scroll arrow pointing down. The destination
  6798. rectangle is offset by the amount you scroll.
  6799.  
  6800. (note)
  6801.       To implement automatic scrolling, you store the address
  6802.       of a routine in the clikLoop field of the edit record, as
  6803.       described above under "The TERec Data Type".
  6804. \ TEFromScrap
  6805. 8
  6806. FUNCTION TEFromScrap : OSErr;  [Not in ROM]
  6807.  
  6808.     TEFromScrap copies the desk scrap to the TextEdit scrap.
  6809. \ TEToScrap
  6810. 8
  6811. FUNCTION TEToScrap : OSErr;  [Not in ROM]
  6812.  
  6813.     TEToScrap copies the TextEdit scrap to the desk scrap.
  6814.  
  6815. (warning)
  6816.          You must call the Scrap Manager function ZeroScrap to
  6817.      initialize the desk scrap or clear its previous contents
  6818.      before calling TEToScrap.
  6819. \ TEScrapHandle
  6820. 8
  6821. FUNCTION TEScarapHandle : Handle;  [Not in ROM]
  6822.  
  6823.     TEScrapHandle returns a handle to the TExtEdit scrap.
  6824. \ TEGetScrapLen
  6825. 8
  6826. FUNCTION TEGetScrapLen : LONGINT; [Not in ROM]
  6827.  
  6828.     TEGetScrapLen returns the size of the TextEdit scrap in bytes.
  6829. \ TESetScrapLen
  6830. 8
  6831. PROCEDURE TESetScrapLen (length: LONGINT); [Not in ROM]
  6832.  
  6833.     TESetScrapLen sets the size of the TextEdit scrap to the given
  6834. number of bytes.
  6835. \ TECalText
  6836. 8
  6837. PROCEDURE TECalText (hTE: TEHandle);
  6838.  
  6839.     TECalText recalculates the beginnings of all lines of text in the
  6840. edit record specified by hTE, updating elements of the lineStarts array.
  6841. Call  TECalText if you've changed the destination rectangle, the hText
  6842. field, or any other field that affects the number of characters per line.
  6843.  
  6844. (note)
  6845.       There are two ways to specify text to be edited. The
  6846.       easiest method is to use TESetText, which takes an
  6847.       existing edit record, creates a copy of the specified
  6848.       text, and stores a handle to the copy in the edit record.
  6849.       You can instead directly change the hText field of the
  6850.       edit record, and then call TECalText to recalculate the
  6851.       lineStarts aray to match the new text. If you have a
  6852.       lot of text, you can use the latter method to save space.
  6853. \ TESelView
  6854. 8
  6855. PROCEDURE TESelView (hTE: TEHandle);
  6856.  
  6857.     If automatic scrolling has been enabled (by a call to TEAutoView,
  6858. described below), TESelView makes sure that the selection range is
  6859. visible, scrolling it into the view rectangle if necessary.
  6860. If automatic scrolling is disabled, TESelView does nothing.
  6861.  
  6862. Note:  The top left of the insertion is scrolled into view; if text
  6863. is being displayed in a rectangle that╒s not tall enough, automatic
  6864. scrolling could cause the text to jump up and down at times.
  6865. \TEPinScroll
  6866. 8
  6867. PROCEDURE TEPinScroll (dh,dv: INTEGER; hTE: TEHandle);
  6868.  
  6869.     TEPinScroll is similar to TEScroll except that it stops scrolling
  6870. when the last line scrolls into the view rectangle.
  6871. \TEAutoView
  6872. 8
  6873. PROCEDURE TEAutoView (auto: BOOLEAN; hTE: TEHandle);
  6874.  
  6875.     TEAutoView enables and disables automatic scrolling of text in the
  6876. edit record specified by hTe. If the auto parameter is FALSE,
  6877. automatic scrolling is disabled and calling TESelView has no effect.
  6878. \ InitDialogs
  6879. 9
  6880. PROCEDURE InitDialogs (restartProc: ProcPtr);
  6881.  
  6882.     Call InitDialogs once before all other Dialog Manager routines, to
  6883. initialize the Dialog Manager.
  6884.  
  6885.   -It sets a pointer to a fail-safe procedure as specified by
  6886.    restartProc; this pointer will be accessed when a system error
  6887.    (such as running out of memory) occurs. RestartProc should point
  6888.    to a procedure that will restart the application after a system
  6889.    error. If no such procedure is desired, pass NIL as the parameter.
  6890.  
  6891.   -It installs the standard sound procedure.
  6892.  
  6893.   -It passes empty strings to ParamText.
  6894. \ ErrorSound
  6895. 9
  6896. PROCEDURE ErrorSound (soundProc: ProcPtr);
  6897.  
  6898.     ErrorSound sets the sound procedure for dialogs and alerts to the
  6899. procedure pointed to by soundProc; if you don't call ErrorSound, the
  6900. Dialog Manager uses the standard sound procedure. (For details, see
  6901. the "Alerts" section abouve.)  If you pass NIL for soundProc, there will
  6902. be no sound (or menu bar blinking) at all.
  6903. \ SetDAFont
  6904. 9
  6905. PROCEDURE SetDAFont (fontNum: INTEGER);  [Pascal only]
  6906.  
  6907.     For subsequently created dialogs and alerts, SetDAFont sets the font
  6908. of the dialog or alert window's grafPort to the font having the
  6909. specified font number. If you don't call this procedure, the system
  6910. font is used. SetDAFont affects statText and editText items but not
  6911. titles of controls, which are always in the system font.
  6912. \ NewDialog
  6913. 9
  6914. FUNCTION NewDialog (dStorage: Ptr; boundsRect: Rect; title: Str255;
  6915.             visible: BOOLEAN; procID: INTEGER; behind: WindowPtr;
  6916.         goAwayFlag: BOOLEAN; refCon: LongInt; items: Handle) :
  6917.         DialogPtr;
  6918.  
  6919.     NewDialog creates a dialog as specified by its parameters and
  6920. returns a pointer to the new dialog. The first eight parameters
  6921. (dStorage through refCon) are pased to the Window Manager function
  6922. NewWindow, which creates the dialog window; the meanings of these
  6923. parameters are summarized below. The items parameter is a handle to the
  6924. dialog's item list. You can get the items handle by calling the
  6925. Resource Mangager to read the item list from the resource file into
  6926. memory.
  6927.  
  6928. (note)
  6929.       Advanced programmers can create their own item lists in
  6930.       memory rather than have them read from a resource file.
  6931.       The exact format is given later under "Formats of
  6932.       Resources for Dialogs and Alerts".
  6933.  
  6934.     DStorage is analogous to the wStorage parameter of NewWindow; it's a
  6935. pointer to the storage to use for the dialog record. If you pass NIL
  6936. for dStorage, the dialog record will be allocated on the heap (which,
  6937. in the case of modeless dialogs, may cause the heap to become
  6938. fragmented).
  6939.  
  6940.     BoundsRect, a rectangle given in global coordinates, determines the
  6941. dialog window's size and location. It becomes the portRect of the
  6942. window's grafPort. Remember that the top coordinate of this rectangle
  6943. should be at least 25 points below the top of the screen for a modal
  6944. dialog, to allow for the menu bar and the border around the portRect,
  6945. and at least 40 points below the top of the screen for a modeless
  6946. dialog, to allow for the menu bar and the window's title bar.
  6947.  
  6948.     Title is the title of a modeless dialog box; pass the empty string
  6949. for modal dialogs.
  6950.  
  6951.     If the visible parameter is TRUE, the dialog window is drawn on the
  6952. screen. If it's FALSE, the window is initially invisible and may later
  6953. be shown with a call to the Window Manager procedure ShowWindow.
  6954.  
  6955. (note)
  6956.       NewDialog generates an update event for the entire window
  6957.       contents, so the items aren't drawn immediately, with the
  6958.       exception of controls. The Dialog Manager calls the
  6959.       Control Manager to draw controls, and the Control Manager
  6960.       draws them immediately rather than via the standard
  6961.       update mechanism. Because of this, the Dialog Manager
  6962.       calls the Window Manager procedure ValidRect for the
  6963.       enclosing rectangle of each control, so the controls
  6964.       won't be drawn twice. If you find that the other items
  6965.       aren't being drawn soon enough after the controls, try 
  6966.       making the window invisible initially and then calling
  6967.       ShowWindow to show it.
  6968.  
  6969.     ProcID is the window definition ID, which leads to the window
  6970. definition function for this type of window. The window definition IDs
  6971. for the standard types of dialog window are dBoxProc for the modal type
  6972. and documentProc for the modeless type.
  6973.  
  6974.     The behind parameter specifies the window behind which the dialog
  6975. window is to be placed on the desktop. Pass POINTER(-1) to bring up
  6976. the dialog window in front of all other windows.
  6977.  
  6978.     GoAwayFlag applies to modeles dialog boxes; if it's TRUE, the dialog
  6979. window has a close box in its title bar when the window is active.
  6980.  
  6981.     RefCon is the dialog window's reference value, which the application
  6982. may store into and access for any purpose.
  6983.  
  6984.     NewDialog sets the font of the dialog window's grafPort to the
  6985. system font or, if you previously called SetDAFont, to the specified
  6986. font. It also sets the window class in the window record to dialogKind.
  6987. \ GetNewDialog
  6988. 9
  6989. FUNCTION GetNewDialog (dialogID: INTEGER; dStorage: Ptr; behind:
  6990.             WindowPtr) : DialogPtr;
  6991.  
  6992.     Like NewDialog (above), GetNewDialog creates a dialog as specified
  6993. by its parameters and returns a pointer to the new dialog. Instead of
  6994. having the parameters boundsRect, title, visible, procID, goAwayFlag,
  6995. and refCon, GetNewDialog has a single dialogID parameter, where
  6996. dialogID is the resource ID of a dialog template that supplies the same
  6997. information as those parameters. The dialog template also contains the
  6998. resource ID of the dialog's item list. After calling the Resource
  6999. Manager to read the item list into memory (if it's not already in
  7000. memory), GetNewDialog makes a copy of the item list and uses that copy;
  7001. thus you may have multiple independent dialogs whose items have the
  7002. same types, locations, and initial contents. The dStorage and behind
  7003. parameters of GetNewDialog have the same meaning as in NewDialog.
  7004. \ CloseDialog
  7005. 9
  7006. PROCEDURE CloseDialog (theDialog: DialogPtr);
  7007.  
  7008.     CloseDialog removes theDialog's window from the screen and deletes
  7009. it from the window list, just as when the Window Manager procedure
  7010. CloseWindow is called. It releases the memory occupied by the
  7011. following:
  7012.  
  7013.   -The data structures associated with the dialog window (such as the
  7014.    window's structure, content, and update regions).
  7015.  
  7016.   -All the items in the dialog (except for pictures and icons, which
  7017.    might be shared resources), and any data structures associated
  7018.    with them. For example, it would dispose of the region occupied
  7019.    by the thumb of a scroll bar, or a similar region for some other
  7020.    control in the dialog.
  7021.  
  7022.     CloseDialog does not dispose of the dialog record or the item list.
  7023. Figure 6 illustrates the effect of CloseDialog (and DisposDialog,
  7024. described below).
  7025.  
  7026.     Call CloseDialog when you're done with a dialog if you supplied
  7027. NewDialog or GetNewDialog with a pointer to the dialog storage (in the
  7028. dStorage parameter) when you created the dialog.
  7029.  
  7030. (note)
  7031.       Even if you didn't supply a pointer to the dialog
  7032.       storage, you may want to call CloseDialog if you created
  7033.       the dialog with NewDialog. You would call CloseDialog if
  7034.       you wanted to keep the item list around (since, unlike
  7035.       GetNewDialog, NewDialog does not use a copy of the item
  7036.       list).
  7037. \ DisposDialog
  7038. 9
  7039. PROCEDURE DisposDialog (theDialog: DialogPtr);
  7040.  
  7041.     DisposDialog calls CloseDialog (above) and then releases the memory
  7042. occupied by the dialog's item list and dialog record. Call
  7043. DisposDialog when you're done with a dialog if you let the dialog
  7044. record be allocated on the heap when you created the dialog (by passing
  7045. NIL as the dStorage parameter to NewDialog or GetNewDialog).
  7046. \ CouldDialog
  7047. 9
  7048. PROCEDURE CouldDialog (dialogID:  INTEGER);
  7049.  
  7050.     CouldDialog ensures that the dialog template having the given
  7051. resource ID is in memory and makes it unable to be purged. It does the
  7052. same for the dialog window's definition function, the dialog's item list
  7053. resource, and any item defined as resources. This is useful if the
  7054. dialog box may come up when the resource file isn't accessible, such as
  7055. during a disk copy.
  7056. \ FreeDialog
  7057. 9
  7058. PROCEDURE FreeDialog (dialogID: INTEGER);
  7059.  
  7060.     Given the resource ID of a dialog template previously specified in a
  7061. call to CouldDialog (above), FreeDialog undoes the effect of
  7062. CouldDialog. It should be called when there's no longer a need to keep
  7063. the resources in memory.
  7064. \ ModalDialog
  7065. 9
  7066. PROCEDURE ModalDialog (filterProc: ProcPtr; VAR itemHit: INTEGER);
  7067.  
  7068.     Call ModalDialog after creating a modal dialog and bringing up its
  7069. window in the frontmost plane. ModalDialog repeatedly gets and handles
  7070. events in the dialog's window; after handling an event involving an
  7071. enabled dialog item, it returns with the item number in itemHit.
  7072. Normally you'll then do whatever is appropriate as a response to an 
  7073. event in that item.
  7074.  
  7075.     ModalDialog gets each event by calling the Toolbox Event Manager
  7076. function GetNextEvent. If the event is a mouse-down event outside the
  7077. content region of the dialog window, ModalDialog emits sound number 1
  7078. (which should be a single beep) and gets the next event; otherwise, it
  7079. filters and handles the event as described below.
  7080.  
  7081. (note)
  7082.       Once before getting each event, ModalDialog calls
  7083.       SystemTask, a Desk Manager procedure that needs to be
  7084.       called regularly if the application is to support the use
  7085.       of desk accessories.
  7086.  
  7087.     The filterProc parameter determines how events are filtered. If it's
  7088.  NIL, the standard filterProc function is executed; this causes
  7089.  ModalDialog to return 1 in itemHit if the Return key or Enter key is
  7090.  pressed. If filterProc isn't NIL, ModalDialog filters events by
  7091.  executing the function it points to. Your filterProc function should
  7092.  have three parameters and return a Boolean value. For example, this is
  7093.  how it would be declared if it were named MyFilter:
  7094.  
  7095.       FUNCTION MyFilter (theDialog: DialogPtr; VAR theEvent:
  7096.                          EventRecord; VAR itemHit: INTEGER ) : BOOLEAN;
  7097.  
  7098.     A function result of FALSE tells ModalDialog to go ahead and handle
  7099. the event, which either can be sent through unchanged or can be changed
  7100. to simulate a different event. A function result of TRUE tells
  7101. ModalDialog to return imediately rather than handle the event; in this
  7102. case, the filterProc function sets itemHit to the item number that
  7103. ModalDialog should return.
  7104.  
  7105. (note)
  7106.       ModalDialog calls GetNextEvent with a mask that excludes
  7107.       disk-inserted events. To receive disk-inserted events,
  7108.       your filterProc function can call GetNextEvent (or
  7109.       EventAvail) with a mask that accepts only that type of event.
  7110.  
  7111.     ModalDialog handles the evnets for which the filterProc function
  7112. returns FALSE as follows:
  7113.  
  7114.   -In response to an activate or update event for the dialog window,
  7115.    ModalDialog activates or updates the window.
  7116.  
  7117.   -If the mouse button is pressed in an editText item, ModalDialog
  7118.    responds to the mouse activity as appropriate (displaying an
  7119.    insertion point or selecting text). If a key-down event occurs
  7120.    and there's an editText item, text entry and editing are handled
  7121.    in the standard way for such items (except that if the Command key
  7122.    is down, ModalDialog responds as though it isn't). In either
  7123.    case, ModalDialog returns if the editText item is enabled or does
  7124.    nothing if it's disabled. If a key-down event occurs when there's
  7125.    no editText item, ModalDialog does nothing.
  7126.  
  7127.   -If the mouse button is pressed in a control, ModalDialog calls the
  7128.    Control Manager function TrackControl. If the mouse button is
  7129.    released inside the control and the control is enabled,
  7130.    ModalDialog returns; otherwise, it does nothing.
  7131.  
  7132.   -If the mouse button is pressed in any other enabled item in the
  7133.    dialog box, ModalDialog returns. If the mouse button is pressed
  7134.    in any other disabled item or in no item, or if any other event
  7135.    occurs, ModalDialog does nothing.
  7136. \ IsDialogEvent
  7137. 9
  7138. FUNCTION IsDialogEvent (theEvent: EventRecord) : BOOLEAN;
  7139.  
  7140.     If your application includes any modeless dialogs, call
  7141. IsDialogEvent after calling the Toolbox Event Manager function
  7142. GetNextEvent. Pass the current event in theEvent. IsDialogEvent
  7143. determines whether theEvent needs to be handled as part of a dialog. If
  7144. theEvent is an activate or update event for a dialog window, a
  7145. mouse-down event in the content region of an active dialog window, or
  7146. any other type of event when a dialog window is active, IsDialogEvent
  7147. returns TRUE; otherwise, it returns FALSE.
  7148.  
  7149.     When FALSE is returned, just handle the event yourself like any
  7150. other event that's not dialog-related. When TRUE is returned, you'll
  7151. generally end up passing the event to DialogSelect for it to handle (as
  7152. described below), but first you should do some additional checking:
  7153.  
  7154.    - DialogSelect doesn't handle keyboard equivalents for commands.
  7155.      Check whether the event is a key-down event with the Command key
  7156.      held down and, if so, carry out the command if it's one that
  7157.      applies when a dialog window is active. (If the command doesn't
  7158.      so apply, do nothing.)
  7159.  
  7160.   - In special cases, you may want to bypass DialogSelect or do some
  7161.     preprocessing before calling it. If so, check for those events
  7162.     and respond accordingly. You would need to do this, for example,
  7163.     if the dialog is to respond to disk-inserted events.
  7164.  
  7165.     For cases other than these, pass the event to DialogSelect for it to
  7166. handle.
  7167. \ DialogSelect
  7168. 9
  7169. FUNCTION DialogSelect (theEvent: EventRecord; VAR theDialog: DialogPtr;
  7170.             VAR itemHit: INTEGER) : BOOLEAN;
  7171.  
  7172.     You'll normally call DialogSelect after IsDialogEvent, passing in
  7173. theEvent an event that needs to be handled as part of a modeless
  7174. dialog. DialogSelect handles the event as described below. If the
  7175. event involves an enabled dialog item, DialogSelect returns a function
  7176. result of TRUE with the dialog pointer in theDialog and the item number
  7177. in itemHit; otherwise, it returns FALSE with theeDialog and itemHit
  7178. undefined. Normally when DialogSelect returns TRUE, you'll do whatever
  7179. is appropriate as a response to the event, and when it returns FALSE
  7180. you'll do nothing.
  7181.  
  7182.     If the event is an activate or update event for a dialog window,
  7183. DialogSelect activates or updates the window ane returns FALSE.
  7184.  
  7185.     If the event is a mouse-down event in an editText item, DialogSelect
  7186. responds as appropriate (displaying an insertion point or selecting
  7187. text). If it's a key-down event and there's an editText item, text
  7188. entry and editing are handled in the standard way. In either case,
  7189. DialogSelect returns TRUE if the editText item is enabled or FALSE if
  7190. it's disabled. If a key-down event is passed when there's no editText
  7191. item, DialogSelect returns FALSE.
  7192.  
  7193. (note)
  7194.       For a key-down event, DialogSelect doesn't check to see
  7195.       whether the Command key is held down; to handle keyboard
  7196.       equivalents of commands, you have to check for them
  7197.       before calling DialogSelect. Similarly, to treat a typed
  7198.       character in a special way (such as ignore it, or make it
  7199.       have the same effect as another character or as clicking
  7200.       a button), you need to check for a key-down event with
  7201.       that character before calling DialogSelect.
  7202.  
  7203.     If the event is a mouse-down event in a control, DialogSelect calls
  7204. the Control Manager function TrackControl. If the mouse button is
  7205. released inside the control and the control is enabled, DialogSelect
  7206. returns TRUE; otherwise, it returns FALSE.
  7207.  
  7208.     If the event is a mouse-down event in any other enabled item,
  7209. DialogSelect returns TRUE. If it's  a mouse-down event in any other
  7210. disabled item or in no item, or if it's any other event, DialogSelect
  7211. returns FALSE.
  7212. \ DlgCut
  7213. 9
  7214. PROCEDURE DlgCut (theDialog: DialogPtr);   [Pascal only]
  7215.  
  7216.     DlgCut checks whether theDialog has any editText items and, if so,
  7217. applies the textEdit procedure TECut to the currently selected editText
  7218. item. (If the dialog record's editField is 0 or greater, DlgCut passes
  7219. the contents of the textH field to TECut.)  You can call DlgCut to
  7220. handle the editing command Cut when a modeless dialog window is active.
  7221. \ DlgCopy
  7222. 9
  7223. PROCEDURE DlgCopy (theDialog: DialogPtr);   [Pascal only]
  7224.  
  7225.     DlgCopy is the same as DlgCut (above) except that it calls TECopy,
  7226. for handling the Copy command.
  7227. \ DlgPaste
  7228. 9
  7229. PROCEDURE DlgPaste (theDialog: DialogPtr);   [Pascal only]
  7230.  
  7231.     DlgPaste is the same as DlgCut (above) except that it calls TEPaste,
  7232. for handling the Paste command.
  7233. \ DlgDelete
  7234. 9
  7235. PROCEDURE DlgDelete (theDialog: DialogPtr);   [Pascal only]
  7236.  
  7237.     DlgDelete is the same as DlgCut (above) except that it calls
  7238. TEDelete, for handling the Clear command.
  7239. \ DrawDialog
  7240. 9
  7241. PROCEDURE DrawDialog (theDialog: DialogPtr);
  7242.  
  7243.     DrawDialog draws the contents of the given dialog box. Since
  7244. DialogSelect and ModallDialog handle dialog window updating, this
  7245. procedure is useful only in unusual situations. You would call it, for
  7246. example, to display a dialog box that doesn't require any response but
  7247. merely tells the user what's going on during a time-consuming process.
  7248. \ Alert
  7249. 9
  7250. FUNCTION Alert (alertID: INTEGER; filterProc: ProcPtr) : INTEGER;
  7251.  
  7252.     This function invokes the alert defined by the alert template that
  7253. has the given resource ID. It calls the currnet sound procedure, if
  7254. any,l passing it the sound number specified in the alert template for
  7255. this stage of the alert. If no alert box is to be drawn at this stage,
  7256. Alert returns a function result of -1; otherwise, it creates and
  7257. displays the alert window for this alert and draws the alert box.
  7258.  
  7259. (note)
  7260.       It creates the alert window by calling NewDialog, and
  7261.       does the rest of its processing by calling ModalDialog.
  7262.  
  7263.     Alert repeatedly gets and handles events in the alert window until
  7264. an enabled item is clicked, at which time it returns the item number.
  7265. Normally you'll then do whatever is appropriate in response to a click
  7266. of that item.
  7267.  
  7268.     Alert gets each event by calling theToolbox Event Manager function
  7269. GetNextEvent. If the event is a mouse-down event outside the content
  7270. region of the alert window, Alert emits sound number 1 (which should be
  7271. a single beep) and gets the next event; otherwise, it filters and
  7272. handles the event as describe below.
  7273.  
  7274.     The filterProc parameter has the same meaning as in ModalDialog (see
  7275. above). If it's NIL, the standard filterProc function is executed,
  7276. which makes the Return key or the Enter key have the same effect as
  7277. clicking the default button. If you specify your own filterProc
  7278. function and want to retain this feature, you must include it in your
  7279. function. You can find out what the current default button is by
  7280. looking at the aDefItem field of the dialog record for the alert (via
  7281. the dialog pointer passed to the function).
  7282.  
  7283.     Alert handles the events for which the filterProc function returns
  7284. FALSE as follows:
  7285.  
  7286.  
  7287.   - If the mouse button is pressed in a control, Alert calls the
  7288.     Control Manager procedure TrackControl. If the mouse buton is
  7289.     released inside the control and the control is enabled, Alert
  7290.     returns; otherwise, it does nothing.
  7291.  
  7292.   - If the mouse button is pressed in any other enabled item, Alert
  7293.     simply returns. If it's pressed in any other disabled item or in 
  7294.     no item, or if any other event occurs, Alert does nothing.
  7295.  
  7296.     Before returning to the application with the item number, Alert
  7297. removes the alert box from the screen. (It disposes of the alert window
  7298. and its associated data structures, the item list, and the items.)
  7299.  
  7300. (note)
  7301.        The Alert function's removal of the alert box would not
  7302.        be the desired result if the user clicked a check box or
  7303.        radio button; however, normally alerts contain only
  7304.        static text, icons, pictures, and buttons that are
  7305.        supposed to make the alert box go away. If your alert
  7306.        contains other items besides these, consider whether it
  7307.        might be more appropriate as a dialog.
  7308. \ StopAlert
  7309. 9
  7310. FUNCTION StopAlert (alertID: INTEGER; filterProc: ProcPtr) : INTEGER;
  7311.  
  7312.     StopAlert is the same as the Alert function (above) except that
  7313. before drawing the items of the alert in the alert box, it draws the
  7314. Stop icon in the top left corner of the box (within the rectangle
  7315. (10,20,42,52)). The Stop icon has the following resource ID:
  7316.  
  7317.        CONST stopIcon = 0;
  7318.  
  7319.     If the application's resource file doesn't include an icon with that
  7320. ID number, the Dialog Manager uses the standart Stop icon in the system
  7321. resource file (see Figure 7).
  7322. \ NoteAlert
  7323. 9
  7324. FUNCTION NoteAlert (alertID: INTEGER; filterProcf: ProcPtr) : INTEGER;
  7325.  
  7326.     NoteAlert is like StopAlert except that it draws the Note icon,
  7327. which has the following resource ID:
  7328.  
  7329.        CONST noteIcon = 1;
  7330. \ CautionAlert
  7331. 9
  7332. FUNCTION CautionAlert (alertID: INTEGER; filterProc: ProcPtr) :
  7333.            INTEGER;
  7334.  
  7335.     CautionAlert is like StopAlert except that it draws the Caution
  7336. icon, which has the following resource ID:
  7337.  
  7338.        CONST ctnIcon = 2;
  7339. \ CouldAlert
  7340. 9
  7341. PROCEDURE CouldAlert (alertID: INTEGER);
  7342.  
  7343.     CouldAlert ensures that the alert template having the given resource
  7344. ID is in memory and makes it unable to be purged. It does the same for
  7345. the alert window's definition function, the alert's item list resource,
  7346. and any items defined as resources. This is useful if the alert may
  7347. occur when the resource file isn't accessible, such as during a disk
  7348. copy.
  7349. \ FreeAlert
  7350. 9
  7351. PROCEDURE FreeAlert (alertID: INTEGER);
  7352.  
  7353.     Given the resource ID of an alert template previously specified in a
  7354. call to CouldAlert (above), FreeAlert undoes the effect of CouldAlert.
  7355. It should be called when there's no longer a need to keep the resources
  7356. in memory.
  7357. \ ParamText
  7358. 9
  7359. PROCEDURE ParamText (param0,param1,param2,param3: Str255);
  7360.  
  7361.     ParamText provides a means of substituting text in statText items:
  7362. param0 through param3 will replace the special strings '^0' through
  7363. '^I3' in all statText items in all subsequent dialog or alert boxes.
  7364. Pass empty strings for parameters not used.
  7365.  
  7366.     For example, if the text is defined as 'Cannot open document ^0' and
  7367. docName is a string variable containg a document name that the user
  7368. typed, you can call ParamText(docName, '','','').
  7369.  
  7370. (warning)
  7371.          All strings that will need to be translated to foreign
  7372.         languages should be stored in resource files.
  7373.  
  7374.  
  7375.  
  7376. \ GetDItem
  7377. 9
  7378. PROCEDURE GetDItem (theDialog: DialogPtr; itemNo: INTEGER; VAR type:
  7379.                     INTEGER; VAR item: Handle; VAR box: Rect);
  7380.  
  7381.     GetDItem returns in its VAR parameters the following information
  7382. about the item numbered itemNo in the given dialog's item list: in the
  7383. type parameter, the item type; in the item parameter, a handle to the
  7384. item (or, for item type userItem, the procedure pointer); and in the box
  7385. parameter, the display rectangle for the item.
  7386.  
  7387.     Suppose, for example, that you want to change the title of a control
  7388. in a dialog box. You can get the item handle with GetDItem, convert it
  7389. to type ControlHandle, and call the Control Manager procedure SetCTitle
  7390. to change the title. Similarly, to move the control or change its size,
  7391. you would call MoveControl or SizeControl.
  7392.  
  7393. (note)
  7394.       To access the text of a statText or editText item, pass
  7395.       the handle returned by GetDItem to GetIText or SetIText
  7396.       (see below).
  7397. \ SetDItem
  7398. 9
  7399. PROCEDURE SetDItem (theDialog: DialogPtr; itemNo: INTEGER; type:
  7400.             INTEGER; item: Handle; box: rect);
  7401.  
  7402.     SetDItem sets the item numbered itemNo in the given dialog's item
  7403. list, as specified by the parameters (without drawing the item). The
  7404. type parameter is the item type; the item parameter is a handle to the
  7405. item (or, for item type userItem, the procedure pointer); and the box
  7406. parameter is the display rectangle for the item.
  7407.  
  7408.     Consider, for example, how to install an item of type userItem in a
  7409. dialog:  In the item list in the resource file, define an item in which
  7410. the type is set to userItem and the display rectangle to (0,0,0,0).
  7411. Specify that the dialog window be invisible (in either the dialog
  7412. template or the NewDialog call). After creating the dialog, convert
  7413. the item's procedure pointer to type Handle; then call SetDItem,
  7414. passing that handle and the display rectangle for the item. Finally,
  7415. call the Window Manager procedure ShowWindow to display the dialog
  7416. window.
  7417.  
  7418. (note)
  7419.       Do not use SetDItem to change the text of a statText or
  7420.       editText item or to change or move a control. See the
  7421.       description of GetDItem above for more information.
  7422. \ GetIText
  7423. 9
  7424. PROCEDURE GetIText (item: Handle; VAR text: str255);
  7425.  
  7426.     Given a handle to a statText or editText item in a dialog box, as
  7427. returned by GetDItem, GetIText returns the text of the item in the text
  7428. parameter.
  7429. \ SetIText
  7430. 9
  7431. PROCEDURE SetIText (item: Handle; text: Str255);
  7432.  
  7433.     Given a handle to a statText or editText item in a dialog box, as
  7434. returned by GetDItem, SetIText sets the text of the item to the
  7435. specified text and draws the item. For example, suppose the exact
  7436. content of a dialog's text item cannot be determined until the
  7437. application is running, but the display rectangle is defined in the
  7438. resource file:  Call GetDItem to get a handle to the item, and call
  7439. SetIText with the desired text.
  7440. \ SelIText
  7441. 9
  7442. PROCEDURE SelIText (theDialog: DIalogPtr; itemNo: INTEGER;
  7443.            strtSel,endSel: INTEGER);
  7444.  
  7445.     Given a pointer to a dialog and the item number of an editText item
  7446. in the dialog box, SelIText does the following:
  7447.  
  7448.    - If the item contains text, SelIText sets the selection range to
  7449.      extend from character position strtSel up to but not including
  7450.      character position endSel. The selection range is inverted unless
  7451.      strtSel equals endSel, in which case a blinking vertical bar is
  7452.      displayed to indicate an insertion point at that position.
  7453.  
  7454.    - If the item doesn't contain text, SelIText simply displays the
  7455.      insertion point.
  7456.  
  7457.     For example, if the user makes an unacceptable entry in the editText
  7458. item, the application can put up an alert box reporting the problem and
  7459. then select the entire text of the item so it can be replaced by a new
  7460. entry. (Without this procedure, the user would have to select the item
  7461. before making the new entry.)
  7462.  
  7463. (note)
  7464.       You can select the entire text by specifying 0 for
  7465.       strtSel and a very large number for endSel. For details
  7466.       about selection range and character position, see the
  7467.       TextEdit manual.
  7468. \ GetAlrtStage
  7469. 9
  7470. FUNCTION GetAlrtStage : INTEGER;   [Pascal only]
  7471.  
  7472.     GetAlrtStage returns the stage of the last occurrence of an alert,
  7473. as a number from 0 to 3.
  7474. \ ResetAlrtStage
  7475. 9
  7476. PROCEDURE ResetAlrtStage;   [Pascal only]
  7477.  
  7478.     ResetAlrtStage resets the stage of the last occurrence of an alert
  7479. so that the next occurrenct of the same alert will be treatd as its
  7480. first stage. This is useful, for example, when you've used ParamText
  7481. to change the text of an alert such that from the user's point of view
  7482. it's a different alert.
  7483. \ HideDItem
  7484. 9
  7485. PROCEDURE HideDItem (theDialog: DialogPtr; itemNo: INTEGER);
  7486.  
  7487.     HideDItem hides the item numbered itemNo in the given dialog╒s item
  7488. list by giving the item a display rectangle that╒s off the screen.
  7489. (Specifically, if the left coordinate of the item╒s display rectangle
  7490. is less than 8192, ShowDItem adds 16384 to both the left and right
  7491. coordinates the rectangle.)  If the item is already hidden (that is,
  7492. if the left coordinate is greater than 8192), HideDItem does nothing.
  7493.  
  7494.     HideDItem calls the EraseRect procedure on the item╒s enclosing
  7495. rectangle and adds the rectangle that contained the item (not
  7496. necessarily the item╒s display rectangle) to the update region.
  7497. If the specified item is an active editText item, the item is first
  7498. deactivated (by calling TEDeactivate).
  7499.  
  7500. Note:  If you have items that are close to each other, be aware that
  7501.        the Dialog Manager draws outside of the enclosing rectangle by 3
  7502.        pixels for editText items and by 4 pixels for a default button.
  7503.  
  7504.     An item that╒s been hidden by HideDItem can be redisplayed by the
  7505. ShowDItem procedure.
  7506.  
  7507. Note:  To create a hidden item in a dialog item list, simply add
  7508.        16384 to the left and right coordinates of the display rectangle.
  7509. \ ShowDItem
  7510. 9
  7511. PROCEDURE ShowDItem (theDialog: DialogPtr; itemNo: INTEGER);
  7512.  
  7513.     ShowDItem redisplays the item numbered itemNo, previously hidden by
  7514. HideDItem, by giving the item the display rectangle it had prior to
  7515. the HideDItem call. (Specifically, if the left coordinate of the
  7516. item╒s display rectangle is greater than 8192, ShowDItem subtracts
  7517. 16384 from both the left and right coordinates the rectangle.)
  7518. If the item is already visible (that is, if the left coordinate is
  7519. less than 8192), ShowDItem does nothing.
  7520.  
  7521.     ShowDItem adds the rectangle that contained the item (not
  7522. necessarily the item╒s display rectangle) to the update region so
  7523. that it will be drawn. If the item becomes the only editText item,
  7524. ShowDItem activates it (by calling TEActivate).
  7525. \FindDItem
  7526. 9
  7527. FUNCTION FindDItem (theDialog: DialogPtr; thePt: Point) : INTEGER;
  7528.  
  7529.     FindDItem returns the item number of the item containing the point
  7530. specified, in local coordinates, by thePt. If the point doesn╒t lie
  7531. within the item╒s rectangle, FindDItem returns ╨1.  If there are
  7532. overlapping items, it returns the item number of the first item in
  7533. the list containing the point. FindDItem is useful for changing the
  7534. cursor when it╒s over a particular item.
  7535.  
  7536. Note:  FindDItem will return the item number of disabled items as well.
  7537. \UpdtDialog
  7538. 9
  7539. PROCEDURE UpdtDialog (theDialog: DialogPtr; updateRgn: RgnHandle);
  7540.  
  7541.     UpdtDialog is a faster version of the DrawDialog procedure.
  7542. Instead of drawing the entire contents of the given dialog box,
  7543. UpdtDialog draws only the items that are in a specified update region.
  7544. UpdtDialog is called in response to an update event, and is usually
  7545. bracketed by calls to the Window Manager procedures BeginUpdate and
  7546. EndUpdate. UpdateRgn should be set to the visRgn of theWindow╒s port.
  7547. (For more details, see the BeginUpdate procedure in chapter 9 of
  7548. Volume I.)
  7549. \ OpenDeskAcc
  7550. 10
  7551. FUNCTION OpenDeskAcc (theAcc: Str255) : INTEGER;
  7552.  
  7553.     OpenDeskAcc opens the desk accessory having the given name and
  7554. displays its window (if any) as the active window. The name is the
  7555. accessory's resource name, which you get from the Apple menu by calling
  7556. the Menu Manager procedure GetItem. OpenDeskAcc calls the Resource
  7557. Manager to read the desk accessory from the resource file.
  7558.  
  7559.     You should ignore the value returned by OpenDeskAcc. If the desk
  7560. accessory is successfully opened, the function result is its driver
  7561. reference number; as described under CloseDeskAcc below, you don't need
  7562. this number to close the accessory. If the desk accessory can't be
  7563. opened, the function result is undefined; the accessory will have taken
  7564. care of informing the user of the problem (such as memory full) and not
  7565. displaying itself.
  7566.  
  7567. (warning)
  7568.          It may occasionally happen that the current grafPort will
  7569.          be the desk accessory's port upon return from
  7570.          OpenDeskAcc. To be safe, you should bracket your call to
  7571.          OpenDeskAcc with calls to the QuickDraw procedures
  7572.          GetPort and SetPort, to save and restore the current
  7573.          port.
  7574.  
  7575.     Before you open a desk accessory it's a good idea to determine
  7576. whether there's enough memory available. Here's an example of how to do
  7577. that:
  7578.  
  7579.         SetResLoad(FALSE);
  7580.         myResHandle := GetNamedResource('DRVR', theAcc);
  7581.         size := SizeResource(myResHandle);
  7582.         myHandle := NewHanddle(size + 3072);
  7583.         IF myHandle = NIL
  7584.           THEN {put up an alert indicating there's not enough memory}
  7585.           ELSE OpenDeskAcc(theAcc)
  7586.  
  7587.     The extra 3K bytes in the argument to the Memory Manager's NewHandle
  7588. function is an average amount of heap space used by desk accessories
  7589. while they're running.
  7590. \ CloseDeskAcc
  7591. 10
  7592. PROCEDURE CloseDeskAcc (refNum: INTEGER);
  7593.  
  7594.     When a system window is active and the user choses Close from the
  7595. File menu, call CloseDeskAcc to close the desk accessory. RefNum is the
  7596. driver reference number for the desk accessory, which you get from the
  7597. windowKind field of its window.
  7598.  
  7599.     The Desk Manager automatically closes a desk accessory if the user
  7600. clicks its close box. Also, since the application heap is released
  7601. when the application terminates, every desk accessory goes away at that
  7602. time.
  7603. \ SystemClick
  7604. 10
  7605. PROCEDURE SystemClick (theEvent: EventRecord; theWindow: WindowPtr);
  7606.  
  7607.     When a mouse-down event occurs and the Window Manager function
  7608. FindWindow reports that the mouse button was pressed in a system
  7609. window, the application should call SystemClick with the event record
  7610. and the window pointer. If the given window belongs to a desk
  7611. accessory, SystemClick sees that the event gets handled properly.
  7612.  
  7613.     SystemClick determines which part of the desk accessory's window the
  7614. mouse button was pressed in, and responds accordingly (similar to the
  7615. way your application responds to mouse activities in its own windows).
  7616.  
  7617.   - If the mouse button was pressed in the content region and the
  7618.     window and the window was active, SystemClick sends the mouse-down
  7619.     event to the desk accessory, which proceses it as appropriate.
  7620.  
  7621.   - If the mouse button was pressed in the content region and the
  7622.     window was inactive, SystemClick makes it the active window.
  7623.  
  7624.   - If the mouse button was pressed in the drag region, SystemClick
  7625.     calls the Window Manager procedure DragWindow to pull an outline
  7626.     of the window across the screen and move the window to a new
  7627.     location. If the window was inactive, DragWindow also makes it
  7628.     the active window (unless the Command key was pressed along with
  7629.     the mouse button).
  7630.  
  7631.   - If the mouse button was pressed in the go-away region, SystemClick
  7632.     calls the Window Manager function TrackGoAway to determine whether
  7633.     the mouse is still inside the go-away region when the click is
  7634.     completed:  if so, it tells the desk accessory to close itself
  7635.     otherwise, it does nothing.
  7636. \ SystemEdit
  7637. 10
  7638. FUNCTION SystemEdit (editCmd: INTEGER) : BOOLEAN;
  7639.  
  7640.     Call SystemEdit when there's a mouse-down event in the menu bar and
  7641. the user choses one of the five standard editing commands from the Edit
  7642. menu. Pass one of the following as the value of the editCmd parameter:
  7643.  
  7644.        EditCmd          Editing command
  7645.        0                Undo
  7646.        2                Cut
  7647.        3                Copy
  7648.        4                Paste
  7649.        5                Clear
  7650.  
  7651.  
  7652.     If your Edit menu contains these five commands in the standard
  7653. arrangement (the order listed above, with a gray line separating Undo
  7654. and Cut), you can simply call
  7655.  
  7656.      SystemEdit(menuItem - 1)
  7657.  
  7658.     If the active window dewsn't belong to a desk accessory, SystemEdit
  7659. returns FALSE; the application should then process the editing comand
  7660. as usual. If the active window dews belong to a desk accessory,
  7661. SystemEdit asks that accessory to process the command and returns TRUE;
  7662. in this case, the application should ignore the command.
  7663.  
  7664. (note)
  7665.       It's up to the application to make sure desk accessories 
  7666.       get their editing comands that are chosen from the Edit
  7667.       menu. In particular, make sure your application hasn't
  7668.       disabled the Edit menu or any of the five standard
  7669.       commands when a desk accessory is activated.
  7670. \ SystemTask
  7671. 10
  7672. PROCEDURE SystemTask;
  7673.  
  7674.     For each open desk accessory, SystemTask causes the accessory to
  7675. perform the periodic action defined for it, if any such action has been
  7676. defined and if the proper time period has passed since the action was
  7677. last performed. For example, a clock accessory can be deifined such
  7678. that the second hand is to move once every second; the periodic action
  7679. for the accessory will be to move the second hand to the next position,
  7680. and SystemTask will alert the accessory every second to perform that
  7681. action.
  7682.  
  7683.     You should call SystemTask as often as possible, usually once every
  7684. time through your main event loop. Call it more than once if your
  7685. applicaition dies an unusually large amount of processing each time
  7686. through the loopk.
  7687.  
  7688. (note)
  7689.       SystemTask should be called at least every sixtieth of a
  7690.       second.
  7691.  
  7692.  
  7693.  
  7694. \ SystemEvent
  7695. 10
  7696. FUNCTION SystemEvent (theEvent: EventRecord) : BOOLEAN;
  7697.  
  7698.     SystemEvent is called only by the Toolbox Event Manager function
  7699. GetNextEvent when it receives an event, to determine whether the event
  7700. should be handled by the application or by the system. If the given
  7701. event should be handled by the application, SystemEvent returns FALSE;
  7702. otherwise, it calls the appropriate system code to handle the event and
  7703. returns TRUE.
  7704.  
  7705.     In the case of a null, abort, or mouse-down event, SystemEvent does
  7706. nothing but return FALSE. Notice that it responds this way to a mouse-
  7707. down event even though the event may in fact have occurred in a system
  7708. window (and therefore may have to be handled by the system). The
  7709. reason for this is that the check for exactly where the event occurred
  7710. (via the Window Manager function FindWindow) is made later by the
  7711. applicaiton and so would be made twice if SystemEvent were also to do
  7712. it. To avoid this duplication, SystemEvent passes the event on to the
  7713. application and lets it make the sole call to FindWindow. Should
  7714. FindWindow reveal that the mouse-down event did occur in a system
  7715. window, the application can then call SystemClick, as described above,
  7716. to get the system to handle it.
  7717.  
  7718.     If the given event is a mouse-up or keyboard event, SystemEvent
  7719. checks whether the active window belongs to a desk accessory and whether
  7720. that accessory can handle this type of event. If so, it sends the event
  7721. to the desk accessory and returns TRUE; otherwise, it returns FALSE.
  7722.  
  7723. (note)
  7724.       It's unlikely that a desk accessory would not be set up
  7725.       to handle activate and update events.
  7726.  
  7727.     Finally, if the given event is a disk-inserted event, SylstemEvent
  7728. does some low-level processing (by calling the File Manager function
  7729. McountVol) but passes the event on to the application by returning
  7730. FALSE, in case the application wants to do further processing.
  7731. \ SystemMenu
  7732. 10
  7733. PROCEDURE SystemMenu (menuResult: LONGINT);
  7734.  
  7735.     SystemMenu is called only by the Menu Manager functions MenuSelect
  7736. and MenuKey, when an item in a menu belonging to a desk accessory has
  7737. been chosen. The menuResult parameter has the same format as the value
  7738. returned by MenuSelect and MenuKey:  the menu ID in the high-order word
  7739. and the menu item number in the low-order word. (The menu ID will be
  7740. negative.)  SystemMenu directs the desk accessory to perform the
  7741. appropriate action for the given menu item.
  7742. \ InfoScrap
  7743. 11
  7744. FUNCTION InfoScrap : PScrapStuff;
  7745.  
  7746.     dInfoScrap returns a pointer to information about the desk scrap.
  7747. The PScrapStuff data type is defined as follows:
  7748.  
  7749. TYPE PScrapStuff = ^ScrapStuff;
  7750.      ScrapStuff = RECORD
  7751.             scrapSize:    LONGINT;   {size of desk scrap}
  7752.             scrapHandle:  Handle;    {handle to desk scrap}
  7753.             scrapCount:   INTEGER;   {count changed by ZeroScrap}
  7754.             scratState:   INTEGER;   {tells where desk scrap is}
  7755.             scrapName:    StringPtr  {scrap file name}
  7756.           END;
  7757.  
  7758.  
  7759.     ScrapSize is the size of the desk scrap in bytes. ScrapHandle is a
  7760. handle to the scrap if it's in memory, or NIL if not.
  7761.  
  7762.     ScrapCount is a count that changes every time ZeroScrap is called,
  7763. and is useful for testing whether the contents of the desk scrap have
  7764. changed during the use of a desk accessory. ScrapState is positive if
  7765. the desk scrap is in memory, 0 if it's on the disk, or negative if it
  7766. hasn't been initialized by ZeroScrap.
  7767.  
  7768. (note)
  7769.        ScrapState is actually 0 if the scrap should be on the
  7770.        disk; for instance, if the user deletes the Clipboard
  7771.        file and then cuts something, the scrap is really in
  7772.        memory, but ScrapState will be 0.
  7773.  
  7774.  
  7775.     ScrapName is a pointer to the name of the scrap file, usually
  7776. "Clipboard File".
  7777.  
  7778. (note)
  7779.       InfoScrap assumes that the scrap file has a version
  7780.       number of 0 and is on the default volume. (Version
  7781.       numbers and volumes are described in the File Manager
  7782.       manual.)
  7783. \ UnloadScrap
  7784. 11
  7785. FUNCTION UnloadScrap : LONGINT;
  7786.  
  7787.     UnloadScrap writes the desk scrap from memory to the scrap file, and
  7788. relaeses the memory it occupied. If the desk scrap is already on the
  7789. disk, UnloadScrap does nothing. If no error occurs, UnloadScrap
  7790. returns the result code noErr; otherwise, it returns and Operating
  7791. System result code indicating an error.
  7792. \ LoadScrap
  7793. 11
  7794. FUNCTION LoadScrap : LONGINT;
  7795.  
  7796.     LoadScrap reads the desk scrap from the scrap file into memory. If
  7797. the desk scrap is already in memory, it does nothing. If no error
  7798. occurs, LoadScrap returns the result code noErr; otherwise, it returns
  7799. an Operating System result code indicating an error.
  7800. \ GetScrap
  7801. 11
  7802. FUNCTION GetScrap (hDest: Handle; theType: ResType; VAR offset:
  7803.                     LONGINT) : LONGINT;
  7804.  
  7805.     Given an existing handle in hDest, GetScrap reads the data of type
  7806. theType from the desk scrap (whether in memory or on the disk), makes a
  7807. copy of it in memory, and sets hDest to be a handle to the copy.
  7808. Usually you'll pass in hDest a handle to a minimum-size block; GetScrap
  7809. will resize the block and copy the scrap into it. If you pass NIL in
  7810. hDest, GetScrap will not read in the data. This is usefull if you want
  7811. to be sure the data is there before allocating space for its handle, or
  7812. if you just want to know the size of the data.
  7813.  
  7814.     In the offset parameter, GetScrap returns the location of the data
  7815. as an offset (in bytes) from the beginning of the desk scrap. If no
  7816. error occurs, the function result is the length of the data in bytes;
  7817. otherwise, it's either an appropriate Operatiing System result code
  7818. (which will be negative) or the following Scrap Manager result code:
  7819.  
  7820.         CONST noTypeErr = -102;   {no data of the requested type}
  7821.  
  7822. For example, given the declaration
  7823.  
  7824.         VAR pHndl: Handle;      {handle for 'PICT' type}
  7825.         tHndl: Handle;          {handle for 'TEXT' type}
  7826.         length: LONGINT;
  7827.         offset: LONGINT;
  7828.  
  7829. you can make the following calls:
  7830.  
  7831.         pHndl := NewHandle(0);
  7832.         length := GetScrap(pHandl,'PICT',offset);
  7833.         IF length < 0
  7834.           THEN
  7835.            {error-handling}
  7836.           ELSE DrawPicture(PicHandle(pHndl))
  7837.  
  7838.  
  7839.     If your application wants data in the form of a  picture, and the
  7840. scrap contains only text, you can convert the text into a picture by
  7841. doing the following:
  7842.  
  7843.           tHndl := NewHandle(0);
  7844.           length := GetScrap(tHndl,'TEXT',offset);
  7845.           IF length < 0
  7846.             THEN
  7847.               {error-handling}
  7848.             ELSE
  7849.               BEGIN
  7850.               HLock(tHndl);
  7851.               pHndl := OpenPicture(thePort^.portRect);
  7852.               TextBox(tHndl^,length,thePort^.portRect,teJustLeft);
  7853.               ClosePicture;
  7854.               HUnlock(tHndl);
  7855.             END
  7856.  
  7857.  
  7858.     The Memory Manager procedures HLock and HUnlock are used to lock and
  7859. unlock blocks when handles are dereferenced (see the Memory Manager
  7860. Manual).
  7861.  
  7862. (note)
  7863.       To copy the desk scrap to the TextEdit scrap, use the
  7864.       TextEdit function TEFromScrap.
  7865.  
  7866.     Your application should pass its preferred data type to GetScrap. If
  7867. it doesn't prefer one data type over any other, it should try getting
  7868. each of the types it can read, and use the type that returns the lowest
  7869. offset. (A lower offset means that this data type was written before
  7870. the others, and therefore was preferred by the application that wrote
  7871. it.)
  7872.  
  7873. (note)
  7874.       If you're trying to read in a complicated picture, and 
  7875.       there isn't enough room in memory for a copy of it, you
  7876.       can customize QuickDraw's picture retrieval so that
  7877.       DrawPicture will read the picture directly from the scrap
  7878.       file. (QuickDraw also lets you customize how pictures
  7879.       are saved so you can save them in a file; see the
  7880.       QuickDraw manual for details about customizing.)
  7881.  
  7882. (note)
  7883.       When reading in a picture from the scrap, allow a buffer
  7884.       of about 3.5K bytes.  (There's a convention that the
  7885.       application defining the picture won't call the QuickDraw
  7886.       procedure CopyBits for more than 3K, so a 3.5K buffer
  7887.       should be large enough for any picture.
  7888. \ ZeroScrap
  7889. 11
  7890. FUNCTION ZeroScrap : LONGINT;
  7891.  
  7892.     If the scrap already exists (in memory or on the disk), ZeroScrap
  7893. clears its contents; if not, the scrap is initialized in memory. You
  7894. must call ZeroScrap before the first time you call PutScrap. If no
  7895. error occurs, ZeroScrap returns the result code noErr; otherwise, it
  7896. returns an Operating System result code indicating an error.
  7897.  
  7898.     ZeroScrap also changes the scrapCount field of the record of
  7899. information provided by InfoScrap. This is useful for testing whether
  7900. the contents of the desk scrap have changed during the use of a desk
  7901. accessory. The application can save the value of the scrapCount field
  7902. when one of its windows is deactivated and a system window is
  7903. activated. Then, each time through its event loop, it can check to see
  7904. whether the value of the field has changed. If so, it means the desk
  7905. accessory called ZeroScrap (and, presumable, PutScrap) and thus changed
  7906. the contents of the desk scrap.
  7907.  
  7908. (warning)
  7909.          Just check to see whether the scrapCount field has
  7910.          changed; don't rely on exactly how it has changed.
  7911. \ PutScrap
  7912. 11
  7913. FUNCTION PutScrap (length: LONGINT; theType: ResType; source: Ptr) :
  7914.               LONGINT;
  7915.  
  7916.     PutScrap writes the data poointed to by the source parameter to the
  7917. desk scrap (in memory or on the disk). The length parameter indicates
  7918. the number of bytes to write, and theType is the data type.
  7919.  
  7920. (warning)
  7921.         The specified type must be different from the type of any
  7922.         data already in the desk scrap. If you write data of a
  7923.         type already in the scrap, the new data will be appended
  7924.         to the scrap, and subsequent GetScrap calls will still
  7925.         return the old data.
  7926.  
  7927.     If no error occurs, PutScrap returns the result code noErr;
  7928. otherwise, it returns an Operating System result code indicating an
  7929. error, or the following Scrap Manager result code:
  7930.  
  7931.        CONST noScrapErr = -100;  {desk scrap isn't initialized}
  7932.  
  7933. (note)
  7934.       To copy the TextEdit scrap to the desk scrap, use the
  7935.       TextEdit function TEToScrap.
  7936.  
  7937. (warning)
  7938.        Don't forget to call ZeroScrap to initialize the scrap or
  7939.        clear its previous contents.
  7940.  
  7941.  
  7942. \ FixRatio
  7943. 12
  7944. FUNCTION FixRatio (numer,demon: INTEGER) : Fixed;
  7945.  
  7946.     FixRatio returns the fixed-point quotient of numer and denom. Numer
  7947. or denom may be any signed integer. The result is truncated. If denom
  7948. is 0, FixRatio returns $7FFFFFFF with the sign of numer.
  7949. \ FixMul
  7950. 12
  7951. FUNCTION  FixMul (a,b: Fixed) : Fixed;
  7952.  
  7953.     FixMul returns the fixed-point product of a and b. The result is
  7954. computed MOD 65536, and truncated.
  7955. \ FixRound
  7956. 12
  7957. FUNCTION FixRound (x: Fixed) : INTEGER;
  7958.  
  7959.     Given a positive fixed-point number, FixRound rounds it to the
  7960. nearest integer and returns the result. If the value is halfway between
  7961. two integers (.5), it's rounded up. To round a negative fixed-point
  7962. number, multiply by -1, round, then multiply by -1 again.
  7963. \ NewString
  7964. 12
  7965. FUNCTION NewString (theString: Str255) : StringHandle;
  7966.  
  7967.     NewString allocates the specified string as a relocatable object on
  7968. the heap and returns a handle to it.
  7969. \ SetString
  7970. 12
  7971. PROCEDURE SetString (h: StringHandle; theString: Str255);
  7972.  
  7973.     SetString sets the string whose handle is passed in h to the string
  7974. specified by theString.
  7975. \ GetString
  7976. 12
  7977. FUNCTION GetString (stringID: INTEGER) : StringHandle;
  7978.  
  7979.     GetString returns a handle to the string having the given resource
  7980. ID, reading it from the resource file if necessary. It calls the
  7981. Resource Manager function GetResource('STR ',stringID). If the resource
  7982. can't be read, GetString returns NIL.
  7983.  
  7984. (note)
  7985.       If your application uses a large number of strings,
  7986.       storing them in a string list in the resource file will
  7987.       be more efficient. You can access strings in a string
  7988.       list with GetIndString, as described below.
  7989. \ GetIndString
  7990. 12
  7991. PROCEDURE GetIndString (VAR theString: Str255; strListID: INTEGER;
  7992.              Index: INTEGER);    [No trap macro]
  7993.  
  7994.     GetIndString returns in theString a string in the string list that
  7995. has the resource ID strListID. It reads the string list from the
  7996. resource file if necessary, by calling the Resource Manager function
  7997. GetResource('STR#',strListID). It returns the string specified by the
  7998. index parameter, which can range from 1 to the number of strings in the
  7999. list. If the resource can't be read or the index is out of range, the 
  8000. empty string is returned.
  8001. \ Munger
  8002. 12
  8003. FUNCTION Munger (h: Handle; offset: LONGINT; ptrl: Ptr; lenl: LONGINT;
  8004.                     ptr2: Ptr; len2: LONGINT) : LONGINT;
  8005.  
  8006.     Munger (which rhymes with "plunger") lets you manipulate bytes in
  8007. the string of bytes (the "destination string") to which h is a handle.
  8008. The operation starts at the specified byte offset in the destination
  8009. string.
  8010.  
  8011. (note)
  8012.       Although the term "string" is used here, Munger does not
  8013.       assume it's manipulating a Pascal string; if you pass it
  8014.       a handle to a Pascal string, you must take into account
  8015.       the length byte.
  8016.  
  8017.     The exact nature of the operation done by Munger depends on the
  8018. values you pass it in two pointer/length parameter pairs. In general,
  8019. (ptr1,len1) defines a target string to be replaced by the second string
  8020. (ptr2,len2). If these four parameters are all positive and nonzero,
  8021. Munger looks for the target string in the destination string, starting
  8022. from the given offset and ending at the end of the string; it replaces
  8023. the first occurrence it finds with the replacement string and returns
  8024. the offset of the first byte past where the replacement occurred.
  8025. Figure 1 illustrates this; the bytes represent ASCII characters as
  8026. shown.
  8027.  
  8028.     Different operations occur if either pointer is NIL or either length
  8029. is 0:
  8030.  
  8031.     - If ptr1 is NIL, the substring of length len1 starting at the given
  8032.       offset is replaced by the replacement string. If len1 is
  8033.       negative, the substring from the given offset to the end of the
  8034.       destination string is replaced by the replacement string. In
  8035.       either case, Munger returns the offset of the first byte past
  8036.       where the replacement occurred.
  8037.  
  8038.  
  8039.     - If len1 is 0, (ptr2,len2) is simply inserted at the given offset;
  8040.       no text is replaced. Munger returns the offset of the first byte
  8041.       past where the insertion occurred.
  8042.  
  8043.     - If ptr2 is NIL, Munger returns the offset at which the targer
  8044.       string was found. The destination string isn't changed.
  8045.  
  8046.     - If ptr2 is NIL, Munger returns the offset at which the target
  8047.       string was found. The destination string isn't changed.
  8048.  
  8049.     - If len2 is 0 (and ptr2 is not NIL), the target string is deleted
  8050.       rather than replaced (since the replacement string is empty).
  8051.       Munger returns the offset at which the deletion occurred.
  8052.  
  8053.  
  8054.     If it can't find the target string in the destination string, Munger 
  8055. returns a negative value.
  8056.  
  8057.     There's one case in which Munger performs a replacement even if it
  8058. doesn't find all of the target string. If the substring from the
  8059. offset to the end of the destination string matches the beginning of
  8060. the target string, the portion found is replaced with the replacement
  8061. string.
  8062.  
  8063. (warning)
  8064.         Be careful not to specify an offset that's greater than
  8065.         the length of the destination string, or unpredictable
  8066.         results may occur.
  8067.  
  8068. (note)
  8069.         The destination string must be in a relocatable block
  8070.         that was allocated by the Memory Manager. Munger
  8071.         accesses the string's length by calling the Memory
  8072.         Manager routines GetHandleSize and SetHandleSize.
  8073. \ PackBits
  8074. 12
  8075. PROCEDURE PackBits (VAR srcPtr,DstPtr: Ptr; srcBytes: INTEGER);
  8076.  
  8077.     PackBits compresses srcBytes bytes of data starting at srcPtr and
  8078. stores the compressed data at dstPtr. The value of srcBytes should not
  8079. be greater than 127. Bytes are compressed when there are three or more
  8080. consecutive equal bytes. After the data is compressed, srcPtr is
  8081. incremented by srcBytes and dstPtr is incremented by the number of
  8082. bytes that the data was compressed to. In the worst case, the
  8083. compressed data can be one byte longer than the original data.
  8084.  
  8085.     PackBits is usually used to compress QuickDraw bit images; in this
  8086. case, you should call it for one row at a time. (Because of the
  8087. repeating patterns in QuickDraw images, there are more likely to be
  8088. consecutive equal bytes there than in other data.)  Use UnpackBits
  8089. (below) to expand data compressed by PackBits.
  8090. \ UnpackBits
  8091. 12
  8092. PROCEDURE UnpackBits (VAR SrcPtr, DstPtr: Ptr; dstBytes: Integer);
  8093.  
  8094.     Given in SrcPtr a pointer to the data that was compressed by PackBits,
  8095. UnpackBits expands the data and stores the result as DstPtr. DstBytes is
  8096. the length that the expanded data will be; it should be the value that was
  8097. passed to PackBits in the SrcBytes parameter. After the data is expanded,
  8098. srcPtr is incremented by the number of bytes that were expanded and dstPtr
  8099. is incremented by dstBytes.
  8100. \ BitTst
  8101. 12
  8102. FUNCTION BitTst (BytePtr: Ptr; bitNum: Longint): Boolean;
  8103.  
  8104.     BitTst tests wether a given bit is set and returns TRUE if so or FALSE
  8105. if not. The bit is specified by bitNum, an offset from the high-order bit
  8106. of the byte pointed to by BytePtr.
  8107. \ BitSet
  8108. 12
  8109. PROCEDURE BitSet (BytePtr: Ptr; bitNum: Longint);
  8110.  
  8111.     BitSet sets the bit specified by bitNum, an offset from the high-order
  8112. bit of the byte pointed to by BytePtr.
  8113. \ BitClear
  8114. 12
  8115. PROCEDURE BitClear (BytePtr: Ptr; bitNum: Longint);
  8116.  
  8117.     BitClear clears the bit specified by bitNum, an offset from the
  8118. high-order bit of the byte pointed to by BytePtr.
  8119. \ BitAnd
  8120. 12
  8121. FUNCTION BitAnd (Value1, Value2: Longint): Longint;
  8122.  
  8123.     BitAnd returns the value of the AND logical operation on the bits
  8124. comprising the given long integers ( vallue1 AND value2).
  8125. \ BitOr
  8126. 12
  8127. FUNCTION BitOr (Value1, Value2: Longint): Longint;
  8128.  
  8129.     BitOr returns the value of the OR logical operation on the bits
  8130. comprising the given long integers ( vallue1 OR value2).
  8131. \ BitXor
  8132. 12
  8133. FUNCTION BitXor (Value1, Value2: Longint): Longint;
  8134.  
  8135.     BitXor returns the value of the XOR logical operation on the bits
  8136. comprising the given long integers ( vallue1 XOR value2).
  8137. \ BitNot
  8138. 12
  8139. FUNCTION BitNot (Value: Longint): Longint;
  8140.  
  8141.     BitNot returns the result of the NOT logical opeation on the bits
  8142. comprisisng the given long integer (NOT value).
  8143. \ BitShift
  8144. 12
  8145. FUNCTION BitShift (Value: Longint; count: Integers): Longint;
  8146.  
  8147.     BitShift logically shifts the bits of the giveb long integer. The count
  8148. parameter specifies the direction and the extent of the shift, and is token
  8149. MOD 32. If count is positive, BitShift shifts that many positions to the
  8150. left; if count is negative, it shifts to the right. Zeroes are shifted into
  8151. empty positions at their end.
  8152. \ HiWord
  8153. 12
  8154. FUNCTION HiWord (x: Longint): Integer;
  8155.  
  8156.     HiWord returns the high-order word of the given long integer. One use
  8157. of this function is to extract the integer part of a fixed-point number.
  8158. \ LoWord
  8159. 12
  8160. FUNCTION LoWord (x: Longint): Integer;
  8161.  
  8162.     LoWord returns the low-order word of the given long integer. One use
  8163. of this function is to extract the fractional part of a fixed-point number.
  8164.  
  8165.     Note: If you're dealing with a long intger that contains two separate
  8166.     integer values, you can define a variant record instead of using
  8167.     HiWord and LoWord. For example, for fixed-point numbers, you can define
  8168.     the following type:
  8169.  
  8170.       TYPE FixedAndInt = RECORD CASE Integer OF
  8171.                             1: (FixedView: Fixed);
  8172.                             2: (intView:   RECORD
  8173.                                             Whole: Integer;
  8174.                                             Part : Integer;
  8175.                                            END;)
  8176.                           END;
  8177.  
  8178.     If you declare x to be of type FixedAndInt, you can access it as a
  8179.     fixed-point value with x.FixedView, or access the integer part with
  8180.     x.intView.Whole aand the fractional part with x.intView.part.
  8181. \ LongMul
  8182. 12
  8183. PROCEDURE LongMul (a,b: Longint; VAR dest: Int64bit);
  8184.  
  8185.     LongMul multiplies the given long integers and returns the signed
  8186. result in dest which has the following data type:
  8187.  
  8188.     TYPE Int64Bit = RECORD
  8189.                       HiLong: Longint;
  8190.                       LoLong: Longint;
  8191.                     END;
  8192. \ ScreenRes
  8193. 12
  8194. PROCEDURE ScreenRes (VAR scrnHRes, scrnVRes: Integer); [Not in ROM]
  8195.  
  8196.     ScreenRes returns the resolution of the screen of the Macintosh 
  8197. being used. ScrnHRes and scrnVRes are the number of pixels per inch 
  8198. horizontally and verticaly, respectively.
  8199.  
  8200.         ____________________________________________________________
  8201.          Assembly-language note: The number of pixels per  inch
  8202.          horizontally is stored in the global variable ScrHRes, and
  8203.          the number of pixels per inch vertically is stored in
  8204.          ScrVRes.
  8205.         ____________________________________________________________
  8206. \ GetIcon
  8207. 12
  8208. FUNCTION GetIcon (IconId: Integer): Handle;
  8209.  
  8210.     GetIcon returns a handle to the icon having the given resource ID,
  8211. reading it from the resource file if necessary. It calls the resource
  8212. manager function GetResource ('ICON', IconId). If the resource can't be
  8213. read, GetIcon returns NIL.
  8214. \ PlotIcon
  8215. 12
  8216. PROCEDURE PlotIcon (TheRect: Rect; TheIcon: Handle);
  8217.     PlotIcon draws the icon whose handle is theIcon in the rectangle
  8218. TheRect, which is in the local coordinate of the current grafport. It calls
  8219. the QuickDraw procedure CopyBits and uses the srcCopy transfer mode.
  8220. \ GetPattern
  8221. 12
  8222. FUNCTION GetPattern (PatID: Integer): PatHandle;
  8223.  
  8224.     GetPattern returns a handle to the pattern  having the given resource
  8225. ID, reading it from the resource file if necessary. It calls the resource
  8226. manager function  GetResource ('PAT ', PatId). If the resource can't be
  8227. read, GetPattern returns NIL. The PatHandle data type is defined in the
  8228. toolbox utilities as follows:
  8229.  
  8230.     TYPE  PatPtr    = ^Pattern;
  8231.           PatHandle = ^PatPtr;
  8232. \ GetIndPattern
  8233. 12
  8234. Function GetIndPattern (VAR ThePattern: Patter; PatLisId: Integer; Index:
  8235.                         Integer);  [Not in ROM]
  8236.  
  8237.     GetIndPattern returns in the pattern a pattern in the pattern list that
  8238. has the resource ID PatListID. It reads the pattern list from the resource
  8239. file if necessary, by calling the Resource Manager function
  8240. GetResource ('PAT#', PatListID). It returns the pattern specified by the
  8241. index parameter, which can range from 1 to the number of patterns in the
  8242. pattern list.
  8243.  
  8244.     There's a pattern list in the system resource file that contains the
  8245. standard Macintosh patterns used by MacPaint. Its resource ID is :
  8246.  
  8247.     CONST   SysPatListID = 0;
  8248. \ GetCursor
  8249. 12
  8250. FUNCTION GetCursor (CursorID: Integer): CursHandle;
  8251.  
  8252.     GetCursor returns a handle to the cursor having the given resource ID,
  8253. reading it forme the resource file if necessary. It calls the resource
  8254. manager function GetResource ('CURS', CursorIdD). If the resource can't be
  8255. read, GetCursor returns NIL. The CursHandle data type is defined in the
  8256. toolbox utilities as follows:
  8257.  
  8258.     TYPE    CursPtr    = ^Cursor;
  8259.             CursHandle = ^CursPtr;
  8260.  
  8261.     The standard cursors are defined in the system resource file. Their
  8262. resources ID are:
  8263.  
  8264.     CONST   iBeamCursor = 1; {to select text}
  8265.             crossCursor = 2; {to draw graphics}
  8266.             plusCursor  = 3; {to select cells in structured documents}
  8267.             watchCursor = 4; {to indicate a too long wait}
  8268.  
  8269.  
  8270.     Note: You can set the cursor with the quickdraw procedure SetCursor.
  8271.     The arrow cursor is defined in QuickDraw as a global variable named
  8272.     Arrow.
  8273. \ ShieldCursor
  8274. 12
  8275. PROCEDURE ShieldCursor (shieldRect: Rect; OffsetPt: Point);
  8276.  
  8277.     If the cursor and the given rectangle intersect, ShieldCursor hides 
  8278. the cursor. If they don't intersect, the cursor remains visible while 
  8279. the mouse isn't moving, but is hidden when the mouse moves.
  8280.  
  8281.     Like the QuickDraw procedure HideCursor, ShieldCursor decrements the
  8282. cursor level,  and should be balanced by a call to ShowCursor.
  8283.  
  8284.     The rectangle may be given in local or global coordinates:
  8285.  
  8286. Ñ  If they're global coordinates, pass (0, 0) in OffsePt.
  8287. Ñ  If they're a grafport's local coordinates, pass the top left corner 
  8288.    of the grafport's boundary rectangle in OffsetPt. (Like the QuickDraw
  8289.    procedure LocalToGlobal, ShieldCursor will offset the coordinates of
  8290.    the rectangle by the coordinate of this point.)
  8291. \ GetPicture
  8292. 12
  8293. FUNCTION GetPicture (PicID: Integer): PicHandle;
  8294.  
  8295.     GetPicture returns a handle to the picture having the given resource
  8296. ID, reading it from the resource file if necessary. It calls the resource
  8297. Manager function GetResource ('PICT', PicID). If the resource can't be read
  8298. GetPicture returns NIL. The PicHandle data type is defined in QuickDraw.
  8299. \ DeltaPoint
  8300. 12
  8301. FUNCTION DeltaPoint (ptA, ptB: Point): Longint;
  8302.  
  8303.     DeltaPoint substracts the coordinates of ptB from the coordinates of
  8304. ptA. The high-order word of the result is the difference of the vertical
  8305. coordinates, and the low-order word is the difference of the horizontal
  8306. coordinates.
  8307.  
  8308.     NOTE : The QuickDraw procedure SubPt also substracts the coordinates
  8309.     of one point, but returns the result in a VAR parameter of type Point.
  8310. \ SlopeFromAngle
  8311. 12
  8312. FUNCTION SlopeFromAngle (Angle: Integer): Fixed;
  8313.  
  8314.     Given an angle, SlopeFromAngle returns the slope dh/dv of the line
  8315. forming that angle with the Y-axis (dh/dv is the horizontal change divided
  8316. by the vertical  change between any two points on the line). The angle is
  8317. treated MOD 180, and its degrees measured from 12 o'clock; positive degrees
  8318. are measured clockwise, negative degrees are measured counterclockwise (for
  8319. example, 90 degrees is at 3 o'clock, and -90 degrees is at 9 o'clock).
  8320. Positive y is down; positive x is to the right.
  8321. \ AngleFromSlope
  8322. 12
  8323. Function AngleFromSlope (Slope: Fixed): Integer;
  8324.  
  8325.     Given the slope dh/dv of a line (see SlopeFromAngle), AngleFromSlope
  8326. returns the angle formed by that line and the y-axis. The angle returned
  8327. is between 1 and 180 (inclusive), in degrees measured clockwise from 12
  8328. o'clock.
  8329.  
  8330.     AngleFromSlope is meant for use when speed is much more important than
  8331. accuracy - its integer result is guaranted to be one degree of the correct
  8332. answer,  but not necessarily within half a degree. However the equation
  8333.  
  8334.     AngleFromSlope(SlopeFromAngle(x))= x
  8335.  
  8336. is true for all x except 0 (although reverse is not).
  8337.  
  8338.     NOTE : SlopeFromAngle(0) is 0, and AngleFromSlope(0) is 180.
  8339. \ FracMul
  8340. 12
  8341. FUNCTION FracMul (x,y: Fract) : Fract;
  8342.  
  8343. FracMul returns x * y. Note that FracMul effects
  8344.  
  8345. ╥type   *   Fract   ╤>  type╙:
  8346. Fract   *   Fract   ╤>  Fract
  8347. LONGINT *   Fract   ╤>  LONGINT
  8348. Fract   *   LONGINT ╤>  LONGINT
  8349. Fixed   *   Fract   ╤>  Fixed
  8350. Fract   *   Fixed   ╤>  Fixed
  8351. \FixDiv
  8352. 12
  8353. FUNCTION FixDiv (x,y: Fixed) : Fixed;
  8354.  
  8355. FixDiv returns x / y.
  8356. \FracDiv
  8357. 12
  8358. FUNCTION FracDiv (x,y: Fract) : Fract;
  8359.  
  8360. FracDiv returns x / y.
  8361. \FracSqrt
  8362. 12
  8363. FUNCTION FracSqrt (x: Fract) : Fract;
  8364.     FracSqrt returns the square root of x, with x interpreted as
  8365. unsigned in the range 0 through 4╨(2╨30), inclusive:  That is, bit 15 in
  8366. Figure 1 has weight 2 rather than ╨2. The result, too, is unsigned
  8367. in the range 0 through 2, inclusive.
  8368. \FracCos
  8369. 12
  8370. FUNCTION FracCos (x: Fixed) : Fract;
  8371.     FracCos and FracSin return the cosine and sine of their radian
  8372. arguments, respectively. The hexadecimal value 0.C910 (which is
  8373. FixATan2(1,1)) is the approximation to ╣/4 used for argument reduction.
  8374. Thus, FracCos and FracSin are nearly periodic, but with period 2*P
  8375. instead of 2*╣, where P=3.1416015625 and ╣, of course, is 3.14159265....
  8376. \FracSin
  8377. 12
  8378. FUNCTION FracSin (x: Fixed) : Fract;
  8379.  
  8380.     FracCos and FracSin return the cosine and sine of their radian
  8381. arguments, respectively. The hexadecimal value 0.C910 (which is
  8382. FixATan2(1,1)) is the approximation to ╣/4 used for argument reduction.
  8383. Thus, FracCos and FracSin are nearly periodic, but with period 2*P
  8384. instead of 2*╣, where P=3.1416015625 and ╣, of course, is 3.14159265....
  8385. \FixATan2
  8386. 12
  8387. FUNCTION FixATan2 (x,y: LONGINT) : Fixed;
  8388.  
  8389.     FixATan2 returns the arctangent of y / x in radians.
  8390. \Long2Fix
  8391. 12
  8392. FUNCTION Long2Fix (x: LONGINT) : Fixed;
  8393.  
  8394.     Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between
  8395. fixed-point types.
  8396. \Fix2Long
  8397. 12
  8398. FUNCTION Fix2Long (x: Fixed) : LONGINT;
  8399.  
  8400. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point
  8401. types.
  8402. \Fix2Frac
  8403. FUNCTION Fix2Frac (x: Fixed) : Fract;
  8404.  
  8405. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point
  8406. types.
  8407. \Frac2Fix
  8408. 12
  8409. FUNCTION Frac2Fix (x: Fract) : Fixed;
  8410.  
  8411. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point
  8412. types.
  8413.  
  8414. \Fix2X
  8415. 12
  8416. FUNCTION Fix2X  (x: Fixed) : Extended;
  8417.  
  8418. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  8419. and the Extended floating-point type. These functions do not set
  8420. floating-point exception flags.
  8421. \X2Fix
  8422. 12
  8423.  
  8424. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  8425. and the Extended floating-point type. These functions do not set
  8426. floating-point exception flags.
  8427. FUNCTION X2Fix  (x: Extended) : Fixed;
  8428. \Frac2X
  8429. 12
  8430. FUNCTION Frac2X (x: Fract) : Extended;
  8431.  
  8432. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  8433. and the Extended floating-point type. These functions do not set
  8434. floating-point exception flags.
  8435. \X2Frac
  8436. 12
  8437. FUNCTION X2Frac (x: Extended) : Fract;
  8438.  
  8439. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  8440. and the Extended floating-point type. These functions do not set
  8441. floating-point exception flags.
  8442.  
  8443. \ InitPack
  8444. 13
  8445. PROCEDURE InitPack (packID: INTEGER);
  8446.  
  8447.     InitPack enables you to use the package specified by packID, which
  8448. is the package's resourceID. (It gets a handle that will be used later
  8449. to read the package into memory.)
  8450. \ InitAllPacks
  8451. 13
  8452. PROCEDURE InitAllPacks;
  8453.  
  8454.     InitAllPacks enables you to use all Macintosh packages (as though
  8455. InitPack were called for each one). It wil already have been called
  8456. when your application starts up.
  8457. \ IUDateString
  8458. 13
  8459. PROCEDURE IUDateString (dateTime: LongInt; form: DateForm; VAR result:
  8460.                         Str255);
  8461.  
  8462.     Given a date and time as returned by the Operating System Utility
  8463. routine ReadDateTime, IUDateString returns in the result parameter a
  8464. string that represents the corresponding date. The form parameter has
  8465. the following data type:
  8466.  
  8467.        TYPE DateForm = (shortDate,longDate,abbrevDate);
  8468.  
  8469.     ShortDate requests the short date format, longDate the long date,
  8470. and abbrevDate the abbreviated long date. IUDateString determines the
  8471. exact format from international resource 0 for the short date of 1 for
  8472. the long date. See Figure I-1 above for examples of the standard
  8473. formats. Notice that the short date contains a space in place of  a
  8474. leading zero when the format specifies "no leading zero", so the length
  8475. of the result is always the same for short dates.
  8476.  
  8477.     If the abbreviated long date is requested and the abbreviation
  8478. length in international resource 1 is greater than the actual length of
  8479. the name being abbreviated, IUDateString fills the abbreviation with NUL
  8480. characters; the abbreviation length should not be greater than 15, the
  8481. maximum name length.
  8482. \ IUDatePString
  8483. 13
  8484. PROCEDURE IUDatePString (dateTime: LongInt; form: DateForm; VAR result:
  8485.             Str255; intlParam: Handle);
  8486.  
  8487.  
  8488.     IUDatePString is the same as IUDateString except that it determines
  8489. the exact format of the date from the resource whose handle is passed in
  8490. intlParam, overriding the resource that would otherwise be used.
  8491. \ IUTimeString
  8492. 13
  8493. PROCEDURE IUTime STring (dateTime: LongInt; wantSeconds: BOOLEAN; VAR
  8494.             result: Str255);
  8495.  
  8496.     Given a date and time as returned by the Operating System Utility
  8497. routein ReadDateTime, IUTimeString returns in the result parameter a
  8498. string that represents the corresponding time of day. If wantSeconds
  8499. is TRUE, seconds are included in the time; otherwise, only the hour and
  8500. minute are included. IUTimeSting determines the time format from
  8501. internation resource 0. See Figure I-1 above for examples of the
  8502. standard formats. Notice that the time contains a space in place of a
  8503. leading zero when the format specifies "no leading zero", so the length
  8504. of the result is always the same.
  8505. \ IUTimePString
  8506. 13
  8507. PROCEDURE IUTimePString (dateTime: LongInt; wantSeconds: BOOLEAN; VAR
  8508.             result: str255; intlParam: Handle);
  8509.  
  8510.     IUTimePString is the same as IUTimeString except that it determines
  8511. the time format from the resource whose handle is passed in intlParam,
  8512. overriding the resource that would otherwise be used.
  8513. \ IUMetric
  8514. 13
  8515. FUNCTION IUMetric : BOOLEAN;
  8516.  
  8517.     If international resource 0 specifies that the metric system is to
  8518. be used, IUMetric retruns TRUE; otherwise, it returns FALSE.
  8519. \ IUGetIntl
  8520. 13
  8521. FUNCTION IUGetIntl (theID: INTEGER) : Handle;
  8522.  
  8523.     IUGetIntl returns a handle to the international resource numbered
  8524. theID (0 or 1). It calls the Resource Manager function
  8525. GetResource('INTL',theID). For example, if you want to access
  8526. individual fields of international resource 0, you can do the
  8527. following:
  8528.  
  8529.      VAR myHndl: Handle;
  8530.          int0: Intl0Hndl;
  8531.      ...
  8532.      myHndl := IUGetIntl(0);
  8533.      int0 := POINTER(ORD(myHndl));
  8534. \ IUSetIntl
  8535. 13
  8536. PROCEDURE IUSetIntl (refNum: INTEGER; thefID; INTEGER; intlParam:
  8537.             Handle);
  8538.  
  8539.     In the resource file having the reference number refNum, IUSetIntl
  8540. sets the international resource numbered theID (0 or 1) to the data
  8541. pointed to by tintlParam. The data may be either an existing resource
  8542. okr data that hasn't yet been written to a resource file. IUSetIntl
  8543. adds the resource to the specified file or replaces the resource if it's
  8544. already there.
  8545. \ IUCompString
  8546. 13
  8547. FUNCTION IUCompString (aStr,bStr: Str255) : INTEGER;  [Pascal only]
  8548.  
  8549.     IUCompString compares aStr and bStr as described above under
  8550. "International String Comparison", taking both primary and secondary
  8551. ordering into consideration. It returns one of the values listed
  8552. below.
  8553.  
  8554.       Result   Meaning                           Example
  8555.                                               aStr     bStr
  8556.        -1       aStr is less than bStr       'Ab'     'ab'
  8557.         0       aStr  equals bStr            'Ab'     'Ab'
  8558.         1       aStr is greater than bStr    'Ac'     'ab'
  8559. \ IUMagString
  8560. 13
  8561. FUNCTION IUMagString (aPtr,bPtr: Ptr; aLen,bLen: INTEGER) : INTEGER;
  8562.  
  8563.     IUMagString is the same as IUCompString (above) except that instead
  8564. of comparing two Pascal strings, it compares the string defined by aPtr
  8565. and aLen to the string defined by bPtr and bLen. The pointer points to
  8566. the first character of the string (any byte in memory, not necesarily
  8567. word-aligned), and the length specifies the number of characters in the
  8568. string.
  8569. \ IUEqualString
  8570. 13
  8571. FUNCTION IUEqualString (aStr,bStr: Str255) : INTEGER;   [Pascal only]
  8572.  
  8573.     IUEqualString comapares aStr and bStr for equality without regard
  8574. for secondary ordering, as described above under "international String
  8575. Comparison". If the strings are equal, it returns 0; otherwise, it
  8576. returns 1. For example, if the strings are 'Rose' and 'rose',
  8577. IUEqualString considers them equal and returns 0.
  8578.  
  8579. (note)
  8580.       See also EqualString in the Operating System Utilities
  8581.       manual *** doesn't yet exist***.
  8582. \ IUMagIDString
  8583. 13
  8584.     IUMagIDString is the same as IUEqualString (above) except that
  8585. instead of comparing two Pascal strings, it compares the string defined
  8586. by aPtr and aLen to the string defined by bPtr and bLen. The pointer
  8587. points to the first character of the string (any byte in memory, not
  8588. necessarily word-aligned), and the length specifies the number of4
  8589. characters in the string.
  8590. \ NumToString
  8591. 13
  8592. PROCEDURE NumToString (theNum: LongInt; VAR theStringd: Str255);
  8593.  
  8594. ____________________________________________________________________
  8595.  
  8596. Trap macro     _NumToString
  8597.  
  8598. On entry       A0:  pointer to theString (length byte followed
  8599.                   by characters)
  8600.  
  8601.              D0:  theNum (long integer)
  8602.  
  8603. On exit         A0:  pointer to theString
  8604.  
  8605. _____________________________________________________________________
  8606.  
  8607.     NumToString converts theNum to a string that represents its decimal
  8608. value, and returns the result in theString. If the value is negative,
  8609. the string begins with a minus sign; otherwise, the sign is omitted.
  8610. Leading zeroes are suppressed, except that the value 0 produces '0'.
  8611. For example:
  8612.  
  8613.      theNum          theString
  8614.       12              '12'
  8615.      -23             '-23'
  8616.        0              '0'
  8617. \ StringToNum
  8618. 13
  8619. PROCEDURE StringToNum (theString: Str255; VAR theNum: LongInt);
  8620.  
  8621. ___________________________________________________________________
  8622.  
  8623. Trap macro     _StringToNum
  8624.  
  8625. On entry       A0:  pointer to theString (length byte followed
  8626.                   by characters)
  8627.  
  8628. On exit        DO:  theNum (long integer)
  8629.  
  8630. ___________________________________________________________________
  8631.  
  8632.  
  8633.     Given a string representing a decimal integer, StringToNum converts
  8634. it to the corresponding integer and returns the result in theNum. The
  8635. string may begin with a plus or minus sign. For example:
  8636.  
  8637.       theString          theNum
  8638.         '12'               12
  8639.        '-23'              -23
  8640.         '-0'                0
  8641.        '055'               55
  8642.  
  8643.     The magnitude of the integer is converted modulo 2^32, and the
  8644. 32-bit result is negated if the string begins with a minus sign; integer
  8645. overflow occurs if the magnitude is greater than 2^31-1. (Negation is
  8646. done by taking the two's complement--reversing the state of each bit
  8647. adn then ading 1.)  For example:
  8648.  
  8649.         theString                                   theNum
  8650.        '2147483648'  (magnitude is 2^31)          -2147483648
  8651.       '-2147483648'                               -2147483648
  8652.        '4294967295'  (magnitude is 2^31)              -1
  8653.       '-4294967295'                                    1
  8654.  
  8655.     StringToNum doesn't actually check whether the characters in the
  8656. string are between '0' and '9'; instead, since the ASCII codes for '0'
  8657. through '9' are $30 through $39, it just masks off the last four bits
  8658. and uses them as a digit. For example, '2:' is converted to the number
  8659. 30 because the ASCI code for ':' is $3A. Leading spaces before the
  8660. first digit are treated as zeroes, since the ASCII code for a space is
  8661. $20. Given that the ASCII codes for 'C', 'A', and 'T' are $43, $41, and
  8662. $54, respectively, consider the following examples:
  8663.  
  8664.  
  8665.       theString              theNum
  8666.         'CAT'                  314
  8667.        '+CAT'                  314
  8668.        '-CAT'                 -314
  8669. \ SFPutFile
  8670. 13
  8671. PROCEDURE SFPutFile (where: Point; prompt: Str255; origName: Str255;
  8672.                     dlgHook: ProPtr; VAR reply: SFReply);
  8673.  
  8674.     SFPutFile displays a dialog box allowing the user to specify a file
  8675. to which data will be written (as during a Save or Save As command). It
  8676. then repeatedly gets and handles events until the user either confirms
  8677. the command after entering an appropriate file name or aborts the
  8678. command by clicking Cancel in the dialog. It reports the user's reply
  8679. by filling the fields of the reply record specified by the reply
  8680. parameter, as described above; the fType field of this record isn't
  8681. used.
  8682.  
  8683.     The general appearance of the standard SFPutFile dialog box is shown
  8684. in Figure S-2. The where parameter specifies the location of the top
  8685. left corner of the dialog box in global coordinates. The prompt
  8686. parameter is a line of text to be displayed as a statText item in the
  8687. dialog box, where shown in Figure S-2. The origName parameter contains
  8688. text that appears as an enabled, selected editText item; for the
  8689. standard document-saving commands, it should be the current name of the
  8690. document, or the empty string (to display an insertion point) if the
  8691. document hasn't been named yet.
  8692.  
  8693.     If you want to use the standard SFPutFile dialog box, pass NIL for
  8694. dlgHook; otherwise, see the information for advanced programmers below.
  8695.  
  8696.     SFPutFile  repeatedly calls the Dialog Manager procedure
  8697. ModalDialog. When an event involving an enabled dialog item occurs,
  8698. ModalDialog handles the event andf returns the item number, and
  8699. SFPutFile responds as follows:
  8700.  
  8701.    - If the Eject or Drive button is clicked, or a disk is inserted,
  8702.      SFPutFile responds as described above under "About the Standard
  8703.      File Package".
  8704.  
  8705.    - Text entered into the editText item is stored in the fName field
  8706.      of the reply record. (SFPutFile keeps track of whetehr there's
  8707.      currently any text in the item, and makes the Save button inactive
  8708.      if not.)
  8709.  
  8710.    - If the Save button is clicked, SFPutFile determines whether the
  8711.      file name in the fName field of the reply record is appropriate.
  8712.      If so, it returns control to the application with the first field
  8713.      of the reply record set to TRUE; otherwise, it responds
  8714.      accordingly, as described below.
  8715.  
  8716.   - If the Cancel button in the dialog is clicked, SFPutFile returns
  8717.     control to the application with the first field of the reply
  8718.     record set to FALSE.
  8719.  
  8720. (note)
  8721.        Notice that disk insertion is one of the user actions
  8722.        listed above, even though ModalDialog normally ignores
  8723.        disk-inserted events. The reason this works is that
  8724.        SFPutFile calls ModalDialog with a filterProc function
  8725.        that checks for a disk-inserted event and returns a
  8726.        "fake", very large item number if one occurs; SFPutFile
  8727.        recognizes this item number as an indication that a disk
  8728.        was inserted.
  8729.  
  8730.     The situations that may cause an entered name to be inappropriate,
  8731. and SFPutFile's response to each, are as follows:
  8732.  
  8733.      - If a file with the specified name already exists on the disk and
  8734.        is different from what was passed in the origName parameter, the
  8735.        alert in Figure S-3 is displayed. If the user clicks Yes, the
  8736.        file name is appropriate.
  8737.  
  8738.      - If the disk to which the file shoud be written is locked, the
  8739.        alert in Figure S-4 is displayed. If a system error occurs, a
  8740.        similar alert is displayed, with a corresponding message
  8741.        explaining the problem.
  8742.  
  8743. (note)
  8744.        The user may specify a disk name (preceding the file name
  8745.        and separated from it by a colon). If the disk isn't
  8746.        currently in a drive, an alert similar to the one in
  8747.        Figure S-4 is displayed. The ability to specify a disk
  8748.        name is supported for historical reasons only; users
  8749.        should not be encouraged to do it.
  8750.  
  8751.     After the user clicks No or Cancel in response to one of these
  8752. alerts, SFPutFile dismisses the alert box and continues handling events
  8753. (so a different name may be entered).
  8754.  
  8755. Advanced programmers:  You can create your own dialog box rather than
  8756. use the standard SFPutFile dailog. To do this, you must provide your
  8757. own dialog template and store it in your application's resource file
  8758. with the same resource ID that the standard template has in the system
  8759. resource file:
  8760.  
  8761.         CONST putDlgID = -3999;   {SFPutFile dialog template ID}
  8762.  
  8763. (note)
  8764.        The SFPPutFile procedure, described below lets you use
  8765.        any resource ID for your nonstandard dialog box.
  8766.  
  8767.     Your dialog template must specify that the dialog window be
  8768. invisible, and your dialog must contain all the standard items, as
  8769. listed below. The appearance and location of these items in your dialog
  8770. may be different. You can make an item "invisible" by giving it a
  8771. display rectangle that's off the screen. The display rectangle for each
  8772. item in the standard dialog box is given below. The rectangle for the
  8773. standard dialog box itself is (0,0,304,104).
  8774.  
  8775.  
  8776.    Item Number  Item                     Standard display rectangle
  8777.     1       Save button                  (12,74,82,92)
  8778.     2       Cancel button                (114,74,184,92)
  8779.     3       Prompt string (statText)     (12,12,184,28)
  8780.     4       UserItem for disk name       (209,16,295,34)
  8781.     5       Eject button                 (217,43,287,61)
  8782.     6       Drive button                 (217,74,287,92)
  8783.     7       EditText item for file name  (14,34,182,50)
  8784.     8       UserItem for gray line       (200,16,201,88)
  8785.  
  8786.  
  8787. (note)
  8788.        Remember that the display rectangle for any "invisible"
  8789.        item must be at least about 20 pixels wide. *** This
  8790.        will be discussed in a future draft of the Dialog Manager
  8791.        manual. ***
  8792.  
  8793.  
  8794.     If your dialog has addition items beyond the standard ones, or if
  8795. you want to handle any of the standard items in a nonstandard manner,
  8796. you must write your own dlgHook funciton and point to it with dlgHook.
  8797. Your dlgHook function should have two parameters and return an integer
  8798. value. For example, this is how it wokuld be declared if it were named
  8799. MyDlg:
  8800.  
  8801.        FUNCTION MyDlg (item: INTEGER; theDialog: DialogPtr) : INTEGER;
  8802.  
  8803.     Immediately after calling ModalDialog, SFPutFile calls your dlgHook
  8804. function, passing it the item number returned by ModalDialog and a
  8805. pointer to the dialog record describing your dialog box. Using these
  8806. two parameters, your dlgHook function should determine how to handle
  8807. the event. There are predefined constants for the item numbers of
  8808. standard enabled items, as follows:
  8809.  
  8810.       CONST putSave   = 1;   {Saver button}
  8811.             putCancel = 2;   {Cancel button}
  8812.         putEject  = 5;   {Eject button}
  8813.         putDrive  = 6;   {Drive button}
  8814.         putName   = 7;   {editText item for file name}
  8815.  
  8816.     ModalDialog also returns the "fake" item number 100 when a disk-
  8817. inserted event occurs, as detected by its filterProc function.
  8818.  
  8819.     After handling the event (or, perhaps, after ignoring it) the
  8820. dlgHook function must return an item number to SFPutFile. If the item
  8821. number is one of those listed above, SFPutFile responds in the standard
  8822. way; otherwise, it does nothing.
  8823.  
  8824. (note)
  8825.        For advanced programmers who want to change the
  8826.        appearance of the alerts displayed when an inappropriate
  8827.        file name is entered, the resource IDs of those alerts in
  8828.        the system resource file are listed below.
  8829.  
  8830.  
  8831.        Alert                   Resource ID
  8832.        Existing file             -3996
  8833.        Locked disk               -3997
  8834.        System error              -3995
  8835.        Disk not found            -3994
  8836. \ SFPPutFile
  8837. 13
  8838. PROCEDURE SFPPutFile (where: Point; prompt: SStr255; origNmae: Str255;
  8839.              dlgHook: ProcPtr; VAR reply: SFReply; dlgID: INTEGER;
  8840.          filterProc: ProcPtr);
  8841.  
  8842.     SFPPutFile is an alternative to SFPutFile for advanced programmers
  8843. who want to use a nonstandard dialog box. It's the same as SFPutFile
  8844. except for the two additional parameters dlgID and filterProc.
  8845.  
  8846.     DlgID is the resource ID of the dialog template to be used instead
  8847. of the standard one (so you can use whatever ID you wish rather than the
  8848. same one as the standard).
  8849.  
  8850.     The filterProc parameter determines how ModalDialog will filter
  8851. events when called by SFPPutFile. If filterProc is NIL, ModalDialog
  8852. does the standard filtering that it does when called by SFPutFile;
  8853. otherwise, filterProoc should point to a function for ModalDialog to
  8854. execute afterdoing the standard filterilng. THe function must be the
  8855. same as one you'd pass directly to ModalDialog in its filterProc
  8856. parameter. (See the Dialog Manager manual for more information.)
  8857. \ SFGetFile
  8858. 13
  8859. PROCEDURE SFGetFile (where: Point; prompt: Str255; fileFilter: ProcPtr;
  8860.                     numTypes: INTEGER; typeList: SFTypeList;
  8861.                     dlgHook: ProcPtr; VAR reply: SFReply);
  8862.  
  8863.     SFGetFIle displays a dialog box listing the names of a specific
  8864. group of files from which the user can select one to be opened (as
  8865. during an Open command). It then repeatedly gets and handles events
  8866. until the user either confirms the command after choosing a file name or
  8867. aborts the command by clicking Cancel in the dialog. It reports the
  8868. user's reply by filling the fields of the reply record specified by the
  8869. reply parameter, as described above under "Using the Standard File
  8870. Package".
  8871.  
  8872.     The general appearance of the standard SFGetFile dialog box is shown
  8873. in Figure S-5. File names are sorted in order of the ASCII codes of
  8874. their characters, ignoring diacritical marks and mapping lowercase
  8875. characters to their uppercase equivalents. If there are more file names
  8876. than can be displayed at one time, the scroll bar is active; otherwise,
  8877. the scroll bar is inactive.
  8878.  
  8879.     The where parameter specifies the  location of the top left corner
  8880. of the dialog box in global coordinates. The prompt parameter is
  8881. ignored; it's there for historical purposes only.
  8882.  
  8883.     The fileFilter, numTypes, and typeList parameters determine which
  8884. files appear in the dialog box. SFGetFile first looks at numTypes and
  8885. typeList to determine what types of files to display, then it executes
  8886. the function pointed to by fileFilter (if any) to do additional
  8887. filtering on which files to display. File types are discussed in the
  8888. manual THE STRUCTURE OF A MACINTOSH APPLICATION. For example, if the
  8889. applicaiton is concerned only with pictures, you won't want to display
  8890. the names of any text files.
  8891.  
  8892.     Pass -1 for numTypes to display all types of files; otherwise, pass
  8893. the number of file types you want to display, and pas the types
  8894. themselves in typeList. The SFTypeList data type is defined as follows:
  8895.  
  8896.          TYPE SFTypeList = ARRAY [0..3] OF OSTYPE;
  8897.  
  8898. (note)
  8899.        This array is declared for a reasonable maximum number of
  8900.        types (four). If you need to specify more than four
  8901.        types, declare your own array type with the desired
  8902.        number of entries (and use the @ operator to pass a
  8903.        pointer to it).
  8904.  
  8905.     If fileFilter isn't NIL, SFGetFile executes the function it points
  8906. to for each file, to determine whether the file should be displayed.
  8907. The fileFilter function has one parameter and returns a Boolean value.
  8908. For example:
  8909.  
  8910.          FUNCTION MyFileFilter (paramBlock: ParmBlkPtr) : BOOLEAN;
  8911.  
  8912.     SFGetFile passes this function the file information it gets by
  8913. calling the File Manager procedure PBGetFInfo. The function selects
  8914. which files should appear in the dialog by returning FALSE for every
  8915. file that should be shown and TRUE for every file that shouldn't be
  8916. shown.
  8917.  
  8918. (note)
  8919.        As described in the File Manager manual, a flag can be
  8920.        set that tells the Finder not to display a particular
  8921.        file's icon on the desktop; this has no effect on whether
  8922.        SFGetFile will list the file name.
  8923.  
  8924.     If you want to use the standard SFGetFile dialog box, pass NIL for
  8925. dlgHook; otherwise, see the information for advanced programmers below.
  8926.  
  8927.     Like SFPutFile, SFGetFile repeatedly calls the Dialog Manager
  8928. procedure ModalDialog. When an event involving an enabled dialog item
  8929. occurs, ModalDialog handles the event and returns the item number, and
  8930. SFGetFile responds as follows:
  8931.  
  8932.    - If the Eject or Drive button is clicked, or a disk is inserted,
  8933.      SFGetFile responds as described above under "About the Standard
  8934.      File Package".
  8935.  
  8936.    - If clicking or dragging occurs in the scroll bar, the contents of
  8937.      the dialog box are redrawn accordingly.
  8938.  
  8939.    - If a file name is clicked, it's selected and stored in the fName
  8940.      field of the reply record. (SFGetFile keeps track of whether a
  8941.      file name is currently selected, and makes the Open button
  8942.      inactive if not.)
  8943.  
  8944.    - If the Open button is clickd, SFGetFile returns control to the
  8945.      application with the first field of the reply record set to TRUE.
  8946.  
  8947.    - If a file name is double-clicked, SFGetFile responds as if the
  8948.      user clicked the file name and then the Open button.
  8949.  
  8950.    - If the Cancel button in the dialog is clicked, SFGetFile returns
  8951.      control to the application with the first field of the reply
  8952.      record set to FALSE.
  8953.  
  8954.     If a key (other than a modifier key) is pressed, SFGetFile selects
  8955. the first file name starting with the character typed. If no file name
  8956. starts with that character, it selects the first file name starting
  8957. with a character whose ASCII code is greater than the character typed.
  8958.  
  8959. Advanced programmers:  You can create your own dialog box rather than
  8960. use the  standard SFGetFile dialog. To do this, you must provide your
  8961. own dialog template and store it in your application's resource file
  8962. with the same resource ID that the standard template has in the system
  8963. resource file:
  8964.  
  8965.         CONST getDlgID = -4000;   {SFGetFile dialog template ID}
  8966.  
  8967. (note)
  8968.       THe SFPGetFile procedure, described below, lets you use
  8969.       any resource ID for your nonstandard dialog box.
  8970.  
  8971.  
  8972.     Your dialog template must specify that the dialog window be
  8973. invisible, and your dialog must contain all the standard items, as
  8974. listed below. The appearance and location of these items in your dialog
  8975. may be different. You can make an item "invisible" by giving it a
  8976. display rectangle that's off the screen. The display rectangle for each
  8977. in the standard dialog box is given below. THe rectangle for the
  8978. standard dialog box itself is (0,0,348,136).
  8979.  
  8980.  Item Number    Item                     Standard display rectangle
  8981.     1         Open button                     (152,28,232,46)
  8982.     2         Invisible button                (1152,59,1232,77)
  8983.     3         Cancel button                   (152,90,232,108)
  8984.     4         UserItem for disk name          (248,28,344,46)
  8985.     5         Eject button                    (256,59,336,77)
  8986.     6         Drive button                    (256,90,336,108)
  8987.     7         UserItem for file name list     (12,11,125,125)
  8988.     8         UserItem for scroll bar         (124,11,140,125)
  8989.     9         UserItem for gray line          (244,20,245,116)
  8990.    10         Invisible text (statText)       (1044,20,1145,116)
  8991.  
  8992.     If your dialog has additional items beyond the standard ones, or if
  8993. you want to handle any of the standard items in a nonstandard manner,
  8994. you must write your own dlgHook function and point to it with dlgHook.
  8995. Your dlgHook function should have two parameters and return an integer
  8996. value. For example, this is how it would be declared if it were named
  8997. MyDlg:
  8998.  
  8999.        FUNCTION MyDlg (item: INTEGER; theDialog: DialogPtr) : INTEGER;
  9000.  
  9001.     Immediately after calling ModalDialog, SFGetFile calls you dlgHook
  9002. function, passing it the item number returned by ModalDialog and a
  9003. pointer to the dialog record describing you dialog box. Using these
  9004. two parameters, your dlgHook function should determine how to handle
  9005. the event. There are predefined constants for the item numbers of
  9006. standard enabled items, as follows:
  9007.  
  9008.     CONST getOpen    = 1;   {Open button}
  9009.           getCancel  = 3;   {Cancel button}
  9010.       getEject   = 5;   {Eject button}
  9011.       getDrive   = 6;   {Drive button}
  9012.       getNmList  = 7;   {userItem for file name list}
  9013.       getScroll  = 8;   {userItem for scroll bar}
  9014.  
  9015.     ModalDIalog also returns "fake" item numbers in the following
  9016. situations, which are detected by its filterProc function:
  9017.  
  9018.    - When a disk-inserted event occurs, it returns 100.
  9019.  
  9020.    - When a key-down event occurs, it returns 1000 plus the ASCII code
  9021.      of the character.
  9022.  
  9023.     After handling the event (or, perhaps, after ignoring it) your
  9024. dlgHook function must return an item number to SFGetFile. If the item
  9025. number is one of those listed above, SFGetFile responds in the standard
  9026. way; otherwise, it does nothing.
  9027. \ SFPGetFile
  9028. 13
  9029. PROCEDURE SFPGetFile (where: Point; prompt: Str255; fileFilter:
  9030.             ProcPtr; numTypes: INTEGER; typeList: SFTypeList; dlgHook:
  9031.         ProcPtr; VAR reply: SFReply; dlgID: INTEGER; filterProc:
  9032.         ProcPtr);
  9033.  
  9034.     SFPGetFile is an alternative to SFGetFile for advanced programmers
  9035. who want to use a nonstandard dialog box. It's the same as  SFGetFile
  9036. except for the two additional parameters dlgID and filterProc.
  9037.  
  9038.     DlgID is the rexource ID of the dialog template to be used instead
  9039. of the standard one (so you can use whatever ID you wish rather than the
  9040. smae one as the standard).
  9041.  
  9042.     The filterProc parameter determines how ModalDialog will filter
  9043. events when called by SFPGetFile. If filterProc is NIL, ModalDialog
  9044. does the standard filtering that it does when called by SFGetFile;
  9045. otherwise, filterProc should point to a function for ModalDialog to
  9046. execute after doing the standard filtering. Note, however, that the
  9047. standard filtering will detect key-down events only if the dialog
  9048. template ID is the standard one.
  9049. \ DILoad
  9050. 13
  9051. PROCEDURE DILoad;
  9052.  
  9053.     DILoad reads the Disk Initialization Package, and its associated
  9054. dialog and dialog items, from the system resource file into memory and
  9055. makes them unpurgeaable.
  9056.  
  9057. (note)
  9058.        DIFormat, DIVerify, and DIZero don't need the dialog, so
  9059.        if you use only these routines you can call the Resource
  9060.        Manager function GetResource to read just the package
  9061.        resource into memory (and the Memory Manager procedure
  9062.        HNoPurge to make it unpurgeable).
  9063. \ DIUnload
  9064. 13
  9065. PROCEDURE DIUnload;
  9066.  
  9067.     DIUnload makes the Disk Initialization Package (and its associated
  9068. dialog an dialog items) purgeable.
  9069. \ DIBadMount
  9070. 13
  9071. FUNCTION DIBadMount (where: Point; evtMessage: LongInt) : INTEGER;
  9072.  
  9073.     Call DIBadMount when a disk-inserted event occurs if the result code
  9074. in the high-order word of the associated event message indicates an
  9075. error (that is, the result code is other than noErr). Given the event
  9076. message in evtMessage, DIBadMount evaluates the result code and either
  9077. ejects the disk or lets the user initialize and name it. The low-order
  9078. word of the event message contains the drive number. The where
  9079. parameter specifies the location (in global coordinates) of the top
  9080. left corner of the dialog box displayed by DIBadMount.
  9081.  
  9082.     If the result code passed is extFSErr, mFulErr, nsDrvErr, paramErr
  9083. , or volOnLinErr, DIBadMount displays a dialog box that describes the
  9084. problem and asks whether the user wants to initialized the disk. For
  9085. the result code ioErr, the dialog box shown in Figure D-1 is displayed.
  9086. (This happens if the disk is brand new.)  For badMDBErr and noMacDskErr,
  9087. DIBadMount displays a similar dialog box in which the description of
  9088. the problem is "This disk is damaged" and "This is not a Macintosh
  9089. disk", respectively.
  9090.  
  9091. (note)
  9092.        Before presenting the disk initialization dialog,
  9093.        DIBadMount checks whether the drive contains an already
  9094.        mounted volume; if so, it ejects the disk and returns 2
  9095.        as its result. This will happen rarely and may reflect
  9096.        an error in your program (for example, you forgot to call
  9097.        DILoad and the user had to switch to the disk containing
  9098.        the system resource file).
  9099.  
  9100.     If the user responds to the disk initialization dialog by clicking
  9101. the Eject button, DIBadMount ejects the disk and returns 1 as its result
  9102. If the Initialize button is clicked, a box displaying the message
  9103. "Initializing disk..." appears, and DIBadMount attempts to initialize
  9104. the disk. If initialization fails, the disk is ejected and the user is
  9105. informed as shown in Figure D-2; after the user clicks OK, DIBadMount
  9106. returns a negative result code ranging from firstDskErr to lastDskErr,
  9107. indicating that a low-level disk error occurred.
  9108.  
  9109.     If the disk is successfully initialized, the dialog box in Figure D
  9110. appears. After the user names the disk and clicks OK, DIBadMount
  9111. mounts the volume by calling the File Manager function PBMountVol and
  9112. returns PBMountVol's result code (noErr if no error occurs).
  9113.  
  9114.       Result codes
  9115.       ------------
  9116.       noErr                No error
  9117.       extFSErr             External file system
  9118.       mFulErr              Memory full
  9119.       nsDrvErr             No such drive
  9120.       paramErr             Bad drive number
  9121.       volOnLinErr          Volume already on-line
  9122.       firstDskErr          Low-level disk error
  9123.       through lastDskErr
  9124.  
  9125.       Other results
  9126.       -------------
  9127.       1                    User clicked Eject
  9128.       2                    Mounted volume in drive
  9129. \ DIFormat
  9130. 13
  9131. FUNCTION DIFormat (drvNum: INTEGER) : OSErr;
  9132.  
  9133.     DILFormat formats the disk in the drive specified by the given drive
  9134. number and returns a result code indicating whether the formatting was
  9135. completed successfully or failed. Formatting a disk consists of
  9136. writing special infromation onto it so that the Disk Driver can read
  9137. from and write to the disk.
  9138.  
  9139.       Result codes
  9140.       ------------
  9141.       noErr               No error
  9142.       firstDskErr         Low-level disk error
  9143. \ DIVerify
  9144. 13
  9145. FUNCTION DIVerify (drvNum: INTEGER) : OSErr;
  9146.  
  9147.     DIVerify verifies the format of the disk in the drive specified by
  9148. the given drive number; it reads each bit from the disk and returns a
  9149. result code indicating whether all bits were read successfully or not.
  9150.  
  9151.       Result codes
  9152.       ------------
  9153.       noErr                 No error
  9154.       firstDskErr           Low-level disk error
  9155. \ DIZero
  9156. 13
  9157. FUNCTION DIZero (drvNum: INTEGER; volName: Str255) : OSErr;
  9158.  
  9159.     On the unmounted volume in the drive specified by the given drive
  9160. number, DIZero writes the volume information, a block map, and a file
  9161. directory as for a volume with no files; the volName parameter
  9162. specifies the volume name to be included in the volume information.
  9163. This is the last step in initialization (after formatting and
  9164. verifying) and makes any files that are already on the volume
  9165. permanently inaccessible. If the operation fails, DIZero returns a
  9166. result code indicating that a low-level disk error occurred; otherwise,
  9167. it mounts the volume by calling the File Manager function PBMountVol
  9168. and returns PBMountVol's result code (noEr if no error occurs).
  9169.  
  9170.  
  9171.       Result codes
  9172.       ------------
  9173.       noErr                    No error
  9174.       badMDBErr                Bad master directory block
  9175.       extFSErr                 External file system
  9176.       ioErr                    Disk I/O error
  9177.       mFulErr                  Memory full
  9178.       noMacDskErr              Not a Macintosh volume
  9179.       nsDrvErr                 No such drive
  9180.       paramErr                 Bad drive number
  9181.       volOnLinErr              Volume already on-line
  9182.       firstDskErr              Low-level disk error
  9183.       through lastDskErr
  9184. \ InitApplZone
  9185. 14
  9186. PROCEDURE InitApplZone;
  9187.  
  9188.       _________________________________________________________
  9189.  
  9190.       Trap macro            _InitApplZone
  9191.       On exit               D0:  result code (integer)
  9192.  
  9193.       _________________________________________________________
  9194.  
  9195.  
  9196.     InitApplZone initializes the application heap zone and makes it the
  9197. current zone. The contents of any previous application zone are lost;
  9198. all previously existing blocks in that zone are discarded.
  9199. InitApplZone is called by the Segment Loader when starting up an
  9200. application;  you shouldn't normally need to call it.
  9201.  
  9202. (warning)
  9203.        Reinitializing the application zone from within a running
  9204.        program is tricky, since the program's code itself
  9205.        resides in the application zone. To do it safely, the
  9206.        code containing the InitApplZone call cannot be in the
  9207.        application zone.
  9208.  
  9209.     The application zone has an initial size of 6K bytes, and can be
  9210. expanded as needed in 1K increments. Space is initially allocated for
  9211. 64 master pointers; should more be needed later, they will be added 64
  9212. at a time. The zone's grow zone function is set to NIL.
  9213.  
  9214.        Result codes        noErr         No eror
  9215. \ SetApplBase
  9216. 14
  9217. PROCEDURE SetApplBase (startPtr: Ptr);
  9218.  
  9219.             _________________________________________________
  9220.  
  9221.      Trap macro               _SetApplBase
  9222.      On entry                 A0:  startPtr (pointer)
  9223.      On exit                  D0:  result code (integer)
  9224.  
  9225.             _________________________________________________
  9226.  
  9227.  
  9228.     SetApplBase changes the starting address of the application heap
  9229. zone to the address designated by startPtr, and then calls IniApplZone.
  9230. SetApplBase is normally called only by the system itself; you should
  9231. never need to call this procedure.
  9232.  
  9233.     Since the application heap zone begins immediately folowing the end
  9234. of the system zone, changingits starting address has the effect of
  9235. changing the size of the system zone. The system zone can be made
  9236. larger, but never smaller; if startPtr points to an address lower than
  9237. the current end of the system zone, it's ignored and the application
  9238. zone's starting address is left unchanged.
  9239.  
  9240. (warning)
  9241.       Like InitApplZone, SetApplBase is a tricky operation,
  9242.       because the code of the program itself resides in the
  9243.       application heap zone. To do it safely, the code
  9244.       containing the SetApplBase call cannot be in the
  9245.       application zone.
  9246.  
  9247.       Result codes     noErr             No error
  9248. \ InitZone
  9249. 14
  9250. PROCEDURE InitZone (pGrowZone: ProcPtr; cMoreMasters: INTEGER;
  9251.                     limitPtr, startPtr: Ptr);
  9252.  
  9253.  
  9254.        ________________________________________________________
  9255.  
  9256.         Trap macro            _InitZone
  9257.  
  9258.         On entry              A0:  pointer to parameter block
  9259.  
  9260.         Parameter block
  9261.                0      startPtr       pointer
  9262.                4      limitPtr       pointer
  9263.                8      cMoreMasters   integer
  9264.               10      pGrowZone      pointer
  9265.  
  9266.         On exit                D0: result code (integer)
  9267.  
  9268.        ________________________________________________________
  9269.  
  9270.  
  9271.     InitZone creates a new heap zone initializes its header and trailer,
  9272. and makes it the current zone. The startPtr parameter is a pointer to
  9273. the first byte of the new zone; limitPtr points to the first byte of
  9274. the zone trailer. The new zone will occupy memory addresses from
  9275. ORD(startPtr) to ORD(limitPtr)+11.
  9276.  
  9277.     CMoreMasters tells how many master pointers should be allocated at a
  9278. time for the new zone. This number of master pointers are created
  9279. initially; should more be needed later, they will be added in
  9280. increments of this same number. For the system heap zone, this number
  9281. is initially 32; for the application heap zone, it's 64.
  9282.  
  9283.     The pGrowZone parameter is a pointer to the grow zone function for
  9284. the new zone, if any. If you're not defining a grow zone function for
  9285. this zone, pass NIL.
  9286.  
  9287.     The new zone includes a 52-byte header, so its actual usable space
  9288. runs from ORD(startPtr)+52 through ORD(limitPtr)-1. In addition, each
  9289. master pointer occupies four bytes within this usable area. Thus the
  9290. total available space in the zone, in bytes, is initially
  9291.  
  9292.       ORD(limitPtr) - ORD(startPtr) - 52 - 4*cMoreMasters
  9293.  
  9294.     This number must not be less than 0. Note that the amount of
  9295. available space in the zone will decrease as more master pointers are
  9296. allocated.
  9297.  
  9298.       Result codes        noErr                No error
  9299. \ SetApplLimit
  9300. 14
  9301. PROCEDURE SetApplLimit (zoneLimit: Ptr);
  9302.  
  9303.         _________________________________________________
  9304.  
  9305.          Trap macro        _SetApplLimit
  9306.  
  9307.          On entry          A0:  zoneLimit (pointer)
  9308.  
  9309.          On exit           D0:  result code (integer)
  9310.  
  9311.         _________________________________________________
  9312.  
  9313.  
  9314.     SetApplLimit sets the application heap limit, beyond which the
  9315. application heap zone can't be expanded. The actual expansion isn't
  9316. under your program's control, but is done automatically by the Memory
  9317. Manager when necessary to satisfy allocation requests. Only the
  9318. original application zone can be expanded.
  9319.  
  9320.     ZoneLimit  is a limit pointer to a byte in memory beyond which the
  9321. zone will not be allowed to grow. The zone can grow to include the byte
  9322. preceding zoneLimit in memory, but no farther. If the zone already
  9323. extends beyond the specified limit it won't be cut back, but it will be
  9324. prevented from growing any more.
  9325.  
  9326. (warning)
  9327.        Notice that zoneLimit is not a byte count. To limit the
  9328.        application zone to a particular size (say 8Kbytes), you
  9329.        have to write something like
  9330.  
  9331.             SetApplLimit(Ptr(ApplicZone)+8192)
  9332.  
  9333.        The Memory Manager function ApplicZone is explained
  9334.        below.
  9335.  
  9336.  
  9337.             _________________________________________________
  9338.  
  9339.        Assembly-language note:  The global variable ApplLimit contains
  9340.        the application heap limit.
  9341.  
  9342.             _________________________________________________
  9343.  
  9344.  
  9345.        Result codes      noErr           No error
  9346. \ MaxApplZone
  9347. 14
  9348. PROCEDURE MaxApplZone;    [No trap macro]
  9349.  
  9350.     MaxApplZone expands the application heap zone to the application
  9351. heap limit without purging any blocks currently in the zone. If the
  9352. zone already extends to the limit, it won't be changed.
  9353.  
  9354.       Result codes      noErr           No error
  9355. \ MoreMasters
  9356. 14
  9357. PROCEDURE MoreMasters;
  9358.  
  9359.             _________________________________________________
  9360.  
  9361.        Trap macro         _MoreMasters
  9362.  
  9363.             _________________________________________________
  9364.  
  9365.     MoreMasters allocates another block of master pointers in the
  9366. current heap zone. This procedure is usually called very early in an
  9367. application.
  9368.  
  9369.      Result codes
  9370.      ------------
  9371.      noErr             No error
  9372.      memFullErr        Not enough room in zone
  9373. \ GetZone
  9374. 14
  9375. FUNCTION GetZone:  THz;
  9376.  
  9377.             _________________________________________________
  9378.  
  9379.       Trap macro             _GetZone
  9380.  
  9381.       On exit                A0:  function result (pointer)
  9382.                              D0:  result code (integer)
  9383.             _________________________________________________
  9384.  
  9385.     GetZone returns a pointer to the curent heap zone.
  9386.  
  9387.             _________________________________________________
  9388.  
  9389.       Assembly-language note:  The global variable TheZone contains a
  9390.       pointer to the current heap zone.
  9391.             _________________________________________________
  9392.  
  9393.       Result codes      noErr          No error
  9394. \ SetZone
  9395. 14
  9396. PROCEDURE SetZone (hz: THz);
  9397.  
  9398.             _________________________________________________
  9399.  
  9400.        Trap macro      _SetZone
  9401.  
  9402.        On entry        A0:  hz (pointer)
  9403.  
  9404.        On exit         D0:  result code (integer)
  9405.             _________________________________________________
  9406.  
  9407.     SetZone sets the current heap zone to the zone pointed to by hz.
  9408.  
  9409.             _________________________________________________
  9410.  
  9411.        Assembly-language note:  You can set the current heap zone by
  9412.        storing a pointer to it in the global variable TheZone.
  9413.             _________________________________________________
  9414.  
  9415.        Result codes          noErr           No error
  9416.  
  9417.  
  9418.  
  9419. \ SystemZone
  9420. 14
  9421. FUNCTION SystemZone : THz;       [No trap macro]
  9422.  
  9423.     SystemZone returns a pointer to the system heap zone.
  9424.  
  9425.             _________________________________________________
  9426.  
  9427.        Assembly-language note:  The global variable SysZone contains a
  9428.        pointer to the system heap zone.
  9429.             _________________________________________________
  9430.  
  9431.        Result codes            noErr        No error
  9432. \ ApplicZone
  9433. 14
  9434. PROCEDURE ApplicZone : THz;  [No trap macro]
  9435.  
  9436.     ApplicZone returns a pointer to the original application heap zone.
  9437.  
  9438.             _________________________________________________
  9439.  
  9440.      Assembly-language note:  The global variable ApplZone contains a
  9441.      pointer to the original application heap zone.
  9442.             _________________________________________________
  9443.  
  9444.      Result codes         noErr          No error
  9445. \ NewHandle
  9446. 14
  9447. FUNCTION NewHandle (logicalSize: Size) : Handle;
  9448.  
  9449.     __________________________________________________________
  9450.  
  9451. Trap macro       _NewHandle
  9452.                  _NewHandle ,SYS           (applies to system heap)
  9453.                  _NewHandle ,CLEAR         (clears allocated block)
  9454.                  _NewHandle ,SYS,CLEAR     (applies to system heap and
  9455.                                             clears allocated block)
  9456.  
  9457. On entry         D0:  logicalSize (long integer)
  9458.  
  9459. On exit          A0:  function result (handle)
  9460.                  D0:  result code (integer)
  9461.     __________________________________________________________
  9462.  
  9463.     NewHandle attempts to allocate a new relocatable block of
  9464. logicalSize bytes from the current heap zone and then return a handle to
  9465. it. The new block will be unlocked and unpurgeable. If logicalSize bytes
  9466. can't be allocated, NewHandle returns NIL.
  9467.  
  9468.     NewHandle will pursue all available avenues to create a free block
  9469. of the requested size, includinig compacting the heap zone, increasing
  9470. its size, purging blocks from it, and calling its grow zone function, if
  9471. any.
  9472.  
  9473.        Result codes     noErr           No error
  9474.                         memFulErr       Not enough room in zone
  9475. \ DisposHandle
  9476. 14
  9477. PROCEDURE DisposHandle (h: Handle);
  9478.  
  9479.             _________________________________________________
  9480.  
  9481.       Trap macro           _DisposHandle
  9482.  
  9483.       On entry             A0:  h (handle
  9484.  
  9485.       On exit              A0:  0
  9486.                            D0: result code (integer)
  9487.             _________________________________________________
  9488.  
  9489.     DisposHandle releases the memory occupied by the relocatable block
  9490. whose handle is h.
  9491.  
  9492. (warning)
  9493.        After a call to DisposHandle, all handles to the released
  9494.        block become invalid and should not be used again.
  9495.  
  9496.        Result codes     noErr       No error
  9497.                         memWZErr    Attempt to operate on a free block
  9498. \ GetHandleSize
  9499. 14
  9500. FUNCTION GetHandleSize (h: Handle) : Size;
  9501.  
  9502.             _________________________________________________
  9503.  
  9504.      Trap macro      _GetHandleSize
  9505.  
  9506.      On entry        A0:  h (handle)
  9507.  
  9508.      On exit         D0:  if >=0, function result (long integer)
  9509.                           if <0, result code (integer)
  9510.             _________________________________________________
  9511.  
  9512.     GetHandleSize returns the logical size, in bytes, of the relocatable
  9513. block whose handle is h. In case of an error, GetHandleSize returns 0.
  9514.  
  9515.             _________________________________________________
  9516.  
  9517.      Assembly-language note:  Recall that the trap dispatcher sets
  9518.      the condition codes before returning from a trap by testing the
  9519.      low-order word of register D0 with a TST.W instruction. Since
  9520.      the block size returned in D0 by _GetHandleSize is a full 32-bit
  9521.      long word, the word-length test sets the condition codes
  9522.      incorrectly in this case. To branch on the contents of D0, use
  9523.      your own TST.L instruction on return from the trap to test the
  9524.      full 32 bits of the register.
  9525.             _________________________________________________
  9526.  
  9527.      Result codes    noErr           No error   [Pascal only]
  9528.                     nilHandleErr     NIL master pointer
  9529.                     memWZErr         Attempt to operate on a free block
  9530. \ SetHandleSize
  9531. 14
  9532. PROCEDURE SetHandleSize (h: Handle; newSize: Size);
  9533.  
  9534.             _________________________________________________
  9535.  
  9536.      Trap macro          _SetHandleSize
  9537.  
  9538.      On entry       A0:  h (handle)
  9539.                     D0:  newSize (long integer)
  9540.  
  9541.      On exit        D0:  result code (integer)
  9542.             _________________________________________________
  9543.  
  9544.     SetHandleSize changes the logical size of the relocatable block
  9545. whose handle is h to newSize bytes.
  9546.  
  9547. (note)
  9548.        Don't attempt to increase the size of a locked block,
  9549.        becausse its unlikely the Memory Manager will be able to
  9550.        do so.
  9551.  
  9552.        Result codes
  9553.  
  9554.        noErr         No error
  9555.        memFullErr    Not enough room to grow
  9556.        nilHandleErr  NIL master pointer
  9557.        memWZErr      Attempt to operate on a free block
  9558. \ HandleZone
  9559. 14
  9560. FUNCTION HandleZone (h: Handle) : THz;
  9561.  
  9562.         _________________________________________________
  9563.  
  9564.           Trap macro    _HandleZone
  9565.  
  9566.           On entry      A0: h (handle)
  9567.  
  9568.           On exit       A0:  function result (pointer)
  9569.                         D0:  result code (integer)
  9570.         _________________________________________________
  9571.  
  9572.     HandleZone returns a pointer to the heap zone containing the
  9573. relocatable block whose handle is h.
  9574.  
  9575. (warning)
  9576.         If handle h is empty (points to a NIL master pointer),
  9577.     HandleZone returns a pointer to the current heap zone.
  9578.     In case of an error, the result returned by HandleZone is
  9579.     meaningless and should be ignored.
  9580.  
  9581. Result codes      noErr            No error
  9582.                   memWZErr         Attempt to operate on a free block
  9583. \ RecoverHandle
  9584. 14
  9585. FUNCTION RecoverHandle (p:Ptr) : Handle;
  9586.  
  9587.             _________________________________________________
  9588.  
  9589.       Trap macro      _RecoverHandle
  9590.                       _RecoverHandle ,SYS     (applies to system heap)
  9591.  
  9592.       On entry        A0:  p (pointer)
  9593.  
  9594.       On exit         A0:  function result (handle)
  9595.                       D0:  unchanged
  9596.             _________________________________________________
  9597.  
  9598.  
  9599.     RecoverHandle returns a handle to the relocataable block pointed to
  9600. by p.
  9601.  
  9602.             _________________________________________________
  9603.  
  9604.     Assembly-language note:  The trap _RecoverHandle doesn't return
  9605.     a result code in register D0; the previous contents of D0 are
  9606.     preserved unchanged.
  9607.             _________________________________________________
  9608.  
  9609.     Result codes     noErr          No error   [Pascal only]
  9610. \ ReallocHandle
  9611. 14
  9612. PROCEDURE ReallocHandle (h: Handle; logicalSize: Size);
  9613.  
  9614.             _________________________________________________
  9615.  
  9616.     Trap macro         _ReallocHandle
  9617.  
  9618.     On entry           A0:  h (handle)
  9619.                        D0:  logicalSize   (integer)
  9620.  
  9621.     On exit            A0:  original h or 0
  9622.                        D0:  result code  (integer)
  9623.             _________________________________________________
  9624.  
  9625.     ReallocHandle allocates a new relocatable block with a logical size
  9626. of logicalSize bytes. It then updates handle h by setting its master
  9627. pointer to point to the new block. The main use of this procedure is
  9628. to reallocate space for a block that has been purged. Normally h is an
  9629. empty handle, but it need not be:  if it points to an existing block,
  9630. that block is released before the new block is created.
  9631.  
  9632.     In case of an error, no new block is allocated and handle h is left
  9633. unchanged.
  9634.  
  9635.             _________________________________________________
  9636.  
  9637.     Assembly-language note:  On return from ReallocHandle, register
  9638.     A0 contains the original handle h, or 0 if no room could be
  9639.     found for the requested block.
  9640.             _________________________________________________
  9641.  
  9642.     Result codes
  9643.  
  9644.             noErr       Noerror
  9645.             memFullErr  Not enough room in zone
  9646.             memWZErr    Attempt to operate on a free block
  9647.             MemPurErr   Block is locked
  9648. \ NewPtr
  9649. 14
  9650. FUNCTION NewPtr (logicalSize: Size) : Ptr;
  9651.  
  9652.             _________________________________________________
  9653.  
  9654.     Trap macro  _NewPtr
  9655.                 _NewPtr ,SYS        (applies to system heap)
  9656.                 _NewPtr ,CLEAR      (clears allocated block)
  9657.                 _NewPtr ,SYS,CLEAR  (applies to system heap and
  9658.                                     clears allocated block)
  9659.  
  9660.     On entry    D0:  logicalSize (long integer)
  9661.  
  9662.     On exit     A0:  function result (pointer)
  9663.                 D0:  result code (integer)
  9664.             _________________________________________________
  9665.  
  9666.     NewPtr attempts to allocate a new nonrelocatable block of
  9667. logicalSize bytes from the current heap zone and then return a pointer
  9668. to it. If logicalSize bytes can't be allocated, NewPtr returns NIL.
  9669.  
  9670.     Newptr will pursue all available avenues to create a free block of
  9671. the requested size, including compacting the heap zone, increasing its
  9672. size, purging blocks from it, and calling its grow zone function, if
  9673. any.
  9674.  
  9675.     Result codes
  9676.  
  9677.             noErr       No error
  9678.             memFullErr  Not enough room in zone
  9679. \ DisposPtr
  9680. 14
  9681. PROCEDURE DisposPtr (p: Ptr);
  9682.  
  9683.           _________________________________________________
  9684.  
  9685.             Trap macro  _DisposPtr
  9686.  
  9687.             On entry    A0:  p (pointer)
  9688.  
  9689.             On exit     A0:  0
  9690.                         D0:  result code (integer)
  9691.           _________________________________________________
  9692.  
  9693.     DisposPtr releases the memory occupied by the nonrelocatable block
  9694. pointed to by p.
  9695.  
  9696. (warning)
  9697.     After a call to DisposPtr, all pointers to the released
  9698.     block become invalid and should not be used again.
  9699.  
  9700.     Result codes
  9701.  
  9702.             noErr       No error
  9703.             memWZErr    Attempt to operated on a free block
  9704. \ GetPtrSize
  9705. 14
  9706. FUNCTION GetPtrSize (p: Ptr) : Size;
  9707.  
  9708.     ___________________________________________________________
  9709.  
  9710.     Trap macro  _GetPtrSize
  9711.  
  9712.     On entry    A0:  p (pointer)
  9713.  
  9714.     On exit     D0:  if >=0, function result (long integer)
  9715.                      if <0, result code (integer)
  9716.     ___________________________________________________________
  9717.  
  9718.     GetPtrSize returns the logical size, in bytes, of the nonrelocatable
  9719. block pointed to by p. In case of an error, GetPtrSize returns 0.
  9720.  
  9721.     ___________________________________________________________
  9722.  
  9723.     Assembly-language note:  Recall that the trap dispatcher sets
  9724.     the condition codes before returning from a trap by testing the
  9725.     low-order half of register D0 with a TST.W instruction. Since
  9726.     the block size returned in D0 by _GetPtrSize is a full 32-bit
  9727.     long word, the word-length test sets the condition codes
  9728.     incorrectly in this case. To branch on the contents of D0, use
  9729.     your own TST.L instruction on return from the trap to test the
  9730.     full 32 bits of the register.
  9731.     ___________________________________________________________
  9732.  
  9733.     Result codes
  9734.  
  9735.             noErr       No error   [Pascal only]
  9736.             memWZErr    Attempt to operate on a free block
  9737. \ SetPtrSize
  9738. 14
  9739. PROCEDURE SetPtrSize (p: Ptr; newSize: Size);
  9740.  
  9741.     ___________________________________________________________
  9742.  
  9743.     Trap macro  _SetPtrSize
  9744.  
  9745.     On entry    A0:  p (pointer)
  9746.  
  9747.     On exit     A0:  function result (pointer)
  9748.             D0:  result code (integer)
  9749.     ___________________________________________________________
  9750.  
  9751.     PtrZone returns a pointer to the heap zone containing the
  9752. nonrelocatable block pointed to by p. In case of an error, the result
  9753. returned by PtrZone is meaningless and should be ignored.
  9754.  
  9755.     Result codes
  9756.  
  9757.             noErr       No error
  9758.             memWZErr    Attempt to operate on a free block
  9759. \ FreeMem
  9760. 14
  9761. FUNCTION FreeMem : LONGINT;
  9762.  
  9763.         _______________________________________________________
  9764.  
  9765.         Trap macro  _FreeMem
  9766.                     _FreeMem ,SYS   (applies to system heap
  9767.  
  9768.         On exit     D0:  function result (long integer)
  9769.         _______________________________________________________
  9770.  
  9771.     FreeMem returns the total amount of free space in the current heap
  9772. zone, in bytes. Notice that it ususally isn't possible to allocate a 
  9773. block of this size, because of fragmentation due to nonrelocatable or
  9774. locked blocks.
  9775.  
  9776.     Result codes
  9777.  
  9778.             noErr   No error
  9779. \ MaxMem
  9780. 14
  9781. FUNCTION MaxMem (VAR grow: Size) : Size;
  9782.  
  9783.             _________________________________________________
  9784.  
  9785.     Trap macro  _MaxMem
  9786.                 _MaxMem ,SYS            (applies to system heap)
  9787.  
  9788.     On exit     D0:  function result    (long integer)
  9789.                 A0:  grow               (long integer)
  9790.             _________________________________________________
  9791.  
  9792.     MaxMem compacts the current heap zone and purges all purgeable
  9793. blocks from the zone. It returns as its result the size in bytes of the
  9794. largest contiguous free block in the zone after the compaction. If the
  9795. current zone is the original application heap zone, the variable
  9796. parameter grow is set to the maximum number of bytes by which the zone
  9797. can grow. For any other heap zone, grow is set to 0. MaxMem doesn't
  9798. actually expand the zone or call its grow zone function.
  9799.  
  9800.     Result codes
  9801.  
  9802.             noErr   No error
  9803. \ CompactMem
  9804. 14
  9805. FUNCTION CompactMem (cbNeeded: Size) : Size;
  9806.  
  9807.     ___________________________________________________________
  9808.  
  9809.     Trap macro  _CompactMem
  9810.                 _CompactMem ,SYS    (applies to system heap)
  9811.  
  9812.     On entry    D0:  cbNeeded (longinteger)
  9813.  
  9814.     On exit     D0:  function result (long integer)
  9815.     ___________________________________________________________
  9816.  
  9817.     CompactMem compacts the current heap zone by moving relocatable
  9818. blocks forward and collecting free space together until a contiguous
  9819. block of at least cbNeeded free bytes is found or the entire zone is
  9820. compacted; it doesn't purge any purgeable blocks. CompactMem returns
  9821. the size in bytes of the largest contiguous free block remaining. Note
  9822. that it doesn't actually allocate the block.
  9823.  
  9824. (notee)
  9825.     To force a compaction of the entire heap zone, pass
  9826.     maxSize for cbNeeded.
  9827.  
  9828.     Result codes
  9829.  
  9830.         noErr       No error
  9831. \ ResrvMem
  9832. 14
  9833. FUNCTION ResrvMem (cbNeeded: Size);
  9834.  
  9835.     ___________________________________________________________
  9836.  
  9837.     Trap macro  _ResrvMem
  9838.                 _ResrvMem ,SYS      (applies to system heap)
  9839.  
  9840.     On entry    D0:  cbNeeded (long integer)
  9841.  
  9842.     On exit     D0:  result code  (integer)
  9843.     ___________________________________________________________
  9844.  
  9845.     ResrvMem creates free space for a block of cbNeeded contiguous bytes
  9846. at the lowest possible position in the current heap zone. It will try
  9847. every available means to place the block as close as possible to the
  9848. beginnig of the zone, including moving other blocks upward, expanding
  9849. the zone, or purging blocks from it. Notice that ResrvMem doesn't
  9850. actually allocate the block.
  9851.  
  9852. (note)
  9853.     When you allocate a relocatable block that you know will
  9854.     be locked for long periods of time, call ResrvMem first.
  9855.     This reserves space for the block near the beginning of
  9856.     the heap zone, where it will interfere with compaction as
  9857.     little as possible. It isn't necessary to call ResrvMem
  9858.     for a nonrelocatable block; NewPtr calls it
  9859.     automatically.
  9860.  
  9861.     Result codes
  9862.  
  9863.             noErr       No error
  9864.             memFullErr  Not enough room in zone
  9865. \ PurgeMem
  9866. 14
  9867. PROCEDURE PurgeMem (cbNeeded: Size);
  9868.  
  9869.     ___________________________________________________________
  9870.  
  9871.     Trap macro  _PurgeMem
  9872.                 _PurgeMEM ,SYS  (applies to system heap)
  9873.  
  9874.     On entry    D0:  cbNeeded (long integer)
  9875.  
  9876.     On exit     D0:  result code (integer)
  9877.     ___________________________________________________________
  9878.  
  9879.     PurgeMem sequentially purges blocks from the current heap zone until
  9880. a contiguous block of at least cbNeeded free bytes is created or the
  9881. entire zone is purged; it doesn't compact the heap zone. Only
  9882. relocatable, unlocked, purgeable blocks can be purged. Notice that
  9883. PurgeMem doesn't actually allocate the block.
  9884.  
  9885. (note)
  9886.     To force a purge of the entire heap zone, pass maxSize
  9887.     for cbNeeded.
  9888.  
  9889.     Result codes
  9890.  
  9891.             noErr       No error
  9892.             memFullErr  Not enough room in zone
  9893. \ EmptyHandle
  9894. 14
  9895. PROCEDURE EmptyHandle (h: Handle);
  9896.  
  9897.     ___________________________________________________________
  9898.  
  9899.     TRap macro  _EmptyHandle
  9900.  
  9901.     On entry    A0:  h (handle)
  9902.  
  9903.     On exit     A0:  h (handle)
  9904.                 D0:  result code (integer)
  9905.     ___________________________________________________________
  9906.  
  9907.     EmptyHandle purges the relocatable block whose handle is h from its
  9908. heap zone and sets its master pointer to NIL (making it an empty
  9909. handle). If h is already empty, EmptyHandle does nothing.
  9910.  
  9911. (note)
  9912.     Since the space occupied by the block's master pointer
  9913.     itself remains allocated, all handles pointing to it
  9914.     remain valid but empty. When you later reallocate space
  9915.     for the block with ReallocHandle, the master pointer will
  9916.     be updated, causing all existing handles to point
  9917.     correctly to the new block.
  9918.  
  9919.     The block whose handle is h must be unlocked, but need not be
  9920. purgeable.
  9921.  
  9922.     Result codes
  9923.  
  9924.             noErr       No error
  9925.             memWZErr    Attempt to operate on a free block
  9926.             memPurErr   Block is locked
  9927. \ HLock
  9928. 14
  9929. PROCEDURE HLock (h: Handle);
  9930.  
  9931.     ___________________________________________________________
  9932.  
  9933.     Trap macro  _HLock
  9934.  
  9935.     On entry    A0:  h (handle)
  9936.  
  9937.     On exit     D0:  result code (integer)
  9938.     ___________________________________________________________
  9939.  
  9940.     HLock locks a relocatable block, preventing it from being moved
  9941. within its heap zone. If the block is already locked, HLock does
  9942. nothing.
  9943.  
  9944.     ___________________________________________________________
  9945.  
  9946.     Assembly-language note:  Changing the value of the block's
  9947.     master pointer's lock bit with a BSET instruction is faster than
  9948.     HLock. However, HLock may eventually perform additional tasks.
  9949.     ___________________________________________________________
  9950.  
  9951.     Result codes
  9952.  
  9953.             noErr       No error
  9954.             nilHandleErr    NIL master pointer
  9955.             memWZErr    Attempt to opetate on a free block
  9956. \ HUnlock
  9957. 14
  9958. PROCEDURE HUnlock (h: Handle);
  9959.  
  9960.     ___________________________________________________________
  9961.  
  9962.     Trap macro  _HUnlock
  9963.  
  9964.     On entry    A0:  h (handle)
  9965.  
  9966.     On exit     D0:  result code (integer)
  9967.     ___________________________________________________________
  9968.  
  9969.     HUnlock unlocks a relocatable block, allowing it to be moved within
  9970. its heap zone. If the block is already unlocked, HUnlock does nothing.
  9971.  
  9972.     ___________________________________________________________
  9973.  
  9974.     Assembly-language note:  Changing the value of the block's
  9975.     master pointer's lock bit with a BCLR instruction is faster than
  9976.     HUnlock. However, HUnlock may eventually perform additional
  9977.     tasks.
  9978.     ___________________________________________________________
  9979.  
  9980.     Result codes
  9981.  
  9982.             noErr           No error
  9983.             nilHandleErr    NIL master pointer
  9984.             memWZErr        Attempt to operate on a fre block
  9985. \ HPurge
  9986. 14
  9987. PROCEDURE HPurge (h: Handle);
  9988.  
  9989.     ___________________________________________________________
  9990.  
  9991.     Trap macro  _HPurge
  9992.  
  9993.     On entry    A0:  h (handle)
  9994.  
  9995.     On exit     D0:  result code (integer)
  9996.     ___________________________________________________________
  9997.  
  9998.     HPurge marks a relocatable block as purgeable. If the block is
  9999. already purgeable, HPurge does nothing.
  10000.  
  10001.     Result codes
  10002.  
  10003.             noErr       No error
  10004.             nilHandleErr    NIL master pointer
  10005.             memWZErr    Attempt to operate on a free block
  10006. \ HNoPurge
  10007. 14
  10008. PROCEDURE HNoPurge (h: Handle);
  10009.  
  10010.     ___________________________________________________________
  10011.     Trap macro  _HNoPurge
  10012.  
  10013.     On entry    A0:  h (handle)
  10014.  
  10015.     On exit     D0:  result code (integer)
  10016.     ___________________________________________________________
  10017.  
  10018.     HNoPurge marks a relocatable block as unpurgeable. If the block is
  10019. already unprugeable, HNoPurge does nothing.
  10020.  
  10021.     Result codes
  10022.  
  10023.             noErr           No error
  10024.             nilHandleErr    NIL master pointerr
  10025.             memWZErr        Attempt to operate on a free block
  10026. \ SetGrowZone
  10027. 14
  10028. PROCEDURE SetGrowZone (growZone: ProcPtr);
  10029.  
  10030.     ___________________________________________________________
  10031.  
  10032.     Trap macro  _SetGrowZone
  10033.  
  10034.     On entry    A0:  growZone (pointer)
  10035.  
  10036.     On exit     D0:  result code (integer)
  10037.     ___________________________________________________________
  10038.  
  10039.     SetGrowZone sets the current heap fzone's grow zone function as
  10040. designated by the growZone parameter. A NIL parameter value removes
  10041. any grow zone function the zone may previously have had.
  10042.  
  10043. (note)
  10044.     If yokur program presses the limits of the available heap
  10045.     space, it's a good idea to have a grow zone function of
  10046.     some sort. At the very least, the grow zone function
  10047.     should detect when the Memory Manager is about to run out
  10048.     of space at a critical time (see GZCritical, below) and
  10049.     take some graceful action--such as displaying an alert
  10050.     box with the message "Out of memory"--instead of just
  10051.     failing unpredictably.
  10052.  
  10053.     The Memory Manager calls the grow zone function as a last resort
  10054. when trying to allocate space, if it has failed to create a block of the
  10055. needed size after compacting the zone, increasing its size (in the case
  10056. of the origianal application zone), or purging blocks from it. Memory
  10057. Manager routines that may cause the grow zone function to be called are
  10058. NewHandle, NewPtr, SetHandleSize, SetPtrSize, ReallocHandle, and
  10059. ResrvMem.
  10060.  
  10061. The grow zone function should be of the form
  10062.  
  10063.     FUNCTION MyGrowZone (cbNeeded: Size) : Size;
  10064.  
  10065.     The cbNeeded parameter gives the physical size of the needed block
  10066. in bytes, including the block header. The grow zone function should
  10067. attempt to create a free block of at least this size. It should return
  10068. a nonzero number if it's abale to allocate some memory, or 0 if it's not
  10069. able to allocate any.
  10070.  
  10071.     If the grow zone function returns 0, the Memory Manager will give up
  10072. trying to allocate the needed block and will signal failure with the
  10073. result code memFullErr. Otherwise it will compact the heap zone and
  10074. try again to allocate the block. If still unsuccessful, it will
  10075. continue to call the grow zone function repeatedly, compacting the zone
  10076. again after each call, until it either succeeds in allocating the
  10077. needed block or receives a zero result and gives up.
  10078.  
  10079.     The usual way for the grow zone function to free more space is to
  10080. call EmptyHandle to purge blocks that were previously marked
  10081. unpurgeable. Another possibility is to unlock blocks that were
  10082. previously locked.
  10083.  
  10084. (note)
  10085.     Although just unlocking blocks doesn't actually free any
  10086.     additional space in the zone, the grow zone function
  10087.     should still return a nonzero result in this case. This
  10088.     signals the Memory Manager to compact the heap and try
  10089.     again to allocate the needed block.
  10090.  
  10091. (warning)
  10092.     Depending on the circumstances in which the grow zone
  10093.     function is called, there may be particular blocks within
  10094.     the heap zone that must not be purged or released. For
  10095.     instance, if your program is attempting to increase the
  10096.     size of a relocatable block with SetHandleSize, it would
  10097.     be disastrous to release the block being expanded. To
  10098.     deal with such cases safely, it's essential to understand
  10099.     the use of the functions GZCritical and GZSaveHnd (see
  10100.     below).
  10101.  
  10102. (warning)
  10103.     Whenever you call the Resource Manager with
  10104.     SetResPurge(TRUE), it installs its own grow zone function
  10105.     into the application heap zone. The Resource Manager's
  10106.     grow zone function automatically writes to the disk all
  10107.     changed resources before they're purged. If you install
  10108.     your own grow zone function into the application heap
  10109.     zone, you shouldn't call SetResPurge(TRUE).
  10110.  
  10111.     Result codes
  10112.  
  10113.             noErr   No error
  10114. \ GZCritical
  10115. 14
  10116. FUNCTION GZCritical : BOOLEAN;    [No trap macro]
  10117.  
  10118.     GZCritical retruns TRUE if the Memory Manager critically needs
  10119. space-- for example, to create a new relocatable or nonrelocatable block
  10120. or to reallocate a handle. It returns FALSE in less critical cases,
  10121. such as ResrvMem trying to reserve space as low as possible in the heap
  10122. zone or SetHandleSize trying to increase the size of a relocatable
  10123. block. GZCritical doesn't affect the value returned by MemError.
  10124.  
  10125. (warning)
  10126.     If you're writing a grow zone function in Pascal, you
  10127.     should always call GZCritical and proceed only if the
  10128.     result is TRUE. All the information you need to handle
  10129.     the critical cases safely is the value of GZSaveHnd (see
  10130.     below). The noncritical cases require additional
  10131.     information that isn't available from Pascal, so your
  10132.     grow zone function should just return 0 and not attempt
  10133.     to free any space.
  10134. \ GZSaveHnd
  10135. 14
  10136. FUNCTION GZSaveHnd : Handle;   [No trap macro]
  10137.  
  10138.     GZSave Hnd retruns a handle to a relocatable block that mustn't be
  10139. purged or released by the grow zone function, or NIL if there is no
  10140. such block. For example, during a SetHandleSize call, the handle being
  10141. changed mustn't be purged. The grow zone function will be safe if it
  10142. avoids purging or releasing this block, provided that the grow zone
  10143. call was critical. To handle noncritical cases safely, further
  10144. information is needed that isn't available from Pascal. GZSaveHnd
  10145. doesn't affect the value returned by MemError.
  10146. \ BlockMove
  10147. 14
  10148. PROCEDURE BlockMove (sourcePtr,destPtr: Ptr; byteCount: Size);
  10149.  
  10150.  
  10151.     ___________________________________________________________
  10152.  
  10153.     Trap macro  _BlockMove
  10154.  
  10155.     On entry    A0:  sourcePtr (pointer)
  10156.                 A1:  destPtr (pointer)
  10157.                 D0:  byteCount (long integer)
  10158.  
  10159.     On exit     D0:  result code (integer)
  10160.     ___________________________________________________________
  10161.  
  10162.     BlockMove moves a block of byteCount consecutive bytes from the
  10163. address designated by sourcePtr to that designated by destPtr. No
  10164. pointers are updated.
  10165.  
  10166.     Result codes
  10167.  
  10168.             noErr   No error
  10169. \ TopMem
  10170. 14
  10171. FUNCTION TopMem : Ptr;   [No trap macro]
  10172.  
  10173.     TopMem returns a pointer to the address following the last byte of
  10174. RAM.
  10175.  
  10176.             _________________________________________________
  10177.  
  10178.     Assembly-language note:  To get a pointer to the end of RAM from
  10179.     assembly language, use the global variable MemTop.
  10180.             _________________________________________________
  10181.  
  10182.     Result codes
  10183.  
  10184.             noErr   No error
  10185. \ MemError
  10186. 14
  10187. FUNCTION MemError : OSErr;   [No trap macro]
  10188.  
  10189.     MemError returns the result code produced by the last Memory Manager
  10190. routine called. (OSErr is an Operating System Utility data type
  10191. declared as INTEGER.)
  10192. \MaxBlock
  10193. 14
  10194. FUNCTION MaxBlock : LONGINT;
  10195.     ______________________________________________________________
  10196.  
  10197.     Trap macro  _MaxBlock
  10198.                 _MaxBlock ,SYS  (applies to system heap)
  10199.  
  10200.     On exit     D0:  function result (word)
  10201.     ______________________________________________________________
  10202.     MaxBlock returns the maximum contiguous space in bytes that could be
  10203. obtained by compacting the current zone (without actually doing
  10204. the compaction).
  10205. \PurgeSpace
  10206. 14
  10207. PROCEDURE PurgeSpace (VAR total,contig: LONGINT);
  10208.     ______________________________________________________________
  10209.  
  10210.     Trap macro  _PurgeSpace
  10211.                 _PurgeSpace ,SYS    (applies to system heap)
  10212.  
  10213.     On exit     A0:  contig (long word)
  10214.                 D0:  total (long word)
  10215.     ______________________________________________________________
  10216.     PurgeSpace returns in total the total amount of space in bytes that
  10217. could be obtained by a general purge (without actually doing
  10218. the purge); this amount includes space that is already free.
  10219. The maximum contiguous space in bytes (including already free space)
  10220. that could be obtained by a purge is returned in contig.
  10221. \StackSpace
  10222. 14
  10223. FUNCTION StackSpace : LONGINT;
  10224.     ______________________________________________________________
  10225.  
  10226.     Trap macro  _StackSpace
  10227.  
  10228.     On exit     D0:  function result (word)
  10229.     ______________________________________________________________
  10230.     StackSpace returns the current amount of stack space between the
  10231. current stack pointer and the application heap (at the instant
  10232. of return from the trap).
  10233. \NewEmptyHandle
  10234. 14
  10235. FUNCTION NewEmptyHandle : Handle;
  10236.     ______________________________________________________________
  10237.  
  10238.     Trap macro  _NewEmptyHandle
  10239.                 _NewEmptyHandle ,SYS    (applies to system heap)
  10240.  
  10241.     On exit     A0:  function result (handle)
  10242.                 D0:  result code (word)
  10243.     ______________________________________________________________
  10244.  
  10245.     NewEmptyHandle is similar in function to NewHandle except that it
  10246. does not allocate any space; the handle returned is empty (in
  10247. other words, it points to a NIL master pointer). NewEmptyHandle
  10248. is used extensively by the Resource Manager; you may not need to use it.
  10249. \HSetRBit
  10250. 14
  10251. PROCEDURE HSetRBit (h: Handle);
  10252.     ______________________________________________________________
  10253.  
  10254.     Trap macro  _HSetRBit
  10255.  
  10256.     On entry    A0:  h (handle)
  10257.  
  10258.     On exit     D0:  result code (word)
  10259.     ______________________________________________________________
  10260.  
  10261.     HSetRBit sets the resource flag of a relocatable block╒s master
  10262. pointer.
  10263. \HClrRBit
  10264. 14
  10265. PROCEDURE HClrRBit (h: Handle);
  10266.     ______________________________________________________________
  10267.  
  10268.     Trap macro  _HClrRBit
  10269.  
  10270.     On entry    A0:  h (handle)
  10271.  
  10272.     On exit     D0:  result code (word)
  10273.     ______________________________________________________________
  10274.     HClrRBit clears the resource flag of a relocatable block╒s master
  10275. pointer.
  10276. \HGetState
  10277. 14
  10278. FUNCTION HGetState (h: Handle) : SignedByte;
  10279.     ______________________________________________________________
  10280.  
  10281.     Trap macro  _HGetState
  10282.  
  10283.     On entry    A0:  h (handle)
  10284.  
  10285.     On exit     D0:  flags (byte)
  10286.     ______________________________________________________________
  10287.     HGetState returns the byte that contains the flags of the master
  10288. pointer for the given handle; it╒s used in conjunction with HSetState
  10289. to save and restore the state of the flags contained in this byte.
  10290. You can save this byte, change the state of any of the flags (using
  10291. the routines described above), and then restore their original state
  10292. by passing the byte back to the HSetState procedure (described below).
  10293. \HSetState
  10294. 14
  10295. PROCEDURE HSetState (h: Handle; flags: SignedByte);
  10296.     ______________________________________________________________
  10297.  
  10298.     Trap macro  _HSetState
  10299.  
  10300.     On entry    A0:  h (handle)
  10301.                 D0:  flags (byte)
  10302.  
  10303.     On exit     D0:  result code (word)
  10304.     ______________________________________________________________
  10305.  
  10306.     HSetState is used in conjunction with HGetState; it sets the byte
  10307. that contains the flags of the master pointer for the given handle
  10308. to the byte specified by flags.
  10309. \ UnloadSeg
  10310. 15
  10311. PROCEDURE UnloadSeg (routineAddr: Ptr);
  10312.  
  10313.     UnloadSeg unloads a segment, making it relocatable and purgeable;
  10314. routineAddr is the address of any externally referenced routine in the
  10315. segment. The segment won't actually be purged until the memory it
  10316. occupies is needed. If the segment is purged, the Segment Loader will
  10317. reload it the next time one of the routines in it is called.
  10318. \ CountAppFiles
  10319. 15
  10320. PROCEDURE COuntAppFiles (VAR message:  INTEGER; VAR count: INTEGER);
  10321.  
  10322.     CountAppFiles deciphers the Finder information passed to your
  10323. application, and returns information about the documents that were
  10324. selected when your application was started up. It returns the number
  10325. of selected documents in the count parameter, and a number in the
  10326. message parameter that indicates whether the documents are to be opened
  10327. or printed:
  10328.  
  10329.     CONST appOpen  = 0;   {open the document(s)}
  10330.           appPrint = 1;   {print the document(s)}
  10331. \ GetAppFiles
  10332. 15
  10333. PROCEDURE GetAppFiles (index: INTEGER; VAR theFile: AppFile);
  10334.  
  10335.     GetAppFiles returns information about a document that was selected
  10336. when your application was started up (as listed in the Finder
  10337. information). The index parameter indicates the file for which
  10338. information should be returned; it must be between 1 and the number
  10339. returned by CountAppFiles, inclusive. The information is returned in
  10340. the following data structure:
  10341.  
  10342.     TYPE AppFile = RECORD
  10343.             vRefNum: INTEGER;  {volume reference number}
  10344.             fType:   OSType;   {file type}
  10345.             versNum: INTEGER;  {version number}
  10346.             fName:   Str255;   {file name}
  10347.           END;
  10348.  
  10349.     Volume reference number, file type, version number, and file name
  10350. are discussed in the File Manager manual.
  10351. \ ClrAppFiles
  10352. 15
  10353. PROCEDURE ClrAppFiles (index: INTEGER);
  10354.  
  10355.     ClrAppFiles changes the Finder information passed to your aplication
  10356. about the specified file such that the Finder knows you've processed
  10357. the file. The index parameter must be between 1 and the number
  10358. returned by CountAppFiles, inclusive. You should call ClrAppFiles for
  10359. every document your application opens or prints, so that the
  10360. information returned by CountAppFiles and GetAppFiles is always
  10361. correct. (ClrAppFiles sets the file type in the Finder information to
  10362. 0.)
  10363. \ GetAppParms
  10364. 15
  10365. PROCEDURE GetAppParms (VAR apName: STRING[31]; VAR apRefNum: INTEGER;
  10366.         VAR apParam: Handle);
  10367.  
  10368.     GetAppParms returns information about the current application. It
  10369. returns the application name in apName and the reference number for the
  10370. application's resource file in apRefNum. A handle to the Finder
  10371. information is returned in apParam, but the Finder information is more
  10372. easily accessed with the GetAppFiles call.
  10373. \ ExitToShell
  10374. 15
  10375. PROCEDURE ExitToShell;
  10376.  
  10377.     ExitToShell provides an exit from an application by starting up the
  10378. Finder (after releasing the entire application heap).
  10379. \ GetOSEvent
  10380. 16
  10381. FUNCTION GetOSEvent (eventMask: INTEGER; VAR theEvent: EventRecord) :
  10382.                         BOOLEAN;
  10383.  
  10384.     ____________________________________________________________
  10385.  
  10386.     Trap macro  _GetOSEvent
  10387.  
  10388.     On entry    A0:  pointer to event record theEvent
  10389.                 D0:  eventMask (word)
  10390.  
  10391.     On exit     D0:  0 if non-null event returned, or
  10392.                  -1 if null event returned (byte)
  10393.     ____________________________________________________________
  10394.  
  10395.     GEtOSEvent returns the next available event of a specified type or
  10396. types and removes it from the event queue. The event is returned as
  10397. the value of the parameter theEvent. The eventMask parameter specifies
  10398. which event types are of interest. GetOSEvent will return the next
  10399. available event of any type designated by the mask. If no event of any
  10400. of the designated types is available, GetOSEvent returns a null event
  10401. and a function result of FALSE; otherwise it returns TRUE.
  10402. \ OSEventAvail
  10403. 16
  10404. FUNCTION OSEventAvail (eventMask: INTEGER; VAR theEvent: EventRecord) :
  10405.                         BOOLEAN;
  10406.  
  10407.     __________________________________________________________________
  10408.  
  10409.     Trap macro  _OSEventAvail
  10410.  
  10411.     On entry    A0:  pointer to event record theEvent
  10412.                 D0:  eventMask (word)
  10413.  
  10414.     On exit     D0:  0 if not-null event returned, or
  10415.                     -1 if null event returned (byte)
  10416.     __________________________________________________________________
  10417.  
  10418.     OSEventAvail works exactly the same as GetOSEvent (above) except
  10419. that it doesn't remove the event from the event queue.
  10420.  
  10421. (note)
  10422.     An event returned by OSEventAvail will not be accessible
  10423.     later if in the meantime the queue becomes full and the
  10424.     event is discarded from it; since the events discarded
  10425.     are always the oldest ones in the queue, however, this
  10426.     will happen only in an unusually busy environment.
  10427. \ SetEventMask
  10428. 16
  10429. PROCEDURE SetEventMask (theMask: INTEGER);  [No trap macro]
  10430.  
  10431.     SetEventMask sets the system event mask to the specified event mask.
  10432. The Operating System Event Manager will post only those event types
  10433. that correspond to bits set in the mask. (As usual, it will not post
  10434. activate and update events, which are generated by the Window Manager
  10435. and not stored in the event queue.)  The system event mask is initially
  10436. set to post all except key-up events.
  10437.  
  10438. (warning)
  10439.     Because desk accessories may rely on receiving certain
  10440.     types of events, your application shouldn't set the
  10441.     system event mask to prevent any additional types
  10442.     (besides key-up) from being posted. You should use
  10443.     SetEventMask only to enable key-up events in the unusual
  10444.     case that your application needs to respond to them.
  10445. \ GetEvQHdr
  10446. 16
  10447. FUNCTION GetEvQHdr : QHdrPtr;  [No trap macro]
  10448.  
  10449.     GetEvQHdr retruns a pointer to the event queue.
  10450. \ PostEvent
  10451. 16
  10452. FUNCTION PostEvent (eventCode: INTEGER; eventMsg: LONGINT) : OSERR;
  10453.  
  10454.     __________________________________________________________________
  10455.     
  10456.         Trap macro  _PostEvent
  10457.     
  10458.         On entry    A0:  eventCode (word)
  10459.                     D0:  eventMsg (long word)
  10460.             
  10461.         On exit     D0:  result code (word)
  10462.     __________________________________________________________________
  10463.  
  10464. PostEvent places in the event queue an event of the type designated by
  10465. eventCode, with the event message specified by eventMsg and with the
  10466. current time, mouse location, and state of the modifier keys and mouse
  10467. button.
  10468.  
  10469.     CONST   noErr       = 0;    { no error (event posted) }
  10470.             evtNotEnb   = 1;    { event type not designated in system }
  10471.                                 { event mask }
  10472. \ FlushEvents
  10473. 16
  10474. PROCEDURE FlushEvents (eventMask, stopMask: INTEGER);
  10475.  
  10476.     __________________________________________________________________
  10477.     
  10478.         Trap macro  _FlushEvents
  10479.     
  10480.         On entry    D0: low-order word:     eventMask
  10481.                         high-order word:    stopMask
  10482.             
  10483.         On exit     D0: 0 or event code (word)
  10484.     __________________________________________________________________
  10485.  
  10486. FlushEvents removes events from the event queue as specified by the
  10487. given event masks.  It removes all events of the type or types
  10488. specified by eventMask, up to but not including the first event of any
  10489. type specified by stopMask; if the event queue doesn't contain any
  10490. events of the types specified by eventMask, it does nothing.  To remove
  10491. all events specified by eventMask, use a stopMask value of 0.
  10492.  
  10493. At the beginning of your application, it's usually a good idea to call
  10494. FlushEvents(everyEvent,0) to empty the event queue of any stray events
  10495. that may have been left lying around, such as unprocessed keystrokes
  10496. typed to the Finder.
  10497. \ PPostEvent
  10498. 16
  10499. FUNCTION PPostEvent (eventCode: INTEGER; eventMsg: LONGINT;
  10500.                         VAR qEl: EvQEl) : OSErr);
  10501.     ____________________________________________________________
  10502.  
  10503.         Trap macro  _PPostEvent
  10504.  
  10505.         On entry    A0:  eventCode (word)
  10506.                     D0:  eventMsg (long word)
  10507.  
  10508.         On exit     A0:  pointer to event queue entry
  10509.     ____________________________________________________________
  10510.     PPostEvent is identical to PostEvent except that it returns a
  10511. pointer to the created queue entry.
  10512. \ GetVInfo
  10513. 17
  10514. FUNCTION GetVInfo (drvNum: INTEGER; volName: StringPtr;
  10515.                   VAR vRefNum: INTEGER; VAR freeBytes: LONGINT)
  10516.                   : OSErr;  [Not in ROM]
  10517.  
  10518.     GetVInfo returns the name, reference number, and available space
  10519. (in bytes), in volName, vRefNum, and freeBytes, for the volume in
  10520. the drive specified by drvNum.
  10521.  
  10522. Result codes    noErr     No error
  10523.                 nsvErr    No default volume
  10524.                 paramErr  Bad drive number
  10525. \ GetVRefNum
  10526. 17
  10527. FUNCTION GetVRefNum (pathRefNum: INTEGER; VAR vRefNum: INTEGER)
  10528.                     : OSErr;  [Not in ROM]
  10529.  
  10530.     Given a path reference number in pathRefNum, GetVRefNum returns
  10531. the volume reference number in vRefNum.
  10532.  
  10533. Result codes    noErr       No error
  10534.                 rfNumErr    Bad reference number
  10535. \ GetVol
  10536. 17
  10537. FUNCTION GetVol (volName: StringPtr; VAR vRefNum: INTEGER)
  10538.                 : OSErr;  [Not in ROM]
  10539.  
  10540.     GetVol returns the name of the default volume in volName and its
  10541. volume reference number in vRefNum.
  10542.  
  10543. Result codes    noErr   No error
  10544.                 nsvErr  No such volume
  10545. \ SetVol
  10546. 17
  10547. FUNCTION SetVol (volName: StringPtr; vRefNum: INTEGER)
  10548.                 : OSErr;  [Not in ROM]
  10549.  
  10550.     SetVol sets the default volume to the mounted volume specified
  10551. by volName or vRefNum.
  10552.  
  10553. Result codes    noErr       No error
  10554.                 bdNamErr    Bad volume name
  10555.                 nsvErr      No such volume
  10556.                 paramErr    No default volume
  10557. \ FlushVol
  10558. 17
  10559. FUNCTION FlushVol (volName: StringPtr; vRefNum: INTEGER)
  10560.                     : OSErr;  [Not in ROM]
  10561.  
  10562.     On the volume specified by volName or vRefNum, FlushVol writes
  10563. the contents of the associated volume buffer and descriptive
  10564. information about the volume (if they╒ve changed since the last
  10565. time FlushVol was called).
  10566.  
  10567. Result codes    noErr       No error
  10568.                 bdNamErr    Bad volume name
  10569.                 extFSErr    External file system
  10570.                 ioErr       I/O error
  10571.                 nsDrvErr    No such drive
  10572.                 nsvErr      No such volume
  10573.                 paramErr    No default volume
  10574. \ UnmountVol
  10575. 17
  10576. FUNCTION UnmountVol (volName: StringPtr; vRefNum: INTEGER)
  10577.                     : OSErr;  [Not in ROM]
  10578.  
  10579.     UnmountVol unmounts the volume specified by volName or vRefNum,
  10580. by calling FlushVol to flush the volume buffer, closing all
  10581. open files on the volume, and releasing the memory used for the volume.
  10582.  
  10583. Warning:  Don╒t unmount the startup volume.
  10584.  
  10585. Result codes    noErr       No error
  10586.                 bdNamErr    Bad volume name
  10587.                 extFSErr    External file system
  10588.                 ioErr       I/O error
  10589.                 nsDrvErr    No such drive
  10590.                 nsvErr      No such volume
  10591.                 paramErr    No default volume
  10592. \ Eject
  10593. 17
  10594. FUNCTION Eject (volName: StringPtr; vRefNum: INTEGER)
  10595.                 : OSErr;  [Not in ROM]
  10596.  
  10597.     Eject flushes the volume specified by volName or vRefNum,
  10598. places it off-line, and then ejects the volume.
  10599.  
  10600. Result codes    noErr       No error
  10601.                 bdNamErr    Bad volume name
  10602.                 extFSErr    External file system
  10603.                 ioErr       I/O error
  10604.                 nsDrvErr    No such drive
  10605.                 nsvErr      No such volume
  10606.                 paramErr    No default volume
  10607. \ Create
  10608. 17
  10609. FUNCTION Create (fileName: Str255; vRefNum: INTEGER; creator: OSType;
  10610.                 fileType: OSType) : OSErr;  [Not in ROM]
  10611.  
  10612.     Create creates a new file (both forks) with the specified name,
  10613. file type, and creator on the specified volume. (File type and
  10614. creator are discussed in the Finder Interface chapter.)
  10615. The new file is unlocked and empty. The date and time of its
  10616. creation and last modification are set to the current date and time.
  10617.  
  10618. Result codes    noErr       No error
  10619.                 bdNamErr    Bad file name
  10620.                 dupFNErr    Duplicate file name and version
  10621.                 dirFulErr   File directory full
  10622.                 extFSErr    External file system
  10623.                 ioErr       I/O error
  10624.                 nsvErr      No such volume
  10625.                 vLckdErr    Software volume lock
  10626.                 wPrErr      Hardware volume lock
  10627. \ FSOpen
  10628. 17
  10629. FUNCTION FSOpen (fileName: Str255; vRefNum: INTEGER; VAR refNum: INTEGER)
  10630.                 : OSErr;  [Not in ROM]
  10631.  
  10632.     FSOpen creates an access path to the file having the name fileName
  10633. on the volume specified by vRefNum. A path reference number is returned
  10634. in refNum. The access path╒s read/write permission is set to whatever
  10635. the file╒s open permission allows.
  10636.  
  10637. Note:  There╒s no guarantee that any bytes have been written until
  10638.        FlushVol is called.
  10639.  
  10640. Result codes    noErr       No error
  10641.                 bdNamErr    Bad file name
  10642.                 extFSErr    External file system
  10643.                 fnfErr      File not found
  10644.                 ioErr       I/O error
  10645.                 nsvErr      No such volume
  10646.                 opWrErr     File already open for writing
  10647.                 tmfoErr     Too many files open
  10648. \ FSRead
  10649. 17
  10650. FUNCTION FSRead (refNum: INTEGER; VAR count: LONGINT; buffPtr: Ptr)
  10651.                 : OSErr;  [Not in ROM]
  10652.  
  10653.     FSRead attempts to read the number of bytes specified by the count
  10654. parameter from the open file whose access path is specified by
  10655. refNum, and transfer them to the data buffer pointed to by buffPtr.
  10656. The read operation begins at the current mark, so you might want to
  10657. precede this with a call to SetFPos. If you try to read past the
  10658. logical end-of-file, FSRead moves the mark to the end-of-file and
  10659. returns eofErr as its function result. After the read is completed,
  10660. the number of bytes actually read is returned in the count parameter.
  10661.  
  10662. Result codes    noErr       No error
  10663.                 eofErr      End-of-file
  10664.                 extFSErr    External file system
  10665.                 fnOpnErr    File not open
  10666.                 ioErr       I/O error
  10667.                 paramErr    Negative count
  10668.                 rfNumErr    Bad reference number
  10669. \ FSWrite
  10670. 17
  10671. FUNCTION FSWrite (refNum: INTEGER; VAR count: LONGINT; buffPtr: Ptr)
  10672.                     : OSErr;  [Not in ROM]
  10673.  
  10674.     FSWrite takes the number of bytes specified by the count parameter
  10675. from the buffer pointed to by buffPtr and attempts to write them to
  10676. the open file whose access path is specified by refNum. The write
  10677. operation begins at the current mark, so you might want to precede
  10678. this with a call to SetFPos. After the write is completed, the number
  10679. of bytes actually written is returned in the count parameter.
  10680.  
  10681. Result codes    noErr       No error
  10682.                 dskFulErr   Disk full
  10683.                 fLckdErr    File locked
  10684.                 fnOpnErr    File not open
  10685.                 ioErr       I/O error
  10686.                 paramErr    Negative count
  10687.                 rfNumErr    Bad reference number
  10688.                 vLckdErr    Software volume lock
  10689.                 wPrErr      Hardware volume lock
  10690.                 wrPermErr   Read/write permission doesn╒t allow writing
  10691. \ GetFPos
  10692. 17
  10693. FUNCTION GetFPos (refNum: INTEGER; VAR filePos: LONGINT)
  10694.                 : OSErr;  [Not in ROM]
  10695.  
  10696.     GetFPos returns, in filePos, the mark of the open file whose access
  10697. path is specified by refNum.
  10698.  
  10699. Result codes    noErr       No error
  10700.                 extFSErr    External file system
  10701.                 fnOpnErr    File not open
  10702.                 ioErr       I/O error
  10703.                 rfNumErr    Bad reference number
  10704. \ SetFPos
  10705. 17
  10706. FUNCTION SetFPos (refNum: INTEGER; posMode: INTEGER; posOff: LONGINT)
  10707.                     : OSErr;  [Not in ROM]
  10708.  
  10709.     SetFPos sets the mark of the open file whose access path is
  10710. specified by refNum to the position specified by posMode and posOff
  10711. (except when posMode is equal to fsAtMark, in which case posOff is
  10712. ignored). PosMode indicates how to position the mark; it must contain
  10713. one of the following values:
  10714.  
  10715. CONST fsAtMark    = 0;  {at current mark}
  10716.       fsFromStart = 1;  {set mark relative to beginning of file}
  10717.       fsFromLEOF  = 2;  {set mark relative to logical end-of-file}
  10718.       fsFromMark  = 3;  {set mark relative to current mark}
  10719.  
  10720.     If you specify fsAtMark, posOffset is ignored and the mark is left
  10721. wherever it╒s currently positioned. If you choose to set the mark
  10722. (relative to either the beginning of the file, the logical end-of-file,
  10723. or the current mark), posOffset specifies the byte offset from the
  10724. chosen point (either positive or negative) where the mark should be set.
  10725. If you try to set the mark past the logical end-of-file, SetFPos moves
  10726. the mark to the end-of-file and returns eofErr as its function result.
  10727.  
  10728. Result codes    noErr       No error
  10729.                 eofErr      End-of-file
  10730.                 extFSErr    External file system
  10731.                 fnOpnErr    File not open
  10732.                 ioErr       I/O error
  10733.                 posErr      Attempt to position before start of file
  10734.                 rfNumErr    Bad reference number
  10735.  
  10736. \ GEtEOF
  10737. 17
  10738. FUNCTION GetEOF (refNum: INTEGER; VAR logEOF: LONGINT)
  10739.                 : OSErr;  [Not in ROM]
  10740.  
  10741.     GetEOF returns, in logEOF, the logical end-of-file of the open
  10742. file whose access path is specified by refNum.
  10743.  
  10744. Result codes    noErr       No error
  10745.                 extFSErr    External file system
  10746.                 fnOpnErr    File not open
  10747.                 ioErr       I/O error
  10748.                 rfNumErr    Bad reference number
  10749. \ SetEOF
  10750. 17
  10751. FUNCTION SetEOF (refNum: INTEGER; logEOF: LONGINT)
  10752.                 : OSErr;  [Not in ROM]
  10753.  
  10754.     SetEOF sets the logical end-of-file of the open file whose access
  10755. path is specified by refNum to the position specified by logEOF.
  10756. If you attempt to set the logical end-of-file beyond the physical
  10757. end-of-file, the physical end-of-file is set to one byte beyond
  10758. the end of the next free allocation block; if there isn╒t enough
  10759. space on the volume, no change is made, and SetEOF returns dskFulErr
  10760. as its function result. If logEOF is 0, all space occupied by the file
  10761. on the volume is released.
  10762.  
  10763. Result codes    noErr       No error
  10764.                 dskFulErr   Disk full
  10765.                 extFSErr    External file system
  10766.                 fLckdErr    File locked
  10767.                 fnOpnErr    File not open
  10768.                 ioErr       I/O error
  10769.                 rfNumErr    Bad reference number
  10770.                 vLckdErr    Software volume lock
  10771.                 wPrErr      Hardware volume lock
  10772.                 wrPermErr   Read/write permission doesn╒t allow writing
  10773. \ Allocate
  10774. 17
  10775. FUNCTION Allocate (refNum: INTEGER; VAR count: LONGINT)
  10776.                     : OSErr;  [Not in ROM]
  10777.  
  10778.     Allocate adds the number of bytes specified by the count parameter
  10779. to the open file whose access path is specified by refNum, and sets the
  10780. physical end-of-file to one byte beyond the last block allocated.
  10781. The number of bytes actually allocated is rounded up to the nearest
  10782. multiple of the allocation block size, and returned in the count
  10783. parameter. If there isn╒t enough empty space on the volume to satisfy
  10784. the allocation request, Allocate allocates the rest of the space on the
  10785. volume and returns dskFulErr as its function result.
  10786.  
  10787. Result codes    noErr       No error
  10788.                 dskFulErr   Disk full
  10789.                 fLckdErr    File locked
  10790.                 fnOpnErr    File not open
  10791.                 ioErr       I/O error
  10792.                 rfNumErr    Bad reference number
  10793.                 vLckdErr    Software volume lock
  10794.                 wPrErr      Hardware volume lock
  10795.                 wrPermErr   Read/write permission doesn╒t allow writing
  10796. \ FSClose
  10797. 17
  10798. FUNCTION FSClose (refNum: INTEGER) : OSErr;  [Not in ROM]
  10799.  
  10800.     FSClose removes the access path specified by refNum, writes the
  10801. contents of the volume buffer to the volume, and updates the file╒s
  10802. entry in the file directory.
  10803.  
  10804. Note:  There╒s no guarantee that any bytes have been written until
  10805.        FlushVol is called.
  10806.  
  10807. Result codes    noErr       No error
  10808.                 extFSErr    External file system
  10809.                 fnfErr      File not found
  10810.                 fnOpnErr    File not open
  10811.                 ioErr       I/O error
  10812.                 nsvErr      No such volume
  10813.                 rfNumErr    Bad reference number
  10814. \ GetFInfo
  10815. 17
  10816. FUNCTION GetFInfo (fileName: Str255; vRefNum: INTEGER; VAR
  10817.                     fndrInfo: FInfo) : OSErr;  [Not in ROM]
  10818.  
  10819.     For the file having the name fileName on the specified volume,
  10820. GetFInfo returns information used by the Finder in fndrInfo
  10821. (see the section ╥File Information Used by the Finder╙).
  10822.  
  10823. Result codes    noErr       No error
  10824.                 bdNamErr    Bad file name
  10825.                 extFSErr    External file system
  10826.                 fnfErr      File not found
  10827.                 ioErr       I/O error
  10828.                 nsvErr      No such volume
  10829.                 paramErr    No default volume
  10830. \ SetFInfo
  10831. 17
  10832. FUNCTION SetFInfo (fileName: Str255; vRefNum: INTEGER;
  10833.                     fndrInfo: FInfo) : OSErr;  [Not in ROM]
  10834.  
  10835.     For the file having the name fileName on the specified volume,
  10836. SetFInfo sets information used by the Finder to fndrInfo (see
  10837. the section ╥File Information Used by the Finder╙).
  10838.  
  10839. Result codes    noErr       No error
  10840.                 extFSErr    External file system
  10841.                 fLckdErr    File locked
  10842.                 fnfErr      File not found
  10843.                 ioErr       I/O error
  10844.                 nsvErr      No such volume
  10845.                 vLckdErr    Software volume lock
  10846.                 wPrErr      Hardware volume lock
  10847. \ SetFLock
  10848. 17
  10849. FUNCTION SetFLock (fileName: Str255; vRefNum: INTEGER)
  10850.                 : OSErr;  [Not in ROM]
  10851.  
  10852.     SetFLock locks the file having the name fileName on the specified
  10853. volume. Access paths currently in use aren╒t affected.
  10854.  
  10855. Result codes    noErr       No error
  10856.                 extFSErr    External file system
  10857.                 fnfErr      File not found
  10858.                 ioErr       I/O error
  10859.                 nsvErr      No such volume
  10860.                 vLckdErr    Software volume lock
  10861.                 wPrErr      Hardware volume lock
  10862. \ RstFLock
  10863. 17
  10864. FUNCTION RstFLock (fileName: Str255; vRefNum: INTEGER)
  10865.                     : OSErr;  [Not in ROM]
  10866.  
  10867.     RstFLock unlocks the file having the name fileName on the specified
  10868. volume. Access paths currently in use aren╒t affected.
  10869.  
  10870. Result codes    noErr       No error
  10871.                 extFSErr    External file system
  10872.                 fnfErr      File not found
  10873.                 ioErr       I/O error
  10874.                 nsvErr      No such volume
  10875.                 vLckdErr    Software volume lock
  10876.                 wPrErr      Hardware volume lock
  10877. \ Rename
  10878. 17
  10879. FUNCTION Rename (oldName: Str255; vRefNum: INTEGER; newName: Str255)
  10880.                 : OSErr;  [Not in ROM]
  10881.  
  10882.     Given a file name in oldName, Rename changes the name of the file to
  10883. newName. Access paths currently in use aren╒t affected. Given a volume
  10884. name in oldName or a volume reference number in vRefNum, Rename changes
  10885. the name of the specified volume to newName.
  10886.  
  10887. Warning:  If you╒re renaming a volume, be sure that both names end with
  10888.           a colon.
  10889.  
  10890. Result codes    noErr       No error
  10891.                 bdNamErr    Bad file name
  10892.                 dirFulErr   Directory full
  10893.                 dupFNErr    Duplicate file name
  10894.                 extFSErr    External file system
  10895.                 fLckdErr    File locked
  10896.                 fnfErr      File not found
  10897.                 fsRnErr     Problem during rename
  10898.                 ioErr       I/O error
  10899.                 nsvErr      No such volume
  10900.                 paramErr    No default volume
  10901.                 vLckdErr    Software volume lock
  10902.                 wPrErr      Hardware volume lock
  10903. \ FSDelete
  10904. 17
  10905. FUNCTION FSDelete (fileName: Str255; vRefNum: INTEGER)
  10906.                     : OSErr;  [Not in ROM]
  10907.  
  10908.     FSDelete removes the closed file having the name fileName from the
  10909. specified volume.
  10910.  
  10911. Note:  This function will delete both forks of a file.
  10912.  
  10913. Result codes    noErr       No error
  10914.                 bdNamErr    Bad file name
  10915.                 extFSErr    External file system
  10916.                 fBsyErr     File busy
  10917.                 fLckdErr    File locked
  10918.                 fnfErr      File not found
  10919.                 ioErr       I/O error
  10920.                 nsvErr      No such volume
  10921.                 vLckdErr    Software volume lock
  10922.                 wPrErr      Hardware volume lock
  10923. \ OpenRF
  10924. 17
  10925. FUNCTION OpenRF (fileName: Str255; vRefNum: INTEGER;
  10926.                 VAR refNum: INTEGER) : OSErr;  [Not in ROM]
  10927.  
  10928.     OpenRF is similar to FSOpen; the only difference is that OpenRF
  10929. opens the resource fork of the specified file rather than the data fork.
  10930. A path reference number is returned in refNum. The access path╒s
  10931. read/write permission is set to whatever the file╒s open permission
  10932. allows.
  10933.  
  10934. Note:  Normally you should access a file╒s resource fork through the
  10935.        routines of the Resource Manager rather than the File Manager.
  10936.        OpenRF doesn╒t read the resource map into memory; it╒s really
  10937.        only useful for block-level operations such as copying files.
  10938.  
  10939. Result codes    noErr       No error
  10940.                 bdNamErr    Bad file name
  10941.                 extFSErr    External file system
  10942.                 fnfErr      File not found
  10943.                 ioErr       I/O error
  10944.                 nsvErr      No such volume
  10945.                 opWrErr     File already open for writing
  10946.                 tmfoErr     Too many files open
  10947. \ FInitQueue
  10948. 17
  10949. PROCEDURE InitQueue;
  10950.  
  10951. Trap macro  _InitQueue
  10952.  
  10953. FInitQueue clears all queued File Manager calls except the current one.
  10954. \ PBMountVol
  10955. 17
  10956. FUNCTION PBMountVol (paramBlock: ParmBlkPtr) : OSErr;
  10957.  
  10958. Trap macro  _MountVol
  10959.  
  10960. Parameter block
  10961.     <╤  16  ioResult    word
  10962.     <╨> 22  ioVRefNum   word
  10963.  
  10964.     PBMountVol mounts the volume in the drive specified by ioVRefNum,
  10965. and returns a volume reference number in ioVRefNum. If there are no
  10966. volumes already mounted, this volume becomes the default volume.
  10967. PBMountVol is always executed synchronously.
  10968.  
  10969. Note:  When mounting hierarchical volumes, PBMountVol opens two files
  10970.        needed for maintaining file directory and file mapping
  10971.        information. PBMountVol can fail if there are no access paths
  10972.        available for these two files; it will return tmfoErr as its
  10973.        function result.
  10974.  
  10975. Result codes    noErr       No error
  10976.                 badMDBErr   Bad master directory block
  10977.                 extFSErr    External file system
  10978.                 ioErr       I/O error
  10979.                 memFullErr  Not enough room in heap zone
  10980.                 noMacDskErr Not a Macintosh disk
  10981.                 nsDrvErr    No such drive
  10982.                 paramErr    Bad drive number
  10983.                 tmfoErr     Too many files open
  10984.                 volOnLinErr Volume already on-line
  10985. \ PBGetVInfo
  10986. 17
  10987. FUNCTION PBGetVInfo (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  10988.  
  10989. Trap macro  _GetVolInfo
  10990.  
  10991. Parameter block
  10992.     ╤>  12      ioCompletion    pointer
  10993.     <╤  16      ioResult        word
  10994.     <╨> 18      ioNamePtr       pointer
  10995.     <╨> 22      ioVRefNum       word
  10996.     ╤>  28      ioVolIndex      word
  10997.     <╤  30      ioVCrDate       long word
  10998.     <╤  34      ioVLsBkUp       long word
  10999.     <╤  38      ioVAtrb         word
  11000.     <╤  40      ioVNmFls        word
  11001.     <╤  42      ioVDirSt        word
  11002.     <╤  44      ioVBlLn         word
  11003.     <╤  46      ioVNmAlBlks     word
  11004.     <╤  48      ioVAlBlkSiz     long word
  11005.     <╤  52      ioVClpSiz       long word
  11006.     <╤  56      ioAlBlSt        word
  11007.     <╤  58      ioVNxtFNum      long word
  11008.     <╤  62      ioVFrBlk        word
  11009.  
  11010.     PBGetVInfo returns information about the specified volume. If
  11011. ioVolIndex is positive, the File Manager attempts to use it to find the
  11012. volume; for instance, if ioVolIndex is 2, the File Manager will attempt
  11013. to access the second mounted volume. If ioVolIndex is negative, the
  11014. File Manager uses ioNamePtr and ioVRefNum in the standard way (described
  11015. in the section ╥Specifying Volumes, Directories, and Files╙) to
  11016. determine which volume. If ioVolIndex is 0, the File Manager attempts
  11017. to access the volume by using ioVRefNum only. The volume reference
  11018. number is returned in ioVRefNum, and a pointer to the volume name is
  11019. returned in ioNamePtr (unless ioNamePtr is NIL).
  11020.  
  11021.     If a working directory reference number is passed in ioVRefNum (or
  11022. if the default directory is a subdirectory), the number of files and
  11023. directories in the specified directory (the directory╒s valence) will be
  11024. returned in ioVNmFls. Also, the volume reference number won╒t be
  11025. returned; ioVRefNum will still contain the working directory reference
  11026. number.
  11027.  
  11028. Warning:  IOVNmAlBlks and ioVFrBlks, which are actually unsigned
  11029.           integers, are clipped to 31744 ($7C00) regardless of the size
  11030.           of the volume.
  11031.  
  11032. Result codes    noErr       No error
  11033.                 nsvErr      No such volume
  11034.                 paramErr    No default volume
  11035. \ PBHGetVInfo
  11036. 17
  11037. FUNCTION PBHGetVInfo (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11038.  
  11039. Trap macro  _HGetVInfo
  11040.  
  11041. Parameter block
  11042.     ╤>  12  ioCompletion    pointer
  11043.     <╤  16  ioResult        word
  11044.     <╨> 18  ioNamePtr       pointer
  11045.     <╨> 22  ioVRefNum       word
  11046.     ╤>  28  ioVolIndex      word
  11047.     <╤  30  ioVCrDate       long word
  11048.     <╤  34  ioVLsMod        long word
  11049.     <╤  38  ioVAtrb         word
  11050.     <╤  40  ioVNmFls        word
  11051.     <╤  42  ioVBitMap       word
  11052.     <╤  44  ioVAllocPtr     word
  11053.     <╤  46  ioVNmAlBlks     word
  11054.     <╤  48  ioVAlBlkSiz     long word
  11055.     <╤  52  ioVClpSiz       long word
  11056.     <╤  56  ioAlBlSt        word
  11057.     <╤  58  ioVNxtFNum      long word
  11058.     <╤  62  ioVFrBlk        word
  11059.     <╤  64  ioVSigWord      word
  11060.     <╤  66  ioVDrvInfo      word
  11061.     <╤  68  ioVDRefNum      word
  11062.     <╤  70  ioVFSID         word
  11063.     <╤  72  ioVBkUp         long word
  11064.     <╤  76  ioVSeqNum       word
  11065.     <╤  78  ioVWrCnt        long word
  11066.     <╤  82  ioVFilCnt       long word
  11067.     <╤  86  ioVDirCnt       long word
  11068.     <╤  90  ioVFndrInfo     32 bytes
  11069.  
  11070.     PBHGetVInfo is similar in function to PBGetVInfo but returns a
  11071. larger parameter block. In addition, PBHGetVInfo always returns the
  11072. volume reference number in ioVRefNum (regardless of what was passed in).
  11073. Also, ioVNmAlBlks and ioVFrBlks are not clipped as they are by
  11074. PBGetVInfo.
  11075.  
  11076. Result codes    noErr       No error
  11077.                 nsvErr      No such volume
  11078.                 paramErr    No default volume
  11079. \ PBSetVInfo
  11080. 17
  11081. FUNCTION PBSetVInfo (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11082.  
  11083. Trap macro  _SetVolInfo
  11084.  
  11085. Parameter block
  11086.     ╤>  12  ioCompletion    pointer
  11087.     <╤  16  ioResult        word
  11088.     ╤>  18  ioNamePtr       pointer
  11089.     ╤>  22  ioVRefNum       word
  11090.     ╤>  30  ioVCrDate       long word
  11091.     ╤>  34  ioVLsMod        long word
  11092.     ╤>  38  ioVAtrb         word
  11093.     ╤>  52  ioVClpSiz       long word
  11094.     ╤>  72  ioVBkUp         long word
  11095.     ╤>  76  ioVSeqNum       word
  11096.     ╤>  90  ioVFndrInfo     32 bytes
  11097.  
  11098.     PBSetVInfo lets you modify information about volumes. A pointer to
  11099. a new name for the volume can be specified in ioNamePtr. The date and
  11100. time of the volume╒s creation and modification can be set with ioVCrDate
  11101. and ioVLsMod respectively. Only bit 15 of ioVAtrb can be changed;
  11102. setting it locks the volume.
  11103.  
  11104. Note: The volume cannot be specified by name; you must use either the
  11105.        volume reference number or the drive number.
  11106.  
  11107. Warning:  PBSetVInfo operates only with the hierarchical version of the
  11108.           File Manager; if used on a Macintosh equipped only with the
  11109.           64K ROM version of the File Manager, it will generate a system
  11110.           error.
  11111.  
  11112. Result codes    noErr       No error
  11113.                 nsvErr      No such volume
  11114.                 paramErr    No default volume
  11115. \ PBGetVol
  11116. 17
  11117. FUNCTION PBGetVol (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11118.  
  11119. Trap macro  _GetVol
  11120.  
  11121. Parameter block
  11122.     ╤>  12  ioCompletion    pointer
  11123.     <╤  16  ioResult        word
  11124.     <╤  18  ioNamePtr       pointer
  11125.     <╤  22  ioVRefNum       word
  11126.  
  11127.     PBGetVol returns a pointer to the name of the default volume in
  11128. ioNamePtr (unless ioNamePtr is NIL) and its volume reference number in
  11129. ioVRefNum. If a default directory was set with a previous PBSetVol
  11130. call, a pointer to its name will be returned in ioNamePtr and its
  11131. working directory reference number in ioVRefNum.
  11132.  
  11133. Result codes    noErr   No error
  11134.                 nsvErr  No default volume
  11135. \ PBHGetVol
  11136. 17
  11137. FUNCTION PBHGetVol (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  11138.  
  11139. Trap macro  _HGetVol
  11140.  
  11141. Parameter block
  11142.     ╤>  12  ioCompletion    pointer
  11143.     <╤  16  ioResult        word
  11144.     <╤  18  ioNamePtr       pointer
  11145.     <╤  22  ioVRefNum       word
  11146.     <╤  28  ioWDProcID      long word
  11147.     <╤  32  ioWDVRefNum     word
  11148.     <╤  48  ioWDDirID       long word
  11149.  
  11150.     PBHGetVol returns the default volume and directory last set by
  11151. either a PBSetVol or a PBHSetVol call. The reference number of the
  11152. default volume is returned in ioVRefNum.
  11153.  
  11154. Warning:  IOVRefNum will return a working directory reference number
  11155.           (instead of the volume reference number) if, in the last call
  11156.           to PBSetVol or PBHSetVol, a working directory reference number
  11157.           was passed in this field.
  11158.  
  11159.     The volume reference number of the volume on which the default
  11160. directory exists is returned in ioWDVRefNum. The directory ID of the
  11161. default directory is returned in ioWDDirID.
  11162.  
  11163. Result codes    noErr   No error
  11164.                 nsvErr  No default volume
  11165. \ PBSetVol
  11166. 17
  11167. FUNCTION PBSetVol (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11168.  
  11169. Trap macro  _SetVol
  11170.  
  11171. Parameter block
  11172.     ╤>  12  ioCompletion    pointer
  11173.     <╤  16  ioResult        word
  11174.     ╤>  18  ioNamePtr       pointer
  11175.     ╤>  22  ioVRefNum       word
  11176.  
  11177.     PBSetVol sets the default volume to the mounted volume specified by
  11178. ioNamePtr or ioVRefNum. On hierarchical volumes, PBSetVol also sets the
  11179. root directory as the default directory.
  11180.  
  11181. Result codes    noErr       No error
  11182.                 bdNamErr    Bad volume name
  11183.                 nsvErr      No such volume
  11184.                 paramErr    No default volume
  11185. \ PBHSetVol
  11186. 17
  11187. FUNCTION PBHSetVol (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  11188.  
  11189. Trap macro  _HSetVol
  11190.  
  11191. Parameter block
  11192.     ╤>  12  ioCompletion    pointer
  11193.     <╤  16  ioResult        word
  11194.     ╤>  18  ioNamePtr       pointer
  11195.     ╤>  22  ioVRefNum       word
  11196.     ╤>  48  ioWDDirID       long word
  11197.  
  11198.     PBHSetVol sets both the default volume and the default directory.
  11199. The default directory to be used can be specified by either a volume
  11200. reference number or a working directory reference number in ioVRefNum, a
  11201. directory ID in ioWDDirID, or a pointer to a pathname (possibly NIL) in
  11202. ioNamePtr.
  11203.  
  11204. Note:  Both the default volume and  the default directory are used in
  11205.        calls made with no volume name and a volume reference number of
  11206.        zero.
  11207.  
  11208. Result codes    noErr   No error
  11209.                 nsvErr  No default volume
  11210. \ PBFlushVol
  11211. 17
  11212. FUNCTION PBFlushVol (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11213.  
  11214. Trap macro  _FlushVol
  11215.  
  11216. Parameter block
  11217.     ╤>  12  ioCompletion    pointer
  11218.     <╤  16  ioResult        word
  11219.     ╤>  18  ioNamePtr       pointer
  11220.     ╤>  22  ioVRefNum       word
  11221.  
  11222.     On the volume specified by ioNamePtr or ioVRefNum, PBFlushVol writes
  11223. descriptive information about the volume, the contents of the associated
  11224. volume buffer, and all access path buffers for the volume (if they╒ve
  11225. changed since the last time PBFlushVol was called).
  11226.  
  11227. Note:  The date and time of the last modification to the volume are set
  11228.        when the modification is made, not when the volume is flushed.
  11229.  
  11230. Result codes    noErr       No error
  11231.                 bdNamErr    Bad volume name
  11232.                 extFSErr    External file system
  11233.                 ioErr       I/O error
  11234.                 nsDrvErr    No such drive
  11235.                 nsvErr      No such volume
  11236.                 paramErr    No default volume
  11237. \ PBUnmountVol
  11238. 17
  11239. FUNCTION PBUnmountVol (paramBlock: ParmBlkPtr) : OSErr;
  11240.  
  11241. Trap macro  _UnmountVol
  11242.  
  11243. Parameter block
  11244.     <╤  16  ioResult    word
  11245.     ╤>  18  ioNamePtr   pointer
  11246.     ╤>  22  ioVRefNum   word
  11247.  
  11248.     PBUnmountVol unmounts the volume specified by ioNamePtr or
  11249. ioVRefNum, by calling PBFlushVol to flush the volume, closing all open
  11250. files on the volume, and releasing the memory used for the volume.
  11251. PBUnmountVol is always executed synchronously.
  11252.  
  11253. Warning:  Don╒t unmount the startup volume.
  11254.  
  11255. Note:  Unmounting a volume does not close working directories; to
  11256.        release the memory allocated to a working directory, call
  11257.        PBCloseWD.
  11258.  
  11259. Result codes    noErr       No error
  11260.                 bdNamErr    Bad volume name
  11261.                 extFSErr    External file system
  11262.                 ioErr       I/O error
  11263.                 nsDrvErr    No such drive
  11264.                 nsvErr      No such volume
  11265.                 paramErr    No default volume
  11266. \ PBOffLine
  11267. 17
  11268. FUNCTION PBOffLine (paramBlock: ParmBlkPtr) : OSErr;
  11269.  
  11270. Trap macro  _OffLine
  11271.  
  11272. Parameter block
  11273.     ╤>  12  ioCompletion    pointer
  11274.     <╤  16  ioResult    word
  11275.     ╤>  18  ioNamePtr   pointer
  11276.     ╤>  22  ioVRefNum   word
  11277.  
  11278.     PBOffLine places off-line the volume specified by ioNamePtr or
  11279. ioVRefNum, by calling PBFlushVol to flush the volume and releasing all
  11280. the memory used for the volume except for the volume control block.
  11281. PBOffLine is always executed synchronously.
  11282.  
  11283. Result codes    noErr       No error
  11284.                 bdNamErr    Bad volume name
  11285.                 extFSErr    External file system
  11286.                 ioErr       I/O error
  11287.                 nsDrvErr    No such drive
  11288.                 nsvErr      No such volume
  11289.                 paramErr    No default volume
  11290. \ PBEject
  11291. 17
  11292. FUNCTION PBEject (paramBlock: ParmBlkPtr) : OSErr;
  11293.  
  11294. Trap macro  _Eject
  11295.  
  11296. Parameter block
  11297.     ╤>  12  ioCompletion    pointer
  11298.     <╤  16  ioResult        word
  11299.     ╤>  18  ioNamePtr       pointer
  11300.     ╤>  22  ioVRefNum       word
  11301.  
  11302.     PBEject flushes the volume specified by ioNamePtr or ioVRefNum,
  11303. places it off-line, and then ejects the volume.
  11304. ________________________________________________________________________
  11305.  
  11306. Assembly-language note:  You may invoke the macro _Eject asynchronously;
  11307. the first part of the call is executed synchronously, and the actual
  11308. ejection is executed asynchronously.
  11309. ________________________________________________________________________
  11310. Result codes    noErr       No error
  11311.                 bdNamErr    Bad volume name
  11312.                 extFSErr    External file system
  11313.                 ioErr       I/O error
  11314.                 nsDrvErr    No such drive
  11315.                 nsvErr      No such volume
  11316.                 paramErr    No default volume
  11317. \ PBOpen
  11318. 17
  11319. FUNCTION PBOpen (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11320.  
  11321. Trap macro  _Open
  11322.  
  11323. Parameter block
  11324.     ╤>  12  ioCompletion    pointer
  11325.     <╤  16  ioResult        word
  11326.     ╤>  18  ioNamePtr       pointer
  11327.     ╤>  22  ioVRefNum       word
  11328.     <╤  24  ioRefNum        word
  11329.     ╤>  26  ioVersNum       byte
  11330.     ╤>  27  ioPermssn       byte
  11331.     ╤>  28  ioMisc          pointer
  11332.  
  11333.     PBOpen creates an access path to the file having the name pointed to
  11334. by ioNamePtr (and on flat volumes, the version number ioVersNum) on the
  11335. volume specified by ioVRefNum. A path reference number is returned in
  11336. ioRefNum.
  11337.  
  11338.     IOMisc either points to a portion of memory (522 bytes) to be used
  11339. as the access path╒s buffer, or is NIL if you want the volume buffer to
  11340. be used instead.
  11341.  
  11342. Warning:  All access paths to a single file that╒s opened multiple times
  11343.           should share the same buffer so that they will read and write
  11344.           the same data.
  11345.  
  11346.     IOPermssn specifies the path╒s read/write permission. A path can be
  11347. opened for writing even if it accesses a file on a locked volume, and an
  11348. error won╒t be returned until a PBWrite, PBSetEOF, or PBAllocate call is
  11349. made.
  11350.  
  11351.     If you attempt to open a locked file for writing, PBOpen will return
  11352. permErr as its function result. If you request exclusive read/write
  11353. permission but another access path already has write permission (whether
  11354. write only, exclusive read/write, or shared read/write), PBOpen will
  11355. return the reference number of the existing access path in ioRefNum and
  11356. opWrErr as its function result. Similarly, if you request shared
  11357. read/write permission but another access path already has exclusive
  11358. read/write permission, PBOpen will return the reference number of the
  11359. access path in ioRefNum and opWrErr as its function result.
  11360.  
  11361. Result codes    noErr       No error
  11362.                 bdNamErr    Bad file name
  11363.                 extFSErr    External file system
  11364.                 fnfErr      File not found
  11365.                 ioErr       I/O error
  11366.                 nsvErr      No such volume
  11367.                 opWrErr     File already open for writing
  11368.                 permErr     Attempt to open locked file for writing
  11369.                 tmfoErr     Too many files open
  11370. \ PBHOpen
  11371. 17
  11372. FUNCTION PBHOpen (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11373.  
  11374. Trap macro  _HOpen
  11375.  
  11376. Parameter block
  11377.     ╤>  12  ioCompletion    pointer
  11378.     <╤  16  ioResult        word
  11379.     ╤>  18  ioNamePtr       pointer
  11380.     ╤>  22  ioVRefNum       word
  11381.     <╤  24  ioRefNum        word
  11382.     ╤>  27  ioPermssn       byte
  11383.     ╤>  28  ioMisc          pointer
  11384.     ╤>  48  ioDirID         long word
  11385.  
  11386.     PBHOpen is identical to PBOpen except that it accepts a directory ID
  11387. in ioDirID.
  11388.  
  11389. Result codes    noErr       No error
  11390.                 bdNamErr    Bad file name
  11391.                 dirNFErr    Directory not found or incomplete pathname
  11392.                 extFSErr    External file system
  11393.                 fnfErr      File not found
  11394.                 ioErr       I/O error
  11395.                 nsvErr      No such volume
  11396.                 opWrErr     File already open for writing
  11397.                 permErr     Attempt to open locked file for writing
  11398.                 tmfoErr     Too many files open
  11399.  
  11400. \ PBOpenRF
  11401. 17
  11402. FUNCTION PBOpenRF (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11403.  
  11404. Trap macro  _OpenRF
  11405.  
  11406. Parameter block
  11407.     ╤>  12  ioCompletion    pointer
  11408.     <╤  16  ioResult        word
  11409.     ╤>  18  ioNamePtr       pointer
  11410.     ╤>  22  ioVRefNum       word
  11411.     <╤  24  ioRefNum        word
  11412.     ╤>  26  ioVersNum       byte
  11413.     ╤>  27  ioPermssn       byte
  11414.     ╤>  28  ioMisc          pointer
  11415.  
  11416.     PBOpenRF is identical to PBOpen, except that it opens the file╒s
  11417. resource fork instead of its data fork.
  11418.  
  11419. Note:  Normally you should access a file╒s resource fork through the
  11420.        routines of the Resource Manager rather than the File Manager.
  11421.        PBOpenRF doesn╒t read the resource map into memory; it╒s really
  11422.        only useful for block-level operations such as copying files.
  11423.  
  11424. Result codes    noErr       No error
  11425.                 bdNamErr    Bad file name
  11426.                 extFSErr    External file system
  11427.                 fnfErr      File not found
  11428.                 ioErr       I/O error
  11429.                 nsvErr      No such volume
  11430.                 opWrErr     File already open for writing
  11431.                 permErr     Attempt to open locked file for writing
  11432.                 tmfoErr     Too many files open
  11433. \ PBHOpenRF
  11434. 17
  11435. FUNCTION PBHOpenRF (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11436.  
  11437. Trap macro  _HOpenRF
  11438.  
  11439. Parameter block
  11440.     ╤>  12  ioCompletion    pointer
  11441.     <╤  16  ioResult        word
  11442.     ╤>  18  ioNamePtr       pointer
  11443.     ╤>  22  ioVRefNum       word
  11444.     <╤  24  ioRefNum        word
  11445.     ╤>  27  ioPermssn       byte
  11446.     ╤>  28  ioMisc          pointer
  11447.     ╤>  48  ioDirID         long word
  11448.  
  11449.     PBHOpenRF is identical to PBOpenRF except that it accepts a
  11450. directory ID in ioDirID.
  11451.  
  11452. Result codes    noErr       No error
  11453.                 bdNamErr    Bad file name
  11454.                 dirNFErr    Directory not found or incomplete pathname
  11455.                 extFSErr    External file system
  11456.                 fnfErr      File not found
  11457.                 ioErr       I/O error
  11458.                 nsvErr      No such volume
  11459.                 opWrErr     File already open for writing
  11460.                 permErr     Attempt to open locked file for writing
  11461.                 tmfoErr     Too many files open
  11462. \ PBLockRange
  11463. 17
  11464. FUNCTION PBLockRange (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11465.  
  11466. Trap macro  _LockRng
  11467.  
  11468. Parameter block
  11469.     ╤>  12  ioCompletion    pointer
  11470.     <╤  16  ioResult        word
  11471.     ╤>  24  ioRefNum        word
  11472.     ╤>  36  ioReqCount      long word
  11473.     ╤>  44  ioPosMode       word
  11474.     ╤>  46  ioPosOffset     long word
  11475.  
  11476.     On a file opened with a shared read/write permission, PBLockRange is
  11477. used in conjunction with PBRead and PBWrite to lock a certain portion of
  11478. the file. PBLockRange uses the same parameters as both PBRead and
  11479. PBWrite; by calling it immediately before PBRead, you can use the
  11480. information present in the parameter block for the PBRead call.
  11481.  
  11482.     When you╒re finished with the data (typically after a call to
  11483. PBWrite), be sure to call PBUnlockRange to free up that portion of the
  11484. file for subsequent PBRead calls.
  11485.  
  11486. Warning:  PBLockRange operates only with the hierarchical version of the
  11487.           File Manager; if used on a Macintosh equipped only with the
  11488.           64K ROM version of the File Manager, it will generate a system
  11489.           error.
  11490.  
  11491. Result codes    noErr       No error
  11492.                 eofErr      End-of-file
  11493.                 extFSErr    External file system
  11494.                 fnOpnErr    File not open
  11495.                 ioErr       I/O error
  11496.                 paramErr    Negative ioReqCount
  11497.                 rfNumErr    Bad reference number
  11498. \ PBUnlockRange
  11499. 17
  11500. FUNCTION PBUnlockRange (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11501.  
  11502. Trap macro  _UnlockRng
  11503.  
  11504. Parameter block
  11505.     ╤>  12  ioCompletion    pointer
  11506.     <╤  16  ioResult        word
  11507.     ╤>  24  ioRefNum        word
  11508.     ╤>  36  ioReqCount      long word
  11509.     ╤>  44  ioPosMode       word
  11510.     ╤>  46  ioPosOffset     long word
  11511.  
  11512.     PBUnlockRange is used in conjunction with PBRead and PBWrite to
  11513. unlock a certain portion of a file that you locked with PBLockRange.
  11514. PBUnlockRange uses the same parameters as both PBRead and PBWrite; by
  11515. calling it immediately after PBWrite, you can use the information
  11516. present in the parameter block to unlock the portion of the file that
  11517. was just written.
  11518.  
  11519. Warning:  PBUnlockRange operates only with the hierarchical version of
  11520.           the File Manager; if used on a Macintosh equipped only with
  11521.           the 64K ROM version of the File Manager, it will generate a
  11522.           system error.
  11523.  
  11524. Result codes    noErr       No error
  11525.                 eofErr      End-of-file
  11526.                 extFSErr    External file system
  11527.                 fnOpnErr    File not open
  11528.                 ioErr       I/O error
  11529.                 paramErr    Negative ioReqCount
  11530.                 rfNumErr    Bad reference number
  11531. \ PBRead
  11532. 17
  11533. FUNCTION PBRead (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11534.  
  11535. Trap macro  _Read
  11536.  
  11537. Parameter block
  11538.     ╤>  12  ioCompletion    pointer
  11539.     <╤  16  ioResult        word
  11540.     ╤>  24  ioRefNum        word
  11541.     ╤>  32  ioBuffer        pointer
  11542.     ╤>  36  ioReqCount      long word
  11543.     <╤  40  ioActCount      long word
  11544.     ╤>  44  ioPosMode       word
  11545.     <╨> 46  ioPosOffset     long word
  11546.  
  11547.     PBRead attempts to read ioReqCount bytes from the open file whose
  11548. access path is specified by ioRefNum, and transfer them to the data
  11549. buffer pointed to by ioBuffer. The position of the mark is specified by
  11550. ioPosMode and ioPosOffset. If you try to read past the logical
  11551. end-of-file, PBRead moves the mark to the end-of-file and returns eofErr
  11552. as its function result. After the read is completed, the mark is
  11553. returned in ioPosOffset and the number of bytes actually read is
  11554. returned in ioActCount.
  11555.  
  11556. Result codes    noErr       No error
  11557.                 eofErr      End-of-file
  11558.                 extFSErr    External file system
  11559.                 fnOpnErr    File not open
  11560.                 ioErr       I/O error
  11561.                 paramErr    Negative ioReqCount
  11562.                 rfNumErr    Bad reference number
  11563. \ PBWrite
  11564. 17
  11565. FUNCTION PBWrite (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11566.  
  11567. Trap macro  _Write
  11568.  
  11569. Parameter block
  11570.     ╤>  12  ioCompletion    pointer
  11571.     <╤  16  ioResult        word
  11572.     ╤>  24  ioRefNum        word
  11573.     ╤>  32  ioBuffer        pointer
  11574.     ╤>  36  ioReqCount      long word
  11575.     <╤  40  ioActCount      long word
  11576.     ╤>  44  ioPosMode       word
  11577.     <╨> 46  ioPosOffset     long word
  11578.  
  11579.     PBWrite takes ioReqCount bytes from the buffer pointed to by
  11580. ioBuffer and attempts to write them to the open file whose access path
  11581. is specified by ioRefNum. The position of the mark is specified by
  11582. ioPosMode and ioPosOffset. After the write is completed, the mark is
  11583. returned in ioPosOffset and the number of bytes actually written is
  11584. returned in ioActCount.
  11585.  
  11586. Result codes    noErr       No error
  11587.                 dskFulErr   Disk full
  11588.                 fLckdErr    File locked
  11589.                 fnOpnErr    File not open
  11590.                 ioErr       I/O error
  11591.                 paramErr    Negative ioReqCount
  11592.                 posErr      Attempt to position before start of file
  11593.                 rfNumErr    Bad reference number
  11594.                 vLckdErr    Software volume lock
  11595.                 wPrErr      Hardware volume lock
  11596.                 wrPermErr   Read/write permission doesn╒t allow writing
  11597. \ PBGetFPos
  11598. 17
  11599. FUNCTION PBGetFPos (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11600.  
  11601. Trap macro  _GetFPos
  11602.  
  11603. Parameter block
  11604.     ╤>  12  ioCompletion    pointer
  11605.     <╤  16  ioResult        word
  11606.     ╤>  24  ioRefNum        word
  11607.     <╤  36  ioReqCount      long word
  11608.     <╤  40  ioActCount      long word
  11609.     <╤  44  ioPosMode       word
  11610.     <╤  46  ioPosOffset     long word
  11611.  
  11612.     PBGetFPos returns, in ioPosOffset, the mark of the open file whose
  11613. access path is specified by ioRefNum. It sets ioReqCount, ioActCount,
  11614. and ioPosMode to 0.
  11615.  
  11616. Result codes    noErr       No error
  11617.                 extFSErr    External file system
  11618.                 fnOpnErr    File not open
  11619.                 gfpErr      Error during GetFPos
  11620.                 ioErr       I/O error
  11621.                 rfNumErr    Bad reference number
  11622. \ PBSetFPos
  11623. 17
  11624. FUNCTION PBSetFPos (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11625.  
  11626. Trap macro  _SetFPos
  11627.  
  11628. Parameter block
  11629.     ╤>  12  ioCompletion    pointer
  11630.     <╤  16  ioResult        word
  11631.     ╤>  24  ioRefNum        word
  11632.     ╤>  44  ioPosMode       word
  11633.     <╨> 46  ioPosOffset     long word
  11634.  
  11635.     PBSetFPos sets the mark of the open file whose access path is
  11636. specified by ioRefNum to the position specified by ioPosMode and
  11637. ioPosOffset. The position at which the mark is actually set is returned
  11638. in ioPosOffset. If you try to set the mark past the logical
  11639. end-of-file, PBSetFPos moves the mark to the end-of-file and returns
  11640. eofErr as its function result.
  11641.  
  11642. Result codes    noErr       No error
  11643.                 eofErr      End-of-file
  11644.                 extFSErr    External file system
  11645.                 fnOpnErr    File not open
  11646.                 ioErr       I/O error
  11647.                 posErr      Attempt to position before start of file
  11648.                 rfNumErr    Bad reference number
  11649. \ PBGetEOF
  11650. 17
  11651. FUNCTION PBGetEOF (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11652.  
  11653. Trap macro  _GetEOF
  11654.  
  11655. Parameter block
  11656.     ╤>  12  ioCompletion    pointer
  11657.     <╤  16  ioResult        word
  11658.     ╤>  24  ioRefNum        word
  11659.     <╤  28  ioMisc          long word
  11660.  
  11661.     PBGetEOF returns, in ioMisc, the logical end-of-file of the open
  11662. file whose access path is specified by ioRefNum.
  11663.  
  11664. Result codes    noErr       No error
  11665.                 extFSErr    External file system
  11666.                 fnOpnErr    File not open
  11667.                 ioErr       I/O error
  11668.                 rfNumErr    Bad reference number
  11669. \ PBSetEOF
  11670. 17
  11671. FUNCTION PBSetEOF (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11672.  
  11673. Trap macro  _SetEOF
  11674.  
  11675. Parameter block
  11676.     ╤>  12  ioCompletion    pointer
  11677.     <╤  16  ioResult        word
  11678.     ╤>  24  ioRefNum        word
  11679.     ╤>  28  ioMisc          long word
  11680.  
  11681.     PBSetEOF sets the logical end-of-file of the open file, whose access
  11682. path is specified by ioRefNum, to ioMisc. If you attempt to set the
  11683. logical end-of-file beyond the physical end-of-file, another allocation
  11684. block is added to the file; if there isn╒t enough space on the volume,
  11685. no change is made, and PBSetEOF returns dskFulErr as its function
  11686. result. If ioMisc is 0, all space occupied by the file on the volume is
  11687. released.
  11688.  
  11689. Result codes    noErr       No error
  11690.                 dskFulErr   Disk full
  11691.                 extFSErr    External file system
  11692.                 fLckdErr    File locked
  11693.                 fnOpnErr    File not open
  11694.                 ioErr       I/O error
  11695.                 rfNumErr    Bad reference number
  11696.                 vLckdErr    Software volume lock
  11697.                 wPrErr      Hardware volume lock
  11698.                 wrPermErr   Read/write permission doesn╒t allow writing
  11699. \ PBAllocate
  11700. 17
  11701. FUNCTION PBAllocate (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11702.  
  11703. Trap macro  _Allocate
  11704.  
  11705. Parameter block
  11706.     ╤>  12  ioCompletion    pointer
  11707.     <╤  16  ioResult        word
  11708.     ╤>  24  ioRefNum        word
  11709.     ╤>  36  ioReqCount      long word
  11710.     <╤  40  ioActCount      long word
  11711.  
  11712.     PBAllocate adds ioReqCount bytes to the open file whose access path
  11713. is specified by ioRefNum, and sets the physical end-of-file to one byte
  11714. beyond the last block allocated. The number of bytes actually allocated
  11715. is rounded up to the nearest multiple of the allocation block size, and
  11716. returned in ioActCount. If there isn╒t enough empty space on the volume
  11717. to satisfy the allocation request, PBAllocate allocates the rest of the
  11718. space on the volume and returns dskFulErr as its function result.
  11719.  
  11720. Note:  Even if the total number of requested bytes is unavailable,
  11721.        PBAllocate will allocate whatever space, contiguous or not, is
  11722.        available. To force the allocation of the entire requested space
  11723.        as a contiguous piece, call PBAllocContig instead.
  11724.  
  11725. Result codes    noErr       No error
  11726.                 dskFulErr   Disk full
  11727.                 fLckdErr    File locked
  11728.                 fnOpnErr    File not open
  11729.                 ioErr       I/O error
  11730.                 rfNumErr    Bad reference number
  11731.                 vLckdErr    Software volume lock
  11732.                 wPrErr      Hardware volume lock
  11733.                 wrPermErr   Read/write permission doesn╒t allow writing
  11734. \ PBAllocContig
  11735. 17
  11736. FUNCTION PBAllocContig (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11737.  
  11738. Trap macro  _AllocContig
  11739.  
  11740. Parameter block
  11741.     ╤>  12  ioCompletion    pointer
  11742.     <╤  16  ioResult        word
  11743.     ╤>  24  ioRefNum        word
  11744.     ╤>  36  ioReqCount      long word
  11745.     <╤  40  ioActCount      long word
  11746.  
  11747.     PBAllocContig is identical to PBAllocate except that if there isn╒t
  11748. enough contiguous empty space on the volume to satisfy the allocation
  11749. request, PBAllocContig will do nothing and will return dskFulErr as its
  11750. function result. If you want to allocate whatever space is available,
  11751. even when the entire request cannot be filled as a contiguous piece,
  11752. call PBAllocate instead.
  11753.  
  11754. Result codes    noErr       No error
  11755.                 dskFulErr   Disk full
  11756.                 fLckdErr    File locked
  11757.                 fnOpnErr    File not open
  11758.                 ioErr       I/O error
  11759.                 rfNumErr    Bad reference number
  11760.                 vLckdErr    Software volume lock
  11761.                 wPrErr      Hardware volume lock
  11762.                 wrPermErr   Read/write permission doesn╒t allow writing
  11763. \ PBFlushFile
  11764. 17
  11765. FUNCTION PBFlushFile (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11766.  
  11767. Trap macro  _FlushFile
  11768.  
  11769. Parameter block
  11770.     ╤>  12  ioCompletion    pointer
  11771.     <╤  16  ioResult        word
  11772.     ╤>  24  ioRefNum        word
  11773.  
  11774.     PBFlushFile writes the contents of the access path buffer indicated
  11775. by ioRefNum to the volume, and updates the file╒s entry in the file
  11776. directory (or in the file catalog, in the case of hierarchical volumes).
  11777.  
  11778. Warning:  Some information stored on the volume won╒t be correct until
  11779.           PBFlushVol is called.
  11780.  
  11781. Result codes    noErr       No error
  11782.                 extFSErr    External file system
  11783.                 fnfErr      File not found
  11784.                 fnOpnErr    File not open
  11785.                 ioErr       I/O error
  11786.                 nsvErr      No such volume
  11787.                 rfNumErr    Bad reference number
  11788.  
  11789. \ PBClose
  11790. 17
  11791. FUNCTION PBClose (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11792.  
  11793. Trap macro  _Close
  11794.  
  11795. Parameter block
  11796.     ╤>  12  ioCompletion    pointer
  11797.     <╤  16  ioResult        word
  11798.     ╤>  24  ioRefNum        word
  11799.  
  11800.     PBClose writes the contents of the access path buffer specified by
  11801. ioRefNum to the volume and removes the access path.
  11802.  
  11803. Warning:  Some information stored on the volume won╒t be correct until
  11804.           PBFlushVol is called.
  11805.  
  11806. Result codes    noErr       No error
  11807.                 extFSErr    External file system
  11808.                 fnfErr      File not found
  11809.                 fnOpnErr    File not open
  11810.                 ioErr       I/O error
  11811.                 nsvErr      No such volume
  11812.                 rfNumErr    Bad reference number
  11813.  
  11814. \ PBCreate
  11815. 17
  11816. FUNCTION PBCreate (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11817.  
  11818. Trap macro  _Create
  11819.  
  11820. Parameter block
  11821.     ╤>  12  ioCompletion    pointer
  11822.     <╤  16  ioResult        word
  11823.     ╤>  18  ioNamePtr       pointer
  11824.     ╤>  22  ioVRefNum       word
  11825.     ╤>  26  ioFVersNum      byte
  11826.  
  11827.     PBCreate creates a new file (both forks) having the name pointed to
  11828. by ioNamePtr (and on flat volumes, the version number ioVersNum) on the
  11829. volume specified by ioVRefNum. The new file is unlocked and empty. The
  11830. date and time of its creation and last modification are set to the
  11831. current date and time. If the file created isn╒t temporary (that is, if
  11832. it will exist after the application terminates), the application should
  11833. call PBSetFInfo (after PBCreate) to fill in the information needed by
  11834. the Finder.
  11835. ________________________________________________________________________
  11836.  
  11837. Assembly-language note:  If a desk accessory creates a file, it should
  11838. always create it in the directory containing the system folder. The
  11839. working directory reference number for this directory is stored in the
  11840. global variable BootDrive; you can pass it in ioVRefNum.
  11841. ________________________________________________________________________
  11842.  
  11843. Result codes    noErr       No error
  11844.                 bdNamErr    Bad file name
  11845.                 dupFNErr    Duplicate file name and version
  11846.                 dirFulErr   File directory full
  11847.                 extFSErr    External file system
  11848.                 ioErr       I/O error
  11849.                 nsvErr      No such volume
  11850.                 vLckdErr    Software volume lock
  11851.                 wPrErr      Hardware volume lock
  11852. \ PBHCreate
  11853. 17
  11854. FUNCTION PBHCreate (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11855.  
  11856. Trap macro  _HCreate
  11857.  
  11858. Parameter block
  11859.     ╤>  12  ioCompletion    pointer
  11860.     <╤  16  ioResult        word
  11861.     ╤>  18  ioNamePtr       pointer
  11862.     ╤>  22  ioVRefNum       word
  11863.     ╤>  48  ioDirID         long word
  11864.  
  11865.     PBHCreate is identical to PBCreate except that it accepts a
  11866. directory ID in ioDirID.
  11867.  
  11868. Note:  To create a directory instead of a file, call PBDirCreate.
  11869.  
  11870. Result codes    noErr       No error
  11871.                 bdNamErr    Bad file name
  11872.                 dupFNErr    Duplicate file name and version
  11873.                 dirFulErr   File directory full
  11874.                 dirNFErr    Directory not found or incomplete pathname
  11875.                 extFSErr    External file system
  11876.                 ioErr       I/O error
  11877.                 nsvErr      No such volume
  11878.                 vLckdErr    Software volume lock
  11879.                 wPrErr      Hardware volume lock
  11880. \ PBDirCreate
  11881. 17
  11882. FUNCTION PBDirCreate (paramBlock: HParmBlkPtr; async: BOOLEAN): OSErr;
  11883.  
  11884. Trap macro  _DirCreate
  11885.  
  11886. Parameter block
  11887.     ╤>  12  ioCompletion    pointer
  11888.     <╤  16  ioResult        word
  11889.     <╨> 18  ioNamePtr       pointer
  11890.     ╤>  22  ioVRefNum       word
  11891.     <╨> 48  ioDirID         long word
  11892.  
  11893.     PBDirCreate is identical to PBHCreate except that it creates a new
  11894. directory instead of a file. You can specify the parent of the
  11895. directory to be created in ioDirID; if it╒s 0, the new directory will be
  11896. placed in the root directory. The directory ID of the new directory is
  11897. returned in ioDirID.
  11898.  
  11899. Warning:  PBDirCreate operates only with the hierarchical version of the
  11900.           File Manager; if used on a Macintosh equipped only with the
  11901.           64K ROM version of the File Manager, it will generate a system
  11902.           error.
  11903.  
  11904. Result codes    noErr       No error
  11905.                 bdNamErr    Bad file name
  11906.                 dupFNErr    Duplicate file name and version
  11907.                 dirFulErr   File directory full
  11908.                 dirNFErr    Directory not found or incomplete pathname
  11909.                 extFSErr    External file system
  11910.                 ioErr       I/O error
  11911.                 nsvErr      No such volume
  11912.                 vLckdErr    Software volume lock
  11913.                 wPrErr      Hardware volume lock
  11914.  
  11915. \ PBDelete
  11916. 17
  11917. FUNCTION PBDelete (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11918.  
  11919. Trap macro  _Delete
  11920.  
  11921. Parameter block
  11922.     ╤>  12  ioCompletion    pointer
  11923.     <╤  16  ioResult        word
  11924.     ╤>  18  ioNamePtr       pointer
  11925.     ╤>  22  ioVRefNum       word
  11926.     ╤>  26  ioFVersNum      byte
  11927.  
  11928.     PBDelete removes the closed file having the name pointed to by
  11929. ioNamePtr (and on flat volumes, the version number ioVersNum) from the
  11930. volume pointed to by ioVRefNum. PBHDelete can be used to delete an
  11931. empty directory as well.
  11932.  
  11933. Note:  This function will delete both forks of the file.
  11934.  
  11935. Result codes    noErr       No error
  11936.                 bdNamErr    Bad file name
  11937.                 extFSErr    External file system
  11938.                 fBsyErr     File busy, directory not empty, or working
  11939.                             directory control block open
  11940.                 fLckdErr    File locked
  11941.                 fnfErr      File not found
  11942.                 nsvErr      No such volume
  11943.                 ioErr       I/O error
  11944.                 vLckdErr    Software volume lock
  11945.                 wPrErr      Hardware volume lock
  11946. \ PBHDelete
  11947. 17
  11948. FUNCTION PBHDelete (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  11949.  
  11950. Trap macro  _HDelete
  11951.  
  11952. Parameter block
  11953.     ╤>  12  ioCompletion    pointer
  11954.     <╤  16  ioResult        word
  11955.     ╤>  18  ioNamePtr       pointer
  11956.     ╤>  22  ioVRefNum       word
  11957.     ╤>  48  ioDirID         long word
  11958.  
  11959.     PBHDelete is identical to PBDelete except that it accepts a
  11960. directory ID in ioDirID. PBHDelete can be used to delete an empty
  11961. directory as well.
  11962.  
  11963. Result codes    noErr       No error
  11964.                 bdNamErr    Bad file name
  11965.                 dirNFErr    Directory not found or incomplete pathname
  11966.                 extFSErr    External file system
  11967.                 fBsyErr     File busy, directory not empty,
  11968.                             or working directory control block open
  11969.                 fLckdErr    File locked
  11970.                 fnfErr      File not found
  11971.                 nsvErr      No such volume
  11972.                 ioErr       I/O error
  11973.                 vLckdErr    Software volume lock
  11974.                 wPrErr      Hardware volume lock
  11975. \ PBGetFInfo
  11976. 17
  11977. FUNCTION PBGetFInfo (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  11978.  
  11979. Trap macro  _GetFileInfo
  11980.  
  11981. Parameter block
  11982.     ╤>  12  ioCompletion    pointer
  11983.     <╤  16  ioResult        word
  11984.     <╨> 18  ioNamePtr       pointer
  11985.     ╤>  22  ioVRefNum       word
  11986.     <╤  24  ioFRefNum       word
  11987.     ╤>  26  ioFVersNum      byte
  11988.     ╤>  28  ioFDirIndex     word
  11989.     <╤  30  ioFlAttrib      byte
  11990.     <╤  31  ioFlVersNum     byte
  11991.     <╤  32  ioFlFndrInfo    16 bytes
  11992.     <╤  48  ioFlNum         long word
  11993.     <╤  52  ioFlStBlk       word
  11994.     <╤  54  ioFlLgLen       long word
  11995.     <╤  58  ioFlPyLen       long word
  11996.     <╤  62  ioFlRStBlk      word
  11997.     <╤  64  ioFlRLgLen      long word
  11998.     <╤  68  ioFlRPyLen      long word
  11999.     <╤  72  ioFlCrDat       long word
  12000.     <╤  76  ioFlMdDat       long word
  12001.  
  12002.     PBGetFInfo returns information about the specified file. If
  12003. ioFDirIndex is positive, the File Manager returns information about the
  12004. file whose directory index is ioFDirIndex on the volume specified by
  12005. ioVRefNum. (See the section ╥Data Organization on Volumes╙ if you╒re
  12006. interested in using this method.)
  12007.  
  12008. Note:  If a working directory reference number is specified in
  12009.        ioVRefNum, the File Manager returns information about the file
  12010.        whose directory index is ioFDirIndex in the specified directory.
  12011.  
  12012.     If ioFDirIndex is negative or 0, the File Manager returns
  12013. information about the file having the name pointed to by ioNamePtr (and
  12014. on flat volumes, the version number ioFVersNum) on the volume specified
  12015. by ioVRefNum. If the file is open, the reference number of the first
  12016. access path found is returned in ioFRefNum, and the name of the file is
  12017. returned in ioNamePtr (unless ioNamePtr is NIL).
  12018.  
  12019. Result codes    noErr       No error
  12020.                 bdNamErr    Bad file name
  12021.                 extFSErr    External file system
  12022.                 fnfErr      File not found
  12023.                 ioErr       I/O error
  12024.                 nsvErr      No such volume
  12025.                 paramErr    No default volume
  12026. \ PBHGetFInfo
  12027. 17
  12028. FUNCTION PBHGetFInfo (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  12029.  
  12030. Trap macro  _HGetFileInfo
  12031.  
  12032. Parameter block
  12033.     ╤>  12  ioCompletion    pointer
  12034.     <╤  16  ioResult        word
  12035.     <╨> 18  ioNamePtr       pointer
  12036.     ╤>  22  ioVRefNum       word
  12037.     <╤  24  ioFRefNum       word
  12038.     ╤>  28  ioFDirIndex     word
  12039.     <╤  30  ioFlAttrib      byte
  12040.     <╤  32  ioFlFndrInfo    16 bytes
  12041.     <╨> 48  ioDirID         long word
  12042.     <╤  52  ioFlStBlk       word
  12043.     <╤  54  ioFlLgLen       long word
  12044.     <╤  58  ioFlPyLen       long word
  12045.     <╤  62  ioFlRStBlk      word
  12046.     <╤  64  ioFlRLgLen      long word
  12047.     <╤  68  ioFlRPyLen      long word
  12048.     <╤  72  ioFlCrDat       long word
  12049.     <╤  76  ioFlMdDat       long word
  12050.  
  12051.     PBHGetFInfo is identical to PBGetFInfo except that it accepts a
  12052. directory ID in ioDirID.
  12053.  
  12054. Result codes    noErr       No error
  12055.                 bdNamErr    Bad file name
  12056.                 dirNFErr    Directory not found or incomplete pathname
  12057.                 extFSErr    External file system
  12058.                 fnfErr      File not found
  12059.                 ioErr       I/O error
  12060.                 nsvErr      No such volume
  12061.                 paramErr    No default volume
  12062. \ PBSetFInfo
  12063. 17
  12064. FUNCTION PBSetFInfo (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12065.  
  12066. Trap macro  _SetFileInfo
  12067.  
  12068. Parameter block
  12069.     ╤>  12  ioCompletion    pointer
  12070.     <╤  16  ioResult        word
  12071.     ╤>  18  ioNamePtr       pointer
  12072.     ╤>  22  ioVRefNum       word
  12073.     ╤>  26  ioFVersNum      byte
  12074.     ╤>  32  ioFlFndrInfo    16 bytes
  12075.     ╤>  72  ioFlCrDat       long word
  12076.     ╤>  76  ioFlMdDat       long word
  12077.  
  12078.     PBSetFInfo sets information (including the date and time of creation
  12079. and modification, and information needed by the Finder) about the file
  12080. having the name pointed to by ioNamePtr (and on flat volumes, the
  12081. version number ioFVersNum) on the volume specified by ioVRefNum. You
  12082. should call PBGetFInfo just before PBSetFInfo, so the current
  12083. information is present in the parameter block.
  12084.  
  12085. Result codes    noErr       No error
  12086.                 bdNamErr    Bad file name
  12087.                 extFSErr    External file system
  12088.                 fLckdErr    File locked
  12089.                 fnfErr      File not found
  12090.                 ioErr       I/O error
  12091.                 nsvErr      No such volume
  12092.                 vLckdErr    Software volume lock
  12093.                 wPrErr      Hardware volume lock
  12094. \ PBHSetFInfo
  12095. 17
  12096. FUNCTION PBHSetFInfo (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  12097.  
  12098. Trap macro  _HSetFileInfo
  12099.  
  12100. Parameter block
  12101.     ╤>  12  ioCompletion    pointer
  12102.     <╤  16  ioResult        word
  12103.     ╤>  18  ioNamePtr       pointer
  12104.     ╤>  22  ioVRefNum       word
  12105.     ╤>  32  ioFlFndrInfo    16 bytes
  12106.     ╤>  48  ioDirID         long word
  12107.     ╤>  72  ioFlCrDat       long word
  12108.     ╤>  76  ioFlMdDat       long word
  12109.  
  12110.     PBHSetFInfo is identical to PBSetFInfo except that it accepts a
  12111. directory ID in ioDirID.
  12112.  
  12113. Result codes    noErr       No error
  12114.                 bdNamErr    Bad file name
  12115.                 dirNFErr    Directory not found or incomplete pathname
  12116.                 extFSErr    External file system
  12117.                 fLckdErr    File locked
  12118.                 fnfErr      File not found
  12119.                 ioErr       I/O error
  12120.                 nsvErr      No such volume
  12121.                 vLckdErr    Software volume lock
  12122.                 wPrErr      Hardware volume lock
  12123. \ PBSetFLock
  12124. 17
  12125. FUNCTION PBSetFLock (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12126.  
  12127. Trap macro  _SetFilLock
  12128.  
  12129. Parameter block
  12130.     ╤>  12  ioCompletion    pointer
  12131.     <╤  16  ioResult        word
  12132.     ╤>  18  ioNamePtr       pointer
  12133.     ╤>  22  ioVRefNum       word
  12134.     ╤>  26  ioFVersNum      byte
  12135.  
  12136.     PBSetFLock locks the file having the name pointed to by ioNamePtr
  12137. (and on flat volumes, the version number ioFVersNum) on the volume
  12138. specified by ioVRefNum. Access paths currently in use aren╒t affected.
  12139.  
  12140. Result codes    noErr       No error
  12141.                 extFSErr    External file system
  12142.                 fnfErr      File not found
  12143.                 ioErr       I/O error
  12144.                 nsvErr      No such volume
  12145.                 vLckdErr    Software volume lock
  12146.                 wPrErr      Hardware volume lock
  12147.  
  12148. \ PBHSetFLock
  12149. 17
  12150. FUNCTION PBHSetFLock (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  12151.  
  12152. Trap macro  _HSetFLock
  12153.  
  12154. Parameter block
  12155.     ╤>  12  ioCompletion    pointer
  12156.     <╤  16  ioResult        word
  12157.     ╤>  18  ioNamePtr       pointer
  12158.     ╤>  22  ioVRefNum       word
  12159.     ╤>  48  ioDirID         long word
  12160.  
  12161.     PBHSetFLock is identical to PBSetFLock except that it accepts a
  12162. directory ID in ioDirID.
  12163.  
  12164. Result codes    noErr       No error
  12165.                 dirNFErr    Directory not found or incomplete pathname
  12166.                 extFSErr    External file system
  12167.                 fnfErr      File not found
  12168.                 ioErr       I/O error
  12169.                 nsvErr      No such volume
  12170.                 vLckdErr    Software volume lock
  12171.                 wPrErr      Hardware volume lock
  12172. \ PBRstFLock
  12173. 17
  12174. FUNCTION PBRstFLock (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12175.  
  12176. Trap macro  _RstFilLock
  12177.  
  12178. Parameter block
  12179.     ╤>  12  ioCompletion    pointer
  12180.     <╤  16  ioResult        word
  12181.     ╤>  18  ioNamePtr       pointer
  12182.     ╤>  22  ioVRefNum       word
  12183.     ╤>  26  ioFVersNum      byte
  12184.  
  12185.     PBRstFLock unlocks the file having the name pointed to by ioNamePtr
  12186. (and on flat volumes, the version number ioFVersNum) on the volume
  12187. specified by ioVRefNum. Access paths currently in use aren╒t affected.
  12188.  
  12189. Result codes    noErr       No error
  12190.                 extFSErr    External file system
  12191.                 fnfErr      File not found
  12192.                 ioErr       I/O error
  12193.                 nsvErr      No such volume
  12194.                 vLckdErr    Software volume lock
  12195.                 wPrErr      Hardware volume lock
  12196.  
  12197. \ PBHRstFLock
  12198. 17
  12199. FUNCTION PBHRstFLock (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  12200.  
  12201. Trap macro  _HRstFLock
  12202.  
  12203. Parameter block
  12204.     ╤>  12  ioCompletion    pointer
  12205.     <╤  16  ioResult        word
  12206.     ╤>  18  ioNamePtr       pointer
  12207.     ╤>  22  ioVRefNum       word
  12208.     ╤>  48  ioDirID         long word
  12209.  
  12210.     PBHRstFLock is identical to PBRstFLock except that it accepts a
  12211. directory ID in ioDirID.
  12212.  
  12213. Result codes    noErr       No error
  12214.                 dirNFErr    Directory not found or incomplete pathname
  12215.                 extFSErr    External file system
  12216.                 fnfErr      File not found
  12217.                 ioErr       I/O error
  12218.                 nsvErr      No such volume
  12219.                 vLckdErr    Software volume lock
  12220.                 wPrErr      Hardware volume lock
  12221.  
  12222. \ PBSetFVers
  12223. 17
  12224. FUNCTION PBSetFVers (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12225.  
  12226. Trap macro  _SetFilType
  12227.  
  12228. Parameter block
  12229.     ╤>  12  ioCompletion    pointer
  12230.     <╤  16  ioResult        word
  12231.     ╤>  18  ioNamePtr       pointer
  12232.     ╤>  22  ioVRefNum       word
  12233.     ╤>  26  ioVersNum       byte
  12234.     ╤>  28  ioMisc          byte
  12235.  
  12236.     PBSetFVers has no effect on hierarchical volumes. On flat volumes,
  12237. PBSetFVers changes the version number of the file having the name
  12238. pointed to by ioNamePtr and version number ioVersNum, on the volume
  12239. specified by ioVRefNum, to the version number stored in the high-order
  12240. byte of ioMisc. Access paths currently in use aren╒t affected.
  12241.  
  12242. Result codes    noErr           No error
  12243.                 bdNamErr        Bad file name
  12244.                 dupFNErr        Duplicate file name and version
  12245.                 extFSErr        External file system
  12246.                 fLckdErr        File locked
  12247.                 fnfErr          File not found
  12248.                 nsvErr          No such volume
  12249.                 ioErr           I/O error
  12250.                 paramErr        No default volume
  12251.                 vLckdErr        Software volume lock
  12252.                 wPrErr          Hardware volume lock
  12253.                 wrgVolTypErr    Attempt to perform hierarchical
  12254.                                 operation on a flat volume
  12255. \ PBRename
  12256. 17
  12257. FUNCTION PBRename (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12258.  
  12259. Trap macro  _Rename
  12260.  
  12261. Parameter block
  12262.     ╤>  12  ioCompletion    pointer
  12263.     <╤  16  ioResult        word
  12264.     ╤>  18  ioNamePtr       pointer
  12265.     ╤>  22  ioVRefNum       word
  12266.     ╤>  26  ioVersNum       byte
  12267.     ╤>  28  ioMisc          pointer
  12268.  
  12269.     Given a pointer to a file name in ioNamePtr (and on flat volumes, a
  12270. version number in ioVersNum), PBRename changes the name of the file to
  12271. the name pointed to by ioMisc. (If the name pointed to by ioNamePtr
  12272. contains one or more colons, so must the name pointed to by ioMisc.)
  12273. Access paths currently in use aren╒t affected. Given a pointer to a
  12274. volume name in ioNamePtr or a volume reference number in ioVRefNum, it
  12275. changes the name of the volume to the name pointed to by ioMisc. If a
  12276. volume to be renamed is specified by its volume reference number,
  12277. ioNamePtr can be NIL.
  12278.  
  12279. Warning:  If a volume to be renamed is specified by its volume name, be
  12280.           sure that it ends with a colon, or Rename will consider it a
  12281.           file name.
  12282.  
  12283. Result codes    noErr       No error
  12284.                 bdNamErr    Bad file name
  12285.                 dirFulErr   File directory full
  12286.                 dupFNErr    Duplicate file name and version
  12287.                 extFSErr    External file system
  12288.                 fLckdErr    File locked
  12289.                 fnfErr      File not found
  12290.                 fsRnErr     Problem during rename
  12291.                 ioErr       I/O error
  12292.                 nsvErr      No such volume
  12293.                 paramErr    No default volume
  12294.                 vLckdErr    Software volume lock
  12295.                 wPrErr      Hardware volume lock
  12296. \ PBHRename
  12297. 17
  12298. FUNCTION PBHRename (paramBlock: HParmBlkPtr; async: BOOLEAN) : OSErr;
  12299.  
  12300. Trap macro  _HRename
  12301.  
  12302. Parameter block
  12303.     ╤>  12  ioCompletion    pointer
  12304.     <╤  16  ioResult        word
  12305.     ╤>  18  ioNamePtr       pointer
  12306.     ╤>  22  ioVRefNum       word
  12307.     ╤>  28  ioMisc      pointer
  12308.     ╤>  48  ioDirID     long word
  12309.  
  12310.     PBHRename is identical to PBRename except that it accepts a
  12311. directory ID in ioDirID and can be used to rename directories as well as
  12312. files and volumes. Given a pointer to the name of a file or directory
  12313. in ioNamePtr, PBHRename changes it to the name pointed to by ioMisc.
  12314. Given a pointer to a volume name in ioNamePtr or a volume reference
  12315. number in ioVRefNum, it changes the name of the volume to the name
  12316. pointed to by ioMisc.
  12317.  
  12318. Warning:  PBHRename cannot be used to change the directory a file is in.
  12319.  
  12320. Result codes    noErr       No error
  12321.                 bdNamErr    Bad file name
  12322.                 dirFulErr   File directory full
  12323.                 dirNFErr    Directory not found or incomplete pathname
  12324.                 dupFNErr    Duplicate file name and version
  12325.                 extFSErr    External file system
  12326.                 fLckdErr    File locked
  12327.                 fnfErr      File not found
  12328.                 fsRnErr     Problem during rename
  12329.                 ioErr       I/O error
  12330.                 nsvErr      No such volume
  12331.                 paramErr    No default volume
  12332.                 vLckdErr    Software volume lock
  12333.                 wPrErr      Hardware volume lock
  12334. \ PBGetCatInfo
  12335. 17
  12336. FUNCTION PBGetCatInfo (paramBlock: CInfoPBPtr; async: BOOLEAN): OSErr;
  12337.  
  12338. Trap macro  _GetCatInfo
  12339.  
  12340. Parameter block
  12341.     Files:                              Directories:
  12342.     ╤>  12  ioCompletion    pointer ╤>  12  ioCompletion    pointer
  12343.     <╤  16  ioResult        word    <╤  16  ioResult        word
  12344.     <╨> 18  ioNamePtr       pointer <╨> 18  ioNamePtr       pointer
  12345.     ╤>  22  ioVRefNum       word    ╤>  22  ioVRefNum       word
  12346.     <╤  24  ioFRefNum       word    <╤  24  ioFRefNum       word
  12347.     ╤>  28  ioFDirIndex     word    ╤>  28  ioFDirIndex     word
  12348.     <╤  30  ioFlAttrib      byte    <╤  30  ioFlAttrib      byte
  12349.     <╤  32  ioFlFndrInfo    16 bytes<╤  32  ioDrUsrWds      16 bytes
  12350.     <╨> 48  ioDirID         long    <╨> 48  ioDrDirID       long
  12351.     <╤  52  ioFlStBlk       word    <╤  52  ioDrNmFls       word
  12352.     <╤  54  ioFlLgLen       long
  12353.     <╤  58  ioFlPyLen       long
  12354.     <╤  62  ioFlRStBlk      word
  12355.     <╤  64  ioFlRLgLen      long
  12356.     <╤  68  ioFlRPyLen      long
  12357.     <╤  72  ioFlCrDat       long    <╤  72  ioDrCrDat       long
  12358.     <╤  76  ioFlMdDat       long    <╤  76  ioDrMdDat       long
  12359.     <╤  80  ioFlBkDat       long    <╤  80  ioDrBkDat       long
  12360.     <╤  84  ioFlXFndrInfo   16 bytes<╤  84  ioDrFndrInfo    16 bytes
  12361.     <╤  100 ioFlParID       long    <╤  100 ioDrParID       long
  12362.     <╤  104 ioFlClpSiz      long
  12363.  
  12364.     PBGetCatInfo gets information about the files and directories in a
  12365. file catalog. To determine whether the information is for a file or a
  12366. directory, test bit 4 of ioFlAttrib, as described in the section
  12367. ╥CInfoPBRec╙. The information that╒s returned for files is shown in the
  12368. left column, and the corresponding information for directories is shown
  12369. in the right column.
  12370.  
  12371.     If ioFDirIndex is positive, the File Manager returns information
  12372. about the file or directory whose directory index is ioFDirIndex in the
  12373. directory specified by ioVRefNum (this will be the root directory if a
  12374. volume reference number is provided).
  12375.  
  12376.     If ioFDirIndex is 0, the File Manager returns information about the
  12377. file or directory specified by ioNamePtr, in the directory specified by
  12378. ioVRefNum (again, this will be the root directory if a volume reference
  12379. number is provided).
  12380.  
  12381.     If ioFDirIndex is negative, the File Manager ignores ioNamePtr and
  12382. returns information about the directory specified by ioDirID.
  12383.  
  12384.     With files, PBGetCatInfo is similar to PBHGetFileInfo but returns
  12385. some additional information. If the file is open, the reference number
  12386. of the first access path found is returned in ioFRefNum, and the name of
  12387. the file is returned in ioNamePtr (unless ioNamePtr is NIL).
  12388.  
  12389. Result codes    noErr       No error
  12390.                 bdNamErr    Bad file name
  12391.                 dirNFErr    Directory not found or incomplete pathname
  12392.                 extFSErr    External file system
  12393.                 fnfErr      File not found
  12394.                 ioErr       I/O error
  12395.                 nsvErr      No such volume
  12396.                 paramErr    No default volume
  12397. \ PBSetCatInfo
  12398. 17
  12399. FUNCTION PBSetCatInfo (paramBlock: CInfoPBPtr; async: BOOLEAN) : OSErr;
  12400.  
  12401. Trap macro  _SetCatInfo
  12402.  
  12403. Parameter block
  12404.     Files:                          Directories:
  12405.     ╤>  12  ioCompletion    pointer ╤>  12  ioCompletion    pointer
  12406.     <╤  16  ioResult        word    <╤  16  ioResult        word
  12407.     <╨> 18  ioNamePtr       pointer <╨> 18  ioNamePtr       pointer
  12408.     ╤>  22  ioVRefNum       word    ╤>  22  ioVRefNum       word
  12409.     ╤>  30  ioFlAttrib      byte    ╤>  30  ioFlAttrib      byte
  12410.     ╤>  32  ioFlFndrInfo    16 bytes╤>  32  ioDrUsrWds      16 bytes
  12411.     ╤>  48  ioDirID         long    ╤>  48  ioDrDirID       long
  12412.     ╤>  72  ioFlCrDat       long    ╤>  72  ioDrCrDat       long
  12413.     ╤>  76  ioFlMdDat       long    ╤>  76  ioDrMdDat       long
  12414.     ╤>  80  ioFlBkDat       long    ╤>  80  ioDrBkDat       long
  12415.     ╤>  84  ioFlXFndrInfo   16 bytes╤>  84  ioDrFndrInfo    16 bytes
  12416.     ╤>  104 ioFlClpSiz      long
  12417.  
  12418.     PBSetCatInfo sets information about the files and directories in a
  12419. catalog. With files, it╒s similar to PBHSetFileInfo but lets you set
  12420. some additional information. The information that can be set for files
  12421. is shown in the left column, and the corresponding information for
  12422. directories is shown in the right column.
  12423.  
  12424. Result codes    noErr       No error
  12425.                 bdNamErr    Bad file name
  12426.                 dirNFErr    Directory not found or incomplete pathname
  12427.                 extFSErr    External file system
  12428.                 fnfErr      File not found
  12429.                 ioErr       I/O error
  12430.                 nsvErr      No such volume
  12431.                 paramErr    No default volume
  12432. \ PBCatMove
  12433. 17
  12434. FUNCTION PBCatMove (paramBlock: CMovePBPtr; async: BOOLEAN) : OSErr;
  12435.  
  12436. Trap macro  _CatMove
  12437.  
  12438. Parameter block
  12439.     ╤>  12  ioCompletion    pointer
  12440.     <╤  16  ioResult        word
  12441.     ╤>  18  ioNamePtr       pointer
  12442.     ╤>  22  ioVRefNum       word
  12443.     ╤>  28  ioNewName       pointer
  12444.     ╤>  36  ioNewDirID      long word
  12445.     ╤>  48  ioDirID         long word
  12446.  
  12447.     PBCatMove moves files or directories from one directory to another.
  12448. The name of the file or directory to be moved is pointed to by
  12449. ioNamePtr; ioVRefNum contains either the volume reference number or
  12450. working directory reference number. A directory ID can be specified in
  12451. ioDirID. The name and directory ID of the directory to which the file
  12452. or directory is to be moved are specified by ioNewName and ioNewDirID.
  12453.  
  12454.     PBCatMove is strictly a file catalog operation; it does not actually
  12455. change the location of the file or directory on the disk. PBCatMove
  12456. cannot move a file or directory to another volume (that is, ioVRefNum is
  12457. used in specifying both the source and the destination). It also cannot
  12458. be used to rename files or directories; for that, use PBHRename.
  12459.  
  12460. Result codes    noErr       No error
  12461.                 badMovErr   Attempt to move into offspring
  12462.                 bdNamErr    Bad file name or attempt to move into a file
  12463.                 dupFNErr    Duplicate file name and version
  12464.                 fnfErr      File not found
  12465.                 ioErr       I/O error
  12466.                 nsvErr      No such volume
  12467.                 paramErr    No default volume
  12468.                 vLckdErr    Software volume lock
  12469.                 wPrErr      Hardware volume lock
  12470. \ PBOpenWD
  12471. 17
  12472. FUNCTION PBOpenWD (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  12473.  
  12474. Trap macro  _OpenWD
  12475.  
  12476. Parameter block
  12477.     ╤>  12  ioCompletion    pointer
  12478.     <╤  16  ioResult        word
  12479.     ╤>  18  ioNamePtr       pointer
  12480.     <╨> 22  ioVRefNum       word
  12481.     ╤>  28  ioWDProcID      long word
  12482.     ╤>  48  ioWDDirID       long word
  12483.  
  12484.     PBOpenWD takes the directory specified by ioVRefNum, ioWDDirID, and
  12485. ioWDProcID and makes it a working directory. (You can also specify the
  12486. directory using a combination of partial pathname and directory ID.)  It
  12487. returns a working directory reference number in ioVRefNum that can be
  12488. used in subsequent calls.
  12489.  
  12490.     If a given directory has already been made a working directory using
  12491. the same ioWDProcID, no new working directory will be opened; instead,
  12492. the existing working directory reference number will be returned. If a
  12493. given directory was already made a working directory using a different
  12494. ioWDProcID, a new working directory reference number is returned.
  12495.  
  12496. Result codes    noErr       No error
  12497.                 tmwdoErr    Too many working directories open
  12498. \ PBCloseWD
  12499. 17
  12500. FUNCTION PBCloseWD (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  12501.  
  12502. Trap macro  _CloseWD
  12503.  
  12504. Parameter block
  12505.     ╤>  12  ioCompletion    pointer
  12506.     <╤  16  ioResult        word
  12507.     ╤>  22  ioVRefNum       word
  12508.  
  12509.     PBCloseWD releases the working directory whose working directory
  12510. reference number is specified in ioVRefNum.
  12511.  
  12512. Note:  If a volume reference number is specified in ioVRefNum, PBCloseWD
  12513.        does nothing.
  12514.  
  12515. Result codes    noErr   No error
  12516.                 nsvErr  No such volume
  12517. \ PBGetWDInfo
  12518. 17
  12519. FUNCTION PBGetWDInfo (paramBlock: WDPBPtr; async: BOOLEAN) : OSErr;
  12520.  
  12521. Trap macro  _GetWDInfo
  12522.  
  12523. Parameter block
  12524.     ╤>  12  ioCompletion    pointer
  12525.     <╤  16  ioResult        word
  12526.     <╤  18  ioNamePtr       pointer
  12527.     <╨> 22  ioVRefNum       word
  12528.     ╤>  26  ioWDIndex       word
  12529.     <╨> 28  ioWDProcID      long word
  12530.     <╨> 32  ioWDVRefNum     word
  12531.     <╤  48  ioWDDirID       long word
  12532.  
  12533.     PBGetWDInfo returns information about the specified working
  12534. directory. The working directory can be specified either by its working
  12535. directory reference number in ioVRefNum (in which case ioWDIndex should
  12536. be 0), or by its index number in ioWDIndex. In the latter case, if
  12537. ioVRefNum is nonzero, it╒s interpreted as a volume specification (volume
  12538. reference number or drive number), and only working directories on that
  12539. volume are indexed.
  12540.  
  12541.     IOWDVRefNum always returns the volume reference number. IOVRefNum
  12542. returns a working directory reference number when a working directory
  12543. reference number is passed in that field; otherwise, it returns a volume
  12544. reference number. The volume name is returned in ioNamePtr.
  12545.  
  12546.     If IOWDProcID is nonzero, only working directories with that
  12547. identifier are indexed; otherwise all working directories are indexed.
  12548.  
  12549. Result codes    noErr   No error
  12550.                 nsvErr  No such volume
  12551. \ PrOpen
  12552. 18
  12553. PROCEDURE PrOpen;
  12554.  
  12555.     PrOpen prepares the Printing Manager for use. It opens the Printer
  12556. Driver and the printer resource file. If either of these items is
  12557. missing, or if the printer resource file is not properly formed, PrOpen
  12558. will do nothing, and PrError will return a Resource Manager result
  12559. code.
  12560. \ PrClose
  12561. 18
  12562. PROCEDURE PrClose;
  12563.  
  12564.     PrClose releases the memory used by the Printing Manager. It closes
  12565. the printer resource file, allowing the file's resource map to be
  12566. removed from memory. It *** currently *** doesn't close the Printer
  12567. Driver, however, since the driver may have been opened before the
  12568. PrOpen call was issued.
  12569. \ PrintDefault
  12570. 18
  12571. PROCEDURE PrintDefault (hPrint: THPrint);
  12572.  
  12573.     PrintDefault fills the fields of a print record with the current
  12574. default values stored in the printer resource file. HPrint is a handle
  12575. to the record, which may be a new print record that you've just
  12576. allocated or an existing one (from a document, for example).
  12577. \ PrValidate
  12578. 18
  12579. FUNCTION PrValidate (hPrint: THPrint) : BOOLEAN;
  12580.  
  12581.     PrValidate checks the contents of a print record for compatibility
  12582. with the current version of the Printing Manager and with the installed
  12583. printer. If the record is valid, the function returns FALSE (no
  12584. change); if invalid, the record is adjusted to the current default
  12585. values, taken from the printer resource file, and the function returns
  12586. TRUE.
  12587.  
  12588.     PrValidate also updates the print record to reflect the current
  12589. settings in the style and job subrecords. These changes have no effect
  12590. on the function's Boolean result.
  12591. \ PrStlDialog
  12592. 18
  12593. FUNCTION PrStlDialog (hPring: THPrint) : BOOLEAN;
  12594.  
  12595.     PrStlDialog conducts a style dialog with the user to determine the
  12596. paper size and paper orientation being used. The initial settings
  12597. displayed in the dialog box are taken from the current values in the
  12598. print record. If the user confirms the dialog, the results of the
  12599. dialog are saved in the print record and the function returns TRUE;
  12600. otherwise the print record is left unchanged and the function returns
  12601. FALSE.
  12602.  
  12603. (note)
  12604.     If the print record was taken from a document, you should
  12605.     update its contents in the document's file if PrStlDialog
  12606.     returns TRUE. This makes the results of the style dialog
  12607.     "stick" to the document.
  12608. \ PrJobDialog
  12609. 18
  12610. FULNCTION PrJobDialog (hPrint: THPrint) : BOOLEAN;
  12611.  
  12612.     PrJobDialog conducts a job dialog with the user to determine the
  12613. printing quality, number of pages to print, and so on. The initial
  12614. settings displayed in the dialog box are taken from the current values
  12615. in the print reord. If the user confirms the dialog, both the print
  12616. record and the printer resource file are updated (so that the user's
  12617. choices "stick" to the printer) and the function returns TRUE;
  12618. otherwise the print record and printer resource file are left unchanged
  12619. and the function returns FALSE.
  12620.  
  12621. (note)
  12622.     If the job dialog is associated with your application's
  12623.     Print command, you should proceed with the requested
  12624.     printing operation id PrJobDialog returns TRUE. If the
  12625.     print record was taken form a document, you should update
  12626.     its contents in the document's file.
  12627. \ PrJobMerge
  12628. 18
  12629. PROCEDURE PrJobMerge (hPringSrc,hPrintDst: THPrint):
  12630.  
  12631.     PrJobMerge copies the job subrecord from one print record
  12632. (hPrintSrc) to another (hPrintDst) and updates the destination record's
  12633. printer information, band information, and paper rectangle, based on
  12634. information in the job subrecord. This allows the information in the
  12635. job subrecord to be used for a group of related jobs.
  12636. \ PrOpenDoc
  12637. 18
  12638. FUNCTION PrOpenDoc (hPrint: THPrint; pPrPort: TPPrPort; pIOBuf: Ptr)
  12639.         : TPPrPort;
  12640.  
  12641.     PrOpenDoc initializes a printing port for use in printing a document
  12642. makes it the current port, and returns pointer to it. HPrint is a
  12643. handle to the print record for this printing operation. The printing
  12644. port is customized for draft printing or spooling, depending on the
  12645. setting of th bJDocLoop field in the job subrecord. For spooling, the
  12646. spool file's name, volume reference number, and version number are
  12647. taken from the job subrecord.
  12648.  
  12649.     PPrPort is a pointer to the storage to be used for the printing
  12650. port. If this parameter is NIL, PrOpenDoc will allocate a new printing
  12651. port for you. Similarly, pIOBuf points to an area of memory to be used
  12652. as an input/output buffer; if it's NIL, PrOpenDoc will use the volume
  12653. buffer for the spool file's volume.
  12654.  
  12655. (note)
  12656.     The pPrPort and pIOBuf parameters are provided because
  12657.     both the printing port and the input/output buffer are
  12658.     nonrelocatable objects. To avoid cluttering the heap
  12659.     with such objects, you have the opportunity to allocate
  12660.     them yourself and pass them to PrOpenDoc. Most of the
  12661.     time you'll just set both of these parameters to NIL.
  12662.  
  12663. (note)
  12664.     Newly created printing ports use the system font (since
  12665.     they're grafPorts), but newly created windows use the
  12666.     application font. Be sure the font you use in the
  12667.     printing port is the same as the font in your application
  12668.     window if yuou want the text in both places to match.
  12669. \ PrOpenPage
  12670. 18
  12671. PROCEDURE PrOpenPage (pPrPort: TPPrPort; pPageFrame: TPRect);
  12672.  
  12673.     PrOpenPage begins a new page in the document associated with the
  12674. given printing port. The page is printed only if it falls within the
  12675. page range designated in the job subrecord.
  12676.  
  12677.     For spooling, the pPageFrame parameter points to a rectangle that
  12678. will be used as the QuickDraw picture frame for this page:
  12679.  
  12680.     TYPE TPRect = ^Rect;
  12681.  
  12682.     When the spool file is later printed, this rectangle will be scaled
  12683. (via the QuickDraw DrawPicture procedure) to coincide with the page
  12684. rectangle in the printer ilnformation subrecord. Unless you want the
  12685. printout to be scaled, you should set pPageFrame to NIL--this uses the
  12686. curret page rectangle as the picture frame, and the page will be
  12687. printed with no scaling.
  12688. \ PrClosePage
  12689. 18
  12690. PROCEDURE PrClosePage (pPrPort: TPPrPort);
  12691.  
  12692.     PrClosePage finishes up the current page of the document associated
  12693. with the given printing port. For draft printing, it ejects the page
  12694. from the printer and, if necessary, alerts the user to insert another;
  12695. for spooling, it closes the picture representing the current page.
  12696. \ PrCloseDoc
  12697. 18
  12698. PROCEDURE PrCloseDoc (pPrPort: TPPrPort);
  12699.  
  12700.     PrCloseDoc finishes up the printing of the document associated with
  12701. the given printing port. For draft printing, it issues a form feed and
  12702. a reset command to the printer; for spooling, it closes the file if the
  12703. spooling was successfully completed or deletes it the file if the
  12704. spooling was unsuccessful.
  12705. \ PrPicFile
  12706. 18
  12707. PROCEDURE PrPicFile (hPrint: THPrint; pPrPort: TPPrPort; pIOBuf: Ptr;
  12708.         pDevBuf: Ptr; VAR prStatus: TPrStatus);
  12709.  
  12710.     PrPicFile images and prints a spool file. HPrint is a handle to the
  12711. print record for this printing operation. The name, volume reference
  12712. number, and version number of the spool file will be taken from the job
  12713. subrecord of this print record. After printing is successfully
  12714. completed, the Printing Manager deletes the spool file from the disk.
  12715.  
  12716.     PPrPort is a pointer to the storage to be used for the printing port
  12717. for this operation. If this parameter is NIL, PrPicFile will allocate
  12718. its own printing port. Similarly, pIOBuf points to an area of memory
  12719. to be used as an input/output buffer for reading the spool file; if
  12720. it's NIL, PrPicFile will use the volume buffer for the spool file's
  12721. volume. PDevBuf points to a similar buffer (the "band buffer") for
  12722. holding the bit image to be printed; ifNIL, PrPicFile will allocate
  12723. its own buffer from the heap. As for PrOpenDoc, you'll normally want
  12724. to set all of these storage parameters to NIL.
  12725.  
  12726. (note)
  12727.     If you provide your own storage for pDevBuf, it has to be
  12728.     big enough to hold the number of bytes indicated by the
  12729.     iDevBytes field of the TPrXInfo subrecord of the print
  12730.     record.
  12731.  
  12732. (warning)
  12733.     Be sure not to pass, in pPrPort, a pointer to the same
  12734.     printing port you received from PrOpenDoc, the one you
  12735.     originally used to spool the file. If that earlier port
  12736.     was allocated by PrOpenDoc itself (that is, if the
  12737.     pPrPort parameter to PrOpenDoc was NIL), then PrCloseDoc
  12738.     will have disposed of the port, making your pointer to it
  12739.     invalid. PrPicFile initializes a fresh printing port of
  12740.     its own; you just provide the storage (or let PrPicFIle
  12741.     allocate it for itself). Of course, if you earlier
  12742.     provided your own storage to PrOpenDoc, there's no reason
  12743.     you can't use the same storage again for PrPicFile.
  12744.  
  12745.     The prStatus parameter is a printer status record that PrPicFile
  12746. will use to report on its progress. Your background procedure (if any)
  12747. can use this record to monitor the state of the printing operation.
  12748. \ PrError
  12749. 18
  12750. FUNCTION PrError : INTEGER; [Pascal only]
  12751.  
  12752.     PrError returns the result code returned by the last Printing
  12753. Manager routine. The possible result codes are:
  12754.  
  12755.     CONST noErr       = 0;     {no error}
  12756.           iMemFullErr = -108;  {not enough heap space}
  12757.  
  12758.     and any Resource Manager result code. A result code of iMemFullErr
  12759. means that the Memory Manager was unable to fulfill a memory allocation
  12760. request by the Printing Manager.
  12761. \ PrSetError
  12762. 18
  12763. PROCEDURE PrSetError (iErr: INTEGER); [Pascal Only]
  12764.  
  12765.     PrSetError stores the specified value into the global variable where
  12766. the Printing Manager keeps its result code. The main *** (currently
  12767. the only) *** use of this procedure is for canceling a printing
  12768. operation in progress. To do this, write
  12769.  
  12770.     PrSetError(iPrAbort)
  12771.  
  12772. where iPrAbort is the following predefined constant:
  12773.  
  12774.     CONST iPrAbort = 128;  {result code for halting printing}
  12775. \ PrDrvrOpen
  12776. 18
  12777. PROCEDURE PrDrvrOpen;
  12778.  
  12779.     PrDrvrOpen opens the Printer Driver.
  12780. \ PrDrvrClose
  12781. 18
  12782. PROCEDURE PrDrvrClose;
  12783.  
  12784.     PrDrvrClose closes the Printer Driver.
  12785. \ PrCtlCall
  12786. 18
  12787. PROCEDURE PrCtlCall (iWhichCtl: INTEGER; lParam1,lParam2,lParam3):
  12788.                     LongInt);
  12789.  
  12790.     PrCtlCall calls the Printer Driver's control routine. IWhichCtl
  12791. designates the operation to be performed; the rest of the parameters
  12792. depend on the operation.
  12793. \ PrDrvrDCE
  12794. 18
  12795. FUNCTION PrDrvrDCE : Handle;
  12796.  
  12797.     PrDrvrDCE returns a handle to the Printer Driver's device control
  12798. entry.
  12799. \ PrDrvrVers
  12800. 18
  12801. FUNCTION PrDrvrVers : INTEGER;
  12802.  
  12803.     PrDrvrVers returns the version number of the Printer Driver in the
  12804. system resource file.
  12805.  
  12806.     The version number of the Printing Manager is available as the
  12807. predefined constant iPrRelease. You may want to compare the result of
  12808. PrDrvrVers with iPrRelease to see if the Printer Driver in the resource
  12809. file is the most recent version.
  12810. \ PrNoPurge
  12811. 18
  12812. PROCEDURE PrNoPurge;
  12813.  
  12814.     PrNoPurge prevents the Printer Driver from being purged from the
  12815. heap.
  12816. \ PrPurge
  12817. 18
  12818. PROCEDURE PrPurge;
  12819.  
  12820.     PrPurge allows the Printer Driver to be purged from the heap.
  12821. \ OpenDriver
  12822. 19
  12823. FUNCTION OpenDriver (name: Str255; VAR refNum: INTEGER) : OSErr;
  12824.  
  12825.     OpenDriver opens the device driver specified by name and returns its
  12826. reference number in refNum.
  12827.  
  12828.     Result codes    noErr           No error
  12829.                     badUnitErr      Bad reference number
  12830.                     dInstErr        Couldn't find driver in resource
  12831.                                     file
  12832.                     openErr         Driver cannot perform the
  12833.                                     requested reading or writing
  12834.                     unitEmptyErr    Bad reference number
  12835. \ CloseDriver
  12836. 19
  12837. FUNCTION CloseDriver (refNum: INTEGER) : OSErr;
  12838.  
  12839.     CloseDriver closes the device driver having the reference number
  12840. refNum. Any pending I/O is completed, and the memory used by the
  12841. driver is released.
  12842.  
  12843.  
  12844.     Result codes    noErr           No error
  12845.                     badUnitErr      Bad reference number
  12846.                     dRemoveErr      Tried to remove an open driver
  12847.                     unitEmptyErr    Bad reference number
  12848. \ FSRead
  12849. 19
  12850. FUNCTION FSRead (refNum: INTEGER; VARcount: LongInt; buffPtr: Ptr) :
  12851.         OSErr;
  12852.  
  12853.     FSRead attempts to read the number of bytes specified by the count
  12854. parameter from the device driver having the reference number refNum,
  12855. and transfer them to the data buffer pointed to by buffPtr. After the
  12856. read operation is completed, the number of bytes actually read is
  12857. returned in the count parameter.
  12858.  
  12859.  
  12860.     Result codes    noErr           No error
  12861.                     badUnitErr      Bad reference number
  12862.                     notOpenErr      Driver isn't open
  12863.                     unitEmptyErr    Bad reference number
  12864.                     readErr         Driver can't respond to Read
  12865.                                     calls
  12866. \ FSWrite
  12867. 19
  12868. FUNCTION FSWrite (refNum: INTEGR; VARcount: LongInt; buffPtr: Ptr) :
  12869.                     OSErr;
  12870.  
  12871.     FSWrite attempts to take the number of bytes specified by the count
  12872. parameter from the buffer pointed to by buffPtr and write them to the
  12873. open device driver having the reference number refNum. After the write
  12874. operation is completed, the number of bytes actually written is
  12875. returned in the count parameter.
  12876.  
  12877.     Result codes    noErr           No error
  12878.                     badUnitErr      Bad reference number
  12879.                     notOpenErr      Driver isn't open
  12880.                     unitEmptyErr    Bad reference number
  12881.                     writErr         Driver can't respond to Write
  12882.                                     calls
  12883. \ Control
  12884. 19
  12885. FUNCTION COntrol (refNum: INTEGER; csCode: INTEGER; csParam: Ptr):
  12886.         OSErr;
  12887.  
  12888.     Control sends control information to the device driver haaving the
  12889. reference number refNum. The type of information sent is specified by
  12890. csCode, and the ilnformation itself is pointed to by csParam. The
  12891. values passed in csCode and pointed to by csParam depend on the driver
  12892. being called.
  12893.  
  12894.  
  12895.     Result codes    noErr           No error
  12896.                     badUnitErr      Bad reference number
  12897.                     notOpenErr      Driver isn't open
  12898.                     unitEmptyErr    Bad reference number
  12899.                     controlErr      Driver can't respond to this
  12900.                                     Control call
  12901.  
  12902.  
  12903.  
  12904. \ Status
  12905. 19
  12906. FUNCTION Status (refNum: INTEGER; csCode: INTEGER; csParam: Ptr) :
  12907.         OSErr;
  12908.  
  12909.     Status returns status information about the device driver having the
  12910. reference number refNum. The type of information returned is specified
  12911. by csCode, and the information itself is pointed to by csParam. The
  12912. values passed in csCode and pointed to by csParam depend on the driver
  12913. being called.
  12914.  
  12915.     Result codes    noErr           No error
  12916.                     badUnitErr      Bad reference number
  12917.                     notOpenErr      Driver isn't open
  12918.                     unitEmptyErr    Bad reference number
  12919.                     statusErr       Driver can't respond to this
  12920.                                     Status call
  12921. \ KillIO
  12922. 19
  12923. FUNCTION KillIO (refNum: INTEGER) : OSErr;
  12924.  
  12925.     KillIO terminates all current and pending I/O with the device driver
  12926. having the reference number refNum.
  12927.  
  12928.     Result codes    noErr           No error
  12929.                     badUnitErr      Bad reference number
  12930.                     unitEmptyErr    Bad reference number
  12931.                     controlErr      Driver can't respond to KillIO
  12932.                                     calls
  12933.  
  12934. (note)
  12935.     KillIO is actually a special type of PBControl call, and
  12936.     all information aabout PBControl calls applies equally to
  12937.     KillIO.
  12938. \ PBOpen
  12939. 19
  12940. FUNCTION PBOpen (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12941.  
  12942.     Trap macro  _Open
  12943.  
  12944.     Parameter block
  12945.         --> 12  ioCompletion    pointer
  12946.         <-- 16  ioResult    word
  12947.         --> 18  ioNamePtr   pointer
  12948.         <-- 24  ioRefNum    word
  12949.         --> 27  ioPermssn   byte
  12950.  
  12951.     Result codes    noErr           No error
  12952.                     badUnitErr      Bad reference number
  12953.                     dInstErr        Couldn't find driver in resource
  12954.                                     file
  12955.                     openErr         Driver cannot perform the
  12956.                                     requested reading or writing
  12957.                     unitEmptyErr    Bad reference number
  12958.  
  12959.  
  12960.     PBOpen opens the device driver specified by ioNamePtr and returns
  12961. its reference number in ioRefNum. IOPermssn specifies the requested
  12962. read/write permission.
  12963. \ PBClose
  12964. 19
  12965. FUNCTION PBCLose (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12966.  
  12967.     Trap macro  _Close
  12968.  
  12969.     Parameter block
  12970.         --> 12  ioCompletion    pointer
  12971.         <-- 16  ioResult    word
  12972.         --> 24  ioRefNum    word
  12973.  
  12974.     Result codes    noErr           No error
  12975.                     badUnitErr      Bad reference number
  12976.                     dRemoveErr      Tried to remove an open driver
  12977.                     unitEmptyErr    Bad reference number
  12978.  
  12979.  
  12980.     PBClose closes the device driver having the reference number
  12981. ioRefNum. Any pending I/O is completed, and the memory used by the
  12982. driver is released.
  12983. \ PBRead
  12984. 19
  12985. FUNCTION PBRead (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  12986.  
  12987.     Trap macro  _Read
  12988.  
  12989.     Parameter block
  12990.         --> 12  ioCompletion    pointer
  12991.         <-- 16  ioResult    word
  12992.         --> 24  ioRefNum    word
  12993.         --> 32  ioBuffer    pointer
  12994.         --> 36  ioReqCount  long word
  12995.         <-- 40  ioActCount  long word
  12996.         --> 44  ioPosMode   word
  12997.         <-> 46  ioPosOffset long word
  12998.  
  12999.  
  13000.  
  13001.  
  13002.     Result codes    noErr           No error
  13003.                     badUnitErr      Bad reference number
  13004.                     notOpenErr      Driver isn't open
  13005.                     unitEmptyErr    Bad reference number
  13006.                     readErr         Driver can't respond to Read
  13007.                                     calls
  13008.  
  13009.     PBRead attempts to read ioReqCount bytes from the device driver
  13010. having the reference number ioRefNum, and transfer them to the data
  13011. buffer pointed to by ioBuffer. After the read operation is completed,
  13012. the number of bytes actually read is returned in ioActCount.
  13013.  
  13014. Advanced programmers:  If the driver is reading from a block device,
  13015.                        the byte offset from the position indicated by
  13016.                        ioPosMode, where the read should actually betwin,
  13017.                        is given by ioPosOffset.
  13018. \ PBWrite
  13019. 19
  13020. FUNCTION PBWrite (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  13021.  
  13022.     Trap macro  _Write
  13023.  
  13024.     Parameter block
  13025.         --> 12  ioCompletion    pointer
  13026.         <-- 16  ioResult    word
  13027.         --> 24  ioRefNum    word
  13028.         --> 32  ioBuffer    pointer
  13029.         --> 36  ioReqCount  long word
  13030.         <-- 40  ioActCount  long word
  13031.         --> 44  ioPosMode   word
  13032.         --> 46  ioPosOffset long word
  13033.  
  13034.     Result codes    noErr       No error
  13035.             badUnitErr  Bad reference number
  13036.             notOpenErr  Driver isn't open
  13037.             unitEmptyErr    Bad reference number
  13038.             writErr Driver  can't respond to Write
  13039.                     calls
  13040.  
  13041.     PBWrite attempts to take ioReqCount bytes from the buffer pointed to
  13042. by ioBuffer and write them to the device driver having the reference
  13043. number ioRefNum. After the write operation is completed, the number of
  13044. bytes actually written is returned in ioActCount.
  13045.  
  13046. Advanced programmers:  If the driver is writing to a block device,
  13047.                        ioPosMode indicates whether the write should
  13048.                        begin relative to the beginning of the device or
  13049.                        the current position. The byte offset from the
  13050.                        position indicated by ioPosMode, where the write
  13051.                        should actually begin, is given by ioPosOffset.
  13052. \ PBControl
  13053. 19
  13054. FUNCTION PBControl (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  13055.  
  13056.     Trap macro  _Control
  13057.  
  13058.     Parameter block
  13059.         --> 12  ioCompletion    pointer
  13060.         <-- 16  ioResult    word
  13061.         --> 24  ioRefNum    word
  13062.         --> 26  csCode      word
  13063.         --> 28  csParam     record
  13064.  
  13065.     Result codes    noErr           No error
  13066.                     badUnitErr      Bad reference number
  13067.                     notOpenErr      Driver isn't open
  13068.                     unitEmptyErr    Bad reference number
  13069.                     controlErr      Driver can't respond to this
  13070.                                     Control call
  13071.  
  13072.  
  13073.     PBControl sends control information to the device driver having the
  13074. reference number ioRefNum. The type of information sent is specified
  13075. by csCode, and the information itself begins at csParam. The values
  13076. passed in csCode and csParam depend on the driver being called.
  13077. \ PBStatus
  13078. 19
  13079. FUNCTION PBStatus (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  13080.  
  13081.     Trap macro  _Status
  13082.  
  13083.     Parameter block
  13084.         --> 12  ioCompletion    pointer
  13085.         <-- 16  ioResult    word
  13086.         --> 24  ioRefNum    word
  13087.         --> 26  csCode      word
  13088.         --> 28  csParam     record
  13089.  
  13090.     Result codes    noErr       No error
  13091.             badUnitErr  Bad reference number
  13092.             notOpenErr  Driver isn't open
  13093.             unitEmptyErr    Bad reference number
  13094.             statusErr   Driver can't respond to this
  13095.                     Status call
  13096.  
  13097.     PBStatus returns status information about the device driver having
  13098. the reference number ioRefNum. The type of information returned is
  13099. specified by csCode, and the information itself begins at csParam. The
  13100. values passed in csCode and csParam depend on the driver being called.
  13101. \ PBKillIO
  13102. 19
  13103. FUNCTION PBKillIO (paramBlock: ParmBlkPtr; async: BOOLEAN) : OSErr;
  13104.  
  13105.     Trap macro  _KillIO
  13106.  
  13107.     Parameter block
  13108.         --> 12  ioCompletion    pointer
  13109.         <-- 16  ioResult    word
  13110.         --> 24  ioRefNum    word
  13111.  
  13112.     Result codes    noErr       No error
  13113.             badUnitErr  Bad reference number
  13114.             unitEmptyErr    Bad reference number
  13115.             controlErr  Driver can't respond to KillIO
  13116.                     calls
  13117.  
  13118.     KillIO stops any current I/O request being processed, and removes
  13119. all pending I/O requests from the I/O queue of the device driver having
  13120. the reference number ioRefNum. The completion routine of each pending
  13121. I/O request is called, with ioResult equal to the following result code:
  13122.  
  13123.     CONST abortErr = -27;
  13124.  
  13125. (note)
  13126.     KillIO is actually a special type of Control call, and
  13127.     all information about Control calls applies equally to
  13128.     KillIO.
  13129. \ DiskEject
  13130. 20
  13131. FUNCTION DiskEject (drvNum: INTEGER) : OSErr;
  13132.  
  13133.     __________________________________________________________________
  13134.  
  13135.     Assembly-language note: DiskEject is equivalent to a Control
  13136.     call with csCode equivalent to the global constant ejectCode.
  13137.     __________________________________________________________________
  13138.  
  13139.     DiskEject ejects the disk from the internal drive if drvNum is 1, or
  13140. from the external drive if drvNum is 2.
  13141.  
  13142.     Result codes
  13143.  
  13144.             noErr       No error
  13145.             nsDrvErr    No such drive
  13146. \ SetTagBuffer
  13147. 20
  13148. FUNCTION SetTagBuffer (buffPtr: Ptr) : OSErr;
  13149.  
  13150.     __________________________________________________________________
  13151.  
  13152.     Assembly-language note:  SetTagBuffer is equivalent to a Control
  13153.     call with csCode = 8.
  13154.     __________________________________________________________________
  13155.  
  13156.     An application can change the information used in the file tags
  13157. buffer by calling SetTagBuffer. The buffPtr parameter points to a
  13158. buffer that contains the information to be used. If buffPtr is NIL, the
  13159. information in the file tags buffer isn't changed.
  13160.  
  13161.     If buffPtr isn't NIL, every time the Disk Driver reads a sector from
  13162. the disk, it stores the file tags in the file tags buffer
  13163. by calling SetTagBuffer. The buffPtr parameter points to a buffer that
  13164. contains the information to be used. If buffPtr is NIL, the
  13165. information in the file tags buffer isn't changed.
  13166.  
  13167.     The contents of the buffer pointed to by buffPtr are overwritten at
  13168. the end of every read request (which can be composed of a number of
  13169. sectors) instead of at the end of every sector. Each read request
  13170. places 12 bytes in the buffer for each sector, always beginning at the
  13171. start of the buffer. This way an application can examine the file tags
  13172. for a number of sequentially read sectors. If a read request is
  13173. composed of a number of sectors, the Disk Driver reads 12 bytes from
  13174. the buffer for each sector. For example, for a read request of five
  13175. sectors, the Disk Driver will read 60 bytes from the buffer.
  13176.  
  13177.     __________________________________________________________________
  13178.  
  13179.     Assembly-language note:  An assembly-language program can change
  13180.     the information used in the file tags buffer by storing a
  13181.     pointer to the buffer containing the information in the global
  13182.     variable TagBufPtr. If TagBufPtr is 0, the information in the
  13183.     file tags buffer isn't changed.
  13184.     __________________________________________________________________
  13185.  
  13186.     Result codes
  13187.  
  13188.             noErr       No error
  13189. \ DriveStatus
  13190. 20
  13191. FUNCTION DriveStatus (drvNum: INTEGER; VAR status: DrvSts) : OSErr;
  13192.  
  13193.     _________________________________________________________________
  13194.  
  13195.     Assembly-language note:  DriveStatus is equivalent to a Status
  13196.     call with csCode equivalent to teh globval constant drvStsCode.
  13197.     _________________________________________________________________
  13198.  
  13199.     DriveStatus returns information about the internal drive if drvNum
  13200. is 1, or about the external drive if drvNum is 2. The information is
  13201. returned in a record of type DrvSts:
  13202.  
  13203. TYPE DrvSts = RECORD
  13204.         track:      INTEGER;     {current track}
  13205.         writeProt:  SignedByte;  {bit 7=1 if volume is locked}
  13206.         diskInPlace:    SignedByte;  {disk in place}
  13207.         installed:  SignedByte;  {drive installed}
  13208.         sides:      SignedByte;  {bit 7=0 if single-sided drive}
  13209.         qLink:      QElmPtr;     {next queue entry}
  13210.         qType:      INTEGER;     {not used}
  13211.         dqDrive:    INTEGER;     {drive number}
  13212.         dqRefNum:   INTEGER;     {driver reference number}
  13213.         dqFSID:     INTEGER;     {file-system identifier}
  13214.         twoSideFmt: SignedByte;  {-1 if two-sided disk}
  13215.         needsFlush: SignedByte;  {reserved}
  13216.         diskErr:    INTEGER;     {error count}
  13217.       END;
  13218.  
  13219.     The diskInPlace field is 0 if there's no disk in the drive, 1 or 2
  13220. if there is a disk in the drive, or -4 to -1 if the disk was ejected in
  13221. the last 1.5 seconds. The installed field is 1 if the drive might be
  13222. connected to the Macintosh, and -1 if the drive isn't installed. 
  13223. The value oftwoSideFmt is valid only when diskInPlace = 2. The value
  13224. of diskErrs is incremented every time an error occurs internally within
  13225. the Disk Driver.
  13226.  
  13227.     Result codes
  13228.  
  13229.             noErr       No error
  13230.             nsDrvErr    No such drive
  13231. \ StartSound
  13232. 21
  13233. PROCEDURE StartSound (synthRec: Ptr; numBytes: LONGINT; completionRtn:
  13234.         ProcPtr);
  13235.  
  13236.     StartSound begins producing the sound(s) described by the
  13237. synthesizer buffer pointed to by synthRec. NumBytes indicates the
  13238. length of the synthesizer buffer (in bytes), and completionRtn points to
  13239. a completion routine to be executed when the sound finishes:
  13240.  
  13241.     - If completionRtn is POINTER(-1), the sound will be produced
  13242.       synchronously.
  13243.  
  13244.     - If completionRtn is NIL, the sound will be produced
  13245.       asynchronously, but no completion routine will be executed.
  13246.  
  13247.     - Otherwise, the sound will be produced asynchronously and the
  13248.       routine pointed to by completionRtn will be executed when the
  13249.       sound finishes.
  13250.  
  13251. (warning)
  13252.     You may want the completion routine to start the next
  13253.     sound when one sound finishes, but beware:  Completion
  13254.     routines are executed at the interrupt level, and
  13255.     shouldn't make any calls to the Memory Manager. Be sure
  13256.     to preallocate all the space you'll need. Or, instead of
  13257.     using a completion routine to start the next sound, the
  13258.     completion routine can post an application-defined event
  13259.     and your application's main event lop can start the next
  13260.     sound when it gets the event.
  13261.  
  13262.     Because the type of pointer for each type of synthesizer buffer is
  13263. different and the type of the synthRec parameter is Ptr, you'll need to
  13264. do something like the following example (which applies to the free-form
  13265. synthesizer):
  13266.  
  13267.     VAR myPtr: Ptr;
  13268.         myHandle: Handle;
  13269.         myFFPtr: FFSynthPtr;
  13270.         ...
  13271.     myHandle := NewHandle(buffSize);     {allocate space for the buffer}
  13272.     HLock(myHandle);             {lock the buffer}
  13273.     myPtr := myHandle^;          {dereference the handle}
  13274.     myFFPtr := FFSynthPtr(myPtr);        {coerce type to FFSynthPtr}
  13275.     myFFPtr^.mode := ffMode;         {identify the synthesizer}
  13276.     ...                  {fill the buffer with values}
  13277.                          {describing the sound}
  13278.     StartSound(myPtr,buffSize,POINTER(-1));    {produce the sound}
  13279.     HUnlock(myHandle)              {unlock the buffer}
  13280.  
  13281. where buffSize is the length of the synthesizer record.
  13282.  
  13283. The sounds are generated as follows:
  13284.  
  13285.     - Free-form synthesizer:  The magnitudes described by each byte in
  13286.       the waveform description are genereated sequentially until the
  13287.       number of bytes specified by the numBytes paramaeter have been
  13288.       written.
  13289.  
  13290.     - Square-wave synthesizer:  The sounds described by each sound
  13291.       triplet are generaed sequentially until either the end of the
  13292.       buffer has been reached (indicated by a count, amplitude, and
  13293.       duration of 0 in the square-wave buffer), or the number of bytes
  13294.       specified by the numBytes parameter have been written.
  13295.  
  13296.     - Four-tone synthesizer:  All four sounds are generated for the
  13297.       length of time specified by the duration integer in the four-tone
  13298.       record.
  13299. \ StopSound
  13300. 21
  13301. PROCEDURE StopSound;
  13302.  
  13303.     StopSound immediately stops the current StartSound call (if any),
  13304. executes the current StartSound call's completion routine (if any), and
  13305. cancels any pending asynchrounous StartSound calls.
  13306. \ SoundDone
  13307. 21
  13308. FUNCTION SoundDone : BOOLEAN;
  13309.  
  13310.     SoundDone returns TRUE if the Sound Driver isn't currently producing
  13311. sound and there are no asynchronous StartSound calls pending; otherwise
  13312. it returns FALSE.
  13313. \ GetSoundVol
  13314. 21
  13315. PROCEDURE GetSoundVol (VAR level: INTEGER);
  13316.  
  13317.     GetSoundVol returns the current speaker volume, from 0 (silence) to
  13318. 7 (loudest).
  13319.  
  13320.     __________________________________________________________________
  13321.  
  13322.     Assembly-language note:  To set the speaker volume level from
  13323.     assembly language, call this Pascal routine from your program.
  13324.     As a side effect, it will set the low-order three bits of the
  13325.     global variable SdVolume to the specified level.
  13326.     __________________________________________________________________
  13327.  
  13328. (note)
  13329.     Your program shouldn't change the speaker volume unless
  13330.     it's a Control Panel-like desk accessory, since it's
  13331.     really up to the user to choose the desired volume level
  13332.     via the Control Panel.
  13333. \ RAMSDOpen
  13334. 22
  13335. FUNCTION RAMSDOpen (whichPort: SPortSel; rsrcType: OSType; rsrcID:
  13336.         INTEGER) : OSErr;
  13337.  
  13338.     RAMSDOpen closes the ROM Serial Driver and opens the RAM input and
  13339. output drivers for the port identified by the whichPort parameter,
  13340. which must be a member of the SPortSel set:
  13341.  
  13342.     TYPE SPortSel = (sPortA, {modem port}
  13343.              sPortB  {printer port});
  13344.  
  13345.     RsrcType and rsrcID indicate the resource type and resource ID of
  13346. the RAM Serial Driver, which should be stored in your application's
  13347. resource file. (OSType is an Operating System Utility data type
  13348. declared the same as ResType in the Resource Manager.)
  13349.  
  13350.     Result codes
  13351.  
  13352.             noErr       No error
  13353.             openErr     Can't open driver
  13354. \ RAMSDClose
  13355. 22
  13356. PROCEDURE RAMSDClose (whichPort: SPortSel);
  13357.  
  13358.     RAMSDClose closes the RAM input and output drivers for the port
  13359. identified by the whichPort parameter, which must be a member of the
  13360. SPortSel set (defined int eh description of RAMSDOpen above).
  13361. \ SerReset
  13362. 22
  13363. FUNCTION SerReset (refNum: INTEGER; serConfig: INTEGER) : OSErr;
  13364.  
  13365.     SerReset resets and reinitializeds the input or output driver having
  13366. the reference number refNum according to the information in serConfig.
  13367. Figure 3 shows the format of serConfig.
  13368.  
  13369.     You can use the following predefined constants to set the values of
  13370. various bits of serConfig:
  13371.  
  13372. CONST   baud300     = 380;      {300 baud}
  13373.         baud600     = 189;      {600 baud}
  13374.         baud1200    = 94;       {1200 baud}
  13375.         baud1800    = 62;       {1800 baud}
  13376.         baud2400    = 46;       {2400 baud}
  13377.         baud3600    = 30;       {3600 baud}
  13378.         baud4800    = 22;       {4800 baud}
  13379.         baud7200    = 14;       {7200 baud}
  13380.         baud9600    = 10;       {9600 baud}
  13381.         baud19200   = 4;        {19200 baud}
  13382.         baud57600   = 0;        {57600 baud}
  13383.         stop10      = 16384;    {1 stop bit}
  13384.         stop15      = -32768;   {1.5 stop bits}
  13385.         stop20      = -16384;   {2 stop bits}
  13386.         noParity    = 8192;     {no parity}
  13387.         oddParity   = 4096;     {odd parity}
  13388.         evenParity  = 12288;    {even parity}
  13389.         data5       = 0;        {5 data bits}
  13390.         data6       = 2048;     {6 data bits}
  13391.         data7       = 1024;     {7 data bits}
  13392.         data8       = 3072;     {8 data bits}
  13393.  
  13394.  
  13395.     For example, the default setting of 9600 baud, eight data bits, two
  13396. stop bits, and no parity bit is equivalent to baud9600+data8+stop20+
  13397. noParity.
  13398. \ SerSetBuf
  13399. 22
  13400. FUNCTION SerSetBuf (refNum: INTEGER; serBPtr: Ptr; serBLen: INTEGER) :
  13401.         OSErr;
  13402.  
  13403.     SerSetBuf specifies a new input buffer for the input driver having
  13404. the reference number refNum. SerBPtr points to the buffer, and serBLen
  13405. specifies the number of bytes in the buffer. If serBLen is 0, a
  13406. 64-byte default buffer provided by the driver is used.
  13407.  
  13408. (warning)
  13409.     You must lock this buffer while it's in use.
  13410.  
  13411.     __________________________________________________________________
  13412.  
  13413.     Assembly-language note: SerSetBuf is equivalent to a Control
  13414.     call with csCode=9, csParam=serBPtr, and csParam+2=serBLen.
  13415.     __________________________________________________________________
  13416.  
  13417.     Result codes    noErr       No error
  13418. \ SerHShake
  13419. 22
  13420. FUNCTION SerHShake (refNum: INTEGER; flags: SerShk) : OSErr;
  13421.  
  13422.     SerHShake sets handshake options and other control information, as
  13423. specified by the flags parameter, for the input or output driver having
  13424. the reference number refNum. The flags parameter has the following
  13425. data structure:
  13426.  
  13427.     TYPE SerShk = PACKED RECORD
  13428.             fXOn: Byte; {XOn/XOff output flow control flag}
  13429.             fCTS: Byte;     {CTS hardware handshake flag}
  13430.             xOn:  CHAR; {XOn character}
  13431.             xOff: CHAR; {XOff character}
  13432.             errs: Byte; {errors that cause abort}
  13433.             evts: Byte; {status changes that cause events}
  13434.             fInX: Byte; {XOn/XOff input flow control flag}
  13435.             null: Byte  {not used}
  13436.                END;
  13437.  
  13438.     If fXOn is nonzero, XOn/XOff output flow control is enabled; if fInX
  13439. is nonzero, XOn/XOff input flow control is enabled. XOn and xOff specify
  13440. the XOn character and XOff character used for XOn/XOff flow control.
  13441. If fCTS is nonzero, CTS hardware handshake is enabled. The errs field
  13442. indicates which errors will cause input requests to be aborted; for
  13443. each type of error, there's  a predefined constant in which the 
  13444. corresponding bit is set:
  13445.  
  13446.     CONST parityErr     = 16;   {set for parity error}
  13447.           hwOverrunErr  = 32;   {set for hardware overrun error}
  13448.           framingErr    = 64;   {set for framing error}
  13449.  
  13450. (note)
  13451.     The ROM Serial Driver doesn't support XOn/XOff input flow
  13452.     control or aborts caused by error conditions.
  13453.  
  13454.     The evts field indicates whether changes in the CTS or break status
  13455. will cause the Serial Driver to post device driver events; you can use
  13456. the following predefined constants to set or test the value of evts:
  13457.  
  13458.     CONST ctsEvent   = 32;  {set if CTS change will cause event to}
  13459.                 {be posted}
  13460.           breakEvent = 128; {set if break status change will cause}
  13461.                     {event to be posted}
  13462.  
  13463.  
  13464. (warning)
  13465.     Use of this option is discouraged because of the long
  13466.     time that interrupts are disabled while such an event is
  13467.     posted.
  13468.  
  13469.     ___________________________________________________________________
  13470.  
  13471.     Assembly-language note:  SerHShake is equivalent to a Control
  13472.     call with csCode=10 and csParam through csParam+6 equivalent to
  13473.     the fields of a variable of type SerShk.
  13474.     ___________________________________________________________________
  13475.  
  13476.     Result codes    noErr       No error
  13477. \ SerSetBrk
  13478. 22
  13479. FUNCTION SerSetBrk (refNum: INTEGER) : OSErr;
  13480.  
  13481. SerSetBrk sets break mode in the input or output driver having the
  13482. reference number refNum.
  13483.  
  13484.     ___________________________________________________________________
  13485.  
  13486.     Assembly-language note:  SerSetBrk is equivalent to a Control
  13487.     call with csCode=12.
  13488.     ___________________________________________________________________
  13489.  
  13490.     Result codes
  13491.  
  13492.             noErr       No error
  13493. \ SerClrBrk
  13494. 22
  13495. FUNCTION SerClrBrk (refNumk: INTEGER) : OSErr;
  13496.  
  13497.     SerClrBrk clears break mode in the inplut or output driver having
  13498. the reference number refNum.
  13499.  
  13500.     __________________________________________________________________
  13501.  
  13502.     Assembly-language note:  SerClrBrk is equivalent to a Control
  13503.     call with csCode=11.
  13504.     __________________________________________________________________
  13505.  
  13506.     Result codes
  13507.  
  13508.         noErr       No error
  13509. \ SerGetBuf
  13510. 22
  13511. FUNCTION SerGetBuf (refNum: INTEGER; VAR count: LONGILNT) ; OSErr;
  13512.  
  13513.     SerGetBuf returns, in the count parameter, the number of bytes in
  13514. the buffer of the input driver having the reference number refNum.
  13515.  
  13516.     ____________________________________________________________________
  13517.  
  13518.     Assembly-language note:  SerGetBuf is equivalent to a Status
  13519.     call with csCode=2. The number of bytes in the buffer is
  13520.     returned in csParam.
  13521.     ____________________________________________________________________
  13522.  
  13523.     Result codes
  13524.  
  13525.         noErr       No error
  13526. \ SerErrFlag
  13527. 22
  13528. FUNCTION SerErrFlag (refNum: INTEGER; VAR serSta: SerStaRec) : OSErr;
  13529.  
  13530.     SerErrFlag returns in serSta three words of status information for
  13531. the input or output driver having the reference number refNum. The
  13532. serSta parameter has the following data structure:
  13533.  
  13534.     TYPE SerStaRec = PACKED RECORD
  13535.                cumErrs:   Byte; {cumulative errors}
  13536.                xOffSent:  Byte; {XOff sent as input flow}
  13537.                         { control}
  13538.                rdPend:    Byte; {read pending flag}
  13539.                wrPend:    Byte;     {write pending flag}
  13540.                ctsHold:   Byte; {CTS flow control hold flag}
  13541.                xOffHold:  Byte; {XOff received as output}
  13542.                             { flow control}
  13543.              END;
  13544.  
  13545.     CumErrs indicates which errors have occurred since the last time
  13546. SerErrFlag was called:
  13547.  
  13548.        CONST swOverrunErr = 1;  {set for software overrun error}
  13549.          parityErr    = 16; {set for parity error}
  13550.          hwOverrunErr = 32; {set for hardware overrun error}
  13551.          framingErr   = 64; {set for framing error}
  13552.  
  13553.  
  13554.     If the driver has sent an XOff character, xOffSent will be equal to
  13555. the following predefined constant:
  13556.  
  13557.     CONST xOffWasSent = $80;    {XOff character was sent}
  13558.  
  13559.     If the driver has a Read or Write call pending, rdPend or wrPend,
  13560. respectively, will be nonzero. If output has been suspended because
  13561. the hardware handshake was negated, ctsHold will be nonzero. If output
  13562. has been suspended because an XOff character was received, xOffHold
  13563. will be nonzero.
  13564.  
  13565.     __________________________________________________________________
  13566.  
  13567.     Assembly-language note:  SerStatus is equivalent to a Status
  13568.     call with csCode=8. The status information is returned in
  13569.     csParam through csParam+5.
  13570.     __________________________________________________________________
  13571.  
  13572.     Result codes    noErr       No error
  13573. \ MPPOpen
  13574. 23
  13575. FUNCTION MPPOpen : OSErr;  [Not in ROM]
  13576.  
  13577. MPPOpen first checks whether the .MPP driver is already loaded; if it
  13578. is, MPPOpen does nothing and returns noErr. If MPP hasn't been loaded,
  13579. MPPOpen attempts to load it into the system heap. If it succeeds, it
  13580. then initializes the driver's variables and goes through the process of
  13581. dynamically assigning a node ID to that Macintosh. On a Macintosh 512K
  13582. or XL, it also loads the .ATP driver and NBP code into the system heap.
  13583.  
  13584. If serial port B isn't configured for AppleTalk, or is already in use,
  13585. the .MPP driver isn't loaded and an appropriate result code is
  13586. returned.
  13587.  
  13588.     Result codes    noErr       No error
  13589.             portInUse   Port B is already in use
  13590.             portNotCf   Port B not configured for AppleTalk
  13591.  
  13592.  
  13593.  
  13594.  
  13595. \ MPPClose
  13596. 23
  13597. FUNCTION MPPClose : OSErr;   [Not in ROM]
  13598.  
  13599. MPPClose removes the .MPP driver, and any data structures associated
  13600. with it, from memory. If the .ATP driver or NBP code were also
  13601. installed, they'll also be removed. MPPClose also returns the use of
  13602. port B to the Serial Driver.
  13603.  
  13604. (warning)
  13605.     Since other co-resident programs may be using AppleTalk,
  13606.     it's strongly recommended that you never use this call. 
  13607.     MPPClose will completely disabale AppleTalk; the only way
  13608.     to restore ApleTalk is to call MPPOpen again.
  13609.  
  13610.  
  13611.  
  13612.  
  13613. \ LAPOpenProtocol
  13614. 23
  13615. FUNCTION LAPOpenProtocol (theLAPType: ABBYte; protoPtr: Ptr) : OSErr;
  13616.         [Not in ROM]
  13617.  
  13618. LAPOpenProtocol adds the LAP protocol type specified by theLAPType to
  13619. the node's protocol table. If you provide a pointer to a protocol 
  13620. handler in protoPtr, ALAP will send each frame with a LAP protocol type
  13621. of theLAPType to that protocol handler.
  13622.  
  13623. If protoPtr is NIL, the default protocol handler will be used for
  13624. receiving frames with a LAP protocol type of theLAPType. In this case,
  13625. to receive a frame you must acall LAPRead to provide the default
  13626. protocol handler with a buffer for placing the data. If, however,
  13627. you've written your own protocol handler and protoPtr points to it,
  13628. your protocol handler will have the responsibility fro receiving the
  13629. frame and it's not necessary to call LAPRead.
  13630.  
  13631.     Result codes    noErr       No error
  13632.             lapProtErr  Error attaching protocol type
  13633.  
  13634.  
  13635.  
  13636.  
  13637. \ LAPWrite
  13638. 23
  13639. FUNCTION LAPWrite (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  13640.         [Not in ROM]
  13641.  
  13642.     ABusRecord
  13643.     ----------
  13644.        <--    abOpcode          {always tLAPWrite}
  13645.        <--    abResult          {result code}
  13646.        -->    abUserReference       {for your use}
  13647.        -->    lapAddress.dstNodeID      {destination node ID}
  13648.        -->    lapAddress.lapProtType    {LAP protocol type}
  13649.        -->    lapReqCount           {length of frame data}
  13650.        -->    lapDataPtr            {pointer to frame data}
  13651.  
  13652. LAPWrite sends a frame to another node. LAPReqCount and lapDataPtr
  13653. specify the length and location of the data to send. The
  13654. lapAddress.lapProtType field indicates the node ID of the node to
  13655. which the frame should be sent.
  13656.  
  13657. (note)
  13658.     The first two bytes of an ALAP frame's data must contain
  13659.     the length in bytes of the data, including the length
  13660.     bytes themselves.
  13661.  
  13662.     Result codes    noErr       No error
  13663.             excessCollsns   Unable to contact destination
  13664.                     node; packet not sent
  13665.  
  13666.  
  13667.  
  13668.  
  13669. \ LAPRead
  13670. 23
  13671. FUNCTION LAPRead (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  13672.         [Not in ROM]
  13673.  
  13674.     ABusRecord
  13675.     ----------
  13676.        <--    abOpcode      {always tLAPWrite}
  13677.        <--    abResult      {result code}
  13678.        -->    abUserReference   {for your use}
  13679.        <--    lapAddress.dstNodeID  {packet's destination node ID}
  13680.        <--    lapAddress.srcNodeID  {packet's source node ID}
  13681.        -->    lapAddress.lapProtType{LAP protocol type}
  13682.        -->    lapReqCount       {buffer size in bytes}
  13683.        <--    lapActCount       {number of frame data bytes actually }
  13684.                     {received}
  13685.        -->    lapDataPtr        {pointer to buffer}
  13686.  
  13687.  
  13688. LAPRead receives a frame from another node. LAPReqCount and lapDataPtr
  13689. specify the length and location of the buffer that will receive the
  13690. frame data. If the buffer isn't large enough to hold all of the
  13691. incoming frame data, the extra bytes wil be discarded and buf2SmallErr
  13692. will be returned. The number of bytes actually received is returned in
  13693. lapActCount. Only frames with LAP protocol type equal to
  13694. lapAddress.lapProtType will be received. The node number of the
  13695. frame's source and destination nodes are returned in
  13696. lapAddress.srcNodeID and lapAddress.dstNodeID respectively. You can
  13697. determine if the packet was broadcast to you by examining the value of
  13698. lapAddress.dstNodeID--if the packet was broadcast it's equal to 255,
  13699. otherwise it's equal to your node ID.
  13700.  
  13701. (note)
  13702.     You should issue LAPRead calls only for LAP protocol
  13703.     types that were opened (via LAPOpenProtocol) to use the
  13704.     default protocol handler.
  13705.  
  13706.     Result codes    noErr       No error
  13707.             buf2SmallErr    Frame too large for buffer
  13708.             readQErr    Invalid protocol type or
  13709.                     protocol type not found in table
  13710.  
  13711.  
  13712.  
  13713.  
  13714. \ LAPRdCancel
  13715. 23
  13716. FUNCTION LAPRdCancel (abRecord: ABRecHandle) : OSErr;  [Not in ROM]
  13717.  
  13718. Given the handle to the ABusRecord of a previously made LAPRead call,
  13719. LAPRdCancel dequeues the LAPRead call, provided that a packet
  13720. satisfying the LAPRead has not already arrived. LAPRdCancel returns
  13721. noErr if the LAPRead call is successfully removed fdrom the queue. If
  13722. LAPRdCancel returns recNotFnd, check the abResult field to verify that
  13723. the LAPRead has been completed and determine its outcome.
  13724.  
  13725.     Result codes    noErr       No error
  13726.             readQErr    Invalid protocol type or
  13727.                     protocol type not found in table
  13728.             recNotFnd   ABRecord n ot found in queue
  13729.  
  13730.  
  13731.  
  13732.  
  13733. \ DDPOpenSocket
  13734. 23
  13735. FUNCTION DDPOpenSocket (VAR theSocket: Byte; sktListener: Ptr) : OSErr;
  13736.         [Not in ROM]
  13737.  
  13738. DDPOpenSocket adds a socket and its socket listener to the socket
  13739. table. If theSocket is nonzero (it must be in the range of 64 to 127),
  13740. it specifies the socket's number. If theSocket is 0, DDPOpenSocket
  13741. dynamically assigns a socket number in the range 128 to 254, and
  13742. returns it in theSocket. SktListener contains a pointer to the socket
  13743. listener; if it'e NIL, the default listener will be used.
  13744.  
  13745. If you're using the default socket listener, you must then call DDPRead
  13746. to receive a datagram (in order to specify buffer space for the default
  13747. socket listener). If, however, you've written your own socket listener
  13748. and sktListener points to it, your listener will provide buffers for
  13749. receiving datagrams and you shouldn't use DDPRead calls.
  13750.  
  13751. DDPOpenSocket will return ddpSktErr if you pass the number of an
  13752. already opened socket, if you pass a socket number greater than 127, or
  13753. if the socket table is full.
  13754.  
  13755. (note)
  13756.     The range of static socket numbers 1 through 63 is
  13757.     reserved for use by AppleTalk. Socket numbers 64 through
  13758.     127 are available for unrestricted experimental use.
  13759.  
  13760.     Result codes    noErr       No error
  13761.             ddpSktErr   Socket error
  13762.  
  13763.  
  13764.  
  13765.  
  13766. \ DDPCloseSocket
  13767. 23
  13768. FUNCTION DDPCloseSocket (theSocket: Byte) : OSErr;   [Not in ROM]
  13769.  
  13770. DDPCloseSocket removes the entry of the specified socket from the
  13771. socket table and cancels all pending DDPRead calls that have been made
  13772. to close a socket that isn't open, DDPCloseSocket will return
  13773. ddpSktErr.
  13774.  
  13775.     Result codes    noErr       No error
  13776.             ddpSktErr   Socket error
  13777.  
  13778.  
  13779.  
  13780. \ DDPWrite
  13781. 23
  13782. FUNCTION DDPWrite (abRecord: ABRecfHandle; doChecksum: BOOLEAN; async:
  13783.         BOOLEAN) : OSErr;   [Not in ROM]
  13784.  
  13785.     ABusRecord
  13786.     ----------
  13787.        <--    abOpcode      {always tDDPWrite}
  13788.        <--    abResult      {result code}
  13789.        -->    abUserReference   {for your use}
  13790.        -->    ddpType       {DDP protocol type}
  13791.        -->    ddpSocket         {source socket number}
  13792.        -->    ddpAddress        {destination socket address}
  13793.        -->    ddpReqCount       {length of datagram data}
  13794.        -->    ddpDataPtr        {pointer to buffer}
  13795.  
  13796. DDPWrite sends a datagram to another socket. DDPReqCount and
  13797. ddpDataPtr specify the length and location of the data to send. The
  13798. ddpType field indicates the DDP protocol type of the frame, and
  13799. ddpAddress is the complete internet address of the socket to which the
  13800. datagram should be sent. DDPSocket specifies the socket from which the
  13801. datagram should be sent. Datagrams sent over the internet to a node on
  13802. an AppleTalk network different from the sending node's network have an
  13803. optional software checksum to detect errors that might occur inside the
  13804. intermediate bridges. If doChecksum is TRUE, DDPWrite will compute
  13805. this checksum; if it's FALSE, this software checksum feature is
  13806. ignored.
  13807.  
  13808. (note)
  13809.     The destination socket can't be in the same node as the
  13810.     program making the DDPWrite call.
  13811.  
  13812.     Result codes    noErr       No error
  13813.             ddpLenErr   Datagram length too big
  13814.             ddpSktErr   Source socket not open
  13815.  
  13816.  
  13817.  
  13818. \ DDPRead
  13819. 23
  13820. FUNCTION DPRead (abRecord: ABRecfHandle; retChecksum: BOOLEAN; async:
  13821.         BOOLEAN) : OSErr;   [Not in ROM]
  13822.  
  13823.     ABusRecord
  13824.     ----------
  13825.        <--    abOpcode      {always tDDPWrite}
  13826.        <--    abResult      {result code}
  13827.        -->    abUserReference   {for your use}
  13828.        <--    ddpType       {DDP protocol type}
  13829.        -->    ddpSocket         {listening socket number}
  13830.        <--    ddpAddress        {source socket address}
  13831.        -->    ddpReqCount       {buffer size in bytes}
  13832.        <--    ddpActCount       {number of bytes actually received}
  13833.        -->    ddpDataPtr        {pointer to buffer}
  13834.        <--    ddpNodeID     {original destination node ID}
  13835.  
  13836.  
  13837. DDPRead receives a datagram from another socket. The length and
  13838. location of the buffer that will receive the data are specified by
  13839. ddpReqCount and ddpDataPtr, respectively. If the buffer isn't large
  13840. enough to hold all of the incoming frame data, the extra bytes will be
  13841. discarded and buf2SmallErr will be returned. The numbr of bytes
  13842. actually received is returned in ddpActCount. DDPSocket specifies the
  13843. socket to receive the datagram (the "listening" socket). The node to
  13844. which the packet was sent is returned in ddpNodeID; if the packet was
  13845. broadcast ddpNodeID will contain 255. The address of the socket that
  13846. sent the packet is returned in ddpAddress. If retCksumErrs is FALSE,
  13847. DDPRead will discard any packets received with an invalid checksum and
  13848. inform the caller of the error. If retCksumErr is TRUE, DDPRead will
  13849. deliver all packets, regardless of whether the checksum is valid or
  13850. not; it will also notify the caller when there's a checksum error.
  13851.  
  13852. (note)
  13853.     The sender of the datagram must be in a different node
  13854.     from the receiver. Youk should issue DDPRead calls only
  13855.     for receiving datagrams for sockets opened with the
  13856.     default socket listener; see the description of
  13857.     DDPOpenSocket.
  13858.  
  13859. (note)
  13860.     If DDPRead returns buf2SmallErr, it will deliver packets
  13861.     even if retCksukmErrs is FALSE.
  13862.  
  13863.     Result codes    noErr       No error
  13864.             buf2SmallErr    Datagram too large for buffer
  13865.             cksumErr    Checksum error
  13866.             ddpLenErr   Datagram length too big
  13867.             ddpSktErr   Socket error
  13868.             readQErr    Invalid socket or
  13869.                     socket not found in table
  13870.  
  13871.  
  13872.  
  13873. \ DDPRdCancel
  13874. 23
  13875. FUNCTION DDPRdCancel (abRecord: ABRecHandle) : OSErr;   [Not in ROM]
  13876.  
  13877. Given the handle to the ABusRecord of a previously made DDPRead call,
  13878. DDPRdCancel dequeues the DDPRead call, provided that a packet
  13879. satisfying the DDPRead hasn't already arrived. DDPRdCancel returns
  13880. noErr if the DDPRead call is successfully removed from the queue. If
  13881. DDPRdCancel returns recNotFnd, check the abResult field of abRecord to
  13882. verify that the DDPRead has been completed and determine its outcome.
  13883.  
  13884.  
  13885.     Result codes    noErr       No error
  13886.             readQErr    Invalid socket or
  13887.                     socket not found in table
  13888.             recNotFnd   ABRecord not found in queue
  13889.  
  13890.  
  13891.  
  13892. \ ATPLoad
  13893. 23
  13894. FUNCTION ATPLoad : OSErr;   [Not in ROM]
  13895.  
  13896. ATPLoad first verifies that the .MPP driver is loaded and running. If
  13897. it isn't, ATPLoad verifies that port B is configured for AppleTalk, and
  13898. is not in use, and then loads MPP into the system heap.
  13899.  
  13900. ATPLoad then loads the .ATP driver, unless it's already in memory. On
  13901. a Macintosh 128K, ATPLoad reads the .ATP driver from the system
  13902. resource file into the application heap; on a Macintosh 512K or XL, ATP
  13903. is read into the system heap.
  13904.  
  13905. (note)
  13906.     On a Macintosh 512K or XL, ATPLoad and MPPOpen perform
  13907.     essentially the same function.
  13908.  
  13909.  
  13910.  
  13911.     Result codes    noErr       No error
  13912.             portInUse   Port B is already in use
  13913.             portNotCf   Port B not configured for AppleTalk
  13914.  
  13915.  
  13916.  
  13917.  
  13918.  
  13919. \ ATPUnload
  13920. 23
  13921. FUNCTION ATPUnload : OSErr;   [Not in ROM]
  13922.  
  13923. ATPUnload makes the .ATP driver purgeable; the space isn't actually
  13924. released by the Memory Manager until necessary.
  13925.  
  13926. (note)
  13927.     This call applies only to a Macintosh 128K; on a
  13928.     Macintosh 512K or Macintosh XL, ATPUnload has no effect.
  13929.  
  13930.     Result codes    noErr       No error
  13931.  
  13932.  
  13933.  
  13934. \ ATPOpenSocket
  13935. 23
  13936. FUNCTION ATPOpenSocket (addrRcvd: AddrBlock; VAR atpSocket: Byte) :
  13937.         OSErr;   [Not in ROM]
  13938.  
  13939. ATPOpenSocket opens a socket for the purpose of receiving requests.
  13940. ATPSocket contains the socket number of the socket to open; if it's 0,
  13941. a number is dynamically assigned and returned in atpSocket. AddrRcvd
  13942. contains a filter of the sockets from which requests will be accepted.
  13943. A 0 in the network number, node ID, or socket number field of the
  13944. addrRcvd record acts as a "wild card"; for instance, a 0 in the socket
  13945. number field means that requests will be accepted from all sockets in
  13946. the node(s) specified by the network and node fields.
  13947.  
  13948.     Result codes    noErr       No error
  13949.             tooManySkts Socket table ful
  13950.             noDataArea  Too many outstanding ATP calls
  13951.  
  13952. (note)
  13953.     If you're only going to send requests and receive
  13954.     responses to these requests, you don't need to open an
  13955.     ATP socket. When you make the ATPSndRequest or
  13956.     ATPRequest call, ATP automatically opens a dynamically
  13957.     assigned socket for that purpose.
  13958.  
  13959.  
  13960.  
  13961. \ ATPCloseSocket
  13962. 23
  13963. FUNCTION ATPCLoseSocket (atpSocket: Byte) : OSErr;   [Not in ROM]
  13964.  
  13965. ATPCloseSocket closes the responding socket whose number is specified
  13966. by atpSocket. It releases the data structures associated with all
  13967. pending, asynchronous calls involving that socket; these pending calls
  13968. are completed immediately and return the result code sktClosed.
  13969.  
  13970.     Result codes    noErr       No error
  13971.             noDataArea  Too many outstanding ATP calls
  13972.  
  13973.  
  13974.  
  13975. \ ATPSndRequest
  13976. 23
  13977. FUNCTION ATPSndRequest (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  13978.         [Not in ROM]
  13979.  
  13980.     ABusRecord
  13981.     ----------
  13982.        <--  abOpcode    {always tATPSndRequest}
  13983.        <--  abResult    {result code}
  13984.        -->  abUserReference {for your use}
  13985.        -->  atpAddress  {destination socket address}
  13986.        -->  atpReqCount {request size in bytes}
  13987.        -->  atpDataPtr  {pointer to buffer}
  13988.        -->  atpRspBDSPtr    {pointer to response BDS}
  13989.        -->  atpUserData {user bytes}
  13990.        -->  atpXO       {exactly-once flag}
  13991.        <--  atpEOM      {end-of-message flag}
  13992.        -->  atpTimeOut  {retry timeout interval in seconds}
  13993.        -->  atpRetries  {maximum number of retries}
  13994.        -->  atpNumBufs  {number of elements in response BDS}
  13995.        <--  atpNumRsp   {number of response packets actually }
  13996.                 {received}
  13997.  
  13998. ATPSndRequest sends a request to another socket. ATPAddress is the
  13999. internet address of the socket to which the request should be sent.
  14000. ATPDataPtr and atpReqCount specify the location and size of a buffer
  14001. that contains the request information to be sent. ATPUserData contains
  14002. the user bytes for the ATP header.
  14003.  
  14004. ATPSndRequest requires you to allocate a response BDS. ATPRspBDSPtr is
  14005. a pointer to the response BDS; atpNumBufs indicates the number of BDS
  14006. elements in the BDS (this is also the maximum number of response
  14007. datagrams that will be accepted). The number of response datagrams
  14008. actually received is returned in atpNumRsp; if a nonzero value is
  14009. returned, you can examine the response BDS to determine which packet
  14010. of the transaction were actually received. If the number returned is
  14011. less than requested, one of the folowing is true:
  14012.  
  14013.     - Some of the packets have been lost and the retry count has been
  14014.       exceeded.
  14015.  
  14016.     - ATPEOM is TRUE; this means that the response consisted of fewer
  14017.       packets than were expected, but that all packets sent were
  14018.       received (the last packet came with the atpEOM flag set).
  14019.  
  14020. ATPTimeOut indicates the length of time that ATPSndRequest should wait
  14021. for a response before retransmitting the request. ATPRetries indicates
  14022. the maximum number of retries ATPSndRequest shoud attempt. ATPXO
  14023. should be TRUE if you want the request to be part of an exactly-once
  14024. transaction.
  14025.  
  14026. ATPSndRequest completes when either the transaction is completed or the
  14027. retry count is exceeded.
  14028.  
  14029.     Result codes    noErr       No error
  14030.             reqFailed   Retry count exceeded
  14031.             tooManyReqs Too many concurrent requests
  14032.             noDataArea  Too many outstanding ATP calls
  14033.  
  14034.  
  14035.  
  14036. \ ATPRequest
  14037. 23
  14038. FUNCTION ATPRequest (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  14039.         [Not in ROM]
  14040.  
  14041.     ABusRecord
  14042.     ----------
  14043.        <--  abOpcode    {always tATPRequest}
  14044.        <--  abResult    {result code}
  14045.        -->  abUserReference {for your use}
  14046.        -->  atpAddress  {destination socket address}
  14047.        -->  atpReqCount {request size in bytes}
  14048.        -->  atpDataPtr  {pointer to buffer}
  14049.        <--  atpActCount {number of bytes actually received}
  14050.        -->  atpUserData {user bytes}
  14051.        -->  atpXO       {exactly-once flag}
  14052.        <--  atpEOM      {end-of-message flag}
  14053.        -->  atpTimeOut  {retry timeout interval in seconds}
  14054.        -->  atpRetries  {maximum number of retries}
  14055.        <--  atpRspUData {user bytes received in transaction}
  14056.                 { response}
  14057.        -->  atpRspBuf   {pointer to response message buffer}
  14058.        -->  atpRspSize  {size of response message buffer}
  14059.  
  14060. ATPRequest is functionally analogous to ATPSndRequest. It sends a
  14061. request to another socket, but doesn't require the caller to set up and
  14062. use the BDS data structure to describe the response buffers.
  14063. ATPAddress indicates the socket to which the request should be sent.
  14064. ATPDataPtr and atpReqCount specify the location and size of a buffer
  14065. that contains the request information to be sent. ATPUserData contains
  14066. the uset bytes to be sent in the request's ATP header. ATPTimeOut
  14067. indicates the length of time that ATPRequest should wait for a response
  14068. before retransmitting the request. ATPRetries indicates the maximum
  14069. number of retries ATPRequest should attempt.
  14070.  
  14071. To use this call, you must have an area of contiguous buffer space
  14072. that's large enough to receive all expected datagrams. The various
  14073. datagrams will be assembled in this buffer and returned to you as a
  14074. complete message upon completion of the transaction. The address and
  14075. size of this buffer are pased in atpRspBuf and atpRspSize,
  14076. respectively. Upon completion of the call, the size ofthe received
  14077. response message is returned in atpActCount. The user bytes received
  14078. in the ATP header of the first response packet are returned in
  14079. atpRspUData. ATPXO should be TRUE if you want the request to be part
  14080. of an exactly-once transaction.
  14081.  
  14082. Although you don't provide a BDS, ATPRequest in fact creates one and
  14083. calls the .ATP driver (as in an ATPSndRequest call). For this reason,
  14084. the abRecord fields atpRspBDSPtr and atpNumBufs are used by ATPRequest;
  14085. you should not expect these fields to remain unaltered during or after
  14086. the function's execution.
  14087.  
  14088. For ATPRequest to receive and correctly deliver the response as a
  14089. single message, the responding end must, upon receiving the request
  14090. (with an ATPGetRequest call), generate the complete response as a
  14091. complete message in a single buffer and then call ATPResponse.
  14092.  
  14093. (note)
  14094.     The responding end could also use ATPSndRsp and ATPAddRsp
  14095.     provided that each response packet (except the last one)
  14096.     contains exactly 578 ATP data bytes; the last packet in
  14097.     the response can contain less than 578 ATP data bytes.
  14098.     Also, if this method is used, only the ATP user bytes of
  14099.     the first response packet will be delivered to the
  14100.     requester; any information in the user bytes of the
  14101.     remaining response packets will not be delivered.
  14102.  
  14103. ATPRequest completes when either the transaction is completed or the
  14104. retry count is exceeded.
  14105.  
  14106.     Result codes    noErr       No error
  14107.             reqFailed   Retry count exceeded
  14108.             tooManyReqs Too many concurrent requests
  14109.             sktClosed   Socket closed by a cancel call
  14110.             noDataArea  Too many outstanding ATP calls
  14111.  
  14112.  
  14113.  
  14114.  
  14115. \ ATPReqCancel
  14116. 23
  14117. FUNCTION ATPReqCancel (abRecord: ABRecHandle; async: BOOLEAN) : OSErr;
  14118.         [Not in ROM]
  14119.  
  14120. Given the handle to the ABusRecord of a previously made ATPSndRequest
  14121. or ATPRequest call, ATPReqCancel dequeues the ATPSndRequest or
  14122. ATPRequest call, provided that the call hasn't already completed.
  14123. ATPReqCancel returns noErr if the ATPSndRequest or ATPRequest call is
  14124. successfully removed from the queue. If it returns cbNotFound, check
  14125. the abResult field of abRecord to verify that the ATPSndRequest or
  14126. ATPRequest call has been completed and determine its outcome.
  14127.  
  14128.     Result codes    noErr       No error
  14129.             cbNotFound  ATP control block not found
  14130.  
  14131.  
  14132.  
  14133.  
  14134. \ ATPGetRequest
  14135. 23
  14136. FUNCTION ATPGetRequest (abRecord: ABRecHandle; async: BOOLEAN) :
  14137.         OSErr;   [Not in ROM]
  14138.  
  14139.     ABusRecord
  14140.     ----------
  14141.        <--  abOpcode    {always tATPGetRequest}
  14142.        <--  abResult    {result code}
  14143.        -->  abUserReference {for your use}
  14144.        -->  atpSocket   {listening socket number}
  14145.        <--  atpAddress  {source socket address}
  14146.        -->  atpReqCount {buffer size in bytes}
  14147.        -->  atpDataPtr  {pointer to buffer}
  14148.        <--  atpBitMap   {transaction bit map}
  14149.        <--  atpTransID  {transaction ID}
  14150.        <--  atpActCount {number of bytes actually received}
  14151.        <--  atpUserData {user bytes}
  14152.        <--  atpXO       {exactly-once flag}
  14153.  
  14154. ATPGetRequest sets up the mechanism to receive a request sent by either
  14155. an ATPSndRequest or an ATPRequest call. ATPSocket contains the socket
  14156. number of the socket that should listen for a request; this socket must
  14157. already have been opened by calling ATPOpenSocket. The address of the
  14158. socket from which the request was sent is returned in atpAddress.
  14159. ATPDataPtr specifies a buffer to store the incoming request;
  14160. atpReqCount indicates the size of the buffer in bytes. The number of
  14161. bytes actually received in the request is returned in atpActCount.
  14162. ATPUserData contains the user bytes from the ATP header. The
  14163. transaction bit map is returned in atpBitMap. The transaction ID is
  14164. returned in atpTransID. ATPXO will be TRUE if the request is part of
  14165. an exactly-once transaction.
  14166.  
  14167. ATPGetRequest completes when a request is received. To cancel an
  14168. asynchronous ATPGetRequest call, you must call ATPCloseSocket, but this
  14169. cancels all pending calls involving that socket.
  14170.  
  14171.  
  14172.     Result codes    noErr       No error
  14173.             badATPSkt   Bad responding socket
  14174.                 sktClosed   Socket closed by a cancel call
  14175.  
  14176.  
  14177.  
  14178.  
  14179. \ ATPSndRsp
  14180. 23
  14181. FUNCTION ATPSndRsp (abRecord: ABRecHandle; async: BOOLEAN) :
  14182.         OSErr;   [Not in ROM]
  14183.  
  14184.  
  14185.     ABusRecord
  14186.     ----------
  14187.        <--  abOpcode    {always tATPSndRsp}
  14188.        <--  abResult    {result code}
  14189.        -->  abUserReference {for your use}
  14190.        -->  atpSocket   {responding socket number}
  14191.        -->  atpAddress  {destination socket address}
  14192.        -->  atpRspBDSPtr    {pointer to response BDS}
  14193.        -->  atpTransID  {transaction ID}
  14194.        -->  atpEOM      {end-of-message flag}
  14195.        -->  atpNumBufs  {number of response packets being }
  14196.                 {sent}
  14197.        -->  atpBDSSize  {number of elements in response BDS}
  14198.  
  14199.  
  14200. ATPSndRsp sends a response to another socket. ATPSocket contains the
  14201. socket number from which the response should be sent and atpAddress
  14202. contains the internet address of the socket to which the response
  14203. should be sent. ATPTransID must contain the transaction ID. ATPEOM is
  14204. TRUE if the response BDS contains the final packet in a transaction
  14205. composed of a group of packets and the number of packets in the
  14206. response is less than expected. ATPRspBDSPtr points to the buffer data
  14207. structure containing the responses to be sent. ATPBDSSize indicates
  14208. the number of elements in the response BDS, and must be in the range 1
  14209. to 8. ATPNumBufs indicates the number of response packets being sent
  14210. with this call, and must be in the range 0 to 8.
  14211.  
  14212. (note)
  14213.     In some situations, you may want to send only part (or
  14214.     possibly none) of your response message back immediately.
  14215.     For instance, you might be requested to send back seven
  14216.     disk blocks, but have only enough internal memory to
  14217.     store one block. In this case, set atpBDSSize to 7
  14218.     (total number of response packets), atpNumBufs to 0
  14219.     (number of response packets currently being sent), and
  14220.     call ATPSndRsp. Then as you read in one block at a time,
  14221.     call ATPAddRsp until all seven response datagrams have
  14222.     been sent.
  14223.  
  14224. During exactly-once transactions, ATPSndRsp won't complete until the
  14225. release packet is received or the release timer expires.
  14226.  
  14227.  
  14228.     Result codes    noErr       No error
  14229.             badATPSkt   Bad responding socket
  14230.             noRelErr    No release received
  14231.                 sktClosed   Socket closed by a cancel call
  14232.             noDataArea  Too many outstanding ATP calls
  14233.  
  14234.  
  14235.  
  14236. \ ATPAddRsp
  14237. 23
  14238. FUNCTION ATPAddRsp (abRecord: ABRecHandle) : OSErr;   [Not in ROM]
  14239.  
  14240.  
  14241.     ABusRecord
  14242.     ----------
  14243.        <--  abOpcode    {always tATPAddRsp}
  14244.        <--  abResult    {result code}
  14245.        -->  abUserReference {for your use}
  14246.        -->  atpSocket   {responding socket number}
  14247.        -->  atpAddress  {destination socket address}
  14248.        -->  atpReqCount {buffer size in bytes}
  14249.        -->  atpDataPtr  {pointer to buffer}
  14250.        -->  atpTransID  {transaction ID}
  14251.        -->  atpUserData {user bytes}
  14252.        -->  atpEOM      {end-of-message flag}
  14253.        -->  atpNumRsp   {sequence number}
  14254.  
  14255. ATPAddRsp sends one additional response packet to a socket that has
  14256. already been sent the initial part of a response via ATPSndRsp.
  14257. ATPSocket contains the socket number from which the response should be
  14258. sent and atpAddress contains the internet address of the socket to
  14259. which the response should be sent. ATPTransID must contain the
  14260. transaction ID. ATPDataPtr and atpReqCount specify the location and
  14261. size of a buffer that contains the information to send; atpNumRsp is
  14262. the sequence number of the response. ATPEOM is TRUE if this repsonse
  14263. datagram is the final packet in a transaction composed of a group of
  14264. packets. ATPUserData contains the user bytes to be sent in this
  14265. response datagram's ATP header.
  14266.  
  14267. (note)
  14268.     No BDS is needed with ATPAddRsp because all pertinent
  14269.     information is passed within the record.
  14270.  
  14271.  
  14272.     Result codes    noErr       No error
  14273.             badATPSkt   Bad responding socket
  14274.             badBuffNum  Bad sequence number
  14275.             noSendResp  ATPAddRsp issued before ATPSndRsp
  14276.             noDataArea  Too many outstanding ATP calls
  14277.  
  14278.  
  14279.  
  14280.  
  14281. \ ATPResponse
  14282. 23
  14283. FUNCTION ATPResponse (abRecord: ABRecHandle; async: BOOLEAN) :
  14284.         OSErr;   [Not in ROM]
  14285.  
  14286.  
  14287.     ABusRecord
  14288.     ----------
  14289.        <--  abOpcode    {always tATPResponse}
  14290.        <--  abResult    {result code}
  14291.        -->  abUserReference {for your use}
  14292.        -->  aptSocket   {responding socket number}
  14293.        -->  atpAddress  {destination socket address}
  14294.        -->  atpRspUData {user bytes sent in transaction}
  14295.                 { response}
  14296.        -->  atpRspBuf   {pointer to response message buffer}
  14297.        -->  atpRspSize  {size of response message buffer}
  14298.  
  14299. ATPResponse is functionally analogous to ATPSndRsp. It sends a
  14300. response to a socket, but doesn't require the caller to provide a BDS.
  14301. ATPAddress must contain the complete network address of the socket to
  14302. which the response should be sent (the socket on which the corresponding
  14303. ATPGetRequest was issued). ATPRspBuf points to the buffer containing
  14304. the response message; the size of this buffer must be passed in
  14305. atpRspSize. The four user bytes to be sent in the ATP header of the
  14306. first response packet are passed in atpRspUData. The last packet of
  14307. the transaction response is sent with the EOM flag set.
  14308.  
  14309. Although you don't provide a BDS, ATPResponse in fact creates one and
  14310. calls the .ATP driver (as in an ATPSndRsp call). For this reason, the
  14311. abRecord fields atpRspBDSPtr and atpNumBufs are used by ATPResponse;
  14312. you should not expect these fields to remain unaltered during or after
  14313. the function's execution.
  14314.  
  14315. During exactly-once transactions ATPResponse won't complete until the
  14316. release packet is received or the release timer expires.
  14317.  
  14318. (warning)
  14319.     The maximum permissible size of the response message is
  14320.     4624 bytes.
  14321.  
  14322.  
  14323.     Result codes    noErr       No error
  14324.             badATPSkt   Bad responding socket
  14325.             noRelErr    No release received
  14326.             atpLenErr   Response too big
  14327.                 sktClosed   Socket closed by a cancel call
  14328.             noDataArea  Too many outstanding ATP calls
  14329.  
  14330.  
  14331.  
  14332.  
  14333. \ ATPRspCancel
  14334. 23
  14335. FUNCTION ATPRspCancel (abRecord: ABRecHandle; async: BOOLEAN) :
  14336.         OSErr;   [Not in ROM]
  14337.  
  14338. Given the handle to the ABusRecord of a previously made ATPSndRsp or
  14339. ATPResponse call, ATPRspCancel dequeues the ATPSndRsp or ATPResponse
  14340. call, provided that the call hasn't already completed. ATPRspCancel
  14341. returns noErr if the ATPSndRsp or ATPResponse call is successfully
  14342. removed from the queue. If it returns cbNotFound, check the abResult
  14343. field of abRecord to verify that the ATPSndRsp or ATPResponse call has
  14344. been completed and determine its outcome.
  14345.  
  14346.  
  14347.     Result codes    noErr       No error
  14348.             cbNotFound  ATP control block not found
  14349.             noDataArea  Too many outstanding ATP calls
  14350.  
  14351.  
  14352.  
  14353.  
  14354. \ NBPRegister
  14355. 23
  14356. FUNCTION NBPRegister (abRecord: ABRecHandle; async: BOOLEAN) :
  14357.         OSErr;   [Not in ROM]
  14358.  
  14359.  
  14360.     ABusRecord
  14361.     ----------
  14362.        <--  abOpcode        {always tNBPRegister}
  14363.        <--  abResult        {result code}
  14364.        -->  abUserReference     {for your use}
  14365.        -->  nbpEntityPtr        {pointer to entity name}
  14366.        -->  nbpBufPtr       {pointer to buffer}
  14367.        -->  nbpBufSize      {buffer size in bytes}
  14368.        -->  nbpAddress.aSocket  {socket address}
  14369.        -->  nbpRetransmitInfo   {retransmission information}
  14370.  
  14371. NBPRegister adds the name and address of an entity to the node's names
  14372. table. NBPEntityPtr points to a variable of type EntityName containing
  14373. the entity's name. If the name is already registered, NBPRegister
  14374. returns the result code nbpDuplicate. NBPBufPtr and nbpBufSize
  14375. specify the location and size of a buffer for NBP to use internally.
  14376. The buffer must contain at least 12 bytes plus the length of the entity
  14377. name.
  14378.  
  14379. (warning)
  14380.     This buffer must not be altered or released until the
  14381.     name is removed from the names table via an NBPRemove
  14382.     call. If you allocate the buffer through a NewHandle
  14383.     call, the handle must be locked as long as the name is
  14384.     registered.
  14385.  
  14386.     Result codes    noErr       No error
  14387.             nbpDuplicate    Duplicate name already exists
  14388.  
  14389.  
  14390.  
  14391.  
  14392. \ NBPLookup
  14393. 23
  14394. FUNCTION NBPLookup (abRecord: ABRecHandle; async: BOOLEAN) :
  14395.         OSErr;   [Not in ROM]
  14396.  
  14397.  
  14398.     ABusRecord
  14399.     ----------
  14400.        <--  abOpcode        {always tNBPLookup}
  14401.        <--  abResult        {result code}
  14402.        -->  abUserReference     {for your use}
  14403.        -->  nbpEntityPtr        {pointer to entity name}
  14404.        -->  nbpBufPtr       {pointer to buffer}
  14405.        -->  nbpBufSize      {buffer size in bytes}
  14406.        <->  nbpDataField        {number of addresses received}
  14407.        -->  nbpRetransmitInfo   {retransmission information}
  14408.  
  14409. NBPLookup returns the addresses of all entities with a specified name.
  14410. NBPEntityPtr points to a variable of type EntityName containing the
  14411. name of the entity whose address should be returned. (Meta-characters
  14412. are allowed in the entity name.)  NBPBufPtr and NBPBufSize contain the
  14413. location and size of an area of memory in which the entities' addresses
  14414. should be returned. NBPDataField indicates the maximum number of
  14415. matching names to find addresses for; the actual number of addresses
  14416. found is returned in NBPDataField. NBPRetransmitInfo contains the
  14417. retry interval and the retry count.
  14418.  
  14419.     Result codes    noErr       No error
  14420.             nbpBuffOvr  Buffer overflow
  14421.  
  14422.  
  14423.  
  14424. \ NBPExtract
  14425. 23
  14426. FUNCTION NBPExtract (theBuffer: Ptr; numInBuf: INTEGER; whichOne:
  14427.         INTEGER; VAR abEntityName; VAR address: AddrBlock)
  14428.         : OSErr;   [Not in ROM]
  14429.  
  14430. NBPExtract retruns one address from the list of addresses returned by
  14431. NBPLookup. TheBuffer and numInBuf indicate the location and number of
  14432. tuples in the buffer. WhichOne specifies which one of the tuples in
  14433. the buffer should be returned in the abEntity and adress parameters.
  14434.  
  14435.     Result codes    noErr       No error
  14436.             extractErr  Can't find tuple in buffer
  14437.  
  14438.  
  14439.  
  14440. \ NBPConfirm
  14441. 23
  14442. FUNCTION NBPConfirm (abRecord: ABRecHandle; async: BOOLEAN) :
  14443.         OSErr;   [Not in ROM]
  14444.  
  14445.     ABusRecord
  14446.     ----------
  14447.        <--  abOpcode        {always tNBPConfirm}
  14448.        <--  abResult        {result code}
  14449.        -->  abUserReference     {for your use}
  14450.        -->  nbpEntityPtr        {pointer to entity name}
  14451.        <--  nbpDataField        {number of addresses received}
  14452.        -->  nbpAddress      {socket address}
  14453.        -->  nbpRetransmitInfo   {retransmission information}
  14454.  
  14455. NBPConfirm confirms that an entity known by name and address still
  14456. exists (is still entered in the names directory). NBPEntityPtr points
  14457. to a variable of type EntityName that contains the name to confirm, and
  14458. nbpAddress specifies the address to be confirmed. (No meta-characters
  14459. are allowed in the entity name.)  NBPRetransmitInfo contains the retry
  14460. interval and the retry count. The correct socket number of the entity
  14461. is returned in nbpDataField. NBPConfirm is more efficient than
  14462. NBPLookup in terms of network traffic.
  14463.  
  14464.  
  14465.     Result codes    noErr       No error
  14466.             nbpConfDiff Name confirmed for different socket
  14467.             nbpNoConfirm    Name not confirmed
  14468.  
  14469.  
  14470.  
  14471. \ NBPRemove
  14472. 23
  14473. FUNCTION NBPRemove (abEntity: EntityPtr) : OSErr;   [Not in ROM]
  14474.  
  14475. NBPRemove removes an entity name from the names table of the caller's
  14476. node.
  14477.  
  14478.  
  14479.     Result codes    noErr       No error
  14480.             nbpNotFound Name not found
  14481.  
  14482.  
  14483.  
  14484. \ NBPLoad
  14485. 23
  14486. FUNCTION NBPLoad : OSErr;   [Not in ROM]
  14487.  
  14488. On a Macintosh 128K, NBPLoad reads the AppleTalk Manager's NBP code
  14489. from the system resource file into the application heap. On a
  14490. Macintosh 512K or XL, NBPLoad has no effect since the NBP code should
  14491. have already been loaded when the .MPP driver was opened. Normally
  14492. you'll never need to call NBPLoad because the AppleTalk Manager calls
  14493. it when necessary.
  14494.  
  14495.     Result codes    noErr       No error
  14496.  
  14497.  
  14498.  
  14499. \ NBPUnload
  14500. 23
  14501. FUNCTION NBPUnload : OSErr;   [Not in ROM]
  14502.  
  14503. NBPUnload makes the NBP code purgeable; the space isn't actually
  14504. released by the Memory Manager until necessary.
  14505.  
  14506. (note)
  14507.     This call applies only to a Macintosh 128K; on a
  14508.     Macintosh 521K or Macintosh XL, NBPUnload has no effect.
  14509.  
  14510.     Result codes    noErr       No error
  14511.  
  14512.  
  14513.  
  14514.  
  14515. \ GetNodeAddress
  14516. 23
  14517. FUNCTION GetNodeAddress (VAR myNode,myNet: INTEGER) : OSErr;[Not in ROM]
  14518.  
  14519. GetNodeAddress returns the current node ID and network number of the
  14520. caller. If the .MPP driver isn't installed, it returns noMPPErr. If
  14521. myNet contains 0, this means that a bridge hasn't yet been found.
  14522.  
  14523.     Result codes    noErr       No error
  14524.             noMPPErr    MP driver not installed
  14525.  
  14526.  
  14527.  
  14528. \ IsMPPOpen
  14529. 23
  14530. FUNCTION IsMPPOpen : BOOLEAN;   [Not in ROM]
  14531.  
  14532. IsMPPOpen returns TRUE if the .MPP driver is loaded and running.
  14533.  
  14534.  
  14535.  
  14536. \ IsATPOpen
  14537. 23
  14538. IsATPOpen : BOOLEAN;   [Not in ROM]
  14539.  
  14540. IsATPOpen returns TRUE if the .ATP driver is loaded and running.
  14541.  
  14542.  
  14543. \ VInstall
  14544. 24
  14545. FUNCTION VInstall (vblTaskPtr: QElemPtr) : OSErr;
  14546.  
  14547.     _________________________________________________________________
  14548.  
  14549.     Trap macro  _VInstall
  14550.  
  14551.     On entry    A0:  vblTaskPtr (pointer)
  14552.  
  14553.     On exit     D0:  result code (integer)
  14554.     _________________________________________________________________
  14555.  
  14556.     VInstall adds the task described by vblTaskPtr to the vertical
  14557. retrace queue. Your application must fill in all fields of the task
  14558. except qLink. VInstall returns one of the result codes listed below.
  14559.  
  14560.     Result codes
  14561.  
  14562.             noErr       No error
  14563.             vTypErr     QType field isn't ORD(vType)
  14564.  
  14565. \ VRemove
  14566. 24
  14567. FUNCTION VRemove (vblTaskPtr: QElemPtr) : OSErr;
  14568.  
  14569.     _________________________________________________________________
  14570.  
  14571.     Trap macro  _VRemove
  14572.  
  14573.     On entry    A0:  vblTaskPtr (pointer)
  14574.  
  14575.     On exit     D0:  result code (integer)
  14576.     _________________________________________________________________
  14577.  
  14578.  
  14579.     Result codes
  14580.  
  14581.             noErr       No error
  14582.             vTypErr     QType field isn't ORD(vType)
  14583.             qErr        Task entry isn't in the queue
  14584. \ GetVBLQHdr
  14585. 24
  14586. FUNCTION GetVBLQHdr : QHdrPtr;   [Pascal only]
  14587.  
  14588.     GetVBLQHdr returns a pointer to the vertical retrace queue.
  14589. \ HandToHand
  14590. 25
  14591. FUNCTION HandToHand (VAR theHndl: Handle) : OSErr;
  14592.  
  14593.     _________________________________________________________________
  14594.  
  14595.     Trap macro  _HandToHand
  14596.  
  14597.     On entry    A0:  theHndl (handle)
  14598.  
  14599.     On exit     A0:  theHndl (handle)
  14600.                 D0:  result code (word)
  14601.     __________________________________________________________________
  14602.  
  14603.     HandToHand copies the information to which theHndl is a handle and
  14604. returns a new handle to the copy in theHndl. Since HandToHand replaces
  14605. the input parameter with a new handle, you should retain the original
  14606. value of the input parameter somewhere else, or you won't be able to
  14607. access it. For example:
  14608.  
  14609.     VAR x,y: Handle;
  14610.         err: OSErr;
  14611.  
  14612.     y := x;
  14613.     err := HandToHand(y)
  14614.  
  14615.     The original handle remains in x while y becomes a different handle
  14616. to identical data.
  14617.  
  14618.     Result codes
  14619.  
  14620.             noErr       No error
  14621.             memFullErr  Not enough room in heap
  14622.             nilHandleErr    NIL master pointer
  14623.             memWZErr    Attempt to operate on a free block
  14624. \ PtrToHand
  14625. 25
  14626. FUNCTION PtrToHand (srcPtr: Ptr; VAR dstHndl: Handle; size: LONGINT) :
  14627.         OSErr;
  14628.  
  14629.     __________________________________________________________________
  14630.  
  14631.     Trap macro  _PtrToHand
  14632.  
  14633.     On entry    A0:  srcPtr (pointer)
  14634.                 D0:  size (long word)
  14635.  
  14636.     On exit     A0:  dstHndl (handle)
  14637.                 D0:  result code (word)
  14638.     ___________________________________________________________________
  14639.  
  14640.  
  14641.  
  14642.  
  14643.  
  14644.     PtrToHand returns in dstHndl a newly created handle to a copy of the
  14645. number of bytes specified by the size parameter, beginning at the
  14646. location specified by srcPtr.
  14647.  
  14648.     Result codes
  14649.  
  14650.             noErr       No error
  14651.             memFullErr  Not enough room in heap
  14652. \ PtrToXHand
  14653. 25
  14654. FUNCTION PtrToXHand (srcPtr: Ptr; VAR dstHndl: Handle; size: LONGINT) :
  14655.                     OSErr;
  14656.  
  14657.  
  14658.     __________________________________________________________________
  14659.  
  14660.     Trap macro  _PtrToXHand
  14661.  
  14662.     On entry    A0:  srcPtr (pointer)
  14663.                 A1:  dstHndl (handle)
  14664.                 D0:  size (long word)
  14665.  
  14666.     On exit     A1:  dstHndl (handle)
  14667.                 D0:  result code (word)
  14668.     ___________________________________________________________________
  14669.  
  14670.     PtrToXHand takes the existing handle specified by dstHndl and makes
  14671. it a handle to a copy of the number of bytes specified by the size
  14672. parameter, beginning at the location specified by srcPtr.
  14673.  
  14674.     Result codes
  14675.  
  14676.             noErr       No error
  14677.             memFullErr  Not enough room in heap
  14678.             nilHandleErr    NIL master pointer
  14679.             memWZErr    Attempt to operate on a free block
  14680. \ HandAndHand
  14681. 25
  14682. FUNCTION HandAndHand (aHndl,bHndl: Handle) : OSErr;
  14683.  
  14684.     __________________________________________________________________
  14685.  
  14686.     Trap macro  _PtrToXHand
  14687.  
  14688.     On entry    A0:  aHndl (handle)
  14689.                 A1:  bHndl (handle)
  14690.  
  14691.     On exit     A1:  bHndl (handle)
  14692.                 D0:  result code (word)
  14693.     ___________________________________________________________________
  14694.  
  14695.     HandAndHand concatenates the information to which aHndl is a handle
  14696. onto the end of the information to which bHndl is a handle.
  14697.  
  14698.  
  14699.     Result codes
  14700.  
  14701.             noErr       No error
  14702.             memFullErr  Not enough room in heap
  14703.             nilHandleErr    NIL master pointer
  14704.             memWZErr    Attempt to operate on a free block
  14705. \ PtrAndHand
  14706. 25
  14707. FUNCTION PtrAndHand (pntr: Ptr; hndlk: Handle; size: LONGINT) : OSErr;
  14708.  
  14709.     __________________________________________________________________
  14710.  
  14711.     Trap macro  _PtrToXHand
  14712.  
  14713.     On entry    A0:  pntr (pointer)
  14714.                 A1:  hndl (handle)
  14715.                 D0:  size (long word)
  14716.  
  14717.     On exit     A1:  hndl (handle)
  14718.                 D0:  result code (word)
  14719.     ___________________________________________________________________
  14720.  
  14721.     PtrAndHand takes the number of bytes specified by the size
  14722. parameter, beginning at the location specified by pntr, and concatenates
  14723. them onto the end of the information to which hndl is a handle.
  14724.  
  14725.     Result codes
  14726.  
  14727.             noErr       No error
  14728.             memFullErr  Not enough room in heap
  14729.             nilHandleErr    NIL master pointer
  14730.             memWZErr    Attempt to operate on a free block
  14731. \ NGetTrapAddress
  14732. 25
  14733. FUNCTION NGetTrapAddress (trapNum: INTEGER; tType: TrapType) : LongInt;
  14734.                             [Not in ROM]
  14735.  
  14736.     NGetTrapAddress is identical to GetTrapAddress except that it
  14737. requires you to specify in tType whether the given routine is an
  14738. Operating System or a Toolbox trap.
  14739.  
  14740. Trap macro  _GetTrapAddress ,NEWOS      (bit 9 set, bit 10 clear)
  14741.             _GetTrapAddress ,NEWTOOL    (bit 9 set, bit 10 set)
  14742.  
  14743. On entry    D0:  trapNum (word)
  14744.  
  14745. On exit     A0:  address of routine
  14746. \ NSetTrapAddress
  14747. 25
  14748. FUNCTION NSetTrapAddress (trapAddr: LongInt; trapNum: INTEGER;
  14749.                             tType: TrapType);  [Not in ROM]
  14750.  
  14751.     NSetTrapAddress is identical to SetTrapAddress except that it
  14752. requires you to specify in tType whether the given routine is an
  14753. Operating System or a Toolbox trap.
  14754.  
  14755. Trap macro  _SetTrapAddress ,NEWOS      (bit 9 set, bit 10 clear)
  14756.             _SetTrapAddress ,NEWTOOL    (bit 9 set, bit 10 set)
  14757.  
  14758. On entry    A0:  trapAddr (address)
  14759.             D0:  trapNum (word)
  14760. \ RelString
  14761. 25
  14762. FUNCTION RelString (aStr,bStr: Str255; caseSens,diacSens: BOOLEAN)
  14763.                     : INTEGER;
  14764.  
  14765.     RelString is similar to EqualString except that it indicates whether
  14766. the first string is less than, equal to, or greater than the second
  14767. string by returning either ╨1, 0, or 1 respectively.
  14768.  
  14769.  
  14770. Trap macro  _RelString
  14771.             _RelString ,MARKS       (sets bit 9, for diacSens=FALSE)
  14772.             _RelString ,CASE        (sets bit 10, for caseSens=TRUE)
  14773.             _RelString ,MARKS,CASE  (sets bits 9 and 10)
  14774.  
  14775. On entry    A0:  pointer to first character of first string
  14776.             A1:  pointer to first character of second string
  14777.             D0:  high-order word:  length of first string
  14778.                  low-order word:  length of second string
  14779.  
  14780. On exit D0:    ╨1 if first string less than second,
  14781.                 0 if equal,
  14782.                 1 if first string greater than second (long word)
  14783.  
  14784.  
  14785.     RelString follows the sort order described in chapter 19 of
  14786. Volume II except for the reordering of the following ligatures:
  14787.  
  14788. « falls between ü and a
  14789. ╛ falls between î and B
  14790. ╬ falls between » and o
  14791. ╧ falls between ┐ and P
  14792. º falls between s and T
  14793.  
  14794.     If diacSens is FALSE, diacritical marks are ignored; RelString
  14795. strips diacriticals according to the following table:
  14796.  
  14797. A   <╤  Ç, ü, ╦, ╠
  14798. C   <╤  é
  14799. E   <╤  â
  14800. N   <╤  ä
  14801. O   <╤  à, ═, »
  14802. U   <╤  å
  14803. a   <╤  ç, ê, ë, è, ï, î, ╗
  14804. c   <╤  ì
  14805. e   <╤  Ä, Å, É, æ
  14806. i   <╤  Æ, ô, ö, ò
  14807. n   <╤  û
  14808. o   <╤  ù, ÿ, Ö, Ü, ¢, ┐, ╝
  14809. u   <╤  £, ¥, ₧, ƒ
  14810. y   <╤  ╪
  14811.  
  14812. Note:   This stripping is identical to that performed by the UprString
  14813.         procedure when the diacSens parameter is FALSE.
  14814.  
  14815.     If caseSens is FALSE, the comparison is not case-sensitive;
  14816. RelString performs a conversion from lower-case to upper-case characters
  14817. according to the following table:
  14818.  
  14819. A   <╤  a
  14820. . . .   <╤  . . .
  14821. Z   <╤  z
  14822. ╦   <╤  ê
  14823. ╠   <╤  ï
  14824. Ç   <╤  è
  14825. ü   <╤  î
  14826. «   <╤  ╛
  14827. é   <╤  ì
  14828. â   <╤  Ä
  14829. ä   <╤  û
  14830. à   <╤  Ü
  14831. ═   <╤  ¢
  14832. »   <╤  ┐
  14833. ╬   <╤  ╧
  14834. å   <╤  ƒ
  14835.  
  14836. Note:   This conversion is identical to that performed by the UprString
  14837.         procedure.
  14838.  
  14839. \ Environs
  14840. 25
  14841. PROCEDURE Environs (VAR rom,machine: INTEGER)  [Not in ROM]
  14842.  
  14843.     In the rom parameter, Environs returns the current ROM version
  14844. number (for a Macintosh XL, the version number of the ROM image
  14845. installed by MacWorks). To use the 128K ROM  information described
  14846. in this volume, the version number should be greater than or equal
  14847. to 117 ($75). In the machine parameter, Environs returns an indication
  14848. of which machine is in use, as follows:
  14849.  
  14850.  
  14851. CONST   macXLMachine    = 0;    {Macintosh XL}
  14852.         macMachine      = 1;    {Macintosh 128K, 512K, 512K upgraded, }
  14853.                                 { 512K enhanced, or Macintosh Plus}
  14854.  
  14855. Note:  The machine parameter does not distinguish between the Macintosh
  14856. 128K, 512K, 512K upgraded, 512K enhanced, and Macintosh Plus.
  14857. ________________________________________________________________________
  14858.  
  14859. Assembly-language note:  From assembly language, you can get this
  14860. information from the word that╒s at an offset of 8 from the beginning
  14861. of ROM (which is stored in the global variable ROMBase). The format of
  14862. this word is $00xx for the Macintosh 128K, 512K, 512K upgraded, 512K
  14863. enhanced, or Macintosh Plus, and $xxFF for the Macintosh XL, where xx
  14864. is the ROM version number. (The ROM version number will always be
  14865. between $01 and $FE.)
  14866. ________________________________________________________________________
  14867.  
  14868. \ EqualString
  14869. 25
  14870. FUNCTION EqualString (aStr,bStr: Str255; caseSens,diacSens: BOOLEAN) :
  14871.                         BOOLEAN;
  14872.  
  14873.     _________________________________________________________________
  14874.  
  14875.     Trap macro  _CmpString
  14876.                 _CmpString  ,MARKS          (sets bit 9, for
  14877.                                              diacSens=FALSE)
  14878.                 _CmpString  ,CASE           (sets bit 10, for
  14879.                                              caseSens=TRUE)
  14880.                 _CmpString   ,MARKS,CASE    (sets bits 9 and 10)
  14881.  
  14882.  
  14883.     On entry    A0:  pointer to first character of first string
  14884.                 A1:  pointer to first character of second string
  14885.                 D0:  high-order word: length of first string
  14886.                      low-order word:  length of second string
  14887.  
  14888.     On exit     D0:  0 if strings equal, 1 if strings not equal
  14889.                     (long word)
  14890.     ___________________________________________________________________
  14891.  
  14892.     EqualString compares the two given strings for equality on the basis
  14893. of their ASCII values. If caseSens is TRUE, uppercase characters are
  14894. distinguished from the corresponding lowercase characters. If diacSens
  14895. is FALSE, diacritical marks are ignored dring the comparison. The
  14896. function returns TRUE if the strings are equal.
  14897.  
  14898. (note)
  14899.     See also the International Utilities Package function
  14900.     IUEqualString, as described in the Macintosh Packages
  14901.     manual.
  14902. \ UprString
  14903. 25
  14904. PROCEDURE UprString (VAR theString: Str255; diacSens: BOOLEAN);
  14905.  
  14906.     _________________________________________________________________
  14907.  
  14908.     Trap macro  _UprString
  14909.                 _UprString  ,MARKS  (sets bit 9, for diacSens=FALSE)
  14910.  
  14911.     On entry    A0:  pointer to first charactaer of string
  14912.                 D0:  length of string (word)
  14913.  
  14914.     On exit     A0:  pointer to first character of string
  14915.     __________________________________________________________________
  14916.  
  14917.     UprString converts any lowercase letters in the given string to
  14918. uppercase, returning the converted string in theString. In addition,
  14919. diacritical marks are stripped from the string if diacSens is FALSE.
  14920. \ ReadDateTime
  14921. 25
  14922. FUNCTION ReadDateTime (VAR secs: LONGINT) : OSErr;
  14923.  
  14924.     __________________________________________________________________
  14925.  
  14926.     Trap macro  _ReadDateTime
  14927.  
  14928.     On entry    A0:  pointer to long word secs
  14929.  
  14930.     On exit     A0:  pointer to long word secs
  14931.                 D0:  result code (word)
  14932.     __________________________________________________________________
  14933.  
  14934.     ReadDateTime copies the date and time stored in the clock chip to a
  14935. low-memory location and returns it in the secs parameter. This routine
  14936. is called at system startup; you'll probably never need to call it
  14937. yourself. Instead you'll call GetDateTime (see below).
  14938.  
  14939.     __________________________________________________________________
  14940.  
  14941.     Assembly-language note:  The low-memory location to which
  14942.     ReadDateTime copies the date and time is the global variable
  14943.     Time.
  14944.     __________________________________________________________________
  14945.  
  14946.  
  14947.     Result codes    noErr       No error
  14948.                     clkRdErr    Unable to read clock
  14949. \ GetDateTime
  14950. 25
  14951. PROCEDURE GetDateTime (VAR secs: LONGINT);   [Not in ROM]
  14952.  
  14953.     GetDateTime returns in the secs parameter the contents of the low-
  14954. memory location in which the date and time is stored; if the date and
  14955. time is properly set, secs will contain the number of seconds between
  14956. midnight, January 1, 1904 and the time that the function was called.
  14957.  
  14958. (note)
  14959.     If your application disables interrupts for longer than a
  14960.     second, the number of seconds returned will not be exact.
  14961.  
  14962.  
  14963.  
  14964.     ________________________________________________________________
  14965.  
  14966.     Assembly-language note:  Assembly-language programmers can just
  14967.     access the global variable Time.
  14968.     ________________________________________________________________
  14969.  
  14970.     If you wish, you can convert the value returned by GetDateTime to a
  14971. date/time record by calling the Secs2Date procedure.
  14972.  
  14973. (note)
  14974.     Passing the value returned by GetDateTime to the
  14975.     International Utilities Package procedure IUDateString or
  14976.     IUTimeString will yield a string representing the
  14977.     corresponding date or time of day, respectively.
  14978. \ SetDateTime
  14979. 25
  14980. FUNCTION SetDateTime (secs: LONGINT) : OSErr;
  14981.  
  14982.     _________________________________________________________________
  14983.  
  14984.     Trap macro  _SetDateTime
  14985.  
  14986.     On entry    D0:  secs (long word)
  14987.  
  14988.     On exit     D0:  result code (word)
  14989.     _________________________________________________________________
  14990.  
  14991.     SetDateTime takes a number of seconds since midnight, January 1,1904
  14992. as specified by the secs parameter and writes it to the clock chip as
  14993. the current date and time. It then attempts to read the value just
  14994. written and verify it by comparing it to the secs parameter.
  14995.  
  14996.     _________________________________________________________________
  14997.  
  14998.     Assembly-language note:  SetDateTime updates the global variable
  14999.     Time to the value of the secs parameter.
  15000.     _________________________________________________________________
  15001.  
  15002.  
  15003.     Result codes    noErr       No error
  15004.                     clkWrErr    Time written did not verify
  15005.                     clkRdErr    Unable to read clock
  15006. \ Date2Secs
  15007. 25
  15008. PROCEDURE Date2Secs (date: DateTimeRec; VAR secs: LONGINT);
  15009.  
  15010.     _________________________________________________________________
  15011.  
  15012.     Trap macro  _Date2Secs
  15013.  
  15014.     On entry    A0:  pointer to date/time record
  15015.  
  15016.     On exit     D0:  secs (long word)
  15017.     _________________________________________________________________
  15018.  
  15019.     Date2Secs takes the given date/time record, converts it to the
  15020. corresponding number of seconds elapsed since midnight, January 1,
  15021. 1904, and returns the result in the secs parameter. The dayOfWeek
  15022. field of the date/time record is ignored. The values passed in the
  15023. year and month fields should be within their allowable ranges, or
  15024. unpredictable results may occur. The remaining four fields of the
  15025. date/time record may contain any value. For example, September 35 will
  15026. be interpreted as October 4, and you could specify the 300th day of the
  15027. year as January 300.
  15028. \ Secs2Date
  15029. 25
  15030. PROCEDURE Secs2Date (secs: LONGINT; VAR date: DateTimeRec);
  15031.  
  15032.     ________________________________________________________________
  15033.  
  15034.     Trap macro  _Secs2Date
  15035.  
  15036.     On entry    D0:  secs (long word)
  15037.  
  15038.     On exit     A0:  pointer to date/time record
  15039.     ________________________________________________________________
  15040.  
  15041.  
  15042.     Secs2Date takes a number of seconds elapsed since midnight,
  15043. January 1, 1904 as specified by the secs parameter, converts it to the
  15044. corresponding date and time, and returns the corresponding date/time
  15045. record in the date parameter.
  15046. \ GetTime
  15047. 25
  15048. PROCEDURE GetTime (VAR date: DateTimeRec);   [Not in ROM]
  15049.  
  15050.     GetTime takes the number of seconds elapsed since midnight,
  15051. January 1, 1904 (obtained by calling GetDateTime), converts that value
  15052. into a date and time (by calling Secs2Date), and returns the result in
  15053. the date parameter.
  15054. \ SetTime
  15055. 25
  15056. PROCEDURE SetTime (date: DateTimeRec);   [Not in ROM]
  15057.  
  15058.     SetTime takes the date and time specified by the date parameter,
  15059. converts it into the corresponding number of seconds elapsed since
  15060. midnight, January 1, 1904 (by calling Date2Secs), and then writes that
  15061. value to the clock chip as the current date time (by calling
  15062. SetDateTime).
  15063. \ InitUtil
  15064. 25
  15065. FUNCTION InitUtil : OSErr;
  15066.  
  15067.     _________________________________________________________________
  15068.  
  15069.     Trap macro  _InitUtil
  15070.  
  15071.     On exit     D0:  result code (word)
  15072.     _________________________________________________________________
  15073.  
  15074.  
  15075.     InitUtil copies the contents of parameter RAM into 20 bytes of low
  15076. memory and copies the date and time from the clock chip into its own
  15077. low-memory location. This routine is called at system startup; you'll
  15078. probably never need to call it yourself.
  15079.  
  15080.  
  15081.     _________________________________________________________________
  15082.  
  15083.     Assembly-language note:  InitUtil copies parameter RAM into 20
  15084.     bytes starting at the address SysParam and copies the date and
  15085.     time into the global variable Time.
  15086.     _________________________________________________________________
  15087.  
  15088.     If the validity status in parameter RAM is not $A8 when InitUtil is
  15089. called, an error is returned as the result code, and the default values
  15090. (given earlier in the "ParameterRAM" section) are read into the los-
  15091. memory copy of parameter RAM; these values are then written to the
  15092. clock chip itself.
  15093.  
  15094.     Result codes    noErr       No error
  15095.                     prInitErr   Validity status not $A8
  15096. \ GetSysPPtr
  15097. 25
  15098. FUNCTION GetSysPPtr : SysPPtr;   [Not in ROM]
  15099.  
  15100.     GetSysPPtr returns a pointer to the low-memory copy of parameter
  15101. RAM. You can examine the values stored in its various fields, or to
  15102. change them before calling WriteParam (below).
  15103. \ WriteParam
  15104. 25
  15105. FUNCTION WriteParam : OSErr;
  15106.  
  15107.     _________________________________________________________________
  15108.  
  15109.     Trap macro  _WriteParam
  15110.  
  15111.     On entry    A0:  SysParam (pointer)
  15112.                 D0:  MinusOne (long word)
  15113.  
  15114.                  (You have to pass the values of these global
  15115.                   variables for historical reasons.)
  15116.  
  15117.     On exit     D0:  result code (word)
  15118.     _________________________________________________________________
  15119.  
  15120.  
  15121.     WriteParam writes the low-memory copy of parameter RAM to the clock
  15122. chip. You should previously have called GetSysPPtr and changed
  15123. selected values as desired.
  15124.  
  15125.     WriteParam also attempts to verify the values written by reading
  15126. them back in and comparing them to the values in the low-memory copy.
  15127.  
  15128. (note)
  15129.     If you've accidentally written incorrect values into
  15130.     parameter RAM, the system may not be able to start up.
  15131.     If this happens, you can reset parameter RAM by removing
  15132.     the battery, letting the Macintosh sit turned off for
  15133.     about five minutes, and then putting the battery back in.
  15134.  
  15135.  
  15136.     Result code noErr       No error
  15137.                 prWrErr     Parameter RAM written did not verify
  15138. \ Enqueue
  15139. 25
  15140. PROCEDURE Enqueue (qElement: QElemPtr; theQueue: QHdrPtr);
  15141.  
  15142.     ________________________________________________________________
  15143.  
  15144.     Trap macro  _Enqueue
  15145.  
  15146.     On entry    A0:  qElement (pointer)
  15147.                 A1:  theQueue (pointer)
  15148.  
  15149.     On exit     A1:  theQueue (pointer)
  15150.     ________________________________________________________________
  15151.  
  15152.     Enqueue adds the queue entry pointer to by qElement to the end of
  15153. the queue specified by theQueue.
  15154.  
  15155. (note)
  15156.     Interrupts are disabled for a short time while the queue
  15157.     is updated.
  15158. \ Dequeue
  15159. 25
  15160. FUNCTION Dequeue (qElement: QElemPtr; theQueue: QHdrPtr) : OSErr;
  15161.  
  15162.     _________________________________________________________________
  15163.  
  15164.     Trap macro  _Dequeue
  15165.  
  15166.     On entry    A0:  qElement (pointer)
  15167.                 A1:  theQueue (pointer)
  15168.  
  15169.     On exit     A1:  theQueue (pointer)
  15170.                 D0:  result code (word)
  15171.     _________________________________________________________________
  15172.  
  15173.  
  15174.     Dequeue removes the queue entry pointed to by qElement from the
  15175. queue specified by theQueue (without deallocating the entry) and adjusts
  15176. other entries in the queue accordingly.
  15177.  
  15178. (note)
  15179.     The note under Enqueue above also applies here. In this
  15180.     case, the amount of time interrupts are disabled depends
  15181.     on the length of the queue and the position of the entry
  15182.     in the queue.
  15183.  
  15184. (note)
  15185.     To remove all entries from a queue, you can just clear
  15186.     all the fields of the queue's header.
  15187.  
  15188.  
  15189.     Result codes    noErr       No error
  15190.                     qErr        Entry not in specified queue
  15191.  
  15192.  
  15193.  
  15194.  
  15195. \ GetTrapAddress
  15196. 25
  15197. FUNCTION GetTrapAddress (trapNum: INTEGER) : LONGINT;
  15198.  
  15199.     _________________________________________________________________
  15200.  
  15201.     Trap macro  _GetTrapAddress
  15202.  
  15203.     On entry    D0:  trapNum (word)
  15204.  
  15205.     On exit     A0:  address of routine
  15206.     _________________________________________________________________
  15207.  
  15208.  
  15209.     GetTrapAddress returns the address of a routine currently installed
  15210. in the trap dispatch table under the trap number designated by trapNum.
  15211. To find out the trap number for a particular routine, see Appendix B.
  15212. \ SetTrapAddress
  15213. 25
  15214. PROCEDURE SetTrapAddress (trapAddr: LONGINT; trapNum: INTEGER);
  15215.  
  15216.  
  15217.     _________________________________________________________________
  15218.  
  15219.     Trap macro  _SetTrapAddress
  15220.  
  15221.     On entry    A0:  trapAddr (address)
  15222.                 D0:  trapNum (word)
  15223.     _________________________________________________________________
  15224.  
  15225.  
  15226.     SetTrapAddress installs in the trap dispatch table a routine whose
  15227. address is trapAddr; this routine is installed under the trap number
  15228. designated by trapNum.
  15229.  
  15230. (note)
  15231.     Remember, the trap dispatch table can address locations
  15232.     within a range of 64K bytes from the base address of ROM
  15233.     or RAM.
  15234. \ Delay
  15235. 25
  15236. PROCEDURE Delay (numTicks: LONGINT; VAR finalTicks: LONGINT);
  15237.  
  15238.     _______________________________________________________________
  15239.  
  15240.     Trap macro  _Delay
  15241.  
  15242.     On entry    A0:  numTicks (long word)
  15243.  
  15244.     On exit     D0:  finalTicks (long word)
  15245.     _______________________________________________________________
  15246.  
  15247.     Delay causes the system to wait for the number of ticks (sixtieths
  15248. of a second) specified by numTicks, and returns in finalTicks the total
  15249. number of ticks from system startup to the end of the delay.
  15250.  
  15251. (warning)
  15252.     Do not rely on the duration of the delay being exact; it
  15253.     will usually be accurate within one tick, but may be off
  15254.     more than that. The Delay procedure enables all
  15255.     interrupts and checks the tick count that's incremented
  15256.     during the vertical retrace interrupt; however, it's
  15257.     possible for this interrupt to be disabled by other
  15258.     interrupts, in which case the duration of the delay will
  15259.     not be exactly what you requested.
  15260. \ SysBeep
  15261. 25
  15262. PROCEDURE SysBeep (duration: INTEGER);
  15263.  
  15264.     SysBeep causes the system to beep for approximately the number of
  15265. ticks specified by the duration parameter. The sound decays from loud
  15266. to soft; after about five seconds it's inaudible. The initial volume of
  15267. the beep depends on the current speaker volume setting, which the user
  15268. can adjust with the Control Panel desk accessory. If the speaker
  15269. volume has been set to 0 (silent), SysBeep instead causes the menu bar
  15270. to blink once.
  15271. \ LNew
  15272. 26
  15273. FUNCTION LNew (rView,dataBounds: Rect; cSize: Point; theProc: INTEGER;
  15274.                 theWindow: WindowPtr; drawIt,hasGrow,
  15275.                 scrollHoriz,scrollVert: BOOLEAN) : ListHandle;
  15276.  
  15277.     Call LNew to create a new list. It returns a handle to the new list.
  15278. The list╒s grafPort is set to theWindow╒s port. If drawIt is FALSE,
  15279. the list is not displayed.
  15280.  
  15281.     RView specifies, in the local coordinates of theWindow, the
  15282. rectangle in which the list will be displayed. (Remember that this
  15283. doesn╒t include space for scroll bars. If the list, including scroll
  15284. bars, is to fill the entire window, rView should be 15 points smaller in
  15285. each dimension than theWindow╒s portRect.)
  15286.  
  15287.     DataBounds is the rectangle for specifying the initial array
  15288. dimensions of the list. For example to preallocate space for a list
  15289. that╒s 5 cells across by 10 cells down, you should set dataBounds to
  15290. (0,0)(5,10). If you want to allocate the space for a one-column list,
  15291. set dataBounds to (0,0)(1,0) and use LAddRow.
  15292.  
  15293.     CSize.h and cSize.v are the desired height and width of each cell in
  15294. pixels; if they╒re not specified, a default cell size is calculated
  15295. (as described above).
  15296.  
  15297.     TheProc is the resource ID of your list definition procedure; for
  15298. a text-only list, pass 0 and the default list definition procedure
  15299. (about 150 bytes in size) will be used. The list definition procedure
  15300. is called to initialize itself after all other list record fields have
  15301. been initialized; thus, it can use any of the values in the list record
  15302. (or set particular fields, such as the indent distance).
  15303.  
  15304.     If hasGrow is TRUE, the scroll bars are sized so that there╒s room
  15305. for a size box in the standard position. It╒s up to the program to
  15306. display the size box (using the Window Manager procedure DrawGrowIcon).
  15307. If scrollHoriz is TRUE, a horizontal scroll bar is placed immediately
  15308. below rView and all horizontal scrolling functions are implemented.
  15309. If scrollVert is TRUE, a vertical scroll bar is placed immediately to
  15310. the right of rView and all vertical scrolling functions are implemented.
  15311.  
  15312.     The visible rectangle is set to contain as many cells of cSize
  15313. (or the default) as will fit into rView. If the cells do not fit
  15314. exactly into rView, the visible rectangle is rounded up to the nearest
  15315. cell. Scrolling will always allow all cells to be fully displayed.
  15316. The selection flags are set to 0, and the active flag is set to TRUE.
  15317.  
  15318.  
  15319. Note:  Scrolling looks best if rView is a multiple of cSize.v in height.
  15320.  
  15321. \ LDispose
  15322. 26
  15323. PROCEDURE LDispose (lHandle: ListHandle);
  15324.  
  15325.     Call LDispose when you are through using a list. It issues a close
  15326. call to the list definition procedure, and calls the Memory Manager
  15327. procedure DisposHandle for the data handle, the Control Manager
  15328. procedure DisposeControl for both scroll bars (if they╒re there), and
  15329. DisposHandle for the list record.
  15330.  
  15331. Note:  Calling LDispose is much faster than deleting one row at a time.
  15332.  
  15333. \ LAddColumn
  15334. 26
  15335. FUNCTION LAddColumn (count,colNum: INTEGER; lHandle: ListHandle)
  15336.                     : INTEGER;
  15337.  
  15338.     LAddColumn inserts into the given list the number of columns
  15339. specified by the count parameter, starting at the column specified by
  15340. colNum. Column numbers that are greater than or equal to colNum are
  15341. increased by count. If colNum is not within dataBounds, new last
  15342. columns are added. The number of the first added column is returned
  15343. and dataBounds.right is increased by count. All cells added are empty.
  15344. If there are no cells (because dataBounds.top = dataBounds.bottom), no
  15345. cells are added, but dataBounds is still extended. If drawing is on and
  15346. the added columns (which are empty) are visible, the list and its
  15347. scrollbars are updated.
  15348.  
  15349. \ LAddRow
  15350. 26
  15351. FUNCTION LAddRow (count,rowNum: INTEGER; lHandle: ListHandle) : INTEGER;
  15352.  
  15353.     LAddRow inserts the number of rows specified by the count parameter,
  15354. starting at the row specified by rowNum. Row numbers that are greater
  15355. than or equal to rowNum are increased by count. If rowNum is not within
  15356. dataBounds, new last rows are added. The number of the first added row
  15357. is returned, and dataBounds.bottom is increased by count. All cells
  15358. added are empty. If there are no cells (because dataBounds.left =
  15359. dataBounds.right), no cells are added, but dataBounds is still extended.
  15360. If drawing is on and the added rows (which are empty) are visible, the
  15361. list and its scroll bars are updated.
  15362.  
  15363. \ LDelColumn
  15364. 26
  15365. PROCEDURE LDelColumn (count,colNum: INTEGER; lHandle: ListHandle);
  15366.  
  15367.     LDelColumn deletes the number of columns specified by the count
  15368. parameter, starting with the column specified by colNum. Column
  15369. numbers that are greater than colNum are decreased by count. If colNum
  15370. is not within dataBounds, nothing is done. DataBounds.right is
  15371. decreased by count. If drawing is on and the deleted columns were
  15372. visible, the list and its scroll bars are updated.
  15373.  
  15374.     If count is 0, or colNum = dataBounds.left AND count  > =
  15375. dataBounds.right ╨ dataBounds.left all the data in the list is quickly
  15376. deleted, dataBounds.right is set to dataBounds.left, and the number of
  15377. rows is left unchanged.
  15378.  
  15379. \ LDelRow
  15380. 26
  15381. PROCEDURE LDelRow (count,rowNum: INTEGER; lHandle: ListHandle);
  15382.  
  15383.     LDelRow deletes the number of rows specified by the count parameter,
  15384. starting with the row specified by rowNum. Row numbers that are greater
  15385. than rowNum are decreased by count. If rowNum is not within dataBounds,
  15386. nothing is done. DataBounds.bottom is decreased by count. If drawing
  15387. is on and the deleted rows were visible, the list and its scroll bars
  15388. are updated.
  15389.  
  15390.     If count is 0, or rowNum = dataBounds.top AND count > =
  15391. dataBounds.bottom ╨ dataBounds.top all the data in the list is quickly
  15392. deleted, dataBounds.bottom is set to dataBounds.top, and the number of
  15393. columns is left unchanged.
  15394.  
  15395. \ LAddToCell
  15396. 26
  15397. PROCEDURE LAddToCell (dataPtr: Ptr; dataLen: INTEGER; theCell: Cell;
  15398.                         lHandle: ListHandle);
  15399.  
  15400.     LAddToCell appends the data pointed to by dataPtr and of length
  15401. dataLen to the cell specified by theCell in lHandle. If drawing is off,
  15402. you must turn drawing on and call LDraw (or LUpdate) to display the
  15403. cell╒s new value.
  15404.  
  15405. \ LClrCell
  15406. 26
  15407. PROCEDURE LClrCell (theCell: Cell; lHandle: ListHandle);
  15408.  
  15409.     LClrCell clears the contents of the specified cell (by setting the
  15410. length to 0). If theCell is not a valid cell, nothing is done. If
  15411. drawing is off, you must turn drawing on and call LDraw to display
  15412. the cell╒s new value (or simply call the Window Manager procedure
  15413. InvalRect).
  15414.  
  15415. \ LGetCell
  15416. 26
  15417. PROCEDURE LGetCell (dataPtr: Ptr; VAR dataLen: INTEGER; theCell: Cell;
  15418.                     lHandle: ListHandle);
  15419.  
  15420.     Given a cell in theCell, LGetCell copies the cell╒s data to the
  15421. location specified by dataPtr; dataLen is the maximum number of bytes
  15422. allowed. If the data is longer than dataLen, only dataLen bytes are
  15423. copied into the location specified by dataPtr. If the data is shorter
  15424. than dataLen, dataLen is set to the true length of the cell╒s data.
  15425.  
  15426. \ LSetCell
  15427. 26
  15428. PROCEDURE LSetCell (dataPtr: Ptr; dataLen: INTEGER; theCell: Cell;
  15429.                     lHandle: ListHandle);
  15430.  
  15431.     LSetCell places the data pointed to by dataPtr and of length dataLen
  15432. into the specified cell. It replaces any data that was already in the
  15433. cell. If dataLen is 0, this is equivalent to LClrCell. If theCell is
  15434. not a valid cell, nothing is done. If drawing is off, you must turn
  15435. drawing on and call LDraw (or LUpdate) to display the cell╒s new value.
  15436.  
  15437. \ LCellSize
  15438. 26
  15439. PROCEDURE LCellSize (cSize: Point; lHandle: ListHandle);
  15440.  
  15441.     LCellSize sets the cellSize field in the list record to cSize and
  15442. updates the visible rectangle to contain cells of this size. This
  15443. command should be used only before any cells have been drawn.
  15444.  
  15445. \ LGetSelect
  15446. 26
  15447. FUNCTION LGetSelect (next: BOOLEAN; VAR theCell: Cell;
  15448.                     lHandle: ListHandle) : BOOLEAN;
  15449.  
  15450.     If next is FALSE, LGetSelect returns TRUE if the specified cell is
  15451. selected, or FALSE if not. If next is TRUE, LGetSelect returns in c the
  15452. cell coordinates of the next selected cell in the row that is greater
  15453. than or equal to theCell. If there are no more cells in the row, it
  15454. returns in theCell the cell coordinates of the next selected cell in the
  15455. next row. If there are no more rows, FALSE is returned.
  15456.  
  15457. \ LSetSelect
  15458. 26
  15459. PROCEDURE LSetSelect (setIt: BOOLEAN; theCell: Cell;
  15460.                         lHandle: ListHandle);
  15461.  
  15462.     If setIt is TRUE, LSetSelect selects the cell and redraws if it is
  15463. visible and was previously unselected. If setIt is FALSE, it deselects
  15464. the cell and redraws if necessary.
  15465.  
  15466. \ LClick
  15467. 26
  15468. FUNCTION LClick (pt: Point; modifiers: INTEGER; lHandle: ListHandle)
  15469.                     : BOOLEAN;
  15470.  
  15471.     Call LClick when there is a mouse-down event in the destination
  15472. rectangle or its scroll bars. Pt is the mouse location in local
  15473. coordinates. Modifiers is the modifiers word from the event record.
  15474. LHandle is the list to be tracked. The result is TRUE if a double-click
  15475. occurred (and the two clicks took place within the same cell).
  15476.  
  15477.     LClick keeps control until the mouse is released; each time through
  15478. its inner loop, it calls the routine whose pointer is in the lClikLoop
  15479. field of the list record.
  15480.  
  15481.     If the mouse is in the visible rectangle, cells are selected
  15482. according to the state of the modifiers and the selection flags. If the
  15483. mouse was in the cells but is dragged outside the list╒s rectangle, the
  15484. list is auto-scrolled. If the mouse was in a control, the control╒s
  15485. definition procedure is called to track the mouse. To discover which
  15486. cell was clicked in, use the LLastClick function.
  15487.  
  15488. \ LLastClick
  15489. 26
  15490. FUNCTION LLastClick (lHandle: ListHandle) : Cell;
  15491.  
  15492.     LLastClick returns the cell coordinates of the last cell clicked in.
  15493. If no cell has been clicked in since LNew, the value returned (for both
  15494. integers) is negative.
  15495.  
  15496. Note:   The value returned by this call is not the last cell
  15497.         double-clicked in, or the last cell selected, but merely the
  15498.         last cell clicked in.
  15499.  
  15500. \ LFind
  15501. 26
  15502. PROCEDURE LFind (VAR offset,len: INTEGER; theCell: Cell;
  15503.                     lHandle: ListHandle);
  15504.  
  15505.     Given a cell in theCell, LFind returns the offset and the length in
  15506. bytes of the cell╒s data. If an invalid cell is specified, offset and
  15507. len are set to ╨1. A similar procedure, LGetCell, is more convenient to
  15508. use from Pascal.
  15509.  
  15510. \ LNextCell
  15511. 26
  15512. FUNCTION LNextCell (hNext,vNext: BOOLEAN; VAR theCell: Cell;
  15513.                     lHandle: ListHandle) : BOOLEAN;
  15514.  
  15515.     Given a cell in theCell, LNextCell returns in theCell the next cell
  15516. in the list. If both hNext and vNext are TRUE, theCell is first
  15517. advanced to the next cell in the row. If there are no more cells in the
  15518. row, theCell is set to the first cell in the next row. If there are no
  15519. more rows, FALSE is returned. If only hNext is TRUE, theCell is
  15520. advanced within the current row. If only vNext is TRUE, theCell is
  15521. advanced within the current column. FALSE is returned if there are no
  15522. remaining cells in the row or column.
  15523.  
  15524. \ LRect
  15525. 26
  15526. PROCEDURE LRect (VAR cellRect: Rect; theCell: Cell; lHandle: ListHandle)
  15527.  
  15528.     LRect returns in cellRect the local (QuickDraw) coordinates of the
  15529. cell specified by theCell. If an invalid cell is specified, (0,0)(0,0)
  15530. is returned in cellRect.
  15531.  
  15532. \ LSearch
  15533. 26
  15534. FUNCTION LSearch (dataPtr: Ptr; dataLen: INTEGER; searchProc: Ptr;
  15535.                     VAR theCell: Cell; lHandle: ListHandle) : BOOLEAN;
  15536.  
  15537.     LSearch searches for the first cell greater than or equal to theCell
  15538. that contains the specified data. If a cell containing matching data is
  15539. found, the function result TRUE is returned, and the cell coordinates
  15540. are returned in theCell. If searchProc is NIL, the International
  15541. Utilities Package function IUMagIDString is called to compare the
  15542. specified data with the contents of each cell. If searchProc is not
  15543. NIL, the routine pointed to by searchProc is called.
  15544.  
  15545. Note:  Your searchProc should have the same parameters as the
  15546.         IUMagIDString function.
  15547.  
  15548. \ LSize
  15549. 26
  15550. PROCEDURE LSize (listWidth,listHeight: INTEGER; lHandle: ListHandle);
  15551.  
  15552.     You╒ll usually call LSize immediately after the Window Manager
  15553. procedure SizeWindow. It causes the bottom right of the list to be
  15554. adjusted so that the list is the width and height indicated by listWidth
  15555. and listHeight. The contents of the list and the scroll bars are
  15556. adjusted and redrawn as necessary. The values of listWidth and
  15557. listHeight do not include the scroll bars; for a list that entirely
  15558. fills the window, listWidth and listHeight should be 15 less than the
  15559. portRect if both scroll bars are present.
  15560.  
  15561. \ LDraw
  15562. 26
  15563. PROCEDURE LDraw (theCell: Cell; lHandle: ListHandle);
  15564.  
  15565.     Call LDraw after updating a cell╒s data or selection status. (You
  15566. can achieve the same result by invalidating the cell╒s rectangle and
  15567. calling LUpdate in response to the update event.)  The List Manager
  15568. makes its grafPort the current port, sets the clipping region to
  15569. the cell╒s rectangle, and calls the list definition procedure to draw
  15570. the cell. It restores the clipping region and port before exiting.
  15571.  
  15572. \ LDoDraw
  15573. 26
  15574. PROCEDURE LDoDraw (drawIt: BOOLEAN; lHandle: ListHandle);
  15575.  
  15576.     LDoDraw sets the List Manager╒s drawing mode to the state specified
  15577. by drawIt. If drawIt is TRUE, changes made by most List Manager calls
  15578. will cause some sort of drawing to take place. If drawIt is FALSE, all
  15579. cell drawing is disabled. (Two exceptions:  The scroll bars are still
  15580. updated after LSize, and the scroll arrows are still highlighted if the
  15581. user clicks them.)
  15582.  
  15583.     The recommended use of LDoDraw is to disable drawing while you╒re
  15584. building a list (that is, adding rows or columns, setting or changing
  15585. cell values, or setting default selections). Once you╒ve finished
  15586. building the list, you should then re-enable drawing. In general,
  15587. drawing should be on while you╒re in your event loop and dispatching
  15588. events to the List Manager.
  15589.  
  15590. \ LScroll
  15591. 26
  15592. PROCEDURE LScroll (dCols,dRows: INTEGER; lHandle: ListHandle);
  15593.  
  15594.     LScroll scrolls the given list by the number of columns and rows
  15595. specified in dCols and dRows, either positively (down and to the right)
  15596. or negatively (up and to the left). Scrolling is pinned to the list╒s
  15597. dataBounds. If drawing is on, LScroll does all necessary updating of
  15598. the screen.
  15599.  
  15600. \ LAutoScroll
  15601. 26
  15602. PROCEDURE LAutoScroll   (lHandle: ListHandle);
  15603.  
  15604.     For the given list, LAutoScroll scrolls the list until the first
  15605. selected cell is visible. It automatically places the first selected
  15606. cell in the top left corner of the visible rectangle.
  15607.  
  15608. \ LUpdate
  15609. 26
  15610. PROCEDURE LUpdate (theRgn: RgnHandle; lHandle: ListHandle);
  15611.  
  15612.     LUpdate should be called in response to an update event. TheRgn
  15613. should be set to the visRgn of the list╒s port (for more details, see
  15614. the BeginUpdate procedure in the Window Manager chapter). It redraws
  15615. any visible cells in lHandle that intersect theRgn. It also redraws
  15616. the controls, if necessary.
  15617.  
  15618. \ LActivate
  15619. 26
  15620. PROCEDURE LActivate (act: BOOLEAN; lHandle: ListHandle);
  15621.  
  15622.     Call LActivate to activate or deactivate the list specified by
  15623. lHandle (in response to an activate event in the window containing the
  15624. list). The act parameter should be set to TRUE to activate the list, or
  15625. FALSE to deactivate the list. LActivate highlights or unhighlights the
  15626. selections, and shows or hides the scroll bars (but not the size box, if
  15627. any).