diff --git a/AddinInfo.txt b/AddinInfo.txt deleted file mode 100644 index 4f58a58..0000000 --- a/AddinInfo.txt +++ /dev/null @@ -1,12 +0,0 @@ -//------------------------------------------------------------------ -// Addin-Application header control file, created with the CASIO SDK -//------------------------------------------------------------------ -[OUTPUT] : "ALGEBRA.G1A" -[BINDATA] : "FXADDINror.bin" -[DISPNAME] : "Algebra" -[APPNAME] : "@ALGEBRA" -[VERSION] : "02.14.0710" -[APL_ICON] : "MainIcon.bmp" -[MODULE_NUM] : 1 -[MOD1_TITLE] : "CAS" -[MOD1_ICON] : "eActivityIcon.bmp" diff --git a/Eigen.g1w b/Eigen.g1w deleted file mode 100644 index 682f79f..0000000 --- a/Eigen.g1w +++ /dev/null @@ -1,176 +0,0 @@ -[DLSimProject] -Name=Algebra -Version=02.14.0710 -Model=:fx-9860G.dlm -MemoryPath=INIT -MemCardPath=SDCard - -[Program1] -Program=Algebra.G1A -Debug=Debug\FXADDINror.dbg -LoadAddress=80000000:90100000 - -[Files] -SourceFile=:abs.cpp -SourceFile=:add.cpp -SourceFile=:adj.cpp -SourceFile=:alloc.cpp -SourceFile=:append.cpp -SourceFile=:arccos.cpp -SourceFile=:arccosh.cpp -SourceFile=:arcsin.cpp -SourceFile=:arcsinh.cpp -SourceFile=:arctan.cpp -SourceFile=:arctanh.cpp -SourceFile=:arg.cpp -SourceFile=:atomize.cpp -SourceFile=:bake.cpp -SourceFile=:bignum.cpp -SourceFile=:binomial.cpp -SourceFile=:ceiling.cpp -SourceFile=:choose.cpp -SourceFile=:circexp.cpp -SourceFile=:clear.cpp -SourceFile=:clock.cpp -SourceFile=:cofactor.cpp -SourceFile=:condense.cpp -SourceFile=:conj.cpp -SourceFile=:cons.cpp -SourceFile=:contract.cpp -SourceFile=:cos.cpp -SourceFile=:cosh.cpp -SourceFile=:data.cpp -SourceFile=:decomp.cpp -SourceFile=:define.cpp -SourceFile=:defint.cpp -SourceFile=:degree.cpp -SourceFile=:denominator.cpp -SourceFile=:derivative.cpp -SourceFile=:det.cpp -SourceFile=:dirac.cpp -SourceFile=:distill.cpp -SourceFile=:divisors.cpp -SourceFile=:dpow.cpp -SourceFile=:dsolve.cpp -SourceFile=:eigen.cpp -SourceFile=:erf.cpp -SourceFile=:erfc.cpp -SourceFile=:eval.cpp -SourceFile=:expand.cpp -SourceFile=:expcos.cpp -SourceFile=:expsin.cpp -SourceFile=:factor.cpp -SourceFile=:factorial.cpp -SourceFile=:factorpoly.cpp -SourceFile=:factors.cpp -SourceFile=:filter.cpp -SourceFile=:find.cpp -SourceFile=:float.cpp -SourceFile=:floor.cpp -SourceFile=:for.cpp -SourceFile=:gamma.cpp -SourceFile=:gcd.cpp -SourceFile=:guess.cpp -SourceFile=:hermite.cpp -SourceFile=:hilbert.cpp -SourceFile=:imag.cpp -SourceFile=:index.cpp -SourceFile=:init.cpp -SourceFile=:inner.cpp -SourceFile=:integral.cpp -SourceFile=:inv.cpp -SourceFile=:is.cpp -SourceFile=:isprime.cpp -SourceFile=:itab.cpp -SourceFile=:itest.cpp -SourceFile=:laguerre.cpp -SourceFile=:laplace.cpp -SourceFile=:lcm.cpp -SourceFile=:leading.cpp -SourceFile=:legendre.cpp -SourceFile=:list.cpp -SourceFile=:log.cpp -SourceFile=:madd.cpp -SourceFile=:mag.cpp -SourceFile=:mcmp.cpp -SourceFile=:mfactor.cpp -SourceFile=:mgcd.cpp -SourceFile=:misc.cpp -SourceFile=:mmodpow.cpp -SourceFile=:mmul.cpp -SourceFile=:mod.cpp -SourceFile=:mpow.cpp -SourceFile=:mprime.cpp -SourceFile=:mroot.cpp -SourceFile=:mscan.cpp -SourceFile=:msqrt.cpp -SourceFile=:mstr.cpp -SourceFile=:multiply.cpp -SourceFile=:nroots.cpp -SourceFile=:numerator.cpp -SourceFile=:outer.cpp -SourceFile=:partition.cpp -SourceFile=:polar.cpp -SourceFile=:pollard.cpp -SourceFile=:power.cpp -SourceFile=:prime.cpp -SourceFile=:primetab.cpp -SourceFile=:product.cpp -SourceFile=:qadd.cpp -SourceFile=:qdiv.cpp -SourceFile=:qmul.cpp -SourceFile=:qpow.cpp -SourceFile=:qsub.cpp -SourceFile=:quickfactor.cpp -SourceFile=:quotient.cpp -SourceFile=:rationalize.cpp -SourceFile=:real.cpp -SourceFile=:rect.cpp -SourceFile=:rewrite.cpp -SourceFile=:roots.cpp -SourceFile=:run.cpp -SourceFile=:scan.cpp -SourceFile=:sgn.cpp -SourceFile=:simfac.cpp -SourceFile=:simplify.cpp -SourceFile=:sin.cpp -SourceFile=:sinh.cpp -SourceFile=:stack.cpp -SourceFile=:subst.cpp -SourceFile=:sum.cpp -SourceFile=:symbol.cpp -SourceFile=:tan.cpp -SourceFile=:tanh.cpp -SourceFile=:Taumath.cpp -SourceFile=:taylor.cpp -SourceFile=:tensor.cpp -SourceFile=:transform.cpp -SourceFile=:transpose.cpp -SourceFile=:userfunc.cpp -SourceFile=:variables.cpp -SourceFile=:vectorize.cpp -SourceFile=:zero.cpp -SourceFile=:display.cpp -SourceFile=:main.cpp -SourceFile=:test.cpp -SourceFile=:console.c -SourceFile=:syscalls_.src -SourceFile=:memory.c -SourceFile=:tex\debug.c -SourceFile=:tex\disp.src -SourceFile=:tex\libText.c -SourceFile=:tex\math.c -SourceFile=:print.cpp -SourceFile=:config.c -SourceFile=:coeff.cpp -HeaderFile=:defs.h -HeaderFile=:prototypes.h -HeaderFile=:setjmp.h -HeaderFile=:stdafx.h -HeaderFile=:console.h -HeaderFile=:syscalls.h -HeaderFile=:memory.h -HeaderFile=:tex\TeX.h -HeaderFile=:tex\debug.h -HeaderFile=:tex\libText.h -HeaderFile=:config.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..441754b --- /dev/null +++ b/Makefile @@ -0,0 +1,143 @@ +prefix = sh3eb-elf- +as = $(prefix)as +cc = $(prefix)gcc +cxx = $(prefix)g++ +objcopy = $(prefix)objcopy +wrapper = g1a-wrapper + +flags = -m3 -mb -Os -nostdlib +cflags = -std=c11 -W -Wall -Wno-main -pedantic +cxxflags= -std=c++11 -W -Wall -Wno-main -pedantic +include = -Iinclude/fx -Iinclude +libs = -Llib -lfx -lgcc +name = eigenmath +target-g1a = $(name).g1a + +# Various files +# besselj and bessely good bye +file-src = $(addprefix src/, \ + main.cpp \ + engine/abs.cpp engine/add.cpp engine/adj.cpp \ + engine/alloc.cpp \ + engine/arccos.cpp engine/arccosh.cpp \ + engine/arcsin.cpp engine/arcsinh.cpp \ + engine/arctan.cpp engine/arctanh.cpp \ + engine/arg.cpp engine/atomize.cpp \ + engine/bake.cpp \ + engine/bignum.cpp \ + engine/binomial.cpp engine/ceiling.cpp \ + engine/choose.cpp engine/circexp.cpp \ + engine/clear.cpp engine/clock.cpp \ + engine/coeff.cpp engine/cofactor.cpp \ + engine/condense.cpp engine/conj.cpp \ + engine/cons.cpp engine/contract.cpp \ + engine/cos.cpp engine/cosh.cpp \ + engine/data.cpp engine/decomp.cpp \ + engine/define.cpp engine/defint.cpp \ + engine/degree.cpp engine/denominator.cpp \ + engine/denominator.cpp engine/derivative.cpp \ + engine/det.cpp engine/dirac.cpp \ + engine/display.cpp engine/distill.cpp \ + engine/divisors.cpp engine/dpow.cpp \ + engine/dsolve.cpp engine/eigen.cpp \ + engine/erf.cpp engine/erfc.cpp \ + engine/eval.cpp engine/expand.cpp \ + engine/expcos.cpp engine/expsin.cpp \ + engine/factor.cpp engine/factorial.cpp \ + engine/factorpoly.cpp engine/factors.cpp \ + engine/factors.cpp engine/filter.cpp \ + engine/find.cpp engine/float.cpp \ + engine/floor.cpp engine/for.cpp \ + engine/gamma.cpp engine/gcd.cpp \ + engine/guess.cpp engine/hermite.cpp \ + engine/hilbert.cpp engine/history.cpp \ + engine/imag.cpp engine/index.cpp \ + engine/index.cpp engine/init.cpp \ + engine/inner.cpp engine/integral.cpp \ + engine/inv.cpp engine/is.cpp \ + engine/isprime.cpp engine/itab.cpp \ + engine/itest.cpp engine/laguerre.cpp \ + engine/laplace.cpp engine/lcm.cpp \ + engine/leading.cpp engine/legendre.cpp \ + engine/list.cpp engine/log.cpp \ + engine/madd.cpp engine/mag.cpp \ + engine/main_engine.cpp engine/mcmp.cpp \ + engine/mfactor.cpp engine/mgcd.cpp \ + engine/misc.cpp engine/mmodpow.cpp \ + engine/mmul.cpp engine/mod.cpp \ + engine/mprime.cpp engine/mroot.cpp \ + engine/mscan.cpp engine/msqrt.cpp \ + engine/mstr.cpp engine/multiply.cpp \ + engine/nroots.cpp engine/numerator.cpp \ + engine/outer.cpp engine/partition.cpp \ + engine/polar.cpp engine/pollard.cpp \ + engine/power.cpp engine/prime.cpp \ + engine/primetab.cpp engine/print.cpp \ + engine/product.cpp engine/qadd.cpp \ + engine/qdiv.cpp engine/qmul.cpp \ + engine/qpow.cpp engine/qsub.cpp \ + engine/quickfactor.cpp engine/quotient.cpp \ + engine/rationalize.cpp engine/real.cpp \ + engine/rect.cpp engine/rewrite.cpp \ + engine/roots.cpp engine/run.cpp \ + engine/scan.cpp engine/sgn.cpp \ + engine/simfac.cpp engine/simplify.cpp \ + engine/sin.cpp engine/sinh.cpp \ + engine/stack.cpp engine/subst.cpp \ + engine/sum.cpp engine/symbol.cpp \ + engine/tan.cpp engine/tanh.cpp \ + engine/taylor.cpp engine/tensor.cpp \ + engine/test.cpp engine/transform.cpp \ + engine/transpose.cpp engine/userfunc.cpp \ + engine/variables.cpp engine/vectorize.cpp \ + engine/zero.cpp ) +file-obj = $(patsubst src/%,build/%.o,$(file-src) $(file-res)) +file-ld = addin.ld +file-icon = icon.bmp +#--- +# Building. +#--- + +# Generic rules + +all: build $(target-g1a) + @echo "[ \033[32;1mOK\033[0m ] All done!" + +build: + mkdir -p $@ + +$(target-g1a): $(file-obj) + $(cc) -o build/$(name).elf $(cflags) -T $(file-ld) $^ $(libs) + $(ob) -R .comment -R .bss -O binary build/$(name).elf build/$(name).bin + g1a-wrapper build/$(name).bin -o $@ $(wrap) + @echo "[ \033[32;1mOK\033[0m ] demo app: `stat -c %s $@` bytes" + +build/%.c.o: src/%.c $(file-dep) + $(cc) -c $< -o $@ $(cflags) $(include) + +build/%.cpp.o: src/%.cpp $(file-dep) + $(cxx) -c $< -o $@ $(cxxflags) $(include) + +build/font_%.bmp.o: res/font_%.bmp + fxconv $< -o $@ --font -n $(<:res/%.bmp=res_%) + +build/map_%.bmp.o: res/map_%.bmp + fxconv $< -o $@ --map -n $(<:res/%.bmp=res_%) $(map-options) + +build/%.bmp.o: res/%.bmp + fxconv $< -o $@ -n $(<:res/%.bmp=res_%) + + + +#--- +# Cleaning and others. +#--- + +clean: + @ rm -rf build/* + +mrproper: clean + @ rm -f $(target-g1a) + @ rm -rf build + +distclean: mrproper diff --git a/Taumath.cpp.bak b/Taumath.cpp.bak deleted file mode 100644 index c58e161..0000000 --- a/Taumath.cpp.bak +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include - -#include "defs.h" -extern "C"{ -#include "console.h" -#include "fxlib.h" -#define EXPR_BUF_SIZE 256 - -extern U ** mem; -extern unsigned int **free_stack; - -int -initialize_tuamath() -{ - // modified by anderain - free_stack = (unsigned int**) calloc(500,sizeof(unsigned int*)); - mem = (U**) calloc(100,sizeof(U*)); - stack = (U**) calloc(TOS,sizeof(U*)); - symtab = (U*) calloc(NSYM,sizeof(U)); - binding = (U**) calloc(NSYM,sizeof(U*)); - arglist = (U**) calloc(NSYM,sizeof(U*)); - logbuf = (char*) calloc(256,1); -} - -const unsigned char *Setup[]={ - "logab(a,b)=log(b)/log(a)", - "log10(x)=log(x)/log(10)", - "ln(x)=log(x)", - "cis(x)=cos(x)+i*sin(x)", - "cot(x)=1/tan(x)", - "coth(x)=cosh(x)/sinh(x)", - "arccot(x)=arctan(1/x)", - "arccoth(x)=arctanh(1/x)", - "sec(x)=1/cos(x)", - "sech(x)=1/cosh(x)", - "arcsec(x)=arccos(1/x)", - "arcsech(x)=arccosh(1/x)", - "csc(x)=1/sin(x)", - "csch(x)=1/sinh(x)", - "arccsc(x)=arcsin(1/x)", - "arccsch(x)=arcsinh(1/x)", - "npr(n,r)=(n!)/(n-r)!", - "ncr(n,r)=n!/(r!(n-r)!)", - "xor(x,y)=or(and(x,not(y)),and(not(x),y))", - NULL, -} - -int AddIn_main(int isAppli, unsigned short OptionNum) -{ - unsigned int key; - unsigned char *expr; - - initialize_tuamath(); - // initialize failed ? - if (!(free_stack && mem && stack && symtab && binding && arglist && logbuf)) - return 0; - - int i = 0; - while(Setup[i] != NULL) - { - run((char *)Setup[i++]); - } - - Console_Init(); - Console_Disp(); - while(1) - { - if((expr=Console_GetLine())==NULL) stop("memory error"); - run((char *)expr); - Console_NewLine(LINE_TYPE_OUTPUT,1); - Console_Disp(); - } - - - for(;;)GetKey(&key); - return 1; -} - -#pragma section _BR_Size -unsigned long BR_Size; -#pragma section - -#pragma section _TOP -int InitializeSystem(int isAppli, unsigned short OptionNum) -{ - return INIT_ADDIN_APPLICATION(isAppli, OptionNum); -} -#pragma section - -} \ No newline at end of file diff --git a/build/engine/abs.cpp.o b/build/engine/abs.cpp.o new file mode 100644 index 0000000..4506fd7 Binary files /dev/null and b/build/engine/abs.cpp.o differ diff --git a/build/engine/add.cpp.o b/build/engine/add.cpp.o new file mode 100644 index 0000000..bc33cb3 Binary files /dev/null and b/build/engine/add.cpp.o differ diff --git a/build/engine/adj.cpp.o b/build/engine/adj.cpp.o new file mode 100644 index 0000000..2bf725e Binary files /dev/null and b/build/engine/adj.cpp.o differ diff --git a/build/engine/alloc.cpp.o b/build/engine/alloc.cpp.o new file mode 100644 index 0000000..d27470b Binary files /dev/null and b/build/engine/alloc.cpp.o differ diff --git a/build/engine/arccos.cpp.o b/build/engine/arccos.cpp.o new file mode 100644 index 0000000..bbb8cb3 Binary files /dev/null and b/build/engine/arccos.cpp.o differ diff --git a/build/engine/arccosh.cpp.o b/build/engine/arccosh.cpp.o new file mode 100644 index 0000000..cc981b8 Binary files /dev/null and b/build/engine/arccosh.cpp.o differ diff --git a/build/engine/arcsin.cpp.o b/build/engine/arcsin.cpp.o new file mode 100644 index 0000000..551173f Binary files /dev/null and b/build/engine/arcsin.cpp.o differ diff --git a/build/engine/arcsinh.cpp.o b/build/engine/arcsinh.cpp.o new file mode 100644 index 0000000..80ce4d7 Binary files /dev/null and b/build/engine/arcsinh.cpp.o differ diff --git a/build/engine/arctan.cpp.o b/build/engine/arctan.cpp.o new file mode 100644 index 0000000..e0079e6 Binary files /dev/null and b/build/engine/arctan.cpp.o differ diff --git a/build/engine/arctanh.cpp.o b/build/engine/arctanh.cpp.o new file mode 100644 index 0000000..1442f07 Binary files /dev/null and b/build/engine/arctanh.cpp.o differ diff --git a/build/engine/arg.cpp.o b/build/engine/arg.cpp.o new file mode 100644 index 0000000..e560b95 Binary files /dev/null and b/build/engine/arg.cpp.o differ diff --git a/build/engine/atomize.cpp.o b/build/engine/atomize.cpp.o new file mode 100644 index 0000000..9ce436b Binary files /dev/null and b/build/engine/atomize.cpp.o differ diff --git a/build/engine/bake.cpp.o b/build/engine/bake.cpp.o new file mode 100644 index 0000000..e37964e Binary files /dev/null and b/build/engine/bake.cpp.o differ diff --git a/build/engine/bignum.cpp.o b/build/engine/bignum.cpp.o new file mode 100644 index 0000000..7a17d23 Binary files /dev/null and b/build/engine/bignum.cpp.o differ diff --git a/build/engine/binomial.cpp.o b/build/engine/binomial.cpp.o new file mode 100644 index 0000000..3391857 Binary files /dev/null and b/build/engine/binomial.cpp.o differ diff --git a/build/engine/ceiling.cpp.o b/build/engine/ceiling.cpp.o new file mode 100644 index 0000000..87d1cdf Binary files /dev/null and b/build/engine/ceiling.cpp.o differ diff --git a/build/engine/choose.cpp.o b/build/engine/choose.cpp.o new file mode 100644 index 0000000..6429d6b Binary files /dev/null and b/build/engine/choose.cpp.o differ diff --git a/build/engine/circexp.cpp.o b/build/engine/circexp.cpp.o new file mode 100644 index 0000000..b4bbaf2 Binary files /dev/null and b/build/engine/circexp.cpp.o differ diff --git a/build/engine/clear.cpp.o b/build/engine/clear.cpp.o new file mode 100644 index 0000000..374bb0c Binary files /dev/null and b/build/engine/clear.cpp.o differ diff --git a/build/engine/clock.cpp.o b/build/engine/clock.cpp.o new file mode 100644 index 0000000..286213a Binary files /dev/null and b/build/engine/clock.cpp.o differ diff --git a/build/engine/coeff.cpp.o b/build/engine/coeff.cpp.o new file mode 100644 index 0000000..c296bc4 Binary files /dev/null and b/build/engine/coeff.cpp.o differ diff --git a/build/engine/cofactor.cpp.o b/build/engine/cofactor.cpp.o new file mode 100644 index 0000000..f25731a Binary files /dev/null and b/build/engine/cofactor.cpp.o differ diff --git a/build/engine/condense.cpp.o b/build/engine/condense.cpp.o new file mode 100644 index 0000000..1d1f9d6 Binary files /dev/null and b/build/engine/condense.cpp.o differ diff --git a/build/engine/conj.cpp.o b/build/engine/conj.cpp.o new file mode 100644 index 0000000..13e3817 Binary files /dev/null and b/build/engine/conj.cpp.o differ diff --git a/build/engine/cons.cpp.o b/build/engine/cons.cpp.o new file mode 100644 index 0000000..2667d79 Binary files /dev/null and b/build/engine/cons.cpp.o differ diff --git a/build/engine/contract.cpp.o b/build/engine/contract.cpp.o new file mode 100644 index 0000000..14763f2 Binary files /dev/null and b/build/engine/contract.cpp.o differ diff --git a/build/engine/cos.cpp.o b/build/engine/cos.cpp.o new file mode 100644 index 0000000..8e56c44 Binary files /dev/null and b/build/engine/cos.cpp.o differ diff --git a/build/engine/cosh.cpp.o b/build/engine/cosh.cpp.o new file mode 100644 index 0000000..5362c01 Binary files /dev/null and b/build/engine/cosh.cpp.o differ diff --git a/build/engine/data.cpp.o b/build/engine/data.cpp.o new file mode 100644 index 0000000..aa281b6 Binary files /dev/null and b/build/engine/data.cpp.o differ diff --git a/build/engine/decomp.cpp.o b/build/engine/decomp.cpp.o new file mode 100644 index 0000000..3d4c4a4 Binary files /dev/null and b/build/engine/decomp.cpp.o differ diff --git a/build/engine/define.cpp.o b/build/engine/define.cpp.o new file mode 100644 index 0000000..832fa78 Binary files /dev/null and b/build/engine/define.cpp.o differ diff --git a/build/engine/defint.cpp.o b/build/engine/defint.cpp.o new file mode 100644 index 0000000..60dfb92 Binary files /dev/null and b/build/engine/defint.cpp.o differ diff --git a/build/engine/degree.cpp.o b/build/engine/degree.cpp.o new file mode 100644 index 0000000..9e0af17 Binary files /dev/null and b/build/engine/degree.cpp.o differ diff --git a/build/engine/denominator.cpp.o b/build/engine/denominator.cpp.o new file mode 100644 index 0000000..abe48f4 Binary files /dev/null and b/build/engine/denominator.cpp.o differ diff --git a/build/engine/derivative.cpp.o b/build/engine/derivative.cpp.o new file mode 100644 index 0000000..75b8b25 Binary files /dev/null and b/build/engine/derivative.cpp.o differ diff --git a/build/engine/det.cpp.o b/build/engine/det.cpp.o new file mode 100644 index 0000000..3153b69 Binary files /dev/null and b/build/engine/det.cpp.o differ diff --git a/build/engine/dirac.cpp.o b/build/engine/dirac.cpp.o new file mode 100644 index 0000000..ef18a46 Binary files /dev/null and b/build/engine/dirac.cpp.o differ diff --git a/build/engine/display.cpp.o b/build/engine/display.cpp.o new file mode 100644 index 0000000..d6ba47b Binary files /dev/null and b/build/engine/display.cpp.o differ diff --git a/build/engine/distill.cpp.o b/build/engine/distill.cpp.o new file mode 100644 index 0000000..6bb9d31 Binary files /dev/null and b/build/engine/distill.cpp.o differ diff --git a/build/engine/divisors.cpp.o b/build/engine/divisors.cpp.o new file mode 100644 index 0000000..fab9c7e Binary files /dev/null and b/build/engine/divisors.cpp.o differ diff --git a/build/engine/dpow.cpp.o b/build/engine/dpow.cpp.o new file mode 100644 index 0000000..256bc8e Binary files /dev/null and b/build/engine/dpow.cpp.o differ diff --git a/build/engine/dsolve.cpp.o b/build/engine/dsolve.cpp.o new file mode 100644 index 0000000..7fdd376 Binary files /dev/null and b/build/engine/dsolve.cpp.o differ diff --git a/build/engine/eigen.cpp.o b/build/engine/eigen.cpp.o new file mode 100644 index 0000000..0f65b17 Binary files /dev/null and b/build/engine/eigen.cpp.o differ diff --git a/build/engine/erf.cpp.o b/build/engine/erf.cpp.o new file mode 100644 index 0000000..e7f4a8f Binary files /dev/null and b/build/engine/erf.cpp.o differ diff --git a/build/engine/erfc.cpp.o b/build/engine/erfc.cpp.o new file mode 100644 index 0000000..69b5a65 Binary files /dev/null and b/build/engine/erfc.cpp.o differ diff --git a/build/engine/eval.cpp.o b/build/engine/eval.cpp.o new file mode 100644 index 0000000..463a58a Binary files /dev/null and b/build/engine/eval.cpp.o differ diff --git a/build/engine/expand.cpp.o b/build/engine/expand.cpp.o new file mode 100644 index 0000000..3b45f23 Binary files /dev/null and b/build/engine/expand.cpp.o differ diff --git a/build/engine/expcos.cpp.o b/build/engine/expcos.cpp.o new file mode 100644 index 0000000..acadbbc Binary files /dev/null and b/build/engine/expcos.cpp.o differ diff --git a/build/engine/expsin.cpp.o b/build/engine/expsin.cpp.o new file mode 100644 index 0000000..fc5274d Binary files /dev/null and b/build/engine/expsin.cpp.o differ diff --git a/build/engine/factor.cpp.o b/build/engine/factor.cpp.o new file mode 100644 index 0000000..d70a16d Binary files /dev/null and b/build/engine/factor.cpp.o differ diff --git a/build/engine/factorial.cpp.o b/build/engine/factorial.cpp.o new file mode 100644 index 0000000..6c6d10d Binary files /dev/null and b/build/engine/factorial.cpp.o differ diff --git a/build/engine/factorpoly.cpp.o b/build/engine/factorpoly.cpp.o new file mode 100644 index 0000000..904c8fc Binary files /dev/null and b/build/engine/factorpoly.cpp.o differ diff --git a/build/engine/factors.cpp.o b/build/engine/factors.cpp.o new file mode 100644 index 0000000..499fd6b Binary files /dev/null and b/build/engine/factors.cpp.o differ diff --git a/build/engine/filter.cpp.o b/build/engine/filter.cpp.o new file mode 100644 index 0000000..3899b4c Binary files /dev/null and b/build/engine/filter.cpp.o differ diff --git a/build/engine/find.cpp.o b/build/engine/find.cpp.o new file mode 100644 index 0000000..2920e1e Binary files /dev/null and b/build/engine/find.cpp.o differ diff --git a/build/engine/float.cpp.o b/build/engine/float.cpp.o new file mode 100644 index 0000000..624e4a7 Binary files /dev/null and b/build/engine/float.cpp.o differ diff --git a/build/engine/floor.cpp.o b/build/engine/floor.cpp.o new file mode 100644 index 0000000..f15e151 Binary files /dev/null and b/build/engine/floor.cpp.o differ diff --git a/build/engine/for.cpp.o b/build/engine/for.cpp.o new file mode 100644 index 0000000..4b0fa6b Binary files /dev/null and b/build/engine/for.cpp.o differ diff --git a/build/engine/gamma.cpp.o b/build/engine/gamma.cpp.o new file mode 100644 index 0000000..2139981 Binary files /dev/null and b/build/engine/gamma.cpp.o differ diff --git a/build/engine/gcd.cpp.o b/build/engine/gcd.cpp.o new file mode 100644 index 0000000..6307e52 Binary files /dev/null and b/build/engine/gcd.cpp.o differ diff --git a/build/engine/guess.cpp.o b/build/engine/guess.cpp.o new file mode 100644 index 0000000..6bd1d43 Binary files /dev/null and b/build/engine/guess.cpp.o differ diff --git a/build/engine/hermite.cpp.o b/build/engine/hermite.cpp.o new file mode 100644 index 0000000..d0a35b7 Binary files /dev/null and b/build/engine/hermite.cpp.o differ diff --git a/build/engine/hilbert.cpp.o b/build/engine/hilbert.cpp.o new file mode 100644 index 0000000..27330ce Binary files /dev/null and b/build/engine/hilbert.cpp.o differ diff --git a/build/main.cpp.o b/build/main.cpp.o new file mode 100644 index 0000000..31f4abc Binary files /dev/null and b/build/main.cpp.o differ diff --git a/config.h b/include/config.h similarity index 100% rename from config.h rename to include/config.h diff --git a/console.h b/include/console.h similarity index 98% rename from console.h rename to include/console.h index aef830f..6419a90 100644 --- a/console.h +++ b/include/console.h @@ -12,7 +12,7 @@ extern "C"{ #include #include -#include "fxlib.h" +#include "libfx.h" enum CONSOLE_SCREEN_SPEC{ LINE_MAX = 32, @@ -98,4 +98,4 @@ extern "C"{ #ifdef __cplusplus } #endif -#endif \ No newline at end of file +#endif diff --git a/defs.h b/include/defs.h similarity index 100% rename from defs.h rename to include/defs.h diff --git a/include/fx/.string.h.swp b/include/fx/.string.h.swp new file mode 100644 index 0000000..1b34a0b Binary files /dev/null and b/include/fx/.string.h.swp differ diff --git a/include/fx/_h_c_lib.h b/include/fx/_h_c_lib.h new file mode 100644 index 0000000..78fe26a --- /dev/null +++ b/include/fx/_h_c_lib.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------*/ +/* SH SERIES C/C++ Compiler Ver. 6.0 */ +/* Copyright (c) 1992,2000 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = _h_c_lib.h : */ +/* */ +/* FUNC = Include file for SH SERIES C/C++ Compiler environment */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ + +#ifndef _H_C_LIB +#define _H_C_LIB + +#ifdef __cplusplus +extern "C"{ +#endif +extern void _CALL_INIT(void); /* for global class object initial processing */ +extern void _CALL_END(void); /* for global class object post-processing */ +#ifdef __cplusplus +} +#endif /* #ifdef __cplusplus */ + +#endif /* #ifndef _H_C_LIB */ diff --git a/include/fx/assert.h b/include/fx/assert.h new file mode 100644 index 0000000..4c88665 --- /dev/null +++ b/include/fx/assert.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = assert.h : debug macro define ; */ +/* */ +/* FUNC = this module do the following functions; */ +/* (1) if NDEBUG defined assert(x) = (void)0; */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ +#ifndef _ASSERT +#define _ASSERT + +#include +#ifdef NDEBUG +#ifdef assert +#undef assert +#endif +#define assert(x) ((void)0) +#else +#ifdef assert +#undef assert +#endif +#define assert(x) ( x ? (void) 0 : (fprintf(stderr,\ + "ASSERTION FAILED: "#x" FILE %s,LINE %d \n", \ + __FILE__,__LINE__),abort(),(void)0)) +#endif +#ifdef __cplusplus +extern "C" { +void abort(void); +} +#endif + +#endif diff --git a/include/fx/builtin.h b/include/fx/builtin.h new file mode 100644 index 0000000..abf96df --- /dev/null +++ b/include/fx/builtin.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 6.0 */ +/* Copyright (c) 1992, 2000 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = builtin : */ +/* */ +/* FUNC = this header file do the following functions; */ +/* (1)builtin function prototype define; */ +/* */ +/* CLAS = UNIT ; */ +/* */ +/* END ; */ +/*****************************************************************/ + +#ifndef _BUILTIN +#define _BUILTIN + +#ifdef __cplusplus +extern "C" { +/* follow math.h & mathf.h */ +extern float _builtin_fabsf(float); +extern double _builtin_fabs(double); +extern float _builtin_sqrtf(float); +extern double _builtin_sqrt(double); + +/* follow private.h */ +extern void _builtin_fsca(long ,float *,float *); +extern float _builtin_fsrra(float); + +/* follow smachine.h */ +extern void _builtin_set_imask(int); +extern int _builtin_get_imask(void); +extern void _builtin_set_cr(int); +extern int _builtin_get_cr(void); +extern void _builtin_set_vbr(void *); +extern void *_builtin_get_vbr(void); +extern void _builtin_sleep(void); + +/* follow string.h */ +extern char *_builtin_strcpy(char *, const char *); +extern int _builtin_strcmp(const char *, const char *); + +/* follow umachine.h */ +extern void _builtin_set_gbr(void *); +extern void *_builtin_get_gbr(void); +extern unsigned char _builtin_gbr_read_byte(int); +extern unsigned short _builtin_gbr_read_word(int); +extern unsigned long _builtin_gbr_read_long(int); +extern void _builtin_gbr_write_byte(int, unsigned char); +extern void _builtin_gbr_write_word(int, unsigned short); +extern void _builtin_gbr_write_long(int, unsigned long); +extern void _builtin_gbr_and_byte(int, unsigned char); +extern void _builtin_gbr_or_byte(int, unsigned char); +extern void _builtin_gbr_xor_byte(int, unsigned char); +extern int _builtin_gbr_tst_byte(int, unsigned char); +extern int _builtin_tas(char *); +extern int _builtin_trapa(int); +extern int _builtin_macw(short *, short *, unsigned int); +extern int _builtin_macwl(short *, short *, unsigned int, unsigned int); +extern int _builtin_macl(int *, int *, unsigned int); +extern int _builtin_macll(int *, int *, unsigned int, unsigned int); +extern int _builtin_trapa_svc(...); +extern void _builtin_prefetch(void *); +extern void _builtin_set_fpscr(int); +extern int _builtin_get_fpscr(void); +extern float _builtin_fipr(float a1[], float b1[]); +extern void _builtin_ftrv(float a1[], float b1[]); +extern void _builtin_ftrvadd(float a1[], float b1[], float c1[]); +extern void _builtin_ftrvsub(float a1[], float b1[], float c1[]); +extern void _builtin_mtrx4mul(float [][4], float [][4]); +extern void _builtin_mtrx4muladd(float [][4], float [][4], float [][4]); +extern void _builtin_mtrx4mulsub(float [][4], float [][4], float [][4]); +extern void _builtin_ld_ext(float [][4]); +extern void _builtin_st_ext(float [][4]); +extern void _builtin_add4(float a1[], float b1[], float c1[]); +extern void _builtin_sub4(float a1[], float b1[], float c1[]); +extern void _builtin_trace(int); +} +#endif /* #ifdef __cplusplus */ + +#endif /* #ifndef _BUILTIN */ diff --git a/include/fx/complex b/include/fx/complex new file mode 100644 index 0000000..76b0085 --- /dev/null +++ b/include/fx/complex @@ -0,0 +1,189 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd + +//==================================================================== +// File: complex +// Purpose: Numerics library / Complex numbers +// Header +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _COMPLEX_ +#define _COMPLEX_ + +#include +#include + +class float_complex; // based on float +class double_complex; // based on double + +// complex specialization +class float_complex { +public: + typedef float value_type; + + float_complex(float re = 0.0f, float im = 0.0f){ + _re = re; _im = im; return; } + float_complex(const double_complex&); + float real() const{ return (_re);} + float imag() const{ return (_im);} + + float_complex& operator= (float rhs){ + _re = rhs; _im = 0.0; return *this; } + float_complex& operator+=(float rhs){ _re += rhs; return *this; } + float_complex& operator-=(float rhs){ _re -= rhs; return *this; } + float_complex& operator*=(float rhs){ + _re *= rhs; _im *= rhs; return *this; } + float_complex& operator/=(float rhs){ + _re /= rhs; _im /= rhs; return *this; } + + float_complex& operator=(const float_complex&rhs){ + _re = rhs.real(); _im = rhs.imag(); return *this; } + float_complex& operator+=(const float_complex&rhs){ + _re += rhs.real(); _im += rhs.imag(); return *this; } + float_complex& operator-=(const float_complex&rhs){ + _re -= rhs.real(); _im -= rhs.imag(); return *this; } + float_complex& operator*=(const float_complex&); + float_complex& operator/=(const float_complex&); +private: + float _re, _im; +}; + +class double_complex { +public: + typedef double value_type; + + double_complex(double re = 0.0, double im = 0.0){ + _re = re; _im = im; return; } + double_complex(const float_complex&rhs){ + _re = (double)rhs.real(); _im = (double)rhs.imag(); return; } + double real() const{ return (_re);} + double imag() const{ return (_im);} + + double_complex& operator= (double rhs){ + _re = rhs; _im = 0.0; return *this; } + double_complex& operator+=(double rhs){ _re += rhs; return *this; } + double_complex& operator-=(double rhs){ _re -= rhs; return *this; } + double_complex& operator*=(double rhs){ + _re *= rhs; _im *= rhs; return *this; } + double_complex& operator/=(double rhs){ + _re /= rhs; _im /= rhs; return *this; } + + double_complex& operator=(const double_complex&rhs){ + _re = rhs.real(); _im = rhs.imag(); return *this; } + double_complex& operator+=(const double_complex&rhs){ + _re += rhs.real(); _im += rhs.imag(); return *this; } + double_complex& operator-=(const double_complex&rhs){ + _re -= rhs.real(); _im -= rhs.imag(); return *this; } + double_complex& operator*=(const double_complex&); + double_complex& operator/=(const double_complex&); +private: + double _re, _im; +}; + + +// complex non-member functions +float_complex operator+(const float_complex&); +float_complex operator-(const float_complex&); +float_complex operator+(const float_complex&, const float_complex&); +float_complex operator+(const float_complex&, const float&); +float_complex operator+(const float&, const float_complex&); +float_complex operator-(const float_complex&, const float_complex&); +float_complex operator-(const float_complex&, const float&); +float_complex operator-(const float&, const float_complex&); +float_complex operator*(const float_complex&, const float_complex&); +float_complex operator*(const float_complex&, const float&); +float_complex operator*(const float&, const float_complex&); +float_complex operator/(const float_complex&, const float_complex&); +float_complex operator/(const float_complex&, const float&); +float_complex operator/(const float&, const float_complex&); +bool operator==(const float_complex&, const float_complex&); +bool operator==(const float_complex&, const float&); +bool operator==(const float&, const float_complex&); +bool operator!=(const float_complex&, const float_complex&); +bool operator!=(const float_complex&, const float&); +bool operator!=(const float&, const float_complex&); +istream& operator>>(istream&, float_complex&); +ostream& operator<<(ostream&, const float_complex&); + +double_complex operator+(const double_complex&); +double_complex operator-(const double_complex&); +double_complex operator+(const double_complex&, const double_complex&); +double_complex operator+(const double_complex&, const double&); +double_complex operator+(const double&, const double_complex&); +double_complex operator-(const double_complex&, const double_complex&); +double_complex operator-(const double_complex&, const double&); +double_complex operator-(const double&, const double_complex&); +double_complex operator*(const double_complex&, const double_complex&); +double_complex operator*(const double_complex&, const double&); +double_complex operator*(const double&, const double_complex&); +double_complex operator/(const double_complex&, const double_complex&); +double_complex operator/(const double_complex&, const double&); +double_complex operator/(const double&, const double_complex&); +bool operator==(const double_complex&, const double_complex&); +bool operator==(const double_complex&, const double&); +bool operator==(const double&, const double_complex&); +bool operator!=(const double_complex&, const double_complex&); +bool operator!=(const double_complex&, const double&); +bool operator!=(const double&, const double_complex&); +istream& operator>>(istream&, double_complex&); +ostream& operator<<(ostream&, const double_complex&); + +// complex value operations +float real(const float_complex&); +float imag(const float_complex&); +float abs(const float_complex&); +float arg(const float_complex&); +float norm(const float_complex&); +float_complex conj(const float_complex&); +float_complex polar(const float&, const float&); + +double real(const double_complex&); +double imag(const double_complex&); +double abs(const double_complex&); +double arg(const double_complex&); +double norm(const double_complex&); +double_complex conj(const double_complex&); +double_complex polar(const double&, const double&); + +// complex transcendentals + +#ifdef sqrt +#undef sqrt +extern "C" double sqrt(double); +#endif + +float_complex cos (const float_complex&); +float_complex cosh (const float_complex&); +float_complex exp (const float_complex&); +float_complex log (const float_complex&); +float_complex log10(const float_complex&); + +float_complex pow(const float_complex&, int); +float_complex pow(const float_complex&, const float&); +float_complex pow(const float_complex&, const float_complex&); +float_complex pow(const float&, const float_complex&); +float_complex sin (const float_complex&); +float_complex sinh (const float_complex&); +float_complex sqrt (const float_complex&); +float_complex tan (const float_complex&); +float_complex tanh (const float_complex&); + +double_complex cos (const double_complex&); +double_complex cosh (const double_complex&); +double_complex exp (const double_complex&); +double_complex log (const double_complex&); +double_complex log10(const double_complex&); + +double_complex pow(const double_complex&, int); +double_complex pow(const double_complex&, const double&); +double_complex pow(const double_complex&, const double_complex&); +double_complex pow(const double&, const double_complex&); +double_complex sin (const double_complex&); +double_complex sinh (const double_complex&); +double_complex sqrt (const double_complex&); +double_complex tan (const double_complex&); +double_complex tanh (const double_complex&); + +#endif diff --git a/include/fx/ctype.h b/include/fx/ctype.h new file mode 100644 index 0000000..66bcd87 --- /dev/null +++ b/include/fx/ctype.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = ctype : */ +/* FUNC = */ +/* ; */ +/* */ +/* */ +/* */ +/* CLAS = UNIT ; */ +/* END ; */ +/*****************************************************************/ +#ifndef _CTYPE +#define _CTYPE + +#ifdef __cplusplus +extern "C" { +#endif + +extern unsigned char _ctype[]; + +extern int isalnum(int); +extern int isalpha(int); +extern int iscntrl(int); +extern int isdigit(int); +extern int isgraph(int); +extern int islower(int); +extern int isprint(int); +extern int ispunct(int); +extern int isspace(int); +extern int isupper(int); +extern int isxdigit(int); +extern int tolower(int); +extern int toupper(int); +#ifdef __cplusplus +} +#endif + +#define _UPPER 0x01 +#define _LOWER 0x02 +#define _DIGIT 0x04 +#define _SPACE 0x08 +#define _PUNCT 0x10 +#define _CNTRL 0x20 +#define _WHITE 0x40 +#define _HEX 0x80 + +#define isalnum(c) (_ctype[(c) & 0xff] & (_UPPER | _LOWER | _DIGIT)) +#define isalpha(c) (_ctype[(c) & 0xff] & (_UPPER | _LOWER)) +#define iscntrl(c) (_ctype[(c) & 0xff] & _CNTRL) +#define isdigit(c) (_ctype[(c) & 0xff] & _DIGIT) +#define isgraph(c) (_ctype[(c) & 0xff] & (_UPPER | _LOWER | _DIGIT | _PUNCT)) +#define islower(c) (_ctype[(c) & 0xff] & _LOWER) +#define isprint(c) (_ctype[(c) & 0xff] & (_UPPER|_LOWER|_DIGIT|_PUNCT|_SPACE)) +#define ispunct(c) (_ctype[(c) & 0xff] & _PUNCT) +#define isspace(c) (_ctype[(c) & 0xff] & _WHITE) +#define isupper(c) (_ctype[(c) & 0xff] & _UPPER) +#define isxdigit(c) (_ctype[(c) & 0xff] & _HEX) +#define tolower(c) (isupper(c) ? ((c)-'A'+'a') : (c)) +#define toupper(c) (islower(c) ? ((c)-'a'+'A') : (c)) + +#endif diff --git a/include/fx/ensigdsp.h b/include/fx/ensigdsp.h new file mode 100644 index 0000000..a82d9e0 --- /dev/null +++ b/include/fx/ensigdsp.h @@ -0,0 +1,257 @@ +/* +*SHDSP Library +*Copyright (c) Hitachi,Ltd. 1998 +*Licensed material of Hitachi,Ltd +*/ +/*********************************************************** +* File: ensigdsp.h +* Purpose: Common +* Create: 1998.03.20 Rev. 1.0 +***********************************************************/ + +/* +** Copyright Ensigma Ltd. 1995 +** +** Unauthorised copying or distribution of this software is prohibited. +** +** Version 1.0. +** +*/ + +/* +** ENSIGMA DSP Library +*/ + +/* Constants */ +#ifndef _ENSIGDSP +#define _ENSIGDSP + +#define BIQUAD_SIZE 6 /* no. coefficients in an IIR biquad */ + +#define EDSP_OK 0 +#define EDSP_BAD_ARG 1 +#define EDSP_NO_HEAP 2 + +#define EFFTALLSCALE (-1L) +#define EFFTMIDSCALE 0x55555555L +#define EFFTNOSCALE 0x00000000L + +#ifdef __cplusplus /*A-10-014-01*/ +extern"C"{ /*A-10-014-01*/ +#endif /*A-10-014-01*/ + +/* +** Fourier transforms +*/ +int FftComplex(short op_x[], + short op_y[], + const short ip_x[], + const short ip_y[], + long size, + long scale); +int FftInComplex(short data_x[], + short data_y[], + long size, + long scale); +int FftReal(short op_x[], + short op_y[], + const short ip[], + long size, + long scale); + /* int ip_is_x);*/ +int FftInReal(short data_x[], + short data_y[], + long size, + long scale, + int not_sure_about_ip_format); +int IfftComplex(short op_x[], + short op_y[], + const short ip_x[], + const short ip_y[], + long size, + long scale); +int IfftInComplex(short data_x[], + short data_y[], + long size, + long scale); +int IfftReal(short op_x[], + short op_y[], + const short ip_x[], + const short ip_y[], + long size, + long scale, + int op_is_x_scratch_is_y); +int IfftInReal(short data_x[], + short data_y[], + long size, + long scale, + int not_sure_about_op_format); +int InitFft(long max_size); +void FreeFft(void); /*A-10-015-01*/ +int LogMagnitude(short output[], + const short ip_x[], + const short ip_y[], + long no_elements, + float fscale); + +/* +** These three variables are for the internal use of the library FFT +** functions only. They should not be accessed by user programs. +*/ +extern long max_fft_size; +extern short *twtble; + +/* +** Window functions +*/ +int GenBlackman(short data[], long N); +int GenHamming(short data[], long N); +int GenHanning(short data[], long N); +int GenTriangle(short data[], long N); + +/* +** Filters. The coefficients must be supplied in X and the workspace in Y. +** If it is straightforward we can support the opposite, ie Xworkspace and +** Ycoeff. +*/ +int FreeFir(short **Yworkspace, long order); +int InitFir(short **Yworkspace, long order); +int InitIir(short **Yworkspace, long no_sections); +int FreeIir(short **Yworkspace, long no_sections); /*A-10-015-01*/ +int InitDIir(long **Yworkspace, long no_sections); +int FreeDIir(long **Yworkspace, long no_sections); /*A-10-015-01*/ +int InitLms(short **Yworkspace, long order); +int FreeLms(short **Yworkspace, long order); /*A-10-015-01*/ +int Fir(short op[], + const short ip[], + long no_samples, + const short Xcoeff[], + long order, + int res_shift, + short *Yworkspace); +int Fir1(short *op_ptr, + short input, + const short Xcoeff[], + long order, + int res_shift, + short *Yworkspace); +int Iir(short op[], + const short ip[], + long no_samples, + const short Xcoeff[], + long no_sections, + short *Yworkspace); +int Iir1(short *op_ptr, + short input, + const short Xcoeff[], + long no_sections, + short *Yworkspace); +int DIir(short op[], + const short ip[], + long no_samples, + const long Xcoeff[], + long no_sections, + long *Yworkspace); +int DIir1(short *op_ptr, + const short input, /*98.01.09 C-10-005-01 */ +/* short input, 98.01.09 D-10-005-01 */ + const long Xcoeff[], + long no_sections, + long *Yworkspace); +int Lms(short op[], + const short ip[], + const short ref[], + long no_samples, + short Xcoeff[], + long order, + int res_shift, + short mu, + short *Yworkspace); +int Lms1(short *op_ptr, + short input, + short ref_op, + short Xcoeff[], + long order, + int res_shift, + short mu, + short *Yworkspace); + +/* +** Convolution and Correlation +*/ +int ConvComplete(short op[], + const short ix[], + const short iy[], + long ix_size, + long iy_size, + int res_shift); +int ConvCyclic(short op[], + const short ix[], + const short iy[], + long size, + int res_shift); +int ConvPartial(short op[], + const short ix[], + const short iy[], + long ix_size, + long iy_size, + int res_shift); +int Correlate(short op[], + const short ix[], + const short iy[], + long ix_size, + long iy_size, + long no_corr, + int x_is_larger, + int res_shift); +int CorrCyclic(short op[], + const short ix[], + const short iy[], + long size, + int reverse, + int res_shift); + + +/* +** Miscellaneous +*/ +int GenGWnoise(short output[], long no_samples, float variance); + +int MinI(short **min_ptr, short buffer[], long buff_len, int src_is_x); +int MaxI(short **max_ptr, short buffer[], long buff_len, int src_is_x); +int PeakI(short **peak_ptr, short buffer[], long buff_len, int src_is_x); + +int Mean(short *mean_ptr, const short buffer[], long buff_len, int src_is_x); +int Variance(long *variance_ptr, + short *mean_ptr, + const short buffer[], + long buff_len, int src_is_x); + +int VectorMult(short dest[], + const short matrixX[], + const short matrixY[], + long length, + int res_shift); +int MatrixMult(void *matrix3, + const void *matrixX, + const void *matrixY, + long m, + long n, + long p, + int res_shift, int dest_is_x); +int MsPower(long *pow_ptr, const short input[], long buff_size, int src_is_x); + +int CopyXtoY(short y[], const short x[], long n); +int CopyYtoX(short x[], const short y[], long n); +int CopyToX(short x[], const short src[], long n); +int CopyToY(short y[], const short src[], long n); +int CopyFromX(short src[], const short x[], long n); +int CopyFromY(short src[], const short y[], long n); + +int Limit(short data[], long no_elements, int data_is_x); + +#ifdef __cplusplus /*A-10-014-01*/ +} /*A-10-014-01*/ +#endif /*A-10-014-01*/ + +#endif diff --git a/include/fx/errno.h b/include/fx/errno.h new file mode 100644 index 0000000..67daf07 --- /dev/null +++ b/include/fx/errno.h @@ -0,0 +1,114 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = errno : */ +/* FUNC = */ +/* ; */ +/* */ +/* */ +/* */ +/* CLAS = UNIT ; */ +/* END ; */ +/*****************************************************************/ +#ifndef _ERRNO +#define _ERRNO + +#ifndef ERANGE +#define ERANGE 1100 +#endif + +#ifndef EDOM +#define EDOM 1101 +#endif + +#ifndef EDIV +#define EDIV 1102 +#endif + +#ifndef ESTRN +#define ESTRN 1104 +#endif + +#ifndef PTRERR +#define PTRERR 1106 +#endif + +#ifndef SEQERR +#define SEQERR 1108 +#endif + +#ifndef ECBASE +#define ECBASE 1200 +#endif + +#ifndef ETLN +#define ETLN 1202 +#endif + +#ifndef EEXP +#define EEXP 1204 +#endif + +#ifndef EEXPN +#define EEXPN 1206 +#endif + +#ifndef ENUM +#define ENUM 1208 +#endif + +#ifndef EFLOATO +#define EFLOATO 1210 +#endif + +#ifndef EFLOATU +#define EFLOATU 1220 +#endif + +#ifndef EDBLO +#define EDBLO 1250 +#endif + +#ifndef EDBLU +#define EDBLU 1260 +#endif + +#ifndef ELDBLO +#define ELDBLO 1270 +#endif + +#ifndef ELDBLU +#define ELDBLU 1280 +#endif + +#ifndef NOTOPN +#define NOTOPN 1300 +#endif + +#ifndef EBADF +#define EBADF 1302 +#endif + +#ifndef ECSPEC +#define ECSPEC 1304 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern volatile int _errno; + +#ifdef __cplusplus +} +#endif + +#ifndef errno +#define errno _errno +#endif + +#endif diff --git a/include/fx/exception.h b/include/fx/exception.h new file mode 100644 index 0000000..c7da5a6 --- /dev/null +++ b/include/fx/exception.h @@ -0,0 +1,74 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = exception.h : */ +/* */ +/* FUNC = Include file for exception handling (see 18.6) */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ + +#ifndef _EXCEPTION_H +#define _EXCEPTION_H + +/* This lets users disable the EDG supplied exception classes. */ +#ifndef __NO_EDG_EXCEPTION_CLASSES + +#include + +#ifdef __EDG_RUNTIME_USES_NAMESPACES +namespace std { +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ + + /* + If bool is not supported, use a typedef for bool. + */ + #ifdef _BOOL + typedef bool __bool; + #else /* ifndef _BOOL */ + typedef int __bool; + #endif /* ifdef _BOOL */ + + class bad_exception : public exception { + public: + bad_exception() throw(); + bad_exception(const bad_exception&) throw(); + bad_exception& operator=(const bad_exception&) throw(); + virtual ~bad_exception() throw(); + virtual const char* what() const throw(); + }; + + typedef void (*terminate_handler)(); + extern terminate_handler set_terminate(terminate_handler); + + typedef void (*unexpected_handler)(); + extern unexpected_handler set_unexpected(unexpected_handler); + + /* unexpected and terminate are in the WP definition of exception.h. + It is not clear why. */ + void terminate(); + void unexpected(); + + extern __bool uncaught_exception(); + +#ifdef __EDG_RUNTIME_USES_NAMESPACES +} /* namespace */ + +#ifdef __EDG_IMPLICIT_USING_STD +/* Implicitly include a using directive for the STD namespace when this + preprocessing flag is TRUE. */ +using namespace std; +#endif /* ifdef __EDG_IMPLICIT_USING_STD */ + +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ + +#endif /* ifndef __NO_EDG_EXCEPTION_CLASSES */ + +#endif /* _EXCEPTION_H */ + diff --git a/include/fx/filt_ws.h b/include/fx/filt_ws.h new file mode 100644 index 0000000..e9ef4c5 --- /dev/null +++ b/include/fx/filt_ws.h @@ -0,0 +1,26 @@ +/* +*SHDSP Library +*Copyright (c) Hitachi,Ltd. 1998 +*Licensed material of Hitachi,Ltd +*/ +/*********************************************************** +* File: filt_ws.h +* Purpose: Filter +* Create: 1998.03.20 Rev. 1.0 +***********************************************************/ + +#ifndef FILT_WS +#define FILT_WS + +#ifndef WS_SIZE +#define WS_SIZE 1024 /* Set Global workspace buffer size=1024 shorts (2048 bytes) */ +#endif + +#define MEMSIZE WS_SIZE*sizeof(short) +#pragma section Y /*need to equate DYRAM with link.cmd file*/ +short ws_mem[WS_SIZE]; +short * ws_ptr=ws_mem; +long ws_left=MEMSIZE; +#pragma section + +#endif diff --git a/include/fx/float.h b/include/fx/float.h new file mode 100644 index 0000000..cf32062 --- /dev/null +++ b/include/fx/float.h @@ -0,0 +1,208 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = float : */ +/* FUNC = limit about float type and double type ; */ +/* */ +/* */ +/* END ; */ +/*****************************************************************/ +#ifndef _FLOAT +#define _FLOAT + +extern const float _FLT_MAX_VAL; +extern const float _FLT_MIN_VAL; +extern const double _DBL_MAX_VAL; +extern const double _DBL_MIN_VAL; +extern const long double _LDBL_MAX_VAL; +extern const long double _LDBL_MIN_VAL; + +#ifndef _FPD + +#define FLT_RADIX 2 +#if defined(_SH2E)|defined(_SH3E)|(defined(_SH4)&!defined(_RON)) +#define FLT_ROUNDS 0 +#define FLT_GUARD 0 +#else +#define FLT_ROUNDS 1 +#define FLT_GUARD 1 +#endif +#define FLT_NORMALIZE 1 +#define FLT_MAX _FLT_MAX_VAL +#define FLT_MIN _FLT_MIN_VAL +#define FLT_MAX_EXP 127 +#if defined(_SH2E)|defined(_SH3E)|(defined(_SH4)&!defined(_DON)) +#define FLT_MIN_EXP (-126) +#else +#define FLT_MIN_EXP (-149) +#endif +#define FLT_MAX_10_EXP 38 +#if defined(_SH2E)|defined(_SH3E)|(defined(_SH4)&!defined(_DON)) +#define FLT_MIN_10_EXP (-38) +#else +#define FLT_MIN_10_EXP (-44) +#endif +#define FLT_DIG 6 +#define FLT_MANT_DIG 24 +#define FLT_EXP_DIG 8 +#if defined(_SH2E)|defined(_SH3E)|(defined(_SH4)&!defined(_RON)) +#define FLT_POS_EPS 1.1920928955078125e-7f +#if defined(_DON) +#define FLT_NEG_EPS 1.4012984643248171e-45f +#else +#define FLT_NEG_EPS 1.1754943508222876e-38f +#endif +#else +#define FLT_POS_EPS 5.9604648328104311e-8f +#define FLT_NEG_EPS 2.9802324164052156e-8f +#endif +#define FLT_POS_EPS_EXP (-23) +#if defined(_SH2E)|defined(_SH3E)|defined(_SH4) +#define FLT_NEG_EPS_EXP (-126) +#else +#define FLT_NEG_EPS_EXP (-24) +#endif + +#endif + + +#if defined(_FLT)|defined(_FPS) + +#define DBL_RADIX FLT_RADIX +#define DBL_ROUNDS FLT_ROUNDS +#define DBL_GUARD FLT_GUARD +#define DBL_NORMALIZE FLT_NORMALIZE +#define DBL_MAX _FLT_MAX_VAL +#define DBL_MIN _FLT_MIN_VAL +#define DBL_MAX_EXP FLT_MAX_EXP +#define DBL_MIN_EXP FLT_MIN_EXP +#define DBL_MAX_10_EXP FLT_MAX_10_EXP +#define DBL_MIN_10_EXP FLT_MIN_10_EXP +#define DBL_DIG FLT_DIG +#define DBL_MANT_DIG FLT_MANT_DIG +#define DBL_EXP_DIG FLT_EXP_DIG +#define DBL_POS_EPS FLT_POS_EPS +#define DBL_NEG_EPS FLT_NEG_EPS +#define DBL_POS_EPS_EXP FLT_POS_EPS_EXP +#define DBL_NEG_EPS_EXP FLT_NEG_EPS_EXP + +#else + +#define DBL_RADIX 2 +#if defined(_SH4)&!defined(_RON) +#define DBL_ROUNDS 0 +#define DBL_GUARD 0 +#else +#define DBL_ROUNDS 1 +#define DBL_GUARD 1 +#endif +#define DBL_NORMALIZE 1 +#define DBL_MAX _DBL_MAX_VAL +#define DBL_MIN _DBL_MIN_VAL +#define DBL_MAX_EXP 1023 +#if defined(_SH4)&!defined(_DON) +#define DBL_MIN_EXP (-1022) +#else +#define DBL_MIN_EXP (-1074) +#endif +#define DBL_MAX_10_EXP 308 +#if defined(_SH4)&!defined(_DON) +#define DBL_MIN_10_EXP (-308) +#else +#define DBL_MIN_10_EXP (-323) +#endif +#define DBL_DIG 15 +#define DBL_MANT_DIG 53 +#define DBL_EXP_DIG 11 +#if defined(_SH4)&!defined(_RON) +#define DBL_POS_EPS 2.2204460492503131e-16 +#if defined(_DON) +#define DBL_NEG_EPS 4.9406564584124655e-324 +#else +#define DBL_NEG_EPS 2.2250738585072014e-308 +#endif +#else +#define DBL_POS_EPS 1.1102230246251567e-16 +#define DBL_NEG_EPS 5.5511151231257834e-17 +#endif +#define DBL_POS_EPS_EXP (-52) +#ifdef _SH4 +#ifdef _RON +#define DBL_NEG_EPS_EXP (-53) +#else +#ifdef _DON +#define DBL_NEG_EPS_EXP (-1023) +#else +#define DBL_NEG_EPS_EXP (-1022) +#endif +#endif +#else +#define DBL_NEG_EPS_EXP (-53) +#endif + +#ifdef _FPD +#define FLT_RADIX DBL_RADIX +#define FLT_ROUNDS DBL_ROUNDS +#define FLT_GUARD DBL_GUARD +#define FLT_NORMALIZE DBL_NORMALIZE +#define FLT_MAX _DBL_MAX_VAL +#define FLT_MIN _DBL_MIN_VAL +#define FLT_MAX_EXP DBL_MAX_EXP +#define FLT_MIN_EXP DBL_MIN_EXP +#define FLT_MAX_10_EXP DBL_MAX_10_EXP +#define FLT_MIN_10_EXP DBL_MIN_10_EXP +#define FLT_DIG DBL_DIG +#define FLT_MANT_DIG DBL_MANT_DIG +#define FLT_EXP_DIG DBL_EXP_DIG +#define FLT_POS_EPS DBL_POS_EPS +#define FLT_NEG_EPS DBL_NEG_EPS +#define FLT_POS_EPS_EXP DBL_POS_EPS_EXP +#define FLT_NEG_EPS_EXP DBL_NEG_EPS_EXP +#endif + +#endif + + +#ifdef _FLT +#define LDBL_RADIX 2 +#define LDBL_ROUNDS 1 +#define LDBL_GUARD 1 +#define LDBL_NORMALIZE 1 +#define LDBL_MAX _LDBL_MAX_VAL +#define LDBL_MIN _LDBL_MIN_VAL +#define LDBL_MAX_EXP 1023 +#define LDBL_MIN_EXP (-1074) +#define LDBL_MAX_10_EXP 308 +#define LDBL_MIN_10_EXP (-323) +#define LDBL_DIG 15 +#define LDBL_MANT_DIG 53 +#define LDBL_EXP_DIG 11 +#define LDBL_POS_EPS 1.1102230246251567e-16 +#define LDBL_NEG_EPS 5.5511151231257834e-17 +#define LDBL_POS_EPS_EXP (-52) +#define LDBL_NEG_EPS_EXP (-53) +#else +#define LDBL_RADIX DBL_RADIX +#define LDBL_ROUNDS DBL_ROUNDS +#define LDBL_GUARD DBL_GUARD +#define LDBL_NORMALIZE DBL_NORMALIZE +#define LDBL_MAX DBL_MAX +#define LDBL_MIN DBL_MIN +#define LDBL_MAX_EXP DBL_MAX_EXP +#define LDBL_MIN_EXP DBL_MIN_EXP +#define LDBL_MAX_10_EXP DBL_MAX_10_EXP +#define LDBL_MIN_10_EXP DBL_MIN_10_EXP +#define LDBL_DIG DBL_DIG +#define LDBL_MANT_DIG DBL_MANT_DIG +#define LDBL_EXP_DIG DBL_EXP_DIG +#define LDBL_POS_EPS DBL_POS_EPS +#define LDBL_NEG_EPS DBL_NEG_EPS +#define LDBL_POS_EPS_EXP DBL_POS_EPS_EXP +#define LDBL_NEG_EPS_EXP DBL_NEG_EPS_EXP +#endif + +#endif diff --git a/include/fx/iomanip b/include/fx/iomanip new file mode 100644 index 0000000..9dcdb71 --- /dev/null +++ b/include/fx/iomanip @@ -0,0 +1,60 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd + +// +// Embeded C++ Library Header +// + +//==================================================================== +// File: iomanip +// Purpose: Definition of class iomanip +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _IOMANIP_ +#define _IOMANIP_ + +#include +#include + +//Class +class smanip{ +private: + union{ + int val_i; + char val_c; + ios_base::fmtflags val_f; + }; + union{ + ios_base& (*pfi)(ios_base&,int); + ios_base& (*pfc)(ios_base&,char); + ios_base& (*pff)(ios_base&,ios_base::fmtflags); + }; + enum _ec2p_smanip_t{ + _ec2p_smanip_i,_ec2p_smanip_c ,_ec2p_smanip_f + }_ec2p_smanip_data; + +public: + smanip(ios_base& (*pf)(ios_base&,int),int arg) + :pfi(pf),val_i(arg),_ec2p_smanip_data(_ec2p_smanip_i){} + + smanip(ios_base& (*pf)(ios_base&,char),char arg) + :pfc(pf),val_c(arg),_ec2p_smanip_data(_ec2p_smanip_c){} + + smanip(ios_base& (*pf)(ios_base&,ios_base::fmtflags),ios_base::fmtflags arg) + :pff(pf),val_f(arg),_ec2p_smanip_data(_ec2p_smanip_f){} + + friend ostream& operator << (ostream&,smanip); + friend istream& operator >> (istream&,smanip); +}; + +//Manipulators +smanip resetiosflags(ios_base::fmtflags); +smanip setiosflags(ios_base::fmtflags); +smanip setbase(int); +smanip setfill(char); +smanip setprecision(int); +smanip setw(int); + +#endif diff --git a/include/fx/ios b/include/fx/ios new file mode 100644 index 0000000..54295ae --- /dev/null +++ b/include/fx/ios @@ -0,0 +1,192 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd +// +// Embeded C++ Class Library Header +// + +//==================================================================== +// File: ios +// Purpose: Definition of class ios +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _IOS_ +#define _IOS_ + +class streambuf; +class ostream; + +typedef long POS_T; +typedef long INT_T; +typedef long SZ_T; +typedef long OFF_T; + +typedef OFF_T streamoff; +typedef SZ_T streamsize; +typedef INT_T int_type; +typedef POS_T pos_type; +typedef OFF_T off_type; + +class ios_base { +public: + typedef long fmtflags; + static const fmtflags boolalpha; + static const fmtflags dec; + static const fmtflags fixed; + static const fmtflags hex; + static const fmtflags internal; + static const fmtflags left; + static const fmtflags oct; + static const fmtflags right; + static const fmtflags scientific; + static const fmtflags showbase; + static const fmtflags showpoint; + static const fmtflags showpos; + static const fmtflags skipws; + static const fmtflags unitbuf; + static const fmtflags uppercase; + static const fmtflags adjustfield; + static const fmtflags basefield; + static const fmtflags floatfield; + typedef int iostate; + static const iostate badbit; + static const iostate eofbit; + static const iostate failbit; + static const iostate goodbit; + typedef int openmode; + static const openmode app; + static const openmode ate; + static const openmode binary; + static const openmode in; + static const openmode out; + static const openmode trunc; + typedef int seekdir; + static const seekdir beg; + static const seekdir cur; + static const seekdir end; + + class Init; + + fmtflags flags() const {return (fmtflags)fmtfl;} + fmtflags flags(fmtflags); + fmtflags setf(fmtflags) ; + fmtflags setf(fmtflags, fmtflags); + void unsetf(fmtflags); + char fill() const { + return (char)fillch; + } + char fill(char); + int precision() const { + return prec; + } + streamsize precision(streamsize); + streamsize width() const {return wide;} + streamsize width(streamsize); + +// static int xalloc() {return index++;} // Not implemented +// long & ipword(int); // Not implemented +// long * &pword(int); // Not implemented + + ~ios_base(){} // destructor + + // callbacks -- exposition only + enum event { + erase_event, + imbue_event, + copyfmt_event + }; + typedef void (*event_callback)(event, ios_base&, int index); + void register_callback(event_callback fn, int index); + static bool sync_with_stdio(bool sync = true){ return true; } + + class Init{ + public: + Init(){init_cnt++;} + ~Init(){init_cnt--;} + private: + static int init_cnt; + }; + +protected: + ios_base(){Init::Init();} + void _ec2p_init_base(); + void _ec2p_copy_base(ios_base &); + static const fmtflags _fmtmask; + static const iostate _statemask; +private: + fmtflags fmtfl; // format flag + streamsize prec; // number of after floating point + streamsize wide; // field width + char fillch; // fill charactor + +// static int index; // exposition only +// long *iarray; // exposition only +// void **parray; // exposition only +}; + +class ios : public ios_base { +public: +// Types: +// typedef INT_T int_type; +// typedef POS_T pos_type; +// typedef OFF_T off_type; + + operator void*() const { + return (void*)!fail(); + } + bool operator!() const{return (bool)fail();} + iostate rdstate () const{return (iostate)state;} + void clear(iostate = goodbit); + void setstate(iostate); + bool good() const {return (bool)(state==goodbit);} + bool eof() const {return (bool)(state&eofbit);} + bool fail() const {return (bool)(state&(badbit|failbit));} + bool bad() const {return (bool)(state&badbit);} + + iostate exceptions() const; // exposition only + void exceptions(iostate); // exposition only + + ios(streambuf *sbptr){ // Constructor + init(sbptr); + } + virtual ~ios(){}; // Destructor + ostream *tie() const {return tiestr;} + ostream *tie(ostream*); + streambuf *rdbuf() const{return sb;} + streambuf *rdbuf(streambuf*); + ios & copyfmt(const ios &); + ios(){init(0);} + void init(streambuf*); +private: + streambuf *sb; // pointer to streambuf object + ostream *tiestr; // pointer to ostream object + int state; // status +}; + +//Manipulators +ios_base & boolalpha(ios_base&); +ios_base & noboolalpha(ios_base&); +ios_base & showbase(ios_base&); +ios_base & noshowbase(ios_base&); +ios_base & showpoint(ios_base&); +ios_base & noshowpoint(ios_base&); +ios_base & showpos(ios_base&); +ios_base & noshowpos(ios_base&); +ios_base & skipws(ios_base&); +ios_base & noskipws(ios_base&); +ios_base & uppercase(ios_base&); +ios_base & nouppercase(ios_base&); +//Adjustfield +ios_base & internal(ios_base&); +ios_base & left(ios_base&); +ios_base & right(ios_base&); +//Basefield +ios_base & dec(ios_base&); +ios_base & hex(ios_base&); +ios_base & oct(ios_base&); +//floatfield +ios_base & fixed(ios_base&); +ios_base & scientific(ios_base&); + +#endif diff --git a/include/fx/iostream b/include/fx/iostream new file mode 100644 index 0000000..b4a5120 --- /dev/null +++ b/include/fx/iostream @@ -0,0 +1,27 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd + +// +// Standard iostream objects +// Embeded C++ Library Header +// + +//==================================================================== +// File: iostream +// Purpose: Definition of class iostream +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _IOSTREAM_ +#define _IOSTREAM_ + +#include +#include +#include + +extern istream cin; +extern ostream cout; +// extern ostream cerr; // EC++, not implemented + +#endif diff --git a/include/fx/istream b/include/fx/istream new file mode 100644 index 0000000..fdbd58b --- /dev/null +++ b/include/fx/istream @@ -0,0 +1,112 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd + +//==================================================================== +// File: istream +// Purpose: Definition of class istream +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _ISTREAM_ +#define _ISTREAM_ + +#include + +class istream : public ios { +public: + // Types (inherited from ios): + // typedef INT_T int_type; + // typedef POS_T pos_type; + // typedef OFF_T off_type; + + istream(streambuf *sb) + :chcount(0),ios(sb){} // Constructor + virtual ~istream(){} // Destructor + class sentry; // Prefix/Suffix + + // Formatted input + istream& operator >>(istream& (*pf)(istream&)){ + return ((*pf)(*this)); } + istream& operator >>(ios& (*pf)(ios&)){ + (*pf)(* (ios *)this); return (*this); } + istream& operator>> (ios_base& (*pf)(ios_base&)){ + (*pf)(* (ios*)this); return (*this); } + istream & operator >>(bool &n); + istream & operator >>(short &n); + istream & operator >>(unsigned short &n); + istream & operator >>(int &n); + istream & operator >>(unsigned int &n); + istream & operator >>(long &n); + istream & operator >>(unsigned long &n); + istream & operator >>(float &f); + istream & operator >>(double &f); + istream & operator >>(long double &f); + istream & operator >>(void * &p); + istream & operator >>(streambuf *sb); + + // Unformatted input + streamsize gcount() const{return chcount;} + int_type get(); + istream & get( char& c ); + istream & get( signed char& c ); + istream & get( unsigned char& c ); + istream & get( char* s, streamsize n); + istream & get( char* s, streamsize n, char delim ); + istream & get( signed char* s, streamsize n); + istream & get( signed char* s, streamsize n, char delim ); + istream & get( unsigned char* s, streamsize n); + istream & get( unsigned char* s, streamsize n, char delim ); + istream & get( streambuf& sb); + istream & get( streambuf& sb, char delim ); + istream & getline( char* s, streamsize n); + istream & getline( char* s, streamsize n, char delim ); + istream & getline( signed char* s, streamsize n ); + istream & getline( signed char* s, streamsize n, char delim ); + istream & getline( unsigned char* s, streamsize n ); + istream & getline( unsigned char* s, streamsize n, char delim ); + istream & ignore( streamsize n=1, int_type delim=streambuf::eof ); + int_type peek(); + istream & read( char* s, streamsize n ); + istream & read( signed char* s, streamsize n ); + istream & read( unsigned char* s, streamsize n ); + streamsize readsome( char* s, streamsize n ); + streamsize readsome( signed char* s, streamsize n ); + streamsize readsome( unsigned char* s, streamsize n ); + istream & putback( char c ); + istream & unget(); + int sync(); + pos_type tellg(); + istream & seekg( pos_type pos ); + istream & seekg( off_type off, ios_base::seekdir dir ); + +private: + streamsize chcount; + streamsize _ec2p_gets( char* s, streamsize n, char delim, int mode ); + int _ec2p_getistr(char* str, unsigned int dig, int mode); + int _ec2p_getfstr(char* str, unsigned int dig); + unsigned long _ec2p_strtoul(char *nptr, char **endptr, int base); + long _ec2p_extlong(); + unsigned long _ec2p_extulong(); +}; + +class istream::sentry { +public: + sentry(istream& is, bool noskipws = false); + ~sentry(){} + operator bool() { return ok_; } +private: + bool ok_; +}; + +// character extraction templates: +istream& operator>>(istream&, char&); +istream& operator>>(istream&, unsigned char&); +istream& operator>>(istream&, signed char&); +istream& operator>>(istream&, char*); +istream& operator>>(istream&, unsigned char*); +istream& operator>>(istream&, signed char*); + +// Manipulator +istream& ws(istream& is ); +#endif diff --git a/include/fx/libfx.h b/include/fx/libfx.h new file mode 100644 index 0000000..7563af9 --- /dev/null +++ b/include/fx/libfx.h @@ -0,0 +1,97 @@ +/*****************************************************************/ +/* */ +/* CASIO fx-9860G SDK Library */ +/* */ +/* File name : fxlib.h */ +/* */ +/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */ +/* */ +/*****************************************************************/ +#ifndef __FXLIB_H__ +#define __FXLIB_H__ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// Prototypes + +void Bdisp_AllClr_DD(void); +void Bdisp_AllClr_VRAM(void); +void Bdisp_AllClr_DDVRAM(void); +void Bdisp_AreaClr_DD(const DISPBOX *pArea); +void Bdisp_AreaClr_VRAM(const DISPBOX *pArea); +void Bdisp_AreaClr_DDVRAM(const DISPBOX *pArea); +void Bdisp_AreaReverseVRAM(int x1, int y1, int x2, int y2); +void Bdisp_GetDisp_DD(unsigned char *pData); +void Bdisp_GetDisp_VRAM(unsigned char *pData); +void Bdisp_PutDisp_DD(void); +void Bdisp_PutDispArea_DD(const DISPBOX *PutDispArea); +void Bdisp_SetPoint_DD(int x, int y, unsigned char point); +void Bdisp_SetPoint_VRAM(int x, int y, unsigned char point); +void Bdisp_SetPoint_DDVRAM(int x, int y, unsigned char point); +int Bdisp_GetPoint_VRAM(int x, int y); +void Bdisp_WriteGraph_DD(const DISPGRAPH *WriteGraph); +void Bdisp_WriteGraph_VRAM(const DISPGRAPH *WriteGraph); +void Bdisp_WriteGraph_DDVRAM(const DISPGRAPH *WriteGraph); +void Bdisp_ReadArea_DD(const DISPBOX *ReadArea, unsigned char *ReadData); +void Bdisp_ReadArea_VRAM(const DISPBOX *ReadArea, unsigned char *ReadData); +void Bdisp_DrawLineVRAM(int x1, int y1, int x2, int y2); +void Bdisp_ClearLineVRAM(int x1, int y1, int x2, int y2); + +void locate(int x, int y); +void Print(const unsigned char *str); +void PrintRev(const unsigned char *str); +void PrintC(const unsigned char *c); +void PrintRevC(const unsigned char *str); +void PrintLine(const unsigned char *str, int max); +void PrintRLine(const unsigned char *str, int max); +void PrintXY(int x, int y, const unsigned char *str, int type); +int PrintMini(int x, int y, const unsigned char *str, int type); +void SaveDisp(unsigned char num); +void RestoreDisp(unsigned char num); +void PopUpWin(int n); + +int Bfile_OpenFile(const FONTCHARACTER *filename, int mode); +int Bfile_OpenMainMemory(const unsigned char *name); +int Bfile_ReadFile(int HANDLE, void *buf, int size, int readpos); +int Bfile_WriteFile(int HANDLE, const void *buf, int size); +int Bfile_SeekFile(int HANDLE, int pos); +int Bfile_CloseFile(int HANDLE); +int Bfile_GetMediaFree(enum DEVICE_TYPE devicetype, int *freebytes); +int Bfile_GetFileSize(int HANDLE); +int Bfile_CreateFile(const FONTCHARACTER *filename, int size); +int Bfile_CreateDirectory(const FONTCHARACTER *pathname); +int Bfile_CreateMainMemory(const unsigned char *name); +int Bfile_RenameMainMemory(const unsigned char *oldname, const unsigned char *newname); +int Bfile_DeleteFile(const FONTCHARACTER *filename); +int Bfile_DeleteDirectory(const FONTCHARACTER *pathname); +int Bfile_DeleteMainMemory(const unsigned char *name); +int Bfile_FindFirst(const FONTCHARACTER *pathname, int *FindHandle, FONTCHARACTER *foundfile, FILE_INFO *fileinfo); +int Bfile_FindNext(int FindHandle, FONTCHARACTER *foundfile, FILE_INFO *fileinfo); +int Bfile_FindClose(int FindHandle); + +void Bkey_Set_RepeatTime(long FirstCount, long NextCount); +void Bkey_Get_RepeatTime(long *FirstCount, long *NextCount); +void Bkey_Set_RepeatTime_Default(void); +int GetKeyWait(int sel, int time, int menu, unsigned int *keycode); +int IsKeyDown(int keycode); +int IsKeyUp(int keycode); +int GetKey(unsigned int *keycode); + +int SetTimer(int ID, int elapse, void (*hander)(void)); +int KillTimer(int ID); +void Sleep(int millisecond); + +void SetQuitHandler(void (*callback)(void)); +int INIT_ADDIN_APPLICATION(int isAppli, unsigned short OptionNum); + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/include/fx/libfx/dispbios.h b/include/fx/libfx/dispbios.h new file mode 100644 index 0000000..03bdbfc --- /dev/null +++ b/include/fx/libfx/dispbios.h @@ -0,0 +1,94 @@ +/*****************************************************************/ +/* */ +/* CASIO fx-9860G SDK Library */ +/* */ +/* File name : dispbios.h */ +/* */ +/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */ +/* */ +/*****************************************************************/ +#ifndef __DISPBIOS_H__ +#define __DISPBIOS_H__ + + +// Defines + +#define IM_VRAM_WIDTH 128 +#define IM_VRAM_HEIGHT 64 + +#define IM_VRAM_SIZE 1024 + +#define IM_CHARACTERS_MAX_LINE 21 +#define IM_BYTES_MAX_LINE (IM_CHARACTERS_MAX_LINE*2) + +#define SAVEDISP_PAGE1 1 +#define SAVEDISP_PAGE2 5 +#define SAVEDISP_PAGE3 6 + +#define MINI_OVER 0x10 +#define MINI_OR 0x11 +#define MINI_REV 0x12 +#define MINI_REVOR 0x13 + +#define IM_BIOS_DD_WIDTH IM_VRAM_WIDTH +#define IM_BIOS_DD_HEIGHT IM_VRAM_HEIGHT + +#define WRITEKIND unsigned char +#define IMB_WRITEKIND_OVER 0x01 +#define IMB_WRITEKIND_OR 0x02 +#define IMB_WRITEKIND_AND 0x03 +#define IMB_WRITEKIND_XOR 0x04 + +#define WRITEMODIFY unsigned char +#define IMB_WRITEMODIFY_NORMAL 0x01 +#define IMB_WRITEMODIFY_REVERCE 0x02 +#define IMB_WRITEMODIFY_MESH 0x03 + +#define AREAKIND unsigned char +#define IMB_AREAKIND_OVER 0x01 +#define IMB_AREAKIND_MESH 0x02 +#define IMB_AREAKIND_CLR 0x03 +#define IMB_AREAKIND_REVERSE 0x04 + +#define EFFECTWIN unsigned char +#define IMB_EFFECTWIN_OK 0x01 +#define IMB_EFFECTWIN_NG 0x02 + +#ifdef __cplusplus +extern "C" { +#endif + +// Structs + +typedef struct tag_DISPBOX{ + int left; + int top; + int right; + int bottom; +} DISPBOX; + +typedef struct tag_GRAPHDATA{ + int width; + int height; + unsigned char *pBitmap; +} GRAPHDATA; + +typedef struct tag_RECTANGLE{ + DISPBOX LineArea; + AREAKIND AreaKind; + EFFECTWIN EffectWin; +} RECTANGLE; + +typedef struct tag_DISPGRAPH{ + int x; + int y; + GRAPHDATA GraphData; + WRITEMODIFY WriteModify; + WRITEKIND WriteKind; +} DISPGRAPH; + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/include/fx/libfx/endian.h b/include/fx/libfx/endian.h new file mode 100644 index 0000000..84ce3d2 --- /dev/null +++ b/include/fx/libfx/endian.h @@ -0,0 +1,22 @@ +/*****************************************************************/ +/* */ +/* CASIO fx-9860G SDK Library */ +/* */ +/* File name : endian.h */ +/* */ +/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */ +/* */ +/*****************************************************************/ +#ifndef __ENDIAN_H__ +#define __ENDIAN_H__ + + +// Macros + +#define UtlSwapWord(w) (unsigned short)((((w) & 0x00ff) << 8) | (((w) & 0xff00) >> 8)) +#define UtlSwapDword(l) (unsigned long)((((l) & 0x000000ff) << 24) | (((l) & 0x0000ff00) << 8) | (((l) & 0xff000000) >> 24) | (((l) & 0x00ff0000) >> 8)) +#define UtlSwapInteger(i) UtlSwapDword(i) +#define UtlSwapPointer(p) (void*)((((unsigned long)(p) & 0x000000ff) << 24) | (((unsigned long)(p) & 0x0000ff00) << 8) | (((unsigned long)(p) & 0xff000000) >> 24) | (((unsigned long)(p) & 0x00ff0000) >> 8)) + + +#endif diff --git a/include/fx/libfx/filebios.h b/include/fx/libfx/filebios.h new file mode 100644 index 0000000..f6fe263 --- /dev/null +++ b/include/fx/libfx/filebios.h @@ -0,0 +1,113 @@ +/*****************************************************************/ +/* */ +/* CASIO fx-9860G SDK Library */ +/* */ +/* File name : filebios.h */ +/* */ +/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */ +/* */ +/*****************************************************************/ +#ifndef __FILEBIOS_H__ +#define __FILEBIOS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +// Defines + +#define FONTCHARACTER unsigned short + +#define _OPENMODE_READ 0x01 +#define _OPENMODE_READ_SHARE 0x80 +#define _OPENMODE_WRITE 0x02 +#define _OPENMODE_READWRITE 0x03 +#define _OPENMODE_READWRITE_SHARE 0x83 + +#define _CREATEMODE_BINARY 1 +#define _CREATEMODE_DIRECTORY 5 + +enum DEVICE_TYPE{ + DEVICE_MAIN_MEMORY, + DEVICE_STORAGE, + DEVICE_SD_CARD, // only fx-9860G SD model +}; + + +// File system standard error code +#define IML_FILEERR_NOERROR 0 +#define IML_FILEERR_ENTRYNOTFOUND -1 +#define IML_FILEERR_ILLEGALPARAM -2 +#define IML_FILEERR_ILLEGALPATH -3 +#define IML_FILEERR_DEVICEFULL -4 +#define IML_FILEERR_ILLEGALDEVICE -5 +#define IML_FILEERR_ILLEGALFILESYS -6 +#define IML_FILEERR_ILLEGALSYSTEM -7 +#define IML_FILEERR_ACCESSDENYED -8 +#define IML_FILEERR_ALREADYLOCKED -9 +#define IML_FILEERR_ILLEGALTASKID -10 +#define IML_FILEERR_PERMISSIONERROR -11 +#define IML_FILEERR_ENTRYFULL -12 +#define IML_FILEERR_ALREADYEXISTENTRY -13 +#define IML_FILEERR_READONLYFILE -14 +#define IML_FILEERR_ILLEGALFILTER -15 +#define IML_FILEERR_ENUMRATEEND -16 +#define IML_FILEERR_DEVICECHANGED -17 +//#define IML_FILEERR_NOTRECORDFILE -18 // Not used +#define IML_FILEERR_ILLEGALSEEKPOS -19 +#define IML_FILEERR_ILLEGALBLOCKFILE -20 +//#define IML_FILEERR_DEVICENOTEXIST -21 // Not used +//#define IML_FILEERR_ENDOFFILE -22 // Not used +#define IML_FILEERR_NOTMOUNTDEVICE -23 +#define IML_FILEERR_NOTUNMOUNTDEVICE -24 +#define IML_FILEERR_CANNOTLOCKSYSTEM -25 +#define IML_FILEERR_RECORDNOTFOUND -26 +//#define IML_FILEERR_NOTDUALRECORDFILE -27 // Not used +#define IML_FILEERR_NOTALARMSUPPORT -28 +#define IML_FILEERR_CANNOTADDALARM -29 +#define IML_FILEERR_FILEFINDUSED -30 +#define IML_FILEERR_DEVICEERROR -31 +#define IML_FILEERR_SYSTEMNOTLOCKED -32 +#define IML_FILEERR_DEVICENOTFOUND -33 +#define IML_FILEERR_FILETYPEMISMATCH -34 +#define IML_FILEERR_NOTEMPTY -35 +#define IML_FILEERR_BROKENSYSTEMDATA -36 +#define IML_FILEERR_MEDIANOTREADY -37 +#define IML_FILEERR_TOOMANYALARMITEM -38 +#define IML_FILEERR_SAMEALARMEXIST -39 +#define IML_FILEERR_ACCESSSWAPAREA -40 +#define IML_FILEERR_MULTIMEDIACARD -41 +#define IML_FILEERR_COPYPROTECTION -42 +#define IML_FILEERR_ILLEGALFILEDATA -43 + +// FILE_INFO.type +#define DT_DIRECTORY 0x0000 // Directory +#define DT_FILE 0x0001 // File +#define DT_ADDIN_APP 0x0002 // Add-In application +#define DT_EACT 0x0003 // eActivity +#define DT_LANGUAGE 0x0004 // Language +#define DT_BITMAP 0x0005 // Bitmap +#define DT_MAINMEM 0x0006 // Main Memory data +#define DT_TEMP 0x0007 // Temporary data +#define DT_DOT 0x0008 // . (Current directory) +#define DT_DOTDOT 0x0009 // .. (Parent directory) +#define DT_VOLUME 0x000A // Volume label + + +// Structs + +typedef struct tag_FILE_INFO +{ + unsigned short id; + unsigned short type; + unsigned long fsize; // File size + unsigned long dsize; // Data size + unsigned int property; // The file has not been completed, except when property is 0. + unsigned long address; +} FILE_INFO; + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/include/fx/libfx/keybios.h b/include/fx/libfx/keybios.h new file mode 100644 index 0000000..a57e1e1 --- /dev/null +++ b/include/fx/libfx/keybios.h @@ -0,0 +1,155 @@ +/*****************************************************************/ +/* */ +/* CASIO fx-9860G SDK Library */ +/* */ +/* File name : keybios.h */ +/* */ +/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */ +/* */ +/*****************************************************************/ +#ifndef __KEYBIOS_H__ +#define __KEYBIOS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +// Defines + +// Character codes +#define KEY_CHAR_0 0x30 +#define KEY_CHAR_1 0x31 +#define KEY_CHAR_2 0x32 +#define KEY_CHAR_3 0x33 +#define KEY_CHAR_4 0x34 +#define KEY_CHAR_5 0x35 +#define KEY_CHAR_6 0x36 +#define KEY_CHAR_7 0x37 +#define KEY_CHAR_8 0x38 +#define KEY_CHAR_9 0x39 +#define KEY_CHAR_DP 0x2e +#define KEY_CHAR_EXP 0x0f +#define KEY_CHAR_PMINUS 0x87 +#define KEY_CHAR_PLUS 0x89 +#define KEY_CHAR_MINUS 0x99 +#define KEY_CHAR_MULT 0xa9 +#define KEY_CHAR_DIV 0xb9 +#define KEY_CHAR_FRAC 0xbb +#define KEY_CHAR_LPAR 0x28 +#define KEY_CHAR_RPAR 0x29 +#define KEY_CHAR_COMMA 0x2c +#define KEY_CHAR_STORE 0x0e +#define KEY_CHAR_LOG 0x95 +#define KEY_CHAR_LN 0x85 +#define KEY_CHAR_SIN 0x81 +#define KEY_CHAR_COS 0x82 +#define KEY_CHAR_TAN 0x83 +#define KEY_CHAR_SQUARE 0x8b +#define KEY_CHAR_POW 0xa8 +#define KEY_CHAR_IMGNRY 0x7f50 +#define KEY_CHAR_LIST 0x7f51 +#define KEY_CHAR_MAT 0x7f40 +#define KEY_CHAR_EQUAL 0x3d +#define KEY_CHAR_PI 0xd0 +#define KEY_CHAR_ANS 0xc0 +#define KEY_CHAR_LBRCKT 0x5b +#define KEY_CHAR_RBRCKT 0x5d +#define KEY_CHAR_LBRACE 0x7b +#define KEY_CHAR_RBRACE 0x7d +#define KEY_CHAR_CR 0x0d +#define KEY_CHAR_CUBEROOT 0x96 +#define KEY_CHAR_RECIP 0x9b +#define KEY_CHAR_ANGLE 0x7f54 +#define KEY_CHAR_EXPN10 0xb5 +#define KEY_CHAR_EXPN 0xa5 +#define KEY_CHAR_ASIN 0x91 +#define KEY_CHAR_ACOS 0x92 +#define KEY_CHAR_ATAN 0x93 +#define KEY_CHAR_ROOT 0x86 +#define KEY_CHAR_POWROOT 0xb8 +#define KEY_CHAR_SPACE 0x20 +#define KEY_CHAR_DQUATE 0x22 +#define KEY_CHAR_VALR 0xcd +#define KEY_CHAR_THETA 0xce +#define KEY_CHAR_A 0x41 +#define KEY_CHAR_B 0x42 +#define KEY_CHAR_C 0x43 +#define KEY_CHAR_D 0x44 +#define KEY_CHAR_E 0x45 +#define KEY_CHAR_F 0x46 +#define KEY_CHAR_G 0x47 +#define KEY_CHAR_H 0x48 +#define KEY_CHAR_I 0x49 +#define KEY_CHAR_J 0x4a +#define KEY_CHAR_K 0x4b +#define KEY_CHAR_L 0x4c +#define KEY_CHAR_M 0x4d +#define KEY_CHAR_N 0x4e +#define KEY_CHAR_O 0x4f +#define KEY_CHAR_P 0x50 +#define KEY_CHAR_Q 0x51 +#define KEY_CHAR_R 0x52 +#define KEY_CHAR_S 0x53 +#define KEY_CHAR_T 0x54 +#define KEY_CHAR_U 0x55 +#define KEY_CHAR_V 0x56 +#define KEY_CHAR_W 0x57 +#define KEY_CHAR_X 0x58 +#define KEY_CHAR_Y 0x59 +#define KEY_CHAR_Z 0x5a + + +// Control codes +#define KEY_CTRL_NOP 0 +#define KEY_CTRL_EXE 30004 +#define KEY_CTRL_DEL 30025 +#define KEY_CTRL_AC 30015 +#define KEY_CTRL_FD 30046 +#define KEY_CTRL_XTT 30001 +#define KEY_CTRL_EXIT 30002 +#define KEY_CTRL_SHIFT 30006 +#define KEY_CTRL_ALPHA 30007 +#define KEY_CTRL_OPTN 30008 +#define KEY_CTRL_VARS 30016 +#define KEY_CTRL_UP 30018 +#define KEY_CTRL_DOWN 30023 +#define KEY_CTRL_LEFT 30020 +#define KEY_CTRL_RIGHT 30021 +#define KEY_CTRL_F1 30009 +#define KEY_CTRL_F2 30010 +#define KEY_CTRL_F3 30011 +#define KEY_CTRL_F4 30012 +#define KEY_CTRL_F5 30013 +#define KEY_CTRL_F6 30014 +#define KEY_CTRL_CATALOG 30100 +#define KEY_CTRL_CAPTURE 30055 +#define KEY_CTRL_CLIP 30050 +#define KEY_CTRL_PASTE 30036 +#define KEY_CTRL_INS 30033 +#define KEY_CTRL_MIXEDFRAC 30054 +#define KEY_CTRL_FRACCNVRT 30026 +#define KEY_CTRL_QUIT 30029 +#define KEY_CTRL_PRGM 30028 +#define KEY_CTRL_SETUP 30037 +#define KEY_CTRL_PAGEUP 30052 +#define KEY_CTRL_PAGEDOWN 30053 +#define KEY_CTRL_MENU 30003 +#define KEY_CTRL_RESERVE1 30060 +#define KEY_CTRL_RESERVE2 30061 +#define KEY_CTRL_RESERVE3 30062 + + +// in Bkey_GetKeyWait function +#define KEYWAIT_HALTON_TIMEROFF 0 +#define KEYWAIT_HALTOFF_TIMEROFF 1 +#define KEYWAIT_HALTON_TIMERON 2 + +#define KEYREP_NOEVENT 0 +#define KEYREP_KEYEVENT 1 +#define KEYREP_TIMEREVENT 2 + +# ifdef __cplusplus +} +# endif + +#endif diff --git a/include/fx/libfx/timer.h b/include/fx/libfx/timer.h new file mode 100644 index 0000000..8dab7b3 --- /dev/null +++ b/include/fx/libfx/timer.h @@ -0,0 +1,23 @@ +/*****************************************************************/ +/* */ +/* CASIO fx-9860G SDK Library */ +/* */ +/* File name : timer.h */ +/* */ +/* Copyright (c) 2006 CASIO COMPUTER CO., LTD. */ +/* */ +/*****************************************************************/ +#ifndef __TIMER_H__ +#define __TIMER_H__ + + +// Defines + +#define ID_USER_TIMER1 1 +#define ID_USER_TIMER2 2 +#define ID_USER_TIMER3 3 +#define ID_USER_TIMER4 4 +#define ID_USER_TIMER5 5 + + +#endif diff --git a/include/fx/limits.h b/include/fx/limits.h new file mode 100644 index 0000000..b4f00ea --- /dev/null +++ b/include/fx/limits.h @@ -0,0 +1,35 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = limits.h : */ +/* */ +/* FUNC = this module do the following functions */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ +#ifndef _LIMITS +#define _LIMITS + +#define CHAR_BIT 8 +#define CHAR_MAX 127 +#define CHAR_MIN (-128) +#define SCHAR_MAX 127 +#define SCHAR_MIN (-128) +#define UCHAR_MAX 255 +#define SHRT_MAX 32767 +#define SHRT_MIN (-32768) +#define USHRT_MAX 65535 +#define INT_MAX 2147483647 +#define INT_MIN (-2147483647-1) +#define UINT_MAX 4294967295u +#define LONG_MAX 2147483647 +#define LONG_MIN (-2147483647L-1L) +#define ULONG_MAX 4294967295u + +#endif diff --git a/include/fx/machine.h b/include/fx/machine.h new file mode 100644 index 0000000..d2386d3 --- /dev/null +++ b/include/fx/machine.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------*/ +/* SH C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = machine.h : */ +/* FUNC = */ +/* ; */ +/* */ +/* */ +/* */ +/* CLAS = UNIT ; */ +/* END ; */ +/*****************************************************************/ +#ifndef _MACHINE +#define _MACHINE + +#include +#include + +#endif diff --git a/include/fx/math.h b/include/fx/math.h new file mode 100644 index 0000000..17b43be --- /dev/null +++ b/include/fx/math.h @@ -0,0 +1,111 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = math : */ +/* FUNC = */ +/* ; */ +/* */ +/* */ +/* */ +/* CLAS = UNIT ; */ +/* END ; */ +/*****************************************************************/ +#ifndef _MATH +#define _MATH + +#ifdef __cplusplus +#include +#endif + +#ifndef ERANGE +#define ERANGE 1100 +#endif + +#ifndef EDOM +#define EDOM 1101 +#endif + +#ifndef ENUM +#define ENUM 1208 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern volatile int _errno; +extern const double _HUGE_VAL; +#define HUGE_VAL _HUGE_VAL + +extern double frexp(double, int *); +extern double ldexp(double, int ); +extern double modf(double, double *); +extern double ceil(double); + +#ifdef _SH4 +#ifdef _FPS +#define fabs _builtin_fabsf +#else +#define fabs _builtin_fabs +#endif +#else +#if defined(_SH2E)|defined(_SH3E) +#ifdef _FLT +#define fabs _builtin_fabsf +#else +extern double fabs(double); +#endif +#else +extern double fabs(double); +#endif +#endif + +extern double floor(double); +extern double fmod(double, double); + +extern double acos(double); +extern double asin(double); +extern double atan(double); +extern double atan2(double,double); +extern double cos(double); +extern double sin(double); +extern double tan(double); +extern double cosh(double); +extern double tanh(double); +extern double sinh(double); +extern double exp(double); +extern double log(double); +extern double log10(double); +extern double pow(double,double); + +#ifdef _COMPLEX_ +extern double sqrt(double); +#else +#ifdef _SH4 +#ifdef _FPS +#define sqrt _builtin_sqrtf +#else +#define sqrt _builtin_sqrt +#endif +#else +#ifdef _SH3E +#ifdef _FLT +#define sqrt _builtin_sqrtf +#else +extern double sqrt(double); +#endif +#else +extern double sqrt(double); +#endif +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/fx/mathf.h b/include/fx/mathf.h new file mode 100644 index 0000000..ba1505d --- /dev/null +++ b/include/fx/mathf.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.1 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = mathf */ +/* FUNC = */ +/* ; */ +/* */ +/* */ +/* */ +/* CLAS = UNIT ; */ +/* END ; */ +/*****************************************************************/ +#ifndef _MATHF +#define _MATHF + +#ifdef __cplusplus +extern "C" { +#include +#endif +extern float frexpf(float, int *); +extern float ldexpf(float, int); +extern float modff(float, float *); +extern float ceilf(float); +#if defined(_SH2E)|defined(_SH3E)|defined(_SH4) +#ifdef _FPD +#define fabsf _builtin_fabs +#else +#define fabsf _builtin_fabsf +#endif +#else +extern float fabsf(float); +#endif +extern float floorf(float); +extern float fmodf(float, float); +extern float acosf(float); +extern float asinf(float); +extern float atanf(float); +extern float atan2f(float,float); +extern float cosf(float); +extern float sinf(float); +extern float tanf(float); +extern float coshf(float); +extern float tanhf(float); +extern float sinhf(float); +extern float expf(float); +extern float logf(float); +extern float log10f(float); +extern float powf(float,float); +#if defined(_SH3E)|defined(_SH4) +#ifdef _FPD +#define sqrtf _builtin_sqrt +#else +#define sqrtf _builtin_sqrtf +#endif +#else +extern float sqrtf(float); +#endif +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/fx/mystrbuf b/include/fx/mystrbuf new file mode 100644 index 0000000..f780d4b --- /dev/null +++ b/include/fx/mystrbuf @@ -0,0 +1,53 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd +// +// Embeded C++ Library +// + +//==================================================================== +// File: mystrbuf +// Purpose: Definition of class mystrbuf +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _MYSTRBUF_ +#define _MYSTRBUF_ + +#ifdef _EC2P_GPP +#define _bufbase _base +#define _bufptr _ptr +#define _bufcnt _cnt +// #define _buflen _bufsiz +#define _ioflag1 _flag +#endif + +#include +struct _f_type; +class mystrbuf : public streambuf { +public: + mystrbuf(){_file_Ptr = 0;} + mystrbuf(void *_fp){_Init((_f_type*)_fp);} + virtual ~mystrbuf(){close();} + void *myfptr() const{return _file_Ptr;} + mystrbuf *open(const char *, int); + mystrbuf *close(); +protected: + virtual streambuf *setbuf(char *, streamsize); + virtual pos_type seekoff(off_type, ios_base::seekdir, + ios_base::openmode=(ios_base::openmode)(ios_base::in|ios_base::out)); + virtual pos_type seekpos(pos_type sp, + ios_base::openmode=(ios_base::openmode)(ios_base::in|ios_base::out)); + virtual int sync(); + virtual int showmanyc(){return 0;} + virtual int_type underflow(); + virtual int_type pbackfail(int_type=streambuf::eof); + virtual int_type overflow(int_type=streambuf::eof); +private: + void _Init(_f_type *); + _f_type *_file_Ptr; +#ifdef _EC2P_GPP + long _buflen_wk; +#endif +}; +#endif diff --git a/include/fx/new b/include/fx/new new file mode 100644 index 0000000..6e8c596 --- /dev/null +++ b/include/fx/new @@ -0,0 +1,31 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 6.0 */ +/* Copyright (c) 1992, 2000 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ + +/***********************************************************************/ +/* SPEC; */ +/* NAME = new : */ +/* */ +/* FUNC = Include file for C++ default operator new . */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ + +#ifndef __NEW__ +#define __NEW__ + +#ifdef __embedded_cplusplus + +#include // include Embeded C++ Library Header + +#else + +#include // include ANSI C++ Library Header + +#endif /* ifdef __embedded_cplusplus */ + +#endif /* ifndef __NEW__ */ diff --git a/include/fx/new_ecpp.h b/include/fx/new_ecpp.h new file mode 100644 index 0000000..77f33cb --- /dev/null +++ b/include/fx/new_ecpp.h @@ -0,0 +1,41 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd + +// +// Dynamic memory management +// Embeded C++ Library Header +// + +//==================================================================== +// File: new +// Purpose: Definition of class new +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _NEW_ +#define _NEW_ + +#include + +// Storage allocation and deallocation +void *operator new(size_t); +void *operator new[] (size_t); +void *operator new(size_t,void *); +void *operator new[](size_t,void *); + +void operator delete(void *); +void operator delete[](void *); +// void operator delete(void *, void *); // Not implemented +// void operator delete[](void *, void *); // Not implemented + +// Type new_handler +typedef void (*new_handler)(); + +// set_new_handler +new_handler set_new_handler(new_handler new_P); + +// new_handler +extern new_handler _ec2p_new_handler; + +#endif diff --git a/include/fx/new_edg.h b/include/fx/new_edg.h new file mode 100644 index 0000000..4bf1a6d --- /dev/null +++ b/include/fx/new_edg.h @@ -0,0 +1,122 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 6.0 */ +/* Copyright (c) 1992, 2000 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = new_edg.h : */ +/* */ +/* FUNC = Include file for C++ default operator new . */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ + +#ifndef __NEW_H +#define __NEW_H + +#ifndef _STDDEF +#include +#endif /* ifndef _STDDEF */ +#ifndef _EXCEPTION_H +#include +#endif /* _EXCEPTION_H */ + +#ifndef __EDG_STD_NAMESPACE +/* If not already defined, define a macro that expands to the namespace + containing the standard library. */ +#ifdef __EDG_RUNTIME_USES_NAMESPACES +#define __EDG_STD_NAMESPACE std +#else /* ifndef __EDG_RUNTIME_USES_NAMESPACES */ +#define __EDG_STD_NAMESPACE /* nothing */ +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ +#endif /* ifdef __EDG_STD_NAMESPACE */ + + +#ifdef __EDG_RUNTIME_USES_NAMESPACES +namespace std { +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ + +/* This lets users disable the EDG supplied exception classes. */ +#ifndef __NO_EDG_EXCEPTION_CLASSES + + class bad_alloc : public exception { + public: + bad_alloc() throw(); + bad_alloc(const bad_alloc&) throw(); + bad_alloc& operator=(const bad_alloc&) throw(); + virtual ~bad_alloc() throw(); + virtual const char* what() const throw(); + }; + +#endif /* ifndef __NO_EDG_EXCEPTION_CLASSES */ + + typedef void (*new_handler)(); + new_handler set_new_handler(new_handler); + struct nothrow_t { }; + // Declaration of object nothrow to permit the use of the placement new + // syntax: new (nothrow) T; + const nothrow_t nothrow = {}; + +#ifdef __EDG_RUNTIME_USES_NAMESPACES +} /* namespace std */ + +#ifdef __EDG_IMPLICIT_USING_STD +/* Implicitly include a using directive for the STD namespace when this + preprocessing flag is TRUE. */ +using namespace std; +#endif /* ifdef __EDG_IMPLICIT_USING_STD */ + +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ + +/* Normal operator new. */ +void *operator new(size_t) throw(__EDG_STD_NAMESPACE::bad_alloc); + +/* Normal operator delete. */ +void operator delete(void*) throw (); + +/* Nothrow version of operator new. */ +void *operator new(size_t, const __EDG_STD_NAMESPACE::nothrow_t&) throw(); + +/* Nothrow version of operator delete. */ +void operator delete(void*, const __EDG_STD_NAMESPACE::nothrow_t&) throw(); + +/* Placement new. */ +void *operator new(size_t, void*) throw(); + +/* Placement delete. */ +#ifdef __PLACEMENT_DELETE +void operator delete(void*, void*) throw(); +#endif /* ifdef __PLACEMENT_DELETE */ + +#ifdef __ARRAY_OPERATORS + +/* Array new. */ +void *operator new[](size_t) throw(__EDG_STD_NAMESPACE::bad_alloc); + +/* Array delete. */ +void operator delete[](void*) throw (); + +/* Placement array new. */ +void *operator new[](size_t, void*) throw(); + +/* Placement array delete. */ +#ifdef __PLACEMENT_DELETE +void operator delete[](void*, void*) throw(); +#endif /* ifdef __PLACEMENT_DELETE */ + +/* Nothrow version of array new. */ +void *operator new[](size_t, + const __EDG_STD_NAMESPACE::nothrow_t&) throw(); + +/* Nothrow version of array delete. */ +void operator delete[](void*, + const __EDG_STD_NAMESPACE::nothrow_t&) throw(); +#endif /* __ARRAY_OPERATORS */ + +// EC++ use new_handler +extern __EDG_STD_NAMESPACE::new_handler _ec2p_new_handler; + +#endif /* ifndef __NEW_H */ diff --git a/include/fx/ostream b/include/fx/ostream new file mode 100644 index 0000000..e81af01 --- /dev/null +++ b/include/fx/ostream @@ -0,0 +1,87 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd + +//==================================================================== +// File: ostream +// Purpose: Definition of class ostream +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _OSTREAM_ +#define _OSTREAM_ + +#include + +class ostream : public ios { +public: + // Types (inherited from ios): + // typedef INT_T int_type; + // typedef POS_T pos_type; + // typedef OFF_T off_type; + + ostream(streambuf *sbptr) : ios(sbptr){} + virtual ~ostream(){} + class sentry; // Prefix/Suffix + ostream& operator <<(ostream& (*pf)(ostream&)){ + return (*pf)(*this); } + ostream& operator <<(ios& (*pf)(ios&)){ + (*pf)(*(ios*)this); return *this; } + ostream& operator<< (ios_base& (*pf)(ios_base&)){ + (*pf)(*(ios*)this); return *this; } + ostream & operator <<(bool n){ + *this<<(int)n; return *this; } + ostream & operator <<(short); + ostream & operator <<(unsigned short); + ostream & operator <<(int); + ostream & operator <<(unsigned int); + ostream & operator <<(long); + ostream & operator <<(unsigned long); + ostream & operator <<(float); + ostream & operator <<(double); + ostream & operator <<(long double); + ostream & operator <<(void *); + ostream & operator <<(streambuf *); + ostream & put(char); + ostream & write(const char *, streamsize); + ostream & write(const signed char *, streamsize); + ostream & write(const unsigned char *, streamsize); + ostream & flush(); + pos_type tellp(); + ostream& seekp( pos_type ); + ostream& seekp( off_type , ios_base::seekdir ); + + int _ec2p_strput(const char*); +private: + void _ec2p_IntPrint(const char*, short); + void _ec2p_FloatPrint(const char*, short); + void _ec2p_DataPut(const char*, int, int, int, int); + void _ec2p_int_fmtparam(const char*, char*); + void _ec2p_flt_fmtparam(const char*, char*); +}; + +// Class ostream::sentry +class ostream::sentry { +public: + sentry(ostream& os); + ~sentry(); + operator bool() { return ok_; } +private: + bool ok_; + ostream* __ec2p_os; +}; + +// character inserters +ostream& operator<<(ostream&, char); +ostream& operator<<(ostream&, const char*); +// signed and unsigned +ostream& operator<<(ostream&, signed char); +ostream& operator<<(ostream&, unsigned char); +// signed and unsigned +ostream& operator<<(ostream&, const signed char*); +ostream& operator<<(ostream&, const unsigned char*); + +ostream & endl( ostream & ); +ostream & ends( ostream & ); +ostream & flush( ostream & ); +#endif diff --git a/include/fx/setjmp.h b/include/fx/setjmp.h new file mode 100644 index 0000000..fa770db --- /dev/null +++ b/include/fx/setjmp.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = setjmp.h : ; */ +/* */ +/* FUNC = this module do the following functions ; */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ +#ifndef _SETJMP +#define _SETJMP + +#if defined(_SH2E)|defined(_SH3E)||defined(_SH4) +typedef int jmp_buf[38]; +#else +typedef int jmp_buf[20]; +#endif +#ifdef _SH4 +typedef int jmp_buf_a[54]; +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern int setjmp(jmp_buf); +extern void longjmp(jmp_buf, int); +#ifdef _SH4 +extern int setjmp_a(jmp_buf); +extern void longjmp_a(jmp_buf, int); +#endif + +extern volatile int _errno; + +#ifdef __cplusplus +} +#endif + +#ifndef SEQERR +#define SEQERR 1108 +#endif + +#endif diff --git a/include/fx/smachine.h b/include/fx/smachine.h new file mode 100644 index 0000000..03c7ae2 --- /dev/null +++ b/include/fx/smachine.h @@ -0,0 +1,28 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 3.0 */ +/* Copyright (c) 1992,1995 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = smachine.h : */ +/* FUNC = ; */ +/* CLAS = UNIT ; */ +/* END ; */ +/*****************************************************************/ +#ifndef _SMACHINE +#define _SMACHINE + +#ifdef __cplusplus +#include +#endif + +#define set_imask(mask) _builtin_set_imask(mask) +#define get_imask() _builtin_get_imask() +#define set_cr(cr) _builtin_set_cr(cr) +#define get_cr() _builtin_get_cr() +#define set_vbr(base) _builtin_set_vbr(base) +#define get_vbr() _builtin_get_vbr() +#define sleep() _builtin_sleep() + +#endif diff --git a/include/fx/stdarg.h b/include/fx/stdarg.h new file mode 100644 index 0000000..48dfd16 --- /dev/null +++ b/include/fx/stdarg.h @@ -0,0 +1,36 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = stdarg : */ +/* FUNC = this module do the following finctions ; */ +/* */ +/* (1) initialize parameter pointer */ +/* (2) set parameter pointer to next parameter */ +/* */ +/* */ +/* END ; */ +/*****************************************************************/ +#ifndef _STDARG +#define _STDARG + +typedef char *va_list ; + +#define va_start(ap,param) (void)((ap)=(int)\ +((char *) &(param)+sizeof(param))%4u?\ +(char *) &(param)+sizeof(param)+(4u-(sizeof(param)%4u)):\ +(char *) &(param)+sizeof(param)) + +#define va_arg(ap,type) (*((ap)=((int)((ap)+sizeof(type))%4u?\ +(ap)+sizeof(type)+(4u-(sizeof(type)%4u)):\ +(ap)+sizeof(type)),\ +(type *)((int)((ap)-sizeof(type))%4u?\ +(ap)-sizeof(type)-(4u-(sizeof(type)%4u)):\ +(ap)-sizeof(type)))) + +#define va_end(ap) + +#endif diff --git a/include/fx/stddef.h b/include/fx/stddef.h new file mode 100644 index 0000000..f453ce4 --- /dev/null +++ b/include/fx/stddef.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = stddef : */ +/* */ +/* FUNC = this module do the following functions */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ +#ifndef _STDDEF +#define _STDDEF + +#ifndef _PTRDIFF_T +#define _PTRDIFF_T +typedef int ptrdiff_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned long size_t; +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL (0) +#else +#define NULL ((void *)0) +#endif +#endif + +#ifndef offsetof +#define offsetof(type,id) ((char *)(&(((type *)NULL)->id)) - \ + (char *)((type *)NULL)) +#endif + +#ifndef errno +#define errno _errno +#endif + +#endif diff --git a/include/fx/stdexcept.h b/include/fx/stdexcept.h new file mode 100644 index 0000000..6fe3879 --- /dev/null +++ b/include/fx/stdexcept.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = stdexcept.h : */ +/* */ +/* FUNC = Include file for exception handling (see 19.1.1) */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ + +#ifndef _STDEXCEPT_H +#define _STDEXCEPT_H + +/* This lets users disable the EDG supplied exception classes. */ +#ifndef __NO_EDG_EXCEPTION_CLASSES + +#ifdef __EDG_RUNTIME_USES_NAMESPACES +namespace std { +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ + class exception { + public: + exception() throw(); + exception& operator=(const exception&) throw(); + virtual ~exception() throw(); + virtual const char* what() const throw(); + }; +#ifdef __EDG_RUNTIME_USES_NAMESPACES +} /* namespace std */ + +#ifdef __EDG_IMPLICIT_USING_STD +/* Implicitly include a using directive for the STD namespace when this + preprocessing flag is TRUE. */ +using namespace std; +#endif /* ifdef __EDG_IMPLICIT_USING_STD */ + +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ + +#endif /* ifndef __NO_EDG_EXCEPTION_CLASSES */ + +#endif /* _STDEXCEPT_H */ + diff --git a/include/fx/stdio.h b/include/fx/stdio.h new file mode 100644 index 0000000..4c87959 --- /dev/null +++ b/include/fx/stdio.h @@ -0,0 +1,146 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = stdio : header file for standard I/O function ; */ +/* */ +/* FUNC = this header file do the following functions; */ +/* (1) file entry table define; */ +/* (2) I/O macro define; */ +/* (3) symbol define; */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ +#ifndef _STDIO +#define _STDIO + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define _NFILE 20 +#define SYS_OPEN 20 +extern struct _iobuf { + unsigned char *_bufptr; /* buffer pointer */ + long _bufcnt; /* buffer count */ + unsigned char *_bufbase; /* buffer base pointer */ + long _buflen; /* buffer length */ + char _ioflag1; /* I/O control flag 1 */ + char _ioflag2; /* I/O control flag 2 */ + char _iofd; +} _iob[_NFILE]; + +extern volatile int _errno; + +typedef struct _iobuf FILE; /* define FILE of file-stream */ + + /* define function of prototype */ +extern int _fillbuf(FILE*); +extern int _flshbuf(int,FILE*); +extern void _putcsub(FILE*); +extern int fclose(FILE *); +extern int fflush(FILE *); +extern FILE *fopen(const char *, const char *); +extern FILE *freopen(const char *, const char *, FILE *); +extern void setbuf(FILE *, char *); +extern int setvbuf(FILE *, char *, int, size_t); +extern int fprintf(FILE *, const char *, ...); +extern int fscanf(FILE *, const char *, ...); +extern int printf(const char * ,...); +extern int scanf(const char * ,...); +extern int sprintf(char *, const char * ,...); +extern int sscanf(const char *, const char * ,...); +extern int vfprintf(FILE *, const char *, char *); +extern int vprintf(const char *, char *); +extern int vsprintf(char *, const char *, char *); +extern int fgetc(FILE *); +extern char *fgets(char *, int, FILE *); +extern int fputc(int , FILE *); +extern int fputs(const char *, FILE *); +extern int getc(FILE *); +extern int getchar(void); +extern char *gets(char *); +extern int putc(int, FILE *); +extern int putchar(int); +extern int puts(const char *); +extern int ungetc(int, FILE *); +extern size_t fread(void *, size_t, size_t, FILE *); +extern size_t fwrite(const void *, size_t, size_t, FILE *); +extern int fseek(FILE *, long int, int); +extern long ftell(FILE *); +extern void rewind(FILE *); +extern void clearerr(FILE *); +extern int feof(FILE *); +extern int ferror(FILE *); +extern void perror(const char *); +#ifdef __cplusplus +} +#endif + +#define _IOFBF 1 /* define _IOFBF of full buffering */ +#define _IOLBF 2 /* define _IOLBF of line buffering */ +#define _IONBF 3 /* define _IONBF of non buffering */ + +#define SEEK_SET 0 /* allocate top position */ +#define SEEK_CUR 1 /* allocate current position */ +#define SEEK_END 2 /* allocate bottom position */ + +#define BUFSIZ 512 /* default buffer size */ + + /* error number define */ +#ifndef EBADF +#define EBADF 1302 /* I/O operation error */ +#endif + +#ifndef PTRERR +#define PTRERR 1106 /* fp null */ +#endif + +#ifndef ECSPEC +#define ECSPEC 1304 /* format err */ +#endif + +#ifndef NOTOPN +#define NOTOPN 1300 /* file not open */ +#endif + + /* I/O flags for _ioflag1 */ +#define _IOREAD 1 /* only read or update read */ +#define _IOWRITE 2 /* only write or update write */ +#define _IORW 4 /* update file */ +#define _IOUNBUF 8 /* unbffering I/O */ +#define _IOBGBUF 16 /* automatic buffer allocate */ +#define _IOEOF 32 /* end of file */ +#define _IOERR 64 /* I/O error */ +#define _IOBIN 128 /* binaly file */ +#define _UNGTC 1 /* ungetc issued (_ioflag2) */ +#define _IOLINBUF 2 /* line buffering */ + +#define EOF (-1) +#define _EOL (0X0A) /* end of line */ + +#define stdin (&_iob[0]) /* standard input file */ +#define stdout (&_iob[1]) /* standard output file */ +#define stderr (&_iob[2]) /* standard error output file */ + +#define getc(fp) ((fp)->_ioflag2&=~_UNGTC,(((fp)->_ioflag1&(_IORW|_IOWRITE))==\ + (_IORW|_IOWRITE))&&(fp)->_bufcnt==(fp)->_buflen?(_fillbuf(fp)):\ + --(fp)->_bufcnt>=0 ?((int)*(fp)->_bufptr++):_fillbuf(fp)) +#define putc(x,fp) (((((fp)->_ioflag1&_IORW)!=0&&((fp)->_ioflag1&_IOWRITE)==0)\ + ?_putcsub(fp):(void)0),((((fp)->_bufcnt==0)||((((fp)->_ioflag2&_IOLINBUF)!=0)\ + && ((fp)->_bufbase!=(fp)->_bufptr)&&(*((fp)->_bufptr-1)==_EOL)))\ + ?_flshbuf((int)(x),(fp)):\ + (((fp)->_bufcnt--),((int)(*(fp)->_bufptr++=(unsigned char)(x)))))) +#define getchar() getc(stdin) +#define putchar(x) putc(x,stdout) +#define feof(fp) ((fp)->_ioflag1&_IOEOF) +#define ferror(fp) ((fp)->_ioflag1&_IOERR) +#define clearerr(fp) ((void)((fp)->_ioflag1&=~(_IOEOF|_IOERR))) + +#endif diff --git a/include/fx/stdlib.h b/include/fx/stdlib.h new file mode 100644 index 0000000..5facbd0 --- /dev/null +++ b/include/fx/stdlib.h @@ -0,0 +1,127 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = stdlib : */ +/* FUNC = */ +/* ; */ +/* */ +/* */ +/* */ +/* CLAS = UNIT ; */ +/* END ; */ +/*****************************************************************/ +#ifndef _STDLIB +#define _STDLIB + +#include + +struct _DIV_T_TAG { /* tag define for div_t */ + int quot; /* quotient */ + int rem; /* remainder */ +}; /* */ +struct _LDIV_T_TAG { /* tag define for ldiv_t */ + long quot; /* quotient */ + long rem; /* remainder */ +}; /* */ + +typedef struct _DIV_T_TAG div_t ; +/* int quot; int rem */ +typedef struct _LDIV_T_TAG ldiv_t ; +/* long quot; long rem; */ + +#ifndef RAND_MAX +#define RAND_MAX 32767 +#endif + +#ifndef ERANGE +#define ERANGE 1100 +#endif + +#ifndef EDOM +#define EDOM 1101 +#endif + +#ifndef EDIV +#define EDIV 1102 +#endif + +#ifndef ESTRN +#define ESTRN 1104 +#endif + +#ifndef ECBASE +#define ECBASE 1200 +#endif + +#ifndef ETLN +#define ETLN 1202 +#endif + +#ifndef EEXP +#define EEXP 1204 +#endif + +#ifndef EEXPN +#define EEXPN 1206 +#endif + +#ifndef EFLOATO +#define EFLOATO 1210 +#endif + +#ifndef EFLOATU +#define EFLOATU 1220 +#endif + +#ifndef EDBLO +#define EDBLO 1250 +#endif + +#ifndef EDBLU +#define EDBLU 1260 +#endif + +#ifndef ELDBLO +#define ELDBLO 1270 +#endif + +#ifndef ELDBLU +#define ELDBLU 1280 +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern volatile int _errno; +extern const double _HUGE_VAL; +#define HUGE_VAL _HUGE_VAL + +extern double atof(const char *) ; +extern int atoi(const char *) ; +extern long int atol(const char *) ; +extern double strtod(const char *, char **) ; +extern long int strtol(const char *, char **, int); +extern int rand(void) ; +extern void srand(unsigned int); +extern void *calloc(size_t, size_t); +extern void free(void *) ; +extern void *malloc(size_t); +extern void *realloc(void *, size_t) ; +extern void *bsearch(const void *, const void *, size_t, size_t, + int(*)(const void*,const void*) ) ; +extern void qsort(void *, size_t, size_t, + int(*)(const void*,const void*) ); + +extern int abs(int); +extern div_t div(int, int); +extern long int labs(long int); +extern ldiv_t ldiv(long int, long int); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/fx/streambuf b/include/fx/streambuf new file mode 100644 index 0000000..9c631bd --- /dev/null +++ b/include/fx/streambuf @@ -0,0 +1,97 @@ +//Embedded C++ Library +//Copyright (c) Hitachi,Ltd. 1997 +//Licensed material of Hitachi,Ltd +// +// Embeded C++ Library +// + +//==================================================================== +// File: streambuf +// Purpose: Definition of class streambuf +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _STREAMBUF_ +#define _STREAMBUF_ + +#include +class streambuf { +public: + virtual ~streambuf(){} + streambuf *pubsetbuf(char *cptr, streamsize nnum){ + return setbuf(cptr, nnum); + } + pos_type pubseekoff(off_type off,ios_base::seekdir way, + ios_base::openmode which + =(ios_base::openmode) + (ios_base::in|ios_base::out)){ + return seekoff(off, way, which); + } + pos_type pubseekpos(pos_type sp, + ios_base::openmode which + =(ios_base::openmode) + (ios_base::in|ios_base::out)){ + return seekpos(sp, which); + } + int pubsync(){ + return sync(); + } + streamsize in_avail(){ + return ((gptr()!=0)&&(gptr() +// + +//==================================================================== +// File: string +// Purpose: Definition of class string +// Create: 1997.09.20 Rev. 1.0 +//==================================================================== + +#ifndef _STRING_ +#define _STRING_ + +#include +#include + + +#include +#include +#include + +class string; + +string operator + (const string &lhs,const string &rhs); +string operator + (const char *lhs,const string &rhs); +string operator + (char lhs,const string &rhs); +string operator + (const string &lhs,const char *rhs); +string operator + (const string &lhs,char rhs); + +bool operator == (const string &lhs,const string &rhs); +bool operator == (const char *lhs,const string &rhs); +bool operator == (const string &lhs,const char *rhs); +bool operator != (const string &lhs,const string &rhs); +bool operator != (const char *lhs,const string &rhs); +bool operator != (const string &lhs,const char *rhs); + +bool operator < (const string &lhs,const string &rhs); +bool operator < (const char *lhs,const string &rhs); +bool operator < (const string &lhs,const char *rhs); +bool operator > (const string &lhs,const string &rhs); +bool operator > (const char *lhs,const string &rhs); +bool operator > (const string &lhs,const char *rhs); + +bool operator <= (const string &lhs,const string &rhs); +bool operator <= (const char *lhs,const string &rhs); +bool operator <= (const string &lhs,const char *rhs); +bool operator >= (const string &lhs,const string &rhs); +bool operator >= (const char *lhs,const string &rhs); +bool operator >= (const string &lhs,const char *rhs); + +void swap(string &lhs, string &rhs); + +istream & operator >> (istream &is,string &str); +ostream & operator << (ostream &os,const string &str); +istream & getline (istream &is,string &str,char delim); +istream & getline (istream &is,string &str); + +class string { +public: + typedef char* iterator; + typedef const char* const_iterator; + + static const size_t npos; + + string(void) { + _ec2p_getmem(NULL, 0, NULL, false); + } + string(const string& str, size_t pos = 0, size_t n = npos) { + size_t wkpos = pos > str.size() ? str.size() : pos; + size_t rlen = (n > (str.size() - wkpos)) ? str.size() - wkpos : n; + _ec2p_getmem(&str.c_str()[wkpos], rlen, NULL, false); + } + string(const char* s, size_t n) { + _ec2p_getmem(s, n, NULL, false); + } + string(const char* s) { + _ec2p_getmem(s, strlen(s), NULL, false); + } + string(size_t n, char c) { + _ec2p_getmem(NULL, n, c, true); + } +#ifdef _EC2P_GPP + string(char c) { + _ec2p_getmem(NULL, 1, c, true); + } +#endif + ~string() { + if (s_ptr != NULL) { + delete [] s_ptr; + s_ptr = NULL; + } + } + string& operator=(const string& str); + string& operator=(const char* s); + string& operator=(char c); + + iterator begin() { return((iterator)s_ptr); } + const_iterator begin() const { return((const_iterator)s_ptr); } + iterator end() { return((iterator)&s_ptr[s_len]); } + const_iterator end() const { return((const_iterator)&s_ptr[s_len]);} + + size_t size() const { return(s_len); } + size_t length() const { return(s_len); } + size_t max_size() const { return(s_res); } + void resize(size_t n, char c); + void resize(size_t n); + size_t capacity() const { return(s_res); } + void reserve(size_t res_arg = 0); + void clear(); + bool empty() const { return( s_len == 0 ? true : false ); } + + const char & operator[](size_t pos) const; + char & operator[](size_t pos); + const char & at(size_t n) const; + char & at(size_t n); + + string& operator+=(const string& str); + string& operator+=(const char* s); + string& operator+=(char c); + string& append(const string& str); + string& append(const string& str, size_t pos, size_t n); + string& append(const char* s, size_t n); + string& append(const char* s); + string& append(size_t n, char c); + + string& assign(const string&); + string& assign(const string& str, size_t pos, size_t n); + string& assign(const char* s, size_t n); + string& assign(const char* s); + string& assign(size_t n, char c); + + string& insert(size_t pos1, const string& str); + string& insert(size_t pos1, const string& str, + size_t pos2, size_t n); + string& insert(size_t pos, const char* s, size_t n); + string& insert(size_t pos, const char* s); + string& insert(size_t pos, size_t n, char c); + iterator insert(iterator p, char c = char()); + void insert(iterator p, size_t n, char c); + + string& erase(size_t pos = 0, size_t n = npos); + iterator erase(iterator position); + iterator erase(iterator first, iterator last); + + string& replace(size_t pos1, size_t n1, const string& str); + string& replace(size_t pos1, size_t n1, const string& str, + size_t pos2, size_t n2); + string& replace(size_t pos, size_t n1, const char* s, size_t n2); + string& replace(size_t pos, size_t n1, const char* s); + string& replace(size_t pos, size_t n1, size_t n2, char c); + string& replace(iterator i1, iterator i2, const string& str); + string& replace(iterator i1, iterator i2, const char* s, size_t n); + string& replace(iterator i1, iterator i2, const char* s); + string& replace(iterator i1, iterator i2, size_t n, char c); + + size_t copy(char* s, size_t n, size_t pos = 0) const; + void swap(string&); + const char* c_str() const { return(s_ptr); } + const char* data() const { + if (s_len == 0) { + s_ptr[0] = '\0'; + } + return(s_ptr); + } + + size_t find (const string& str, size_t pos = 0) const; + size_t find (const char* s, size_t pos, size_t n) const; + size_t find (const char* s, size_t pos = 0) const; + size_t find (char c, size_t pos = 0) const; + size_t rfind(const string& str, size_t pos = npos) const; + size_t rfind(const char* s, size_t pos, size_t n) const; + size_t rfind(const char* s, size_t pos = npos) const; + size_t rfind(char c, size_t pos = npos) const; + + size_t find_first_of(const string& str, size_t pos = 0) const; + size_t find_first_of(const char* s, size_t pos, size_t n) const; + size_t find_first_of(const char* s, size_t pos = 0) const; + size_t find_first_of(char c, size_t pos = 0) const; + size_t find_last_of (const string& str, size_t pos = npos) const; + size_t find_last_of (const char* s, size_t pos, size_t n) const; + size_t find_last_of (const char* s, size_t pos = npos) const; + size_t find_last_of (char c, size_t pos = npos) const; + + size_t find_first_not_of(const string& str, size_t pos = 0) const; + size_t find_first_not_of(const char* s, size_t pos, size_t n) const; + size_t find_first_not_of(const char* s, size_t pos = 0) const; + size_t find_first_not_of(char c, size_t pos = 0) const; + size_t find_last_not_of (const string& str, size_t pos = npos) const; + size_t find_last_not_of (const char* s, size_t pos, size_t n) const; + size_t find_last_not_of (const char* s, size_t pos = npos) const; + size_t find_last_not_of (char c, size_t pos = npos) const; + + string substr(size_t pos = 0, size_t n = npos) const; + int compare(const string& str) const; + int compare(size_t pos1, size_t n1, const string& str) const; + int compare(size_t pos1, size_t n1, const string& str, + size_t pos2, size_t n2) const; + int compare(const char* s) const; + int compare(size_t pos1, size_t n1, + const char* s, size_t n2 = npos) const; +private: + char *s_ptr; + size_t s_len, s_res; + void _ec2p_getmem(const char *s, size_t n, char c, bool flg=false); + char *_ec2p_extmem(size_t n); + static const char _ec2p_at; + }; +#endif diff --git a/include/fx/string.h b/include/fx/string.h new file mode 100644 index 0000000..6ce197f --- /dev/null +++ b/include/fx/string.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = string : */ +/* FUNC = */ +/* ; */ +/* */ +/* */ +/* */ +/* CLAS = UNIT ; */ +/* LINK = */ +/* NOTE = */ +/* ; */ +/* */ +/* END ; */ +/*****************************************************************/ +#ifndef _STRING +#define _STRING + +#include + +#ifdef __cplusplus +extern "C" { +#include +#endif +extern void *memcpy(void *, const void *, size_t); +extern void *memmove(void *, const void *, size_t); +extern char *strcpy(char *, const char *); +extern char *strncpy(char *, const char *, size_t); +extern char *strcat(char *, const char *); +extern char *strncat(char *, const char *,size_t); +extern int memcmp(const void *, const void *,size_t); +extern int strcmp(const char *, const char *); +extern int strncmp(const char *, const char *, size_t); +extern void *memchr(const void *, int, size_t); +extern char *strchr(const char *, int); +extern size_t strcspn(const char *, const char *); +extern char *strpbrk(const char *, const char *); +extern char *strrchr(const char *, int); +extern size_t strspn(const char *, const char *); +extern char *strstr(const char *, const char *); +extern char *strtok(char *, const char *); +extern void *memset(void *, int, size_t); +extern char *strerror(int); +extern size_t strlen(const char *); +#ifdef __cplusplus +} +#endif + +#define strcpy(s1,s2) _builtin_strcpy(s1,s2) +#define strcmp(s1,s2) _builtin_strcmp(s1,s2) + +#endif diff --git a/include/fx/typeinfo.h b/include/fx/typeinfo.h new file mode 100644 index 0000000..adafb5b --- /dev/null +++ b/include/fx/typeinfo.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 1.0 */ +/* Copyright (c) 1992 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/***********************************************************************/ +/* SPEC; */ +/* NAME = typeinfo.h : */ +/* */ +/* FUNC = Include file for type information (18.5.1) */ +/* */ +/* CLAS = UNIT; */ +/* */ +/* END; */ +/***********************************************************************/ + +#ifndef _TYPEINFO_H +#define _TYPEINFO_H + +#include + +#ifdef __EDG_RUNTIME_USES_NAMESPACES +namespace std { +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ + + /* + If bool is not supported, use a typedef for bool. + */ + #ifdef _BOOL + typedef bool __bool; + #else /* ifndef _BOOL */ + typedef int __bool; + #endif /* ifdef _BOOL */ + +/* The following pragma is used so that the compiler knows that this definition + of type_info is the one that corresponds to the type returned by typeid. */ +#pragma define_type_info + class type_info { + public: + virtual ~type_info(); + __bool operator==(const type_info&) const; + __bool operator!=(const type_info&) const; + __bool before(const type_info&) const; + const char* name() const; + private: + type_info& operator=(const type_info&); // Not actually defined + protected: + // Protected instead of private to suppress the "no accessible + // constructor" warning + type_info(const type_info&); // Not actually defined + }; + + class bad_cast : public exception { + public: + bad_cast() throw(); + bad_cast(const bad_cast&) throw(); + bad_cast& operator=(const bad_cast&) throw(); + virtual ~bad_cast() throw(); + virtual const char* what() const throw(); + }; + + class bad_typeid : public exception { + public: + bad_typeid() throw(); + bad_typeid(const bad_typeid&) throw(); + bad_typeid& operator=(const bad_typeid&) throw(); + virtual ~bad_typeid() throw(); + virtual const char* what() const throw(); + }; + +#ifdef __EDG_RUNTIME_USES_NAMESPACES +} /* namespace std */ + +#ifdef __EDG_IMPLICIT_USING_STD +/* Implicitly include a using directive for the STD namespace when this + preprocessing flag is TRUE. */ +using namespace std; +#endif /* ifdef __EDG_IMPLICIT_USING_STD */ + +#endif /* ifdef __EDG_RUNTIME_USES_NAMESPACES */ + +#endif /* _TYPEINFO_H */ diff --git a/include/fx/umachine.h b/include/fx/umachine.h new file mode 100644 index 0000000..56b3be2 --- /dev/null +++ b/include/fx/umachine.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------*/ +/* SH SERIES C Compiler Ver. 3.0 */ +/* Copyright (c) 1992, 1995 Hitachi,Ltd. */ +/* Licensed material of Hitachi,Ltd. */ +/*------------------------------------------------------*/ +/*****************************************************************/ +/* SPEC ; */ +/* NAME = umachine.h : */ +/* FUNC = ; */ +/* CLAS = UNIT ; */ +/* END ; */ +/*****************************************************************/ +#ifndef _UMACHINE +#define _UMACHINE + +#ifdef __cplusplus +#include +#endif + +#define set_gbr(base) _builtin_set_gbr(base) +#define get_gbr() _builtin_get_gbr() +#define gbr_read_byte(offset) _builtin_gbr_read_byte(offset) +#define gbr_read_word(offset) _builtin_gbr_read_word(offset) +#define gbr_read_long(offset) _builtin_gbr_read_long(offset) +#define gbr_write_byte(offset,data) _builtin_gbr_write_byte(offset,data) +#define gbr_write_word(offset,data) _builtin_gbr_write_word(offset,data) +#define gbr_write_long(offset,data) _builtin_gbr_write_long(offset,data) +#define gbr_and_byte(offset,mask) _builtin_gbr_and_byte(offset,mask) +#define gbr_or_byte(offset,mask) _builtin_gbr_or_byte(offset,mask) +#define gbr_xor_byte(offset,mask) _builtin_gbr_xor_byte(offset,mask) +#define gbr_tst_byte(offset,mask) _builtin_gbr_tst_byte(offset,mask) +#define tas(addr) _builtin_tas(addr) +#define trapa(trap_no) _builtin_trapa(trap_no) +#define macw(ptr1, ptr2, count) _builtin_macw(ptr1, ptr2, count) +#define macwl(ptr1, ptr2, count, mask) _builtin_macwl(ptr1, ptr2, count, mask) +#define macl(ptr1, ptr2, count) _builtin_macl(ptr1, ptr2, count) +#define macll(ptr1, ptr2, count, mask) _builtin_macll(ptr1, ptr2, count, mask) +#define trapa_svc _builtin_trapa_svc +#define prefetch _builtin_prefetch +#define set_fpscr(cr) _builtin_set_fpscr(cr) +#define get_fpscr() _builtin_get_fpscr() +#define fipr(vec1, vec2) _builtin_fipr(vec1, vec2) +#define ftrv(vec1, vec2) _builtin_ftrv(vec1, vec2) +#define ftrvadd(vec1, vec2, vec3) _builtin_ftrvadd(vec1, vec2, vec3) +#define ftrvsub(vec1, vec2, vec3) _builtin_ftrvsub(vec1, vec2, vec3) +#define mtrx4mul(mx1, mx2) _builtin_mtrx4mul(mx1, mx2) +#define mtrx4muladd(mx1, mx2, mx3) _builtin_mtrx4muladd(mx1, mx2, mx3) +#define mtrx4mulsub(mx1, mx2, mx3) _builtin_mtrx4mulsub(mx1, mx2, mx3) +#define ld_ext(mx) _builtin_ld_ext(mx) +#define st_ext(mx) _builtin_st_ext(mx) +#define add4(vec1, vec2, vec3) _builtin_add4(vec1, vec2, vec3) +#define sub4(vec1, vec2, vec3) _builtin_sub4(vec1, vec2, vec3) +#define trace(tv) _builtin_trace(tv) + +#endif diff --git a/memory.h b/include/memory.h similarity index 100% rename from memory.h rename to include/memory.h diff --git a/prototypes.h b/include/prototypes.h similarity index 100% rename from prototypes.h rename to include/prototypes.h diff --git a/setjmp.h b/include/setjmp.h similarity index 100% rename from setjmp.h rename to include/setjmp.h diff --git a/stdafx.h b/include/stdafx.h similarity index 100% rename from stdafx.h rename to include/stdafx.h diff --git a/syscalls.h b/include/syscalls.h similarity index 100% rename from syscalls.h rename to include/syscalls.h diff --git a/tex/TeX.h b/include/tex/TeX.h similarity index 98% rename from tex/TeX.h rename to include/tex/TeX.h index ae3b02a..b99b7ee 100644 --- a/tex/TeX.h +++ b/include/tex/TeX.h @@ -15,7 +15,7 @@ // Additional headers inclusion. #include "libText.h" - #include "fxlib.h" + #include "libfx.h" #include "debug.h" // Symbols used in program. diff --git a/tex/debug.h b/include/tex/debug.h similarity index 89% rename from tex/debug.h rename to include/tex/debug.h index c175a6f..396b204 100644 --- a/tex/debug.h +++ b/include/tex/debug.h @@ -1,7 +1,7 @@ #include #include #include -#include "fxlib.h" +#include "libfx.h" #define DEBUG 0 diff --git a/tex/libText.h b/include/tex/libText.h similarity index 100% rename from tex/libText.h rename to include/tex/libText.h diff --git a/lib/libfx.a b/lib/libfx.a new file mode 100644 index 0000000..5ef92aa Binary files /dev/null and b/lib/libfx.a differ diff --git a/misc.cpp.000 b/misc.cpp.000 deleted file mode 100644 index 21de0b1..0000000 --- a/misc.cpp.000 +++ /dev/null @@ -1,271 +0,0 @@ -#include "stdafx.h" -#include "defs.h" -#include - -void -new_string(char *s) -{ - save(); - p1 = alloc(); - p1->k = STR; - //char *tempstr; - //tempstr=malloc(strlen(s)+1); - p1->u.str=malloc(strlen(s)+1); - memcpy(p1->u.str,s,strlen(s)+1); - //p1->u.str=(void *)tempstr; - push(p1); - restore(); -} - -void -out_of_memory(void) -{ - stop("out of memory"); -} - -void -push_zero_matrix(int i, int j) -{ - push(alloc_tensor(i * j)); - stack[tos - 1]->u.tensor->ndim = 2; - stack[tos - 1]->u.tensor->dim[0] = i; - stack[tos - 1]->u.tensor->dim[1] = j; -} - -void -push_identity_matrix(int n) -{ - int i; - push_zero_matrix(n, n); - for (i = 0; i < n; i++) - stack[tos - 1]->u.tensor->elem[i * n + i] = one; -} - -void -push_cars(U *p) -{ - while (iscons(p)) { - push(car(p)); - p = cdr(p); - } -} - -void -peek(void) -{ - save(); - p1 = pop(); - push(p1); - printline(p1); - restore(); -} - -void -peek2(void) -{ - print_lisp(stack[tos - 2]); - print_lisp(stack[tos - 1]); -} - -int -equal(U *p1, U *p2) -{ - if (cmp_expr(p1, p2) == 0) - return 1; - else - return 0; -} - -int -lessp(U *p1, U *p2) -{ - if (cmp_expr(p1, p2) < 0) - return 1; - else - return 0; -} - -int -sign(int n) -{ - if (n < 0) - return -1; - else if (n > 0) - return 1; - else - return 0; -} - -int -cmp_expr(U *p1, U *p2) -{ - int n; - - if (p1 == p2) - return 0; - - if (p1 == symbol(NIL)) - return -1; - - if (p2 == symbol(NIL)) - return 1; - - if (isnum(p1) && isnum(p2)) - return sign(compare_numbers(p1, p2)); - - if (isnum(p1)) - return -1; - - if (isnum(p2)) - return 1; - - if (isstr(p1) && isstr(p2)) - return sign(strcmp(p1->u.str, p2->u.str)); - - if (isstr(p1)) - return -1; - - if (isstr(p2)) - return 1; - - if (issymbol(p1) && issymbol(p2)) - return sign(strcmp(get_printname(p1), get_printname(p2))); - - if (issymbol(p1)) - return -1; - - if (issymbol(p2)) - return 1; - - if (istensor(p1) && istensor(p2)) - return compare_tensors(p1, p2); - - if (istensor(p1)) - return -1; - - if (istensor(p2)) - return 1; - - while (iscons(p1) && iscons(p2)) { - n = cmp_expr(car(p1), car(p2)); - if (n != 0) - return n; - p1 = cdr(p1); - p2 = cdr(p2); - } - - if (iscons(p2)) - return -1; - - if (iscons(p1)) - return 1; - - return 0; -} - -int -length(U *p) -{ - int n = 0; - while (iscons(p)) { - p = cdr(p); - n++; - } - return n; -} - -static void unique_f(U *); - -U * -unique(U *p) -{ - save(); - p1 = symbol(NIL); - p2 = symbol(NIL); - unique_f(p); - if (p2 != symbol(NIL)) - p1 = symbol(NIL); - p = p1; - restore(); - return p; -} - -static void -unique_f(U *p) -{ - if (isstr(p)) { - if (p1 == symbol(NIL)) - p1 = p; - else if (p != p1) - p2 = p; - return; - } - while (iscons(p)) { - unique_f(car(p)); - if (p2 != symbol(NIL)) - return; - p = cdr(p); - } -} - -#if 0 - -void -check_endianess(void) -{ - int tmp = 1; - if (((char *) &tmp)[0] == 1 && Y_LITTLE_ENDIAN == 0) { - printf("Please change Y_LITTLE_ENDIAN to 1 in defs.h and recompile.\n"); - Exit(1); - } - if (((char *) &tmp)[0] == 0 && Y_LITTLE_ENDIAN != 0) { - printf("Please change Y_LITTLE_ENDIAN to 0 in defs.h and recompile.\n"); - Exit(1); - } -} - -#endif - -void -ssqrt(void) -{ - push_rational(1, 2); - power(); -} - -void -yyexpand(void) -{ - int x; - x = expanding; - expanding = 1; - eval(); - expanding = x; -} - -void -exponential(void) -{ - push_symbol(E); - swap(); - power(); -} - -void -square(void) -{ - push_integer(2); - power(); -} - -static int -__cmp(const void *p1, const void *p2) -{ - return cmp_expr(*((U **) p1), *((U **) p2)); -} - -void -sort_stack(int n) -{ - qsort(stack + tos - n, n, sizeof (U *), __cmp); -} diff --git a/src/.main.cpp.swp b/src/.main.cpp.swp new file mode 100644 index 0000000..9ee7a92 Binary files /dev/null and b/src/.main.cpp.swp differ diff --git a/config.c b/src/config.c similarity index 100% rename from config.c rename to src/config.c diff --git a/console.c b/src/console.c similarity index 100% rename from console.c rename to src/console.c diff --git a/src/engine/.history.cpp.swp b/src/engine/.history.cpp.swp new file mode 100644 index 0000000..56b9d82 Binary files /dev/null and b/src/engine/.history.cpp.swp differ diff --git a/abs.cpp b/src/engine/abs.cpp similarity index 100% rename from abs.cpp rename to src/engine/abs.cpp diff --git a/add.cpp b/src/engine/add.cpp similarity index 100% rename from add.cpp rename to src/engine/add.cpp diff --git a/adj.cpp b/src/engine/adj.cpp similarity index 100% rename from adj.cpp rename to src/engine/adj.cpp diff --git a/alloc.cpp b/src/engine/alloc.cpp similarity index 100% rename from alloc.cpp rename to src/engine/alloc.cpp diff --git a/append.cpp b/src/engine/append.cpp similarity index 100% rename from append.cpp rename to src/engine/append.cpp diff --git a/arccos.cpp b/src/engine/arccos.cpp similarity index 100% rename from arccos.cpp rename to src/engine/arccos.cpp diff --git a/arccosh.cpp b/src/engine/arccosh.cpp similarity index 100% rename from arccosh.cpp rename to src/engine/arccosh.cpp diff --git a/arcsin.cpp b/src/engine/arcsin.cpp similarity index 100% rename from arcsin.cpp rename to src/engine/arcsin.cpp diff --git a/arcsinh.cpp b/src/engine/arcsinh.cpp similarity index 100% rename from arcsinh.cpp rename to src/engine/arcsinh.cpp diff --git a/arctan.cpp b/src/engine/arctan.cpp similarity index 100% rename from arctan.cpp rename to src/engine/arctan.cpp diff --git a/arctanh.cpp b/src/engine/arctanh.cpp similarity index 100% rename from arctanh.cpp rename to src/engine/arctanh.cpp diff --git a/arg.cpp b/src/engine/arg.cpp similarity index 100% rename from arg.cpp rename to src/engine/arg.cpp diff --git a/atomize.cpp b/src/engine/atomize.cpp similarity index 100% rename from atomize.cpp rename to src/engine/atomize.cpp diff --git a/bake.cpp b/src/engine/bake.cpp similarity index 100% rename from bake.cpp rename to src/engine/bake.cpp diff --git a/besselj.cpp b/src/engine/besselj.cpp similarity index 100% rename from besselj.cpp rename to src/engine/besselj.cpp diff --git a/bessely.cpp b/src/engine/bessely.cpp similarity index 100% rename from bessely.cpp rename to src/engine/bessely.cpp diff --git a/bignum.cpp b/src/engine/bignum.cpp similarity index 100% rename from bignum.cpp rename to src/engine/bignum.cpp diff --git a/binomial.cpp b/src/engine/binomial.cpp similarity index 100% rename from binomial.cpp rename to src/engine/binomial.cpp diff --git a/ceiling.cpp b/src/engine/ceiling.cpp similarity index 100% rename from ceiling.cpp rename to src/engine/ceiling.cpp diff --git a/choose.cpp b/src/engine/choose.cpp similarity index 100% rename from choose.cpp rename to src/engine/choose.cpp diff --git a/circexp.cpp b/src/engine/circexp.cpp similarity index 100% rename from circexp.cpp rename to src/engine/circexp.cpp diff --git a/clear.cpp b/src/engine/clear.cpp similarity index 100% rename from clear.cpp rename to src/engine/clear.cpp diff --git a/clock.cpp b/src/engine/clock.cpp similarity index 100% rename from clock.cpp rename to src/engine/clock.cpp diff --git a/coeff.cpp b/src/engine/coeff.cpp similarity index 100% rename from coeff.cpp rename to src/engine/coeff.cpp diff --git a/cofactor.cpp b/src/engine/cofactor.cpp similarity index 100% rename from cofactor.cpp rename to src/engine/cofactor.cpp diff --git a/condense.cpp b/src/engine/condense.cpp similarity index 100% rename from condense.cpp rename to src/engine/condense.cpp diff --git a/conj.cpp b/src/engine/conj.cpp similarity index 100% rename from conj.cpp rename to src/engine/conj.cpp diff --git a/cons.cpp b/src/engine/cons.cpp similarity index 100% rename from cons.cpp rename to src/engine/cons.cpp diff --git a/contract.cpp b/src/engine/contract.cpp similarity index 100% rename from contract.cpp rename to src/engine/contract.cpp diff --git a/cos.cpp b/src/engine/cos.cpp similarity index 100% rename from cos.cpp rename to src/engine/cos.cpp diff --git a/cosh.cpp b/src/engine/cosh.cpp similarity index 100% rename from cosh.cpp rename to src/engine/cosh.cpp diff --git a/data.cpp b/src/engine/data.cpp similarity index 100% rename from data.cpp rename to src/engine/data.cpp diff --git a/decomp.cpp b/src/engine/decomp.cpp similarity index 100% rename from decomp.cpp rename to src/engine/decomp.cpp diff --git a/define.cpp b/src/engine/define.cpp similarity index 100% rename from define.cpp rename to src/engine/define.cpp diff --git a/defint.cpp b/src/engine/defint.cpp similarity index 100% rename from defint.cpp rename to src/engine/defint.cpp diff --git a/degree.cpp b/src/engine/degree.cpp similarity index 100% rename from degree.cpp rename to src/engine/degree.cpp diff --git a/denominator.cpp b/src/engine/denominator.cpp similarity index 100% rename from denominator.cpp rename to src/engine/denominator.cpp diff --git a/derivative.cpp b/src/engine/derivative.cpp similarity index 100% rename from derivative.cpp rename to src/engine/derivative.cpp diff --git a/det.cpp b/src/engine/det.cpp similarity index 100% rename from det.cpp rename to src/engine/det.cpp diff --git a/dirac.cpp b/src/engine/dirac.cpp similarity index 100% rename from dirac.cpp rename to src/engine/dirac.cpp diff --git a/display.cpp b/src/engine/display.cpp similarity index 100% rename from display.cpp rename to src/engine/display.cpp diff --git a/distill.cpp b/src/engine/distill.cpp similarity index 100% rename from distill.cpp rename to src/engine/distill.cpp diff --git a/divisors.cpp b/src/engine/divisors.cpp similarity index 100% rename from divisors.cpp rename to src/engine/divisors.cpp diff --git a/dpow.cpp b/src/engine/dpow.cpp similarity index 100% rename from dpow.cpp rename to src/engine/dpow.cpp diff --git a/draw.cpp b/src/engine/draw.cpp similarity index 100% rename from draw.cpp rename to src/engine/draw.cpp diff --git a/dsolve.cpp b/src/engine/dsolve.cpp similarity index 100% rename from dsolve.cpp rename to src/engine/dsolve.cpp diff --git a/eigen.cpp b/src/engine/eigen.cpp similarity index 100% rename from eigen.cpp rename to src/engine/eigen.cpp diff --git a/erf.cpp b/src/engine/erf.cpp similarity index 100% rename from erf.cpp rename to src/engine/erf.cpp diff --git a/erfc.cpp b/src/engine/erfc.cpp similarity index 100% rename from erfc.cpp rename to src/engine/erfc.cpp diff --git a/eval.cpp b/src/engine/eval.cpp similarity index 100% rename from eval.cpp rename to src/engine/eval.cpp diff --git a/expand.cpp b/src/engine/expand.cpp similarity index 100% rename from expand.cpp rename to src/engine/expand.cpp diff --git a/expcos.cpp b/src/engine/expcos.cpp similarity index 100% rename from expcos.cpp rename to src/engine/expcos.cpp diff --git a/expsin.cpp b/src/engine/expsin.cpp similarity index 100% rename from expsin.cpp rename to src/engine/expsin.cpp diff --git a/factor.cpp b/src/engine/factor.cpp similarity index 100% rename from factor.cpp rename to src/engine/factor.cpp diff --git a/factorial.cpp b/src/engine/factorial.cpp similarity index 100% rename from factorial.cpp rename to src/engine/factorial.cpp diff --git a/factorpoly.cpp b/src/engine/factorpoly.cpp similarity index 100% rename from factorpoly.cpp rename to src/engine/factorpoly.cpp diff --git a/factors.cpp b/src/engine/factors.cpp similarity index 100% rename from factors.cpp rename to src/engine/factors.cpp diff --git a/filter.cpp b/src/engine/filter.cpp similarity index 100% rename from filter.cpp rename to src/engine/filter.cpp diff --git a/find.cpp b/src/engine/find.cpp similarity index 100% rename from find.cpp rename to src/engine/find.cpp diff --git a/float.cpp b/src/engine/float.cpp similarity index 100% rename from float.cpp rename to src/engine/float.cpp diff --git a/floor.cpp b/src/engine/floor.cpp similarity index 100% rename from floor.cpp rename to src/engine/floor.cpp diff --git a/for.cpp b/src/engine/for.cpp similarity index 100% rename from for.cpp rename to src/engine/for.cpp diff --git a/gamma.cpp b/src/engine/gamma.cpp similarity index 100% rename from gamma.cpp rename to src/engine/gamma.cpp diff --git a/gcd.cpp b/src/engine/gcd.cpp similarity index 100% rename from gcd.cpp rename to src/engine/gcd.cpp diff --git a/graphicsProvider.cpp b/src/engine/graphicsProvider.cpp similarity index 100% rename from graphicsProvider.cpp rename to src/engine/graphicsProvider.cpp diff --git a/guess.cpp b/src/engine/guess.cpp similarity index 100% rename from guess.cpp rename to src/engine/guess.cpp diff --git a/hermite.cpp b/src/engine/hermite.cpp similarity index 100% rename from hermite.cpp rename to src/engine/hermite.cpp diff --git a/hilbert.cpp b/src/engine/hilbert.cpp similarity index 100% rename from hilbert.cpp rename to src/engine/hilbert.cpp diff --git a/history.cpp b/src/engine/history.cpp similarity index 100% rename from history.cpp rename to src/engine/history.cpp diff --git a/imag.cpp b/src/engine/imag.cpp similarity index 100% rename from imag.cpp rename to src/engine/imag.cpp diff --git a/index.cpp b/src/engine/index.cpp similarity index 100% rename from index.cpp rename to src/engine/index.cpp diff --git a/init.cpp b/src/engine/init.cpp similarity index 100% rename from init.cpp rename to src/engine/init.cpp diff --git a/inner.cpp b/src/engine/inner.cpp similarity index 100% rename from inner.cpp rename to src/engine/inner.cpp diff --git a/integral.cpp b/src/engine/integral.cpp similarity index 100% rename from integral.cpp rename to src/engine/integral.cpp diff --git a/inv.cpp b/src/engine/inv.cpp similarity index 100% rename from inv.cpp rename to src/engine/inv.cpp diff --git a/is.cpp b/src/engine/is.cpp similarity index 100% rename from is.cpp rename to src/engine/is.cpp diff --git a/isprime.cpp b/src/engine/isprime.cpp similarity index 100% rename from isprime.cpp rename to src/engine/isprime.cpp diff --git a/itab.cpp b/src/engine/itab.cpp similarity index 100% rename from itab.cpp rename to src/engine/itab.cpp diff --git a/itest.cpp b/src/engine/itest.cpp similarity index 100% rename from itest.cpp rename to src/engine/itest.cpp diff --git a/laguerre.cpp b/src/engine/laguerre.cpp similarity index 100% rename from laguerre.cpp rename to src/engine/laguerre.cpp diff --git a/laplace.cpp b/src/engine/laplace.cpp similarity index 100% rename from laplace.cpp rename to src/engine/laplace.cpp diff --git a/lcm.cpp b/src/engine/lcm.cpp similarity index 100% rename from lcm.cpp rename to src/engine/lcm.cpp diff --git a/leading.cpp b/src/engine/leading.cpp similarity index 100% rename from leading.cpp rename to src/engine/leading.cpp diff --git a/legendre.cpp b/src/engine/legendre.cpp similarity index 100% rename from legendre.cpp rename to src/engine/legendre.cpp diff --git a/list.cpp b/src/engine/list.cpp similarity index 100% rename from list.cpp rename to src/engine/list.cpp diff --git a/log.cpp b/src/engine/log.cpp similarity index 100% rename from log.cpp rename to src/engine/log.cpp diff --git a/madd.cpp b/src/engine/madd.cpp similarity index 100% rename from madd.cpp rename to src/engine/madd.cpp diff --git a/mag.cpp b/src/engine/mag.cpp similarity index 100% rename from mag.cpp rename to src/engine/mag.cpp diff --git a/main.cpp b/src/engine/main_engine.cpp similarity index 100% rename from main.cpp rename to src/engine/main_engine.cpp diff --git a/mcmp.cpp b/src/engine/mcmp.cpp similarity index 100% rename from mcmp.cpp rename to src/engine/mcmp.cpp diff --git a/mfactor.cpp b/src/engine/mfactor.cpp similarity index 100% rename from mfactor.cpp rename to src/engine/mfactor.cpp diff --git a/mgcd.cpp b/src/engine/mgcd.cpp similarity index 100% rename from mgcd.cpp rename to src/engine/mgcd.cpp diff --git a/misc.cpp b/src/engine/misc.cpp similarity index 100% rename from misc.cpp rename to src/engine/misc.cpp diff --git a/mmodpow.cpp b/src/engine/mmodpow.cpp similarity index 100% rename from mmodpow.cpp rename to src/engine/mmodpow.cpp diff --git a/mmul.cpp b/src/engine/mmul.cpp similarity index 100% rename from mmul.cpp rename to src/engine/mmul.cpp diff --git a/mod.cpp b/src/engine/mod.cpp similarity index 100% rename from mod.cpp rename to src/engine/mod.cpp diff --git a/mpow.cpp b/src/engine/mpow.cpp similarity index 100% rename from mpow.cpp rename to src/engine/mpow.cpp diff --git a/mprime.cpp b/src/engine/mprime.cpp similarity index 100% rename from mprime.cpp rename to src/engine/mprime.cpp diff --git a/mroot.cpp b/src/engine/mroot.cpp similarity index 100% rename from mroot.cpp rename to src/engine/mroot.cpp diff --git a/mscan.cpp b/src/engine/mscan.cpp similarity index 100% rename from mscan.cpp rename to src/engine/mscan.cpp diff --git a/msqrt.cpp b/src/engine/msqrt.cpp similarity index 100% rename from msqrt.cpp rename to src/engine/msqrt.cpp diff --git a/mstr.cpp b/src/engine/mstr.cpp similarity index 100% rename from mstr.cpp rename to src/engine/mstr.cpp diff --git a/multiply.cpp b/src/engine/multiply.cpp similarity index 100% rename from multiply.cpp rename to src/engine/multiply.cpp diff --git a/nroots.cpp b/src/engine/nroots.cpp similarity index 100% rename from nroots.cpp rename to src/engine/nroots.cpp diff --git a/numerator.cpp b/src/engine/numerator.cpp similarity index 100% rename from numerator.cpp rename to src/engine/numerator.cpp diff --git a/outer.cpp b/src/engine/outer.cpp similarity index 100% rename from outer.cpp rename to src/engine/outer.cpp diff --git a/partition.cpp b/src/engine/partition.cpp similarity index 100% rename from partition.cpp rename to src/engine/partition.cpp diff --git a/polar.cpp b/src/engine/polar.cpp similarity index 100% rename from polar.cpp rename to src/engine/polar.cpp diff --git a/pollard.cpp b/src/engine/pollard.cpp similarity index 100% rename from pollard.cpp rename to src/engine/pollard.cpp diff --git a/power.cpp b/src/engine/power.cpp similarity index 100% rename from power.cpp rename to src/engine/power.cpp diff --git a/prime.cpp b/src/engine/prime.cpp similarity index 100% rename from prime.cpp rename to src/engine/prime.cpp diff --git a/primetab.cpp b/src/engine/primetab.cpp similarity index 100% rename from primetab.cpp rename to src/engine/primetab.cpp diff --git a/print.cpp b/src/engine/print.cpp similarity index 100% rename from print.cpp rename to src/engine/print.cpp diff --git a/product.cpp b/src/engine/product.cpp similarity index 100% rename from product.cpp rename to src/engine/product.cpp diff --git a/qadd.cpp b/src/engine/qadd.cpp similarity index 100% rename from qadd.cpp rename to src/engine/qadd.cpp diff --git a/qdiv.cpp b/src/engine/qdiv.cpp similarity index 100% rename from qdiv.cpp rename to src/engine/qdiv.cpp diff --git a/qmul.cpp b/src/engine/qmul.cpp similarity index 100% rename from qmul.cpp rename to src/engine/qmul.cpp diff --git a/qpow.cpp b/src/engine/qpow.cpp similarity index 100% rename from qpow.cpp rename to src/engine/qpow.cpp diff --git a/qsub.cpp b/src/engine/qsub.cpp similarity index 100% rename from qsub.cpp rename to src/engine/qsub.cpp diff --git a/quickfactor.cpp b/src/engine/quickfactor.cpp similarity index 100% rename from quickfactor.cpp rename to src/engine/quickfactor.cpp diff --git a/quotient.cpp b/src/engine/quotient.cpp similarity index 100% rename from quotient.cpp rename to src/engine/quotient.cpp diff --git a/rationalize.cpp b/src/engine/rationalize.cpp similarity index 100% rename from rationalize.cpp rename to src/engine/rationalize.cpp diff --git a/real.cpp b/src/engine/real.cpp similarity index 100% rename from real.cpp rename to src/engine/real.cpp diff --git a/rect.cpp b/src/engine/rect.cpp similarity index 100% rename from rect.cpp rename to src/engine/rect.cpp diff --git a/rewrite.cpp b/src/engine/rewrite.cpp similarity index 100% rename from rewrite.cpp rename to src/engine/rewrite.cpp diff --git a/roots.cpp b/src/engine/roots.cpp similarity index 100% rename from roots.cpp rename to src/engine/roots.cpp diff --git a/run.cpp b/src/engine/run.cpp similarity index 100% rename from run.cpp rename to src/engine/run.cpp diff --git a/scan.cpp b/src/engine/scan.cpp similarity index 100% rename from scan.cpp rename to src/engine/scan.cpp diff --git a/sgn.cpp b/src/engine/sgn.cpp similarity index 100% rename from sgn.cpp rename to src/engine/sgn.cpp diff --git a/simfac.cpp b/src/engine/simfac.cpp similarity index 100% rename from simfac.cpp rename to src/engine/simfac.cpp diff --git a/simplify.cpp b/src/engine/simplify.cpp similarity index 100% rename from simplify.cpp rename to src/engine/simplify.cpp diff --git a/sin.cpp b/src/engine/sin.cpp similarity index 100% rename from sin.cpp rename to src/engine/sin.cpp diff --git a/sinh.cpp b/src/engine/sinh.cpp similarity index 100% rename from sinh.cpp rename to src/engine/sinh.cpp diff --git a/stack.cpp b/src/engine/stack.cpp similarity index 100% rename from stack.cpp rename to src/engine/stack.cpp diff --git a/subst.cpp b/src/engine/subst.cpp similarity index 100% rename from subst.cpp rename to src/engine/subst.cpp diff --git a/sum.cpp b/src/engine/sum.cpp similarity index 100% rename from sum.cpp rename to src/engine/sum.cpp diff --git a/symbol.cpp b/src/engine/symbol.cpp similarity index 100% rename from symbol.cpp rename to src/engine/symbol.cpp diff --git a/tan.cpp b/src/engine/tan.cpp similarity index 100% rename from tan.cpp rename to src/engine/tan.cpp diff --git a/tanh.cpp b/src/engine/tanh.cpp similarity index 100% rename from tanh.cpp rename to src/engine/tanh.cpp diff --git a/taylor.cpp b/src/engine/taylor.cpp similarity index 100% rename from taylor.cpp rename to src/engine/taylor.cpp diff --git a/tensor.cpp b/src/engine/tensor.cpp similarity index 100% rename from tensor.cpp rename to src/engine/tensor.cpp diff --git a/test.cpp b/src/engine/test.cpp similarity index 100% rename from test.cpp rename to src/engine/test.cpp diff --git a/transform.cpp b/src/engine/transform.cpp similarity index 100% rename from transform.cpp rename to src/engine/transform.cpp diff --git a/transpose.cpp b/src/engine/transpose.cpp similarity index 100% rename from transpose.cpp rename to src/engine/transpose.cpp diff --git a/userfunc.cpp b/src/engine/userfunc.cpp similarity index 100% rename from userfunc.cpp rename to src/engine/userfunc.cpp diff --git a/variables.cpp b/src/engine/variables.cpp similarity index 100% rename from variables.cpp rename to src/engine/variables.cpp diff --git a/vectorize.cpp b/src/engine/vectorize.cpp similarity index 100% rename from vectorize.cpp rename to src/engine/vectorize.cpp diff --git a/zero.cpp b/src/engine/zero.cpp similarity index 100% rename from zero.cpp rename to src/engine/zero.cpp diff --git a/Taumath.cpp b/src/main.cpp similarity index 91% rename from Taumath.cpp rename to src/main.cpp index 6fc16fb..9862769 100644 --- a/Taumath.cpp +++ b/src/main.cpp @@ -4,7 +4,7 @@ #include "defs.h" extern "C"{ #include "console.h" -#include "fxlib.h" +#include "libfx.h" #include "syscalls.h" #include "tex/TeX.h" #include "memory.h" @@ -40,7 +40,7 @@ void TeX_quit(void) Txt_Quit(); } -const unsigned char *Setup[]={ +const /*unsigned*/ char *Setup[]={ "logab(a,b)=log(b)/log(a)", "log10(x)=log(x)/log(10)", "ln(x)=log(x)", @@ -120,7 +120,7 @@ int AddIn_main(int isAppli, unsigned short OptionNum) Console_NewLine(LINE_TYPE_OUTPUT,1); // More details on where the error is - Console_Output("\xE6\x92 USER.eig line : "); + Console_Output((unsigned char*)"\xE6\x92 USER.eig line : "); sprintf(line_number, "%d", line_count); strcat(line_number, " "); Console_Output((unsigned char*)line_number); @@ -152,17 +152,4 @@ int AddIn_main(int isAppli, unsigned short OptionNum) TeX_quit(); for(;;)GetKey(&key); return 1; -} - -#pragma section _BR_Size -unsigned long BR_Size; -#pragma section - -#pragma section _TOP -int InitializeSystem(int isAppli, unsigned short OptionNum) -{ - return INIT_ADDIN_APPLICATION(isAppli, OptionNum); -} -#pragma section - -} \ No newline at end of file +}} diff --git a/memory.c b/src/memory.c similarity index 100% rename from memory.c rename to src/memory.c diff --git a/tex/debug.c b/tex/debug.c deleted file mode 100644 index 14eff14..0000000 --- a/tex/debug.c +++ /dev/null @@ -1,55 +0,0 @@ -#include "debug.h" - -#ifdef DEBUG - -int debug_handle; - -#ifndef DEBUG_PATH - #define DEBUG_PATH "\\\\crd0\\TeX.log" -#endif - -#ifndef DEBUG_FILE - #define DEBUG_FILE 10000 -#endif - -#ifndef DEBUG_SIZE - #define DEBUG_SIZE 100 -#endif - -void debug_init(void) -{ - char debug_path[] = DEBUG_PATH; - unsigned short *bfile_path; - int i=0; - - while(debug_path[i]) i++; - bfile_path = calloc(i+1,2); - for(i=0;debug_path[i];i++) bfile_path[i] = debug_path[i]; - bfile_path[i] = 0x0; - - Bfile_DeleteFile(bfile_path); - Bfile_CreateFile(bfile_path,DEBUG_FILE); - debug_handle = Bfile_OpenFile(bfile_path,_OPENMODE_WRITE); - - free(bfile_path); -} - -void debug(const char *format, ...) -{ - char ch[DEBUG_SIZE+1]; - va_list args; - - va_start(args,format); - vsprintf(ch,format,args); - va_end(args); - ch[DEBUG_SIZE] = 0; - - Bfile_WriteFile(debug_handle,ch,strlen(ch)); -} - -void debug_quit(void) -{ - Bfile_CloseFile(debug_handle); -} - -#endif // DEBUG diff --git a/tex/libText.c b/tex/libText.c deleted file mode 100644 index 7c827d0..0000000 --- a/tex/libText.c +++ /dev/null @@ -1,382 +0,0 @@ -#include -#include -#include "LibText.h" - -// Thanks to Simon Lothar for this function -typedef char*(*Txt_SC)(void); -const unsigned int Txt_SC_VRAM[] = { 0xD201D002, 0x422B0009, 0x80010070, 0x0135 }; -#define Txt_GetVRAM (*(Txt_SC)Txt_SC_VRAM) -char *Txt_VRAM; - -unsigned int *Txt_Fonts[TXT_FONTS]; - -void Txt_Init(int fonts) -{ - int i; - Txt_VRAM = Txt_GetVRAM(); - for(i=0;i>3)) |= (128>>(x&7)); - else *(Txt_VRAM+(y<<4)+(x>>3)) &= ~(128>>(x&7)); -} - -void Txt_Point(int x, int y, int v, int m) -{ - switch(m) - { - case TXT_OR: if(v) Txt_Pixel(x,y,1); break; - case TXT_ON: Txt_Pixel(x,y,v); break; - case TXT_AND: if(v) Txt_Pixel(x,y,0); break; - case TXT_REV: Txt_Pixel(x,y,!v); break; - case TXT_XOR: if(v) Txt_Pixel(x,y,!Txt_Get(x,y)); break; - } -} - -int Txt_Get(int x, int y) -{ - return (*(Txt_VRAM+(y<<4)+(x>>3)) >> (~x&7))&1; -} - -void Txt_Char(char c, int x, int y, int f, int w, int h, int m) -{ - unsigned int *font = Txt_Fonts[f]; - unsigned char a,b,v; - int offbyte = (c*w*h)>>5; - int offbit = (c*w*h)&31; - if(!font) return; - - for(b=0;bh) h=th; - if(tl>l) l=tl; - - // Freeing the allocated memory and preparing the next iteration. - free(element); - expr = next; - } - - // A pixel of spacing was added for each element, but the last one didn't need one. - w -= 1; - - if(width) *width = w; - if(height) *height = h; - if(line) *line = l; -} - -void TeX_sizeSimple(char *element, int *width, int *height, int *line) -{ - /* - ** This function returns the size of any simple TeX element, based on its parameters. Detects if the parameter is plain - ** text, command or any complex expression. - ** Any call to TeX_sizeSimple() needs at least one level of subsequent calls to TeX_sizeComplex() if the element is a - ** command that has at least one parameter. - ** Otherwise, TeX_sizeSimple() will return a fixed size without calling any subroutine. - */ - - int w=0, h=0, l=0; // These variables will contain the properties of the element. - int *tw, *th, *tl; // These variables store temporary data needed for comparison between parameters. - char *name; // This pointer will save the value of element to know which command was used. - char *next; // This pointer will parse the element to find the parameters. - char *parameter; // This pointer will contain dynamically-allocated temporary data -- a parameter. - int param; // Contains the number of parameters the command use. Not used if element is plain text. - int i, x; // An incremental loop counter, and just a stupid variable. - - // Testing if the element is only plain text. - if(*element != '\\') - { - if(width) *width = (Txt_Width(TEX_FONT)+1)*strlen(element)-1; - if(height) *height = Txt_Height(TEX_FONT); - if(line) *line = Txt_Height(TEX_FONT)>>1; - return; - } - - // Otherwise, the element is obviously a command. - name = element+1; - param = TeX_getParamNumber(element+1); - while(*element != '{') element++; - - // Allocating memory to store the properties of parameters. - tw = calloc(TEX_MAXP,4); - th = calloc(TEX_MAXP,4); - tl = calloc(TEX_MAXP,4); - - // Processing each parameter. - for(i=0;itw[1]?tw[0]:tw[1])+2, h=th[0]+th[1]+3, l=th[0]+1; - else if(!strncmp(name,"sum", 3)) x=(tw[0]>tw[1]?tw[0]:tw[1]), w=(x>8?x:8), h=th[0]+th[1]+11, l=th[0]+4; - else if(!strncmp(name,"sqrt",4)) w=tw[0]+6, h=th[0]+3, l=tl[0]+2; - else if(!strncmp(name,"vec", 3)) w=tw[0], h=th[0]+4, l=tl[0]+4; - else w=-1, h=-1, l=-1; - - if(width) *width = w; - if(height) *height = h; - if(line) *line = l; - - // Freeing the allocated data. - free(tw); - free(th); - free(tl); -} - -char *TeX_getElement(char *expr) -{ - /* - ** This function returns a pointer to the end of the first element pointed to by expr. If *expr is '\\', the element is - ** considered as a command and TeX_getElement() returns a pointer to the character just after the '}' closing the command. - ** In any other cases, the element is supposed to be plain text and TeX_getElement() returns a pointer to the first '\\' - ** opening a command. - */ - - char *next = expr; - - // Looking for any '\\' as first character. - if(*expr=='\\') - { - // Getting the number of parameters for the detected command. - const int param = TeX_getParamNumber(expr+1); - int c,i; - - // Determining the end of each parameter based on sublevel elements. - for(i=0,c=0;i>1)-(tw[0]>>1),l-th[0]-1); - TeX_drawComplex(parameters[1],x+(w>>1)-(tw[1]>>1),l+2); - } - - else if(!strncmp(name,"sum",3)) - { - for(j=0;j<8;j++) setPixel(x+(w>>1)+j-4,l-4,1), setPixel(x+(w>>1)+j-4,l+4,1); - for(j=1;j<4;j++) setPixel(x+(w>>1)-j,l-j,1), setPixel(x+(w>>1)-j,l+j,1); - setPixel(x+(w>>1),l,1); - setPixel(x+(w>>1)+3,l-3,1); - setPixel(x+(w>>1)+3,l+3,1); - TeX_drawComplex(parameters[0],x+(w>>1)-(tw[0]>>1),l+6); - TeX_drawComplex(parameters[1],x+(w>>1)-(tw[1]>>1),l-5-th[1]); - } - - else if(!strncmp(name,"sqrt",4)) - { - for(j=0;j