diff --git a/.gitignore b/.gitignore index 6b192a3..20a5d2d 100644 --- a/.gitignore +++ b/.gitignore @@ -33,8 +33,6 @@ calc-static calc.1 calc.spec calc.usage -calcerr.c -calcerr.h charbit.h chatbit chk_c @@ -55,6 +53,8 @@ custom/libcustcalc* debug.out endian endian_calc.h +errcode +errsym.h fposval fposval.h func.show diff --git a/CHANGES b/CHANGES index 30aab81..08b8b41 100644 --- a/CHANGES +++ b/CHANGES @@ -229,6 +229,47 @@ The following are the changes from calc version 2.14.3.5 to date: of the calc error code system as well as libcalc interface where applicable. + Changed #define E_USERDEF to #define E__USERDEF. + + Removed use of E_USERDEF, E__BASE, E__COUNT, and E__HIGHEST + from custom/c_sysinfo because the c_sysinfo is just a demo + and this will simplify the custom/Makefile. + + The include file calcerr.h is now the errsym.h include file. + The calcerr.tbl has been replaced by errtbl.c and errtbl.h. + + The calcerr_c.awk, calcerr_c.sed, calcerr_h.awk, and + calcerr_h.sed files are now obsolete and have been removed. + The calcerr.c and calcerr.h now obsolete and are no longer built. + + The calc computation error codes, symbols and messages are now in + a error_table[] array of struct errtbl. + + An E_STRING is a string corresponds to an error code #define. + For example, the E_STRING for the calc error E_STRCAT, + is the string "E_STRING". An E_STRING must now match + the regular expression: "^E_[A-Z0-9_]+$". + + The old array error_table[] of error message strings has been + replaced by a new error_table[] array of struct errtbl. The struct + errtbl array holds calc errnum error codes, the related E_STRING + symbol as a string, and the original related error message. + To add new computation error codes, add them near the bottom of the + error_table[] array, just before the NULL entry. + + The ./errcode utility, when run, will verify the consistency of + the error_table[] array. + + The Makefile uses ./errcode -e to generate the contents of + help/errorcodes file. The help errorcodes now prints + information from the new cstruct errtbl error_table[] array. + + The help/errorcodes.hdr and help/errorcodes.sed files are + now obsolete and have been removed. + + The Makefile uses ./errcode -d to generate the contents of the + errsym.h include file. + The following are the changes from calc version 2.14.3.4 to 2.14.3.5: diff --git a/Makefile b/Makefile index 690b00d..45abb8b 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,7 @@ V=@: # LIBSRC= addop.c assocfunc.c blkcpy.c block.c byteswap.c \ codegen.c comfunc.c commath.c config.c const.c custom.c \ - file.c func.c hash.c help.c hist.c input.c jump.c label.c \ + errtbl.c file.c func.c hash.c help.c hist.c input.c jump.c label.c \ lib_calc.c lib_util.c listfunc.c matfunc.c math_error.c \ obj.c opcodes.c pix.c poly.c prime.c qfunc.c qio.c \ qmath.c qmod.c qtrans.c quickhash.c seed.c sha1.c size.c \ @@ -136,12 +136,12 @@ LIBSRC= addop.c assocfunc.c blkcpy.c block.c byteswap.c \ # the object files which are built into a math link library # -# There MUST be a .o for every .c in LIBSRC plus calcerr.o +# There MUST be a .o for every .c in LIBSRC # which is built via this Makefile. # -LIBOBJS= addop.o assocfunc.o blkcpy.o block.o byteswap.o calcerr.o \ +LIBOBJS= addop.o assocfunc.o blkcpy.o block.o byteswap.o \ codegen.o comfunc.o commath.o config.o const.o custom.o \ - file.o func.o hash.o help.o hist.o input.o jump.o label.o \ + errtbl.o file.o func.o hash.o help.o hist.o input.o jump.o label.o \ lib_calc.o lib_util.o listfunc.o matfunc.o math_error.o \ obj.o opcodes.o pix.o poly.o prime.o qfunc.o qio.o \ qmath.o qmod.o qtrans.o quickhash.o seed.o sha1.o size.o \ @@ -163,14 +163,14 @@ CALCOBJS= calc.o # these .h files are needed to build the math link library # LIB_H_SRC= alloc.h banned.h blkcpy.h block.h bool.h byteswap.h calc.h \ - cmath.h config.h custom.h decl.h file.h func.h hash.h hist.h \ - int.h jump.h label.h lib_util.h lib_calc.h nametype.h \ + cmath.h config.h custom.h decl.h errtbl.h file.h func.h hash.h \ + hist.h int.h jump.h label.h lib_util.h lib_calc.h nametype.h \ opcodes.h prime.h qmath.h sha1.h str.h strl.h \ symbol.h token.h value.h zmath.h zrand.h zrandom.h attribute.h # we build these .h files during the make # -BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \ +BUILD_H_SRC= align32.h args.h conf.h endian_calc.h errsym.h \ fposval.h have_ban_pragma.h have_const.h have_fgetsetpos.h \ have_fpos_pos.h have_getpgid.h have_getprid.h have_getsid.h \ have_gettime.h have_memmv.h have_newstr.h have_offscl.h \ @@ -184,7 +184,7 @@ BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \ # we build these .c files during the make # -BUILD_C_SRC= calcerr.c +BUILD_C_SRC= # these .c files may be used in the process of building BUILD_H_SRC # @@ -201,8 +201,7 @@ UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \ # these awk and sed tools are used in the process of building BUILD_H_SRC # and BUILD_C_SRC # -UTIL_MISC_SRC= calcerr_h.sed calcerr_h.awk calcerr_c.sed calcerr_c.awk \ - calcerr.tbl check.awk fposval.h.def +UTIL_MISC_SRC= fposval.h.def # these .o files may get built in the process of building BUILD_H_SRC # @@ -293,7 +292,7 @@ CALC_STATIC_LIBS= libcalc.a libcustcalc.a CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION} SYM_DYNAMIC_LIBS= libcalc${LIB_EXT} libcustcalc${LIB_EXT} \ libcalc${LIB_EXT_VER} libcustcalc${LIB_EXT_VER} -EARLY_TARGETS= hsrc .hsrc custom/.all custom/Makefile +EARLY_TARGETS= errsym.h hsrc .hsrc custom/.all custom/Makefile # list of sample programs that need to be built to satisfy sample rule # @@ -2172,25 +2171,10 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h \ ${TRUE}; \ fi -calcerr.h: calcerr.tbl calcerr_h.sed calcerr_h.awk ${MK_SET} - ${Q} ${RM} -f calerr.h +errsym.h: errcode${EXT} + ${Q} ${RM} -f $@ ${H} echo 'forming $@' - ${Q} echo '/*' > $@ - ${Q} echo ' * DO NOT EDIT' >> $@ - ${Q} echo ' *' >> $@ - ${Q} echo ' * generated by calcerr.tbl via Makefile' >> $@ - ${Q} echo ' */' >> $@ - ${Q} echo '' >> $@ - ${Q} echo '' >> $@ - ${Q} echo '#if !defined(CALC_CALCERR_H)' >> $@ - ${Q} echo '#define CALC_CALCERR_H' >> $@ - ${Q} echo '' >> $@ - ${Q} echo '' >> $@ - ${Q} ${SED} -f calcerr_h.sed < calcerr.tbl | \ - ${AWK} -f calcerr_h.awk >> $@ - ${Q} echo '' >> $@ - ${Q} echo '' >> $@ - ${Q} echo '#endif /* !CALC_CALCERR_H */' >> $@ + ./errcode${EXT} -d > $@ ${H} echo '$@ formed' -@if [ -z "${Q}" ]; then \ echo ''; \ @@ -2202,27 +2186,9 @@ calcerr.h: calcerr.tbl calcerr_h.sed calcerr_h.awk ${MK_SET} ${TRUE}; \ fi -calcerr.c: calcerr.tbl calcerr_c.sed calcerr_c.awk ${MK_SET} - ${Q} ${RM} -f calerr.c - ${H} echo 'forming $@' - ${Q} echo '/*' > $@ - ${Q} echo ' * DO NOT EDIT' >> $@ - ${Q} echo ' *' >> $@ - ${Q} echo ' * generated by calcerr.tbl via Makefile' >> $@ - ${Q} echo ' */' >> $@ - ${Q} echo '' >> $@ - ${Q} ${SED} -f calcerr_c.sed < calcerr.tbl | \ - ${AWK} -f calcerr_c.awk >> $@ - ${H} echo '$@ formed' - -@if [ -z "${Q}" ]; then \ - echo ''; \ - echo '=-=-= start of $@ =-=-='; \ - ${CAT} $@; \ - echo '=-=-= end of $@ =-=-='; \ - echo ''; \ - else \ - ${TRUE}; \ - fi +errcode${EXT}: errtbl.c errtbl.h have_const.h ${MK_SET} + ${RM} -f $@ + ${LCC} ${ICFLAGS} ${ILDFLAGS} -DERRCODE_SRC errtbl.c -o $@ have_unused.h: have_unused.c have_stdlib.h have_ban_pragma.h \ ${MK_SET} @@ -2467,7 +2433,7 @@ help/builtin: help/Makefile \ ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' help/errorcodes: help/Makefile \ - calcerr.h help/errorcodes.hdr help/errorcodes.sed + errcode${EXT} ${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking builtin rule for help =-=-=-=-=' ${RM} -f $@ @@ -3334,6 +3300,7 @@ olduninstall: ${RM} -f inst_files ${RM} -f ${CALC_INCDIR}/calcerr.c ${RM} -f ${CALC_INCDIR}/have_fgetsetpos.h + ${RM} -f ${CALC_INCDIR}/calcerr.h ${RM} -f -v Makefile.simple Makefile.simple.bak ${RM} -f -v custom/Makefile.simple custom/Makefile.simple.bak @@ -3369,6 +3336,7 @@ clean: ${RM} -f endian.h stdarg.h libcalcerr.a cal/obj help/obj ${RM} -f have_vs.c std_arg.h try_stdarg.c fnvhash.c ${RM} -f have_malloc.h math_error.h string.h string.c + ${RM} -f calcerr.c calcerr.h calcerr.o ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' clobber: clean @@ -4023,12 +3991,12 @@ addop.o: block.h addop.o: bool.h addop.o: byteswap.h addop.o: calc.h -addop.o: calcerr.h addop.o: charbit.h addop.o: cmath.h addop.o: config.h addop.o: decl.h addop.o: endian_calc.h +addop.o: errsym.h addop.o: func.h addop.o: hash.h addop.o: have_ban_pragma.h @@ -4064,12 +4032,12 @@ assocfunc.o: banned.h assocfunc.o: block.h assocfunc.o: bool.h assocfunc.o: byteswap.h -assocfunc.o: calcerr.h assocfunc.o: charbit.h assocfunc.o: cmath.h assocfunc.o: config.h assocfunc.o: decl.h assocfunc.o: endian_calc.h +assocfunc.o: errsym.h assocfunc.o: hash.h assocfunc.o: have_ban_pragma.h assocfunc.o: have_const.h @@ -4095,12 +4063,12 @@ blkcpy.o: block.h blkcpy.o: bool.h blkcpy.o: byteswap.h blkcpy.o: calc.h -blkcpy.o: calcerr.h blkcpy.o: charbit.h blkcpy.o: cmath.h blkcpy.o: config.h blkcpy.o: decl.h blkcpy.o: endian_calc.h +blkcpy.o: errsym.h blkcpy.o: file.h blkcpy.o: hash.h blkcpy.o: have_ban_pragma.h @@ -4126,12 +4094,12 @@ block.o: block.c block.o: block.h block.o: bool.h block.o: byteswap.h -block.o: calcerr.h block.o: charbit.h block.o: cmath.h block.o: config.h block.o: decl.h block.o: endian_calc.h +block.o: errsym.h block.o: hash.h block.o: have_ban_pragma.h block.o: have_const.h @@ -4178,7 +4146,6 @@ calc.o: bool.h calc.o: byteswap.h calc.o: calc.c calc.o: calc.h -calc.o: calcerr.h calc.o: charbit.h calc.o: cmath.h calc.o: conf.h @@ -4186,6 +4153,7 @@ calc.o: config.h calc.o: custom.h calc.o: decl.h calc.o: endian_calc.h +calc.o: errsym.h calc.o: func.h calc.o: hash.h calc.o: have_ban_pragma.h @@ -4216,11 +4184,6 @@ calc.o: symbol.h calc.o: token.h calc.o: value.h calc.o: zmath.h -calcerr.o: banned.h -calcerr.o: calcerr.c -calcerr.o: calcerr.h -calcerr.o: have_ban_pragma.h -calcerr.o: have_const.h charbit.o: banned.h charbit.o: charbit.c charbit.o: have_ban_pragma.h @@ -4239,7 +4202,6 @@ codegen.o: block.h codegen.o: bool.h codegen.o: byteswap.h codegen.o: calc.h -codegen.o: calcerr.h codegen.o: charbit.h codegen.o: cmath.h codegen.o: codegen.c @@ -4247,6 +4209,7 @@ codegen.o: conf.h codegen.o: config.h codegen.o: decl.h codegen.o: endian_calc.h +codegen.o: errsym.h codegen.o: func.h codegen.o: hash.h codegen.o: have_ban_pragma.h @@ -4324,7 +4287,6 @@ config.o: block.h config.o: bool.h config.o: byteswap.h config.o: calc.h -config.o: calcerr.h config.o: charbit.h config.o: cmath.h config.o: config.c @@ -4332,6 +4294,7 @@ config.o: config.h config.o: custom.h config.o: decl.h config.o: endian_calc.h +config.o: errsym.h config.o: hash.h config.o: have_ban_pragma.h config.o: have_const.h @@ -4362,13 +4325,13 @@ const.o: block.h const.o: bool.h const.o: byteswap.h const.o: calc.h -const.o: calcerr.h const.o: charbit.h const.o: cmath.h const.o: config.h const.o: const.c const.o: decl.h const.o: endian_calc.h +const.o: errsym.h const.o: hash.h const.o: have_ban_pragma.h const.o: have_const.h @@ -4392,7 +4355,6 @@ custom.o: block.h custom.o: bool.h custom.o: byteswap.h custom.o: calc.h -custom.o: calcerr.h custom.o: charbit.h custom.o: cmath.h custom.o: config.h @@ -4400,6 +4362,7 @@ custom.o: custom.c custom.o: custom.h custom.o: decl.h custom.o: endian_calc.h +custom.o: errsym.h custom.o: hash.h custom.o: have_ban_pragma.h custom.o: have_const.h @@ -4421,6 +4384,10 @@ endian.o: endian.c endian.o: have_ban_pragma.h endian.o: have_stdlib.h endian.o: have_unistd.h +errtbl.o: decl.h +errtbl.o: errtbl.c +errtbl.o: errtbl.h +errtbl.o: have_const.h file.o: alloc.h file.o: attribute.h file.o: banned.h @@ -4428,12 +4395,12 @@ file.o: block.h file.o: bool.h file.o: byteswap.h file.o: calc.h -file.o: calcerr.h file.o: charbit.h file.o: cmath.h file.o: config.h file.o: decl.h file.o: endian_calc.h +file.o: errsym.h file.o: file.c file.o: file.h file.o: fposval.h @@ -4490,13 +4457,14 @@ func.o: block.h func.o: bool.h func.o: byteswap.h func.o: calc.h -func.o: calcerr.h func.o: charbit.h func.o: cmath.h func.o: config.h func.o: custom.h func.o: decl.h func.o: endian_calc.h +func.o: errsym.h +func.o: errtbl.h func.o: file.h func.o: func.c func.o: func.h @@ -4539,12 +4507,12 @@ hash.o: block.h hash.o: bool.h hash.o: byteswap.h hash.o: calc.h -hash.o: calcerr.h hash.o: charbit.h hash.o: cmath.h hash.o: config.h hash.o: decl.h hash.o: endian_calc.h +hash.o: errsym.h hash.o: hash.c hash.o: hash.h hash.o: have_ban_pragma.h @@ -4667,13 +4635,13 @@ help.o: block.h help.o: bool.h help.o: byteswap.h help.o: calc.h -help.o: calcerr.h help.o: charbit.h help.o: cmath.h help.o: conf.h help.o: config.h help.o: decl.h help.o: endian_calc.h +help.o: errsym.h help.o: hash.h help.o: have_ban_pragma.h help.o: have_const.h @@ -4700,12 +4668,12 @@ hist.o: block.h hist.o: bool.h hist.o: byteswap.h hist.o: calc.h -hist.o: calcerr.h hist.o: charbit.h hist.o: cmath.h hist.o: config.h hist.o: decl.h hist.o: endian_calc.h +hist.o: errsym.h hist.o: hash.h hist.o: have_ban_pragma.h hist.o: have_const.h @@ -4738,13 +4706,13 @@ input.o: block.h input.o: bool.h input.o: byteswap.h input.o: calc.h -input.o: calcerr.h input.o: charbit.h input.o: cmath.h input.o: conf.h input.o: config.h input.o: decl.h input.o: endian_calc.h +input.o: errsym.h input.o: hash.h input.o: have_ban_pragma.h input.o: have_const.h @@ -4780,12 +4748,12 @@ label.o: block.h label.o: bool.h label.o: byteswap.h label.o: calc.h -label.o: calcerr.h label.o: charbit.h label.o: cmath.h label.o: config.h label.o: decl.h label.o: endian_calc.h +label.o: errsym.h label.o: func.h label.o: hash.h label.o: have_ban_pragma.h @@ -4814,7 +4782,6 @@ lib_calc.o: block.h lib_calc.o: bool.h lib_calc.o: byteswap.h lib_calc.o: calc.h -lib_calc.o: calcerr.h lib_calc.o: charbit.h lib_calc.o: cmath.h lib_calc.o: conf.h @@ -4822,6 +4789,7 @@ lib_calc.o: config.h lib_calc.o: custom.h lib_calc.o: decl.h lib_calc.o: endian_calc.h +lib_calc.o: errsym.h lib_calc.o: func.h lib_calc.o: hash.h lib_calc.o: have_ban_pragma.h @@ -4877,12 +4845,12 @@ listfunc.o: banned.h listfunc.o: block.h listfunc.o: bool.h listfunc.o: byteswap.h -listfunc.o: calcerr.h listfunc.o: charbit.h listfunc.o: cmath.h listfunc.o: config.h listfunc.o: decl.h listfunc.o: endian_calc.h +listfunc.o: errsym.h listfunc.o: hash.h listfunc.o: have_ban_pragma.h listfunc.o: have_const.h @@ -4914,12 +4882,12 @@ matfunc.o: banned.h matfunc.o: block.h matfunc.o: bool.h matfunc.o: byteswap.h -matfunc.o: calcerr.h matfunc.o: charbit.h matfunc.o: cmath.h matfunc.o: config.h matfunc.o: decl.h matfunc.o: endian_calc.h +matfunc.o: errsym.h matfunc.o: hash.h matfunc.o: have_ban_pragma.h matfunc.o: have_const.h @@ -4947,12 +4915,12 @@ math_error.o: block.h math_error.o: bool.h math_error.o: byteswap.h math_error.o: calc.h -math_error.o: calcerr.h math_error.o: charbit.h math_error.o: cmath.h math_error.o: config.h math_error.o: decl.h math_error.o: endian_calc.h +math_error.o: errsym.h math_error.o: hash.h math_error.o: have_ban_pragma.h math_error.o: have_const.h @@ -4978,12 +4946,12 @@ obj.o: block.h obj.o: bool.h obj.o: byteswap.h obj.o: calc.h -obj.o: calcerr.h obj.o: charbit.h obj.o: cmath.h obj.o: config.h obj.o: decl.h obj.o: endian_calc.h +obj.o: errsym.h obj.o: func.h obj.o: hash.h obj.o: have_ban_pragma.h @@ -5015,13 +4983,13 @@ opcodes.o: block.h opcodes.o: bool.h opcodes.o: byteswap.h opcodes.o: calc.h -opcodes.o: calcerr.h opcodes.o: charbit.h opcodes.o: cmath.h opcodes.o: config.h opcodes.o: custom.h opcodes.o: decl.h opcodes.o: endian_calc.h +opcodes.o: errsym.h opcodes.o: file.h opcodes.o: func.h opcodes.o: hash.h @@ -5077,12 +5045,12 @@ poly.o: banned.h poly.o: block.h poly.o: bool.h poly.o: byteswap.h -poly.o: calcerr.h poly.o: charbit.h poly.o: cmath.h poly.o: config.h poly.o: decl.h poly.o: endian_calc.h +poly.o: errsym.h poly.o: hash.h poly.o: have_ban_pragma.h poly.o: have_const.h @@ -5239,12 +5207,12 @@ quickhash.o: banned.h quickhash.o: block.h quickhash.o: bool.h quickhash.o: byteswap.h -quickhash.o: calcerr.h quickhash.o: charbit.h quickhash.o: cmath.h quickhash.o: config.h quickhash.o: decl.h quickhash.o: endian_calc.h +quickhash.o: errsym.h quickhash.o: hash.h quickhash.o: have_ban_pragma.h quickhash.o: have_const.h @@ -5271,12 +5239,12 @@ sample_many.o: block.h sample_many.o: bool.h sample_many.o: byteswap.h sample_many.o: calc.h -sample_many.o: calcerr.h sample_many.o: charbit.h sample_many.o: cmath.h sample_many.o: config.h sample_many.o: decl.h sample_many.o: endian_calc.h +sample_many.o: errsym.h sample_many.o: hash.h sample_many.o: have_ban_pragma.h sample_many.o: have_const.h @@ -5303,12 +5271,12 @@ sample_rand.o: block.h sample_rand.o: bool.h sample_rand.o: byteswap.h sample_rand.o: calc.h -sample_rand.o: calcerr.h sample_rand.o: charbit.h sample_rand.o: cmath.h sample_rand.o: config.h sample_rand.o: decl.h sample_rand.o: endian_calc.h +sample_rand.o: errsym.h sample_rand.o: hash.h sample_rand.o: have_ban_pragma.h sample_rand.o: have_const.h @@ -5371,12 +5339,12 @@ sha1.o: banned.h sha1.o: block.h sha1.o: bool.h sha1.o: byteswap.h -sha1.o: calcerr.h sha1.o: charbit.h sha1.o: cmath.h sha1.o: config.h sha1.o: decl.h sha1.o: endian_calc.h +sha1.o: errsym.h sha1.o: hash.h sha1.o: have_ban_pragma.h sha1.o: have_const.h @@ -5400,12 +5368,12 @@ size.o: banned.h size.o: block.h size.o: bool.h size.o: byteswap.h -size.o: calcerr.h size.o: charbit.h size.o: cmath.h size.o: config.h size.o: decl.h size.o: endian_calc.h +size.o: errsym.h size.o: hash.h size.o: have_ban_pragma.h size.o: have_const.h @@ -5432,12 +5400,12 @@ str.o: block.h str.o: bool.h str.o: byteswap.h str.o: calc.h -str.o: calcerr.h str.o: charbit.h str.o: cmath.h str.o: config.h str.o: decl.h str.o: endian_calc.h +str.o: errsym.h str.o: hash.h str.o: have_ban_pragma.h str.o: have_const.h @@ -5477,12 +5445,12 @@ symbol.o: block.h symbol.o: bool.h symbol.o: byteswap.h symbol.o: calc.h -symbol.o: calcerr.h symbol.o: charbit.h symbol.o: cmath.h symbol.o: config.h symbol.o: decl.h symbol.o: endian_calc.h +symbol.o: errsym.h symbol.o: func.h symbol.o: hash.h symbol.o: have_ban_pragma.h @@ -5513,12 +5481,12 @@ token.o: block.h token.o: bool.h token.o: byteswap.h token.o: calc.h -token.o: calcerr.h token.o: charbit.h token.o: cmath.h token.o: config.h token.o: decl.h token.o: endian_calc.h +token.o: errsym.h token.o: hash.h token.o: have_ban_pragma.h token.o: have_const.h @@ -5545,12 +5513,12 @@ value.o: block.h value.o: bool.h value.o: byteswap.h value.o: calc.h -value.o: calcerr.h value.o: charbit.h value.o: cmath.h value.o: config.h value.o: decl.h value.o: endian_calc.h +value.o: errsym.h value.o: file.h value.o: func.h value.o: hash.h @@ -5583,12 +5551,12 @@ version.o: block.h version.o: bool.h version.o: byteswap.h version.o: calc.h -version.o: calcerr.h version.o: charbit.h version.o: cmath.h version.o: config.h version.o: decl.h version.o: endian_calc.h +version.o: errsym.h version.o: hash.h version.o: have_ban_pragma.h version.o: have_const.h @@ -5724,12 +5692,12 @@ zprime.o: banned.h zprime.o: block.h zprime.o: bool.h zprime.o: byteswap.h -zprime.o: calcerr.h zprime.o: charbit.h zprime.o: cmath.h zprime.o: config.h zprime.o: decl.h zprime.o: endian_calc.h +zprime.o: errsym.h zprime.o: hash.h zprime.o: have_ban_pragma.h zprime.o: have_const.h @@ -5756,12 +5724,12 @@ zrand.o: banned.h zrand.o: block.h zrand.o: bool.h zrand.o: byteswap.h -zrand.o: calcerr.h zrand.o: charbit.h zrand.o: cmath.h zrand.o: config.h zrand.o: decl.h zrand.o: endian_calc.h +zrand.o: errsym.h zrand.o: hash.h zrand.o: have_ban_pragma.h zrand.o: have_const.h @@ -5787,12 +5755,12 @@ zrandom.o: banned.h zrandom.o: block.h zrandom.o: bool.h zrandom.o: byteswap.h -zrandom.o: calcerr.h zrandom.o: charbit.h zrandom.o: cmath.h zrandom.o: config.h zrandom.o: decl.h zrandom.o: endian_calc.h +zrandom.o: errsym.h zrandom.o: hash.h zrandom.o: have_ban_pragma.h zrandom.o: have_const.h diff --git a/block.c b/block.c index 48b8c92..5a3b569 100644 --- a/block.c +++ b/block.c @@ -39,7 +39,7 @@ #include "block.h" #include "nametype.h" #include "str.h" -#include "calcerr.h" +#include "errsym.h" #include "attribute.h" diff --git a/calcerr.tbl b/calcerr.tbl deleted file mode 100644 index 094eb4e..0000000 --- a/calcerr.tbl +++ /dev/null @@ -1,582 +0,0 @@ -# -# calcerr - error codes and messages -# -# Copyright (C) 1999-2006,2021,2023 Ernest Bowen and Landon Curt Noll -# -# Calc is open software; you can redistribute it and/or modify it under -# the terms of the version 2.1 of the GNU Lesser General Public License -# as published by the Free Software Foundation. -# -# Calc is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General -# Public License for more details. -# -# A copy of version 2.1 of the GNU Lesser General Public License is -# distributed with calc under the filename COPYING-LGPL. You should have -# received a copy with calc; if not, write to Free Software Foundation, Inc. -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Under source code control: 1996/05/23 17:38:44 -# File existed as early as: 1996 -# -# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ - -# This file is used to build calcerr.h include file. -# -# Lines should be of the form: -# -# SYMBOL meaning - -###################################################################### -# WARNING: The order of the lines below is critical! If you change # -# the order, you will break code that depends on the return # -# value of the errno() builtin function. # -# # -# If you need to add values to this table, ONLY add then # -# to the bottom of the file! # -###################################################################### - - -E_1OVER0 Division by zero -E_0OVER0 Indeterminate (0/0) -E_ADD Bad arguments for + -E_SUB Bad arguments for binary - -E_MUL Bad arguments for * -E_DIV Bad arguments for / -E_NEG Bad argument for unary - -E_SQUARE Bad argument for squaring -E_INV Bad argument for inverse -E_INCV Bad argument for ++ -E_DECV Bad argument for -- -E_INT Bad argument for int -E_FRAC Bad argument for frac -E_CONJ Bad argument for conj -E_APPR Bad first argument for appr -E_APPR2 Bad second argument for appr -E_APPR3 Bad third argument for appr -E_ROUND Bad first argument for round -E_ROUND2 Bad second argument for round -E_ROUND3 Bad third argument for round -E_BROUND Bad first argument for bround -E_BROUND2 Bad second argument for bround -E_BROUND3 Bad third argument for bround -E_SQRT Bad first argument for sqrt -E_SQRT2 Bad second argument for sqrt -E_SQRT3 Bad third argument for sqrt -E_ROOT Bad first argument for root -E_ROOT2 Bad second argument for root -E_ROOT3 Bad third argument for root -E_NORM Bad argument for norm -E_SHIFT Bad first argument for << or >> -E_SHIFT2 Bad second argument for << or >> -E_SCALE Bad first argument for scale -E_SCALE2 Bad second argument for scale -E_POWI Bad first argument for ^ -E_POWI2 Bad second argument for ^ -E_POWER Bad first argument for power -E_POWER2 Bad second argument for power -E_POWER3 Bad third argument for power -E_QUO Bad first argument for quo or // -E_QUO2 Bad second argument for quo or // -E_QUO3 Bad third argument for quo -E_MOD Bad first argument for mod or % -E_MOD2 Bad second argument for mod or % -E_MOD3 Bad third argument for mod -E_SGN Bad argument for sgn -E_ABS Bad first argument for abs -E_ABS2 Bad second argument for abs -E_EVAL Scan error in argument for eval -E_STR Non-simple type for str -E_EXP1 Non-real epsilon for exp -E_EXP2 Bad first argument for exp -E_FPUTC1 Non-file first argument for fputc -E_FPUTC2 Bad second argument for fputc -E_FPUTC3 File not open for writing for fputc -E_FGETC1 Non-file first argument for fgetc -E_FGETC2 File not open for reading for fgetc -E_FOPEN1 Non-string arguments for fopen -E_FOPEN2 Unrecognized mode for fopen -E_FREOPEN1 Non-file first argument for freopen -E_FREOPEN2 Non-string or unrecognized mode for freopen -E_FREOPEN3 Non-string third argument for freopen -E_FCLOSE1 Non-file argument for fclose -E_FFLUSH Non-file argument for fflush -E_FPUTS1 Non-file first argument for fputs -E_FPUTS2 Non-string argument after first for fputs -E_FPUTS3 File not open for writing for fputs -E_FGETS1 Non-file argument for fgets -E_FGETS2 File not open for reading for fgets -E_FPUTSTR1 Non-file first argument for fputstr -E_FPUTSTR2 Non-string argument after first for fputstr -E_FPUTSTR3 File not open for writing for fputstr -E_FGETSTR1 Non-file first argument for fgetstr -E_FGETSTR2 File not open for reading for fgetstr -E_FGETLINE1 Non-file argument for fgetline -E_FGETLINE2 File not open for reading for fgetline -E_FGETFIELD1 Non-file argument for fgetfield -E_FGETFIELD2 File not open for reading for fgetfield -E_REWIND1 Non-file argument for rewind -E_FILES Non-integer argument for files -E_PRINTF1 Non-string fmt argument for fprint -E_PRINTF2 Stdout not open for writing to ??? -E_FPRINTF1 Non-file first argument for fprintf -E_FPRINTF2 Non-string second (fmt) argument for fprintf -E_FPRINTF3 File not open for writing for fprintf -E_STRPRINTF1 Non-string first (fmt) argument for strprintf -E_STRPRINTF2 Error in attempting strprintf ??? -E_FSCAN1 Non-file first argument for fscan -E_FSCAN2 File not open for reading for fscan -E_STRSCAN Non-string first argument for strscan -E_FSCANF1 Non-file first argument for fscanf -E_FSCANF2 Non-string second (fmt) argument for fscanf -E_FSCANF3 Non-lvalue argument after second for fscanf -E_FSCANF4 File not open for reading or other error for fscanf -E_STRSCANF1 Non-string first argument for strscanf -E_STRSCANF2 Non-string second (fmt) argument for strscanf -E_STRSCANF3 Non-lvalue argument after second for strscanf -E_STRSCANF4 Some error in attempting strscanf ??? -E_SCANF1 Non-string first (fmt) argument for scanf -E_SCANF2 Non-lvalue argument after first for scanf -E_SCANF3 Some error in attempting scanf ??? -E_FTELL1 Non-file argument for ftell -E_FTELL2 File not open or other error for ftell -E_FSEEK1 Non-file first argument for fseek -E_FSEEK2 Non-integer or negative second argument for fseek -E_FSEEK3 File not open or other error for fseek -E_FSIZE1 Non-file argument for fsize -E_FSIZE2 File not open or other error for fsize -E_FEOF1 Non-file argument for feof -E_FEOF2 File not open or other error for feof -E_FERROR1 Non-file argument for ferror -E_FERROR2 File not open or other error for ferror -E_UNGETC1 Non-file argument for ungetc -E_UNGETC2 File not open for reading for ungetc -E_UNGETC3 Bad second argument or other error for ungetc -E_BIGEXP Exponent too big in scanning -E_ISATTY1 UNUSED ERROR: E_ISATTY1 is no longer used -E_ISATTY2 UNUSED ERROR: E_ISATTY2 is no longer used -E_ACCESS1 Non-string first argument for access -E_ACCESS2 Bad second argument for access -E_SEARCH1 Bad first argument for search -E_SEARCH2 Bad second argument for search -E_SEARCH3 Bad third argument for search -E_SEARCH4 Bad fourth argument for search -E_SEARCH5 Cannot find fsize or fpos for search -E_SEARCH6 File not readable for search -E_RSEARCH1 Bad first argument for rsearch -E_RSEARCH2 Bad second argument for rsearch -E_RSEARCH3 Bad third argument for rsearch -E_RSEARCH4 Bad fourth argument for rsearch -E_RSEARCH5 Cannot find fsize or fpos for rsearch -E_RSEARCH6 File not readable for rsearch -E_MANYOPEN Too many open files -E_REWIND2 Attempt to rewind a file that is not open -E_STRERROR1 Bad argument type for strerror -E_STRERROR2 Index out of range for strerror -E_COS1 Bad epsilon for cos -E_COS2 Bad first argument for cos -E_SIN1 Bad epsilon for sin -E_SIN2 Bad first argument for sin -E_EVAL2 Non-string argument for eval -E_ARG1 Bad epsilon for arg -E_ARG2 Bad first argument for arg -E_POLAR1 Non-real argument for polar -E_POLAR2 Bad epsilon for polar -E_FCNT UNUSED ERROR: Non-integral argument for fcnt -E_MATFILL1 Non-variable first argument for matfill -E_MATFILL2 Non-matrix first argument-value for matfill -E_MATDIM Non-matrix argument for matdim -E_MATSUM Non-matrix argument for matsum -E_ISIDENT UNUSED ERROR: E_ISIDENT is no longer used -E_MATTRANS1 Non-matrix argument for mattrans -E_MATTRANS2 Non-two-dimensional matrix for mattrans -E_DET1 Non-matrix argument for det -E_DET2 Matrix for det not of dimension 2 -E_DET3 Non-square matrix for det -E_MATMIN1 Non-matrix first argument for matmin -E_MATMIN2 Non-positive-integer second argument for matmin -E_MATMIN3 Second argument for matmin exceeds dimension -E_MATMAX1 Non-matrix first argument for matmin -E_MATMAX2 Second argument for matmax not positive integer -E_MATMAX3 Second argument for matmax exceeds dimension -E_CP1 Non-matrix argument for cp -E_CP2 Non-one-dimensional matrix for cp -E_CP3 Matrix size not 3 for cp -E_DP1 Non-matrix argument for dp -E_DP2 Non-one-dimensional matrix for dp -E_DP3 Different-size matrices for dp -E_STRLEN Non-string argument for strlen -E_STRCAT Non-string argument for strcat -E_SUBSTR1 Non-string first argument for strcat -E_SUBSTR2 Non-non-negative integer second argument for strcat -E_CHAR Bad argument for char -E_ORD Non-string argument for ord -E_INSERT1 Non-list-variable first argument for insert -E_INSERT2 Non-integral second argument for insert -E_PUSH Non-list-variable first argument for push -E_APPEND Non-list-variable first argument for append -E_DELETE1 Non-list-variable first argument for delete -E_DELETE2 Non-integral second argument for delete -E_POP Non-list-variable argument for pop -E_REMOVE Non-list-variable argument for remove -E_LN1 Bad epsilon argument for ln -E_LN2 Non-numeric first argument for ln -E_ERROR1 Non-integer argument for error -E_ERROR2 Argument outside range for error -E_EVAL3 Attempt to eval at maximum input depth -E_EVAL4 Unable to open string for reading -E_RM1 First argument for rm is not a non-empty string -E_RM2 UNUSED ERROR: Unable to remove a file -E_RDPERM UNUSED ERROR: Operation allowed because calc mode disallows read operations -E_WRPERM Operation allowed because calc mode disallows write operations -E_EXPERM UNUSED ERROR: Operation allowed because calc mode disallows exec operations -E_MIN Unordered arguments for min -E_MAX Unordered arguments for max -E_LISTMIN Unordered items for minimum of list -E_LISTMAX Unordered items for maximum of list -E_SIZE Size undefined for argument type -E_NO_C_ARG Calc must be run with a -C argument to use custom function -E_NO_CUSTOM Calc was built with custom functions disabled -E_UNK_CUSTOM Custom function unknown, try: show custom -E_BLK1 Non-integral length for block -E_BLK2 Negative or too-large length for block -E_BLK3 Non-integral chunksize for block -E_BLK4 Negative or too-large chunksize for block -E_BLKFREE1 Named block does not exist for blkfree -E_BLKFREE2 Non-integral id specification for blkfree -E_BLKFREE3 Block with specified id does not exist -E_BLKFREE4 Block already freed -E_BLKFREE5 No-realloc protection prevents blkfree -E_BLOCKS1 Non-integer argument for blocks -E_BLOCKS2 Non-allocated index number for blocks -E_COPY1 Non-integer or negative source index for copy -E_COPY2 Source index too large for copy -E_COPY3 UNUSED ERROR: E_COPY3 is no longer used -E_COPY4 Non-integer or negative number for copy -E_COPY5 Number too large for copy -E_COPY6 Non-integer or negative destination index for copy -E_COPY7 Destination index too large for copy -E_COPY8 Freed block source for copy -E_COPY9 Unsuitable source type for copy -E_COPY10 Freed block destination for copy -E_COPY11 Unsuitable destination type for copy -E_COPY12 Incompatible source and destination for copy -E_COPY13 No-copy-from source variable -E_COPY14 No-copy-to destination variable -E_COPY15 No-copy-from source named block -E_COPY16 No-copy-to destination named block -E_COPY17 No-relocate destination for copy -E_COPYF1 File not open for copy -E_COPYF2 fseek or fsize failure for copy -E_COPYF3 fwrite error for copy -E_COPYF4 fread error for copy -E_PROTECT1 Non-variable first argument for protect -E_PROTECT2 Bad second argument for protect -E_PROTECT3 Bad third argument for protect -E_MATFILL3 No-copy-to destination for matfill -E_MATFILL4 No-assign-from source for matfill -E_MATTRACE1 Non-matrix argument for mattrace -E_MATTRACE2 Non-two-dimensional argument for mattrace -E_MATTRACE3 Non-square argument for mattrace -E_TAN1 Bad epsilon for tan -E_TAN2 Bad argument for tan -E_COT1 Bad epsilon for cot -E_COT2 Bad argument for cot -E_SEC1 Bad epsilon for sec -E_SEC2 Bad argument for sec -E_CSC1 Bad epsilon for csc -E_CSC2 Bad argument for csc -E_SINH1 Bad epsilon for sinh -E_SINH2 Bad argument for sinh -E_COSH1 Bad epsilon for cosh -E_COSH2 Bad argument for cosh -E_TANH1 Bad epsilon for tanh -E_TANH2 Bad argument for tanh -E_COTH1 Bad epsilon for coth -E_COTH2 Bad argument for coth -E_SECH1 Bad epsilon for sech -E_SECH2 Bad argument for sech -E_CSCH1 Bad epsilon for csch -E_CSCH2 Bad argument for csch -E_ASIN1 Bad epsilon for asin -E_ASIN2 Bad argument for asin -E_ACOS1 Bad epsilon for acos -E_ACOS2 Bad argument for acos -E_ATAN1 Bad epsilon for atan -E_ATAN2 Bad argument for atan -E_ACOT1 Bad epsilon for acot -E_ACOT2 Bad argument for acot -E_ASEC1 Bad epsilon for asec -E_ASEC2 Bad argument for asec -E_ACSC1 Bad epsilon for acsc -E_ACSC2 Bad argument for acsc -E_ASINH1 Bad epsilon for asin -E_ASINH2 Bad argument for asinh -E_ACOSH1 Bad epsilon for acosh -E_ACOSH2 Bad argument for acosh -E_ATANH1 Bad epsilon for atanh -E_ATANH2 Bad argument for atanh -E_ACOTH1 Bad epsilon for acoth -E_ACOTH2 Bad argument for acoth -E_ASECH1 UNUSED ERROR: Bad epsilon for asech -E_ASECH2 Bad argument for asech -E_ACSCH1 Bad epsilon for acsch -E_ACSCH2 Bad argument for acsch -E_GD1 Bad epsilon for gd -E_GD2 Bad argument for gd -E_AGD1 Bad epsilon for agd -E_AGD2 Bad argument for agd -E_LOGINF Log of zero or infinity -E_STRADD String addition failure -E_STRMUL String multiplication failure -E_STRNEG String reversal failure -E_STRSUB String subtraction failure -E_BIT1 Bad argument type for bit -E_BIT2 Index too large for bit -E_SETBIT1 Non-integer second argument for setbit -E_SETBIT2 Out-of-range index for setbit -E_SETBIT3 Non-string first argument for setbit -E_OR Bad argument for or -E_AND Bad argument for and -E_STROR Allocation failure for string or -E_STRAND Allocation failure for string and -E_XOR Bad argument for xorvalue -E_COMP Bad argument for comp -E_STRDIFF Allocation failure for string diff -E_STRCOMP Allocation failure for string comp -E_SEG1 Bad first argument for segment -E_SEG2 Bad second argument for segment -E_SEG3 Bad third argument for segment -E_STRSEG Failure for string segment -E_HIGHBIT1 Bad argument type for highbit -E_HIGHBIT2 Non-integer argument for highbit -E_LOWBIT1 Bad argument type for lowbit -E_LOWBIT2 Non-integer argument for lowbit -E_CONTENT Bad argument type for unary hash op -E_HASHOP Bad argument type for binary hash op -E_HEAD1 Bad first argument for head -E_HEAD2 Bad second argument for head -E_STRHEAD Failure for strhead -E_TAIL1 Bad first argument for tail -E_TAIL2 UNUSED ERROR: Bad second argument for tail -E_STRTAIL Failure for strtail -E_STRSHIFT Failure for strshift -E_STRCMP Non-string argument for strcmp -E_STRNCMP Bad argument type for strncmp -E_XOR1 Varying types of argument for xor -E_XOR2 Bad argument type for xor -E_STRCPY Bad argument type for strcpy -E_STRNCPY Bad argument type for strncpy -E_BACKSLASH Bad argument type for unary backslash -E_SETMINUS Bad argument type for setminus -E_INDICES1 Bad first argument type for indices -E_INDICES2 Bad second argument for indices -E_EXP3 Too-large re(argument) for exp -E_SINH3 Too-large re(argument) for sinh -E_COSH3 Too-large re(argument) for cosh -E_SIN3 Too-large im(argument) for sin -E_COS3 Too-large im(argument) for cos -E_GD3 Infinite or too-large result for gd -E_AGD3 Infinite or too-large result for agd -E_POWER4 Too-large value for power -E_ROOT4 Too-large value for root -E_DGT1 Non-real first arg for digit -E_DGT2 Non-integral second arg for digit -E_DGT3 Bad third arg for digit -E_PLCS1 Bad first argument for places -E_PLCS2 Bad second argument for places -E_DGTS1 Bad first argument for digits -E_DGTS2 Bad second argument for digits -E_ILOG Bad first argument for ilog -E_ILOGB Bad second argument for ilog -E_ILOG10 Bad argument for ilog10 -E_ILOG2 Bad argument for ilog2 -E_COMB1 Non-integer second arg for comb -E_COMB2 Too-large second arg for comb -E_CTLN Bad argument for catalan -E_BERN Bad argument for bern -E_EULER Bad argument for euler -E_SLEEP Bad argument for sleep -E_TTY calc_tty failure -E_ASSIGN1 No-copy-to destination for octet assign -E_ASSIGN2 No-copy-from source for octet assign -E_ASSIGN3 No-change destination for octet assign -E_ASSIGN4 Non-variable destination for assign -E_ASSIGN5 No-assign-to destination for assign -E_ASSIGN6 No-assign-from source for assign -E_ASSIGN7 No-change destination for assign -E_ASSIGN8 No-type-change destination for assign -E_ASSIGN9 No-error-value destination for assign -E_SWAP1 No-copy argument for octet swap -E_SWAP2 No-assign-to-or-from argument for swap -E_SWAP3 Non-lvalue argument for swap -E_QUOMOD1 Non-lvalue argument 3 or 4 for quomod -E_QUOMOD2 Non-real-number arg 1 or 2 or bad arg 5 for quomod -E_QUOMOD3 No-assign-to argument 3 or 4 for quomod -E_PREINC1 No-copy-to or no-change argument for octet preinc -E_PREINC2 Non-variable argument for preinc -E_PREINC3 No-assign-to or no-change argument for preinc -E_PREDEC1 No-copy-to or no-change argument for octet predec -E_PREDEC2 Non-variable argument for predec -E_PREDEC3 No-assign-to or no-change argument for predec -E_POSTINC1 No-copy-to or no-change argument for octet postinc -E_POSTINC2 Non-variable argument for postinc -E_POSTINC3 No-assign-to or no-change argument for postinc -E_POSTDEC1 No-copy-to or no-change argument for octet postdec -E_POSTDEC2 Non-variable argument for postdec -E_POSTDEC3 No-assign-to or no-change argument for postdec -E_INIT1 Error-type structure for initialization -E_INIT2 No-copy-to structure for initialization -E_INIT3 Too many initializer values -E_INIT4 Attempt to initialize freed named block -E_INIT5 Bad structure type for initialization -E_INIT6 No-assign-to element for initialization -E_INIT7 No-change element for initialization -E_INIT8 No-type-change element for initialization -E_INIT9 No-error-value element for initialization -E_INIT10 No-assign-or-copy-from source for initialization -E_LIST1 No-relocate for list insert -E_LIST2 No-relocate for list delete -E_LIST3 No-relocate for list push -E_LIST4 No-relocate for list append -E_LIST5 No-relocate for list pop -E_LIST6 No-relocate for list remove -E_MODIFY1 Non-variable first argument for modify -E_MODIFY2 Non-string second argument for modify -E_MODIFY3 No-change first argument for modify -E_MODIFY4 Undefined function for modify -E_MODIFY5 Unacceptable type first argument for modify -E_FPATHOPEN1 Non-string arguments for fpathopen -E_FPATHOPEN2 Unrecognized mode for fpathopen -E_LOG1 Bad epsilon argument for log -E_LOG2 Non-numeric first argument for log -E_LOG3 Cannot calculate log for this value -E_FGETFILE1 Non-file argument for fgetfile -E_FGETFILE2 File argument for fgetfile not open for reading -E_FGETFILE3 Unable to set file position in fgetfile -E_ESTR UNUSED ERROR: Non-representable type for estr -E_STRCASECMP Non-string argument for strcasecmp -E_STRNCASECMP Bad argument type for strncasecmp -E_ISUPPER Bad argument for isupper -E_ISLOWER Bad argument for islower -E_ISALNUM Bad argument for isalnum -E_ISALPHA Bad argument for isalpha -E_ISASCII Bad argument for isascii -E_ISCNTRL Bad argument for iscntrl -E_ISDIGIT Bad argument for isdigit -E_ISGRAPH Bad argument for isgraph -E_ISPRINT Bad argument for isprint -E_ISPUNCT Bad argument for ispunct -E_ISSPACE Bad argument for isspace -E_ISXDIGIT Bad argument for isxdigit -E_STRTOUPPER Bad argument type for strtoupper -E_STRTOLOWER Bad argument type for strtolower -E_TAN3 UNUSED ERROR: Invalid value for calculating the sin numerator for tan -E_TAN4 UNUSED ERROR: Invalid value for calculating the cos denominator for tan -E_COT3 UNUSED ERROR: Invalid value for calculating the sin numerator for cot -E_COT4 UNUSED ERROR: Invalid value for calculating the cos denominator for cot -E_SEC3 UNUSED ERROR: Invalid value for calculating the cos reciprocal for sec -E_CSC3 UNUSED ERROR: Invalid value for calculating the sin reciprocal for csc -E_TANH3 Invalid value for calculating the sinh numerator for tanh -E_TANH4 Invalid value for calculating the cosh denominator for tanh -E_COTH3 Invalid value for calculating the sinh numerator for coth -E_COTH4 Invalid value for calculating the cosh denominator for coth -E_SECH3 Invalid value for calculating the cosh reciprocal for sech -E_CSCH3 Invalid value for calculating the sinh reciprocal for csch -E_ASIN3 Invalid value for calculating asin -E_ACOS3 Invalid value for calculating acos -E_ASINH3 Invalid value for calculating asinh -E_ACOSH3 Invalid value for calculating acosn -E_ATAN3 Invalid value for calculating atan -E_ACOT3 Invalid value for calculating acot -E_ASEC3 Invalid value for calculating asec -E_ACSC3 Invalid value for calculating acsc -E_ATANH3 Invalid value for calculating atan -E_ACOTH3 Invalid value for calculating acot -E_ASECH3 Invalid value for calculating asec -E_ACSCH3 Invalid value for calculating acsc -E_D2R1 Bad epsilon for converting degrees to radians -E_D2R2 Bad first argument converting degrees to radians -E_R2D1 Bad epsilon for converting radians to degrees -E_R2D2 Bad first argument converting radians to degrees -E_G2R1 Bad epsilon for converting gradians to radians -E_G2R2 Bad first argument converting gradians to radians -E_R2G1 Bad epsilon for converting radians to gradians -E_R2G2 Bad first argument converting radians to gradians -E_D2G1 Bad first argument converting degrees to gradians -E_G2D1 Bad first argument converting gradians to degrees -E_D2DMS1 Non-lvalue arguments 2, 3 or 4 for d2dms -E_D2DMS2 Non-real-number arg 1 for d2dms -E_D2DMS3 No-assign-to argument 2, 3 or 4 for d2dms -E_D2DMS4 Invalid rounding arg 5 for d2dms -E_D2DM1 Non-lvalue arguments 2 or 3 for d2dm -E_D2DM2 Non-real-number arg 1 for d2dm -E_D2DM3 No-assign-to argument 2 or 3 for d2dm -E_D2DM4 Invalid rounding arg 4 for d2dm -E_G2GMS1 Non-lvalue arguments 2, 3 or 4 for g2gms -E_G2GMS2 Non-real-number arg 1 for g2gms -E_G2GMS3 No-assign-to argument 2 or 3 for g2gms -E_G2GMS4 Invalid rounding arg 5 for g2gms -E_G2GM1 Non-lvalue arguments 2 or 3 for g2gm -E_G2GM2 Non-real-number arg 1 for g2gm -E_G2GM3 No-assign-to argument 2, 3 or 4 for g2gm -E_G2GM4 Invalid rounding arg 4 for g2gm -E_H2HMS1 Non-lvalue arguments 2, 3 or 4 for h2hms -E_H2HMS2 Non-real-number arg 1 for h2hms -E_H2HMS3 No-assign-to argument 2, 3 or 4 for h2hms -E_H2HMS4 Invalid rounding arg 5 for h2hms -E_H2HM1 Non-lvalue arguments 2 or 3 for h2hm -E_H2HM2 Non-real-number arg 1 for h2hm -E_H2HM3 No-assign-to argument 2 or 3 for h2hm -E_H2HM4 Invalid rounding arg 4 for h2hm -E_DMS2D1 Non-real-number arguments 1, 2 or 3 for dms2d -E_DMS2D2 Invalid rounding arg 4 for dms2d -E_DM2D1 Non-real-number arguments 1 or 2 for dm2d -E_DM2D2 Invalid rounding arg 4 for dm2d -E_GMS2G1 Non-real-number arguments 1, 2 or 3 for gms2g -E_GMS2G2 Invalid rounding arg 4 for gms2g -E_GM2G1 Non-real-number arguments 1 or 2 for gm2g -E_GM2G2 Invalid rounding arg 4 for gm2g -E_HMS2H1 Non-real-number arguments 1, 2 or 3 for hms2h -E_HMS2H2 Invalid rounding arg 4 for hms2h -E_HM2H1 UNUSED ERROR: Non-real-number arguments 1 or 2 for hm2h -E_HM2H2 UNUSED ERROR: Invalid rounding arg 4 for hm2h -E_LOG2_1 Bad epsilon argument for log2 -E_LOG2_2 Non-numeric first argument for log2 -E_LOG2_3 Cannot calculate log2 for this value -E_LOGN_1 Bad epsilon argument for logn -E_LOGN_2 Non-numeric first argument for logn -E_LOGN_3 Cannot calculate logn for this value -E_LOGN_4 Cannot calculate logn for this log base -E_LOGN_5 Non-numeric second argument for logn -E_VERSIN1 Bad epsilon for versin -E_VERSIN2 Bad first argument for versin -E_VERSIN3 Too-large im(argument) for versin -E_AVERSIN1 Bad epsilon for aversin -E_AVERSIN2 Bad first argument for aversin -E_AVERSIN3 Too-large im(argument) for aversin -E_COVERSIN1 Bad epsilon for coversin -E_COVERSIN2 Bad first argument for coversin -E_COVERSIN3 Too-large im(argument) for coversin -E_ACOVERSIN1 Bad epsilon for acoversin -E_ACOVERSIN2 Bad first argument for acoversin -E_ACOVERSIN3 Too-large im(argument) for acoversin -E_VERCOS1 Bad epsilon for vercos -E_VERCOS2 Bad first argument for vercos -E_VERCOS3 Too-large im(argument) for vercos -E_AVERCOS1 Bad epsilon for avercos -E_AVERCOS2 Bad first argument for avercos -E_AVERCOS3 Too-large im(argument) for avercos -E_COVERCOS1 Bad epsilon for covercos -E_COVERCOS2 Bad first argument for covercos -E_COVERCOS3 Too-large im(argument) for covercos -E_ACOVERCOS1 Bad epsilon for acovercos -E_ACOVERCOS2 Bad first argument for acovercos -E_ACOVERCOS3 Too-large im(argument) for acovercos -E_TAN5 Invalid complex argument for tan -E_COT5 Invalid zero argument for cot -E_COT6 Invalid complex argument for cot -E_SEC5 Invalid complex argument for sec -E_CSC5 Invalid zero argument for cot -E_CSC6 Invalid complex argument for csc diff --git a/calcerr_c.awk b/calcerr_c.awk deleted file mode 100644 index 79fc6bf..0000000 --- a/calcerr_c.awk +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/sed -# -# calcerr_c - help produce calcerr.c from calcerr.tbl -# -# Copyright (C) 1999,2023 Landon Curt Noll -# -# Calc is open software; you can redistribute it and/or modify it under -# the terms of the version 2.1 of the GNU Lesser General Public License -# as published by the Free Software Foundation. -# -# Calc is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General -# Public License for more details. -# -# A copy of version 2.1 of the GNU Lesser General Public License is -# distributed with calc under the filename COPYING-LGPL. You should have -# received a copy with calc; if not, write to Free Software Foundation, Inc. -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Under source code control: 1996/05/24 03:15:35 -# File existed as early as: 1996 -# -# chongo /\oo/\ http://www.isthe.com/chongo/ -# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ -# -BEGIN { - printf("#include \n"); - printf("#include \"calcerr.h\"\n\n"); - printf("#include \"have_const.h\"\n\n"); - printf("#include \"banned.h\"\t"); - printf("/* include after system header <> includes */\n\n"); - printf("/*\n"); - printf(" * names of calc error values\n"); - printf(" */\n"); - printf("CONST char *error_table[E__COUNT+2] = {\n"); - printf(" \"No error\",\t\t/* MUST be first */\n"); -} -{ - print $0; -} -END { - printf(" NULL\t/* MUST be last */\n"); - printf("};\n"); -} diff --git a/calcerr_c.sed b/calcerr_c.sed deleted file mode 100644 index 638523c..0000000 --- a/calcerr_c.sed +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/sed -# -# calcerr_c - help produce calcerr.c from calcerr.tbl -# -# Copyright (C) 1999 Landon Curt Noll -# -# Calc is open software; you can redistribute it and/or modify it under -# the terms of the version 2.1 of the GNU Lesser General Public License -# as published by the Free Software Foundation. -# -# Calc is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General -# Public License for more details. -# -# A copy of version 2.1 of the GNU Lesser General Public License is -# distributed with calc under the filename COPYING-LGPL. You should have -# received a copy with calc; if not, write to Free Software Foundation, Inc. -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Under source code control: 1996/05/24 03:15:35 -# File existed as early as: 1996 -# -# chongo /\oo/\ http://www.isthe.com/chongo/ -# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ -# -s/#.*// -s/[ ][ ]*$// -/^$/d -s/[^ ][^ ]*[ ][ ]*\(.*\)$/ "\1",/ diff --git a/calcerr_h.awk b/calcerr_h.awk deleted file mode 100644 index 64d5c1b..0000000 --- a/calcerr_h.awk +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/awk -# -# calcerr_h - help produce calcerr.h from calcerr.tbl -# -# Copyright (C) 1999,2023 Landon Curt Noll -# -# Calc is open software; you can redistribute it and/or modify it under -# the terms of the version 2.1 of the GNU Lesser General Public License -# as published by the Free Software Foundation. -# -# Calc is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General -# Public License for more details. -# -# A copy of version 2.1 of the GNU Lesser General Public License is -# distributed with calc under the filename COPYING-LGPL. You should have -# received a copy with calc; if not, write to Free Software Foundation, Inc. -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Under source code control: 1996/05/23 17:38:44 -# File existed as early as: 1996 -# -# chongo /\oo/\ http://www.isthe.com/chongo/ -# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ -# -BEGIN { - ebase = 10000; - printf("#define E__BASE %d\t/* calc errors start above here */\n\n", ebase); -} -NF > 1 { - if (length($1) > 7) { - printf("#define %s\t", $1, NR); - } else { - printf("#define %s\t\t", $1, NR); - } - printf("%d\t/* ", ebase+NR); - for (i=2; i < NF; ++i) { - printf("%s ", $i); - } - printf("%s */\n", $NF); -} -END { - printf("\n#define E__HIGHEST\t%d\t/* highest calc error */\n", NR+ebase); - printf("#define E__COUNT\t%d\t/* number of calc errors */\n", NR); - printf("#define E_USERDEF\t20000\t/* base of user defined errors */\n"); - printf("#define E_USERMAX\t32767\t/* maximum user defined error value */\n\n"); - printf("/* names of calc error values */\n"); -} diff --git a/calcerr_h.sed b/calcerr_h.sed deleted file mode 100644 index 93177b3..0000000 --- a/calcerr_h.sed +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/sed -# -# calcerr_h - help produce calcerr.h from calcerr.tbl -# -# Copyright (C) 1999 Landon Curt Noll -# -# Calc is open software; you can redistribute it and/or modify it under -# the terms of the version 2.1 of the GNU Lesser General Public License -# as published by the Free Software Foundation. -# -# Calc is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General -# Public License for more details. -# -# A copy of version 2.1 of the GNU Lesser General Public License is -# distributed with calc under the filename COPYING-LGPL. You should have -# received a copy with calc; if not, write to Free Software Foundation, Inc. -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Under source code control: 1996/05/23 17:38:44 -# File existed as early as: 1996 -# -# chongo /\oo/\ http://www.isthe.com/chongo/ -# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ -# -s/#.*// -s/[ ][ ]*$// -/^$/d -s/\([^ ][^ ]*\)[ ][ ]*\(.*\)$/\1 \2/ diff --git a/custom/HOW_TO_ADD b/custom/HOW_TO_ADD index cf48544..1da2aa2 100644 --- a/custom/HOW_TO_ADD +++ b/custom/HOW_TO_ADD @@ -570,10 +570,10 @@ Step 9: Add the Make dependency tools u_curds.o: ../alloc.h u_curds.o: ../block.h u_curds.o: ../byteswap.h - u_curds.o: ../calcerr.h u_curds.o: ../cmath.h u_curds.o: ../config.h u_curds.o: ../endian_calc.h + u_curds.o: ../errsym.h u_curds.o: ../hash.h u_curds.o: ../have_const.h u_curds.o: ../have_malloc.h diff --git a/custom/Makefile b/custom/Makefile index 3633188..97e8cb9 100644 --- a/custom/Makefile +++ b/custom/Makefile @@ -694,13 +694,13 @@ c_argv.o: ../block.h c_argv.o: ../bool.h c_argv.o: ../byteswap.h c_argv.o: ../calc.h -c_argv.o: ../calcerr.h c_argv.o: ../charbit.h c_argv.o: ../cmath.h c_argv.o: ../config.h c_argv.o: ../custom.h c_argv.o: ../decl.h c_argv.o: ../endian_calc.h +c_argv.o: ../errsym.h c_argv.o: ../hash.h c_argv.o: ../have_ban_pragma.h c_argv.o: ../have_const.h @@ -726,13 +726,13 @@ c_devnull.o: ../banned.h c_devnull.o: ../block.h c_devnull.o: ../bool.h c_devnull.o: ../byteswap.h -c_devnull.o: ../calcerr.h c_devnull.o: ../charbit.h c_devnull.o: ../cmath.h c_devnull.o: ../config.h c_devnull.o: ../custom.h c_devnull.o: ../decl.h c_devnull.o: ../endian_calc.h +c_devnull.o: ../errsym.h c_devnull.o: ../hash.h c_devnull.o: ../have_ban_pragma.h c_devnull.o: ../have_const.h @@ -759,13 +759,13 @@ c_help.o: ../banned.h c_help.o: ../block.h c_help.o: ../bool.h c_help.o: ../byteswap.h -c_help.o: ../calcerr.h c_help.o: ../charbit.h c_help.o: ../cmath.h c_help.o: ../config.h c_help.o: ../custom.h c_help.o: ../decl.h c_help.o: ../endian_calc.h +c_help.o: ../errsym.h c_help.o: ../hash.h c_help.o: ../have_ban_pragma.h c_help.o: ../have_const.h @@ -792,13 +792,13 @@ c_pmodm127.o: ../banned.h c_pmodm127.o: ../block.h c_pmodm127.o: ../bool.h c_pmodm127.o: ../byteswap.h -c_pmodm127.o: ../calcerr.h c_pmodm127.o: ../charbit.h c_pmodm127.o: ../cmath.h c_pmodm127.o: ../config.h c_pmodm127.o: ../custom.h c_pmodm127.o: ../decl.h c_pmodm127.o: ../endian_calc.h +c_pmodm127.o: ../errsym.h c_pmodm127.o: ../hash.h c_pmodm127.o: ../have_ban_pragma.h c_pmodm127.o: ../have_const.h @@ -824,13 +824,13 @@ c_pzasusb8.o: ../banned.h c_pzasusb8.o: ../block.h c_pzasusb8.o: ../bool.h c_pzasusb8.o: ../byteswap.h -c_pzasusb8.o: ../calcerr.h c_pzasusb8.o: ../charbit.h c_pzasusb8.o: ../cmath.h c_pzasusb8.o: ../config.h c_pzasusb8.o: ../custom.h c_pzasusb8.o: ../decl.h c_pzasusb8.o: ../endian_calc.h +c_pzasusb8.o: ../errsym.h c_pzasusb8.o: ../hash.h c_pzasusb8.o: ../have_ban_pragma.h c_pzasusb8.o: ../have_const.h @@ -857,13 +857,13 @@ c_register.o: ../block.h c_register.o: ../bool.h c_register.o: ../byteswap.h c_register.o: ../calc.h -c_register.o: ../calcerr.h c_register.o: ../charbit.h c_register.o: ../cmath.h c_register.o: ../config.h c_register.o: ../custom.h c_register.o: ../decl.h c_register.o: ../endian_calc.h +c_register.o: ../errsym.h c_register.o: ../hash.h c_register.o: ../have_ban_pragma.h c_register.o: ../have_const.h @@ -890,7 +890,6 @@ c_sysinfo.o: ../block.h c_sysinfo.o: ../bool.h c_sysinfo.o: ../byteswap.h c_sysinfo.o: ../calc.h -c_sysinfo.o: ../calcerr.h c_sysinfo.o: ../charbit.h c_sysinfo.o: ../cmath.h c_sysinfo.o: ../conf.h @@ -898,6 +897,7 @@ c_sysinfo.o: ../config.h c_sysinfo.o: ../custom.h c_sysinfo.o: ../decl.h c_sysinfo.o: ../endian_calc.h +c_sysinfo.o: ../errsym.h c_sysinfo.o: ../fposval.h c_sysinfo.o: ../hash.h c_sysinfo.o: ../have_ban_pragma.h @@ -929,13 +929,13 @@ custtbl.o: ../banned.h custtbl.o: ../block.h custtbl.o: ../bool.h custtbl.o: ../byteswap.h -custtbl.o: ../calcerr.h custtbl.o: ../charbit.h custtbl.o: ../cmath.h custtbl.o: ../config.h custtbl.o: ../custom.h custtbl.o: ../decl.h custtbl.o: ../endian_calc.h +custtbl.o: ../errsym.h custtbl.o: ../hash.h custtbl.o: ../have_ban_pragma.h custtbl.o: ../have_const.h diff --git a/custom/c_sysinfo.c b/custom/c_sysinfo.c index 6b12682..ccddfec 100644 --- a/custom/c_sysinfo.c +++ b/custom/c_sysinfo.c @@ -56,7 +56,6 @@ int c_sysinfo_allowed = 0; /* CUSTOM undefined */ #include "../longbits.h" #define CHECK_L_FORMAT #include "../block.h" -#include "../calcerr.h" #include "../conf.h" #include "../endian_calc.h" #include "../fposval.h" @@ -128,14 +127,6 @@ STATIC struct infoname sys_info[] = { EPSILON_DEFAULT, (FULL)0}, {"ERRMAX", "default errmax value", NULL, (FULL)ERRMAX}, - {"E_USERDEF", "base of user defined errors", NULL, - (FULL)E_USERDEF}, - {"E__BASE", "calc errors start above here", NULL, - (FULL)E__BASE}, - {"E__COUNT", "number of calc errors", NULL, - (FULL)E__COUNT}, - {"E__HIGHEST", "highest calc error", NULL, - (FULL)E__HIGHEST}, {"false", "boolean false", NULL, (FULL)false}, {"FILEPOS_BITS", "file position size in bits", NULL, diff --git a/errtbl.c b/errtbl.c new file mode 100644 index 0000000..57c9e68 --- /dev/null +++ b/errtbl.c @@ -0,0 +1,1005 @@ +/* + * errtbl - calc computation error codes, symbols and messages + * + * This code is used to generate errsym.h and help/errorcodes. + * This code also verifies the consistency of the error_table[] array. + * + * NOTE: This file was once called calcerr.tbl. + * + * Copyright (C) 1999-2006,2021,2023 Ernest Bowen and Landon Curt Noll + * + * Calc is open software; you can redistribute it and/or modify it under + * the terms of the version 2.1 of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * Calc is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General + * Public License for more details. + * + * A copy of version 2.1 of the GNU Lesser General Public License is + * distributed with calc under the filename COPYING-LGPL. You should have + * received a copy with calc; if not, write to Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Under source code control: 1996/05/23 17:38:44 + * File existed as early as: 1996 + * + * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ + */ + +#include + +#include "errtbl.h" + +#define ERRTBL_COPYRIGHT_YEAR 2023 /* Copyright (C) year for generated files */ + +/* number of calc computation error codes */ +#define MY_E__COUNT ((sizeof(error_table) / sizeof(error_table[0])) - 2) + +/* highest assigned calc computation error code */ +#define MY_E__HIGHEST (E__BASE + MY_E__COUNT) + + +/************************************************************************/ +/* */ +/* WARNING: The order of the lines below is critical! If you change */ +/* the order, you will break code that depends on the return */ +/* value of the errno() builtin function. */ +/* */ +/* When adding entries to this table add then just before the */ +/* NULL pointer (* must be last *) entry. */ +/* */ +/************************************************************************/ + +/* + * The error_table[] array represents the calc computation error related + * error codes, symbols and messages. + * + * The errnum of the 1st entry error_table[0] must be E__BASE. + * + * All errnum for the following entries just be consecutive, + * except for the final NULL entry. + * + * The final entry must have an errnum of -1, errsym of NULL and errmsg of NULL. + * + * Keep the errmsg short enough that lines in this table are not too long. + * You might want to keep the length of the errmsg to 80 characters or less. + */ +CONST struct errtbl error_table[] = { + + /* The E__BASE entry below must start with 10000 and must be first!! */ + { 10000, "E__BASE", "No error" }, + { 10001, "E_1OVER0", "Division by zero" }, + { 10002, "E_0OVER0", "Indeterminate (0/0)" }, + { 10003, "E_ADD", "Bad arguments for +" }, + { 10004, "E_SUB", "Bad arguments for binary -" }, + { 10005, "E_MUL", "Bad arguments for *" }, + { 10006, "E_DIV", "Bad arguments for /" }, + { 10007, "E_NEG", "Bad argument for unary -" }, + { 10008, "E_SQUARE", "Bad argument for squaring" }, + { 10009, "E_INV", "Bad argument for inverse" }, + { 10010, "E_INCV", "Bad argument for ++" }, + { 10011, "E_DECV", "Bad argument for --" }, + { 10012, "E_INT", "Bad argument for int" }, + { 10013, "E_FRAC", "Bad argument for frac" }, + { 10014, "E_CONJ", "Bad argument for conj" }, + { 10015, "E_APPR", "Bad first argument for appr" }, + { 10016, "E_APPR2", "Bad second argument for appr" }, + { 10017, "E_APPR3", "Bad third argument for appr" }, + { 10018, "E_ROUND", "Bad first argument for round" }, + { 10019, "E_ROUND2", "Bad second argument for round" }, + { 10020, "E_ROUND3", "Bad third argument for round" }, + { 10021, "E_BROUND", "Bad first argument for bround" }, + { 10022, "E_BROUND2", "Bad second argument for bround" }, + { 10023, "E_BROUND3", "Bad third argument for bround" }, + { 10024, "E_SQRT", "Bad first argument for sqrt" }, + { 10025, "E_SQRT2", "Bad second argument for sqrt" }, + { 10026, "E_SQRT3", "Bad third argument for sqrt" }, + { 10027, "E_ROOT", "Bad first argument for root" }, + { 10028, "E_ROOT2", "Bad second argument for root" }, + { 10029, "E_ROOT3", "Bad third argument for root" }, + { 10030, "E_NORM", "Bad argument for norm" }, + { 10031, "E_SHIFT", "Bad first argument for << or >>" }, + { 10032, "E_SHIFT2", "Bad second argument for << or >>" }, + { 10033, "E_SCALE", "Bad first argument for scale" }, + { 10034, "E_SCALE2", "Bad second argument for scale" }, + { 10035, "E_POWI", "Bad first argument for ^" }, + { 10036, "E_POWI2", "Bad second argument for ^" }, + { 10037, "E_POWER", "Bad first argument for power" }, + { 10038, "E_POWER2", "Bad second argument for power" }, + { 10039, "E_POWER3", "Bad third argument for power" }, + { 10040, "E_QUO", "Bad first argument for quo or //" }, + { 10041, "E_QUO2", "Bad second argument for quo or //" }, + { 10042, "E_QUO3", "Bad third argument for quo" }, + { 10043, "E_MOD", "Bad first argument for mod or %" }, + { 10044, "E_MOD2", "Bad second argument for mod or %" }, + { 10045, "E_MOD3", "Bad third argument for mod" }, + { 10046, "E_SGN", "Bad argument for sgn" }, + { 10047, "E_ABS", "Bad first argument for abs" }, + { 10048, "E_ABS2", "Bad second argument for abs" }, + { 10049, "E_EVAL", "Scan error in argument for eval" }, + { 10050, "E_STR", "Non-simple type for str" }, + { 10051, "E_EXP1", "Non-real epsilon for exp" }, + { 10052, "E_EXP2", "Bad first argument for exp" }, + { 10053, "E_FPUTC1", "Non-file first argument for fputc" }, + { 10054, "E_FPUTC2", "Bad second argument for fputc" }, + { 10055, "E_FPUTC3", "File not open for writing for fputc" }, + { 10056, "E_FGETC1", "Non-file first argument for fgetc" }, + { 10057, "E_FGETC2", "File not open for reading for fgetc" }, + { 10058, "E_FOPEN1", "Non-string arguments for fopen" }, + { 10059, "E_FOPEN2", "Unrecognized mode for fopen" }, + { 10060, "E_FREOPEN1", "Non-file first argument for freopen" }, + { 10061, "E_FREOPEN2", "Non-string or unrecognized mode for freopen" }, + { 10062, "E_FREOPEN3", "Non-string third argument for freopen" }, + { 10063, "E_FCLOSE1", "Non-file argument for fclose" }, + { 10064, "E_FFLUSH", "Non-file argument for fflush" }, + { 10065, "E_FPUTS1", "Non-file first argument for fputs" }, + { 10066, "E_FPUTS2", "Non-string argument after first for fputs" }, + { 10067, "E_FPUTS3", "File not open for writing for fputs" }, + { 10068, "E_FGETS1", "Non-file argument for fgets" }, + { 10069, "E_FGETS2", "File not open for reading for fgets" }, + { 10070, "E_FPUTSTR1", "Non-file first argument for fputstr" }, + { 10071, "E_FPUTSTR2", "Non-string argument after first for fputstr" }, + { 10072, "E_FPUTSTR3", "File not open for writing for fputstr" }, + { 10073, "E_FGETSTR1", "Non-file first argument for fgetstr" }, + { 10074, "E_FGETSTR2", "File not open for reading for fgetstr" }, + { 10075, "E_FGETLINE1", "Non-file argument for fgetline" }, + { 10076, "E_FGETLINE2", "File not open for reading for fgetline" }, + { 10077, "E_FGETFIELD1", "Non-file argument for fgetfield" }, + { 10078, "E_FGETFIELD2", "File not open for reading for fgetfield" }, + { 10079, "E_REWIND1", "Non-file argument for rewind" }, + { 10080, "E_FILES", "Non-integer argument for files" }, + { 10081, "E_PRINTF1", "Non-string fmt argument for fprint" }, + { 10082, "E_PRINTF2", "Stdout not open for writing to ???" }, + { 10083, "E_FPRINTF1", "Non-file first argument for fprintf" }, + { 10084, "E_FPRINTF2", "Non-string second (fmt) argument for fprintf" }, + { 10085, "E_FPRINTF3", "File not open for writing for fprintf" }, + { 10086, "E_STRPRINTF1", "Non-string first (fmt) argument for strprintf" }, + { 10087, "E_STRPRINTF2", "Error in attempting strprintf ???" }, + { 10088, "E_FSCAN1", "Non-file first argument for fscan" }, + { 10089, "E_FSCAN2", "File not open for reading for fscan" }, + { 10090, "E_STRSCAN", "Non-string first argument for strscan" }, + { 10091, "E_FSCANF1", "Non-file first argument for fscanf" }, + { 10092, "E_FSCANF2", "Non-string second (fmt) argument for fscanf" }, + { 10093, "E_FSCANF3", "Non-lvalue argument after second for fscanf" }, + { 10094, "E_FSCANF4", "File not open for reading or other error for fscanf" }, + { 10095, "E_STRSCANF1", "Non-string first argument for strscanf" }, + { 10096, "E_STRSCANF2", "Non-string second (fmt) argument for strscanf" }, + { 10097, "E_STRSCANF3", "Non-lvalue argument after second for strscanf" }, + { 10098, "E_STRSCANF4", "Some error in attempting strscanf ???" }, + { 10099, "E_SCANF1", "Non-string first (fmt) argument for scanf" }, + { 10100, "E_SCANF2", "Non-lvalue argument after first for scanf" }, + { 10101, "E_SCANF3", "Some error in attempting scanf ???" }, + { 10102, "E_FTELL1", "Non-file argument for ftell" }, + { 10103, "E_FTELL2", "File not open or other error for ftell" }, + { 10104, "E_FSEEK1", "Non-file first argument for fseek" }, + { 10105, "E_FSEEK2", "Non-integer or negative second argument for fseek" }, + { 10106, "E_FSEEK3", "File not open or other error for fseek" }, + { 10107, "E_FSIZE1", "Non-file argument for fsize" }, + { 10108, "E_FSIZE2", "File not open or other error for fsize" }, + { 10109, "E_FEOF1", "Non-file argument for feof" }, + { 10110, "E_FEOF2", "File not open or other error for feof" }, + { 10111, "E_FERROR1", "Non-file argument for ferror" }, + { 10112, "E_FERROR2", "File not open or other error for ferror" }, + { 10113, "E_UNGETC1", "Non-file argument for ungetc" }, + { 10114, "E_UNGETC2", "File not open for reading for ungetc" }, + { 10115, "E_UNGETC3", "Bad second argument or other error for ungetc" }, + { 10116, "E_BIGEXP", "Exponent too big in scanning" }, + { 10117, "E_ISATTY1", "UNUSED ERROR: E_ISATTY1 is no longer used" }, + { 10118, "E_ISATTY2", "UNUSED ERROR: E_ISATTY2 is no longer used" }, + { 10119, "E_ACCESS1", "Non-string first argument for access" }, + { 10120, "E_ACCESS2", "Bad second argument for access" }, + { 10121, "E_SEARCH1", "Bad first argument for search" }, + { 10122, "E_SEARCH2", "Bad second argument for search" }, + { 10123, "E_SEARCH3", "Bad third argument for search" }, + { 10124, "E_SEARCH4", "Bad fourth argument for search" }, + { 10125, "E_SEARCH5", "Cannot find fsize or fpos for search" }, + { 10126, "E_SEARCH6", "File not readable for search" }, + { 10127, "E_RSEARCH1", "Bad first argument for rsearch" }, + { 10128, "E_RSEARCH2", "Bad second argument for rsearch" }, + { 10129, "E_RSEARCH3", "Bad third argument for rsearch" }, + { 10130, "E_RSEARCH4", "Bad fourth argument for rsearch" }, + { 10131, "E_RSEARCH5", "Cannot find fsize or fpos for rsearch" }, + { 10132, "E_RSEARCH6", "File not readable for rsearch" }, + { 10133, "E_MANYOPEN", "Too many open files" }, + { 10134, "E_REWIND2", "Attempt to rewind a file that is not open" }, + { 10135, "E_STRERROR1", "Bad argument type for strerror" }, + { 10136, "E_STRERROR2", "Index out of range for strerror" }, + { 10137, "E_COS1", "Bad epsilon for cos" }, + { 10138, "E_COS2", "Bad first argument for cos" }, + { 10139, "E_SIN1", "Bad epsilon for sin" }, + { 10140, "E_SIN2", "Bad first argument for sin" }, + { 10141, "E_EVAL2", "Non-string argument for eval" }, + { 10142, "E_ARG1", "Bad epsilon for arg" }, + { 10143, "E_ARG2", "Bad first argument for arg" }, + { 10144, "E_POLAR1", "Non-real argument for polar" }, + { 10145, "E_POLAR2", "Bad epsilon for polar" }, + { 10146, "E_FCNT", "UNUSED ERROR: Non-integral argument for fcnt" }, + { 10147, "E_MATFILL1", "Non-variable first argument for matfill" }, + { 10148, "E_MATFILL2", "Non-matrix first argument-value for matfill" }, + { 10149, "E_MATDIM", "Non-matrix argument for matdim" }, + { 10150, "E_MATSUM", "Non-matrix argument for matsum" }, + { 10151, "E_ISIDENT", "UNUSED ERROR: E_ISIDENT is no longer used" }, + { 10152, "E_MATTRANS1", "Non-matrix argument for mattrans" }, + { 10153, "E_MATTRANS2", "Non-two-dimensional matrix for mattrans" }, + { 10154, "E_DET1", "Non-matrix argument for det" }, + { 10155, "E_DET2", "Matrix for det not of dimension 2" }, + { 10156, "E_DET3", "Non-square matrix for det" }, + { 10157, "E_MATMIN1", "Non-matrix first argument for matmin" }, + { 10158, "E_MATMIN2", "Non-positive-integer second argument for matmin" }, + { 10159, "E_MATMIN3", "Second argument for matmin exceeds dimension" }, + { 10160, "E_MATMAX1", "Non-matrix first argument for matmin" }, + { 10161, "E_MATMAX2", "Second argument for matmax not positive integer" }, + { 10162, "E_MATMAX3", "Second argument for matmax exceeds dimension" }, + { 10163, "E_CP1", "Non-matrix argument for cp" }, + { 10164, "E_CP2", "Non-one-dimensional matrix for cp" }, + { 10165, "E_CP3", "Matrix size not 3 for cp" }, + { 10166, "E_DP1", "Non-matrix argument for dp" }, + { 10167, "E_DP2", "Non-one-dimensional matrix for dp" }, + { 10168, "E_DP3", "Different-size matrices for dp" }, + { 10169, "E_STRLEN", "Non-string argument for strlen" }, + { 10170, "E_STRCAT", "Non-string argument for strcat" }, + { 10171, "E_SUBSTR1", "Non-string first argument for strcat" }, + { 10172, "E_SUBSTR2", "Non-non-negative integer second argument for strcat" }, + { 10173, "E_CHAR", "Bad argument for char" }, + { 10174, "E_ORD", "Non-string argument for ord" }, + { 10175, "E_INSERT1", "Non-list-variable first argument for insert" }, + { 10176, "E_INSERT2", "Non-integral second argument for insert" }, + { 10177, "E_PUSH", "Non-list-variable first argument for push" }, + { 10178, "E_APPEND", "Non-list-variable first argument for append" }, + { 10179, "E_DELETE1", "Non-list-variable first argument for delete" }, + { 10180, "E_DELETE2", "Non-integral second argument for delete" }, + { 10181, "E_POP", "Non-list-variable argument for pop" }, + { 10182, "E_REMOVE", "Non-list-variable argument for remove" }, + { 10183, "E_LN1", "Bad epsilon argument for ln" }, + { 10184, "E_LN2", "Non-numeric first argument for ln" }, + { 10185, "E_ERROR1", "Non-integer argument for error" }, + { 10186, "E_ERROR2", "Argument outside range for error" }, + { 10187, "E_EVAL3", "Attempt to eval at maximum input depth" }, + { 10188, "E_EVAL4", "Unable to open string for reading" }, + { 10189, "E_RM1", "First argument for rm is not a non-empty string" }, + { 10190, "E_RM2", "UNUSED ERROR: Unable to remove a file" }, + { 10191, "E_RDPERM", "UNUSED ERROR: Operation allowed because calc mode disallows read operations" }, + { 10192, "E_WRPERM", "Operation allowed because calc mode disallows write operations" }, + { 10193, "E_EXPERM", "UNUSED ERROR: Operation allowed because calc mode disallows exec operations" }, + { 10194, "E_MIN", "Unordered arguments for min" }, + { 10195, "E_MAX", "Unordered arguments for max" }, + { 10196, "E_LISTMIN", "Unordered items for minimum of list" }, + { 10197, "E_LISTMAX", "Unordered items for maximum of list" }, + { 10198, "E_SIZE", "Size undefined for argument type" }, + { 10199, "E_NO_C_ARG", "Calc must be run with a -C argument to use custom function" }, + { 10200, "E_NO_CUSTOM", "Calc was built with custom functions disabled" }, + { 10201, "E_UNK_CUSTOM", "Custom function unknown, try: show custom" }, + { 10202, "E_BLK1", "Non-integral length for block" }, + { 10203, "E_BLK2", "Negative or too-large length for block" }, + { 10204, "E_BLK3", "Non-integral chunksize for block" }, + { 10205, "E_BLK4", "Negative or too-large chunksize for block" }, + { 10206, "E_BLKFREE1", "Named block does not exist for blkfree" }, + { 10207, "E_BLKFREE2", "Non-integral id specification for blkfree" }, + { 10208, "E_BLKFREE3", "Block with specified id does not exist" }, + { 10209, "E_BLKFREE4", "Block already freed" }, + { 10210, "E_BLKFREE5", "No-realloc protection prevents blkfree" }, + { 10211, "E_BLOCKS1", "Non-integer argument for blocks" }, + { 10212, "E_BLOCKS2", "Non-allocated index number for blocks" }, + { 10213, "E_COPY1", "Non-integer or negative source index for copy" }, + { 10214, "E_COPY2", "Source index too large for copy" }, + { 10215, "E_COPY3", "UNUSED ERROR: E_COPY3 is no longer used" }, + { 10216, "E_COPY4", "Non-integer or negative number for copy" }, + { 10217, "E_COPY5", "Number too large for copy" }, + { 10218, "E_COPY6", "Non-integer or negative destination index for copy" }, + { 10219, "E_COPY7", "Destination index too large for copy" }, + { 10220, "E_COPY8", "Freed block source for copy" }, + { 10221, "E_COPY9", "Unsuitable source type for copy" }, + { 10222, "E_COPY10", "Freed block destination for copy" }, + { 10223, "E_COPY11", "Unsuitable destination type for copy" }, + { 10224, "E_COPY12", "Incompatible source and destination for copy" }, + { 10225, "E_COPY13", "No-copy-from source variable" }, + { 10226, "E_COPY14", "No-copy-to destination variable" }, + { 10227, "E_COPY15", "No-copy-from source named block" }, + { 10228, "E_COPY16", "No-copy-to destination named block" }, + { 10229, "E_COPY17", "No-relocate destination for copy" }, + { 10230, "E_COPYF1", "File not open for copy" }, + { 10231, "E_COPYF2", "fseek or fsize failure for copy" }, + { 10232, "E_COPYF3", "fwrite error for copy" }, + { 10233, "E_COPYF4", "fread error for copy" }, + { 10234, "E_PROTECT1", "Non-variable first argument for protect" }, + { 10235, "E_PROTECT2", "Bad second argument for protect" }, + { 10236, "E_PROTECT3", "Bad third argument for protect" }, + { 10237, "E_MATFILL3", "No-copy-to destination for matfill" }, + { 10238, "E_MATFILL4", "No-assign-from source for matfill" }, + { 10239, "E_MATTRACE1", "Non-matrix argument for mattrace" }, + { 10240, "E_MATTRACE2", "Non-two-dimensional argument for mattrace" }, + { 10241, "E_MATTRACE3", "Non-square argument for mattrace" }, + { 10242, "E_TAN1", "Bad epsilon for tan" }, + { 10243, "E_TAN2", "Bad argument for tan" }, + { 10244, "E_COT1", "Bad epsilon for cot" }, + { 10245, "E_COT2", "Bad argument for cot" }, + { 10246, "E_SEC1", "Bad epsilon for sec" }, + { 10247, "E_SEC2", "Bad argument for sec" }, + { 10248, "E_CSC1", "Bad epsilon for csc" }, + { 10249, "E_CSC2", "Bad argument for csc" }, + { 10250, "E_SINH1", "Bad epsilon for sinh" }, + { 10251, "E_SINH2", "Bad argument for sinh" }, + { 10252, "E_COSH1", "Bad epsilon for cosh" }, + { 10253, "E_COSH2", "Bad argument for cosh" }, + { 10254, "E_TANH1", "Bad epsilon for tanh" }, + { 10255, "E_TANH2", "Bad argument for tanh" }, + { 10256, "E_COTH1", "Bad epsilon for coth" }, + { 10257, "E_COTH2", "Bad argument for coth" }, + { 10258, "E_SECH1", "Bad epsilon for sech" }, + { 10259, "E_SECH2", "Bad argument for sech" }, + { 10260, "E_CSCH1", "Bad epsilon for csch" }, + { 10261, "E_CSCH2", "Bad argument for csch" }, + { 10262, "E_ASIN1", "Bad epsilon for asin" }, + { 10263, "E_ASIN2", "Bad argument for asin" }, + { 10264, "E_ACOS1", "Bad epsilon for acos" }, + { 10265, "E_ACOS2", "Bad argument for acos" }, + { 10266, "E_ATAN1", "Bad epsilon for atan" }, + { 10267, "E_ATAN2", "Bad argument for atan" }, + { 10268, "E_ACOT1", "Bad epsilon for acot" }, + { 10269, "E_ACOT2", "Bad argument for acot" }, + { 10270, "E_ASEC1", "Bad epsilon for asec" }, + { 10271, "E_ASEC2", "Bad argument for asec" }, + { 10272, "E_ACSC1", "Bad epsilon for acsc" }, + { 10273, "E_ACSC2", "Bad argument for acsc" }, + { 10274, "E_ASINH1", "Bad epsilon for asin" }, + { 10275, "E_ASINH2", "Bad argument for asinh" }, + { 10276, "E_ACOSH1", "Bad epsilon for acosh" }, + { 10277, "E_ACOSH2", "Bad argument for acosh" }, + { 10278, "E_ATANH1", "Bad epsilon for atanh" }, + { 10279, "E_ATANH2", "Bad argument for atanh" }, + { 10280, "E_ACOTH1", "Bad epsilon for acoth" }, + { 10281, "E_ACOTH2", "Bad argument for acoth" }, + { 10282, "E_ASECH1", "UNUSED ERROR: Bad epsilon for asech" }, + { 10283, "E_ASECH2", "Bad argument for asech" }, + { 10284, "E_ACSCH1", "Bad epsilon for acsch" }, + { 10285, "E_ACSCH2", "Bad argument for acsch" }, + { 10286, "E_GD1", "Bad epsilon for gd" }, + { 10287, "E_GD2", "Bad argument for gd" }, + { 10288, "E_AGD1", "Bad epsilon for agd" }, + { 10289, "E_AGD2", "Bad argument for agd" }, + { 10290, "E_LOGINF", "Log of zero or infinity" }, + { 10291, "E_STRADD", "String addition failure" }, + { 10292, "E_STRMUL", "String multiplication failure" }, + { 10293, "E_STRNEG", "String reversal failure" }, + { 10294, "E_STRSUB", "String subtraction failure" }, + { 10295, "E_BIT1", "Bad argument type for bit" }, + { 10296, "E_BIT2", "Index too large for bit" }, + { 10297, "E_SETBIT1", "Non-integer second argument for setbit" }, + { 10298, "E_SETBIT2", "Out-of-range index for setbit" }, + { 10299, "E_SETBIT3", "Non-string first argument for setbit" }, + { 10300, "E_OR", "Bad argument for or" }, + { 10301, "E_AND", "Bad argument for and" }, + { 10302, "E_STROR", "Allocation failure for string or" }, + { 10303, "E_STRAND", "Allocation failure for string and" }, + { 10304, "E_XOR", "Bad argument for xorvalue" }, + { 10305, "E_COMP", "Bad argument for comp" }, + { 10306, "E_STRDIFF", "Allocation failure for string diff" }, + { 10307, "E_STRCOMP", "Allocation failure for string comp" }, + { 10308, "E_SEG1", "Bad first argument for segment" }, + { 10309, "E_SEG2", "Bad second argument for segment" }, + { 10310, "E_SEG3", "Bad third argument for segment" }, + { 10311, "E_STRSEG", "Failure for string segment" }, + { 10312, "E_HIGHBIT1", "Bad argument type for highbit" }, + { 10313, "E_HIGHBIT2", "Non-integer argument for highbit" }, + { 10314, "E_LOWBIT1", "Bad argument type for lowbit" }, + { 10315, "E_LOWBIT2", "Non-integer argument for lowbit" }, + { 10316, "E_CONTENT", "Bad argument type for unary hash op" }, + { 10317, "E_HASHOP", "Bad argument type for binary hash op" }, + { 10318, "E_HEAD1", "Bad first argument for head" }, + { 10319, "E_HEAD2", "Bad second argument for head" }, + { 10320, "E_STRHEAD", "Failure for strhead" }, + { 10321, "E_TAIL1", "Bad first argument for tail" }, + { 10322, "E_TAIL2", "UNUSED ERROR: Bad second argument for tail" }, + { 10323, "E_STRTAIL", "Failure for strtail" }, + { 10324, "E_STRSHIFT", "Failure for strshift" }, + { 10325, "E_STRCMP", "Non-string argument for strcmp" }, + { 10326, "E_STRNCMP", "Bad argument type for strncmp" }, + { 10327, "E_XOR1", "Varying types of argument for xor" }, + { 10328, "E_XOR2", "Bad argument type for xor" }, + { 10329, "E_STRCPY", "Bad argument type for strcpy" }, + { 10330, "E_STRNCPY", "Bad argument type for strncpy" }, + { 10331, "E_BACKSLASH", "Bad argument type for unary backslash" }, + { 10332, "E_SETMINUS", "Bad argument type for setminus" }, + { 10333, "E_INDICES1", "Bad first argument type for indices" }, + { 10334, "E_INDICES2", "Bad second argument for indices" }, + { 10335, "E_EXP3", "Too-large re(argument) for exp" }, + { 10336, "E_SINH3", "Too-large re(argument) for sinh" }, + { 10337, "E_COSH3", "Too-large re(argument) for cosh" }, + { 10338, "E_SIN3", "Too-large im(argument) for sin" }, + { 10339, "E_COS3", "Too-large im(argument) for cos" }, + { 10340, "E_GD3", "Infinite or too-large result for gd" }, + { 10341, "E_AGD3", "Infinite or too-large result for agd" }, + { 10342, "E_POWER4", "Too-large value for power" }, + { 10343, "E_ROOT4", "Too-large value for root" }, + { 10344, "E_DGT1", "Non-real first arg for digit" }, + { 10345, "E_DGT2", "Non-integral second arg for digit" }, + { 10346, "E_DGT3", "Bad third arg for digit" }, + { 10347, "E_PLCS1", "Bad first argument for places" }, + { 10348, "E_PLCS2", "Bad second argument for places" }, + { 10349, "E_DGTS1", "Bad first argument for digits" }, + { 10350, "E_DGTS2", "Bad second argument for digits" }, + { 10351, "E_ILOG", "Bad first argument for ilog" }, + { 10352, "E_ILOGB", "Bad second argument for ilog" }, + { 10353, "E_ILOG10", "Bad argument for ilog10" }, + { 10354, "E_ILOG2", "Bad argument for ilog2" }, + { 10355, "E_COMB1", "Non-integer second arg for comb" }, + { 10356, "E_COMB2", "Too-large second arg for comb" }, + { 10357, "E_CTLN", "Bad argument for catalan" }, + { 10358, "E_BERN", "Bad argument for bern" }, + { 10359, "E_EULER", "Bad argument for euler" }, + { 10360, "E_SLEEP", "Bad argument for sleep" }, + { 10361, "E_TTY", "calc_tty failure" }, + { 10362, "E_ASSIGN1", "No-copy-to destination for octet assign" }, + { 10363, "E_ASSIGN2", "No-copy-from source for octet assign" }, + { 10364, "E_ASSIGN3", "No-change destination for octet assign" }, + { 10365, "E_ASSIGN4", "Non-variable destination for assign" }, + { 10366, "E_ASSIGN5", "No-assign-to destination for assign" }, + { 10367, "E_ASSIGN6", "No-assign-from source for assign" }, + { 10368, "E_ASSIGN7", "No-change destination for assign" }, + { 10369, "E_ASSIGN8", "No-type-change destination for assign" }, + { 10370, "E_ASSIGN9", "No-error-value destination for assign" }, + { 10371, "E_SWAP1", "No-copy argument for octet swap" }, + { 10372, "E_SWAP2", "No-assign-to-or-from argument for swap" }, + { 10373, "E_SWAP3", "Non-lvalue argument for swap" }, + { 10374, "E_QUOMOD1", "Non-lvalue argument 3 or 4 for quomod" }, + { 10375, "E_QUOMOD2", "Non-real-number arg 1 or 2 or bad arg 5 for quomod" }, + { 10376, "E_QUOMOD3", "No-assign-to argument 3 or 4 for quomod" }, + { 10377, "E_PREINC1", "No-copy-to or no-change argument for octet preinc" }, + { 10378, "E_PREINC2", "Non-variable argument for preinc" }, + { 10379, "E_PREINC3", "No-assign-to or no-change argument for preinc" }, + { 10380, "E_PREDEC1", "No-copy-to or no-change argument for octet predec" }, + { 10381, "E_PREDEC2", "Non-variable argument for predec" }, + { 10382, "E_PREDEC3", "No-assign-to or no-change argument for predec" }, + { 10383, "E_POSTINC1", "No-copy-to or no-change argument for octet postinc" }, + { 10384, "E_POSTINC2", "Non-variable argument for postinc" }, + { 10385, "E_POSTINC3", "No-assign-to or no-change argument for postinc" }, + { 10386, "E_POSTDEC1", "No-copy-to or no-change argument for octet postdec" }, + { 10387, "E_POSTDEC2", "Non-variable argument for postdec" }, + { 10388, "E_POSTDEC3", "No-assign-to or no-change argument for postdec" }, + { 10389, "E_INIT1", "Error-type structure for initialization" }, + { 10390, "E_INIT2", "No-copy-to structure for initialization" }, + { 10391, "E_INIT3", "Too many initializer values" }, + { 10392, "E_INIT4", "Attempt to initialize freed named block" }, + { 10393, "E_INIT5", "Bad structure type for initialization" }, + { 10394, "E_INIT6", "No-assign-to element for initialization" }, + { 10395, "E_INIT7", "No-change element for initialization" }, + { 10396, "E_INIT8", "No-type-change element for initialization" }, + { 10397, "E_INIT9", "No-error-value element for initialization" }, + { 10398, "E_INIT10", "No-assign-or-copy-from source for initialization" }, + { 10399, "E_LIST1", "No-relocate for list insert" }, + { 10400, "E_LIST2", "No-relocate for list delete" }, + { 10401, "E_LIST3", "No-relocate for list push" }, + { 10402, "E_LIST4", "No-relocate for list append" }, + { 10403, "E_LIST5", "No-relocate for list pop" }, + { 10404, "E_LIST6", "No-relocate for list remove" }, + { 10405, "E_MODIFY1", "Non-variable first argument for modify" }, + { 10406, "E_MODIFY2", "Non-string second argument for modify" }, + { 10407, "E_MODIFY3", "No-change first argument for modify" }, + { 10408, "E_MODIFY4", "Undefined function for modify" }, + { 10409, "E_MODIFY5", "Unacceptable type first argument for modify" }, + { 10410, "E_FPATHOPEN1", "Non-string arguments for fpathopen" }, + { 10411, "E_FPATHOPEN2", "Unrecognized mode for fpathopen" }, + { 10412, "E_LOG1", "Bad epsilon argument for log" }, + { 10413, "E_LOG2", "Non-numeric first argument for log" }, + { 10414, "E_LOG3", "Cannot calculate log for this value" }, + { 10415, "E_FGETFILE1", "Non-file argument for fgetfile" }, + { 10416, "E_FGETFILE2", "File argument for fgetfile not open for reading" }, + { 10417, "E_FGETFILE3", "Unable to set file position in fgetfile" }, + { 10418, "E_ESTR", "UNUSED ERROR: Non-representable type for estr" }, + { 10419, "E_STRCASECMP", "Non-string argument for strcasecmp" }, + { 10420, "E_STRNCASECMP", "Bad argument type for strncasecmp" }, + { 10421, "E_ISUPPER", "Bad argument for isupper" }, + { 10422, "E_ISLOWER", "Bad argument for islower" }, + { 10423, "E_ISALNUM", "Bad argument for isalnum" }, + { 10424, "E_ISALPHA", "Bad argument for isalpha" }, + { 10425, "E_ISASCII", "Bad argument for isascii" }, + { 10426, "E_ISCNTRL", "Bad argument for iscntrl" }, + { 10427, "E_ISDIGIT", "Bad argument for isdigit" }, + { 10428, "E_ISGRAPH", "Bad argument for isgraph" }, + { 10429, "E_ISPRINT", "Bad argument for isprint" }, + { 10430, "E_ISPUNCT", "Bad argument for ispunct" }, + { 10431, "E_ISSPACE", "Bad argument for isspace" }, + { 10432, "E_ISXDIGIT", "Bad argument for isxdigit" }, + { 10433, "E_STRTOUPPER", "Bad argument type for strtoupper" }, + { 10434, "E_STRTOLOWER", "Bad argument type for strtolower" }, + { 10435, "E_TAN3", "UNUSED ERROR: Invalid value for calculating the sin numerator for tan" }, + { 10436, "E_TAN4", "UNUSED ERROR: Invalid value for calculating the cos denominator for tan" }, + { 10437, "E_COT3", "UNUSED ERROR: Invalid value for calculating the sin numerator for cot" }, + { 10438, "E_COT4", "UNUSED ERROR: Invalid value for calculating the cos denominator for cot" }, + { 10439, "E_SEC3", "UNUSED ERROR: Invalid value for calculating the cos reciprocal for sec" }, + { 10440, "E_CSC3", "UNUSED ERROR: Invalid value for calculating the sin reciprocal for csc" }, + { 10441, "E_TANH3", "Invalid value for calculating the sinh numerator for tanh" }, + { 10442, "E_TANH4", "Invalid value for calculating the cosh denominator for tanh" }, + { 10443, "E_COTH3", "Invalid value for calculating the sinh numerator for coth" }, + { 10444, "E_COTH4", "Invalid value for calculating the cosh denominator for coth" }, + { 10445, "E_SECH3", "Invalid value for calculating the cosh reciprocal for sech" }, + { 10446, "E_CSCH3", "Invalid value for calculating the sinh reciprocal for csch" }, + { 10447, "E_ASIN3", "Invalid value for calculating asin" }, + { 10448, "E_ACOS3", "Invalid value for calculating acos" }, + { 10449, "E_ASINH3", "Invalid value for calculating asinh" }, + { 10450, "E_ACOSH3", "Invalid value for calculating acosn" }, + { 10451, "E_ATAN3", "Invalid value for calculating atan" }, + { 10452, "E_ACOT3", "Invalid value for calculating acot" }, + { 10453, "E_ASEC3", "Invalid value for calculating asec" }, + { 10454, "E_ACSC3", "Invalid value for calculating acsc" }, + { 10455, "E_ATANH3", "Invalid value for calculating atan" }, + { 10456, "E_ACOTH3", "Invalid value for calculating acot" }, + { 10457, "E_ASECH3", "Invalid value for calculating asec" }, + { 10458, "E_ACSCH3", "Invalid value for calculating acsc" }, + { 10459, "E_D2R1", "Bad epsilon for converting degrees to radians" }, + { 10460, "E_D2R2", "Bad first argument converting degrees to radians" }, + { 10461, "E_R2D1", "Bad epsilon for converting radians to degrees" }, + { 10462, "E_R2D2", "Bad first argument converting radians to degrees" }, + { 10463, "E_G2R1", "Bad epsilon for converting gradians to radians" }, + { 10464, "E_G2R2", "Bad first argument converting gradians to radians" }, + { 10465, "E_R2G1", "Bad epsilon for converting radians to gradians" }, + { 10466, "E_R2G2", "Bad first argument converting radians to gradians" }, + { 10467, "E_D2G1", "Bad first argument converting degrees to gradians" }, + { 10468, "E_G2D1", "Bad first argument converting gradians to degrees" }, + { 10469, "E_D2DMS1", "Non-lvalue arguments 2, 3 or 4 for d2dms" }, + { 10470, "E_D2DMS2", "Non-real-number arg 1 for d2dms" }, + { 10471, "E_D2DMS3", "No-assign-to argument 2, 3 or 4 for d2dms" }, + { 10472, "E_D2DMS4", "Invalid rounding arg 5 for d2dms" }, + { 10473, "E_D2DM1", "Non-lvalue arguments 2 or 3 for d2dm" }, + { 10474, "E_D2DM2", "Non-real-number arg 1 for d2dm" }, + { 10475, "E_D2DM3", "No-assign-to argument 2 or 3 for d2dm" }, + { 10476, "E_D2DM4", "Invalid rounding arg 4 for d2dm" }, + { 10477, "E_G2GMS1", "Non-lvalue arguments 2, 3 or 4 for g2gms" }, + { 10478, "E_G2GMS2", "Non-real-number arg 1 for g2gms" }, + { 10479, "E_G2GMS3", "No-assign-to argument 2 or 3 for g2gms" }, + { 10480, "E_G2GMS4", "Invalid rounding arg 5 for g2gms" }, + { 10481, "E_G2GM1", "Non-lvalue arguments 2 or 3 for g2gm" }, + { 10482, "E_G2GM2", "Non-real-number arg 1 for g2gm" }, + { 10483, "E_G2GM3", "No-assign-to argument 2, 3 or 4 for g2gm" }, + { 10484, "E_G2GM4", "Invalid rounding arg 4 for g2gm" }, + { 10485, "E_H2HMS1", "Non-lvalue arguments 2, 3 or 4 for h2hms" }, + { 10486, "E_H2HMS2", "Non-real-number arg 1 for h2hms" }, + { 10487, "E_H2HMS3", "No-assign-to argument 2, 3 or 4 for h2hms" }, + { 10488, "E_H2HMS4", "Invalid rounding arg 5 for h2hms" }, + { 10489, "E_H2HM1", "Non-lvalue arguments 2 or 3 for h2hm" }, + { 10490, "E_H2HM2", "Non-real-number arg 1 for h2hm" }, + { 10491, "E_H2HM3", "No-assign-to argument 2 or 3 for h2hm" }, + { 10492, "E_H2HM4", "Invalid rounding arg 4 for h2hm" }, + { 10493, "E_DMS2D1", "Non-real-number arguments 1, 2 or 3 for dms2d" }, + { 10494, "E_DMS2D2", "Invalid rounding arg 4 for dms2d" }, + { 10495, "E_DM2D1", "Non-real-number arguments 1 or 2 for dm2d" }, + { 10496, "E_DM2D2", "Invalid rounding arg 4 for dm2d" }, + { 10497, "E_GMS2G1", "Non-real-number arguments 1, 2 or 3 for gms2g" }, + { 10498, "E_GMS2G2", "Invalid rounding arg 4 for gms2g" }, + { 10499, "E_GM2G1", "Non-real-number arguments 1 or 2 for gm2g" }, + { 10500, "E_GM2G2", "Invalid rounding arg 4 for gm2g" }, + { 10501, "E_HMS2H1", "Non-real-number arguments 1, 2 or 3 for hms2h" }, + { 10502, "E_HMS2H2", "Invalid rounding arg 4 for hms2h" }, + { 10503, "E_HM2H1", "UNUSED ERROR: Non-real-number arguments 1 or 2 for hm2h" }, + { 10504, "E_HM2H2", "UNUSED ERROR: Invalid rounding arg 4 for hm2h" }, + { 10505, "E_LOG2_1", "Bad epsilon argument for log2" }, + { 10506, "E_LOG2_2", "Non-numeric first argument for log2" }, + { 10507, "E_LOG2_3", "Cannot calculate log2 for this value" }, + { 10508, "E_LOGN_1", "Bad epsilon argument for logn" }, + { 10509, "E_LOGN_2", "Non-numeric first argument for logn" }, + { 10510, "E_LOGN_3", "Cannot calculate logn for this value" }, + { 10511, "E_LOGN_4", "Cannot calculate logn for this log base" }, + { 10512, "E_LOGN_5", "Non-numeric second argument for logn" }, + { 10513, "E_VERSIN1", "Bad epsilon for versin" }, + { 10514, "E_VERSIN2", "Bad first argument for versin" }, + { 10515, "E_VERSIN3", "Too-large im(argument) for versin" }, + { 10516, "E_AVERSIN1", "Bad epsilon for aversin" }, + { 10517, "E_AVERSIN2", "Bad first argument for aversin" }, + { 10518, "E_AVERSIN3", "Too-large im(argument) for aversin" }, + { 10519, "E_COVERSIN1", "Bad epsilon for coversin" }, + { 10520, "E_COVERSIN2", "Bad first argument for coversin" }, + { 10521, "E_COVERSIN3", "Too-large im(argument) for coversin" }, + { 10522, "E_ACOVERSIN1", "Bad epsilon for acoversin" }, + { 10523, "E_ACOVERSIN2", "Bad first argument for acoversin" }, + { 10524, "E_ACOVERSIN3", "Too-large im(argument) for acoversin" }, + { 10525, "E_VERCOS1", "Bad epsilon for vercos" }, + { 10526, "E_VERCOS2", "Bad first argument for vercos" }, + { 10527, "E_VERCOS3", "Too-large im(argument) for vercos" }, + { 10528, "E_AVERCOS1", "Bad epsilon for avercos" }, + { 10529, "E_AVERCOS2", "Bad first argument for avercos" }, + { 10530, "E_AVERCOS3", "Too-large im(argument) for avercos" }, + { 10531, "E_COVERCOS1", "Bad epsilon for covercos" }, + { 10532, "E_COVERCOS2", "Bad first argument for covercos" }, + { 10533, "E_COVERCOS3", "Too-large im(argument) for covercos" }, + { 10534, "E_ACOVERCOS1", "Bad epsilon for acovercos" }, + { 10535, "E_ACOVERCOS2", "Bad first argument for acovercos" }, + { 10536, "E_ACOVERCOS3", "Too-large im(argument) for acovercos" }, + { 10537, "E_TAN5", "Invalid complex argument for tan" }, + { 10538, "E_COT5", "Invalid zero argument for cot" }, + { 10539, "E_COT6", "Invalid complex argument for cot" }, + { 10540, "E_SEC5", "Invalid complex argument for sec" }, + { 10541, "E_CSC5", "Invalid zero argument for cot" }, + { 10542, "E_CSC6", "Invalid complex argument for csc" }, + /* add new entries above here and be sure their errnum numeric value is consecutive */ + + /* The next NULL entry must be last */ + { -1, NULL, NULL } +}; + + + +/* + * The code below is used to form the errcode executable and is NOT part of libcalc + */ +#if defined(ERRCODE_SRC) + + +#include +#include +#include +#include + + +/* + * errcode command line + */ +CONST char *usage = + "usage: %s [-h] [-e | -d]\n" + "\n" + "\t-h\tprint help and exit\n" + "\t-e\tprint the contents of help/errorcodes\n" + "\t-d\tprint the contents of errsym.h\n" + "\n" + "Exit codes:\n" + " 0\t\tall is OK\n" + " 2\t\t-h and help string\n" + " 3\t\tcommand line error\n" + " >=10\t\terror_table is invalid\n"; + + +char *program = "((NULL))"; /* our name */ + + +/* + * verify_error_table - verify the consistency of the error_table + * + * The errnum must start with E__BASE and be consecutive until the final entry. + * + * The errsym must be a non-NULL string that matches regular expression: ^E_[A-Z0-9_]+$ until the last entry. + * + * The errnsf must be a non-NULL non-empty string until the last entry. + * + * The final entry must have an errnum of -1, errsym of NULL and errmsg of NULL. + * + * This function does not return on error or if the error_table is invalid. + */ +S_FUNC void +verify_error_table(void) +{ + size_t len; /* length of the error_table */ + size_t e__count; /* computed E__COUNT value */ + char *p; + size_t i; + + /* + * verify error_table size + */ + len = sizeof(error_table) / sizeof(error_table[0]); + e__count = len - 2; + if (e__count != MY_E__COUNT) { + fprintf(stderr, "**** %s ERROR: error_table length: %zu != MY_E__COUNT+2: %lu\n", + program, len, MY_E__COUNT+2); + exit(10); + } + + /* + * verify the initial errnum of the 1st error_table entry + */ + if (error_table[0].errnum != E__BASE) { + fprintf(stderr, "**** %s ERROR: initial entry error_table[0].errnum: %d != E__BASE: %d\n", + program, error_table[0].errnum, E__BASE); + exit(11); + } + if (error_table[0].errsym == NULL) { + fprintf(stderr, "**** %s ERROR: error_table[0].errsym is NULL\n", + program); + exit(12); + } + if (strcmp(error_table[0].errsym, "E__BASE") != 0) { + fprintf(stderr, "**** %s ERROR: error_table[0].errsym: %s != E__BASE\n", + program, error_table[0].errsym); + exit(13); + } + if (error_table[0].errmsg == NULL) { + fprintf(stderr, "**** %s ERROR: error_table[0].errmsg is NULL\n", + program); + exit(14); + } + if (strlen(error_table[0].errmsg) <= 0) { + fprintf(stderr, "**** %s ERROR: error_table[0].errmsg length: %zu must be > 0\n", + program, strlen(error_table[0].errmsg)); + exit(15); + } + + /* + * verify 2nd thru end to last entry of error_table + */ + for (i=1; i < len-1; ++i) { + + /* + * check errnum - must be consecutive beyond E__BASE + */ + if ((unsigned long)(error_table[i].errnum) != E__BASE+i) { + fprintf(stderr, "**** %s ERROR: error_table[%zu].errnum: %d != %ld\n", + program, i, error_table[i].errnum, E__BASE+i); + exit(16); + } + + /* + * check errsym is a non-NULL string matching the regular expression: ^E_[A-Z0-9_]+$ + */ + if (error_table[i].errsym == NULL) { + fprintf(stderr, "**** %s ERROR: error_table[%zu].errsym is NULL\n", + program, i); + exit(17); + } + if (strlen(error_table[i].errsym) < 3) { + fprintf(stderr, "**** %s ERROR: error_table[%zu].errsym length: %zu must be >= 3\n", + program, i, strlen(error_table[i].errsym)); + exit(18); + } + if (strncmp(error_table[i].errsym, "E_", 2) != 0) { + fprintf(stderr, "**** %s ERROR: error_table[%zu].errsym: %s must start with E_\n", + program, i, error_table[i].errsym); + exit(19); + } + for (p = error_table[i].errsym+2; *p != '\0'; ++p) { + if (!isascii(*p) || !(isupper(*p) || isdigit(*p) || *p == '_')) { + fprintf(stderr, "**** %s ERROR: error_table[%zu].errsym: %s " + "must match the regular expression: %s\n", + program, i, error_table[i].errsym, "^E_[A-Z0-9_]+$"); + exit(20); + } + } + + /* + * verify errmsg is not empty + */ + if (strlen(error_table[i].errmsg) <= 0) { + fprintf(stderr, "**** %s ERROR: error_table[%zu].errmsg length: %zu must be > 0\n", + program, i, strlen(error_table[i].errmsg)); + exit(21); + } + } + + /* + * verify the last error_table entry + */ + if (error_table[len-1].errnum != -1) { + fprintf(stderr, "**** %s ERROR: final NULL entry error_table[%zu].errnum: %d != -1\n", + program, len-1, error_table[len-1].errnum); + exit(22); + } + if (error_table[len-1].errsym != NULL) { + fprintf(stderr, "**** %s ERROR: final NULL entry error_table[%zu].errsym != NULL\n", + program, len-1); + exit(23); + } + if (error_table[len-1].errmsg != NULL) { + fprintf(stderr, "**** %s ERROR: final NULL entry error_table[%zu].errmsg != NULL\n", + program, len-1); + exit(24); + } + return; +} + + +/* + * print_errorcodes - print the help/errorcodes file + */ +S_FUNC void +print_errorcodes(void) +{ + /* + * print the help/errorcodes file header + */ + size_t len; /* length of the error_table */ + size_t i; + + /* + * print the help/errorcodes file header + */ + printf("## DO NOT EDIT - This file was generated by errcode -e via the Makefile\n" + "Calc computation error codes\n" + "\n" + "\"E_STRING\"\terrnum\tCalc computation error message\n" + "----------\t------\t------------------------------\n" + "\n" + "\"E__NONE\"\t%d\tcalc_errno cleared: libc errno codes above here\n" + "\"E__BASE\"\t%d\tReserved for \"No error\" calc internal state\n" + "\n", + E__NONE, E__BASE); + + /* + * print the error message lines + */ + len = sizeof(error_table) / sizeof(error_table[0]); + for (i=1; i < len-1; ++i) { + if (strlen(error_table[i].errsym) < 6) { + printf("\"%s\"\t\t%d\t%s\n", + error_table[i].errsym, error_table[i].errnum, error_table[i].errmsg); + } else { + printf("\"%s\"\t%d\t%s\n", + error_table[i].errsym, error_table[i].errnum, error_table[i].errmsg); + } + } + + /* + * print the help/errorcodes.h file trailer + */ + printf("\n" + "\"E__HIGHEST\"\t%ld\thighest assigned calc computation error code\n" + "\"E__USERDEF\"\t%d\tuser defined error codes start here\n" + "\"E__USERMAX\"\t%d\tmaximum user defined error code\n", + MY_E__HIGHEST, E__USERDEF, E__USERMAX); + printf("\n" + "## Copyright (C) %d Landon Curt Noll\n" + "##\n" + "## Calc is open software; you can redistribute it and/or modify it under\n" + "## the terms of the version 2.1 of the GNU Lesser General Public License\n" + "## as published by the Free Software Foundation.\n" + "##\n" + "## Calc is distributed in the hope that it will be useful, but WITHOUT\n" + "## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n" + "## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General\n" + "## Public License for more details.\n" + "##\n" + "## A copy of version 2.1 of the GNU Lesser General Public License is\n" + "## distributed with calc under the filename COPYING-LGPL. You should have\n" + "## received a copy with calc; if not, write to Free Software Foundation, Inc.\n" + "## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n" + "##\n" + "## Under source code control: n/a\n" + "## File existed as early as: n/a\n" + "##\n" + "## chongo /\\oo/\\ http://www.isthe.com/chongo/\n" + "## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/\n", + ERRTBL_COPYRIGHT_YEAR); + return; +} + + +/* + * print_errsym - print the contents of errsym.h + */ +S_FUNC void +print_errsym(void) +{ + size_t len; /* length of the error_table */ + size_t i; + + /* + * print the errsym.h file header + */ + printf("/*\n" + " * DO NOT EDIT - This file was generated by errcode -d via the Makefile\n" + " *\n" + " * Copyright (C) %d Landon Curt Noll\n" + " *\n" + " * Calc is open software; you can redistribute it and/or modify it under\n" + " * the terms of the version 2.1 of the GNU Lesser General Public License\n" + " * as published by the Free Software Foundation.\n" + " *\n" + " * Calc is distributed in the hope that it will be useful, but WITHOUT\n" + " * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n" + " * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General\n" + " * Public License for more details.\n" + " *\n" + " * A copy of version 2.1 of the GNU Lesser General Public License is\n" + " * distributed with calc under the filename COPYING-LGPL. You should have\n" + " * received a copy with calc; if not, write to Free Software Foundation, Inc.\n" + " * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n" + " *\n" + " * Under source code control: n/a\n" + " * File existed as early as: n/a\n" + " *\n" + " * chongo /\\oo/\\ http://www.isthe.com/chongo/\n" + " * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/\n" + " */\n" + "\n" + "\n" + "#if !defined(INCLUDE_ERRSYM_H)\n" + "#define INCLUDE_ERRSYM_H\n" + "\n" + "\n", + ERRTBL_COPYRIGHT_YEAR); + printf("#define E__NONE\t\t%d\t/* calc_errno cleared: libc errno codes above here */\n" + "#define E__BASE\t\t%d\t/* Reserved for \"No error\" calc internal state */\n" + "\n", + E__NONE, E__BASE); + + /* + * print the #define lines + */ + len = sizeof(error_table) / sizeof(error_table[0]); + for (i=1; i < len-1; ++i) { + if (strlen(error_table[i].errsym) < 8) { + printf("#define %s\t\t%d\t/* %s */\n", + error_table[i].errsym, error_table[i].errnum, error_table[i].errmsg); + } else { + printf("#define %s\t%d\t/* %s */\n", + error_table[i].errsym, error_table[i].errnum, error_table[i].errmsg); + } + } + + /* + * print the errsym.h file trailer + */ + printf("\n" + "#define E__HIGHEST\t%ld\t/* highest assigned calc computation error code */\n" + "#define E__COUNT\t%ld\t/* number of calc computation error codes w/o E__BASE */\n" + "#define E__USERDEF\t%d\t/* user defined error codes start here */\n" + "#define E__USERMAX\t%d\t/* maximum user defined error code */\n", + MY_E__HIGHEST, MY_E__COUNT, E__USERDEF, E__USERMAX); + printf("\n" + "\n" + "#endif /* !INCLUDE_ERRSYM_H */\n"); + return; +} + + +int +main(int argc, char *argv[]) +{ + extern char *optarg; /* argv index of the next arg */ + extern int optind; /* argv index of the next arg */ + int e_flag = 0; /* 1 ==> -e flag was used */ + int d_flag = 0; /* 1 ==> -s flag was used */ + int i; + + /* + * parse args + */ + program = argv[0]; + while ((i = getopt(argc, argv, "hed")) != -1) { + switch (i) { + case 'h': + fprintf(stderr, usage, program); + exit(2); + case 'e': + e_flag = 1; + break; + case 'd': + d_flag = 1; + break; + default: + fprintf(stderr, "**** %s ERROR: invalid command line\n", program); + fprintf(stderr, usage, program); + exit(3); + } + } + if (e_flag && d_flag) { + fprintf(stderr, "**** %s ERROR: -e and -d conflict\n", program); + fprintf(stderr, usage, program); + exit(3); + } + + /* + * verify the consistency of the error_table + */ + verify_error_table(); + + /* + * -e - print the contents of help/errorcodes + */ + if (e_flag) { + print_errorcodes(); + } + + /* + * -d - print the contents of errsym.h + */ + if (d_flag) { + print_errsym(); + } + + /* + * All Done!!! -- Jessica Noll, Age 2 + */ + exit(0); +} + + +#endif /* ERRCODE_SRC */ diff --git a/errtbl.h b/errtbl.h new file mode 100644 index 0000000..3ac2c20 --- /dev/null +++ b/errtbl.h @@ -0,0 +1,68 @@ +/* + * errtbl - calc error code table entry + * + * Copyright (C) 2023 Ernest Bowen and Landon Curt Noll + * + * Calc is open software; you can redistribute it and/or modify it under + * the terms of the version 2.1 of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * Calc is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General + * Public License for more details. + * + * A copy of version 2.1 of the GNU Lesser General Public License is + * distributed with calc under the filename COPYING-LGPL. You should have + * received a copy with calc; if not, write to Free Software Foundation, Inc. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Under source code control: 2023/09/12 20:55:14 + * File existed as early as: 2023 + * + * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ + */ + + +#if !defined(INCLUDE_ERRTBL_H) +#define INCLUDE_ERRTBL_H + + +#include "have_const.h" +#include "decl.h" + + +/* + * primary error code defines + */ +#define E__NONE 0 /* calc_errno cleared: libc errno codes above here */ +#define E__BASE 10000 /* calc errors start above here */ +#define E__USERDEF 20000 /* user defined error codes start here */ +#define E__USERMAX 32767 /* maximum user defined error code */ + + +/* + * calc error code, error symbol and error message + */ +struct errtbl { + int errnum; /* calc error code or -1 */ + char *errsym; /* error symbol string - must match the regular expression: ^E_[A-Z0-9_]+$ or NULL */ + char *errmsg; /* calc error message or NULL */ +}; + + +/* + * The error_table[] array represents the calc computation error related + * error codes, symbols and messages. + * + * The errnum of the 1st entry error_table[0] must be E__BASE. + * + * All errnum for the following entries just be consecutive, + * except for the final NULL entry. + * + * The final entry must have an errnum of -1, errsym of NULL and errmsg of NULL. + */ +EXTERN CONST struct errtbl error_table[]; /* calc error codes, error symbols and error messages */ + + +#endif /* !INCLUDE_ERRTBL_H */ diff --git a/file.c b/file.c index e9fa782..adf6a78 100644 --- a/file.c +++ b/file.c @@ -43,7 +43,7 @@ #include "have_fpos_pos.h" #include "fposval.h" #include "file.h" -#include "calcerr.h" +#include "errsym.h" #include "strl.h" #if defined(_WIN32) || defined(_WIN64) diff --git a/func.c b/func.c index 369703b..296dbbf 100644 --- a/func.c +++ b/func.c @@ -93,7 +93,8 @@ #include "have_const.h" #include "have_unused.h" #include "calc.h" -#include "calcerr.h" +#include "errsym.h" +#include "errtbl.h" #include "opcodes.h" #include "token.h" #include "func.h" @@ -132,7 +133,6 @@ S_FUNC int malloced_putenv(char *str); * external declarations */ EXTERN char cmdbuf[]; /* command line expression */ -EXTERN CONST char *error_table[E__COUNT+2]; /* calc coded error messages */ E_FUNC void matrandperm(MATRIX *M); E_FUNC void listrandperm(LIST *lp); E_FUNC int idungetc(FILEID id, int ch); @@ -175,7 +175,7 @@ STATIC NUMBER _qfourhundred = { { _fourhundredval_, 1, 0 }, /* * user-defined error strings */ -STATIC short nexterrnum = E_USERDEF; +STATIC short nexterrnum = E__USERDEF; STATIC STRINGHEAD newerrorstr; #endif /* !FUNCLIST */ @@ -8081,11 +8081,11 @@ f_newerror(int count, VALUE **vals) str = vals[0]->v_str->s_str; if (str == NULL || str[0] == '\0') str = "???"; - if (nexterrnum == E_USERDEF) + if (nexterrnum == E__USERDEF) initstr(&newerrorstr); index = findstr(&newerrorstr, str); if (index >= 0) { - errnum = E_USERDEF + index; + errnum = E__USERDEF + index; } else { if (nexterrnum == 32767) math_error("Too many new error values"); @@ -8131,7 +8131,7 @@ f_strerror(int count, VALUE **vals) i = E__BASE; /* firewall - return generic error string if it is not assigned */ - if (i >= nexterrnum || (i > E__HIGHEST && i < E_USERDEF) + if (i >= nexterrnum || (i > E__HIGHEST && i < E__USERDEF) || (i < E__BASE && strerror(i) == NULL)) { size_t snprintf_len; /* malloced snprintf buffer length */ snprintf_len = sizeof("Unknown error 12345678901234567890")+1; @@ -8151,12 +8151,12 @@ f_strerror(int count, VALUE **vals) cp = strerror(i); /* user-described error */ - } else if (i >= E_USERDEF) { - cp = namestr(&newerrorstr, i - E_USERDEF); + } else if (i >= E__USERDEF) { + cp = namestr(&newerrorstr, i - E__USERDEF); /* calc-described error */ } else { - cp = (char *)error_table[i - E__BASE]; + cp = (char *)error_table[i - E__BASE].errmsg; } /* return result as a V_STR */ @@ -12105,11 +12105,11 @@ showerrors(void) { int i; - if (nexterrnum == E_USERDEF) + if (nexterrnum == E__USERDEF) printf("No new error-values created\n"); - for (i = E_USERDEF; i < nexterrnum; i++) + for (i = E__USERDEF; i < nexterrnum; i++) printf("%d: %s\n", i, - namestr(&newerrorstr, i - E_USERDEF)); + namestr(&newerrorstr, i - E__USERDEF)); } diff --git a/help/Makefile b/help/Makefile index 7576e57..ac7c58c 100644 --- a/help/Makefile +++ b/help/Makefile @@ -247,8 +247,7 @@ SINGULAR_FILES= binding bug change errorcode type # These files are found (but not built) in the distribution # DISTLIST= ${STD_HELP_FILES} ${DETAIL_HELP} ${MAKE_FILE} \ - obj.file builtin.top builtin.end funclist.sed \ - errorcodes.hdr errorcodes.sed + obj.file builtin.top builtin.end funclist.sed # These files are used to make (but not built) a calc .a link library # @@ -361,10 +360,9 @@ contrib: ../CONTRIB-CODE ${TRUE}; \ fi -errorcodes: ../calcerr.h errorcodes.hdr errorcodes.sed +errorcodes: ../errcode${EXT} ${RM} -f $@ - ${CAT} errorcodes.hdr > $@ - ${SED} -n -f errorcodes.sed < ../calcerr.h >> $@ + ../errcode${EXT} -e > $@ ${CHMOD} 0444 $@ -@if [ -z "${Q}" ]; then \ echo ''; \ @@ -639,8 +637,7 @@ detail_help_list: ! -name archive ! -name assoc ! -name builtin.end \ ! -name builtin.top ! -name command ! -name config \ ! -name contrib ! -name credit ! -name custom ! -name define \ - ! -name environment ! -name errorcodes.hdr \ - ! -name errorcodes.sed ! -name expression ! -name file \ + ! -name environment ! -name expression ! -name file \ ! -name funclist.c ! -name funclist.sed ! -name help \ ! -name history ! -name interrupt ! -name intro ! -name list \ ! -name mat ! -name obj.file ! -name operator \ diff --git a/help/errno b/help/errno index c4fec84..b37cdb0 100644 --- a/help/errno +++ b/help/errno @@ -2,10 +2,11 @@ NAME errno - return or set a the global calc_errno value SYNOPSIS - errno([errnum]) + errno([errnum | "E_STRING"]) TYPES errnum integer + E_STRING string return integer @@ -68,6 +69,8 @@ LIMITS LINK LIBRARY int calc_errno; /* global calc_errno value */ + E_STRING is C string matching the regular expression: "^E_[A-Z0-9_]+$" + SEE ALSO errmax, errcount, error, strerror, iserror, newerror, errorcodes, stoponerror diff --git a/help/error b/help/error index f3c7d3f..19488d5 100644 --- a/help/error +++ b/help/error @@ -2,10 +2,11 @@ NAME error - raise a calc error condition SYNOPSIS - error([errnum]) + error([errnum | "E_STRING"]) TYPES errnum integer, defaults to errno() + E_STRING string return null value or error value @@ -74,10 +75,13 @@ DESCRIPTION The following constants are part of the calc error code mechanism: E__BASE == 10000 # 1 less than the 1st calc computation error code - E_USERDEF == 20000 # User defined error codes start - E_USERMAX == 32767 # maximum user defined error code - E__BASE < E__HIGHEST < E_USERDEF # How E__HIGHEST is bounded - E__COUNT == E__HIGHEST - E__BASE # Number of calc computation error codes + + E__COUNT # number of calc computation error codes (not including E__BASE) + E__HIGHEST # highest assigned calc computation error code + + E__USERDEF == 20000 # user defined error codes start here + E__USERMAX == 32767 # maximum user defined error code + See help errorcodes for the actual values of the above constants. @@ -111,6 +115,8 @@ EXAMPLE LIMITS 0 <= errnum <= 32767 + E_STRING is C string matching the regular expression: "^E_[A-Z0-9_]+$" + LINK LIBRARY int calc_errno; /* global calc_errno value */ diff --git a/help/errorcodes.hdr b/help/errorcodes.hdr deleted file mode 100644 index d36d441..0000000 --- a/help/errorcodes.hdr +++ /dev/null @@ -1,25 +0,0 @@ -Calc generated error codes (see the error help file): - -## Copyright (C) 1999,2023 Landon Curt Noll -## -## Calc is open software; you can redistribute it and/or modify it under -## the terms of the version 2.1 of the GNU Lesser General Public License -## as published by the Free Software Foundation. -## -## Calc is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General -## Public License for more details. -## -## A copy of version 2.1 of the GNU Lesser General Public License is -## distributed with calc under the filename COPYING-LGPL. You should have -## received a copy with calc; if not, write to Free Software Foundation, Inc. -## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -## -## Under source code control: 1995/12/18 03:19:11 -## File existed as early as: 1995 -## -## chongo /\oo/\ http://www.isthe.com/chongo/ -## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ - 0 calc_errno cleared: libc errno codes above here - 10000 calc errors start above here diff --git a/help/errorcodes.sed b/help/errorcodes.sed deleted file mode 100644 index 0757b3a..0000000 --- a/help/errorcodes.sed +++ /dev/null @@ -1,23 +0,0 @@ -/^#define E_[^_].*[ ][1-9][0-9]*[ ]\/\* .* \*\//s/#define E_.*[ ]\([1-9][0-9]*\)[ ]*\/\* \(.*\)[ ][ ]*\*\// \1 \2/p - -## Copyright (C) 1999 Landon Curt Noll -## -## Calc is open software; you can redistribute it and/or modify it under -## the terms of the version 2.1 of the GNU Lesser General Public License -## as published by the Free Software Foundation. -## -## Calc is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General -## Public License for more details. -## -## A copy of version 2.1 of the GNU Lesser General Public License is -## distributed with calc under the filename COPYING-LGPL. You should have -## received a copy with calc; if not, write to Free Software Foundation, Inc. -## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -## -## Under source code control: 1995/12/18 03:19:11 -## File existed as early as: 1995 -## -## chongo /\oo/\ http://www.isthe.com/chongo/ -## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/newerror b/help/newerror index 032b516..d13d3f0 100644 --- a/help/newerror +++ b/help/newerror @@ -66,9 +66,11 @@ EXAMPLE triangle side length <= 0: 20000 LIMITS - The number of new described error-values is not to exceed E_USERMAX-E_USERDEF + The number of new described error-values is not to exceed E__USERMAX-E__USERDEF (which is usually 12767 calls to the newerror function). + E_STRING is string matching the regular expression: "^E_[A-Z0-9]+$" + LINK LIBRARY none diff --git a/help/strerror b/help/strerror index c4d1e0a..6596e69 100644 --- a/help/strerror +++ b/help/strerror @@ -2,10 +2,11 @@ NAME strerror - returns a string describing an error value SYNOPSIS - strerror([errnum]) + strerror([errnum | "E_STRING"]) TYPES errnum integer + E_STRING string return string @@ -78,6 +79,8 @@ EXAMPLE LIMITS 0 <= errnum <= 32767 + E_STRING is C string matching the regular expression: "^E_[A-Z0-9_]+$" + LINK LIBRARY int calc_errno; /* global calc_errno value */ CONST char *error_table[E__COUNT+2]; /* calc coded error messages */ diff --git a/matfunc.c b/matfunc.c index 953df17..b5a9dd5 100644 --- a/matfunc.c +++ b/matfunc.c @@ -31,7 +31,7 @@ #include "alloc.h" #include "value.h" #include "zrand.h" -#include "calcerr.h" +#include "errsym.h" #include "have_unused.h" diff --git a/trailblank b/trailblank index f79310a..3a77934 100755 --- a/trailblank +++ b/trailblank @@ -47,11 +47,10 @@ LEADING_SPACES_BEFORE_TAB=$( -name '*.orig' -o -name '*.rej' -o -name '*.bak' -o \ -name '*.ptch' -o -name 'core.*' -o \ -name '*.so*' -o -name 'calc-static' -o -name 'libcalc.*' -o \ - -name 'sample_many' -o -name 'sample_rand' -o \ + -name 'sample_many' -o -name 'sample_rand' -o -name 'errcode' -o \ -path './help/funclist' -o -path './have_stdvs' -o \ -path './endian' -o -path './no_implicit' -o -name 'chk_c' -o \ -path './longbits' -o -name '.*.swp' -o -name 'conf.h' -o \ - -path './help/errorcodes.sed' -o -path './cal/set8700.line' -o \ -name '.git' -o -path './custom/libcustcalc*' -o -path './libcustcalc*' -o \ -name 'sample_many-static' -o -name 'sample_rand-static' -o \ -name 'codeql-analysis.yml' -o -name tags -o -name debug.out \ @@ -79,11 +78,10 @@ TRAILING_WHITESPACE=$( -name '*.orig' -o -name '*.rej' -o -name '*.bak' -o \ -name '*.ptch' -o -name 'core.*' -o \ -name '*.so*' -o -name 'calc-static' -o -name 'libcalc.*' -o \ - -name 'sample_many' -o -name 'sample_rand' -o \ + -name 'sample_many' -o -name 'sample_rand' -o -name 'errcode' -o \ -path './help/funclist' -o -path './have_stdvs' -o \ -path './endian' -o -path './no_implicit' -o -name 'chk_c' -o \ -path './longbits' -o -name '.*.swp' -o -name 'conf.h' -o \ - -path './help/errorcodes.sed' -o -path './cal/set8700.line' -o \ -name '.git' -o -path './custom/libcustcalc*' -o -path './libcustcalc*' -o \ -name 'sample_many-static' -o -name 'sample_rand-static' -o \ -name 'codeql-analysis.yml' -o -name tags -o -name debug.out \ @@ -102,7 +100,7 @@ fi # Some of these files must have long lines. Some of these files may not exist. # if [[ -x /usr/local/bin/picky ]]; then - PICKY_PHASE_0A=$(/usr/local/bin/picky -w -s -v ./help/errorcodes.sed ./cal/set8700.line \ + PICKY_PHASE_0A=$(/usr/local/bin/picky -w -s -v ./cal/set8700.line \ .gitignore README.md .lldbinit 2>&1) status="$?" if [[ $status -ne 0 ]]; then @@ -121,12 +119,12 @@ if [[ -x /usr/local/bin/picky ]]; then EXIT_CODE=4 fi fi - if [[ -e calcerr.h ]]; then - PICKY_PHASE_0C=$(/usr/local/bin/picky -w -s -v calcerr.h 2>&1) + if [[ -e errsym.h ]]; then + PICKY_PHASE_0C=$(/usr/local/bin/picky -w -s -v errsym.h 2>&1) status="$?" if [[ $status -ne 0 ]]; then echo - echo '# picky failed on calcerr.h' + echo '# picky failed on errsym.h' echo "$PICKY_PHASE_0C" | sed -e 's/\.\///' EXIT_CODE=5 fi @@ -150,16 +148,13 @@ PICKY_PHASE_1=$( -name '*.orig' -o -name '*.rej' -o -name '*.bak' -o \ -name '*.ptch' -o -name 'core.*' -o \ -name '*.so*' -o -name 'calc-static' -o -name 'libcalc.*' -o \ - -name 'sample_many' -o -name 'sample_rand' -o \ + -name 'sample_many' -o -name 'sample_rand' -o -name 'errcode' -o \ -path './help/funclist' -o -path './have_stdvs' -o \ -path './endian' -o -path './no_implicit' -o -name 'chk_c' -o \ -path './longbits' -o -name '.*.swp' -o -name 'conf.h' -o \ - -path './help/errorcodes.sed' -o -path './cal/set8700.line' -o \ -name '.git' -o -path './custom/libcustcalc*' -o -path './libcustcalc*' -o \ -name 'sample_many-static' -o -name 'sample_rand-static' -o \ - -name 'codeql-analysis.yml' -o -name tags -o -name debug.out \ - -o \ - -path './help/errorcodes.sed' -o -path './help/errorcodes.sed' -o \ + -name 'codeql-analysis.yml' -o -name tags -o -name debug.out -o \ -name '.gitignore' -o -name 'README.md' -o -name '.lldbinit' \ \) -prune -o -type f -print0 | \ if [[ -x /usr/local/bin/picky ]]; then diff --git a/value.h b/value.h index a10c608..7d9cc8f 100644 --- a/value.h +++ b/value.h @@ -33,7 +33,7 @@ # include "cmath.h" # include "config.h" # include "sha1.h" -# include "calcerr.h" +# include "errsym.h" # include "hash.h" # include "block.h" # include "nametype.h" @@ -43,7 +43,7 @@ # include # include # include -# include +# include # include # include # include