* renamed udd to ctx in qse_mmgr_t

* fixed problems in build and test scripts
This commit is contained in:
hyung-hwan 2011-08-15 03:07:31 +00:00
parent f332efc288
commit 6e2dd10655
37 changed files with 328 additions and 149 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c 547 2011-08-13 16:04:14Z hyunghwan.chung $
* $Id: awk.c 549 2011-08-14 09:07:31Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -864,15 +864,15 @@ static int awk_main (int argc, qse_char_t* argv[])
#if defined(QSE_BUILD_DEBUG)
if (arg.failmalloc > 0)
{
debug_mmgr.udd = &arg;
debug_mmgr.ctx = &arg;
mmgr = &debug_mmgr;
}
else
#endif
if (arg.memlimit > 0)
{
xma_mmgr.udd = qse_xma_open (QSE_NULL, 0, arg.memlimit);
if (xma_mmgr.udd == QSE_NULL)
xma_mmgr.ctx = qse_xma_open (QSE_NULL, 0, arg.memlimit);
if (xma_mmgr.ctx == QSE_NULL)
{
qse_printf (QSE_T("ERROR: cannot open memory heap\n"));
goto oops;
@ -925,7 +925,7 @@ static int awk_main (int argc, qse_char_t* argv[])
#ifdef ENABLE_CALLBACK
rcb.stm = on_statement;
rcb.udd = &arg;
rcb.ctx = &arg;
#endif
rtx = qse_awk_rtx_openstd (
@ -973,7 +973,7 @@ oops:
if (rtx) qse_awk_rtx_close (rtx);
if (awk) qse_awk_close (awk);
if (xma_mmgr.udd) qse_xma_close (xma_mmgr.udd);
if (xma_mmgr.ctx) qse_xma_close (xma_mmgr.ctx);
freearg (&arg);
return ret;

View File

@ -275,8 +275,8 @@ int sed_main (int argc, qse_char_t* argv[])
if (g_memlimit > 0)
{
xma_mmgr.udd = qse_xma_open (QSE_NULL, 0, g_memlimit);
if (xma_mmgr.udd == QSE_NULL)
xma_mmgr.ctx = qse_xma_open (QSE_NULL, 0, g_memlimit);
if (xma_mmgr.ctx == QSE_NULL)
{
qse_printf (QSE_T("ERROR: cannot open memory heap\n"));
goto oops;
@ -353,7 +353,7 @@ int sed_main (int argc, qse_char_t* argv[])
oops:
if (sed) qse_sed_close (sed);
if (xma_mmgr.udd) qse_xma_close (xma_mmgr.udd);
if (xma_mmgr.ctx) qse_xma_close (xma_mmgr.ctx);
if (g_script_file != QSE_NULL && g_script != QSE_NULL)
QSE_MMGR_FREE (QSE_MMGR_GETDFL(), g_script);
return ret;

4
qse/configure vendored
View File

@ -17186,7 +17186,7 @@ QSE_PROJECT_AUTHOR="${PACKAGE_BUGREPORT}"
QSE_PROJECT_URL="${PACKAGE_URL}"
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/awk/Makefile include/qse/cut/Makefile include/qse/sed/Makefile include/qse/stx/Makefile include/qse/net/Makefile lib/Makefile lib/cmn/Makefile lib/awk/Makefile lib/cut/Makefile lib/sed/Makefile lib/stx/Makefile lib/net/Makefile cmd/Makefile cmd/awk/Makefile cmd/cut/Makefile cmd/sed/Makefile cmd/stx/Makefile samples/Makefile samples/cmn/Makefile samples/awk/Makefile samples/cut/Makefile samples/sed/Makefile samples/net/Makefile regress/Makefile regress/awk/Makefile regress/sed/Makefile doc/Makefile doc/page/Makefile doc/Doxyfile"
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/awk/Makefile include/qse/cut/Makefile include/qse/sed/Makefile include/qse/stx/Makefile include/qse/net/Makefile lib/Makefile lib/cmn/Makefile lib/awk/Makefile lib/cut/Makefile lib/sed/Makefile lib/stx/Makefile lib/net/Makefile cmd/Makefile cmd/awk/Makefile cmd/cut/Makefile cmd/sed/Makefile cmd/stx/Makefile samples/Makefile samples/cmn/Makefile samples/awk/Makefile samples/cut/Makefile samples/sed/Makefile samples/net/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/page/Makefile doc/Doxyfile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -18307,7 +18307,9 @@ do
"samples/net/Makefile") CONFIG_FILES="$CONFIG_FILES samples/net/Makefile" ;;
"regress/Makefile") CONFIG_FILES="$CONFIG_FILES regress/Makefile" ;;
"regress/awk/Makefile") CONFIG_FILES="$CONFIG_FILES regress/awk/Makefile" ;;
"regress/awk/regress.sh") CONFIG_FILES="$CONFIG_FILES regress/awk/regress.sh" ;;
"regress/sed/Makefile") CONFIG_FILES="$CONFIG_FILES regress/sed/Makefile" ;;
"regress/sed/regress.sh") CONFIG_FILES="$CONFIG_FILES regress/sed/regress.sh" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"doc/page/Makefile") CONFIG_FILES="$CONFIG_FILES doc/page/Makefile" ;;
"doc/Doxyfile") CONFIG_FILES="$CONFIG_FILES doc/Doxyfile" ;;

