home *** CD-ROM | disk | FTP | other *** search
- /*
- THIS SOURCE CODE WAS COPIED (and slightly modified) FROM:
-
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: Error.c
- Author: Copyright © 1992 Jason Williams
- Version: 0.15 (07 Apr 1992)
- Purpose: Centralised error handling functions
- Mods: 7 Apr 1992 - JCW - Added Error_OutOfMemory
- 30 Apr 1993 - JCW - Fixed (Wimp_ReportError prototype changed)
- */
-
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
-
- #include "DeskLib:Error.h"
- #include "DeskLib:WimpSWIs.h"
-
- static char *taskname = "PopUp Server";
-
- extern void Error_Report(int errornum, char *report)
- {
- os_error error;
- error_flags eflags;
-
- sprintf(error.errmess, "%s", report);
- error.errnum = errornum;
-
- eflags.value = 1;
- (void) Wimp_ReportError(&error, eflags.value, taskname);
- }
-
-
-
- extern void Error_ReportFatal(int errornum, char *report)
- {
- char newreport[256];
-
- sprintf(newreport,
- "%s has suffered a fatal internal error (%s) and must quit immediately",
- taskname, report);
- Error_Report(errornum, newreport);
- exit(1);
- }
-
-
- extern void Error_ReportInternal(int errornum, char *report)
- {
- Error_Report(errornum, report);
- }
-
-
- extern void Error_ReportFatalInternal(int errornum, char *report)
- {
- Error_ReportFatal(errornum, report);
- }
-
-
- extern BOOL Error_OutOfMemory(BOOL fatal, char *place)
- {
- char errmess[256];
-
- strcpy(errmess, "Unable to get enough memory for ");
- strcat(errmess, place);
-
- if (fatal)
- Error_ReportFatal(0, errmess);
- else
- Error_Report(0, errmess);
-
- return(FALSE); /* Always returns FALSE so can return FALSE from your
- * own function at the same time as reporting the error
- */
- }
-