Cleanup defines

This commit is contained in:
Carsten Larsen 2017-04-15 20:36:40 +02:00
parent 44ea2ea898
commit 3374eebd4d
33 changed files with 69 additions and 301 deletions

3
configure vendored
View File

@ -278,13 +278,12 @@ SYSSRCS='
console.cpp console.cpp
console_amiga.cpp console_amiga.cpp
console_stdc.cpp console_stdc.cpp
console_posix.cpp console_termios.cpp
console_windows.cpp console_windows.cpp
filesystem_amiga.cpp filesystem_amiga.cpp
filesystem_stdc.cpp filesystem_stdc.cpp
language.cpp language.cpp
language_amiga.cpp language_amiga.cpp
language_posix.cpp
language_stdc.cpp language_stdc.cpp
preferences.cpp preferences.cpp
preferences_amiga.cpp preferences_amiga.cpp

View File

@ -84,28 +84,23 @@
# endif # endif
#endif #endif
/******************************************************************************/ /******************************************************************************/
#if defined(HAIKU) || defined(UNIX) || defined(APPLE) || defined(_POSIX_VERSION) #if defined(HAIKU) || defined(UNIX) || defined(APPLE)
# ifndef POSIX # ifndef TERMIOS
# define POSIX # define TERMIOS
# endif # endif
#endif
/******************************************************************************/
#if !defined(AMIGA) && !defined(POSIX) && !defined(WINDOWS)
# ifndef STDC_CONSOLE
# define STDC_CONSOLE
# endif
#endif
/******************************************************************************/
#if defined(POSIX)
# include <stdint.h> # include <stdint.h>
# include <unistd.h> # include <unistd.h>
# include <dirent.h>
#endif #endif
/******************************************************************************/ /******************************************************************************/
#if defined(WINDOWS) #if defined(WINDOWS)
# include <stdint.h> # include <stdint.h>
#endif #endif
/******************************************************************************/ /******************************************************************************/
#if defined(AROS) || defined(MORPHOS) || defined(AOS4)
# include <stdint.h>
# include <sys/types.h>
#endif
/******************************************************************************/
#if defined(AOS3) #if defined(AOS3)
# include <sys/types.h> # include <sys/types.h>
# define IPTR LONG* # define IPTR LONG*
@ -116,11 +111,6 @@ typedef u_int32_t uint32_t;
typedef u_int64_t uint64_t; typedef u_int64_t uint64_t;
#endif #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) #if (__cplusplus <= 199711L && !defined(WINDOWS)) || !defined(__cplusplus)
#ifndef nullptr #ifndef nullptr
#define nullptr 0 #define nullptr 0

View File

@ -29,7 +29,7 @@
#include "amathc.h" #include "amathc.h"
#ifdef AMIGA #if defined(AMIGA)
#include <clib/exec_protos.h> #include <clib/exec_protos.h>
#endif #endif
@ -58,7 +58,7 @@ unsigned int AllocAndCopy(char** destination, const char* source)
*destination = AllocMemSafe(size); *destination = AllocMemSafe(size);
d = *destination; d = *destination;
#ifdef AMIGA // Take advantage of exec #if defined(AMIGA) // Take advantage of exec
CopyMem(s, d, n); CopyMem(s, d, n);
#else #else
while (n--) while (n--)

View File

@ -29,7 +29,7 @@
#include "amathc.h" #include "amathc.h"
#ifdef AMIGA #if defined(AMIGA)
#include <stddef.h> #include <stddef.h>
#include <exec/types.h> #include <exec/types.h>
#include <exec/memory.h> #include <exec/memory.h>

View File