View File

@ -275,7 +275,9 @@ AC_CONFIG_FILES([
samples/net/Makefile
regress/Makefile
regress/awk/Makefile
regress/awk/regress.sh
regress/sed/Makefile
regress/sed/regress.sh
doc/Makefile
doc/page/Makefile
doc/Doxyfile

View File

@ -39,7 +39,7 @@ PROJECT_NUMBER = @VERSION@
# where doxygen was started. If left blank the current directory will be used.
#OUTPUT_DIRECTORY = ./qse-@VERSION@
OUTPUT_DIRECTORY = @abs_top_srcdir@/doc/qse-@VERSION@
OUTPUT_DIRECTORY = @abs_srcdir@/qse-@VERSION@
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
@ -565,7 +565,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = @abs_top_srcdir@/include @abs_top_srcdir@/doc/page
INPUT = @abs_top_srcdir@/include @abs_srcdir@/page
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
@ -791,7 +791,7 @@ HTML_FOOTER =
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET = @abs_top_srcdir@/doc/doxygen.css
HTML_STYLESHEET = @abs_srcdir@/doxygen.css
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to

View File

@ -1,4 +1,4 @@
/** @defgroup awk AWK
/** @page awk AWK
@section awk_intro INTRODUCTION

View File

@ -1,4 +1,4 @@
/** @defgroup cut TEXT CUTTER
/** @page cut TEXT CUTTER
@section cut_contents CONTENTS
- \ref cut_intro

View File

@ -2,18 +2,12 @@
@section qse_intro INTRODUCTION
The QSE library implements functionality of various Unix commands in an
embeddable form and defines data types, functions, and classes that you can
use when you embed such functionality into an application. The interface has
been designed to be flexible enough to access various aspects of embedding
application and an embedded object from each other.
Currently the library contains the following components:
- @subpage awk "AWK Interpreter"
- @subpage cut "CUT Text Cutter"
- @subpage sed "SED Stream Editor"
As the library grows, more components will be added.
The QSE library implements various Unix commands in an embeddable form and
defines data types, functions, and classes that you can use when you embed
them into an application. It also provides more fundamental data types and
funtions needed when you deal with memory, streams, data structures.
The interface has been designed to be flexible enough to access various
aspects of embedding application and an embedded object from each other.
The library is licensed under the GNU Lesser General Public License version 3:
http://www.gnu.org/licenses/
@ -23,6 +17,16 @@ The project webpage: http://code.abiyo.net/@qse
For further information, contact:
Chung, Hyung-Hwan <hyunghwan.chung@gmail.com>
@section components MODULES
See the subpages for various modules available in this library.
- @subpage mem "Memory Management"
- @subpage io "I/O Handling"
- @subpage awk "AWK Interpreter"
- @subpage cut "CUT Text Cutter"
- @subpage sed "SED Stream Editor"
@section installation INSTALLATION
@subsection build_from_source BUILINDG FROM A SOURCE PACKAGE
@ -87,18 +91,5 @@ Under the wide character mode:
#qse_mchar_t maps to @b char and #qse_wchar_t maps to @b wchar_t or equivalent.
@section library_modules LIBRARY MODULES
@b QSE contains a set of APIs. Each set is organized into a library module
and its interface is exported via header files. Commonly used functions and
data structures are organized into a common functions library and forms the
foundation for other modules. Specialized functions and data structures are
organized to dedicated modules. See relevant subpages for more information
on each module.
- @subpage mem "Memory Management"
- @subpage io "I/O Handling"
- @subpage awk "AWK Interpreter"
- @subpage cut "CUT Text Cutter"
- @subpage sed "SED Stream Editor"
*/

View File

@ -1,6 +1,60 @@
/** @page mem Memory Management
@section mem_alloc Memory Allocator
- Private heap allocator #qse_xma_t
- Fixed-size block allocator #qse_fma_t
@section mem_overview Overview
A memory manager is an instance of a structure type #qse_mmgr_t. Creating
and/or initializing an object requires a memory manager to be passed in.
If you pass in #QSE_NULL for a memory manager, the object is created and/or
initialized with the default memory manager.
The default memory manager is merely a wrapper to memory allocation functions
provided by underlying operating systems: HeapAlloc/HeapReAlloc/HeapFree
on _WIN32 and malloc/realloc/free on other platforms. You can get this default
memory manager with qse_getdflmmgr() and can change it with qse_setdflmmgr().
Typically, the name of a function creating an object begins with @b qse_,
ends with @b _open, and accepts a memory manager as the first parameter.
See qse_mbs_open() for instance. So you can customize memory management
at the per-object level.
@section mem_xma Priviate Heap
While the default memory manager allocates memory from a system-wide heap,
you can create a private heap and use it when you create an object.
The #qse_xma_t type defines a private heap manager and its functions offer
sufficient interface to form a memory manager over a private heap.
A typical usage is shown below:
@code
qse_mmgr_t mmgr;
/* Create a heap */
heap = qse_xma_open (QSE_NULL, 0, 1024 * 1024); /* 1M heap */
/* Initialize a new memory */
mmgr.alloc = (qse_mmgr_alloc_t)qse_xma_alloc;
mmgr.realloc = (qse_mmgr_realloc_t)qse_xma_realloc;
mmgr.free = (qse_mmgr_free_t)qse_xma_realloc;
mmgr.ctx = heap;
/*
* You can pass 'mmgr' when you create/initialize a different object
*/
....
....
/* Destroy the heap */
qse_xma_close (heap);
@endcode
Note that creating a private heap requires a memory manager, too. The example
above used the default memory manager to create a private heap within the
global heap. This means that you can split a heap to smaller subheaps.
@section mem_fma Fixed-size Block Allocator
If the size of memory blocks to allocate share the same size, you can use
#qse_fma_t for performance.
*/

View File

@ -1,4 +1,4 @@
/** @defgroup sed Stream Editor
/** @page sed Stream Editor
@section sed_contents CONTENTS
- \ref sed_intro

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 518 2011-07-24 14:24:13Z hyunghwan.chung $
* $Id: awk.h 549 2011-08-14 09:07:31Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -678,7 +678,7 @@ typedef struct qse_awk_rio_t qse_awk_rio_t;
typedef void (*qse_awk_rcb_stm_t) (
qse_awk_rtx_t* rtx, /**< runtime context */
qse_awk_nde_t* nde, /**< node */
void* udd /**< user-defined data */
void* ctx /**< user-defined data */
);
/**
@ -698,7 +698,7 @@ struct qse_awk_rcb_t
* A caller may store a user-defined data pointer into this field. This
* is passed to the actual callback.
*/
void* udd;
void* ctx;
};
typedef struct qse_awk_rcb_t qse_awk_rcb_t;

