diff --git a/HISTORY b/HISTORY index 4a811e3f..b3d5a147 100644 --- a/HISTORY +++ b/HISTORY @@ -2,7 +2,12 @@ --- amath change history --- ------------------------------------------------------------------------------- -v1.7.0 March 12 2017 +v1.7.1 March 26 2017 +- Haiku support. +- Unified ANSI console. +- Code cleanup. + +v1.7.1 March 12 2017 - Introduce scientific notation. - Introduce Not a Number (NaN). - Fixed bugs related to infinity (Inf). diff --git a/Makefile b/Makefile deleted file mode 100644 index 1030ba62..00000000 --- a/Makefile +++ /dev/null @@ -1,122 +0,0 @@ - -CC = gcc -CXX = g++ -CFLAGS = -O2 -DWITHTEST -Wall -Isrc -Isrc/main -CXXFLAGS = -O2 -DWITHTEST -Wall -Isrc -Isrc/main -AR = ar -RANLIB = ranlib -LFLAGS = -lappsystem -lfunctions -lstatement -lappmain -lfunctions -lstatement -lappmain -lamathapp -lamathcplex -lamath -lamathc -lstdc++ -LPATH = -Lsrc/lib -Lsrc/clib -Lsrc/real -Lsrc/cplex -Lsrc/main/function -Lsrc/main/statement -Lsrc/main -Lsrc/system -LPATHS = -Lsrc/lib/static -Lsrc/clib/static -Lsrc/real/static -Lsrc/cplex/static -Lsrc/main/function -Lsrc/main/statement -Lsrc/main -Lsrc/system -FLXCAT = build/flexcat/flexcat -MKDIR = mkdir -p -DEL = rm -f -INSTALLP = install -m 0755 -INSTALLM = install -m 0644 -PREFIX = /usr -INSTDIRP = ${DESTDIR}${PREFIX}/bin -INSTDIRM = ${DESTDIR}${PREFIX}/share/man/man1 - -all: shared-app -app: appmain functions statement appsystem -libs: amathapp amath amathc amathcplex - -amath: static-app -static: static-app - -src/main.o: src/main.cpp - ${CXX} ${CXXFLAGS} -c src/main.cpp -o src/main.o - -appmain: - cd src/main && ${MAKE} - -appsystem: - cd src/system && ${MAKE} - -functions: - cd src/main/function && ${MAKE} - -statement: - cd src/main/statement && ${MAKE} - -amathapp: - cd src/lib && ${MAKE} - -amath: - cd src/real && ${MAKE} - -amathc: - cd src/clib && ${MAKE} - -amathcplex: - cd src/cplex && ${MAKE} - -localize: - cd build/flexcat && ${MAKE} - ${FLXCAT} text/keyword.cd src/localize/kword.h=text/keyword.sd - ${FLXCAT} text/help.cd src/localize/help.h=text/help.sd - ${FLXCAT} text/ident.cd src/localize/ident.h=text/ident.sd - ${FLXCAT} text/text.cd src/localize/text.h=text/text.sd - -catalogs: - cd build/flexcat && ${MAKE} - ${MKDIR} dist/catalog/english - ${FLXCAT} text/help.cd catalog/english/amath-help.ct CATALOG dist/catalog/english/amath-help.catalog - ${FLXCAT} text/ident.cd catalog/english/amath-ident.ct CATALOG dist/catalog/english/amath-ident.catalog - ${FLXCAT} text/text.cd catalog/english/amath-text.ct CATALOG dist/catalog/english/amath-text.catalog - ${MKDIR} dist/catalog/dansk - ${FLXCAT} text/help.cd catalog/dansk/amath-help.ct CATALOG dist/catalog/dansk/amath-help.catalog - ${FLXCAT} text/ident.cd catalog/dansk/amath-ident.ct CATALOG dist/catalog/dansk/amath-ident.catalog - ${FLXCAT} text/text.cd catalog/dansk/amath-text.ct CATALOG dist/catalog/dansk/amath-text.catalog - ${FLXCAT} text/keyword.cd catalog/dansk/amath-keyword.ct CATALOG dist/catalog/dansk/amath-keyword.catalog - -shared-app: app libs src/main.o - ${CC} ${CFLAGS} -s src/main.o -o amath ${LPATH} ${LFLAGS} - -static-app: src/main.o - cd src/lib && ${MAKE} static - cd src/clib && ${MAKE} static - cd src/real && ${MAKE} static - cd src/cplex && ${MAKE} static - cd src/main && ${MAKE} static - cd src/system && ${MAKE} static - cd src/main/function && ${MAKE} static - cd src/main/statement && ${MAKE} static - ${CC} ${CFLAGS} -s src/main.o -o amath ${LPATHS} ${LFLAGS} - -.PHONY: test -test: amath - LD_LIBRARY_PATH=src/clib/:src/lib:src/cplex:scr/real - ./amath test - -.PHONY: install -install: shared-app - cd src/lib && ${MAKE} install - cd src/clib && ${MAKE} install - cd src/real && ${MAKE} install - cd src/cplex && ${MAKE} install - ${INSTALLP} amath ${INSTDIRP}/amath - ${INSTALLM} amath.1 ${INSTDIRM}/amath.1 - -.PHONY: uninstall -uninstall: - cd src/lib && ${MAKE} uninstall - cd src/clib && ${MAKE} uninstall - cd src/real && ${MAKE} uninstall - cd src/cplex && ${MAKE} uninstall - ${DEL} ${INSTDIRP}/amath - ${DEL} ${INSTDIRM}/amath.1 - -.PHONY: clean -clean: - cd src/lib && ${MAKE} clean - cd src/clib && ${MAKE} clean - cd src/real && ${MAKE} clean - cd src/cplex && ${MAKE} clean - cd src/main && ${MAKE} clean - cd src/system && ${MAKE} clean - cd src/main/function && ${MAKE} clean - cd src/main/statement && ${MAKE} clean - cd build/flexcat && ${MAKE} clean - ${DEL} src/main.o amath - diff --git a/amath.1 b/amath.1 index 3847678e..d1c1c85a 100644 --- a/amath.1 +++ b/amath.1 @@ -1,11 +1,11 @@ -.TH "amath" 1 "Wed Mar 1 2017" "Version 1.7.0" "amath" \" -*- nroff -*- +.TH "amath" 1 "Wed Mar 15 2017" "Version 1.7.1" "amath" \" -*- nroff -*- .ad l .nh .SH NAME -amath \- Statements and functions +amath \- Simple command line calculator .SH SYNOPSIS -\fCamath [expression]\fP +\fCamath [ --shell | --noansi | expression ]\fP .SH Description amath(1) features a case sensitive command line interface, internal @@ -36,19 +36,18 @@ version Show version string memory Show internal memory usage exit Exit program .fi -.PP - + .SH "Operators" .PP .nf -+ Mathematical addition. -- Mathematical subtraction. -* Mathematical multiplication. -/ Mathematical division. -^ Mathematical exponentiation. -= Assignment of variable values. -| Absolute value of number. - ++ Mathematical addition +- Mathematical subtraction +* Mathematical multiplication +/ Mathematical division +^ Mathematical exponentiation += Assignment of variable values +| Absolute value of number + .SH "Variables and constant" .PP .nf @@ -57,7 +56,6 @@ e Euler's number i Imaginary unit ins Result of last calculation .fi -.PP .SH "Base functions" .PP @@ -74,8 +72,7 @@ lb Binary logarithm function (base 2) ln Natural logarithm function (base e) lg Common logarithm function (base 10) .fi -.PP - + .SH "Trigonometric functions" .PP .nf @@ -92,8 +89,7 @@ arccot Inverse trigonometric cotangent function arcsec Inverse trigonometric secant function arccsc Inverse trigonometric cosecant function .fi -.PP - + .SH "Hyperbolic functions" .PP .nf @@ -110,8 +106,7 @@ arccoth Inverse hyperbolic cotangent function arcsech Inverse hyperbolic secant function arccsch Inverse hyperbolic cosecant function .fi -.PP - + .SH "Early trigonometric functions" .PP .nf @@ -132,8 +127,7 @@ archvc Inverse haversed cosine function archcv Inverse hacoversed sine function archcc Inverse hacoversed cosine function .fi -.PP - + .SH "Example script" .PP .nf @@ -143,8 +137,7 @@ floor(39.9531);floor(-39.9531); trunc(23.827);trunc(-23.827); sqrt(100);sqrt(52.23); .fi -.PP - + .SH "Example script with functions" .PP .nf @@ -154,8 +147,7 @@ a=2;b=3;c=a+b; vars;funcs; f(2.2);c+1.1; .fi -.PP - + .SH "Example script with complex numbers" .PP .nf @@ -166,8 +158,7 @@ coth(1+2i); sech(1+2i); csch(1+2i); .fi -.PP - + .SH "See also" -.PP +.PP amathc(3), amathr(3), amathi(3) diff --git a/amath.doxygen b/amath.doxygen index 4ac695f6..34bde0c7 100644 --- a/amath.doxygen +++ b/amath.doxygen @@ -38,7 +38,7 @@ PROJECT_NAME = "amath" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.7.0" +PROJECT_NUMBER = "1.7.1" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/build/flexcat/Makefile b/build/flexcat/Makefile deleted file mode 100644 index 4a1461fa..00000000 --- a/build/flexcat/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -all: flexcat - -CFLAGS += -I. -Wall - -asprintf.o: asprintf.c - ${CC} ${CFLAGS} -c asprintf.c - -createcat.o: createcat.c - ${CC} ${CFLAGS} -c createcat.c - -createcatsrc.o: createcatsrc.c - ${CC} ${CFLAGS} -c createcatsrc.c - -createct.o: createct.c - ${CC} ${CFLAGS} -c createct.c - -globals.o: globals.c - ${CC} ${CFLAGS} -c globals.c - -locale_other.o: locale_other.c - ${CC} ${CFLAGS} -c locale_other.c - -main.o: main.c - ${CC} ${CFLAGS} -c main.c - -openlibs.o: openlibs.c - ${CC} ${CFLAGS} -c openlibs.c - -readprefs.o: readprefs.c - ${CC} ${CFLAGS} -c readprefs.c - -scancd.o: scancd.c - ${CC} ${CFLAGS} -c scancd.c - -scanct.o: scanct.c - ${CC} ${CFLAGS} -c scanct.c - -scanpo.o: scanpo.c - ${CC} ${CFLAGS} -c scanpo.c - -showfuncs.o: showfuncs.c - ${CC} ${CFLAGS} -c showfuncs.c - -strptime.o: strptime.c - ${CC} ${CFLAGS} -c strptime.c - -swapfuncs.o: swapfuncs.c - ${CC} ${CFLAGS} -c swapfuncs.c - -utils.o: utils.c - ${CC} ${CFLAGS} -c utils.c - -vastubs.o: vastubs.c - ${CC} ${CFLAGS} -c vastubs.c - - -flexcat: asprintf.o createcat.o createcatsrc.o createct.o globals.o locale_other.o main.o openlibs.o readprefs.o scancd.o scanct.o scanpo.o showfuncs.o strptime.o swapfuncs.o utils.o vastubs.o - ${CC} ${CFLAGS} -o flexcat asprintf.o createcat.o createcatsrc.o createct.o globals.o locale_other.o main.o openlibs.o readprefs.o scancd.o scanct.o scanpo.o showfuncs.o strptime.o swapfuncs.o utils.o vastubs.o -lm - -clean: - rm -f asprintf.o createcat.o createcatsrc.o createct.o globals.o locale_other.o main.o openlibs.o readprefs.o scancd.o scanct.o scanpo.o showfuncs.o strptime.o swapfuncs.o utils.o vastubs.o flexcat - diff --git a/builddeb b/builddebdev similarity index 97% rename from builddeb rename to builddebdev index 73be8f8a..0d55dd10 100755 --- a/builddeb +++ b/builddebdev @@ -2,7 +2,7 @@ set -e -version="1.7.0" +version="1.7.1" build_package () { @@ -11,7 +11,7 @@ rm -f amath-${version}_$1.deb sh configure CFLAGS=$2 make clean -echo "Building $3 bit package of amath ${version} for Debian ..." +echo "Building $3 bit package of amath-dev ${version} for Debian ..." make mv amath amath.tmp @@ -91,7 +91,7 @@ chmod 644 amath/usr/share/amath/* # Create control file { -echo "Package: amath" +echo "Package: amath-dev" echo "Version: ${version}" echo "Architecture: $1" echo "Maintainer: Carsten Larsen " @@ -113,7 +113,7 @@ chmod 0755 amath/DEBIAN/control # Create license file { echo "Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/" -echo "Upstream-Name: amath" +echo "Upstream-Name: amath-dev" echo "Source: http://amath.innolan.net" echo echo "Files: *" @@ -191,7 +191,7 @@ echo "rm -f /usr/lib/libamathcplex.so.${version}" chmod 0755 amath/DEBIAN/postrm fakeroot dpkg-deb --build amath -mv amath.deb amath-${version}_$1.deb +mv amath.deb amath-dev-${version}_$1.deb rm -Rf amath } diff --git a/buildwin b/buildwin index 93c7bb25..76836c1f 100755 --- a/buildwin +++ b/buildwin @@ -2,7 +2,7 @@ set -e -version="1.7.0" +version="1.7.1" echo "Building amath ${version} for Windows ..." @@ -11,37 +11,23 @@ rm -Rf amath rm -Rf dist mkdir dist -./configure --enable-test --cross-compile="i686-w64-mingw32" CFLAGS="-D_WIN32" LDFLAGS="-static -static-libgcc -static-libstdc++" +./configure --enable-test --cross-compile="i686-w64-mingw32" CFLAGS="-DWINDOWS" LDFLAGS="-static -static-libgcc -static-libstdc++" make clean make static mv amath dist/amath-${version}-x86.exe make clean -./configure --enable-test --cross-compile="x86_64-w64-mingw32" CFLAGS="-D_WIN32" LDFLAGS="-static -static-libgcc -static-libstdc++" +./configure --enable-test --cross-compile="x86_64-w64-mingw32" CFLAGS="-DWINDOWS" LDFLAGS="-static -static-libgcc -static-libstdc++" make static mv amath dist/amath-${version}-x64.exe make clean -./configure --enable-test --cross-compile="i686-w64-mingw32" CFLAGS="-D_WIN32 -DANSICONSOLE" LDFLAGS="-static -static-libgcc -static-libstdc++" -make static -mv amath dist/amath-${version}-ansi-x86.exe -make clean - -./configure --enable-test --cross-compile="x86_64-w64-mingw32" CFLAGS="-D_WIN32 -DANSICONSOLE" LDFLAGS="-static -static-libgcc -static-libstdc++" -make static -mv amath dist/amath-${version}-ansi-x64.exe -make clean - cd dist touch hashkeys sha1sum amath-${version}-x86.exe >>hashkeys sha1sum amath-${version}-x86.exe >>hashkeys -sha1sum amath-${version}-ansi-x86.exe >>hashkeys -sha1sum amath-${version}-ansi-x64.exe >>hashkeys sha256sum amath-${version}-x86.exe >>hashkeys sha256sum amath-${version}-x86.exe >>hashkeys -sha256sum amath-${version}-ansi-x86.exe >>hashkeys -sha256sum amath-${version}-ansi-x64.exe >>hashkeys cd .. cp LICENSE dist/ diff --git a/catalog/dansk/amath-help.ct b/catalog/dansk/amath-help.ct deleted file mode 100644 index 15001343..00000000 --- a/catalog/dansk/amath-help.ct +++ /dev/null @@ -1,114 +0,0 @@ -## version $VER: amath-help.catalog 1.60 (09.04.2015) Danish -## language dansk -## codeset 0 -; ############################################################################# -; Copyright (c) 2014-2017 Carsten Sonne Larsen -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; * Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; -; * Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -; ############################################################################# -; ### flexcat catalog/help.cd NEWCTFILE catalog/danish/amath-help.ct -; flexcat catalog/help.cd catalog/danish/amath-help.ct CATALOG catalog/danish/amath-help.catalog -; ############################################################################# -symzero -Indtast kommando eller udtryk.#NEWLINE##SYNTAXHIGHLIGHT#Eksempel: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#Mere hj�lp er tilg�ngelig i udvalgte omr�der#NEWLINE#-------------------------------------------------#NEWLINE#funktioner Grundl�ggende funktioner.#NEWLINE#trigo Trigonometriske funktioner.#NEWLINE#hyper Hyperbolske funktioner.#NEWLINE#kompleks Komplekse tal.#NEWLINE#kommandoer Underst�ttede kommondoer.#NEWLINE#operatorer Underst�ttede operatorer.#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Eksemple: hj�lp trigo#NEWLINE# -symoperator --------------------------------------------------#NEWLINE# + Matematik addition.#NEWLINE# - Matematik subtraktion.#NEWLINE# * Matematik multiplikation.#NEWLINE# / Matematik division.#NEWLINE# ^ Matematik potensopl�ftning.#NEWLINE# = Tildeling af variabel v�rdi.#NEWLINE# | Absolutte eller numerisk v�rdi.#NEWLINE#-------------------------------------------------#NEWLINE# -symfunction --------------------------------------------------#NEWLINE#abs Absolutte eller numerisk v�rdi.#NEWLINE#sgn Matematik signum funktion.#NEWLINE#round Afrund til n�rmeste heltal.#NEWLINE#trunc Fjern decimaler.#NEWLINE#floor Afrund i positiv retning.#NEWLINE#ceil Afrund i negativ retning.#NEWLINE#sqrt Kvadratrodsfunktion (exponent 1/2).#NEWLINE#cbrt Kubikrods (exponent 1/3).#NEWLINE#lb Bin�r logaritme funktion (grundtal 2).#NEWLINE#ln Naturlig logaritme funktion (grundtal e).#NEWLINE#lg 10-talslogaritme funktion (grundtal 10).#NEWLINE#-------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Eksempel: round(1.55)#NORMALTEXT##NEWLINE# -symtrigon --------------------------------------------------#NEWLINE#sin Trigonometrisk sinus funktion.#NEWLINE#cos Trigonometrisk cosinus funktion.#NEWLINE#tan Trigonometrisk tangent funktion.#NEWLINE#cot Trigonometrisk cotangent funktion.#NEWLINE#sec Trigonometrisk secant funktion.#NEWLINE#csc Trigonometrisk cosecant funktion.#NEWLINE#asin Invers trigonometrisk sinus funktion.#NEWLINE#acos Invers trigonometrisk cosinus funktion.#NEWLINE#atan Invers trigonometrisk tangent funktion.#NEWLINE#acot Invers trigonometrisk cotangent funktion.#NEWLINE#asec Invers trigonometrisk secant funktion.#NEWLINE#acsc Invers trigonometrisk cosecant funktion.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse funktioner kan prefixes med ar eller arc #NEWLINE#i stedet for a.#NEWLINE# -symhyper --------------------------------------------------#NEWLINE#sinh Hyperbolsk sinus funktion.#NEWLINE#cosh Hyperbolsk cosinus funktion.#NEWLINE#tanh Hyperbolsk tangent funktion.#NEWLINE#coth Hyperbolsk cotangent funktion.#NEWLINE#sech Hyperbolsk secant funktion.#NEWLINE#csch Hyperbolsk cosecant funktion. #NEWLINE#asinh Invers hyperbolsk sinus funktion.#NEWLINE#acosh Invers hyperbolsk cosinus funktion.#NEWLINE#atanh Invers hyperbolsk tangent funktion.#NEWLINE#acoth Invers hyperbolsk cotangent funktion.#NEWLINE#asech Invers hyperbolsk secant funktion.#NEWLINE#acsch Invers hyperbolsk cosecant funktion.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse funktioner kan prefixes med ar eller arc #NEWLINE#i stedet for a.#NEWLINE# -symearly -TODO-------------------------------------------------#NEWLINE#ver Versed sine function.#NEWLINE#vcs Versed cosine function.#NEWLINE#cvs Coversed sine function.#NEWLINE#cvc Coversed cosine function.#NEWLINE#hv Haversed sine function.#NEWLINE#hvc Haversed cosine function.#NEWLINE#hcv Hacoversed sine function.#NEWLINE#hcc Hacoversed cosine function.#NEWLINE#aver Inverse versed sine function.#NEWLINE#avcs Inverse versed cosine function.#NEWLINE#acvs Inverse coversed sine function.#NEWLINE#acvc Inverse coversed cosine function.#NEWLINE#ahv Inverse haversed sine function.#NEWLINE#ahvc Inverse haversed cosine function.#NEWLINE#ahcv Inverse hacoversed sine function.#NEWLINE#ahcc Inverse hacoversed cosine function.#NEWLINE#-------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc #NEWLINE#instead of a.#NEWLINE# -symcomplex -Udtryk med komplekse tal skrives ved at angive i#NEWLINE#sammen med den imagin�re talv�rdi. Komplekse tal#NEWLINE#kan blandes med reelle tal.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: 2+3i#NEWLINE#Eksempel: 2+3.2i*cos(-1i)+5/7#NEWLINE# -symclear -Ryd kommandoen sletter alt tekst i konsol vinduet.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: ryd#NEWLINE# -symdef -Definer kommandoen bruges til at definere funktioner med. Det er ikke#NEWLINE#strengt n�dvendigt at angive kommandoen, n�r en funktion skal defineres.#NEWLINE#Allerede definerede funktioner kan vises med kommandoen #SYNTAXHIGHLIGHT#funtioner#NORMAL#.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: definer f(x)=2*x+3#NEWLINE#Alternativ syntaks: f(x)=2*x+3#NEWLINE# -; Help for delete statement -symdelete -The delete statement can delete variable and funktions. To delete a#NEWLINE#single variable or funktions use the name of the funktion or variable.#NEWLINE#To delete all funktions or variables specify either the variable or#NEWLINE#funktion keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: delete f(x)#NEWLINE#Syntaks: delete variables#NEWLINE# -; Help for digits statement -symdigits -The digits statement defines the displayed number of significant digits.#NEWLINE#To show current configuration use the digits statement without specifying#NEWLINE#the number.#NEWLINE# #SYNTAXHIGHLIGHT#Syntaks: digits 7#NEWLINE# -; Help for eval statement -symeval -The eval statement evaluates an expression. When evaluating an expression#NEWLINE#it is possible to omit the eval keyword.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: eval 2.4*x+3.2#NEWLINE#Optional syntax: 2.4*x+3.2#NEWLINE# -; Help for execute statement -symexecute -The execute statement reads the content of a file and execute all statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: execute "savedfile"#NEWLINE# -; Help for input statement -syminput -The input statement either changes or shows the how numeral input is interpreted.#NEWLINE#Possible input systems are: binary, octal, decimal and hexadecimal. Default is#NEWLINE#decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral output system can be modified using the output statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: input hexadecimal#NEWLINE#Syntaks: input 4#NEWLINE# -; Help for help statement -symhelp -The help statement can be used to display help about topics and statements.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: help variables#NEWLINE# -; Help for output statement -symoutput -The output statement either changes or shows the how numeral output is shown.#NEWLINE#Possible output systems are: binary, octal, decimal and hexadecimal. Default#NEWLINE#is decimal. To use positional systems with other bases specify the base number.#NEWLINE#Numeral input system can be modified using the input statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: output octal#NEWLINE# -; Help for list statement -symlist -No description is available for the list statement.#NEWLINE# -symshow -Vis kommandoen kan bruges til at vise indholdet af en fil, der �nskes k�rt.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: vis "mitscript"#NEWLINE# -; Help for load statement -symload -The load statement retrieves a set of defined variables and funktions from#NEWLINE#a file. Variables and funktions can be saved using the save statement.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: load "savedwork"#NEWLINE# -; Help for save statement -symsave -Med gem kommando kan variabler og funktioner i hukommelsen gemmes til en fil.#NEWLINE#Gemte variabler og funktion kan indl�stet igen med #SYNTAXHIGHLIGHT#hent#NORMAL# kommandoen.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: gem "mitarbejde"#NEWLINE# -symversion -Viser hvilken version af amath der k�rer.#NEWLINE# -symabout -TODOShow various information about the running version of amath.#NEWLINE# -symlicense -TODOShow license details.#NEWLINE# -symmem -Viser internt hukommelsesforbrug. Programkoden er ikke medregnet.#NEWLINE# -; Help for prefs statement -symprefs -There is no help for prefs statement now.#NEWLINE# -symvariable -Variabler kommandoen viser en list af definerede variabler i hukommelsen.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: variabler#NEWLINE#Alternativ syntaks: var#NEWLINE# -symexit -Afslut kommandoen lukker amath programmet.#NEWLINE##SYNTAXHIGHLIGHT#Syntaks: afslut#NEWLINE# -; Help for constant epsilon -syme -Euler's number is base of the exponential funktion which equals its own#NEWLINE#derivative. It is approximately equal to 2.71828.#NEWLINE##SYNTAXHIGHLIGHT#Example: ln(e)#NEWLINE# -; Help for constant pi -sympi -Pi is the ratio of the circumference of a circle to its diameter. Being an#NEWLINE#irrational number, pi cannot be expressed exactly as a common fraction.#NEWLINE#The value of pi is commonly approximated as #SYNTAXHIGHLIGHT#3.14159#NORMALTEXT#.#NEWLINE# -symi -Den imagin�re enhen refereres og angives almindelig vis som i.#NEWLINE#Den imagin�re enhen et tal, som n�r det ganges med sig selv,#NEWLINE#giver resultatet -1.#NEWLINE# -symins -Den sidst udregnede v�rdi kan benyttes i n�ste udtryk ved hj�lp af #SYNTAXHIGHLIGHT#ins#NORMAL# variablen.#NEWLINE##SYNTAXHIGHLIGHT#Eksemple: ins*0,25#NEWLINE# -symbin -Der er ikke nogen hj�lp tilg�ngelig om bin�r n�gleordet.#NEWLINE -symoct -Der er ikke nogen hj�lp tilg�ngelig om oktal n�gleordet.#NEWLINE -symdec -Der er ikke nogen hj�lp tilg�ngelig om decimal n�gleordet.#NEWLINE -symhex -Der er ikke nogen hj�lp tilg�ngelig om hexadecimal n�gleordet.#NEWLINE diff --git a/catalog/dansk/amath-ident.ct b/catalog/dansk/amath-ident.ct deleted file mode 100644 index ec54132f..00000000 --- a/catalog/dansk/amath-ident.ct +++ /dev/null @@ -1,121 +0,0 @@ -## version $VER: amath-ident.catalog 1.60 (08.04.2015) Danish -## language dansk -## codeset 0 -; ############################################################################# -; ## Help texts for built-in functions in amath -; ## ------------------------------------------ -; ## -; ## This file is published under Creative Common License. See: -; ## http://creativecommons.org/licenses/by-sa/3.0/ -; ## Parts of the content came from wikipedia.org -; ############################################################################# -abs -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -sgn -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -round -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -trunc -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -floor -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -ceil -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -sqr -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -cbr -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -lb -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -ln -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -lg -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -sin -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -cos -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -tan -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -cot -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -sec -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -csc -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -asin -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -acos -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -atan -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -acot -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -asec -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -acsc -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -sinh -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -cosh -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -tanh -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -coth -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -sech -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -csch -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -asinh -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -acosh -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -atanh -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -acoth -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -asech -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -acsch -Der er ikke nogen hj�lp tilg�ngelig om den funktion.#NEWLINE# -ver -The versed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the cosine.#NEWLINE#ver(x) = 1 - cos(x)#NEWLINE# -vcs -The versed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the cosine.#NEWLINE#ver(x) = 1 + cos(x)#NEWLINE# -cvs -The coversed sine is an early appearing trigonometric function.#NEWLINE#It is equal to one minus the sine.#NEWLINE#ver(x) = 1 - sin(x)#NEWLINE# -cvc -The coversed cosine is an early appearing trigonometric function.#NEWLINE#It is equal to one plus the sine.#NEWLINE#cvc(x) = 1 + sin(x)#NEWLINE# -hv -No help is available for the haversed sine function.#NEWLINE# -hvc -No help is available for the haversed cosine function.#NEWLINE# -hcv -No help is available for the hacoversed sine function.#NEWLINE# -hcc -No help is available for the hacoversed cosine function.#NEWLINE# -aver -No help is available for this function.#NEWLINE# -avcs -No help is available for this function.#NEWLINE# -acvs -No help is available for this function.#NEWLINE# -acvc -No help is available for this function.#NEWLINE# -ahv -No help is available for this function.#NEWLINE# -ahvc -No help is available for this function.#NEWLINE# -ahcv -No help is available for this function.#NEWLINE# -ahcc -No help is available for this function.#NEWLINE# -exsec -No help is available for this function.#NEWLINE# -excsc -No help is available for this function.#NEWLINE# -aexsec -No help is available for this function.#NEWLINE# -aexcsc -No help is available for this function.#NEWLINE# \ No newline at end of file diff --git a/catalog/dansk/amath-keyword.ct b/catalog/dansk/amath-keyword.ct deleted file mode 100644 index 15e41134..00000000 --- a/catalog/dansk/amath-keyword.ct +++ /dev/null @@ -1,164 +0,0 @@ -## version $VER: amath-keyword.catalog 1.60 (08.04.2015) Danish -## language dansk -## codeset 0 -;############################################################################# -; Copyright (c) 2014-2017 Carsten Sonne Larsen -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; * Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; -; * Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -;############################################################################# -;######### ClearStatement -clear -ryd -;######### FunctionDefinition statement -def -definer -;######### DeleteStatement and keyword -delete -slet -;######### Eulers Number keyword -e -e -;######### Complex i keyword -i -i -;######### pi keyword -pi -pi -;######### ins variable keyword -ins -ins -;######### EvalStatement -eval -beregn -;######### DrawStatement -draw -tegn -;######### PlotStatement -plot -plot -;######### ExecuteStatement -execute -k�r -;######### ExitStatement -exit -afslut -quit -slut -;######### Statements keyword -statements -kommandoer -;######### Operators keyword -operators -operatorer -;######### Complex keyword -complex -kompleks -;######### Function keyword -funcs -funk -functions -funktioner -;######### Trigonometric keyword -trigon -trigo -trigonometric -trigonometri -;######### Hyperbolic keyword -hyper -hyper -hyperbolic -hyperbolsk -;######### Early keyword -early -tidlig -;######### HelpStatement -help -hj�lp -;######### PromptStatement -prompt -prompt -;######### VersionStatement -version -version -;######### MemoryStatement -mem -hukommelse -memory -hukommelse -;######### PrefsStatement -prefs -pr�f -preferences -pr�ferencer -;######### ListStatement and keyword -list -list -;######### LoadStatement and keyword -load -hent -;######### SaveStatement and keyword -save -gem -;######### ShowStatement and keyword -show -vis -;######### ListVariablesStatement and keyword -vars -var -variables -variabler -;######### DigitsStatement -digits -cifre -;######### InputStatement -input -ind -;######### OutputStatement -output -ud -;######### Binary keyword -bin -bin -binary -bin�r -;######### Octal keyword -oct -okt -octal -oktal -;######### Decimal keyword -dec -dec -decimal -decimal -;######### Hexadecimal keyword -hex -hex -hexadecimal -hexadecimal -;######### AboutStatement and keyword -about -om -;######### LicenseStatement and keyword -license -lisens \ No newline at end of file diff --git a/catalog/dansk/amath-text.ct b/catalog/dansk/amath-text.ct deleted file mode 100644 index 99c76200..00000000 --- a/catalog/dansk/amath-text.ct +++ /dev/null @@ -1,136 +0,0 @@ -## version $VER: amath-text.catalog 1.60 (08.04.2015) Danish -## language dansk -## codeset 0 -; ############################################################################# -; Copyright (c) 2014-2017 Carsten Sonne Larsen -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; * Redistributions of source code must retain the above copyright notice, this -; list of conditions and the following disclaimer. -; -; * Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -; SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -; CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -; OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -; ############################################################################# -INTROMSG -#NORMALTEXT##BOLD##STARTMSG##NEWLINE##NORMALTEXT##COLOR02#Skriv hj�lp for at f� vist uddybende information.#NEWLINE# -STATEMENTLINE ----------------------------------------------------------#NEWLINE# -STATEMENTCLEAR -clear Clear console window.#NEWLINE# -STATEMENTDEF -def Define function.#NEWLINE# -STATEMENTDELETE -delete Delete variable or function.#NEWLINE# -STATEMENTDIGITS -digits Set number of significant digits.#NEWLINE# -STATEMENTEVAL -eval Evaluate arithmetic expression.#NEWLINE# -STATEMENTEXECUTE -execute Execute statements in a file.#NEWLINE# -STATEMENTFUNCS -functions Show list of user defined functions.#NEWLINE# -STATEMENTINPUT -input Change numeral input system.#NEWLINE# -STATEMENTHELP -help Show basic help text.#NEWLINE# -STATEMENTOUTPUT -output Change numeral output system.#NEWLINE# -STATEMENTLIST -list Show content of a directory.#NEWLINE# -STATEMENTSHOW -show Show content of a file.#NEWLINE# -STATEMENTLOAD -load Load variable and functions from file.#NEWLINE# -STATEMENTSAVE -save Save variable and functions to file.#NEWLINE# -STATEMENTVARS -variables Show list of variables.#NEWLINE# -STATEMENTVERSION -version Show version string.#NEWLINE# -STATEMENTMEMORY -memory Show internal memory usage.#NEWLINE# -STATEMENTEXIT -exit Exit program.#NEWLINE# -STATEMENTFOOTER -The def and eval statements are optional. Functions and#NEWLINE#variables statements can be shorten to funcs and vars.#NEWLINE# -TXTLISTDIRHEADER - Type Navn#NEWLINE#-----------------------------------------------#NEWLINE# -TXTLISTDIRTFILE -[fil] -TXTLISTDIRTDIR -[mappe] -TXTLISTDIRTUNKNOWN -[ukendt] -TXTMEMBLOCKS -Allokerede blokke: #SPACE# -TXTMEMSIZE -Hukommelsesforbrug:#SPACE# -TXTMEMMAXSIZE -H�jeste forbrug: #SPACE# -HELPNOHELP -Der er ingen hj�lp tilg�ngelig om det emne.#NEWLINE# -HELPSYNTAX -Syntaktiske fejl:#SPACE# -HELPUERROR -Uventet fejl:#SPACE# -HELPVARNDEF -Variablen er ikke defineret:#SPACE# -HELPFUNNDEF -Funktionen er ikke defineret:#SPACE# -HELPFUNRDEF -Funktionen er allerede defineret:#SPACE# -HELPPNUMERA -Grundtallet skal v�re mellem 2 og 32:#SPACE# -HELPPDIGITS -Antal betydende cifre skal v�re mellem 0 og 15:#SPACE# -HELPINPUSHOW -Talsystemet n�r computeren l�ser ind er#SPACE# -HELPOUTPSHOW -Talsystemet n�r computeren skriver ud er#SPACE# -HELPINPUSETT -Talsystemet ved indl�sning �ndret til#SPACE# -HELPOUTPSETT -Talsystemet ved udskrivning �ndret til#SPACE# -HELPDIGISETT -Antal betydende cifre �ndret til#SPACE# -HELPDIGISHOW -Antal betydende cifre der vises er#SPACE# -HELPVARSNDEF -Der er ikke defineret nogle variabler.#NEWLINE# -HELPFUNCNDEF -Der er ikke defineret nogle funktioner.#NEWLINE# -HELPLOADSUCC -Variabler og funktioner indl�st fra fil.#NEWLINE# -HELPSAVESUCC -Variabler og funktioner gemt til fil.#NEWLINE# -HELPSAVEFAIL -Kan ikke gemme fil.#NEWLINE# -HELPSAVENOTH -Der er ikke noget og gemme.#NEWLINE# -HELPPREFLOAD -Pr�ferencer blev indl�st.#NEWLINE# -HELPPREFNOLO -Kunne ikke indl�ses pr�ferencer.#NEWLINE# -HELPPREFSAVE -Pr�ferencer blev gemt.#NEWLINE# -HELPPREFNOSA -Kunne ikke gemme pr�ferencer.#NEWLINE# -MSGNODIR -Mappen kan ikke �bnes:#SPACE# -MSGNOFILE -Filen kan ikke �bnes.#NEWLINE# diff --git a/configure b/configure index 49d4b5e1..2f4f956c 100755 --- a/configure +++ b/configure @@ -27,7 +27,7 @@ set -e -version="1.7.0" +version="1.7.1" clang=false debugsym=false @@ -85,9 +85,9 @@ for arg in "$@"; do --disable-test) regtest=false;; - --enable-stdc++) + --with-stdc++) gcclib="-lstdc++";; - --disable-stdc++) + --without-stdc++) gcclib="";; --help) @@ -104,14 +104,14 @@ for arg in "$@"; do echo ' --disable-test: do not include regression test' echo ' --enable-clang: build with clang compiler' echo ' --disable-clang: do not build with clang compiler' - echo ' --enable-stdc++: link with stdc++ library' - echo ' --disable-stdc++: do not link with stdc++ library' + echo ' --with-stdc++: link with stdc++ library' + echo ' --without-stdc++: do not link with stdc++ library' echo echo ' CFLAGS=: additional compiler flags' echo ' CXXFLAGS=: additional compiler flags' echo ' LDFLAGS=: additional linker flags' echo - echo 'all invalid options are silently ignored' + echo 'No warnings are shown for Invalid options.' exit 0 ;; esac @@ -161,6 +161,8 @@ SYSSRCS=' console.cpp console_amiga.cpp console_stdc.cpp +console_posix.cpp +console_windows.cpp filesystem_amiga.cpp filesystem_stdc.cpp language.cpp @@ -170,14 +172,13 @@ language_stdc.cpp preferences.cpp preferences_amiga.cpp preferences_stdc.cpp -proc_amiga.cpp program.cpp program_amiga.cpp +program_haiku.cpp program_stdc.cpp program_test.cpp -task_amiga.cpp -task_stdc.cpp window_amiga.cpp +window_haiku.cpp ' FUNCTIONSRC=' absolute.cpp @@ -693,7 +694,6 @@ echo "clean:" echo " \${DEL} static/\${alib} \${solib} ${libc} ${libcs}" echo } > src/clib/Makefile - ######################################################################### ############################# Real Numbers ############################## @@ -907,13 +907,13 @@ echo " cd src/lib && \${MAKE}" echo echo "${amath}:" echo " cd src/real && \${MAKE}" -echo +echo echo "${amathc}:" echo " cd src/clib && \${MAKE}" -echo +echo echo "${amathcplex}:" echo " cd src/cplex && \${MAKE}" -echo +echo echo "localize:" echo " cd build/flexcat && \${MAKE}" echo " \${FLXCAT} text/keyword.cd src/localize/kword.h=text/keyword.sd" @@ -927,11 +927,6 @@ echo " \${MKDIR} dist/catalog/english" echo " \${FLXCAT} text/help.cd catalog/english/amath-help.ct CATALOG dist/catalog/english/amath-help.catalog" echo " \${FLXCAT} text/ident.cd catalog/english/amath-ident.ct CATALOG dist/catalog/english/amath-ident.catalog" echo " \${FLXCAT} text/text.cd catalog/english/amath-text.ct CATALOG dist/catalog/english/amath-text.catalog" -echo " \${MKDIR} dist/catalog/dansk" -echo " \${FLXCAT} text/help.cd catalog/dansk/amath-help.ct CATALOG dist/catalog/dansk/amath-help.catalog" -echo " \${FLXCAT} text/ident.cd catalog/dansk/amath-ident.ct CATALOG dist/catalog/dansk/amath-ident.catalog" -echo " \${FLXCAT} text/text.cd catalog/dansk/amath-text.ct CATALOG dist/catalog/dansk/amath-text.catalog" -echo " \${FLXCAT} text/keyword.cd catalog/dansk/amath-keyword.ct CATALOG dist/catalog/dansk/amath-keyword.catalog" echo echo "shared-app: app libs ${program}.o" echo " \${CC} \${CFLAGS} ${exestrip} ${program}.o -o amath \${LPATH} \${LFLAGS}" diff --git a/src/amath.h b/src/amath.h index d86ff0ea..917339f6 100644 --- a/src/amath.h +++ b/src/amath.h @@ -60,6 +60,12 @@ # endif #endif /******************************************************************************/ +#ifdef _WIN32 +# ifndef WINDOWS +# define WINDOWS +# endif +#endif +/******************************************************************************/ #if defined(AOS3) || defined(AOS4) || defined(AROS) || defined (MORPHOS) # ifndef AMIGA # define AMIGA @@ -72,30 +78,29 @@ # endif #endif /******************************************************************************/ -#if defined(AMIGA) || defined(HAIKU) || defined(UNIX) -# ifndef ANSICONSOLE -# define ANSICONSOLE +#if defined(HAIKU) || defined(UNIX) +# ifndef POSIX +# define POSIX # endif #endif /******************************************************************************/ -#ifdef HAIKU +#if !defined(AMIGA) && !defined(POSIX) && !defined(WINDOWS) +# ifndef STDC_CONSOLE +# define STDC_CONSOLE +# endif +#endif +/******************************************************************************/ +#if defined(POSIX) # include # include # include #endif /******************************************************************************/ -#ifdef UNIX -# include -# include -# include -# include -#endif -/******************************************************************************/ -#ifdef _WIN32 +#if defined(WINDOWS) # include #endif /******************************************************************************/ -#ifdef AOS3 +#if defined(AOS3) # include # define IPTR LONG* # define uintptr_t uint32_t @@ -110,10 +115,9 @@ typedef u_int64_t uint64_t; # include #endif /******************************************************************************/ -#if (__cplusplus <= 199711L && !defined(_WIN32)) || !defined(__cplusplus) +#if (__cplusplus <= 199711L && !defined(WINDOWS)) || !defined(__cplusplus) #define nullptr 0 -#endif -#if defined(__GNUC__) || defined(__GNUG__) +#elif (__cplusplus <= 199711L) && (defined(__GNUC__) || defined(__GNUG__)) #define nullptr 0 #endif /******************************************************************************/ @@ -208,7 +212,7 @@ typedef u_int64_t uint64_t; #define SPACE " " #define DOT "." /******************************************************************************/ -#ifdef _WIN32 +#ifdef WINDOWS #define NEWLINE "\r\n" #else #define NEWLINE "\n" @@ -272,30 +276,22 @@ typedef int bool; # define TXTFPU EMPTYSTRING #endif /******************************************************************************/ -#if defined(WITHTEST) && !defined(ANSICONSOLE) -# define TXTOPTS "TEST" -#endif -#if !defined(WITHTEST) && defined(ANSICONSOLE) -# define TXTOPTS "ANSI" -#endif -#if defined(WITHTEST) && defined(ANSICONSOLE) -# define TXTOPTS "ANSI, TEST" -#endif -#ifdef TXTOPTS -# define TXTOPTMSG SPACE "(OPT: " TXTOPTS ")" +#if defined(WITHTEST) +# define TXTOPTMSG SPACE "(test)" #else # define TXTOPTMSG EMPTYSTRING #endif /******************************************************************************/ #define TXTARCH TXTCPU TXTFPU -#define RELDATESTAMP "(12-03-2017)" -#define TXTDOSVERSION "\0$VER: amath 1.70" SPACE RELDATESTAMP SPACE TXTARCH -#define TXTTITLE "amath version 1.7.0" +#define RELDATESTAMP "(10-04-2017)" +#define TXTDOSVERSION "\0$VER: amath 1.71" SPACE RELDATESTAMP SPACE TXTARCH +#define TXTTITLE "amath version 1.7.1" #define TXTCOPYRIGHT "(c) 2017 Carsten Sonne Larsen" #define TXTSTARTMSG TXTTITLE SPACE TXTCOPYRIGHT /******************************************************************************/ #define TXTVERSMSG TXTTITLE SPACE RELDATESTAMP SPACE TXTARCH #define TXTCOMPMSG "Compiled with " COMP_NAME SPACE COMP_VERS TXTOPTMSG +#define TXTCOMPSHTMSG "Compiled with " COMP_NAME SPACE COMP_VERS /******************************************************************************/ #define CPROCNAME "amath_console" /******************************************************************************/ @@ -318,45 +314,4 @@ typedef int bool; #define CATALOG_DEF OC_BuiltInLanguage, "english" #endif /******************************************************************************/ -#if defined(ANSICONSOLE) -#define HEADLINE "\x1B[1m" -#ifdef UNIX -#define SYNTAXHIGHLIGHT "\x1B[3m\x1B[32m" -#else -#define SYNTAXHIGHLIGHT "\x1B[32m" -#endif -#define NORMALTEXT "\x1B[0m" -#define BOLD "\x1B[1m" -#define ITALICS "\x1B[3m" -#define UNDERLINE "\x1B[4m" -#define COLOR01 "\x1B[31m" -#define COLOR02 "\x1B[32m" -#define COLOR03 "\x1B[33m" -#define CURSORFORWARD "\x1B[1C" -#define CURSORBACKWARD "\x1B[1D" -#define ERASEINLINE "\x1B[K" -#define INSERT1CHAR "\x1B[1@" -#define DELETE1CHAR "\x1B[1P" -#define DELETELINE "\x0D\x1B[K" -#define CLEARWINDOW "\x1B[1;1H\x1B[J" -/******************************************************************************/ -#else -#define HEADLINE EMPTYSTRING -#define SYNTAXHIGHLIGHT EMPTYSTRING -#define NORMALTEXT EMPTYSTRING -#define BOLD EMPTYSTRING -#define ITALICS EMPTYSTRING -#define UNDERLINE EMPTYSTRING -#define COLOR01 EMPTYSTRING -#define COLOR02 EMPTYSTRING -#define COLOR03 EMPTYSTRING -#define CURSORFORWARD EMPTYSTRING -#define CURSORBACKWARD EMPTYSTRING -#define ERASEINLINE EMPTYSTRING -#define INSERT1CHAR EMPTYSTRING -#define DELETE1CHAR EMPTYSTRING -#define DELETELINE EMPTYSTRING -#define CLEARWINDOW EMPTYSTRING -#endif -/******************************************************************************/ #endif diff --git a/src/amath.sln b/src/amath.sln deleted file mode 100644 index 5d2db161..00000000 --- a/src/amath.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26228.4 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amath", "amath.vcxproj", "{834DBB3E-042B-41E5-9400-EEC16CF003C7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Debug|x64.ActiveCfg = Debug|x64 - {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Debug|x64.Build.0 = Debug|x64 - {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Debug|x86.ActiveCfg = Debug|Win32 - {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Debug|x86.Build.0 = Debug|Win32 - {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Release|x64.ActiveCfg = Release|x64 - {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Release|x64.Build.0 = Release|x64 - {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Release|x86.ActiveCfg = Release|Win32 - {834DBB3E-042B-41E5-9400-EEC16CF003C7}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/amath.vcxproj b/src/amath.vcxproj deleted file mode 100644 index 9b729b60..00000000 --- a/src/amath.vcxproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {834DBB3E-042B-41E5-9400-EEC16CF003C7} - Win32Proj - amath - 10.0.14393.0 - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - true - - - false - - - false - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - - - - - - - Level3 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - Console - true - true - - - - - - - - \ No newline at end of file diff --git a/src/amath.vcxproj.filters b/src/amath.vcxproj.filters deleted file mode 100644 index 6a1782f7..00000000 --- a/src/amath.vcxproj.filters +++ /dev/null @@ -1,17 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - \ No newline at end of file diff --git a/src/amathc.h b/src/amathc.h index c2d65a61..5188c554 100644 --- a/src/amathc.h +++ b/src/amathc.h @@ -51,6 +51,7 @@ typedef struct void* AllocMemSafe(size_t); void FreeMemSafe(void*); +void DetachMemSafe(void*); void FreeAllSafe(); void MemUsage(long*, long*, long*); diff --git a/src/clib/Makefile b/src/clib/Makefile deleted file mode 100644 index 36a2d0ff..00000000 --- a/src/clib/Makefile +++ /dev/null @@ -1,104 +0,0 @@ -CC = gcc -CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -MKDIR = mkdir -p -DEL = rm -f -INSTALL = install -m 0644 -LDCONFIG = ldconfig -PREFIX = /usr -INSTDIR = ${DESTDIR}${PREFIX}/lib/amath -INSTDIRI = ${DESTDIR}${PREFIX}/include/amath -INSTDIRPC = ${DESTDIR}${PREFIX}/lib/pkgconfig -INSTDIRM = ${DESTDIR}${PREFIX}/share/man/man3 -alib = libamathc.a -solib = libamathc.so -pkgconfig = amathc.pc -manpage = amathc.3 - -all: static shared - -static: ${alib} - -shared: ${solib} - -static/alloccpy.o: alloccpy.c - ${CC} ${CFLAGS} -fno-builtin -c alloccpy.c -o static/alloccpy.o - -shared/alloccpy.o: alloccpy.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c alloccpy.c -o shared/alloccpy.o - -static/mem.o: mem.c - ${CC} ${CFLAGS} -fno-builtin -c mem.c -o static/mem.o - -shared/mem.o: mem.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c mem.c -o shared/mem.o - -static/memcpy.o: memcpy.c - ${CC} ${CFLAGS} -fno-builtin -c memcpy.c -o static/memcpy.o - -shared/memcpy.o: memcpy.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c memcpy.c -o shared/memcpy.o - -static/memset.o: memset.c - ${CC} ${CFLAGS} -fno-builtin -c memset.c -o static/memset.o - -shared/memset.o: memset.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c memset.c -o shared/memset.o - -static/strcmp.o: strcmp.c - ${CC} ${CFLAGS} -fno-builtin -c strcmp.c -o static/strcmp.o - -shared/strcmp.o: strcmp.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c strcmp.c -o shared/strcmp.o - -static/strlen.o: strlen.c - ${CC} ${CFLAGS} -fno-builtin -c strlen.c -o static/strlen.o - -shared/strlen.o: strlen.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c strlen.c -o shared/strlen.o - -static/untag.o: untag.c - ${CC} ${CFLAGS} -fno-builtin -c untag.c -o static/untag.o - -shared/untag.o: untag.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c untag.c -o shared/untag.o - -.PHONY: build -build: - ${MKDIR} static - ${MKDIR} shared - -${solib}: build shared/alloccpy.o shared/mem.o shared/memcpy.o shared/memset.o shared/strcmp.o shared/strlen.o shared/untag.o - ${CC} ${CFLAGS} -shared -s -fPIC -Wl,-soname,${solib}.1.7.0 -o ${solib} shared/alloccpy.o shared/mem.o shared/memcpy.o shared/memset.o shared/strcmp.o shared/strlen.o shared/untag.o -lc - -${alib}: build static/alloccpy.o static/mem.o static/memcpy.o static/memset.o static/strcmp.o static/strlen.o static/untag.o - ${AR} rcs static/${alib} static/alloccpy.o static/mem.o static/memcpy.o static/memset.o static/strcmp.o static/strlen.o static/untag.o - ${RANLIB} static/${alib} - -.PHONY: install -install: ${alib} ${solib} - ${MKDIR} ${INSTDIR} - ${MKDIR} ${INSTDIRPC} - ${MKDIR} ${INSTDIRI} - ${INSTALL} static/${alib} ${INSTDIR}/${alib} - ${INSTALL} ${solib} ${INSTDIR}/${solib} - ${INSTALL} ${pkgconfig} ${INSTDIRPC}/${pkgconfig} - ${INSTALL} ${manpage} ${INSTDIRM}/${manpage} - ${INSTALL} ../amath.h ${INSTDIRI} - ${INSTALL} ../amathc.h ${INSTDIRI} - ${LDCONFIG} ${INSTDIR} - -.PHONY: uninstall -uninstall: - ${DEL} ${INSTDIR}/${alib} - ${DEL} ${INSTDIR}/${solib} - ${DEL} ${INSTDIRPC}/${pkgconfig} - ${DEL} ${INSTDIRM}/${manpage} - ${DEL} ${INSTDIRI}/amath.h - ${DEL} ${INSTDIRI}/amathc.h - ${LDCONFIG} - -clean: - ${DEL} static/${alib} ${solib} static/alloccpy.o static/mem.o static/memcpy.o static/memset.o static/strcmp.o static/strlen.o static/untag.o shared/alloccpy.o shared/mem.o shared/memcpy.o shared/memset.o shared/strcmp.o shared/strlen.o shared/untag.o - diff --git a/src/clib/amathc.3 b/src/clib/amathc.3 index 08bcfe1d..0dd877e6 100644 --- a/src/clib/amathc.3 +++ b/src/clib/amathc.3 @@ -1,4 +1,4 @@ -.TH "amath/amathc.h" 3 "Wed Mar 1 2017" "Version 1.7.0" "amath" \" -*- nroff -*- +.TH "amath/amathc.h" 3 "Wed Mar 1 2017" "Version 1.7.1" "amath" \" -*- nroff -*- .ad l .nh .SH NAME @@ -100,12 +100,8 @@ Definition at line 40 of file alloccpy\&.c\&. 58 *destination = AllocMemSafe(size); 59 d = *destination; 60 -61 #ifdef AMIGA // Take advantage of exec -62 CopyMem(s, d, n); -63 #else 64 while (n--) 65 *d++ = *s++; -66 #endif 67 68 return size; 69 } @@ -122,7 +118,7 @@ Definition at line 86 of file mem\&.c\&. 88 struct MemoryBlock* newblock; 89 size_t allocsize; 90 -91 if (list == NULL) +91 if (list == nullptr) 92 { 93 list = (struct MemoryList*)ALLOC_MEM(sizeof(struct MemoryList)); 94 if (!list) @@ -131,7 +127,7 @@ Definition at line 86 of file mem\&.c\&. 97 return 0; 98 } 99 -100 list->first = NULL; +100 list->first = nullptr; 101 list->peak = 0; 102 list->size = 0; 103 list->count = 0; @@ -186,13 +182,13 @@ Definition at line 199 of file mem\&.c\&. 200 { 201 struct MemoryBlock *current, *next; 202 -203 if (list == NULL) +203 if (list == nullptr) 204 { 205 return; 206 } 207 208 current = list->first; -209 while (current != NULL) +209 while (current != nullptr) 210 { 211 next = current->next; 212 FREE_MEM(current->address); @@ -201,7 +197,7 @@ Definition at line 199 of file mem\&.c\&. 215 } 216 217 FREE_MEM(list); -218 list = NULL; +218 list = nullptr; 219 } .fi .SS "void FreeMemSafe (void *)" @@ -215,33 +211,33 @@ Definition at line 147 of file mem\&.c\&. 148 { 149 struct MemoryBlock *current, *previous; 150 -151 if (list == NULL || block == NULL) +151 if (list == nullptr || block == nullptr) 152 { 153 dealloc_error("list", 0); 154 return; 155 } 156 -157 if (block == NULL) +157 if (block == nullptr) 158 { 159 dealloc_error("memory", 0); 160 return; 161 } 162 -163 previous = NULL; +163 previous = nullptr; 164 current = list->first; -165 while (current != NULL && current->address != block) +165 while (current != nullptr && current->address != block) 166 { 167 previous = current; 168 current = current->next; 169 } 170 -171 if (current == NULL) +171 if (current == nullptr) 172 { 173 dealloc_error("address not found", block); 174 return; 175 } 176 -177 if (previous == NULL) +177 if (previous == nullptr) 178 { 179 list->first = current->next; 180 } @@ -254,8 +250,8 @@ Definition at line 147 of file mem\&.c\&. 187 list->count--; 188 189 FREE_MEM(current->address); -190 current->address = NULL; -191 current->next = NULL; +190 current->address = nullptr; +191 current->next = nullptr; 192 current->size = 0; 193 FREE_MEM(current); 194 } @@ -279,9 +275,6 @@ Definition at line 77 of file memcpy\&.c\&. 86 if ((mem_ptr)dst < (mem_ptr)src) 87 { 88 // Copy forward -89 #ifdef AMIGA // Take advantage of exec -90 CopyMem((void*)source, destination, length); -91 #else 92 t = (mem_ptr)src; // only need low bits 93 if ((t | (mem_ptr)dst) & wmask) 94 { diff --git a/src/clib/amathc.pc b/src/clib/amathc.pc index 21efe36b..f9bc3f6b 100644 --- a/src/clib/amathc.pc +++ b/src/clib/amathc.pc @@ -5,6 +5,6 @@ libdir=${exec_prefix}/lib Name: amath C library Description: C functions for manipulating strings and memory -Version: 1.7.0 +Version: 1.7.1 Cflags: -I${includedir} Libs: -L${libdir} -lamathc diff --git a/src/clib/amathc.vcxproj b/src/clib/amathc.vcxproj deleted file mode 100644 index 73c99ca7..00000000 --- a/src/clib/amathc.vcxproj +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {01757088-637B-45D8-B042-14B76DF11115} - Win32Proj - - - - StaticLibrary - true - v141 - - - StaticLibrary - false - v141 - - - Application - true - v141 - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - $(ProjectDir)..;%(AdditionalIncludeDirectories) - - - MachineX86 - true - Windows - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreadedDLL - Level3 - ProgramDatabase - - - MachineX86 - true - Windows - true - true - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/clib/amathc.vcxproj.filters b/src/clib/amathc.vcxproj.filters deleted file mode 100644 index 7a9995db..00000000 --- a/src/clib/amathc.vcxproj.filters +++ /dev/null @@ -1,40 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/clib/mem.c b/src/clib/mem.c index 1b0a8bb5..b525efe3 100644 --- a/src/clib/mem.c +++ b/src/clib/mem.c @@ -75,7 +75,7 @@ struct MemoryList /** * @brief Global list of allocated memory. */ -struct MemoryList* list = NULL; +struct MemoryList* list = nullptr; void alloc_error(char*, size_t); void dealloc_error(char*, void*); @@ -88,7 +88,7 @@ void* AllocMemSafe(size_t size) struct MemoryBlock* newblock; size_t allocsize; - if (list == NULL) + if (list == nullptr) { list = (struct MemoryList*)ALLOC_MEM(sizeof(struct MemoryList)); if (!list) @@ -97,7 +97,7 @@ void* AllocMemSafe(size_t size) return 0; } - list->first = NULL; + list->first = nullptr; list->peak = 0; list->size = 0; list->count = 0; @@ -141,40 +141,37 @@ void* AllocMemSafe(size_t size) return newblock->address; } -/** - * @brief Deallocate memory from the global memory list. - */ -void FreeMemSafe(void* block) +void RemoveMemSafe(void* block, bool deallocate) { struct MemoryBlock *current, *previous; - if (list == NULL || block == NULL) + if (list == nullptr || block == nullptr) { dealloc_error("list", 0); return; } - if (block == NULL) + if (block == nullptr) { dealloc_error("memory", 0); return; } - previous = NULL; + previous = nullptr; current = list->first; - while (current != NULL && current->address != block) + while (current != nullptr && current->address != block) { previous = current; current = current->next; } - if (current == NULL) + if (current == nullptr) { dealloc_error("address not found", block); return; } - if (previous == NULL) + if (previous == nullptr) { list->first = current->next; } @@ -186,13 +183,34 @@ void FreeMemSafe(void* block) list->size -= current->size; list->count--; - FREE_MEM(current->address); - current->address = NULL; - current->next = NULL; + if (deallocate) + { + FREE_MEM(current->address); + } + + current->address = nullptr; + current->next = nullptr; current->size = 0; FREE_MEM(current); } +/** + * @brief Deallocate memory from the global memory list. + */ +void FreeMemSafe(void* block) +{ + RemoveMemSafe(block, true); +} + +/** + * @brief Detach an allocated memory from the global memory list. + * @details The memory block is only detached, not deallocated. + */ +void DetachMemSafe(void* block) +{ + RemoveMemSafe(block, false); +} + /** * @brief Deallocate all memory in the global memory list. */ @@ -200,13 +218,13 @@ void FreeAllSafe() { struct MemoryBlock *current, *next; - if (list == NULL) + if (list == nullptr) { return; } current = list->first; - while (current != NULL) + while (current != nullptr) { next = current->next; FREE_MEM(current->address); @@ -215,7 +233,7 @@ void FreeAllSafe() } FREE_MEM(list); - list = NULL; + list = nullptr; } /** diff --git a/src/cplex/Makefile b/src/cplex/Makefile deleted file mode 100644 index 33673de0..00000000 --- a/src/cplex/Makefile +++ /dev/null @@ -1,259 +0,0 @@ -CC = gcc -CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -MKDIR = mkdir -p -DEL = rm -f -INSTALL = install -m 0644 -LDCONFIG = ldconfig -PREFIX = /usr -INSTDIR = ${DESTDIR}${PREFIX}/lib/amath -INSTDIRI = ${DESTDIR}${PREFIX}/include/amath -INSTDIRPC = ${DESTDIR}${PREFIX}/lib/pkgconfig -INSTDIRM = ${DESTDIR}${PREFIX}/share/man/man3 -alib = libamathcplex.a -solib = libamathcplex.so -pkgconfig = amathi.pc -manpage = amathi.3 - -all: static shared - -static: ${alib} - -shared: ${solib} - -static/cacos.o: cacos.c - ${CC} ${CFLAGS} -fno-builtin -c cacos.c -o static/cacos.o - -shared/cacos.o: cacos.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cacos.c -o shared/cacos.o - -static/cacosh.o: cacosh.c - ${CC} ${CFLAGS} -fno-builtin -c cacosh.c -o static/cacosh.o - -shared/cacosh.o: cacosh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cacosh.c -o shared/cacosh.o - -static/cacot.o: cacot.c - ${CC} ${CFLAGS} -fno-builtin -c cacot.c -o static/cacot.o - -shared/cacot.o: cacot.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cacot.c -o shared/cacot.o - -static/cacoth.o: cacoth.c - ${CC} ${CFLAGS} -fno-builtin -c cacoth.c -o static/cacoth.o - -shared/cacoth.o: cacoth.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cacoth.c -o shared/cacoth.o - -static/cacsc.o: cacsc.c - ${CC} ${CFLAGS} -fno-builtin -c cacsc.c -o static/cacsc.o - -shared/cacsc.o: cacsc.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cacsc.c -o shared/cacsc.o - -static/cacsch.o: cacsch.c - ${CC} ${CFLAGS} -fno-builtin -c cacsch.c -o static/cacsch.o - -shared/cacsch.o: cacsch.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cacsch.c -o shared/cacsch.o - -static/casec.o: casec.c - ${CC} ${CFLAGS} -fno-builtin -c casec.c -o static/casec.o - -shared/casec.o: casec.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c casec.c -o shared/casec.o - -static/casech.o: casech.c - ${CC} ${CFLAGS} -fno-builtin -c casech.c -o static/casech.o - -shared/casech.o: casech.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c casech.c -o shared/casech.o - -static/casin.o: casin.c - ${CC} ${CFLAGS} -fno-builtin -c casin.c -o static/casin.o - -shared/casin.o: casin.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c casin.c -o shared/casin.o - -static/casinh.o: casinh.c - ${CC} ${CFLAGS} -fno-builtin -c casinh.c -o static/casinh.o - -shared/casinh.o: casinh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c casinh.c -o shared/casinh.o - -static/catan.o: catan.c - ${CC} ${CFLAGS} -fno-builtin -c catan.c -o static/catan.o - -shared/catan.o: catan.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c catan.c -o shared/catan.o - -static/catanh.o: catanh.c - ${CC} ${CFLAGS} -fno-builtin -c catanh.c -o static/catanh.o - -shared/catanh.o: catanh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c catanh.c -o shared/catanh.o - -static/ccbrt.o: ccbrt.c - ${CC} ${CFLAGS} -fno-builtin -c ccbrt.c -o static/ccbrt.o - -shared/ccbrt.o: ccbrt.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ccbrt.c -o shared/ccbrt.o - -static/ccos.o: ccos.c - ${CC} ${CFLAGS} -fno-builtin -c ccos.c -o static/ccos.o - -shared/ccos.o: ccos.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ccos.c -o shared/ccos.o - -static/ccosh.o: ccosh.c - ${CC} ${CFLAGS} -fno-builtin -c ccosh.c -o static/ccosh.o - -shared/ccosh.o: ccosh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ccosh.c -o shared/ccosh.o - -static/ccot.o: ccot.c - ${CC} ${CFLAGS} -fno-builtin -c ccot.c -o static/ccot.o - -shared/ccot.o: ccot.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ccot.c -o shared/ccot.o - -static/ccoth.o: ccoth.c - ${CC} ${CFLAGS} -fno-builtin -c ccoth.c -o static/ccoth.o - -shared/ccoth.o: ccoth.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ccoth.c -o shared/ccoth.o - -static/ccsc.o: ccsc.c - ${CC} ${CFLAGS} -fno-builtin -c ccsc.c -o static/ccsc.o - -shared/ccsc.o: ccsc.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ccsc.c -o shared/ccsc.o - -static/ccsch.o: ccsch.c - ${CC} ${CFLAGS} -fno-builtin -c ccsch.c -o static/ccsch.o - -shared/ccsch.o: ccsch.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ccsch.c -o shared/ccsch.o - -static/cexp.o: cexp.c - ${CC} ${CFLAGS} -fno-builtin -c cexp.c -o static/cexp.o - -shared/cexp.o: cexp.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cexp.c -o shared/cexp.o - -static/clog.o: clog.c - ${CC} ${CFLAGS} -fno-builtin -c clog.c -o static/clog.o - -shared/clog.o: clog.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c clog.c -o shared/clog.o - -static/clog10.o: clog10.c - ${CC} ${CFLAGS} -fno-builtin -c clog10.c -o static/clog10.o - -shared/clog10.o: clog10.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c clog10.c -o shared/clog10.o - -static/clogb.o: clogb.c - ${CC} ${CFLAGS} -fno-builtin -c clogb.c -o static/clogb.o - -shared/clogb.o: clogb.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c clogb.c -o shared/clogb.o - -static/cpow.o: cpow.c - ${CC} ${CFLAGS} -fno-builtin -c cpow.c -o static/cpow.o - -shared/cpow.o: cpow.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cpow.c -o shared/cpow.o - -static/csec.o: csec.c - ${CC} ${CFLAGS} -fno-builtin -c csec.c -o static/csec.o - -shared/csec.o: csec.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c csec.c -o shared/csec.o - -static/csech.o: csech.c - ${CC} ${CFLAGS} -fno-builtin -c csech.c -o static/csech.o - -shared/csech.o: csech.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c csech.c -o shared/csech.o - -static/csgn.o: csgn.c - ${CC} ${CFLAGS} -fno-builtin -c csgn.c -o static/csgn.o - -shared/csgn.o: csgn.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c csgn.c -o shared/csgn.o - -static/csin.o: csin.c - ${CC} ${CFLAGS} -fno-builtin -c csin.c -o static/csin.o - -shared/csin.o: csin.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c csin.c -o shared/csin.o - -static/csinh.o: csinh.c - ${CC} ${CFLAGS} -fno-builtin -c csinh.c -o static/csinh.o - -shared/csinh.o: csinh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c csinh.c -o shared/csinh.o - -static/csqrt.o: csqrt.c - ${CC} ${CFLAGS} -fno-builtin -c csqrt.c -o static/csqrt.o - -shared/csqrt.o: csqrt.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c csqrt.c -o shared/csqrt.o - -static/ctan.o: ctan.c - ${CC} ${CFLAGS} -fno-builtin -c ctan.c -o static/ctan.o - -shared/ctan.o: ctan.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ctan.c -o shared/ctan.o - -static/ctanh.o: ctanh.c - ${CC} ${CFLAGS} -fno-builtin -c ctanh.c -o static/ctanh.o - -shared/ctanh.o: ctanh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ctanh.c -o shared/ctanh.o - -static/prim.o: prim.c - ${CC} ${CFLAGS} -fno-builtin -c prim.c -o static/prim.o - -shared/prim.o: prim.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c prim.c -o shared/prim.o - -.PHONY: build -build: - ${MKDIR} static - ${MKDIR} shared - -${solib}: build shared/cacos.o shared/cacosh.o shared/cacot.o shared/cacoth.o shared/cacsc.o shared/cacsch.o shared/casec.o shared/casech.o shared/casin.o shared/casinh.o shared/catan.o shared/catanh.o shared/ccbrt.o shared/ccos.o shared/ccosh.o shared/ccot.o shared/ccoth.o shared/ccsc.o shared/ccsch.o shared/cexp.o shared/clog.o shared/clog10.o shared/clogb.o shared/cpow.o shared/csec.o shared/csech.o shared/csgn.o shared/csin.o shared/csinh.o shared/csqrt.o shared/ctan.o shared/ctanh.o shared/prim.o - ${CC} ${CFLAGS} -shared -s -fPIC -Wl,-soname,${solib}.1.7.0 -o ${solib} shared/cacos.o shared/cacosh.o shared/cacot.o shared/cacoth.o shared/cacsc.o shared/cacsch.o shared/casec.o shared/casech.o shared/casin.o shared/casinh.o shared/catan.o shared/catanh.o shared/ccbrt.o shared/ccos.o shared/ccosh.o shared/ccot.o shared/ccoth.o shared/ccsc.o shared/ccsch.o shared/cexp.o shared/clog.o shared/clog10.o shared/clogb.o shared/cpow.o shared/csec.o shared/csech.o shared/csgn.o shared/csin.o shared/csinh.o shared/csqrt.o shared/ctan.o shared/ctanh.o shared/prim.o - -${alib}: build static/cacos.o static/cacosh.o static/cacot.o static/cacoth.o static/cacsc.o static/cacsch.o static/casec.o static/casech.o static/casin.o static/casinh.o static/catan.o static/catanh.o static/ccbrt.o static/ccos.o static/ccosh.o static/ccot.o static/ccoth.o static/ccsc.o static/ccsch.o static/cexp.o static/clog.o static/clog10.o static/clogb.o static/cpow.o static/csec.o static/csech.o static/csgn.o static/csin.o static/csinh.o static/csqrt.o static/ctan.o static/ctanh.o static/prim.o - ${AR} rcs static/${alib} static/cacos.o static/cacosh.o static/cacot.o static/cacoth.o static/cacsc.o static/cacsch.o static/casec.o static/casech.o static/casin.o static/casinh.o static/catan.o static/catanh.o static/ccbrt.o static/ccos.o static/ccosh.o static/ccot.o static/ccoth.o static/ccsc.o static/ccsch.o static/cexp.o static/clog.o static/clog10.o static/clogb.o static/cpow.o static/csec.o static/csech.o static/csgn.o static/csin.o static/csinh.o static/csqrt.o static/ctan.o static/ctanh.o static/prim.o - ${RANLIB} static/${alib} - -.PHONY: install -install: ${alib} ${solib} - ${MKDIR} ${INSTDIR} - ${MKDIR} ${INSTDIRPC} - ${MKDIR} ${INSTDIRI} - ${INSTALL} static/${alib} ${INSTDIR}/${alib} - ${INSTALL} ${solib} ${INSTDIR}/${solib} - ${INSTALL} ${pkgconfig} ${INSTDIRPC}/${pkgconfig} - ${INSTALL} ${manpage} ${INSTDIRM}/${manpage} - ${INSTALL} ../complex.h ${INSTDIRI}/amathi.h - ${LDCONFIG} ${INSTDIR} - -.PHONY: uninstall -uninstall: - ${DEL} ${INSTDIR}/${alib} - ${DEL} ${INSTDIR}/${solib} - ${DEL} ${INSTDIRPC}/${pkgconfig} - ${DEL} ${INSTDIRM}/${manpage} - ${DEL} ${INSTDIRPC}/amathi.pc - ${DEL} ${INSTDIRI}/amathi.h - ${LDCONFIG} - -clean: - ${DEL} static/${alib} ${solib} static/cacos.o static/cacosh.o static/cacot.o static/cacoth.o static/cacsc.o static/cacsch.o static/casec.o static/casech.o static/casin.o static/casinh.o static/catan.o static/catanh.o static/ccbrt.o static/ccos.o static/ccosh.o static/ccot.o static/ccoth.o static/ccsc.o static/ccsch.o static/cexp.o static/clog.o static/clog10.o static/clogb.o static/cpow.o static/csec.o static/csech.o static/csgn.o static/csin.o static/csinh.o static/csqrt.o static/ctan.o static/ctanh.o static/prim.o shared/cacos.o shared/cacosh.o shared/cacot.o shared/cacoth.o shared/cacsc.o shared/cacsch.o shared/casec.o shared/casech.o shared/casin.o shared/casinh.o shared/catan.o shared/catanh.o shared/ccbrt.o shared/ccos.o shared/ccosh.o shared/ccot.o shared/ccoth.o shared/ccsc.o shared/ccsch.o shared/cexp.o shared/clog.o shared/clog10.o shared/clogb.o shared/cpow.o shared/csec.o shared/csech.o shared/csgn.o shared/csin.o shared/csinh.o shared/csqrt.o shared/ctan.o shared/ctanh.o shared/prim.o - diff --git a/src/cplex/amathi.3 b/src/cplex/amathi.3 index b05e2858..ea6180fc 100644 --- a/src/cplex/amathi.3 +++ b/src/cplex/amathi.3 @@ -1,4 +1,4 @@ -.TH "amath/amathi.h" 3 "Wed Mar 1 2017" "Version 1.7.0" "amath" \" -*- nroff -*- +.TH "amath/amathi.h" 3 "Wed Mar 1 2017" "Version 1.7.1" "amath" \" -*- nroff -*- .ad l .nh .SH NAME diff --git a/src/cplex/amathi.pc b/src/cplex/amathi.pc index b55e8bee..115045cb 100644 --- a/src/cplex/amathi.pc +++ b/src/cplex/amathi.pc @@ -5,6 +5,6 @@ libdir=${exec_prefix}/lib Name: amath complex library Description: Functions for handling complex numbers -Version: 1.7.0 +Version: 1.7.1 Cflags: -I${includedir} Libs: -L${libdir} -lamathi diff --git a/src/cplex/amathi.vcxproj b/src/cplex/amathi.vcxproj deleted file mode 100644 index 2973ec59..00000000 --- a/src/cplex/amathi.vcxproj +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {278A3E34-C1F0-4176-AA98-6D8CD4F16438} - Win32Proj - - - - StaticLibrary - true - v141 - - - StaticLibrary - false - v141 - - - Application - true - v141 - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - $(ProjectDir).. - - - MachineX86 - true - Windows - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreadedDLL - Level3 - ProgramDatabase - - - MachineX86 - true - Windows - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/cplex/amathi.vcxproj.filters b/src/cplex/amathi.vcxproj.filters deleted file mode 100644 index 9f640be0..00000000 --- a/src/cplex/amathi.vcxproj.filters +++ /dev/null @@ -1,123 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - \ No newline at end of file diff --git a/src/lib/Makefile b/src/lib/Makefile deleted file mode 100644 index f8613713..00000000 --- a/src/lib/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -CXX = g++ -CXXFLAGS = -O3 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -MKDIR = mkdir -p -DEL = rm -f -INSTALL = install -m 0644 -LDCONFIG = ldconfig -PREFIX = /usr -INSTDIR = ${DESTDIR}${PREFIX}/lib/amath -INSTDIRI = ${DESTDIR}${PREFIX}/include/amath -INSTDIRPC = ${DESTDIR}${PREFIX}/lib/pkgconfig -alib = libamathapp.a -solib = libamathapp.so -pkgconfig = amatha.pc - -all: static shared - -static: ${alib} - -shared: ${solib} - -static/aengine.o: aengine.cpp - ${CXX} ${CXXFLAGS} -c aengine.cpp -o static/aengine.o - -shared/aengine.o: aengine.cpp - ${CXX} ${CXXFLAGS} -fPIC -c aengine.cpp -o shared/aengine.o - -static/charbuf.o: charbuf.cpp - ${CXX} ${CXXFLAGS} -c charbuf.cpp -o static/charbuf.o - -shared/charbuf.o: charbuf.cpp - ${CXX} ${CXXFLAGS} -fPIC -c charbuf.cpp -o shared/charbuf.o - -static/integer.o: integer.cpp - ${CXX} ${CXXFLAGS} -c integer.cpp -o static/integer.o - -shared/integer.o: integer.cpp - ${CXX} ${CXXFLAGS} -fPIC -c integer.cpp -o shared/integer.o - -static/cplex.o: cplex.cpp - ${CXX} ${CXXFLAGS} -c cplex.cpp -o static/cplex.o - -shared/cplex.o: cplex.cpp - ${CXX} ${CXXFLAGS} -fPIC -c cplex.cpp -o shared/cplex.o - -static/nnumb.o: nnumb.cpp - ${CXX} ${CXXFLAGS} -c nnumb.cpp -o static/nnumb.o - -shared/nnumb.o: nnumb.cpp - ${CXX} ${CXXFLAGS} -fPIC -c nnumb.cpp -o shared/nnumb.o - -static/ntext.o: ntext.cpp - ${CXX} ${CXXFLAGS} -c ntext.cpp -o static/ntext.o - -shared/ntext.o: ntext.cpp - ${CXX} ${CXXFLAGS} -fPIC -c ntext.cpp -o shared/ntext.o - -static/real.o: real.cpp - ${CXX} ${CXXFLAGS} -c real.cpp -o static/real.o - -shared/real.o: real.cpp - ${CXX} ${CXXFLAGS} -fPIC -c real.cpp -o shared/real.o - -.PHONY: build -build: - ${MKDIR} static - ${MKDIR} shared - -${solib}: build shared/aengine.o shared/charbuf.o shared/integer.o shared/cplex.o shared/nnumb.o shared/ntext.o shared/real.o - ${CXX} ${CXXFLAGS} -shared -s -fPIC -Wl,-soname,${solib}.1.7.0 -o ${solib} shared/aengine.o shared/charbuf.o shared/integer.o shared/cplex.o shared/nnumb.o shared/ntext.o shared/real.o - -${alib}: build static/aengine.o static/charbuf.o static/integer.o static/cplex.o static/nnumb.o static/ntext.o static/real.o - ${AR} rcs static/${alib} static/aengine.o static/charbuf.o static/integer.o static/cplex.o static/nnumb.o static/ntext.o static/real.o - ${RANLIB} static/${alib} - -.PHONY: install -install: ${alib} ${solib} - ${MKDIR} ${INSTDIR} - ${MKDIR} ${INSTDIRPC} - ${MKDIR} ${INSTDIRI} - ${INSTALL} static/${alib} ${INSTDIR}/${alib} - ${INSTALL} ${solib} ${INSTDIR}/${solib} - ${INSTALL} ${pkgconfig} ${INSTDIRPC}/${pkgconfig} - ${INSTALL} aengine.h ${INSTDIRI}/aengine.h - ${INSTALL} charbuf.h ${INSTDIRI}/charbuf.h - ${INSTALL} cplex.h ${INSTDIRI}/cplex.h - ${INSTALL} integer.h ${INSTDIRI}/integer.h - ${INSTALL} nnumb.h ${INSTDIRI}/nnumb.h - ${INSTALL} ntext.h ${INSTDIRI}/ntext.h - ${INSTALL} numb.h ${INSTDIRI}/numb.h - ${INSTALL} real.h ${INSTDIRI}/real.h - ${LDCONFIG} ${INSTDIR} - -.PHONY: uninstall -uninstall: - ${DEL} ${INSTDIR}/${alib} - ${DEL} ${INSTDIR}/${solib} - ${DEL} ${INSTDIRPC}/${pkgconfig} - ${DEL} ${INSTDIRI}/aengine.h - ${DEL} ${INSTDIRI}/charbuf.h - ${DEL} ${INSTDIRI}/cplex.h - ${DEL} ${INSTDIRI}/integer.h - ${DEL} ${INSTDIRI}/nnumb.h - ${DEL} ${INSTDIRI}/ntext.h - ${DEL} ${INSTDIRI}/numb.h - ${DEL} ${INSTDIRI}/real.h - ${LDCONFIG} - -clean: - ${DEL} static/${alib} ${solib} static/aengine.o static/charbuf.o static/integer.o static/cplex.o static/nnumb.o static/ntext.o static/real.o shared/aengine.o shared/charbuf.o shared/integer.o shared/cplex.o shared/nnumb.o shared/ntext.o shared/real.o - diff --git a/src/lib/aengine.cpp b/src/lib/aengine.cpp index d0e75d8d..74833082 100644 --- a/src/lib/aengine.cpp +++ b/src/lib/aengine.cpp @@ -33,6 +33,13 @@ #include "charval.h" #include "aengine.h" +#define CURSORFORWARD "\x1B[1C" +#define CURSORBACKWARD "\x1B[1D" +#define ERASEINLINE "\x1B[K" +#define INSERT1CHAR "\x1B[1@" +#define DELETE1CHAR "\x1B[1P" +#define DELETELINE "\x0D\x1B[K" + AnsiConoleEngine::AnsiConoleEngine(const char* prompt, CharValidator* validator) { this->validator = validator; @@ -82,31 +89,15 @@ void AnsiConoleEngine::StartInput() linedone = false; } -//#include -//#include -//#include - const char* AnsiConoleEngine::ProcessChar(const unsigned char character) { unsigned char ch = character; out->Empty(); - /* - // -------------- DEUG ------------------ - Number *d = new RealNumber((int)ch); - NumeralSystem *ns = new DecimalSystem(0); - const char *dtext = ns->GetText(d); - StrCopy(out->buf, dtext); - StrConcat(out->buf, SPACE); - delete ns; - delete d; - return out->buf; - // -------------- DEUG ------------------ - */ - if (len == 0) { - // TODO: double buffer + out->EnsureGrowth(lineSize); + len = lineSize; } bool processed = false; @@ -120,7 +111,7 @@ const char* AnsiConoleEngine::ProcessChar(const unsigned char character) escmode = true; processed = true; } - else if (ch == 155 || (escmode && ch == 91)) + else if (ch == 155 || (escmode && ch == 79) || (escmode && ch == 91)) { csimode = true; processed = true; diff --git a/src/lib/aengine.h b/src/lib/aengine.h index 74070e52..9f2753f2 100644 --- a/src/lib/aengine.h +++ b/src/lib/aengine.h @@ -64,7 +64,7 @@ private: char* prompt; - static const int maxLines = 20; + static const int maxLines = 100; static const int lineSize = 1024; char** lines; CharBuffer* linebuf; diff --git a/src/lib/amatha.pc b/src/lib/amatha.pc index fcb77569..c4544266 100644 --- a/src/lib/amatha.pc +++ b/src/lib/amatha.pc @@ -5,6 +5,6 @@ libdir=${exec_prefix}/lib Name: amath application library Description: C++ library for handling numbers -Version: 1.7.0 +Version: 1.7.1 Cflags: -I${includedir} Libs: -L${libdir} -lamathapp -lamathr -lamathi -lamathc diff --git a/src/lib/amatha.vcxproj b/src/lib/amatha.vcxproj deleted file mode 100644 index 39612ca3..00000000 --- a/src/lib/amatha.vcxproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {B2BC043B-5799-4D01-96B0-C7871F7734FB} - Win32Proj - - - - StaticLibrary - true - v141 - - - StaticLibrary - false - v141 - - - Application - true - v141 - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - $(ProjectDir).. - - - MachineX86 - true - Windows - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - MultiThreadedDLL - Level3 - ProgramDatabase - - - MachineX86 - true - Windows - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/lib/amatha.vcxproj.filters b/src/lib/amatha.vcxproj.filters deleted file mode 100644 index 9a2b00fd..00000000 --- a/src/lib/amatha.vcxproj.filters +++ /dev/null @@ -1,69 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/src/localize/tags.h b/src/localize/tags.h deleted file mode 100644 index f3c10959..00000000 --- a/src/localize/tags.h +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Project homepage: - * http://amath.innolan.net - * - */ - -#ifndef AMATH_LOCALIZE_TAGS_H -#define AMATH_LOCALIZE_TAGS_H - -#include "amath.h" -#include "amathc.h" - -static const texttag texttags[] = { - {"#HEADLINE#", HEADLINE}, - {"#SYNTAXHIGHLIGHT#", SYNTAXHIGHLIGHT}, - {"#NORMALTEXT#", NORMALTEXT}, - {"#BOLD#", BOLD}, - {"#ITALICS#", ITALICS}, - {"#UNDERLINE#", UNDERLINE}, - {"#COLOR01#", COLOR01}, - {"#COLOR02#", COLOR02}, - {"#COLOR03#", COLOR03}, - {"#SPACE#", SPACE}, - {"#NEWLINE#", NEWLINE}, - {"#STARTMSG#", TXTSTARTMSG} -}; - -#endif diff --git a/src/main.cpp b/src/main.cpp index e6c05428..3134d447 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,6 +32,7 @@ #include "system/program.h" #include "system/program_stdc.h" #include "system/program_amiga.h" +#include "system/program_haiku.h" #include "system/program_test.h" const char* vers = TXTDOSVERSION; @@ -64,7 +65,7 @@ void operator delete[] (void* ptr) throw() { FreeMemSafe(ptr); } #endif /* MSVC++ */ -#if defined (_WIN32) && defined(_MSC_VER) +#if defined(WINDOWS) && defined(_MSC_VER) #include void* __CRTDECL operator new (size_t size) { return AllocMemSafe(size); } void* __CRTDECL operator new[] (size_t size) { return AllocMemSafe(size); } @@ -74,7 +75,7 @@ void __CRTDECL operator delete[] (void* ptr) throw() { FreeMemSafe(ptr); } int main(int argc, char** argv) { -#ifdef WITHTEST +#if defined(WITHTEST) if (argc == 2 && StrIsEqual(argv[1], "test")) { Program = new TestProgram(false); @@ -86,23 +87,25 @@ int main(int argc, char** argv) else #endif { -#ifdef AMIGA +#if defined(AMIGA) DosBase = (struct DosBase*)OpenLibrary(AMIGADOS_NAME, AMIGADOS_REV); IntuitionBase = (struct IntuitionBase*)OpenLibrary(INTUITION_NAME, INTUITION_REV); GfxBase = (struct GfxBase*)OpenLibrary(GRAPHICS_NAME, GRAPHICS_REV); LocaleBase = (struct LocaleBase*)OpenLibrary(LOCALE_NAME, LOCALE_REV); Program = new AmigaProgram(); +#elif defined(HAIKU) + Program = new HaikuProgram(); #else Program = new StandardProgram(); #endif } Program->Initialize(argc, argv); - Program->Run(); + Program->Start(); int exit = Program->GetExitStatus(); -#ifdef AMIGA +#if defined(AMIGA) if (DosBase != nullptr) CloseLibrary((struct Library*)DosBase); diff --git a/src/main.h b/src/main.h index ed701a1d..f176a5e8 100644 --- a/src/main.h +++ b/src/main.h @@ -76,17 +76,7 @@ https://gitlab.com/rnger/amath \subsection download Download - Prebuild packages are available from gitlab.com
-
Windows with ANSI support
- https://gitlab.com/rnger/amath-bin/raw/master/Windows/amath-1.6.2-ansi-x86.exe (32 bit)
- (SHA256 d308424862eef418d97e3b60c00b191f711349c6f856e12b4917b114ac2f6578)
- https://gitlab.com/rnger/amath-bin/raw/master/Windows/amath-1.6.2-ansi-x64.exe (64 bit)
- (SHA256 170c5246f0bd0cec3e1d4f64c7c685d75cdbd5a5da7acf0ea4641c21e2a7d5ea)
-
Windows without ANSI support
- https://gitlab.com/rnger/amath-bin/raw/master/Windows/amath-1.6.2-x86.exe (32 bit)
- (SHA256 1ee22651fb09dc841b71062b8a6e9f6da285d807d3216e935a15eca9df5fd614)
- https://gitlab.com/rnger/amath-bin/raw/master/Windows/amath-1.6.2-x64.exe (64 bit)
- (SHA256 d3ba707f37ab27e90847d54839d65b0308124ac6ab61e1aac1deda44d87a7fad)
+ Windows: https://gitlab.com/rnger/amath-bin/tree/master/Windows

FreeBSD: https://www.freshports.org/math/amath/

@@ -94,12 +84,10 @@
Included in the Icaros Desktop environment: http://vmwaros.blogspot.com/

- Other packages: https://gitlab.com/rnger/amath-bin/tree/master
- + Other packages: https://gitlab.com/rnger/amath-bin/tree/master \subsection history History A full \ref release_page is available for amath. - \page command_page Statements and functions \section command_sec Statements and functions @@ -269,7 +257,12 @@ \page release_page Release history \section release_sec Release history - \subsection version170 v1.7.0 March 12 2017 + \subsection version171 v1.7.1 March 26 2017 + - Haiku support. + - Unified ANSI console. + - Code cleanup. + + \subsection version170 v1.7.1 March 12 2017 - Introduce scientific notation. - Introduce Not a Number (NaN). - Fixed bugs related to infinity (Inf). diff --git a/src/main/Makefile b/src/main/Makefile deleted file mode 100644 index 04b78107..00000000 --- a/src/main/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -CXX = g++ -CXXFLAGS = -O2 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -DEL = rm -f - -all: lib -static: lib - -evaluator.o: evaluator.cpp - ${CXX} ${CXXFLAGS} -c evaluator.cpp - -functionlist.o: functionlist.cpp - ${CXX} ${CXXFLAGS} -c functionlist.cpp - -fgrid.o: fgrid.cpp - ${CXX} ${CXXFLAGS} -c fgrid.cpp - -lexer.o: lexer.cpp - ${CXX} ${CXXFLAGS} -c lexer.cpp - -nodes.o: nodes.cpp - ${CXX} ${CXXFLAGS} -c nodes.cpp - -operators.o: operators.cpp - ${CXX} ${CXXFLAGS} -c operators.cpp - -optimizer.o: optimizer.cpp - ${CXX} ${CXXFLAGS} -c optimizer.cpp - -parser.o: parser.cpp - ${CXX} ${CXXFLAGS} -c parser.cpp - -token.o: token.cpp - ${CXX} ${CXXFLAGS} -c token.cpp - -userfunction.o: userfunction.cpp - ${CXX} ${CXXFLAGS} -c userfunction.cpp - -values.o: values.cpp - ${CXX} ${CXXFLAGS} -c values.cpp - -viewer.o: viewer.cpp - ${CXX} ${CXXFLAGS} -c viewer.cpp - -lib: evaluator.o functionlist.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o - ${AR} rcs libappmain.a evaluator.o functionlist.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o - ${RANLIB} libappmain.a - -clean: - ${DEL} libappmain.a evaluator.o functionlist.o fgrid.o lexer.o nodes.o operators.o optimizer.o parser.o token.o userfunction.o values.o viewer.o - diff --git a/src/main/function/Makefile b/src/main/function/Makefile deleted file mode 100644 index 8048fd74..00000000 --- a/src/main/function/Makefile +++ /dev/null @@ -1,187 +0,0 @@ -CXX = g++ -CXXFLAGS = -O2 -DWITHTEST -I. -I../.. -Wall -AR = ar -RANLIB = ranlib -DEL = rm -f - -all: lib -static: lib - -absolute.o: absolute.cpp - ${CXX} ${CXXFLAGS} -c absolute.cpp - -aexcosecant.o: aexcosecant.cpp - ${CXX} ${CXXFLAGS} -c aexcosecant.cpp - -aexsecant.o: aexsecant.cpp - ${CXX} ${CXXFLAGS} -c aexsecant.cpp - -arccos.o: arccos.cpp - ${CXX} ${CXXFLAGS} -c arccos.cpp - -arcsin.o: arcsin.cpp - ${CXX} ${CXXFLAGS} -c arcsin.cpp - -arctan.o: arctan.cpp - ${CXX} ${CXXFLAGS} -c arctan.cpp - -arccosecant.o: arccosecant.cpp - ${CXX} ${CXXFLAGS} -c arccosecant.cpp - -arccotangent.o: arccotangent.cpp - ${CXX} ${CXXFLAGS} -c arccotangent.cpp - -arcsecant.o: arcsecant.cpp - ${CXX} ${CXXFLAGS} -c arcsecant.cpp - -arccovercosine.o: arccovercosine.cpp - ${CXX} ${CXXFLAGS} -c arccovercosine.cpp - -arccoversine.o: arccoversine.cpp - ${CXX} ${CXXFLAGS} -c arccoversine.cpp - -archacovercosine.o: archacovercosine.cpp - ${CXX} ${CXXFLAGS} -c archacovercosine.cpp - -archacoversine.o: archacoversine.cpp - ${CXX} ${CXXFLAGS} -c archacoversine.cpp - -archavercosine.o: archavercosine.cpp - ${CXX} ${CXXFLAGS} -c archavercosine.cpp - -archaversine.o: archaversine.cpp - ${CXX} ${CXXFLAGS} -c archaversine.cpp - -arcvercosine.o: arcvercosine.cpp - ${CXX} ${CXXFLAGS} -c arcvercosine.cpp - -arcversine.o: arcversine.cpp - ${CXX} ${CXXFLAGS} -c arcversine.cpp - -ceil.o: ceil.cpp - ${CXX} ${CXXFLAGS} -c ceil.cpp - -cosecant.o: cosecant.cpp - ${CXX} ${CXXFLAGS} -c cosecant.cpp - -cosine.o: cosine.cpp - ${CXX} ${CXXFLAGS} -c cosine.cpp - -cotangent.o: cotangent.cpp - ${CXX} ${CXXFLAGS} -c cotangent.cpp - -covercos.o: covercos.cpp - ${CXX} ${CXXFLAGS} -c covercos.cpp - -coversin.o: coversin.cpp - ${CXX} ${CXXFLAGS} -c coversin.cpp - -cube.o: cube.cpp - ${CXX} ${CXXFLAGS} -c cube.cpp - -excosecant.o: excosecant.cpp - ${CXX} ${CXXFLAGS} -c excosecant.cpp - -exsecant.o: exsecant.cpp - ${CXX} ${CXXFLAGS} -c exsecant.cpp - -floor.o: floor.cpp - ${CXX} ${CXXFLAGS} -c floor.cpp - -hacovercos.o: hacovercos.cpp - ${CXX} ${CXXFLAGS} -c hacovercos.cpp - -hacoversin.o: hacoversin.cpp - ${CXX} ${CXXFLAGS} -c hacoversin.cpp - -havercos.o: havercos.cpp - ${CXX} ${CXXFLAGS} -c havercos.cpp - -haversin.o: haversin.cpp - ${CXX} ${CXXFLAGS} -c haversin.cpp - -hyparccosecant.o: hyparccosecant.cpp - ${CXX} ${CXXFLAGS} -c hyparccosecant.cpp - -hyparccosine.o: hyparccosine.cpp - ${CXX} ${CXXFLAGS} -c hyparccosine.cpp - -hyparccotangent.o: hyparccotangent.cpp - ${CXX} ${CXXFLAGS} -c hyparccotangent.cpp - -hyparcsecant.o: hyparcsecant.cpp - ${CXX} ${CXXFLAGS} -c hyparcsecant.cpp - -hyparcsine.o: hyparcsine.cpp - ${CXX} ${CXXFLAGS} -c hyparcsine.cpp - -hyparctangent.o: hyparctangent.cpp - ${CXX} ${CXXFLAGS} -c hyparctangent.cpp - -hypcosecant.o: hypcosecant.cpp - ${CXX} ${CXXFLAGS} -c hypcosecant.cpp - -hypcosine.o: hypcosine.cpp - ${CXX} ${CXXFLAGS} -c hypcosine.cpp - -hypcotangent.o: hypcotangent.cpp - ${CXX} ${CXXFLAGS} -c hypcotangent.cpp - -hypsecant.o: hypsecant.cpp - ${CXX} ${CXXFLAGS} -c hypsecant.cpp - -hypsine.o: hypsine.cpp - ${CXX} ${CXXFLAGS} -c hypsine.cpp - -hyptangent.o: hyptangent.cpp - ${CXX} ${CXXFLAGS} -c hyptangent.cpp - -ln.o: ln.cpp - ${CXX} ${CXXFLAGS} -c ln.cpp - -log10.o: log10.cpp - ${CXX} ${CXXFLAGS} -c log10.cpp - -log2.o: log2.cpp - ${CXX} ${CXXFLAGS} -c log2.cpp - -node.o: node.cpp - ${CXX} ${CXXFLAGS} -c node.cpp - -round.o: round.cpp - ${CXX} ${CXXFLAGS} -c round.cpp - -secant.o: secant.cpp - ${CXX} ${CXXFLAGS} -c secant.cpp - -signum.o: signum.cpp - ${CXX} ${CXXFLAGS} -c signum.cpp - -sine.o: sine.cpp - ${CXX} ${CXXFLAGS} -c sine.cpp - -square.o: square.cpp - ${CXX} ${CXXFLAGS} -c square.cpp - -tangent.o: tangent.cpp - ${CXX} ${CXXFLAGS} -c tangent.cpp - -trunc.o: trunc.cpp - ${CXX} ${CXXFLAGS} -c trunc.cpp - -user.o: user.cpp - ${CXX} ${CXXFLAGS} -c user.cpp - -vercos.o: vercos.cpp - ${CXX} ${CXXFLAGS} -c vercos.cpp - -versin.o: versin.cpp - ${CXX} ${CXXFLAGS} -c versin.cpp - -lib: absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o arccovercosine.o arccoversine.o archacovercosine.o archacoversine.o archavercosine.o archaversine.o arcvercosine.o arcversine.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o hyparccosecant.o hyparccosine.o hyparccotangent.o hyparcsecant.o hyparcsine.o hyparctangent.o hypcosecant.o hypcosine.o hypcotangent.o hypsecant.o hypsine.o hyptangent.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o - ${AR} rcs libfunctions.a absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o arccovercosine.o arccoversine.o archacovercosine.o archacoversine.o archavercosine.o archaversine.o arcvercosine.o arcversine.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o hyparccosecant.o hyparccosine.o hyparccotangent.o hyparcsecant.o hyparcsine.o hyparctangent.o hypcosecant.o hypcosine.o hypcotangent.o hypsecant.o hypsine.o hyptangent.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o - ${RANLIB} libfunctions.a - -clean: - ${DEL} libfunctions.a absolute.o aexcosecant.o aexsecant.o arccos.o arcsin.o arctan.o arccosecant.o arccotangent.o arcsecant.o arccovercosine.o arccoversine.o archacovercosine.o archacoversine.o archavercosine.o archaversine.o arcvercosine.o arcversine.o ceil.o cosecant.o cosine.o cotangent.o covercos.o coversin.o cube.o excosecant.o exsecant.o floor.o hacovercos.o hacoversin.o havercos.o haversin.o hyparccosecant.o hyparccosine.o hyparccotangent.o hyparcsecant.o hyparcsine.o hyparctangent.o hypcosecant.o hypcosine.o hypcotangent.o hypsecant.o hypsine.o hyptangent.o ln.o log10.o log2.o node.o round.o secant.o signum.o sine.o square.o tangent.o trunc.o user.o vercos.o versin.o - diff --git a/src/main/function/functions.vcxproj b/src/main/function/functions.vcxproj deleted file mode 100644 index 75377a9e..00000000 --- a/src/main/function/functions.vcxproj +++ /dev/null @@ -1,224 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {AD6E3CD6-48C4-47D9-94F5-565EE3AF7485} - Win32Proj - - - - StaticLibrary - true - v141 - - - StaticLibrary - false - v141 - - - Application - true - v141 - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)../..;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - - - MachineX86 - true - Windows - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)../..;%(AdditionalIncludeDirectories) - MultiThreadedDLL - Level3 - ProgramDatabase - - - MachineX86 - true - Windows - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/function/functions.vcxproj.filters b/src/main/function/functions.vcxproj.filters deleted file mode 100644 index af84dadd..00000000 --- a/src/main/function/functions.vcxproj.filters +++ /dev/null @@ -1,366 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/src/main/main.vcxproj b/src/main/main.vcxproj deleted file mode 100644 index 2949cb8a..00000000 --- a/src/main/main.vcxproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {A1EA2AF8-7233-45C5-BA42-C746F658EA4E} - Win32Proj - - - - StaticLibrary - true - v141 - - - StaticLibrary - false - v141 - - - Application - true - v141 - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - DEBUGTREE;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)..;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - - - MachineX86 - true - Windows - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)..;%(AdditionalIncludeDirectories) - MultiThreadedDLL - Level3 - ProgramDatabase - - - MachineX86 - true - Windows - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/main.vcxproj.filters b/src/main/main.vcxproj.filters deleted file mode 100644 index e902dce3..00000000 --- a/src/main/main.vcxproj.filters +++ /dev/null @@ -1,96 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/src/main/parser.cpp b/src/main/parser.cpp index 935ff418..6aae54f2 100644 --- a/src/main/parser.cpp +++ b/src/main/parser.cpp @@ -208,7 +208,7 @@ SyntaxNode* Parser::ParseStatement() case symexit: res = new ExitStatement(); break; -#if defined(ANSICONSOLE) +#if !defined(STDC_CONSOLE) case symclear: res = new ClearStatement(); break; diff --git a/src/main/statement/Makefile b/src/main/statement/Makefile deleted file mode 100644 index 060b8e27..00000000 --- a/src/main/statement/Makefile +++ /dev/null @@ -1,94 +0,0 @@ -CXX = g++ -CXXFLAGS = -O2 -DWITHTEST -I. -I../.. -Wall -AR = ar -RANLIB = ranlib -DEL = rm -f - -all: lib -static: lib - -about.o: about.cpp - ${CXX} ${CXXFLAGS} -c about.cpp - -clear.o: clear.cpp - ${CXX} ${CXXFLAGS} -c clear.cpp - -delete.o: delete.cpp - ${CXX} ${CXXFLAGS} -c delete.cpp - -digits.o: digits.cpp - ${CXX} ${CXXFLAGS} -c digits.cpp - -draw.o: draw.cpp - ${CXX} ${CXXFLAGS} -c draw.cpp - -empty.o: empty.cpp - ${CXX} ${CXXFLAGS} -c empty.cpp - -eval.o: eval.cpp - ${CXX} ${CXXFLAGS} -c eval.cpp - -execute.o: execute.cpp - ${CXX} ${CXXFLAGS} -c execute.cpp - -exit.o: exit.cpp - ${CXX} ${CXXFLAGS} -c exit.cpp - -funcdef.o: funcdef.cpp - ${CXX} ${CXXFLAGS} -c funcdef.cpp - -funclist.o: funclist.cpp - ${CXX} ${CXXFLAGS} -c funclist.cpp - -help.o: help.cpp - ${CXX} ${CXXFLAGS} -c help.cpp - -input.o: input.cpp - ${CXX} ${CXXFLAGS} -c input.cpp - -license.o: license.cpp - ${CXX} ${CXXFLAGS} -c license.cpp - -list.o: list.cpp - ${CXX} ${CXXFLAGS} -c list.cpp - -load.o: load.cpp - ${CXX} ${CXXFLAGS} -c load.cpp - -memory.o: memory.cpp - ${CXX} ${CXXFLAGS} -c memory.cpp - -node.o: node.cpp - ${CXX} ${CXXFLAGS} -c node.cpp - -output.o: output.cpp - ${CXX} ${CXXFLAGS} -c output.cpp - -plot.o: plot.cpp - ${CXX} ${CXXFLAGS} -c plot.cpp - -prefs.o: prefs.cpp - ${CXX} ${CXXFLAGS} -c prefs.cpp - -prompt.o: prompt.cpp - ${CXX} ${CXXFLAGS} -c prompt.cpp - -save.o: save.cpp - ${CXX} ${CXXFLAGS} -c save.cpp - -show.o: show.cpp - ${CXX} ${CXXFLAGS} -c show.cpp - -silent.o: silent.cpp - ${CXX} ${CXXFLAGS} -c silent.cpp - -version.o: version.cpp - ${CXX} ${CXXFLAGS} -c version.cpp - -lib: about.o clear.o delete.o digits.o draw.o empty.o eval.o execute.o exit.o funcdef.o funclist.o help.o input.o license.o list.o load.o memory.o node.o output.o plot.o prefs.o prompt.o save.o show.o silent.o version.o - ${AR} rcs libstatement.a about.o clear.o delete.o digits.o draw.o empty.o eval.o execute.o exit.o funcdef.o funclist.o help.o input.o license.o list.o load.o memory.o node.o output.o plot.o prefs.o prompt.o save.o show.o silent.o version.o - ${RANLIB} libstatement.a - -clean: - ${DEL} libstatement.a about.o clear.o delete.o digits.o draw.o empty.o eval.o execute.o exit.o funcdef.o funclist.o help.o input.o license.o list.o load.o memory.o node.o output.o plot.o prefs.o prompt.o save.o show.o silent.o version.o - diff --git a/src/main/statement/about.cpp b/src/main/statement/about.cpp index f924e3aa..3af21ee0 100644 --- a/src/main/statement/about.cpp +++ b/src/main/statement/about.cpp @@ -27,17 +27,11 @@ * */ -#include "amath.h" #include "about.h" +#include "system/program.h" AboutStatement::AboutStatement() : - StatementNode( - BOLD TXTVERSMSG NORMALTEXT NEWLINE TXTCOMPMSG NORMALTEXT NEWLINE NEWLINE - "amath features a case sensitive command line interface, internal IEEE 754" NEWLINE - "calculations with 15 significant digits, calculations with real and complex" NEWLINE - "numbers, variables and user defined functions, logarithmic and exponential" NEWLINE - "functions, trigonometric and hyperbolic function and selected mathematical" NEWLINE - "constants and rounding functions." NEWLINE) + StatementNode() { } @@ -47,5 +41,6 @@ AboutStatement::~AboutStatement() char* AboutStatement::Execute() { + Program->Console->ShowAbout(); return statementText; } diff --git a/src/main/statement/help.cpp b/src/main/statement/help.cpp index 060d58d4..2aed8a5a 100644 --- a/src/main/statement/help.cpp +++ b/src/main/statement/help.cpp @@ -91,7 +91,7 @@ char* HelpStatement::StatementHelp() const output->ClearBuffer(); APPENDHELP(STATEMENTLINE) -#if defined(ANSICONSOLE) +#if !defined(STDC_CONSOLE) APPENDHELP(STATEMENTCLEAR) #endif APPENDHELP(STATEMENTDEF) diff --git a/src/main/statement/license.cpp b/src/main/statement/license.cpp index ee4f91c9..f96000f8 100644 --- a/src/main/statement/license.cpp +++ b/src/main/statement/license.cpp @@ -27,46 +27,11 @@ * */ -#include "amath.h" #include "license.h" +#include "system/program.h" LicenseStatement::LicenseStatement() : - StatementNode( - NEWLINE BOLD - "Copyright (c) 2014-2017 Carsten Sonne Larsen " NORMALTEXT NEWLINE - "Copyright (c) 2007 The NetBSD Foundation, Inc." NEWLINE - "Copyright (c) 1990, 1993 The Regents of the University of California." NEWLINE - "All rights reserved." NEWLINE - NEWLINE - "This code is derived from software written by Stephen L. Moshier." NEWLINE - "It is redistributed by the NetBSD Foundation by permission of the author." NEWLINE - NEWLINE - "This code is derived from software contributed to Berkeley by" NEWLINE - "Mike Hibler and Chris Torek." NEWLINE - NEWLINE - "Redistribution and use in source and binary forms, with or without" NEWLINE - "modification, are permitted provided that the following conditions are met:" NEWLINE - NEWLINE - "* Redistributions of source code must retain the above copyright notice, this" NEWLINE - " list of conditions and the following disclaimer." NEWLINE - NEWLINE - "* Redistributions in binary form must reproduce the above copyright notice," NEWLINE - " this list of conditions and the following disclaimer in the documentation" NEWLINE - " and/or other materials provided with the distribution." NEWLINE - NEWLINE - "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"" NEWLINE - "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE" NEWLINE - "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE" NEWLINE - "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE" NEWLINE - "FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL" NEWLINE - "DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR" NEWLINE - "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER" NEWLINE - "CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY," NEWLINE - "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE" NEWLINE - "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." NEWLINE - NEWLINE ITALICS - "Specific details should be found in the source files." NORMALTEXT NEWLINE - NEWLINE) + StatementNode() { } @@ -76,5 +41,6 @@ LicenseStatement::~LicenseStatement() char* LicenseStatement::Execute() { + Program->Console->ShowLicense(); return statementText; } diff --git a/src/main/statement/statements.vcxproj b/src/main/statement/statements.vcxproj deleted file mode 100644 index 46d59b2b..00000000 --- a/src/main/statement/statements.vcxproj +++ /dev/null @@ -1,161 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {8C4AB972-1866-4696-9B3D-EAFD25D09BF8} - Win32Proj - - - - StaticLibrary - true - v141 - - - StaticLibrary - false - v141 - - - Application - true - v141 - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)../..;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - - - MachineX86 - true - Windows - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)../..;%(AdditionalIncludeDirectories) - MultiThreadedDLL - Level3 - ProgramDatabase - - - MachineX86 - true - Windows - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/statement/statements.vcxproj.filters b/src/main/statement/statements.vcxproj.filters deleted file mode 100644 index 1b1ddb4e..00000000 --- a/src/main/statement/statements.vcxproj.filters +++ /dev/null @@ -1,177 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/src/main/statement/version.cpp b/src/main/statement/version.cpp index ff65eea0..39af2cef 100644 --- a/src/main/statement/version.cpp +++ b/src/main/statement/version.cpp @@ -27,11 +27,11 @@ * */ -#include "amath.h" #include "version.h" +#include "system/program.h" VersionStatement::VersionStatement() : - StatementNode(BOLD TXTVERSMSG NORMALTEXT NEWLINE TXTCOMPMSG NEWLINE) + StatementNode() { } @@ -41,5 +41,6 @@ VersionStatement::~VersionStatement() char* VersionStatement::Execute() { + Program->Console->ShowVersion(); return statementText; } diff --git a/src/real/Makefile b/src/real/Makefile deleted file mode 100644 index 126fc0d4..00000000 --- a/src/real/Makefile +++ /dev/null @@ -1,306 +0,0 @@ -CC = gcc -CFLAGS = -std=c9x -O3 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -MKDIR = mkdir -p -DEL = rm -f -INSTALL = install -m 0644 -LDCONFIG = ldconfig -PREFIX = /usr -INSTDIR = ${DESTDIR}${PREFIX}/lib/amath -INSTDIRI = ${DESTDIR}${PREFIX}/include/amath -INSTDIRPC = ${DESTDIR}${PREFIX}/lib/pkgconfig -INSTDIRM = ${DESTDIR}${PREFIX}/share/man/man3 -alib = libamath.a -solib = libamath.so -pkgconfig = amathr.pc -manpage = amathr.3 - -all: static shared - -static: ${alib} - -shared: ${solib} - -static/acos.o: acos.c - ${CC} ${CFLAGS} -fno-builtin -c acos.c -o static/acos.o - -shared/acos.o: acos.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c acos.c -o shared/acos.o - -static/acosh.o: acosh.c - ${CC} ${CFLAGS} -fno-builtin -c acosh.c -o static/acosh.o - -shared/acosh.o: acosh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c acosh.c -o shared/acosh.o - -static/acvs.o: acvs.c - ${CC} ${CFLAGS} -fno-builtin -c acvs.c -o static/acvs.o - -shared/acvs.o: acvs.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c acvs.c -o shared/acvs.o - -static/ahv.o: ahv.c - ${CC} ${CFLAGS} -fno-builtin -c ahv.c -o static/ahv.o - -shared/ahv.o: ahv.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ahv.c -o shared/ahv.o - -static/ahvc.o: ahvc.c - ${CC} ${CFLAGS} -fno-builtin -c ahvc.c -o static/ahvc.o - -shared/ahvc.o: ahvc.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ahvc.c -o shared/ahvc.o - -static/asin.o: asin.c - ${CC} ${CFLAGS} -fno-builtin -c asin.c -o static/asin.o - -shared/asin.o: asin.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c asin.c -o shared/asin.o - -static/asinh.o: asinh.c - ${CC} ${CFLAGS} -fno-builtin -c asinh.c -o static/asinh.o - -shared/asinh.o: asinh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c asinh.c -o shared/asinh.o - -static/atan.o: atan.c - ${CC} ${CFLAGS} -fno-builtin -c atan.c -o static/atan.o - -shared/atan.o: atan.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c atan.c -o shared/atan.o - -static/atan2.o: atan2.c - ${CC} ${CFLAGS} -fno-builtin -c atan2.c -o static/atan2.o - -shared/atan2.o: atan2.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c atan2.c -o shared/atan2.o - -static/atanh.o: atanh.c - ${CC} ${CFLAGS} -fno-builtin -c atanh.c -o static/atanh.o - -shared/atanh.o: atanh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c atanh.c -o shared/atanh.o - -static/aver.o: aver.c - ${CC} ${CFLAGS} -fno-builtin -c aver.c -o static/aver.o - -shared/aver.o: aver.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c aver.c -o shared/aver.o - -static/cbrt.o: cbrt.c - ${CC} ${CFLAGS} -fno-builtin -c cbrt.c -o static/cbrt.o - -shared/cbrt.o: cbrt.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cbrt.c -o shared/cbrt.o - -static/ceil.o: ceil.c - ${CC} ${CFLAGS} -fno-builtin -c ceil.c -o static/ceil.o - -shared/ceil.o: ceil.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ceil.c -o shared/ceil.o - -static/copysign.o: copysign.c - ${CC} ${CFLAGS} -fno-builtin -c copysign.c -o static/copysign.o - -shared/copysign.o: copysign.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c copysign.c -o shared/copysign.o - -static/cos.o: cos.c - ${CC} ${CFLAGS} -fno-builtin -c cos.c -o static/cos.o - -shared/cos.o: cos.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cos.c -o shared/cos.o - -static/cosh.o: cosh.c - ${CC} ${CFLAGS} -fno-builtin -c cosh.c -o static/cosh.o - -shared/cosh.o: cosh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c cosh.c -o shared/cosh.o - -static/exp.o: exp.c - ${CC} ${CFLAGS} -fno-builtin -c exp.c -o static/exp.o - -shared/exp.o: exp.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c exp.c -o shared/exp.o - -static/expm1.o: expm1.c - ${CC} ${CFLAGS} -fno-builtin -c expm1.c -o static/expm1.o - -shared/expm1.o: expm1.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c expm1.c -o shared/expm1.o - -static/fabs.o: fabs.c - ${CC} ${CFLAGS} -fno-builtin -c fabs.c -o static/fabs.o - -shared/fabs.o: fabs.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c fabs.c -o shared/fabs.o - -static/finite.o: finite.c - ${CC} ${CFLAGS} -fno-builtin -c finite.c -o static/finite.o - -shared/finite.o: finite.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c finite.c -o shared/finite.o - -static/floor.o: floor.c - ${CC} ${CFLAGS} -fno-builtin -c floor.c -o static/floor.o - -shared/floor.o: floor.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c floor.c -o shared/floor.o - -static/fmod.o: fmod.c - ${CC} ${CFLAGS} -fno-builtin -c fmod.c -o static/fmod.o - -shared/fmod.o: fmod.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c fmod.c -o shared/fmod.o - -static/hypot.o: hypot.c - ${CC} ${CFLAGS} -fno-builtin -c hypot.c -o static/hypot.o - -shared/hypot.o: hypot.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c hypot.c -o shared/hypot.o - -static/isnan.o: isnan.c - ${CC} ${CFLAGS} -fno-builtin -c isnan.c -o static/isnan.o - -shared/isnan.o: isnan.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c isnan.c -o shared/isnan.o - -static/kcos.o: kcos.c - ${CC} ${CFLAGS} -fno-builtin -c kcos.c -o static/kcos.o - -shared/kcos.o: kcos.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c kcos.c -o shared/kcos.o - -static/kremp2.o: kremp2.c - ${CC} ${CFLAGS} -fno-builtin -c kremp2.c -o static/kremp2.o - -shared/kremp2.o: kremp2.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c kremp2.c -o shared/kremp2.o - -static/ksin.o: ksin.c - ${CC} ${CFLAGS} -fno-builtin -c ksin.c -o static/ksin.o - -shared/ksin.o: ksin.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ksin.c -o shared/ksin.o - -static/ktan.o: ktan.c - ${CC} ${CFLAGS} -fno-builtin -c ktan.c -o static/ktan.o - -shared/ktan.o: ktan.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c ktan.c -o shared/ktan.o - -static/log.o: log.c - ${CC} ${CFLAGS} -fno-builtin -c log.c -o static/log.o - -shared/log.o: log.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c log.c -o shared/log.o - -static/log10.o: log10.c - ${CC} ${CFLAGS} -fno-builtin -c log10.c -o static/log10.o - -shared/log10.o: log10.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c log10.c -o shared/log10.o - -static/log1p.o: log1p.c - ${CC} ${CFLAGS} -fno-builtin -c log1p.c -o static/log1p.o - -shared/log1p.o: log1p.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c log1p.c -o shared/log1p.o - -static/pow.o: pow.c - ${CC} ${CFLAGS} -fno-builtin -c pow.c -o static/pow.o - -shared/pow.o: pow.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c pow.c -o shared/pow.o - -static/remp2.o: remp2.c - ${CC} ${CFLAGS} -fno-builtin -c remp2.c -o static/remp2.o - -shared/remp2.o: remp2.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c remp2.c -o shared/remp2.o - -static/round.o: round.c - ${CC} ${CFLAGS} -fno-builtin -c round.c -o static/round.o - -shared/round.o: round.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c round.c -o shared/round.o - -static/scalbn.o: scalbn.c - ${CC} ${CFLAGS} -fno-builtin -c scalbn.c -o static/scalbn.o - -shared/scalbn.o: scalbn.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c scalbn.c -o shared/scalbn.o - -static/sin.o: sin.c - ${CC} ${CFLAGS} -fno-builtin -c sin.c -o static/sin.o - -shared/sin.o: sin.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c sin.c -o shared/sin.o - -static/sinh.o: sinh.c - ${CC} ${CFLAGS} -fno-builtin -c sinh.c -o static/sinh.o - -shared/sinh.o: sinh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c sinh.c -o shared/sinh.o - -static/sqrt.o: sqrt.c - ${CC} ${CFLAGS} -fno-builtin -c sqrt.c -o static/sqrt.o - -shared/sqrt.o: sqrt.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c sqrt.c -o shared/sqrt.o - -static/tan.o: tan.c - ${CC} ${CFLAGS} -fno-builtin -c tan.c -o static/tan.o - -shared/tan.o: tan.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c tan.c -o shared/tan.o - -static/tanh.o: tanh.c - ${CC} ${CFLAGS} -fno-builtin -c tanh.c -o static/tanh.o - -shared/tanh.o: tanh.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c tanh.c -o shared/tanh.o - -static/trunc.o: trunc.c - ${CC} ${CFLAGS} -fno-builtin -c trunc.c -o static/trunc.o - -shared/trunc.o: trunc.c - ${CC} ${CFLAGS} -fPIC -fno-builtin -c trunc.c -o shared/trunc.o - -.PHONY: build -build: - ${MKDIR} static - ${MKDIR} shared - -${solib}: build shared/acos.o shared/acosh.o shared/acvs.o shared/ahv.o shared/ahvc.o shared/asin.o shared/asinh.o shared/atan.o shared/atan2.o shared/atanh.o shared/aver.o shared/cbrt.o shared/ceil.o shared/copysign.o shared/cos.o shared/cosh.o shared/exp.o shared/expm1.o shared/fabs.o shared/finite.o shared/floor.o shared/fmod.o shared/hypot.o shared/isnan.o shared/kcos.o shared/kremp2.o shared/ksin.o shared/ktan.o shared/log.o shared/log10.o shared/log1p.o shared/pow.o shared/remp2.o shared/round.o shared/scalbn.o shared/sin.o shared/sinh.o shared/sqrt.o shared/tan.o shared/tanh.o shared/trunc.o - ${CC} ${CFLAGS} -shared -s -fPIC -Wl,-soname,${solib}.1.7.0 -o ${solib} shared/acos.o shared/acosh.o shared/acvs.o shared/ahv.o shared/ahvc.o shared/asin.o shared/asinh.o shared/atan.o shared/atan2.o shared/atanh.o shared/aver.o shared/cbrt.o shared/ceil.o shared/copysign.o shared/cos.o shared/cosh.o shared/exp.o shared/expm1.o shared/fabs.o shared/finite.o shared/floor.o shared/fmod.o shared/hypot.o shared/isnan.o shared/kcos.o shared/kremp2.o shared/ksin.o shared/ktan.o shared/log.o shared/log10.o shared/log1p.o shared/pow.o shared/remp2.o shared/round.o shared/scalbn.o shared/sin.o shared/sinh.o shared/sqrt.o shared/tan.o shared/tanh.o shared/trunc.o - -${alib}: build static/acos.o static/acosh.o static/acvs.o static/ahv.o static/ahvc.o static/asin.o static/asinh.o static/atan.o static/atan2.o static/atanh.o static/aver.o static/cbrt.o static/ceil.o static/copysign.o static/cos.o static/cosh.o static/exp.o static/expm1.o static/fabs.o static/finite.o static/floor.o static/fmod.o static/hypot.o static/isnan.o static/kcos.o static/kremp2.o static/ksin.o static/ktan.o static/log.o static/log10.o static/log1p.o static/pow.o static/remp2.o static/round.o static/scalbn.o static/sin.o static/sinh.o static/sqrt.o static/tan.o static/tanh.o static/trunc.o - ${AR} rcs static/${alib} static/acos.o static/acosh.o static/acvs.o static/ahv.o static/ahvc.o static/asin.o static/asinh.o static/atan.o static/atan2.o static/atanh.o static/aver.o static/cbrt.o static/ceil.o static/copysign.o static/cos.o static/cosh.o static/exp.o static/expm1.o static/fabs.o static/finite.o static/floor.o static/fmod.o static/hypot.o static/isnan.o static/kcos.o static/kremp2.o static/ksin.o static/ktan.o static/log.o static/log10.o static/log1p.o static/pow.o static/remp2.o static/round.o static/scalbn.o static/sin.o static/sinh.o static/sqrt.o static/tan.o static/tanh.o static/trunc.o - ${RANLIB} static/${alib} - -.PHONY: install -install: ${alib} ${solib} - ${MKDIR} ${INSTDIR} - ${MKDIR} ${INSTDIRPC} - ${MKDIR} ${INSTDIRI} - ${INSTALL} static/${alib} ${INSTDIR}/${alib} - ${INSTALL} ${solib} ${INSTDIR}/${solib} - ${INSTALL} ${pkgconfig} ${INSTDIRPC}/${pkgconfig} - ${INSTALL} ${manpage} ${INSTDIRM}/${manpage} - ${INSTALL} ../math.h ${INSTDIRI}/amathr.h - ${LDCONFIG} ${INSTDIR} - -.PHONY: uninstall -uninstall: - ${DEL} ${INSTDIR}/${alib} - ${DEL} ${INSTDIR}/${solib} - ${DEL} ${INSTDIRPC}/${pkgconfig} - ${DEL} ${INSTDIRM}/${manpage} - ${DEL} ${INSTDIRI}/amathr.h - ${LDCONFIG} - -clean: - ${DEL} static/${alib} ${solib} static/acos.o static/acosh.o static/acvs.o static/ahv.o static/ahvc.o static/asin.o static/asinh.o static/atan.o static/atan2.o static/atanh.o static/aver.o static/cbrt.o static/ceil.o static/copysign.o static/cos.o static/cosh.o static/exp.o static/expm1.o static/fabs.o static/finite.o static/floor.o static/fmod.o static/hypot.o static/isnan.o static/kcos.o static/kremp2.o static/ksin.o static/ktan.o static/log.o static/log10.o static/log1p.o static/pow.o static/remp2.o static/round.o static/scalbn.o static/sin.o static/sinh.o static/sqrt.o static/tan.o static/tanh.o static/trunc.o shared/acos.o shared/acosh.o shared/acvs.o shared/ahv.o shared/ahvc.o shared/asin.o shared/asinh.o shared/atan.o shared/atan2.o shared/atanh.o shared/aver.o shared/cbrt.o shared/ceil.o shared/copysign.o shared/cos.o shared/cosh.o shared/exp.o shared/expm1.o shared/fabs.o shared/finite.o shared/floor.o shared/fmod.o shared/hypot.o shared/isnan.o shared/kcos.o shared/kremp2.o shared/ksin.o shared/ktan.o shared/log.o shared/log10.o shared/log1p.o shared/pow.o shared/remp2.o shared/round.o shared/scalbn.o shared/sin.o shared/sinh.o shared/sqrt.o shared/tan.o shared/tanh.o shared/trunc.o - diff --git a/src/real/amathr.3 b/src/real/amathr.3 index c4f3b799..b0d0b1aa 100644 --- a/src/real/amathr.3 +++ b/src/real/amathr.3 @@ -1,4 +1,4 @@ -.TH "amath/math.h" 3 "Wed Mar 1 2017" "Version 1.7.0" "amath" \" -*- nroff -*- +.TH "amath/math.h" 3 "Wed Mar 1 2017" "Version 1.7.1" "amath" \" -*- nroff -*- .ad l .nh .SH NAME diff --git a/src/real/amathr.pc b/src/real/amathr.pc index 2990cfb6..b28ef086 100644 --- a/src/real/amathr.pc +++ b/src/real/amathr.pc @@ -5,6 +5,6 @@ libdir=${exec_prefix}/lib Name: amath real library Description: Functions for handling real numbers -Version: 1.7.0 +Version: 1.7.1 Cflags: -I${includedir} Libs: -L${libdir} -lamathr diff --git a/src/system/Makefile b/src/system/Makefile deleted file mode 100644 index cf9e6c5e..00000000 --- a/src/system/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -CXX = g++ -CXXFLAGS = -O2 -DWITHTEST -I. -I.. -Wall -AR = ar -RANLIB = ranlib -DEL = rm -f - -all: lib -static: lib - -console.o: console.cpp - ${CXX} ${CXXFLAGS} -c console.cpp - -console_amiga.o: console_amiga.cpp - ${CXX} ${CXXFLAGS} -c console_amiga.cpp - -console_stdc.o: console_stdc.cpp - ${CXX} ${CXXFLAGS} -c console_stdc.cpp - -filesystem_amiga.o: filesystem_amiga.cpp - ${CXX} ${CXXFLAGS} -c filesystem_amiga.cpp - -filesystem_stdc.o: filesystem_stdc.cpp - ${CXX} ${CXXFLAGS} -c filesystem_stdc.cpp - -language.o: language.cpp - ${CXX} ${CXXFLAGS} -c language.cpp - -language_amiga.o: language_amiga.cpp - ${CXX} ${CXXFLAGS} -c language_amiga.cpp - -language_posix.o: language_posix.cpp - ${CXX} ${CXXFLAGS} -c language_posix.cpp - -language_stdc.o: language_stdc.cpp - ${CXX} ${CXXFLAGS} -c language_stdc.cpp - -preferences.o: preferences.cpp - ${CXX} ${CXXFLAGS} -c preferences.cpp - -preferences_amiga.o: preferences_amiga.cpp - ${CXX} ${CXXFLAGS} -c preferences_amiga.cpp - -preferences_stdc.o: preferences_stdc.cpp - ${CXX} ${CXXFLAGS} -c preferences_stdc.cpp - -proc_amiga.o: proc_amiga.cpp - ${CXX} ${CXXFLAGS} -c proc_amiga.cpp - -program.o: program.cpp - ${CXX} ${CXXFLAGS} -c program.cpp - -program_amiga.o: program_amiga.cpp - ${CXX} ${CXXFLAGS} -c program_amiga.cpp - -program_stdc.o: program_stdc.cpp - ${CXX} ${CXXFLAGS} -c program_stdc.cpp - -program_test.o: program_test.cpp - ${CXX} ${CXXFLAGS} -c program_test.cpp - -task_amiga.o: task_amiga.cpp - ${CXX} ${CXXFLAGS} -c task_amiga.cpp - -task_stdc.o: task_stdc.cpp - ${CXX} ${CXXFLAGS} -c task_stdc.cpp - -window_amiga.o: window_amiga.cpp - ${CXX} ${CXXFLAGS} -c window_amiga.cpp - -lib: console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o - ${AR} rcs libappsystem.a console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o - ${RANLIB} libappsystem.a - -clean: - ${DEL} libappsystem.a console.o console_amiga.o console_stdc.o filesystem_amiga.o filesystem_stdc.o language.o language_amiga.o language_posix.o language_stdc.o preferences.o preferences_amiga.o preferences_stdc.o proc_amiga.o program.o program_amiga.o program_stdc.o program_test.o task_amiga.o task_stdc.o window_amiga.o - diff --git a/src/system/console.cpp b/src/system/console.cpp index ce9b759f..de4e1350 100644 --- a/src/system/console.cpp +++ b/src/system/console.cpp @@ -33,6 +33,42 @@ #include "program.h" #include "localize/text.h" +static const char *version = TXTVERSMSG; +static const char *compiler = TXTCOMPMSG; +static const char *about = NEWLINE NEWLINE + "amath features a case sensitive command line interface, internal IEEE 754" NEWLINE + "calculations with 15 significant digits, calculations with real and complex" NEWLINE + "numbers, variables and user defined functions, logarithmic and exponential" NEWLINE + "functions, trigonometric and hyperbolic function and selected mathematical" NEWLINE + "constants and rounding functions." NEWLINE; +static const char *copyright = "Copyright (c) 2014-2017 Carsten Sonne Larsen "; +static const char *license = + "Copyright (c) 2007 The NetBSD Foundation, Inc." NEWLINE + "Copyright (c) 1990, 1993 The Regents of the University of California." NEWLINE + "All rights reserved." NEWLINE NEWLINE + "This code is derived from software written by Stephen L. Moshier." NEWLINE + "It is redistributed by the NetBSD Foundation by permission of the author." NEWLINE NEWLINE + "This code is derived from software contributed to Berkeley by" NEWLINE + "Mike Hibler and Chris Torek." NEWLINE NEWLINE + "Redistribution and use in source and binary forms, with or without" NEWLINE + "modification, are permitted provided that the following conditions are met:" NEWLINE NEWLINE + "* Redistributions of source code must retain the above copyright notice, this" NEWLINE + " list of conditions and the following disclaimer." NEWLINE NEWLINE + "* Redistributions in binary form must reproduce the above copyright notice," NEWLINE + " this list of conditions and the following disclaimer in the documentation" NEWLINE + " and/or other materials provided with the distribution." NEWLINE NEWLINE + "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"" NEWLINE + "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE" NEWLINE + "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE" NEWLINE + "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE" NEWLINE + "FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL" NEWLINE + "DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR" NEWLINE + "SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER" NEWLINE + "CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY," NEWLINE + "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE" NEWLINE + "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." NEWLINE NEWLINE; +static const char *footer = "Specific details should be found in the source files."; + ConsoleBase::ConsoleBase(const char* prompt) { AllocAndCopy(&this->prompt, prompt); @@ -48,23 +84,123 @@ const char* ConsoleBase::GetName() return CPROCNAME; } +const char * ConsoleBase::GetVersionText() +{ + return version; +} + +const char *ConsoleBase::GetCompilerText() +{ + return compiler; +} + +bool ConsoleBase::Open() +{ + return true; +} + +void ConsoleBase::Close() +{ +} + +bool ConsoleBase::SetAnsiMode(bool value) +{ + ansiMode = value; + return value; +} + +void ConsoleBase::ResetConsole() +{ + if (ansiMode) + { + static const char *normal = "\x1B[0m"; + WriteString(normal); + } +} + +void ConsoleBase::AnsiBold() +{ + if (ansiMode) + { + static const char *bold = "\x1B[1m"; + WriteString(bold); + } +} + +void ConsoleBase::AnsiItalics() +{ + if (ansiMode) + { + static const char *italics = "\x1B[3m"; + WriteString(italics); + } +} + void ConsoleBase::Clear() { - WriteString(CLEARWINDOW); - WriteString(NORMALTEXT); + if (ansiMode) + { + static const char *clear = "\x1B[1;1H\x1B[J"; + WriteString(clear); + ResetConsole(); + } + else + { + static const char *msg = "Screen can only be cleared in ANSI mode."; + WriteString(msg); + WriteString(NEWLINE); + } +} + +void ConsoleBase::ShowVersion() +{ + AnsiBold(); + WriteString(version); + ResetConsole(); + WriteString(NEWLINE); + WriteString(compiler); + WriteString(NEWLINE); + ResetConsole(); +} + +void ConsoleBase::ShowAbout() +{ + AnsiBold(); + WriteString(version); + ResetConsole(); + WriteString(NEWLINE); + WriteString(compiler); + ResetConsole(); + WriteString(about); + ResetConsole(); +} + +void ConsoleBase::ShowLicense() +{ + WriteString(NEWLINE); + AnsiBold(); + WriteString(copyright); + ResetConsole(); + WriteString(NEWLINE); + WriteString(license); + AnsiItalics(); + WriteString(footer); + ResetConsole(); + WriteString(NEWLINE); + WriteString(NEWLINE); } void ConsoleBase::StartMessage() { WriteString(INTROMSG); - WriteString(NORMALTEXT); + ResetConsole(); } void ConsoleBase::Prompt() { - WriteString(NORMALTEXT); + ResetConsole(); WriteString(prompt); - WriteString(NORMALTEXT); + ResetConsole(); } void ConsoleBase::SetPrompt(const char* string) diff --git a/src/system/console.h b/src/system/console.h index b82d011a..220ea57a 100644 --- a/src/system/console.h +++ b/src/system/console.h @@ -36,29 +36,40 @@ * */ -#include "thread.h" - /** * @brief Abstract base class encapsulating console logic. * */ -class ConsoleBase : public ThreadBase +class ConsoleBase { public: explicit ConsoleBase(const char* prompt); virtual ~ConsoleBase(); const char* GetName(); - virtual void Clear(); + virtual bool Open(); + virtual void Close(); + virtual void Start() = 0; virtual void Exit() = 0; + virtual void Clear(); + virtual void ShowAbout(); + virtual void ShowLicense(); + virtual void ShowVersion(); virtual void SetPrompt(const char* string); virtual void WriteString(const char* string) = 0; + virtual bool SetAnsiMode(bool value); protected: - void StartMessage(); + virtual void StartMessage(); void Prompt(); + const char* GetVersionText(); + const char* GetCompilerText(); + char* prompt; private: - char* prompt; + void ResetConsole(); + void AnsiItalics(); + void AnsiBold(); + bool ansiMode; }; #endif diff --git a/src/system/console_amiga.cpp b/src/system/console_amiga.cpp index 64e86f7a..2dd22ba9 100644 --- a/src/system/console_amiga.cpp +++ b/src/system/console_amiga.cpp @@ -32,14 +32,13 @@ #include "console_amiga.h" #include "main/evaluator.h" -#ifdef AMIGA +#if defined(AMIGA) #include AmigaShellConsole::AmigaShellConsole(const char* prompt) : - ConsoleBase(prompt) + ConsoleBase(prompt), exit(false) { line = new char[linesize]; - exit = false; } AmigaShellConsole::~AmigaShellConsole() @@ -47,12 +46,7 @@ AmigaShellConsole::~AmigaShellConsole() delete line; } -int AmigaShellConsole::GetStackSize() -{ - return 100000; -} - -void AmigaShellConsole::Run() +void AmigaShellConsole::Start() { exit = false; Flush(Input()); diff --git a/src/system/console_amiga.h b/src/system/console_amiga.h index 7368bb2a..5c7fccac 100644 --- a/src/system/console_amiga.h +++ b/src/system/console_amiga.h @@ -31,7 +31,7 @@ #define AMATH_AMIGA_SHELL_CONSOLE /** - * @file console.h + * @file console_amiga.h * @brief Amiga OS specific console. * */ @@ -40,14 +40,17 @@ #include "amathc.h" #include "console.h" -#ifdef AMIGA +#if defined(AMIGA) +/** + * @brief Encapsulates the IO of a console in Amiga OS. + * + */ class AmigaShellConsole : public ConsoleBase { public: explicit AmigaShellConsole(const char *prompt); virtual ~AmigaShellConsole(); - virtual int GetStackSize(); - virtual void Run(); + virtual void Start(); virtual void Exit(); virtual void SetPrompt(const char *string); virtual void WriteString(const char *string); diff --git a/src/system/console_posix.cpp b/src/system/console_posix.cpp new file mode 100644 index 00000000..4419bc3f --- /dev/null +++ b/src/system/console_posix.cpp @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "amath.h" +#include "amathc.h" +#include "console.h" +#include "console_posix.h" +#include "lib/charval.h" +#include "lib/aengine.h" +#include "main/evaluator.h" + +#if defined(POSIX) +#include +#include + +PosixConsole::PosixConsole(const char* prompt, CharValidator* validator) : + ConsoleBase(prompt), line(nullptr), exit(false) +{ + proc = new AnsiConoleEngine(prompt, validator); +} + +PosixConsole::~PosixConsole() +{ + delete proc; +} + +bool PosixConsole::Open() +{ + if (tcgetattr(STDIN_FILENO, &oldAttr) != 0) + { + termError = true; + return false; + } + + newAttr = oldAttr; + newAttr.c_lflag &=(~ICANON & ~ECHO); + newAttr.c_cc[VMIN] = 1; + newAttr.c_cc[VTIME] = 0; + + return (tcsetattr(STDIN_FILENO, TCSANOW, &newAttr) != -1); +} + +void PosixConsole::Close() +{ + if (!termError) + { + tcsetattr(STDIN_FILENO, TCSANOW, &oldAttr); + } +} + +void PosixConsole::Start() +{ + exit = false; + StartMessage(); + + while (!exit) + { + Prompt(); + ReadLine(); + Evaluator* evaluator = new Evaluator(line); + evaluator->Evaluate(); + const char* res = evaluator->GetResult(); + Write(res, StrLen(res)); + delete evaluator; + } +} + +void PosixConsole::Exit() +{ + exit = true; +} + +void PosixConsole::ReadLine() +{ + proc->StartInput(); + while (!proc->InputDone()) + { + unsigned char c = getchar(); + const char* out = proc->ProcessChar(static_cast(c)); + WriteString(out); + } + + line = proc->GetLine(); +} + +void PosixConsole::WriteString(const char* string) +{ + Write(string, StrLen(string)); +} + +void PosixConsole::Write(const char* string, unsigned int length) +{ + unsigned int i = 0; + while (i < length && string[i] != 0) + { + fputc(string[i], stdout); + i++; + } + + fflush(stdout); +} + +void PosixConsole::SetPrompt(const char* string) +{ + ConsoleBase::SetPrompt(string); + proc->SetPrompt(string); +} + +#endif diff --git a/src/system/proc_amiga.h b/src/system/console_posix.h similarity index 62% rename from src/system/proc_amiga.h rename to src/system/console_posix.h index 81c37329..6600bf7e 100644 --- a/src/system/proc_amiga.h +++ b/src/system/console_posix.h @@ -27,48 +27,49 @@ * */ -#ifndef AMATH_AMIGA_PROC -#define AMATH_AMIGA_PROC +#ifndef AMATH_POSIX_CONSOLE +#define AMATH_POSIX_CONSOLE /** - * @file proc_amiga.h - * @brief Amiga OS specific sytem process calls. + * @file console_posix.h + * @brief Standard C and termios based console. * */ #include "amath.h" #include "amathc.h" -#include "system/task.h" -#include "system/thread.h" +#include "console.h" +#include "lib/charval.h" +#include "lib/aengine.h" -#ifdef AMIGA -#include -#include -#include -#include -#include -#include +#if defined(POSIX) +#include /** -* @brief Encapsulates system calls to an Amiga OS process. -* -* Based on examples found at:
-* http://amigadev.elowar.com/read/ADCD_2.1/Includes_and_Autodocs_3._guide/node014C.html
-* http://guidetoamigacompatibleprogramming.googlecode.com/svn/trunk/english/CAP_5.txt -* -*/ -class AmigaProcess : public TaskBase { + * @brief Encapsulates the IO of a console using Standard C and termios. + * + */ +class PosixConsole : public ConsoleBase +{ public: - AmigaProcess(); - ~AmigaProcess(); - void Start(ThreadBase *thread); - void WaitExit(); + PosixConsole(const char* prompt, CharValidator* validator); + virtual ~PosixConsole(); + virtual bool Open(); + virtual void Close(); + virtual void Start(); + virtual void Exit(); + virtual void SetPrompt(const char* string); + virtual void WriteString(const char* string); private: - static void Invoke(); - unsigned int signal; - Task *maintask; - Process *proc; + void ReadLine(); + static void Write(const char* string, unsigned int length); + AnsiConoleEngine* proc; + const char* line; + bool exit; + bool termError; + struct termios oldAttr; + struct termios newAttr; }; #endif diff --git a/src/system/console_stdc.cpp b/src/system/console_stdc.cpp index 2d88c769..b3efff94 100644 --- a/src/system/console_stdc.cpp +++ b/src/system/console_stdc.cpp @@ -28,47 +28,48 @@ */ #include "amath.h" -#include "amathc.h" -#include "console.h" #include "console_stdc.h" -#include "lib/charval.h" -#include "lib/aengine.h" #include "main/evaluator.h" -#if !defined(AMIGA) +#if defined(STDC_CONSOLE) #include -StandardConsole::StandardConsole(const char* prompt, CharValidator* validator) : - ConsoleBase(prompt) +StandardConsole::StandardConsole(const char* prompt) : + ConsoleBase(prompt), exit(false) { - proc = new AnsiConoleEngine(prompt, validator); - line = nullptr; - exit = false; + line = new char[linesize]; } StandardConsole::~StandardConsole() { - delete proc; + delete line; } -int StandardConsole::GetStackSize() +bool StandardConsole::SetAnsiMode(bool value) { - return 100000; + return false; } -void StandardConsole::Run() +void StandardConsole::Start() { exit = false; + fflush(stdin); StartMessage(); while (!exit) { Prompt(); ReadLine(); + + if (*line == '\0') + { + break; + } + Evaluator* evaluator = new Evaluator(line); evaluator->Evaluate(); - const char* res = evaluator->GetResult(); - Write(res, StrLen(res)); + const char* out = evaluator->GetResult(); + WriteString(out); delete evaluator; } } @@ -80,51 +81,19 @@ void StandardConsole::Exit() void StandardConsole::ReadLine() { -#ifdef UNIX - termios new_tio, old_tio; - tcgetattr(STDIN_FILENO, &old_tio); - new_tio = old_tio; - new_tio.c_lflag &=(~ICANON & ~ECHO); - tcsetattr(STDIN_FILENO, TCSANOW, &new_tio); -#endif - - proc->StartInput(); - - while (!proc->InputDone()) - { - unsigned char c = getchar(); - const char* out = proc->ProcessChar(static_cast(c)); - WriteString(out); - } - - line = proc->GetLine(); - -#ifdef UNIX - tcsetattr(STDIN_FILENO, TCSANOW, &old_tio); -#endif + fflush(stdin); + fgets(line, linesize, stdin); } void StandardConsole::WriteString(const char* string) { - Write(string, StrLen(string)); -} - -void StandardConsole::Write(const char* string, unsigned int length) -{ - unsigned int i = 0; - while (i < length && string[i] != 0) - { - fputc(string[i], stdout); - i++; - } - + fputs(string, stdout); fflush(stdout); } void StandardConsole::SetPrompt(const char* string) { ConsoleBase::SetPrompt(string); - proc->SetPrompt(string); } #endif diff --git a/src/system/console_stdc.h b/src/system/console_stdc.h index 035d9d1e..2bc147dd 100644 --- a/src/system/console_stdc.h +++ b/src/system/console_stdc.h @@ -27,46 +27,42 @@ * */ -#ifndef AMATH_STANDARD_CONSOLE -#define AMATH_STANDARD_CONSOLE +#ifndef AMATH_STDC_CONSOLE +#define AMATH_STDC_CONSOLE /** * @file console_stdc.h - * @brief Standard C and termios based console. + * @brief Standard C console. * */ #include "amath.h" -#include "amathc.h" #include "console.h" -#include "lib/charval.h" -#include "lib/aengine.h" -#if !defined(AMIGA) +#if defined(STDC_CONSOLE) +#include /** - * @brief Encapsulates the IO of a console using Standard C and termios. + * @brief Encapsulates the IO of a Standard C console. * */ -class StandardConsole : public ConsoleBase -{ +class StandardConsole : public ConsoleBase { public: - StandardConsole(const char* prompt, CharValidator* validator); + explicit StandardConsole(const char *prompt); virtual ~StandardConsole(); - virtual int GetStackSize(); - virtual void Run(); + virtual void Start(); virtual void Exit(); - virtual void SetPrompt(const char* string); - virtual void WriteString(const char* string); + virtual void SetPrompt(const char *string); + virtual void WriteString(const char *string); + virtual bool SetAnsiMode(bool value); private: void ReadLine(); - static void Write(const char* string, unsigned int length); - AnsiConoleEngine* proc; - const char* line; + bool exit; + char *line; + static const unsigned int linesize = 1024; }; #endif - #endif diff --git a/src/system/console_windows.cpp b/src/system/console_windows.cpp new file mode 100644 index 00000000..3a2ef630 --- /dev/null +++ b/src/system/console_windows.cpp @@ -0,0 +1,248 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "amath.h" + +#if defined(WINDOWS) +#include "amathc.h" +#include "console.h" +#include "console_windows.h" +#include "lib/charval.h" +#include "lib/aengine.h" +#include "main/evaluator.h" +#include + +#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 +#endif +#ifndef DISABLE_NEWLINE_AUTO_RETURN +#define DISABLE_NEWLINE_AUTO_RETURN 0x0008 +#endif +#ifndef ENABLE_VIRTUAL_TERMINAL_INPUT +#define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200 +#endif + +#define IN_DEFAULT \ + ENABLE_PROCESSED_INPUT + +#define IN_ANSI \ + ENABLE_PROCESSED_INPUT | \ + ENABLE_VIRTUAL_TERMINAL_INPUT + +#define OUT_DEFAULT \ + ENABLE_PROCESSED_OUTPUT | \ + ENABLE_WRAP_AT_EOL_OUTPUT + +#define OUT_ANSI1 \ + ENABLE_PROCESSED_OUTPUT | \ + ENABLE_WRAP_AT_EOL_OUTPUT | \ + ENABLE_VIRTUAL_TERMINAL_PROCESSING | \ + DISABLE_NEWLINE_AUTO_RETURN + +#define OUT_ANSI2 \ + ENABLE_PROCESSED_OUTPUT | \ + ENABLE_WRAP_AT_EOL_OUTPUT | \ + ENABLE_VIRTUAL_TERMINAL_PROCESSING + +WindowsConsole::WindowsConsole(const char* prompt, CharValidator* validator) : + ConsoleBase(prompt), line(nullptr), exit(false) +{ + proc = new AnsiConoleEngine(prompt, validator); +} + +WindowsConsole::~WindowsConsole() +{ +} + +bool WindowsConsole::Open() +{ + HANDLE in = GetStdHandle(STD_INPUT_HANDLE); + if (in == INVALID_HANDLE_VALUE) + { + return false; + } + + if (!GetConsoleMode(in, &oldInMode)) + { + return false; + } + + if (!SetConsoleMode(in, IN_DEFAULT)) + { + return false; + } + + HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); + if (out == INVALID_HANDLE_VALUE) + { + return false; + } + + if (!GetConsoleMode(out, &oldOutMode)) + { + return false; + } + + if (!SetConsoleMode(out, OUT_DEFAULT)) + { + return false; + } + + return true; +} + +void WindowsConsole::Close() +{ + HANDLE in = GetStdHandle(STD_INPUT_HANDLE); + if (in == INVALID_HANDLE_VALUE) + { + return; + } + SetConsoleMode(in, oldInMode); + + HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); + if (out == INVALID_HANDLE_VALUE) + { + return; + } + SetConsoleMode(in, oldOutMode); +} + +bool WindowsConsole::SetAnsiMode(bool value) +{ + HANDLE in = GetStdHandle(STD_INPUT_HANDLE); + if (in == INVALID_HANDLE_VALUE) + { + ConsoleBase::SetAnsiMode(false); + return false; + } + + HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); + if (out == INVALID_HANDLE_VALUE) + { + ConsoleBase::SetAnsiMode(false); + return false; + } + + // Disable virtual terminal + if (!value) + { + SetConsoleMode(in, IN_DEFAULT); + SetConsoleMode(out, OUT_DEFAULT); + ConsoleBase::SetAnsiMode(false); + return true; + } + + bool success = true; + + // Enable virtual terminal + if (!SetConsoleMode(out, OUT_ANSI1)) + { + if (!SetConsoleMode(out, OUT_ANSI2)) + { + success = false; + } + } + + if (!SetConsoleMode(in, IN_ANSI)) + { + success = false; + } + + ConsoleBase::SetAnsiMode(success); + return success; +} + +void WindowsConsole::Start() +{ + exit = false; + StartMessage(); + + while (!exit) + { + Prompt(); + ReadLine(); + Evaluator* evaluator = new Evaluator(line); + evaluator->Evaluate(); + const char* res = evaluator->GetResult(); + Write(res, StrLen(res)); + delete evaluator; + } +} + +void WindowsConsole::Exit() +{ + exit = true; +} + +void WindowsConsole::SetPrompt(const char* string) +{ + ConsoleBase::SetPrompt(string); + proc->SetPrompt(string); +} + +void WindowsConsole::ReadLine() +{ + DWORD count; + HANDLE in = GetStdHandle(STD_INPUT_HANDLE); + if (in == INVALID_HANDLE_VALUE) + { + return; + } + + char inchar; + proc->StartInput(); + while (!proc->InputDone()) + { + ReadConsole(in, &inchar, 1, &count, nullptr); + const char* out = proc->ProcessChar(inchar); + WriteString(out); + } + + line = proc->GetLine(); +} + +void WindowsConsole::WriteString(const char* string) +{ + Write(string, StrLen(string)); +} + +void WindowsConsole::Write(const char* string, unsigned int length) +{ + DWORD count; + HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); + if (out == INVALID_HANDLE_VALUE) + { + return; + } + + WriteConsole(out, string, length, &count, nullptr); +} + +#endif diff --git a/src/system/task_amiga.h b/src/system/console_windows.h similarity index 63% rename from src/system/task_amiga.h rename to src/system/console_windows.h index 682034c3..1e291aba 100644 --- a/src/system/task_amiga.h +++ b/src/system/console_windows.h @@ -27,54 +27,50 @@ * */ -#ifndef AMATH_AMIGA_TASK -#define AMATH_AMIGA_TASK +#ifndef AMATH_WINDOWS_CONSOLE +#define AMATH_WINDOWS_CONSOLE /** - * @file task_amiga.h - * @brief Amiga OS specific sytem task calls. + * @file console_windows.h + * @brief Windows based console. * */ #include "amath.h" #include "amathc.h" -#include "task.h" -#include "thread.h" +#include "console.h" +#include "lib/charval.h" +#include "lib/aengine.h" -#ifdef AMIGA -#include -#include -#include -#include -#include -#include +#if defined(WINDOWS) +#include /** -* @brief Infomations passed to a new task when started. -* -*/ -struct ThreadStart { - ThreadBase *thread; - Task *maintask; - unsigned int signal; -}; - -/** -* @brief Encapsulates system calls to an Amiga OS task. -* -*/ -class AmigaTask : public TaskBase { + * @brief Encapsulates the IO of a console in Windows. + * + */ +class WindowsConsole : public ConsoleBase +{ public: - AmigaTask(); - ~AmigaTask(); - void Start(ThreadBase *thread); - void WaitExit(); + WindowsConsole(const char* prompt, CharValidator* validator); + virtual ~WindowsConsole(); + virtual bool Open(); + virtual void Close(); + virtual void Start(); + virtual void Exit(); + virtual void SetPrompt(const char* string); + virtual void WriteString(const char* string); + virtual bool SetAnsiMode(bool value); private: - static void Invoke(); - unsigned int signal; - Task *maintask; - Task *task; + void ReadLine(); + static void Write(const char* string, unsigned int length); + + AnsiConoleEngine* proc; + DWORD oldOutMode; + DWORD oldInMode; + const char* line; + bool exit; }; #endif diff --git a/src/system/filesystem_stdc.cpp b/src/system/filesystem_stdc.cpp index b2048044..1aa8ecd2 100644 --- a/src/system/filesystem_stdc.cpp +++ b/src/system/filesystem_stdc.cpp @@ -53,7 +53,7 @@ CharBuffer* StandardFilesystem::ListDirectory(const char* path) } DIR *dir; - if ((dir = opendir(pathbuf->GetString())) == NULL) { + if ((dir = opendir(pathbuf->GetString())) == nullptr) { CharBuffer *res = new CharBuffer(); const char *msg = MSGNODIR; res->EnsureSize(StrLen(msg) + StrLen(pathbuf->GetString()) + StrLen(NEWLINE) + 1); @@ -71,7 +71,7 @@ CharBuffer* StandardFilesystem::ListDirectory(const char* path) bool first = true; struct dirent *entry; - while ((entry = readdir(dir)) != NULL) { + while ((entry = readdir(dir)) != nullptr) { if (StrIsEqual(entry->d_name, ".") || StrIsEqual(entry->d_name, "..")) { continue; } @@ -126,7 +126,7 @@ CharBuffer* StandardFilesystem::LoadTextFile(const char* name) { FILE* file; -#if !defined(_WIN32) +#if !defined(WINDOWS) file = fopen(name, "r"); #else fopen_s(&file, name, "r"); @@ -169,7 +169,7 @@ bool StandardFilesystem::SaveTextFile(const char* name, const char* text) { FILE* file; -#if !defined(_WIN32) +#if !defined(WINDOWS) file = fopen(name, "w"); #else fopen_s(&file, name, "w"); diff --git a/src/system/language.cpp b/src/system/language.cpp index 1979731a..992a0fe0 100644 --- a/src/system/language.cpp +++ b/src/system/language.cpp @@ -36,9 +36,42 @@ #include "localize/kword.h" #include "localize/ident.h" #include "localize/text.h" -#include "localize/tags.h" #include "localize/ialias.h" +static const texttag ansiTags[] = { + {"#HEADLINE#", "\x1B[1m"}, +#ifdef UNIX + {"#SYNTAXHIGHLIGHT#", "\x1B[3m\x1B[32m"}, +#else + {"#SYNTAXHIGHLIGHT#", "\x1B[32m"}, +#endif + {"#NORMALTEXT#", "\x1B[0m"}, + {"#BOLD#", "\x1B[1m"}, + {"#ITALICS#", "\x1B[3m"}, + {"#UNDERLINE#", "\x1B[4m"}, + {"#COLOR01#", "\x1B[31m"}, + {"#COLOR02#", "\x1B[32m"}, + {"#COLOR03#", "\x1B[33m"}, + {"#SPACE#", SPACE}, + {"#NEWLINE#", NEWLINE}, + {"#STARTMSG#", TXTSTARTMSG} +}; + +static const texttag emptyTags[] = { + {"#HEADLINE#", EMPTYSTRING}, + {"#SYNTAXHIGHLIGHT#", EMPTYSTRING}, + {"#NORMALTEXT#", EMPTYSTRING}, + {"#BOLD#", EMPTYSTRING}, + {"#ITALICS#", EMPTYSTRING}, + {"#UNDERLINE#", EMPTYSTRING}, + {"#COLOR01#", EMPTYSTRING}, + {"#COLOR02#", EMPTYSTRING}, + {"#COLOR03#", EMPTYSTRING}, + {"#SPACE#", SPACE}, + {"#NEWLINE#", NEWLINE}, + {"#STARTMSG#", TXTSTARTMSG} +}; + Language::Language() { lastText = nullptr; @@ -63,6 +96,11 @@ Language::~Language() } } +void Language::SetAnsiMode(bool value) +{ + ansiMode = value; +} + char* Language::FindAlias(const char* ident) const { for (unsigned int i = 0; i < aliascount; i++) @@ -170,9 +208,12 @@ char* Language::UntagText(const char* text) return nullptr; } - unsigned int count = sizeof(texttags) / sizeof(texttag); + unsigned int count = sizeof(ansiTags) / sizeof(texttag); char* untagged = new char[StrLen(text) * 2]; - Untag(untagged, text, (texttag*)texttags, count); + texttag* tags = ansiMode + ? (texttag*)ansiTags + : (texttag*)emptyTags; + Untag(untagged, text, tags, count); unsigned int len = StrLen(untagged) + 1; lastText = new char[len]; diff --git a/src/system/language.h b/src/system/language.h index de5851d2..49e8c6e2 100644 --- a/src/system/language.h +++ b/src/system/language.h @@ -57,6 +57,7 @@ public: virtual bool CharIsOperator(unsigned long character); virtual bool StrIsEqualLoc(const char* s1, const char* s2) = 0; virtual bool Validate(char c) = 0; + void SetAnsiMode(bool value); protected: virtual char* Translate(textdef* def) = 0; @@ -74,6 +75,7 @@ private: char* FindAlias(const char* ident) const; char* UntagText(const char* text); char* lastText; + bool ansiMode; }; #endif diff --git a/src/system/language_amiga.cpp b/src/system/language_amiga.cpp index fd2e5664..eed532eb 100644 --- a/src/system/language_amiga.cpp +++ b/src/system/language_amiga.cpp @@ -36,7 +36,6 @@ #include "localize/text.h" #include "localize/ident.h" #include "localize/kword.h" -#include "localize/tags.h" #ifdef AMIGA #include @@ -44,17 +43,17 @@ AmigaLanguage::AmigaLanguage() : Language::Language() { - locale = OpenLocale(NULL); + locale = OpenLocale(nullptr); helpcatalog = OpenCatalog(locale, CATALOG_HELP, CATALOG_DEF, TAG_DONE); identcatalog = OpenCatalog(locale, CATALOG_IDEN, CATALOG_DEF, TAG_DONE); textcatalog = OpenCatalog(locale, CATALOG_TEXT, CATALOG_DEF, TAG_DONE); keywordcatalog = OpenCatalog(locale, CATALOG_KEYW, CATALOG_DEF, TAG_DONE); - if (keywordcatalog != NULL) { + if (keywordcatalog != nullptr) { keywordsloc = new keyworddef[keywordcount]; for (unsigned int j = 0; j < keywordcount; j++) { keywordsloc[j].id = j; - keywordsloc[j].name = GetCatalogStr(keywordcatalog, j, NULL); + keywordsloc[j].name = GetCatalogStr(keywordcatalog, j, nullptr); keywordsloc[j].symbol = keywords[j].symbol; } } @@ -62,23 +61,23 @@ AmigaLanguage::AmigaLanguage() : AmigaLanguage::~AmigaLanguage() { - if (helpcatalog != NULL) { + if (helpcatalog != nullptr) { CloseCatalog(helpcatalog); } - if (identcatalog != NULL) { + if (identcatalog != nullptr) { CloseCatalog(identcatalog); } - if (textcatalog != NULL) { + if (textcatalog != nullptr) { CloseCatalog(textcatalog); } - if (keywordcatalog != NULL) { + if (keywordcatalog != nullptr) { CloseCatalog(keywordcatalog); } - if (locale != NULL) { + if (locale != nullptr) { CloseLocale(locale); } } diff --git a/src/system/language_posix.cpp b/src/system/language_posix.cpp index e1af6179..0c59df78 100644 --- a/src/system/language_posix.cpp +++ b/src/system/language_posix.cpp @@ -32,13 +32,12 @@ #include "program.h" #include "language_posix.h" #include "localize/lex.h" -#include "localize/tags.h" #include "localize/help.h" #include "localize/text.h" #include "localize/ident.h" #include "localize/kword.h" -#ifdef UNIX +#if defined(UNIX) #include #include /* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html */ #include /* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html */ diff --git a/src/system/language_stdc.cpp b/src/system/language_stdc.cpp index 1d3e7c40..fdbe04ad 100644 --- a/src/system/language_stdc.cpp +++ b/src/system/language_stdc.cpp @@ -33,7 +33,6 @@ #include "language_stdc.h" #include "filesystem_stdc.h" #include "localize/lex.h" -#include "localize/tags.h" #include "localize/help.h" #include "localize/text.h" #include "localize/ident.h" diff --git a/src/system/preferences_amiga.cpp b/src/system/preferences_amiga.cpp index 70cffe99..fb58b2b8 100644 --- a/src/system/preferences_amiga.cpp +++ b/src/system/preferences_amiga.cpp @@ -56,11 +56,11 @@ bool AmigaPreferences::Load() do { c = FGets(file, buf, bufsize); - if (c != NULL) { + if (c != nullptr) { text->EnsureSize(s++); text->Append(c); } - } while (c != NULL); + } while (c != nullptr); delete [] buf; Close(file); diff --git a/src/system/preferences_stdc.cpp b/src/system/preferences_stdc.cpp index b9c2459e..85c05081 100644 --- a/src/system/preferences_stdc.cpp +++ b/src/system/preferences_stdc.cpp @@ -37,9 +37,12 @@ #include #include -#if defined(UNIX) && defined(HAIKU) +#if defined(UNIX) static const char *tempname = "/tmp/amath.prefs"; static const char *permname = "/usr/local/etc/amath.conf"; +#elif defined(HAIKU) +static const char *tempname = "/tmp/amath.prefs"; +static const char *permname = "~/config/settings/amath/amath.conf"; #else static const char* tempname = "amath.prefs"; static const char* permname = "amath.conf"; @@ -63,11 +66,11 @@ bool StandardPreferences::Load() do { c = fgets(buf, bufsize, file); - if (c != NULL) { + if (c != nullptr) { text->EnsureSize(s++); text->Append(c); } - } while (c != NULL); + } while (c != nullptr); delete [] buf; fclose(file); diff --git a/src/system/proc_amiga.cpp b/src/system/proc_amiga.cpp deleted file mode 100644 index 083a4e19..00000000 --- a/src/system/proc_amiga.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Project homepage: - * http://amath.innolan.net - * - */ - -#include "amath.h" -#include "amathc.h" -#include "task.h" -#include "thread.h" -#include "proc_amiga.h" - -#ifdef WITHTEST -#ifdef AMIGA -#ifdef DEVNOTFINISH // Still under development -#include -#include -#include -#include -#include -#include -#include -#include -#include - -AmigaProcess::AmigaProcess() -{ - proc = nullptr; - maintask = FindTask(NULL); - signal = AllocSignal(-1); -} - -AmigaProcess::~AmigaProcess() -{ -/* -if (proc != nullptr) { - Forbid(); - DeleteTask(proc); - Permit(); -} -*/ - -// See: http://eab.abime.net/showthread.php?t=73783 -// And AROS Stack swap: http://en.wikibooks.org/wiki/Aros/Developer/Docs/Examples/StackSwap - Forbid(); - FreeSignal(signal); - Permit(); -} - -ThreadStart procstart; - -void AmigaProcess::Start(ThreadBase *thread) -{ - - procstart.thread = thread; - procstart.maintask = maintask; - procstart.signal = signal; - - proc = CreateNewProcTags(NP_Entry, (ULONG) &AmigaProcess::Invoke, - NP_Name, thread->GetName(), - NP_Priority, 1, - TAG_DONE); -} - -void AmigaProcess::Invoke() -{ - ThreadStart invoked = procstart; - - invoked.thread->Run(); - Signal(invoked.maintask, 1U << invoked.signal); -} - -void AmigaProcess::WaitExit() -{ - Wait(1U << signal | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D); -} - -#endif -#endif -#endif diff --git a/src/system/program.cpp b/src/system/program.cpp index 8dab6b0f..ab6c1e00 100644 --- a/src/system/program.cpp +++ b/src/system/program.cpp @@ -46,10 +46,9 @@ #include "main/values.h" #include "main/functionlist.h" -Program::Program() +Program::Program() : + Console(nullptr), shellMode(false), ansiMode(false), status(0) { - status = 0; - Console = nullptr; Variables = new VariableList(); Functions = new FunctionList(); ins = new IntegerNumber(); @@ -60,7 +59,7 @@ Program::Program() #elif defined(AMIGA) Language = new AmigaLanguage(); Filesystem = new AmigaFilesystem(); - Preferences =new AmigaPreferences(); + Preferences = new AmigaPreferences(); #else Language = new StandardLanguage(); Filesystem = new StandardFilesystem(); @@ -140,3 +139,34 @@ int Program::GetExitStatus() const { return status; } + +void Program::InitAnsiMode() +{ + SetAnsiMode(ansiMode); +} + +bool Program::GetAnsiMode() const +{ + return ansiMode; +} + +void Program::SetAnsiMode(bool value) +{ + bool result = false; + if (Console != nullptr) + { + result = Console->SetAnsiMode(value); + } + + if (Language != nullptr) + { + Language->SetAnsiMode(result); + } + + ansiMode = result; +} + +void Program::Exit() +{ + Console->Exit(); +} diff --git a/src/system/program.h b/src/system/program.h index 8b409603..8fc595cd 100644 --- a/src/system/program.h +++ b/src/system/program.h @@ -58,13 +58,15 @@ public: Program(); virtual ~Program(); virtual void Initialize(int argc, char** argv) = 0; - virtual void Run() = 0; - virtual void Exit() = 0; + virtual void Start() = 0; + virtual void Exit(); void NewPositionalInput(short unsigned int base, short unsigned int digits); void NewPositionalOutput(short unsigned int base, short unsigned int digits); void SetLastResult(Number* number); void SetPrompt(const char* text) const; int GetExitStatus() const; + bool GetAnsiMode() const; + void SetAnsiMode(bool value); struct Number* GetLastResult() const; class Language* Language; class ConsoleBase* Console; @@ -77,6 +79,9 @@ public: class GraphList* Graphs; protected: + void InitAnsiMode(); + bool shellMode; + bool ansiMode; int status; private: diff --git a/src/system/program_amiga.cpp b/src/system/program_amiga.cpp index a077b7d3..bbd2b426 100644 --- a/src/system/program_amiga.cpp +++ b/src/system/program_amiga.cpp @@ -40,16 +40,10 @@ #include "lib/charbuf.h" #include "main/evaluator.h" -#ifdef AMIGA -#define ARGS_FORMAT "SHELL/S,INPUT/F" +#if defined(AMIGA) +#define ARGS_FORMAT "SHELL/S,NOANSI/S,INPUT/F" #include -void WriteToShell(const char* out) -{ - Write(Output(), (APTR)out, StrLen(out)); - Write(Output(), (APTR)NORMALTEXT, StrLen(NORMALTEXT)); -} - #ifdef AOS3 # define RDPTR LONG* #else @@ -59,27 +53,31 @@ void WriteToShell(const char* out) AmigaProgram::AmigaProgram() : Program() { - rdargs = NULL; + rdargs = nullptr; args.shell = FALSE; - args.input = NULL; - Console = NULL; + args.noansi = FALSE; + args.input = nullptr; + Console = nullptr; } AmigaProgram::~AmigaProgram() { - if (Console != NULL) { + if (Console != nullptr) { + Console->Close(); delete Console; } - if (rdargs != NULL) { + if (rdargs != nullptr) { FreeArgs(rdargs); } } void AmigaProgram::Initialize(int argc, char **argv) { - if(argc < 2) { + if(argc < 2) + { Console = new AmigaWindow(Preferences->GetPrompt(), Language); + SetAnsiMode(true); return; } @@ -87,32 +85,39 @@ void AmigaProgram::Initialize(int argc, char **argv) if (!rdargs) { PrintFault(IoErr(), (STRPTR)argv[0]); - } - - if (args.shell) { - Console = new AmigaShellConsole(Preferences->GetPrompt()); return; } + + shellMode = args.shell ? true : false; + ansiMode = args.noansi ? false : true; + + Console = new AmigaShellConsole(Preferences->GetPrompt()); + InitAnsiMode(); } -void AmigaProgram::Run() +void AmigaProgram::Start() { + if(Console == nullptr || !Console->Open()) + { + return; + } + Preferences->Load(); - if (Console != NULL) { - Console->Run(); - } else if (args.input != NULL) { + if (shellMode) + { + Console->Start(); + return; + } + + if (args.input != nullptr) + { Evaluator *evaluator = new Evaluator(args.input); evaluator->Evaluate(); const char *res = evaluator->GetResult(); - WriteToShell(res); + Console->WriteString(res); delete evaluator; } } -void AmigaProgram::Exit() -{ - Console->Exit(); -} - #endif diff --git a/src/system/program_amiga.h b/src/system/program_amiga.h index f301c353..26f2e09d 100644 --- a/src/system/program_amiga.h +++ b/src/system/program_amiga.h @@ -29,11 +29,14 @@ #include "program.h" +#if defined(AMIGA) + struct RDArgs; struct amathargs { long shell; + long noansi; char* input; }; @@ -43,10 +46,11 @@ public: AmigaProgram(); virtual ~AmigaProgram(); virtual void Initialize(int argc, char** argv); - virtual void Run(); - virtual void Exit(); + virtual void Start(); private: RDArgs* rdargs; amathargs args; }; + +#endif diff --git a/src/system/program_haiku.cpp b/src/system/program_haiku.cpp new file mode 100644 index 00000000..88f6aeaa --- /dev/null +++ b/src/system/program_haiku.cpp @@ -0,0 +1,152 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "amath.h" +#include "amathc.h" +#include "console.h" +#include "filesystem.h" +#include "program_haiku.h" +#include "window_haiku.h" +#include "console_posix.h" +#include "lib/charbuf.h" +#include "main/evaluator.h" + +#if defined(HAIKU) + +#if __GNUC__ == 2 +#pragma GCC diagnostic ignored "-Wno-multichar" +#endif + +#include +#include + +HaikuProgram::HaikuProgram() + : Program(), BApplication("application/x-vnd.amath") +{ + Console = nullptr; + line = nullptr; + app = false; +} + +HaikuProgram::~HaikuProgram() +{ + if (Console != nullptr) + { + Console->Close(); + delete Console; + } + + if (line != nullptr) + { + delete line; + } +} + +void HaikuProgram::Initialize(int argc, char **argv) +{ + if (argc < 2) + { + Console = new HaikuWindow(Preferences->GetPrompt(), Language); + SetAnsiMode(false); + app = true; + return; + } + + Console = new PosixConsole(Preferences->GetPrompt(), Language); + SetAnsiMode(true); + + line = new CharBuffer(); + line->Empty(); + + bool options = true; + unsigned int len = 1; + for (int i = 1; i < argc; i++) + { + if (options) + { + if (StrIsEqual(argv[i], "noansi") || StrIsEqual(argv[i], "--noansi")) + { + SetAnsiMode(false); + continue; + } + else if (StrIsEqual(argv[i], "shell") || StrIsEqual(argv[i], "--shell")) + { + shellMode = true; + } + else + { + options = false; + } + } + + if (!options) + { + len += StrLen(argv[i]) + 1; + line->EnsureSize(len); + line->Append(argv[i]); + line->Append(' '); + } + } + + if (len > 1) + { + line->DeleteLastChar(); + } +} + +void HaikuProgram::Start() +{ + if(Console == nullptr || !Console->Open()) + { + return; + } + + Preferences->Load(); + + if (shellMode) + { + Console->Start(); + return; + } + + if (app) + { + Console->Start(); + Run(); + return; + } + + Evaluator *evaluator = new Evaluator(line->GetString()); + evaluator->Evaluate(); + const char *res = evaluator->GetResult(); + Console->WriteString(res); + delete evaluator; +} + +#endif diff --git a/src/system/task.h b/src/system/program_haiku.h similarity index 79% rename from src/system/task.h rename to src/system/program_haiku.h index f3fcace6..7037626d 100644 --- a/src/system/task.h +++ b/src/system/program_haiku.h @@ -27,34 +27,27 @@ * */ -#ifndef AMATH_TASK -#define AMATH_TASK +#include "program.h" -/** - * @file task.h - * @brief Generic task/process logic. - * - */ +#if defined(HAIKU) -#include "thread.h" +#if __GNUC__ == 2 +#pragma GCC diagnostic ignored "-Wno-multichar" +#endif -/** - * @brief Abstract base class encapsulating a system thread. - * - */ -class TaskBase +#include + +class HaikuProgram : public Program, public BApplication { public: - TaskBase() - { - } + HaikuProgram(); + virtual ~HaikuProgram(); + virtual void Initialize(int argc, char **argv); + virtual void Start(); - virtual ~TaskBase() - { - } - - virtual void Start(ThreadBase* thread) = 0; - virtual void WaitExit() = 0; +private: + CharBuffer *line; + bool app; }; #endif diff --git a/src/system/program_stdc.cpp b/src/system/program_stdc.cpp index dcef6368..3d686fb4 100644 --- a/src/system/program_stdc.cpp +++ b/src/system/program_stdc.cpp @@ -30,25 +30,28 @@ #include "amath.h" #include "amathc.h" #include "program_stdc.h" +#include "console_posix.h" #include "console_stdc.h" +#include "console_windows.h" #include "preferences_stdc.h" #include "lib/charbuf.h" #include "main/evaluator.h" -#if !defined(AMIGA) -#include +#if !defined(AMIGA) && !defined(HAIKU) StandardProgram::StandardProgram() : Program() { Console = nullptr; line = nullptr; + shellMode = true; } StandardProgram::~StandardProgram() { if (Console != nullptr) { + Console->Close(); delete Console; } @@ -60,56 +63,74 @@ StandardProgram::~StandardProgram() void StandardProgram::Initialize(int argc, char** argv) { - if (argc < 2) - { - // STDC version only has a console +#if defined(WINDOWS) + Console = new WindowsConsole(Preferences->GetPrompt(), Language); +#elif defined(POSIX) + Console = new PosixConsole(Preferences->GetPrompt(), Language); +#else Console = new StandardConsole(Preferences->GetPrompt(), Language); - return; - } +#endif + SetAnsiMode(true); + line = new CharBuffer(); + line->Empty(); + + bool options = true; unsigned int len = 1; for (int i = 1; i < argc; i++) { - len += StrLen(argv[i]) + 1; + if (options) + { + if (StrIsEqual(argv[i], "noansi") || StrIsEqual(argv[i], "--noansi")) + { + SetAnsiMode(false); + continue; + } + else if (StrIsEqual(argv[i], "shell") || StrIsEqual(argv[i], "--shell")) + { + shellMode = true; + } + else + { + options = false; + } + } + + if (!options) + { + len += StrLen(argv[i]) + 1; + line->EnsureSize(len); + line->Append(argv[i]); + line->Append(' '); + } } - line = new CharBuffer(len); - line->Empty(); - - for (int i = 1; i < argc; i++) + if (len > 1) { - line->Append(argv[i]); - line->Append(' '); - } - - line->DeleteLastChar(); - - if (line->Is("shell")) - { - Console = new StandardConsole(Preferences->GetPrompt(), Language); + line->DeleteLastChar(); } } -void StandardProgram::Run() +void StandardProgram::Start() { + if(Console == nullptr || !Console->Open()) + { + return; + } + Preferences->Load(); - if (Console != nullptr) + if (shellMode) { - Console->Run(); + Console->Start(); return; } Evaluator* evaluator = new Evaluator(line->GetString()); evaluator->Evaluate(); const char* res = evaluator->GetResult(); - printf("%s%s", res, NORMALTEXT); + Console->WriteString(res); delete evaluator; } -void StandardProgram::Exit() -{ - Console->Exit(); -} - #endif diff --git a/src/system/program_stdc.h b/src/system/program_stdc.h index 79b33fb4..63e4821a 100644 --- a/src/system/program_stdc.h +++ b/src/system/program_stdc.h @@ -28,11 +28,10 @@ */ #include "amath.h" -#include "amathc.h" #include "program.h" #include "lib/charbuf.h" -#if !defined(AMIGA) +#if !defined(AMIGA) && !defined(HAIKU) class StandardProgram : public Program { @@ -40,8 +39,7 @@ public: StandardProgram(); virtual ~StandardProgram(); virtual void Initialize(int argc, char** argv); - virtual void Run(); - virtual void Exit(); + virtual void Start(); private: CharBuffer* line; diff --git a/src/system/program_test.cpp b/src/system/program_test.cpp index 106ddb98..9162b829 100644 --- a/src/system/program_test.cpp +++ b/src/system/program_test.cpp @@ -31,6 +31,7 @@ #include "amath.h" #include "amathc.h" #include "program_test.h" +#include "console_stdc.h" #include "lib/charbuf.h" #include "main/evaluator.h" #include @@ -42,19 +43,19 @@ TestProgram::TestProgram(bool silent) pass = 0; fail = 0; -// Ignore type of locale fraction point. + // Ignore type of locale fraction point. delete Input; - Input = new DecimalSystem(Preferences->GetDigits(), '.'); + Input = new DecimalSystem(10, '.'); delete Output; - Output = new DecimalSystem(Preferences->GetDigits(), '.'); + Output = new DecimalSystem(10, '.'); } TestProgram::~TestProgram() { } -void TestProgram::Run() +void TestProgram::Start() { printf("Testing " TXTVERSMSG NEWLINE); printf(TXTCOMPMSG NEWLINE); @@ -446,7 +447,6 @@ void TestProgram::RunTestset06() TestExecution("eval pi/2"); TestExecution("list"); TestExecution("memory"); - TestExecution("version"); TestExecution("variables"); } diff --git a/src/system/program_test.h b/src/system/program_test.h index fb5f8f55..5c42e91f 100644 --- a/src/system/program_test.h +++ b/src/system/program_test.h @@ -47,7 +47,7 @@ public: explicit TestProgram(bool silent); virtual ~TestProgram(); virtual void Initialize(int argc, char** argv); - virtual void Run(); + virtual void Start(); virtual void Exit(); private: diff --git a/src/system/system.vcxproj b/src/system/system.vcxproj deleted file mode 100644 index 435d2f4b..00000000 --- a/src/system/system.vcxproj +++ /dev/null @@ -1,158 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {E3FD8E6B-8056-4579-8DE5-A2F0458D896A} - Win32Proj - - - - StaticLibrary - true - v141 - - - StaticLibrary - false - v141 - - - Application - true - v141 - - - Application - false - v141 - - - - - - - - - - - - - - - - - - - - - true - - - true - - - - WITHTEST;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)..;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - Level3 - ProgramDatabase - Disabled - - - MachineX86 - true - Windows - - - - - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - $(ProjectDir)..;%(AdditionalIncludeDirectories) - MultiThreadedDLL - Level3 - ProgramDatabase - - - MachineX86 - true - Windows - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/system/system.vcxproj.filters b/src/system/system.vcxproj.filters deleted file mode 100644 index 149465bb..00000000 --- a/src/system/system.vcxproj.filters +++ /dev/null @@ -1,168 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/src/system/task_amiga.cpp b/src/system/task_amiga.cpp deleted file mode 100644 index dcf7f6dd..00000000 --- a/src/system/task_amiga.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Project homepage: - * http://amath.innolan.net - * - */ - -#include "amath.h" -#include "amathc.h" -#include "thread.h" -#include "task_amiga.h" - -#ifdef AMIGA -#include -#include -#include -#include -#include -#include -#include -#include -#include - -AmigaTask::AmigaTask() -{ - task = nullptr; - maintask = FindTask(NULL); - signal = AllocSignal(-1); -} - -AmigaTask::~AmigaTask() -{ - if (task != nullptr) { - Forbid(); - DeleteTask(task); - Permit(); - } - - Forbid(); - FreeSignal(signal); - Permit(); -} - -ThreadStart threadstart; - -void AmigaTask::Start(ThreadBase *thread) -{ - threadstart.thread = thread; - threadstart.maintask = maintask; - threadstart.signal = signal; - task = CreateTask( - (STRPTR)thread->GetName(), 0, - (APTR)&AmigaTask::Invoke, - thread->GetStackSize()); -} - -void AmigaTask::Invoke() -{ - ThreadStart invoked = threadstart; - invoked.thread->Run(); - Signal(invoked.maintask, 1U << invoked.signal); -} - -void AmigaTask::WaitExit() -{ - Wait(1U << signal | SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D); -} - -#endif diff --git a/src/system/task_stdc.cpp b/src/system/task_stdc.cpp deleted file mode 100644 index 0845fe3b..00000000 --- a/src/system/task_stdc.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Project homepage: - * http://amath.innolan.net - * - */ - -#include "amath.h" -#include "amathc.h" -#include "thread.h" -#include "task_stdc.h" - -#if defined(UNIX) || defined(HAIKU) -#include -#include -#include -#include - -StandardTask::StandardTask() -{ } - -StandardTask::~StandardTask() -{ } - -void StandardTask::Start(ThreadBase* thread) -{ - pid_t childpid = fork(); - -// fork() returns 0 to the child process - if (childpid == 0) - { - thread->Run(); - exit(0); - } -} - -void StandardTask::WaitExit() -{ - wait(NULL); -} - -#endif diff --git a/src/system/thread.h b/src/system/thread.h deleted file mode 100644 index 0f8d3b17..00000000 --- a/src/system/thread.h +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 2014-2017 Carsten Sonne Larsen - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Project homepage: - * http://amath.innolan.net - * - */ - -/** - * @file thread.h - * @brief Generic thread logic. - * - */ - -#ifndef AMATH_THREAD_BASE_H -#define AMATH_THREAD_BASE_H - -/** - * @brief Abstract base class encapsulating runable component. - * - */ -class ThreadBase -{ -public: - ThreadBase() - { - } - - virtual ~ThreadBase() - { - } - - virtual void Run() = 0; - virtual const char* GetName() = 0; - virtual int GetStackSize() = 0; -}; - -#endif diff --git a/src/system/window_amiga.cpp b/src/system/window_amiga.cpp index fcd01bcb..fca95bad 100644 --- a/src/system/window_amiga.cpp +++ b/src/system/window_amiga.cpp @@ -33,7 +33,8 @@ #include "lib/aengine.h" #include "main/evaluator.h" -#ifdef AMIGA +#if defined(AMIGA) + #include #include #include @@ -50,12 +51,12 @@ AmigaWindow::AmigaWindow(const char *prompt, CharValidator *validator) : ConsoleBase(prompt) { proc = new AnsiConoleEngine(prompt, validator); - window = NULL; -//menu = NULL; - writereq.st = NULL; - writeport = NULL; - readreq.st = NULL; - readport = NULL; + window = nullptr; + //menu = nullptr; + writereq.st = nullptr; + writeport = nullptr; + readreq.st = nullptr; + readport = nullptr; succeed = false; openconsole = false; } @@ -66,11 +67,6 @@ AmigaWindow::~AmigaWindow() delete proc; } -int AmigaWindow::GetStackSize() -{ - return 100000; -} - void AmigaWindow::Create() { NewWindow nw = { @@ -85,9 +81,9 @@ void AmigaWindow::Create() WFLG_CLOSEGADGET | WFLG_ACTIVATE | WFLG_SIMPLE_REFRESH, - NULL, NULL, // user gadgets, user checkmark + nullptr, nullptr, // user gadgets, user checkmark (UBYTE*) TXTTITLE, // title - NULL, NULL, // window screen, super bitmap + nullptr, nullptr, // window screen, super bitmap 400, 75, // min width, height 1600, 1050, // max width, height WBENCHSCREEN // open on workbench screen @@ -112,12 +108,12 @@ void AmigaWindow::Create() readreq.st->io_Device = writereq.st->io_Device; readreq.st->io_Unit = writereq.st->io_Unit; -// Queue input + // Queue input ReadChar(readreq); -// Do GUI stuff -//menu = new AmigaMenu(window); -//menu->Attach(); + // Do GUI stuff + //menu = new AmigaMenu(window); + //menu->Attach(); } void AmigaWindow::Cleanup() @@ -134,36 +130,36 @@ void AmigaWindow::Cleanup() if(readreq.st) { DeleteExtIO(readreq.st); - readreq.st = NULL; + readreq.st = nullptr; } if(readport) { DeletePort(readport); - readport = NULL; + readport = nullptr; } if(writereq.st) { DeleteExtIO(writereq.st); - writereq.st = NULL; + writereq.st = nullptr; } if(writeport) { DeletePort(writeport); - writeport = NULL; + writeport = nullptr; } -//if (menu) { -// delete menu; -// menu = NULL; -//} + //if (menu) { + // delete menu; + // menu = nullptr; + //} if(window) { CloseWindow(window); - window = NULL; + window = nullptr; } } -void AmigaWindow::Run() +void AmigaWindow::Start() { Create(); StartMessage(); @@ -216,9 +212,9 @@ void AmigaWindow::ReadLine() case IDCMP_CLOSEWINDOW: exit = true; break; -//case IDCMP_MENUPICK: -// menu->Process(); -// break; + //case IDCMP_MENUPICK: + // menu->Process(); + // break; default: break; } diff --git a/src/system/window_amiga.h b/src/system/window_amiga.h index 5442c165..de9777cc 100644 --- a/src/system/window_amiga.h +++ b/src/system/window_amiga.h @@ -42,7 +42,8 @@ #include "console.h" #include "lib/aengine.h" -#ifdef AMIGA +#if defined(AMIGA) + #include #include #include @@ -83,9 +84,7 @@ class AmigaWindow : public ConsoleBase { public: AmigaWindow(const char *prompt, CharValidator *validator); ~AmigaWindow(); - - int GetStackSize(); - void Run(); + void Start(); void Exit(); void SetPrompt(const char *string); void WriteString(const char *string); @@ -112,7 +111,6 @@ private: unsigned long windowsig; AnsiConoleEngine *proc; const char *line; - //AmigaMenu *menu; }; diff --git a/src/system/window_haiku.cpp b/src/system/window_haiku.cpp new file mode 100644 index 00000000..c0fa1db7 --- /dev/null +++ b/src/system/window_haiku.cpp @@ -0,0 +1,322 @@ +/*- + * Copyright (c) 2014-2017 Carsten Sonne Larsen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Project homepage: + * http://amath.innolan.net + * + */ + +#include "amath.h" +#include "amathc.h" +#include "window_haiku.h" +#include "lib/charbuf.h" +#include "lib/aengine.h" +#include "main/evaluator.h" +#include "localize/text.h" + +//http://git.netsurf-browser.org/netsurf.git/plain/frontends/beos/about.cpp +//https://notabug.org/Tsyesika/Runyu/src/master/RunyuWindow.cpp + +#if defined(HAIKU) + +#if __GNUC__ == 2 +#pragma GCC diagnostic ignored "-Wno-multichar" +#endif + +#include +#include +#include +#include +#include +#include + +HaikuWindow::HaikuWindow(const char *prompt, CharValidator *validator) : + ConsoleBase(prompt), + BWindow( + BRect(150, 150, 800, 600), + TXTTITLE, + B_TITLED_WINDOW, + B_ASYNCHRONOUS_CONTROLS + ) +{ + BRect textRect = Bounds(); + textRect.OffsetTo(0, 0); + textRect.InsetBy(5, 5); + + BFont font(be_fixed_font); + textView = new HaikuTextView( + this, + Bounds(), + "TextView", + textRect, + &font, 0); + textView->SetStylable(true); + DetachMemSafe(textView); + + BScrollView *scrollView = new BScrollView( + TXTTITLE "ScrollView", + textView, + B_FOLLOW_ALL, + 0, + false, + true); + DetachMemSafe(scrollView); + AddChild(scrollView); + + /* + BMenuBar* menuBar = new BMenuBar("MenuBar"); + BLayoutBuilder::Menu<>(menuBar) + .AddMenu("File") + .AddItem("About", B_ABOUT_REQUESTED) + .AddItem("Quit", B_QUIT_REQUESTED, 'Q') + .End(); + DetachMemSafe(menuBar); + + BLayoutBuilder::Group<>(this, B_VERTICAL, 0) + .SetInsets(0) + .Add(menuBar) + .Add(scrollView) + .End(); + */ +} + +HaikuWindow::~HaikuWindow(void) +{ +} + +void HaikuWindow::Exit(void) +{ + be_app->PostMessage(B_QUIT_REQUESTED); +} + +void HaikuWindow::Start(void) +{ + textView->MakeFocus(true); + StartMessage(); + Prompt(); + Show(); +} + +void HaikuWindow::StartMessage(void) +{ + text_run run; + run.font = be_bold_font; + run.offset = 0; + run.color.red = 0; + run.color.green = 0; + run.color.blue = 0; + run.color.alpha = 255; + + text_run_array runArray; + runArray.count = 1; + runArray.runs[0] = run; + + textView->Insert(INTROMSG, &runArray); +} + +void HaikuWindow::ShowAbout(void) +{ + BAboutWindow* about = new BAboutWindow("About amath", "application/x-vnd.amath"); + DetachMemSafe(about); + + CharBuffer *buf = new CharBuffer(); + static const char* version = TXTTITLE SPACE RELDATESTAMP; + static const char* compiler = TXTCOMPSHTMSG; + static const char* footer = "Details specified in license."; + int len = StrLen(version) + StrLen(compiler) + StrLen(footer) + 10; + + buf->EnsureSize(len); + buf->Append(version); + buf->Append(NEWLINE); + buf->Append(compiler); + buf->Append(NEWLINE); + buf->Append(NEWLINE); + buf->Append(footer); + + about->AddCopyright(2014, "Carsten Sonne Larsen"); + about->AddExtraInfo(buf->GetString()); + about->Show(); + + delete buf; +} + +void HaikuWindow::ShowLicense(void) +{ + // TODO + ConsoleBase::ShowLicense(); +} + +void HaikuWindow::ShowVersion(void) +{ + text_run run; + run.font = be_bold_font; + run.offset = 0; + run.color.red = 34; + run.color.green = 139; + run.color.blue = 34; + run.color.alpha = 255; + + text_run_array runArray; + runArray.count = 1; + runArray.runs[0] = run; + + textView->Insert(GetVersionText(), &runArray); + textView->Insert(NEWLINE); + + runArray.runs[0].font = be_plain_font; + runArray.runs[0].font.SetFace(B_REGULAR_FACE); + runArray.runs[0].color.red = 0; + runArray.runs[0].color.green = 0; + runArray.runs[0].color.blue = 0; + + textView->Insert(GetCompilerText(), &runArray); + textView->Insert(NEWLINE); +} + +void HaikuWindow::Clear(void) +{ + textView->SetText(EMPTYSTRING); +} + +void HaikuWindow::WriteString(const char *string) +{ + text_run run; + run.font = be_fixed_font; + run.offset = 0; + run.color.red = 0; + run.color.green = 0; + run.color.blue = 0; + run.color.alpha = 255; + + text_run_array runArray; + runArray.count = 1; + runArray.runs[0] = run; + + textView->Insert(string, &runArray); +} + +void HaikuWindow::Execute(void) +{ + int lineIndex = textView->CurrentLine(); + int lineStart = textView->OffsetAt(lineIndex); + int lineCount = textView->CountLines(); + + if (lineCount != lineIndex + 1) + { + return; + } + + int len = textView->TextLength() - lineStart; + char *line = new char[len + 1]; + textView->GetText(lineStart, lineStart + len, line); + *(line + len) = '\0'; + + char *input = line; + char *p = prompt; + while (*input == *p && *input != '\0') + { + input++; + p++; + } + + WriteString(NEWLINE); + Evaluator *evaluator = new Evaluator(input); + evaluator->Evaluate(); + const char *out = evaluator->GetResult(); + WriteString(out); + + delete evaluator; + delete line; + + Prompt(); + textView->ScrollToOffset(textView->TextLength() - 1); +} + +void HaikuWindow::MessageReceived(BMessage* msg) +{ + switch (msg->what) + { + case B_ABOUT_REQUESTED: + ShowAbout(); + break; + default: + BWindow::MessageReceived(msg); + break; + } +} + +void HaikuWindow::FrameResized(float w, float h) +{ + UpdateTextRect(); +} + +void HaikuWindow::UpdateTextRect(void) +{ + BRect rect(textView->Bounds()); + rect.InsetBy(5, 5); + textView->SetTextRect(rect); +} + +bool HaikuWindow::QuitRequested() +{ + Exit(); + return true; +} + +HaikuTextView::HaikuTextView( + HaikuWindow *window, + BRect frame, + const char *name, + BRect textRect, + const BFont *initialFont, + const rgb_color *initialColor) : + BTextView( + frame, + name, + textRect, + initialFont, + initialColor, + B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED + ), window(window) +{ +} + +HaikuTextView::~HaikuTextView(void) +{ +} + +void HaikuTextView::KeyDown(const char *bytes, int32 numBytes) +{ + switch (*bytes) + { + case B_ENTER: + window->Execute(); + break; + default: + BTextView::KeyDown(bytes, numBytes); + break; + } +} + +#endif diff --git a/src/system/task_stdc.h b/src/system/window_haiku.h similarity index 50% rename from src/system/task_stdc.h rename to src/system/window_haiku.h index a025222e..89bfccab 100644 --- a/src/system/task_stdc.h +++ b/src/system/window_haiku.h @@ -27,36 +27,71 @@ * */ -#ifndef AMATH_STANDARD_TASK -#define AMATH_STANDARD_TASK - -/** - * @file task_stdc.h - * @brief CLib compliant thread handling. - * - */ +#ifndef AMATH_HAIKU_CONSOLE_WINDOW_H +#define AMATH_HAIKU_CONSOLE_WINDOW_H #include "amath.h" #include "amathc.h" +#include "console.h" +#include "lib/aengine.h" -#ifndef AMIGA -#include "task.h" -#include "thread.h" +#if defined(HAIKU) -/** -* @brief Encapsulates calls to POSIX task. -* -* Based on fork and wait. -* -*/ -class StandardTask : public TaskBase +#if __GNUC__ == 2 +#pragma GCC diagnostic ignored "-Wno-multichar" +#endif + +#include +#include +#include +#include +#include +#include + +class HaikuTextView; + +class HaikuWindow : public ConsoleBase, public BWindow { public: - StandardTask(); - ~StandardTask(); - void Start(ThreadBase* thread); - void WaitExit(); + HaikuWindow(const char *prompt, CharValidator *validator); + virtual ~HaikuWindow(void); + virtual void MessageReceived(BMessage* msg); + virtual void FrameResized(float w, float h); + virtual void UpdateTextRect(void); + virtual bool QuitRequested(void); + virtual void Start(void); + virtual void Exit(void); + virtual void Clear(void); + virtual void ShowAbout(void); + virtual void ShowLicense(void); + virtual void ShowVersion(void); + virtual void WriteString(const char *string); + void Execute(void); + +protected: + virtual void StartMessage(void); + +private: + HaikuTextView *textView; +}; + +class HaikuTextView : public BTextView +{ +public: + HaikuTextView( + HaikuWindow *window, + BRect frame, + const char *name, + BRect textRect, + const BFont *initialFont, + const rgb_color *initialColor); + virtual ~HaikuTextView(void); + virtual void KeyDown(const char *bytes, int32 numBytes); + +private: + HaikuWindow *window; }; #endif #endif +