revised docs

This commit is contained in:
2013-01-12 16:46:12 +00:00
parent 4581bf1e4e
commit ef6d295cac
49 changed files with 849 additions and 312 deletions

View File

@ -187,6 +187,8 @@ QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_OFF64_T = @QSE_SIZEOF_OFF64_T@
QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@

View File

@ -5,7 +5,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(includedir)
bin_PROGRAMS = awk01 awk02 awk03 awk04 awk05 awk06 awk09 awk11 awk15
bin_PROGRAMS = awk01 awk02 awk03 awk04 awk05 awk06 awk07 awk09 awk11 awk15
LDFLAGS = -L../../lib/awk -L../../lib/cmn
LDADD = -lqseawk -lqsecmn $(LIBM)
@ -16,15 +16,16 @@ LDADD += $(UNICOWS_LIBS)
endif
endif
awk01_SOURCES = awk01.c
awk02_SOURCES = awk02.c
awk03_SOURCES = awk03.c
awk04_SOURCES = awk04.c
awk05_SOURCES = awk05.c
awk06_SOURCES = awk06.c
awk09_SOURCES = awk09.c
awk11_SOURCES = awk11.c
awk15_SOURCES = awk15.c
awk01_SOURCES = awk01.c
awk02_SOURCES = awk02.c awk00.c awk00.h
awk03_SOURCES = awk03.c awk00.c awk00.h
awk04_SOURCES = awk04.c awk00.c awk00.h
awk05_SOURCES = awk05.c awk00.c awk00.h
awk06_SOURCES = awk06.c awk00.c awk00.h
awk07_SOURCES = awk07.c awk00.c awk00.h
awk09_SOURCES = awk09.c awk00.c awk00.h
awk11_SOURCES = awk11.c awk00.c awk00.h
awk15_SOURCES = awk15.c awk00.c awk00.h
if ENABLE_CXX

View File

