From d7f8c6cbd3e0b58bda4200d8eb52ea0dd22c7c91 Mon Sep 17 00:00:00 2001 From: llsth Date: Wed, 8 Apr 2015 01:15:36 +0200 Subject: [PATCH] Cleaned up definitions --- Makefile.vcxproj | 2 -- Makefile.vcxproj.filters | 6 ---- app/lib/aengine.cpp | 2 -- app/lib/ntext.cpp | 1 - app/localize/help.h | 2 -- app/localize/start.h | 16 +---------- app/localize/tags.h | 3 +- app/localize/text.h | 2 -- app/main/functions.cpp | 1 - app/main/nodes.cpp | 2 -- app/main/nodes.h | 2 -- app/main/statements.cpp | 1 - app/system/base/io.cpp | 2 -- app/system/console.cpp | 2 -- app/system/filesystem_amiga.cpp | 1 - app/system/filesystem_stdc.cpp | 1 - app/system/language.cpp | 1 - app/system/preferences.cpp | 2 -- catalog/help.sd | 2 -- catalog/text.sd | 2 -- lib/clib.h | 29 +++++-------------- lib/clib/untag.c | 2 -- lib/platform.h | 50 +++++++++++++++++++++++++++++++++ 23 files changed, 59 insertions(+), 75 deletions(-) diff --git a/Makefile.vcxproj b/Makefile.vcxproj index 2e6c0984..f7512742 100644 --- a/Makefile.vcxproj +++ b/Makefile.vcxproj @@ -187,7 +187,6 @@ - @@ -199,7 +198,6 @@ - {21BD69A9-7F52-48D9-9846-6943E90A87A9} diff --git a/Makefile.vcxproj.filters b/Makefile.vcxproj.filters index ac967c13..f3f5d845 100644 --- a/Makefile.vcxproj.filters +++ b/Makefile.vcxproj.filters @@ -560,9 +560,6 @@ app\system\io - - lib - lib @@ -584,9 +581,6 @@ lib - - lib - lib\dconv diff --git a/app/lib/aengine.cpp b/app/lib/aengine.cpp index bb149f90..9bd097a7 100644 --- a/app/lib/aengine.cpp +++ b/app/lib/aengine.cpp @@ -25,8 +25,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #include "lib/charbuf.h" #include "lib/aengine.h" diff --git a/app/lib/ntext.cpp b/app/lib/ntext.cpp index d861ad06..37c20113 100644 --- a/app/lib/ntext.cpp +++ b/app/lib/ntext.cpp @@ -26,7 +26,6 @@ #include "clib.h" #include "math.h" -#include "text.h" #include "dprint.h" #include "complex.h" #include "lib/real.h" diff --git a/app/localize/help.h b/app/localize/help.h index 1014ea91..68a74d39 100644 --- a/app/localize/help.h +++ b/app/localize/help.h @@ -37,8 +37,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #include "localize/lex.h" #define symzero Symbol(0) diff --git a/app/localize/start.h b/app/localize/start.h index 5e3586d3..3c1f9d4f 100644 --- a/app/localize/start.h +++ b/app/localize/start.h @@ -81,19 +81,6 @@ //#define TXTCPU EMPTYSTRING #endif /******************************************************************************/ -#if defined(AROS) -# define TXTSYSNAME SPACE "AROS" -#endif -#if defined(MORPHOS) -# define TXTSYSNAME SPACE "MorphOS" -#endif -#if defined(AOS3) || defined(AOS4) -# define TXTSYSNAME SPACE "AmigaOS" -#endif -#ifndef TXTSYSNAME -# define TXTSYSNAME EMPTYSTRING -#endif -/******************************************************************************/ #ifdef WITHTEST # define TXTTEST SPACE "TEST" #else @@ -109,7 +96,6 @@ #define TXTTITLE "amath version 1.6.0" #define TXTDOSVERSION "\0$VER: amath 1.60 (01-04-2015)" #define TXTCOPYRIGHT "(c) 2015 Carsten Sonne Larsen" -#define TXTARCH TXTCPU TXTFPU TXTSYSNAME TXTTEST -#define TXTSTARTMSG TXTTITLE SPACE TXTARCH SPACE TXTCOPYRIGHT +#define TXTSTARTMSG TXTTITLE SPACE TXTCPU TXTFPU TXTTEST SPACE TXTCOPYRIGHT /******************************************************************************/ #endif diff --git a/app/localize/tags.h b/app/localize/tags.h index 94148cfc..3dc88b34 100644 --- a/app/localize/tags.h +++ b/app/localize/tags.h @@ -27,8 +27,7 @@ #ifndef AMATH_TEXT_TAGS_H #define AMATH_TEXT_TAGS_H -#include "text.h" -#include "ansicon.h" +#include "clib.h" #include "localize/start.h" static const texttag texttags[] = { diff --git a/app/localize/text.h b/app/localize/text.h index c5ea15c3..6fd2203d 100644 --- a/app/localize/text.h +++ b/app/localize/text.h @@ -37,8 +37,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #define INTROMSG Program->Language->GetText(0) #define TXTLISTDIRHEADER Program->Language->GetText(1) diff --git a/app/main/functions.cpp b/app/main/functions.cpp index 3664ce1b..411f83d2 100644 --- a/app/main/functions.cpp +++ b/app/main/functions.cpp @@ -25,7 +25,6 @@ */ #include "clib.h" -#include "text.h" #include "lib/numb.h" #include "main/values.h" #include "main/functions.h" diff --git a/app/main/nodes.cpp b/app/main/nodes.cpp index ca53b943..842ffb81 100644 --- a/app/main/nodes.cpp +++ b/app/main/nodes.cpp @@ -25,8 +25,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #include "lib/numb.h" #include "lib/charbuf.h" #include "main/nodes.h" diff --git a/app/main/nodes.h b/app/main/nodes.h index 84d24036..7697a7b7 100644 --- a/app/main/nodes.h +++ b/app/main/nodes.h @@ -34,8 +34,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #include "lib/numb.h" #include "lib/charbuf.h" diff --git a/app/main/statements.cpp b/app/main/statements.cpp index 4f1e8831..753ce972 100644 --- a/app/main/statements.cpp +++ b/app/main/statements.cpp @@ -26,7 +26,6 @@ #include "mem.h" #include "clib.h" -#include "text.h" #include "lib/real.h" #include "lib/charbuf.h" #include "localize/help.h" diff --git a/app/system/base/io.cpp b/app/system/base/io.cpp index 0fe24a12..302f7d6d 100644 --- a/app/system/base/io.cpp +++ b/app/system/base/io.cpp @@ -26,8 +26,6 @@ #include "mem.h" #include "clib.h" -#include "text.h" -#include "ansicon.h" #include "localize/start.h" #include "system/program.h" #include "system/program_stdc.h" diff --git a/app/system/console.cpp b/app/system/console.cpp index 1242b502..c29f1946 100755 --- a/app/system/console.cpp +++ b/app/system/console.cpp @@ -25,8 +25,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #include "localize/text.h" #include "system/console.h" #include "system/base/io.h" diff --git a/app/system/filesystem_amiga.cpp b/app/system/filesystem_amiga.cpp index 042caba8..0313a263 100755 --- a/app/system/filesystem_amiga.cpp +++ b/app/system/filesystem_amiga.cpp @@ -25,7 +25,6 @@ */ #include "clib.h" -#include "text.h" #include "lib/charbuf.h" #include "localize/text.h" #include "system/program.h" diff --git a/app/system/filesystem_stdc.cpp b/app/system/filesystem_stdc.cpp index f5551afd..548287a6 100755 --- a/app/system/filesystem_stdc.cpp +++ b/app/system/filesystem_stdc.cpp @@ -26,7 +26,6 @@ #include "clib.h" -#include "text.h" #include "lib/charbuf.h" #include "localize/text.h" #include "system/program.h" diff --git a/app/system/language.cpp b/app/system/language.cpp index 6c43e18a..d792d364 100644 --- a/app/system/language.cpp +++ b/app/system/language.cpp @@ -25,7 +25,6 @@ */ #include "clib.h" -#include "text.h" #include "localize/tags.h" #include "system/language.h" diff --git a/app/system/preferences.cpp b/app/system/preferences.cpp index d8608c8f..4cdc1061 100644 --- a/app/system/preferences.cpp +++ b/app/system/preferences.cpp @@ -25,8 +25,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #include "lib/numb.h" #include "lib/real.h" #include "lib/ntext.h" diff --git a/catalog/help.sd b/catalog/help.sd index 52ef78a3..28adc6f7 100644 --- a/catalog/help.sd +++ b/catalog/help.sd @@ -39,8 +39,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #include "localize/lex.h" #define symzero Symbol(0) diff --git a/catalog/text.sd b/catalog/text.sd index ee377793..ec3b8094 100644 --- a/catalog/text.sd +++ b/catalog/text.sd @@ -39,8 +39,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" #define %i Program->Language->GetText(%d) diff --git a/lib/clib.h b/lib/clib.h index 7b0c4458..a0f2fbb9 100644 --- a/lib/clib.h +++ b/lib/clib.h @@ -31,41 +31,26 @@ * @file clib.h * @brief C functions for manipulating strings and memory. * - * This file contains classless C functions. Similar functions can - * be found in standard C libraries. - * */ -#include "text.h" #include "platform.h" -/** - * @brief NULL pointer for non allocated memory. - * - * Use the NOMEM to avoid unnecessary dependency to stdio NULL. - */ -#define NOMEM 0 - -// Defintions used i CLib functions -#define LONG_BIT 32 -#define wsize sizeof(unsigned int) -#define wmask (wsize - 1) - -#ifndef __cplusplus -typedef int bool; -#define true 1 -#define false 0 -#endif - #ifdef __cplusplus extern "C" { #endif +typedef struct { + const char *tag; + const char *text; +} texttag; + int StrLen(const char *string); bool StrIsEqual(const char *s1, const char *s2); void MemSet(void *destination, int c0, unsigned int length); void MemCopy(void *destination, const void *source, unsigned int length); unsigned int AllocAndCopy(char **destination, const char *source); +void Untag(char *destination, const char *source, + texttag tags[], unsigned int tagcount); #ifdef __cplusplus } diff --git a/lib/clib/untag.c b/lib/clib/untag.c index 70cc90c0..149aa0c0 100644 --- a/lib/clib/untag.c +++ b/lib/clib/untag.c @@ -25,8 +25,6 @@ */ #include "clib.h" -#include "text.h" -#include "ansicon.h" void Untag(char *destination, const char *source, texttag tags[], unsigned int tagcount) { diff --git a/lib/platform.h b/lib/platform.h index e1f6e11c..354f53a8 100644 --- a/lib/platform.h +++ b/lib/platform.h @@ -29,6 +29,20 @@ #include +#define EMPTYSTRING "" +#define SPACE " " +#define NEWLINE "\n" +#define NOMEM 0 +#define LONG_BIT 32 +#define wsize sizeof(unsigned int) +#define wmask (wsize - 1) + +#ifndef __cplusplus +typedef int bool; +#define true 1 +#define false 0 +#endif + #ifdef __AMIGA__ # ifndef AOS3 # define AOS3 @@ -112,4 +126,40 @@ typedef u_int64_t uint64_t; # define IPTR LONG* #endif +#if defined(ANSICONSOLE) +#define HEADLINE "\x1B[1m" +#define SYNTAXHIGHLIGHT "\x1B[3m\x1B[32m" +#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