added QSE_FIO_TEXT to qse_fio_t
This commit is contained in:
@ -22,25 +22,30 @@
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
|
||||
#include <qse/cmn/tio.h>
|
||||
|
||||
enum qse_fio_open_flag_t
|
||||
{
|
||||
/* request qse_char_io based IO */
|
||||
QSE_FIO_TEXT = (1 << 0),
|
||||
|
||||
/* treat the file name pointer as a handle pointer */
|
||||
QSE_FIO_HANDLE = (1 << 0),
|
||||
QSE_FIO_HANDLE = (1 << 1),
|
||||
|
||||
QSE_FIO_READ = (1 << 1),
|
||||
QSE_FIO_WRITE = (1 << 2),
|
||||
QSE_FIO_APPEND = (1 << 3),
|
||||
QSE_FIO_READ = (1 << 8),
|
||||
QSE_FIO_WRITE = (1 << 9),
|
||||
QSE_FIO_APPEND = (1 << 10),
|
||||
|
||||
QSE_FIO_CREATE = (1 << 4),
|
||||
QSE_FIO_TRUNCATE = (1 << 5),
|
||||
QSE_FIO_EXCLUSIVE = (1 << 6),
|
||||
QSE_FIO_SYNC = (1 << 7),
|
||||
QSE_FIO_CREATE = (1 << 11),
|
||||
QSE_FIO_TRUNCATE = (1 << 12),
|
||||
QSE_FIO_EXCLUSIVE = (1 << 13),
|
||||
QSE_FIO_SYNC = (1 << 14),
|
||||
|
||||
/* for WIN32 only. harmless(no effect) when used on other platforms */
|
||||
QSE_FIO_NOSHRD = (1 << 16),
|
||||
QSE_FIO_NOSHWR = (1 << 17),
|
||||
QSE_FIO_RANDOM = (1 << 18), /* hint that access be random */
|
||||
QSE_FIO_SEQUENTIAL = (1 << 19) /* hint that access is sequential */
|
||||
QSE_FIO_NOSHRD = (1 << 24),
|
||||
QSE_FIO_NOSHWR = (1 << 25),
|
||||
QSE_FIO_RANDOM = (1 << 26), /* hint that access be random */
|
||||
QSE_FIO_SEQUENTIAL = (1 << 27) /* hint that access is sequential */
|
||||
};
|
||||
|
||||
/* seek origin */
|
||||
@ -68,10 +73,10 @@ enum qse_fio_mode_t
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
/* <winnt.h> => typedef PVOID HANDLE; */
|
||||
typedef void* qse_fio_hnd_t;
|
||||
/* <winnt.h> => typedef PVOID HANDLE; */
|
||||
typedef void* qse_fio_hnd_t;
|
||||
#else
|
||||
typedef int qse_fio_hnd_t;
|
||||
typedef int qse_fio_hnd_t;
|
||||
#endif
|
||||
|
||||
/* file offset */
|
||||
@ -83,8 +88,9 @@ typedef struct qse_fio_lck_t qse_fio_lck_t;
|
||||
|
||||
struct qse_fio_t
|
||||
{
|
||||
qse_mmgr_t* mmgr;
|
||||
QSE_DEFINE_STD_FIELDS (fio)
|
||||
qse_fio_hnd_t handle;
|
||||
qse_tio_t* tio;
|
||||
};
|
||||
|
||||
struct qse_fio_lck_t
|
||||
@ -102,6 +108,8 @@ struct qse_fio_lck_t
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
QSE_DEFINE_STD_FUNCTIONS (fio)
|
||||
|
||||
/****f* qse.fio/qse_fio_open
|
||||
* NAME
|
||||
* qse_fio_open - open a file
|
||||
@ -144,9 +152,15 @@ void qse_fio_fini (
|
||||
qse_fio_t* fio
|
||||
);
|
||||
|
||||
/****f* qse.cmn.fio/qse_fio_gethandle
|
||||
* NAME
|
||||
* qse_fio_gethandle - get the native file handle
|
||||
* SYNOPSIS
|
||||
*/
|
||||
qse_fio_hnd_t qse_fio_gethandle (
|
||||
qse_fio_t* fio
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* qse.cmn.fio/qse_fio_sethandle
|
||||
* NAME
|
||||
@ -174,17 +188,45 @@ int qse_fio_truncate (
|
||||
qse_fio_off_t size
|
||||
);
|
||||
|
||||
/****f* qse.cmn.fio/qse_fio_read
|
||||
* NAME
|
||||
* qse_fio_read - read data
|
||||
* SYNOPSIS
|
||||
*/
|
||||
qse_ssize_t qse_fio_read (
|
||||
qse_fio_t* fio,
|
||||
void* buf,
|
||||
qse_size_t size
|
||||
qse_fio_t* fio,
|
||||
void* buf,
|
||||
qse_size_t size
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* qse.cmn.fio/qse_fio_write
|
||||
* NAME
|
||||
* qse_fio_write - write data
|
||||
* SYNOPSIS
|
||||
*/
|
||||
qse_ssize_t qse_fio_write (
|
||||
qse_fio_t* fio,
|
||||
const void* buf,
|
||||
qse_size_t size
|
||||
qse_fio_t* fio,
|
||||
const void* data,
|
||||
qse_size_t size
|
||||
);
|
||||
/******/
|
||||
|
||||
|
||||
/****f* qse.cmn.fio/qse_fio_flush
|
||||
* NAME
|
||||
* qse_fio_flush - flush data
|
||||
*
|
||||
* DESCRIPTION
|
||||
* The qse_fio_flush() function is useful if QSE_FIO_TEXT is used in
|
||||
* qse_fio_open ().
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
qse_ssize_t qse_fio_flush (
|
||||
qse_fio_t* fio
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* qse.cmn.fio/qse_fio_chmod
|
||||
* NAME
|
||||
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
* $Id: sysapi.h,v 1.56 2006/03/21 16:15:16 bacon Ease $
|
||||
*
|
||||
Copyright 2006-2008 Chung, Hyung-Hwan.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _QSE_CMN_IO_H_
|
||||
#define _QSE_CMN_IO_H_
|
||||
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
|
||||
/* flags for qse_open */
|
||||
enum
|
||||
{
|
||||
QSE_OPEN_READ = (1 << 0),
|
||||
QSE_OPEN_WRITE = (1 << 1),
|
||||
QSE_OPEN_CREATE = (1 << 2),
|
||||
QSE_OPEN_TRUNCATE = (1 << 3),
|
||||
QSE_OPEN_EXCLUSIVE = (1 << 4),
|
||||
QSE_OPEN_APPEND = (1 << 5),
|
||||
QSE_OPEN_NONBLOCK = (1 << 6)
|
||||
};
|
||||
|
||||
/* origin for qse_seek */
|
||||
enum
|
||||
{
|
||||
QSE_SEEK_BEGIN = 0,
|
||||
QSE_SEEK_CURRENT = 1,
|
||||
QSE_SEEK_END = 2
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
qse_hnd_t qse_open (
|
||||
const qse_char_t* path,
|
||||
int flag,
|
||||
...
|
||||
);
|
||||
|
||||
int qse_close (
|
||||
qse_hnd_t handle
|
||||
);
|
||||
|
||||
qse_ssize_t qse_read (
|
||||
qse_hnd_t handle,
|
||||
void* buf,
|
||||
qse_size_t sz
|
||||
);
|
||||
|
||||
qse_ssize_t qse_write (
|
||||
qse_hnd_t handle,
|
||||
const void* data,
|
||||
qse_size_t sz
|
||||
);
|
||||
|
||||
qse_off_t qse_seek (
|
||||
qse_hnd_t handle,
|
||||
qse_off_t offset,
|
||||
int origin
|
||||
);
|
||||
|
||||
/*
|
||||
int qse_hstat (qse_hnd_t handle, qse_stat_t* buf);
|
||||
int qse_hchmod (qse_hnd_t handle, qse_mode_t mode);
|
||||
*/
|
||||
int qse_htruncate (qse_hnd_t handle, qse_off_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -27,26 +27,27 @@
|
||||
|
||||
enum qse_pcp_open_flag_t
|
||||
{
|
||||
QSE_PCP_WRITEIN = (1 << 0),
|
||||
QSE_PCP_READOUT = (1 << 1),
|
||||
QSE_PCP_READERR = (1 << 2),
|
||||
|
||||
QSE_PCP_ERRTOOUT = (1 << 3),
|
||||
QSE_PCP_OUTTOERR = (1 << 4),
|
||||
|
||||
QSE_PCP_INTONUL = (1 << 5),
|
||||
QSE_PCP_ERRTONUL = (1 << 6),
|
||||
QSE_PCP_OUTTONUL = (1 << 7),
|
||||
|
||||
QSE_PCP_DROPIN = (1 << 8),
|
||||
QSE_PCP_DROPOUT = (1 << 9),
|
||||
QSE_PCP_DROPERR = (1 << 10),
|
||||
|
||||
/* invoke the command through a default system shell */
|
||||
QSE_PCP_SHELL = (1 << 11),
|
||||
|
||||
/* enable ase_char_t based IO */
|
||||
QSE_PCP_TEXT = (1 << 12)
|
||||
QSE_PCP_TEXT = (1 << 0),
|
||||
|
||||
/* invoke the command through a system shell
|
||||
* (/bin/sh on *nix, command.com on windows) */
|
||||
QSE_PCP_SHELL = (1 << 1),
|
||||
|
||||
QSE_PCP_WRITEIN = (1 << 8),
|
||||
QSE_PCP_READOUT = (1 << 9),
|
||||
QSE_PCP_READERR = (1 << 10),
|
||||
|
||||
QSE_PCP_ERRTOOUT = (1 << 11),
|
||||
QSE_PCP_OUTTOERR = (1 << 12),
|
||||
|
||||
QSE_PCP_INTONUL = (1 << 13),
|
||||
QSE_PCP_ERRTONUL = (1 << 14),
|
||||
QSE_PCP_OUTTONUL = (1 << 15),
|
||||
|
||||
QSE_PCP_DROPIN = (1 << 16),
|
||||
QSE_PCP_DROPOUT = (1 << 17),
|
||||
QSE_PCP_DROPERR = (1 << 18)
|
||||
};
|
||||
|
||||
enum qse_pcp_wait_flag_t
|
||||
|
@ -30,6 +30,9 @@
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define to 1 if you have the `exp' function. */
|
||||
#undef HAVE_EXP
|
||||
|
||||
|
@ -73,10 +73,13 @@
|
||||
|
||||
#define QSE_ABS(x) ((x) < 0? -(x): (x))
|
||||
|
||||
#define QSE_LOOP_CONTINUE(id) goto __loop_ ## id ## _begin__;
|
||||
#define QSE_LOOP_BREAK(id) goto __loop_ ## id ## _end__;
|
||||
#define QSE_ERR_THROW(id) goto __err_ ## id
|
||||
#define QSE_ERR_CATCH(id) while(0) __err_ ## id:
|
||||
|
||||
#define QSE_LOOP_CONTINUE(id) goto __loop_ ## id ## _begin__
|
||||
#define QSE_LOOP_BREAK(id) goto __loop_ ## id ## _end__
|
||||
#define QSE_LOOP_BEGIN(id) __loop_ ## id ## _begin__: {
|
||||
#define QSE_LOOP_END(id) QSE_LOOP_CONTINUE(id) } __loop_ ## id ## _end__:;
|
||||
#define QSE_LOOP_END(id) QSE_LOOP_CONTINUE(id) } __loop_ ## id ## _end__:
|
||||
|
||||
#define QSE_REPEAT(n,blk) \
|
||||
do { \
|
||||
|
Reference in New Issue
Block a user