made minor changes to support MINGW32
This commit is contained in:
parent
dea9b94b87
commit
261c499217
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: awk.c 419 2008-10-13 11:32:58Z baconevi $
|
||||
* $Id: awk.c 463 2008-12-09 06:52:03Z baconevi $
|
||||
*/
|
||||
|
||||
#include <ase/awk/awk.h>
|
||||
@ -1164,7 +1164,7 @@ static void close_awk (ase_awk_t* awk)
|
||||
extension_t* ext = (extension_t*)ase_awk_getextension(awk);
|
||||
|
||||
#ifdef _WIN32
|
||||
HANDLE heap = (HANDLE)ext->mmgr->data;
|
||||
HANDLE heap = (HANDLE)ext->mmgr.data;
|
||||
#endif
|
||||
|
||||
ase_awk_close (awk);
|
||||
|
5
ase/configure
vendored
5
ase/configure
vendored
@ -20346,8 +20346,8 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
|
||||
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"
|
||||
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -D_AUTO_CONFIGURED"
|
||||
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE -D_AUTO_CONFIGURED"
|
||||
|
||||
LIBM=
|
||||
case $host in
|
||||
@ -27748,7 +27748,6 @@ _ACEOF
|
||||
esac
|
||||
|
||||
|
||||
# Defines extra options
|
||||
# Check whether --enable-wchar was given.
|
||||
if test "${enable_wchar+set}" = set; then
|
||||
enableval=$enable_wchar; enable_wchar_is=$enableval
|
||||
|
@ -66,8 +66,8 @@ else
|
||||
fi
|
||||
|
||||
dnl make visible the 64bit interface to the file system
|
||||
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
|
||||
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"
|
||||
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -D_AUTO_CONFIGURED"
|
||||
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE -D_AUTO_CONFIGURED"
|
||||
|
||||
dnl Checks for the math library (is -lm needed?)
|
||||
AC_CHECK_LIBM
|
||||
@ -135,7 +135,7 @@ AC_C_BIGENDIAN(
|
||||
[AC_DEFINE([ASE_ENDIAN_LITTLE],[],[Little Endian])],
|
||||
[AC_DEFINE([ASE_ENDIAN_UNKNOWN],[],[Unknown Endian])])
|
||||
|
||||
# Defines extra options
|
||||
dnl define extra options
|
||||
AC_ARG_ENABLE([wchar], [AC_HELP_STRING([--enable-wchar],
|
||||
[use wchar_t a default charater type when enabled (default. yes)])],
|
||||
enable_wchar_is=$enableval,enable_wchar_is=yes)
|
||||
|
@ -36,7 +36,7 @@ enum ase_fio_seek_origin_t
|
||||
|
||||
#ifdef _WIN32
|
||||
/* <winnt.h> typedef PVOID HANDLE; */
|
||||
typedef void* aes_fio_hnd_t;
|
||||
typedef void* ase_fio_hnd_t;
|
||||
#else
|
||||
typedef int ase_fio_hnd_t;
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: types.h 443 2008-10-30 13:45:17Z baconevi $
|
||||
* $Id: types.h 463 2008-12-09 06:52:03Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -17,10 +17,13 @@
|
||||
******
|
||||
*/
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_AUTO_CONFIGURED)
|
||||
#include <ase/config.h>
|
||||
#elif defined(_WIN32)
|
||||
#include <ase/conf_msw.h>
|
||||
#elif defined(vms) || defined(__vms)
|
||||
#include <ase/conf_vms.h>
|
||||
/*
|
||||
#elif defined(__unix__) || defined(__unix) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__SPU__)
|
||||
#if !defined(__unix__)
|
||||
#define __unix__
|
||||
@ -29,6 +32,7 @@
|
||||
#define __unix
|
||||
#endif
|
||||
#include <ase/config.h>
|
||||
*/
|
||||
#else
|
||||
#error unsupported operating system
|
||||
#endif
|
||||
@ -90,10 +94,10 @@ typedef int ase_tri_t;
|
||||
* ase_ulong_t - define the largest unsigned integer type supported
|
||||
******
|
||||
*/
|
||||
#if ASE_SIZEOF_LONG_LONG != 0
|
||||
#if ASE_SIZEOF_LONG_LONG > 0
|
||||
typedef long long ase_long_t;
|
||||
typedef unsigned long long ase_ulong_t;
|
||||
#elif ASE_SIZEOF___INT64 != 0
|
||||
#elif ASE_SIZEOF___INT64 > 0
|
||||
typedef __int64 ase_long_t;
|
||||
typedef unsigned __int64 ase_ulong_t;
|
||||
#else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.h 223 2008-06-26 06:44:41Z baconevi $
|
||||
* $Id: main.h 463 2008-12-09 06:52:03Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -10,21 +10,25 @@
|
||||
#include <ase/types.h>
|
||||
#include <ase/macros.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <tchar.h>
|
||||
#define ase_main _tmain
|
||||
typedef ase_char_t ase_achar_t;
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
#if defined(ASE_CHAR_IS_MCHAR)
|
||||
#define ase_main main
|
||||
typedef ase_mchar_t ase_achar_t;
|
||||
#else
|
||||
#define ase_main wmain
|
||||
typedef ase_wchar_t ase_achar_t;
|
||||
#endif
|
||||
#else
|
||||
#define ase_main main
|
||||
typedef ase_mchar_t ase_achar_t;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]));
|
||||
/* TODO - ase_runmain with env */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -72,7 +72,6 @@ ase_fio_t* ase_fio_init (
|
||||
DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||
DWORD creation_disposition = 0;
|
||||
DWORD attributes = FILE_ATTRIBUTE_NORMAL;
|
||||
DWORD file_type;
|
||||
|
||||
if (flags & ASE_FIO_READ) desired_access |= GENERIC_READ;
|
||||
if (flags & ASE_FIO_WRITE) desired_access |= GENERIC_WRITE;
|
||||
@ -105,13 +104,15 @@ ase_fio_t* ase_fio_init (
|
||||
creation_disposition, attributes, 0);
|
||||
}
|
||||
|
||||
if (handle == INVALID_HANDLE) return ASE_NULL;
|
||||
if (handle == INVALID_HANDLE_VALUE) return ASE_NULL;
|
||||
|
||||
file_type = GetFileType(handle);
|
||||
if (file_type == FILE_TYPE_UNKNOWN)
|
||||
{
|
||||
CloseHandle (handle);
|
||||
return ASE_NULL;
|
||||
DWORD file_type = GetFileType(handle);
|
||||
if (file_type == FILE_TYPE_UNKNOWN)
|
||||
{
|
||||
CloseHandle (handle);
|
||||
return ASE_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: a lot more */
|
||||
@ -259,7 +260,7 @@ ase_ssize_t ase_fio_read (ase_fio_t* fio, void* buf, ase_size_t size)
|
||||
#ifdef _WIN32
|
||||
DWORD count;
|
||||
if (size > ASE_TYPE_MAX(DWORD)) size = ASE_TYPE_MAX(DWORD);
|
||||
if (ReadFile(handle, buf, size, &count, ASE_NULL) == FALSE) return -1;
|
||||
if (ReadFile(fio->handle, buf, size, &count, ASE_NULL) == FALSE) return -1;
|
||||
return (ase_ssize_t)count;
|
||||
#else
|
||||
if (size > ASE_TYPE_MAX(size_t)) size = ASE_TYPE_MAX(size_t);
|
||||
@ -276,7 +277,7 @@ ase_ssize_t ase_fio_write (ase_fio_t* fio, const void* data, ase_size_t size)
|
||||
#ifdef _WIN32
|
||||
DWORD count;
|
||||
if (size > ASE_TYPE_MAX(DWORD)) size = ASE_TYPE_MAX(DWORD);
|
||||
if (WriteFile(handle, buf, &count, ASE_NULL) == FALSE) return -1;
|
||||
if (WriteFile(fio->handle, data, size, &count, ASE_NULL) == FALSE) return -1;
|
||||
return (ase_ssize_t)count;
|
||||
#else
|
||||
if (size > ASE_TYPE_MAX(size_t)) size = ASE_TYPE_MAX(size_t);
|
||||
|
@ -8,6 +8,10 @@
|
||||
static ase_ssize_t __sio_input (int cmd, void* arg, void* buf, ase_size_t size);
|
||||
static ase_ssize_t __sio_output (int cmd, void* arg, void* buf, ase_size_t size);
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
static ase_sio_t __sio_in =
|
||||
{
|
||||
ASE_NULL, /* mmgr */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: main.c 116 2008-03-03 11:15:37Z baconevi $
|
||||
* $Id: main.c 463 2008-12-09 06:52:03Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -10,7 +10,7 @@
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
|
||||
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]))
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio.c 341 2008-08-20 10:58:19Z baconevi $
|
||||
* $Id: stdio.c 463 2008-12-09 06:52:03Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -21,7 +21,11 @@ int ase_vsprintf (ase_char_t* buf, size_t size, const ase_char_t* fmt, va_list a
|
||||
{
|
||||
int n;
|
||||
|
||||
n = _vsntprintf (buf, size, fmt, ap);
|
||||
#ifdef ASE_CHAR_IS_MCHAR
|
||||
n = _vsnprintf (buf, size, fmt, ap);
|
||||
#else
|
||||
n = _vsnwprintf (buf, size, fmt, ap);
|
||||
#endif
|
||||
if (n < 0 || (size_t)n >= size)
|
||||
{
|
||||
if (size > 0) buf[size-1] = ASE_T('\0');
|
||||
@ -319,10 +323,10 @@ int ase_dprintf (const ase_char_t* fmt, ...)
|
||||
|
||||
ASE_FILE* ase_fopen (const ase_char_t* path, const ase_char_t* mode)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return _tfopen (path, mode);
|
||||
#elif defined(ASE_CHAR_IS_MCHAR)
|
||||
#if defined(ASE_CHAR_IS_MCHAR)
|
||||
return fopen (path, mode);
|
||||
#elif defined(_WIN32)
|
||||
return _wfopen (path, mode);
|
||||
#else
|
||||
|
||||
char path_mb[PATH_MAX + 1];
|
||||
@ -343,24 +347,10 @@ ASE_FILE* ase_fopen (const ase_char_t* path, const ase_char_t* mode)
|
||||
|
||||
ASE_FILE* ase_popen (const ase_char_t* cmd, const ase_char_t* mode)
|
||||
{
|
||||
#if defined(__SPU__)
|
||||
/* popen is not available */
|
||||
#warning ############################################
|
||||
#warning ase_popen is NOT SUPPORTED in this platform.
|
||||
#warning #############################################
|
||||
return ASE_NULL;
|
||||
#elif defined(_WIN32)
|
||||
#if defined(__DMC__)
|
||||
/* TODO: implement this for DMC */
|
||||
#warning ############################################
|
||||
#warning ase_popen is NOT SUPPORTED in this platform.
|
||||
#warning #############################################
|
||||
return ASE_NULL;
|
||||
#else
|
||||
return _tpopen (cmd, mode);
|
||||
#endif
|
||||
#elif defined(ASE_CHAR_IS_MCHAR)
|
||||
#if defined(ASE_CHAR_IS_MCHAR)
|
||||
return popen (cmd, mode);
|
||||
#elif defined(_WIN32)
|
||||
return _wpopen (cmd, mode);
|
||||
#else
|
||||
char cmd_mb[PATH_MAX + 1];
|
||||
char mode_mb[32];
|
||||
@ -407,11 +397,11 @@ ase_ssize_t ase_getdelim (
|
||||
if (b == ASE_NULL)
|
||||
{
|
||||
capa = 256;
|
||||
#if (defined(vms) || defined(__vms)) && (ASE_SIZEOF_VOID_P >= 8)
|
||||
#if (defined(vms) || defined(__vms)) && (ASE_SIZEOF_VOID_P >= 8)
|
||||
b = (ase_char_t*) _malloc32 (sizeof(ase_char_t)*(capa+1));
|
||||
#else
|
||||
#else
|
||||
b = (ase_char_t*) malloc (sizeof(ase_char_t)*(capa+1));
|
||||
#endif
|
||||
#endif
|
||||
if (b == ASE_NULL) return -2;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user