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>
|
#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);
|
extension_t* ext = (extension_t*)ase_awk_getextension(awk);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE heap = (HANDLE)ext->mmgr->data;
|
HANDLE heap = (HANDLE)ext->mmgr.data;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ase_awk_close (awk);
|
ase_awk_close (awk);
|
||||||
|
5
ase/configure
vendored
5
ase/configure
vendored
@ -20346,8 +20346,8 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
|
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -D_AUTO_CONFIGURED"
|
||||||
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"
|
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE -D_AUTO_CONFIGURED"
|
||||||
|
|
||||||
LIBM=
|
LIBM=
|
||||||
case $host in
|
case $host in
|
||||||
@ -27748,7 +27748,6 @@ _ACEOF
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Defines extra options
|
|
||||||
# Check whether --enable-wchar was given.
|
# Check whether --enable-wchar was given.
|
||||||
if test "${enable_wchar+set}" = set; then
|
if test "${enable_wchar+set}" = set; then
|
||||||
enableval=$enable_wchar; enable_wchar_is=$enableval
|
enableval=$enable_wchar; enable_wchar_is=$enableval
|
||||||
|
@ -66,8 +66,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
dnl make visible the 64bit interface to the file system
|
dnl make visible the 64bit interface to the file system
|
||||||
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
|
CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE -D_AUTO_CONFIGURED"
|
||||||
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE"
|
CXXFLAGS="$CXXFLAGS -D_LARGEFILE64_SOURCE -D_AUTO_CONFIGURED"
|
||||||
|
|
||||||
dnl Checks for the math library (is -lm needed?)
|
dnl Checks for the math library (is -lm needed?)
|
||||||
AC_CHECK_LIBM
|
AC_CHECK_LIBM
|
||||||
@ -135,7 +135,7 @@ AC_C_BIGENDIAN(
|
|||||||
[AC_DEFINE([ASE_ENDIAN_LITTLE],[],[Little Endian])],
|
[AC_DEFINE([ASE_ENDIAN_LITTLE],[],[Little Endian])],
|
||||||
[AC_DEFINE([ASE_ENDIAN_UNKNOWN],[],[Unknown Endian])])
|
[AC_DEFINE([ASE_ENDIAN_UNKNOWN],[],[Unknown Endian])])
|
||||||
|
|
||||||
# Defines extra options
|
dnl define extra options
|
||||||
AC_ARG_ENABLE([wchar], [AC_HELP_STRING([--enable-wchar],
|
AC_ARG_ENABLE([wchar], [AC_HELP_STRING([--enable-wchar],
|
||||||
[use wchar_t a default charater type when enabled (default. yes)])],
|
[use wchar_t a default charater type when enabled (default. yes)])],
|
||||||
enable_wchar_is=$enableval,enable_wchar_is=yes)
|
enable_wchar_is=$enableval,enable_wchar_is=yes)
|
||||||
|
@ -36,7 +36,7 @@ enum ase_fio_seek_origin_t
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/* <winnt.h> typedef PVOID HANDLE; */
|
/* <winnt.h> typedef PVOID HANDLE; */
|
||||||
typedef void* aes_fio_hnd_t;
|
typedef void* ase_fio_hnd_t;
|
||||||
#else
|
#else
|
||||||
typedef int ase_fio_hnd_t;
|
typedef int ase_fio_hnd_t;
|
||||||
#endif
|
#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}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -17,10 +17,13 @@
|
|||||||
******
|
******
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_AUTO_CONFIGURED)
|
||||||
|
#include <ase/config.h>
|
||||||
|
#elif defined(_WIN32)
|
||||||
#include <ase/conf_msw.h>
|
#include <ase/conf_msw.h>
|
||||||
#elif defined(vms) || defined(__vms)
|
#elif defined(vms) || defined(__vms)
|
||||||
#include <ase/conf_vms.h>
|
#include <ase/conf_vms.h>
|
||||||
|
/*
|
||||||
#elif defined(__unix__) || defined(__unix) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__SPU__)
|
#elif defined(__unix__) || defined(__unix) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__SPU__)
|
||||||
#if !defined(__unix__)
|
#if !defined(__unix__)
|
||||||
#define __unix__
|
#define __unix__
|
||||||
@ -29,6 +32,7 @@
|
|||||||
#define __unix
|
#define __unix
|
||||||
#endif
|
#endif
|
||||||
#include <ase/config.h>
|
#include <ase/config.h>
|
||||||
|
*/
|
||||||
#else
|
#else
|
||||||
#error unsupported operating system
|
#error unsupported operating system
|
||||||
#endif
|
#endif
|
||||||
@ -90,10 +94,10 @@ typedef int ase_tri_t;
|
|||||||
* ase_ulong_t - define the largest unsigned integer type supported
|
* 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 long long ase_long_t;
|
||||||
typedef unsigned long long ase_ulong_t;
|
typedef unsigned long long ase_ulong_t;
|
||||||
#elif ASE_SIZEOF___INT64 != 0
|
#elif ASE_SIZEOF___INT64 > 0
|
||||||
typedef __int64 ase_long_t;
|
typedef __int64 ase_long_t;
|
||||||
typedef unsigned __int64 ase_ulong_t;
|
typedef unsigned __int64 ase_ulong_t;
|
||||||
#else
|
#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}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -10,21 +10,25 @@
|
|||||||
#include <ase/types.h>
|
#include <ase/types.h>
|
||||||
#include <ase/macros.h>
|
#include <ase/macros.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||||
#include <tchar.h>
|
#if defined(ASE_CHAR_IS_MCHAR)
|
||||||
#define ase_main _tmain
|
#define ase_main main
|
||||||
typedef ase_char_t ase_achar_t;
|
typedef ase_mchar_t ase_achar_t;
|
||||||
|
#else
|
||||||
|
#define ase_main wmain
|
||||||
|
typedef ase_wchar_t ase_achar_t;
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define ase_main main
|
#define ase_main main
|
||||||
typedef ase_mchar_t ase_achar_t;
|
typedef ase_mchar_t ase_achar_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]));
|
int ase_runmain (int argc, ase_achar_t* argv[], int(*mf) (int,ase_char_t*[]));
|
||||||
|
/* TODO - ase_runmain with env */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,6 @@ ase_fio_t* ase_fio_init (
|
|||||||
DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||||
DWORD creation_disposition = 0;
|
DWORD creation_disposition = 0;
|
||||||
DWORD attributes = FILE_ATTRIBUTE_NORMAL;
|
DWORD attributes = FILE_ATTRIBUTE_NORMAL;
|
||||||
DWORD file_type;
|
|
||||||
|
|
||||||
if (flags & ASE_FIO_READ) desired_access |= GENERIC_READ;
|
if (flags & ASE_FIO_READ) desired_access |= GENERIC_READ;
|
||||||
if (flags & ASE_FIO_WRITE) desired_access |= GENERIC_WRITE;
|
if (flags & ASE_FIO_WRITE) desired_access |= GENERIC_WRITE;
|
||||||
@ -105,14 +104,16 @@ ase_fio_t* ase_fio_init (
|
|||||||
creation_disposition, attributes, 0);
|
creation_disposition, attributes, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle == INVALID_HANDLE) return ASE_NULL;
|
if (handle == INVALID_HANDLE_VALUE) return ASE_NULL;
|
||||||
|
|
||||||
file_type = GetFileType(handle);
|
{
|
||||||
|
DWORD file_type = GetFileType(handle);
|
||||||
if (file_type == FILE_TYPE_UNKNOWN)
|
if (file_type == FILE_TYPE_UNKNOWN)
|
||||||
{
|
{
|
||||||
CloseHandle (handle);
|
CloseHandle (handle);
|
||||||
return ASE_NULL;
|
return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: a lot more */
|
/* TODO: a lot more */
|
||||||
#else
|
#else
|
||||||
@ -259,7 +260,7 @@ ase_ssize_t ase_fio_read (ase_fio_t* fio, void* buf, ase_size_t size)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD count;
|
DWORD count;
|
||||||
if (size > ASE_TYPE_MAX(DWORD)) size = ASE_TYPE_MAX(DWORD);
|
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;
|
return (ase_ssize_t)count;
|
||||||
#else
|
#else
|
||||||
if (size > ASE_TYPE_MAX(size_t)) size = ASE_TYPE_MAX(size_t);
|
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
|
#ifdef _WIN32
|
||||||
DWORD count;
|
DWORD count;
|
||||||
if (size > ASE_TYPE_MAX(DWORD)) size = ASE_TYPE_MAX(DWORD);
|
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;
|
return (ase_ssize_t)count;
|
||||||
#else
|
#else
|
||||||
if (size > ASE_TYPE_MAX(size_t)) size = ASE_TYPE_MAX(size_t);
|
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_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);
|
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 =
|
static ase_sio_t __sio_in =
|
||||||
{
|
{
|
||||||
ASE_NULL, /* mmgr */
|
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}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <locale.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*[]))
|
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}
|
* {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;
|
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 (n < 0 || (size_t)n >= size)
|
||||||
{
|
{
|
||||||
if (size > 0) buf[size-1] = ASE_T('\0');
|
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)
|
ASE_FILE* ase_fopen (const ase_char_t* path, const ase_char_t* mode)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(ASE_CHAR_IS_MCHAR)
|
||||||
return _tfopen (path, mode);
|
|
||||||
#elif defined(ASE_CHAR_IS_MCHAR)
|
|
||||||
return fopen (path, mode);
|
return fopen (path, mode);
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
return _wfopen (path, mode);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
char path_mb[PATH_MAX + 1];
|
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)
|
ASE_FILE* ase_popen (const ase_char_t* cmd, const ase_char_t* mode)
|
||||||
{
|
{
|
||||||
#if defined(__SPU__)
|
#if defined(ASE_CHAR_IS_MCHAR)
|
||||||
/* 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)
|
|
||||||
return popen (cmd, mode);
|
return popen (cmd, mode);
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
return _wpopen (cmd, mode);
|
||||||
#else
|
#else
|
||||||
char cmd_mb[PATH_MAX + 1];
|
char cmd_mb[PATH_MAX + 1];
|
||||||
char mode_mb[32];
|
char mode_mb[32];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user