@ -47,7 +47,7 @@
#pragma GCC diagnostic ignored "-Wcast-align" #pragma GCC diagnostic ignored "-Wcast-align"
#endif #endif
#ifdef AMIGA #if defined(AMIGA)
#include <clib/exec_protos.h> #include <clib/exec_protos.h>
#endif #endif
@ -84,7 +84,7 @@ void MemCopy(void* destination, const void* source, unsigned int length)
if ((mem_ptr)dst < (mem_ptr)src) if ((mem_ptr)dst < (mem_ptr)src)
{ {
// Copy forward // Copy forward
#ifdef AMIGA // Take advantage of exec #if defined(AMIGA) // Take advantage of exec
CopyMem((void*)source, destination, length); CopyMem((void*)source, destination, length);
#else #else
t = (mem_ptr)src; // only need low bits t = (mem_ptr)src; // only need low bits

View File

@ -39,7 +39,7 @@ const char* vers = TXTDOSVERSION;
class Program* Program = nullptr; class Program* Program = nullptr;
#ifdef AMIGA #if defined(AMIGA)
#include <clib/exec_protos.h> #include <clib/exec_protos.h>
static struct DosBase *DosBase = nullptr; static struct DosBase *DosBase = nullptr;
static struct GfxBase *GfxBase = nullptr; static struct GfxBase *GfxBase = nullptr;

View File

@ -55,7 +55,7 @@ void Evaluator::Evaluate() const
SyntaxNode* node = parser->Parse(); SyntaxNode* node = parser->Parse();
delete parser; delete parser;
#ifdef DEBUGTREE #if defined(DEBUGTREE)
Viewer* viewer = new Viewer(node); Viewer* viewer = new Viewer(node);
const char* vout = viewer->GetTree(); const char* vout = viewer->GetTree();
output->EnsureGrowth(StrLen(vout)); output->EnsureGrowth(StrLen(vout));
@ -68,7 +68,7 @@ void Evaluator::Evaluate() const
node = optimizer->GetRoot(); node = optimizer->GetRoot();
delete optimizer; delete optimizer;
#ifdef DEBUGTREE #if defined(DEBUGTREE)
viewer = new Viewer(node); viewer = new Viewer(node);
vout = viewer->GetTree(); vout = viewer->GetTree();
output->EnsureGrowth(StrLen(vout)); output->EnsureGrowth(StrLen(vout));

View File

@ -209,7 +209,7 @@ SyntaxNode* Parser::ParseStatement()
case symexit: case symexit:
res = new ExitStatement(); res = new ExitStatement();
break; break;
#if !defined(STDC_CONSOLE) #if !defined(AMIGA) && !defined(TERMIOS) && !defined(WINDOWS)
case symclear: case symclear:
res = new ClearStatement(); res = new ClearStatement();
break; break;

View File

@ -90,7 +90,7 @@ char* HelpStatement::StatementHelp() const
output->ClearBuffer(); output->ClearBuffer();
APPENDHELP(STATEMENTLINE) APPENDHELP(STATEMENTLINE)
#if !defined(STDC_CONSOLE) #if !defined(AMIGA) && !defined(TERMIOS) && !defined(WINDOWS)
APPENDHELP(STATEMENTCLEAR) APPENDHELP(STATEMENTCLEAR)
#endif #endif
APPENDHELP(STATEMENTDEF) APPENDHELP(STATEMENTDEF)

View File

@ -32,7 +32,7 @@
#include "viewer.h" #include "viewer.h"
#include "lib/charbuf.h" #include "lib/charbuf.h"
#ifdef DEBUGTREE #if defined(DEBUGTREE)
Viewer::Viewer(SyntaxNode* root) Viewer::Viewer(SyntaxNode* root)
{ {

View File

@ -39,13 +39,12 @@
#include "nodes.h" #include "nodes.h"
#include "lib/charbuf.h" #include "lib/charbuf.h"
#ifdef DEBUGTREE #if defined(DEBUGTREE)
/** /**
* @brief Control class displaying a syntax tree * @brief Control class displaying a syntax tree
* @details * @details
* Define DEBUGTREE to enable the tree viewer. * Define DEBUGTREE to enable the tree viewer.
*
*/ */
class Viewer class Viewer
{ {

View File

@ -31,7 +31,7 @@
#include "console_stdc.h" #include "console_stdc.h"
#include "main/evaluator.h" #include "main/evaluator.h"
#if defined(STDC_CONSOLE) #if !defined(AMIGA) && !defined(TERMIOS) && !defined(WINDOWS)
#include <stdio.h> #include <stdio.h>
StandardConsole::StandardConsole(const char* prompt) : StandardConsole::StandardConsole(const char* prompt) :

View File

@ -39,7 +39,7 @@
#include "amath.h" #include "amath.h"
#include "console.h" #include "console.h"
#if defined(STDC_CONSOLE) #if !defined(AMIGA) && !defined(TERMIOS) && !defined(WINDOWS)
/** /**
* @brief Encapsulates the IO of a Standard C console. * @brief Encapsulates the IO of a Standard C console.

View File

@ -30,27 +30,27 @@
#include "amath.h" #include "amath.h"
#include "amathc.h" #include "amathc.h"
#include "console.h" #include "console.h"
#include "console_posix.h" #include "console_termios.h"
#include "lib/charval.h" #include "lib/charval.h"
#include "lib/aengine.h" #include "lib/aengine.h"
#include "main/evaluator.h" #include "main/evaluator.h"
#if defined(POSIX) #if defined(TERMIOS)
#include <stdio.h> #include <stdio.h>
#include <termios.h> #include <termios.h>
PosixConsole::PosixConsole(const char* prompt, CharValidator* validator) : TermiosConsole::TermiosConsole(const char* prompt, CharValidator* validator) :
ConsoleBase(prompt), line(nullptr), exit(false) ConsoleBase(prompt), line(nullptr), exit(false)
{ {
proc = new AnsiConoleEngine(prompt, validator); proc = new AnsiConoleEngine(prompt, validator);
} }
PosixConsole::~PosixConsole() TermiosConsole::~TermiosConsole()
{ {
delete proc; delete proc;
} }
bool PosixConsole::Open() bool TermiosConsole::Open()
{ {
if (tcgetattr(STDIN_FILENO, &oldAttr) != 0) if (tcgetattr(STDIN_FILENO, &oldAttr) != 0)
{ {
@ -66,7 +66,7 @@ bool PosixConsole::Open()
return (tcsetattr(STDIN_FILENO, TCSANOW, &newAttr) != -1); return (tcsetattr(STDIN_FILENO, TCSANOW, &newAttr) != -1);
} }
void PosixConsole::Close() void TermiosConsole::Close()
{ {
if (!termError) if (!termError)
{ {
@ -74,7 +74,7 @@ void PosixConsole::Close()
} }
} }
void PosixConsole::Start() void TermiosConsole::Start()
{ {
exit = false; exit = false;
StartMessage(); StartMessage();
@ -91,12 +91,12 @@ void PosixConsole::Start()
} }
} }
void PosixConsole::Exit() void TermiosConsole::Exit()
{ {
exit = true; exit = true;
} }
void PosixConsole::ReadLine() void TermiosConsole::ReadLine()
{ {
char c; char c;
proc->StartInput(); proc->StartInput();
@ -116,12 +116,12 @@ void PosixConsole::ReadLine()
line = proc->GetLine(); line = proc->GetLine();
} }
void PosixConsole::WriteString(const char* string) void TermiosConsole::WriteString(const char* string)
{ {
Write(string, StrLen(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); ssize_t res = write(STDOUT_FILENO, string, length);
if (res != 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); ConsoleBase::SetPrompt(string);
proc->SetPrompt(string); proc->SetPrompt(string);

View File

@ -27,11 +27,11 @@
* *
*/ */
#ifndef AMATH_POSIX_CONSOLE #ifndef AMATH_TERMIOS_CONSOLE
#define AMATH_POSIX_CONSOLE #define AMATH_TERMIOS_CONSOLE
/** /**
* @file console_posix.h * @file console_termios.h
* @brief Standard C and termios based console. * @brief Standard C and termios based console.
* *
*/ */
@ -42,18 +42,18 @@
#include "lib/charval.h" #include "lib/charval.h"
#include "lib/aengine.h" #include "lib/aengine.h"
#if defined(POSIX) #if defined(TERMIOS)
#include <termios.h> #include <termios.h>
/** /**
* @brief Encapsulates the IO of a console using Standard C and termios. * @brief Encapsulates the IO of a console using Standard C and termios.
* *
*/ */
class PosixConsole : public ConsoleBase class TermiosConsole : public ConsoleBase
{ {
public: public:
PosixConsole(const char* prompt, CharValidator* validator); TermiosConsole(const char* prompt, CharValidator* validator);
virtual ~PosixConsole(); virtual ~TermiosConsole();
virtual bool Open(); virtual bool Open();
virtual void Close(); virtual void Close();
virtual void Start(); virtual void Start();

View File

@ -34,14 +34,12 @@
#include "lib/charbuf.h" #include "lib/charbuf.h"
#include "loc/text.h" #include "loc/text.h"
#ifdef AMIGA #if defined(AMIGA)
#include <clib/dos_protos.h> #include <clib/dos_protos.h>
/** /**
* @brief * @brief
*
* http://en.wikibooks.org/wiki/Aros/Developer/Docs/Libraries/DOS#Examine_Files_or_Directories * http://en.wikibooks.org/wiki/Aros/Developer/Docs/Libraries/DOS#Examine_Files_or_Directories
*
*/ */
CharBuffer* AmigaFilesystem::ListDirectory(const char* path) CharBuffer* AmigaFilesystem::ListDirectory(const char* path)
{ {

View File

@ -32,15 +32,14 @@
/** /**
* @file filesystem_amiga.h * @file filesystem_amiga.h
* @brief Amiga OS specific file system calls. * @brief Amiga OS specific file system calls
*
*/ */
#include "amath.h" #include "amath.h"
#include "amathc.h" #include "amathc.h"
#include "filesystem.h" #include "filesystem.h"
#ifdef AMIGA #if defined(AMIGA)
class AmigaFilesystem : public FilesystemBase class AmigaFilesystem : public FilesystemBase
{ {

View File

@ -40,6 +40,10 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(UNIX) || defined(HAIKU)
#include <dirent.h>
#endif
CharBuffer* StandardFilesystem::ListDirectory(const char* path) CharBuffer* StandardFilesystem::ListDirectory(const char* path)
{ {
#if defined(UNIX) || defined(HAIKU) #if defined(UNIX) || defined(HAIKU)
@ -86,7 +90,7 @@ CharBuffer* StandardFilesystem::ListDirectory(const char* path)
const char *type; const char *type;
#ifdef HAIKU #if defined(HAIKU)
type = TXTLISTDIRTUNKNOWN; type = TXTLISTDIRTUNKNOWN;
#else #else
switch (entry->d_type) { switch (entry->d_type) {

View File

@ -32,7 +32,7 @@
/** /**
* @file filesystem_stdc.h * @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
#endif #endif

View File

@ -41,7 +41,7 @@
static const texttag ansiTags[] = { static const texttag ansiTags[] = {
{"#HEADLINE#", "\x1B[1m"}, {"#HEADLINE#", "\x1B[1m"},
#ifdef UNIX #if defined(UNIX)
{"#SYNTAXHIGHLIGHT#", "\x1B[3m\x1B[32m"}, {"#SYNTAXHIGHLIGHT#", "\x1B[3m\x1B[32m"},
#else #else
{"#SYNTAXHIGHLIGHT#", "\x1B[32m"}, {"#SYNTAXHIGHLIGHT#", "\x1B[32m"},

View File

@ -36,7 +36,7 @@
#include "loc/ident.h" #include "loc/ident.h"
#include "loc/kword.h" #include "loc/kword.h"
#ifdef AMIGA #if defined(AMIGA)
#include <clib/locale_protos.h> #include <clib/locale_protos.h>
AmigaLanguage::AmigaLanguage() : AmigaLanguage::AmigaLanguage() :

View File

@ -30,11 +30,14 @@
#ifndef AMATH_LANGUAGE_AMIGA_H #ifndef AMATH_LANGUAGE_AMIGA_H
#define AMATH_LANGUAGE_AMIGA_H #define AMATH_LANGUAGE_AMIGA_H
#include "amath.h"
#include "language.h" #include "language.h"
#include "loc/help.h" #include "loc/help.h"
#include "loc/text.h" #include "loc/text.h"
#include "loc/kword.h" #include "loc/kword.h"
#if defined(AMIGA)
class AmigaLanguage : public Language class AmigaLanguage : public Language
{ {
public: public:
@ -64,3 +67,4 @@ private:
}; };
#endif #endif
#endif

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

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

View File

@ -77,5 +77,4 @@ private:
}; };
#endif #endif
#endif #endif

View File

@ -33,7 +33,7 @@
#include "preferences.h" #include "preferences.h"
#include "preferences_amiga.h" #include "preferences_amiga.h"
#ifdef AMIGA #if defined(AMIGA)
#include <clib/dos_protos.h> #include <clib/dos_protos.h>
static const char *tempname = "ENV:amath.prefs"; static const char *tempname = "ENV:amath.prefs";

View File

@ -30,8 +30,11 @@
#ifndef AMATH_PREFERENCES_AMIGA_H #ifndef AMATH_PREFERENCES_AMIGA_H
#define AMATH_PREFERENCES_AMIGA_H #define AMATH_PREFERENCES_AMIGA_H
#include "amath.h"
#include "preferences.h" #include "preferences.h"
#if defined(AMIGA)
class AmigaPreferences : public PreferencesBase class AmigaPreferences : public PreferencesBase
{ {
public: public:
@ -44,3 +47,4 @@ private:
}; };
#endif #endif
#endif

View File

@ -33,7 +33,6 @@
#include "language.h" #include "language.h"
#include "language_stdc.h" #include "language_stdc.h"
#include "language_amiga.h" #include "language_amiga.h"
#include "language_posix.h"
#include "filesystem.h" #include "filesystem.h"
#include "filesystem_stdc.h" #include "filesystem_stdc.h"
#include "filesystem_amiga.h" #include "filesystem_amiga.h"
@ -52,11 +51,7 @@ Program::Program() :
Variables = new VariableList(); Variables = new VariableList();
Functions = new FunctionList(); Functions = new FunctionList();
ins = new RealNumber(); ins = new RealNumber();
#if defined(UNIX) #if defined(AMIGA)
Language = new PosixLanguage();
Filesystem = new StandardFilesystem();
Preferences = new StandardPreferences();
#elif defined(AMIGA)
Language = new AmigaLanguage(); Language = new AmigaLanguage();
Filesystem = new AmigaFilesystem(); Filesystem = new AmigaFilesystem();
Preferences = new AmigaPreferences(); Preferences = new AmigaPreferences();

View File

@ -44,7 +44,7 @@
#define ARGS_FORMAT "SHELL/S,NOANSI/S,INPUT/F" #define ARGS_FORMAT "SHELL/S,NOANSI/S,INPUT/F"
#include <clib/dos_protos.h> #include <clib/dos_protos.h>
#ifdef AOS3 #if defined(AOS3)
# define RDPTR LONG* # define RDPTR LONG*
#else #else
# define RDPTR IPTR* # define RDPTR IPTR*

View File

@ -33,7 +33,7 @@
#include "filesystem.h" #include "filesystem.h"
#include "program_haiku.h" #include "program_haiku.h"
#include "window_haiku.h" #include "window_haiku.h"
#include "console_posix.h" #include "console_termios.h"
#include "lib/charbuf.h" #include "lib/charbuf.h"
#include "main/evaluator.h" #include "main/evaluator.h"
@ -77,7 +77,7 @@ void HaikuProgram::Initialize(int argc, char **argv)
return; return;
} }
Console = new PosixConsole(Preferences->GetPrompt(), Language); Console = new TermiosConsole(Preferences->GetPrompt(), Language);
SetAnsiMode(true); SetAnsiMode(true);
line = new CharBuffer(); line = new CharBuffer();

View File

@ -30,8 +30,8 @@
#include "amath.h" #include "amath.h"
#include "amathc.h" #include "amathc.h"
#include "program_stdc.h" #include "program_stdc.h"
#include "console_posix.h"
#include "console_stdc.h" #include "console_stdc.h"
#include "console_termios.h"
#include "console_windows.h" #include "console_windows.h"
#include "preferences_stdc.h" #include "preferences_stdc.h"
#include "lib/charbuf.h" #include "lib/charbuf.h"
@ -65,8 +65,8 @@ void StandardProgram::Initialize(int argc, char** argv)
{ {
#if defined(WINDOWS) #if defined(WINDOWS)
Console = new WindowsConsole(Preferences->GetPrompt(), Language); Console = new WindowsConsole(Preferences->GetPrompt(), Language);
#elif defined(POSIX) #elif defined(TERMIOS)
Console = new PosixConsole(Preferences->GetPrompt(), Language); Console = new TermiosConsole(Preferences->GetPrompt(), Language);
#else #else
Console = new StandardConsole(Preferences->GetPrompt(), Language); Console = new StandardConsole(Preferences->GetPrompt(), Language);
#endif #endif

View File

@ -275,28 +275,3 @@ void AmigaWindow::SetPrompt(const char* string)
} }
#endif #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. */
//}

View File

@ -94,4 +94,3 @@ private:
#endif #endif
#endif #endif