home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / macintosh / programmer-faq.part2 < prev    next >
Encoding:
Text File  |  1995-07-25  |  25.9 KB  |  750 lines

  1. Subject: Comp.Sys.Mac.Programmer FAQ Part 2/2 (1/12/93)
  2. Newsgroups: comp.sys.mac.programmer,news.answers
  3. From: Daryl_Spitzer@mindlink.bc.ca (Daryl Spitzer)
  4. Date: 31 Aug 1993 00:00:16 -0400
  5.  
  6. Archive-name: macintosh/programmer-faq/part2
  7. Last-modified: 1993/01/12
  8.  
  9.  
  10.                      +---------------------------------+
  11.                      | Frequently Asked Questions List |
  12.                      |   for Comp.Sys.Mac.Programmer   |
  13.                      |         January 12, 1993        |
  14.                      |            PART  TWO            |
  15.                      +---------------------------------+
  16.  
  17.  
  18. This FAQ list is automatically posted once a week to comp.sys.mac.programmer.
  19. It is also available via anonymous ftp from ftp.cs.uoregon.edu [128.223.8.8]
  20. (user name 'anonymous', your internet address as password) in the files
  21. /pub/mac/csmp-faq-1 and /pub/mac/csmp-faq-2.
  22.  
  23. This FAQ list is maintained by Daryl Spitzer.  He can be reached at the
  24. following addresses:
  25.  
  26.    Internet:  Daryl_Spitzer@mindlink.bc.ca
  27.    SnailMail: 203 - 1385 West 12th Avenue
  28.               Vancouver, BC  (Canada)
  29.               V6H 1M2
  30.  
  31. The purpose of the FAQ list is to answer some of the most common questions
  32. asked on this group, and to refer people left with unanswered questions to
  33. available sources of additional help.  You should read the FAQ list before
  34. posting to comp.sys.mac.programmer.
  35.  
  36. Submissions, comments, etcetera, should be sent to Daryl Spitzer, as above.
  37. All such material sent will be considered to have entered the public domain
  38. (and will be subject to editing) unless specific text to the contrary
  39. accompanies the message (which may render the submission unusable).
  40.  
  41.  
  42.  
  43.                          Changes since August 3, 1992
  44.                          ----------------------------
  45.  
  46.  - the keeper of the FAQ is now Daryl Spitzer (Daryl_Spitzer@mindlink.bc.ca)
  47.  
  48.  - 1.2  Debuggers:
  49.     added Fritz Anderson's description of SourceBug
  50.  
  51.  - 2.1  The Associates and Partners Programs:
  52.     new description, DEVHOTLINE is no longer a valid AppleLink address
  53.  
  54.  - 2.3  APDA
  55.     new address and telephone numbers
  56.  
  57.  - 3.1.1  Technical Books
  58.     new Inside Macintosh volumes
  59.  
  60.  - 3.1.3  Periodicals:
  61.     MacTutor is now MacTech
  62.  
  63.  
  64.  
  65.  
  66.                               Table of Contents
  67.                               -----------------
  68.  
  69. Part One  (separate file)
  70. ---------------------
  71.  
  72.   I.    Development Software
  73.           1. Compilers
  74.           2. Debuggers
  75.           3. Other Tools
  76.  
  77.   II.   Apple Developer Programs
  78.           1. The Associates and Partners Programs
  79.           2. Apple Developer University
  80.           3. APDA
  81.           4. Developer CDs
  82.  
  83.   III.  Sources of Information
  84.           1. Books and Periodicals
  85.                1. Technical Books
  86.                2. Teaching Books
  87.                3. Periodicals
  88.           2. Mailing Lists
  89.                1. Comp.Sys.Mac.Programmer Digest
  90.                2. Think Class Library Discussion
  91.                3. MacPsych
  92.           3. Miscellaneous
  93.                1. Usenet Mac Programmer's Guide (UMPG)
  94.                2. Kent Sandvik's Frequently Asked MPW C++ and MacApp
  95. Questions
  96.                3. Comp.Sys.Mac.FAQ
  97.  
  98.   IV.   Archive Sites
  99.           1. ftp.apple.com [130.43.2.3]
  100.           2. sumex-aim.stanford.edu [36.44.0.6]
  101.           3. rascal.ics.utexas.edu [128.83.138.20]
  102.           4. mac.archive.umich.edu [141.211.164.153]
  103.           5. ftp.cs.uoregon.edu [128.223.8.8]
  104.           6. ics.uci.edu [128.195.1.1]
  105.           7. ftp.brown.edu [128.148.176.55]
  106.           8. comp.binaries.mac [newsgroup]
  107.  
  108.   V.    One-liners
  109.           1. The Main Loop and Events
  110.           2. Menus
  111.           3. Resources
  112.           4. Windows, Alerts, and Dialogs
  113.           5. Drawing
  114.           6. Files
  115.           7. Interrupts and VBL Tasks
  116.           8. Handles and Pointers
  117.           9. General
  118.  
  119.  
  120. Part Two  (this file)
  121. -------------------------
  122.  
  123.   VI.   Specific Questions Answered
  124.           1. The Main Loop and Events
  125.                1. How do you tell if a specific key is being pressed?
  126.                2. How can I get millisecond timing from the keyboard
  127.                   (or mouse)?
  128.           2. Menus
  129.                1. When do you put an ellipsis on the end of a menu item?
  130.                2. How do I get the menubar to disappear and re-appear?
  131.                3. What's the difference between the resource ID of a 'MENU'
  132.                   resource and the menuID field of that resource?
  133.           3. Windows, Alerts, and Dialogs
  134.                1. How do you put a border around the default button in a
  135.                   dialog?
  136.           4. Drawing
  137.                1. What is the fastest way to paint one pixel on the screen?
  138.                2. How do you draw directly into a pixmap without using
  139.                   QuickDraw?
  140.                3. How do you draw directly onto the screen without using
  141.                   QuickDraw?
  142.                4. What RGB value does the system use for dimmed buttons,
  143.                   menus and window titles?
  144.           5. Files
  145.                1. Why is the File Manager so hard to use?
  146.                2. How do you get a full pathname?
  147.                3. How do you set the SFGet/PutFile directory?
  148.                4. How do you access the application's data fork?
  149.           6. Handles and Pointers
  150.                1. When should I call MoveHHi?
  151.                2. Why does malloc/calloc keep crashing or returning NULL in
  152.                   Think C?
  153.           7. Standalone Code
  154.                1. How do I write an INIT?
  155.           8. General
  156.                1. How do I register signatures and file types with Apple?
  157.                2. How do I go about writing serial port communications?
  158.  
  159.  
  160.   VII.  Eternal Debates:
  161.           1. Why doesn't the Mac do preemptive multitasking?
  162.  
  163.  
  164.  
  165. =============================================================================
  166.  
  167.  
  168.                  ===========================================
  169.                    Section VI: Specific Questions Answered
  170.                  ===========================================
  171.  
  172.  
  173.  
  174. 6.1  The Main Loop and Events
  175. -----------------------------
  176.  
  177.  
  178. ----------------------------------------------------------
  179. 6.1.1  How do you tell if a specific key is being pressed?
  180. ----------------------------------------------------------
  181.  
  182. Use GetKeys.  GetKeys fills a 16-byte KeyMap structure with the state of
  183. every key.  Each bit represents a single key on the keyboard; 1 means the
  184. key is down, 0 means it is up.  Note that there can be a maximum of seven
  185. keys being pressed at a time - any of the modifier keys plus at most two
  186. other keys.
  187.  
  188. Here's an example in C:
  189.  
  190. Boolean IsKeyDown(
  191.     unsigned short theKey )  // a keyboard-specific scan code for a key
  192. {
  193.  
  194.     unsigned char  keyMap[16];
  195.  
  196.     GetKeys( (void *) keyMap );
  197.     return ((keyMap[theKey>>3] >> (theKey & 7)) & 1);
  198.  
  199. }
  200.  
  201.  
  202.  
  203. -----------------------------------------------------------------------------
  204. 6.1.2  I'm writing a psychology experiment.  How can I get millisecond timing
  205.        from the keyboard (or mouse)?
  206. -----------------------------------------------------------------------------
  207.  
  208. The simple answer is that you can't.  Although the new time manager can call
  209. routines every couple of microseconds, input goes through the event manager,
  210. which only posts events about every 16 milliseconds.  Thus, even if you poll
  211. the keyboard every 30 microseconds, you will not get better than 16 ms.
  212. resolution.  If you really need millisecond accuracy, you need to use
  213. external hardware.
  214.  
  215. The good news is that you probably don't need better than 16 ms. resolution
  216. anyway.  Measuring with 16 ms. accuracy only increases the standard deviation
  217. of your RT means by about 4.8 msec.  Read: Ulrich, R. and Giray, M. (1989).
  218. Time resolution of clocks: Effects on reaction time measurement -- Good news
  219. for bad clocks.  British Journal of Mathematical and Statistical Psychology,
  220. 42, 1-12.
  221.  
  222. By the way, there is a mailing list dedicated to running psychology
  223. experiments on the Mac.  It frequently gets tied up in arguments about
  224. millisecond timing.  The address to write to is macpsych-request@stolaf.edu.
  225.  
  226.  
  227.  
  228.  
  229. 6.2  Menus
  230. ----------
  231.  
  232.  
  233. -------------------------------------------------------------
  234. 6.2.1  When do you put an ellipsis on the end of a menu item?
  235. -------------------------------------------------------------
  236.  
  237. Put an ellipsis (...) at the end of any menu item which requires more
  238. information in order to complete or simply displays information.  Usually
  239. this involves a dialog of some kind, be it modal or non modal.
  240.  
  241.  
  242.  
  243. -----------------------------------------------------------
  244. 6.2.2  How do I get the menubar to disappear and re-appear?
  245. -----------------------------------------------------------
  246.  
  247. A set of routines to do this in Pascal can be found in the Usenet
  248. Macintosh Programmer's Guide.  You can also ftp some sample code in C
  249. from skinner.cs.uoregon.edu in /pub/mac/menu-bar.c.
  250.  
  251.  
  252.  
  253. -----------------------------------------------------------------------------
  254. 6.2.3  What's the difference between the resource ID of a 'MENU' resource and
  255.        the menuID field of that resource?
  256. -----------------------------------------------------------------------------
  257.  
  258. The resource ID of a 'MENU' resource is just the resource ID - it has no
  259. hidden meaning.  What is normally expected by beginning programmers is that
  260. the number that MenuSelect and MenuKey return is the resource ID of the menu.
  261. In fact, the number returned is the value of the menuID field of the menu,
  262. and has no relation to the resource ID of the menu.  You can set the menuID
  263. to any number you want, but by convention it is expected to be the same as
  264. the resource ID of the menu.  (You can change this value in ResEdit by
  265. opening the menu you wish to change, and selecting 'Edit Menu & MDEF ID...'
  266. from the MENU menu.)
  267.  
  268.  
  269.  
  270.  
  271. 6.3  Windows, Alerts, and Dialogs
  272. ---------------------------------
  273.  
  274.  
  275. ---------------------------------------------------------------------
  276. 6.3.1  How do you put a border around the default button in a dialog?
  277. ---------------------------------------------------------------------
  278.  
  279. The most common way to do this is to create a dummy user item in the dialog,
  280. and use SetDItem to install a procedure that outlines the default button.
  281. The dialog's "Initially visible" bit should be false and you should call
  282. ShowWindow before calling ModalDialog; otherwise, if the button is very tall,
  283. part of the outline won't be drawn.  Here is an example in C:
  284.  
  285.  
  286. /* This function draws a border around dialog item #1 */
  287.  
  288. pascal void OutlineDefault(
  289.     DialogPtr theDialog,
  290.     short     theItem )
  291. {
  292.  
  293.     Rect     itemRect;
  294.     Handle   itemHandle;
  295.     short    itemType;
  296.     short    diameter;
  297.  
  298.     GetDItem( theDialog, 1, &itemType, &itemHandle, &itemRect );
  299.     diameter = (itemRect.bottom - itemRect.top) / 2 + 6;
  300.     if ( diameter < 16 )
  301.         diameter = 16;
  302.     PenSize( 3, 3 );
  303.     InsetRect( &itemRect, -4, -4 );
  304.     FrameRoundRect( &itemRect, diameter, diameter );
  305.  
  306. }
  307.  
  308.  
  309.  
  310. /* Assume myDialog has been initialized, and item #4 is the dummy
  311.    user item for outlining the default button.  The following lines
  312.    install the outlining procedure OutlineDefault into the user
  313.    item, so that OutlineDefault will be called by the Dialog Manager
  314.    each time the dialog needs to be redrawn.  Depending on your
  315.    compiler, you may have to cast OutlineDefault to a Handle. */
  316.  
  317. GetDItem( myDialog, 4, &itemType, &itemHandle, &itemRect );
  318. SetDItem( myDialog, 4, itemType, OutlineDefault, &itemRect );
  319.  
  320.  
  321.  
  322.  
  323. 6.4  Drawing
  324. ------------
  325.  
  326.  
  327. ----------------------------------------------------------------
  328. 6.4.1  What is the fastest way to paint one pixel on the screen?
  329. ----------------------------------------------------------------
  330.  
  331. Using QuickDraw, the fastest way to draw one pixel is
  332.    MoveTo( x, y );
  333.    Line( 0, 0 );
  334. making sure that the pen size is 1 by 1.  This is about twice as fast as
  335. setting the pen size to 0 by 1 or 1 by 0 and calling Line( 1, 0 ) or
  336. Line( 0, 1 ), respectively.  I'm not sure why....
  337.  
  338. See below for how to draw a pixel without using QuickDraw.
  339.  
  340.  
  341.  
  342. ----------------------------------------------------------------------
  343. 6.4.2  How do you draw directly into a pixmap without using QuickDraw?
  344. ----------------------------------------------------------------------
  345.  
  346. As an example, here is a routine that paints a single pixel in a pixmap.
  347. To use this procedure, you just have to know what 'value' to pass in.  This
  348. depends on the current bit-depth of 'thePixMap.'  The rightmost n bits of
  349. 'value' are used for the pixel value for depth = n.  For depths of eight or
  350. less, the value of each pixel is an index into a color table.  For depth =
  351. 16,
  352. each 16-bit pixel is interpreted as an RGB value, as follows:
  353.  
  354.          Bit: 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
  355.        Value:  R  R  R  R  R  G  G  G  G  G  B  B  B  B  B  U
  356.  
  357. where R = Red, G = Green, B = Blue, and U = Unused.  For depth = 32, each
  358. 32-bit pixel is interpreted as an RGB value as follows:
  359.  
  360.          Bit: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
  361.        Value:  A  A  A  A  A  A  A  A  R  R  R  R  R  R  R  R
  362.  
  363.          Bit: 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
  364.        Value:  G  G  G  G  G  G  G  G  B  B  B  B  B  B  B  B
  365.  
  366. where R = Red, G = Green, B = Blue, and A = Alpha.
  367.  
  368.  
  369.  
  370. void SetPixel(
  371.     short           x,
  372.     short           y,
  373.     long            value,
  374.     PixMapHandle    thePixMap )
  375. {
  376.  
  377.     unsigned long   rowBytes;
  378.     unsigned char   mask;
  379.     unsigned char   shiftBits;
  380.     unsigned char   *thePixel;
  381.     unsigned char   pixelDepth;
  382.     char            mode = true32b;
  383.     Boolean         swapMode;
  384.         swapMode = PixMap32Bit( thePixMap );
  385.  
  386.     LockPixels( thePixMap );
  387.  
  388.     rowBytes = (unsigned long) ((*thePixMap)->rowBytes & 0x1fff);
  389.     thePixel = (unsigned char *) GetPixBaseAddr( thePixMap );
  390.  
  391.     pixelDepth = (*thePixMap)->pixelSize;
  392.  
  393.     switch ( pixelDepth ) {
  394.             case 1:
  395.         case 2:
  396.         case 4:
  397.         case 8:
  398.  
  399.             thePixel += (rowBytes * y) +
  400.                         (((unsigned long) pixelDepth * x) / 8L);
  401.  
  402.             shiftBits = ((8 - pixelDepth) - ((x * pixelDepth) % 8));
  403.  
  404.             mask = (unsigned char) ((1 << pixelDepth) - 1) << shiftBits;
  405.  
  406.             if ( swapMode ) {
  407.                 SwapMMUMode( &mode );
  408.             }
  409.  
  410.             *thePixel &= ~mask;
  411.             *thePixel |= (unsigned char) value << shiftBits;
  412.  
  413.             break;
  414.  
  415.  
  416.         case 16:
  417.  
  418.             thePixel += (rowBytes * y) + (2L * x);
  419.  
  420.             if ( swapMode ) {
  421.                 SwapMMUMode( &mode );
  422.             }
  423.  
  424.             *((unsigned short *)thePixel) = (unsigned short) value;
  425.  
  426.             break;
  427.  
  428.  
  429.         case 32:
  430.  
  431.             thePixel += (rowBytes * y) + (4L * x);
  432.  
  433.             if ( swapMode ) {
  434.                 SwapMMUMode( &mode );
  435.             }
  436.  
  437.             *((unsigned long *)thePixel) = value;
  438.  
  439.             break;
  440.  
  441.  
  442.         default:
  443.             break;
  444.  
  445.     }
  446.  
  447.     if ( swapMode ) {
  448.         SwapMMUMode( &mode );
  449.     }
  450.  
  451.     UnlockPixels( thePixMap );
  452.  
  453. }
  454.  
  455.  
  456.  
  457. ------------------------------------------------------------------------
  458. 6.4.3  How do you draw directly onto the screen without using QuickDraw?
  459. ------------------------------------------------------------------------
  460.  
  461. Get the pixmap for the monitor that you want to draw on, and send it to the
  462. above procedure.  For example, to draw a red dot at position 10,10 on the
  463. main screen (if the main screen is in 32-bit mode):
  464.  
  465.    GDHandle   theDevice;
  466.  
  467.    theDevice = GetMainDevice();
  468.  
  469.    SetPixel( x, y, 0x00FF0000, (*theDevice)->gdPMap );
  470.  
  471. If you are drawing directly to the screen, you should always wrap your
  472. drawing with calls to ShieldCursor and ShowCursor.  Some monitors such
  473. as the Radius Pivot series keep a virtual screen, and they don't update
  474. the real screen unless they have to.  When you write directly to the
  475. screen, you're actually writing to the virtual screen, and your drawing
  476. won't show up on the real screen until the system has some other reason
  477. to update the monitor.  Calling ShieldCursor each time you draw will
  478. force these systems to update the real screen when you expect them to.
  479.  
  480.  
  481.  
  482. -----------------------------------------------------------------------
  483. 6.4.4  What RGB value does the system use for dimmed buttons, menus and
  484.        window titles?
  485. -----------------------------------------------------------------------
  486.  
  487. The gray color does not have a fixed RGB value.  It is a weighted average of
  488. the foreground and background colors.  To obtain the appropriate 'gray' color
  489. for a given foreground and background color, use the Palette Manager routine
  490. GetGray (documented in Inside Macintosh Volume VI).
  491.  
  492. pascal Boolean GetGray( GDHandle device, const RGBColor *backGround,
  493.                         RGBColor *foreGround )
  494.   = {0x303C,0x1219,0xAAA2};
  495.  
  496. If at least one gray or intermediate color is available, GetGray stores the
  497. color in foreGround and returns true.  If no gray is available, or, if you
  498. supplied two colors, no third distinguishable color is available, the
  499. foreGround parameter is unchanged and the function returns false.
  500.  
  501. GetGray is not available in older versions of the system.  Use Gestalt to
  502. determine whether it is available.
  503.  
  504.  
  505.  
  506.  
  507. 6.5  Files
  508. ----------
  509.  
  510.  
  511. ----------------------------------------------
  512. 6.5.1  Why is the File Manager so hard to use?
  513. ----------------------------------------------
  514.  
  515. Its always those pesky wdrn's that are the problem.  Here is a summary of
  516. some of the things to know:
  517.  
  518.     vrn = volume reference number
  519.           (small negative number; e.g. -2)
  520.     wdrn = working directory reference number
  521.            (large negative number; e.g. -32123)
  522.     dirID = directory ID
  523.             (small (but long integer!) positive number; e.g. 4123)
  524.  
  525.     - vrn's and wdrn's can be used interchangably for the most part.
  526.     - A vrn represents either a volume, or the root directory of a volume.
  527.     - A wdrn represents a directory on a volume.
  528.     - A dirID represents nothing without a vrn or a wdrn.
  529.     - A dirID overrides the directory otherwise specified by the vrn or wdrn
  530.       unless it's zero, in which case it's ignored.  If it is 2 it specifies
  531.       the root directory of the volume.
  532.     - You should always use vrn,dirID pairs. To convert a wdrn into a
  533.       vrn,dirID pair use GetWDInfo, which returns the vRefNum, the dirID and
  534.       the procID of the wdRefNum.  The procID is almost always 'ERIK'.
  535.     - You can also use GetVol/SetVol to convert volume names to/from vrns.
  536.     - To store a vrn,dirID pair (between invocations of a program) convert
  537.       the vrn to a volume name & creation date (for verification) and store
  538.       them and the dirID (and a filename perhaps).
  539.  
  540.  
  541.  
  542. --------------------------------------
  543. 6.5.2  How do you get a full pathname?
  544. --------------------------------------
  545.  
  546. Take a look at Tech Note #238, available from APDA (and other places).  It
  547. tells you everything you need to know to get a full pathname, and why you
  548. should, in general, use a volume name, dirID, filename (and perhaps volume
  549. creation date) triple instead.  Also check out the code snippets available
  550. from ftp.apple.com et al.  There are a couple of snippets that give code to
  551. get a full pathname, as well as many other cool file manager tricks.
  552.  
  553.  
  554.  
  555. --------------------------------------------------
  556. 6.5.3  How do you set the SFGet/PutFile directory?
  557. --------------------------------------------------
  558.  
  559. To set the directory that is displayed by SFGet/PutFile, stuff the volume
  560. reference number into SFSaveDisk, and the dirID into CurDirStore.
  561.  
  562.      CurDirStore = $398;   Current dirID from Standard File (long)
  563.      SFSaveDisk = $214;    Negative of current vRefNum
  564.  
  565.  
  566.  
  567. -----------------------------------------------------
  568. 6.5.3  How do you access the application's data fork?
  569. -----------------------------------------------------
  570.  
  571. Call CurResFile when the application starts up.
  572. Call PBGetFCBInfo to convert that refNum into a vRefNum, dirID and name.
  573. Call HOpen with the vRefNum, dirID, and name to open up your data fork.
  574.  
  575.  
  576.  
  577.  
  578. 6.6  Handles and Pointers
  579. -------------------------
  580.  
  581.  
  582. ----------------------------------
  583. 6.6.1  When should I call MoveHHi?
  584. ----------------------------------
  585.  
  586. MoveHHi is an expensive operation; calling it when you don't need to can
  587. significantly slow down your program.  Additionally, over-calling of MoveHHi
  588. can fragment the top of your heap.  Call MoveHHi before locking a handle that
  589. is followed by some memory allocation.  To efficiently move a handle high in
  590. the heap and then lock it, you might want to call HLockHi, a call new with
  591. MPW 3.2 and THINK C 5.0 (probably THINK Pascal 4.0 as well).
  592.  
  593.  
  594.  
  595. -------------------------------------------------------------------------
  596. 6.6.2  Why does malloc/calloc keep crashing or returning NULL in Think C?
  597. -------------------------------------------------------------------------
  598.  
  599. #include <stdlib.h>
  600.  
  601. Explanation:  In THINK C, parameters and return values are 2-byte ints by
  602. default, which causes the value passed to malloc to be $10000 times as large
  603. as you think it is, and causes the upper bytes of the return value to be
  604. zeroed.  Including stdlib includes a prototype which overrides the defaults.
  605.  
  606. Another common cause of problems with malloc is overwriting the end of a
  607. string, such as only mallocing the size of the string and then writing the
  608. string plus a null into the malloc'd space.  Think's malloc algorithm stores
  609. block size information in space adjacent to the storage it allocates, so
  610. overwriting the storage tends to cause havoc. The problem may not show
  611. immediately since it will probably be the next malloc that encounters
  612. problems.
  613.  
  614.  
  615.  
  616.  
  617. 6.7  Standalone Code
  618. --------------------
  619.  
  620.  
  621. ------------------------------
  622. 6.7.1  How do I write an INIT?
  623. ------------------------------
  624.  
  625. There is a simple INIT (SetWindow INIT) with source code and explanations in
  626. the Usenet Macintosh Programmer's Guide.  There is also a chapter on writing
  627. system extensions in Macintosh Programming Secrets (2nd Ed.).  Be sure to
  628. check out the ftp sites (especially ftp.apple.com) for sample inits.
  629.  
  630.  
  631.  
  632.  
  633. 6.8  General
  634. ------------
  635.  
  636.  
  637. --------------------------------------------------------------
  638. 6.8.1  How do I register signatures and file types with Apple?
  639. --------------------------------------------------------------
  640.  
  641. Registering a signature and file type is free, and you don't have to be an
  642. Apple Partner or Associate.  You can ftp the registration form from
  643. ftp.apple.com; it's available as
  644.      /dts/mac/registration/creator-file-type-form.txt.
  645.  
  646.  
  647.  
  648. -------------------------------------------------------------------------
  649. 6.8.2  How do I go about writing serial port communications?
  650.  
  651. These days, it is best to use the new Comunications Toolbox (CTB).  By
  652. utiizing the CTB, you will be able to write your code to a single
  653. specification, and the code will work with all current CTB "tools" and all
  654. future CTB tools. The CTB tools allow programmers to extend the CTB's
  655. functionality. There is a tool for each facet of the communications puzzle:
  656. Connection Tools, Terminal Tools, and File Transfer Tools.
  657.  
  658. For example, once I have written a piece of code that uses the Serial tool to
  659. connect me to a terminal server, combined with the VT102 Tool to emulate a
  660. vt102 terminal, and the XMODEM Macbinary Tool to transfer files, the same
  661. code will work with Apple Modem Tool, TCP/IP, AppleTalk ADSP, ISDN, X.25, and
  662. all future Connection Tools. Further, the terminal can emulate a VT320,
  663. ASCII, or other terminals. Files may be transfered with XMODEM, TEXT, and
  664. soon ZMODEM and Kermit protocols.
  665.  
  666. The disadvantage of the CTB is that you must limit yourself to the
  667. specification of the Connection, Terminal, and File Transfer interfaces.
  668. These limitations are *rarely* a problem, but clearly something like a FAX
  669. interface program or real time data analyzer, would have to seriously
  670. consider the interfaces before committing.
  671.  
  672. For most standard communications applications, such as terminal emulators,
  673. Bulletin Board Systems, etc., the CTB is the correct choice.
  674.  
  675. You can only get the CTB development kit from APDA.  It is affordable,
  676. somewhere just under $100.  This includes working sample code.
  677.  
  678.  
  679.  
  680.  
  681.  
  682.                       ================================
  683.                         Section VII: Eternal Debates
  684.                       ================================
  685.  
  686.  
  687. These questions have no final answers.  They pop up every few months and
  688. waste a tremendous amount of valuable network resources on discussions
  689. that will never be resolved.  Most people would be happy if they were
  690. never discussed again in this newsgroup.
  691.  
  692.  
  693. 7.1  Why doesn't the Mac do preemptive multitasking?
  694. ----------------------------------------------------
  695.  
  696. Pro-preemptives claim the current scheme is too vulnerable to ill-behaved
  697. applications and too much trouble for application writers.  Anti-
  698. preemptives claim that preemptive multitasking would reduce interactive
  699. response, and that the current cooperative system works well.
  700.  
  701.  
  702.  
  703.  
  704.  
  705.                        ==============================
  706.                          Credits / Acknowledgements
  707.                        ==============================
  708.  
  709.  
  710. Many thanks to Ben Haller, who started this whole thing, and did quite a lot
  711. of work on this posting before handing it off to Michael A. Kelly.  Many
  712. thanks to Michael A. Kelly also, for all his work in establishing and
  713. maintaining this FAQ (in addition to continuing to keep the
  714. Comp.Sys.Mac.Programmer Digest) before passing the baton.
  715.  
  716. Thanks to these people for proofreading this list during its development:
  717.     Ben Haller
  718.     Wally Wedel
  719.     John B. Matthews
  720.     Patrick Beard
  721.     Steve Zellers
  722.  
  723. Thanks to Chris Webster for the one-liners.
  724.  
  725. Thanks to Peter Lewis for the answers to the following specific questions:
  726.     6.2.1  When do you put an ellipsis on the end of a menu item?
  727.     6.5.1  Why is the File Manager so hard to use?
  728.     6.5.2  How do you get a full pathname?
  729.     6.5.3  How do you set the SFGet/PutFile directory?
  730.  
  731. Thanks to Greg Ferrar for the review on TMON Pro.
  732.  
  733. Thanks to John Rinaldo for the review on Jasik's Debugger.
  734.  
  735. Thanks for Fritz Anderson for his descriptions of SourceBug and the new
  736. Inside Macintosh volumes.
  737.  
  738. And thanks to everyone who has offered suggestions or constructive
  739. criticism....  Keep those comments coming!
  740.  
  741.  
  742.  
  743.  
  744. --
  745. -------------------------------------------------------------------
  746.  Daryl_Spitzer@mindlink.bc.ca     "Life isn't just, life just is."
  747.          a2251@mindlink.bc.ca              -- Me  (I think.)
  748. -------------------------------------------------------------------
  749.  
  750.