10 Commits
Author SHA1 Message Date
Carsten Larsen f067ba8f80 Update release date 2017-04-22 00:56:52 +02:00
Carsten Larsen 683a382359 Hint GCC6 2017-04-22 00:55:06 +02:00
Carsten Larsen 13141f8fd6 Update changelog 2017-04-22 00:54:47 +02:00
Carsten Larsen 484133b293 Update release date 2017-04-22 00:54:26 +02:00
Carsten Larsen 2f5a7f1a8e Improved configuration 2017-04-22 00:53:41 +02:00
Carsten Larsen d723292cc7 Fix haiku bug 2017-04-22 00:52:57 +02:00
Carsten Larsen f480dc1a19 Fix clear statement 2017-04-15 22:33:46 +02:00
Carsten Larsen 78f598d49b Option for Position Independent Code 2017-04-15 22:32:42 +02:00
Carsten Larsen 6cf752a257 Bumped version 2017-04-15 20:43:33 +02:00
Carsten Larsen 3374eebd4d Cleanup defines 2017-04-15 20:36:40 +02:00
52 changed files with 139 additions and 337 deletions
+4
View File
@@ -1,5 +1,9 @@
amath release history
v1.8.1 April 22 2017
- OpenBSD support.
- Fixed Haiku bug.
v1.8.0 April 13 2017
- Fixed bugs in numeral systems.
- Fixed bugs related to infinity (Inf).
+1 -1
View File
@@ -20,7 +20,7 @@
.\" 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.
.TH amath 1 "Version 1.8.0" "April 13 2017"
.TH amath 1 "Version 1.8.1" "April 22 2017"
.SH NAME
amath \- Simple command line calculator
.SH SYNOPSIS
+1 -1
View File
@@ -1,7 +1,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "amath"
PROJECT_NUMBER = "1.8.0"
PROJECT_NUMBER = "1.8.1"
PROJECT_BRIEF = "Simple command line calculator"
PROJECT_LOGO =
OUTPUT_DIRECTORY = ../amath-doc
+1 -1
View File
@@ -2,7 +2,7 @@
set -e
version="1.8.0"
version="1.8.1"
build_package () {
+10 -6
View File
@@ -7,29 +7,29 @@ rm -Rf amath
rm -Rf dist
mkdir dist
./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul"
./configure --disable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul"
make clean
make static
mv amath dist/amath.000
make clean
./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul"
./configure --disable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul"
make static
mv amath dist/amath.020
make clean
./configure --disable-test --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul"
./configure --disable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul"
make static
mv amath dist/amath.030
make clean
./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul"
./configure --enable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68000 -noixemul"
make static
mv amath dist/amath-test.000
make clean
./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul"
./configure --enable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68020 -noixemul"
make static
mv amath dist/amath-test.020
make clean
./configure --enable-test --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul"
./configure --enable-test --disable-pic --cross-compile="m68k-amigaos" CFLAGS="-m68030 -noixemul"
make static
mv amath dist/amath-test.030
make clean
@@ -61,3 +61,7 @@ date -Ru >dist/build_date
mv dist amath
#lha-ac a amath.lha amath
# GCC 6.x
#./configure --enable-test --cross-compile="/opt/m68k-amigaos6/bin/m68k-amigaos" CFLAGS="-m68000 -noixemul" LDFLAGS="-Xlinker --allow-multiple-definition"
#make static
+2 -2
View File
@@ -2,8 +2,8 @@
# DO NOT USE THIS SCRIPT UNLESS YOU KNOW WHAT YOU ARE DOING !
version='1.8.0'
stamp="201704130000"
version='1.8.1'
stamp="201704220000"
#stamp="201704110000"
srcdir="amath-rc"
distdir="amath-${version}"
+1 -1
View File
@@ -2,7 +2,7 @@
set -e
version="1.8.0"
version="1.8.1"
echo "Building amath ${version} for Windows ..."
Vendored
+33 -12
View File
@@ -27,7 +27,7 @@
set -e
version="1.8.0"
version="1.8.1"
clang=false
debugsym=false
@@ -36,6 +36,7 @@ openlibm=false
stdlibm=false
stdlibc=false
useldconfig=false
fpic=false
prefix="/usr"
pkgconfigdir="lib/pkgconfig"
@@ -45,6 +46,7 @@ cxxflags=""
ldflags=""
gcclib="-lstdc++"
libm=""
libc=""
for arg in "$@"; do
unknown=true
@@ -107,6 +109,17 @@ for arg in "$@"; do
useldconfig=false
unknown=false
;;
--enable-pic)
fpic=true
unknown=false
;;
--disable-pic)
fpic=false
unknown=false
;;
--enable-debug)
debugsym=true
unknown=false
@@ -184,6 +197,8 @@ for arg in "$@"; do
echo ' --disable-clang: do not build with clang compiler'
echo ' --enable-ldconfig: use ldconfig to registre libraries'
echo ' --disable-ldconfig: do not use ldconfig to registre libraries'
echo ' --enable-pic: build with Position Independent Code (-fPIC)'
echo ' --disable-pic: do not build static libraries with Position Independent Code'
echo ' --with-libm: link with libm library (-lm)'
echo ' --without-libm: do not link with libm library'
echo ' --with-openlibm: link with openlibm library (-lopenlibm)'
@@ -255,6 +270,13 @@ fi
if $stdlibc; then
gcclib="${gcclib} -lc"
libc="-lc"
fi
if $fpic; then
fPIC=" -fPIC"
else
fPIC=""
fi
cflags="${cflags}${debugflag}${mflags}"
@@ -278,13 +300,12 @@ SYSSRCS='
console.cpp
console_amiga.cpp
console_stdc.cpp
console_posix.cpp
console_termios.cpp
console_windows.cpp
filesystem_amiga.cpp
filesystem_stdc.cpp
language.cpp
language_amiga.cpp
language_posix.cpp
language_stdc.cpp
preferences.cpp
preferences_amiga.cpp
@@ -567,7 +588,7 @@ ldlibflags="-l${amathapp} ${libm}-l${amathcplex} ${libm}-l${amath} -l${amathc} $
############################ Main Application ###########################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-I. -I.. -Wall"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f"
@@ -599,7 +620,7 @@ echo
########################### Functions Library ###########################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-I. -I../.. -Wall"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I../.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f"
@@ -631,7 +652,7 @@ echo
########################### Statement Library ###########################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-I. -I../.. -Wall"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I../.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f"
@@ -663,7 +684,7 @@ echo
############################ System Library #############################
{
echo "CXX = ${crosscompile}${cxxcompiler}"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}-I. -I.. -Wall"
echo "CXXFLAGS = ${appop}${options} ${cxxflags}${fPIC} -I. -I.. -Wall"
echo "AR = ${crosscompile}ar"
echo "RANLIB = ${crosscompile}ranlib"
echo "DEL = rm -f"
@@ -725,7 +746,7 @@ for f in ${LIBAPPSRCS}
do
b=`basename $f .cpp`
echo "static/${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -c ${f} -o static/${b}.o"
echo " \${CXX} \${CXXFLAGS}${fPIC} -c ${f} -o static/${b}.o"
echo
echo "shared/${b}.o: ${f}"
echo " \${CXX} \${CXXFLAGS} -fPIC -c ${f} -o shared/${b}.o"
@@ -836,7 +857,7 @@ for f in ${LIBC1SRCS}
do
b=`basename $f .c`
echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fno-builtin -c ${f} -o static/${b}.o"
echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo
echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"
@@ -851,7 +872,7 @@ echo " \${MKDIR} static"
echo " \${MKDIR} shared"
echo
echo "\${solib}: build ${libcs}"
echo " \${CC} \${CFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}${soverion} -o \${solib} ${libcs} -lc"
echo " \${CC} \${CFLAGS} -shared ${exestrip} -fPIC -Wl,-soname,\${solib}${soverion} -o \${solib} ${libcs} ${libc}"
echo
echo "\${alib}: build ${libc}"
echo " \${AR} rcs static/\${alib} ${libc}"
@@ -935,7 +956,7 @@ for f in ${LIBREALSRCS}
do
b=`basename $f .c`
echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fno-builtin -c ${f} -o static/${b}.o"
echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo
echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"
@@ -1032,7 +1053,7 @@ for f in ${LIBCPLEXSRCS}
do
b=`basename $f .c`
echo "static/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fno-builtin -c ${f} -o static/${b}.o"
echo " \${CC} \${CFLAGS}${fPIC} -fno-builtin -c ${f} -o static/${b}.o"
echo
echo "shared/${b}.o: ${f}"
echo " \${CC} \${CFLAGS} -fPIC -fno-builtin -c ${f} -o shared/${b}.o"
+11 -21
View File
@@ -84,28 +84,23 @@
# endif
#endif
/******************************************************************************/
#if defined(HAIKU) || defined(UNIX) || defined(APPLE) || defined(_POSIX_VERSION)
# ifndef POSIX
# define POSIX
#if defined(HAIKU) || defined(UNIX) || defined(APPLE)
# ifndef TERMIOS
# define TERMIOS
# endif
#endif
/******************************************************************************/
#if !defined(AMIGA) && !defined(POSIX) && !defined(WINDOWS)
# ifndef STDC_CONSOLE
# define STDC_CONSOLE
# endif
#endif
/******************************************************************************/
#if defined(POSIX)
# include <stdint.h>
# include <unistd.h>
# include <dirent.h>
#endif
/******************************************************************************/
#if defined(WINDOWS)
# include <stdint.h>
#endif
/******************************************************************************/
#if defined(AROS) || defined(MORPHOS) || defined(AOS4)
# include <stdint.h>
# include <sys/types.h>
#endif
/******************************************************************************/
#if defined(AOS3)
# include <sys/types.h>
# define IPTR LONG*
@@ -116,11 +111,6 @@ typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t;
#endif
/******************************************************************************/
#if defined(AROS) || defined(MORPHOS) || defined(AOS4) || defined(APPLE)
# include <stdint.h>
# include <sys/types.h>
#endif
/******************************************************************************/
#if (__cplusplus <= 199711L && !defined(WINDOWS)) || !defined(__cplusplus)
#ifndef nullptr
#define nullptr 0
@@ -291,9 +281,9 @@ typedef int bool;
#endif
/******************************************************************************/
#define TXTARCH TXTCPU TXTFPU
#define RELDATESTAMP "(13-04-2017)"
#define TXTDOSVERSION "\0$VER: amath 1.80" SPACE RELDATESTAMP SPACE TXTARCH
#define TXTTITLE "amath version 1.8.0"
#define RELDATESTAMP "(22-04-2017)"
#define TXTDOSVERSION "\0$VER: amath 1.81" SPACE RELDATESTAMP SPACE TXTARCH
#define TXTTITLE "amath version 1.8.1"
#define TXTCOPYRIGHT "(c) 2017 Carsten Sonne Larsen"
#define TXTSTARTMSG TXTTITLE SPACE TXTCOPYRIGHT
/******************************************************************************/
+2 -2
View File
@@ -29,7 +29,7 @@
#include "amathc.h"
#ifdef AMIGA
#if defined(AMIGA)
#include <clib/exec_protos.h>
#endif
@@ -58,7 +58,7 @@ unsigned int AllocAndCopy(char** destination, const char* source)
*destination = AllocMemSafe(size);
d = *destination;
#ifdef AMIGA // Take advantage of exec
#if defined(AMIGA) // Take advantage of exec
CopyMem(s, d, n);
#else
while (n--)
+1 -1
View File
@@ -20,7 +20,7 @@
.\" 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.
.TH "amathc.h" 3 "Version 1.8.0" "April 13 2017"
.TH "amathc.h" 3 "Version 1.8.1" "April 22 2017"
.SH NAME
amathc.h \- C functions for manipulating strings and memory
.SH SYNOPSIS
+1 -1
View File
@@ -1,7 +1,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "amathc"
PROJECT_NUMBER = "1.8.0"
PROJECT_NUMBER = "1.8.1"
PROJECT_BRIEF = "C functions for manipulating strings and memory"
PROJECT_LOGO =
OUTPUT_DIRECTORY =
+1 -1
View File
@@ -5,6 +5,6 @@ libdir=${exec_prefix}/lib
Name: amath C library
Description: C functions for manipulating strings and memory
Version: 1.8.0
Version: 1.8.1
Cflags: -I${includedir}
Libs: -L${libdir} -lamathc
+1 -1
View File
@@ -29,7 +29,7 @@
#include "amathc.h"
#ifdef AMIGA
#if defined(AMIGA)
#include <stddef.h>
#include <exec/types.h>
#include <exec/memory.h>
+2 -2
View File
@@ -47,7 +47,7 @@
#pragma GCC diagnostic ignored "-Wcast-align"
#endif
#ifdef AMIGA
#if defined(AMIGA)
#include <clib/exec_protos.h>
#endif
@@ -84,7 +84,7 @@ void MemCopy(void* destination, const void* source, unsigned int length)
if ((mem_ptr)dst < (mem_ptr)src)
{
// Copy forward
#ifdef AMIGA // Take advantage of exec
#if defined(AMIGA) // Take advantage of exec
CopyMem((void*)source, destination, length);
#else
t = (mem_ptr)src; // only need low bits
+1 -1
View File
@@ -20,7 +20,7 @@
.\" 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.
.TH "mathi.h" 3 "Version 1.8.0" "April 13 2017"
.TH "mathi.h" 3 "Version 1.8.1" "April 22 2017"
.SH NAME
mathi.h \- Complex numbers math library
.SH SYNOPSIS
+1 -1
View File
@@ -1,7 +1,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "amathi"
PROJECT_NUMBER = "1.8.0"
PROJECT_NUMBER = "1.8.1"
PROJECT_BRIEF = "Complex numbers math library"
PROJECT_LOGO =
OUTPUT_DIRECTORY =
+1 -1
View File
@@ -5,6 +5,6 @@ libdir=${exec_prefix}/lib
Name: amath complex library
Description: Complex numbers math library
Version: 1.8.0
Version: 1.8.1
Cflags: -I${includedir}
Libs: -L${libdir} -lamathi
+1 -1
View File
@@ -5,6 +5,6 @@ libdir=${exec_prefix}/lib
Name: amath application library
Description: C++ library for handling numbers
Version: 1.8.0
Version: 1.8.1
Cflags: -I${includedir}
Libs: -L${libdir} -lamathapp -lamathr -lamathi -lamathc
+1 -1
View File
@@ -39,7 +39,7 @@ const char* vers = TXTDOSVERSION;
class Program* Program = nullptr;
#ifdef AMIGA
#if defined(AMIGA)
#include <clib/exec_protos.h>
static struct DosBase *DosBase = nullptr;
static struct GfxBase *GfxBase = nullptr;
+4
View File
@@ -261,6 +261,10 @@
\page release_page Release history
\section release_sec Release history
\subsection version181 1.8.1 April 22 2017
- OpenBSD support
- Fixed Haiku bug
\subsection version180 1.8.0 April 13 2017
- Fixed bugs in numeral systems.
- Fixed bugs related to infinity (Inf).
+2 -2
View File
@@ -55,7 +55,7 @@ void Evaluator::Evaluate() const
SyntaxNode* node = parser->Parse();
delete parser;
#ifdef DEBUGTREE
#if defined(DEBUGTREE)
Viewer* viewer = new Viewer(node);
const char* vout = viewer->GetTree();
output->EnsureGrowth(StrLen(vout));
@@ -68,7 +68,7 @@ void Evaluator::Evaluate() const
node = optimizer->GetRoot();
delete optimizer;
#ifdef DEBUGTREE
#if defined(DEBUGTREE)
viewer = new Viewer(node);
vout = viewer->GetTree();
output->EnsureGrowth(StrLen(vout));
+1 -1
View File
@@ -209,7 +209,7 @@ SyntaxNode* Parser::ParseStatement()
case symexit:
res = new ExitStatement();
break;
#if !defined(STDC_CONSOLE)
#if defined(AMIGA) || defined(TERMIOS) || defined(WINDOWS)
case symclear:
res = new ClearStatement();
break;
+1 -1
View File
@@ -90,7 +90,7 @@ char* HelpStatement::StatementHelp() const
output->ClearBuffer();
APPENDHELP(STATEMENTLINE)
#if !defined(STDC_CONSOLE)
#if defined(AMIGA) || defined(TERMIOS) || defined(WINDOWS)
APPENDHELP(STATEMENTCLEAR)
#endif
APPENDHELP(STATEMENTDEF)
+1 -1
View File
@@ -32,7 +32,7 @@
#include "viewer.h"
#include "lib/charbuf.h"
#ifdef DEBUGTREE
#if defined(DEBUGTREE)
Viewer::Viewer(SyntaxNode* root)
{
+1 -2
View File
@@ -39,13 +39,12 @@
#include "nodes.h"
#include "lib/charbuf.h"
#ifdef DEBUGTREE
#if defined(DEBUGTREE)
/**
* @brief Control class displaying a syntax tree
* @details
* Define DEBUGTREE to enable the tree viewer.
*
*/
class Viewer
{
+1 -1
View File
@@ -20,7 +20,7 @@
.\" 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.
.TH "mathr.h" 3 "Version 1.8.0" "April 13 2017"
.TH "mathr.h" 3 "Version 1.8.1" "April 22 2017"
.SH NAME
mathr.h \- Real numbers math library
.SH SYNOPSIS
+1 -1
View File
@@ -1,7 +1,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "amathr"
PROJECT_NUMBER = "1.8.0"
PROJECT_NUMBER = "1.8.1"
PROJECT_BRIEF = "Real numbers math library"
PROJECT_LOGO =
OUTPUT_DIRECTORY =
+1 -1
View File
@@ -5,6 +5,6 @@ libdir=${exec_prefix}/lib
Name: amath real library
Description: Real numbers math library
Version: 1.8.0
Version: 1.8.1
Cflags: -I${includedir}
Libs: -L${libdir} -lamathr
+1 -1
View File
@@ -31,7 +31,7 @@
#include "console_stdc.h"
#include "main/evaluator.h"
#if defined(STDC_CONSOLE)
#if !defined(AMIGA) && !defined(TERMIOS) && !defined(WINDOWS)
#include <stdio.h>
StandardConsole::StandardConsole(const char* prompt) :
+1 -1
View File
@@ -39,7 +39,7 @@
#include "amath.h"
#include "console.h"
#if defined(STDC_CONSOLE)
#if !defined(AMIGA) && !defined(TERMIOS) && !defined(WINDOWS)
/**
* @brief Encapsulates the IO of a Standard C console.
@@ -30,27 +30,27 @@
#include "amath.h"
#include "amathc.h"
#include "console.h"
#include "console_posix.h"
#include "console_termios.h"
#include "lib/charval.h"
#include "lib/aengine.h"
#include "main/evaluator.h"
#if defined(POSIX)
#if defined(TERMIOS)
#include <stdio.h>
#include <termios.h>
PosixConsole::PosixConsole(const char* prompt, CharValidator* validator) :
TermiosConsole::TermiosConsole(const char* prompt, CharValidator* validator) :
ConsoleBase(prompt), line(nullptr), exit(false)
{
proc = new AnsiConoleEngine(prompt, validator);
}
PosixConsole::~PosixConsole()
TermiosConsole::~TermiosConsole()
{
delete proc;
}
bool PosixConsole::Open()
bool TermiosConsole::Open()
{
if (tcgetattr(STDIN_FILENO, &oldAttr) != 0)
{
@@ -66,7 +66,7 @@ bool PosixConsole::Open()
return (tcsetattr(STDIN_FILENO, TCSANOW, &newAttr) != -1);
}
void PosixConsole::Close()
void TermiosConsole::Close()
{
if (!termError)
{
@@ -74,7 +74,7 @@ void PosixConsole::Close()
}
}
void PosixConsole::Start()
void TermiosConsole::Start()
{
exit = false;
StartMessage();
@@ -91,12 +91,12 @@ void PosixConsole::Start()
}
}
void PosixConsole::Exit()
void TermiosConsole::Exit()
{
exit = true;
}
void PosixConsole::ReadLine()
void TermiosConsole::ReadLine()
{
char c;
proc->StartInput();
@@ -116,12 +116,12 @@ void PosixConsole::ReadLine()
line = proc->GetLine();
}
void PosixConsole::WriteString(const char* string)
void TermiosConsole::WriteString(const char* string)
{
Write(string, StrLen(string));
}
void PosixConsole::Write(const char* string, unsigned int length)
void TermiosConsole::Write(const char* string, unsigned int length)
{
ssize_t res = write(STDOUT_FILENO, string, length);
if (res != length)
@@ -130,7 +130,7 @@ void PosixConsole::Write(const char* string, unsigned int length)
}
}
void PosixConsole::SetPrompt(const char* string)
void TermiosConsole::SetPrompt(const char* string)
{
ConsoleBase::SetPrompt(string);
proc->SetPrompt(string);
@@ -27,11 +27,11 @@
*
*/
#ifndef AMATH_POSIX_CONSOLE
#define AMATH_POSIX_CONSOLE
#ifndef AMATH_TERMIOS_CONSOLE
#define AMATH_TERMIOS_CONSOLE
/**
* @file console_posix.h
* @file console_termios.h
* @brief Standard C and termios based console.
*
*/
@@ -42,18 +42,18 @@
#include "lib/charval.h"
#include "lib/aengine.h"
#if defined(POSIX)
#if defined(TERMIOS)
#include <termios.h>
/**
* @brief Encapsulates the IO of a console using Standard C and termios.
*
*/
class PosixConsole : public ConsoleBase
class TermiosConsole : public ConsoleBase
{
public:
PosixConsole(const char* prompt, CharValidator* validator);
virtual ~PosixConsole();
TermiosConsole(const char* prompt, CharValidator* validator);
virtual ~TermiosConsole();
virtual bool Open();
virtual void Close();
virtual void Start();
+1 -3
View File
@@ -34,14 +34,12 @@
#include "lib/charbuf.h"
#include "loc/text.h"
#ifdef AMIGA
#if defined(AMIGA)
#include <clib/dos_protos.h>
/**
* @brief
*
* http://en.wikibooks.org/wiki/Aros/Developer/Docs/Libraries/DOS#Examine_Files_or_Directories
*
*/
CharBuffer* AmigaFilesystem::ListDirectory(const char* path)
{
+2 -3
View File
@@ -32,15 +32,14 @@
/**
* @file filesystem_amiga.h
* @brief Amiga OS specific file system calls.
*
* @brief Amiga OS specific file system calls
*/
#include "amath.h"
#include "amathc.h"
#include "filesystem.h"
#ifdef AMIGA
#if defined(AMIGA)
class AmigaFilesystem : public FilesystemBase
{
+5 -1
View File
@@ -40,6 +40,10 @@
#include <stdio.h>
#include <stdlib.h>
#if defined(UNIX) || defined(HAIKU)
#include <dirent.h>
#endif
CharBuffer* StandardFilesystem::ListDirectory(const char* path)
{
#if defined(UNIX) || defined(HAIKU)
@@ -86,7 +90,7 @@ CharBuffer* StandardFilesystem::ListDirectory(const char* path)
const char *type;
#ifdef HAIKU
#if defined(HAIKU)
type = TXTLISTDIRTUNKNOWN;
#else
switch (entry->d_type) {
+1 -2
View File
@@ -32,7 +32,7 @@
/**
* @file filesystem_stdc.h
* @brief Standard C compliant file system calls.
* @brief Standard C compliant file system calls
*
*/
@@ -55,5 +55,4 @@ private:
};
#endif
#endif
+1 -1
View File
@@ -41,7 +41,7 @@
static const texttag ansiTags[] = {
{"#HEADLINE#", "\x1B[1m"},
#ifdef UNIX
#if defined(UNIX)
{"#SYNTAXHIGHLIGHT#", "\x1B[3m\x1B[32m"},
#else
{"#SYNTAXHIGHLIGHT#", "\x1B[32m"},
+1 -1
View File
@@ -36,7 +36,7 @@
#include "loc/ident.h"
#include "loc/kword.h"
#ifdef AMIGA
#if defined(AMIGA)
#include <clib/locale_protos.h>
AmigaLanguage::AmigaLanguage() :
+4
View File
@@ -30,11 +30,14 @@
#ifndef AMATH_LANGUAGE_AMIGA_H
#define AMATH_LANGUAGE_AMIGA_H
#include "amath.h"
#include "language.h"
#include "loc/help.h"
#include "loc/text.h"
#include "loc/kword.h"
#if defined(AMIGA)
class AmigaLanguage : public Language
{
public:
@@ -64,3 +67,4 @@ private:
};
#endif
#endif
-126
View File
@@ -1,126 +0,0 @@
/*-
* Copyright (c) 2014-2017 Carsten Sonne Larsen <cs@innolan.net>
* 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 "program.h"
#include "language_posix.h"
#include "loc/help.h"
#include "loc/text.h"
#include "loc/ident.h"
#include "loc/kword.h"
#if defined(UNIX)
#include <stdio.h>
#include <ctype.h> /* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html */
#include <locale.h> /* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html */
#include <nl_types.h> /* http://pubs.opengroup.org/onlinepubs/7908799/xsh/nl_types.h.html */
#include <string.h>
PosixLanguage::PosixLanguage() :
Language()
{
// locale = newlocale(LC_ALL, "da_DK.ISO8859-15", (locale_t)0);
// setlocale(LC_NUMERIC, "da_DK.ISO8859-15");
locale = newlocale(LC_ALL, "", (locale_t)0);
setlocale(LC_NUMERIC, "");
conv = localeconv();
}
PosixLanguage::~PosixLanguage()
{
freelocale(locale);
}
bool PosixLanguage::CharIsAlNum(long unsigned int character)
{
return (bool)isalnum_l((int)character, locale);
}
bool PosixLanguage::CharIsAlpha(long unsigned int character)
{
return (bool)isalpha_l((int)character, locale);
}
bool PosixLanguage::CharIsCntrl(long unsigned int character)
{
return (bool)iscntrl_l((int)character, locale);
}
bool PosixLanguage::CharIsDigit(long unsigned int character)
{
return (bool)isdigit_l((int)character, locale);
}
bool PosixLanguage::CharIsPunct(long unsigned int character)
{
return (bool)ispunct_l((int)character, locale);
}
bool PosixLanguage::CharIsSpace(long unsigned int character)
{
return (bool)isspace_l((int)character, locale);
}
char PosixLanguage::GetFractionPoint()
{
return *(conv->decimal_point);
}
bool PosixLanguage::StrIsEqualLoc(const char* s1, const char* s2)
{
size_t len = StrLen(s2) * 2;
char *tmp = new char[len];
strxfrm(tmp, s2, len);
bool res = StrIsEqual(s1, tmp);
delete [] tmp;
return res;
}
char* PosixLanguage::Translate(identhelpdef* def)
{
return (char*)def->text;
}
char* PosixLanguage::Translate(helptextdef* def)
{
return (char*)def->text;
}
char* PosixLanguage::Translate(textdef* def)
{
return (char*)def->text;
}
bool PosixLanguage::Validate(char c)
{
return (c >= 32 && c <= 126);
}
#endif
-70
View File
@@ -1,70 +0,0 @@
/*-
* Copyright (c) 2014-2017 Carsten Sonne Larsen <cs@innolan.net>
* 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 _LANGUAGE_POSIX_H
#define _LANGUAGE_POSIX_H
#include "amath.h"
#include "amathc.h"
#include "language.h"
#include "loc/help.h"
#include "loc/text.h"
#include "loc/kword.h"
#ifdef UNIX
#include <ctype.h>
#include <locale.h>
#include <nl_types.h>
class PosixLanguage : public Language {
public:
PosixLanguage();
~PosixLanguage();
char GetFractionPoint();
bool CharIsAlNum(unsigned long character);
bool CharIsAlpha(unsigned long character);
bool CharIsDigit(unsigned long character);
bool CharIsPunct(unsigned long character);
bool CharIsSpace(unsigned long character);
bool CharIsCntrl(unsigned long character);
bool StrIsEqualLoc(const char *s1, const char *s2);
bool Validate(char c);
protected:
char* Translate(textdef *def);
char* Translate(helptextdef *def);
char* Translate(identhelpdef *def);
private:
locale_t locale;
struct lconv *conv;
};
#endif
#endif
-1
View File
@@ -77,5 +77,4 @@ private:
};
#endif
#endif
+1 -1
View File
@@ -33,7 +33,7 @@
#include "preferences.h"
#include "preferences_amiga.h"
#ifdef AMIGA
#if defined(AMIGA)
#include <clib/dos_protos.h>
static const char *tempname = "ENV:amath.prefs";
+4
View File
@@ -30,8 +30,11 @@
#ifndef AMATH_PREFERENCES_AMIGA_H
#define AMATH_PREFERENCES_AMIGA_H
#include "amath.h"
#include "preferences.h"
#if defined(AMIGA)
class AmigaPreferences : public PreferencesBase
{
public:
@@ -44,3 +47,4 @@ private:
};
#endif
#endif
+1 -6
View File
@@ -33,7 +33,6 @@
#include "language.h"
#include "language_stdc.h"
#include "language_amiga.h"
#include "language_posix.h"
#include "filesystem.h"
#include "filesystem_stdc.h"
#include "filesystem_amiga.h"
@@ -52,11 +51,7 @@ Program::Program() :
Variables = new VariableList();
Functions = new FunctionList();
ins = new RealNumber();
#if defined(UNIX)
Language = new PosixLanguage();
Filesystem = new StandardFilesystem();
Preferences = new StandardPreferences();
#elif defined(AMIGA)
#if defined(AMIGA)
Language = new AmigaLanguage();
Filesystem = new AmigaFilesystem();
Preferences = new AmigaPreferences();
+1 -1
View File
@@ -44,7 +44,7 @@
#define ARGS_FORMAT "SHELL/S,NOANSI/S,INPUT/F"
#include <clib/dos_protos.h>
#ifdef AOS3
#if defined(AOS3)
# define RDPTR LONG*
#else
# define RDPTR IPTR*
+2 -2
View File
@@ -33,7 +33,7 @@
#include "filesystem.h"
#include "program_haiku.h"
#include "window_haiku.h"
#include "console_posix.h"
#include "console_termios.h"
#include "lib/charbuf.h"
#include "main/evaluator.h"
@@ -77,7 +77,7 @@ void HaikuProgram::Initialize(int argc, char **argv)
return;
}
Console = new PosixConsole(Preferences->GetPrompt(), Language);
Console = new TermiosConsole(Preferences->GetPrompt(), Language);
SetAnsiMode(true);
line = new CharBuffer();
+3 -3
View File
@@ -30,8 +30,8 @@
#include "amath.h"
#include "amathc.h"
#include "program_stdc.h"
#include "console_posix.h"
#include "console_stdc.h"
#include "console_termios.h"
#include "console_windows.h"
#include "preferences_stdc.h"
#include "lib/charbuf.h"
@@ -65,8 +65,8 @@ void StandardProgram::Initialize(int argc, char** argv)
{
#if defined(WINDOWS)
Console = new WindowsConsole(Preferences->GetPrompt(), Language);
#elif defined(POSIX)
Console = new PosixConsole(Preferences->GetPrompt(), Language);
#elif defined(TERMIOS)
Console = new TermiosConsole(Preferences->GetPrompt(), Language);
#else
Console = new StandardConsole(Preferences->GetPrompt(), Language);
#endif
-25
View File
@@ -275,28 +275,3 @@ void AmigaWindow::SetPrompt(const char* string)
}
#endif
//http://amigadev.elowar.com/read/ADCD_2.1/Libraries_Manual_guide/node046C.html#line6
//#include <devices/keymap.h>
//
//BOOL AskKeyMap(struct IOStdReq *request, struct KeyMap *keymap)
//{
// request->io_Command = CD_ASKKEYMAP;
// request->io_Length = sizeof(struct KeyMap);
// request->io_Data = (APTR)keymap; /* where to put it */
// DoIO(request);
// if(request->io_Error) return(FALSE);
// else return(TRUE); /* if no error, it worked. */
//}
//BOOL SetKeyMap(struct IOStdReq *request,struct KeyMap *keymap)
//{
// request->io_Command = CD_SETKEYMAP;
// request->io_Length = sizeof(struct KeyMap);
// request->io_Data = (APTR)keymap; /* where to get it */
// DoIO(request);
// if(request->io_Error) return(FALSE);
// else return(TRUE); /* if no error, it worked. */
//}
+1 -1
View File
@@ -142,7 +142,7 @@ void HaikuWindow::ShowAbout(void)
CharBuffer *buf = new CharBuffer();
static const char* version = TXTTITLE SPACE RELDATESTAMP;
static const char* compiler = TXTCOMPSHTMSG;
static const char* compiler = TXTCOMPMSG;
static const char* footer = "Details specified in license.";
int len = StrLen(version) + StrLen(compiler) + StrLen(footer) + 10;
-1
View File
@@ -94,4 +94,3 @@ private:
#endif
#endif