interim commit

- fixed wrong qse_pio_hid_t definition
This commit is contained in:
hyung-hwan 2009-01-09 04:48:46 +00:00
parent 86a1d88307
commit 567eaa483b
5 changed files with 118 additions and 130 deletions

View File

@ -504,13 +504,13 @@ typedef struct qse_awk_val_ref_t qse_awk_val_ref_t;
typedef struct qse_awk_val_chunk_t qse_awk_val_chunk_t; typedef struct qse_awk_val_chunk_t qse_awk_val_chunk_t;
#if QSE_SIZEOF_INT == 2 #if QSE_SIZEOF_INT == 2
#define QSE_AWK_VAL_HDR \ # define QSE_AWK_VAL_HDR \
unsigned int type: 3; \ unsigned int type: 3; \
unsigned int ref: 13 unsigned int ref: 13
#else #else
#define QSE_AWK_VAL_HDR \ # define QSE_AWK_VAL_HDR \
unsigned int type: 3; \ unsigned int type: 3; \
unsigned int ref: 29 unsigned int ref: 29
#endif #endif
#define QSE_AWK_VAL_TYPE(x) ((x)->type) #define QSE_AWK_VAL_TYPE(x) ((x)->type)

View File

@ -11,9 +11,9 @@
#ifdef __cplusplus #ifdef __cplusplus
/*#define QSE_NULL ((qse_uint_t)0)*/ /*#define QSE_NULL ((qse_uint_t)0)*/
#define QSE_NULL (0) # define QSE_NULL (0)
#else #else
#define QSE_NULL ((void*)0) # define QSE_NULL ((void*)0)
#endif #endif
/****d* ase/QSE_TRUE,QSE_FALSE /****d* ase/QSE_TRUE,QSE_FALSE
@ -108,64 +108,50 @@
#define QSE_WT(txt) (L ## txt) #define QSE_WT(txt) (L ## txt)
#if defined(QSE_CHAR_IS_MCHAR) #if defined(QSE_CHAR_IS_MCHAR)
#define QSE_Q(val) QSE_MQ(val) # define QSE_Q(val) QSE_MQ(val)
#define QSE_C(ch) QSE_MC(ch) # define QSE_C(ch) QSE_MC(ch)
#define QSE_S(str) QSE_MS(str) # define QSE_S(str) QSE_MS(str)
#define QSE_T(txt) QSE_MT(txt) # define QSE_T(txt) QSE_MT(txt)
#else #else
#define QSE_Q(val) QSE_WQ(val) # define QSE_Q(val) QSE_WQ(val)
#define QSE_C(ch) QSE_WC(ch) # define QSE_C(ch) QSE_WC(ch)
#define QSE_S(str) QSE_WS(str) # define QSE_S(str) QSE_WS(str)
#define QSE_T(txt) QSE_WT(txt) # define QSE_T(txt) QSE_WT(txt)
#endif #endif
#if defined(__GNUC__) #if defined(__GNUC__)
#define QSE_BEGIN_PACKED_STRUCT(x) struct x { # define QSE_BEGIN_PACKED_STRUCT(x) struct x {
#define QSE_END_PACKED_STRUCT() } __attribute__((packed)); # define QSE_END_PACKED_STRUCT() } __attribute__((packed));
#else #else
#define QSE_BEGIN_PACKED_STRUCT(x) struct x { # define QSE_BEGIN_PACKED_STRUCT(x) struct x {
#define QSE_END_PACKED_STRUCT() }; # define QSE_END_PACKED_STRUCT() };
#endif #endif
#ifdef NDEBUG #ifdef NDEBUG
#define QSE_ASSERT(expr) ((void)0) # define QSE_ASSERT(expr) ((void)0)
#define QSE_ASSERTX(expr,desc) ((void)0) # define QSE_ASSERTX(expr,desc) ((void)0)
#else #else
#ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {
#endif # endif
void qse_assert_failed ( void qse_assert_failed (
const qse_char_t* expr, const qse_char_t* desc, const qse_char_t* expr, const qse_char_t* desc,
const qse_char_t* file, qse_size_t line); const qse_char_t* file, qse_size_t line);
#ifdef __cplusplus # ifdef __cplusplus
} }
#endif # endif
#define QSE_ASSERT(expr) (void)((expr) || \ # define QSE_ASSERT(expr) (void)((expr) || \
(qse_assert_failed (QSE_T(#expr), QSE_NULL, QSE_T(__FILE__), __LINE__), 0)) (qse_assert_failed (QSE_T(#expr), QSE_NULL, QSE_T(__FILE__), __LINE__), 0))
#define QSE_ASSERTX(expr,desc) (void)((expr) || \ # define QSE_ASSERTX(expr,desc) (void)((expr) || \
(qse_assert_failed (QSE_T(#expr), QSE_T(desc), QSE_T(__FILE__), __LINE__), 0)) (qse_assert_failed (QSE_T(#expr), QSE_T(desc), QSE_T(__FILE__), __LINE__), 0))
#endif #endif
/****d* ase/QSE_FNS
* NAME
* QSE_FNS - define an ASE function name space
* DESCRIPTION
* The QSE_FNS macro enables you to simulate a function name space for the
* types designed properly.
* EXAMPLE
* QSE_FNS (awk, AWK);
* qse_awk_t* awk = AWK.open (....);
* AWK.close (awk);
******
*/
#define QSE_NS(type,name) struct qse_ns_##type##_t name = qse_ns_##type##_d
#ifdef __cplusplus #ifdef __cplusplus
#define QSE_BEGIN_NAMESPACE(x) namespace x { # define QSE_BEGIN_NAMESPACE(x) namespace x {
#define QSE_END_NAMESPACE(x) } # define QSE_END_NAMESPACE(x) }
#define QSE_BEGIN_NAMESPACE2(x,y) namespace x { namespace y { # define QSE_BEGIN_NAMESPACE2(x,y) namespace x { namespace y {
#define QSE_END_NAMESPACE2(y,x) }} # define QSE_END_NAMESPACE2(y,x) }}
#endif #endif
#endif #endif

