added qse_sio_openstd().
added QSE_SED_ZEROA1 and related code
This commit is contained in:
		| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * $Id: fio.h 565 2011-09-11 02:48:21Z hyunghwan.chung $ | ||||
|  * $Id: fio.h 569 2011-09-19 06:51:02Z hyunghwan.chung $ | ||||
|  * | ||||
|     Copyright 2006-2011 Chung, Hyung-Hwan. | ||||
|     This file is part of QSE. | ||||
| @ -55,6 +55,14 @@ enum qse_fio_open_flag_t | ||||
| 	QSE_FIO_SEQUENTIAL = (1 << 27)  /* hint that access is sequential */ | ||||
| }; | ||||
|  | ||||
| enum qse_fio_std_t | ||||
| { | ||||
| 	QSE_FIO_STDIN  = 0, | ||||
| 	QSE_FIO_STDOUT = 1, | ||||
| 	QSE_FIO_STDERR = 2 | ||||
| }; | ||||
| typedef enum qse_fio_std_t qse_fio_std_t; | ||||
|  | ||||
| /* seek origin */ | ||||
| enum qse_fio_ori_t | ||||
| { | ||||
| @ -62,6 +70,8 @@ enum qse_fio_ori_t | ||||
| 	QSE_FIO_CURRENT = 1, | ||||
| 	QSE_FIO_END     = 2 | ||||
| }; | ||||
| /* file origin for seek */ | ||||
| typedef enum qse_fio_ori_t qse_fio_ori_t; | ||||
|  | ||||
| enum qse_fio_mode_t | ||||
| { | ||||
| @ -95,9 +105,6 @@ enum qse_fio_mode_t | ||||
| /* file offset */ | ||||
| typedef qse_foff_t qse_fio_off_t; | ||||
|  | ||||
| /* file origin for seek */ | ||||
| typedef enum qse_fio_ori_t qse_fio_ori_t; | ||||
|  | ||||
| typedef struct qse_fio_t qse_fio_t; | ||||
| typedef struct qse_fio_lck_t qse_fio_lck_t; | ||||
|  | ||||
| @ -143,14 +150,14 @@ qse_fio_t* qse_fio_open ( | ||||
| 	int               mode | ||||
| ); | ||||
|  | ||||
| /*** | ||||
| /** | ||||
|  * The qse_fio_close() function closes a file. | ||||
|  */ | ||||
| void qse_fio_close ( | ||||
| 	qse_fio_t* fio | ||||
| ); | ||||
|  | ||||
| /*** | ||||
| /** | ||||
|  * The qse_fio_close() function opens a file into @a fio. | ||||
|  */ | ||||
| int qse_fio_init ( | ||||
| @ -161,7 +168,7 @@ int qse_fio_init ( | ||||
| 	int               mode | ||||
| ); | ||||
|  | ||||
| /*** | ||||
| /** | ||||
|  * The qse_fio_close() function finalizes a file by closing the handle  | ||||
|  * stored in @a fio. | ||||
|  */ | ||||
| @ -169,6 +176,7 @@ void qse_fio_fini ( | ||||
| 	qse_fio_t* fio | ||||
| ); | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * The qse_fio_gethandle() function returns the native file handle. | ||||
|  */ | ||||
| @ -271,6 +279,12 @@ int qse_fio_unlock ( | ||||
| 	int            flags | ||||
| ); | ||||
|  | ||||
|  | ||||
| int qse_getstdfiohandle ( | ||||
| 	qse_fio_std_t  std, | ||||
| 	qse_fio_hnd_t* hnd | ||||
| ); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * $Id: sio.h 568 2011-09-17 15:41:26Z hyunghwan.chung $ | ||||
|  * $Id: sio.h 569 2011-09-19 06:51:02Z hyunghwan.chung $ | ||||
|  * | ||||
|     Copyright 2006-2011 Chung, Hyung-Hwan. | ||||
|     This file is part of QSE. | ||||
| @ -50,6 +50,11 @@ enum qse_sio_open_flag_t | ||||
|  | ||||
| typedef qse_fio_off_t qse_sio_pos_t; | ||||
| typedef qse_fio_hnd_t qse_sio_hnd_t; | ||||
| typedef qse_fio_std_t qse_sio_std_t; | ||||
|  | ||||
| #define QSE_SIO_STDIN  QSE_FIO_STDIN | ||||
| #define QSE_SIO_STDOUT QSE_FIO_STDOUT | ||||
| #define QSE_SIO_STDER  QSE_FIO_STDERR | ||||
|  | ||||
| /** | ||||
|  * The qse_sio_t type defines a simple text stream over a file. It also | ||||
| @ -86,6 +91,13 @@ qse_sio_t* qse_sio_open ( | ||||
| 	int               flags    /**< number OR'ed of #qse_sio_open_flag_t */ | ||||
| ); | ||||
|  | ||||
| qse_sio_t* qse_sio_openstd ( | ||||
| 	qse_mmgr_t*       mmgr,    /**< memory manager */ | ||||
| 	qse_size_t        xtnsize, /**< extension size in bytes */ | ||||
| 	qse_sio_std_t     std,     /**< standard I/O identifier */ | ||||
| 	int               flags    /**< number OR'ed of #qse_sio_open_flag_t */ | ||||
| ); | ||||
|  | ||||
| /** | ||||
|  * The qse_sio_close() function destroys a stream object. | ||||
|  */ | ||||
| @ -100,6 +112,13 @@ int qse_sio_init ( | ||||
| 	int               flags | ||||
| ); | ||||
|  | ||||
| int qse_sio_initstd ( | ||||
| 	qse_sio_t*        sio, | ||||
| 	qse_mmgr_t*       mmgr, | ||||
| 	qse_sio_std_t     std, | ||||
| 	int               flags | ||||
| ); | ||||
|  | ||||
| void qse_sio_fini ( | ||||
| 	qse_sio_t* sio | ||||
| ); | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /* | ||||
|  * $Id: sed.h 568 2011-09-17 15:41:26Z hyunghwan.chung $ | ||||
|  * $Id: sed.h 569 2011-09-19 06:51:02Z hyunghwan.chung $ | ||||
|  * | ||||
|     Copyright 2006-2011 Chung, Hyung-Hwan. | ||||
|     This file is part of QSE. | ||||
| @ -140,9 +140,10 @@ enum qse_sed_option_t | ||||
| 	QSE_SED_QUIET        = (1 << 3), /**< do not print pattern space */ | ||||
| 	QSE_SED_STRICT       = (1 << 4), /**< do strict address check */ | ||||
| 	QSE_SED_STARTSTEP    = (1 << 5), /**< allow start~step */ | ||||
| 	QSE_SED_EXTENDEDREX  = (1 << 6), /**< use extended regex */ | ||||
| 	QSE_SED_NONSTDEXTREX = (1 << 7), /**< enable non-standard extensions to regex */ | ||||
| 	QSE_SED_SAMELINE     = (1 << 8), /**< allow text on the same line as c, a, i */ | ||||
| 	QSE_SED_ZEROA1       = (1 << 6), /**< allow 0,/regex/ */ | ||||
| 	QSE_SED_SAMELINE     = (1 << 7), /**< allow text on the same line as c, a, i */ | ||||
| 	QSE_SED_EXTENDEDREX  = (1 << 8), /**< use extended regex */ | ||||
| 	QSE_SED_NONSTDEXTREX = (1 << 9)  /**< enable non-standard extensions to regex */ | ||||
| }; | ||||
| typedef enum qse_sed_option_t qse_sed_option_t; | ||||
|  | ||||
|  | ||||
| @ -105,13 +105,13 @@ int qse_sed_compstd ( | ||||
| ); | ||||
|  | ||||
| /** | ||||
|  * The qse_sed_execstd() function executes the compiled script | ||||
|  * The qse_sed_execstd() function executes a compiled script | ||||
|  * over input streams @a in and an output stream @a out. | ||||
|  * | ||||
|  * If @a in is not #QSE_NULL, it must point to a null-terminated array | ||||
|  * of standard I/O resources. if in[0] is QSE_NULL, this function | ||||
|  * returns failure, requiring at least 1 valid resource to be included | ||||
|  * in the array. | ||||
|  * of standard I/O resources. if in[0].type is QSE_SED_IOSTD_NULL, this  | ||||
|  * function returns failure, requiring at least 1 valid resource to be  | ||||
|  * included in the array. | ||||
|  * | ||||
|  * If @a in is #QSE_NULL, the standard console input is used. | ||||
|  * If @a out is #QSE_NULL, the standard console output is used. | ||||
| @ -124,6 +124,21 @@ int qse_sed_execstd ( | ||||
| 	qse_sed_iostd_t* out | ||||
| ); | ||||
|  | ||||
| /** | ||||
|  * The qse_sed_execstdfile() function executes a compiled script | ||||
|  * a single input file @a infile and a single output file @a outfile. | ||||
|  * | ||||
|  * If @a infile is #QSE_NULL, the standard console input is used. | ||||
|  * If @a outfile is #QSE_NULL, the standard console output is used. | ||||
|  * | ||||
|  * @return 0 on success, -1 on failure | ||||
|  */ | ||||
| int qse_sed_execstdfile ( | ||||
|      qse_sed_t*        sed, | ||||
| 	const qse_char_t* infile, | ||||
| 	const qse_char_t* outfile | ||||
| ); | ||||
|  | ||||
| #ifdef __cplusplus | ||||
| } | ||||
| #endif | ||||
|  | ||||
		Reference in New Issue
	
	Block a user