home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / monitors / rsys / source.lha / src / RSysError.c < prev    next >
C/C++ Source or Header  |  1995-01-09  |  3KB  |  123 lines

  1. /*
  2. ***************************************************************************
  3. *
  4. * Datei:
  5. *    RSysError.c
  6. *
  7. * Inhalt:
  8. *    void ErrorHandleFull(enum err_objects errobj, enum err_actions erract, int kill, char *file, char *func, int line);
  9. *
  10. * Bemerkungen:
  11. *    Enthält die Fehlerbehandlungsroutinen für RSys. Es werden der
  12. *    Quelldateiname, die Funktion und die entsprechende
  13. *    Zeilennummer unterstützt.
  14. *
  15. * Erstellungsdatum:
  16. *    20-Apr-93    Rolf Böhme
  17. *
  18. * Änderungen:
  19. *    20-Apr-93    Rolf Böhme    Erstellung
  20. *
  21. ***************************************************************************
  22. */
  23.  
  24. #include "RSysDebug.h"
  25. #include "RSysFunc.h"
  26.  
  27. char *str_err_objects[] = {
  28.    "Broker",
  29.    "Ports",
  30.    "Files and Directories",
  31.    "Screens",
  32.    "Windows",
  33.    "Libraries",
  34.    "Devices",
  35.    "Icons",
  36.    "Gadgets and Menus",
  37.    "Environment and Prefs",
  38.    "DOS-ExAll()",
  39.    "Fonts",
  40.    "Lists and Nodes",
  41.    "Memory",
  42.    "Tasks",
  43.    "Clipboard",
  44.    "Miscallaneous"
  45. };
  46.  
  47. char *str_err_actions[] = {
  48.    "Duplicate name attempted",
  49.    "Creation failed",
  50.    "Can't find object",
  51.    "Can't kill object",
  52.    "Can't open object",
  53.    "Can't read file",
  54.    "Can't write file",
  55.    "ExAll() failed",
  56.    "Size of object to large",
  57.    "Object not saved",
  58.    "Wrong input or argument given",
  59.    "Can't examine object info",
  60.    "Object does no exist",
  61.    "Object has wrong type",
  62.    "Allocation failed"
  63. };
  64.  
  65.    /*
  66.     * ErrorHandleFull() gibt im Falle eines Fehlers eine
  67.     * vollständige Beschreibung des Fehlers unter Angabe der
  68.     * Zeilennummer und der Quelldatei sowie der Funktion, in der
  69.     * der Fehler auftrat
  70.     */
  71. void
  72. ErrorHandleFull(enum err_objects errobj, enum err_actions erract,
  73.                 int kill, char *file, char *func, int line)
  74. {
  75.    UBYTE header[BUFSIZE],
  76.          kind[BUFSIZE];
  77.    UBYTE *errfmt = (UBYTE *)"Error object  : %s\n"
  78.                             "Error action  : %s\n"
  79.                             "Source file   : %s\n"
  80.                             "Function      : %s()\n"
  81.                             "Source line   : %ld\n"
  82.                             "Count entries : %ld\n"
  83.                             "-- %s";
  84.  
  85.    DPOS;
  86.  
  87.    sprintf((char *)header, "%s %s message", NAME, (kill ? "Error" : "Info"));
  88.    strcpy((char *)kind, (kill == KILL) ?
  89.                            "Sorry...this killed the Program!" :
  90.                            "Don't worry! The program continues...");
  91.  
  92.    if (IntuitionBase)
  93.    {
  94.       MyEasyRequest(SysWnd, header,
  95.                     (UBYTE *)((kill == KILL) ? "Kill!" : "Continue"),
  96.                     errfmt,
  97.                     (UBYTE *) str_err_objects[errobj],
  98.                     (UBYTE *) str_err_actions[erract],
  99.                     (UBYTE *) file,
  100.                     (UBYTE *) func,
  101.                     line,
  102.                     countentries,
  103.                     kind);
  104.    }
  105.    else if (NOT(Flags.wb_start))
  106.    {
  107.       strcat((char *)kind, "\n");
  108.       Printf(errfmt,(ULONG) str_err_objects[errobj],
  109.                     (UBYTE *) str_err_actions[erract],
  110.                     (UBYTE *) file,
  111.                     (UBYTE *) func,
  112.                     line,
  113.                     countentries,
  114.                     kind);
  115.    }
  116.  
  117.    if (kill == KILL)
  118.       CloseAll();
  119.  
  120.    return;
  121. }
  122.  
  123.