View File

@ -21,23 +21,13 @@
/*#define QSE_HAVE_CONFIG_H*/ /*#define QSE_HAVE_CONFIG_H*/
#if defined(QSE_HAVE_CONFIG_H) #if defined(QSE_HAVE_CONFIG_H)
#include <qse/config.h> # include <qse/config.h>
#elif defined(_WIN32) #elif defined(_WIN32)
#include <qse/conf_msw.h> # include <qse/conf_msw.h>
#elif defined(vms) || defined(__vms) #elif defined(vms) || defined(__vms)
#include <qse/conf_vms.h> # include <qse/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__
#endif
#if !defined(__unix)
#define __unix
#endif
#include <qse/config.h>
*/
#else #else
#error unsupported operating system # error unsupported operating system
#endif #endif
/****t* ase/qse_bool_t /****t* ase/qse_bool_t
@ -66,7 +56,8 @@ typedef int qse_tri_t;
* qse_uint_t - define an unsigned integer type as large as a pointer type * qse_uint_t - define an unsigned integer type as large as a pointer type
****** ******
*/ */
#if (defined(hpux) || defined(__hpux) || defined(__hpux__)) && (QSE_SIZEOF_VOID_P == QSE_SIZEOF_LONG) #if (defined(hpux) || defined(__hpux) || defined(__hpux__)) && \
(QSE_SIZEOF_VOID_P == QSE_SIZEOF_LONG)
typedef long qse_int_t; typedef long qse_int_t;
typedef unsigned long qse_uint_t; typedef unsigned long qse_uint_t;
#elif defined(__SPU__) && (QSE_SIZEOF_VOID_P == QSE_SIZEOF_LONG) #elif defined(__SPU__) && (QSE_SIZEOF_VOID_P == QSE_SIZEOF_LONG)
@ -88,7 +79,7 @@ typedef int qse_tri_t;
typedef __int64 qse_int_t; typedef __int64 qse_int_t;
typedef unsigned __int64 qse_uint_t; typedef unsigned __int64 qse_uint_t;
#else #else
#error unsupported pointer size # error unsupported pointer size
#endif #endif
/****t* ase/qse_long_t,qse_ulong_t /****t* ase/qse_long_t,qse_ulong_t
@ -160,52 +151,52 @@ typedef int qse_tri_t;
****** ******
*/ */
#if QSE_SIZEOF_INT == 8 #if QSE_SIZEOF_INT == 8
#define QSE_HAVE_INT64_T # define QSE_HAVE_INT64_T
#define QSE_HAVE_UINT64_T # define QSE_HAVE_UINT64_T
typedef int qse_int64_t; typedef int qse_int64_t;
typedef unsigned int qse_uint64_t; typedef unsigned int qse_uint64_t;
#elif QSE_SIZEOF_LONG == 8 #elif QSE_SIZEOF_LONG == 8
#define QSE_HAVE_INT64_T # define QSE_HAVE_INT64_T
#define QSE_HAVE_UINT64_T # define QSE_HAVE_UINT64_T
typedef long qse_int64_t; typedef long qse_int64_t;
typedef unsigned long qse_uint64_t; typedef unsigned long qse_uint64_t;
#elif QSE_SIZEOF_LONG_LONG == 8 #elif QSE_SIZEOF_LONG_LONG == 8
#define QSE_HAVE_INT64_T # define QSE_HAVE_INT64_T
#define QSE_HAVE_UINT64_T # define QSE_HAVE_UINT64_T
typedef long long qse_int64_t; typedef long long qse_int64_t;
typedef unsigned long long qse_uint64_t; typedef unsigned long long qse_uint64_t;
#elif QSE_SIZEOF___INT64 == 8 #elif QSE_SIZEOF___INT64 == 8
#define QSE_HAVE_INT64_T # define QSE_HAVE_INT64_T
#define QSE_HAVE_UINT64_T # define QSE_HAVE_UINT64_T
typedef __int64 qse_int64_t; typedef __int64 qse_int64_t;
typedef unsigned __int64 qse_uint64_t; typedef unsigned __int64 qse_uint64_t;
#endif #endif
#if QSE_SIZEOF_INT == 16 #if QSE_SIZEOF_INT == 16
#define QSE_HAVE_INT128_T # define QSE_HAVE_INT128_T
#define QSE_HAVE_UINT128_T # define QSE_HAVE_UINT128_T
typedef int qse_int128_t; typedef int qse_int128_t;
typedef unsigned int qse_uint128_t; typedef unsigned int qse_uint128_t;
#elif QSE_SIZEOF_LONG == 16 #elif QSE_SIZEOF_LONG == 16
#define QSE_HAVE_INT128_T # define QSE_HAVE_INT128_T
#define QSE_HAVE_UINT128_T # define QSE_HAVE_UINT128_T
typedef long qse_int128_t; typedef long qse_int128_t;
typedef unsigned long qse_uint128_t; typedef unsigned long qse_uint128_t;
#elif QSE_SIZEOF_LONG_LONG == 16 #elif QSE_SIZEOF_LONG_LONG == 16
#define QSE_HAVE_INT128_T # define QSE_HAVE_INT128_T
#define QSE_HAVE_UINT128_T # define QSE_HAVE_UINT128_T
typedef long long qse_int128_t; typedef long long qse_int128_t;
typedef unsigned long long qse_uint128_t; typedef unsigned long long qse_uint128_t;
#elif QSE_SIZEOF___INT128 == 16 #elif QSE_SIZEOF___INT128 == 16
#define QSE_HAVE_INT128_T # define QSE_HAVE_INT128_T
#define QSE_HAVE_UINT128_T # define QSE_HAVE_UINT128_T
typedef __int128 qse_int128_t; typedef __int128 qse_int128_t;
typedef unsigned __int128 qse_uint128_t; typedef unsigned __int128 qse_uint128_t;
#endif #endif
/****t* ase/qse_byte_t /****t* ase/qse_byte_t
* NAME * NAME
* qse_word_t - define a byte type * qse_byte_t - define a byte type
****** ******
*/ */
typedef qse_uint8_t qse_byte_t; typedef qse_uint8_t qse_byte_t;
@ -216,9 +207,9 @@ typedef qse_uint8_t qse_byte_t;
****** ******
*/ */
#ifdef __SIZE_TYPE__ #ifdef __SIZE_TYPE__
typedef __SIZE_TYPE__ qse_size_t; typedef __SIZE_TYPE__ qse_size_t;
#else #else
typedef qse_uint_t qse_size_t; typedef qse_uint_t qse_size_t;
#endif #endif
/****t* ase/qse_ssize_t /****t* ase/qse_ssize_t
@ -239,13 +230,13 @@ typedef qse_uint_t qse_word_t;
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
/* TODO: check if the support for long double is complete. /* TODO: check if the support for long double is complete.
* if so, use long double for qse_real_t */ * if so, use long double for qse_real_t */
#define QSE_SIZEOF_REAL QSE_SIZEOF_DOUBLE # define QSE_SIZEOF_REAL QSE_SIZEOF_DOUBLE
typedef double qse_real_t; typedef double qse_real_t;
#elif QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE #elif QSE_SIZEOF_LONG_DOUBLE > QSE_SIZEOF_DOUBLE
#define QSE_SIZEOF_REAL QSE_SIZEOF_LONG_DOUBLE # define QSE_SIZEOF_REAL QSE_SIZEOF_LONG_DOUBLE
typedef long double qse_real_t; typedef long double qse_real_t;
#else #else
#define QSE_SIZEOF_REAL QSE_SIZEOF_DOUBLE # define QSE_SIZEOF_REAL QSE_SIZEOF_DOUBLE
typedef double qse_real_t; typedef double qse_real_t;
#endif #endif
@ -264,7 +255,9 @@ typedef int qse_mcint_t;
* qse_wcint_t - define a type that can hold qse_wchar_t and QSE_WCHAR_EOF * qse_wcint_t - define a type that can hold qse_wchar_t and QSE_WCHAR_EOF
****** ******
*/ */
#if defined(__cplusplus) && (!defined(_MSC_VER) || (defined(_MSC_VER)&&defined(_NATIVE_WCHAR_T_DEFINED))) #if defined(__cplusplus) && \
(!defined(_MSC_VER) || \
(defined(_MSC_VER) && defined(_NATIVE_WCHAR_T_DEFINED)))
/* C++ */ /* C++ */
typedef wchar_t qse_wchar_t; typedef wchar_t qse_wchar_t;
@ -278,41 +271,41 @@ typedef int qse_mcint_t;
typedef unsigned short qse_wchar_t; typedef unsigned short qse_wchar_t;
typedef unsigned short qse_wcint_t; typedef unsigned short qse_wcint_t;
#elif (QSE_SIZEOF_WCHAR_T == 4) #elif (QSE_SIZEOF_WCHAR_T == 4)
#if defined(vms) || defined(__vms) # if defined(vms) || defined(__vms)
typedef unsigned int qse_wchar_t; typedef unsigned int qse_wchar_t;
typedef int qse_wcint_t; typedef int qse_wcint_t;
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) # elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
typedef int qse_wchar_t; typedef int qse_wchar_t;
typedef int qse_wcint_t; typedef int qse_wcint_t;
#elif (defined(sun) || defined(__sun) || defined(__linux)) # elif (defined(sun) || defined(__sun) || defined(__linux))
#if defined(_LP64) # if defined(_LP64)
typedef int qse_wchar_t; typedef int qse_wchar_t;
typedef int qse_wcint_t; typedef int qse_wcint_t;
#else # else
typedef long qse_wchar_t; typedef long qse_wchar_t;
typedef long qse_wcint_t; typedef long qse_wcint_t;
#endif # endif
#elif defined(__APPLE__) && defined(__MACH__) # elif defined(__APPLE__) && defined(__MACH__)
typedef int qse_wchar_t; typedef int qse_wchar_t;
typedef int qse_wcint_t; typedef int qse_wcint_t;
#elif defined(hpux) || defined(__hpux) || defined(__hpux__) # elif defined(hpux) || defined(__hpux) || defined(__hpux__)
#if defined(__HP_cc) || defined(__HP_aCC) # if defined(__HP_cc) || defined(__HP_aCC)
typedef unsigned int qse_wchar_t; typedef unsigned int qse_wchar_t;
#else # else
typedef int qse_wchar_t; typedef int qse_wchar_t;
#endif # endif
typedef int qse_wcint_t; typedef int qse_wcint_t;
#elif QSE_SIZEOF_LONG == 4 # elif QSE_SIZEOF_LONG == 4
typedef long qse_wchar_t; typedef long qse_wchar_t;
typedef long qse_wcint_t; typedef long qse_wcint_t;
#elif QSE_SIZEOF_INT == 4 # elif QSE_SIZEOF_INT == 4
typedef int qse_wchar_t; typedef int qse_wchar_t;
typedef int qse_wcint_t; typedef int qse_wcint_t;
#else # else
#error no supported data type for wchar_t # error no supported data type for wchar_t
#endif # endif
#else #else
#error unsupported size of wchar_t # error unsupported size of wchar_t
#endif #endif
/****t* ase/qse_char_t,qse_cint_t /****t* ase/qse_char_t,qse_cint_t
@ -322,34 +315,34 @@ typedef int qse_mcint_t;
****** ******
*/ */
#if defined(_WIN32) && (defined(UNICODE)||defined(_UNICODE)) #if defined(_WIN32) && (defined(UNICODE)||defined(_UNICODE))
#define QSE_CHAR_IS_WCHAR # define QSE_CHAR_IS_WCHAR
typedef qse_wchar_t qse_char_t; typedef qse_wchar_t qse_char_t;
typedef qse_wcint_t qse_cint_t; typedef qse_wcint_t qse_cint_t;
#else #else
#if defined(QSE_CHAR_IS_MCHAR) # if defined(QSE_CHAR_IS_MCHAR)
typedef qse_mchar_t qse_char_t; typedef qse_mchar_t qse_char_t;
typedef qse_mcint_t qse_cint_t; typedef qse_mcint_t qse_cint_t;
#elif defined(QSE_CHAR_IS_WCHAR) # elif defined(QSE_CHAR_IS_WCHAR)
typedef qse_wchar_t qse_char_t; typedef qse_wchar_t qse_char_t;
typedef qse_wcint_t qse_cint_t; typedef qse_wcint_t qse_cint_t;
#elif defined(_MBCS) # elif defined(_MBCS)
#define QSE_CHAR_IS_MCHAR # define QSE_CHAR_IS_MCHAR
typedef qse_mchar_t qse_char_t; typedef qse_mchar_t qse_char_t;
typedef qse_mcint_t qse_cint_t; typedef qse_mcint_t qse_cint_t;
#else # else
#define QSE_CHAR_IS_WCHAR # define QSE_CHAR_IS_WCHAR
typedef qse_wchar_t qse_char_t; typedef qse_wchar_t qse_char_t;
typedef qse_wcint_t qse_cint_t; typedef qse_wcint_t qse_cint_t;
#endif # endif
#endif #endif
#if defined(QSE_CHAR_IS_WCHAR) && defined(_WIN32) #if defined(QSE_CHAR_IS_WCHAR) && defined(_WIN32)
#ifndef UNICODE # ifndef UNICODE
#define UNICODE # define UNICODE
#endif # endif
#ifndef _UNICODE # ifndef _UNICODE
#define _UNICODE # define _UNICODE
#endif # endif
#endif #endif
typedef struct qse_xstr_t qse_xstr_t; typedef struct qse_xstr_t qse_xstr_t;
@ -366,7 +359,7 @@ typedef struct qse_ccls_t qse_ccls_t;
struct qse_xstr_t struct qse_xstr_t
{ {
qse_char_t* ptr; /* this is not a const pointer */ qse_char_t* ptr; /* this is not a const pointer */
qse_size_t len; qse_size_t len; /* the number of characters */
}; };
/******/ /******/
@ -379,7 +372,7 @@ struct qse_xstr_t
struct qse_cstr_t struct qse_cstr_t
{ {
const qse_char_t* ptr; /* this is a const pointer */ const qse_char_t* ptr; /* this is a const pointer */
qse_size_t len; qse_size_t len; /* the number of characters */
}; };
/******/ /******/
@ -400,7 +393,7 @@ struct qse_mmgr_t
/****t* ase/qse_ccls_type_t /****t* ase/qse_ccls_type_t
* NAME * NAME
* qse_ccls_type_t - define types of character class * qse_ccls_type_t - define character class types
* *
* SYNOPSIS * SYNOPSIS
*/ */

