home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / RTrace 1.0 / source / macerrors.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-23  |  23.3 KB  |  631 lines  |  [TEXT/KAHL]

  1. /*****************************************************************************\
  2. * macerrors.c                                                                 *
  3. *                                                                             *
  4. * This file contains code which is specific to the Macintosh.  It error       *
  5. * checking, error messages, and error dialogs.                                *
  6. \*****************************************************************************/
  7.  
  8. #include "rtresources.h"
  9. #include "macerrors.h"
  10. #include <setjmp.h>
  11. #include <string.h>
  12.  
  13.  
  14. /* Bounds on classes of error messages */
  15. #define    OS_ERROR_CODES_MIN                -233
  16. #define    OS_ERROR_CODES_MAX                -1
  17. #define    SYSENVIRONS_ERROR_CODES_MIN        -5502
  18. #define    SYSENVIRONS_ERROR_CODES_MAX        -5500
  19. #define    SYSTEM_ERROR_CODES_MIN            1
  20. #define    SYSTEM_ERROR_CODES_MAX            105
  21. #define    FILE_SYSTEM_ERROR_CODES_MIN        -1307
  22. #define    FILE_SYSTEM_ERROR_CODES_MAX        -1300
  23. #define PICTURE_ERROR_CODES_MIN            -11005
  24. #define    PICTURE_ERROR_CODES_MAX            -11000
  25. #define    STARTUP_MANAGER_ERROR_CODES_MIN    -351
  26. #define    STARTUP_MANAGER_ERROR_CODES_MAX    -290
  27. #define    MEMORYDISPATCH_ERROR_CODES_MIN    -625
  28. #define    MEMORYDISPATCH_ERROR_CODES_MAX    -620
  29. #define    APPLETALK_ERROR_CODES_MIN        -1029
  30. #define    APPLETALK_ERROR_CODES_MAX        -1024
  31. #define    ASP_ERROR_CODES_MIN                -1075
  32. #define    ASP_ERROR_CODES_MAX                -1066
  33. #define    ATP1_ERROR_CODES_MIN            -1105
  34. #define    ATP1_ERROR_CODES_MAX            -1096
  35. #define    ATP2_ERROR_CODES_MIN            -3109
  36. #define    ATP2_ERROR_CODES_MAX            -3101
  37. #define    PRINTER_ERROR_CODES_MIN            -4101
  38. #define    PRINTER_ERROR_CODES_MAX            -4096
  39. #define    GESTALT_ERROR_CODES_MIN            -5553
  40. #define    GESTALT_ERROR_CODES_MAX            -5550
  41.  
  42.  
  43. /* STR# resources containing error messages */
  44. #define    OS_ERROR_MESSAGES_STRN                128
  45. #define    SYSENVIRONS_ERROR_MESSAGES_STRN        129
  46. #define    SYSTEM_ERROR_MESSAGES_STRN            130
  47. #define    FILE_SYSTEM_ERROR_MESSAGES_STRN        131
  48. #define PICTURE_ERROR_MESSAGES_STRN            132
  49. #define    STARTUP_MANAGER_ERROR_MESSAGES_STRN    133
  50. #define    MEMORYDISPATCH_ERROR_MESSAGES_STRN    134
  51. #define    APPLETALK_ERROR_MESSAGES_STRN        135
  52. #define    ASP_ERROR_MESSAGES_STRN                136
  53. #define    ATP1_ERROR_MESSAGES_STRN            137
  54. #define    ATP2_ERROR_MESSAGES_STRN            138
  55. #define    PRINTER_ERROR_MESSAGES_STRN            139
  56. #define    GESTALT_ERROR_MESSAGES_STRN            140
  57.  
  58.  
  59.  
  60. /* External globals */
  61. extern Boolean        image_complete;            /* TRUE if the image is completely rendered */
  62. extern jmp_buf        environment;            /* Used to store environment to restore on error */
  63. extern Boolean        starting_up;            /* TRUE if we're still starting up */
  64. extern DialogPtr    error_dialog;            /* the Error dialog */
  65. extern DialogPtr    offer_to_abort_dialog;    /* the Offer to Abort dialog */
  66.  
  67.  
  68. /* External prototypes */
  69. extern void post_render(Boolean natural);
  70.  
  71. /* Internal prototypes */
  72. Boolean is_os_error(short error_code, short *message_offset);
  73. Boolean is_sysenvirons_error(short error_code, short *message_offset);
  74. Boolean is_system_error(short error_code, short *message_offset);
  75. Boolean is_file_system_error(short error_code, short *message_offset);
  76. Boolean is_picture_error(short error_code, short *message_offset);
  77. Boolean is_startup_manager_error(short error_code, short *message_offset);
  78. Boolean is_memorydispatch_error(short error_code, short *message_offset);
  79. Boolean is_printer_error(short error_code, short *message_offset);
  80. Boolean is_appletalk_error(short error_code, short *message_offset);
  81. Boolean is_atp1_error(short error_code, short *message_offset);
  82. Boolean is_atp2_error(short error_code, short *message_offset);
  83. Boolean is_asp_error(short error_code, short *message_offset);
  84. Boolean is_printer_error(short error_code, short *message_offset);
  85. Boolean is_gestalt_error(short error_code, short *message_offset);
  86.  
  87.  
  88.  
  89. /*****************************************************************************\
  90. * procedure abortive_error                                                    *
  91. *                                                                             *
  92. * Purpose: This procedure is called when an error is encountered during       *
  93. *          rendering.  It aborts the render, puts up an error dialog, and     *
  94. *          returns to the event loop.                                         *
  95. *                                                                             *                                                                             *
  96. * Parameters: error_code: the error code of the message to display.           *
  97. *                                                                             *                                                                             *
  98. * Created by: Greg Ferrar                                                     *
  99. * Created on: August 28, 1992                                                 *
  100. * Modified:                                                                   *
  101. \*****************************************************************************/
  102.  
  103. void abortive_error(short error_code)
  104. {
  105.  
  106.     short        item;
  107.     char        *error_string = get_mac_error_message(error_code);
  108.     Str63        error_number_string;
  109.     
  110.     /* Convert the error code to a string */
  111.     NumToString((long) error_code, error_number_string);
  112.  
  113.     /* We never finished rendering the image */
  114.     image_complete = FALSE;
  115.  
  116.     /* Display the error dialog */
  117.     ParamText (error_string, error_number_string, 0, 0);
  118.     ShowWindow(error_dialog);
  119.     SelectWindow(error_dialog);
  120.     ModalDialog ((ProcPtr) NULL, &item);
  121.     HideWindow(error_dialog);
  122.     PtoCstr (error_string);        /* in case it was a constant string */
  123.     
  124.     /* try to clean up after this failed render */
  125.     post_render(FALSE);
  126.     
  127.     /* Go back to the event loop (restore startup environment) */
  128.     longjmp(environment, 1);
  129.  
  130. }    /* abortive_error() */
  131.  
  132.  
  133.  
  134. /*****************************************************************************\
  135. * procedure abortive_string_error                                             *
  136. *                                                                             *
  137. * Purpose: This procedure is called when an error is encountered during       *
  138. *          rendering.  It aborts the render, puts up an error dialog, and     *
  139. *          returns to the event loop.                                         *
  140. *                                                                             *                                                                             *
  141. * Parameters: error_string: the error message to display.                     *
  142. *                                                                             *                                                                             *
  143. * Created by: Greg Ferrar                                                     *
  144. * Created on: August 28, 1992                                                 *
  145. * Modified:                                                                   *
  146. \*****************************************************************************/
  147.  
  148. void abortive_string_error(char *error_string)
  149. {
  150.  
  151.     short    item;
  152.  
  153.     /* We never finished rendering the image */
  154.     image_complete = FALSE;
  155.  
  156.     /* Display the error dialog */
  157.     ParamText (CtoPstr(error_string), "\pRTrace Error", 0, 0);
  158.     ShowWindow(error_dialog);
  159.     SelectWindow(error_dialog);
  160.     ModalDialog ((ProcPtr) NULL, &item);
  161.     HideWindow(error_dialog);
  162.     PtoCstr (error_string);        /* in case it was a constant string */
  163.     
  164.     /* try to clean up after this failed render */
  165.     post_render(FALSE);
  166.     
  167.     /* Go back to the event loop (restore startup environment) */
  168.     longjmp(environment, 1);
  169.  
  170. }    /* abortive_string_error() */
  171.  
  172.  
  173.  
  174. /*****************************************************************************\
  175. * procedure terminal_error                                                    *
  176. *                                                                             *
  177. * Purpose: This procedure is called when rtrace encounters an unrecoverable   *
  178. *          error.  It displays an error alert, and quits.                     *
  179. *                                                                             *                                                                             *
  180. * Parameters: error_code: the error code of the message to display.           *
  181. *                                                                             *                                                                             *
  182. * Created by: Greg Ferrar                                                     *
  183. * Created on: September 10, 1992                                              *
  184. * Modified:                                                                   *
  185. \*****************************************************************************/
  186.  
  187. void terminal_error(short error_code)
  188. {
  189.  
  190.     short     item;
  191.     char    *error_string = get_mac_error_message(error_code);
  192.     Str63    error_number_string;
  193.     
  194.     /* Convert the error code to a string */
  195.     NumToString((long) error_code, error_number_string);
  196.  
  197.     /* Display error */
  198.     ParamText (error_string, error_number_string, 0, 0);
  199.     ShowWindow(error_dialog);
  200.     SelectWindow(error_dialog);
  201.     ModalDialog ((ProcPtr) NULL, &item);
  202.  
  203.     /* Quit */
  204.     ExitToShell();
  205.     
  206. }    /* terminal_error() */
  207.  
  208.  
  209.  
  210. /*****************************************************************************\
  211. * procedure terminal_string_error                                             *
  212. *                                                                             *
  213. * Purpose: This procedure is called when rtrace encounters an unrecoverable   *
  214. *          error.  It displays an error alert, and quits.                     *
  215. *                                                                             *                                                                             *
  216. * Parameters: error_code: the error code of the message to display.           *
  217. *                                                                             *                                                                             *
  218. * Created by: Greg Ferrar                                                     *
  219. * Created on: September 10, 1992                                              *
  220. * Modified:                                                                   *
  221. \*****************************************************************************/
  222.  
  223. void terminal_string_error(char *error_string)
  224. {
  225.  
  226.     short     item;
  227.  
  228.     /* Display error */
  229.     ParamText (CtoPstr(error_string), "\pSorry", 0, 0);
  230.     ShowWindow(error_dialog);
  231.     SelectWindow(error_dialog);
  232.     ModalDialog ((ProcPtr) NULL, &item);
  233.  
  234.     /* Quit */
  235.     ExitToShell();
  236.     
  237. }    /* terminal_string_error() */
  238.  
  239.  
  240.  
  241. /*****************************************************************************\
  242. * procedure terminal_startup_error                                            *
  243. *                                                                             *
  244. * Purpose: This procedure is called when rtrace encounters an error which is  *
  245. *          terminal during startup but only abortive any other time.          *
  246. *                                                                             *                                                                             *
  247. * Parameters: error_code: the error code of the message to display.           *
  248. *                                                                             *                                                                             *
  249. * Created by: Greg Ferrar                                                     *
  250. * Created on: September 10, 1992                                              *
  251. * Modified:                                                                   *
  252. \*****************************************************************************/
  253.  
  254. void terminal_startup_error(short error_code)
  255. {
  256.  
  257.     short     item;
  258.     char    *error_string = get_mac_error_message(error_code);
  259.  
  260.     if (starting_up)
  261.         terminal_error(error_code);
  262.     else
  263.         abortive_error(error_code);
  264.     
  265. }    /* terminal_startup_error() */
  266.  
  267.  
  268.  
  269. /*****************************************************************************\
  270. * procedure possibly_terminal_string_error                                    *
  271. *                                                                             *
  272. * Purpose: This procedure is called when rtrace encounters an error which may *
  273. *          be terminal, if the user chooses.  It displays an error alert, and *
  274. *          prompts the user whether to quit or not.                           *
  275. *                                                                             *                                                                             *
  276. * Parameters: error_string: the error message to display.                     *
  277. *                                                                             *                                                                             *
  278. * Created by: Greg Ferrar                                                     *
  279. * Created on: September 10, 1992                                              *
  280. * Modified:                                                                   *
  281. \*****************************************************************************/
  282.  
  283. void possibly_terminal_string_error(char *error_string)
  284. {
  285.  
  286.     short     item;
  287.  
  288.     /* Display message, abort if appropriate */
  289.     ParamText (CtoPstr(error_string), 0, 0, 0);
  290.     ShowWindow(offer_to_abort_dialog);
  291.     SelectWindow(offer_to_abort_dialog);
  292.     ModalDialog ((ProcPtr) NULL, &item);
  293.     HideWindow(offer_to_abort_dialog);
  294.     PtoCstr (offer_to_abort_dialog);        /* in case it was a constant string */
  295.  
  296.     /* Abort if user wants to */
  297.     if (item == OFFER_ABORT_BUTTON)
  298.         ExitToShell();
  299.  
  300.     PtoCstr(error_string);
  301.  
  302. }    /* possibly_terminal_string_error() */
  303.  
  304.  
  305.  
  306. /*****************************************************************************\
  307. * procedure get_mac_error_message                                             *
  308. *                                                                             *
  309. * Purpose: This procedure takes an error code and returns the appropriate     *
  310. *          error message.                                                     *
  311. *                                                                             *                                                                             *
  312. * Parameters: error_code: the error code of the message to display.           *
  313. *             return the message string.                                      *                                                                             *
  314. *                                                                             *                                                                             *
  315. * Created by: Greg Ferrar                                                     *
  316. * Created on: September 10, 1992                                              *
  317. * Modified:                                                                   *
  318. \*****************************************************************************/
  319.  
  320. char *get_mac_error_message(short error_code)
  321. {
  322.  
  323.     Str255        error_body;
  324.     static char    error_message[256];
  325.     short        message_offset;
  326.  
  327.     /* Is it an OS error? */
  328.     if (is_os_error(error_code, &message_offset))
  329.         
  330.         /* Get the error code string */
  331.         GetIndString (error_message, OS_ERROR_MESSAGES_STRN, error_code);
  332.  
  333.     /* Is it a SysEnvirons error? */
  334.     else if (is_sysenvirons_error(error_code, &message_offset))
  335.         
  336.         /* Get the error code string */
  337.         GetIndString (error_message, SYSENVIRONS_ERROR_MESSAGES_STRN, error_code);
  338.     
  339.     /* Is it a System error? */
  340.     else if (is_system_error(error_code, &message_offset))
  341.         
  342.         /* Get the error code string */
  343.         GetIndString (error_message, SYSTEM_ERROR_MESSAGES_STRN, error_code);
  344.     
  345.     /* Is it a File System error? */
  346.     else if (is_file_system_error(error_code, &message_offset))
  347.         
  348.         /* Get the error code string */
  349.         GetIndString (error_message, FILE_SYSTEM_ERROR_MESSAGES_STRN, error_code);
  350.     
  351.     /* Is it a Picture error? */
  352.     else if (is_picture_error(error_code, &message_offset))
  353.         
  354.         /* Get the error code string */
  355.         GetIndString (error_message, PICTURE_ERROR_MESSAGES_STRN, error_code);
  356.     
  357.     /* Is it a Startup Manager error? */
  358.     else if (is_startup_manager_error(error_code, &message_offset))
  359.         
  360.         /* Get the error code string */
  361.         GetIndString (error_message, STARTUP_MANAGER_ERROR_MESSAGES_STRN, error_code);
  362.     
  363.     /* Is it a MemoryDispatch error? */
  364.     else if (is_memorydispatch_error(error_code, &message_offset))
  365.         
  366.         /* Get the error code string */
  367.         GetIndString (error_message, MEMORYDISPATCH_ERROR_MESSAGES_STRN, error_code);
  368.     
  369.     /* Is it an AppleTalk error? */
  370.     else if (is_appletalk_error(error_code, &message_offset))
  371.         
  372.         /* Get the error code string */
  373.         GetIndString (error_message, APPLETALK_ERROR_MESSAGES_STRN, error_code);
  374.     
  375.     /* Is it an ASP error? */
  376.     else if (is_asp_error(error_code, &message_offset))
  377.         
  378.         /* Get the error code string */
  379.         GetIndString (error_message, ASP_ERROR_MESSAGES_STRN, error_code);
  380.     
  381.     /* Is it a Apple Talk ATP/group 1 error? */
  382.     else if (is_atp1_error(error_code, &message_offset))
  383.         
  384.         /* Get the error code string */
  385.         GetIndString (error_message, ATP1_ERROR_MESSAGES_STRN, error_code);
  386.     
  387.     /* Is it a Apple Talk ATP/group 2 error? */
  388.     else if (is_atp2_error(error_code, &message_offset))
  389.         
  390.         /* Get the error code string */
  391.         GetIndString (error_message, ATP1_ERROR_MESSAGES_STRN, error_code);
  392.     
  393.     /* Is it a Printer error? */
  394.     else if (is_printer_error(error_code, &message_offset))
  395.         
  396.         /* Get the error code string */
  397.         GetIndString (error_message, PRINTER_ERROR_MESSAGES_STRN, error_code);
  398.     
  399.     /* Is it a Gestalt error? */
  400.     else if (is_gestalt_error(error_code, &message_offset))
  401.         
  402.         /* Get the error code string */
  403.         GetIndString (error_message, GESTALT_ERROR_MESSAGES_STRN, error_code);
  404.     
  405.     else
  406.     
  407.         /* We don't know about this error; make it blank so it will be tagged
  408.             as an unknown error */
  409.         error_message[0] = 0;
  410.     
  411.     /* If this error is blank, call it an unknown error */
  412.     if (error_message[0] == 0)
  413.         {
  414.         strcpy (error_message, "Unknown type of error");
  415.         CtoPstr(error_message);
  416.         }
  417.     
  418.     return error_message;
  419.     
  420. }    /* get_mac_error_message() */
  421.  
  422.  
  423. /*****************************************************************************\
  424. * procedures is_xxxx_error                                                    *
  425. *                                                                             *
  426. * Purpose: These procedures take an error code TRUE if it is of the a certain *
  427. *          type (specified by the xxxx in the name).  Furthermore, if it IS   *
  428. *          of the specified type, error_code will be changed to the STR#      *
  429. *          offset of the error message in the appropriate STR# resource.      *
  430. *                                                                             *                                                                             *
  431. * Parameters: error_code: the error code, becomes the STR# offset.            *
  432. *             return TRUE if the error is of that type.                       *                                                                             *
  433. *                                                                             *                                                                             *
  434. * Created by: Greg Ferrar                                                     *
  435. * Created on: September 24, 1992                                              *
  436. * Modified:                                                                   *
  437. \*****************************************************************************/
  438.  
  439. Boolean is_os_error(short error_code, short *message_offset)
  440. {
  441.  
  442.     if ((error_code > OS_ERROR_CODES_MIN) && (error_code < OS_ERROR_CODES_MAX))
  443.         {
  444.         *message_offset = OS_ERROR_CODES_MAX - error_code + 1;
  445.         return TRUE;
  446.         }
  447.     else
  448.         return FALSE;
  449.  
  450. }    /* is_os_error() */
  451.  
  452. /**********************************************/
  453.  
  454. Boolean is_sysenvirons_error(short error_code, short *message_offset)
  455. {
  456.  
  457.     if ((error_code > SYSENVIRONS_ERROR_CODES_MIN) && (error_code < SYSENVIRONS_ERROR_CODES_MAX))
  458.         {
  459.         *message_offset = SYSENVIRONS_ERROR_CODES_MAX - error_code + 1;
  460.         return TRUE;
  461.         }
  462.     else
  463.         return FALSE;
  464.  
  465. }    /* is_sysenvirons_error() */
  466.  
  467. /**********************************************/
  468.  
  469. Boolean is_system_error(short error_code, short *message_offset)
  470. {
  471.  
  472.     if ((error_code > SYSTEM_ERROR_CODES_MIN) && (error_code < SYSTEM_ERROR_CODES_MAX))
  473.         {
  474.         *message_offset = error_code;
  475.         return TRUE;
  476.         }
  477.     else
  478.         return FALSE;
  479.         
  480. }    /* is_system_error() */
  481.  
  482. /**********************************************/
  483.  
  484. Boolean is_file_system_error(short error_code, short *message_offset)
  485. {
  486.  
  487.     if ((error_code > FILE_SYSTEM_ERROR_CODES_MIN) && (error_code < FILE_SYSTEM_ERROR_CODES_MAX))
  488.         {
  489.         *message_offset = FILE_SYSTEM_ERROR_CODES_MAX - error_code + 1;
  490.         return TRUE;
  491.         }
  492.     else
  493.         return FALSE;
  494.  
  495. }    /* is_file_system_error() */
  496.  
  497. /**********************************************/
  498.  
  499. Boolean is_picture_error(short error_code, short *message_offset)
  500. {
  501.  
  502.     if ((error_code > PICTURE_ERROR_CODES_MIN) && (error_code < PICTURE_ERROR_CODES_MAX))
  503.         {
  504.         *message_offset = PICTURE_ERROR_CODES_MAX - error_code + 1;
  505.         return TRUE;
  506.         }
  507.     else
  508.         return FALSE;
  509.  
  510. }    /* is_picture_error() */
  511.  
  512. /**********************************************/
  513.  
  514. Boolean is_startup_manager_error(short error_code, short *message_offset)
  515. {
  516.  
  517.     if ((error_code > STARTUP_MANAGER_ERROR_CODES_MIN) && (error_code < STARTUP_MANAGER_ERROR_CODES_MAX))
  518.         {
  519.         *message_offset = STARTUP_MANAGER_ERROR_CODES_MAX - error_code + 1;
  520.         return TRUE;
  521.         }
  522.     else
  523.         return FALSE;
  524.  
  525. }    /* is_startup_manager_error() */
  526.  
  527. /**********************************************/
  528.  
  529. Boolean is_memorydispatch_error(short error_code, short *message_offset)
  530. {
  531.  
  532.     if ((error_code > MEMORYDISPATCH_ERROR_CODES_MIN) && (error_code < MEMORYDISPATCH_ERROR_CODES_MAX))
  533.         {
  534.         *message_offset = MEMORYDISPATCH_ERROR_CODES_MAX - error_code + 1;
  535.         return TRUE;
  536.         }
  537.     else
  538.         return FALSE;
  539.  
  540. }    /* is_memorydispatch_error() */
  541.  
  542. /**********************************************/
  543.  
  544. Boolean is_printer_error(short error_code, short *message_offset)
  545. {
  546.  
  547.     if ((error_code > PRINTER_ERROR_CODES_MIN) && (error_code < PRINTER_ERROR_CODES_MAX))
  548.         {
  549.         *message_offset = PRINTER_ERROR_CODES_MAX - error_code + 1;
  550.         return TRUE;
  551.         }
  552.     else
  553.         return FALSE;
  554.  
  555. }    /* is_printer_error() */
  556.  
  557. /**********************************************/
  558.  
  559. Boolean is_appletalk_error(short error_code, short *message_offset)
  560. {
  561.  
  562.     if ((error_code > APPLETALK_ERROR_CODES_MIN) && (error_code < APPLETALK_ERROR_CODES_MAX))
  563.         {
  564.         *message_offset = APPLETALK_ERROR_CODES_MAX - error_code + 1;
  565.         return TRUE;
  566.         }
  567.     else
  568.         return FALSE;
  569.  
  570. }    /* is_appletalk_error() */
  571.  
  572. /**********************************************/
  573.  
  574. Boolean is_atp1_error(short error_code, short *message_offset)
  575. {
  576.  
  577.     if ((error_code > ATP1_ERROR_CODES_MIN) && (error_code < ATP1_ERROR_CODES_MAX))
  578.         {
  579.         *message_offset = ATP1_ERROR_CODES_MAX - error_code + 1;
  580.         return TRUE;
  581.         }
  582.     else
  583.         return FALSE;
  584.  
  585. }    /* is_atp1_error() */
  586.  
  587. /**********************************************/
  588.  
  589. Boolean is_atp2_error(short error_code, short *message_offset)
  590. {
  591.  
  592.     if ((error_code > ATP2_ERROR_CODES_MIN) && (error_code < ATP2_ERROR_CODES_MAX))
  593.         {
  594.         *message_offset = ATP2_ERROR_CODES_MAX - error_code + 1;
  595.         return TRUE;
  596.         }
  597.     else
  598.         return FALSE;
  599.  
  600. }    /* is_atp2_error() */
  601.  
  602. /**********************************************/
  603.  
  604. Boolean is_asp_error(short error_code, short *message_offset)
  605. {
  606.  
  607.     if ((error_code > ASP_ERROR_CODES_MIN) && (error_code < ASP_ERROR_CODES_MAX))
  608.         {
  609.         *message_offset = ASP_ERROR_CODES_MAX - error_code + 1;
  610.         return TRUE;
  611.         }
  612.     else
  613.         return FALSE;
  614.  
  615. }    /* is_asp_error() */
  616.  
  617. /**********************************************/
  618.  
  619. Boolean is_gestalt_error(short error_code, short *message_offset)
  620. {
  621.  
  622.     if ((error_code > GESTALT_ERROR_CODES_MIN) && (error_code < GESTALT_ERROR_CODES_MAX))
  623.         {
  624.         *message_offset = GESTALT_ERROR_CODES_MAX - error_code + 1;
  625.         return TRUE;
  626.         }
  627.     else
  628.         return FALSE;
  629.  
  630. }    /* is_gestalt_error() */
  631.