View File

@ -49,7 +49,7 @@ public:
this->alloc = alloc_mem;
this->realloc = realloc_mem;
this->free = free_mem;
this->udd = this;
this->ctx = this;
}
///
@ -90,17 +90,17 @@ protected:
///
/// bridge function from the #qse_mmgr_t type the allocMem() function.
///
static void* alloc_mem (void* udd, size_t n);
static void* alloc_mem (void* ctx, size_t n);
///
/// bridge function from the #qse_mmgr_t type the reallocMem() function.
///
static void* realloc_mem (void* udd, void* ptr, size_t n);
static void* realloc_mem (void* ctx, void* ptr, size_t n);
///
/// bridge function from the #qse_mmgr_t type the freeMem() function.
///
static void free_mem (void* udd, void* ptr);
static void free_mem (void* ctx, void* ptr);
};
/////////////////////////////////

View File

@ -118,7 +118,7 @@
* }
*
* // complete the qse_mmgr_t interface by providing the allocator.
* mmgr.udd = fma;
* mmgr.ctx = fma;
*
* // initializes the statically declared red-black tree.
* // can not call qse_rbt_open() which allocates the qse_rbt_t object.

View File

@ -1,5 +1,5 @@
/*
* $Id: mem.h 441 2011-04-22 14:28:43Z hyunghwan.chung $
* $Id: mem.h 549 2011-08-14 09:07:31Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -42,22 +42,18 @@
* The QSE_MMGR_ALLOC() macro allocates a memory block of the @a size bytes
* using the @a mmgr memory manager.
*/
#define QSE_MMGR_ALLOC(mmgr,size) \
((mmgr)->alloc((mmgr)->udd,size))
#define QSE_MMGR_ALLOC(mmgr,size) ((mmgr)->alloc((mmgr)->ctx,size))
/**
* The QSE_MMGR_REALLOC() macro resizes a memory block pointed to by @a ptr
* to the @a size bytes using the @a mmgr memory manager.
*/
#define QSE_MMGR_REALLOC(mmgr,ptr,size) \
((mmgr)->realloc((mmgr)->udd,ptr,size))
#define QSE_MMGR_REALLOC(mmgr,ptr,size) ((mmgr)->realloc((mmgr)->ctx,ptr,size))
/**
* The QSE_MMGR_FREE() macro deallocates the memory block pointed to by @a ptr.
*/
#define QSE_MMGR_FREE(mmgr,ptr) \
((mmgr)->free((mmgr)->udd,ptr))
#define QSE_MMGR_FREE(mmgr,ptr) ((mmgr)->free((mmgr)->ctx,ptr))
#ifdef __cplusplus
extern "C" {

View File

@ -1,5 +1,5 @@
/*
* $Id: str.h 536 2011-08-06 03:25:08Z hyunghwan.chung $
* $Id: str.h 549 2011-08-14 09:07:31Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -2236,6 +2236,9 @@ qse_mchar_t* qse_wcstombsdup (
QSE_DEFINE_COMMON_FUNCTIONS (mbs)
/**
* The qse_mbs_open() function creates a dynamically resizable multibyte string.
*/
qse_mbs_t* qse_mbs_open (
qse_mmgr_t* mmgr,
qse_size_t ext,
@ -2405,6 +2408,11 @@ qse_size_t qse_mbs_pac (
QSE_DEFINE_COMMON_FUNCTIONS (wcs)
/**
* The qse_wcs_open() function creates a dynamically resizable wide-character
* string.
*/
qse_wcs_t* qse_wcs_open (
qse_mmgr_t* mmgr,
qse_size_t ext,

View File

@ -1,5 +1,5 @@
/*
* $Id: types.h 524 2011-07-26 15:41:20Z hyunghwan.chung $
* $Id: types.h 549 2011-08-14 09:07:31Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -555,22 +555,22 @@ typedef struct qse_xptl_t qse_xptl_t;
* allocate a memory chunk of the size @a n.
* @return pointer to a memory chunk on success, QSE_NULL on failure.
*/
typedef void* (*qse_mmgr_alloc_t) (void* udd, qse_size_t n);
typedef void* (*qse_mmgr_alloc_t) (void* ctx, qse_size_t n);
/**
* resize a memory chunk pointed to by @a ptr to the size @a n.
* @return pointer to a memory chunk on success, QSE_NULL on failure.
*/
typedef void* (*qse_mmgr_realloc_t) (void* udd, void* ptr, qse_size_t n);
typedef void* (*qse_mmgr_realloc_t) (void* ctx, void* ptr, qse_size_t n);
/**
* free a memory chunk pointed to by @a ptr.
*/
typedef void (*qse_mmgr_free_t) (void* udd, void* ptr);
typedef void (*qse_mmgr_free_t) (void* ctx, void* ptr);
/**
* The qse_mmgr_t type defines a set of functions for memory management.
* As the type is merely a structure, it is just used as a single container
* for memory management functions with a pointer to user-defined data.
* The user-defined data pointer @a udd is passed to each memory management
* The user-defined data pointer @a ctx is passed to each memory management
* function whenever it is called. You can allocate, reallocate, and free
* a memory chunk.
*
@ -582,7 +582,7 @@ struct qse_mmgr_t
qse_mmgr_alloc_t alloc; /**< allocation function */
qse_mmgr_realloc_t realloc; /**< resizing function */
qse_mmgr_free_t free; /**< disposal function */
void* udd; /**< user-defined data pointer */
void* ctx; /**< user-defined data pointer */
};
typedef struct qse_mmgr_t qse_mmgr_t;

View File

@ -1,2 +1,2 @@
SUBDIRS = cmn sed awk cut stx net
SUBDIRS = cmn sed awk cut net stx
DIST_SUBDIRS = $(SUBDIRS)

View File

@ -229,7 +229,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = cmn sed awk cut stx net
SUBDIRS = cmn sed awk cut net stx
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c 520 2011-07-25 07:32:49Z hyunghwan.chung $
* $Id: run.c 549 2011-08-14 09:07:31Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -1892,7 +1892,7 @@ static int run_block0 (qse_awk_rtx_t* rtx, qse_awk_nde_blk_t* nde)
#define ON_STATEMENT(rtx,nde) \
if ((rtx)->awk->stopall) (rtx)->exit_level = EXIT_ABORT; \
if ((rtx)->rcb.stm) (rtx)->rcb.stm (rtx, nde, (rtx)->rcb.udd);
if ((rtx)->rcb.stm) (rtx)->rcb.stm (rtx, nde, (rtx)->rcb.ctx);
static int run_statement (qse_awk_rtx_t* rtx, qse_awk_nde_t* nde)
{

View File

@ -24,19 +24,19 @@
QSE_BEGIN_NAMESPACE(QSE)
/////////////////////////////////
void* Mmgr::alloc_mem (void* udd, size_t n)
void* Mmgr::alloc_mem (void* ctx, size_t n)
{
return ((Mmgr*)udd)->allocMem (n);
return ((Mmgr*)ctx)->allocMem (n);
}
void* Mmgr::realloc_mem (void* udd, void* ptr, size_t n)
void* Mmgr::realloc_mem (void* ctx, void* ptr, size_t n)
{
return ((Mmgr*)udd)->reallocMem (ptr, n);
return ((Mmgr*)ctx)->reallocMem (ptr, n);
}
void Mmgr::free_mem (void* udd, void* ptr)
void Mmgr::free_mem (void* ctx, void* ptr)
{
return ((Mmgr*)udd)->freeMem (ptr);
return ((Mmgr*)ctx)->freeMem (ptr);
}
/////////////////////////////////

View File

@ -1,5 +1,5 @@
/*
* $Id: mem.c 441 2011-04-22 14:28:43Z hyunghwan.chung $
* $Id: mem.c 549 2011-08-14 09:07:31Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -19,7 +19,12 @@
*/
#include <qse/cmn/mem.h>
#include <stdlib.h>
#if defined(_WIN32)
# include <windows.h>
#else
# include <stdlib.h>
#endif
#if defined(__SPU__)
#include <spu_intrinsics.h>
@ -417,17 +422,40 @@ void* qse_memrmem (const void* hs, qse_size_t hl, const void* nd, qse_size_t nl)
static void* mmgr_alloc (void* data, qse_size_t n)
{
#if defined(_WIN32)
HANDLE heap;
heap = GetProcessHeap ();
if (heap == NULL) return QSE_NULL;
return HeapAlloc (heap, 0, n);
#else
/* TODO: need to rewrite this for __OS2__ using DosAllocMem()? */
return malloc (n);
#endif
}
static void* mmgr_realloc (void* data, void* ptr, qse_size_t n)
{
#if defined(_WIN32)
HANDLE heap;
heap = GetProcessHeap ();
if (heap == NULL) return QSE_NULL;
return ptr? HeapReAlloc (heap, 0, ptr, n):
HeapAlloc (heap, 0, n);
#else
return realloc (ptr, n);
#endif
}
static void mmgr_free (void* data, void* ptr)
{
#if defined(_WIN32)
HANDLE heap;
heap = GetProcessHeap ();
if (heap) HeapFree (heap, 0, ptr);
#else
free (ptr);
#endif
}
static qse_mmgr_t builtin_mmgr =

View File

@ -10,6 +10,7 @@ libqsenet_la_SOURCES = \
http.c \
htre.c \
htrd.c \
httpd.h \
httpd.c \
httpd_task.c

View File

@ -247,6 +247,7 @@ libqsenet_la_SOURCES = \
http.c \
htre.c \
htrd.c \
httpd.h \
httpd.c \
httpd_task.c

View File

@ -178,7 +178,7 @@ next:
{
qse_char_t buf[256];
scm->prm.sprintf (
scm->prm.udd,
scm->prm.ctx,
buf, QSE_COUNTOF(buf),
QSE_T("%Lf"),
#ifdef __MINGW32__

View File

@ -8,6 +8,8 @@ AM_CPPFLAGS = \
lib_LTLIBRARIES = libqsestx.la
libqsestx_la_SOURCES = stx.c err.c hash.c mem.c obj.c sym.c dic.c cls.c boot.c par.c
libqsestx_la_SOURCES = \
stx.h hash.h mem.h obj.h sym.h dic.h cls.h boot.h \
stx.c err.c hash.c mem.c obj.c sym.c dic.c cls.c boot.c par.c
libqsestx_la_LDFLAGS = -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined
libqsestx_la_LIBADD = -lqsecmn

View File

@ -243,7 +243,10 @@ AM_CPPFLAGS = \
-I$(includedir)
lib_LTLIBRARIES = libqsestx.la
libqsestx_la_SOURCES = stx.c err.c hash.c mem.c obj.c sym.c dic.c cls.c boot.c par.c
libqsestx_la_SOURCES = \
stx.h hash.h mem.h obj.h sym.h dic.h cls.h boot.h \
stx.c err.c hash.c mem.c obj.c sym.c dic.c cls.c boot.c par.c
libqsestx_la_LDFLAGS = -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined
libqsestx_la_LIBADD = -lqsecmn
all: all-am

View File

@ -1,8 +1,10 @@
AUTOMAKE_OPTIONS = no-dependencies
noinst_SCRIPTS = regress.sh
EXTRA_DIST = \
regress.sh \
regress.out \
regress.out.xma \
adr-001.awk \
adr-002.awk \
asm.awk \
@ -127,8 +129,28 @@ EXTRA_DIST = \
cou.dat \
emp.dat \
indent.dat \
passwd.dat \
quicksort2.dat \
quicksort.dat \
stripcomment.dat \
unr.dat \
asm.s
asm.s \
lisp/awklisp \
lisp/lists \
lisp/perlisp \
lisp/tail.lsp \
lisp/eliza.dat \
lisp/Manual \
lisp/README \
lisp/test.scm \
lisp/eliza.lsp \
lisp/numbers \
lisp/scheme.lsp \
lisp/trace \
lisp/fib.lsp \
lisp/numbers.dat \
lisp/scmhelp.lsp \
lisp/Impl-notes \
lisp/old-awklisp \
lisp/startup

View File

@ -14,6 +14,7 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@ -34,7 +35,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = regress/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/regress.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
@ -44,8 +46,9 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = regress.sh
CONFIG_CLEAN_VPATH_FILES =
SCRIPTS = $(noinst_SCRIPTS)
depcomp =
am__depfiles_maybe =
SOURCES =
@ -193,9 +196,10 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = no-dependencies
noinst_SCRIPTS = regress.sh
EXTRA_DIST = \
regress.sh \
regress.out \
regress.out.xma \
adr-001.awk \
adr-002.awk \
asm.awk \
@ -320,11 +324,30 @@ EXTRA_DIST = \
cou.dat \
emp.dat \
indent.dat \
passwd.dat \
quicksort2.dat \
quicksort.dat \
stripcomment.dat \
unr.dat \
asm.s
asm.s \
lisp/awklisp \
lisp/lists \
lisp/perlisp \
lisp/tail.lsp \
lisp/eliza.dat \
lisp/Manual \
lisp/README \
lisp/test.scm \
lisp/eliza.lsp \
lisp/numbers \
lisp/scheme.lsp \
lisp/trace \
lisp/fib.lsp \
lisp/numbers.dat \
lisp/scmhelp.lsp \
lisp/Impl-notes \
lisp/old-awklisp \
lisp/startup
all: all-am
@ -359,6 +382,8 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
regress.sh: $(top_builddir)/config.status $(srcdir)/regress.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
@ -404,7 +429,7 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
all-am: Makefile
all-am: Makefile $(SCRIPTS)
installdirs:
install: install-am
install-exec: install-exec-am

View File

@ -1,6 +1,6 @@
BEGIN {
recurse1 = "../../cmd/awk/qseawk -f quicksort2.awk #" rand()
recurse2 = "../../cmd/awk/qseawk -f quicksort2.awk #" rand()
recurse1 = QSEAWK " -vQSEAWK=" QSEAWK " -vSCRIPT_PATH=" SCRIPT_PATH " -f " SCRIPT_PATH "/quicksort2.awk #" rand()
recurse2 = QSEAWK " -vQSEAWK=" QSEAWK " -vSCRIPT_PATH=" SCRIPT_PATH " -f " SCRIPT_PATH "/quicksort2.awk #" rand()
}
NR == 1 {
pivot=$0;

View File

@ -37,12 +37,12 @@ print_usage()
###################
[ -z "${QSEAWK}" ] && {
QSEAWK=../../cmd/awk/.libs/qseawk
[ -f "${QSEAWK}" ] || QSEAWK=../../cmd/awk/qseawk
QSEAWK="@abs_top_builddir@/cmd/awk/.libs/qseawk"
[ -f "${QSEAWK}" ] || QSEAWK="@abs_top_builddir@/cmd/awk/qseawk"
}
[ -z "${QSESED}" ] && {
QSESED=../../cmd/sed/.libs/qsesed
[ -f "${QSESED}" ] || QSESED=../../cmd/sed/qsesed
QSESED="@abs_top_builddir@/cmd/sed/.libs/qsesed"
[ -f "${QSESED}" ] || QSESED="@abs_top_builddir@/cmd/sed/qsesed"
}
[ -f "${QSEAWK}" -a -x "${QSEAWK}" ] || {
echo_so "the executable '${QSEAWK}' is not found or not executable"
@ -55,6 +55,10 @@ print_usage()
QSEAWK_BASENAME="`basename "${QSEAWK}"`"
SCRIPT_DIR="@abs_top_srcdir@/regress/awk"
BASE_OUTFILE="@abs_top_srcdir@/regress/awk/regress.out"
BASE_OUTFILE_XMA="@abs_top_srcdir@/regress/awk/regress.out.xma"
TMPFILE="${TMPFILE:=./regress.temp}"
OUTFILE="${OUTFILE:=./regress.out}"
OUTFILE_XMA="${OUTFILE}.xma"
@ -173,7 +177,7 @@ PROGS="
levenshtein-utests.awk!!!--newline=on --include=on
rcalc.awk!!!--newline=on -v target=89000
quicksort.awk!quicksort.dat!!
quicksort2.awk!quicksort2.dat!!
quicksort2.awk!quicksort2.dat!!-vQSEAWK=\"${QSEAWK}\" -vSCRIPT_PATH=\"${SCRIPT_DIR}\"
asm.awk!asm.s!asm.dat!
stripcomment.awk!stripcomment.dat!!
wordfreq.awk!wordfreq.awk!!
@ -208,23 +212,34 @@ run_scripts()
script="`echo ${prog} | cut -d! -f1`"
datafile="`echo ${prog} | cut -d! -f2`"
redinfile="`echo ${prog} | cut -d! -f3`"
readinfile="`echo ${prog} | cut -d! -f3`"
awkopts="`echo ${prog} | cut -d! -f4`"
orgscript="${script}"
[ -z "${script}" ] && continue
script_path="@abs_srcdir@/${script}"
datafile_path="@abs_srcdir@/${datafile}"
readinfile_path="@abs_srcdir@/${readinfile}"
[ -f "${script}".dp ] && script="${script}.dp"
[ -f "${script}" ] ||
[ -f "${script_path}" ] ||
{
echo_so "${script} not found"
continue
}
[ -z "${redinfile}" ] && redinfile="/dev/stdin"
[ -z "${readinfile}" ] &&
{
readinfile="/dev/stdin"
readinfile_path="/dev/stdin"
}
echo_title "${valgrind} ${QSEAWK_BASENAME} ${extraopts} ${awkopts} -f ${orgscript} ${datafile} <${redinfile} 2>&1"
${valgrind} ${QSEAWK} ${extraopts} -o "${script}.dp" ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1
# if the datafile does not exist, let's not use the original name
[ -f "${datafile_path}" ] || datafile_path="$datafile"
echo_title "${valgrind} ${QSEAWK_BASENAME} ${extraopts} ${awkopts} -f ${orgscript} ${datafile} <${readinfile} 2>&1"
${valgrind} ${QSEAWK} ${extraopts} -o "${script}.dp" ${awkopts} -f ${script_path} ${datafile_path} <${readinfile_path} 2>&1
done < "${TMPFILE}"
@ -233,8 +248,9 @@ run_scripts()
run_test()
{
outfile="${1}"
extraopts="${2}"
base_outfile="${1}"
outfile="${2}"
extraopts="${3}"
rm -f *.dp
echo_so "FIRST RUN WITH ORIGINAL SOURCE"
@ -255,11 +271,11 @@ run_test()
# diff -q is not supported on old platforms.
# redirect output to /dev/null instead.
diff "${outfile}" "${outfile}.test" > /dev/null || {
diff "${base_outfile}" "${outfile}.test" > /dev/null || {
echo_so "ERROR: Difference is found between expected output and actual output."
echo_so " The expected output is stored in '${outfile}'."
echo_so " The expected output is stored in '${base_outfile}'."
echo_so " The actual output is stored in '${outfile}.test'."
echo_so " You may execute 'diff ${outfile} ${outfile}.test' for more info."
echo_so " You may execute 'diff ${base_outfile} ${outfile}.test' for more info."
return 1
}
rm -f "${outfile}.test"
@ -269,21 +285,23 @@ run_test()
case $1 in
init)
rm -f *.dp
run_scripts "" "" > "${OUTFILE}"
run_scripts "" "${XMAOPTS}" > "${OUTFILE_XMA}"
run_scripts "" "" > "${BASE_OUTFILE}"
run_scripts "" "${XMAOPTS}" > "${BASE_OUTFILE_XMA}"
rm -f *.dp
echo_so "INIT OK"
;;
test)
run_test "${OUTFILE}" "" && {
run_test "${OUTFILE_XMA}" "${XMAOPTS}" && {
#diff "${OUTFILE}" "${OUTFILE_XMA}" | grep -v '^\[CMD\] '
${QSESED} "s|${QSEAWK_BASENAME} ${XMAOPTS}|${QSEAWK_BASENAME} |" "${OUTFILE_XMA}" > "${OUTFILE_XMA}.$$"
diff "${OUTFILE}" "${OUTFILE_XMA}.$$" || {
run_test "${BASE_OUTFILE}" "${OUTFILE}" "" &&
{
run_test "${BASE_OUTFILE_XMA}" "${OUTFILE_XMA}" "${XMAOPTS}" &&
{
${QSESED} "s|${QSESED_BASENAME} ${XMAOPTS}|${QSESED_BASENAME} |" "${OUTFILE_XMA}.test" > "${OUTFILE_XMA}.$$"
diff "${OUTFILE}.test" "${OUTFILE_XMA}.$$" ||
{
rm -f "${OUTFILE_XMA}.$$"
echo_so "ERROR: Difference is found between normal output and xma output."
echo_so " The normal output is stored in '${OUTFILE}'."
echo_so " The xma output is stored in '${OUTFILE_XMA}'."
echo_so " The normal output is stored in '${OUTFILE}.test'."
echo_so " The xma output is stored in '${OUTFILE_XMA}.test'."
echo_so " Ignore lines staring with [CMD] in the difference."
exit 1;
}

View File

@ -1,7 +1,9 @@
AUTOMAKE_OPTIONS = no-dependencies
noinst_SCRIPTS = regress.sh
EXTRA_DIST = \
regress.sh regress.out \
regress.out regress.out.xma \
s001.sed s001.dat \
s002.sed s002.dat \
s003.sed s003.dat \

View File

@ -14,6 +14,7 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@ -34,7 +35,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = regress/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/regress.sh.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
@ -44,8 +46,9 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = regress.sh
CONFIG_CLEAN_VPATH_FILES =
SCRIPTS = $(noinst_SCRIPTS)
depcomp =
am__depfiles_maybe =
SOURCES =
@ -193,8 +196,9 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = no-dependencies
noinst_SCRIPTS = regress.sh
EXTRA_DIST = \
regress.sh regress.out \
regress.out regress.out.xma \
s001.sed s001.dat \
s002.sed s002.dat \
s003.sed s003.dat \
@ -233,6 +237,8 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
regress.sh: $(top_builddir)/config.status $(srcdir)/regress.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
@ -278,7 +284,7 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
all-am: Makefile
all-am: Makefile $(SCRIPTS)
installdirs:
install: install-am
install-exec: install-exec-am

View File

@ -37,8 +37,8 @@ print_usage()
###################
[ -z "${QSESED}" ] && {
QSESED=../../cmd/sed/.libs/qsesed
[ -f "${QSESED}" ] || QSESED=../../cmd/sed/qsesed
QSESED="@abs_top_builddir@/cmd/sed/.libs/qsesed"
[ -f "${QSESED}" ] || QSESED="@abs_top_builddir@/cmd/sed/qsesed"
}
[ -f "${QSESED}" -a -x "${QSESED}" ] || {
echo_so "the executable '${QSESED}' is not found or not executable"
@ -47,6 +47,9 @@ print_usage()
QSESED_BASENAME="`basename "${QSESED}"`"
BASE_OUTFILE="@abs_top_srcdir@/regress/sed/regress.out"
BASE_OUTFILE_XMA="@abs_top_srcdir@/regress/sed/regress.out.xma"
TMPFILE="${TMPFILE:=./regress.temp}"
OUTFILE="${OUTFILE:=./regress.out}"
OUTFILE_XMA="${OUTFILE}.xma"
@ -77,21 +80,32 @@ run_scripts()
script="`echo ${prog} | cut -d/ -f1`"
datafile="`echo ${prog} | cut -d/ -f2`"
redinfile="`echo ${prog} | cut -d/ -f3`"
readinfile="`echo ${prog} | cut -d/ -f3`"
options="`echo ${prog} | cut -d/ -f4`"
[ -z "${script}" ] && continue
[ -f "${script}" ] ||
script_path="@abs_srcdir@/${script}"
datafile_path="@abs_srcdir@/${datafile}"
readinfile_path="@abs_srcdir@/${readinfile}"
[ -f "${script_path}" ] ||
{
echo_so "${script} not found"
echo_so "${script_path} not found"
continue
}
[ -z "${redinfile}" ] && redinfile="/dev/stdin"
[ -z "${readinfile}" ] &&
{
readinfile="/dev/stdin"
readinfile_path="/dev/stdin"
}
echo_title "${valgrind} ${QSESED_BASENAME} ${extraopts} ${options} -f ${script} ${datafile} <${redinfile} 2>&1"
${valgrind} ${QSESED} ${extraopts} ${options} -f ${script} ${datafile} <${redinfile} 2>&1
# if the datafile does not exist, let's not use the original name
#[ -f "${datafile_path}" ] || datafile_path="$datafile"
echo_title "${valgrind} ${QSESED_BASENAME} ${extraopts} ${options} -f ${script} ${datafile} <${readinfile} 2>&1"
${valgrind} ${QSESED} ${extraopts} ${options} -f ${script_path} ${datafile_path} <${readinfile_path} 2>&1
done < "${TMPFILE}"
@ -100,39 +114,43 @@ run_scripts()
run_test()
{
outfile="${1}"
extraopts="${2}"
base_outfile="${1}"
outfile="${2}"
extraopts="${3}"
run_scripts "" "${extraopts}"> "${outfile}.test"
# diff -q is not supported on old platforms.
# redirect output to /dev/null instead.
diff "${outfile}" "${outfile}.test" > /dev/null || {
diff "${base_outfile}" "${outfile}.test" > /dev/null || {
echo_so "ERROR: Difference is found between expected output and actual output."
echo_so " The expected output is stored in '${outfile}'."
echo_so " The expected output is stored in '${base_outfile}'."
echo_so " The actual output is stored in '${outfile}.test'."
echo_so " You may execute 'diff ${outfile} ${outfile}.test' for more info."
echo_so " You may execute 'diff ${base_outfile} ${outfile}.test' for more info."
return 1
}
rm -f "${outfile}.test"
# rm -f "${outfile}.test"
return 0
}
case $1 in
init)
run_scripts "" "" > "${OUTFILE}"
run_scripts "" "${XMAOPTS}" > "${OUTFILE_XMA}"
run_scripts "" "" > "${BASE_OUTFILE}"
run_scripts "" "${XMAOPTS}" > "${BASE_OUTFILE_XMA}"
echo_so "INIT OK"
;;
test)
run_test "${OUTFILE}" "" && {
run_test "${OUTFILE_XMA}" "${XMAOPTS}" && {
${QSESED} "s|${QSESED_BASENAME} ${XMAOPTS}|${QSESED_BASENAME} |" "${OUTFILE_XMA}" > "${OUTFILE_XMA}.$$"
diff "${OUTFILE}" "${OUTFILE_XMA}.$$" || {
run_test "${BASE_OUTFILE}" "${OUTFILE}" "" &&
{
run_test "${BASE_OUTFILE_XMA}" "${OUTFILE_XMA}" "${XMAOPTS}" &&
{
${QSESED} "s|${QSESED_BASENAME} ${XMAOPTS}|${QSESED_BASENAME} |" "${OUTFILE_XMA}.test" > "${OUTFILE_XMA}.$$"
diff "${OUTFILE}.test" "${OUTFILE_XMA}.$$" ||
{
rm -f "${OUTFILE_XMA}.$$"
echo_so "ERROR: Difference is found between normal output and xma output."
echo_so " The normal output is stored in '${OUTFILE}'."
echo_so " The xma output is stored in '${OUTFILE_XMA}'."
echo_so " The normal output is stored in '${OUTFILE}.test'."
echo_so " The xma output is stored in '${OUTFILE_XMA}.test'."
echo_so " Ignore lines staring with [CMD] in the difference."
exit 1;
}

View File

@ -1 +1 @@
SUBDIRS = cmn awk cut sed
SUBDIRS = cmn awk cut sed net

View File

@ -230,7 +230,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = cmn awk cut sed
SUBDIRS = cmn awk cut sed net
all: all-recursive
.SUFFIXES:

View File

@ -110,7 +110,7 @@ static int test2 ()
return -1;
}
mmgr.udd = fma;
mmgr.ctx = fma;
if (qse_rbt_init (&rbt, &mmgr, QSE_SIZEOF(long), QSE_SIZEOF(long)) == QSE_NULL)
{
qse_printf (QSE_T("cannot initialize a tree\n"));

View File

@ -165,7 +165,7 @@ static int test5 ()
return -1;
}
xmammgr.udd = xma1;
xmammgr.xma = xma1;
xma2 = qse_xma_open (&xmammgr, 0, 500000L);
if (xma1 == QSE_NULL)