added qse_sed_getlinnum() and qse_sed_setlinnum()

This commit is contained in:
hyung-hwan 2009-05-29 07:00:56 +00:00
parent 4914825a7a
commit 681d6f7068
8 changed files with 73 additions and 4 deletions

View File

@ -5,5 +5,5 @@ The library is licended under the Apache License, Version 2.0.
The project webpage: http://qse.googlecode.com/ The project webpage: http://qse.googlecode.com/
For furthur information, contact: For furthur information, contact:
Chung, Hyung-Hwan <b a c o n e v i @ g m a i l . c o m> Chung, Hyung-Hwan <bacon@abiyo.net>

View File

@ -6,5 +6,15 @@ SED="../test/sed/sed01"
/^OUTPUT_DIRECTORY[[:space:]]*=/s/qse/qse.ko/ /^OUTPUT_DIRECTORY[[:space:]]*=/s/qse/qse.ko/
/^INPUT[[:space:]]*=/s/page/page.ko/' < Doxyfile > Doxyfile.ko /^INPUT[[:space:]]*=/s/page/page.ko/' < Doxyfile > Doxyfile.ko
#"${SED}" '/^OUTPUT_LANGUAGE[[:space:]]*=/s/English/Chinese/
# /^OUTPUT_DIRECTORY[[:space:]]*=/s/qse/qse.cn/
# /^INPUT[[:space:]]*=/s/page/page.cn/' < Doxyfile > Doxyfile.cn
#"${SED}" '/^OUTPUT_LANGUAGE[[:space:]]*=/s/English/Japanese/
# /^OUTPUT_DIRECTORY[[:space:]]*=/s/qse/qse.ja/
# /^INPUT[[:space:]]*=/s/page/page.ja/' < Doxyfile > Doxyfile.ja
doxygen Doxyfile doxygen Doxyfile
doxygen Doxyfile.ko doxygen Doxyfile.ko
#doxygen Doxyfile.cn
#doxygen Doxyfile.ja

View File

@ -127,6 +127,21 @@ public:
*/ */
errnum_t getErrorNumber () const throw (); errnum_t getErrorNumber () const throw ();
/**
* The getConsoleLine() function returns the current line
* number from an input console.
* @return current line number
*/
size_t getConsoleLine () throw ();
/**
* The setConsoleLine() function changes the current line
* number from an input console.
*/
void setConsoleLine (
size_t num ///< a line number
) throw ();
protected: protected:
/** /**
* The IOBase class is a base class for IO operation. It wraps around * The IOBase class is a base class for IO operation. It wraps around
@ -182,6 +197,7 @@ protected:
} }
protected: protected:
Sed* sed;
io_arg_t* arg; io_arg_t* arg;
Mode mode; Mode mode;
}; };

View File

@ -35,6 +35,10 @@
* qse_sed_close (sed); * qse_sed_close (sed);
* @endcode * @endcode
* *
* @todo
* - to allow flexible numbers of commands
* - to allow configurable recursion depth for a regular expression
*
* @example sed01.c * @example sed01.c
* This example shows how to embed a basic stream editor. * This example shows how to embed a basic stream editor.
*/ */
@ -320,6 +324,23 @@ int qse_sed_exec (
qse_sed_io_fun_t outf /**< stream writer */ qse_sed_io_fun_t outf /**< stream writer */
); );
/**
* The qse_sed_getlinnum() function gets the current input line number.
* @return current input line number
*/
qse_size_t qse_sed_getlinnum (
qse_sed_t* sed /**< a stream editor */
);
/**
* The qse_sed_setlinnum() function changes the current input line number.
* It affects the '=' command.
*/
void qse_sed_setlinnum (
qse_sed_t* sed, /**< a stream editor */
qse_size_t num /**< a line number */
);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -89,6 +89,18 @@ Sed::errnum_t Sed::getErrorNumber () const throw ()
return (sed == QSE_NULL)? QSE_SED_ENOERR: qse_sed_geterrnum (sed); return (sed == QSE_NULL)? QSE_SED_ENOERR: qse_sed_geterrnum (sed);
} }
Sed::size_t Sed::getConsoleLine () throw ()
{
QSE_ASSERT (sed != QSE_NULL);
return qse_sed_getlinnum (sed);
}
void Sed::setConsoleLine (size_t num) throw ()
{
QSE_ASSERT (sed != QSE_NULL);
qse_sed_setlinnum (sed, num);
}
Sed::ssize_t Sed::xin (sed_t* s, io_cmd_t cmd, io_arg_t* arg) throw () Sed::ssize_t Sed::xin (sed_t* s, io_cmd_t cmd, io_arg_t* arg) throw ()
{ {
Sed* sed = *(Sed**)QSE_XTN(s); Sed* sed = *(Sed**)QSE_XTN(s);

View File

@ -2642,3 +2642,13 @@ done3:
qse_map_fini (&sed->e.out.files); qse_map_fini (&sed->e.out.files);
return ret; return ret;
} }
qse_size_t qse_sed_getlinenum (qse_sed_t* sed)
{
return sed->e.in.num;
}
void qse_sed_setlinenum (qse_sed_t* sed, qse_size_t num)
{
sed->e.in.num = num;
}