home *** CD-ROM | disk | FTP | other *** search
- /*
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: Error.h
- Author: Copyright © 1992 Jason Williams
- Improved by Philip Colmer
- Version: 1.054(13 Jul 1993)
- Purpose: Centralised error reporting, with hopefully useful routines,
- but which YOU (the user) can change if you want something
- different
- Mods: 7 Apr 1992 - JCW - Added Error_OutOfMemory
- 14 Jun 1993 - PJC - Allowed Error_Report(Fatal) to take
- variable arguments
- 13 Jul 1993 - PJC - Added varargs to "Internal" versions of above
- */
-
- #ifndef __dl_error_h
- #define __dl_error_h
-
- #ifndef __kernel_h
- #include "kernel.h"
- #endif
-
- #ifndef __dl_core_h
- #include "Core.h"
- #endif
-
-
-
- /* Error_ReportInternal ----------------------------------------------------
- * This is identical to Error_Report, except it is used for most DeskLib
- * library internal errors. User code should use Error_Report. This allows
- * you to modify the treatment of internal errors, without affecting your
- * own error handling.
- */
- extern void Error_ReportInternal(int errornum, char *report, ...);
-
-
- /* Error_ReportFatalInternal -----------------------------------------------
- * This does an Error_ReportInternal, and then calls exit()
- */
- extern void Error_ReportFatalInternal(int errornum, char *report, ...);
-
-
- /* Error_Report ------------------------------------------------------------
- * This is a centralised user-error reporting function.
- * Call it, citing any error number you want, and any error string you want.
- * The current implementation merely invokes Wimp_ReportError, but use it
- * from your code, as then the method by which you report errors can be
- * altered just by changing Error.c
- *
- * The report is a 'printf' style formatting string, optionally followed
- * by arguments just as in printf commands. This saves you from having to
- * pre-assemble strings to pass in.
- * examples:
- * Error_Report(5, "My VIDC just blew up!");
- * Error_Report(6, "You can't put the number %d in there!", thenumber);
- */
- extern void Error_Report(int errornum, char *report, ...);
-
-
- /* Error_ReportFatal -------------------------------------------------------
- * Exactly the same as Error_Report, except after reporting the error, it
- * terminates the program by calling exit()
- *
- * Takes variable arguments a la 'printf'. See Error_Report for more info.
- */
- extern void Error_ReportFatal(int errornum, char *report, ...);
-
-
- /* Error_Check -------------------------------------------------------------
- * Used to encapsulate an OS call to automatically check for error return.
- * If the OS call returns an error, then it will be reported, and the
- * function returns TRUE.
- * Otherwise, no action is taken, and FALSE is returned
- */
- extern BOOL Error_Check(os_error *error);
-
-
- /* Error_CheckFatal --------------------------------------------------------
- * Identical to Error_Check, but calls exit() if an error ocurred
- */
- extern void Error_CheckFatal(os_error *error);
-
-
- /* Error_OutOfMemory -------------------------------------------------------
- * Reports a memory error (e.g. "Unable to claim enough memory for
- * [Messages]"), where you supply just the "place" of the failure
- * (e.g. in this case, in the "Messages" section)
- * if "fatal" is TRUE, Error_ReportFatal is used, else Error_Report is used.
- *
- * This function ALWAYS returns FALSE (== 0 == NULL), so you can use:
- * if (spritearea == NULL)
- * return(Error_OutOfMemory(FALSE, "icon sprites"));
- */
- extern BOOL Error_OutOfMemory(BOOL fatal, char *place);
-
-
- #endif
-