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