Win32 fixes

This commit is contained in:
llsth 2015-04-14 14:00:01 +02:00
parent 9d85d4c699
commit e00ce964ae
10 changed files with 49 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
Makefile
*.kdev4 *.kdev4
*.o *.o
*.a *.a

View File

@ -97,6 +97,6 @@
#define TXTDOSVERSION "\0$VER: amath 1.60 (01-04-2015)" SPACE TXTARCH #define TXTDOSVERSION "\0$VER: amath 1.60 (01-04-2015)" SPACE TXTARCH
#define TXTTITLE "amath version 1.6.0" #define TXTTITLE "amath version 1.6.0"
#define TXTCOPYRIGHT "(c) 2015 Carsten Sonne Larsen" #define TXTCOPYRIGHT "(c) 2015 Carsten Sonne Larsen"
#define TXTSTARTMSG TXTTITLE SPACE TXTCOPYRIGHT SPACE TXTARCH #define TXTSTARTMSG TXTTITLE SPACE TXTCOPYRIGHT
/******************************************************************************/ /******************************************************************************/
#endif #endif

View File

@ -116,7 +116,14 @@ CharBuffer* StandardFilesystem::ListDirectory(const char *path)
CharBuffer* StandardFilesystem::LoadTextFile(const char* name) CharBuffer* StandardFilesystem::LoadTextFile(const char* name)
{ {
FILE *file = fopen(name, "r"); FILE *file;
#if !defined(_WIN32)
file = fopen(name, "r");
#else
fopen_s(&file, name, "r");
#endif
if (!file) { if (!file) {
return NOMEM; return NOMEM;
} }
@ -150,7 +157,14 @@ CharBuffer* StandardFilesystem::LoadTextFile(const char* name)
bool StandardFilesystem::SaveTextFile(const char *name, const char *text) bool StandardFilesystem::SaveTextFile(const char *name, const char *text)
{ {
FILE *file = fopen(name, "w"); FILE *file;
#if !defined(_WIN32)
file = fopen(name, "w");
#else
fopen_s(&file, name, "w");
#endif
if (!file) { if (!file) {
return false; return false;
} }

View File

@ -36,7 +36,7 @@
#include "system/language_stdc.h" #include "system/language_stdc.h"
StandardLanguage::StandardLanguage() : StandardLanguage::StandardLanguage() :
Language::Language() Language()
{ {
LoadCatalogs(); LoadCatalogs();
} }

8
configure vendored
View File

@ -322,12 +322,18 @@ if $VALID ; then
echo " \${FLXCAT} text/help.cd app/localize/help.h=text/help.sd" echo " \${FLXCAT} text/help.cd app/localize/help.h=text/help.sd"
echo " \${FLXCAT} text/ident-clean.cd app/localize/ident.h=text/ident.sd" echo " \${FLXCAT} text/ident-clean.cd app/localize/ident.h=text/ident.sd"
echo " \${FLXCAT} text/text.cd app/localize/text.h=text/text.sd" echo " \${FLXCAT} text/text.cd app/localize/text.h=text/text.sd"
echo echo
echo "catalogsu: " echo "catalogsu: "
echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-help.ct >utext/dk-help.dict" echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-help.ct >utext/dk-help.dict"
echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-ident.ct >utext/dk-ident.dict" echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-ident.ct >utext/dk-ident.dict"
echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-text.ct >utext/dk-text.dict" echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-text.ct >utext/dk-text.dict"
echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-keyword.ct >utext/dk-keyword.dict" echo " iconv -f ISO-8859-15 -t UTF-8 catalog/dansk/amath-keyword.ct >utext/dk-keyword.dict"
echo
echo "catalogsw: "
echo " iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-help.ct >utext/dk-help.dict"
echo " iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-ident.ct >utext/dk-ident.dict"
echo " iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-text.ct >utext/dk-text.dict"
echo " iconv -f ISO-8859-15 -t CP850 catalog/dansk/amath-keyword.ct >utext/dk-keyword.dict"
echo echo
echo "libamathapp: ${libapp}" echo "libamathapp: ${libapp}"
echo " \${AR} rcs libamathapp${outext}.a ${libapp}" echo " \${AR} rcs libamathapp${outext}.a ${libapp}"

View File

@ -37,10 +37,10 @@
#define FREE_MEM(x) FreeVec(x) #define FREE_MEM(x) FreeVec(x)
#define Debug(x,y,z,w) #define Debug(x,y,z,w)
#else #else
#include <stdio.h> # include <stdlib.h>
#define ALLOC_MEM(x) calloc(1L,x) # define ALLOC_MEM(x) calloc(1L,x)
#define FREE_MEM(x) free(x) # define FREE_MEM(x) free(x)
#define Debug(x,y,z,w) # define Debug(x,y,z,w)
#endif #endif
struct MemoryBlock struct MemoryBlock

View File

@ -155,14 +155,19 @@ inline void operator delete[] (void* ptr) {
#endif #endif
#endif #endif
#ifdef _WIN32
# include <stdio.h>
# include <stdint.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
#if (__GNUC__ > 2) || defined (_WIN32) #if (__GNUC__ > 2) || defined (_WIN32)
#include <new> #include <new>
inline void* operator new (size_t size) throw(std::bad_alloc) { inline void* operator new (size_t size) throw() {
return AllocMemSafe(size); return AllocMemSafe(size);
} }
inline void* operator new[] (size_t size) throw(std::bad_alloc) { inline void* operator new[] (size_t size) throw() {
return AllocMemSafe(size); return AllocMemSafe(size);
} }

View File

@ -44,6 +44,10 @@
#include "prim.h" #include "prim.h"
#include "math.h" #include "math.h"
#ifdef _WIN32
#pragma warning( disable : 4146 )
#endif
/* atan2(y,x) /* atan2(y,x)
* Method : * Method :
* 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).

View File

@ -44,6 +44,10 @@
#include "prim.h" #include "prim.h"
#include "math.h" #include "math.h"
#ifdef _WIN32
#pragma warning( disable : 4146 )
#endif
static const double one = 1.0, huge = 1e300; static const double one = 1.0, huge = 1e300;
static double zero = 0.0; static double zero = 0.0;

View File

@ -43,6 +43,10 @@
#include "prim.h" #include "prim.h"
#ifdef _WIN32
#pragma warning( disable : 4146 )
#endif
static const double one = 1.0, Zero[] = {0.0, -0.0,}; static const double one = 1.0, Zero[] = {0.0, -0.0,};
/** /**