added the Mmgr class and modifiled related classes

This commit is contained in:
hyung-hwan 2009-05-21 04:44:47 +00:00
parent 3ab1bfff92
commit b7f8bba219
23 changed files with 360 additions and 96 deletions

View File

@ -561,7 +561,7 @@ protected:
return 1;
}
void* allocMem (size_t n)
void* allocMem (size_t n) throw ()
{
#ifdef _WIN32
return ::HeapAlloc (heap, 0, n);
@ -570,7 +570,7 @@ protected:
#endif
}
void* reallocMem (void* ptr, size_t n)
void* reallocMem (void* ptr, size_t n) throw ()
{
#ifdef _WIN32
if (ptr == NULL)
@ -582,7 +582,7 @@ protected:
#endif
}
void freeMem (void* ptr)
void freeMem (void* ptr) throw ()
{
#ifdef _WIN32
::HeapFree (heap, 0, ptr);

View File

@ -4,6 +4,10 @@ SUBDIRS = cmn utl awk lsp
pkginclude_HEADERS = config.h.in conf_msw.h conf_vms.h types.h macros.h pack1.h unpack.h
if ENABLE_CXX
pkginclude_HEADERS += Mmgr.hpp
endif
pkgincludedir= $(includedir)/qse
CLEANFILES = *dist

67
qse/include/qse/Mmgr.hpp Normal file
View File

@ -0,0 +1,67 @@
/*
* $Id: Sed.hpp 127 2009-05-07 13:15:04Z baconevi $
*
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_MMGR_HPP_
#define _QSE_MMGR_HPP_
#include <qse/types.h>
#include <qse/macros.h>
/////////////////////////////////
QSE_BEGIN_NAMESPACE(QSE)
/////////////////////////////////
class Mmgr: public qse_mmgr_t
{
public:
Mmgr () throw ()
{
this->alloc = alloc_mem;
this->realloc = realloc_mem;
this->free = free_mem;
this->data = this;
}
virtual ~Mmgr () {}
protected:
virtual void* allocMem (qse_size_t n) throw () = 0;
virtual void* reallocMem (void* ptr, qse_size_t n) throw () = 0;
virtual void freeMem (void* ptr) throw () = 0;
static void* alloc_mem (void* data, qse_size_t n) throw ()
{
return ((Mmgr*)data)->allocMem (n);
}
static void* realloc_mem (void* data, void* ptr, qse_size_t n) throw ()
{
return ((Mmgr*)data)->reallocMem (ptr, n);
}
static void free_mem (void* data, void* ptr) throw ()
{
return ((Mmgr*)data)->freeMem (ptr);
}
};
/////////////////////////////////
QSE_END_NAMESPACE(QSE)
/////////////////////////////////
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp 127 2009-05-07 13:15:04Z hyunghwan.chung $
* $Id: Awk.hpp 148 2009-05-20 10:44:47Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -22,6 +22,7 @@
#include <qse/awk/awk.h>
#include <qse/cmn/map.h>
#include <qse/cmn/chr.h>
#include <qse/Mmgr.hpp>
#include <stdarg.h>
/////////////////////////////////
@ -31,7 +32,7 @@ QSE_BEGIN_NAMESPACE(QSE)
/**
* Represents the AWK interpreter engine
*/
class Awk
class Awk: public Mmgr
{
public:
/** Boolean data type */
@ -732,9 +733,7 @@ public:
};
/** Constructor */
Awk ();
/** Destructor */
virtual ~Awk ();
Awk () throw ();
/** Returns the underlying handle */
operator awk_t* () const;
@ -1022,10 +1021,6 @@ protected:
virtual void onRunStatement (Run& run, size_t line);
// primitive handlers
virtual void* allocMem (size_t n) = 0;
virtual void* reallocMem (void* ptr, size_t n) = 0;
virtual void freeMem (void* ptr) = 0;
virtual real_t pow (real_t x, real_t y) = 0;
virtual int vsprintf (char_t* buf, size_t size,
const char_t* fmt, va_list arg) = 0;
@ -1054,10 +1049,6 @@ protected:
static void onRunExit (rtx_t* run, val_t* ret, void* data);
static void onRunStatement (rtx_t* run, size_t line, void* data);
static void* allocMem (void* data, size_t n);
static void* reallocMem (void* data, void* ptr, size_t n);
static void freeMem (void* data, void* ptr);
static real_t pow (awk_t* data, real_t x, real_t y);
static int sprintf (awk_t* data, char_t* buf, size_t size,
const char_t* fmt, ...);
@ -1078,8 +1069,6 @@ protected:
private:
Awk (const Awk&);
Awk& operator= (const Awk&);
mmgr_t mmgr;
};
/////////////////////////////////

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.hpp 127 2009-05-07 13:15:04Z hyunghwan.chung $
* $Id: StdAwk.hpp 148 2009-05-20 10:44:47Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -33,7 +33,6 @@ QSE_BEGIN_NAMESPACE(QSE)
class StdAwk: public Awk
{
public:
StdAwk ();
int open ();
int run (const char_t** args, size_t nargs);
@ -80,9 +79,9 @@ protected:
int flushFile (File& io);
// primitive handlers
void* allocMem (size_t n);
void* reallocMem (void* ptr, size_t n);
void freeMem (void* ptr);
void* allocMem (size_t n) throw ();
void* reallocMem (void* ptr, size_t n) throw ();
void freeMem (void* ptr) throw ();
real_t pow (real_t x, real_t y);
int vsprintf (char_t* buf, size_t size,

View File

@ -1,6 +1,10 @@
pkginclude_HEADERS = mem.h chr.h str.h lda.h map.h rex.h sll.h dll.h opt.h tio.h fio.h pio.h sio.h time.h
#if ENABLE_CXX
#pkginclude_HEADERS +=
#endif
pkgincludedir = $(includedir)/qse/cmn
CLEANFILES = *dist

View File

@ -1,5 +1,5 @@
pkginclude_HEADERS = sed.h
pkginclude_HEADERS = sed.h Sed.hpp StdSed.hpp
pkgincludedir= $(includedir)/qse/sed

View File

@ -19,6 +19,7 @@
#ifndef _QSE_SED_SED_HPP_
#define _QSE_SED_SED_HPP_
#include <qse/Mmgr.hpp>
#include <qse/sed/sed.h>
/////////////////////////////////
@ -28,11 +29,10 @@ QSE_BEGIN_NAMESPACE(QSE)
/**
* The Sed class implements a stream editor.
*/
class Sed:
class Sed: public Mmgr
{
public:
Sed () throw ();
~Sed () throw ();
Sed () throw (): sed (QSE_NULL) {}
int open () throw ();
void close () throw ();

View File

@ -0,0 +1,42 @@
/*
* $Id: Sed.hpp 127 2009-05-07 13:15:04Z baconevi $
*
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_SED_STDSED_HPP_
#define _QSE_SED_STDSED_HPP_
#include <qse/sed/Sed.hpp>
/////////////////////////////////
QSE_BEGIN_NAMESPACE(QSE)
/////////////////////////////////
class StdSed: public Sed
{
public:
protected:
void* allocMem (qse_size_t n) throw ();
void* reallocMem (void* ptr, qse_size_t n) throw ();
void freeMem (void* ptr) throw ();
};
/////////////////////////////////
QSE_END_NAMESPACE(QSE)
/////////////////////////////////
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.cpp 127 2009-05-07 13:15:04Z hyunghwan.chung $
* $Id: Awk.cpp 148 2009-05-20 10:44:47Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -1065,21 +1065,12 @@ void* Awk::Run::getData () const
// Awk
//////////////////////////////////////////////////////////////////
Awk::Awk (): awk (QSE_NULL), functionMap (QSE_NULL),
Awk::Awk () throw (): awk (QSE_NULL), functionMap (QSE_NULL),
sourceIn (Source::READ), sourceOut (Source::WRITE),
errnum (ERR_NOERR), errlin (0), runCallback (false)
{
this->errmsg[0] = QSE_T('\0');
mmgr.alloc = allocMem;
mmgr.realloc = reallocMem;
mmgr.free = freeMem;
mmgr.data = this;
}
Awk::~Awk ()
{
}
Awk::operator Awk::awk_t* () const
@ -1193,7 +1184,7 @@ int Awk::open ()
prm.pow = pow;
prm.sprintf = sprintf;
awk = qse_awk_open (&mmgr, QSE_SIZEOF(xtn_t), &prm);
awk = qse_awk_open (this, QSE_SIZEOF(xtn_t), &prm);
if (awk == QSE_NULL)
{
setError (ERR_NOMEM);
@ -1754,21 +1745,6 @@ void Awk::onRunStatement (rtx_t* run, size_t line, void* data)
r->awk->onRunStatement (*r, line);
}
void* Awk::allocMem (void* data, size_t n)
{
return ((Awk*)data)->allocMem (n);
}
void* Awk::reallocMem (void* data, void* ptr, size_t n)
{
return ((Awk*)data)->reallocMem (ptr, n);
}
void Awk::freeMem (void* data, void* ptr)
{
((Awk*)data)->freeMem (ptr);
}
Awk::real_t Awk::pow (awk_t* awk, real_t x, real_t y)
{
xtn_t* xtn = (xtn_t*) QSE_XTN (awk);

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.cpp 127 2009-05-07 13:15:04Z hyunghwan.chung $
* $Id: StdAwk.cpp 148 2009-05-20 10:44:47Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -37,10 +37,6 @@
QSE_BEGIN_NAMESPACE(QSE)
/////////////////////////////////
StdAwk::StdAwk ()
{
}
#define ADDFNC(name,min,max,impl) \
do { \
if (addFunction (name, min, max, \
@ -396,17 +392,17 @@ int StdAwk::flushFile (File& io)
}
// memory allocation primitives
void* StdAwk::allocMem (size_t n)
void* StdAwk::allocMem (size_t n) throw ()
{
return ::malloc (n);
}
void* StdAwk::reallocMem (void* ptr, size_t n)
void* StdAwk::reallocMem (void* ptr, size_t n) throw ()
{
return ::realloc (ptr, n);
}
void StdAwk::freeMem (void* ptr)
void StdAwk::freeMem (void* ptr) throw ()
{
::free (ptr);
}

View File

@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = nostdinc
AM_CFLAGS = -I$(top_builddir)/include
AM_CPPFLAGS = -I$(top_builddir)/include
lib_LTLIBRARIES = libqsecmn.la
libqsecmn_la_SOURCES = \

View File

@ -202,7 +202,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = nostdinc
AM_CFLAGS = -I$(top_builddir)/include
AM_CPPFLAGS = -I$(top_builddir)/include
lib_LTLIBRARIES = libqsecmn.la
libqsecmn_la_SOURCES = \
syscall.h mem.h chr.h \

View File

@ -1,5 +1,5 @@
AM_CFLAGS = -I$(top_builddir)/include
AM_CPPFLAGS = -I$(top_builddir)/include
lib_LTLIBRARIES = libqsesed.la
libqsesed_la_SOURCES = sed.c sed.h
@ -8,7 +8,7 @@ libqsesed_la_LIBADD = -lqsecmn -lqseutl
if ENABLE_CXX
lib_LTLIBRARIES += libqsesed++.la
libqsesed___la_SOURCES = Sed.cpp
libqsesed___la_SOURCES = Sed.cpp StdSed.cpp
libqsesed___la_LDFLAGS = -L. -L../cmn -L../utl -version-info 1:0:0 -no-undefined
libqsesed___la_LIBADD = -lqsesed -lqsecmn -lqseutl
endif

View File

@ -52,8 +52,8 @@ am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libqsesed___la_DEPENDENCIES =
am__libqsesed___la_SOURCES_DIST = Sed.cpp
@ENABLE_CXX_TRUE@am_libqsesed___la_OBJECTS = Sed.lo
am__libqsesed___la_SOURCES_DIST = Sed.cpp StdSed.cpp
@ENABLE_CXX_TRUE@am_libqsesed___la_OBJECTS = Sed.lo StdSed.lo
libqsesed___la_OBJECTS = $(am_libqsesed___la_OBJECTS)
libqsesed___la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
@ -217,12 +217,12 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = -I$(top_builddir)/include
AM_CPPFLAGS = -I$(top_builddir)/include
lib_LTLIBRARIES = libqsesed.la $(am__append_1)
libqsesed_la_SOURCES = sed.c sed.h
libqsesed_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn -L../utl
libqsesed_la_LIBADD = -lqsecmn -lqseutl
@ENABLE_CXX_TRUE@libqsesed___la_SOURCES = Sed.cpp
@ENABLE_CXX_TRUE@libqsesed___la_SOURCES = Sed.cpp StdSed.cpp
@ENABLE_CXX_TRUE@libqsesed___la_LDFLAGS = -L. -L../cmn -L../utl -version-info 1:0:0 -no-undefined
@ENABLE_CXX_TRUE@libqsesed___la_LIBADD = -lqsesed -lqsecmn -lqseutl
all: all-am
@ -297,6 +297,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sed.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StdSed.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sed.Plo@am__quote@
.c.o:

View File

@ -17,22 +17,26 @@
*/
#include <qse/sed/Sed.hpp>
#include "sed.h"
#include <qse/utl/stdio.h>
#include <stdlib.h>
/////////////////////////////////
QSE_BEGIN_NAMESPACE(QSE)
/////////////////////////////////
Sed::Sed () throw () : sed (QSE_NULL)
{
}
Sed::~Sed () throw ()
{
close ();
}
int Sed::open () throw ()
{
sed = qse_sed_open (this, QSE_SIZEOF(Sed*));
if (sed == QSE_NULL)
{
// TODO: set error...
return -1;
}
*(Sed**)QSE_XTN(sed) = this;
return 0;
}
void Sed::close () throw()
@ -44,8 +48,17 @@ void Sed::close () throw()
}
}
int Sed::compile () throw ()
{
return 0;
}
int Sed::execute () throw ()
{
return 0;
}
/////////////////////////////////
QSE_BEGIN_NAMESPACE(QSE)
QSE_END_NAMESPACE(QSE)
/////////////////////////////////

44
qse/lib/sed/StdSed.cpp Normal file
View File

@ -0,0 +1,44 @@
/*
* $Id: Sed.hpp 127 2009-05-07 13:15:04Z baconevi $
*
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.
*/
#include <qse/sed/StdSed.hpp>
#include <stdlib.h>
/////////////////////////////////
QSE_BEGIN_NAMESPACE(QSE)
/////////////////////////////////
void* StdSed::allocMem (qse_size_t n) throw ()
{
return ::malloc (n);
}
void* StdSed::reallocMem (void* ptr, qse_size_t n) throw ()
{
return ::realloc (ptr, n);
}
void StdSed::freeMem (void* ptr) throw ()
{
::free (ptr);
}
/////////////////////////////////
QSE_END_NAMESPACE(QSE)
/////////////////////////////////

View File

@ -1,5 +1,5 @@
AM_CFLAGS = -I$(top_builddir)/include
AM_CPPFLAGS = -I$(top_builddir)/include
lib_LTLIBRARIES = libqseutl.la
libqseutl_la_SOURCES = \

View File

@ -32,6 +32,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@ENABLE_CXX_TRUE@am__append_1 = libqsesed++.la
subdir = lib/utl
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -50,6 +51,14 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
libqsesed___la_DEPENDENCIES =
am__libqsesed___la_SOURCES_DIST = Sed.cpp
@ENABLE_CXX_TRUE@am_libqsesed___la_OBJECTS = Sed.lo
libqsesed___la_OBJECTS = $(am_libqsesed___la_OBJECTS)
libqsesed___la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(libqsesed___la_LDFLAGS) $(LDFLAGS) -o $@
@ENABLE_CXX_TRUE@am_libqsesed___la_rpath = -rpath $(libdir)
libqseutl_la_DEPENDENCIES =
am_libqseutl_la_OBJECTS = assert.lo http.lo main.lo stdio.lo tgp.lo
libqseutl_la_OBJECTS = $(am_libqseutl_la_OBJECTS)
@ -68,8 +77,18 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libqseutl_la_SOURCES)
DIST_SOURCES = $(libqseutl_la_SOURCES)
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libqsesed___la_SOURCES) $(libqseutl_la_SOURCES)
DIST_SOURCES = $(am__libqsesed___la_SOURCES_DIST) \
$(libqseutl_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -198,8 +217,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = -I$(top_builddir)/include
lib_LTLIBRARIES = libqseutl.la
AM_CPPFLAGS = -I$(top_builddir)/include
lib_LTLIBRARIES = libqseutl.la $(am__append_1)
libqseutl_la_SOURCES = \
assert.c http.c main.c stdio.c \
tgp.c \
@ -207,10 +226,13 @@ libqseutl_la_SOURCES = \
libqseutl_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn
libqseutl_la_LIBADD = -lqsecmn
@ENABLE_CXX_TRUE@libqsesed___la_SOURCES = Sed.cpp
@ENABLE_CXX_TRUE@libqsesed___la_LDFLAGS = -L. -L../cmn -L../utl -version-info 1:0:0 -no-undefined
@ENABLE_CXX_TRUE@libqsesed___la_LIBADD = -lqsesed -lqsecmn -lqseutl
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
.SUFFIXES: .c .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@ -267,6 +289,8 @@ clean-libLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libqsesed++.la: $(libqsesed___la_OBJECTS) $(libqsesed___la_DEPENDENCIES)
$(libqsesed___la_LINK) $(am_libqsesed___la_rpath) $(libqsesed___la_OBJECTS) $(libqsesed___la_LIBADD) $(LIBS)
libqseutl.la: $(libqseutl_la_OBJECTS) $(libqseutl_la_DEPENDENCIES)
$(libqseutl_la_LINK) -rpath $(libdir) $(libqseutl_la_OBJECTS) $(libqseutl_la_LIBADD) $(LIBS)
@ -276,6 +300,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sed.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assert.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@
@ -303,6 +328,27 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo

View File

@ -1,8 +1,11 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
bin_PROGRAMS = sed01
bin_PROGRAMS = sed01 sed02
LDFLAGS = -L../../lib/cmn -L../../lib/utl -L../../lib/sed
LDADD = -lqsesed -lqseutl -lqsecmn $(LIBM)
sed01_SOURCES = sed01.c
sed02_SOURCES = sed02.cpp
sed02_LDADD = -lqsesed++ $(LDADD)

View File

@ -32,7 +32,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = sed01$(EXEEXT)
bin_PROGRAMS = sed01$(EXEEXT) sed02$(EXEEXT)
subdir = test/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -50,6 +50,10 @@ sed01_OBJECTS = $(am_sed01_OBJECTS)
sed01_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
sed01_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_sed02_OBJECTS = sed02.$(OBJEXT)
sed02_OBJECTS = $(am_sed02_OBJECTS)
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
sed02_DEPENDENCIES = $(am__DEPENDENCIES_2)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/qse
depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp
am__depfiles_maybe = depfiles
@ -62,8 +66,17 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(sed01_SOURCES)
DIST_SOURCES = $(sed01_SOURCES)
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(sed01_SOURCES) $(sed02_SOURCES)
DIST_SOURCES = $(sed01_SOURCES) $(sed02_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -195,10 +208,12 @@ top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include
LDADD = -lqsesed -lqseutl -lqsecmn $(LIBM)
sed01_SOURCES = sed01.c
sed02_SOURCES = sed02.cpp
sed02_LDADD = -lqsesed++ $(LDADD)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
.SUFFIXES: .c .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
@ -259,6 +274,9 @@ clean-binPROGRAMS:
sed01$(EXEEXT): $(sed01_OBJECTS) $(sed01_DEPENDENCIES)
@rm -f sed01$(EXEEXT)
$(LINK) $(sed01_OBJECTS) $(sed01_LDADD) $(LIBS)
sed02$(EXEEXT): $(sed02_OBJECTS) $(sed02_DEPENDENCIES)
@rm -f sed02$(EXEEXT)
$(CXXLINK) $(sed02_OBJECTS) $(sed02_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -267,6 +285,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sed01.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sed02.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@ -289,6 +308,27 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo

40
qse/test/sed/sed02.cpp Normal file
View File

@ -0,0 +1,40 @@
/*
* $Id$
*
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.
*/
#include <qse/sed/StdSed.hpp>
#include <qse/utl/main.h>
#include <qse/utl/stdio.h>
int sed_main (int argc, qse_char_t* argv[])
{
QSE::StdSed sed;
if (sed.open () == -1)
{
qse_printf (QSE_T("cannot open a stream editor\n"));
return -1;
}
sed.close ();
return 0;
}
int qse_main (int argc, char* argv[])
{
return qse_runmain (argc, argv, sed_main);
}