fixed bugs and added more features.
- fixed a bug in qse_sed_exec() to return success on flush() error - added Sed::setError() - completed a sample program sed03.cpp
This commit is contained in:
@ -38,14 +38,18 @@ public:
|
||||
typedef qse_char_t char_t;
|
||||
/** data type that can hold any character or an end-of-file value */
|
||||
typedef qse_cint_t cint_t;
|
||||
/** represents an unsigned integer number of the same size as void* */
|
||||
/** redefines an unsigned integer number of the same size as void* */
|
||||
typedef qse_size_t size_t;
|
||||
/** signed version of size_t */
|
||||
typedef qse_ssize_t ssize_t;
|
||||
/** represents an integer */
|
||||
/** redefines an integer */
|
||||
typedef qse_long_t long_t;
|
||||
/** represents a floating-point number */
|
||||
/** redefines a floating-point number */
|
||||
typedef qse_real_t real_t;
|
||||
/** redefines a structure of a constant character pointer and length */
|
||||
typedef qse_cstr_t cstr_t;
|
||||
/** redefines a structure of a character pointer and length */
|
||||
typedef qse_xstr_t xstr_t;
|
||||
};
|
||||
|
||||
/////////////////////////////////
|
||||
|
@ -143,6 +143,15 @@ public:
|
||||
*/
|
||||
size_t getConsoleLine () throw ();
|
||||
|
||||
/**
|
||||
* The setError() function sets information on an error occurred.
|
||||
*/
|
||||
void setError (
|
||||
errnum_t err, ///< an error number
|
||||
size_t lin = 0, ///< a line number
|
||||
const cstr_t* args = QSE_NULL ///< strings for formatting an error message
|
||||
);
|
||||
|
||||
/**
|
||||
* The setConsoleLine() function changes the current line
|
||||
* number from an input console.
|
||||
|
@ -21,13 +21,6 @@
|
||||
|
||||
#include <qse/sed/Sed.hpp>
|
||||
|
||||
/** @file
|
||||
* A standard stream editor
|
||||
*
|
||||
* @example sed02.cpp
|
||||
* The example shows a simple usage of the StdSed class.
|
||||
*/
|
||||
|
||||
/////////////////////////////////
|
||||
QSE_BEGIN_NAMESPACE(QSE)
|
||||
/////////////////////////////////
|
||||
@ -35,15 +28,13 @@ QSE_BEGIN_NAMESPACE(QSE)
|
||||
/**
|
||||
* The StdSed class inherits the Sed class and implements the standard
|
||||
* IO handlers and memory manager for easier use.
|
||||
*
|
||||
*/
|
||||
class StdSed: public Sed
|
||||
{
|
||||
protected:
|
||||
/** allocate a memory chunk */
|
||||
void* allocMem (qse_size_t n) throw ();
|
||||
/** resize a memory chunk */
|
||||
void* reallocMem (void* ptr, qse_size_t n) throw ();
|
||||
/** free a memory chunk */
|
||||
void freeMem (void* ptr) throw ();
|
||||
|
||||
int openConsole (Console& io);
|
||||
@ -57,6 +48,16 @@ protected:
|
||||
ssize_t writeFile (File& io, const char_t* data, size_t len);
|
||||
};
|
||||
|
||||
/**
|
||||
* @example sed02.cpp
|
||||
* The example shows how to use the QSE::StdSed class to write a simple stream
|
||||
* editor that reads from a standard input and writes to a standard output.
|
||||
*
|
||||
* @example sed03.cpp
|
||||
* The example shows how to extend the QSE::StdSed class to read from and
|
||||
* write to a string.
|
||||
*/
|
||||
|
||||
/////////////////////////////////
|
||||
QSE_END_NAMESPACE(QSE)
|
||||
/////////////////////////////////
|
||||
|
@ -1,7 +1,19 @@
|
||||
/*
|
||||
* $Id: main.h 463 2008-12-09 06:52:03Z baconevi $
|
||||
* $Id$
|
||||
*
|
||||
* {License}
|
||||
Copyright 2006-2009 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_UTL_MAIN_H_
|
||||
@ -10,6 +22,16 @@
|
||||
#include <qse/types.h>
|
||||
#include <qse/macros.h>
|
||||
|
||||
/** @file
|
||||
* This file includes a macro and a function to help users to write a
|
||||
* cross-platform main function.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The #qse_main macro defines a main function wrapper for an underlying
|
||||
* platform. Combined with the qse_runmain() function, it provides a consistant
|
||||
* view to the main function.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
||||
# if defined(QSE_CHAR_IS_MCHAR)
|
||||
# define qse_main main
|
||||
@ -27,6 +49,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The qse_runmain() function helps to invoke a main function independent of
|
||||
* the character mode configured for the library.
|
||||
*/
|
||||
int qse_runmain (
|
||||
int argc,
|
||||
qse_achar_t* argv[],
|
||||
|
Reference in New Issue
Block a user