added qse_sed_getspace(), qse_sed_allocmem(), qse_sed_reallocmem(), qse_sed_callocmem(), qse_sed_freemem()

This commit is contained in:
2013-01-13 09:04:54 +00:00
parent 2337ac67b1
commit 92e4134b7d
24 changed files with 566 additions and 247 deletions

View File

@ -221,3 +221,23 @@ the cmgr field moved from the union member file to the outer structure.
### 0 upon Opening ###
I/O handlers can return 0 for success upon opening.
\skipline ---------------------------------------------------------------------
\skipline the sample files are listed here for example list generation purpose.
\skipline ---------------------------------------------------------------------
\example awk01.c
\example awk02.c
\example awk03.c
\example awk04.c
\example awk05.c
\example awk06.c
\example awk07.c
\example awk21.cpp
\example awk22.cpp
\example awk23.cpp

View File

@ -27,14 +27,51 @@ You can call qse_sed_compstdfile() instead of qse_sed_compstdstr() to compile
sed commands stored in a file. You can use qse_sed_compstd() or qse_sed_comp()
for more flexibility.
Customize Console
-----------------
Locale
------
Accessing Pattern Space
-----------------------
While QSESED can use a wide character type as the default character type,
the hosting program still has to initialize the locale whenever necessary.
All the samples shown in this page calls a common function
init_sed_sample_locale(), use the qse_main() macro as the main function,
and call qse_runmain() for cross-platform and cross-character-set support.
Accessing Hold Space
--------------------
Here is the function prototype.
\includelineno sed00.h
Here goes the actual function.
\includelineno sed00.c
Note that these two files do not constitute QSEAWK and are used for samples
here only.
Customizing Streams
-------------------
You can use qse_sed_execstd() in customzing the input and output streams.
The sample below uses I/O resources of the #QSE_SED_IOSTD_STR type to use
an argument as input data and let the output to be dynamically allocated.
\includelineno sed02.c
You can use the core layer function qse_sed_exec() and implement the
::qse_sed_io_impl_t interface for more flexibility. No samples will
be provided here because the standard layer functions qse_sed_execstd()
and qse_sed_execstdfile() are the good samples.
Accessing Pattern and Hold Space
--------------------------------
The qse_sed_getspace() allows to you get the pointer and the length
of the pattern space and the hold space. It may not be so useful you
access them after execution is completed. The qse_sed_setexectracer()
function lets you set up a hook function during execution time.
The following sample prints the contents of the pattern space and
hold space at each phase of execution.
\includelineno sed03.c
Embedding In C++
----------------
@ -42,5 +79,15 @@ Embedding In C++
The QSE::Sed and QSE::StdSed classes are provided for C++. The sample here shows
how to embed QSE::StdSed for stream editing.
\includelineno sed02.cpp
\includelineno sed21.cpp
\skipline ---------------------------------------------------------------------
\skipline the sample files are listed here for example list generation purpose.
\skipline ---------------------------------------------------------------------
\example sed01.c
\example sed02.c
\example sed03.c
\example sed21.cpp