njb_error.h
00001 #ifndef __NJB__ERROR__H
00002 #define __NJB__ERROR__H
00003
00004 #include <stdio.h>
00005 #include "libnjb.h"
00006
00011 #define EO_USBCTL 1
00012 #define EO_USBBLK 2
00013 #define EO_RDSHORT 3
00014 #define EO_NOMEM 4
00015 #define EO_BADDATA 5
00016 #define EO_EOM 6
00017 #define EO_BADSTATUS 7
00018 #define EO_BADNJBID 8
00019 #define EO_BADCOUNT 9
00020 #define EO_WRSHORT 10
00021 #define EO_NULLTMP 11
00022 #define EO_TOOBIG 12
00023 #define EO_CANTMOVE 13
00024 #define EO_TIMEOUT 14
00025 #define EO_ABORTED 15
00026 #define EO_EOF 16
00027 #define EO_DEVICE 17
00028 #define EO_INIT 18
00029 #define EO_TMPFILE 19
00030 #define EO_XFERDENIED 20
00031 #define EO_WRFILE 21
00032 #define EO_XFERERROR 22
00033 #define EO_SRCFILE 23
00034 #define EO_INVALID 24
00035 #define EO_AGAIN 25
00036 #define EO_BAD_NJB1_REPLACE 26
00039 #define MAX_ERRLEN 128
00040 #define MAX_ERRORS 16
00041
00042 typedef struct njb_error_stack_struct njb_error_stack_t;
00046 struct njb_error_stack_struct {
00047 int idx;
00048 int count;
00049 char **msg;
00050 };
00051
00052 void initialize_errorstack(njb_t *njb);
00053 void destroy_errorstack(njb_t *njb);
00054 void njb_error_add (njb_t *njb, const char *sub, int err);
00055 void njb_error_add2 (njb_t *njb, const char *sub, const char *prefix, int err);
00056 void njb_error_add3 (njb_t *njb, const char *sub, const char *prefix, const
00057 char *suffix, int err);
00058 void njb_error_add_string (njb_t *njb, const char *sub, const char* error);
00059 void njb_error_clear (njb_t *njb);
00060
00061 #define NJB_ERROR(a,b) njb_error_add(a,subroutinename,b)
00062 #define NJB_ERROR2(a,b,c) njb_error_add2(a,subroutinename,b,c)
00063 #define NJB_ERROR3(a,b,c,d) njb_error_add3(a,subroutinename,b,c,d)
00064
00065 #endif
00066