diff --git a/.gitignore b/.gitignore index c147e78..37e18f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,25 @@ +# common excluded patterns +# +*~ +*.BAK +core* +.DS_Store +*.dSYM/ +*.[oa] +.*.swp +*,v + # files and directories created during the building of calc and other Makefile actions # # NOTE: While many of these might be part of a released calc tarball, they are # not consider development source. Some other file(s) and/or programs # generate these files. +# We sort this list via: sort -u -f # .dynamic .hsrc .static +align32 align32.h args.h cal/.all @@ -18,8 +31,10 @@ calc.usage calcerr.c calcerr.h charbit.h +chatbit chk_c conf.h +const_tmp cscript/.all cscript/4dsphere cscript/fproduct @@ -35,42 +50,65 @@ custom/libcustcalc* debug.out endian endian_calc.h +fposval fposval.h +have_arc4random have_arc4random.h +have_ban_pragma have_ban_pragma.h +have_const have_const.h +have_environ have_environ.h have_fgetsetpos.h +have_fpos +have_fpos_pos have_fpos_pos.h +have_getpgid have_getpgid.h +have_getprid have_getprid.h have_getsid.h +have_gettime have_gettime.h have_inttypes.h have_limits.h +have_memmv have_memmv.h +have_newstr have_newstr.h +have_offscl have_offscl.h +have_posscl have_posscl.h +have_rusage have_rusage.h +have_statfs have_statfs.h have_stdbool.h have_stdint.h have_stdlib.h have_stdvs +have_strdup have_strdup.h have_string.h +have_strlcat have_strlcat.h +have_strlcpy have_strlcpy.h have_sys_mount.h have_sys_param.h have_sys_vfs.h have_times.h +have_uid_t have_uid_t.h have_unistd.h +have_unused have_unused.h have_urandom.h +have_ustat have_ustat.h +have_varvs help/.all help/binding help/bindings @@ -115,14 +153,3 @@ tags terminal.h ver_calc win32/ - -# other commonly excluded patterns -# -*~ -*.BAK -core* -.DS_Store -*.dSYM/ -*.[oa] -.*.swp -*,v diff --git a/CHANGES b/CHANGES index 350b129..dadc6a3 100644 --- a/CHANGES +++ b/CHANGES @@ -21,9 +21,6 @@ The following are the changes from calc version 2.14.3.5 to date: of a pointer) to longbits.h. Moved calc version definition from version.c to version.h. - Added CALC2_COMPAT, that when defined attempts to maintain calc - version 2 compatibility. When MAJOR_VER <= 2, CALC2_COMPAT is - defined. This is anticipation for a future calc version 3 code. Sorted the order of symbols printed by "make env". @@ -36,9 +33,6 @@ The following are the changes from calc version 2.14.3.5 to date: file defines TRUE as true, FALSE as false, and BOOL as bool: for backward compatibility. - The sign in a ZVALUE is now of type SIGN, whcih is either - SB32 when CALC2_COMPAT is defined, or a bool. - Replaced in C source, TRUE with true, FALSE with false, and BOOL with bool. @@ -84,6 +78,14 @@ The following are the changes from calc version 2.14.3.5 to date: power of 2, log2(x) will return an integer, otherwise it will return the equivalent of ln(x)/ln(2). + Removed CALC2_COMPAT in favor of ckecking if MAJOR_VER < 3. + + The sign element in a ZVALUE is now of type SIGN, which is either + SB32 when MAJOR_VER < 3, or a bool otherwise. + + The len element in a ZVALUE is of type LEN. LEN type is SB32 when + MAJOR_VER < 3, or a uintptr_t otherwise. + The following are the changes from calc version 2.14.3.4 to 2.14.3.5: diff --git a/README.RELEASE b/README.RELEASE index fea1ab3..199fc5b 100644 --- a/README.RELEASE +++ b/README.RELEASE @@ -16,10 +16,6 @@ The top version level (e.g., 2) refers to the internal representation of values. Any library or hardware linked/built for calc 2 will be able to use values from other 2.x.y.z versions. -When top version level is 2, the symbol "CALC2_COMPAT" is defined -by "version.h". See "version.h" for constants used to define the -calc version. - The top 2 levels (e.g., 2.14) refers to a specific compatible set of builtin functions. Calc interpreted code (such as calc resource files) written for, say calc 2.14, will be able to use the same set of builtin @@ -37,6 +33,14 @@ version change), nor were there new calc builtins introduced in such a top 3 level release. +The file, "version.h" defines the 4 version levels: + + MAJOR_VER /* level 1: major library version */ + MINOR_VER /* level 2: minor library version */ + MAJOR_PATCH /* level 3: major software version level */ + MINOR_PATCH /* level 4: minor software version level */ + + The program "ver_calc" will print information about the compiled calc version as defined "version.h" when "ver_calc" was compiled: diff --git a/longbits.c b/longbits.c index 020d310..f41cf45 100644 --- a/longbits.c +++ b/longbits.c @@ -156,8 +156,12 @@ main(int argc, char **argv) * We use "void *" as the size of a generic pointer. */ printf("#undef PTR_LEN\n"); +#if MAJOR_VER < 3 printf("#define PTR_LEN %ld\t\t/%s/\n", (long int)sizeof(void *), "* length of a pointer *"); +#else /* MAJOR_VER < 3 */ + printf("#define PTR_LEN UINTPTR_WIDTH\t\t/%s/\n", "* length of a pointer *"); +#endif /* MAJOR_VER < 3 */ printf("#undef PTR_BITS\n"); printf("#define PTR_BITS %ld\t\t/%s/\n", (long int)sizeof(void *)*CALC_CHARBIT, "* bit length of a pointer *"); diff --git a/version.h b/version.h index e2f6edd..8d4aab2 100644 --- a/version.h +++ b/version.h @@ -33,7 +33,6 @@ * MAJOR_VER * * The MAJOR_VER is 2 is the classical version of calc. - * By default, MAJOR_VER == 2 also defines CALC2_COMPAT. * * One of the main reasons why MAJOR_VER might incremented is * if fundamental calc data objects (such as when ZVALUE or NUMBER @@ -62,19 +61,10 @@ * Moreover, when we are working towards a new production release, * bug fix and improvement updates will cause MINOR_PATCH to increment. */ -#define MAJOR_VER 2 /* major library version */ -#define MINOR_VER 14 /* minor library version */ -#define MAJOR_PATCH 3 /* major software version level */ -#define MINOR_PATCH 5 /* minor software version level */ - -/* - * calc version 2 compatibility - * - * Set MAJOR_VER <= 2 OR define CALC2_COMPAT. - */ -#if MAJOR_VER <= 2 -#define CALC2_COMPAT /* enable calc version 2 compatibility */ -#endif +#define MAJOR_VER 2 /* level 1: major library version */ +#define MINOR_VER 14 /* level 2: minor library version */ +#define MAJOR_PATCH 3 /* level 3: major software version level */ +#define MINOR_PATCH 5 /* level 4: minor software version level */ #endif /* !INCLUDE_VERSION_H*/ diff --git a/zmath.h b/zmath.h index f6ab11c..c4db6ab 100644 --- a/zmath.h +++ b/zmath.h @@ -167,15 +167,11 @@ typedef SB32 FLAG; /* small value (e.g. comparison) */ /* * length of internal integer values in units of HALF */ -#if defined(CALC2_COMPAT) +#if MAJOR_VER < 3 typedef SB32 LEN; /* calc v2 compatible unit of length storage */ -#elif PTR_LEN >= 8 -typedef SB64 LEN; /* use unit of length storage for 8 or more octet pointers */ -#elif PTR_LEN == 4 -typedef SB32 LEN; /* use unit of length storage for 4 octet pointers */ -#else -typedef SB32 LEN; /* else assume we can support at least 4 octet pointers */ -#endif +#else /* MAJOR_VER < 3 */ +typedef uintptr_t LEN; /* unit of length storage */ +#endif /* MAJOR_VER < 3 */ #define SWAP_B32_IN_HASH(dest, src) (*(dest) = *(src)) #define SWAP_B16_IN_HASH(dest, src) SWAP_B16_IN_B32(dest, src) @@ -251,15 +247,11 @@ typedef SB32 LEN; /* else assume we can support at least 4 octet pointers */ * We limit to 1/16 because for a maximum complex value we * will need 4 huge integers, plus other data, code and stack space. */ -#if defined(CALC2_COMPAT) +#if MAJOR_VER < 3 #define MAXDATA (0x80000000>>3) /* calc v2 compatible supported address space */ -#elif PTR_LEN >= 8 -#define MAXDATA ((LEN) 1<<(64-4)) /* 1/16 of a 64-bit address space */ -#elif PTR_LEN >= 4 && PTR_LEN < 8 -#define MAXDATA ((LEN) 1<<(32-4)) /* 1/16 of a 32-bit address space */ -#else - /\oo/\ unsupproted PTR_LEN /\oo/\ !! /* firewall - reject PTR_LEN as unsupported */ -#endif +#else /* MAJOR_VER < 3 */ +#define MAXDATA ((LEN) 1<<(UINTPTR_WIDTH-4)) /* 1/16 of address space */ +#endif /* MAJOR_VER < 3 */ /* * MAXLEN - maximum length of internal integer values in units of HALF @@ -312,11 +304,11 @@ typedef union { /* * ZVALUE - multi-prevision integer */ -#if defined(CALC2_COMPAT) +#if MAJOR_VER < 3 typedef SB32 SIGN; /* calc v2 compatible sign type */ -#else /* CALC2_COMPAT */ +#else /* MAJOR_VER < 3 */ typedef bool SIGN; /* sign as a C boolean */ -#endif /* CALC2_COMPAT */ +#endif /* MAJOR_VER < 3 */ typedef struct { HALF *v; /* pointer to array of values */ LEN len; /* number of values in array */ @@ -645,12 +637,7 @@ E_FUNC void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res); #define MODE_MAX 9 #define MODE2_OFF (MODE_MAX+1) -/* XXX - perhaps we need the MODE_REAL_AUTO vs MODE_REAL as a config mode? */ -#if 0 /* XXX - can we safely set MODE_INITIAL to MODE_REAL_AUTO ?? */ -#define MODE_INITIAL MODE_REAL_AUTO -#else #define MODE_INITIAL MODE_REAL -#endif #define MODE2_INITIAL MODE2_OFF