diff --git a/CHANGES b/CHANGES index 9db6fb2..b0f91b5 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,23 @@ -The following are the changes from calc version 2.12.1.8 to date: +The following are the changes from calc version 2.12.1.10 to date: + + Put back the missing -s flags on the cscripts: mersenne, 4dsphere, + fprodcut, plus, and powerterm. Thanks goes to Bradley Reed + for discovering this problem. + + All static variables are now declared with the symbol STATIC. + All extern variables are now declared with the symbol EXTERN. + All static functions are now declared with the symbol S_FUNC. + All extern functions are now declared with the symbol E_FUNC. + The include file decl.h defines these 4 symbols by default + to static, extern, static, and extern respectively. Under + Windoz, DLL is also defined accorind to the _EXPORTING symbol + and is prepended to the EXTERN and E_FUNC symbols. The decl.h + file has replaced the win32dll.h file. + + Added Apple Mac OS X compiler set in the Makefile. + + +The following are the changes from calc version 2.12.1.8 to 2.12.1.9: Fixed calc cscripts that contained comments that were not valid calc comments. Improved calc comment documentation in "help unexpected" @@ -6339,8 +6358,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1: ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.96 $ -## @(#) $Id: CHANGES,v 29.96 2007/02/08 21:22:43 chongo Exp $ +## @(#) $Revision: 29.97 $ +## @(#) $Id: CHANGES,v 29.97 2007/02/11 10:25:01 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## ## Under source code control: 1993/06/02 18:12:57 diff --git a/COPYING b/COPYING index 56f9e97..9da615d 100644 --- a/COPYING +++ b/COPYING @@ -12,8 +12,8 @@ This file is Copyrighted Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - # @(#) $Revision: 29.8 $ - # @(#) $Id: COPYING,v 29.8 2006/05/01 19:16:57 chongo Exp $ + # @(#) $Revision: 29.9 $ + # @(#) $Id: COPYING,v 29.9 2007/02/11 10:16:31 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $ =-= @@ -182,9 +182,11 @@ Calc copyrights and exception files top of this file. It is important to note that you may distribute verbatim copies of this file but you may not modify this file. - Some of these exception files are in the public domain. Other - exception files have non-LGPL Copyrights. Other files are under a - LGPL Copyright but have different authors. + Some of these exception files are in the public domain. The md5.c + and md5.h files were "derived from the RSA Data Security, Inc. MD5 + Message-Digest Algorithm" and are under a copyright that allows these + two files to be freely used and distributed. Other files are under + the LGPL but have different authors that those listed above. In all cases one may use and distribute these exception files freely. And because one may freely distribute the LGPL covered files, the diff --git a/Makefile b/Makefile index 369e20a..fe4b217 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # USE_READLINE= -DUSE_READLINE # READLINE_LIB= -lreadline -lhistory -lncurses # -# Copyright (C) 1999-2006 Landon Curt Noll +# Copyright (C) 1999-2007 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 @@ -32,8 +32,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -MAKEFILE_REV= $$Revision: 29.86 $$ -# @(#) $Id: Makefile.ship,v 29.86 2007/02/08 21:21:53 chongo Exp $ +MAKEFILE_REV= $$Revision: 29.88 $$ +# @(#) $Id: Makefile.ship,v 29.88 2007/02/11 10:32:26 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # # Under source code control: 1990/02/15 01:48:41 @@ -819,7 +819,7 @@ CALCPAGER= less # Debug/Optimize options for ${CC} and ${LCC} # -# Select DEBUG= -O2 -gstabs+ for DJGPP. +# Select DEBUG= -O2 -gstabs+ -DWINDOZ for DJGPP. # #DEBUG= # @@ -850,7 +850,7 @@ DEBUG= -O3 -g3 #DEBUG= -gx #DEBUG= -WM,-g # -#DEBUG= -O2 -gstabs+ +#DEBUG= -O2 -gstabs+ -DWINDOZ # On systems that have dynamic shared link libs, you may want want to disable # them for faster calc startup. @@ -1006,8 +1006,6 @@ EXT= # # Linux set # -# Tested on Red Hat 6.0 Linux but should run on almost any Linux release. -# CCWARN= -Wall -W -Wno-comment CCWERR= CCOPT= ${DEBUG} ${NO_SHARED} @@ -1024,6 +1022,24 @@ CC= ${PURIFY} ${LCC} ${CCWERR} # ### # +# Apple Mac OS X +# +#CCWARN= -Wall -W -Wno-comment +#CCWERR= +#CCOPT= ${DEBUG} ${NO_SHARED} +#CCMISC= -arch i386 -arch ppc +# +#CFLAGS= -DCALC_SRC ${CCWARN} ${CCOPT} ${CCMISC} +#ICFLAGS= -DCALC_SRC ${CCWARN} ${CCMISC} +# +#LDFLAGS= ${NO_SHARED} ${LD_NO_SHARED} -arch i386 -arch ppc +#ILDFLAGS= +# +#LCC= gcc +#CC= ${PURIFY} ${LCC} ${CCWERR} +# +### +# # gcc set # #CCWARN= -Wall -W -Wno-comment @@ -1270,10 +1286,10 @@ CALCOBJS= calc.o # these .h files are needed by programs that use libcalc.a # LIB_H_SRC= alloc.h blkcpy.h block.h byteswap.h calc.h cmath.h \ - config.h custom.h file.h func.h hash.h hist.h jump.h \ + config.h custom.h decl.h file.h func.h hash.h hist.h jump.h \ label.h lib_util.h math_error.h md5.h nametype.h \ opcodes.h prime.h qmath.h shs.h shs1.h string.h \ - symbol.h token.h value.h win32dll.h zmath.h zrand.h zrandom.h + symbol.h token.h value.h zmath.h zrand.h zrandom.h # we build these .h files during the make # @@ -1585,7 +1601,7 @@ TARGETS= ${LICENSE} ${CALC_LIBS} custom/.all calc${EXT} sample/.all \ # ### -all: .hsrc ${TARGETS} +all: .hsrc ${TARGETS} CHANGES calc${EXT}: .hsrc ${CALC_LIBS} ${CALCOBJS} ${RM} -f $@ @@ -2969,6 +2985,8 @@ have_unused.h: have_unused.c ${MAKE_FILE} ${CAT} unused_tmp >> have_unused.h; \ else \ echo '#undef HAVE_UNUSED /* no */' >> have_unused.h; \ + echo '#undef UNUSED' >> have_unused.h; \ + echo '#define UNUSED /* no */' >> have_unused.h; \ fi ${Q} echo '' >> have_unused.h ${Q} echo '' >> have_unused.h @@ -3574,7 +3592,7 @@ clean: ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${Q} echo remove files that are obsolete -${RM} -rf lib - -${RM} -f endian.h stdarg.h libcalcerr.a cal/obj help/obj + -${RM} -f endian.h stdarg.h libcalcerr.a cal/obj help/obj win32dll.h -${RM} -f have_vs.c std_arg.h try_stdarg.c fnvhash.c ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' @@ -3612,7 +3630,7 @@ clobber: ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo remove files that are obsolete -${RM} -rf lib - -${RM} -f endian.h stdarg.h libcalcerr.a cal/obj help/obj + -${RM} -f endian.h stdarg.h libcalcerr.a cal/obj help/obj win32dll.h -${RM} -f have_vs.c std_arg.h try_stdarg.c fnvhash.c calc.spec -${RM} -rf win32 ${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-=' @@ -3740,7 +3758,7 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 else \ ${RM} -f ${T}${BINDIR}/calc.new${EXT}; \ ${CP} -f calc${EXT} ${T}${BINDIR}/calc.new${EXT}; \ - ${CHMOD} 0755 ${T}${BINDIR}/calc.new${EXT}; \ + ${CHMOD} 0555 ${T}${BINDIR}/calc.new${EXT}; \ ${MV} -f ${T}${BINDIR}/calc.new${EXT} ${T}${BINDIR}/calc${EXT}; \ echo "installed ${T}${BINDIR}/calc${EXT}"; \ fi @@ -3934,6 +3952,7 @@ addop.o: calc.h addop.o: calcerr.h addop.o: cmath.h addop.o: config.h +addop.o: decl.h addop.o: endian_calc.h addop.o: func.h addop.o: hash.h @@ -3955,7 +3974,6 @@ addop.o: string.h addop.o: symbol.h addop.o: token.h addop.o: value.h -addop.o: win32dll.h addop.o: zmath.h align32.o: align32.c align32.o: have_unistd.h @@ -3967,8 +3985,10 @@ assocfunc.o: byteswap.h assocfunc.o: calcerr.h assocfunc.o: cmath.h assocfunc.o: config.h +assocfunc.o: decl.h assocfunc.o: endian_calc.h assocfunc.o: hash.h +assocfunc.o: have_const.h assocfunc.o: have_malloc.h assocfunc.o: have_memmv.h assocfunc.o: have_newstr.h @@ -3982,7 +4002,6 @@ assocfunc.o: shs.h assocfunc.o: shs1.h assocfunc.o: string.h assocfunc.o: value.h -assocfunc.o: win32dll.h assocfunc.o: zmath.h blkcpy.o: alloc.h blkcpy.o: blkcpy.c @@ -3993,6 +4012,7 @@ blkcpy.o: calc.h blkcpy.o: calcerr.h blkcpy.o: cmath.h blkcpy.o: config.h +blkcpy.o: decl.h blkcpy.o: endian_calc.h blkcpy.o: file.h blkcpy.o: hash.h @@ -4011,7 +4031,6 @@ blkcpy.o: shs.h blkcpy.o: shs1.h blkcpy.o: string.h blkcpy.o: value.h -blkcpy.o: win32dll.h blkcpy.o: zmath.h block.o: alloc.h block.o: block.c @@ -4020,8 +4039,10 @@ block.o: byteswap.h block.o: calcerr.h block.o: cmath.h block.o: config.h +block.o: decl.h block.o: endian_calc.h block.o: hash.h +block.o: have_const.h block.o: have_malloc.h block.o: have_memmv.h block.o: have_newstr.h @@ -4035,13 +4056,14 @@ block.o: shs.h block.o: shs1.h block.o: string.h block.o: value.h -block.o: win32dll.h block.o: zmath.h byteswap.o: alloc.h byteswap.o: byteswap.c byteswap.o: byteswap.h byteswap.o: cmath.h +byteswap.o: decl.h byteswap.o: endian_calc.h +byteswap.o: have_const.h byteswap.o: have_malloc.h byteswap.o: have_memmv.h byteswap.o: have_newstr.h @@ -4049,7 +4071,6 @@ byteswap.o: have_stdlib.h byteswap.o: have_string.h byteswap.o: longbits.h byteswap.o: qmath.h -byteswap.o: win32dll.h byteswap.o: zmath.h calc.o: alloc.h calc.o: args.h @@ -4062,6 +4083,7 @@ calc.o: cmath.h calc.o: conf.h calc.o: config.h calc.o: custom.h +calc.o: decl.h calc.o: endian_calc.h calc.o: func.h calc.o: hash.h @@ -4089,7 +4111,6 @@ calc.o: string.h calc.o: symbol.h calc.o: token.h calc.o: value.h -calc.o: win32dll.h calc.o: zmath.h calcerr.o: calcerr.c calcerr.o: calcerr.h @@ -4103,6 +4124,7 @@ codegen.o: cmath.h codegen.o: codegen.c codegen.o: conf.h codegen.o: config.h +codegen.o: decl.h codegen.o: endian_calc.h codegen.o: func.h codegen.o: hash.h @@ -4125,14 +4147,15 @@ codegen.o: string.h codegen.o: symbol.h codegen.o: token.h codegen.o: value.h -codegen.o: win32dll.h codegen.o: zmath.h comfunc.o: alloc.h comfunc.o: byteswap.h comfunc.o: cmath.h comfunc.o: comfunc.c comfunc.o: config.h +comfunc.o: decl.h comfunc.o: endian_calc.h +comfunc.o: have_const.h comfunc.o: have_malloc.h comfunc.o: have_memmv.h comfunc.o: have_newstr.h @@ -4141,13 +4164,14 @@ comfunc.o: have_string.h comfunc.o: longbits.h comfunc.o: nametype.h comfunc.o: qmath.h -comfunc.o: win32dll.h comfunc.o: zmath.h commath.o: alloc.h commath.o: byteswap.h commath.o: cmath.h commath.o: commath.c +commath.o: decl.h commath.o: endian_calc.h +commath.o: have_const.h commath.o: have_malloc.h commath.o: have_memmv.h commath.o: have_newstr.h @@ -4155,7 +4179,6 @@ commath.o: have_stdlib.h commath.o: have_string.h commath.o: longbits.h commath.o: qmath.h -commath.o: win32dll.h commath.o: zmath.h config.o: alloc.h config.o: block.h @@ -4166,6 +4189,7 @@ config.o: cmath.h config.o: config.c config.o: config.h config.o: custom.h +config.o: decl.h config.o: endian_calc.h config.o: hash.h config.o: have_const.h @@ -4185,7 +4209,6 @@ config.o: shs1.h config.o: string.h config.o: token.h config.o: value.h -config.o: win32dll.h config.o: zmath.h config.o: zrand.h const.o: alloc.h @@ -4196,6 +4219,7 @@ const.o: calcerr.h const.o: cmath.h const.o: config.h const.o: const.c +const.o: decl.h const.o: endian_calc.h const.o: hash.h const.o: have_const.h @@ -4212,7 +4236,6 @@ const.o: shs.h const.o: shs1.h const.o: string.h const.o: value.h -const.o: win32dll.h const.o: zmath.h custom.o: alloc.h custom.o: block.h @@ -4223,6 +4246,7 @@ custom.o: cmath.h custom.o: config.h custom.o: custom.c custom.o: custom.h +custom.o: decl.h custom.o: endian_calc.h custom.o: hash.h custom.o: have_const.h @@ -4239,7 +4263,6 @@ custom.o: shs.h custom.o: shs1.h custom.o: string.h custom.o: value.h -custom.o: win32dll.h custom.o: zmath.h endian.o: endian.c endian.o: have_stdlib.h @@ -4251,6 +4274,7 @@ file.o: calc.h file.o: calcerr.h file.o: cmath.h file.o: config.h +file.o: decl.h file.o: endian_calc.h file.o: file.c file.o: file.h @@ -4273,7 +4297,6 @@ file.o: shs.h file.o: shs1.h file.o: string.h file.o: value.h -file.o: win32dll.h file.o: zmath.h fposval.o: endian_calc.h fposval.o: fposval.c @@ -4289,6 +4312,7 @@ func.o: calcerr.h func.o: cmath.h func.o: config.h func.o: custom.h +func.o: decl.h func.o: endian_calc.h func.o: file.h func.o: func.c @@ -4319,7 +4343,6 @@ func.o: string.h func.o: symbol.h func.o: token.h func.o: value.h -func.o: win32dll.h func.o: zmath.h func.o: zrand.h func.o: zrandom.h @@ -4330,6 +4353,7 @@ hash.o: calc.h hash.o: calcerr.h hash.o: cmath.h hash.o: config.h +hash.o: decl.h hash.o: endian_calc.h hash.o: hash.c hash.o: hash.h @@ -4347,7 +4371,6 @@ hash.o: shs.h hash.o: shs1.h hash.o: string.h hash.o: value.h -hash.o: win32dll.h hash.o: zmath.h hash.o: zrand.h hash.o: zrandom.h @@ -4385,6 +4408,7 @@ help.o: calcerr.h help.o: cmath.h help.o: conf.h help.o: config.h +help.o: decl.h help.o: endian_calc.h help.o: hash.h help.o: have_const.h @@ -4403,7 +4427,6 @@ help.o: shs.h help.o: shs1.h help.o: string.h help.o: value.h -help.o: win32dll.h help.o: zmath.h hist.o: alloc.h hist.o: block.h @@ -4412,6 +4435,7 @@ hist.o: calc.h hist.o: calcerr.h hist.o: cmath.h hist.o: config.h +hist.o: decl.h hist.o: endian_calc.h hist.o: hash.h hist.o: have_const.h @@ -4433,7 +4457,6 @@ hist.o: shs.h hist.o: shs1.h hist.o: string.h hist.o: value.h -hist.o: win32dll.h hist.o: zmath.h input.o: alloc.h input.o: block.h @@ -4443,6 +4466,7 @@ input.o: calcerr.h input.o: cmath.h input.o: conf.h input.o: config.h +input.o: decl.h input.o: endian_calc.h input.o: hash.h input.o: have_const.h @@ -4462,8 +4486,8 @@ input.o: shs.h input.o: shs1.h input.o: string.h input.o: value.h -input.o: win32dll.h input.o: zmath.h +jump.o: decl.h jump.o: have_const.h jump.o: jump.c jump.o: jump.h @@ -4474,6 +4498,7 @@ label.o: calc.h label.o: calcerr.h label.o: cmath.h label.o: config.h +label.o: decl.h label.o: endian_calc.h label.o: func.h label.o: hash.h @@ -4495,7 +4520,6 @@ label.o: shs1.h label.o: string.h label.o: token.h label.o: value.h -label.o: win32dll.h label.o: zmath.h lib_calc.o: alloc.h lib_calc.o: block.h @@ -4505,6 +4529,7 @@ lib_calc.o: calcerr.h lib_calc.o: cmath.h lib_calc.o: conf.h lib_calc.o: config.h +lib_calc.o: decl.h lib_calc.o: endian_calc.h lib_calc.o: func.h lib_calc.o: hash.h @@ -4529,12 +4554,13 @@ lib_calc.o: symbol.h lib_calc.o: terminal.h lib_calc.o: token.h lib_calc.o: value.h -lib_calc.o: win32dll.h lib_calc.o: zmath.h lib_calc.o: zrandom.h lib_util.o: alloc.h lib_util.o: byteswap.h +lib_util.o: decl.h lib_util.o: endian_calc.h +lib_util.o: have_const.h lib_util.o: have_malloc.h lib_util.o: have_memmv.h lib_util.o: have_newstr.h @@ -4543,7 +4569,6 @@ lib_util.o: have_string.h lib_util.o: lib_util.c lib_util.o: lib_util.h lib_util.o: longbits.h -lib_util.o: win32dll.h lib_util.o: zmath.h listfunc.o: alloc.h listfunc.o: block.h @@ -4551,6 +4576,7 @@ listfunc.o: byteswap.h listfunc.o: calcerr.h listfunc.o: cmath.h listfunc.o: config.h +listfunc.o: decl.h listfunc.o: endian_calc.h listfunc.o: hash.h listfunc.o: have_const.h @@ -4568,7 +4594,6 @@ listfunc.o: shs.h listfunc.o: shs1.h listfunc.o: string.h listfunc.o: value.h -listfunc.o: win32dll.h listfunc.o: zmath.h listfunc.o: zrand.h longbits.o: have_stdlib.h @@ -4580,6 +4605,7 @@ matfunc.o: byteswap.h matfunc.o: calcerr.h matfunc.o: cmath.h matfunc.o: config.h +matfunc.o: decl.h matfunc.o: endian_calc.h matfunc.o: hash.h matfunc.o: have_const.h @@ -4598,7 +4624,6 @@ matfunc.o: shs.h matfunc.o: shs1.h matfunc.o: string.h matfunc.o: value.h -matfunc.o: win32dll.h matfunc.o: zmath.h matfunc.o: zrand.h math_error.o: alloc.h @@ -4609,6 +4634,7 @@ math_error.o: calc.h math_error.o: calcerr.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: hash.h math_error.o: have_const.h @@ -4627,7 +4653,6 @@ math_error.o: shs.h math_error.o: shs1.h math_error.o: string.h math_error.o: value.h -math_error.o: win32dll.h math_error.o: zmath.h md5.o: align32.h md5.o: alloc.h @@ -4636,8 +4661,10 @@ md5.o: byteswap.h md5.o: calcerr.h md5.o: cmath.h md5.o: config.h +md5.o: decl.h md5.o: endian_calc.h md5.o: hash.h +md5.o: have_const.h md5.o: have_malloc.h md5.o: have_memmv.h md5.o: have_newstr.h @@ -4652,7 +4679,6 @@ md5.o: shs.h md5.o: shs1.h md5.o: string.h md5.o: value.h -md5.o: win32dll.h md5.o: zmath.h no_implicit.o: no_implicit.c obj.o: alloc.h @@ -4662,6 +4688,7 @@ obj.o: calc.h obj.o: calcerr.h obj.o: cmath.h obj.o: config.h +obj.o: decl.h obj.o: endian_calc.h obj.o: func.h obj.o: hash.h @@ -4683,7 +4710,6 @@ obj.o: shs1.h obj.o: string.h obj.o: symbol.h obj.o: value.h -obj.o: win32dll.h obj.o: zmath.h opcodes.o: alloc.h opcodes.o: block.h @@ -4693,6 +4719,7 @@ opcodes.o: calcerr.h opcodes.o: cmath.h opcodes.o: config.h opcodes.o: custom.h +opcodes.o: decl.h opcodes.o: endian_calc.h opcodes.o: file.h opcodes.o: func.h @@ -4719,12 +4746,12 @@ opcodes.o: shs1.h opcodes.o: string.h opcodes.o: symbol.h opcodes.o: value.h -opcodes.o: win32dll.h opcodes.o: zmath.h opcodes.o: zrand.h opcodes.o: zrandom.h pix.o: alloc.h pix.o: byteswap.h +pix.o: decl.h pix.o: endian_calc.h pix.o: have_const.h pix.o: have_malloc.h @@ -4736,7 +4763,6 @@ pix.o: longbits.h pix.o: pix.c pix.o: prime.h pix.o: qmath.h -pix.o: win32dll.h pix.o: zmath.h poly.o: alloc.h poly.o: block.h @@ -4744,8 +4770,10 @@ poly.o: byteswap.h poly.o: calcerr.h poly.o: cmath.h poly.o: config.h +poly.o: decl.h poly.o: endian_calc.h poly.o: hash.h +poly.o: have_const.h poly.o: have_malloc.h poly.o: have_memmv.h poly.o: have_newstr.h @@ -4760,10 +4788,10 @@ poly.o: shs.h poly.o: shs1.h poly.o: string.h poly.o: value.h -poly.o: win32dll.h poly.o: zmath.h prime.o: alloc.h prime.o: byteswap.h +prime.o: decl.h prime.o: endian_calc.h prime.o: have_const.h prime.o: have_malloc.h @@ -4776,11 +4804,11 @@ prime.o: longbits.h prime.o: prime.c prime.o: prime.h prime.o: qmath.h -prime.o: win32dll.h prime.o: zmath.h qfunc.o: alloc.h qfunc.o: byteswap.h qfunc.o: config.h +qfunc.o: decl.h qfunc.o: endian_calc.h qfunc.o: have_const.h qfunc.o: have_malloc.h @@ -4793,13 +4821,14 @@ qfunc.o: nametype.h qfunc.o: prime.h qfunc.o: qfunc.c qfunc.o: qmath.h -qfunc.o: win32dll.h qfunc.o: zmath.h qio.o: alloc.h qio.o: args.h qio.o: byteswap.h qio.o: config.h +qio.o: decl.h qio.o: endian_calc.h +qio.o: have_const.h qio.o: have_malloc.h qio.o: have_memmv.h qio.o: have_newstr.h @@ -4810,12 +4839,13 @@ qio.o: longbits.h qio.o: nametype.h qio.o: qio.c qio.o: qmath.h -qio.o: win32dll.h qio.o: zmath.h qmath.o: alloc.h qmath.o: byteswap.h qmath.o: config.h +qmath.o: decl.h qmath.o: endian_calc.h +qmath.o: have_const.h qmath.o: have_malloc.h qmath.o: have_memmv.h qmath.o: have_newstr.h @@ -4825,12 +4855,13 @@ qmath.o: longbits.h qmath.o: nametype.h qmath.o: qmath.c qmath.o: qmath.h -qmath.o: win32dll.h qmath.o: zmath.h qmod.o: alloc.h qmod.o: byteswap.h qmod.o: config.h +qmod.o: decl.h qmod.o: endian_calc.h +qmod.o: have_const.h qmod.o: have_malloc.h qmod.o: have_memmv.h qmod.o: have_newstr.h @@ -4840,11 +4871,12 @@ qmod.o: longbits.h qmod.o: nametype.h qmod.o: qmath.h qmod.o: qmod.c -qmod.o: win32dll.h qmod.o: zmath.h qtrans.o: alloc.h qtrans.o: byteswap.h +qtrans.o: decl.h qtrans.o: endian_calc.h +qtrans.o: have_const.h qtrans.o: have_malloc.h qtrans.o: have_memmv.h qtrans.o: have_newstr.h @@ -4853,7 +4885,6 @@ qtrans.o: have_string.h qtrans.o: longbits.h qtrans.o: qmath.h qtrans.o: qtrans.c -qtrans.o: win32dll.h qtrans.o: zmath.h quickhash.o: alloc.h quickhash.o: block.h @@ -4861,6 +4892,7 @@ quickhash.o: byteswap.h quickhash.o: calcerr.h quickhash.o: cmath.h quickhash.o: config.h +quickhash.o: decl.h quickhash.o: endian_calc.h quickhash.o: hash.h quickhash.o: have_const.h @@ -4878,13 +4910,14 @@ quickhash.o: shs.h quickhash.o: shs1.h quickhash.o: string.h quickhash.o: value.h -quickhash.o: win32dll.h quickhash.o: zmath.h quickhash.o: zrand.h quickhash.o: zrandom.h seed.o: alloc.h seed.o: byteswap.h +seed.o: decl.h seed.o: endian_calc.h +seed.o: have_const.h seed.o: have_getpgid.h seed.o: have_getprid.h seed.o: have_getsid.h @@ -4903,7 +4936,6 @@ seed.o: have_ustat.h seed.o: longbits.h seed.o: qmath.h seed.o: seed.c -seed.o: win32dll.h seed.o: zmath.h shs.o: align32.h shs.o: alloc.h @@ -4912,8 +4944,10 @@ shs.o: byteswap.h shs.o: calcerr.h shs.o: cmath.h shs.o: config.h +shs.o: decl.h shs.o: endian_calc.h shs.o: hash.h +shs.o: have_const.h shs.o: have_malloc.h shs.o: have_memmv.h shs.o: have_newstr.h @@ -4928,7 +4962,6 @@ shs.o: shs.h shs.o: shs1.h shs.o: string.h shs.o: value.h -shs.o: win32dll.h shs.o: zmath.h shs1.o: align32.h shs1.o: alloc.h @@ -4937,8 +4970,10 @@ shs1.o: byteswap.h shs1.o: calcerr.h shs1.o: cmath.h shs1.o: config.h +shs1.o: decl.h shs1.o: endian_calc.h shs1.o: hash.h +shs1.o: have_const.h shs1.o: have_malloc.h shs1.o: have_memmv.h shs1.o: have_newstr.h @@ -4953,7 +4988,6 @@ shs1.o: shs1.c shs1.o: shs1.h shs1.o: string.h shs1.o: value.h -shs1.o: win32dll.h shs1.o: zmath.h size.o: alloc.h size.o: block.h @@ -4961,6 +4995,7 @@ size.o: byteswap.h size.o: calcerr.h size.o: cmath.h size.o: config.h +size.o: decl.h size.o: endian_calc.h size.o: hash.h size.o: have_const.h @@ -4978,7 +5013,6 @@ size.o: shs1.h size.o: size.c size.o: string.h size.o: value.h -size.o: win32dll.h size.o: zmath.h size.o: zrand.h size.o: zrandom.h @@ -4989,6 +5023,7 @@ string.o: calc.h string.o: calcerr.h string.o: cmath.h string.o: config.h +string.o: decl.h string.o: endian_calc.h string.o: hash.h string.o: have_const.h @@ -5006,7 +5041,6 @@ string.o: shs1.h string.o: string.c string.o: string.h string.o: value.h -string.o: win32dll.h string.o: zmath.h symbol.o: alloc.h symbol.o: block.h @@ -5015,6 +5049,7 @@ symbol.o: calc.h symbol.o: calcerr.h symbol.o: cmath.h symbol.o: config.h +symbol.o: decl.h symbol.o: endian_calc.h symbol.o: func.h symbol.o: hash.h @@ -5037,7 +5072,6 @@ symbol.o: symbol.c symbol.o: symbol.h symbol.o: token.h symbol.o: value.h -symbol.o: win32dll.h symbol.o: zmath.h token.o: alloc.h token.o: args.h @@ -5047,6 +5081,7 @@ token.o: calc.h token.o: calcerr.h token.o: cmath.h token.o: config.h +token.o: decl.h token.o: endian_calc.h token.o: hash.h token.o: have_const.h @@ -5066,7 +5101,6 @@ token.o: string.h token.o: token.c token.o: token.h token.o: value.h -token.o: win32dll.h token.o: zmath.h value.o: alloc.h value.o: block.h @@ -5075,6 +5109,7 @@ value.o: calc.h value.o: calcerr.h value.o: cmath.h value.o: config.h +value.o: decl.h value.o: endian_calc.h value.o: file.h value.o: func.h @@ -5098,7 +5133,6 @@ value.o: string.h value.o: symbol.h value.o: value.c value.o: value.h -value.o: win32dll.h value.o: zmath.h value.o: zrand.h value.o: zrandom.h @@ -5109,6 +5143,7 @@ version.o: calc.h version.o: calcerr.h version.o: cmath.h version.o: config.h +version.o: decl.h version.o: endian_calc.h version.o: hash.h version.o: have_const.h @@ -5127,25 +5162,27 @@ version.o: shs1.h version.o: string.h version.o: value.h version.o: version.c -version.o: win32dll.h version.o: zmath.h zfunc.o: alloc.h zfunc.o: byteswap.h +zfunc.o: decl.h zfunc.o: endian_calc.h +zfunc.o: have_const.h zfunc.o: have_malloc.h zfunc.o: have_memmv.h zfunc.o: have_newstr.h zfunc.o: have_stdlib.h zfunc.o: have_string.h zfunc.o: longbits.h -zfunc.o: win32dll.h zfunc.o: zfunc.c zfunc.o: zmath.h zio.o: alloc.h zio.o: args.h zio.o: byteswap.h zio.o: config.h +zio.o: decl.h zio.o: endian_calc.h +zio.o: have_const.h zio.o: have_malloc.h zio.o: have_memmv.h zio.o: have_newstr.h @@ -5154,25 +5191,27 @@ zio.o: have_string.h zio.o: longbits.h zio.o: nametype.h zio.o: qmath.h -zio.o: win32dll.h zio.o: zio.c zio.o: zmath.h zmath.o: alloc.h zmath.o: byteswap.h +zmath.o: decl.h zmath.o: endian_calc.h +zmath.o: have_const.h zmath.o: have_malloc.h zmath.o: have_memmv.h zmath.o: have_newstr.h zmath.o: have_stdlib.h zmath.o: have_string.h zmath.o: longbits.h -zmath.o: win32dll.h zmath.o: zmath.c zmath.o: zmath.h zmod.o: alloc.h zmod.o: byteswap.h zmod.o: config.h +zmod.o: decl.h zmod.o: endian_calc.h +zmod.o: have_const.h zmod.o: have_malloc.h zmod.o: have_memmv.h zmod.o: have_newstr.h @@ -5181,13 +5220,14 @@ zmod.o: have_string.h zmod.o: longbits.h zmod.o: nametype.h zmod.o: qmath.h -zmod.o: win32dll.h zmod.o: zmath.h zmod.o: zmod.c zmul.o: alloc.h zmul.o: byteswap.h zmul.o: config.h +zmul.o: decl.h zmul.o: endian_calc.h +zmul.o: have_const.h zmul.o: have_malloc.h zmul.o: have_memmv.h zmul.o: have_newstr.h @@ -5196,7 +5236,6 @@ zmul.o: have_string.h zmul.o: longbits.h zmul.o: nametype.h zmul.o: qmath.h -zmul.o: win32dll.h zmul.o: zmath.h zmul.o: zmul.c zprime.o: alloc.h @@ -5205,6 +5244,7 @@ zprime.o: byteswap.h zprime.o: calcerr.h zprime.o: cmath.h zprime.o: config.h +zprime.o: decl.h zprime.o: endian_calc.h zprime.o: hash.h zprime.o: have_const.h @@ -5223,7 +5263,6 @@ zprime.o: shs.h zprime.o: shs1.h zprime.o: string.h zprime.o: value.h -zprime.o: win32dll.h zprime.o: zmath.h zprime.o: zprime.c zprime.o: zrand.h @@ -5233,6 +5272,7 @@ zrand.o: byteswap.h zrand.o: calcerr.h zrand.o: cmath.h zrand.o: config.h +zrand.o: decl.h zrand.o: endian_calc.h zrand.o: hash.h zrand.o: have_const.h @@ -5250,7 +5290,6 @@ zrand.o: shs.h zrand.o: shs1.h zrand.o: string.h zrand.o: value.h -zrand.o: win32dll.h zrand.o: zmath.h zrand.o: zrand.c zrand.o: zrand.h @@ -5260,6 +5299,7 @@ zrandom.o: byteswap.h zrandom.o: calcerr.h zrandom.o: cmath.h zrandom.o: config.h +zrandom.o: decl.h zrandom.o: endian_calc.h zrandom.o: hash.h zrandom.o: have_const.h @@ -5277,7 +5317,6 @@ zrandom.o: shs.h zrandom.o: shs1.h zrandom.o: string.h zrandom.o: value.h -zrandom.o: win32dll.h zrandom.o: zmath.h zrandom.o: zrandom.c zrandom.o: zrandom.h diff --git a/README.WINDOWS b/README.WINDOWS index 0c595ae..b48e90c 100644 --- a/README.WINDOWS +++ b/README.WINDOWS @@ -56,7 +56,7 @@ recommends the following settings: CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit CALCPAGER= less.exe -ci - DEBUG= -O2 -gstabs+ + DEBUG= -O2 -gstabs+ -DWINDOZ The 'Linux set' or 'gcc set' (see the Select your compiler type section) should work for DJGPP systems if you set the above Makefile variables. @@ -112,37 +112,8 @@ In particular: source directory, edit them (if needed) and build using the Cygwin GCC compiler and Cygwin build environment. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-= calc maintenance folk =-=-= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -People who maintain calc need to keep in mind the following: - -The following was added to opcodes.h, config.h, zmath.h and value.h: - - #if defined(_WIN32) - #ifdef _EXPORTING - #define DLL __declspec(dllexport) - #else - #define DLL __declspec(dllimport) - #endif - - #else /* Windoz free systems */ - - #define DLL - - #endif /* Windoz free systems */ - -Then DLL was added in front of all the exported functions. For example: - - extern int configtype(char*); - -was changed to: - - DLL extern int configtype(char*); - - -## Copyright (C) 2002 Landon Curt Noll and Thomas Jones-Low +## Copyright (C) 2002-2007 Landon Curt Noll and Thomas Jones-Low ## ## 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 @@ -158,8 +129,8 @@ was changed to: ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.12 $ -## @(#) $Id: README.WINDOWS,v 29.12 2004/07/28 12:52:01 chongo Exp $ +## @(#) $Revision: 29.13 $ +## @(#) $Id: README.WINDOWS,v 29.13 2007/02/11 10:23:28 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $ ## ## Under source code control: 2001/02/25 14:00:05 diff --git a/addop.c b/addop.c index a596b81..8cb8a6e 100644 --- a/addop.c +++ b/addop.c @@ -1,7 +1,7 @@ /* * addop - add opcodes to a function being compiled * - * Copyright (C) 1999-2006 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.13 $ - * @(#) $Id: addop.c,v 29.13 2006/06/20 10:28:06 chongo Exp $ + * @(#) $Revision: 29.14 $ + * @(#) $Id: addop.c,v 29.14 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $ * * Under source code control: 1990/02/15 01:48:10 @@ -44,17 +44,17 @@ #define OPCODEALLOCSIZE 100 /* reallocate size for opcodes in functions */ -static unsigned long maxopcodes;/* number of opcodes available */ -static long newindex; /* index of new function */ -static char *newname; /* name of new function */ -static long oldop; /* previous opcode */ -static long oldoldop; /* opcode before previous opcode */ -static long debugline; /* line number of latest debug opcode */ -static long funccount; /* number of functions */ -static long funcavail; /* available number of functions */ -static FUNC *functemplate; /* function definition template */ -static FUNC **functions; /* table of functions */ -static STRINGHEAD funcnames; /* function names */ +STATIC unsigned long maxopcodes;/* number of opcodes available */ +STATIC long newindex; /* index of new function */ +STATIC char *newname; /* name of new function */ +STATIC long oldop; /* previous opcode */ +STATIC long oldoldop; /* opcode before previous opcode */ +STATIC long debugline; /* line number of latest debug opcode */ +STATIC long funccount; /* number of functions */ +STATIC long funcavail; /* available number of functions */ +STATIC FUNC *functemplate; /* function definition template */ +STATIC FUNC **functions; /* table of functions */ +STATIC STRINGHEAD funcnames; /* function names */ /* diff --git a/alloc.h b/alloc.h index b94da57..4db4738 100644 --- a/alloc.h +++ b/alloc.h @@ -1,7 +1,7 @@ /* * alloc - storage allocation and storage debug macros * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.5 $ - * @(#) $Id: alloc.h,v 29.5 2007/02/07 20:51:38 chongo Exp $ + * @(#) $Revision: 29.6 $ + * @(#) $Id: alloc.h,v 29.6 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/alloc.h,v $ * * Under source code control: 1990/02/15 01:48:29 @@ -48,13 +48,13 @@ # include #else #if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus) - extern void *malloc(); - extern void *realloc(); - extern void free(); + E_FUNC void *malloc(); + E_FUNC void *realloc(); + E_FUNC void free(); # else - extern char *malloc(); - extern char *realloc(); - extern void free(); + E_FUNC char *malloc(); + E_FUNC char *realloc(); + E_FUNC void free(); # endif #endif @@ -64,23 +64,23 @@ #else # if defined(HAVE_NEWSTR) -extern void *memcpy(); -extern void *memset(); +E_FUNC void *memcpy(); +E_FUNC void *memset(); #if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus) -extern size_t strlen(); +E_FUNC size_t strlen(); # else -extern long strlen(); +E_FUNC long strlen(); # endif # else /* HAVE_NEWSTR */ -extern void bcopy(); -extern void bfill(); -extern char *index(); +E_FUNC void bcopy(); +E_FUNC void bfill(); +E_FUNC char *index(); # endif /* HAVE_NEWSTR */ -extern char *strchr(); -extern char *strcpy(); -extern char *strncpy(); -extern char *strcat(); -extern int strcmp(); +E_FUNC char *strchr(); +E_FUNC char *strcpy(); +E_FUNC char *strncpy(); +E_FUNC char *strcat(); +E_FUNC int strcmp(); #endif @@ -100,7 +100,7 @@ extern int strcmp(); # else # define MEMMOVE_SIZE_T long # endif -extern void *memmove(void *s1, const void *s2, MEMMOVE_SIZE_T n); +E_FUNC void *memmove(void *s1, CONST void *s2, MEMMOVE_SIZE_T n); #endif #endif /* !__ALLOC_H__ */ diff --git a/assocfunc.c b/assocfunc.c index 004f4f7..0b96006 100644 --- a/assocfunc.c +++ b/assocfunc.c @@ -1,7 +1,7 @@ /* * assocfunc - association table routines * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: assocfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: assocfunc.c,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/assocfunc.c,v $ * * Under source code control: 1993/07/20 23:04:27 @@ -46,10 +46,10 @@ #define ELEMSIZE(n) (sizeof(ASSOCELEM) + (sizeof(VALUE) * ((n) - 1))) -static ASSOCELEM *elemindex(ASSOC *ap, long index); -static BOOL compareindices(VALUE *v1, VALUE *v2, long dim); -static void resize(ASSOC *ap, long newsize); -static void assoc_elemfree(ASSOCELEM *ep); +S_FUNC ASSOCELEM *elemindex(ASSOC *ap, long index); +S_FUNC BOOL compareindices(VALUE *v1, VALUE *v2, long dim); +S_FUNC void resize(ASSOC *ap, long newsize); +S_FUNC void assoc_elemfree(ASSOCELEM *ep); /* @@ -69,7 +69,7 @@ associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices) { ASSOCELEM **listhead; ASSOCELEM *ep; - static VALUE val; + STATIC VALUE val; QCKHASH hash; int i; @@ -200,7 +200,7 @@ assocrsearch(ASSOC *ap, VALUE *vp, long i, long j, ZVALUE *index) * ap association to index into * index index of desired element */ -static ASSOCELEM * +S_FUNC ASSOCELEM * elemindex(ASSOC *ap, long index) { ASSOCELEM *ep; @@ -356,7 +356,7 @@ assoccopy(ASSOC *oldap) * This is only actually done if the growth from the previous size is * enough to make this worthwhile. */ -static void +S_FUNC void resize(ASSOC *ap, long newsize) { ASSOCELEM **oldtable; @@ -400,7 +400,7 @@ resize(ASSOC *ap, long newsize) /* * Free an association element, along with any contained values. */ -static void +S_FUNC void assoc_elemfree(ASSOCELEM *ep) { int i; @@ -520,7 +520,7 @@ assocprint(ASSOC *ap, long max_print) * Compare two lists of index values to see if they are identical. * Returns TRUE if they are the same. */ -static BOOL +S_FUNC BOOL compareindices(VALUE *v1, VALUE *v2, long dim) { int i; diff --git a/blkcpy.c b/blkcpy.c index 1665b91..66b5487 100644 --- a/blkcpy.c +++ b/blkcpy.c @@ -1,7 +1,7 @@ /* * blkcpy - general values and related routines used by the calculator * - * Copyright (C) 1999-2006 Landon Curt Noll and Ernest Bowen + * Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen * * Primary author: Landon Curt Noll * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.10 $ - * @(#) $Id: blkcpy.c,v 29.10 2007/02/07 20:51:38 chongo Exp $ + * @(#) $Revision: 29.11 $ + * @(#) $Id: blkcpy.c,v 29.11 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $ * * Under source code control: 1997/04/18 20:41:26 @@ -935,7 +935,7 @@ copyostr2blk(char *str,long ssi,long num,BLOCK *dblk,long dsi,BOOL noreloc) * s1 */ void * -memmove(void *s1, const void *s2, MEMMOVE_SIZE_T n) +memmove(void *s1, CONST void *s2, MEMMOVE_SIZE_T n) { /* * firewall diff --git a/blkcpy.h b/blkcpy.h index 11f3a13..596fde6 100644 --- a/blkcpy.h +++ b/blkcpy.h @@ -1,7 +1,7 @@ /* * blkcpy - general values and related routines used by the calculator * - * Copyright (C) 1999 Landon Curt Noll and Ernest Bowen + * Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen * * Primary author: Landon Curt Noll * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: blkcpy.h,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: blkcpy.h,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.h,v $ * * Under source code control: 1997/04/18 20:41:25 @@ -36,27 +36,27 @@ /* * the main copy gateway function */ -extern int copystod(VALUE *, long, long, VALUE *, long); +E_FUNC int copystod(VALUE *, long, long, VALUE *, long); /* * specific copy functions */ -extern int copyblk2blk(BLOCK *, long, long, BLOCK *, long, BOOL); -extern int copyblk2file(BLOCK *, long, long, FILEID, long); -extern int copyblk2mat(BLOCK *, long, long, MATRIX *, long); -extern int copyblk2num(BLOCK *, long, long, NUMBER *, long, NUMBER **); -extern int copyblk2str(BLOCK *, long, long, STRING *, long); -extern int copyfile2blk(FILEID, long, long, BLOCK *, long, BOOL); -extern int copylist2list(LIST *, long, long, LIST *, long); -extern int copylist2mat(LIST *, long, long, MATRIX *, long); -extern int copymat2blk(MATRIX *, long, long, BLOCK *, long, BOOL); -extern int copymat2list(MATRIX *, long, long, LIST *, long); -extern int copymat2mat(MATRIX *, long, long, MATRIX *, long); -extern int copynum2blk(NUMBER *, long, long, BLOCK *, long, BOOL); -extern int copyostr2blk(char *, long, long, BLOCK *, long, BOOL); -extern int copyostr2str(char *, long, long, STRING *, long); -extern int copystr2blk(STRING *, long, long, BLOCK *, long, BOOL); -extern int copystr2file(STRING *, long, long, FILEID, long); -extern int copystr2str(STRING *, long, long, STRING *, long); +E_FUNC int copyblk2blk(BLOCK *, long, long, BLOCK *, long, BOOL); +E_FUNC int copyblk2file(BLOCK *, long, long, FILEID, long); +E_FUNC int copyblk2mat(BLOCK *, long, long, MATRIX *, long); +E_FUNC int copyblk2num(BLOCK *, long, long, NUMBER *, long, NUMBER **); +E_FUNC int copyblk2str(BLOCK *, long, long, STRING *, long); +E_FUNC int copyfile2blk(FILEID, long, long, BLOCK *, long, BOOL); +E_FUNC int copylist2list(LIST *, long, long, LIST *, long); +E_FUNC int copylist2mat(LIST *, long, long, MATRIX *, long); +E_FUNC int copymat2blk(MATRIX *, long, long, BLOCK *, long, BOOL); +E_FUNC int copymat2list(MATRIX *, long, long, LIST *, long); +E_FUNC int copymat2mat(MATRIX *, long, long, MATRIX *, long); +E_FUNC int copynum2blk(NUMBER *, long, long, BLOCK *, long, BOOL); +E_FUNC int copyostr2blk(char *, long, long, BLOCK *, long, BOOL); +E_FUNC int copyostr2str(char *, long, long, STRING *, long); +E_FUNC int copystr2blk(STRING *, long, long, BLOCK *, long, BOOL); +E_FUNC int copystr2file(STRING *, long, long, FILEID, long); +E_FUNC int copystr2str(STRING *, long, long, STRING *, long); #endif /* !__BLKCPY_H__ */ diff --git a/block.c b/block.c index 8f491c9..d6ac8e7 100644 --- a/block.c +++ b/block.c @@ -1,7 +1,7 @@ /* * block - fixed, dynamic, fifo and circular memory blocks * - * Copyright (C) 1999 Landon Curt Noll and Ernest Bowen + * Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen * * Primary author: Landon Curt Noll * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: block.c,v 29.3 2006/05/01 19:16:57 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: block.c,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/block.c,v $ * * Under source code control: 1997/02/27 00:29:40 @@ -42,14 +42,14 @@ #define NBLOCKCHUNK 16 -static long nblockcount = 0; -static long maxnblockcount = 0; -static STRINGHEAD nblocknames; -static NBLOCK **nblocks; +STATIC long nblockcount = 0; +STATIC long maxnblockcount = 0; +STATIC STRINGHEAD nblocknames; +STATIC NBLOCK **nblocks; /* forward declarations */ -static void blkchk(BLOCK*); +S_FUNC void blkchk(BLOCK*); /* @@ -154,7 +154,7 @@ blk_free(BLOCK *blk) * if all is ok, otherwise math_error() is called and this * function does not return */ -static void +S_FUNC void blkchk(BLOCK *blk) { diff --git a/block.h b/block.h index 8a018f6..107adca 100644 --- a/block.h +++ b/block.h @@ -1,7 +1,7 @@ /* * block - fixed, dynamic, fifo and circular memory blocks * - * Copyright (C) 1999 Landon Curt Noll and Ernest Bowen + * Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen * * Primary author: Landon Curt Noll * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: block.h,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: block.h,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/block.h,v $ * * Under source code control: 1997/02/21 05:03:39 @@ -160,7 +160,7 @@ typedef struct nblock NBLOCK; /* * block debug */ -extern int blk_debug; /* 0 => debug off */ +EXTERN int blk_debug; /* 0 => debug off */ /* @@ -204,22 +204,22 @@ typedef USB8 OCTET; /* * external functions */ -extern BLOCK *blkalloc(int, int); -extern void blk_free(BLOCK*); -extern BLOCK *blkrealloc(BLOCK*, int, int); -extern void blktrunc(BLOCK*); -extern BLOCK *blk_copy(BLOCK*); -extern int blk_cmp(BLOCK*, BLOCK*); -extern void blk_print(BLOCK*); -extern void nblock_print(NBLOCK *); -extern NBLOCK *createnblock(char *, int, int); -extern NBLOCK *reallocnblock(int, int, int); -extern int removenblock(int); -extern int findnblockid(char *); -extern NBLOCK *findnblock(int); -extern BLOCK *copyrealloc(BLOCK*, int, int); -extern int countnblocks(void); -extern void shownblocks(void); +E_FUNC BLOCK *blkalloc(int, int); +E_FUNC void blk_free(BLOCK*); +E_FUNC BLOCK *blkrealloc(BLOCK*, int, int); +E_FUNC void blktrunc(BLOCK*); +E_FUNC BLOCK *blk_copy(BLOCK*); +E_FUNC int blk_cmp(BLOCK*, BLOCK*); +E_FUNC void blk_print(BLOCK*); +E_FUNC void nblock_print(NBLOCK *); +E_FUNC NBLOCK *createnblock(char *, int, int); +E_FUNC NBLOCK *reallocnblock(int, int, int); +E_FUNC int removenblock(int); +E_FUNC int findnblockid(char *); +E_FUNC NBLOCK *findnblock(int); +E_FUNC BLOCK *copyrealloc(BLOCK*, int, int); +E_FUNC int countnblocks(void); +E_FUNC void shownblocks(void); #endif /* !__BLOCK_H__ */ diff --git a/calc.c b/calc.c index b949df9..b1e1c6f 100644 --- a/calc.c +++ b/calc.c @@ -1,7 +1,7 @@ /* * calc - arbitrary precision calculator * - * Copyright (C) 1999-2006 David I. Bell, Landon Curt Noll and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.14 $ - * @(#) $Id: calc.c,v 29.14 2007/02/07 00:37:25 chongo Exp $ + * @(#) $Revision: 29.15 $ + * @(#) $Id: calc.c,v 29.15 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $ * * Under source code control: 1990/02/15 01:48:11 @@ -87,11 +87,11 @@ /* - * static definitions and functions + * S_FUNC definitions and functions */ -static void intint(int arg); /* interrupt routine */ -static int nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr); -static void set_run_state(run state); +S_FUNC void intint(int arg); /* interrupt routine */ +S_FUNC int nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr); +S_FUNC void set_run_state(run state); /* * Top level calculator routine. @@ -713,7 +713,7 @@ main(int argc, char **argv) * arg to keep ANSI C happy */ /*ARGSUSED*/ -static void +S_FUNC void intint(int UNUSED arg) { (void) signal(SIGINT, intint); @@ -760,7 +760,7 @@ math_error(char *fmt, ...) } } -static int +S_FUNC int nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr) { char *cp; @@ -799,7 +799,7 @@ nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr) } -static void +S_FUNC void set_run_state(run state) { if (conf->calc_debug & CALCDBG_RUNSTATE) diff --git a/calc.h b/calc.h index d025950..1c3a973 100644 --- a/calc.h +++ b/calc.h @@ -1,7 +1,7 @@ /* * calc - definitions for calculator program * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.19 $ - * @(#) $Id: calc.h,v 29.19 2006/08/20 15:01:30 chongo Exp $ + * @(#) $Revision: 29.20 $ + * @(#) $Id: calc.h,v 29.20 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $ * * Under source code control: 1990/02/15 01:48:31 @@ -33,11 +33,11 @@ #include #if defined(CALC_SRC) /* if we are building from the calc source tree */ -# include "win32dll.h" +# include "decl.h" # include "value.h" # include "have_const.h" #else -# include +# include # include # include #endif @@ -103,141 +103,141 @@ /* * File I/O routines. */ -extern DLL FILEID openid(char *name, char *mode); -extern DLL FILEID openpathid(char *name, char *mode, char *pathlist); -extern DLL FILEID indexid(long index); -extern DLL BOOL validid(FILEID id); -extern DLL BOOL errorid(FILEID id); -extern DLL BOOL eofid(FILEID id); -extern DLL int closeid(FILEID id); -extern DLL int getcharid(FILEID id); -extern DLL int idprintf(FILEID id, char *fmt, int count, VALUE **vals); -extern DLL int idfputc(FILEID id, int ch); -extern DLL int idfputs(FILEID id, STRING *str); -extern DLL int printid(FILEID id, int flags); -extern DLL int flushid(FILEID id); -extern DLL int readid(FILEID id, int flags, STRING **retptr); -extern DLL int getloc(FILEID id, ZVALUE *loc); -extern DLL int setloc(FILEID id, ZVALUE zpos); -extern DLL int getsize(FILEID id, ZVALUE *size); -extern DLL int get_device(FILEID id, ZVALUE *dev); -extern DLL int get_inode(FILEID id, ZVALUE *ino); -extern DLL FILEID reopenid(FILEID id, char *mode, char *name); -extern DLL int closeall(void); +E_FUNC FILEID openid(char *name, char *mode); +E_FUNC FILEID openpathid(char *name, char *mode, char *pathlist); +E_FUNC FILEID indexid(long index); +E_FUNC BOOL validid(FILEID id); +E_FUNC BOOL errorid(FILEID id); +E_FUNC BOOL eofid(FILEID id); +E_FUNC int closeid(FILEID id); +E_FUNC int getcharid(FILEID id); +E_FUNC int idprintf(FILEID id, char *fmt, int count, VALUE **vals); +E_FUNC int idfputc(FILEID id, int ch); +E_FUNC int idfputs(FILEID id, STRING *str); +E_FUNC int printid(FILEID id, int flags); +E_FUNC int flushid(FILEID id); +E_FUNC int readid(FILEID id, int flags, STRING **retptr); +E_FUNC int getloc(FILEID id, ZVALUE *loc); +E_FUNC int setloc(FILEID id, ZVALUE zpos); +E_FUNC int getsize(FILEID id, ZVALUE *size); +E_FUNC int get_device(FILEID id, ZVALUE *dev); +E_FUNC int get_inode(FILEID id, ZVALUE *ino); +E_FUNC FILEID reopenid(FILEID id, char *mode, char *name); +E_FUNC int closeall(void); #if !defined(_WIN32) -extern DLL int flushall(void); +E_FUNC int flushall(void); #endif -extern DLL int idfputstr(FILEID id, char *str); -extern DLL int rewindid(FILEID id); -extern DLL void rewindall(void); -extern DLL ZVALUE zfilesize(FILEID id); -extern DLL void showfiles(void); -extern DLL int fscanfid(FILEID id, char *fmt, int count, VALUE **vals); -extern DLL int scanfstr(char *str, char *fmt, int count, VALUE **vals); -extern DLL int ftellid(FILEID id, ZVALUE *res); -extern DLL int fseekid(FILEID id, ZVALUE offset, int whence); -extern DLL int isattyid(FILEID id); -extern DLL int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res); -extern DLL int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res); -extern DLL void showconstants(void); -extern DLL void freeconstant(unsigned long); -extern DLL void freestringconstant(long); -extern DLL void trimconstants(void); +E_FUNC int idfputstr(FILEID id, char *str); +E_FUNC int rewindid(FILEID id); +E_FUNC void rewindall(void); +E_FUNC ZVALUE zfilesize(FILEID id); +E_FUNC void showfiles(void); +E_FUNC int fscanfid(FILEID id, char *fmt, int count, VALUE **vals); +E_FUNC int scanfstr(char *str, char *fmt, int count, VALUE **vals); +E_FUNC int ftellid(FILEID id, ZVALUE *res); +E_FUNC int fseekid(FILEID id, ZVALUE offset, int whence); +E_FUNC int isattyid(FILEID id); +E_FUNC int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res); +E_FUNC int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res); +E_FUNC void showconstants(void); +E_FUNC void freeconstant(unsigned long); +E_FUNC void freestringconstant(long); +E_FUNC void trimconstants(void); /* * Input routines. */ -extern DLL int openstring(char *str, size_t num); -extern DLL int openterminal(void); -extern DLL int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok); -extern DLL char *nextline(void); -extern DLL int nextchar(void); -extern DLL void reread(void); -extern DLL void resetinput(void); -extern DLL void setprompt(char *); -extern DLL BOOL inputisterminal(void); -extern DLL int inputlevel(void); -extern DLL long calclevel(void); -extern DLL char *inputname(void); -extern DLL long linenumber(void); -extern DLL void runrcfiles(void); -extern DLL void closeinput(void); +E_FUNC int openstring(char *str, size_t num); +E_FUNC int openterminal(void); +E_FUNC int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok); +E_FUNC char *nextline(void); +E_FUNC int nextchar(void); +E_FUNC void reread(void); +E_FUNC void resetinput(void); +E_FUNC void setprompt(char *); +E_FUNC BOOL inputisterminal(void); +E_FUNC int inputlevel(void); +E_FUNC long calclevel(void); +E_FUNC char *inputname(void); +E_FUNC long linenumber(void); +E_FUNC void runrcfiles(void); +E_FUNC void closeinput(void); /* * Other routines. */ -extern DLL NUMBER *constvalue(unsigned long index); -extern DLL long addnumber(char *str); -extern DLL long addqconstant(NUMBER *q); -extern DLL void initstack(void); -extern DLL void getcommands(BOOL toplevel); -extern DLL void givehelp(char *type); -extern DLL void libcalc_call_me_first(void); -extern DLL void libcalc_call_me_last(void); -extern DLL BOOL calc_tty(int fd); -extern DLL BOOL orig_tty(int fd); -extern DLL void showerrors(void); -extern DLL char *calc_strdup(CONST char *); +E_FUNC NUMBER *constvalue(unsigned long index); +E_FUNC long addnumber(char *str); +E_FUNC long addqconstant(NUMBER *q); +E_FUNC void initstack(void); +E_FUNC void getcommands(BOOL toplevel); +E_FUNC void givehelp(char *type); +E_FUNC void libcalc_call_me_first(void); +E_FUNC void libcalc_call_me_last(void); +E_FUNC BOOL calc_tty(int fd); +E_FUNC BOOL orig_tty(int fd); +E_FUNC void showerrors(void); +E_FUNC char *calc_strdup(CONST char *); /* * Initialization */ -extern DLL void initialize(void); -extern DLL void reinitialize(void); +E_FUNC void initialize(void); +E_FUNC void reinitialize(void); #if !defined (_WIN32) -extern DLL int isatty(int tty); /* TRUE if fd is a tty */ +E_FUNC int isatty(int tty); /* TRUE if fd is a tty */ #endif -extern DLL char *version(void); /* return version string */ -extern DLL int post_init; /* TRUE => math_error setjmp is ready */ +E_FUNC char *version(void); /* return version string */ +EXTERN int post_init; /* TRUE => math_error setjmp is ready */ /* * global flags and definitions */ -extern DLL int abortlevel; /* current level of aborts */ -extern DLL BOOL inputwait; /* TRUE if in a terminal input wait */ -extern DLL jmp_buf jmpbuf; /* for errors */ +EXTERN int abortlevel; /* current level of aborts */ +EXTERN BOOL inputwait; /* TRUE if in a terminal input wait */ +EXTERN jmp_buf jmpbuf; /* for errors */ -extern DLL int p_flag; /* TRUE => pipe mode */ -extern DLL int q_flag; /* TRUE => don't execute rc files */ -extern DLL int u_flag; /* TRUE => unbuffer stdin and stdout */ -extern DLL int d_flag; /* TRUE => disable heading, resource_debug */ -extern DLL int c_flag; /* TRUE => continue after error if permitted */ -extern DLL int i_flag; /* TRUE => try to go interactive after error */ -extern DLL int s_flag; /* TRUE => keep args as strings for argv() */ -extern DLL long stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */ -extern DLL BOOL abort_now; /* TRUE => try to go interactive */ +EXTERN int p_flag; /* TRUE => pipe mode */ +EXTERN int q_flag; /* TRUE => don't execute rc files */ +EXTERN int u_flag; /* TRUE => unbuffer stdin and stdout */ +EXTERN int d_flag; /* TRUE => disable heading, resource_debug */ +EXTERN int c_flag; /* TRUE => continue after error if permitted */ +EXTERN int i_flag; /* TRUE => try to go interactive after error */ +E_FUNC int s_flag; /* TRUE => keep args as strings for argv() */ +EXTERN long stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */ +EXTERN BOOL abort_now; /* TRUE => try to go interactive */ -extern DLL int argc_value; /* count of argv[] strings for argv() builtin */ -extern DLL char **argv_value; /* argv[] strings for argv() builtin */ +E_FUNC int argc_value; /* count of argv[] strings for argv() builtin */ +E_FUNC char **argv_value; /* argv[] strings for argv() builtin */ -extern DLL char *pager; /* $PAGER or default */ -extern DLL int stdin_tty; /* TRUE if stdin is a tty */ -extern DLL int havecommands; /* TRUE if have cmd args) */ -extern DLL char *program; /* our name */ -extern DLL char *base_name; /* basename of our name */ -extern DLL char cmdbuf[]; /* command line expression */ +EXTERN char *pager; /* $PAGER or default */ +EXTERN int stdin_tty; /* TRUE if stdin is a tty */ +EXTERN int havecommands; /* TRUE if have cmd args) */ +EXTERN char *program; /* our name */ +EXTERN char *base_name; /* basename of our name */ +EXTERN char cmdbuf[]; /* command line expression */ -extern DLL int abortlevel; /* current level of aborts */ -extern DLL BOOL inputwait; /* TRUE if in a terminal input wait */ -extern DLL VALUE *stack; /* execution stack */ -extern DLL int dumpnames; /* TRUE => dump names rather than indices */ +EXTERN int abortlevel; /* current level of aborts */ +EXTERN BOOL inputwait; /* TRUE if in a terminal input wait */ +EXTERN VALUE *stack; /* execution stack */ +EXTERN int dumpnames; /* TRUE => dump names rather than indices */ -extern DLL char *calcpath; /* $CALCPATH or default */ -extern DLL char *calcrc; /* $CALCRC or default */ -extern DLL char *calcbindings; /* $CALCBINDINGS or default */ -extern DLL char *home; /* $HOME or default */ -extern DLL char *shell; /* $SHELL or default */ -extern DLL char *program; /* our name (argv[0]) */ +EXTERN char *calcpath; /* $CALCPATH or default */ +EXTERN char *calcrc; /* $CALCRC or default */ +EXTERN char *calcbindings; /* $CALCBINDINGS or default */ +EXTERN char *home; /* $HOME or default */ +EXTERN char *shell; /* $SHELL or default */ +E_FUNC char *program; /* our name (argv[0]) */ -extern DLL int no_env; /* TRUE (-e) => ignore env vars on startup */ -extern DLL long errmax; /* if >= 0, error when errcount exceeds errmax */ -extern DLL int use_old_std; /* TRUE (-O) => use classic configuration */ +E_FUNC int no_env; /* TRUE (-e) => ignore env vars on startup */ +EXTERN long errmax; /* if >= 0, error when errcount exceeds errmax */ +E_FUNC int use_old_std; /* TRUE (-O) => use classic configuration */ -extern DLL int allow_read; /* FALSE => dont open any files for reading */ -extern DLL int allow_write; /* FALSE => dont open any files for writing */ -extern DLL int allow_exec; /* FALSE => may not execute any commands */ +EXTERN int allow_read; /* FALSE => dont open any files for reading */ +EXTERN int allow_write; /* FALSE => dont open any files for writing */ +EXTERN int allow_exec; /* FALSE => may not execute any commands */ /* * calc startup and run state @@ -253,19 +253,19 @@ typedef enum { RUN_EXIT, /* normal exit from calc */ RUN_EXIT_WITH_ERROR /* exit with error */ } run; -extern DLL run run_state; -extern DLL char *run_state_name(run state); +EXTERN run run_state; +E_FUNC char *run_state_name(run state); /* * calc version information */ #define CALC_TITLE "C-style arbitrary precision calculator" -extern int calc_major_ver; -extern int calc_minor_ver; -extern int calc_major_patch; -extern int calc_minor_patch; -extern char *Copyright; -extern DLL char *version(void); +EXTERN int calc_major_ver; +EXTERN int calc_minor_ver; +EXTERN int calc_major_patch; +EXTERN int calc_minor_patch; +EXTERN char *Copyright; +E_FUNC char *version(void); #endif /* !__CALC_H__ */ diff --git a/cmath.h b/cmath.h index f2446bb..1ca0303 100644 --- a/cmath.h +++ b/cmath.h @@ -1,7 +1,7 @@ /* * cmath - data structures for extended precision complex arithmetic * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -52,84 +52,84 @@ typedef struct { /* * Input, output, and conversion routines. */ -extern COMPLEX *comalloc(void); -extern COMPLEX *qqtoc(NUMBER *q1, NUMBER *q2); -extern void comfree(COMPLEX *c); -extern void comprint(COMPLEX *c); -extern void cprintfr(COMPLEX *c); +E_FUNC COMPLEX *comalloc(void); +E_FUNC COMPLEX *qqtoc(NUMBER *q1, NUMBER *q2); +E_FUNC void comfree(COMPLEX *c); +E_FUNC void comprint(COMPLEX *c); +E_FUNC void cprintfr(COMPLEX *c); /* * Basic numeric routines. */ -extern COMPLEX *c_add(COMPLEX *c1, COMPLEX *c2); -extern COMPLEX *c_sub(COMPLEX *c1, COMPLEX *c2); -extern COMPLEX *c_mul(COMPLEX *c1, COMPLEX *c2); -extern COMPLEX *c_div(COMPLEX *c1, COMPLEX *c2); -extern COMPLEX *c_addq(COMPLEX *c, NUMBER *q); -extern COMPLEX *c_subq(COMPLEX *c, NUMBER *q); -extern COMPLEX *c_mulq(COMPLEX *c, NUMBER *q); -extern COMPLEX *c_divq(COMPLEX *c, NUMBER *q); -extern COMPLEX *c_scale(COMPLEX *c, long i); -extern COMPLEX *c_shift(COMPLEX *c, long i); -extern COMPLEX *c_square(COMPLEX *c); -extern COMPLEX *c_conj(COMPLEX *c); -extern COMPLEX *c_real(COMPLEX *c); -extern COMPLEX *c_imag(COMPLEX *c); -extern COMPLEX *c_neg(COMPLEX *c); -extern COMPLEX *c_inv(COMPLEX *c); -extern COMPLEX *c_int(COMPLEX *c); -extern COMPLEX *c_frac(COMPLEX *c); -extern BOOL c_cmp(COMPLEX *c1, COMPLEX *c2); +E_FUNC COMPLEX *c_add(COMPLEX *c1, COMPLEX *c2); +E_FUNC COMPLEX *c_sub(COMPLEX *c1, COMPLEX *c2); +E_FUNC COMPLEX *c_mul(COMPLEX *c1, COMPLEX *c2); +E_FUNC COMPLEX *c_div(COMPLEX *c1, COMPLEX *c2); +E_FUNC COMPLEX *c_addq(COMPLEX *c, NUMBER *q); +E_FUNC COMPLEX *c_subq(COMPLEX *c, NUMBER *q); +E_FUNC COMPLEX *c_mulq(COMPLEX *c, NUMBER *q); +E_FUNC COMPLEX *c_divq(COMPLEX *c, NUMBER *q); +E_FUNC COMPLEX *c_scale(COMPLEX *c, long i); +E_FUNC COMPLEX *c_shift(COMPLEX *c, long i); +E_FUNC COMPLEX *c_square(COMPLEX *c); +E_FUNC COMPLEX *c_conj(COMPLEX *c); +E_FUNC COMPLEX *c_real(COMPLEX *c); +E_FUNC COMPLEX *c_imag(COMPLEX *c); +E_FUNC COMPLEX *c_neg(COMPLEX *c); +E_FUNC COMPLEX *c_inv(COMPLEX *c); +E_FUNC COMPLEX *c_int(COMPLEX *c); +E_FUNC COMPLEX *c_frac(COMPLEX *c); +E_FUNC BOOL c_cmp(COMPLEX *c1, COMPLEX *c2); /* * More complicated functions. */ -extern COMPLEX *c_powi(COMPLEX *c, NUMBER *q); -extern NUMBER *c_ilog(COMPLEX *c, ZVALUE base); +E_FUNC COMPLEX *c_powi(COMPLEX *c, NUMBER *q); +E_FUNC NUMBER *c_ilog(COMPLEX *c, ZVALUE base); /* * Transcendental routines. These all take an epsilon argument to * specify how accurately these are to be calculated. */ -extern COMPLEX *c_power(COMPLEX *c1, COMPLEX *c2, NUMBER *epsilon); -extern COMPLEX *c_sqrt(COMPLEX *c, NUMBER *epsilon, long R); -extern COMPLEX *c_root(COMPLEX *c, NUMBER *q, NUMBER *epsilon); -extern COMPLEX *c_exp(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_ln(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_log(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_cos(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_sin(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_cosh(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_sinh(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_polar(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); -extern COMPLEX *c_rel(COMPLEX *c1, COMPLEX *c2); -extern COMPLEX *c_asin(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_acos(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_atan(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_acot(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_asec(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_acsc(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_asinh(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_acosh(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_atanh(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_acoth(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_asech(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_acsch(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_gd(COMPLEX *c, NUMBER *epsilon); -extern COMPLEX *c_agd(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_power(COMPLEX *c1, COMPLEX *c2, NUMBER *epsilon); +E_FUNC COMPLEX *c_sqrt(COMPLEX *c, NUMBER *epsilon, long R); +E_FUNC COMPLEX *c_root(COMPLEX *c, NUMBER *q, NUMBER *epsilon); +E_FUNC COMPLEX *c_exp(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_ln(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_log(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_cos(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_sin(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_cosh(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_sinh(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_polar(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); +E_FUNC COMPLEX *c_rel(COMPLEX *c1, COMPLEX *c2); +E_FUNC COMPLEX *c_asin(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_acos(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_atan(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_acot(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_asec(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_acsc(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_asinh(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_acosh(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_atanh(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_acoth(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_asech(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_acsch(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_gd(COMPLEX *c, NUMBER *epsilon); +E_FUNC COMPLEX *c_agd(COMPLEX *c, NUMBER *epsilon); /* * external functions */ -extern COMPLEX *swap_b8_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all); -extern COMPLEX *swap_b16_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all); -extern COMPLEX *swap_HALF_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all); +E_FUNC COMPLEX *swap_b8_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all); +E_FUNC COMPLEX *swap_b16_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all); +E_FUNC COMPLEX *swap_HALF_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all); /* @@ -153,7 +153,7 @@ extern COMPLEX *swap_HALF_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all); /* * Pre-defined values. */ -extern COMPLEX _czero_, _cone_, _conei_; +EXTERN COMPLEX _czero_, _cone_, _conei_; #endif /* !__CMATH_H__ */ diff --git a/codegen.c b/codegen.c index 00ad18d..a4f6b10 100644 --- a/codegen.c +++ b/codegen.c @@ -1,7 +1,7 @@ /* * codegen - module to generate opcodes from the input tokens * - * Copyright (C) 1999-2006 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.22 $ - * @(#) $Id: codegen.c,v 29.22 2006/12/15 16:25:09 chongo Exp $ + * @(#) $Revision: 29.23 $ + * @(#) $Id: codegen.c,v 29.23 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $ * * Under source code control: 1990/02/15 01:48:13 @@ -49,61 +49,61 @@ # include #endif -static BOOL rdonce; /* TRUE => do not reread this file */ +STATIC BOOL rdonce; /* TRUE => do not reread this file */ FUNC *curfunc; -static int getsymvalue(char *name, VALUE *v_p); -static int getfilename(char *name, size_t namelen, BOOL *once); -static BOOL getid(char *buf); -static void getshowstatement(void); -static void getfunction(void); -static void ungetfunction(void); -static void getbody(LABEL *contlabel, LABEL *breaklabel, +S_FUNC int getsymvalue(char *name, VALUE *v_p); +S_FUNC int getfilename(char *name, size_t namelen, BOOL *once); +S_FUNC BOOL getid(char *buf); +S_FUNC void getshowstatement(void); +S_FUNC void getfunction(void); +S_FUNC void ungetfunction(void); +S_FUNC void getbody(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *defaultlabel); -static int getdeclarations(int symtype); -static int getsimpledeclaration (int symtype); -static int getonevariable (int symtype); -static void getstatement(LABEL *contlabel, LABEL *breaklabel, +S_FUNC int getdeclarations(int symtype); +S_FUNC int getsimpledeclaration (int symtype); +S_FUNC int getonevariable (int symtype); +S_FUNC void getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *defaultlabel); -static void getobjdeclaration(int symtype); -static void getoneobj(long index, int symtype); -static void getobjvars(char *name, int symtype); -static void getmatdeclaration(int symtype); -static void getonematrix(int symtype); -static void creatematrix(void); -static void getsimplebody(void); -static void getcondition(void); -static void getmatargs(void); -static void getelement(void); -static void usesymbol(char *name, int autodef); -static void definesymbol(char *name, int symtype); -static void getcallargs(char *name); -static void do_changedir(void); -static int getexprlist(void); -static int getopassignment(void); -static int getassignment(void); -static int getaltcond(void); -static int getorcond(void); -static int getandcond(void); -static int getrelation(void); -static int getsum(void); -static int getproduct(void); -static int getorexpr(void); -static int getandexpr(void); -static int getshiftexpr(void); -static int getreference(void); -static int getincdecexpr(void); -static int getterm(void); -static int getidexpr(BOOL okmat, int autodef); -static long getinitlist(void); +S_FUNC void getobjdeclaration(int symtype); +S_FUNC void getoneobj(long index, int symtype); +S_FUNC void getobjvars(char *name, int symtype); +S_FUNC void getmatdeclaration(int symtype); +S_FUNC void getonematrix(int symtype); +S_FUNC void creatematrix(void); +S_FUNC void getsimplebody(void); +S_FUNC void getcondition(void); +S_FUNC void getmatargs(void); +S_FUNC void getelement(void); +S_FUNC void usesymbol(char *name, int autodef); +S_FUNC void definesymbol(char *name, int symtype); +S_FUNC void getcallargs(char *name); +S_FUNC void do_changedir(void); +S_FUNC int getexprlist(void); +S_FUNC int getopassignment(void); +S_FUNC int getassignment(void); +S_FUNC int getaltcond(void); +S_FUNC int getorcond(void); +S_FUNC int getandcond(void); +S_FUNC int getrelation(void); +S_FUNC int getsum(void); +S_FUNC int getproduct(void); +S_FUNC int getorexpr(void); +S_FUNC int getandexpr(void); +S_FUNC int getshiftexpr(void); +S_FUNC int getreference(void); +S_FUNC int getincdecexpr(void); +S_FUNC int getterm(void); +S_FUNC int getidexpr(BOOL okmat, int autodef); +S_FUNC long getinitlist(void); #define INDICALLOC 8 -static int quickindices[INDICALLOC]; -static int * newindices; -static int * indices; -static int maxindices; +STATIC int quickindices[INDICALLOC]; +STATIC int * newindices; +STATIC int * indices; +STATIC int maxindices; /* @@ -289,7 +289,7 @@ evaluate(BOOL nestflag) /* * Undefine one or more functions */ -static void +S_FUNC void ungetfunction(void) { char *name; @@ -340,7 +340,7 @@ ungetfunction(void) * func = name '(' '' | name [ ',' name] ... ')' simplebody * | name '(' '' | name [ ',' name] ... ')' body. */ -static void +S_FUNC void getfunction(void) { char *name; /* parameter name */ @@ -429,7 +429,7 @@ getfunction(void) * Get a simple assignment style body for a function declaration. * simplebody = '=' assignment '\n'. */ -static void +S_FUNC void getsimplebody(void) { (void) tokenmode(TM_NEWLINES); @@ -444,7 +444,7 @@ getsimplebody(void) * | [ declarations ] ... [statement ] ... '\n' */ /*ARGSUSED*/ -static void +S_FUNC void getbody(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *defaultlabel) { int oldmode; @@ -474,7 +474,7 @@ getbody(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *defaul * declarations = { LOCAL | GLOBAL | STATIC } onedeclaration * [ ',' onedeclaration ] ... ';'. */ -static int +S_FUNC int getdeclarations(int symtype) { int res = 0; @@ -526,7 +526,7 @@ getdeclarations(int symtype) * Subsequences end with "," or at end of line; spaces indicate * repeated assignment, e.g. "c d = 2" has the effect of "c = 2, d = 2". */ -static int +S_FUNC int getsimpledeclaration(int symtype) { int res = 0; @@ -554,9 +554,9 @@ getsimpledeclaration(int symtype) * Get one variable in a sequence of simple identifiers. * Returns 1 if the subsequence in which the variable occurs ends with * an assignment, e.g. for the variables b, c, d, in - * static a, b = 1, c d = 2, d; + * S_FUNC a, b = 1, c d = 2, d; */ -static int +S_FUNC int getonevariable(int symtype) { char *name; @@ -608,7 +608,7 @@ getonevariable(int symtype) * nextcaselabel label for next case statement * defaultlabel label for default case */ -static void +S_FUNC void getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *defaultlabel) { LABEL label; @@ -1059,7 +1059,7 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d * is an OBJ statement, otherwise this is part of a declaration which will * define new symbols with the specified type. */ -static void +S_FUNC void getobjdeclaration(int symtype) { char *name; /* name of object type */ @@ -1165,7 +1165,7 @@ getobjdeclaration(int symtype) } -static void +S_FUNC void getoneobj(long index, int symtype) { char *symname; @@ -1192,7 +1192,7 @@ getoneobj(long index, int symtype) /* * Routine to assign a specified object-type value to each of a set of - * variables in a "global", "local" or "static" declaration, or, if + * variables in a "global", "local" or "S_FUNC" declaration, or, if * symtype is SYM_UNDEFINED, to create one object value of the specified * type. * @@ -1200,7 +1200,7 @@ getoneobj(long index, int symtype) * name object name * symtype declaration type */ -static void +S_FUNC void getobjvars(char *name, int symtype) { long index; /* index for object */ @@ -1224,7 +1224,7 @@ getobjvars(char *name, int symtype) } -static void +S_FUNC void getmatdeclaration(int symtype) { for (;;) { @@ -1244,7 +1244,7 @@ getmatdeclaration(int symtype) } -static void +S_FUNC void getonematrix(int symtype) { long dim; @@ -1340,7 +1340,7 @@ getonematrix(int symtype) } -static void +S_FUNC void creatematrix(void) { long dim; @@ -1398,7 +1398,7 @@ creatematrix(void) * Returns the number of elements that are in the list, or -1 on parse error. * initlist = { assignment [ , assignment ] ... }. */ -static long +S_FUNC long getinitlist(void) { long index; @@ -1454,7 +1454,7 @@ getinitlist(void) * Get a condition. * condition = '(' assignment ')'. */ -static void +S_FUNC void getcondition(void) { if (gettoken() != T_LEFTPAREN) { @@ -1478,7 +1478,7 @@ getcondition(void) * Returns flags describing the type of the last assignment or expression found. * exprlist = assignment [ ',' assignment ] ... */ -static int +S_FUNC int getexprlist(void) { int type; @@ -1511,7 +1511,7 @@ getexprlist(void) * | lvalue '**=' assignment * | orcond. */ -static int +S_FUNC int getopassignment(void) { int type; /* type of expression */ @@ -1587,7 +1587,7 @@ getopassignment(void) * Get an assignment (lvalue = ...) or possibly just an expression */ -static int +S_FUNC int getassignment (void) { int type; /* type of expression */ @@ -1657,7 +1657,7 @@ getassignment (void) * Flags are returned indicating the type of expression found. * altcond = orcond [ '?' orcond ':' altcond ]. */ -static int +S_FUNC int getaltcond(void) { int type; /* type of expression */ @@ -1691,7 +1691,7 @@ getaltcond(void) * Flags are returned indicating the type of expression found. * orcond = andcond [ '||' andcond ] ... */ -static int +S_FUNC int getorcond(void) { int type; /* type of expression */ @@ -1715,7 +1715,7 @@ getorcond(void) * Flags are returned indicating the type of expression found. * andcond = relation [ '&&' relation ] ... */ -static int +S_FUNC int getandcond(void) { int type; /* type of expression */ @@ -1745,7 +1745,7 @@ getandcond(void) * | sum '>' sum * | sum. */ -static int +S_FUNC int getrelation(void) { int type; /* type of expression */ @@ -1776,7 +1776,7 @@ getrelation(void) * Flags indicating the type of expression found are returned. * sum = product [ {'+' | '-'} product ] ... */ -static int +S_FUNC int getsum(void) { int type; /* type of expression found */ @@ -1819,7 +1819,7 @@ getsum(void) * Flags indicating the type of expression found are returned. * product = orexpr [ {'*' | '/' | '//' | '%'} orexpr ] ... */ -static int +S_FUNC int getproduct(void) { int type; /* type of value found */ @@ -1850,7 +1850,7 @@ getproduct(void) * Flags indicating the type of expression found are returned. * orexpr = andexpr [ '|' andexpr ] ... */ -static int +S_FUNC int getorexpr(void) { int type; /* type of value found */ @@ -1873,7 +1873,7 @@ getorexpr(void) * Flags indicating the type of expression found are returned. * andexpr = shiftexpr [ '&' shiftexpr ] ... */ -static int +S_FUNC int getandexpr(void) { int type; /* type of value found */ @@ -1912,7 +1912,7 @@ getandexpr(void) * | reference '>>' shiftexpr * | reference. */ -static int +S_FUNC int getshiftexpr(void) { int type; /* type of value found */ @@ -1956,7 +1956,7 @@ getshiftexpr(void) * address = '&' term * dereference = '*' term */ -static int +S_FUNC int getreference(void) { int type; @@ -1993,7 +1993,7 @@ getreference(void) * get an increment or decrement expression * ++expr, --expr, expr++, expr-- */ -static int +S_FUNC int getincdecexpr(void) { int type; @@ -2051,7 +2051,7 @@ getincdecexpr(void) * | function [ '(' [assignment [',' assignment] ] ')' ] * | '!' term */ -static int +S_FUNC int getterm(void) { int type; /* type of term found */ @@ -2211,7 +2211,7 @@ getterm(void) * element references. The symbol can be a global or a local variable name. * Returns the type of expression found. */ -static int +S_FUNC int getidexpr(BOOL okmat, int autodef) { int type; @@ -2286,7 +2286,7 @@ getidexpr(BOOL okmat, int autodef) * to get the value of a symbol. It should NOT be used in the * general op code generation / calc code parsing case. */ -static int +S_FUNC int getsymvalue(char *name, VALUE *v_p) { GLOBAL *g_ret; /* global return from findglobal() */ @@ -2319,7 +2319,7 @@ getsymvalue(char *name, VALUE *v_p) * namelen length of filename buffer including NUL byte * once non-NULL => set to TRUE of -once read */ -static int +S_FUNC int getfilename(char *name, size_t namelen, BOOL *once) { STRING *s; @@ -2401,7 +2401,7 @@ getfilename(char *name, size_t namelen, BOOL *once) /* * Read the show command to display useful information */ -static void +S_FUNC void getshowstatement(void) { char name[5]; @@ -2472,7 +2472,7 @@ getshowstatement(void) * Read in a set of matrix index arguments, surrounded with square brackets. * This also handles double square brackets for 'fast indexing'. */ -static void +S_FUNC void getmatargs(void) { int dim; @@ -2534,7 +2534,7 @@ getmatargs(void) * Get an element of an object reference. * The leading period which introduces the element has already been read. */ -static void +S_FUNC void getelement(void) { long index; @@ -2555,7 +2555,7 @@ getelement(void) * Read in a single symbol name and copy its value into the given buffer. * Returns TRUE if a valid symbol id was found. */ -static BOOL +S_FUNC BOOL getid(char *buf) { int type; @@ -2587,7 +2587,7 @@ getid(char *buf) * redeclared and when in the same body the variable will be accessible only ^ with the appropriate specfier. */ -static void +S_FUNC void definesymbol(char *name, int symtype) { switch (symboltype(name)) { @@ -2650,7 +2650,7 @@ definesymbol(char *name, int symtype) * autodef 1 => define if symbol is not known * T_GLOBAL => get global, define if necessary */ -static void +S_FUNC void usesymbol(char *name, int autodef) { int type; @@ -2707,7 +2707,7 @@ usesymbol(char *name, int autodef) * given: * name name of function */ -static void +S_FUNC void getcallargs(char *name) { long index; /* function index */ @@ -2776,7 +2776,7 @@ getcallargs(char *name) /* * Change the current directory. If no directory is given, assume home. */ -static void +S_FUNC void do_changedir(void) { char *p; diff --git a/comfunc.c b/comfunc.c index fcfb181..be78ad3 100644 --- a/comfunc.c +++ b/comfunc.c @@ -1,7 +1,7 @@ /* * comfunc - extended precision complex arithmetic non-primitive routines * - * Copyright (C) 1999 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.6 $ - * @(#) $Id: comfunc.c,v 29.6 2006/05/20 08:43:55 chongo Exp $ + * @(#) $Revision: 29.7 $ + * @(#) $Id: comfunc.c,v 29.7 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/comfunc.c,v $ * * Under source code control: 1990/02/15 01:48:13 @@ -36,10 +36,10 @@ /* * cache the natural logarithm of 10 */ -static COMPLEX *cln_10 = NULL; -static NUMBER *cln_10_epsilon = NULL; -static NUMBER _q10_ = { { _tenval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL }; -static NUMBER _q0_ = { { _zeroval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL }; +STATIC COMPLEX *cln_10 = NULL; +STATIC NUMBER *cln_10_epsilon = NULL; +STATIC NUMBER _q10_ = { { _tenval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL }; +STATIC NUMBER _q0_ = { { _zeroval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL }; COMPLEX _cten_ = { &_q10_, &_q0_, 1 }; diff --git a/commath.c b/commath.c index de82857..e8958b2 100644 --- a/commath.c +++ b/commath.c @@ -1,7 +1,7 @@ /* * commath - extended precision complex arithmetic primitive routines * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: commath.c,v 29.4 2005/10/18 10:43:49 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: commath.c,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/commath.c,v $ * * Under source code control: 1990/02/15 01:48:10 @@ -35,7 +35,7 @@ COMPLEX _czero_ = { &_qzero_, &_qzero_, 1 }; COMPLEX _cone_ = { &_qone_, &_qzero_, 1 }; COMPLEX _conei_ = { &_qzero_, &_qone_, 1 }; -static COMPLEX _cnegone_ = { &_qnegone_, &_qzero_, 1 }; +STATIC COMPLEX _cnegone_ = { &_qnegone_, &_qzero_, 1 }; /* diff --git a/config.c b/config.c index 5aeb7a5..322b9d5 100644 --- a/config.c +++ b/config.c @@ -1,7 +1,7 @@ /* * config - configuration routines * - * Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll + * Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.23 $ - * @(#) $Id: config.c,v 29.23 2006/12/15 16:17:18 chongo Exp $ + * @(#) $Revision: 29.24 $ + * @(#) $Id: config.c,v 29.24 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $ * * Under source code control: 1991/07/20 00:21:56 @@ -261,7 +261,7 @@ CONFIG *conf = NULL; /* loaded in at startup - current configuration */ /* * Possible output modes. */ -static NAMETYPE modes[] = { +STATIC NAMETYPE modes[] = { {"fraction", MODE_FRAC}, {"frac", MODE_FRAC}, {"integer", MODE_INT}, @@ -286,7 +286,7 @@ static NAMETYPE modes[] = { /* * Possible block base output modes */ -static NAMETYPE blk_base[] = { +STATIC NAMETYPE blk_base[] = { {"hexadecimal", BLK_BASE_HEX}, {"hex", BLK_BASE_HEX}, {"default", BLK_BASE_HEX}, @@ -305,7 +305,7 @@ static NAMETYPE blk_base[] = { /* * Possible block output formats */ -static NAMETYPE blk_fmt[] = { +STATIC NAMETYPE blk_fmt[] = { {"lines", BLK_FMT_LINE}, {"line", BLK_FMT_LINE}, {"strings", BLK_FMT_STRING}, @@ -325,7 +325,7 @@ static NAMETYPE blk_fmt[] = { /* * Possible ctrl_d styles */ -static NAMETYPE ctrl_d[] = { +STATIC NAMETYPE ctrl_d[] = { {"virgin_eof", CTRL_D_VIRGIN_EOF}, {"virgineof", CTRL_D_VIRGIN_EOF}, {"virgin", CTRL_D_VIRGIN_EOF}, @@ -345,7 +345,7 @@ static NAMETYPE ctrl_d[] = { */ #define TRUE_STRING "true" #define FALSE_STRING "false" -static NAMETYPE truth[] = { +STATIC NAMETYPE truth[] = { {TRUE_STRING, TRUE}, {"t", TRUE}, {"on", TRUE}, @@ -367,9 +367,9 @@ static NAMETYPE truth[] = { /* * declare static functions */ -static long lookup_long(NAMETYPE *set, char *name); -static char *lookup_name(NAMETYPE *set, long val); -static int getlen(VALUE *vp, LEN *lp); +S_FUNC long lookup_long(NAMETYPE *set, char *name); +S_FUNC char *lookup_name(NAMETYPE *set, long val); +S_FUNC int getlen(VALUE *vp, LEN *lp); /* @@ -403,7 +403,7 @@ configtype(char *name) * returns: * numeric value of the name or -1 if not found */ -static long +S_FUNC long lookup_long(NAMETYPE *set, char *name) { NAMETYPE *cp; /* current config pointer */ @@ -426,7 +426,7 @@ lookup_long(NAMETYPE *set, char *name) * returns: * name of the value found of NULL */ -static char * +S_FUNC char * lookup_name(NAMETYPE *set, long val) { NAMETYPE *cp; /* current config pointer */ @@ -446,7 +446,7 @@ lookup_name(NAMETYPE *set, long val) * Return: 1 ==> not an integer, 2 ==> int > 2^31, 0 ==> OK, -1 ==> error */ -static int +S_FUNC int getlen(VALUE *vp, LEN *lp) { if (vp->v_type != V_NUM || !qisint(vp->v_num)) diff --git a/config.h b/config.h index 0248c45..503212a 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ /* * config - configuration routines * - * Copyright (C) 1999-2004 Landon Curt Noll and David I. Bell + * Copyright (C) 1999-2007 Landon Curt Noll and David I. Bell * * Primary author: Landon Curt Noll * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.21 $ - * @(#) $Id: config.h,v 29.21 2006/12/15 16:16:59 chongo Exp $ + * @(#) $Revision: 29.22 $ + * @(#) $Id: config.h,v 29.22 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $ * * Under source code control: 1995/11/01 22:20:17 @@ -36,11 +36,11 @@ #if defined(CALC_SRC) /* if we are building from the calc source tree */ -# include "win32dll.h" +# include "decl.h" # include "nametype.h" # include "qmath.h" #else -# include +# include # include # include #endif @@ -206,23 +206,23 @@ typedef struct config CONFIG; /* * global configuration states and aliases */ -extern DLL CONFIG *conf; /* current configuration */ -extern DLL CONFIG oldstd; /* old classic standard configuration */ -extern DLL CONFIG newstd; /* default compatible configuration */ -extern DLL char *calc_debug; /* !=NULL => value of config("calc_debug") */ -extern DLL char *resource_debug; /* !=NULL => config("resource_debug") value */ -extern DLL char *user_debug; /* !=NULL => value of config("user_debug") */ +EXTERN CONFIG *conf; /* current configuration */ +EXTERN CONFIG oldstd; /* old classic standard configuration */ +EXTERN CONFIG newstd; /* default compatible configuration */ +E_FUNC char *calc_debug; /* !=NULL => value of config("calc_debug") */ +E_FUNC char *resource_debug; /* !=NULL => config("resource_debug") value */ +E_FUNC char *user_debug; /* !=NULL => value of config("user_debug") */ /* * configuration externals */ -extern DLL CONFIG *config_copy(CONFIG *src); -extern DLL void config_free(CONFIG *cfg); -extern DLL void config_print(CONFIG *cfg); -extern DLL int configtype(char*); -extern DLL void config_print(CONFIG*); -extern DLL BOOL config_cmp(CONFIG*, CONFIG*); +E_FUNC CONFIG *config_copy(CONFIG *src); +E_FUNC void config_free(CONFIG *cfg); +E_FUNC void config_print(CONFIG *cfg); +E_FUNC int configtype(char*); +E_FUNC void config_print(CONFIG*); +E_FUNC BOOL config_cmp(CONFIG*, CONFIG*); #endif /* !__CONFIG_H__ */ diff --git a/const.c b/const.c index 3f534d1..357ed47 100644 --- a/const.c +++ b/const.c @@ -1,7 +1,7 @@ /* * const - constant number storage module * - * Copyright (C) 1999-2004 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: const.c,v 29.4 2004/02/23 14:04:01 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: const.c,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/const.c,v $ * * Under source code control: 1990/02/15 01:48:14 @@ -34,9 +34,9 @@ #define CONSTALLOCSIZE 400 /* number of constants to allocate */ -static unsigned long constcount;/* number of constants defined */ -static long constavail; /* number of constants available */ -static NUMBER **consttable; /* table of constants */ +STATIC unsigned long constcount;/* number of constants defined */ +STATIC long constavail; /* number of constants available */ +STATIC NUMBER **consttable; /* table of constants */ void diff --git a/cscript/4dsphere.calc b/cscript/4dsphere.calc index b123460..86d607e 100644 --- a/cscript/4dsphere.calc +++ b/cscript/4dsphere.calc @@ -1,4 +1,4 @@ -#!/usr/local/src/cmd/calc/calc -q -f +#!/usr/local/src/cmd/calc/calc -q -s -f /* * 4dsphere - determine if 6 points lie on the surface of a sphere in R^4 * @@ -26,8 +26,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 1.4 $ - * @(#) $Id: 4dsphere.calc,v 1.4 2007/02/07 00:34:04 chongo Exp $ + * @(#) $Revision: 1.5 $ + * @(#) $Id: 4dsphere.calc,v 1.5 2007/02/11 10:05:56 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/4dsphere.calc,v $ * * Under source code control: 2001/05/03 19:02:03 diff --git a/cscript/fproduct.calc b/cscript/fproduct.calc index dba4008..a115101 100644 --- a/cscript/fproduct.calc +++ b/cscript/fproduct.calc @@ -1,4 +1,4 @@ -#!/usr/local/src/cmd/calc/calc -q -f +#!/usr/local/src/cmd/calc/calc -q -s -f /* * fproduct - write the big Endian product of terms to a file * @@ -24,8 +24,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: fproduct.calc,v 29.3 2007/02/07 00:34:04 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: fproduct.calc,v 29.4 2007/02/11 10:05:56 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/fproduct.calc,v $ * * Under source code control: 2001/04/07 20:13:11 diff --git a/cscript/mersenne.calc b/cscript/mersenne.calc index 6953b2d..3eab128 100644 --- a/cscript/mersenne.calc +++ b/cscript/mersenne.calc @@ -1,4 +1,4 @@ -#!/usr/local/src/cmd/calc/calc -q -f +#!/usr/local/src/cmd/calc/calc -q -s -f /* * mersenne - print the value of a mersenne number * @@ -18,8 +18,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: mersenne.calc,v 29.4 2007/02/07 00:34:04 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: mersenne.calc,v 29.5 2007/02/11 10:05:56 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $ * * Under source code control: 1999/11/30 00:09:01; diff --git a/cscript/powerterm.calc b/cscript/powerterm.calc index e646c96..87ad587 100644 --- a/cscript/powerterm.calc +++ b/cscript/powerterm.calc @@ -1,4 +1,4 @@ -#!/usr/local/src/cmd/calc/calc -q -f +#!/usr/local/src/cmd/calc/calc -q -s -f /* * powerterm - print the argument as a sum of powers of integers * @@ -24,8 +24,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: powerterm.calc,v 29.7 2007/02/07 00:34:04 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: powerterm.calc,v 29.8 2007/02/11 10:05:56 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/powerterm.calc,v $ * * Under source code control: 2001/04/24 23:49:11 diff --git a/custom.h b/custom.h index c0dd191..65c3da6 100644 --- a/custom.h +++ b/custom.h @@ -1,7 +1,7 @@ /* * custom - interface for custom software and hardware interfaces * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: custom.h,v 29.3 2004/02/25 23:54:40 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: custom.h,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.h,v $ * * Under source code control: 1997/03/03 04:53:08 @@ -71,10 +71,10 @@ struct custom { * * These are the required interfaces. The dummy.c stubs these interfaces too. */ -extern VALUE custom(char*, int, VALUE**); /* master custom interface */ -extern BOOL allow_custom; /* TRUE => custom builtins allowed */ -extern void showcustom(void); /* print custom functions */ -extern void customhelp(char *); /* direct custom help */ -extern CONST struct custom cust[]; /* custom interface table */ +E_FUNC VALUE custom(char*, int, VALUE**); /* master custom interface */ +EXTERN BOOL allow_custom; /* TRUE => custom builtins allowed */ +E_FUNC void showcustom(void); /* print custom functions */ +E_FUNC void customhelp(char *); /* direct custom help */ +EXTERN CONST struct custom cust[]; /* custom interface table */ #endif /* !CUSTOM_H */ diff --git a/custom/HOW_TO_ADD b/custom/HOW_TO_ADD index 36395df..5abc969 100644 --- a/custom/HOW_TO_ADD +++ b/custom/HOW_TO_ADD @@ -480,18 +480,18 @@ Step 6: Register the function in the custom interface table * * Declare custom functions as follows: * - * extern VALUE c_xyz(char*, int, VALUE**); + * E_FUNC VALUE c_xyz(char*, int, VALUE**); * * We suggest that you sort the entries below by name. */ - extern VALUE c_argv(char*, int, VALUE**); - extern VALUE c_devnull(char*, int, VALUE**); - extern VALUE c_help(char*, int, VALUE**); - extern VALUE c_sysinfo(char*, int, VALUE**); + E_FUNC VALUE c_argv(char*, int, VALUE**); + E_FUNC VALUE c_devnull(char*, int, VALUE**); + E_FUNC VALUE c_help(char*, int, VALUE**); + E_FUNC VALUE c_sysinfo(char*, int, VALUE**); For u_curds we would add the line: - extern VALUE u_curds(char*, int, VALUE**); + E_FUNC VALUE u_curds(char*, int, VALUE**); Step 7: Add the required information to the custom/Makefile @@ -631,7 +631,7 @@ Step 12: Contribute and consider submitting your custom function for possible inclusion in later versions of calc. -## Copyright (C) 1999-2004 Landon Curt Noll +## Copyright (C) 1999-2007 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 @@ -647,8 +647,8 @@ Step 12: Contribute ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.5 $ -## @(#) $Id: HOW_TO_ADD,v 29.5 2005/10/18 11:18:34 chongo Exp $ +## @(#) $Revision: 29.6 $ +## @(#) $Id: HOW_TO_ADD,v 29.6 2007/02/11 10:22:46 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/HOW_TO_ADD,v $ ## ## Under source code control: 1997/03/10 03:03:21 diff --git a/custom/Makefile b/custom/Makefile index 85255f4..d2d280c 100644 --- a/custom/Makefile +++ b/custom/Makefile @@ -18,8 +18,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.29 $ -# @(#) $Id: Makefile,v 29.29 2006/09/18 13:13:25 chongo Exp $ +# @(#) $Revision: 29.30 $ +# @(#) $Id: Makefile,v 29.30 2007/02/11 10:22:29 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $ # # Under source code control: 1997/03/09 02:28:54 @@ -845,6 +845,7 @@ c_argv.o: ../calcerr.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: ../hash.h c_argv.o: ../have_const.h @@ -862,7 +863,6 @@ c_argv.o: ../shs.h c_argv.o: ../shs1.h c_argv.o: ../string.h c_argv.o: ../value.h -c_argv.o: ../win32dll.h c_argv.o: ../zmath.h c_argv.o: c_argv.c c_devnull.o: ../alloc.h @@ -872,6 +872,7 @@ c_devnull.o: ../calcerr.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: ../hash.h c_devnull.o: ../have_const.h @@ -889,7 +890,6 @@ c_devnull.o: ../shs.h c_devnull.o: ../shs1.h c_devnull.o: ../string.h c_devnull.o: ../value.h -c_devnull.o: ../win32dll.h c_devnull.o: ../zmath.h c_devnull.o: c_devnull.c c_help.o: ../alloc.h @@ -899,6 +899,7 @@ c_help.o: ../calcerr.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: ../hash.h c_help.o: ../have_const.h @@ -916,7 +917,6 @@ c_help.o: ../shs.h c_help.o: ../shs1.h c_help.o: ../string.h c_help.o: ../value.h -c_help.o: ../win32dll.h c_help.o: ../zmath.h c_help.o: c_help.c c_pmodm127.o: ../alloc.h @@ -926,6 +926,7 @@ c_pmodm127.o: ../calcerr.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: ../hash.h c_pmodm127.o: ../have_const.h @@ -943,7 +944,6 @@ c_pmodm127.o: ../shs.h c_pmodm127.o: ../shs1.h c_pmodm127.o: ../string.h c_pmodm127.o: ../value.h -c_pmodm127.o: ../win32dll.h c_pmodm127.o: ../zmath.h c_pmodm127.o: c_pmodm127.c c_pzasusb8.o: ../alloc.h @@ -953,6 +953,7 @@ c_pzasusb8.o: ../calcerr.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: ../hash.h c_pzasusb8.o: ../have_const.h @@ -970,7 +971,6 @@ c_pzasusb8.o: ../shs.h c_pzasusb8.o: ../shs1.h c_pzasusb8.o: ../string.h c_pzasusb8.o: ../value.h -c_pzasusb8.o: ../win32dll.h c_pzasusb8.o: ../zmath.h c_pzasusb8.o: c_pzasusb8.c c_sysinfo.o: ../alloc.h @@ -982,6 +982,7 @@ c_sysinfo.o: ../cmath.h c_sysinfo.o: ../conf.h c_sysinfo.o: ../config.h c_sysinfo.o: ../custom.h +c_sysinfo.o: ../decl.h c_sysinfo.o: ../endian_calc.h c_sysinfo.o: ../fposval.h c_sysinfo.o: ../hash.h @@ -1002,7 +1003,6 @@ c_sysinfo.o: ../shs.h c_sysinfo.o: ../shs1.h c_sysinfo.o: ../string.h c_sysinfo.o: ../value.h -c_sysinfo.o: ../win32dll.h c_sysinfo.o: ../zmath.h c_sysinfo.o: ../zrand.h c_sysinfo.o: ../zrandom.h @@ -1014,6 +1014,7 @@ custtbl.o: ../calcerr.h custtbl.o: ../cmath.h custtbl.o: ../config.h custtbl.o: ../custom.h +custtbl.o: ../decl.h custtbl.o: ../endian_calc.h custtbl.o: ../hash.h custtbl.o: ../have_const.h @@ -1030,6 +1031,5 @@ custtbl.o: ../shs.h custtbl.o: ../shs1.h custtbl.o: ../string.h custtbl.o: ../value.h -custtbl.o: ../win32dll.h custtbl.o: ../zmath.h custtbl.o: custtbl.c diff --git a/custom/c_pmodm127.c b/custom/c_pmodm127.c index 4875249..661da95 100644 --- a/custom/c_pmodm127.c +++ b/custom/c_pmodm127.c @@ -1,7 +1,7 @@ /* * c_pmodm127 - calculate q mod 2^(2^127-1) * - * Copyright (C) 2004 Landon Curt Noll + * Copyright (C) 2004-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.5 $ - * @(#) $Id: c_pmodm127.c,v 29.5 2006/06/25 22:08:42 chongo Exp $ + * @(#) $Revision: 29.6 $ + * @(#) $Id: c_pmodm127.c,v 29.6 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_pmodm127.c,v $ * * Under source code control: 2004/07/28 22:12:25 @@ -40,7 +40,7 @@ #include "../have_unused.h" /* 2^255 */ -static HALF h255[] = { +STATIC HALF h255[] = { #if BASEB == 32 (HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x80000000 @@ -57,10 +57,10 @@ ZVALUE p255 = { /* static declarations */ -static void zmod5_or_zmod(ZVALUE *zp); -static BOOL havelastmod = FALSE; -static ZVALUE lastmod[1]; -static ZVALUE lastmodinv[1]; +S_FUNC void zmod5_or_zmod(ZVALUE *zp); +STATIC BOOL havelastmod = FALSE; +STATIC ZVALUE lastmod[1]; +STATIC ZVALUE lastmodinv[1]; /* @@ -187,7 +187,7 @@ c_pmodm127(char UNUSED *name, int UNUSED count, VALUE **vals) * the result of the zmod5_or_zmod conditions do not apply to the argument * and saved mod. */ -static void +S_FUNC void zmod5_or_zmod(ZVALUE *zp) { LEN len, modlen, j; diff --git a/custom/c_sysinfo.c b/custom/c_sysinfo.c index 593ebb4..10d0474 100644 --- a/custom/c_sysinfo.c +++ b/custom/c_sysinfo.c @@ -1,7 +1,7 @@ /* * c_sysinfo - names and values of selected #defines * - * Copyright (C) 1999,2004 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.12 $ - * @(#) $Id: c_sysinfo.c,v 29.12 2006/09/18 06:28:47 chongo Exp $ + * @(#) $Revision: 29.13 $ + * @(#) $Id: c_sysinfo.c,v 29.13 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $ * * Under source code control: 1997/03/09 23:14:40 @@ -64,7 +64,7 @@ struct infoname { char *str; /* non-NULL ==> value of #define is a string */ FULL nmbr; /* if str==NULL ==> value fo #define as a FULL */ }; -static struct infoname sys_info[] = { +STATIC struct infoname sys_info[] = { {"S100", "slots in an subtractive 100 table", NULL, (FULL)S100}, {"BASE", "base for calculations", NULL, (FULL)BASE}, {"BASE1", "one less than base", NULL, (FULL)BASE}, @@ -160,9 +160,9 @@ static struct infoname sys_info[] = { /* * forward declarations */ -static void dump_name_meaning(void); /* custom("sysinfo", 0) */ -static void dump_name_value(void); /* custom("sysinfo", 1) */ -static void dump_mening_value(void); /* custom("sysinfo", 2) */ +S_FUNC void dump_name_meaning(void); /* custom("sysinfo", 0) */ +S_FUNC void dump_name_value(void); /* custom("sysinfo", 1) */ +S_FUNC void dump_mening_value(void); /* custom("sysinfo", 2) */ /* @@ -290,7 +290,7 @@ c_sysinfo(char UNUSED *name, int count, VALUE **vals) /* * dump_name_meaning - print all infonames and meanings */ -static void +S_FUNC void dump_name_meaning(void) { struct infoname *p; /* current infoname */ @@ -307,7 +307,7 @@ dump_name_meaning(void) /* * dump_name_value - print all infonames and values */ -static void +S_FUNC void dump_name_value(void) { struct infoname *p; /* current infoname */ @@ -338,7 +338,7 @@ dump_name_value(void) /* * dump_mening_value - print all values and meanings */ -static void +S_FUNC void dump_mening_value(void) { struct infoname *p; /* current infoname */ diff --git a/custom/custtbl.c b/custom/custtbl.c index b056b4e..cef72b9 100644 --- a/custom/custtbl.c +++ b/custom/custtbl.c @@ -1,7 +1,7 @@ /* * custtbl - custom interface table * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: custtbl.c,v 29.4 2005/02/05 06:16:19 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: custtbl.c,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/custtbl.c,v $ * * Under source code control: 1997/03/09 02:28:54 @@ -47,16 +47,16 @@ * * Declare custom functions as follows: * - * extern VALUE c_xyz(char*, int, VALUE**); + * E_FUNC VALUE c_xyz(char*, int, VALUE**); * * We suggest that you sort the entries below by name. */ -extern VALUE c_argv(char*, int, VALUE**); -extern VALUE c_devnull(char*, int, VALUE**); -extern VALUE c_help(char*, int, VALUE**); -extern VALUE c_sysinfo(char*, int, VALUE**); -extern VALUE c_pzasusb8(char*, int, VALUE**); -extern VALUE c_pmodm127(char*, int, VALUE**); +E_FUNC VALUE c_argv(char*, int, VALUE**); +E_FUNC VALUE c_devnull(char*, int, VALUE**); +E_FUNC VALUE c_help(char*, int, VALUE**); +E_FUNC VALUE c_sysinfo(char*, int, VALUE**); +E_FUNC VALUE c_pzasusb8(char*, int, VALUE**); +E_FUNC VALUE c_pmodm127(char*, int, VALUE**); #endif /* CUSTOM */ diff --git a/decl.h b/decl.h new file mode 100644 index 0000000..cbf0704 --- /dev/null +++ b/decl.h @@ -0,0 +1,94 @@ +/* + * decl - variable and function declaration macros + * + * Copyright (C) 2007 Landon Curt Noll + * + * Primary author: 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. + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * @(#) $Revision: 29.2 $ + * @(#) $Id: decl.h,v 29.2 2007/02/11 10:19:14 chongo Exp $ + * @(#) $Source: /usr/local/src/cmd/calc/RCS/decl.h,v $ + * + * Under source code control: 2007/02/09 05:24:25 + * File existed as early as: 2007 + * + * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ + */ + + +#include "have_const.h" + + +#if !defined(__DECL_H__) +#define __DECL_H__ + + +/* + * Mac OS X macros that promote thread safety + */ +#if defined(MACOSX_TLS) + + + /* variable related macros */ +# define EXTERN extern __thread +# define STATIC static __thread + + /* function related macros */ +# define E_FUNC extern +# define S_FUNC static + + +/* + * MS windoz macros + */ +#elif defined(_WIN32) || defined(WINDOZ) + + + /* determine which type of DLL we must generate */ +# if defined(_EXPORTING) +# define DLL __declspec(dllexport) +# else +# define DLL __declspec(dllimport) +# endif + + /* variable related macros */ +# define EXTERN extern DLL +# define STATIC static + + /* function related macros */ +# define E_FUNC extern DLL +# define S_FUNC static + + +/* + * default macros + */ +#else + + + /* variable related macros */ +# define EXTERN extern +# define STATIC static + + /* function related macros */ +# define E_FUNC extern +# define S_FUNC static + + +#endif + +#endif /* !__DECL_H__ */ diff --git a/file.c b/file.c index b264126..8dd2819 100644 --- a/file.c +++ b/file.c @@ -1,7 +1,7 @@ /* * file - file I/O routines callable by users * - * Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll + * Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.16 $ - * @(#) $Id: file.c,v 29.16 2006/08/20 15:01:30 chongo Exp $ + * @(#) $Revision: 29.17 $ + * @(#) $Id: file.c,v 29.17 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $ * * Under source code control: 1991/07/20 00:21:56 @@ -57,8 +57,8 @@ /* * external STDIO functions */ -extern void math_setfp(FILE *fp); -extern FILE *f_open(char *name, char *mode); +E_FUNC void math_setfp(FILE *fp); +E_FUNC FILE *f_open(char *name, char *mode); /* @@ -66,7 +66,7 @@ extern FILE *f_open(char *name, char *mode); * The first three entries always correspond to stdin, stdout, and stderr, * and cannot be closed. Their file ids are always 0, 1, and 2. */ -static FILEIO files[MAXFILES] = { +STATIC FILEIO files[MAXFILES] = { {FILEID_STDIN, NULL, (dev_t)0, (ino_t)0, "(stdin)", TRUE, FALSE, FALSE, FALSE, 'r', "r"}, {FILEID_STDOUT, NULL, (dev_t)0, (ino_t)0, @@ -76,28 +76,28 @@ static FILEIO files[MAXFILES] = { }; -static int ioindex[MAXFILES] = {0,1,2}; /* Indices for FILEIO table */ -static FILEID lastid = FILEID_STDERR; /* Last allocated file id */ -static int idnum = 3; /* Number of allocated file ids */ +STATIC int ioindex[MAXFILES] = {0,1,2}; /* Indices for FILEIO table */ +STATIC FILEID lastid = FILEID_STDERR; /* Last allocated file id */ +STATIC int idnum = 3; /* Number of allocated file ids */ /* forward static declarations */ -static ZVALUE filepos2z(FILEPOS pos); -static FILEPOS z2filepos(ZVALUE pos); -static int set_open_pos(FILE *fp, ZVALUE zpos); -static int get_open_pos(FILE *fp, ZVALUE *res); -static ZVALUE off_t2z(off_t siz); -static ZVALUE dev2z(dev_t dev); -static ZVALUE inode2z(ino_t inode); -static void getscanfield(FILE *fp, BOOL skip, unsigned int width, +S_FUNC ZVALUE filepos2z(FILEPOS pos); +S_FUNC FILEPOS z2filepos(ZVALUE pos); +S_FUNC int set_open_pos(FILE *fp, ZVALUE zpos); +S_FUNC int get_open_pos(FILE *fp, ZVALUE *res); +S_FUNC ZVALUE off_t2z(off_t siz); +S_FUNC ZVALUE dev2z(dev_t dev); +S_FUNC ZVALUE inode2z(ino_t inode); +S_FUNC void getscanfield(FILE *fp, BOOL skip, unsigned int width, int scannum, char *scanptr, char **strptr); -static void getscanwhite(FILE *fp, BOOL skip, unsigned int width, +S_FUNC void getscanwhite(FILE *fp, BOOL skip, unsigned int width, int scannum, char **strptr); -static int fscanfile(FILE *fp, char *fmt, int count, VALUE **vals); -static void freadnum(FILE *fp, VALUE *valptr); -static void freadsum(FILE *fp, VALUE *valptr); -static void freadprod(FILE *fp, VALUE *valptr); -static void fskipnum(FILE *fp); +S_FUNC int fscanfile(FILE *fp, char *fmt, int count, VALUE **vals); +S_FUNC void freadnum(FILE *fp, VALUE *valptr); +S_FUNC void freadsum(FILE *fp, VALUE *valptr); +S_FUNC void freadprod(FILE *fp, VALUE *valptr); +S_FUNC void fskipnum(FILE *fp); /* @@ -112,7 +112,7 @@ static void fskipnum(FILE *fp); void file_init(void) { - static int done = 0; /* 1 => routine already called */ + STATIC int done = 0; /* 1 => routine already called */ struct stat sbuf; /* file status */ FILEIO *fiop; FILE *fp; @@ -202,7 +202,7 @@ file_init(void) * id calc file ID * fp open file stream */ -static void +S_FUNC void init_fileio(FILEIO *fiop, char *name, char *mode, struct stat *sbufp, FILEID id, FILE *fp) { @@ -1352,7 +1352,7 @@ rewindall(void) * NOTE: Does not support negative file positions. */ /*ARGSUSED*/ -static ZVALUE +S_FUNC ZVALUE filepos2z(FILEPOS pos) { ZVALUE ret; /* ZVALUE file position to return */ @@ -1385,7 +1385,7 @@ filepos2z(FILEPOS pos) * * NOTE: Does not support negative file positions. */ -static FILEPOS +S_FUNC FILEPOS z2filepos(ZVALUE zpos) { #if FILEPOS_BITS > FULL_BITS @@ -1462,7 +1462,7 @@ z2filepos(ZVALUE zpos) * 0 res points to the file position * -1 error */ -static int +S_FUNC int get_open_pos(FILE *fp, ZVALUE *res) { FILEPOS pos; /* current file position */ @@ -1622,7 +1622,7 @@ fseekid(FILEID id, ZVALUE offset, int whence) * NOTE: Due to fsetpos limitation, position is set relative to only * the beginning of the file. */ -static int +S_FUNC int set_open_pos(FILE *fp, ZVALUE zpos) { FILEPOS pos; /* current file position */ @@ -1706,7 +1706,7 @@ setloc(FILEID id, ZVALUE zpos) * file size as a ZVALUE */ /*ARGSUSED*/ -static ZVALUE +S_FUNC ZVALUE off_t2z(off_t siz) { ZVALUE ret; /* ZVALUE file size to return */ @@ -1737,7 +1737,7 @@ off_t2z(off_t siz) * returns: * file size as a ZVALUE */ -static ZVALUE +S_FUNC ZVALUE dev2z(dev_t dev) { ZVALUE ret; /* ZVALUE file size to return */ @@ -1769,7 +1769,7 @@ dev2z(dev_t dev) * file size as a ZVALUE */ /*ARGSUSED*/ -static ZVALUE +S_FUNC ZVALUE inode2z(ino_t inode) { ZVALUE ret; /* ZVALUE file size to return */ @@ -1927,7 +1927,7 @@ get_inode(FILEID id, ZVALUE *inode) } -static off_t +S_FUNC off_t filesize(FILEIO *fiop) { struct stat sbuf; @@ -2025,7 +2025,7 @@ showfiles(void) * scanptr string of characters considered separators * strptr pointer to where the new field pointer may be found */ -static void +S_FUNC void getscanfield(FILE *fp, BOOL skip, unsigned int width, int scannum, char *scanptr, char **strptr) { char *str; /* current string */ @@ -2103,7 +2103,7 @@ getscanfield(FILE *fp, BOOL skip, unsigned int width, int scannum, char *scanptr * scannum Number of characters in scanset * strptr pointer to where the new field pointer may be found */ -static void +S_FUNC void getscanwhite(FILE *fp, BOOL skip, unsigned int width, int scannum, char **strptr) { char *str; /* current string */ @@ -2170,7 +2170,7 @@ getscanwhite(FILE *fp, BOOL skip, unsigned int width, int scannum, char **strptr } -static int +S_FUNC int fscanfile(FILE *fp, char *fmt, int count, VALUE **vals) { int assnum; /* Number of assignments made */ @@ -2364,7 +2364,7 @@ scanfstr(char *str, char *fmt, int count, VALUE **vals) * a sign immediately following 'e' or 'E', or a dot is encountered. * Absence of digits is interpreted as zero. */ -static void +S_FUNC void freadnum(FILE *fp, VALUE *valptr) { ZVALUE num, zden, newnum, newden, div, tmp; @@ -2502,7 +2502,7 @@ freadnum(FILE *fp, VALUE *valptr) } -static void +S_FUNC void freadsum(FILE *fp, VALUE *valptr) { VALUE v1, v2, v3; @@ -2528,7 +2528,7 @@ freadsum(FILE *fp, VALUE *valptr) } -static void +S_FUNC void freadprod(FILE *fp, VALUE *valptr) { VALUE v1, v2, v3; @@ -2552,7 +2552,7 @@ freadprod(FILE *fp, VALUE *valptr) } -static void +S_FUNC void fskipnum(FILE *fp) { char ch; diff --git a/file.h b/file.h index 3f54a5b..3f301f9 100644 --- a/file.h +++ b/file.h @@ -1,7 +1,7 @@ /* * file - file I/O routines callable by users * - * Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll + * Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.8 $ - * @(#) $Id: file.h,v 29.8 2006/05/19 15:26:10 chongo Exp $ + * @(#) $Revision: 29.9 $ + * @(#) $Id: file.h,v 29.9 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/file.h,v $ * * Under source code control: 1996/05/24 05:55:58 @@ -91,12 +91,12 @@ typedef struct { /* * external functions */ -extern DLL FILEIO * findid(FILEID id, int writable); -extern DLL int fgetposid(FILEID id, FILEPOS *ptr); -extern DLL int fsetposid(FILEID id, FILEPOS *ptr); -extern DLL int get_open_siz(FILE *fp, ZVALUE *res); -extern DLL char* findfname(FILEID); -extern DLL FILE *f_pathopen(char *name, char *mode, char *pathlist, char **openpath); +E_FUNC FILEIO * findid(FILEID id, int writable); +E_FUNC int fgetposid(FILEID id, FILEPOS *ptr); +E_FUNC int fsetposid(FILEID id, FILEPOS *ptr); +E_FUNC int get_open_siz(FILE *fp, ZVALUE *res); +E_FUNC char* findfname(FILEID); +E_FUNC FILE *f_pathopen(char *name, char *mode, char *pathlist, char **openpath); #endif /* !__FILE_H__ */ diff --git a/func.c b/func.c index 101b333..7214427 100644 --- a/func.c +++ b/func.c @@ -1,7 +1,7 @@ /* * func - built-in functions implemented here * - * Copyright (C) 1999-2006 David I. Bell, Landon Curt Noll and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.32 $ - * @(#) $Id: func.c,v 29.32 2006/12/16 10:46:07 chongo Exp $ + * @(#) $Revision: 29.33 $ + * @(#) $Id: func.c,v 29.33 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $ * * Under source code control: 1990/02/15 01:48:15 @@ -35,6 +35,7 @@ #include #include + #if defined(_WIN32) # include # define _access access @@ -43,9 +44,14 @@ #if defined(FUNCLIST) #define CONST /* disabled for FUNCLIST in case NATIVE_CC doesn't have it */ +#undef HAVE_CONST + +#include "decl.h" #else /* FUNCLIST */ +#include "decl.h" + #include "have_unistd.h" #if defined(HAVE_UNISTD_H) #include @@ -113,25 +119,25 @@ /* * forward declarations */ -static NUMBER *base_value(long mode, int defval); -static int strscan(char *s, int count, VALUE **vals); -static int filescan(FILEID id, int count, VALUE **vals); -static VALUE f_eval(VALUE *vp); -static VALUE f_fsize(VALUE *vp); -static int malloced_putenv(char *str); +S_FUNC NUMBER *base_value(long mode, int defval); +S_FUNC int strscan(char *s, int count, VALUE **vals); +S_FUNC int filescan(FILEID id, int count, VALUE **vals); +S_FUNC VALUE f_eval(VALUE *vp); +S_FUNC VALUE f_fsize(VALUE *vp); +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 */ -extern void matrandperm(MATRIX *M); -extern void listrandperm(LIST *lp); -extern int idungetc(FILEID id, int ch); -extern LIST* associndices(ASSOC *ap, long index); -extern LIST* matindices(MATRIX *mp, long index); +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); +E_FUNC LIST* associndices(ASSOC *ap, long index); +E_FUNC LIST* matindices(MATRIX *mp, long index); /* @@ -142,16 +148,16 @@ struct env_pool { char *getenv; /* what getenv() would return, NULL => unused */ char *putenv; /* pointer given to putenv() */ }; -static int env_pool_cnt = 0; /* number of env_pool elements in use */ -static int env_pool_max = 0; /* number of env_pool elements allocated */ -static struct env_pool *e_pool = NULL; /* env_pool elements */ +STATIC int env_pool_cnt = 0; /* number of env_pool elements in use */ +STATIC int env_pool_max = 0; /* number of env_pool elements allocated */ +STATIC struct env_pool *e_pool = NULL; /* env_pool elements */ /* * user-defined error strings */ -static short nexterrnum = E_USERDEF; -static STRINGHEAD newerrorstr; +STATIC short nexterrnum = E_USERDEF; +STATIC STRINGHEAD newerrorstr; #endif /* !FUNCLIST */ @@ -181,7 +187,7 @@ struct builtin { #if !defined(FUNCLIST) -static VALUE +S_FUNC VALUE f_eval(VALUE *vp) { FUNC *oldfunc; @@ -235,7 +241,7 @@ f_eval(VALUE *vp) } -static VALUE +S_FUNC VALUE f_prompt(VALUE *vp) { VALUE result; @@ -272,7 +278,7 @@ f_prompt(VALUE *vp) } -static VALUE +S_FUNC VALUE f_display(int count, VALUE **vals) { LEN oldvalue; @@ -298,7 +304,7 @@ f_display(int count, VALUE **vals) /*ARGSUSED*/ -static VALUE +S_FUNC VALUE f_null(int UNUSED count, VALUE UNUSED **vals) { VALUE res; @@ -311,7 +317,7 @@ f_null(int UNUSED count, VALUE UNUSED **vals) } -static VALUE +S_FUNC VALUE f_str(VALUE *vp) { VALUE result; @@ -350,7 +356,7 @@ f_str(VALUE *vp) } -static VALUE +S_FUNC VALUE f_estr(VALUE *vp) { VALUE result; @@ -368,7 +374,7 @@ f_estr(VALUE *vp) } -static VALUE +S_FUNC VALUE f_name(VALUE *vp) { VALUE result; @@ -404,7 +410,7 @@ f_name(VALUE *vp) -static VALUE +S_FUNC VALUE f_poly(int count, VALUE **vals) { VALUE *x; @@ -443,7 +449,7 @@ f_poly(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_mne(NUMBER *val1, NUMBER *val2, NUMBER *val3) { NUMBER *tmp, *res; @@ -455,7 +461,7 @@ f_mne(NUMBER *val1, NUMBER *val2, NUMBER *val3) } -static NUMBER * +S_FUNC NUMBER * f_isrel(NUMBER *val1, NUMBER *val2) { if (qisfrac(val1) || qisfrac(val2)) { @@ -466,14 +472,14 @@ f_isrel(NUMBER *val1, NUMBER *val2) } -static NUMBER * +S_FUNC NUMBER * f_issquare(NUMBER *vp) { return itoq((long) qissquare(vp)); } -static NUMBER * +S_FUNC NUMBER * f_isprime(int count, NUMBER **vals) { NUMBER *err; /* error return, NULL => use math_error */ @@ -513,7 +519,7 @@ f_isprime(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_nprime(int count, NUMBER **vals) { NUMBER *err; /* error return, NULL => use math_error */ @@ -557,7 +563,7 @@ f_nprime(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_pprime(int count, NUMBER **vals) { NUMBER *err; /* error return, NULL => use math_error */ @@ -605,7 +611,7 @@ f_pprime(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_factor(int count, NUMBER **vals) { NUMBER *err; /* error return, NULL => use math_error */ @@ -678,7 +684,7 @@ f_factor(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_pix(int count, NUMBER **vals) { NUMBER *err; /* error return, NULL => use math_error */ @@ -719,7 +725,7 @@ f_pix(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_prevcand(int count, NUMBER **vals) { ZVALUE zmodulus; @@ -800,7 +806,7 @@ f_prevcand(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_nextcand(int count, NUMBER **vals) { ZVALUE zmodulus; @@ -886,14 +892,14 @@ f_nextcand(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_seed(void) { return pseudo_seed(); } -static NUMBER * +S_FUNC NUMBER * f_rand(int count, NUMBER **vals) { NUMBER *ans; @@ -940,7 +946,7 @@ f_rand(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_randbit(int count, NUMBER **vals) { NUMBER *ans; @@ -988,7 +994,7 @@ f_randbit(int count, NUMBER **vals) } -static VALUE +S_FUNC VALUE f_srand(int count, VALUE **vals) { VALUE result; @@ -1044,7 +1050,7 @@ f_srand(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_random(int count, NUMBER **vals) { NUMBER *ans; @@ -1091,7 +1097,7 @@ f_random(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_randombit(int count, NUMBER **vals) { NUMBER *ans; @@ -1139,7 +1145,7 @@ f_randombit(int count, NUMBER **vals) } -static VALUE +S_FUNC VALUE f_srandom(int count, VALUE **vals) { VALUE result; @@ -1230,7 +1236,7 @@ f_srandom(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_primetest(int count, NUMBER **vals) { /* parse args */ @@ -1244,7 +1250,7 @@ f_primetest(int count, NUMBER **vals) } -static VALUE +S_FUNC VALUE f_setbit(int count, VALUE **vals) { BOOL r; @@ -1270,7 +1276,7 @@ f_setbit(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_digit(int count, VALUE **vals) { VALUE res; @@ -1298,7 +1304,7 @@ f_digit(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_digits(int count, VALUE **vals) { ZVALUE base; @@ -1320,7 +1326,7 @@ f_digits(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_places(int count, VALUE **vals) { long places; @@ -1343,7 +1349,7 @@ f_places(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_popcnt(int count, NUMBER **vals) { int bitval = 1; @@ -1367,7 +1373,7 @@ f_popcnt(int count, NUMBER **vals) } -static VALUE +S_FUNC VALUE f_xor(int count, VALUE **vals) { NUMBER *q, *qtmp; @@ -1515,7 +1521,7 @@ maxlistitems(LIST *lp) } -static VALUE +S_FUNC VALUE f_min(int count, VALUE **vals) { VALUE min; @@ -1571,7 +1577,7 @@ f_min(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_max(int count, VALUE **vals) { VALUE max; @@ -1627,7 +1633,7 @@ f_max(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_gcd(int count, NUMBER **vals) { NUMBER *val, *tmp; @@ -1642,7 +1648,7 @@ f_gcd(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_lcm(int count, NUMBER **vals) { NUMBER *val, *tmp; @@ -1659,7 +1665,7 @@ f_lcm(int count, NUMBER **vals) } -static VALUE +S_FUNC VALUE f_hash(int count, VALUE **vals) { QCKHASH hash; @@ -1723,7 +1729,7 @@ sumlistitems(LIST *lp) } -static VALUE +S_FUNC VALUE f_sum(int count, VALUE **vals) { VALUE tmp; @@ -1767,7 +1773,7 @@ f_sum(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_avg(int count, VALUE **vals) { VALUE tmp; @@ -1809,7 +1815,7 @@ f_avg(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_fact(VALUE *vp) { VALUE res; @@ -1830,7 +1836,7 @@ f_fact(VALUE *vp) } -static VALUE +S_FUNC VALUE f_hmean(int count, VALUE **vals) { VALUE sum, tmp1, tmp2; @@ -1869,7 +1875,7 @@ f_hmean(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_hnrmod(NUMBER *val1, NUMBER *val2, NUMBER *val3, NUMBER *val4) { ZVALUE answer; /* v mod h*2^n+r */ @@ -1942,7 +1948,7 @@ ssqlistitems(LIST *lp) return sum; } -static VALUE +S_FUNC VALUE f_ssq(int count, VALUE **vals) { VALUE tmp; @@ -1975,14 +1981,14 @@ f_ssq(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_ismult(NUMBER *val1, NUMBER *val2) { return itoq((long) qdivides(val1, val2)); } -static NUMBER * +S_FUNC NUMBER * f_meq(NUMBER *val1, NUMBER *val2, NUMBER *val3) { NUMBER *tmp, *res; @@ -1994,7 +2000,7 @@ f_meq(NUMBER *val1, NUMBER *val2, NUMBER *val3) } -static VALUE +S_FUNC VALUE f_exp(int count, VALUE **vals) { VALUE result; @@ -2038,7 +2044,7 @@ f_exp(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_ln(int count, VALUE **vals) { VALUE result; @@ -2083,7 +2089,7 @@ f_ln(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_log(int count, VALUE **vals) { VALUE result; @@ -2128,7 +2134,7 @@ f_log(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_cos(int count, VALUE **vals) { VALUE result; @@ -2168,7 +2174,7 @@ f_cos(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_sin(int count, VALUE **vals) { VALUE result; @@ -2208,7 +2214,7 @@ f_sin(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_tan(int count, VALUE **vals) { VALUE result; @@ -2246,7 +2252,7 @@ f_tan(int count, VALUE **vals) return result; } -static VALUE +S_FUNC VALUE f_sec(int count, VALUE **vals) { VALUE result; @@ -2281,7 +2287,7 @@ f_sec(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_cot(int count, VALUE **vals) { VALUE result; @@ -2322,7 +2328,7 @@ f_cot(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_csc(int count, VALUE **vals) { VALUE result; @@ -2358,7 +2364,7 @@ f_csc(int count, VALUE **vals) return result; } -static VALUE +S_FUNC VALUE f_sinh(int count, VALUE **vals) { VALUE result; @@ -2401,7 +2407,7 @@ f_sinh(int count, VALUE **vals) return result; } -static VALUE +S_FUNC VALUE f_cosh(int count, VALUE **vals) { VALUE result; @@ -2445,7 +2451,7 @@ f_cosh(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_tanh(int count, VALUE **vals) { VALUE result; @@ -2484,7 +2490,7 @@ f_tanh(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_coth(int count, VALUE **vals) { VALUE result; @@ -2525,7 +2531,7 @@ f_coth(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_sech(int count, VALUE **vals) { VALUE result; @@ -2560,7 +2566,7 @@ f_sech(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_csch(int count, VALUE **vals) { VALUE result; @@ -2597,7 +2603,7 @@ f_csch(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_atan(int count, VALUE **vals) { VALUE result; @@ -2637,7 +2643,7 @@ f_atan(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_acot(int count, VALUE **vals) { VALUE result; @@ -2676,7 +2682,7 @@ f_acot(int count, VALUE **vals) return result; } -static VALUE +S_FUNC VALUE f_asin(int count, VALUE **vals) { VALUE result; @@ -2722,7 +2728,7 @@ f_asin(int count, VALUE **vals) return result; } -static VALUE +S_FUNC VALUE f_acos(int count, VALUE **vals) { VALUE result; @@ -2769,7 +2775,7 @@ f_acos(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_asec(int count, VALUE **vals) { VALUE result; @@ -2822,7 +2828,7 @@ f_asec(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_acsc(int count, VALUE **vals) { VALUE result; @@ -2875,7 +2881,7 @@ f_acsc(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_asinh(int count, VALUE **vals) { VALUE result; @@ -2913,7 +2919,7 @@ f_asinh(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_acosh(int count, VALUE **vals) { VALUE result; @@ -2960,7 +2966,7 @@ f_acosh(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_atanh(int count, VALUE **vals) { VALUE result; @@ -3011,7 +3017,7 @@ f_atanh(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_acoth(int count, VALUE **vals) { VALUE result; @@ -3062,7 +3068,7 @@ f_acoth(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_asech(int count, VALUE **vals) { VALUE result; @@ -3115,7 +3121,7 @@ f_asech(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_acsch(int count, VALUE **vals) { VALUE result; @@ -3168,7 +3174,7 @@ f_acsch(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_gd(int count, VALUE **vals) { VALUE result; @@ -3217,7 +3223,7 @@ f_gd(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_agd(int count, VALUE **vals) { VALUE result; @@ -3266,7 +3272,7 @@ f_agd(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_comb(VALUE *v1, VALUE *v2) { long n; @@ -3323,7 +3329,7 @@ f_comb(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_bern(VALUE *vp) { VALUE res; @@ -3340,7 +3346,7 @@ f_bern(VALUE *vp) } -static VALUE +S_FUNC VALUE f_freebern(void) { VALUE res; @@ -3352,7 +3358,7 @@ f_freebern(void) } -static VALUE +S_FUNC VALUE f_euler(VALUE *vp) { VALUE res; @@ -3368,7 +3374,7 @@ f_euler(VALUE *vp) } -static VALUE +S_FUNC VALUE f_freeeuler(void) { VALUE res; @@ -3380,7 +3386,7 @@ f_freeeuler(void) } -static VALUE +S_FUNC VALUE f_catalan(VALUE *vp) { VALUE res; @@ -3395,7 +3401,7 @@ f_catalan(VALUE *vp) return res; } -static VALUE +S_FUNC VALUE f_arg(int count, VALUE **vals) { VALUE result; @@ -3433,14 +3439,14 @@ f_arg(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_legtoleg(NUMBER *val1, NUMBER *val2) { return qlegtoleg(val1, val2, FALSE); } -static NUMBER * +S_FUNC NUMBER * f_trunc(int count, NUMBER **vals) { NUMBER *val; @@ -3452,7 +3458,7 @@ f_trunc(int count, NUMBER **vals) } -static VALUE +S_FUNC VALUE f_bround(int count, VALUE **vals) { VALUE tmp1, tmp2, res; @@ -3475,7 +3481,7 @@ f_bround(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_appr(int count, VALUE **vals) { VALUE tmp1, tmp2, res; @@ -3499,7 +3505,7 @@ f_appr(int count, VALUE **vals) return res; } -static VALUE +S_FUNC VALUE f_round(int count, VALUE **vals) { VALUE tmp1, tmp2, res; @@ -3522,7 +3528,7 @@ f_round(int count, VALUE **vals) } -static NUMBER * +S_FUNC NUMBER * f_btrunc(int count, NUMBER **vals) { NUMBER *val; @@ -3534,7 +3540,7 @@ f_btrunc(int count, NUMBER **vals) } -static VALUE +S_FUNC VALUE f_quo(int count, VALUE **vals) { VALUE tmp, res; @@ -3552,7 +3558,7 @@ f_quo(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_mod(int count, VALUE **vals) { VALUE tmp, res; @@ -3569,7 +3575,7 @@ f_mod(int count, VALUE **vals) return res; } -static VALUE +S_FUNC VALUE f_quomod(int count, VALUE **vals) { VALUE *v1, *v2, *v3, *v4, *v5; @@ -3631,7 +3637,7 @@ f_quomod(int count, VALUE **vals) return result; } -static VALUE +S_FUNC VALUE f_mmin(VALUE *v1, VALUE *v2) { VALUE sixteen, res; @@ -3648,7 +3654,7 @@ f_mmin(VALUE *v1, VALUE *v2) } -static NUMBER * +S_FUNC NUMBER * f_near(int count, NUMBER **vals) { NUMBER *val; @@ -3660,7 +3666,7 @@ f_near(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_cfsim(int count, NUMBER **vals) { long R; @@ -3670,7 +3676,7 @@ f_cfsim(int count, NUMBER **vals) } -static NUMBER * +S_FUNC NUMBER * f_cfappr(int count, NUMBER **vals) { long R; @@ -3683,7 +3689,7 @@ f_cfappr(int count, NUMBER **vals) } -static VALUE +S_FUNC VALUE f_ceil(VALUE *val) { VALUE tmp, res; @@ -3699,7 +3705,7 @@ f_ceil(VALUE *val) } -static VALUE +S_FUNC VALUE f_floor(VALUE *val) { VALUE tmp1, tmp2, res; @@ -3718,7 +3724,7 @@ f_floor(VALUE *val) } -static VALUE +S_FUNC VALUE f_sqrt(int count, VALUE **vals) { VALUE tmp1, tmp2, result; @@ -3741,7 +3747,7 @@ f_sqrt(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_root(int count, VALUE **vals) { VALUE *vp, err, result; @@ -3762,7 +3768,7 @@ f_root(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_power(int count, VALUE **vals) { VALUE *vp, err, result; @@ -3783,7 +3789,7 @@ f_power(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_polar(int count, VALUE **vals) { VALUE *vp, err, result; @@ -3816,7 +3822,7 @@ f_polar(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_ilog(VALUE *v1, VALUE *v2) { VALUE res; @@ -3845,7 +3851,7 @@ f_ilog(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_ilog2(VALUE *vp) { VALUE res; @@ -3870,7 +3876,7 @@ f_ilog2(VALUE *vp) } -static VALUE +S_FUNC VALUE f_ilog10(VALUE *vp) { VALUE res; @@ -3895,7 +3901,7 @@ f_ilog10(VALUE *vp) } -static NUMBER * +S_FUNC NUMBER * f_faccnt(NUMBER *val1, NUMBER *val2) { if (qisfrac(val1) || qisfrac(val2)) @@ -3904,7 +3910,7 @@ f_faccnt(NUMBER *val1, NUMBER *val2) } -static VALUE +S_FUNC VALUE f_matfill(int count, VALUE **vals) { VALUE *v1, *v2, *v3; @@ -3941,7 +3947,7 @@ f_matfill(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_matsum(VALUE *vp) { VALUE result; @@ -3959,7 +3965,7 @@ f_matsum(VALUE *vp) } -static VALUE +S_FUNC VALUE f_isident(VALUE *vp) { VALUE result; @@ -3977,7 +3983,7 @@ f_isident(VALUE *vp) } -static VALUE +S_FUNC VALUE f_mattrace(VALUE *vp) { if (vp->v_type != V_MAT) @@ -3986,7 +3992,7 @@ f_mattrace(VALUE *vp) } -static VALUE +S_FUNC VALUE f_mattrans(VALUE *vp) { VALUE result; @@ -4004,7 +4010,7 @@ f_mattrans(VALUE *vp) } -static VALUE +S_FUNC VALUE f_det(VALUE *vp) { if (vp->v_type != V_MAT) @@ -4014,7 +4020,7 @@ f_det(VALUE *vp) } -static VALUE +S_FUNC VALUE f_matdim(VALUE *vp) { VALUE result; @@ -4037,7 +4043,7 @@ f_matdim(VALUE *vp) } -static VALUE +S_FUNC VALUE f_matmin(VALUE *v1, VALUE *v2) { VALUE result; @@ -4063,7 +4069,7 @@ f_matmin(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_matmax(VALUE *v1, VALUE *v2) { VALUE result; @@ -4089,7 +4095,7 @@ f_matmax(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_cp(VALUE *v1, VALUE *v2) { MATRIX *m1, *m2; @@ -4112,7 +4118,7 @@ f_cp(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_dp(VALUE *v1, VALUE *v2) { MATRIX *m1, *m2; @@ -4129,7 +4135,7 @@ f_dp(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_strlen(VALUE *vp) { VALUE result; @@ -4150,7 +4156,7 @@ f_strlen(VALUE *vp) } -static VALUE +S_FUNC VALUE f_strcmp(VALUE *v1, VALUE *v2) { VALUE result; @@ -4170,7 +4176,7 @@ f_strcmp(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_strncmp(VALUE *v1, VALUE *v2, VALUE *v3) { long n1, n2, n; @@ -4203,7 +4209,7 @@ f_strncmp(VALUE *v1, VALUE *v2, VALUE *v3) } -static VALUE +S_FUNC VALUE f_strcat(int count, VALUE **vals) { VALUE **vp; @@ -4247,7 +4253,7 @@ f_strcat(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_strcpy(VALUE *v1, VALUE *v2) { VALUE result; @@ -4263,7 +4269,7 @@ f_strcpy(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_strncpy(VALUE *v1, VALUE *v2, VALUE *v3) { VALUE result; @@ -4285,7 +4291,7 @@ f_strncpy(VALUE *v1, VALUE *v2, VALUE *v3) } -static VALUE +S_FUNC VALUE f_substr(VALUE *v1, VALUE *v2, VALUE *v3) { NUMBER *q1, *q2; @@ -4331,7 +4337,7 @@ f_substr(VALUE *v1, VALUE *v2, VALUE *v3) return result; } -static VALUE +S_FUNC VALUE f_char(VALUE *vp) { char ch; @@ -4363,7 +4369,7 @@ f_char(VALUE *vp) } -static VALUE +S_FUNC VALUE f_ord(VALUE *vp) { OCTET *c; @@ -4389,7 +4395,7 @@ f_ord(VALUE *vp) } -static VALUE +S_FUNC VALUE f_protect(int count, VALUE **vals) { int i, depth; @@ -4438,7 +4444,7 @@ f_protect(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_size(VALUE *vp) { VALUE result; @@ -4466,7 +4472,7 @@ f_size(VALUE *vp) } -static VALUE +S_FUNC VALUE f_sizeof(VALUE *vp) { VALUE result; @@ -4486,7 +4492,7 @@ f_sizeof(VALUE *vp) } -static VALUE +S_FUNC VALUE f_memsize(VALUE *vp) { VALUE result; @@ -4506,7 +4512,7 @@ f_memsize(VALUE *vp) } -static VALUE +S_FUNC VALUE f_search(int count, VALUE **vals) { VALUE *v1, *v2, *v3, *v4; @@ -4672,7 +4678,7 @@ f_search(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_rsearch(int count, VALUE **vals) { VALUE *v1, *v2, *v3, *v4; @@ -4858,7 +4864,7 @@ f_rsearch(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_list(int count, VALUE **vals) { VALUE result; @@ -4875,7 +4881,7 @@ f_list(int count, VALUE **vals) /*ARGSUSED*/ -static VALUE +S_FUNC VALUE f_assoc(int UNUSED count, VALUE UNUSED **vals) { VALUE result; @@ -4889,7 +4895,7 @@ f_assoc(int UNUSED count, VALUE UNUSED **vals) } -static VALUE +S_FUNC VALUE f_indices(VALUE *v1, VALUE *v2) { VALUE result; @@ -4919,7 +4925,7 @@ f_indices(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_listinsert(int count, VALUE **vals) { VALUE *v1, *v2, *v3; @@ -4953,7 +4959,7 @@ f_listinsert(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_listpush(int count, VALUE **vals) { VALUE result; @@ -4979,7 +4985,7 @@ f_listpush(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_listappend(int count, VALUE **vals) { VALUE *v1, *v2; @@ -5005,7 +5011,7 @@ f_listappend(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_listdelete(VALUE *v1, VALUE *v2) { VALUE result; @@ -5027,7 +5033,7 @@ f_listdelete(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_listpop(VALUE *vp) { VALUE result; @@ -5043,7 +5049,7 @@ f_listpop(VALUE *vp) } -static VALUE +S_FUNC VALUE f_listremove(VALUE *vp) { VALUE result; @@ -5062,7 +5068,7 @@ f_listremove(VALUE *vp) /* * Return the current user time of calc in seconds. */ -static NUMBER * +S_FUNC NUMBER * f_usertime(void) { #if defined(HAVE_GETRUSAGE) @@ -5101,7 +5107,7 @@ f_usertime(void) * Return the current kernel time of calc in seconds. * This is the kernel mode time only. */ -static NUMBER * +S_FUNC NUMBER * f_systime(void) { #if defined(HAVE_GETRUSAGE) @@ -5139,7 +5145,7 @@ f_systime(void) /* * Return the current user and kernel time of calc in seconds. */ -static NUMBER * +S_FUNC NUMBER * f_runtime(void) { #if defined(HAVE_GETRUSAGE) @@ -5191,7 +5197,7 @@ f_runtime(void) /* * return the number of second since the Epoch (00:00:00 1 Jan 1970 UTC). */ -static NUMBER * +S_FUNC NUMBER * f_time(void) { return itoq((long) time(0)); @@ -5201,7 +5207,7 @@ f_time(void) /* * time in asctime()/ctime() format */ -static VALUE +S_FUNC VALUE f_ctime(void) { VALUE res; @@ -5218,7 +5224,7 @@ f_ctime(void) } -static VALUE +S_FUNC VALUE f_fopen(VALUE *v1, VALUE *v2) { VALUE result; @@ -5259,7 +5265,7 @@ f_fopen(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_fpathopen(int count, VALUE **vals) { VALUE result; @@ -5314,7 +5320,7 @@ f_fpathopen(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_freopen(int count, VALUE **vals) { VALUE result; @@ -5362,7 +5368,7 @@ f_freopen(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_errno(int count, VALUE **vals) { int newerr, olderr; @@ -5400,7 +5406,7 @@ f_errno(int count, VALUE **vals) -static VALUE +S_FUNC VALUE f_errcount(int count, VALUE **vals) { int newcount, oldcount; @@ -5430,7 +5436,7 @@ f_errcount(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_errmax(int count, VALUE **vals) { long oldmax; @@ -5459,7 +5465,7 @@ f_errmax(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_stoponerror(int count, VALUE **vals) { long oldval; @@ -5487,7 +5493,7 @@ f_stoponerror(int count, VALUE **vals) return result; } -static VALUE +S_FUNC VALUE f_fclose(int count, VALUE **vals) { VALUE result; @@ -5520,7 +5526,7 @@ f_fclose(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_rm(int count, VALUE **vals) { VALUE result; @@ -5570,7 +5576,7 @@ f_rm(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_newerror(int count, VALUE **vals) { char *str; @@ -5597,7 +5603,7 @@ f_newerror(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_strerror(int count, VALUE **vals) { VALUE *vp; @@ -5663,7 +5669,7 @@ f_strerror(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_ferror(VALUE *vp) { VALUE result; @@ -5683,7 +5689,7 @@ f_ferror(VALUE *vp) } -static VALUE +S_FUNC VALUE f_feof(VALUE *vp) { VALUE result; @@ -5703,7 +5709,7 @@ f_feof(VALUE *vp) } -static VALUE +S_FUNC VALUE f_fflush(int count, VALUE **vals) { VALUE result; @@ -5732,7 +5738,7 @@ f_fflush(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_error(int count, VALUE **vals) { VALUE *vp; @@ -5760,7 +5766,7 @@ f_error(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_iserror(VALUE *vp) { VALUE res; @@ -5774,7 +5780,7 @@ f_iserror(VALUE *vp) } -static VALUE +S_FUNC VALUE f_fsize(VALUE *vp) { VALUE result; @@ -5798,7 +5804,7 @@ f_fsize(VALUE *vp) } -static VALUE +S_FUNC VALUE f_fseek(int count, VALUE **vals) { VALUE result; @@ -5837,7 +5843,7 @@ f_fseek(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_ftell(VALUE *vp) { VALUE result; @@ -5861,7 +5867,7 @@ f_ftell(VALUE *vp) } -static VALUE +S_FUNC VALUE f_rewind(int count, VALUE **vals) { VALUE result; @@ -5889,7 +5895,7 @@ f_rewind(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_fprintf(int count, VALUE **vals) { VALUE result; @@ -5911,7 +5917,7 @@ f_fprintf(int count, VALUE **vals) } -static int +S_FUNC int strscan(char *s, int count, VALUE **vals) { char ch, chtmp; @@ -5955,7 +5961,7 @@ strscan(char *s, int count, VALUE **vals) } -static int +S_FUNC int filescan(FILEID id, int count, VALUE **vals) { STRING *str; @@ -5992,7 +5998,7 @@ filescan(FILEID id, int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_scan(int count, VALUE **vals) { char *cp; @@ -6015,7 +6021,7 @@ f_scan(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_strscan(int count, VALUE **vals) { VALUE *vp; @@ -6039,7 +6045,7 @@ f_strscan(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_fscan(int count, VALUE **vals) { VALUE *vp; @@ -6069,7 +6075,7 @@ f_fscan(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_scanf(int count, VALUE **vals) { VALUE *vp; @@ -6097,7 +6103,7 @@ f_scanf(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_strscanf(int count, VALUE **vals) { VALUE *vp, *vq; @@ -6134,7 +6140,7 @@ f_strscanf(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_fscanf(int count, VALUE **vals) { VALUE *vp, *sp; @@ -6171,7 +6177,7 @@ f_fscanf(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_fputc(VALUE *v1, VALUE *v2) { VALUE result; @@ -6210,7 +6216,7 @@ f_fputc(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_fputs(int count, VALUE **vals) { VALUE result; @@ -6235,7 +6241,7 @@ f_fputs(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_fputstr(int count, VALUE **vals) { VALUE result; @@ -6261,7 +6267,7 @@ f_fputstr(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_printf(int count, VALUE **vals) { VALUE result; @@ -6281,7 +6287,7 @@ f_printf(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_strprintf(int count, VALUE **vals) { VALUE result; @@ -6308,7 +6314,7 @@ f_strprintf(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_fgetc(VALUE *vp) { VALUE result; @@ -6331,7 +6337,7 @@ f_fgetc(VALUE *vp) } -static VALUE +S_FUNC VALUE f_ungetc(VALUE *v1, VALUE *v2) { VALUE result; @@ -6369,7 +6375,7 @@ f_ungetc(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_fgetline(VALUE *vp) { VALUE result; @@ -6393,7 +6399,7 @@ f_fgetline(VALUE *vp) } -static VALUE +S_FUNC VALUE f_fgets(VALUE *vp) { VALUE result; @@ -6417,7 +6423,7 @@ f_fgets(VALUE *vp) } -static VALUE +S_FUNC VALUE f_fgetstr(VALUE *vp) { VALUE result; @@ -6441,7 +6447,7 @@ f_fgetstr(VALUE *vp) } -static VALUE +S_FUNC VALUE f_fgetfield(VALUE *vp) { VALUE result; @@ -6464,7 +6470,7 @@ f_fgetfield(VALUE *vp) return result; } -static VALUE +S_FUNC VALUE f_fgetfile(VALUE *vp) { VALUE result; @@ -6490,7 +6496,7 @@ f_fgetfile(VALUE *vp) } -static VALUE +S_FUNC VALUE f_files(int count, VALUE **vals) { VALUE result; @@ -6513,7 +6519,7 @@ f_files(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_reverse(VALUE *val) { VALUE res; @@ -6542,7 +6548,7 @@ f_reverse(VALUE *val) } -static VALUE +S_FUNC VALUE f_sort(VALUE *val) { VALUE res; @@ -6566,7 +6572,7 @@ f_sort(VALUE *val) } -static VALUE +S_FUNC VALUE f_join(int count, VALUE **vals) { LIST *lp; @@ -6594,7 +6600,7 @@ f_join(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_head(VALUE *v1, VALUE *v2) { VALUE res; @@ -6634,7 +6640,7 @@ f_head(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_tail(VALUE *v1, VALUE *v2) { long n; @@ -6683,7 +6689,7 @@ f_tail(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_segment(int count, VALUE **vals) { VALUE *vp; @@ -6723,7 +6729,7 @@ f_segment(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_modify(VALUE *v1, VALUE *v2) { FUNC *fp; @@ -6786,7 +6792,7 @@ f_modify(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_forall(VALUE *v1, VALUE *v2) { FUNC *fp; @@ -6833,7 +6839,7 @@ f_forall(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_select(VALUE *v1, VALUE *v2) { LIST *lp; @@ -6871,7 +6877,7 @@ f_select(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_count(VALUE *v1, VALUE *v2) { LISTELEM *ep; @@ -6924,7 +6930,7 @@ f_count(VALUE *v1, VALUE *v2) } -static VALUE +S_FUNC VALUE f_makelist(VALUE *v1) { LIST *lp; @@ -6953,7 +6959,7 @@ f_makelist(VALUE *v1) } -static VALUE +S_FUNC VALUE f_randperm(VALUE *val) { VALUE res; @@ -6979,7 +6985,7 @@ f_randperm(VALUE *val) } -static VALUE +S_FUNC VALUE f_cmdbuf(void) { VALUE result; @@ -6998,7 +7004,7 @@ f_cmdbuf(void) } -static VALUE +S_FUNC VALUE f_getenv(VALUE *v1) { VALUE result; @@ -7021,7 +7027,7 @@ f_getenv(VALUE *v1) } -static VALUE +S_FUNC VALUE f_isatty(VALUE *vp) { VALUE result; @@ -7039,7 +7045,7 @@ f_isatty(VALUE *vp) } -static VALUE +S_FUNC VALUE f_calc_tty(void) { VALUE res; @@ -7052,7 +7058,7 @@ f_calc_tty(void) } -static VALUE +S_FUNC VALUE f_inputlevel (void) { VALUE result; @@ -7066,7 +7072,7 @@ f_inputlevel (void) } -static VALUE +S_FUNC VALUE f_calclevel(void) { VALUE result; @@ -7080,7 +7086,7 @@ f_calclevel(void) } -static VALUE +S_FUNC VALUE f_calcpath(void) { VALUE result; @@ -7094,7 +7100,7 @@ f_calcpath(void) } -static VALUE +S_FUNC VALUE f_access(int count, VALUE **vals) { NUMBER *q; @@ -7146,7 +7152,7 @@ f_access(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_putenv(int count, VALUE **vals) { VALUE result; @@ -7209,7 +7215,7 @@ f_putenv(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_strpos(VALUE *haystack, VALUE *needle) { VALUE result; @@ -7235,7 +7241,7 @@ f_strpos(VALUE *haystack, VALUE *needle) } -static VALUE +S_FUNC VALUE f_system(VALUE *vp) { VALUE result; @@ -7269,7 +7275,7 @@ f_system(VALUE *vp) } -static VALUE +S_FUNC VALUE f_sleep(int count, VALUE **vals) { long time; @@ -7316,7 +7322,7 @@ f_sleep(int count, VALUE **vals) /* * set the default output base/mode */ -static NUMBER * +S_FUNC NUMBER * f_base(int count, NUMBER **vals) { long base; /* output base/mode */ @@ -7367,7 +7373,7 @@ f_base(int count, NUMBER **vals) /* * set the default secondary output base/mode */ -static NUMBER * +S_FUNC NUMBER * f_base2(int count, NUMBER **vals) { long base; /* output base/mode */ @@ -7421,7 +7427,7 @@ f_base2(int count, NUMBER **vals) /* * return a numerical 'value' of the mode/base */ -static NUMBER * +S_FUNC NUMBER * base_value(long mode, int defval) { NUMBER *result; @@ -7498,7 +7504,7 @@ base_value(long mode, int defval) } -static VALUE +S_FUNC VALUE f_custom(int count, VALUE **vals) { VALUE result; @@ -7546,7 +7552,7 @@ f_custom(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_blk(int count, VALUE **vals) { int len; /* number of octets to malloc */ @@ -7623,7 +7629,7 @@ f_blk(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_blkfree(VALUE *vp) { int id; @@ -7660,7 +7666,7 @@ f_blkfree(VALUE *vp) } -static VALUE +S_FUNC VALUE f_blocks(int count, VALUE **vals) { NBLOCK *nblk; @@ -7691,7 +7697,7 @@ f_blocks(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_free(int count, VALUE **vals) { VALUE result; @@ -7710,7 +7716,7 @@ f_free(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_freeglobals(void) { VALUE result; @@ -7724,7 +7730,7 @@ f_freeglobals(void) } -static VALUE +S_FUNC VALUE f_freeredc(void) { VALUE result; @@ -7738,7 +7744,7 @@ f_freeredc(void) } -static VALUE +S_FUNC VALUE f_freestatics(void) { VALUE result; @@ -7760,7 +7766,7 @@ f_freestatics(void) * Copy 'num' consecutive items from 'src' with index 'ssi' to * 'dest', starting at position with index 'dsi'. */ -static VALUE +S_FUNC VALUE f_copy(int count, VALUE **vals) { long ssi = 0; /* source start index */ @@ -7841,7 +7847,7 @@ f_copy(int count, VALUE **vals) * Copy 'num' consecutive items from 'src' with index 'ssi' to * 'dest', starting at position with index 'dsi'. */ -static VALUE +S_FUNC VALUE f_blkcpy(int count, VALUE **vals) { VALUE *args[5]; /* args to re-order */ @@ -7883,7 +7889,7 @@ f_blkcpy(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_sha(int count, VALUE **vals) { VALUE result; @@ -7952,7 +7958,7 @@ f_sha(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_sha1(int count, VALUE **vals) { VALUE result; @@ -8019,7 +8025,7 @@ f_sha1(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_md5(int count, VALUE **vals) { VALUE result; @@ -8088,7 +8094,7 @@ f_md5(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_argv(int count, VALUE **vals) { int arg; /* the argv_value string index */ @@ -8131,7 +8137,7 @@ f_argv(int count, VALUE **vals) } -static VALUE +S_FUNC VALUE f_version(void) { VALUE result; @@ -8184,7 +8190,7 @@ f_version(void) * b_valfunc routine to calculate general values * b_desc description of function */ -static CONST struct builtin builtins[] = { +STATIC CONST struct builtin builtins[] = { {"abs", 1, 2, 0, OP_ABS, 0, 0, "absolute value within accuracy b"}, {"access", 1, 2, 0, OP_NOP, 0, f_access, @@ -9047,7 +9053,7 @@ showerrors(void) * * NOTE: The caller MUST pass a string that the caller has previously malloced. */ -static int +S_FUNC int malloced_putenv(char *str) { char *value; /* location of the value part of the str argument */ diff --git a/func.h b/func.h index 9bb57b8..00e802a 100644 --- a/func.h +++ b/func.h @@ -1,7 +1,7 @@ /* * func - built-in function interface definitions * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: func.h,v 29.4 2001/06/08 21:00:58 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: func.h,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/func.h,v $ * * Under source code control: 1990/02/15 01:48:33 @@ -72,42 +72,42 @@ struct func { /* * The current function being compiled. */ -extern FUNC *curfunc; +EXTERN FUNC *curfunc; /* * Functions to handle functions. */ -extern FUNC *findfunc(long index); -extern char *namefunc(long index); -extern BOOL evaluate(BOOL nestflag); -extern long adduserfunc(char *name); -extern void rmuserfunc(char *name); -extern void rmalluserfunc(void); -extern long getuserfunc(char *name); -extern void beginfunc(char *name, BOOL newflag); -extern int builtinopcode(long index); -extern char *builtinname(long index); -extern int dumpop(unsigned long *pc); -extern void addop(long op); -extern void endfunc(void); -extern void addopone(long op, long arg); -extern void addoptwo(long op, long arg1, long arg2); -extern void addoplabel(long op, LABEL *label); -extern void addopptr(long op, char *ptr); -extern void writeindexop(void); -extern void showbuiltins(void); -extern int getbuiltinfunc(char *name); -extern void builtincheck(long index, int count); -extern void addopfunction(long op, long index, int count); -extern void showfunctions(void); -extern void initfunctions(void); -extern void clearopt(void); -extern void updateoldvalue(FUNC *fp); -extern void calculate(FUNC *fp, int argcount); -extern VALUE builtinfunc(long index, int argcount, VALUE *stck); -extern void freenumbers(FUNC *); -extern void freefunc(FUNC *); +E_FUNC FUNC *findfunc(long index); +E_FUNC char *namefunc(long index); +E_FUNC BOOL evaluate(BOOL nestflag); +E_FUNC long adduserfunc(char *name); +E_FUNC void rmuserfunc(char *name); +E_FUNC void rmalluserfunc(void); +E_FUNC long getuserfunc(char *name); +E_FUNC void beginfunc(char *name, BOOL newflag); +E_FUNC int builtinopcode(long index); +E_FUNC char *builtinname(long index); +E_FUNC int dumpop(unsigned long *pc); +E_FUNC void addop(long op); +E_FUNC void endfunc(void); +E_FUNC void addopone(long op, long arg); +E_FUNC void addoptwo(long op, long arg1, long arg2); +E_FUNC void addoplabel(long op, LABEL *label); +E_FUNC void addopptr(long op, char *ptr); +E_FUNC void writeindexop(void); +E_FUNC void showbuiltins(void); +E_FUNC int getbuiltinfunc(char *name); +E_FUNC void builtincheck(long index, int count); +E_FUNC void addopfunction(long op, long index, int count); +E_FUNC void showfunctions(void); +E_FUNC void initfunctions(void); +E_FUNC void clearopt(void); +E_FUNC void updateoldvalue(FUNC *fp); +E_FUNC void calculate(FUNC *fp, int argcount); +E_FUNC VALUE builtinfunc(long index, int argcount, VALUE *stck); +E_FUNC void freenumbers(FUNC *); +E_FUNC void freefunc(FUNC *); #endif /* !__FUNC_H__ */ diff --git a/hash.c b/hash.c index 2bdbd93..a32e9ee 100644 --- a/hash.c +++ b/hash.c @@ -1,7 +1,7 @@ /* * hash - one-way hash routines * - * Copyright (C) 1999-2006 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.10 $ - * @(#) $Id: hash.c,v 29.10 2006/06/20 10:25:45 chongo Exp $ + * @(#) $Revision: 29.11 $ + * @(#) $Id: hash.c,v 29.11 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/hash.c,v $ * * Under source code control: 1995/11/23 05:13:11 @@ -43,9 +43,9 @@ /* * external hash_setup functions */ -extern void shs_init_state(HASH*); -extern void shs1_init_state(HASH*); -extern void MD5_init_state(HASH*); +E_FUNC void shs_init_state(HASH*); +E_FUNC void shs1_init_state(HASH*); +E_FUNC void MD5_init_state(HASH*); /* @@ -60,7 +60,7 @@ extern void MD5_init_state(HASH*); /* * hash_setup - setup the hash state for a given hash */ -static struct hash_setup { +STATIC struct hash_setup { int type; /* hash type (see XYZ_HASH_TYPE below) */ void (*init_state)(HASH*); /* initialize a hash state */ } htbl[] = { diff --git a/hash.h b/hash.h index f3b79a6..05a20e4 100644 --- a/hash.h +++ b/hash.h @@ -1,7 +1,7 @@ /* * hash - one-way hash routines * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: hash.h,v 29.4 2001/06/08 21:00:58 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: hash.h,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/hash.h,v $ * * Under source code control: 1995/11/14 23:57:45 @@ -123,19 +123,19 @@ struct hashstate { /* * external functions */ -extern HASH* hash_init(int, HASH*); -extern void hash_free(HASH*); -extern HASH* hash_copy(HASH*); -extern int hash_cmp(HASH*, HASH*); -extern void hash_print(HASH*); -extern ZVALUE hash_final(HASH*); -extern HASH* hash_long(int, long, HASH*); -extern HASH* hash_zvalue(int, ZVALUE, HASH*); -extern HASH* hash_number(int, void*, HASH*); -extern HASH* hash_complex(int, void*, HASH*); -extern HASH* hash_str(int, char*, HASH*); -extern HASH* hash_usb8(int, USB8*, int, HASH*); -extern HASH* hash_value(int, void*, HASH*); +E_FUNC HASH* hash_init(int, HASH*); +E_FUNC void hash_free(HASH*); +E_FUNC HASH* hash_copy(HASH*); +E_FUNC int hash_cmp(HASH*, HASH*); +E_FUNC void hash_print(HASH*); +E_FUNC ZVALUE hash_final(HASH*); +E_FUNC HASH* hash_long(int, long, HASH*); +E_FUNC HASH* hash_zvalue(int, ZVALUE, HASH*); +E_FUNC HASH* hash_number(int, void*, HASH*); +E_FUNC HASH* hash_complex(int, void*, HASH*); +E_FUNC HASH* hash_str(int, char*, HASH*); +E_FUNC HASH* hash_usb8(int, USB8*, int, HASH*); +E_FUNC HASH* hash_value(int, void*, HASH*); #endif /* !__HASH_H__ */ diff --git a/help.c b/help.c index 9502d12..bb539ab 100644 --- a/help.c +++ b/help.c @@ -1,7 +1,7 @@ /* * help - display help for calc * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.9 $ - * @(#) $Id: help.c,v 29.9 2007/02/07 00:37:52 chongo Exp $ + * @(#) $Revision: 29.10 $ + * @(#) $Id: help.c,v 29.10 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $ * * Under source code control: 1997/09/14 10:58:30 @@ -51,7 +51,7 @@ /* * some help topics are symbols, so we alias them to nice filenames */ -static struct help_alias { +STATIC struct help_alias { char *topic; char *filename; } halias[] = { @@ -89,7 +89,7 @@ static struct help_alias { /* * external values */ -extern char *pager; /* $PAGER or default */ +EXTERN char *pager; /* $PAGER or default */ /* @@ -104,7 +104,7 @@ extern char *pager; /* $PAGER or default */ * given: * stream open file stream of the file to send to the pager */ -static void +S_FUNC void page_file(FILE *stream) { FILE *cmd; /* pager command */ diff --git a/hist.c b/hist.c index 52e28ce..11350b9 100644 --- a/hist.c +++ b/hist.c @@ -1,7 +1,7 @@ /* * hist - interactive readline module * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.12 $ - * @(#) $Id: hist.c,v 29.12 2006/06/02 09:57:12 chongo Exp $ + * @(#) $Revision: 29.13 $ + * @(#) $Id: hist.c,v 29.13 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.c,v $ * * Under source code control: 1993/05/02 20:09:19 @@ -71,7 +71,7 @@ #if !defined(USE_READLINE) -extern FILE *curstream(void); +E_FUNC FILE *curstream(void); #define STDIN 0 #define SAVE_SIZE 256 /* size of save buffer */ @@ -80,7 +80,7 @@ extern FILE *curstream(void); #define CONTROL(x) ((char)(((int)(x)) & 0x1f)) -static struct { +STATIC struct { char *prompt; char *buf; char *pos; @@ -102,41 +102,41 @@ typedef struct { } FUNC; /* declare binding functions */ -static void flush_input(void); -static void start_of_line(void); -static void end_of_line(void); -static void forward_char(void); -static void backward_char(void); -static void forward_word(void); -static void backward_word(void); -static void delete_char(void); -static void forward_kill_char(void); -static void backward_kill_char(void); -static void forward_kill_word(void); -static void kill_line(void); -static void new_line(void); -static void save_line(void); -static void forward_history(void); -static void backward_history(void); -static void insert_char(int key); -static void goto_line(void); -static void list_history(void); -static void refresh_line(void); -static void swap_chars(void); -static void set_mark(void); -static void yank(void); -static void save_region(void); -static void kill_region(void); -static void reverse_search(void); -static void quote_char(void); -static void uppercase_word(void); -static void lowercase_word(void); -static void ignore_char(void); -static void arrow_key(void); -static void quit_calc(void); +S_FUNC void flush_input(void); +S_FUNC void start_of_line(void); +S_FUNC void end_of_line(void); +S_FUNC void forward_char(void); +S_FUNC void backward_char(void); +S_FUNC void forward_word(void); +S_FUNC void backward_word(void); +S_FUNC void delete_char(void); +S_FUNC void forward_kill_char(void); +S_FUNC void backward_kill_char(void); +S_FUNC void forward_kill_word(void); +S_FUNC void kill_line(void); +S_FUNC void new_line(void); +S_FUNC void save_line(void); +S_FUNC void forward_history(void); +S_FUNC void backward_history(void); +S_FUNC void insert_char(int key); +S_FUNC void goto_line(void); +S_FUNC void list_history(void); +S_FUNC void refresh_line(void); +S_FUNC void swap_chars(void); +S_FUNC void set_mark(void); +S_FUNC void yank(void); +S_FUNC void save_region(void); +S_FUNC void kill_region(void); +S_FUNC void reverse_search(void); +S_FUNC void quote_char(void); +S_FUNC void uppercase_word(void); +S_FUNC void lowercase_word(void); +S_FUNC void ignore_char(void); +S_FUNC void arrow_key(void); +S_FUNC void quit_calc(void); -static FUNC funcs[] = +STATIC FUNC funcs[] = { {"ignore-char", ignore_char}, {"flush-input", flush_input}, @@ -190,11 +190,11 @@ struct key_map { }; -static char base_map_name[] = "base-map"; -static char esc_map_name[] = "esc-map"; +STATIC char base_map_name[] = "base-map"; +STATIC char esc_map_name[] = "esc-map"; -static KEY_MAP maps[] = { +STATIC KEY_MAP maps[] = { {base_map_name, {NULL, NULL}, {NULL, NULL}}, {esc_map_name, {NULL, NULL}, {NULL, NULL}}, }; @@ -213,46 +213,46 @@ typedef struct { } HIST; -static int inited; -static int canedit; -static int histused; -static int key_count; -static int save_len; -static KEY_MAP *cur_map; -static KEY_MAP *base_map; -static KEY_ENT key_table[MAX_KEYS]; -static char histbuf[HIST_SIZE + 1]; -static char save_buffer[SAVE_SIZE]; +STATIC int inited; +STATIC int canedit; +STATIC int histused; +STATIC int key_count; +STATIC int save_len; +STATIC KEY_MAP *cur_map; +STATIC KEY_MAP *base_map; +STATIC KEY_ENT key_table[MAX_KEYS]; +STATIC char histbuf[HIST_SIZE + 1]; +STATIC char save_buffer[SAVE_SIZE]; /* declare other static functions */ -static FUNCPTR find_func(char *name); -static HIST *get_event(int n); -static HIST *find_event(char *pat, int len); -static void read_key(void); -static void erasechar(void); -static void newline(void); -static void backspace(void); -static void beep(void); -static void echo_char(int ch); -static void echo_string(char *str, int len); -static void savetext(char *str, int len); -static void memrcpy(char *dest, char *src, int len); -static int read_bindings(FILE *fp); -static int in_word(int ch); -static KEY_MAP *find_map(char *map); -static void unbind_key(KEY_MAP *map, int key); -static void raw_bind_key(KEY_MAP *map, int key, +S_FUNC FUNCPTR find_func(char *name); +S_FUNC HIST *get_event(int n); +S_FUNC HIST *find_event(char *pat, int len); +S_FUNC void read_key(void); +S_FUNC void erasechar(void); +S_FUNC void newline(void); +S_FUNC void backspace(void); +S_FUNC void beep(void); +S_FUNC void echo_char(int ch); +S_FUNC void echo_string(char *str, int len); +S_FUNC void savetext(char *str, int len); +S_FUNC void memrcpy(char *dest, char *src, int len); +S_FUNC int read_bindings(FILE *fp); +S_FUNC int in_word(int ch); +S_FUNC KEY_MAP *find_map(char *map); +S_FUNC void unbind_key(KEY_MAP *map, int key); +S_FUNC void raw_bind_key(KEY_MAP *map, int key, FUNCPTR func, KEY_MAP *next_map); -static KEY_MAP *do_map_line(char *line); -static void do_default_line(KEY_MAP *map, char *line); -static void do_bind_line(KEY_MAP *map, char *line); -static void back_over_char(int ch); -static void echo_rest_of_line(void); -static void goto_start_of_line(void); -static void goto_end_of_line(void); -static void remove_char(int ch); -static void decrement_end(int n); -static void insert_string(char *str, int len); +S_FUNC KEY_MAP *do_map_line(char *line); +S_FUNC void do_default_line(KEY_MAP *map, char *line); +S_FUNC void do_bind_line(KEY_MAP *map, char *line); +S_FUNC void back_over_char(int ch); +S_FUNC void echo_rest_of_line(void); +S_FUNC void goto_start_of_line(void); +S_FUNC void goto_end_of_line(void); +S_FUNC void remove_char(int ch); +S_FUNC void decrement_end(int n); +S_FUNC void insert_string(char *str, int len); /* @@ -406,7 +406,7 @@ hist_term(void) } -static KEY_MAP * +S_FUNC KEY_MAP * find_map(char *map) { unsigned int i; @@ -419,14 +419,14 @@ find_map(char *map) } -static void +S_FUNC void unbind_key(KEY_MAP *map, int key) { map->map[key] = NULL; } -static void +S_FUNC void raw_bind_key(KEY_MAP *map, int key, FUNCPTR func, KEY_MAP *next_map) { if (map->map[key] == NULL) { @@ -439,7 +439,7 @@ raw_bind_key(KEY_MAP *map, int key, FUNCPTR func, KEY_MAP *next_map) } -static KEY_MAP * +S_FUNC KEY_MAP * do_map_line(char *line) { char *cp; @@ -458,7 +458,7 @@ do_map_line(char *line) } -static void +S_FUNC void do_bind_line(KEY_MAP *map, char *line) { char *cp; @@ -529,7 +529,7 @@ do_bind_line(KEY_MAP *map, char *line) } -static void +S_FUNC void do_default_line(KEY_MAP *map, char *line) { char *cp; @@ -584,7 +584,7 @@ do_default_line(KEY_MAP *map, char *line) * * Returns nonzero on error. */ -static int +S_FUNC int read_bindings(FILE *fp) { char *cp; @@ -621,7 +621,7 @@ read_bindings(FILE *fp) } -static void +S_FUNC void read_key(void) { KEY_ENT *ent; @@ -653,7 +653,7 @@ read_key(void) * Return the Nth history event, indexed from zero. * Earlier history events are lower in number. */ -static HIST * +S_FUNC HIST * get_event(int n) { register HIST * hp; @@ -671,7 +671,7 @@ get_event(int n) * Search the history list for the specified pattern. * Returns the found history, or NULL. */ -static HIST * +S_FUNC HIST * find_event(char *pat, int len) { register HIST * hp; @@ -747,7 +747,7 @@ hist_saveline(char *line, int len) /* * Find the function for a specified name. */ -static FUNCPTR +S_FUNC FUNCPTR find_func(char *name) { FUNC *fp; @@ -760,7 +760,7 @@ find_func(char *name) } -static void +S_FUNC void arrow_key(void) { switch (fgetc(stdin)) { @@ -780,7 +780,7 @@ arrow_key(void) } -static void +S_FUNC void back_over_char(int ch) { backspace(); @@ -789,7 +789,7 @@ back_over_char(int ch) } -static void +S_FUNC void remove_char(int ch) { erasechar(); @@ -798,14 +798,14 @@ remove_char(int ch) } -static void +S_FUNC void echo_rest_of_line(void) { echo_string(HS.pos, HS.end - HS.pos); } -static void +S_FUNC void goto_start_of_line(void) { while (HS.pos > HS.buf) @@ -813,7 +813,7 @@ goto_start_of_line(void) } -static void +S_FUNC void goto_end_of_line(void) { echo_rest_of_line(); @@ -821,7 +821,7 @@ goto_end_of_line(void) } -static void +S_FUNC void decrement_end(int n) { HS.end -= n; @@ -830,13 +830,13 @@ decrement_end(int n) } -static void +S_FUNC void ignore_char(void) { } -static void +S_FUNC void flush_input(void) { echo_rest_of_line(); @@ -847,21 +847,21 @@ flush_input(void) } -static void +S_FUNC void start_of_line(void) { goto_start_of_line(); } -static void +S_FUNC void end_of_line(void) { goto_end_of_line(); } -static void +S_FUNC void forward_char(void) { if (HS.pos < HS.end) @@ -869,7 +869,7 @@ forward_char(void) } -static void +S_FUNC void backward_char(void) { if (HS.pos > HS.buf) @@ -877,7 +877,7 @@ backward_char(void) } -static void +S_FUNC void uppercase_word(void) { while ((HS.pos < HS.end) && !in_word((int)(*HS.pos))) @@ -890,7 +890,7 @@ uppercase_word(void) } -static void +S_FUNC void lowercase_word(void) { while ((HS.pos < HS.end) && !in_word((int)(*HS.pos))) @@ -903,7 +903,7 @@ lowercase_word(void) } -static void +S_FUNC void forward_word(void) { while ((HS.pos < HS.end) && !in_word((int)(*HS.pos))) @@ -913,7 +913,7 @@ forward_word(void) } -static void +S_FUNC void backward_word(void) { if ((HS.pos > HS.buf) && in_word((int)(*HS.pos))) @@ -927,7 +927,7 @@ backward_word(void) } -static void +S_FUNC void forward_kill_char(void) { int rest; @@ -949,7 +949,7 @@ forward_kill_char(void) } -static void +S_FUNC void delete_char(void) { /* @@ -972,7 +972,7 @@ delete_char(void) } -static void +S_FUNC void backward_kill_char(void) { if (HS.pos > HS.buf) { @@ -983,7 +983,7 @@ backward_kill_char(void) } -static void +S_FUNC void forward_kill_word(void) { char *cp; @@ -1007,7 +1007,7 @@ forward_kill_word(void) } -static void +S_FUNC void kill_line(void) { if (HS.end <= HS.pos) @@ -1026,7 +1026,7 @@ kill_line(void) * The line is NOT put into the edit history, so that the caller can * decide whether or not this should be done. */ -static void +S_FUNC void new_line(void) { int len; @@ -1050,7 +1050,7 @@ new_line(void) } -static void +S_FUNC void save_line(void) { int len; @@ -1064,7 +1064,7 @@ save_line(void) } -static void +S_FUNC void goto_line(void) { int num; @@ -1088,7 +1088,7 @@ goto_line(void) } -static void +S_FUNC void forward_history(void) { HIST *hp; @@ -1105,7 +1105,7 @@ forward_history(void) } -static void +S_FUNC void backward_history(void) { HIST *hp; @@ -1122,7 +1122,7 @@ backward_history(void) } -static void +S_FUNC void insert_char(int key) { int len; @@ -1145,7 +1145,7 @@ insert_char(int key) } -static void +S_FUNC void insert_string(char *str, int len) { int rest; @@ -1171,7 +1171,7 @@ insert_string(char *str, int len) } -static void +S_FUNC void list_history(void) { HIST *hp; @@ -1186,7 +1186,7 @@ list_history(void) } -static void +S_FUNC void refresh_line(void) { char *cp; @@ -1202,7 +1202,7 @@ refresh_line(void) } -static void +S_FUNC void swap_chars(void) { char ch1; @@ -1221,14 +1221,14 @@ swap_chars(void) } -static void +S_FUNC void set_mark(void) { HS.mark = HS.pos; } -static void +S_FUNC void save_region(void) { int len; @@ -1243,7 +1243,7 @@ save_region(void) } -static void +S_FUNC void kill_region(void) { char *cp; @@ -1275,14 +1275,14 @@ kill_region(void) } -static void +S_FUNC void yank(void) { insert_string(save_buffer, save_len); } -static void +S_FUNC void reverse_search(void) { int len; @@ -1318,7 +1318,7 @@ reverse_search(void) } -static void +S_FUNC void quote_char(void) { int ch; @@ -1332,7 +1332,7 @@ quote_char(void) /* * Save data in the save buffer. */ -static void +S_FUNC void savetext(char *str, int len) { save_len = 0; @@ -1348,42 +1348,42 @@ savetext(char *str, int len) /* * Test whether a character is part of a word. */ -static int +S_FUNC int in_word(int ch) { return (isalnum(ch) || (ch == '_')); } -static void +S_FUNC void erasechar(void) { fputs("\b \b", stdout); } -static void +S_FUNC void newline(void) { fputc('\n', stdout); } -static void +S_FUNC void backspace(void) { fputc('\b', stdout); } -static void +S_FUNC void beep(void) { fputc('\007', stdout); } -static void +S_FUNC void echo_char(int ch) { if (isprint(ch)) { @@ -1395,7 +1395,7 @@ echo_char(int ch) } -static void +S_FUNC void echo_string(char *str, int len) { while (len-- > 0) @@ -1403,7 +1403,7 @@ echo_string(char *str, int len) } -static void +S_FUNC void memrcpy(char *dest, char *src, int len) { dest += len - 1; @@ -1414,7 +1414,7 @@ memrcpy(char *dest, char *src, int len) #endif /* !USE_READLINE */ -static void +S_FUNC void quit_calc(void) { hist_term(); @@ -1480,7 +1480,7 @@ hist_term(void) } -static void +S_FUNC void my_stifle_history (void) { /* only save last number of entries */ @@ -1514,7 +1514,7 @@ hist_init(char UNUSED *filename) void hist_saveline(char *line, int len) { - static char *prev = NULL; + STATIC char *prev = NULL; if (len <= 1) return; diff --git a/hist.h b/hist.h index 0c41e6f..232c3bc 100644 --- a/hist.h +++ b/hist.h @@ -1,7 +1,7 @@ /* * hist - definitions for command history module * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.6 $ - * @(#) $Id: hist.h,v 29.6 2006/05/19 15:26:10 chongo Exp $ + * @(#) $Revision: 29.7 $ + * @(#) $Id: hist.h,v 29.7 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.h,v $ * * Under source code control: 1993/05/02 20:09:20 @@ -68,10 +68,10 @@ #define HIST_NOTTY 3 /* terminal modes could not be set */ -extern DLL int hist_init(char *filename); -extern DLL void hist_term(void); -extern DLL size_t hist_getline(char *prompt, char *buf, size_t len); -extern DLL void hist_saveline(char *line, int len); +E_FUNC int hist_init(char *filename); +E_FUNC void hist_term(void); +E_FUNC size_t hist_getline(char *prompt, char *buf, size_t len); +E_FUNC void hist_saveline(char *line, int len); #endif /* !__HIST_H__ */ diff --git a/input.c b/input.c index 466b725..e01ca67 100644 --- a/input.c +++ b/input.c @@ -1,7 +1,7 @@ /* * input - nested input source file reader * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.12 $ - * @(#) $Id: input.c,v 29.12 2006/12/15 17:02:49 chongo Exp $ + * @(#) $Revision: 29.13 $ + * @(#) $Id: input.c,v 29.13 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $ * * Under source code control: 1990/02/15 01:48:16 @@ -56,9 +56,9 @@ #include "conf.h" #include "hist.h" -extern int stdin_tty; /* TRUE if stdin is a tty */ -extern FILE *f_open(char *name, char *mode); -extern FILE *curstream(void); +EXTERN int stdin_tty; /* TRUE if stdin is a tty */ +E_FUNC FILE *f_open(char *name, char *mode); +E_FUNC FILE *curstream(void); #define TTYSIZE 100 /* reallocation size for terminal buffers */ @@ -90,25 +90,25 @@ typedef struct { struct stat inode; /* inode information for file */ } READSET; -static READSET *readset = NULL; /* array of files read */ -static int maxreadset = 0; /* length of readset */ +STATIC READSET *readset = NULL; /* array of files read */ +STATIC int maxreadset = 0; /* length of readset */ -static int linesize; /* current max size of input line */ -static char *linebuf; /* current input line buffer */ -static char *prompt; /* current prompt for terminal */ -static BOOL noprompt; /* TRUE if should not print prompt */ +STATIC int linesize; /* current max size of input line */ +STATIC char *linebuf; /* current input line buffer */ +STATIC char *prompt; /* current prompt for terminal */ +STATIC BOOL noprompt; /* TRUE if should not print prompt */ -static int depth; /* current input depth */ -static INPUT *cip; /* current input source */ -static INPUT inputs[MAXDEPTH]; /* input sources */ +STATIC int depth; /* current input depth */ +STATIC INPUT *cip; /* current input source */ +STATIC INPUT inputs[MAXDEPTH]; /* input sources */ -static int openfile(char *name); -static int ttychar(void); -static int isinoderead(struct stat *sbuf); -static int findfreeread(void); -static int addreadset(char *name, char *path, struct stat *sbuf); -static char *homeexpand(char *name); +S_FUNC int openfile(char *name); +S_FUNC int ttychar(void); +S_FUNC int isinoderead(struct stat *sbuf); +S_FUNC int findfreeread(void); +S_FUNC int addreadset(char *name, char *path, struct stat *sbuf); +S_FUNC char *homeexpand(char *name); /* @@ -390,7 +390,7 @@ f_pathopen(char *name, char *mode, char *pathlist, char **openpath) * given: * name a filename with a leading ~ */ -static char * +S_FUNC char * homeexpand(char *name) { #if defined(_WIN32) @@ -539,7 +539,7 @@ f_open(char *name, char *mode) * given: * name file name to be read */ -static int +S_FUNC int openfile(char *name) { FILE *fp; /* open file descriptor */ @@ -773,12 +773,12 @@ nextline(void) * The routines in the history module are called so that the user * can use a command history and emacs-like editing of the line. */ -static int +S_FUNC int ttychar(void) { int ch; /* current char */ int len; /* length of current command */ - static char charbuf[1024]; + STATIC char charbuf[1024]; /* * If we have more to read from the saved command line, then do that. @@ -957,7 +957,7 @@ runrcfiles(void) * sbuf stat of the inode in question */ -static int +S_FUNC int isinoderead(struct stat *sbuf) { int i; @@ -1005,7 +1005,7 @@ isinoderead(struct stat *sbuf) * * This function returns the index of the next free element, or -1. */ -static int +S_FUNC int findfreeread(void) { int i; @@ -1066,7 +1066,7 @@ findfreeread(void) * path full pathname of file * sbuf stat of the path */ -static int +S_FUNC int addreadset(char *name, char *path, struct stat *sbuf) { int ret; /* index to return */ diff --git a/jump.h b/jump.h index 9b3fde7..53d83d3 100644 --- a/jump.h +++ b/jump.h @@ -1,7 +1,7 @@ /* * jump - trivial prime jump table * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: jump.h,v 29.4 2001/06/08 21:00:58 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: jump.h,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/jump.h,v $ * * Under source code control: 1994/06/29 04:03:55 @@ -68,8 +68,10 @@ #if defined(CALC_SRC) /* if we are building from the calc source tree */ # include "have_const.h" +# include "decl.h" #else # include +# include #endif @@ -101,8 +103,8 @@ /* * external jump tables */ -extern CONST short jmpindx[]; -extern CONST unsigned char jmp[]; -extern CONST unsigned char *CONST lastjmp; +EXTERN CONST short jmpindx[]; +EXTERN CONST unsigned char jmp[]; +EXTERN CONST unsigned char *CONST lastjmp; #endif /* !__JUMP_H__ */ diff --git a/label.c b/label.c index bd8155a..275a965 100644 --- a/label.c +++ b/label.c @@ -1,7 +1,7 @@ /* * label - label handling routines * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: label.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: label.c,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/label.c,v $ * * Under source code control: 1990/02/15 01:48:17 @@ -35,9 +35,9 @@ #include "opcodes.h" #include "func.h" -static long labelcount; /* number of user labels defined */ -static STRINGHEAD labelnames; /* list of user label names */ -static LABEL labels[MAXLABELS]; /* list of user labels */ +STATIC long labelcount; /* number of user labels defined */ +STATIC STRINGHEAD labelnames; /* list of user label names */ +STATIC LABEL labels[MAXLABELS]; /* list of user labels */ /* diff --git a/label.h b/label.h index 71976f7..f3f5dc4 100644 --- a/label.h +++ b/label.h @@ -1,7 +1,7 @@ /* * label - label handling routines * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: label.h,v 29.4 2001/06/08 21:00:58 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: label.h,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/label.h,v $ * * Under source code control: 1990/02/15 01:48:33 @@ -52,13 +52,13 @@ typedef struct { } LABEL; -extern void initlabels(void); -extern void definelabel(char *name); -extern void addlabel(char *name); -extern void clearlabel(LABEL *lp); -extern void setlabel(LABEL *lp); -extern void uselabel(LABEL *lp); -extern void checklabels(void); +E_FUNC void initlabels(void); +E_FUNC void definelabel(char *name); +E_FUNC void addlabel(char *name); +E_FUNC void clearlabel(LABEL *lp); +E_FUNC void setlabel(LABEL *lp); +E_FUNC void uselabel(LABEL *lp); +E_FUNC void checklabels(void); #endif /* !__LABEL_H__ */ diff --git a/lib_calc.c b/lib_calc.c index ed8f6f7..d5c20de 100644 --- a/lib_calc.c +++ b/lib_calc.c @@ -1,7 +1,7 @@ /* * lib_calc - calc link library initialization and shutdown routines * - * Copyright (C) 1999-2006 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.14 $ - * @(#) $Id: lib_calc.c,v 29.14 2006/05/21 07:28:54 chongo Exp $ + * @(#) $Revision: 29.15 $ + * @(#) $Id: lib_calc.c,v 29.15 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $ * * Under source code control: 1996/06/17 18:06:19 @@ -98,8 +98,8 @@ typedef struct {int fd;} ttystruct; #if !defined(HAVE_UID_T) && !defined(_UID_T) typedef unsigned short uid_t; #endif -extern char *getenv(); -extern uid_t geteuid(); +E_FUNC char *getenv(); +E_FUNC uid_t geteuid(); #endif @@ -167,23 +167,23 @@ char *user_debug = NULL; /* !=NULL => value of config("user_debug") */ /* * initialization functions */ -extern void math_setfp(FILE *fp); -extern void file_init(void); -extern void zio_init(void); -extern void initialize(void); -extern void reinitialize(void); +E_FUNC void math_setfp(FILE *fp); +E_FUNC void file_init(void); +E_FUNC void zio_init(void); +E_FUNC void initialize(void); +E_FUNC void reinitialize(void); /* * static declarations */ -static int init_done = 0; /* 1 => we already initialized */ -static int *fd_setup = NULL; /* fd's setup for interaction or -1 */ -static int fd_setup_len = 0; /* number of fd's in fd_setup */ -static ttystruct *fd_orig = NULL; /* fd original state */ -static ttystruct *fd_cur = NULL; /* fd current state */ -static void initenv(void); /* setup calc environment */ -static int find_tty_state(int fd); /* find slot for saved tty state */ +STATIC int init_done = 0; /* 1 => we already initialized */ +STATIC int *fd_setup = NULL; /* fd's setup for interaction or -1 */ +STATIC int fd_setup_len = 0; /* number of fd's in fd_setup */ +STATIC ttystruct *fd_orig = NULL; /* fd original state */ +STATIC ttystruct *fd_cur = NULL; /* fd current state */ +S_FUNC void initenv(void); /* setup calc environment */ +S_FUNC int find_tty_state(int fd); /* find slot for saved tty state */ /* @@ -394,7 +394,7 @@ cvmalloc_error(char *message) * use a default value. If $HOME does not exist, or is empty, use the home * directory information from the password file. */ -static void +S_FUNC void initenv(void) { #if !defined(_WIN32) @@ -597,7 +597,7 @@ calc_strdup(CONST char *s1) * Returns: * indx The index into fd_setup[], fd_orig[] and fd_cur[] to use or -1 */ -static int +S_FUNC int find_tty_state(int fd) { int *new_fd_setup; /* new fd_setup array */ diff --git a/lib_util.h b/lib_util.h index d93ec43..9fbed73 100644 --- a/lib_util.h +++ b/lib_util.h @@ -1,7 +1,7 @@ /* * lib_util - calc link library utility routines * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: lib_util.h,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: lib_util.h,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_util.h,v $ * * Under source code control: 1997/04/19 21:38:30 @@ -38,10 +38,10 @@ #define __LIB_UTIL_H__ /* external functions in lib_util.c */ -extern int lowhex2bin[256]; -extern char lowbin2hex[256]; -extern ZVALUE convstr2z(char*); -extern ZVALUE convhex2z(char *hex); -extern char *convz2hex(ZVALUE z); +EXTERN int lowhex2bin[256]; +EXTERN char lowbin2hex[256]; +E_FUNC ZVALUE convstr2z(char*); +E_FUNC ZVALUE convhex2z(char *hex); +E_FUNC char *convz2hex(ZVALUE z); #endif /* __LIB_UTIL_H__ */ diff --git a/listfunc.c b/listfunc.c index fde9230..37b2026 100644 --- a/listfunc.c +++ b/listfunc.c @@ -1,7 +1,7 @@ /* * listfunc - list handling routines * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: listfunc.c,v 29.3 2006/06/02 10:24:09 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: listfunc.c,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/listfunc.c,v $ * * Under source code control: 1990/02/15 01:48:18 @@ -40,11 +40,11 @@ #include "value.h" #include "zrand.h" -extern long irand(long s); +E_FUNC long irand(long s); -static LISTELEM *elemalloc(void); -static void elemfree(LISTELEM *ep); -static void removelistelement(LIST *lp, LISTELEM *ep); +S_FUNC LISTELEM *elemalloc(void); +S_FUNC void elemfree(LISTELEM *ep); +S_FUNC void removelistelement(LIST *lp, LISTELEM *ep); /* @@ -224,7 +224,7 @@ removelistmiddle(LIST *lp, long index, VALUE *vp) * lp list header * ep list element to remove */ -static void +S_FUNC void removelistelement(LIST *lp, LISTELEM *ep) { if ((ep == lp->l_cache) || ((ep != lp->l_first) && (ep != lp->l_last))) @@ -804,7 +804,7 @@ listrandperm(LIST *lp) /* * Allocate an element for a list. */ -static LISTELEM * +S_FUNC LISTELEM * elemalloc(void) { LISTELEM *ep; @@ -825,7 +825,7 @@ elemalloc(void) /* * Free a list element, along with any contained value. */ -static void +S_FUNC void elemfree(LISTELEM *ep) { if (ep->e_value.v_type != V_NULL) diff --git a/longbits.c b/longbits.c index f6d119d..9efb06f 100644 --- a/longbits.c +++ b/longbits.c @@ -1,7 +1,7 @@ /* * longbits - Determine the number if bits in a char, short, int or long * - * Copyright (C) 1999-2006 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: longbits.c,v 29.7 2006/06/01 11:37:20 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: longbits.c,v 29.8 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/longbits.c,v $ * * Under source code control: 1994/03/18 03:06:18 @@ -98,7 +98,7 @@ #if defined(__linux) # if !defined(isascii) - extern int isascii(int c); + E_FUNC int isascii(int c); # endif /* !isascii */ #endif /* __linux */ diff --git a/matfunc.c b/matfunc.c index 61fccda..8ba5b36 100644 --- a/matfunc.c +++ b/matfunc.c @@ -1,7 +1,7 @@ /* * matfunc - extended precision rational arithmetic matrix functions * - * Copyright (C) 1999-2004 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: matfunc.c,v 29.7 2006/06/02 10:24:09 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: matfunc.c,v 29.8 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/matfunc.c,v $ * * Under source code control: 1990/02/15 01:48:18 @@ -38,12 +38,12 @@ #include "have_unused.h" -extern long irand(long s); +E_FUNC long irand(long s); -static void matswaprow(MATRIX *m, long r1, long r2); -static void matsubrow(MATRIX *m, long oprow, long baserow, VALUE *mulval); -static void matmulrow(MATRIX *m, long row, VALUE *mulval); -static MATRIX *matident(MATRIX *m); +S_FUNC void matswaprow(MATRIX *m, long r1, long r2); +S_FUNC void matsubrow(MATRIX *m, long oprow, long baserow, VALUE *mulval); +S_FUNC void matmulrow(MATRIX *m, long row, VALUE *mulval); +S_FUNC MATRIX *matident(MATRIX *m); @@ -1043,7 +1043,7 @@ matfill(MATRIX *m, VALUE *v1, VALUE *v2) /* * Set a copy of a square matrix to the identity matrix. */ -static MATRIX * +S_FUNC MATRIX * matident(MATRIX *m) { register VALUE *val; /* current value */ @@ -1318,7 +1318,7 @@ matdet(MATRIX *m) * Local utility routine to swap two rows of a square matrix. * No checks are made to verify the legality of the arguments. */ -static void +S_FUNC void matswaprow(MATRIX *m, long r1, long r2) { register VALUE *v1, *v2; @@ -1345,7 +1345,7 @@ matswaprow(MATRIX *m, long r1, long r2) * The row to be changed is oprow, the row to be subtracted is baserow. * No checks are made to verify the legality of the arguments. */ -static void +S_FUNC void matsubrow(MATRIX *m, long oprow, long baserow, VALUE *mulval) { register VALUE *vop, *vbase; @@ -1371,7 +1371,7 @@ matsubrow(MATRIX *m, long oprow, long baserow, VALUE *mulval) * Local utility routine to multiply a row by a specified number. * No checks are made to verify the legality of the arguments. */ -static void +S_FUNC void matmulrow(MATRIX *m, long row, VALUE *mulval) { register VALUE *val; diff --git a/math_error.h b/math_error.h index 5693fa4..a0bc2d6 100644 --- a/math_error.h +++ b/math_error.h @@ -1,7 +1,7 @@ /* * math_error - a simple libcalc math error routine * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.5 $ - * @(#) $Id: math_error.h,v 29.5 2001/06/08 21:00:58 chongo Exp $ + * @(#) $Revision: 29.6 $ + * @(#) $Id: math_error.h,v 29.6 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/math_error.h,v $ * * Under source code control: 1997/03/23 18:37:10 @@ -34,16 +34,16 @@ #if defined(CALC_SRC) /* if we are building from the calc source tree */ -# include "win32dll.h" +# include "decl.h" #else -# include +# include #endif /* * Global data definitions. */ -extern DLL jmp_buf jmpbuf; /* for errors */ +EXTERN jmp_buf jmpbuf; /* for errors */ #endif /* !__MATH_ERROR_H__ */ diff --git a/md5.c b/md5.c index 916bea5..1b3cb97 100644 --- a/md5.c +++ b/md5.c @@ -10,8 +10,8 @@ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: md5.c,v 29.3 2004/08/03 12:28:29 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: md5.c,v 29.4 2007/02/11 10:16:31 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/md5.c,v $ * * This file is not covered under version 2.1 of the GNU LGPL. @@ -54,6 +54,7 @@ #include +#include "decl.h" #include "longbits.h" #include "align32.h" #include "endian_calc.h" @@ -61,6 +62,9 @@ #include "hash.h" #include "md5.h" +CONST char *rsa_notice = "The md5 code was derived from the RSA " + "Data Security, Inc. MD5 Message-Digest Algorithm."; + /* * The F, G, H and I are basic MD5 functions. The following diff --git a/obj.c b/obj.c index 739e2d7..9fc88f7 100644 --- a/obj.c +++ b/obj.c @@ -1,7 +1,7 @@ /* * obj - object handling primitives * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.8 $ - * @(#) $Id: obj.c,v 29.8 2006/05/20 08:43:55 chongo Exp $ + * @(#) $Revision: 29.9 $ + * @(#) $Id: obj.c,v 29.9 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/obj.c,v $ * * Under source code control: 1990/02/15 01:48:19 @@ -64,7 +64,7 @@ #define ERR_ASSIGN 10 /* assign value */ -static struct objectinfo { +STATIC struct objectinfo { short args; /* number of arguments */ short retval; /* type of return value */ short error; /* special action on errors */ @@ -119,17 +119,17 @@ static struct objectinfo { }; -static STRINGHEAD objectnames; /* names of objects */ -static STRINGHEAD elements; /* element names for parts of objects */ -static OBJECTACTIONS **objects; /* table of actions for objects */ +STATIC STRINGHEAD objectnames; /* names of objects */ +STATIC STRINGHEAD elements; /* element names for parts of objects */ +STATIC OBJECTACTIONS **objects; /* table of actions for objects */ #define OBJALLOC 16 -static long maxobjcount = 0; +STATIC long maxobjcount = 0; -static VALUE objpowi(VALUE *vp, NUMBER *q); -static BOOL objtest(OBJECT *op); -static BOOL objcmp(OBJECT *op1, OBJECT *op2); -static void objprint(OBJECT *op); +S_FUNC VALUE objpowi(VALUE *vp, NUMBER *q); +S_FUNC BOOL objtest(OBJECT *op); +S_FUNC BOOL objcmp(OBJECT *op1, OBJECT *op2); +S_FUNC void objprint(OBJECT *op); /* @@ -159,7 +159,7 @@ VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3) { FUNC *fp; /* function to call */ - static OBJECTACTIONS *oap; /* object to call for */ + STATIC OBJECTACTIONS *oap; /* object to call for */ struct objectinfo *oip; /* information about action */ long index; /* index of function (negative if undefined) */ VALUE val; /* return value */ @@ -332,7 +332,7 @@ objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3) * given: * op object being printed */ -static void +S_FUNC void objprint(OBJECT *op) { int count; /* number of elements */ @@ -354,7 +354,7 @@ objprint(OBJECT *op) * This is the default routine if the user's is not defined. * Returns TRUE if any of the elements are "nonzero". */ -static BOOL +S_FUNC BOOL objtest(OBJECT *op) { int i; /* loop counter */ @@ -373,7 +373,7 @@ objtest(OBJECT *op) * This is the default routine if the user's is not defined. * For equality, all elements must be equal. */ -static BOOL +S_FUNC BOOL objcmp(OBJECT *op1, OBJECT *op2) { int i; /* loop counter */ @@ -399,7 +399,7 @@ objcmp(OBJECT *op1, OBJECT *op2) * vp value to be powered * q power to raise number to */ -static VALUE +S_FUNC VALUE objpowi(VALUE *vp, NUMBER *q) { VALUE res, tmp; diff --git a/opcodes.c b/opcodes.c index d1332e5..8d789b8 100644 --- a/opcodes.c +++ b/opcodes.c @@ -1,7 +1,7 @@ /* * opcodes - opcode execution module * - * Copyright (C) 1999-2006 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.12 $ - * @(#) $Id: opcodes.c,v 29.12 2006/06/25 22:05:38 chongo Exp $ + * @(#) $Revision: 29.13 $ + * @(#) $Id: opcodes.c,v 29.13 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $ * * Under source code control: 1990/02/15 01:48:19 @@ -53,13 +53,13 @@ #define QUICKLOCALS 20 /* local vars to handle quickly */ -static VALUE stackarray[MAXSTACK]; /* storage for stack */ -static VALUE oldvalue; /* previous calculation value */ -static BOOL saveval = TRUE; /* to enable or disable saving */ -static int calc_errno; /* most recent error-number */ -static int errcount; /* counts calls to error_value */ -static BOOL go; -static long calc_depth; +STATIC VALUE stackarray[MAXSTACK]; /* storage for stack */ +STATIC VALUE oldvalue; /* previous calculation value */ +STATIC BOOL saveval = TRUE; /* to enable or disable saving */ +STATIC int calc_errno; /* most recent error-number */ +STATIC int errcount; /* counts calls to error_value */ +STATIC BOOL go; +STATIC long calc_depth; /* * global symbols @@ -73,9 +73,9 @@ long funcline; /* function line being executed */ /* * forward declarations */ -static void showsizes(void); -static void o_paramaddr(FUNC *fp, int argcnt, VALUE *args, long index); -static void o_getvalue(void); +S_FUNC void showsizes(void); +S_FUNC void o_paramaddr(FUNC *fp, int argcnt, VALUE *args, long index); +S_FUNC void o_getvalue(void); /* @@ -107,8 +107,8 @@ struct opcode { /* * external configuration functions */ -extern void config_value(CONFIG *cfg, int type, VALUE *ret); -extern void setconfig(int type, VALUE *vp); +E_FUNC void config_value(CONFIG *cfg, int type, VALUE *ret); +E_FUNC void setconfig(int type, VALUE *vp); /* @@ -142,13 +142,13 @@ initstack(void) /* * The various opcodes */ -static void +S_FUNC void o_nop(void) { } -static void +S_FUNC void o_localaddr(FUNC *fp, VALUE *locals, long index) { if ((unsigned long)index >= fp->f_localcount) { @@ -164,7 +164,7 @@ o_localaddr(FUNC *fp, VALUE *locals, long index) /*ARGSUSED*/ -static void +S_FUNC void o_globaladdr(FUNC UNUSED *fp, GLOBAL *sp) { if (sp == NULL) { @@ -179,7 +179,7 @@ o_globaladdr(FUNC UNUSED *fp, GLOBAL *sp) /*ARGSUSED*/ -static void +S_FUNC void o_paramaddr(FUNC UNUSED *fp, int argcount, VALUE *args, long index) { if ((long)index >= argcount) { @@ -198,7 +198,7 @@ o_paramaddr(FUNC UNUSED *fp, int argcount, VALUE *args, long index) } -static void +S_FUNC void o_localvalue(FUNC *fp, VALUE *locals, long index) { if ((unsigned long)index >= fp->f_localcount) { @@ -211,7 +211,7 @@ o_localvalue(FUNC *fp, VALUE *locals, long index) /*ARGSUSED*/ -static void +S_FUNC void o_globalvalue(FUNC UNUSED *fp, GLOBAL *sp) { if (sp == NULL) { @@ -223,7 +223,7 @@ o_globalvalue(FUNC UNUSED *fp, GLOBAL *sp) /*ARGSUSED*/ -static void +S_FUNC void o_paramvalue(FUNC UNUSED *fp, int argcount, VALUE *args, long index) { if ((long)index >= argcount) { @@ -237,7 +237,7 @@ o_paramvalue(FUNC UNUSED *fp, int argcount, VALUE *args, long index) } -static void +S_FUNC void o_argvalue(FUNC *fp, int argcount, VALUE *args) { VALUE *vp; @@ -268,7 +268,7 @@ o_argvalue(FUNC *fp, int argcount, VALUE *args) /*ARGSUSED*/ -static void +S_FUNC void o_number(FUNC UNUSED *fp, long arg) { NUMBER *q; @@ -286,7 +286,7 @@ o_number(FUNC UNUSED *fp, long arg) /*ARGSUSED*/ -static void +S_FUNC void o_imaginary(FUNC UNUSED *fp, long arg) { NUMBER *q; @@ -313,7 +313,7 @@ o_imaginary(FUNC UNUSED *fp, long arg) /*ARGSUSED*/ -static void +S_FUNC void o_string(FUNC UNUSED *fp, long arg) { stack++; @@ -323,7 +323,7 @@ o_string(FUNC UNUSED *fp, long arg) } -static void +S_FUNC void o_undef(void) { stack++; @@ -333,7 +333,7 @@ o_undef(void) /*ARGSUSED*/ -static void +S_FUNC void o_matcreate(FUNC UNUSED *fp, long dim) { register MATRIX *mp; /* matrix being defined */ @@ -401,11 +401,11 @@ o_matcreate(FUNC UNUSED *fp, long dim) /*ARGSUSED*/ -static void +S_FUNC void o_eleminit(FUNC UNUSED *fp, long index) { VALUE *vp; - static VALUE *oldvp; + STATIC VALUE *oldvp; VALUE tmp; OCTET *ptr; BLOCK *blk; @@ -542,7 +542,7 @@ o_eleminit(FUNC UNUSED *fp, long index) * writeflag nonzero if element will be written */ /*ARGSUSED*/ -static void +S_FUNC void o_indexaddr(FUNC UNUSED *fp, long dim, long writeflag) { int i; @@ -695,7 +695,7 @@ o_indexaddr(FUNC UNUSED *fp, long dim, long writeflag) /*ARGSUSED*/ -static void +S_FUNC void o_elemaddr(FUNC UNUSED *fp, long index) { VALUE *vp; @@ -741,7 +741,7 @@ o_elemaddr(FUNC UNUSED *fp, long index) } -static void +S_FUNC void o_elemvalue(FUNC *fp, long index) { o_elemaddr(fp, index); @@ -750,7 +750,7 @@ o_elemvalue(FUNC *fp, long index) /*ARGSUSED*/ -static void +S_FUNC void o_objcreate(FUNC UNUSED *fp, long arg) { stack++; @@ -760,7 +760,7 @@ o_objcreate(FUNC UNUSED *fp, long arg) } -static void +S_FUNC void o_assign(void) { VALUE *var; /* variable value */ @@ -876,7 +876,7 @@ o_assign(void) } -static void +S_FUNC void o_assignback(void) { VALUE tmp; @@ -888,7 +888,7 @@ o_assignback(void) } -static void +S_FUNC void o_assignpop(void) { o_assign(); @@ -896,7 +896,7 @@ o_assignpop(void) } -static void +S_FUNC void o_ptr(void) { switch (stack->v_type) { @@ -921,7 +921,7 @@ o_ptr(void) } -static void +S_FUNC void o_deref(void) { VALUE *vp; @@ -991,7 +991,7 @@ o_deref(void) } -static void +S_FUNC void o_swap(void) { VALUE *v1, *v2; /* variables to be swapped */ @@ -1031,7 +1031,7 @@ o_swap(void) } -static void +S_FUNC void o_add(void) { VALUE *v1, *v2; @@ -1068,7 +1068,7 @@ o_add(void) } -static void +S_FUNC void o_sub(void) { VALUE *v1, *v2; @@ -1105,7 +1105,7 @@ o_sub(void) } -static void +S_FUNC void o_mul(void) { VALUE *v1, *v2; @@ -1141,7 +1141,7 @@ o_mul(void) } -static void +S_FUNC void o_power(void) { VALUE *v1, *v2; @@ -1160,7 +1160,7 @@ o_power(void) } -static void +S_FUNC void o_div(void) { VALUE *v1, *v2; @@ -1196,7 +1196,7 @@ o_div(void) } -static void +S_FUNC void o_quo(void) { VALUE *v1, *v2; @@ -1217,7 +1217,7 @@ o_quo(void) } -static void +S_FUNC void o_mod(void) { VALUE *v1, *v2; @@ -1238,7 +1238,7 @@ o_mod(void) } -static void +S_FUNC void o_and(void) { VALUE *v1, *v2; @@ -1258,7 +1258,7 @@ o_and(void) } -static void +S_FUNC void o_or(void) { VALUE *v1, *v2; @@ -1277,7 +1277,7 @@ o_or(void) *stack = tmp; } -static void +S_FUNC void o_xor (void) { VALUE *v1, *v2; @@ -1298,7 +1298,7 @@ o_xor (void) } -static void +S_FUNC void o_comp (void) { VALUE *vp; @@ -1313,7 +1313,7 @@ o_comp (void) } -static void +S_FUNC void o_not(void) { VALUE *vp; @@ -1337,7 +1337,7 @@ o_not(void) } -static void +S_FUNC void o_plus (void) { VALUE *vp; @@ -1364,7 +1364,7 @@ o_plus (void) } -static void +S_FUNC void o_negate(void) { VALUE *vp; @@ -1389,7 +1389,7 @@ o_negate(void) } -static void +S_FUNC void o_invert(void) { VALUE *vp; @@ -1405,7 +1405,7 @@ o_invert(void) } -static void +S_FUNC void o_scale(void) { VALUE *v1, *v2; @@ -1424,7 +1424,7 @@ o_scale(void) } -static void +S_FUNC void o_int(void) { VALUE *vp; @@ -1439,7 +1439,7 @@ o_int(void) } -static void +S_FUNC void o_frac(void) { VALUE *vp; @@ -1454,7 +1454,7 @@ o_frac(void) } -static void +S_FUNC void o_abs(void) { VALUE *v1, *v2; @@ -1489,7 +1489,7 @@ o_abs(void) } -static void +S_FUNC void o_norm(void) { VALUE *vp; @@ -1514,7 +1514,7 @@ o_norm(void) } -static void +S_FUNC void o_square(void) { VALUE *vp; @@ -1539,7 +1539,7 @@ o_square(void) } -static void +S_FUNC void o_test(void) { VALUE *vp; @@ -1556,7 +1556,7 @@ o_test(void) } -static void +S_FUNC void o_links(void) { VALUE *vp; @@ -1588,7 +1588,7 @@ o_links(void) } -static void +S_FUNC void o_bit (void) { VALUE *v1, *v2; @@ -1637,7 +1637,7 @@ o_bit (void) stack->v_subtype = V_NOSUBTYPE; } -static void +S_FUNC void o_highbit (void) { VALUE *vp; @@ -1685,7 +1685,7 @@ o_highbit (void) } -static void +S_FUNC void o_lowbit (void) { VALUE *vp; @@ -1737,7 +1737,7 @@ o_lowbit (void) } -static void +S_FUNC void o_content (void) { VALUE *vp; @@ -1752,7 +1752,7 @@ o_content (void) } -static void +S_FUNC void o_hashop (void) { VALUE *v1, *v2; @@ -1771,7 +1771,7 @@ o_hashop (void) } -static void +S_FUNC void o_backslash (void) { VALUE *vp; @@ -1786,7 +1786,7 @@ o_backslash (void) } -static void +S_FUNC void o_setminus (void) { VALUE *v1, *v2; @@ -1805,7 +1805,7 @@ o_setminus (void) } -static void +S_FUNC void o_istype(void) { VALUE *v1, *v2; @@ -1829,7 +1829,7 @@ o_istype(void) } -static void +S_FUNC void o_isint(void) { VALUE *vp; @@ -1857,7 +1857,7 @@ o_isint(void) } -static void +S_FUNC void o_isnum(void) { VALUE *vp; @@ -1887,7 +1887,7 @@ o_isnum(void) } -static void +S_FUNC void o_ismat(void) { VALUE *vp; @@ -1909,7 +1909,7 @@ o_ismat(void) } -static void +S_FUNC void o_islist(void) { VALUE *vp; @@ -1926,7 +1926,7 @@ o_islist(void) } -static void +S_FUNC void o_isobj(void) { VALUE *vp; @@ -1943,7 +1943,7 @@ o_isobj(void) } -static void +S_FUNC void o_isstr(void) { VALUE *vp; @@ -1960,7 +1960,7 @@ o_isstr(void) } -static void +S_FUNC void o_isfile(void) { VALUE *vp; @@ -1977,7 +1977,7 @@ o_isfile(void) } -static void +S_FUNC void o_isrand(void) { VALUE *vp; @@ -1994,7 +1994,7 @@ o_isrand(void) } -static void +S_FUNC void o_israndom(void) { VALUE *vp; @@ -2011,7 +2011,7 @@ o_israndom(void) } -static void +S_FUNC void o_isconfig(void) { VALUE *vp; @@ -2028,7 +2028,7 @@ o_isconfig(void) } -static void +S_FUNC void o_ishash(void) { VALUE *vp; @@ -2047,7 +2047,7 @@ o_ishash(void) } -static void +S_FUNC void o_isassoc(void) { VALUE *vp; @@ -2064,7 +2064,7 @@ o_isassoc(void) } -static void +S_FUNC void o_isblock(void) { VALUE *vp; @@ -2085,7 +2085,7 @@ o_isblock(void) } -static void +S_FUNC void o_isoctet(void) { VALUE *vp; @@ -2102,7 +2102,7 @@ o_isoctet(void) } -static void +S_FUNC void o_isptr(void) { VALUE *vp; @@ -2125,7 +2125,7 @@ o_isptr(void) } -static void +S_FUNC void o_isdefined(void) { VALUE *vp; @@ -2155,7 +2155,7 @@ o_isdefined(void) } -static void +S_FUNC void o_isobjtype(void) { VALUE *vp; @@ -2176,7 +2176,7 @@ o_isobjtype(void) } -static void +S_FUNC void o_issimple(void) { VALUE *vp; @@ -2200,7 +2200,7 @@ o_issimple(void) } -static void +S_FUNC void o_isodd(void) { VALUE *vp; @@ -2223,7 +2223,7 @@ o_isodd(void) } -static void +S_FUNC void o_iseven(void) { VALUE *vp; @@ -2246,7 +2246,7 @@ o_iseven(void) } -static void +S_FUNC void o_isreal(void) { VALUE *vp; @@ -2269,7 +2269,7 @@ o_isreal(void) } -static void +S_FUNC void o_isnull(void) { VALUE *vp; @@ -2291,7 +2291,7 @@ o_isnull(void) } -static void +S_FUNC void o_re(void) { VALUE *vp; @@ -2321,7 +2321,7 @@ o_re(void) } -static void +S_FUNC void o_im(void) { VALUE *vp; @@ -2351,7 +2351,7 @@ o_im(void) } -static void +S_FUNC void o_conjugate(void) { VALUE *vp; @@ -2374,7 +2374,7 @@ o_conjugate(void) } -static void +S_FUNC void o_fiaddr(void) { register MATRIX *m; /* current matrix element */ @@ -2446,7 +2446,7 @@ o_fiaddr(void) } -static void +S_FUNC void o_fivalue(void) { (void) o_fiaddr(); @@ -2454,7 +2454,7 @@ o_fivalue(void) } -static void +S_FUNC void o_sgn(void) { VALUE *vp; @@ -2479,7 +2479,7 @@ o_sgn(void) } -static void +S_FUNC void o_numerator(void) { VALUE *vp; @@ -2503,7 +2503,7 @@ o_numerator(void) } -static void +S_FUNC void o_denominator(void) { VALUE *vp; @@ -2525,7 +2525,7 @@ o_denominator(void) } -static void +S_FUNC void o_duplicate(void) { VALUE *vp; @@ -2535,7 +2535,7 @@ o_duplicate(void) } -static void +S_FUNC void o_dupvalue(void) { if (stack->v_type == V_ADDR) @@ -2546,21 +2546,21 @@ o_dupvalue(void) } -static void +S_FUNC void o_pop(void) { freevalue(stack--); } -static void +S_FUNC void o_return(void) { } /*ARGSUSED*/ -static void +S_FUNC void o_jumpz(FUNC UNUSED *fp, BOOL *dojump) { VALUE *vp; @@ -2584,7 +2584,7 @@ o_jumpz(FUNC UNUSED *fp, BOOL *dojump) /*ARGSUSED*/ -static void +S_FUNC void o_jumpnz(FUNC UNUSED *fp, BOOL *dojump) { VALUE *vp; @@ -2611,7 +2611,7 @@ o_jumpnz(FUNC UNUSED *fp, BOOL *dojump) * jumpnn invokes a jump if top value points to a null value */ /*ARGSUSED*/ -static void +S_FUNC void o_jumpnn(FUNC UNUSED *fp, BOOL *dojump) { if (stack->v_addr->v_type) { @@ -2622,7 +2622,7 @@ o_jumpnn(FUNC UNUSED *fp, BOOL *dojump) /*ARGSUSED*/ -static void +S_FUNC void o_condorjump(FUNC UNUSED *fp, BOOL *dojump) { VALUE *vp; @@ -2648,7 +2648,7 @@ o_condorjump(FUNC UNUSED *fp, BOOL *dojump) /*ARGSUSED*/ -static void +S_FUNC void o_condandjump(FUNC UNUSED *fp, BOOL *dojump) { VALUE *vp; @@ -2679,7 +2679,7 @@ o_condandjump(FUNC UNUSED *fp, BOOL *dojump) * If they are equal, pop both values and do not jump. */ /*ARGSUSED*/ -static void +S_FUNC void o_casejump(FUNC UNUSED *fp, BOOL *dojump) { VALUE *v1, *v2; @@ -2701,14 +2701,14 @@ o_casejump(FUNC UNUSED *fp, BOOL *dojump) /*ARGSUSED*/ -static void +S_FUNC void o_jump(FUNC UNUSED *fp, BOOL *dojump) { *dojump = TRUE; } -static void +S_FUNC void o_usercall(FUNC *fp, long index, long argcount) { fp = findfunc(index); @@ -2721,7 +2721,7 @@ o_usercall(FUNC *fp, long index, long argcount) /*ARGSUSED*/ -static void +S_FUNC void o_call(FUNC UNUSED *fp, long index, long argcount) { VALUE result; @@ -2734,7 +2734,7 @@ o_call(FUNC UNUSED *fp, long index, long argcount) } -static void +S_FUNC void o_getvalue(void) { if (stack->v_type == V_ADDR) @@ -2742,7 +2742,7 @@ o_getvalue(void) } -static void +S_FUNC void o_cmp(void) { VALUE *v1, *v2; @@ -2761,7 +2761,7 @@ o_cmp(void) } -static void +S_FUNC void o_eq(void) { VALUE *v1, *v2; @@ -2782,7 +2782,7 @@ o_eq(void) } -static void +S_FUNC void o_ne(void) { VALUE *v1, *v2; @@ -2803,7 +2803,7 @@ o_ne(void) } -static void +S_FUNC void o_le(void) { VALUE *v1, *v2; @@ -2833,7 +2833,7 @@ o_le(void) } -static void +S_FUNC void o_ge(void) { VALUE *v1, *v2; @@ -2862,7 +2862,7 @@ o_ge(void) } -static void +S_FUNC void o_lt(void) { VALUE *v1, *v2; @@ -2891,7 +2891,7 @@ o_lt(void) } -static void +S_FUNC void o_gt(void) { VALUE *v1, *v2; @@ -2920,7 +2920,7 @@ o_gt(void) } -static void +S_FUNC void o_preinc(void) { VALUE *vp, tmp; @@ -2950,7 +2950,7 @@ o_preinc(void) } -static void +S_FUNC void o_predec(void) { VALUE *vp, tmp; @@ -2979,7 +2979,7 @@ o_predec(void) } -static void +S_FUNC void o_postinc(void) { VALUE *vp; @@ -3022,7 +3022,7 @@ o_postinc(void) } -static void +S_FUNC void o_postdec(void) { VALUE *vp; @@ -3064,7 +3064,7 @@ o_postdec(void) } -static void +S_FUNC void o_leftshift(void) { VALUE *v1, *v2; @@ -3083,7 +3083,7 @@ o_leftshift(void) } -static void +S_FUNC void o_rightshift(void) { VALUE *v1, *v2; @@ -3103,7 +3103,7 @@ o_rightshift(void) /*ARGSUSED*/ -static void +S_FUNC void o_debug(FUNC UNUSED *fp, long line) { funcline = line; @@ -3114,7 +3114,7 @@ o_debug(FUNC UNUSED *fp, long line) } -static void +S_FUNC void o_printresult(void) { VALUE *vp; @@ -3134,7 +3134,7 @@ o_printresult(void) /*ARGSUSED*/ -static void +S_FUNC void o_print(FUNC UNUSED *fp, long flags) { VALUE *vp; @@ -3150,7 +3150,7 @@ o_print(FUNC UNUSED *fp, long flags) } -static void +S_FUNC void o_printeol(void) { math_chr('\n'); @@ -3158,7 +3158,7 @@ o_printeol(void) } -static void +S_FUNC void o_printspace(void) { math_chr(' '); @@ -3168,7 +3168,7 @@ o_printspace(void) /*ARGSUSED*/ -static void +S_FUNC void o_printstring(FUNC UNUSED *fp, long index) { STRING *s; @@ -3183,7 +3183,7 @@ o_printstring(FUNC UNUSED *fp, long index) } -static void +S_FUNC void o_zero(void) { stack++; @@ -3193,7 +3193,7 @@ o_zero(void) } -static void +S_FUNC void o_one(void) { stack++; @@ -3203,7 +3203,7 @@ o_one(void) } -static void +S_FUNC void o_save(FUNC *fp) { VALUE *vp; @@ -3218,7 +3218,7 @@ o_save(FUNC *fp) } -static void +S_FUNC void o_oldvalue(void) { ++stack; @@ -3240,7 +3240,7 @@ o_setsaveval(void) } -static void +S_FUNC void o_quit(FUNC *fp, long index) { STRING *s; @@ -3272,7 +3272,7 @@ o_quit(FUNC *fp, long index) } -static void +S_FUNC void o_abort(FUNC *fp, long index) { abort_now = TRUE; @@ -3280,7 +3280,7 @@ o_abort(FUNC *fp, long index) } -static void +S_FUNC void o_getepsilon(void) { stack++; @@ -3290,7 +3290,7 @@ o_getepsilon(void) } -static void +S_FUNC void o_setepsilon(void) { VALUE *vp; @@ -3313,7 +3313,7 @@ o_setepsilon(void) } -static void +S_FUNC void o_setconfig(void) { int type; @@ -3344,7 +3344,7 @@ o_setconfig(void) } -static void +S_FUNC void o_getconfig(void) { int type; @@ -3438,7 +3438,7 @@ set_errcount(int e) /* * Fill a newly created matrix at v1 with copies of value at v2. */ -static void +S_FUNC void o_initfill(void) { VALUE *v1, *v2; @@ -3465,7 +3465,7 @@ o_initfill(void) /*ARGSUSED*/ -static void +S_FUNC void o_show(FUNC *fp, long arg) { unsigned int size; @@ -3503,7 +3503,7 @@ o_show(FUNC *fp, long arg) } -static void +S_FUNC void showsizes(void) { printf("\tchar\t\t%4ld\n", (long)sizeof(char)); @@ -3539,7 +3539,7 @@ showsizes(void) /* * Information about each opcode. */ -static struct opcode opcodes[MAX_OPCODE+1] = { +STATIC struct opcode opcodes[MAX_OPCODE+1] = { {o_nop, OPNUL, "NOP"}, /* no operation */ {o_localaddr, OPLOC, "LOCALADDR"}, /* address of local variable */ {o_globaladdr, OPGLB, "GLOBALADDR"}, /* address of global variable */ diff --git a/opcodes.h b/opcodes.h index 5aae904..6ff7bf8 100644 --- a/opcodes.h +++ b/opcodes.h @@ -1,7 +1,7 @@ /* * opcodes - opcode execution module definition * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: opcodes.h,v 29.7 2006/06/25 20:33:26 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: opcodes.h,v 29.8 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.h,v $ * * Under source code control: 1990/02/15 01:48:35 @@ -33,9 +33,9 @@ #if defined(CALC_SRC) /* if we are building from the calc source tree */ -# include "win32dll.h" +# include "decl.h" #else -# include +# include #endif @@ -180,8 +180,8 @@ /* * external declarations */ -extern DLL char *funcname; /* function being executed */ -extern DLL long funcline; /* function line being executed */ +EXTERN char *funcname; /* function being executed */ +EXTERN long funcline; /* function line being executed */ #endif /* !__OPCODES_H__ */ diff --git a/prime.c b/prime.c index 92fbbe2..06ac3a5 100644 --- a/prime.c +++ b/prime.c @@ -1,7 +1,7 @@ /* * prime - quickly determine if a small number is prime * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: prime.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: prime.c,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/prime.c,v $ * * Under source code control: 1994/06/04 03:26:14 @@ -916,11 +916,11 @@ CONST unsigned short prime[MAP_POPCNT+1] = { * smallest prime > MAX_SM_PRIME (2^32-5) == 2^32+15 */ #if BASEB == 32 -static CONST HALF _nxt_prime_val_[] = { 0xf, 0x1 }; +STATIC CONST HALF _nxt_prime_val_[] = { 0xf, 0x1 }; ZVALUE CONST _nxt_prime_ = { (HALF *)_nxt_prime_val_, 2, 0 }; NUMBER _nxtprime_ = {{(HALF *)_nxt_prime_val_,2,0}, {_oneval_,1,0}, 1, NULL}; #else -static CONST HALF _nxt_prime_val_[] = { 0xf, 0x0, 0x1 }; +STATIC CONST HALF _nxt_prime_val_[] = { 0xf, 0x0, 0x1 }; ZVALUE CONST _nxt_prime_ = { (HALF *)_nxt_prime_val_, 3, 0 }; NUMBER _nxtprime_ = {{(HALF *)_nxt_prime_val_,3,0}, {_oneval_,1,0}, 1, NULL}; #endif @@ -928,5 +928,5 @@ NUMBER _nxtprime_ = {{(HALF *)_nxt_prime_val_,3,0}, {_oneval_,1,0}, 1, NULL}; /* * JMPMOD*2 as a ZVALUE */ -static CONST HALF _jmpmod2_val_[] = { JMPMOD*2 }; +STATIC CONST HALF _jmpmod2_val_[] = { JMPMOD*2 }; CONST ZVALUE _jmpmod2_ = { (HALF *)_jmpmod2_val_, 1, 0 }; diff --git a/prime.h b/prime.h index 933ea5b..21fe5a4 100644 --- a/prime.h +++ b/prime.h @@ -1,7 +1,7 @@ /* * prime - quickly determine if a small number is prime * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: prime.h,v 29.4 2001/06/08 21:00:58 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: prime.h,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/prime.h,v $ * * Under source code control: 1994/06/04 03:26:15 @@ -82,13 +82,13 @@ /* * Prime related external arrays. */ -extern CONST unsigned short prime[]; -extern CONST unsigned char pr_map[]; -extern CONST unsigned short pi10b[]; -extern CONST unsigned short pi18b[]; -extern NUMBER _nxtprime_; /* 2^32+15 - smallest prime > 2^32 */ -extern CONST ZVALUE _nxt_prime_; /* 2^32+15 - smallest prime > 2^32 */ -extern CONST ZVALUE _jmpmod2_; /* JMPMOD*2 as a ZVALUE */ +EXTERN CONST unsigned short prime[]; +EXTERN CONST unsigned char pr_map[]; +EXTERN CONST unsigned short pi10b[]; +EXTERN CONST unsigned short pi18b[]; +EXTERN NUMBER _nxtprime_; /* 2^32+15 - smallest prime > 2^32 */ +EXTERN CONST ZVALUE _nxt_prime_; /* 2^32+15 - smallest prime > 2^32 */ +EXTERN CONST ZVALUE _jmpmod2_; /* JMPMOD*2 as a ZVALUE */ #endif /* !__PRIME_H__ */ diff --git a/qfunc.c b/qfunc.c index 7ac3117..7838acd 100644 --- a/qfunc.c +++ b/qfunc.c @@ -1,7 +1,7 @@ /* * qfunc - extended precision rational arithmetic non-primitive functions * - * Copyright (C) 1999-2004 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.9 $ - * @(#) $Id: qfunc.c,v 29.9 2006/05/20 08:43:55 chongo Exp $ + * @(#) $Revision: 29.10 $ + * @(#) $Id: qfunc.c,v 29.10 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $ * * Under source code control: 1990/02/15 01:48:20 @@ -34,11 +34,11 @@ #include "config.h" #include "prime.h" -static NUMBER **B_table; -static long B_num; -static long B_allocnum; -static NUMBER **E_table; -static long E_num; +STATIC NUMBER **B_table; +STATIC long B_num; +STATIC long B_allocnum; +STATIC NUMBER **E_table; +STATIC long E_num; #define QALLOCNUM 64 diff --git a/qio.c b/qio.c index dba3b0b..41936d7 100644 --- a/qio.c +++ b/qio.c @@ -1,7 +1,7 @@ /* * qio - scanf and printf routines for arbitrary precision rational numbers * - * Copyright (C) 1999-2004 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.8 $ - * @(#) $Id: qio.c,v 29.8 2006/05/20 08:43:55 chongo Exp $ + * @(#) $Revision: 29.9 $ + * @(#) $Id: qio.c,v 29.9 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qio.c,v $ * * Under source code control: 1993/07/30 19:42:46 @@ -40,8 +40,8 @@ #define PRINTF1(fmt, a1) math_fmt(fmt, a1) #define PRINTF2(fmt, a1, a2) math_fmt(fmt, a1, a2) -static long scalefactor; -static ZVALUE scalenumber = { 0, 0, 0 }; +STATIC long scalefactor; +STATIC ZVALUE scalenumber = { 0, 0, 0 }; /* diff --git a/qmath.c b/qmath.c index ec5b273..3de5a3f 100644 --- a/qmath.c +++ b/qmath.c @@ -1,7 +1,7 @@ /* * qmath - extended precision rational arithmetic primitive routines * - * Copyright (C) 1999-2004 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: qmath.c,v 29.7 2006/12/15 16:18:10 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: qmath.c,v 29.8 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.c,v $ * * Under source code control: 1990/02/15 01:48:21 @@ -1393,9 +1393,9 @@ qcmpi(NUMBER *q, long n) #define NNALLOC 1000 -static NUMBER *freeNum = NULL; -static NUMBER **firstNums = NULL; -static long blockcount = 0; +STATIC NUMBER *freeNum = NULL; +STATIC NUMBER **firstNums = NULL; +STATIC long blockcount = 0; NUMBER * diff --git a/qmath.h b/qmath.h index 4a30927..a10ebd3 100644 --- a/qmath.h +++ b/qmath.h @@ -1,7 +1,7 @@ /* * qmath - declarations for extended precision rational arithmetic * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.8 $ - * @(#) $Id: qmath.h,v 29.8 2006/12/15 16:18:10 chongo Exp $ + * @(#) $Revision: 29.9 $ + * @(#) $Id: qmath.h,v 29.9 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.h,v $ * * Under source code control: 1993/07/30 19:42:47 @@ -53,188 +53,188 @@ struct number { typedef struct number NUMBER; -extern NUMBER _qlge_; +EXTERN NUMBER _qlge_; /* * Input. output, allocation, and conversion routines. */ -extern NUMBER *qalloc(void); -extern NUMBER *qcopy(NUMBER *q); -extern NUMBER *uutoq(FULL i1, FULL i2); -extern NUMBER *iitoq(long i1, long i2); -extern NUMBER *str2q(char *str); -extern NUMBER *itoq(long i); -extern NUMBER *utoq(FULL i); -extern NUMBER *stoq(SFULL i); -extern long qtoi(NUMBER *q); -extern FULL qtou(NUMBER *q); -extern SFULL qtos(NUMBER *q); -extern long qparse(char *str, int flags); -extern void qfreenum(NUMBER *q); -extern void qprintnum(NUMBER *q, int mode); -extern void qprintff(NUMBER *q, long width, long precision); -extern void qprintfe(NUMBER *q, long width, long precision); -extern void qprintfr(NUMBER *q, long width, BOOL force); -extern void qprintfd(NUMBER *q, long width); -extern void qprintfx(NUMBER *q, long width); -extern void qprintfb(NUMBER *q, long width); -extern void qprintfo(NUMBER *q, long width); -extern void qprintf(char *, ...); -extern void shownumbers(void); -extern void showredcdata(void); -extern void freeredcdata(void); -extern void fitprint(NUMBER *, long); +E_FUNC NUMBER *qalloc(void); +E_FUNC NUMBER *qcopy(NUMBER *q); +E_FUNC NUMBER *uutoq(FULL i1, FULL i2); +E_FUNC NUMBER *iitoq(long i1, long i2); +E_FUNC NUMBER *str2q(char *str); +E_FUNC NUMBER *itoq(long i); +E_FUNC NUMBER *utoq(FULL i); +E_FUNC NUMBER *stoq(SFULL i); +E_FUNC long qtoi(NUMBER *q); +E_FUNC FULL qtou(NUMBER *q); +E_FUNC SFULL qtos(NUMBER *q); +E_FUNC long qparse(char *str, int flags); +E_FUNC void qfreenum(NUMBER *q); +E_FUNC void qprintnum(NUMBER *q, int mode); +E_FUNC void qprintff(NUMBER *q, long width, long precision); +E_FUNC void qprintfe(NUMBER *q, long width, long precision); +E_FUNC void qprintfr(NUMBER *q, long width, BOOL force); +E_FUNC void qprintfd(NUMBER *q, long width); +E_FUNC void qprintfx(NUMBER *q, long width); +E_FUNC void qprintfb(NUMBER *q, long width); +E_FUNC void qprintfo(NUMBER *q, long width); +E_FUNC void qprintf(char *, ...); +E_FUNC void shownumbers(void); +E_FUNC void showredcdata(void); +E_FUNC void freeredcdata(void); +E_FUNC void fitprint(NUMBER *, long); /* * Basic numeric routines. */ -extern NUMBER *qaddi(NUMBER *q, long i); -extern NUMBER *qmuli(NUMBER *q, long i); -extern NUMBER *qdivi(NUMBER *q, long i); -extern NUMBER *qqadd(NUMBER *q1, NUMBER *q2); -extern NUMBER *qsub(NUMBER *q1, NUMBER *q2); -extern NUMBER *qmul(NUMBER *q1, NUMBER *q2); -extern NUMBER *qqdiv(NUMBER *q1, NUMBER *q2); -extern NUMBER *qquo(NUMBER *q1, NUMBER *q2, long rnd); -extern NUMBER *qmod(NUMBER *q1, NUMBER *q2, long rnd); -extern NUMBER *qmin(NUMBER *q1, NUMBER *q2); -extern NUMBER *qmax(NUMBER *q1, NUMBER *q2); -extern NUMBER *qand(NUMBER *q1, NUMBER *q2); -extern NUMBER *qor(NUMBER *q1, NUMBER *q2); -extern NUMBER *qxor(NUMBER *q1, NUMBER *q2); -extern NUMBER *qandnot(NUMBER *q1, NUMBER *q2); -extern NUMBER *qcomp(NUMBER *q); -extern NUMBER *qpowermod(NUMBER *q1, NUMBER *q2, NUMBER *q3); -extern NUMBER *qpowi(NUMBER *q1, NUMBER *q2); -extern NUMBER *qsquare(NUMBER *q); -extern NUMBER *qneg(NUMBER *q); -extern NUMBER *qsign(NUMBER *q); -extern NUMBER *qint(NUMBER *q); -extern NUMBER *qfrac(NUMBER *q); -extern NUMBER *qnum(NUMBER *q); -extern NUMBER *qden(NUMBER *q); -extern NUMBER *qinv(NUMBER *q); -extern NUMBER *qqabs(NUMBER *q); -extern NUMBER *qinc(NUMBER *q); -extern NUMBER *qdec(NUMBER *q); -extern NUMBER *qshift(NUMBER *q, long n); -extern NUMBER *qtrunc(NUMBER *q1, NUMBER *q2); -extern NUMBER *qround(NUMBER *q, long places, long rnd); -extern NUMBER *qbtrunc(NUMBER *q1, NUMBER *q2); -extern NUMBER *qbround(NUMBER *q, long places, long rnd); -extern NUMBER *qscale(NUMBER *q, long i); -extern BOOL qdivides(NUMBER *q1, NUMBER *q2); -extern BOOL qcmp(NUMBER *q1, NUMBER *q2); -extern BOOL qcmpi(NUMBER *q, long i); -extern FLAG qrel(NUMBER *q1, NUMBER *q2); -extern FLAG qreli(NUMBER *q, long i); -extern BOOL qisset(NUMBER *q, long i); +E_FUNC NUMBER *qaddi(NUMBER *q, long i); +E_FUNC NUMBER *qmuli(NUMBER *q, long i); +E_FUNC NUMBER *qdivi(NUMBER *q, long i); +E_FUNC NUMBER *qqadd(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qsub(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qmul(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qqdiv(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qquo(NUMBER *q1, NUMBER *q2, long rnd); +E_FUNC NUMBER *qmod(NUMBER *q1, NUMBER *q2, long rnd); +E_FUNC NUMBER *qmin(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qmax(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qand(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qor(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qxor(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qandnot(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qcomp(NUMBER *q); +E_FUNC NUMBER *qpowermod(NUMBER *q1, NUMBER *q2, NUMBER *q3); +E_FUNC NUMBER *qpowi(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qsquare(NUMBER *q); +E_FUNC NUMBER *qneg(NUMBER *q); +E_FUNC NUMBER *qsign(NUMBER *q); +E_FUNC NUMBER *qint(NUMBER *q); +E_FUNC NUMBER *qfrac(NUMBER *q); +E_FUNC NUMBER *qnum(NUMBER *q); +E_FUNC NUMBER *qden(NUMBER *q); +E_FUNC NUMBER *qinv(NUMBER *q); +E_FUNC NUMBER *qqabs(NUMBER *q); +E_FUNC NUMBER *qinc(NUMBER *q); +E_FUNC NUMBER *qdec(NUMBER *q); +E_FUNC NUMBER *qshift(NUMBER *q, long n); +E_FUNC NUMBER *qtrunc(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qround(NUMBER *q, long places, long rnd); +E_FUNC NUMBER *qbtrunc(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qbround(NUMBER *q, long places, long rnd); +E_FUNC NUMBER *qscale(NUMBER *q, long i); +E_FUNC BOOL qdivides(NUMBER *q1, NUMBER *q2); +E_FUNC BOOL qcmp(NUMBER *q1, NUMBER *q2); +E_FUNC BOOL qcmpi(NUMBER *q, long i); +E_FUNC FLAG qrel(NUMBER *q1, NUMBER *q2); +E_FUNC FLAG qreli(NUMBER *q, long i); +E_FUNC BOOL qisset(NUMBER *q, long i); /* * More complicated numeric functions. */ -extern NUMBER *qcomb(NUMBER *q1, NUMBER *q2); -extern NUMBER *qgcd(NUMBER *q1, NUMBER *q2); -extern NUMBER *qlcm(NUMBER *q1, NUMBER *q2); -extern NUMBER *qfact(NUMBER *q); -extern NUMBER *qpfact(NUMBER *q); -extern NUMBER *qminv(NUMBER *q1, NUMBER *q2); -extern NUMBER *qfacrem(NUMBER *q1, NUMBER *q2); -extern NUMBER *qperm(NUMBER *q1, NUMBER *q2); -extern NUMBER *qgcdrem(NUMBER *q1, NUMBER *q2); -extern NUMBER *qlowfactor(NUMBER *q1, NUMBER *q2); -extern NUMBER *qfib(NUMBER *q); -extern NUMBER *qcfappr(NUMBER *q, NUMBER *epsilon, long R); -extern NUMBER *qcfsim(NUMBER *q, long R); -extern NUMBER *qisqrt(NUMBER *q); -extern NUMBER *qjacobi(NUMBER *q1, NUMBER *q2); -extern NUMBER *qiroot(NUMBER *q1, NUMBER *q2); -extern NUMBER *qmappr(NUMBER *q, NUMBER *e, long R); -extern NUMBER *qlcmfact(NUMBER *q); -extern NUMBER *qredcin(NUMBER *q1, NUMBER *q2); -extern NUMBER *qredcout(NUMBER *q1, NUMBER *q2); -extern NUMBER *qredcmul(NUMBER *q1, NUMBER *q2, NUMBER *q3); -extern NUMBER *qredcsquare(NUMBER *q1, NUMBER *q2); -extern NUMBER *qredcpower(NUMBER *q1, NUMBER *q2, NUMBER *q3); -extern BOOL qprimetest(NUMBER *q1, NUMBER *q2, NUMBER *q3); -extern BOOL qissquare(NUMBER *q); -extern long qilog2(NUMBER *q); -extern long qilog10(NUMBER *q); -extern NUMBER *qilog(NUMBER *q, ZVALUE base); -extern BOOL qcmpmod(NUMBER *q1, NUMBER *q2, NUMBER *q3); -extern BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd); -extern FLAG qnear(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); -extern NUMBER *qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base); -extern long qprecision(NUMBER *q); -extern long qplaces(NUMBER *q, ZVALUE base); -extern long qdecplaces(NUMBER *q); -extern long qdigits(NUMBER *q, ZVALUE base); -extern void setepsilon(NUMBER *q); -extern NUMBER *qbitvalue(long i); -extern NUMBER *qtenpow(long i); +E_FUNC NUMBER *qcomb(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qgcd(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qlcm(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qfact(NUMBER *q); +E_FUNC NUMBER *qpfact(NUMBER *q); +E_FUNC NUMBER *qminv(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qfacrem(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qperm(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qgcdrem(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qlowfactor(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qfib(NUMBER *q); +E_FUNC NUMBER *qcfappr(NUMBER *q, NUMBER *epsilon, long R); +E_FUNC NUMBER *qcfsim(NUMBER *q, long R); +E_FUNC NUMBER *qisqrt(NUMBER *q); +E_FUNC NUMBER *qjacobi(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qiroot(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qmappr(NUMBER *q, NUMBER *e, long R); +E_FUNC NUMBER *qlcmfact(NUMBER *q); +E_FUNC NUMBER *qredcin(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qredcout(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qredcmul(NUMBER *q1, NUMBER *q2, NUMBER *q3); +E_FUNC NUMBER *qredcsquare(NUMBER *q1, NUMBER *q2); +E_FUNC NUMBER *qredcpower(NUMBER *q1, NUMBER *q2, NUMBER *q3); +E_FUNC BOOL qprimetest(NUMBER *q1, NUMBER *q2, NUMBER *q3); +E_FUNC BOOL qissquare(NUMBER *q); +E_FUNC long qilog2(NUMBER *q); +E_FUNC long qilog10(NUMBER *q); +E_FUNC NUMBER *qilog(NUMBER *q, ZVALUE base); +E_FUNC BOOL qcmpmod(NUMBER *q1, NUMBER *q2, NUMBER *q3); +E_FUNC BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd); +E_FUNC FLAG qnear(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); +E_FUNC NUMBER *qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base); +E_FUNC long qprecision(NUMBER *q); +E_FUNC long qplaces(NUMBER *q, ZVALUE base); +E_FUNC long qdecplaces(NUMBER *q); +E_FUNC long qdigits(NUMBER *q, ZVALUE base); +E_FUNC void setepsilon(NUMBER *q); +E_FUNC NUMBER *qbitvalue(long i); +E_FUNC NUMBER *qtenpow(long i); /* * Transcendental functions. These all take an epsilon argument to * specify the required accuracy of the calculation. */ -extern void qsincos(NUMBER *q, long bitnum, NUMBER **vs, NUMBER **vc); -extern NUMBER *qsqrt(NUMBER *q, NUMBER *epsilon, long R); -extern NUMBER *qpower(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); -extern NUMBER *qroot(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); -extern NUMBER *qcos(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qsin(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qexp(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qln(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qlog(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qtan(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qsec(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qcot(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qcsc(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qacos(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qasin(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qatan(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qasec(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qacsc(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qacot(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qatan2(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); -extern NUMBER *qhypot(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); -extern NUMBER *qcosh(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qsinh(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qtanh(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qcoth(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qsech(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qcsch(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qacosh(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qasinh(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qatanh(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qasech(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qacsch(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qacoth(NUMBER *q, NUMBER *epsilon); -extern NUMBER *qlegtoleg(NUMBER *q, NUMBER *epsilon, BOOL wantneg); -extern NUMBER *qpi(NUMBER *epsilon); -extern NUMBER *qcatalan(NUMBER *); -extern NUMBER *qbern(ZVALUE z); -extern void qfreebern(void); -extern NUMBER *qeuler(ZVALUE z); -extern void qfreeeuler(void); +E_FUNC void qsincos(NUMBER *q, long bitnum, NUMBER **vs, NUMBER **vc); +E_FUNC NUMBER *qsqrt(NUMBER *q, NUMBER *epsilon, long R); +E_FUNC NUMBER *qpower(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); +E_FUNC NUMBER *qroot(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); +E_FUNC NUMBER *qcos(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qsin(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qexp(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qln(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qlog(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qtan(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qsec(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qcot(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qcsc(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qacos(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qasin(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qatan(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qasec(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qacsc(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qacot(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qatan2(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); +E_FUNC NUMBER *qhypot(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); +E_FUNC NUMBER *qcosh(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qsinh(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qtanh(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qcoth(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qsech(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qcsch(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qacosh(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qasinh(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qatanh(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qasech(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qacsch(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qacoth(NUMBER *q, NUMBER *epsilon); +E_FUNC NUMBER *qlegtoleg(NUMBER *q, NUMBER *epsilon, BOOL wantneg); +E_FUNC NUMBER *qpi(NUMBER *epsilon); +E_FUNC NUMBER *qcatalan(NUMBER *); +E_FUNC NUMBER *qbern(ZVALUE z); +E_FUNC void qfreebern(void); +E_FUNC NUMBER *qeuler(ZVALUE z); +E_FUNC void qfreeeuler(void); /* * pseudo-seed generator */ -extern NUMBER *pseudo_seed(void); +E_FUNC NUMBER *pseudo_seed(void); /* * external swap functions */ -extern NUMBER *swap_b8_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all); -extern NUMBER *swap_b16_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all); -extern NUMBER *swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all); +E_FUNC NUMBER *swap_b8_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all); +E_FUNC NUMBER *swap_b16_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all); +E_FUNC NUMBER *swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all); /* @@ -271,9 +271,9 @@ extern NUMBER *swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all); /* * constants used often by the arithmetic routines */ -extern NUMBER _qzero_, _qone_, _qnegone_, _qonehalf_, _qneghalf_, _qonesqbase_; -extern NUMBER _qtwo_, _qthree_, _qfour_, _qten_; -extern NUMBER * initnumbs[]; +EXTERN NUMBER _qzero_, _qone_, _qnegone_, _qonehalf_, _qneghalf_, _qonesqbase_; +EXTERN NUMBER _qtwo_, _qthree_, _qfour_, _qten_; +EXTERN NUMBER * initnumbs[]; #endif /* !__QMATH_H__ */ diff --git a/qmod.c b/qmod.c index 8ebebf4..4b1f4da 100644 --- a/qmod.c +++ b/qmod.c @@ -1,7 +1,7 @@ /* * qmod - modular arithmetic routines for normal numbers and REDC numbers * - * Copyright (C) 1999-2006 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: qmod.c,v 29.3 2006/06/25 20:33:26 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: qmod.c,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qmod.c,v $ * * Under source code control: 1991/05/22 23:15:07 @@ -45,11 +45,11 @@ typedef struct { } REDC_CACHE; -static long redc_age; /* current age counter */ -static REDC_CACHE redc_cache[MAXREDC]; /* cached REDC info */ +STATIC long redc_age; /* current age counter */ +STATIC REDC_CACHE redc_cache[MAXREDC]; /* cached REDC info */ -static REDC *qfindredc(NUMBER *q); +S_FUNC REDC *qfindredc(NUMBER *q); /* @@ -339,7 +339,7 @@ qredcpower(NUMBER *q1, NUMBER *q2, NUMBER *q3) * given: * q modulus to find REDC information of */ -static REDC * +S_FUNC REDC * qfindredc(NUMBER *q) { register REDC_CACHE *rcp; diff --git a/qtrans.c b/qtrans.c index a1f9352..067b970 100644 --- a/qtrans.c +++ b/qtrans.c @@ -1,7 +1,7 @@ /* * qtrans - transcendental functions for real numbers * - * Copyright (C) 1999-2004 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: qtrans.c,v 29.7 2006/05/07 13:04:18 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: qtrans.c,v 29.8 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qtrans.c,v $ * * Under source code control: 1990/02/15 01:48:22 @@ -44,11 +44,11 @@ NUMBER _qlge_ = { { _qlgenum_, 1, 0 }, { _qlgeden_, 1, 0 }, 1, NULL }; /* * cache the natural logarithm of 10 */ -static NUMBER *ln_10 = NULL; -static NUMBER *ln_10_epsilon = NULL; +STATIC NUMBER *ln_10 = NULL; +STATIC NUMBER *ln_10_epsilon = NULL; -static NUMBER *pivalue[2]; -static NUMBER *qexprel(NUMBER *q, long bitnum); +STATIC NUMBER *pivalue[2]; +STATIC NUMBER *qexprel(NUMBER *q, long bitnum); /* * Evaluate and store in specified locations the sin and cos of a given @@ -821,7 +821,7 @@ qexp(NUMBER *q, NUMBER *epsilon) * Requires *q >= 0, bitnum >= 0. * This returns NULL if more than 2^30 working bits would be required. */ -static NUMBER * +S_FUNC NUMBER * qexprel(NUMBER *q, long bitnum) { long n, m, k, h, s, t, d; diff --git a/quickhash.c b/quickhash.c index a5465d7..e996814 100644 --- a/quickhash.c +++ b/quickhash.c @@ -1,7 +1,7 @@ /* * quickhash - quickly hash a calc value using a quasi Fowler/Noll/Vo hash * - * Copyright (C) 1999-2002 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.13 $ - * @(#) $Id: quickhash.c,v 29.13 2006/06/25 23:24:16 chongo Exp $ + * @(#) $Revision: 29.14 $ + * @(#) $Id: quickhash.c,v 29.14 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/quickhash.c,v $ * * Under source code control: 1995/03/04 11:34:23 @@ -41,19 +41,19 @@ /* * forward declarations */ -static QCKHASH assochash(ASSOC *ap, QCKHASH val); -static QCKHASH listhash(LIST *lp, QCKHASH val); -static QCKHASH mathash(MATRIX *m, QCKHASH val); -static QCKHASH objhash(OBJECT *op, QCKHASH val); -static QCKHASH randhash(RAND *r, QCKHASH val); -static QCKHASH randomhash(RANDOM *state, QCKHASH val); -static QCKHASH config_hash(CONFIG *cfg, QCKHASH val); -static QCKHASH fnv_strhash(char *ch, QCKHASH val); -static QCKHASH fnv_STRhash(STRING *str, QCKHASH val); -static QCKHASH fnv_fullhash(FULL *v, LEN len, QCKHASH val); -static QCKHASH fnv_zhash(ZVALUE z, QCKHASH val); -static QCKHASH hash_hash(HASH *hash, QCKHASH val); -static QCKHASH blk_hash(BLOCK *blk, QCKHASH val); +S_FUNC QCKHASH assochash(ASSOC *ap, QCKHASH val); +S_FUNC QCKHASH listhash(LIST *lp, QCKHASH val); +S_FUNC QCKHASH mathash(MATRIX *m, QCKHASH val); +S_FUNC QCKHASH objhash(OBJECT *op, QCKHASH val); +S_FUNC QCKHASH randhash(RAND *r, QCKHASH val); +S_FUNC QCKHASH randomhash(RANDOM *state, QCKHASH val); +S_FUNC QCKHASH config_hash(CONFIG *cfg, QCKHASH val); +S_FUNC QCKHASH fnv_strhash(char *ch, QCKHASH val); +S_FUNC QCKHASH fnv_STRhash(STRING *str, QCKHASH val); +S_FUNC QCKHASH fnv_fullhash(FULL *v, LEN len, QCKHASH val); +S_FUNC QCKHASH fnv_zhash(ZVALUE z, QCKHASH val); +S_FUNC QCKHASH hash_hash(HASH *hash, QCKHASH val); +S_FUNC QCKHASH blk_hash(BLOCK *blk, QCKHASH val); /* @@ -233,7 +233,7 @@ hashvalue(VALUE *vp, QCKHASH val) /* * Return a trivial hash value for an association. */ -static QCKHASH +S_FUNC QCKHASH assochash(ASSOC *ap, QCKHASH val) { /* @@ -249,7 +249,7 @@ assochash(ASSOC *ap, QCKHASH val) /* * Return a trivial hash value for a list. */ -static QCKHASH +S_FUNC QCKHASH listhash(LIST *lp, QCKHASH val) { /* @@ -275,7 +275,7 @@ listhash(LIST *lp, QCKHASH val) /* * Return a trivial hash value for a matrix. */ -static QCKHASH +S_FUNC QCKHASH mathash(MATRIX *m, QCKHASH val) { long skip; @@ -325,7 +325,7 @@ mathash(MATRIX *m, QCKHASH val) /* * Return a trivial hash value for an object. */ -static QCKHASH +S_FUNC QCKHASH objhash(OBJECT *op, QCKHASH val) { int i; @@ -348,7 +348,7 @@ objhash(OBJECT *op, QCKHASH val) * returns: * trivial hash integer */ -static QCKHASH +S_FUNC QCKHASH randhash(RAND *r, QCKHASH val) { /* @@ -380,7 +380,7 @@ randhash(RAND *r, QCKHASH val) * returns: * trivial hash integer */ -static QCKHASH +S_FUNC QCKHASH randomhash(RANDOM *state, QCKHASH val) { /* @@ -408,7 +408,7 @@ randomhash(RANDOM *state, QCKHASH val) /* * config_hash - return a trivial hash for a configuration state */ -static QCKHASH +S_FUNC QCKHASH config_hash(CONFIG *cfg, QCKHASH val) { USB32 value; /* value to hash from hash elements */ @@ -515,7 +515,7 @@ config_hash(CONFIG *cfg, QCKHASH val) * returns: * a 32 bit QCKHASH value */ -static QCKHASH +S_FUNC QCKHASH fnv_strhash(char *ch, QCKHASH val) { /* @@ -537,7 +537,7 @@ fnv_strhash(char *ch, QCKHASH val) * returns: * a 32 bit QCKHASH value */ -static QCKHASH +S_FUNC QCKHASH fnv_STRhash(STRING *str, QCKHASH val) { char *ch; @@ -567,7 +567,7 @@ fnv_STRhash(STRING *str, QCKHASH val) * returns: * a 32 bit QCKHASH value */ -static QCKHASH +S_FUNC QCKHASH fnv_fullhash(FULL *v, LEN len, QCKHASH val) { /* @@ -590,7 +590,7 @@ fnv_fullhash(FULL *v, LEN len, QCKHASH val) * returns: * a 32 bit QCKHASH value */ -static QCKHASH +S_FUNC QCKHASH fnv_zhash(ZVALUE z, QCKHASH val) { LEN n; @@ -638,7 +638,7 @@ fnv_zhash(ZVALUE z, QCKHASH val) * returns: * a 32 bit QCKHASH value */ -static QCKHASH +S_FUNC QCKHASH hash_hash(HASH *hash, QCKHASH val) { int i; @@ -663,7 +663,7 @@ hash_hash(HASH *hash, QCKHASH val) * returns: * a 32 bit QCKHASH value */ -static QCKHASH +S_FUNC QCKHASH blk_hash(BLOCK *blk, QCKHASH val) { int i; diff --git a/sample/Makefile b/sample/Makefile index 63f0149..0a8c09f 100644 --- a/sample/Makefile +++ b/sample/Makefile @@ -17,8 +17,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.23 $ -# @(#) $Id: Makefile,v 29.23 2006/09/18 13:13:25 chongo Exp $ +# @(#) $Revision: 29.24 $ +# @(#) $Id: Makefile,v 29.24 2007/02/11 10:22:29 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $ # # Under source code control: 1997/04/19 22:46:49 @@ -618,6 +618,7 @@ many_random.o: ../calc.h many_random.o: ../calcerr.h many_random.o: ../cmath.h many_random.o: ../config.h +many_random.o: ../decl.h many_random.o: ../endian_calc.h many_random.o: ../hash.h many_random.o: ../have_const.h @@ -635,7 +636,6 @@ many_random.o: ../shs.h many_random.o: ../shs1.h many_random.o: ../string.h many_random.o: ../value.h -many_random.o: ../win32dll.h many_random.o: ../zmath.h many_random.o: ../zrandom.h many_random.o: many_random.c @@ -646,6 +646,7 @@ test_random.o: ../calc.h test_random.o: ../calcerr.h test_random.o: ../cmath.h test_random.o: ../config.h +test_random.o: ../decl.h test_random.o: ../endian_calc.h test_random.o: ../hash.h test_random.o: ../have_const.h @@ -663,7 +664,6 @@ test_random.o: ../shs.h test_random.o: ../shs1.h test_random.o: ../string.h test_random.o: ../value.h -test_random.o: ../win32dll.h test_random.o: ../zmath.h test_random.o: ../zrandom.h test_random.o: test_random.c diff --git a/seed.c b/seed.c index 111d235..b8bc522 100644 --- a/seed.c +++ b/seed.c @@ -1,7 +1,7 @@ /* * seed - produce a pseudo-random seeds * - * Copyright (C) 1999-2004 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: seed.c,v 29.7 2004/02/23 14:04:01 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: seed.c,v 29.8 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $ * * Under source code control: 1999/10/03 10:06:53 @@ -171,7 +171,7 @@ typedef struct s_hash64 hash64; * returns: * 64 bit hash as a static hash64 structure */ -static hash64 +S_FUNC hash64 hash_buf(char *buf, unsigned len) { hash64 hval; /* current hash value */ diff --git a/shs.c b/shs.c index 0b4c214..55a8708 100644 --- a/shs.c +++ b/shs.c @@ -31,8 +31,8 @@ * Based on Version 2.11 (09 Mar 1995) from Landon Curt Noll's * (http://www.isthe.com/chongo/) shs hash program. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: shs.c,v 29.3 2004/02/23 08:14:15 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: shs.c,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/shs.c,v $ * * This file is not covered under version 2.1 of the GNU LGPL. @@ -128,23 +128,23 @@ /* * forward declarations */ -static void shsInit(HASH*); -static void shsTransform(USB32*, USB32*); -static void shsUpdate(HASH*, USB8*, USB32); -static void shsFinal(HASH*); -static void shs_chkpt(HASH*); -static void shs_note(int, HASH*); -static void shs_type(int, HASH*); +S_FUNC void shsInit(HASH*); +S_FUNC void shsTransform(USB32*, USB32*); +S_FUNC void shsUpdate(HASH*, USB8*, USB32); +S_FUNC void shsFinal(HASH*); +S_FUNC void shs_chkpt(HASH*); +S_FUNC void shs_note(int, HASH*); +S_FUNC void shs_type(int, HASH*); void shs_init_state(HASH*); -static ZVALUE shs_final_state(HASH*); -static int shs_cmp(HASH*, HASH*); -static void shs_print(HASH*); +S_FUNC ZVALUE shs_final_state(HASH*); +S_FUNC int shs_cmp(HASH*, HASH*); +S_FUNC void shs_print(HASH*); /* * shsInit - initialize the SHS state */ -static void +S_FUNC void shsInit(HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ @@ -170,7 +170,7 @@ shsInit(HASH *state) * It may be necessary to split it into sections, eg based on the four * subrounds. One may also want to roll each subround into a loop. */ -static void +S_FUNC void shsTransform(USB32 *digest, USB32 *W) { USB32 A, B, C, D, E; /* Local vars */ @@ -279,7 +279,7 @@ shsTransform(USB32 *digest, USB32 *W) /* * shsUpdate - update SHS with arbitrary length data */ -static void +S_FUNC void shsUpdate(HASH *state, USB8 *buffer, USB32 count) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ @@ -356,7 +356,7 @@ shsUpdate(HASH *state, USB8 *buffer, USB32 count) * Finally we append the 64 bit length on to the 56 bytes of data * remaining. This final chunk is transformed. */ -static void +S_FUNC void shsFinal(HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ @@ -428,7 +428,7 @@ shsFinal(HASH *state) * This function will ensure that the the hash chunk buffer is empty. * Any partially hashed data will be padded out with 0's and hashed. */ -static void +S_FUNC void shs_chkpt(HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ @@ -474,7 +474,7 @@ shs_chkpt(HASH *state) * Types include negative values, complex values, division, zero numeric * and array of HALFs. */ -static void +S_FUNC void shs_note(int special, HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ @@ -505,7 +505,7 @@ shs_note(int special, HASH *state) * or not. We also do nothing with V_STR so that a hash of a string * will produce the same value as the standard hash function. */ -static void +S_FUNC void shs_type(int type, HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ @@ -572,7 +572,7 @@ shs_init_state(HASH *state) * returns: * a ZVALUE representing the state */ -static ZVALUE +S_FUNC ZVALUE shs_final_state(HASH *state) { SHS_INFO *dig = &state->h_union.h_shs; /* digest state */ @@ -636,7 +636,7 @@ shs_final_state(HASH *state) * TRUE => hash states are different * FALSE => hash states are the same */ -static int +S_FUNC int shs_cmp(HASH *a, HASH *b) { /* @@ -695,7 +695,7 @@ shs_cmp(HASH *a, HASH *b) * given: * state the hash state to print */ -static void +S_FUNC void shs_print(HASH *state) { /* diff --git a/shs1.c b/shs1.c index c4974f4..b88c585 100644 --- a/shs1.c +++ b/shs1.c @@ -22,8 +22,8 @@ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: shs1.c,v 29.3 2004/02/23 08:15:52 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: shs1.c,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/shs1.c,v $ * * This file is not covered under version 2.1 of the GNU LGPL. @@ -102,23 +102,23 @@ (e += LEFT_ROT(a,5) + f(b,c,d) + k + data, b = LEFT_ROT(b,30)) /* forward declarations */ -static void shs1Init(HASH*); -static void shs1Transform(USB32*, USB32*); -static void shs1Update(HASH*, USB8*, USB32); -static void shs1Final(HASH*); -static void shs1_chkpt(HASH*); -static void shs1_note(int, HASH*); -static void shs1_type(int, HASH*); +S_FUNC void shs1Init(HASH*); +S_FUNC void shs1Transform(USB32*, USB32*); +S_FUNC void shs1Update(HASH*, USB8*, USB32); +S_FUNC void shs1Final(HASH*); +S_FUNC void shs1_chkpt(HASH*); +S_FUNC void shs1_note(int, HASH*); +S_FUNC void shs1_type(int, HASH*); void shs1_init_state(HASH*); -static ZVALUE shs1_final_state(HASH*); -static int shs1_cmp(HASH*, HASH*); -static void shs1_print(HASH*); +S_FUNC ZVALUE shs1_final_state(HASH*); +S_FUNC int shs1_cmp(HASH*, HASH*); +S_FUNC void shs1_print(HASH*); /* * shs1Init - initialize the SHS1 state */ -static void +S_FUNC void shs1Init(HASH *state) { SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */ @@ -144,7 +144,7 @@ shs1Init(HASH *state) * It may be necessary to split it into sections, eg based on the four * subrounds. One may also want to roll each subround into a loop. */ -static void +S_FUNC void shs1Transform(USB32 *digest, USB32 *W) { USB32 A, B, C, D, E; /* Local vars */ @@ -406,7 +406,7 @@ shs1Final(HASH *state) * This function will ensure that the the hash chunk buffer is empty. * Any partially hashed data will be padded out with 0's and hashed. */ -static void +S_FUNC void shs1_chkpt(HASH *state) { SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */ @@ -451,7 +451,7 @@ shs1_chkpt(HASH *state) * Types include negative values, complex values, division, zero numeric * and array of HALFs. */ -static void +S_FUNC void shs1_note(int special, HASH *state) { SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */ @@ -482,7 +482,7 @@ shs1_note(int special, HASH *state) * or not. We also do nothing with V_STR so that a hash of a string * will produce the same value as the standard hash function. */ -static void +S_FUNC void shs1_type(int type, HASH *state) { SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */ @@ -549,7 +549,7 @@ shs1_init_state(HASH *state) * returns: * a ZVALUE representing the state */ -static ZVALUE +S_FUNC ZVALUE shs1_final_state(HASH *state) { SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */ @@ -613,7 +613,7 @@ shs1_final_state(HASH *state) * TRUE => hash states are different * FALSE => hash states are the same */ -static int +S_FUNC int shs1_cmp(HASH *a, HASH *b) { /* @@ -672,7 +672,7 @@ shs1_cmp(HASH *a, HASH *b) * given: * state the hash state to print */ -static void +S_FUNC void shs1_print(HASH *state) { /* diff --git a/size.c b/size.c index de00c2d..1f9efcc 100644 --- a/size.c +++ b/size.c @@ -1,7 +1,7 @@ /* * size - size and sizeof functions are implemented here * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: size.c,v 29.4 2006/05/19 15:26:10 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: size.c,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/size.c,v $ * * Under source code control: 1997/03/10 01:56:51 @@ -37,11 +37,11 @@ /* * forward declarations */ -static size_t zsize(ZVALUE); -static size_t qsize(NUMBER*); -static size_t csize(COMPLEX*); -static size_t memzsize(ZVALUE); -static size_t memqsize(NUMBER*); +S_FUNC size_t zsize(ZVALUE); +S_FUNC size_t qsize(NUMBER*); +S_FUNC size_t csize(COMPLEX*); +S_FUNC size_t memzsize(ZVALUE); +S_FUNC size_t memqsize(NUMBER*); /* @@ -124,7 +124,7 @@ elm_count(VALUE *vp) * returns: * value size */ -static size_t +S_FUNC size_t zsize(ZVALUE z) { /* ignore the size of 0, 1 and -1 */ @@ -148,7 +148,7 @@ zsize(ZVALUE z) * returns: * value size */ -static size_t +S_FUNC size_t qsize(NUMBER *q) { /* ingore denominator parts of integers */ @@ -173,7 +173,7 @@ qsize(NUMBER *q) * returns: * value size */ -static size_t +S_FUNC size_t csize(COMPLEX *c) { /* ingore denominator parts of integers */ @@ -194,7 +194,7 @@ csize(COMPLEX *c) * returns: * memory footprint */ -static size_t +S_FUNC size_t memzsize(ZVALUE z) { return sizeof(ZVALUE) + (z.len * sizeof(HALF)); @@ -210,7 +210,7 @@ memzsize(ZVALUE z) * returns: * memory footprint */ -static size_t +S_FUNC size_t memqsize(NUMBER *q) { return sizeof(NUMBER) + memzsize(q->num) + memzsize(q->den); diff --git a/string.c b/string.c index c7c9f40..7332091 100644 --- a/string.c +++ b/string.c @@ -1,7 +1,7 @@ /* * string - string list routines * - * Copyright (C) 1999-2006 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.10 $ - * @(#) $Id: string.c,v 29.10 2006/08/20 15:01:30 chongo Exp $ + * @(#) $Revision: 29.11 $ + * @(#) $Id: string.c,v 29.11 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/string.c,v $ * * Under source code control: 1990/02/15 01:48:10 @@ -40,9 +40,9 @@ STRING _nullstring_ = {"", 0, 1, NULL}; -static char *chartable; /* single character string table */ +STATIC char *chartable; /* single character string table */ -static struct { +STATIC struct { long l_count; /* count of strings in table */ long l_maxcount; /* maximum strings storable in table */ size_t l_avail; /* characters available in current string */ @@ -792,7 +792,7 @@ stringlowbit(STRING *s) * Returns TRUE if and only if a difference is encountered. * Essentially a local version of memcmp. */ -static BOOL +S_FUNC BOOL stringcompare(char *c1, char *c2, long len) { while (len-- > 0) { @@ -1000,9 +1000,9 @@ stringrsearch(STRING *s1, STRING *s2, long start, long end, ZVALUE *index) #define STRALLOC 100 -static STRING *freeStr = NULL; -static STRING **firstStrs = NULL; -static long blockcount = 0; +STATIC STRING *freeStr = NULL; +STATIC STRING **firstStrs = NULL; +STATIC long blockcount = 0; STRING * @@ -1172,9 +1172,9 @@ sfree(STRING *s) freeStr = s; } -static long stringconstcount = 0; -static long stringconstavail = 0; -static STRING **stringconsttable; +STATIC long stringconstcount = 0; +STATIC long stringconstavail = 0; +STATIC STRING **stringconsttable; #define STRCONSTALLOC 100 void diff --git a/string.h b/string.h index c6824d7..7b5669e 100644 --- a/string.h +++ b/string.h @@ -1,7 +1,7 @@ /* * string - string list routines * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: string.h,v 29.7 2006/08/20 15:01:30 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: string.h,v 29.8 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/string.h,v $ * * Under source code control: 1990/02/15 01:48:36 @@ -57,26 +57,26 @@ typedef struct { } STRINGHEAD; -extern void initstr(STRINGHEAD *hp); -extern char *addstr(STRINGHEAD *hp, char *str); -extern char *namestr(STRINGHEAD *hp, long n); -extern int findstr(STRINGHEAD *hp, char *str); -extern char *charstr(int ch); -extern char *addliteral(char *str); -extern long stringindex(char *str1, char *str2); -extern STRING *stralloc(void); -extern long addstring(char *str, size_t len); -extern STRING *charstring(int ch); -extern STRING *makestring(char *str); -extern STRING *makenewstring(char *str); -extern STRING *findstring(long index); -extern STRING *slink(STRING *); -extern void sfree(STRING *); -extern void fitstring(char *, long, long); -extern void strprint(STRING *); -extern void showstrings(void); -extern void showliterals(void); -extern STRING _nullstring_; +E_FUNC void initstr(STRINGHEAD *hp); +E_FUNC char *addstr(STRINGHEAD *hp, char *str); +E_FUNC char *namestr(STRINGHEAD *hp, long n); +E_FUNC int findstr(STRINGHEAD *hp, char *str); +E_FUNC char *charstr(int ch); +E_FUNC char *addliteral(char *str); +E_FUNC long stringindex(char *str1, char *str2); +E_FUNC STRING *stralloc(void); +E_FUNC long addstring(char *str, size_t len); +E_FUNC STRING *charstring(int ch); +E_FUNC STRING *makestring(char *str); +E_FUNC STRING *makenewstring(char *str); +E_FUNC STRING *findstring(long index); +E_FUNC STRING *slink(STRING *); +E_FUNC void sfree(STRING *); +E_FUNC void fitstring(char *, long, long); +E_FUNC void strprint(STRING *); +E_FUNC void showstrings(void); +E_FUNC void showliterals(void); +EXTERN STRING _nullstring_; #endif /* !__CALCSTRING_H__ */ diff --git a/symbol.c b/symbol.c index e403271..ce157de 100644 --- a/symbol.c +++ b/symbol.c @@ -1,7 +1,7 @@ /* * symbol - global and local symbol routines * - * Copyright (C) 1999-2006 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.6 $ - * @(#) $Id: symbol.c,v 29.6 2006/06/20 10:28:06 chongo Exp $ + * @(#) $Revision: 29.7 $ + * @(#) $Id: symbol.c,v 29.7 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/symbol.c,v $ * * Under source code control: 1990/02/15 01:48:23 @@ -40,21 +40,21 @@ #define HASHSIZE 37 /* size of hash table */ -extern FILE *f_open(char *name, char *mode); +E_FUNC FILE *f_open(char *name, char *mode); -static int filescope; /* file scope level for static variables */ -static int funcscope; /* function scope level for static variables */ -static STRINGHEAD localnames; /* list of local variable names */ -static STRINGHEAD globalnames; /* list of global variable names */ -static STRINGHEAD paramnames; /* list of parameter variable names */ -static GLOBAL *globalhash[HASHSIZE]; /* hash table for globals */ +STATIC int filescope; /* file scope level for static variables */ +STATIC int funcscope; /* function scope level for static variables */ +STATIC STRINGHEAD localnames; /* list of local variable names */ +STATIC STRINGHEAD globalnames; /* list of global variable names */ +STATIC STRINGHEAD paramnames; /* list of parameter variable names */ +STATIC GLOBAL *globalhash[HASHSIZE]; /* hash table for globals */ -static void printtype(VALUE *); -static void unscope(void); -static void addstatic(GLOBAL *); -static long staticcount = 0; -static long staticavail = 0; -static GLOBAL **statictable; +S_FUNC void printtype(VALUE *); +S_FUNC void unscope(void); +S_FUNC void addstatic(GLOBAL *); +STATIC long staticcount = 0; +STATIC long staticavail = 0; +STATIC GLOBAL **statictable; /* @@ -231,7 +231,7 @@ showallglobals(void) printf("No global variables\n"); } -static void +S_FUNC void printtype(VALUE *vp) { int type; @@ -330,7 +330,7 @@ writeglobals(char *name) GLOBAL **hp; /* hash table head address */ register GLOBAL *sp; /* current global symbol pointer */ int savemode; /* saved output mode */ - extern void math_setfp(FILE *fp); + E_FUNC void math_setfp(FILE *fp); fp = f_open(name, "w"); if (fp == NULL) @@ -576,7 +576,7 @@ showstatics(void) * function scopes larger than the current scope levels. Their memory * remains allocated since their values still actually exist. */ -static void +S_FUNC void unscope(void) { GLOBAL **hp; /* hash table head address */ diff --git a/symbol.h b/symbol.h index c43ce22..4f9ffd3 100644 --- a/symbol.h +++ b/symbol.h @@ -1,7 +1,7 @@ /* * symbol - global and local symbol routines * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.6 $ - * @(#) $Id: symbol.h,v 29.6 2006/05/19 15:26:10 chongo Exp $ + * @(#) $Revision: 29.7 $ + * @(#) $Id: symbol.h,v 29.7 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/symbol.h,v $ * * Under source code control: 1990/02/15 01:48:37 @@ -66,45 +66,45 @@ struct global { /* * Routines to search for global symbols. */ -extern GLOBAL *addglobal(char *name, BOOL isstatic); -extern GLOBAL *findglobal(char *name); +E_FUNC GLOBAL *addglobal(char *name, BOOL isstatic); +E_FUNC GLOBAL *findglobal(char *name); /* * Routines to return names of variables. */ -extern char *localname(long n); -extern char *paramname(long n); -extern char *globalname(GLOBAL *sp); +E_FUNC char *localname(long n); +E_FUNC char *paramname(long n); +E_FUNC char *globalname(GLOBAL *sp); /* * Routines to handle entering and leaving of scope levels. */ -extern void resetscopes(void); -extern void enterfilescope(void); -extern void exitfilescope(void); -extern void enterfuncscope(void); -extern void exitfuncscope(void); -extern void endscope (char *name, BOOL isglobal); +E_FUNC void resetscopes(void); +E_FUNC void enterfilescope(void); +E_FUNC void exitfilescope(void); +E_FUNC void enterfuncscope(void); +E_FUNC void exitfuncscope(void); +E_FUNC void endscope (char *name, BOOL isglobal); /* * Other routines. */ -extern long addlocal(char *name); -extern long findlocal(char *name); -extern long addparam(char *name); -extern long findparam(char *name); -extern void initlocals(void); -extern void initglobals(void); -extern int writeglobals(char *name); -extern int symboltype(char *name); -extern void showglobals(void); -extern void showallglobals(void); -extern void freeglobals(void); -extern void showstatics(void); -extern void freestatics(void); +E_FUNC long addlocal(char *name); +E_FUNC long findlocal(char *name); +E_FUNC long addparam(char *name); +E_FUNC long findparam(char *name); +E_FUNC void initlocals(void); +E_FUNC void initglobals(void); +E_FUNC int writeglobals(char *name); +E_FUNC int symboltype(char *name); +E_FUNC void showglobals(void); +E_FUNC void showallglobals(void); +E_FUNC void freeglobals(void); +E_FUNC void showstatics(void); +E_FUNC void freestatics(void); #endif /* !__SYMBOL_H__ */ diff --git a/token.c b/token.c index 9dec83f..fc119c4 100644 --- a/token.c +++ b/token.c @@ -1,7 +1,7 @@ /* * token - read input file characters into tokens * - * Copyright (C) 1999 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.10 $ - * @(#) $Id: token.c,v 29.10 2006/06/24 18:43:05 chongo Exp $ + * @(#) $Revision: 29.11 $ + * @(#) $Id: token.c,v 29.11 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $ * * Under source code control: 1990/02/15 01:48:25 @@ -52,7 +52,7 @@ /* * Current token. */ -static struct { +STATIC struct { short t_type; /* type of token */ char *t_sym; /* symbol name */ long t_strindex; /* index of string value */ @@ -60,12 +60,12 @@ static struct { } curtoken; -static BOOL rescan; /* TRUE to reread current token */ -static BOOL newlines; /* TRUE to return newlines as tokens */ -static BOOL allsyms; /* TRUE if always want a symbol token */ -static STRINGHEAD strings; /* list of constant strings */ -static char *numbuf; /* buffer for numeric tokens */ -static long numbufsize; /* current size of numeric buffer */ +STATIC BOOL rescan; /* TRUE to reread current token */ +STATIC BOOL newlines; /* TRUE to return newlines as tokens */ +STATIC BOOL allsyms; /* TRUE if always want a symbol token */ +STATIC STRINGHEAD strings; /* list of constant strings */ +STATIC char *numbuf; /* buffer for numeric tokens */ +STATIC long numbufsize; /* current size of numeric buffer */ long errorcount = 0; /* number of compilation errors */ @@ -78,7 +78,7 @@ struct keyword { int k_token; /* token number */ }; -static struct keyword keywords[] = { +STATIC struct keyword keywords[] = { {"if", T_IF}, {"else", T_ELSE}, {"for", T_FOR}, @@ -111,11 +111,11 @@ static struct keyword keywords[] = { }; -static void eatcomment(void); -static void eatstring(int quotechar); -static void eatline(void); -static int eatsymbol(void); -static int eatnumber(void); +S_FUNC void eatcomment(void); +S_FUNC void eatstring(int quotechar); +S_FUNC void eatline(void); +S_FUNC int eatsymbol(void); +S_FUNC int eatnumber(void); /* @@ -379,7 +379,7 @@ gettoken(void) * Continue to eat up a comment string. * The leading slash-asterisk has just been scanned at this point. */ -static void +S_FUNC void eatcomment(void) { int ch; @@ -407,7 +407,7 @@ eatcomment(void) * Typically a #! will require the rest of the line to be eaten as if * it were a comment. */ -static void +S_FUNC void eatline(void) { int ch; /* chars being eaten */ @@ -423,7 +423,7 @@ eatline(void) * Read in a string and add it to the literal string pool. * The leading single or double quote has been read in at this point. */ -static void +S_FUNC void eatstring(int quotechar) { register char *cp; /* current character address */ @@ -551,14 +551,14 @@ eatstring(int quotechar) * If allsyms is set, keywords are not looked up and almost all chars * will be accepted for the symbol. Returns the type of symbol found. */ -static int +S_FUNC int eatsymbol(void) { register struct keyword *kp; /* pointer to current keyword */ register char *cp; /* current character pointer */ int ch; /* current character */ int cc; /* character count */ - static char buf[SYMBOLSIZE+1]; /* temporary buffer */ + STATIC char buf[SYMBOLSIZE+1]; /* temporary buffer */ cp = buf; cc = SYMBOLSIZE; @@ -604,7 +604,7 @@ eatsymbol(void) * return just a period, which is used for element accesses and for * the old numeric value. */ -static int +S_FUNC int eatnumber(void) { register char *cp; /* current character pointer */ diff --git a/token.h b/token.h index ff36cd2..9d627c0 100644 --- a/token.h +++ b/token.h @@ -1,7 +1,7 @@ /* * token - token defines * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.5 $ - * @(#) $Id: token.h,v 29.5 2006/06/20 10:28:06 chongo Exp $ + * @(#) $Revision: 29.6 $ + * @(#) $Id: token.h,v 29.6 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/token.h,v $ * * Under source code control: 1990/02/15 01:48:37 @@ -166,17 +166,17 @@ #define TM_ALLSYMS 0x2 /* treat almost everything as a symbol */ -extern long errorcount; /* number of errors found */ +EXTERN long errorcount; /* number of errors found */ -extern long tokenstring(void); -extern long tokennumber(void); -extern char *tokensymbol(void); -extern void inittokens(void); -extern int tokenmode(int flag); -extern int gettoken(void); -extern void rescantoken(void); -extern void scanerror(int, char *, ...); -extern void warning(char *, ...); +E_FUNC long tokenstring(void); +E_FUNC long tokennumber(void); +E_FUNC char *tokensymbol(void); +E_FUNC void inittokens(void); +E_FUNC int tokenmode(int flag); +E_FUNC int gettoken(void); +E_FUNC void rescantoken(void); +E_FUNC void scanerror(int, char *, ...); +E_FUNC void warning(char *, ...); #endif /* !__TOKEN_H__ */ diff --git a/value.c b/value.c index 19aaf84..9e999ec 100644 --- a/value.c +++ b/value.c @@ -1,7 +1,7 @@ /* * value - generic value manipulation routines * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.10 $ - * @(#) $Id: value.c,v 29.10 2006/08/20 15:01:30 chongo Exp $ + * @(#) $Revision: 29.11 $ + * @(#) $Id: value.c,v 29.11 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $ * * Under source code control: 1990/02/15 01:48:25 @@ -1617,7 +1617,7 @@ rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres) void absvalue(VALUE *v1, VALUE *v2, VALUE *vres) { - static NUMBER *q; + STATIC NUMBER *q; if (v1->v_type == V_OBJ || v2->v_type == V_OBJ) { *vres = objcall(OBJ_ABS, v1, v2, NULL_VALUE); diff --git a/value.h b/value.h index d90bad6..9c4ecee 100644 --- a/value.h +++ b/value.h @@ -1,7 +1,7 @@ /* * value - definitions of general values and related routines used by calc * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.11 $ - * @(#) $Id: value.h,v 29.11 2006/08/20 15:01:30 chongo Exp $ + * @(#) $Revision: 29.12 $ + * @(#) $Id: value.h,v 29.12 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $ * * Under source code control: 1993/07/30 19:42:47 @@ -33,7 +33,7 @@ #if defined(CALC_SRC) /* if we are building from the calc source tree */ -# include "win32dll.h" +# include "decl.h" # include "cmath.h" # include "config.h" # include "shs.h" @@ -43,7 +43,7 @@ # include "nametype.h" # include "string.h" #else -# include +# include # include # include # include @@ -201,60 +201,60 @@ struct value { /* * value functions */ -extern DLL void freevalue(VALUE *vp); -extern DLL void copyvalue(VALUE *vp, VALUE *vres); -extern DLL void negvalue(VALUE *vp, VALUE *vres); -extern DLL void addvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void subvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void mulvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void orvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void andvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void compvalue(VALUE *vp, VALUE *vres); -extern DLL void xorvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void squarevalue(VALUE *vp, VALUE *vres); -extern DLL void invertvalue(VALUE *vp, VALUE *vres); -extern DLL void roundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); -extern DLL void broundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); -extern DLL void setminusvalue(VALUE *, VALUE *, VALUE *); -extern DLL void backslashvalue(VALUE *, VALUE *); -extern DLL void contentvalue(VALUE *, VALUE *); -extern DLL void hashopvalue(VALUE *, VALUE *, VALUE *); -extern DLL void apprvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); -extern DLL void intvalue(VALUE *vp, VALUE *vres); -extern DLL void fracvalue(VALUE *vp, VALUE *vres); -extern DLL void incvalue(VALUE *vp, VALUE *vres); -extern DLL void decvalue(VALUE *vp, VALUE *vres); -extern DLL void conjvalue(VALUE *vp, VALUE *vres); -extern DLL void sqrtvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); -extern DLL void rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); -extern DLL void absvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void normvalue(VALUE *vp, VALUE *vres); -extern DLL void shiftvalue(VALUE *v1, VALUE *v2, BOOL rightshift, VALUE *vres); -extern DLL void scalevalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void powivalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); -extern DLL void divvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void quovalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); -extern DLL void modvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); -extern DLL BOOL testvalue(VALUE *vp); -extern DLL BOOL comparevalue(VALUE *v1, VALUE *v2); -extern DLL BOOL acceptvalue(VALUE *v1, VALUE *v2); -extern DLL void relvalue(VALUE *v1, VALUE *v2, VALUE *vres); -extern DLL void sgnvalue(VALUE *vp, VALUE *vres); -extern DLL QCKHASH hashvalue(VALUE *vp, QCKHASH val); -extern DLL void printvalue(VALUE *vp, int flags); -extern DLL void printestr(VALUE *vp); -extern DLL BOOL precvalue(VALUE *v1, VALUE *v2); -extern DLL VALUE error_value(int e); -extern DLL int set_errno(int e); -extern DLL int set_errcount(int e); -extern DLL long countlistitems(LIST *lp); -extern DLL void addlistitems(LIST *lp, VALUE *vres); -extern DLL void addlistinv(LIST *lp, VALUE *vres); -extern DLL void copy2octet(VALUE *, OCTET *); -extern DLL int copystod(VALUE *, long, long, VALUE *, long); -extern DLL void protecttodepth(VALUE *, int, int); -extern DLL void set_update(int); +E_FUNC void freevalue(VALUE *vp); +E_FUNC void copyvalue(VALUE *vp, VALUE *vres); +E_FUNC void negvalue(VALUE *vp, VALUE *vres); +E_FUNC void addvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void subvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void mulvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void orvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void andvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void compvalue(VALUE *vp, VALUE *vres); +E_FUNC void xorvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void squarevalue(VALUE *vp, VALUE *vres); +E_FUNC void invertvalue(VALUE *vp, VALUE *vres); +E_FUNC void roundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); +E_FUNC void broundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); +E_FUNC void setminusvalue(VALUE *, VALUE *, VALUE *); +E_FUNC void backslashvalue(VALUE *, VALUE *); +E_FUNC void contentvalue(VALUE *, VALUE *); +E_FUNC void hashopvalue(VALUE *, VALUE *, VALUE *); +E_FUNC void apprvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); +E_FUNC void intvalue(VALUE *vp, VALUE *vres); +E_FUNC void fracvalue(VALUE *vp, VALUE *vres); +E_FUNC void incvalue(VALUE *vp, VALUE *vres); +E_FUNC void decvalue(VALUE *vp, VALUE *vres); +E_FUNC void conjvalue(VALUE *vp, VALUE *vres); +E_FUNC void sqrtvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); +E_FUNC void rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); +E_FUNC void absvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void normvalue(VALUE *vp, VALUE *vres); +E_FUNC void shiftvalue(VALUE *v1, VALUE *v2, BOOL rightshift, VALUE *vres); +E_FUNC void scalevalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void powivalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); +E_FUNC void divvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void quovalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); +E_FUNC void modvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres); +E_FUNC BOOL testvalue(VALUE *vp); +E_FUNC BOOL comparevalue(VALUE *v1, VALUE *v2); +E_FUNC BOOL acceptvalue(VALUE *v1, VALUE *v2); +E_FUNC void relvalue(VALUE *v1, VALUE *v2, VALUE *vres); +E_FUNC void sgnvalue(VALUE *vp, VALUE *vres); +E_FUNC QCKHASH hashvalue(VALUE *vp, QCKHASH val); +E_FUNC void printvalue(VALUE *vp, int flags); +E_FUNC void printestr(VALUE *vp); +E_FUNC BOOL precvalue(VALUE *v1, VALUE *v2); +E_FUNC VALUE error_value(int e); +E_FUNC int set_errno(int e); +E_FUNC int set_errcount(int e); +E_FUNC long countlistitems(LIST *lp); +E_FUNC void addlistitems(LIST *lp, VALUE *vres); +E_FUNC void addlistinv(LIST *lp, VALUE *vres); +E_FUNC void copy2octet(VALUE *, OCTET *); +E_FUNC int copystod(VALUE *, long, long, VALUE *, long); +E_FUNC void protecttodepth(VALUE *, int, int); +E_FUNC void set_update(int); /* @@ -271,44 +271,44 @@ struct matrix { #define matsize(n) (sizeof(MATRIX) - sizeof(VALUE) + ((n) * sizeof(VALUE))) -extern DLL MATRIX *matadd(MATRIX *m1, MATRIX *m2); -extern DLL MATRIX *matsub(MATRIX *m1, MATRIX *m2); -extern DLL MATRIX *matmul(MATRIX *m1, MATRIX *m2); -extern DLL MATRIX *matneg(MATRIX *m); -extern DLL MATRIX *matalloc(long size); -extern DLL MATRIX *matcopy(MATRIX *m); -extern DLL MATRIX *matinit(MATRIX *m, VALUE *v1, VALUE *v2); -extern DLL MATRIX *matsquare(MATRIX *m); -extern DLL MATRIX *matinv(MATRIX *m); -extern DLL MATRIX *matscale(MATRIX *m, long n); -extern DLL MATRIX *matshift(MATRIX *m, long n); -extern DLL MATRIX *matmulval(MATRIX *m, VALUE *vp); -extern DLL MATRIX *matpowi(MATRIX *m, NUMBER *q); -extern DLL MATRIX *matconj(MATRIX *m); -extern DLL MATRIX *matquoval(MATRIX *m, VALUE *vp, VALUE *v3); -extern DLL MATRIX *matmodval(MATRIX *m, VALUE *vp, VALUE *v3); -extern DLL MATRIX *matint(MATRIX *m); -extern DLL MATRIX *matfrac(MATRIX *m); -extern DLL MATRIX *matappr(MATRIX *m, VALUE *v2, VALUE *v3); -extern DLL VALUE mattrace(MATRIX *m); -extern DLL MATRIX *mattrans(MATRIX *m); -extern DLL MATRIX *matcross(MATRIX *m1, MATRIX *m2); -extern DLL BOOL mattest(MATRIX *m); -extern DLL void matsum(MATRIX *m, VALUE *vres); -extern DLL BOOL matcmp(MATRIX *m1, MATRIX *m2); -extern DLL int matsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index); -extern DLL int matrsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index); -extern DLL VALUE matdet(MATRIX *m); -extern DLL VALUE matdot(MATRIX *m1, MATRIX *m2); -extern DLL void matfill(MATRIX *m, VALUE *v1, VALUE *v2); -extern DLL void matfree(MATRIX *m); -extern DLL void matprint(MATRIX *m, long max_print); -extern DLL VALUE *matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices); -extern DLL void matreverse(MATRIX *m); -extern DLL void matsort(MATRIX *m); -extern DLL BOOL matisident(MATRIX *m); -extern DLL MATRIX *matround(MATRIX *m, VALUE *v2, VALUE *v3); -extern DLL MATRIX *matbround(MATRIX *m, VALUE *v2, VALUE *v3); +E_FUNC MATRIX *matadd(MATRIX *m1, MATRIX *m2); +E_FUNC MATRIX *matsub(MATRIX *m1, MATRIX *m2); +E_FUNC MATRIX *matmul(MATRIX *m1, MATRIX *m2); +E_FUNC MATRIX *matneg(MATRIX *m); +E_FUNC MATRIX *matalloc(long size); +E_FUNC MATRIX *matcopy(MATRIX *m); +E_FUNC MATRIX *matinit(MATRIX *m, VALUE *v1, VALUE *v2); +E_FUNC MATRIX *matsquare(MATRIX *m); +E_FUNC MATRIX *matinv(MATRIX *m); +E_FUNC MATRIX *matscale(MATRIX *m, long n); +E_FUNC MATRIX *matshift(MATRIX *m, long n); +E_FUNC MATRIX *matmulval(MATRIX *m, VALUE *vp); +E_FUNC MATRIX *matpowi(MATRIX *m, NUMBER *q); +E_FUNC MATRIX *matconj(MATRIX *m); +E_FUNC MATRIX *matquoval(MATRIX *m, VALUE *vp, VALUE *v3); +E_FUNC MATRIX *matmodval(MATRIX *m, VALUE *vp, VALUE *v3); +E_FUNC MATRIX *matint(MATRIX *m); +E_FUNC MATRIX *matfrac(MATRIX *m); +E_FUNC MATRIX *matappr(MATRIX *m, VALUE *v2, VALUE *v3); +E_FUNC VALUE mattrace(MATRIX *m); +E_FUNC MATRIX *mattrans(MATRIX *m); +E_FUNC MATRIX *matcross(MATRIX *m1, MATRIX *m2); +E_FUNC BOOL mattest(MATRIX *m); +E_FUNC void matsum(MATRIX *m, VALUE *vres); +E_FUNC BOOL matcmp(MATRIX *m1, MATRIX *m2); +E_FUNC int matsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index); +E_FUNC int matrsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index); +E_FUNC VALUE matdet(MATRIX *m); +E_FUNC VALUE matdot(MATRIX *m1, MATRIX *m2); +E_FUNC void matfill(MATRIX *m, VALUE *v1, VALUE *v2); +E_FUNC void matfree(MATRIX *m); +E_FUNC void matprint(MATRIX *m, long max_print); +E_FUNC VALUE *matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices); +E_FUNC void matreverse(MATRIX *m); +E_FUNC void matsort(MATRIX *m); +E_FUNC BOOL matisident(MATRIX *m); +E_FUNC MATRIX *matround(MATRIX *m, VALUE *v2, VALUE *v3); +E_FUNC MATRIX *matbround(MATRIX *m, VALUE *v2, VALUE *v3); /* @@ -335,32 +335,32 @@ struct list { }; -extern DLL void insertlistfirst(LIST *lp, VALUE *vp); -extern DLL void insertlistlast(LIST *lp, VALUE *vp); -extern DLL void insertlistmiddle(LIST *lp, long index, VALUE *vp); -extern DLL void removelistfirst(LIST *lp, VALUE *vp); -extern DLL void removelistlast(LIST *lp, VALUE *vp); -extern DLL void removelistmiddle(LIST *lp, long index, VALUE *vp); -extern DLL void listfree(LIST *lp); -extern DLL void listprint(LIST *lp, long max_print); -extern DLL int listsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index); -extern DLL int listrsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index); -extern DLL BOOL listcmp(LIST *lp1, LIST *lp2); -extern DLL VALUE *listfindex(LIST *lp, long index); -extern DLL LIST *listalloc(void); -extern DLL LIST *listcopy(LIST *lp); -extern DLL void listreverse(LIST *lp); -extern DLL void listsort(LIST *lp); -extern DLL LIST *listappr(LIST *lp, VALUE *v2, VALUE *v3); -extern DLL LIST *listround(LIST *m, VALUE *v2, VALUE *v3); -extern DLL LIST *listbround(LIST *m, VALUE *v2, VALUE *v3); -extern DLL LIST *listquo(LIST *lp, VALUE *v2, VALUE *v3); -extern DLL LIST *listmod(LIST *lp, VALUE *v2, VALUE *v3); -extern DLL BOOL evp(LISTELEM *cp, LISTELEM *x, VALUE *vres); -extern DLL BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *vres); -extern DLL void insertitems(LIST *lp1, LIST *lp2); -extern DLL LISTELEM *listelement(LIST *, long); -extern DLL LIST *listsegment(LIST *, long, long); +E_FUNC void insertlistfirst(LIST *lp, VALUE *vp); +E_FUNC void insertlistlast(LIST *lp, VALUE *vp); +E_FUNC void insertlistmiddle(LIST *lp, long index, VALUE *vp); +E_FUNC void removelistfirst(LIST *lp, VALUE *vp); +E_FUNC void removelistlast(LIST *lp, VALUE *vp); +E_FUNC void removelistmiddle(LIST *lp, long index, VALUE *vp); +E_FUNC void listfree(LIST *lp); +E_FUNC void listprint(LIST *lp, long max_print); +E_FUNC int listsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index); +E_FUNC int listrsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index); +E_FUNC BOOL listcmp(LIST *lp1, LIST *lp2); +E_FUNC VALUE *listfindex(LIST *lp, long index); +E_FUNC LIST *listalloc(void); +E_FUNC LIST *listcopy(LIST *lp); +E_FUNC void listreverse(LIST *lp); +E_FUNC void listsort(LIST *lp); +E_FUNC LIST *listappr(LIST *lp, VALUE *v2, VALUE *v3); +E_FUNC LIST *listround(LIST *m, VALUE *v2, VALUE *v3); +E_FUNC LIST *listbround(LIST *m, VALUE *v2, VALUE *v3); +E_FUNC LIST *listquo(LIST *lp, VALUE *v2, VALUE *v3); +E_FUNC LIST *listmod(LIST *lp, VALUE *v2, VALUE *v3); +E_FUNC BOOL evp(LISTELEM *cp, LISTELEM *x, VALUE *vres); +E_FUNC BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *vres); +E_FUNC void insertitems(LIST *lp1, LIST *lp2); +E_FUNC LISTELEM *listelement(LIST *, long); +E_FUNC LIST *listsegment(LIST *, long, long); /* @@ -385,15 +385,15 @@ struct assoc { }; -extern DLL ASSOC *assocalloc(long initsize); -extern DLL ASSOC *assoccopy(ASSOC *ap); -extern DLL void assocfree(ASSOC *ap); -extern DLL void assocprint(ASSOC *ap, long max_print); -extern DLL int assocsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index); -extern DLL int assocrsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index); -extern DLL BOOL assoccmp(ASSOC *ap1, ASSOC *ap2); -extern DLL VALUE *assocfindex(ASSOC *ap, long index); -extern DLL VALUE *associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices); +E_FUNC ASSOC *assocalloc(long initsize); +E_FUNC ASSOC *assoccopy(ASSOC *ap); +E_FUNC void assocfree(ASSOC *ap); +E_FUNC void assocprint(ASSOC *ap, long max_print); +E_FUNC int assocsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index); +E_FUNC int assocrsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index); +E_FUNC BOOL assoccmp(ASSOC *ap1, ASSOC *ap2); +E_FUNC VALUE *assocfindex(ASSOC *ap, long index); +E_FUNC VALUE *associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices); /* @@ -475,62 +475,62 @@ struct object { (sizeof(OBJECT) + ((elements) - USUAL_ELEMENTS) * sizeof(VALUE)) -extern DLL OBJECT *objcopy(OBJECT *op); -extern DLL OBJECT *objalloc(long index); -extern DLL VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3); -extern DLL void objfree(OBJECT *op); -extern DLL int addelement(char *name); -extern DLL int defineobject(char *name, int indices[], int count); -extern DLL int checkobject(char *name); -extern DLL void showobjfuncs(void); -extern DLL void showobjtypes(void); -extern DLL int findelement(char *name); -extern DLL char *objtypename(unsigned long index); -extern DLL int objoffset(OBJECT *op, long index); +E_FUNC OBJECT *objcopy(OBJECT *op); +E_FUNC OBJECT *objalloc(long index); +E_FUNC VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3); +E_FUNC void objfree(OBJECT *op); +E_FUNC int addelement(char *name); +E_FUNC int defineobject(char *name, int indices[], int count); +E_FUNC int checkobject(char *name); +E_FUNC void showobjfuncs(void); +E_FUNC void showobjtypes(void); +E_FUNC int findelement(char *name); +E_FUNC char *objtypename(unsigned long index); +E_FUNC int objoffset(OBJECT *op, long index); /* * Configuration parameter name and type. */ -extern NAMETYPE configs[]; -extern DLL void config_value(CONFIG *cfg, int type, VALUE *ret); -extern DLL void setconfig(int type, VALUE *vp); -extern DLL void config_print(CONFIG *cfg); /* the CONFIG to print */ +EXTERN NAMETYPE configs[]; +E_FUNC void config_value(CONFIG *cfg, int type, VALUE *ret); +E_FUNC void setconfig(int type, VALUE *vp); +E_FUNC void config_print(CONFIG *cfg); /* the CONFIG to print */ /* * size, memsize and sizeof support */ -extern DLL long elm_count(VALUE *vp); -extern DLL size_t lsizeof(VALUE *vp); -extern DLL size_t memsize(VALUE *vp); +E_FUNC long elm_count(VALUE *vp); +E_FUNC size_t lsizeof(VALUE *vp); +E_FUNC size_t memsize(VALUE *vp); /* * String functions */ -extern DLL STRING *stringadd(STRING *, STRING *); -extern DLL STRING *stringcopy(STRING *); -extern DLL STRING *stringsub(STRING *, STRING *); -extern DLL STRING *stringmul(NUMBER *, STRING *); -extern DLL STRING *stringand(STRING *, STRING *); -extern DLL STRING *stringor(STRING *, STRING *); -extern DLL STRING *stringxor(STRING *, STRING *); -extern DLL STRING *stringdiff(STRING *, STRING *); -extern DLL STRING *stringsegment(STRING *, long, long); -extern DLL STRING *stringshift(STRING *, long); -extern DLL STRING *stringcomp(STRING *); -extern DLL STRING *stringneg(STRING *); -extern DLL STRING *stringcpy(STRING *, STRING *); -extern DLL STRING *stringncpy(STRING *, STRING *, size_t); -extern DLL long stringcontent(STRING *s); -extern DLL long stringlowbit(STRING *s); -extern DLL long stringhighbit(STRING *s); -extern DLL BOOL stringcmp(STRING *, STRING *); -extern DLL BOOL stringrel(STRING *, STRING *); -extern DLL int stringbit(STRING *, long); -extern DLL BOOL stringtest(STRING *); -extern DLL int stringsetbit(STRING *, long, BOOL); -extern DLL int stringsearch(STRING *, STRING *, long, long, ZVALUE *); -extern DLL int stringrsearch(STRING *, STRING *, long, long, ZVALUE *); +E_FUNC STRING *stringadd(STRING *, STRING *); +E_FUNC STRING *stringcopy(STRING *); +E_FUNC STRING *stringsub(STRING *, STRING *); +E_FUNC STRING *stringmul(NUMBER *, STRING *); +E_FUNC STRING *stringand(STRING *, STRING *); +E_FUNC STRING *stringor(STRING *, STRING *); +E_FUNC STRING *stringxor(STRING *, STRING *); +E_FUNC STRING *stringdiff(STRING *, STRING *); +E_FUNC STRING *stringsegment(STRING *, long, long); +E_FUNC STRING *stringshift(STRING *, long); +E_FUNC STRING *stringcomp(STRING *); +E_FUNC STRING *stringneg(STRING *); +E_FUNC STRING *stringcpy(STRING *, STRING *); +E_FUNC STRING *stringncpy(STRING *, STRING *, size_t); +E_FUNC long stringcontent(STRING *s); +E_FUNC long stringlowbit(STRING *s); +E_FUNC long stringhighbit(STRING *s); +E_FUNC BOOL stringcmp(STRING *, STRING *); +E_FUNC BOOL stringrel(STRING *, STRING *); +E_FUNC int stringbit(STRING *, long); +E_FUNC BOOL stringtest(STRING *); +E_FUNC int stringsetbit(STRING *, long, BOOL); +E_FUNC int stringsearch(STRING *, STRING *, long, long, ZVALUE *); +E_FUNC int stringrsearch(STRING *, STRING *, long, long, ZVALUE *); #endif /* !__VALUE_H__ */ diff --git a/version.c b/version.c index 85b598f..7c83b73 100644 --- a/version.c +++ b/version.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.77 $ - * @(#) $Id: version.c,v 29.77 2007/02/08 21:22:43 chongo Exp $ + * @(#) $Revision: 29.80 $ + * @(#) $Id: version.c,v 29.80 2007/02/11 10:28:20 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * * Under source code control: 1990/05/22 11:00:58 @@ -36,8 +36,9 @@ #include #if defined(CALC_VER) -#include -#include +# include +# include +# define STATIC static static char *program; #else # include "calc.h" @@ -48,7 +49,7 @@ static char *program; #define MAJOR_VER 2 /* major version */ #define MINOR_VER 12 /* minor version */ #define MAJOR_PATCH 1 /* patch level or 0 if no patch */ -#define MINOR_PATCH 10 /* test number or 0 if no minor patch */ +#define MINOR_PATCH 11 /* test number or 0 if no minor patch */ /* @@ -63,7 +64,7 @@ int calc_minor_patch = MINOR_PATCH; /* * stored version */ -static char *stored_version = NULL; /* version formed if != NULL */ +STATIC char *stored_version = NULL; /* version formed if != NULL */ /* diff --git a/win32dll.h b/win32dll.h deleted file mode 100644 index 2e773e1..0000000 --- a/win32dll.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * win32dll - definitions for building windoz dll files - * - * Copyright (C) 2001 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. - * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - * - * @(#) $Revision: 29.1 $ - * @(#) $Id: win32dll.h,v 29.1 2001/03/18 03:03:11 chongo Exp $ - * @(#) $Source: /usr/local/src/cmd/calc/RCS/win32dll.h,v $ - * - * Under source code control: 2001/03/17 13:05:31 - * File existed as early as: 2001 - * - * chongo /\oo/\ http://www.isthe.com/chongo/ - * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ - */ - - -#if !defined(__WIN32DLL_H__) -#define __WIN32DLL_H__ - -#if defined(_WIN32) - -# if defined(_EXPORTING) -# define DLL __declspec(dllexport) -# else -# define DLL __declspec(dllimport) -# endif - -#else /* Windoz free systems */ - -# define DLL - -#endif /* Windoz free systems */ - - -#endif /* !__WIN32DLL_H__ */ diff --git a/zfunc.c b/zfunc.c index a606c4f..fb7793c 100644 --- a/zfunc.c +++ b/zfunc.c @@ -1,7 +1,7 @@ /* * zfunc - extended precision integral arithmetic non-primitive routines * - * Copyright (C) 1999 David I. Bell, Landon Curt Noll and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.8 $ - * @(#) $Id: zfunc.c,v 29.8 2006/06/04 20:18:44 chongo Exp $ + * @(#) $Revision: 29.9 $ + * @(#) $Id: zfunc.c,v 29.9 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zfunc.c,v $ * * Under source code control: 1990/02/15 01:48:27 @@ -34,8 +34,8 @@ ZVALUE _tenpowers_[TEN_MAX+1]; /* table of 10^2^n */ -static long *power10 = NULL; -static int max_power10_exp = 0; +STATIC long *power10 = NULL; +STATIC int max_power10_exp = 0; /* * given: @@ -48,7 +48,7 @@ static int max_power10_exp = 0; * If issq_mod4k[x & 0xfff] == 0, then x cannot be a perfect square * else x might be a perfect square. */ -static USB8 issq_mod4k[1<<12] = { +STATIC USB8 issq_mod4k[1<<12] = { 1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0, 0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0, 1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0, @@ -275,7 +275,7 @@ zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res) /* * docomb evaluates binomial coefficient when z1 >= 0, z2 >= 0 */ -static int +S_FUNC int docomb(ZVALUE z1, ZVALUE z2, ZVALUE *res) { ZVALUE ans; diff --git a/zio.c b/zio.c index d1be447..11607c3 100644 --- a/zio.c +++ b/zio.c @@ -1,7 +1,7 @@ /* * zio - scanf and printf routines for arbitrary precision integers * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.8 $ - * @(#) $Id: zio.c,v 29.8 2006/06/01 16:21:37 chongo Exp $ + * @(#) $Revision: 29.9 $ + * @(#) $Id: zio.c,v 29.9 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zio.c,v $ * * Under source code control: 1993/07/30 19:42:48 @@ -61,12 +61,12 @@ struct iostate { }; -static IOSTATE *oldiostates = NULL; /* list of saved output states */ -static FILE *outfp = NULL; /* file unit for output */ -static char *outbuf = NULL; /* current diverted buffer */ -static BOOL outputisstring = FALSE; -static size_t outbufsize; -static size_t outbufused; +STATIC IOSTATE *oldiostates = NULL; /* list of saved output states */ +STATIC FILE *outfp = NULL; /* file unit for output */ +STATIC char *outbuf = NULL; /* current diverted buffer */ +STATIC BOOL outputisstring = FALSE; +STATIC size_t outbufsize; +STATIC size_t outbufused; /* @@ -79,7 +79,7 @@ static size_t outbufused; void zio_init(void) { - static int done = 0; /* 1 => routine already called */ + STATIC int done = 0; /* 1 => routine already called */ if (!done) { outfp = stdout; diff --git a/zmath.c b/zmath.c index 9536774..c2b386b 100644 --- a/zmath.c +++ b/zmath.c @@ -1,7 +1,7 @@ /* * zmath - extended precision integral arithmetic primitives * - * Copyright (C) 1999 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: zmath.c,v 29.3 2006/12/15 16:20:04 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: zmath.c,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.c,v $ * * Under source code control: 1990/02/15 01:48:28 @@ -228,8 +228,8 @@ char popcnt[256] = { #ifdef ALLOCTEST -static long nalloc = 0; -static long nfree = 0; +STATIC long nalloc = 0; +STATIC long nfree = 0; #endif diff --git a/zmath.h b/zmath.h index 01681dd..219f82d 100644 --- a/zmath.h +++ b/zmath.h @@ -1,7 +1,7 @@ /* * zmath - declarations for extended precision integer arithmetic * - * Copyright (C) 1999-2006 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.18 $ - * @(#) $Id: zmath.h,v 29.18 2006/12/15 16:20:04 chongo Exp $ + * @(#) $Revision: 29.19 $ + * @(#) $Id: zmath.h,v 29.19 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $ * * Under source code control: 1993/07/30 19:42:48 @@ -39,14 +39,14 @@ #if defined(CALC_SRC) /* if we are building from the calc source tree */ -# include "win32dll.h" +# include "decl.h" # include "alloc.h" # include "endian_calc.h" # include "longbits.h" # include "byteswap.h" # include "have_stdlib.h" #else -# include +# include # include # include # include @@ -278,128 +278,128 @@ typedef struct { /* * Function prototypes for integer math routines. */ -extern DLL HALF * alloc(LEN len); +E_FUNC HALF * alloc(LEN len); #ifdef ALLOCTEST -extern DLL void freeh(HALF *); +E_FUNC void freeh(HALF *); #endif /* * Input, output, and conversion routines. */ -extern DLL void zcopy(ZVALUE z, ZVALUE *res); -extern DLL void itoz(long i, ZVALUE *res); -extern DLL void utoz(FULL i, ZVALUE *res); -extern DLL void stoz(SFULL i, ZVALUE *res); -extern DLL void str2z(char *s, ZVALUE *res); -extern DLL long ztoi(ZVALUE z); -extern DLL FULL ztou(ZVALUE z); -extern DLL SFULL ztos(ZVALUE z); -extern DLL void zprintval(ZVALUE z, long decimals, long width); -extern DLL void zprintx(ZVALUE z, long width); -extern DLL void zprintb(ZVALUE z, long width); -extern DLL void zprinto(ZVALUE z, long width); -extern DLL void fitzprint(ZVALUE, long, long); +E_FUNC void zcopy(ZVALUE z, ZVALUE *res); +E_FUNC void itoz(long i, ZVALUE *res); +E_FUNC void utoz(FULL i, ZVALUE *res); +E_FUNC void stoz(SFULL i, ZVALUE *res); +E_FUNC void str2z(char *s, ZVALUE *res); +E_FUNC long ztoi(ZVALUE z); +E_FUNC FULL ztou(ZVALUE z); +E_FUNC SFULL ztos(ZVALUE z); +E_FUNC void zprintval(ZVALUE z, long decimals, long width); +E_FUNC void zprintx(ZVALUE z, long width); +E_FUNC void zprintb(ZVALUE z, long width); +E_FUNC void zprinto(ZVALUE z, long width); +E_FUNC void fitzprint(ZVALUE, long, long); /* * Basic numeric routines. */ -extern DLL void zmuli(ZVALUE z, long n, ZVALUE *res); -extern DLL long zdivi(ZVALUE z, long n, ZVALUE *res); -extern DLL long zmodi(ZVALUE z, long n); -extern DLL void zadd(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zsub(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL long zdiv(ZVALUE z1, ZVALUE z2, ZVALUE *res, ZVALUE *rem, long R); -extern DLL long zquo(ZVALUE z1, ZVALUE z2, ZVALUE *res, long R); -extern DLL long zmod(ZVALUE z1, ZVALUE z2, ZVALUE *rem, long R); -extern DLL void zequo(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL BOOL zdivides(ZVALUE z1, ZVALUE z2); -extern DLL void zor(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zand(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zxor(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zandnot(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL long zpopcnt(ZVALUE z, int bitval); -extern DLL void zshift(ZVALUE z, long n, ZVALUE *res); -extern DLL void zsquare(ZVALUE z, ZVALUE *res); -extern DLL long zlowbit(ZVALUE z); -extern DLL LEN zhighbit(ZVALUE z); -extern DLL void zbitvalue(long n, ZVALUE *res); -extern DLL BOOL zisset(ZVALUE z, long n); -extern DLL BOOL zisonebit(ZVALUE z); -extern DLL BOOL zisallbits(ZVALUE z); -extern DLL FLAG ztest(ZVALUE z); -extern DLL FLAG zrel(ZVALUE z1, ZVALUE z2); -extern DLL FLAG zabsrel(ZVALUE z1, ZVALUE z2); -extern DLL BOOL zcmp(ZVALUE z1, ZVALUE z2); +E_FUNC void zmuli(ZVALUE z, long n, ZVALUE *res); +E_FUNC long zdivi(ZVALUE z, long n, ZVALUE *res); +E_FUNC long zmodi(ZVALUE z, long n); +E_FUNC void zadd(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zsub(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC long zdiv(ZVALUE z1, ZVALUE z2, ZVALUE *res, ZVALUE *rem, long R); +E_FUNC long zquo(ZVALUE z1, ZVALUE z2, ZVALUE *res, long R); +E_FUNC long zmod(ZVALUE z1, ZVALUE z2, ZVALUE *rem, long R); +E_FUNC void zequo(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC BOOL zdivides(ZVALUE z1, ZVALUE z2); +E_FUNC void zor(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zand(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zxor(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zandnot(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC long zpopcnt(ZVALUE z, int bitval); +E_FUNC void zshift(ZVALUE z, long n, ZVALUE *res); +E_FUNC void zsquare(ZVALUE z, ZVALUE *res); +E_FUNC long zlowbit(ZVALUE z); +E_FUNC LEN zhighbit(ZVALUE z); +E_FUNC void zbitvalue(long n, ZVALUE *res); +E_FUNC BOOL zisset(ZVALUE z, long n); +E_FUNC BOOL zisonebit(ZVALUE z); +E_FUNC BOOL zisallbits(ZVALUE z); +E_FUNC FLAG ztest(ZVALUE z); +E_FUNC FLAG zrel(ZVALUE z1, ZVALUE z2); +E_FUNC FLAG zabsrel(ZVALUE z1, ZVALUE z2); +E_FUNC BOOL zcmp(ZVALUE z1, ZVALUE z2); /* * More complicated numeric functions. */ -extern DLL FULL uugcd(FULL i1, FULL i2); -extern DLL long iigcd(long i1, long i2); -extern DLL void zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zlcm(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zreduce(ZVALUE z1, ZVALUE z2, ZVALUE *z1res, ZVALUE *z2res); -extern DLL void zfact(ZVALUE z, ZVALUE *dest); -extern DLL void zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL int zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL FLAG zjacobi(ZVALUE z1, ZVALUE z2); -extern DLL void zfib(ZVALUE z, ZVALUE *res); -extern DLL void zpowi(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void ztenpow(long power, ZVALUE *res); -extern DLL void zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res); -extern DLL BOOL zmodinv(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL BOOL zrelprime(ZVALUE z1, ZVALUE z2); -extern DLL long zlog(ZVALUE z1, ZVALUE z2); -extern DLL long zlog10(ZVALUE z, BOOL *was_10_power); -extern DLL long zdivcount(ZVALUE z1, ZVALUE z2); -extern DLL long zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem); -extern DLL long zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL long zdigits(ZVALUE z1); -extern DLL long zdigit(ZVALUE z1, long n); -extern DLL FLAG zsqrt(ZVALUE z1, ZVALUE *dest, long R); -extern DLL void zroot(ZVALUE z1, ZVALUE z2, ZVALUE *dest); -extern DLL BOOL zissquare(ZVALUE z); -extern DLL void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res); +E_FUNC FULL uugcd(FULL i1, FULL i2); +E_FUNC long iigcd(long i1, long i2); +E_FUNC void zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zlcm(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zreduce(ZVALUE z1, ZVALUE z2, ZVALUE *z1res, ZVALUE *z2res); +E_FUNC void zfact(ZVALUE z, ZVALUE *dest); +E_FUNC void zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC int zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC FLAG zjacobi(ZVALUE z1, ZVALUE z2); +E_FUNC void zfib(ZVALUE z, ZVALUE *res); +E_FUNC void zpowi(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void ztenpow(long power, ZVALUE *res); +E_FUNC void zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res); +E_FUNC BOOL zmodinv(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC BOOL zrelprime(ZVALUE z1, ZVALUE z2); +E_FUNC long zlog(ZVALUE z1, ZVALUE z2); +E_FUNC long zlog10(ZVALUE z, BOOL *was_10_power); +E_FUNC long zdivcount(ZVALUE z1, ZVALUE z2); +E_FUNC long zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem); +E_FUNC long zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC long zdigits(ZVALUE z1); +E_FUNC long zdigit(ZVALUE z1, long n); +E_FUNC FLAG zsqrt(ZVALUE z1, ZVALUE *dest, long R); +E_FUNC void zroot(ZVALUE z1, ZVALUE z2, ZVALUE *dest); +E_FUNC BOOL zissquare(ZVALUE z); +E_FUNC void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res); /* * Prime related functions. */ -extern DLL FLAG zisprime(ZVALUE z); -extern DLL FULL znprime(ZVALUE z); -extern DLL FULL next_prime(FULL v); -extern DLL FULL zpprime(ZVALUE z); -extern DLL void zpfact(ZVALUE z, ZVALUE *dest); -extern DLL BOOL zprimetest(ZVALUE z, long count, ZVALUE skip); -extern DLL BOOL zredcprimetest(ZVALUE z, long count, ZVALUE skip); -extern DLL BOOL znextcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand); -extern DLL BOOL zprevcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand); -extern DLL FULL zlowfactor(ZVALUE z, long count); -extern DLL FLAG zfactor(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL long zpix(ZVALUE z1); -extern DLL void zlcmfact(ZVALUE z, ZVALUE *dest); +E_FUNC FLAG zisprime(ZVALUE z); +E_FUNC FULL znprime(ZVALUE z); +E_FUNC FULL next_prime(FULL v); +E_FUNC FULL zpprime(ZVALUE z); +E_FUNC void zpfact(ZVALUE z, ZVALUE *dest); +E_FUNC BOOL zprimetest(ZVALUE z, long count, ZVALUE skip); +E_FUNC BOOL zredcprimetest(ZVALUE z, long count, ZVALUE skip); +E_FUNC BOOL znextcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand); +E_FUNC BOOL zprevcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand); +E_FUNC FULL zlowfactor(ZVALUE z, long count); +E_FUNC FLAG zfactor(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC long zpix(ZVALUE z1); +E_FUNC void zlcmfact(ZVALUE z, ZVALUE *dest); /* * Misc misc functions. :-) */ -extern DLL void zsquaremod(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zminmod(ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL BOOL zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3); -extern DLL void zio_init(void); +E_FUNC void zsquaremod(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zminmod(ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC BOOL zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3); +E_FUNC void zio_init(void); /* * These functions are for internal use only. */ -extern DLL void ztrim(ZVALUE *z); -extern DLL void zshiftr(ZVALUE z, long n); -extern DLL void zshiftl(ZVALUE z, long n); -extern DLL HALF *zalloctemp(LEN len); +E_FUNC void ztrim(ZVALUE *z); +E_FUNC void zshiftr(ZVALUE z, long n); +E_FUNC void zshiftl(ZVALUE z, long n); +E_FUNC HALF *zalloctemp(LEN len); /* @@ -416,13 +416,13 @@ typedef struct { ZVALUE one; /* REDC format for the number 1 */ } REDC; -extern DLL REDC *zredcalloc(ZVALUE z1); -extern DLL void zredcfree(REDC *rp); -extern DLL void zredcencode(REDC *rp, ZVALUE z1, ZVALUE *res); -extern DLL void zredcdecode(REDC *rp, ZVALUE z1, ZVALUE *res); -extern DLL void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res); -extern DLL void zredcsquare(REDC *rp, ZVALUE z1, ZVALUE *res); -extern DLL void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC REDC *zredcalloc(ZVALUE z1); +E_FUNC void zredcfree(REDC *rp); +E_FUNC void zredcencode(REDC *rp, ZVALUE z1, ZVALUE *res); +E_FUNC void zredcdecode(REDC *rp, ZVALUE z1, ZVALUE *res); +E_FUNC void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res); +E_FUNC void zredcsquare(REDC *rp, ZVALUE z1, ZVALUE *res); +E_FUNC void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res); /* @@ -587,63 +587,63 @@ extern DLL void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res); /* * Output routines for either FILE handles or strings. */ -extern DLL void math_chr(int ch); -extern DLL void math_str(char *str); -extern DLL void math_fill(char *str, long width); -extern DLL void math_flush(void); -extern DLL void math_divertio(void); -extern DLL void math_cleardiversions(void); -extern DLL char *math_getdivertedio(void); -extern DLL int math_setmode(int mode); -extern DLL int math_setmode2(int mode); -extern DLL LEN math_setdigits(LEN digits); -extern DLL void math_fmt(char *, ...); +E_FUNC void math_chr(int ch); +E_FUNC void math_str(char *str); +E_FUNC void math_fill(char *str, long width); +E_FUNC void math_flush(void); +E_FUNC void math_divertio(void); +E_FUNC void math_cleardiversions(void); +E_FUNC char *math_getdivertedio(void); +E_FUNC int math_setmode(int mode); +E_FUNC int math_setmode2(int mode); +E_FUNC LEN math_setdigits(LEN digits); +E_FUNC void math_fmt(char *, ...); /* * The error routine. */ -extern DLL void math_error(char *, ...); +E_FUNC void math_error(char *, ...); /* * external swap functions */ -extern DLL HALF *swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len); -extern DLL ZVALUE *swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all); -extern DLL HALF *swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len); -extern DLL ZVALUE *swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all); -extern DLL ZVALUE *swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all); +E_FUNC HALF *swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len); +E_FUNC ZVALUE *swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all); +E_FUNC HALF *swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len); +E_FUNC ZVALUE *swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all); +E_FUNC ZVALUE *swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all); /* * constants used often by the arithmetic routines */ -extern HALF _zeroval_[], _oneval_[], _twoval_[], _threeval_[], _fourval_[]; -extern HALF _fiveval_[], _sixval_[], _sevenval_[], _eightval_[], _nineval_[]; -extern HALF _tenval_[], _elevenval_[], _twelveval_[], _thirteenval_[]; -extern HALF _fourteenval_[], _fifteenval_[]; -extern HALF _sqbaseval_[]; -extern HALF _fourthbaseval_[]; +EXTERN HALF _zeroval_[], _oneval_[], _twoval_[], _threeval_[], _fourval_[]; +EXTERN HALF _fiveval_[], _sixval_[], _sevenval_[], _eightval_[], _nineval_[]; +EXTERN HALF _tenval_[], _elevenval_[], _twelveval_[], _thirteenval_[]; +EXTERN HALF _fourteenval_[], _fifteenval_[]; +EXTERN HALF _sqbaseval_[]; +EXTERN HALF _fourthbaseval_[]; -extern ZVALUE zconst[]; /* ZVALUE integers from 0 thru 15 */ +EXTERN ZVALUE zconst[]; /* ZVALUE integers from 0 thru 15 */ -extern ZVALUE _zero_, _one_, _two_, _ten_, _neg_one_; -extern ZVALUE _sqbase_, _pow4base_, _pow8base_; +EXTERN ZVALUE _zero_, _one_, _two_, _ten_, _neg_one_; +EXTERN ZVALUE _sqbase_, _pow4base_, _pow8base_; -extern ZVALUE _b32_, _b64_; +EXTERN ZVALUE _b32_, _b64_; -extern DLL BOOL _math_abort_; /* nonzero to abort calculations */ -extern ZVALUE _tenpowers_[]; /* table of 10^2^n */ +EXTERN BOOL _math_abort_; /* nonzero to abort calculations */ +EXTERN ZVALUE _tenpowers_[]; /* table of 10^2^n */ /* * Bit fiddeling functions and types */ -extern HALF bitmask[]; /* bit rotation, norm 0 */ -extern HALF lowhalf[]; /* bit masks from low end of HALF */ -extern HALF rlowhalf[]; /* reversed bit masks from low end of HALF */ -extern HALF highhalf[]; /* bit masks from high end of HALF */ -extern HALF rhighhalf[]; /* reversed bit masks from high end of HALF */ +EXTERN HALF bitmask[]; /* bit rotation, norm 0 */ +EXTERN HALF lowhalf[]; /* bit masks from low end of HALF */ +EXTERN HALF rlowhalf[]; /* reversed bit masks from low end of HALF */ +EXTERN HALF highhalf[]; /* bit masks from high end of HALF */ +EXTERN HALF rhighhalf[]; /* reversed bit masks from high end of HALF */ #define HAVE_REVERSED_MASKS /* allows old code to know libcalc.a has them */ diff --git a/zmod.c b/zmod.c index 97d7780..431c172 100644 --- a/zmod.c +++ b/zmod.c @@ -1,7 +1,7 @@ /* * zmod - modulo arithmetic routines * - * Copyright (C) 1999 David I. Bell, Landon Curt Noll and Ernest Bowen + * Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: zmod.c,v 29.4 2006/06/11 00:08:56 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: zmod.c,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zmod.c,v $ * * Under source code control: 1991/05/22 23:03:55 @@ -47,15 +47,15 @@ #define POWBITS 4 /* bits for power chunks (must divide BASEB) */ #define POWNUMS (1<len = 1; } -static void +S_FUNC void zmod6(ZVALUE z1, ZVALUE *res) { LEN len, modlen, len0; @@ -799,7 +799,7 @@ zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res) /* * Given a positive odd N-word integer z, evaluate minv(-z, BASEB^N) */ -static void +S_FUNC void zredcmodinv(ZVALUE z, ZVALUE *res) { ZVALUE tmp; diff --git a/zmul.c b/zmul.c index 05aca11..38065c5 100644 --- a/zmul.c +++ b/zmul.c @@ -1,7 +1,7 @@ /* * zmul - faster than usual multiplying and squaring routines * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2007 David I. Bell * * 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: zmul.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: zmul.c,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zmul.c,v $ * * Under source code control: 1991/01/09 20:01:31 @@ -41,10 +41,10 @@ #include "zmath.h" -static HALF *tempbuf; /* temporary buffer for multiply and square */ +STATIC HALF *tempbuf; /* temporary buffer for multiply and square */ -static LEN domul(HALF *v1, LEN size1, HALF *v2, LEN size2, HALF *ans); -static LEN dosquare(HALF *vp, LEN size, HALF *ans); +S_FUNC LEN domul(HALF *v1, LEN size1, HALF *v2, LEN size2, HALF *ans); +S_FUNC LEN dosquare(HALF *vp, LEN size, HALF *ans); /* @@ -116,7 +116,7 @@ zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res) * size2 size of second number * ans location for result */ -static LEN +S_FUNC LEN domul(HALF *v1, LEN size1, HALF *v2, LEN size2, HALF *ans) { LEN shift; /* amount numbers are shifted by */ @@ -705,7 +705,7 @@ zsquare(ZVALUE z, ZVALUE *res) * size length of value to square * ans location for result */ -static LEN +S_FUNC LEN dosquare(HALF *vp, LEN size, HALF *ans) { LEN shift; /* amount numbers are shifted by */ @@ -1052,8 +1052,8 @@ HALF * zalloctemp(LEN len) { HALF *hp; - static LEN buflen; /* current length of temp buffer */ - static HALF *bufptr; /* pointer to current temp buffer */ + STATIC LEN buflen; /* current length of temp buffer */ + STATIC HALF *bufptr; /* pointer to current temp buffer */ if (len <= buflen) return bufptr; diff --git a/zprime.c b/zprime.c index eae55aa..518346f 100644 --- a/zprime.c +++ b/zprime.c @@ -1,7 +1,7 @@ /* * zprime - rapid small prime routines * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: zprime.c,v 29.3 2006/05/20 08:43:55 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: zprime.c,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zprime.c,v $ * * Under source code control: 1994/05/29 04:34:36 @@ -49,7 +49,7 @@ /* * product of primes that fit into a long */ -static CONST FULL pfact_tbl[MAX_PFACT_VAL+1] = { +STATIC CONST FULL pfact_tbl[MAX_PFACT_VAL+1] = { 1, 1, 2, 6, 6, 30, 30, 210, 210, 210, 210, 2310, 2310, 30030, 30030, 30030, 30030, 510510, 510510, 9699690, 9699690, 9699690, 9699690, 223092870, 223092870, 223092870, 223092870, 223092870, 223092870 @@ -70,7 +70,7 @@ static CONST FULL pfact_tbl[MAX_PFACT_VAL+1] = { * topbit[0] == 0 by convention * topbit[x] gives the highest 1 bit of x */ -static CONST unsigned char topbit[256] = { +STATIC CONST unsigned char topbit[256] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, @@ -96,7 +96,7 @@ static CONST unsigned char topbit[256] = { * * We have enough table entries for a FULL that is 64 bits long. */ -static CONST FULL isqrt_pow2[64] = { +STATIC CONST FULL isqrt_pow2[64] = { 1, 1, 2, 2, 4, 5, 8, 11, /* 0 .. 7 */ 16, 22, 32, 45, 64, 90, 128, 181, /* 8 .. 15 */ 256, 362, 512, 724, 1024, 1448, 2048, 2896, /* 16 .. 23 */ @@ -114,9 +114,9 @@ static CONST FULL isqrt_pow2[64] = { /* * static functions */ -static FULL fsqrt(FULL v); /* quick square root of v */ -static long pix(FULL x); /* pi of x */ -static FULL small_factor(ZVALUE n, FULL limit); /* factor or 0 */ +S_FUNC FULL fsqrt(FULL v); /* quick square root of v */ +S_FUNC long pix(FULL x); /* pi of x */ +S_FUNC FULL small_factor(ZVALUE n, FULL limit); /* factor or 0 */ /* @@ -434,7 +434,7 @@ zpix(ZVALUE z) * -1 error * >=0 number of primes <= x */ -static long +S_FUNC long pix(FULL x) { long count; /* pi(x) */ @@ -588,7 +588,7 @@ zfactor(ZVALUE n, ZVALUE zlimit, ZVALUE *res) * 0 no prime <= the limit was found * != 0 the smallest prime factor */ -static FULL +S_FUNC FULL small_factor(ZVALUE z, FULL limit) { FULL top; /* current max factor level */ @@ -1588,7 +1588,7 @@ zlcmfact(ZVALUE z, ZVALUE *dest) * given: * x compute the integer square root of x */ -static FULL +S_FUNC FULL fsqrt(FULL x) { FULL y; /* (FULL)temporary value */ diff --git a/zrand.c b/zrand.c index 8507323..9983e27 100644 --- a/zrand.c +++ b/zrand.c @@ -1,7 +1,7 @@ /* * zrand - subtractive 100 shuffle generator * - * Copyright (C) 1999,2004 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.9 $ - * @(#) $Id: zrand.c,v 29.9 2004/03/31 04:58:40 chongo Exp $ + * @(#) $Revision: 29.10 $ + * @(#) $Id: zrand.c,v 29.10 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $ * * Under source code control: 1995/01/07 09:45:25 @@ -366,7 +366,7 @@ * This is the state of the s100 generator after initialization, or srand(0), * or srand(0) is called. The init_s100 value is never changed, only copied. */ -static CONST RAND init_s100 = { +STATIC CONST RAND init_s100 = { 1, /* seeded */ 0, /* no buffered bits */ #if FULL_BITS == SBITS /* buffer */ @@ -759,7 +759,7 @@ static CONST RAND init_s100 = { * * This array is never changed, only copied. */ -static CONST FULL def_subtract[SCNT] = { +STATIC CONST FULL def_subtract[SCNT] = { #if FULL_BITS == SBITS (FULL)U(0xc8c0370c7db7dc19), (FULL)U(0x738e33b940a06fbb), (FULL)U(0x481abb76a859ed2b), (FULL)U(0x74106bb39ccdccb5), @@ -877,32 +877,32 @@ static CONST FULL def_subtract[SCNT] = { * These constants are used in the randreseed64(). See below. */ #if FULL_BITS == SBITS -static CONST HALF a_vec[SHALFS] = { (HALF)0x73c0ccbd, (HALF)0x57aa0ff4 }; -static CONST HALF c_vec[SHALFS] = { (HALF)0x18e09865, (HALF)0x12ea8057 }; +STATIC CONST HALF a_vec[SHALFS] = { (HALF)0x73c0ccbd, (HALF)0x57aa0ff4 }; +STATIC CONST HALF c_vec[SHALFS] = { (HALF)0x18e09865, (HALF)0x12ea8057 }; #elif 2*FULL_BITS == SBITS -static CONST HALF a_vec[SHALFS] = { (HALF)0xccbd, (HALF)0x73c0, +STATIC CONST HALF a_vec[SHALFS] = { (HALF)0xccbd, (HALF)0x73c0, (HALF)0x0ff4, (HALF)0x57aa }; -static CONST HALF c_vec[SHALFS] = { (HALF)0x9865, (HALF)0x18e0, +STATIC CONST HALF c_vec[SHALFS] = { (HALF)0x9865, (HALF)0x18e0, (HALF)0x8057, (HALF)0x12ea }; #else /\../\ FULL_BITS must be 32 or 64 /\../\ !!! #endif -static CONST ZVALUE a_val = {(HALF *)a_vec, SHALFS, 0}; -static CONST ZVALUE c_val = {(HALF *)c_vec, SHALFS, 0}; +STATIC CONST ZVALUE a_val = {(HALF *)a_vec, SHALFS, 0}; +STATIC CONST ZVALUE c_val = {(HALF *)c_vec, SHALFS, 0}; /* * current s100 generator state */ -static RAND s100; +STATIC RAND s100; /* * declare static functions */ -static void randreseed64(ZVALUE seed, ZVALUE *res); -static int slotcp(BITSTR *bitstr, FULL *src, int count); -static void slotcp64(BITSTR *bitstr, FULL *src); +S_FUNC void randreseed64(ZVALUE seed, ZVALUE *res); +S_FUNC int slotcp(BITSTR *bitstr, FULL *src, int count); +S_FUNC void slotcp64(BITSTR *bitstr, FULL *src); /* @@ -1034,7 +1034,7 @@ static void slotcp64(BITSTR *bitstr, FULL *src); * NOTE: This is NOT a pseudo random number generator. This function is * intended to be used internally by ss100rand() and sshufrand(). */ -static void +S_FUNC void randreseed64(ZVALUE seed, ZVALUE *res) { ZVALUE t; /* temp value */ @@ -1440,7 +1440,7 @@ zsetrand(CONST RAND *state) * returns: * number of bits transfered */ -static int +S_FUNC int slotcp(BITSTR *bitstr, FULL *src, int count) { HALF *dh; /* most significant HALF in dest */ @@ -1615,7 +1615,7 @@ slotcp(BITSTR *bitstr, FULL *src, int count) * returns: * number of bits transfered */ -static void +S_FUNC void slotcp64(BITSTR *bitstr, FULL *src) { HALF *dh = bitstr->loc; /* most significant HALF in dest */ diff --git a/zrand.h b/zrand.h index 4b7b00c..c72ee98 100644 --- a/zrand.h +++ b/zrand.h @@ -1,7 +1,7 @@ /* * zrand - subtractive 100 shuffle generator * - * Copyright (C) 1999,2004 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: zrand.h,v 29.7 2004/03/31 04:58:40 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: zrand.h,v 29.8 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.h,v $ * * Under source code control: 1995/01/07 09:45:26 @@ -210,16 +210,16 @@ struct rand { /* * s100 generator function declarations */ -extern RAND *zsrand(CONST ZVALUE *seed, CONST MATRIX *pmat100); -extern RAND *zsetrand(CONST RAND *state); -extern void zrandskip(long count); -extern void zrand(long count, ZVALUE *res); -extern void zrandrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res); -extern long irand(long s); -extern RAND *randcopy(CONST RAND *rand); -extern void randfree(RAND *rand); -extern BOOL randcmp(CONST RAND *s1, CONST RAND *s2); -extern void randprint(CONST RAND *state, int flags); +E_FUNC RAND *zsrand(CONST ZVALUE *seed, CONST MATRIX *pmat100); +E_FUNC RAND *zsetrand(CONST RAND *state); +E_FUNC void zrandskip(long count); +E_FUNC void zrand(long count, ZVALUE *res); +E_FUNC void zrandrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res); +E_FUNC long irand(long s); +E_FUNC RAND *randcopy(CONST RAND *rand); +E_FUNC void randfree(RAND *rand); +E_FUNC BOOL randcmp(CONST RAND *s1, CONST RAND *s2); +E_FUNC void randprint(CONST RAND *state, int flags); #endif /* !__ZRAND_H__ */ diff --git a/zrandom.c b/zrandom.c index cc669df..2500d24 100644 --- a/zrandom.c +++ b/zrandom.c @@ -1,7 +1,7 @@ /* * zrandom - Blum-Blum-Shub pseudo-random generator * - * Copyright (C) 1999,2004 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.8 $ - * @(#) $Id: zrandom.c,v 29.8 2004/03/31 04:58:40 chongo Exp $ + * @(#) $Revision: 29.9 $ + * @(#) $Id: zrandom.c,v 29.9 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $ * * Under source code control: 1997/02/15 04:01:56 @@ -1090,7 +1090,7 @@ /* * current Blum generator state */ -static RANDOM blum; +STATIC RANDOM blum; /* @@ -1101,25 +1101,25 @@ static RANDOM blum; * The z_rdefault ZVALUE is the 'r' (quadratic residue) of init_blum. */ #if FULL_BITS == 64 -static CONST HALF h_ndefvec[] = { +STATIC CONST HALF h_ndefvec[] = { (HALF)0xd6be18d9, (HALF)0xba55a689, (HALF)0x4a9027d9, (HALF)0x84f34b64, (HALF)0xd0e8d302, (HALF)0x3d78613e, (HALF)0x56af9e37, (HALF)0x2ac19031, (HALF)0xf }; -static CONST HALF h_rdefvec[] = { +STATIC CONST HALF h_rdefvec[] = { (HALF)0xd3e7b11e, (HALF)0x0f23fd7e, (HALF)0xa62546c9, (HALF)0x06c73ca5, (HALF)0x627d6265, (HALF)0x2f1e93a8, (HALF)0xff4b074e, (HALF)0x48b6d882, (HALF)0x7 }; #elif 2*FULL_BITS == 64 -static CONST HALF h_ndefvec[] = { +STATIC CONST HALF h_ndefvec[] = { (HALF)0x18d9, (HALF)0xd6be, (HALF)0xa689, (HALF)0xba55, (HALF)0x27d9, (HALF)0x4a90, (HALF)0x4b64, (HALF)0x84f3, (HALF)0xd302, (HALF)0xd0e8, (HALF)0x613e, (HALF)0x3d78, (HALF)0x9e37, (HALF)0x56af, (HALF)0x9031, (HALF)0x2ac1, (HALF)0xf }; -static CONST HALF h_rdefvec[] = { +STATIC CONST HALF h_rdefvec[] = { (HALF)0xb11e, (HALF)0xd3e7, (HALF)0xfd7e, (HALF)0x0f23, (HALF)0x46c9, (HALF)0xa625, (HALF)0x3ca5, (HALF)0x06c7, (HALF)0x6265, (HALF)0x627d, (HALF)0x93a8, (HALF)0x2f1e, @@ -1129,19 +1129,19 @@ static CONST HALF h_rdefvec[] = { #else /\../\ FULL_BITS must be 32 or 64 /\../\ !!! #endif -static CONST RANDOM init_blum = {1, 0, 8, (HALF)0, (HALF)0xff, +STATIC CONST RANDOM init_blum = {1, 0, 8, (HALF)0, (HALF)0xff, {(HALF *)h_ndefvec, sizeof(h_ndefvec)/sizeof(HALF), 0}, {(HALF *)h_rdefvec, sizeof(h_rdefvec)/sizeof(HALF), 0}}; #if FULL_BITS == 64 -static CONST HALF h_rdefvec_2[] = { +STATIC CONST HALF h_rdefvec_2[] = { (HALF)0xd3e7b11e, (HALF)0x0f23fd7e, (HALF)0xa62546c9, (HALF)0x06c73ca5, (HALF)0x627d6265, (HALF)0x2f1e93a8, (HALF)0xff4b074e, (HALF)0x48b6d882, (HALF)0x7 }; #elif 2*FULL_BITS == 64 -static CONST HALF h_rdefvec_2[] = { +STATIC CONST HALF h_rdefvec_2[] = { (HALF)0xb11e, (HALF)0xd3e7, (HALF)0xfd7e, (HALF)0x0f23, (HALF)0x46c9, (HALF)0xa625, (HALF)0x3ca5, (HALF)0x06c7, (HALF)0x6265, (HALF)0x627d, (HALF)0x93a8, (HALF)0x2f1e, @@ -1151,7 +1151,7 @@ static CONST HALF h_rdefvec_2[] = { #else /\../\ FULL_BITS must be 32 or 64 /\../\ !!! #endif -static CONST ZVALUE z_rdefault = { +STATIC CONST ZVALUE z_rdefault = { (HALF *)h_rdefvec_2, sizeof(h_rdefvec_2)/sizeof(HALF), 0 }; @@ -1163,132 +1163,132 @@ static CONST ZVALUE z_rdefault = { * 1 <= newn < BLUM_PREGEN. */ #if FULL_BITS == 64 -static CONST HALF h_nvec01[] = { +STATIC CONST HALF h_nvec01[] = { (HALF)0x83de9361, (HALF)0xf0db722d, (HALF)0x6fe328ca, (HALF)0x04944073, (HALF)0x5 }; -static CONST HALF h_rvec01[] = { +STATIC CONST HALF h_rvec01[] = { (HALF)0xa4cc42ec, (HALF)0x4e5dbb01, (HALF)0x11d952e7, (HALF)0xb226980f }; -static CONST HALF h_nvec02[] = { +STATIC CONST HALF h_nvec02[] = { (HALF)0x353443f1, (HALF)0xeb286ea9, (HALF)0xdd374a18, (HALF)0x348a2555, (HALF)0x2c5 }; -static CONST HALF h_rvec02[] = { +STATIC CONST HALF h_rvec02[] = { (HALF)0x21e3a218, (HALF)0xe893616b, (HALF)0x6cd710e3, (HALF)0xf3d64344, (HALF)0x40 }; -static CONST HALF h_nvec03[] = { +STATIC CONST HALF h_nvec03[] = { (HALF)0x11d001f1, (HALF)0xf2ca661f, (HALF)0x3a81f1e0, (HALF)0x59d6ce4e, (HALF)0x0009cfd9 }; -static CONST HALF h_rvec03[] = { +STATIC CONST HALF h_rvec03[] = { (HALF)0xa0d7d76a, (HALF)0x3e142de2, (HALF)0xff5cea4f, (HALF)0xb44d9b64, (HALF)0xfae5 }; -static CONST HALF h_nvec04[] = { +STATIC CONST HALF h_nvec04[] = { (HALF)0xdfcc0751, (HALF)0x2decc680, (HALF)0x5df12a1a, (HALF)0x5c894ed7, (HALF)0x3070f924 }; -static CONST HALF h_rvec04[] = { +STATIC CONST HALF h_rvec04[] = { (HALF)0x4b984570, (HALF)0xa220ddba, (HALF)0xa2c0af8a, (HALF)0x131b2bdc, (HALF)0x0020c2d8 }; -static CONST HALF h_nvec05[] = { +STATIC CONST HALF h_nvec05[] = { (HALF)0x99166ef1, (HALF)0x8b99e5e7, (HALF)0x8769a010, (HALF)0x5d3fe111, (HALF)0x680bc2fa, (HALF)0x38f75aac, (HALF)0xdb81a85b, (HALF)0x109b1822, (HALF)0x2 }; -static CONST HALF h_rvec05[] = { +STATIC CONST HALF h_rvec05[] = { (HALF)0x59e2efa9, (HALF)0x0e6c77c8, (HALF)0x1e70aeed, (HALF)0x234f7b7d, (HALF)0x5f5df6db, (HALF)0xe821a960, (HALF)0xae33b792, (HALF)0x5e9b890e }; -static CONST HALF h_nvec06[] = { +STATIC CONST HALF h_nvec06[] = { (HALF)0xe1ddf431, (HALF)0xd85557f1, (HALF)0x5ee732da, (HALF)0x3a38db77, (HALF)0x5c644026, (HALF)0xf2dbf218, (HALF)0x9ada2c79, (HALF)0x7bfd9d7d, (HALF)0xa }; -static CONST HALF h_rvec06[] = { +STATIC CONST HALF h_rvec06[] = { (HALF)0xc9404daf, (HALF)0xc5dc2e80, (HALF)0x2c98eccf, (HALF)0xe1f3495d, (HALF)0xce1c925c, (HALF)0xe097aede, (HALF)0x88667154, (HALF)0x5e94a02f }; -static CONST HALF h_nvec07[] = { +STATIC CONST HALF h_nvec07[] = { (HALF)0xcf9ec751, (HALF)0x602f9125, (HALF)0x52882e7f, (HALF)0x0dcf53ce, (HALF)0xff569d6b, (HALF)0x628643fc, (HALF)0x37801cd5, (HALF)0xf2399ef2, (HALF)0x43d87de8 }; -static CONST HALF h_rvec07[] = { +STATIC CONST HALF h_rvec07[] = { (HALF)0x098d25e6, (HALF)0x3992d2e5, (HALF)0x64f0b58c, (HALF)0xcf18d4dd, (HALF)0x9d876aef, (HALF)0x7acced04, (HALF)0xbfbe9076, (HALF)0x1ee014c7, (HALF)0x0013522d }; -static CONST HALF h_nvec08[] = { +STATIC CONST HALF h_nvec08[] = { (HALF)0x26742f11, (HALF)0xbc42e66a, (HALF)0xb59cd9f0, (HALF)0x9ad4a6c2, (HALF)0x5bdbd2f9, (HALF)0xbdc91fed, (HALF)0xf13c9ce7, (HALF)0xeb4699b7, (HALF)0x47126ca7, (HALF)0x58 }; -static CONST HALF h_rvec08[] = { +STATIC CONST HALF h_rvec08[] = { (HALF)0x489dc674, (HALF)0xaae95f3a, (HALF)0xa35da929, (HALF)0x5597b4b8, (HALF)0x28e9c947, (HALF)0x3d344f9a, (HALF)0xb7e661fa, (HALF)0xa3269116, (HALF)0x853016dc }; -static CONST HALF h_nvec09[] = { +STATIC CONST HALF h_nvec09[] = { (HALF)0xab27e3d1, (HALF)0x12745db4, (HALF)0xb980f951, (HALF)0x62b16b66, (HALF)0x0fdece0d, (HALF)0x6061c6fd, (HALF)0x36a6ff09, (HALF)0xe08eb61c, (HALF)0x84d895c3, (HALF)0x4a86752a, (HALF)0xc1797b4f, (HALF)0x562157a3, (HALF)0x3d267bb0, (HALF)0x14e81b00, (HALF)0x218d9238, (HALF)0x52322fd3, (HALF)0x0039e8be }; -static CONST HALF h_rvec09[] = { +STATIC CONST HALF h_rvec09[] = { (HALF)0x7d4ed20d, (HALF)0x601ef2b8, (HALF)0x8e59f959, (HALF)0xedaa5d9e, (HALF)0x309a89ba, (HALF)0xe5ab7d81, (HALF)0x796b2545, (HALF)0x02de3222, (HALF)0x8357c0bd, (HALF)0x0107e3fd, (HALF)0x82d9d288, (HALF)0xbc42a8aa, (HALF)0x4b787343, (HALF)0xc0150886, (HALF)0xbab915bf, (HALF)0xf8ad1e6b, (HALF)0xb458 }; -static CONST HALF h_nvec10[] = { +STATIC CONST HALF h_nvec10[] = { (HALF)0xb7e64b89, (HALF)0xc3cdc363, (HALF)0x2ef9c73c, (HALF)0x6092ce22, (HALF)0x02abe36c, (HALF)0x08d49573, (HALF)0x74511c40, (HALF)0xd38582de, (HALF)0xa524a02f, (HALF)0x52c81b3b, (HALF)0x250d3cc9, (HALF)0x23b50e88, (HALF)0xbd1448bf, (HALF)0x882d7f98, (HALF)0xc23ef596, (HALF)0xc9055666, (HALF)0x025f2435 }; -static CONST HALF h_rvec10[] = { +STATIC CONST HALF h_rvec10[] = { (HALF)0x94cfc482, (HALF)0x594f5ad4, (HALF)0x23442aee, (HALF)0x145f40ce, (HALF)0x1baf950d, (HALF)0xadc4f175, (HALF)0xf62c669f, (HALF)0x8d075d56, (HALF)0x08ed8b40, (HALF)0xaaf2cf30, (HALF)0xc24b5ffb, (HALF)0x250df8cf, (HALF)0x7ca81ec9, (HALF)0x787e2b70, (HALF)0x18401468, (HALF)0x47b20e0c, (HALF)0x0066bb7e }; -static CONST HALF h_nvec11[] = { +STATIC CONST HALF h_nvec11[] = { (HALF)0x546ee069, (HALF)0x2e1a530c, (HALF)0x2014dab2, (HALF)0xa729cf52, (HALF)0x920ee1a9, (HALF)0x68f27533, (HALF)0x25873cfa, (HALF)0xdd37a749, (HALF)0x4499daa2, (HALF)0x286e5870, (HALF)0x57f3f9b6, (HALF)0x5ec54467, (HALF)0x69a791ea, (HALF)0x874ecd77, (HALF)0x4217d56b, (HALF)0x82bdb309, (HALF)0x497864de }; -static CONST HALF h_rvec11[] = { +STATIC CONST HALF h_rvec11[] = { (HALF)0x56e38b04, (HALF)0x3a0aded3, (HALF)0x461d88b1, (HALF)0x9c094d65, (HALF)0xe5333fed, (HALF)0x34d918fe, (HALF)0x1ef56281, (HALF)0xcedfa07c, (HALF)0x590f47fb, (HALF)0xa2c54d5c, (HALF)0x732339ee, (HALF)0x806549a7, (HALF)0x9ce3163f, (HALF)0xae3af8b6, (HALF)0x264a4465, (HALF)0x1cb5e630, (HALF)0x00868488 }; -static CONST HALF h_nvec12[] = { +STATIC CONST HALF h_nvec12[] = { (HALF)0xf14c7b99, (HALF)0x7f66d151, (HALF)0x87efad2b, (HALF)0x57d3f098, (HALF)0xd6534165, (HALF)0x812fdd25, (HALF)0x48c7c7ce, (HALF)0xa1bf41e0, (HALF)0x4c94e315, (HALF)0x190b1593, (HALF)0xee4251da, (HALF)0x2b4a1a66, (HALF)0x2bb7c2a1, (HALF)0x65b18ca9, (HALF)0x08b89116, (HALF)0xc0ccb15f, (HALF)0x57582ab3, (HALF)0x34 }; -static CONST HALF h_rvec12[] = { +STATIC CONST HALF h_rvec12[] = { (HALF)0xe207b4a0, (HALF)0x5227dd68, (HALF)0x9488fbc4, (HALF)0x6ed081aa, (HALF)0x8e736fe5, (HALF)0x3dd2c020, (HALF)0xeeb07c57, (HALF)0x0b604eb7, (HALF)0xa13f72a1, (HALF)0xcbfc4333, (HALF)0xa4c5e8cd, (HALF)0x0add520d, (HALF)0x758ca3b2, (HALF)0x55490137, (HALF)0x5870babd, (HALF)0xf648ed93, (HALF)0xdf719bd1 }; -static CONST HALF h_nvec13[] = { +STATIC CONST HALF h_nvec13[] = { (HALF)0x3314fc49, (HALF)0xcca20032, (HALF)0x208e3420, (HALF)0x8aaa503a, (HALF)0xd79a63cc, (HALF)0xb4ed7417, (HALF)0x95dd1892, (HALF)0xb5915f64, (HALF)0xd14cc7f1, (HALF)0x1589917e, (HALF)0xb2b05667, (HALF)0xc32d99cb, @@ -1299,7 +1299,7 @@ static CONST HALF h_nvec13[] = { (HALF)0xdaf66d82, (HALF)0xed03d833, (HALF)0x1b5af734, (HALF)0x166b7dd2, (HALF)0x01517c19 }; -static CONST HALF h_rvec13[] = { +STATIC CONST HALF h_rvec13[] = { (HALF)0x6b7736f5, (HALF)0x2407bfe4, (HALF)0x965e2072, (HALF)0xcc26cf3e, (HALF)0xa432b567, (HALF)0x2ed007ab, (HALF)0x0e2f67b9, (HALF)0xef640960, (HALF)0xbe5f1ad3, (HALF)0x3faeda1b, (HALF)0xa8f6b988, (HALF)0xe5c9cea5, @@ -1310,7 +1310,7 @@ static CONST HALF h_rvec13[] = { (HALF)0x9b706d2b, (HALF)0x8b04f6a6, (HALF)0x1263fa64, (HALF)0x8e9a560d, (HALF)0xd42e }; -static CONST HALF h_nvec14[] = { +STATIC CONST HALF h_nvec14[] = { (HALF)0xc116af01, (HALF)0xbdef8c0f, (HALF)0xc4409a1a, (HALF)0xacb3185c, (HALF)0xb33f925b, (HALF)0xfee83005, (HALF)0x4b3db112, (HALF)0x7f076743, (HALF)0x21709223, (HALF)0x2159054b, (HALF)0x6fdfefe3, (HALF)0x792d0a07, @@ -1321,7 +1321,7 @@ static CONST HALF h_nvec14[] = { (HALF)0x1f564618, (HALF)0xb9d983d0, (HALF)0x7479ac07, (HALF)0x93c6f4e8, (HALF)0x5e56a00e }; -static CONST HALF h_rvec14[] = { +STATIC CONST HALF h_rvec14[] = { (HALF)0x0ff9f190, (HALF)0x47a4db68, (HALF)0x913cc8ea, (HALF)0xb6b1b220, (HALF)0x13edfbbb, (HALF)0xa8f1f1c3, (HALF)0xd6d71f8f, (HALF)0x4194649a, (HALF)0x7d497344, (HALF)0x677c8416, (HALF)0x0186b983, (HALF)0xee633901, @@ -1332,7 +1332,7 @@ static CONST HALF h_rvec14[] = { (HALF)0x15b9a564, (HALF)0x9b18f154, (HALF)0x6ef0c5d0, (HALF)0xb6733509, (HALF)0x00f7aa7c }; -static CONST HALF h_nvec15[] = { +STATIC CONST HALF h_nvec15[] = { (HALF)0xc8d97079, (HALF)0x061e7597, (HALF)0xf5d2c721, (HALF)0x299bc51f, (HALF)0xffe6c337, (HALF)0x19798624, (HALF)0xee6f92b6, (HALF)0x0b1d0c7a, (HALF)0xb5308231, (HALF)0x49c558dd, (HALF)0x196a530e, (HALF)0x0caa515c, @@ -1343,7 +1343,7 @@ static CONST HALF h_nvec15[] = { (HALF)0x45352ebe, (HALF)0x5ba81ca8, (HALF)0x02c46c17, (HALF)0x9edfbcdb, (HALF)0x97dd840b }; -static CONST HALF h_rvec15[] = { +STATIC CONST HALF h_rvec15[] = { (HALF)0x6c3e2110, (HALF)0x808f0aaa, (HALF)0xd98db92e, (HALF)0x1e6abd43, (HALF)0xf401b920, (HALF)0x9d3f0381, (HALF)0xdb95d174, (HALF)0xa2f65c33, (HALF)0x0c5469f8, (HALF)0xa3c126fc, (HALF)0x8866241b, (HALF)0x0e46eca7, @@ -1354,7 +1354,7 @@ static CONST HALF h_rvec15[] = { (HALF)0xa8d77ca6, (HALF)0xb50025da, (HALF)0x69ab99f9, (HALF)0x03b8c758, (HALF)0x00b82207 }; -static CONST HALF h_nvec16[] = { +STATIC CONST HALF h_nvec16[] = { (HALF)0xd84346e1, (HALF)0x184183f6, (HALF)0x2dc9bd36, (HALF)0x4ca857ac, (HALF)0x96a5828d, (HALF)0xed1f1c59, (HALF)0x36d9731f, (HALF)0xbd3f6183, (HALF)0xde0f5578, (HALF)0xb6a2ea8a, (HALF)0xbe993c44, (HALF)0x0e283c05, @@ -1365,7 +1365,7 @@ static CONST HALF h_nvec16[] = { (HALF)0x9e43536a, (HALF)0x9f544cb8, (HALF)0xb56f84c3, (HALF)0xb82fbb12, (HALF)0x6e348549, (HALF)0x45 }; -static CONST HALF h_rvec16[] = { +STATIC CONST HALF h_rvec16[] = { (HALF)0x7b4e8830, (HALF)0x70605db8, (HALF)0xa1abe4a5, (HALF)0xa70fbe04, (HALF)0x2bcda8f4, (HALF)0xd29ada9a, (HALF)0x55ad0560, (HALF)0xb367137e, (HALF)0xd6972f1a, (HALF)0x809bad45, (HALF)0xb15d2454, (HALF)0x0c0d415f, @@ -1376,7 +1376,7 @@ static CONST HALF h_rvec16[] = { (HALF)0x7895ae8f, (HALF)0x4a4b6dcd, (HALF)0x973e921a, (HALF)0x9fb27a07, (HALF)0xb0d7dcb1 }; -static CONST HALF h_nvec17[] = { +STATIC CONST HALF h_nvec17[] = { (HALF)0x72b72051, (HALF)0xedc24ebf, (HALF)0xe970a8d1, (HALF)0x66c9b150, (HALF)0xcbb927f7, (HALF)0xb574ffd9, (HALF)0x4166b249, (HALF)0x0fce4030, (HALF)0xfa6922ca, (HALF)0x39cc14a9, (HALF)0x14396e2a, (HALF)0xaff74c7f, @@ -1395,7 +1395,7 @@ static CONST HALF h_nvec17[] = { (HALF)0x96e0faf9, (HALF)0x33be3c0f, (HALF)0xffa3040b, (HALF)0x813aeac0, (HALF)0x6177 }; -static CONST HALF h_rvec17[] = { +STATIC CONST HALF h_rvec17[] = { (HALF)0x22b41dac, (HALF)0xd6258005, (HALF)0x2aa1e0cb, (HALF)0x45d147b5, (HALF)0xbf5c46d9, (HALF)0x14c9dadf, (HALF)0x09b0aec4, (HALF)0x4286bfef, (HALF)0xc6f8e9d1, (HALF)0xdd68467b, (HALF)0x93f4ffb9, (HALF)0x58f2eb51, @@ -1414,7 +1414,7 @@ static CONST HALF h_rvec17[] = { (HALF)0xc2d2fc5b, (HALF)0xdd665324, (HALF)0xc3b8adf1, (HALF)0x0b6eaf3b, (HALF)0x5372 }; -static CONST HALF h_nvec18[] = { +STATIC CONST HALF h_nvec18[] = { (HALF)0xc8b78629, (HALF)0x41351b18, (HALF)0x28ad4ed8, (HALF)0xc96f7df1, (HALF)0x7cd3c931, (HALF)0x0f23036a, (HALF)0xac657631, (HALF)0x6a625812, (HALF)0x08144788, (HALF)0x8642ed62, (HALF)0x76198a40, (HALF)0x70defd64, @@ -1433,7 +1433,7 @@ static CONST HALF h_nvec18[] = { (HALF)0x5378efcb, (HALF)0xfec0c7c6, (HALF)0xf07cb724, (HALF)0xfb61b42a, (HALF)0x068f2a38 }; -static CONST HALF h_rvec18[] = { +STATIC CONST HALF h_rvec18[] = { (HALF)0x35ea3c63, (HALF)0x8df2ef97, (HALF)0xa2b3afb7, (HALF)0x179158f6, (HALF)0x04920dba, (HALF)0xf333077e, (HALF)0xf8304b5a, (HALF)0x230ff2ae, (HALF)0x84a8f3f0, (HALF)0xadda164e, (HALF)0xc9a1c944, (HALF)0xc70502f2, @@ -1452,7 +1452,7 @@ static CONST HALF h_rvec18[] = { (HALF)0x5358be89, (HALF)0x4cd835d7, (HALF)0xf0d5cda8, (HALF)0x1f1ac6c3, (HALF)0x04735e92 }; -static CONST HALF h_nvec19[] = { +STATIC CONST HALF h_nvec19[] = { (HALF)0x6b659a79, (HALF)0x0239c12d, (HALF)0xd204df49, (HALF)0x1d4ae0c7, (HALF)0x099bf000, (HALF)0x6435ade8, (HALF)0xdc4af029, (HALF)0x2f4ee7a2, (HALF)0xadfcf1e3, (HALF)0x73358f43, (HALF)0x687eede5, (HALF)0xb567cd4d, @@ -1471,7 +1471,7 @@ static CONST HALF h_nvec19[] = { (HALF)0x2e410ad4, (HALF)0x0721c315, (HALF)0xdde27654, (HALF)0x2ad6534b, (HALF)0xd6788b25, (HALF)0xb23bb9e8, (HALF)0x00230d7a }; -static CONST HALF h_rvec19[] = { +STATIC CONST HALF h_rvec19[] = { (HALF)0x698ef473, (HALF)0x3d53a5b7, (HALF)0x06448319, (HALF)0xd9ad4445, (HALF)0x6967daa0, (HALF)0xa14c6240, (HALF)0x78e77724, (HALF)0x63ef2ab7, (HALF)0x8dff2ee2, (HALF)0x662eb424, (HALF)0xcd9307d6, (HALF)0x0ab06a5d, @@ -1490,7 +1490,7 @@ static CONST HALF h_rvec19[] = { (HALF)0x6fa6fa75, (HALF)0xe21f6512, (HALF)0x999518b4, (HALF)0x2196605b, (HALF)0xe4fc1798, (HALF)0x5f21e245, (HALF)0x0008f172 }; -static CONST HALF h_nvec20[] = { +STATIC CONST HALF h_nvec20[] = { (HALF)0xc3c1d081, (HALF)0x4d262fce, (HALF)0x8765cc91, (HALF)0xf3727f7c, (HALF)0xabba4bbc, (HALF)0xe0985801, (HALF)0xfa365c51, (HALF)0xb2a4b230, (HALF)0xf4430a8d, (HALF)0x546b98c8, (HALF)0xd9748b26, (HALF)0xe255a82f, @@ -1509,7 +1509,7 @@ static CONST HALF h_nvec20[] = { (HALF)0x56d79660, (HALF)0x6066a3f3, (HALF)0x648b0327, (HALF)0x267e5b3a, (HALF)0xdddc63a0, (HALF)0x3322e890, (HALF)0x20e0d8b1, (HALF)0x004fd2b8 }; -static CONST HALF h_rvec20[] = { +STATIC CONST HALF h_rvec20[] = { (HALF)0xa048bd1a, (HALF)0x95abdc7b, (HALF)0x98f47cf8, (HALF)0x126ac98d, (HALF)0xaebf85fd, (HALF)0x5650580f, (HALF)0x3292d7dd, (HALF)0xf49e8377, (HALF)0x2947ed46, (HALF)0xd1a5b26c, (HALF)0xae14e6a1, (HALF)0x9b1f5788, @@ -1529,100 +1529,100 @@ static CONST HALF h_rvec20[] = { (HALF)0xee960da1, (HALF)0xa3099293, (HALF)0x84445fea, (HALF)0x0046ef01 }; #elif 2*FULL_BITS == 64 -static CONST HALF h_nvec01[] = { +STATIC CONST HALF h_nvec01[] = { (HALF)0x9361, (HALF)0x83de, (HALF)0x722d, (HALF)0xf0db, (HALF)0x28ca, (HALF)0x6fe3, (HALF)0x4073, (HALF)0x0494, (HALF)0x5 }; -static CONST HALF h_rvec01[] = { +STATIC CONST HALF h_rvec01[] = { (HALF)0x42ec, (HALF)0xa4cc, (HALF)0xbb01, (HALF)0x4e5d, (HALF)0x52e7, (HALF)0x11d9, (HALF)0x980f, (HALF)0xb226 }; -static CONST HALF h_nvec02[] = { +STATIC CONST HALF h_nvec02[] = { (HALF)0x43f1, (HALF)0x3534, (HALF)0x6ea9, (HALF)0xeb28, (HALF)0x4a18, (HALF)0xdd37, (HALF)0x2555, (HALF)0x348a, (HALF)0x2c5 }; -static CONST HALF h_rvec02[] = { +STATIC CONST HALF h_rvec02[] = { (HALF)0xa218, (HALF)0x21e3, (HALF)0x616b, (HALF)0xe893, (HALF)0x10e3, (HALF)0x6cd7, (HALF)0x4344, (HALF)0xf3d6, (HALF)0x40 }; -static CONST HALF h_nvec03[] = { +STATIC CONST HALF h_nvec03[] = { (HALF)0x01f1, (HALF)0x11d0, (HALF)0x661f, (HALF)0xf2ca, (HALF)0xf1e0, (HALF)0x3a81, (HALF)0xce4e, (HALF)0x59d6, (HALF)0xcfd9, (HALF)0x0009 }; -static CONST HALF h_rvec03[] = { +STATIC CONST HALF h_rvec03[] = { (HALF)0xd76a, (HALF)0xa0d7, (HALF)0x2de2, (HALF)0x3e14, (HALF)0xea4f, (HALF)0xff5c, (HALF)0x9b64, (HALF)0xb44d, (HALF)0xfae5 }; -static CONST HALF h_nvec04[] = { +STATIC CONST HALF h_nvec04[] = { (HALF)0x0751, (HALF)0xdfcc, (HALF)0xc680, (HALF)0x2dec, (HALF)0x2a1a, (HALF)0x5df1, (HALF)0x4ed7, (HALF)0x5c89, (HALF)0xf924, (HALF)0x3070 }; -static CONST HALF h_rvec04[] = { +STATIC CONST HALF h_rvec04[] = { (HALF)0x4570, (HALF)0x4b98, (HALF)0xddba, (HALF)0xa220, (HALF)0xaf8a, (HALF)0xa2c0, (HALF)0x2bdc, (HALF)0x131b, (HALF)0xc2d8, (HALF)0x0020 }; -static CONST HALF h_nvec05[] = { +STATIC CONST HALF h_nvec05[] = { (HALF)0x6ef1, (HALF)0x9916, (HALF)0xe5e7, (HALF)0x8b99, (HALF)0xa010, (HALF)0x8769, (HALF)0xe111, (HALF)0x5d3f, (HALF)0xc2fa, (HALF)0x680b, (HALF)0x5aac, (HALF)0x38f7, (HALF)0xa85b, (HALF)0xdb81, (HALF)0x1822, (HALF)0x109b, (HALF)0x2 }; -static CONST HALF h_rvec05[] = { +STATIC CONST HALF h_rvec05[] = { (HALF)0xefa9, (HALF)0x59e2, (HALF)0x77c8, (HALF)0x0e6c, (HALF)0xaeed, (HALF)0x1e70, (HALF)0x7b7d, (HALF)0x234f, (HALF)0xf6db, (HALF)0x5f5d, (HALF)0xa960, (HALF)0xe821, (HALF)0xb792, (HALF)0xae33, (HALF)0x890e, (HALF)0x5e9b }; -static CONST HALF h_nvec06[] = { +STATIC CONST HALF h_nvec06[] = { (HALF)0xf431, (HALF)0xe1dd, (HALF)0x57f1, (HALF)0xd855, (HALF)0x32da, (HALF)0x5ee7, (HALF)0xdb77, (HALF)0x3a38, (HALF)0x4026, (HALF)0x5c64, (HALF)0xf218, (HALF)0xf2db, (HALF)0x2c79, (HALF)0x9ada, (HALF)0x9d7d, (HALF)0x7bfd, (HALF)0xa }; -static CONST HALF h_rvec06[] = { +STATIC CONST HALF h_rvec06[] = { (HALF)0x4daf, (HALF)0xc940, (HALF)0x2e80, (HALF)0xc5dc, (HALF)0xeccf, (HALF)0x2c98, (HALF)0x495d, (HALF)0xe1f3, (HALF)0x925c, (HALF)0xce1c, (HALF)0xaede, (HALF)0xe097, (HALF)0x7154, (HALF)0x8866, (HALF)0xa02f, (HALF)0x5e94 }; -static CONST HALF h_nvec07[] = { +STATIC CONST HALF h_nvec07[] = { (HALF)0xc751, (HALF)0xcf9e, (HALF)0x9125, (HALF)0x602f, (HALF)0x2e7f, (HALF)0x5288, (HALF)0x53ce, (HALF)0x0dcf, (HALF)0x9d6b, (HALF)0xff56, (HALF)0x43fc, (HALF)0x6286, (HALF)0x1cd5, (HALF)0x3780, (HALF)0x9ef2, (HALF)0xf239, (HALF)0x7de8, (HALF)0x43d8 }; -static CONST HALF h_rvec07[] = { +STATIC CONST HALF h_rvec07[] = { (HALF)0x25e6, (HALF)0x098d, (HALF)0xd2e5, (HALF)0x3992, (HALF)0xb58c, (HALF)0x64f0, (HALF)0xd4dd, (HALF)0xcf18, (HALF)0x6aef, (HALF)0x9d87, (HALF)0xed04, (HALF)0x7acc, (HALF)0x9076, (HALF)0xbfbe, (HALF)0x14c7, (HALF)0x1ee0, (HALF)0x522d, (HALF)0x0013 }; -static CONST HALF h_nvec08[] = { +STATIC CONST HALF h_nvec08[] = { (HALF)0x2f11, (HALF)0x2674, (HALF)0xe66a, (HALF)0xbc42, (HALF)0xd9f0, (HALF)0xb59c, (HALF)0xa6c2, (HALF)0x9ad4, (HALF)0xd2f9, (HALF)0x5bdb, (HALF)0x1fed, (HALF)0xbdc9, (HALF)0x9ce7, (HALF)0xf13c, (HALF)0x99b7, (HALF)0xeb46, (HALF)0x6ca7, (HALF)0x4712, (HALF)0x58 }; -static CONST HALF h_rvec08[] = { +STATIC CONST HALF h_rvec08[] = { (HALF)0xc674, (HALF)0x489d, (HALF)0x5f3a, (HALF)0xaae9, (HALF)0xa929, (HALF)0xa35d, (HALF)0xb4b8, (HALF)0x5597, (HALF)0xc947, (HALF)0x28e9, (HALF)0x4f9a, (HALF)0x3d34, (HALF)0x61fa, (HALF)0xb7e6, (HALF)0x9116, (HALF)0xa326, (HALF)0x16dc, (HALF)0x8530 }; -static CONST HALF h_nvec09[] = { +STATIC CONST HALF h_nvec09[] = { (HALF)0xe3d1, (HALF)0xab27, (HALF)0x5db4, (HALF)0x1274, (HALF)0xf951, (HALF)0xb980, (HALF)0x6b66, (HALF)0x62b1, (HALF)0xce0d, (HALF)0x0fde, (HALF)0xc6fd, (HALF)0x6061, @@ -1633,7 +1633,7 @@ static CONST HALF h_nvec09[] = { (HALF)0x9238, (HALF)0x218d, (HALF)0x2fd3, (HALF)0x5232, (HALF)0xe8be, (HALF)0x0039 }; -static CONST HALF h_rvec09[] = { +STATIC CONST HALF h_rvec09[] = { (HALF)0xd20d, (HALF)0x7d4e, (HALF)0xf2b8, (HALF)0x601e, (HALF)0xf959, (HALF)0x8e59, (HALF)0x5d9e, (HALF)0xedaa, (HALF)0x89ba, (HALF)0x309a, (HALF)0x7d81, (HALF)0xe5ab, @@ -1644,7 +1644,7 @@ static CONST HALF h_rvec09[] = { (HALF)0x15bf, (HALF)0xbab9, (HALF)0x1e6b, (HALF)0xf8ad, (HALF)0xb458 }; -static CONST HALF h_nvec10[] = { +STATIC CONST HALF h_nvec10[] = { (HALF)0x4b89, (HALF)0xb7e6, (HALF)0xc363, (HALF)0xc3cd, (HALF)0xc73c, (HALF)0x2ef9, (HALF)0xce22, (HALF)0x6092, (HALF)0xe36c, (HALF)0x02ab, (HALF)0x9573, (HALF)0x08d4, @@ -1655,7 +1655,7 @@ static CONST HALF h_nvec10[] = { (HALF)0xf596, (HALF)0xc23e, (HALF)0x5666, (HALF)0xc905, (HALF)0x2435, (HALF)0x025f }; -static CONST HALF h_rvec10[] = { +STATIC CONST HALF h_rvec10[] = { (HALF)0xc482, (HALF)0x94cf, (HALF)0x5ad4, (HALF)0x594f, (HALF)0x2aee, (HALF)0x2344, (HALF)0x40ce, (HALF)0x145f, (HALF)0x950d, (HALF)0x1baf, (HALF)0xf175, (HALF)0xadc4, @@ -1666,7 +1666,7 @@ static CONST HALF h_rvec10[] = { (HALF)0x1468, (HALF)0x1840, (HALF)0x0e0c, (HALF)0x47b2, (HALF)0xbb7e, (HALF)0x0066 }; -static CONST HALF h_nvec11[] = { +STATIC CONST HALF h_nvec11[] = { (HALF)0xe069, (HALF)0x546e, (HALF)0x530c, (HALF)0x2e1a, (HALF)0xdab2, (HALF)0x2014, (HALF)0xcf52, (HALF)0xa729, (HALF)0xe1a9, (HALF)0x920e, (HALF)0x7533, (HALF)0x68f2, @@ -1677,7 +1677,7 @@ static CONST HALF h_nvec11[] = { (HALF)0xd56b, (HALF)0x4217, (HALF)0xb309, (HALF)0x82bd, (HALF)0x64de, (HALF)0x4978 }; -static CONST HALF h_rvec11[] = { +STATIC CONST HALF h_rvec11[] = { (HALF)0x8b04, (HALF)0x56e3, (HALF)0xded3, (HALF)0x3a0a, (HALF)0x88b1, (HALF)0x461d, (HALF)0x4d65, (HALF)0x9c09, (HALF)0x3fed, (HALF)0xe533, (HALF)0x18fe, (HALF)0x34d9, @@ -1688,7 +1688,7 @@ static CONST HALF h_rvec11[] = { (HALF)0x4465, (HALF)0x264a, (HALF)0xe630, (HALF)0x1cb5, (HALF)0x8488, (HALF)0x0086 }; -static CONST HALF h_nvec12[] = { +STATIC CONST HALF h_nvec12[] = { (HALF)0x7b99, (HALF)0xf14c, (HALF)0xd151, (HALF)0x7f66, (HALF)0xad2b, (HALF)0x87ef, (HALF)0xf098, (HALF)0x57d3, (HALF)0x4165, (HALF)0xd653, (HALF)0xdd25, (HALF)0x812f, @@ -1699,7 +1699,7 @@ static CONST HALF h_nvec12[] = { (HALF)0x9116, (HALF)0x08b8, (HALF)0xb15f, (HALF)0xc0cc, (HALF)0x2ab3, (HALF)0x5758, (HALF)0x34 }; -static CONST HALF h_rvec12[] = { +STATIC CONST HALF h_rvec12[] = { (HALF)0xb4a0, (HALF)0xe207, (HALF)0xdd68, (HALF)0x5227, (HALF)0xfbc4, (HALF)0x9488, (HALF)0x81aa, (HALF)0x6ed0, (HALF)0x6fe5, (HALF)0x8e73, (HALF)0xc020, (HALF)0x3dd2, @@ -1710,7 +1710,7 @@ static CONST HALF h_rvec12[] = { (HALF)0xbabd, (HALF)0x5870, (HALF)0xed93, (HALF)0xf648, (HALF)0x9bd1, (HALF)0xdf71 }; -static CONST HALF h_nvec13[] = { +STATIC CONST HALF h_nvec13[] = { (HALF)0xfc49, (HALF)0x3314, (HALF)0x0032, (HALF)0xcca2, (HALF)0x3420, (HALF)0x208e, (HALF)0x503a, (HALF)0x8aaa, (HALF)0x63cc, (HALF)0xd79a, (HALF)0x7417, (HALF)0xb4ed, @@ -1729,7 +1729,7 @@ static CONST HALF h_nvec13[] = { (HALF)0xf734, (HALF)0x1b5a, (HALF)0x7dd2, (HALF)0x166b, (HALF)0x7c19, (HALF)0x0151 }; -static CONST HALF h_rvec13[] = { +STATIC CONST HALF h_rvec13[] = { (HALF)0x36f5, (HALF)0x6b77, (HALF)0xbfe4, (HALF)0x2407, (HALF)0x2072, (HALF)0x965e, (HALF)0xcf3e, (HALF)0xcc26, (HALF)0xb567, (HALF)0xa432, (HALF)0x07ab, (HALF)0x2ed0, @@ -1748,7 +1748,7 @@ static CONST HALF h_rvec13[] = { (HALF)0xfa64, (HALF)0x1263, (HALF)0x560d, (HALF)0x8e9a, (HALF)0xd42e }; -static CONST HALF h_nvec14[] = { +STATIC CONST HALF h_nvec14[] = { (HALF)0xaf01, (HALF)0xc116, (HALF)0x8c0f, (HALF)0xbdef, (HALF)0x9a1a, (HALF)0xc440, (HALF)0x185c, (HALF)0xacb3, (HALF)0x925b, (HALF)0xb33f, (HALF)0x3005, (HALF)0xfee8, @@ -1767,7 +1767,7 @@ static CONST HALF h_nvec14[] = { (HALF)0xac07, (HALF)0x7479, (HALF)0xf4e8, (HALF)0x93c6, (HALF)0xa00e, (HALF)0x5e56 }; -static CONST HALF h_rvec14[] = { +STATIC CONST HALF h_rvec14[] = { (HALF)0xf190, (HALF)0x0ff9, (HALF)0xdb68, (HALF)0x47a4, (HALF)0xc8ea, (HALF)0x913c, (HALF)0xb220, (HALF)0xb6b1, (HALF)0xfbbb, (HALF)0x13ed, (HALF)0xf1c3, (HALF)0xa8f1, @@ -1786,7 +1786,7 @@ static CONST HALF h_rvec14[] = { (HALF)0xc5d0, (HALF)0x6ef0, (HALF)0x3509, (HALF)0xb673, (HALF)0xaa7c, (HALF)0x00f7 }; -static CONST HALF h_nvec15[] = { +STATIC CONST HALF h_nvec15[] = { (HALF)0x7079, (HALF)0xc8d9, (HALF)0x7597, (HALF)0x061e, (HALF)0xc721, (HALF)0xf5d2, (HALF)0xc51f, (HALF)0x299b, (HALF)0xc337, (HALF)0xffe6, (HALF)0x8624, (HALF)0x1979, @@ -1805,7 +1805,7 @@ static CONST HALF h_nvec15[] = { (HALF)0x6c17, (HALF)0x02c4, (HALF)0xbcdb, (HALF)0x9edf, (HALF)0x840b, (HALF)0x97dd }; -static CONST HALF h_rvec15[] = { +STATIC CONST HALF h_rvec15[] = { (HALF)0x2110, (HALF)0x6c3e, (HALF)0x0aaa, (HALF)0x808f, (HALF)0xb92e, (HALF)0xd98d, (HALF)0xbd43, (HALF)0x1e6a, (HALF)0xb920, (HALF)0xf401, (HALF)0x0381, (HALF)0x9d3f, @@ -1824,7 +1824,7 @@ static CONST HALF h_rvec15[] = { (HALF)0x99f9, (HALF)0x69ab, (HALF)0xc758, (HALF)0x03b8, (HALF)0x2207, (HALF)0x00b8 }; -static CONST HALF h_nvec16[] = { +STATIC CONST HALF h_nvec16[] = { (HALF)0x46e1, (HALF)0xd843, (HALF)0x83f6, (HALF)0x1841, (HALF)0xbd36, (HALF)0x2dc9, (HALF)0x57ac, (HALF)0x4ca8, (HALF)0x828d, (HALF)0x96a5, (HALF)0x1c59, (HALF)0xed1f, @@ -1843,7 +1843,7 @@ static CONST HALF h_nvec16[] = { (HALF)0x84c3, (HALF)0xb56f, (HALF)0xbb12, (HALF)0xb82f, (HALF)0x8549, (HALF)0x6e34, (HALF)0x45 }; -static CONST HALF h_rvec16[] = { +STATIC CONST HALF h_rvec16[] = { (HALF)0x8830, (HALF)0x7b4e, (HALF)0x5db8, (HALF)0x7060, (HALF)0xe4a5, (HALF)0xa1ab, (HALF)0xbe04, (HALF)0xa70f, (HALF)0xa8f4, (HALF)0x2bcd, (HALF)0xda9a, (HALF)0xd29a, @@ -1862,7 +1862,7 @@ static CONST HALF h_rvec16[] = { (HALF)0x921a, (HALF)0x973e, (HALF)0x7a07, (HALF)0x9fb2, (HALF)0xdcb1, (HALF)0xb0d7 }; -static CONST HALF h_nvec17[] = { +STATIC CONST HALF h_nvec17[] = { (HALF)0x2051, (HALF)0x72b7, (HALF)0x4ebf, (HALF)0xedc2, (HALF)0xa8d1, (HALF)0xe970, (HALF)0xb150, (HALF)0x66c9, (HALF)0x27f7, (HALF)0xcbb9, (HALF)0xffd9, (HALF)0xb574, @@ -1897,7 +1897,7 @@ static CONST HALF h_nvec17[] = { (HALF)0x040b, (HALF)0xffa3, (HALF)0xeac0, (HALF)0x813a, (HALF)0x6177 }; -static CONST HALF h_rvec17[] = { +STATIC CONST HALF h_rvec17[] = { (HALF)0x1dac, (HALF)0x22b4, (HALF)0x8005, (HALF)0xd625, (HALF)0xe0cb, (HALF)0x2aa1, (HALF)0x47b5, (HALF)0x45d1, (HALF)0x46d9, (HALF)0xbf5c, (HALF)0xdadf, (HALF)0x14c9, @@ -1932,7 +1932,7 @@ static CONST HALF h_rvec17[] = { (HALF)0xadf1, (HALF)0xc3b8, (HALF)0xaf3b, (HALF)0x0b6e, (HALF)0x5372 }; -static CONST HALF h_nvec18[] = { +STATIC CONST HALF h_nvec18[] = { (HALF)0x8629, (HALF)0xc8b7, (HALF)0x1b18, (HALF)0x4135, (HALF)0x4ed8, (HALF)0x28ad, (HALF)0x7df1, (HALF)0xc96f, (HALF)0xc931, (HALF)0x7cd3, (HALF)0x036a, (HALF)0x0f23, @@ -1967,7 +1967,7 @@ static CONST HALF h_nvec18[] = { (HALF)0xb724, (HALF)0xf07c, (HALF)0xb42a, (HALF)0xfb61, (HALF)0x2a38, (HALF)0x068f }; -static CONST HALF h_rvec18[] = { +STATIC CONST HALF h_rvec18[] = { (HALF)0x3c63, (HALF)0x35ea, (HALF)0xef97, (HALF)0x8df2, (HALF)0xafb7, (HALF)0xa2b3, (HALF)0x58f6, (HALF)0x1791, (HALF)0x0dba, (HALF)0x0492, (HALF)0x077e, (HALF)0xf333, @@ -2002,7 +2002,7 @@ static CONST HALF h_rvec18[] = { (HALF)0xcda8, (HALF)0xf0d5, (HALF)0xc6c3, (HALF)0x1f1a, (HALF)0x5e92, (HALF)0x0473 }; -static CONST HALF h_nvec19[] = { +STATIC CONST HALF h_nvec19[] = { (HALF)0x9a79, (HALF)0x6b65, (HALF)0xc12d, (HALF)0x0239, (HALF)0xdf49, (HALF)0xd204, (HALF)0xe0c7, (HALF)0x1d4a, (HALF)0xf000, (HALF)0x099b, (HALF)0xade8, (HALF)0x6435, @@ -2038,7 +2038,7 @@ static CONST HALF h_nvec19[] = { (HALF)0x8b25, (HALF)0xd678, (HALF)0xb9e8, (HALF)0xb23b, (HALF)0x0d7a, (HALF)0x0023 }; -static CONST HALF h_rvec19[] = { +STATIC CONST HALF h_rvec19[] = { (HALF)0xf473, (HALF)0x698e, (HALF)0xa5b7, (HALF)0x3d53, (HALF)0x8319, (HALF)0x0644, (HALF)0x4445, (HALF)0xd9ad, (HALF)0xdaa0, (HALF)0x6967, (HALF)0x6240, (HALF)0xa14c, @@ -2073,7 +2073,7 @@ static CONST HALF h_rvec19[] = { (HALF)0x18b4, (HALF)0x9995, (HALF)0x605b, (HALF)0x2196, (HALF)0x1798, (HALF)0xe4fc, (HALF)0xe245, (HALF)0x5f21, (HALF)0xf172, (HALF)0x0008 }; -static CONST HALF h_nvec20[] = { +STATIC CONST HALF h_nvec20[] = { (HALF)0xd081, (HALF)0xc3c1, (HALF)0x2fce, (HALF)0x4d26, (HALF)0xcc91, (HALF)0x8765, (HALF)0x7f7c, (HALF)0xf372, (HALF)0x4bbc, (HALF)0xabba, (HALF)0x5801, (HALF)0xe098, @@ -2109,7 +2109,7 @@ static CONST HALF h_nvec20[] = { (HALF)0x63a0, (HALF)0xdddc, (HALF)0xe890, (HALF)0x3322, (HALF)0xd8b1, (HALF)0x20e0, (HALF)0xd2b8, (HALF)0x004f }; -static CONST HALF h_rvec20[] = { +STATIC CONST HALF h_rvec20[] = { (HALF)0xbd1a, (HALF)0xa048, (HALF)0xdc7b, (HALF)0x95ab, (HALF)0x7cf8, (HALF)0x98f4, (HALF)0xc98d, (HALF)0x126a, (HALF)0x85fd, (HALF)0xaebf, (HALF)0x580f, (HALF)0x5650, @@ -2151,7 +2151,7 @@ static CONST HALF h_rvec20[] = { /* * NOTE: set n is found in random_pregen[n-1] */ -static RANDOM random_pregen[BLUM_PREGEN] = { +STATIC RANDOM random_pregen[BLUM_PREGEN] = { {1, 0, 7, (HALF)0, (HALF)0x07f, {(HALF *)h_nvec01, sizeof(h_nvec01)/sizeof(HALF), 0}, {(HALF *)h_rvec01, sizeof(h_rvec01)/sizeof(HALF), 0}}, @@ -2218,7 +2218,7 @@ static RANDOM random_pregen[BLUM_PREGEN] = { /* * forward static declarations */ -static void zfree_random(ZVALUE z); +S_FUNC void zfree_random(ZVALUE z); /* @@ -3171,7 +3171,7 @@ random_libcalc_cleanup(void) * given: * z the ZVALUE to zfree(z) if not pointing to static data */ -static void +S_FUNC void zfree_random(ZVALUE z) { if (z.v != NULL && diff --git a/zrandom.h b/zrandom.h index 40bf62a..a6f69b9 100644 --- a/zrandom.h +++ b/zrandom.h @@ -1,7 +1,7 @@ /* * zrandom - Blum-Blum-Shub pseudo-random generator * - * Copyright (C) 1999 Landon Curt Noll + * Copyright (C) 1999-2007 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 @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.4 $ - * @(#) $Id: zrandom.h,v 29.4 2001/06/08 21:00:58 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: zrandom.h,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.h,v $ * * Under source code control: 1997/02/15 04:01:56 @@ -74,21 +74,21 @@ struct random { /* * Blum generator function declarations */ -extern RANDOM *zsrandom1(CONST ZVALUE seed, BOOL need_ret); -extern RANDOM *zsrandom2(CONST ZVALUE seed, CONST ZVALUE newn); -extern RANDOM *zsrandom4(CONST ZVALUE seed, +E_FUNC RANDOM *zsrandom1(CONST ZVALUE seed, BOOL need_ret); +E_FUNC RANDOM *zsrandom2(CONST ZVALUE seed, CONST ZVALUE newn); +E_FUNC RANDOM *zsrandom4(CONST ZVALUE seed, CONST ZVALUE ip, CONST ZVALUE iq, long trials); -extern RANDOM *zsetrandom(CONST RANDOM *state); -extern void zrandomskip(long count); -extern void zrandom(long count, ZVALUE *res); -extern void zrandom(long count, ZVALUE *res); -extern void zrandomrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res); -extern long irandom(long s); -extern RANDOM *randomcopy(CONST RANDOM *random); -extern void randomfree(RANDOM *random); -extern BOOL randomcmp(CONST RANDOM *s1, CONST RANDOM *s2); -extern void randomprint(CONST RANDOM *state, int flags); -extern void random_libcalc_cleanup(void); +E_FUNC RANDOM *zsetrandom(CONST RANDOM *state); +E_FUNC void zrandomskip(long count); +E_FUNC void zrandom(long count, ZVALUE *res); +E_FUNC void zrandom(long count, ZVALUE *res); +E_FUNC void zrandomrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res); +E_FUNC long irandom(long s); +E_FUNC RANDOM *randomcopy(CONST RANDOM *random); +E_FUNC void randomfree(RANDOM *random); +E_FUNC BOOL randomcmp(CONST RANDOM *s1, CONST RANDOM *s2); +E_FUNC void randomprint(CONST RANDOM *state, int flags); +E_FUNC void random_libcalc_cleanup(void); #endif /* !__ZRANDOM_H__ */