@ -35,8 +35,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = awk01$(EXEEXT) awk02$(EXEEXT) awk03$(EXEEXT) \
awk04$(EXEEXT) awk05$(EXEEXT) awk06$(EXEEXT) awk09$(EXEEXT) \
awk11$(EXEEXT) awk15$(EXEEXT) $(am__EXEEXT_1)
awk04$(EXEEXT) awk05$(EXEEXT) awk06$(EXEEXT) awk07$(EXEEXT) \
awk09$(EXEEXT) awk11$(EXEEXT) awk15$(EXEEXT) $(am__EXEEXT_1)
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
@ENABLE_CXX_TRUE@am__append_2 = awk21 awk22 awk23 awk24 awk25 awk26 awk27 awk28
subdir = samples/awk
@ -65,35 +65,39 @@ awk01_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
@WCHAR_TRUE@@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
awk01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk02_OBJECTS = awk02.$(OBJEXT)
am_awk02_OBJECTS = awk02.$(OBJEXT) awk00.$(OBJEXT)
awk02_OBJECTS = $(am_awk02_OBJECTS)
awk02_LDADD = $(LDADD)
awk02_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk03_OBJECTS = awk03.$(OBJEXT)
am_awk03_OBJECTS = awk03.$(OBJEXT) awk00.$(OBJEXT)
awk03_OBJECTS = $(am_awk03_OBJECTS)
awk03_LDADD = $(LDADD)
awk03_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk04_OBJECTS = awk04.$(OBJEXT)
am_awk04_OBJECTS = awk04.$(OBJEXT) awk00.$(OBJEXT)
awk04_OBJECTS = $(am_awk04_OBJECTS)
awk04_LDADD = $(LDADD)
awk04_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk05_OBJECTS = awk05.$(OBJEXT)
am_awk05_OBJECTS = awk05.$(OBJEXT) awk00.$(OBJEXT)
awk05_OBJECTS = $(am_awk05_OBJECTS)
awk05_LDADD = $(LDADD)
awk05_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk06_OBJECTS = awk06.$(OBJEXT)
am_awk06_OBJECTS = awk06.$(OBJEXT) awk00.$(OBJEXT)
awk06_OBJECTS = $(am_awk06_OBJECTS)
awk06_LDADD = $(LDADD)
awk06_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk09_OBJECTS = awk09.$(OBJEXT)
am_awk07_OBJECTS = awk07.$(OBJEXT) awk00.$(OBJEXT)
awk07_OBJECTS = $(am_awk07_OBJECTS)
awk07_LDADD = $(LDADD)
awk07_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk09_OBJECTS = awk09.$(OBJEXT) awk00.$(OBJEXT)
awk09_OBJECTS = $(am_awk09_OBJECTS)
awk09_LDADD = $(LDADD)
awk09_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk11_OBJECTS = awk11.$(OBJEXT)
am_awk11_OBJECTS = awk11.$(OBJEXT) awk00.$(OBJEXT)
awk11_OBJECTS = $(am_awk11_OBJECTS)
awk11_LDADD = $(LDADD)
awk11_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_awk15_OBJECTS = awk15.$(OBJEXT)
am_awk15_OBJECTS = awk15.$(OBJEXT) awk00.$(OBJEXT)
awk15_OBJECTS = $(am_awk15_OBJECTS)
awk15_LDADD = $(LDADD)
awk15_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
@ -162,17 +166,18 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(awk01_SOURCES) $(awk02_SOURCES) $(awk03_SOURCES) \
$(awk04_SOURCES) $(awk05_SOURCES) $(awk06_SOURCES) \
$(awk09_SOURCES) $(awk11_SOURCES) $(awk15_SOURCES) \
$(awk21_SOURCES) $(awk22_SOURCES) $(awk23_SOURCES) \
$(awk24_SOURCES) $(awk25_SOURCES) $(awk26_SOURCES) \
$(awk27_SOURCES) $(awk28_SOURCES)
$(awk07_SOURCES) $(awk09_SOURCES) $(awk11_SOURCES) \
$(awk15_SOURCES) $(awk21_SOURCES) $(awk22_SOURCES) \
$(awk23_SOURCES) $(awk24_SOURCES) $(awk25_SOURCES) \
$(awk26_SOURCES) $(awk27_SOURCES) $(awk28_SOURCES)
DIST_SOURCES = $(awk01_SOURCES) $(awk02_SOURCES) $(awk03_SOURCES) \
$(awk04_SOURCES) $(awk05_SOURCES) $(awk06_SOURCES) \
$(awk09_SOURCES) $(awk11_SOURCES) $(awk15_SOURCES) \
$(am__awk21_SOURCES_DIST) $(am__awk22_SOURCES_DIST) \
$(am__awk23_SOURCES_DIST) $(am__awk24_SOURCES_DIST) \
$(am__awk25_SOURCES_DIST) $(am__awk26_SOURCES_DIST) \
$(am__awk27_SOURCES_DIST) $(am__awk28_SOURCES_DIST)
$(awk07_SOURCES) $(awk09_SOURCES) $(awk11_SOURCES) \
$(awk15_SOURCES) $(am__awk21_SOURCES_DIST) \
$(am__awk22_SOURCES_DIST) $(am__awk23_SOURCES_DIST) \
$(am__awk24_SOURCES_DIST) $(am__awk25_SOURCES_DIST) \
$(am__awk26_SOURCES_DIST) $(am__awk27_SOURCES_DIST) \
$(am__awk28_SOURCES_DIST)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -272,6 +277,8 @@ QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_OFF64_T = @QSE_SIZEOF_OFF64_T@
QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
@ -354,15 +361,16 @@ AM_CPPFLAGS = \
-I$(includedir)
LDADD = -lqseawk -lqsecmn $(LIBM) $(am__append_1)
awk01_SOURCES = awk01.c
awk02_SOURCES = awk02.c
awk03_SOURCES = awk03.c
awk04_SOURCES = awk04.c
awk05_SOURCES = awk05.c
awk06_SOURCES = awk06.c
awk09_SOURCES = awk09.c
awk11_SOURCES = awk11.c
awk15_SOURCES = awk15.c
awk01_SOURCES = awk01.c
awk02_SOURCES = awk02.c awk00.c awk00.h
awk03_SOURCES = awk03.c awk00.c awk00.h
awk04_SOURCES = awk04.c awk00.c awk00.h
awk05_SOURCES = awk05.c awk00.c awk00.h
awk06_SOURCES = awk06.c awk00.c awk00.h
awk07_SOURCES = awk07.c awk00.c awk00.h
awk09_SOURCES = awk09.c awk00.c awk00.h
awk11_SOURCES = awk11.c awk00.c awk00.h
awk15_SOURCES = awk15.c awk00.c awk00.h
@ENABLE_CXX_TRUE@CXXLIB = -lqseawkxx -lqsecmnxx
@ENABLE_CXX_TRUE@awk21_SOURCES = awk21.cpp
@ENABLE_CXX_TRUE@awk22_SOURCES = awk22.cpp
@ -475,6 +483,9 @@ awk05$(EXEEXT): $(awk05_OBJECTS) $(awk05_DEPENDENCIES) $(EXTRA_awk05_DEPENDENCIE
awk06$(EXEEXT): $(awk06_OBJECTS) $(awk06_DEPENDENCIES) $(EXTRA_awk06_DEPENDENCIES)
@rm -f awk06$(EXEEXT)
$(LINK) $(awk06_OBJECTS) $(awk06_LDADD) $(LIBS)
awk07$(EXEEXT): $(awk07_OBJECTS) $(awk07_DEPENDENCIES) $(EXTRA_awk07_DEPENDENCIES)
@rm -f awk07$(EXEEXT)
$(LINK) $(awk07_OBJECTS) $(awk07_LDADD) $(LIBS)
awk09$(EXEEXT): $(awk09_OBJECTS) $(awk09_DEPENDENCIES) $(EXTRA_awk09_DEPENDENCIES)
@rm -f awk09$(EXEEXT)
$(LINK) $(awk09_OBJECTS) $(awk09_LDADD) $(LIBS)
@ -515,12 +526,14 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk00.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk01.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk02.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk03.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk04.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk05.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk06.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk07.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk09.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk11.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/awk15.Po@am__quote@

31
qse/samples/awk/awk00.c Normal file
View File

@ -0,0 +1,31 @@
/* awk00.c */
#include "awk00.h"
#include <qse/cmn/mbwc.h>
#include <locale.h>
#if defined(_WIN32)
# include <windows.h>
#endif
void init_awk_sample_locale (void)
{
#if defined(_WIN32)
char locale[100];
UINT codepage = GetConsoleOutputCP();
if (codepage == CP_UTF8)
{
/*SetConsoleOutputCP (CP_UTF8);*/
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
}
else
{
sprintf (locale, ".%u", (unsigned int)codepage);
setlocale (LC_ALL, locale);
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
}
#else
setlocale (LC_ALL, "");
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
#endif
}

16
qse/samples/awk/awk00.h Normal file
View File

@ -0,0 +1,16 @@
/* awk00.h */
#ifndef _AWK00_H_
#define _AWK00_H_
#ifdef __cplusplus
extern "C" {
#endif
void init_awk_sample_locale (void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,6 +1,8 @@
#include <qse/awk/std.h>
#include <qse/cmn/str.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h"
/* i'll print records with the second field grater than 4.
* at the end, we'll print the number of records seen so far */
@ -73,8 +75,7 @@ static qse_ssize_t handle_console (
return -1;
}
int main ()
static int awk_main (int argc, qse_char_t* argv[])
{
qse_awk_t* awk = QSE_NULL;
qse_awk_rtx_t* rtx = QSE_NULL;
@ -151,3 +152,10 @@ oops:
qse_printf (QSE_T("Console Output:\n================\n%.*s\n"), (int)conoutpos, conout);
return ret;
}
int qse_main (int argc, qse_achar_t* argv[])
{
extern void init_awk_sample_locale (void);
init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main);
}

View File

@ -1,117 +1,177 @@
#include <qse/awk/std.h>
#include <qse/cmn/str.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h"
static const qse_char_t* src = QSE_T(
"function init() { a = 20; return a; }"
"function main() { return ++a; }"
"function fini() { print \"a in fini() =>\", ++a; return a; }"
);
/* i'll print records with the second field grater than 4.
* at the end, we'll print the number of records seen so far */
static const qse_char_t* script =
QSE_T("$2 > 4 { print $0; } END { print NR; }");
static const qse_char_t* fnc[] =
struct console_t
{
QSE_T("init"),
QSE_T("main"),
QSE_T("main"),
QSE_T("main"),
QSE_T("main"),
QSE_T("fini"),
/* console input */
const qse_char_t* conin;
qse_size_t coninpos;
/* console output */
qse_char_t conout[10000]; /* fixed-size console buffer for demo only */
qse_size_t conoutpos;
};
int main ()
typedef struct console_t console_t;
/* this is the console I/O handler */
static qse_ssize_t handle_console (
qse_awk_rtx_t* rtx,
qse_awk_rio_cmd_t cmd,
qse_awk_rio_arg_t* arg,
qse_char_t* data,
qse_size_t count)
{
console_t* con = qse_awk_rtx_getxtnstd (rtx);
/* this function is called separately for the console input and console
* output. however, since i don't maintain underlying resources like
* file handles, i don't really check if it's input or output.
* you can check the value of #qse_awk_rio_mode_t in the arg->mode
* field if you want to tell.
*/
switch (cmd)
{
case QSE_AWK_RIO_OPEN:
/* 0 for success, -1 for failure. */
return 0;
case QSE_AWK_RIO_CLOSE:
/* 0 for success, -1 for failure. */
return 0;
case QSE_AWK_RIO_READ:
{
qse_ssize_t len = 0;
while (con->conin[con->coninpos] && len < count)
data[len++] = con->conin[con->coninpos++];
/* 0 for EOF, -1 for failure.
positive numbers for the number of characters read */
return len;
}
case QSE_AWK_RIO_WRITE:
con->conoutpos += qse_strxncpy (
&con->conout[con->conoutpos], QSE_COUNTOF(con->conout) - con->conoutpos,
data, count);
/* 0 for EOF, -1 for failure.
positive numbers for the number of characters written */
return count;
case QSE_AWK_RIO_FLUSH:
/* 0 for success, -1 for failure. */
return 0;
case QSE_AWK_RIO_NEXT:
/* 0 for success, -1 for failure. */
return 0;
}
/* this part will never be reached */
return -1;
}
static int awk_main (int argc, qse_char_t* argv[])
{
qse_awk_t* awk = QSE_NULL;
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_val_t* retv;
qse_awk_parsestd_t psin[2];
int ret, i, opt;
qse_awk_rio_t rio;
int ret = -1;
console_t* con;
/* create an awk object */
awk = qse_awk_openstd (0);
if (awk == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: cannot open awk\n"));
ret = -1; goto oops;
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open awk\n"));
goto oops;
}
/* get the awk's trait */
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* change the trait value to disallow BEGIN, END, pattern-action blocks */
opt &= ~QSE_AWK_PABLOCK;
/* update the trait */
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
/* prepare a script to parse */
psin[0].type = QSE_AWK_PARSESTD_STR;
psin[0].u.str.ptr = src;
psin[0].u.str.len = qse_strlen(src);
psin[0].u.str.ptr = script;
psin[0].u.str.len = qse_strlen(script);
psin[1].type = QSE_AWK_PARSESTD_NULL;
/* parse a script */
ret = qse_awk_parsestd (awk, psin, QSE_NULL);
if (ret == -1)
/* parse a script in a string */
if (qse_awk_parsestd (awk, psin, QSE_NULL) <= -1)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"),
qse_awk_geterrmsg(awk));
goto oops;
}
/* create a runtime context */
/* open a runtime context */
rtx = qse_awk_rtx_openstd (
awk,
0,
QSE_T("awk03"),
awk,
QSE_SIZEOF(console_t), /* the size of extenstion area */
QSE_T("awk01"),
QSE_NULL, /* stdin */
QSE_NULL, /* stdout */
QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
);
if (rtx == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"),
qse_awk_geterrmsg(awk));
ret = -1; goto oops;
goto oops;
}
/* get the pointer to the extension area. */
con = (console_t*)qse_awk_rtx_getxtnstd (rtx);
/* initialize fields that require non-zero values.
* the entire extension area was initialized to zeros
* when it was created. */
con->conin = QSE_T("Beth 4.00 0\nDan 3.74 0\nKathy 4.00 10\nMark 5.00 20\nMary 5.50 22\nSusie 4.25 18\n");
/* call init() initially, followed by 4 calls to main(),
* and a final call to fini() */
for (i = 0; i < QSE_COUNTOF(fnc); i++)
/* retrieve the I/O handlers created by qse_awk_rtx_openstd() */
qse_awk_rtx_getrio (rtx, &rio);
/* override the console handler */
rio.console = handle_console;
/* update the I/O handlers */
qse_awk_rtx_setrio (rtx, &rio);
/* execute pattern-action blocks */
retv = qse_awk_rtx_loop (rtx);
if (retv == QSE_NULL)
{
qse_awk_val_t* v;
qse_char_t* str;
qse_size_t len;
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
goto oops;
}
/* call the function */
v = qse_awk_rtx_call (rtx, fnc[i], QSE_NULL, 0);
if (v == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* convert the return value to a string with duplication */
str = qse_awk_rtx_valtostrdup (rtx, v, &len);
/* clear the return value */
qse_awk_rtx_refdownval (rtx, v);
if (str == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* print the return value */
qse_printf (QSE_T("return: [%.*s]\n"), (int)len, str);
/* destroy the duplicated string */
qse_awk_rtx_freemem (rtx, str);
}
/* decrement the reference count of the return value */
qse_awk_rtx_refdownval (rtx, retv);
ret = 0;
oops:
/* destroy a runtime context */
/* the buffer is available during the runtime context is alive */
qse_printf (QSE_T("Console Output:\n================\n%.*s\n"), (int)con->conoutpos, con->conout);
/* destroy the runtime context */
if (rtx) qse_awk_rtx_close (rtx);
/* destroy the awk object */
if (awk) qse_awk_close (awk);
return ret;
}
int qse_main (int argc, qse_achar_t* argv[])
{
init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main);
}