View File

@ -20,12 +20,12 @@
#include "mem.h" #include "mem.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> # include <windows.h>
#include <tchar.h> # include <tchar.h>
#else #else
#include "syscall.h" # include "syscall.h"
#include <fcntl.h> # include <fcntl.h>
#include <errno.h> # include <errno.h>
#endif #endif
qse_pio_t* qse_pio_open ( qse_pio_t* qse_pio_open (
@ -174,6 +174,7 @@ qse_pio_t* qse_pio_init (
if (flags & QSE_PIO_SHELL) if (flags & QSE_PIO_SHELL)
{ {
const qse_mchar_t* mcmd; const qse_mchar_t* mcmd;
qse_mchar_t* argv[4];
#ifdef QSE_CHAR_IS_MCHAR #ifdef QSE_CHAR_IS_MCHAR
mcmd = cmd; mcmd = cmd;
@ -204,7 +205,16 @@ qse_pio_t* qse_pio_init (
n = qse_wcstombs (cmd, mcmd, &mn); n = qse_wcstombs (cmd, mcmd, &mn);
execl ("/bin/sh", "sh", "-c", mcmd, QSE_NULL); argv[0] = QSE_MT("/bin/sh");
argv[1] = QSE_MT("-c");
argv[2] = mcmd;
argv[3] = QSE_NULL;
/* TODO: */
{
extern char** environ;
QSE_EXECVE (QSE_MT("/bin/sh"), argv, environ);
}
} }
else else
{ {

View File

@ -73,7 +73,6 @@ static int test2 (void)
{ {
qse_byte_t buf[128]; qse_byte_t buf[128];
/*qse_pio_canread (pio, QSE_PIO_ERR, 1000)*/
qse_ssize_t n = qse_pio_read (pio, buf, sizeof(buf), QSE_PIO_ERR); qse_ssize_t n = qse_pio_read (pio, buf, sizeof(buf), QSE_PIO_ERR);
if (n == 0) break; if (n == 0) break;
if (n < 0) if (n < 0)