View File

@ -1,19 +1,29 @@
#include <qse/awk/std.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h"
static const qse_char_t* src = QSE_T(
"function pow(x,y) { return x ** y; }"
"function init() { a = 20; return a; }"
"function main() { return ++a; }"
"function fini() { print \"a in fini() =>\", ++a; return a; }"
);
int main ()
static const qse_char_t* fnc[] =
{
QSE_T("init"),
QSE_T("main"),
QSE_T("main"),
QSE_T("main"),
QSE_T("main"),
QSE_T("fini"),
};
static int awk_main (int argc, qse_char_t* argv[])
{
qse_awk_t* awk = QSE_NULL;
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_parsestd_t psin[2];
qse_char_t* str;
qse_size_t len;
qse_awk_val_t* rtv = QSE_NULL;
qse_awk_val_t* arg[2] = { QSE_NULL, QSE_NULL };
int ret, i, opt;
/* create an awk object */
@ -31,13 +41,13 @@ int main ()
/* update the trait */
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
/* prepare an awk script to parse */
/* prepare a script to parse */
psin[0].type = QSE_AWK_PARSESTD_STR;
psin[0].u.str.ptr = src;
psin[0].u.str.len = qse_strlen(src);
psin[1].type = QSE_AWK_PARSESTD_NULL;
/* parse the script */
/* parse a script */
ret = qse_awk_parsestd (awk, psin, QSE_NULL);
if (ret == -1)
{
@ -48,9 +58,9 @@ int main ()
/* create a runtime context */
rtx = qse_awk_rtx_openstd (
awk,
awk,
0,
QSE_T("awk04"),
QSE_T("awk03"),
QSE_NULL, /* stdin */
QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
@ -62,64 +72,54 @@ int main ()
ret = -1; goto oops;
}
/* create the first argument to the pow function to call */
arg[0] = qse_awk_rtx_makeintval (rtx, 50);
if (arg[0] == QSE_NULL)
/* call init() initially, followed by 4 calls to main(),
* and a final call to fini() */
for (i = 0; i < QSE_COUNTOF(fnc); i++)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_awk_rtx_refupval (rtx, arg[0]);
qse_awk_val_t* v;
qse_char_t* str;
qse_size_t len;
/* create the second argument to the pow function to call */
arg[1] = qse_awk_rtx_makeintval (rtx, 3);
if (arg[1] == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_awk_rtx_refupval (rtx, arg[1]);
/* call the function */
v = qse_awk_rtx_call (rtx, fnc[i], QSE_NULL, 0);
if (v == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* call the pow function */
rtv = qse_awk_rtx_call (rtx, QSE_T("pow"), arg, 2);
if (rtv == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* convert the return value to a string with duplication */
str = qse_awk_rtx_valtostrdup (rtx, v, &len);
/* duplicate the return value to a string */
str = qse_awk_rtx_valtostrdup (rtx, rtv, &len);
/* clear the return value */
qse_awk_rtx_refdownval (rtx, v);
/* clear the return value */
qse_awk_rtx_refdownval (rtx, rtv);
if (str == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
if (str == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* print the return value */
qse_printf (QSE_T("return: [%.*s]\n"), (int)len, str);
qse_printf (QSE_T("[%.*s]\n"), (int)len, str);
/* destroy the duplicated string */
qse_awk_rtx_freemem (rtx, str);
/* destroy the duplicated string */
qse_awk_rtx_freemem (rtx, str);
}
oops:
/* dereference all arguments */
for (i = 0; i < QSE_COUNTOF(arg); i++)
{
if (arg[i]) qse_awk_rtx_refdownval (rtx, arg[i]);
}
/* destroy a runtime context */
if (rtx) qse_awk_rtx_close (rtx);
/* destroy the processor */
/* destroy the awk object */
if (awk) qse_awk_close (awk);
return ret;
}
int qse_main (int argc, qse_achar_t* argv[])
{
init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main);
}

134
qse/samples/awk/awk05.c Normal file
View File

@ -0,0 +1,134 @@
#include <qse/awk/std.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h"
static const qse_char_t* src = QSE_T(
"function pow(x,y) { return x ** y; }"
);
static int awk_main (int argc, qse_char_t* argv[])
{
qse_awk_t* awk = QSE_NULL;
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_parsestd_t psin[2];
qse_char_t* str;
qse_size_t len;
qse_awk_val_t* rtv = QSE_NULL;
qse_awk_val_t* arg[2] = { QSE_NULL, QSE_NULL };
int ret, i, opt;
/* create an awk object */
awk = qse_awk_openstd (0);
if (awk == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: cannot open awk\n"));
ret = -1; goto oops;
}
/* get the awk's trait */
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* change the trait value to disallow BEGIN, END, pattern-action blocks */
opt &= ~QSE_AWK_PABLOCK;
/* update the trait */
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
/* prepare an awk script to parse */
psin[0].type = QSE_AWK_PARSESTD_STR;
psin[0].u.str.ptr = src;
psin[0].u.str.len = qse_strlen(src);
psin[1].type = QSE_AWK_PARSESTD_NULL;
/* parse the script */
ret = qse_awk_parsestd (awk, psin, QSE_NULL);
if (ret == -1)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_geterrmsg(awk));
goto oops;
}
/* create a runtime context */
rtx = qse_awk_rtx_openstd (
awk,
0,
QSE_T("awk04"),
QSE_NULL, /* stdin */
QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
);
if (rtx == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_geterrmsg(awk));
ret = -1; goto oops;
}
/* create the first argument to the pow function to call */
arg[0] = qse_awk_rtx_makeintval (rtx, 50);
if (arg[0] == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_awk_rtx_refupval (rtx, arg[0]);
/* create the second argument to the pow function to call */
arg[1] = qse_awk_rtx_makeintval (rtx, 3);
if (arg[1] == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_awk_rtx_refupval (rtx, arg[1]);
/* call the pow function */
rtv = qse_awk_rtx_call (rtx, QSE_T("pow"), arg, 2);
if (rtv == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* duplicate the return value to a string */
str = qse_awk_rtx_valtostrdup (rtx, rtv, &len);
/* clear the return value */
qse_awk_rtx_refdownval (rtx, rtv);
if (str == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_printf (QSE_T("[%.*s]\n"), (int)len, str);
/* destroy the duplicated string */
qse_awk_rtx_freemem (rtx, str);
oops:
/* dereference all arguments */
for (i = 0; i < QSE_COUNTOF(arg); i++)
{
if (arg[i]) qse_awk_rtx_refdownval (rtx, arg[i]);
}
/* destroy a runtime context */
if (rtx) qse_awk_rtx_close (rtx);
/* destroy the processor */
if (awk) qse_awk_close (awk);
return ret;
}
int qse_main (int argc, qse_achar_t* argv[])
{
init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main);
}

View File

@ -1,29 +1,25 @@
#include <qse/awk/std.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h"
static const qse_char_t* src = QSE_T(
"function dump(x) { OFS=\"=\"; for (k in x) print k, x[k]; x[\"f99\"]=\"os2\"; return x; }"
"function pow(x,y) { return x ** y; }"
);
int main ()
static int awk_main (int argc, qse_char_t* argv[])
{
qse_awk_t* awk = QSE_NULL;
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_parsestd_t psin[2];
qse_char_t* str;
qse_size_t len;
qse_awk_val_t* rtv = QSE_NULL;
qse_awk_val_t* arg = QSE_NULL;
int ret, opt;
qse_awk_val_t* arg[2] = { QSE_NULL, QSE_NULL };
int ret, i, opt;
qse_awk_fun_t* fun;
/* this structure is passed to qse_awk_rtx_makemapvalwithdata() */
qse_awk_val_map_data_t md[] =
{
{ { QSE_T("f0"), 2 }, QSE_AWK_VAL_MAP_DATA_STR, QSE_T("linux") },
{ { QSE_T("f1"), 2 }, QSE_AWK_VAL_MAP_DATA_STR, QSE_T("openvms") },
{ { QSE_T("f2"), 2 }, QSE_AWK_VAL_MAP_DATA_STR, QSE_T("hpux") },
{ { QSE_NULL, 0 }, 0, QSE_NULL } /* last item */
};
/* create a standard awk object */
/* create an awk object */
awk = qse_awk_openstd (0);
if (awk == QSE_NULL)
{
@ -38,7 +34,7 @@ int main ()
/* update the trait */
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
/* prepare a script to parse */
/* prepare an awk script to parse */
psin[0].type = QSE_AWK_PARSESTD_STR;
psin[0].u.str.ptr = src;
psin[0].u.str.len = qse_strlen(src);
@ -53,15 +49,14 @@ int main ()
goto oops;
}
/* create a standard runtime context */
/* create a runtime context */
rtx = qse_awk_rtx_openstd (
awk,
0,
QSE_T("awk06"),
QSE_T("awk05"),
QSE_NULL, /* stdin */
QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
);
if (rtx == QSE_NULL)
{
@ -70,18 +65,37 @@ int main ()
ret = -1; goto oops;
}
/* create a map value to pass as an argument */
arg = qse_awk_rtx_makemapvalwithdata (rtx, md);
if (arg == QSE_NULL)
/* create the first argument to the pow function to call */
arg[0] = qse_awk_rtx_makeintval (rtx, 50);
if (arg[0] == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_awk_rtx_refupval (rtx, arg);
/* execute the dump function in the awk script */
rtv = qse_awk_rtx_call (rtx, QSE_T("dump"), &arg, 1);
qse_awk_rtx_refupval (rtx, arg[0]);
/* create the second argument to the pow function to call */
arg[1] = qse_awk_rtx_makeintval (rtx, 3);
if (arg[1] == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_awk_rtx_refupval (rtx, arg[1]);
/* find the pow function */
fun = qse_awk_rtx_findfun (rtx, QSE_T("pow"));
if (fun == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* call the function found */
rtv = qse_awk_rtx_callfun (rtx, fun, arg, 2);
if (rtv == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
@ -89,72 +103,42 @@ int main ()
ret = -1; goto oops;
}
if (rtv->type == QSE_AWK_VAL_MAP)
/* duplicate the return value to a string */
str = qse_awk_rtx_valtostrdup (rtx, rtv, &len);
/* clear the return value */
qse_awk_rtx_refdownval (rtx, rtv);
if (str == QSE_NULL)
{
/* if a returned value is a map,
* traverse the map and print the key/value pairs. */
qse_awk_val_map_itr_t itr;
qse_awk_val_map_itr_t* iptr;
/* get the iterator to the first key/value pair */
iptr = qse_awk_rtx_getfirstmapvalitr (rtx, rtv, &itr);
while (iptr)
{
qse_xstr_t str;
/* #QSE_AWK_VAL_MAP_ITR_VAL returns the value part */
str.ptr = qse_awk_rtx_valtostrdup (
rtx, QSE_AWK_VAL_MAP_ITR_VAL(iptr), &str.len);
if (str.ptr == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* #QSE_AWK_VAL_MAP_ITR_KEY returns the key part */
qse_printf (QSE_T("ret [%.*s]=[%.*s]\n"),
(int)QSE_AWK_VAL_MAP_ITR_KEY(iptr)->len,
QSE_AWK_VAL_MAP_ITR_KEY(iptr)->ptr,
(int)str.len, str.ptr
);
qse_awk_rtx_freemem (rtx, str.ptr);
/* get the iterator to the next key/value pair */
iptr = qse_awk_rtx_getnextmapvalitr (rtx, rtv, &itr);
}
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
else
{
/* if it is a plain value, convert it to a string
* and print it */
qse_xstr_t str;
str.ptr = qse_awk_rtx_valtostrdup (rtx, rtv, &str.len);
if (str.ptr == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_printf (QSE_T("ret [%.*s]\n"), (int)str.len, str.ptr);
qse_awk_rtx_freemem (rtx, str.ptr);
}
qse_printf (QSE_T("[%.*s]\n"), (int)len, str);
/* destroy the duplicated string */
qse_awk_rtx_freemem (rtx, str);
oops:
/* clear the return value */
if (rtv) qse_awk_rtx_refdownval (rtx, rtv);
/* dereference the argument */
if (arg) qse_awk_rtx_refdownval (rtx, arg);
/* dereference all arguments */
for (i = 0; i < QSE_COUNTOF(arg); i++)
{
if (arg[i]) qse_awk_rtx_refdownval (rtx, arg[i]);
}
/* destroy a runtime context */
if (rtx) qse_awk_rtx_close (rtx);
/* destroy the processor */
if (awk) qse_awk_close (awk);
return ret;
}
int qse_main (int argc, qse_achar_t* argv[])
{
init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main);
}

169
qse/samples/awk/awk07.c Normal file
View File

@ -0,0 +1,169 @@
#include <qse/awk/std.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
#include "awk00.h"
static const qse_char_t* src = QSE_T(
"function dump(x) { OFS=\"=\"; for (k in x) print k, x[k]; x[\"f99\"]=\"os2\"; return x; }"
);
static int awk_main (int argc, qse_char_t* argv[])
{
qse_awk_t* awk = QSE_NULL;
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_parsestd_t psin[2];
qse_awk_val_t* rtv = QSE_NULL;
qse_awk_val_t* arg = QSE_NULL;
int ret, opt;
/* this structure is passed to qse_awk_rtx_makemapvalwithdata() */
qse_awk_val_map_data_t md[] =
{
{ { QSE_T("f0"), 2 }, QSE_AWK_VAL_MAP_DATA_STR, QSE_T("linux") },
{ { QSE_T("f1"), 2 }, QSE_AWK_VAL_MAP_DATA_STR, QSE_T("openvms") },
{ { QSE_T("f2"), 2 }, QSE_AWK_VAL_MAP_DATA_STR, QSE_T("hpux") },
{ { QSE_NULL, 0 }, 0, QSE_NULL } /* last item */
};
/* create a standard awk object */
awk = qse_awk_openstd (0);
if (awk == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: cannot open awk\n"));
ret = -1; goto oops;
}
/* get the awk's trait */
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* change the trait value to disallow BEGIN, END, pattern-action blocks */
opt &= ~QSE_AWK_PABLOCK;
/* update the trait */
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
/* prepare a script to parse */
psin[0].type = QSE_AWK_PARSESTD_STR;
psin[0].u.str.ptr = src;
psin[0].u.str.len = qse_strlen(src);
psin[1].type = QSE_AWK_PARSESTD_NULL;
/* parse the script */
ret = qse_awk_parsestd (awk, psin, QSE_NULL);
if (ret == -1)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_geterrmsg(awk));
goto oops;
}
/* create a standard runtime context */
rtx = qse_awk_rtx_openstd (
awk,
0,
QSE_T("awk06"),
QSE_NULL, /* stdin */
QSE_NULL, /* stdout */
QSE_NULL /* default cmgr */
);
if (rtx == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_geterrmsg(awk));
ret = -1; goto oops;
}
/* create a map value to pass as an argument */
arg = qse_awk_rtx_makemapvalwithdata (rtx, md);
if (arg == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_awk_rtx_refupval (rtx, arg);
/* execute the dump function in the awk script */
rtv = qse_awk_rtx_call (rtx, QSE_T("dump"), &arg, 1);
if (rtv == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
if (rtv->type == QSE_AWK_VAL_MAP)
{
/* if a returned value is a map,
* traverse the map and print the key/value pairs. */
qse_awk_val_map_itr_t itr;
qse_awk_val_map_itr_t* iptr;
/* get the iterator to the first key/value pair */
iptr = qse_awk_rtx_getfirstmapvalitr (rtx, rtv, &itr);
while (iptr)
{
qse_xstr_t str;
/* #QSE_AWK_VAL_MAP_ITR_VAL returns the value part */
str.ptr = qse_awk_rtx_valtostrdup (
rtx, QSE_AWK_VAL_MAP_ITR_VAL(iptr), &str.len);
if (str.ptr == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
/* #QSE_AWK_VAL_MAP_ITR_KEY returns the key part */
qse_printf (QSE_T("ret [%.*s]=[%.*s]\n"),
(int)QSE_AWK_VAL_MAP_ITR_KEY(iptr)->len,
QSE_AWK_VAL_MAP_ITR_KEY(iptr)->ptr,
(int)str.len, str.ptr
);
qse_awk_rtx_freemem (rtx, str.ptr);
/* get the iterator to the next key/value pair */
iptr = qse_awk_rtx_getnextmapvalitr (rtx, rtv, &itr);
}
}
else
{
/* if it is a plain value, convert it to a string
* and print it */
qse_xstr_t str;
str.ptr = qse_awk_rtx_valtostrdup (rtx, rtv, &str.len);
if (str.ptr == QSE_NULL)
{
qse_fprintf (QSE_STDERR, QSE_T("error: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
}
qse_printf (QSE_T("ret [%.*s]\n"), (int)str.len, str.ptr);
qse_awk_rtx_freemem (rtx, str.ptr);
}
oops:
/* clear the return value */
if (rtv) qse_awk_rtx_refdownval (rtx, rtv);
/* dereference the argument */
if (arg) qse_awk_rtx_refdownval (rtx, arg);
/* destroy a runtime context */
if (rtx) qse_awk_rtx_close (rtx);
/* destroy the processor */
if (awk) qse_awk_close (awk);
return ret;
}
int qse_main (int argc, qse_achar_t* argv[])
{
init_awk_sample_locale ();
return qse_runmain (argc, argv, awk_main);
}

View File

@ -346,6 +346,8 @@ QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_OFF64_T = @QSE_SIZEOF_OFF64_T@
QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@

View File

@ -182,6 +182,8 @@ QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_OFF64_T = @QSE_SIZEOF_OFF64_T@
QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@

View File

@ -195,6 +195,8 @@ QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_OFF64_T = @QSE_SIZEOF_OFF64_T@
QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@