- fixed a bug in pio.c for WIN32

- deleted unnecessary files.
- updated documentation.
This commit is contained in:
hyung-hwan 2009-12-15 06:50:11 +00:00
parent 7715b1b9f9
commit 41b716c195
28 changed files with 206 additions and 1224 deletions

View File

@ -1,2 +1,2 @@
SUBDIRS = sed awk cut lsp utl
SUBDIRS = sed awk cut lsp
DIST_SUBDIRS = $(SUBDIRS)

View File

@ -228,7 +228,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = sed awk cut lsp utl
SUBDIRS = sed awk cut lsp
DIST_SUBDIRS = $(SUBDIRS)
all: all-recursive

View File

@ -1,9 +0,0 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
bin_PROGRAMS = qsetgp
qsetgp_SOURCES = tgp.c
qsetgp_LDFLAGS = -L../../lib/utl
qsetgp_LDADD = -lqseutl

View File

@ -1,540 +0,0 @@
# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = qsetgp$(EXEEXT)
subdir = cmd/utl
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/ac/m4/libtool.m4 \
$(top_srcdir)/ac/m4/ltoptions.m4 \
$(top_srcdir)/ac/m4/ltsugar.m4 \
$(top_srcdir)/ac/m4/ltversion.m4 \
$(top_srcdir)/ac/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac
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_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_qsetgp_OBJECTS = tgp.$(OBJEXT)
qsetgp_OBJECTS = $(am_qsetgp_OBJECTS)
qsetgp_DEPENDENCIES =
qsetgp_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(qsetgp_LDFLAGS) \
$(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/qse
depcomp = $(SHELL) $(top_srcdir)/ac/au/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(qsetgp_SOURCES)
DIST_SOURCES = $(qsetgp_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHAR_MODE = @CHAR_MODE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
HAVE_OBJC = @HAVE_OBJC@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJCFLAGS = @OBJCFLAGS@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
QSE_PROJECT_URL = @QSE_PROJECT_URL@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
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_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
RANLIB = @RANLIB@
RM = @RM@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
ac_ct_OBJC = @ac_ct_OBJC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include
qsetgp_SOURCES = tgp.c
qsetgp_LDFLAGS = -L../../lib/utl
qsetgp_LDADD = -lqseutl
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cmd/utl/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign cmd/utl/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
qsetgp$(EXEEXT): $(qsetgp_OBJECTS) $(qsetgp_DEPENDENCIES)
@rm -f qsetgp$(EXEEXT)
$(qsetgp_LINK) $(qsetgp_OBJECTS) $(qsetgp_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgp.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,223 +0,0 @@
/*
* $Id: tgp.c,v 1.5 2007/05/16 09:15:14 bacon Exp $
*/
#include <qse/utl/tgp.h>
#include <qse/cmn/stdio.h>
#include <qse/cmn/main.h>
#include <qse/cmn/mem.h>
#include <qse/cmn/chr.h>
#include <qse/cmn/str.h>
#include <qse/cmn/opt.h>
#include <string.h>
#include <stdlib.h>
#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
#endif
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#endif
#if defined(__linux) && defined(_DEBUG)
#include <mcheck.h>
#endif
static void print_usage (const qse_char_t* argv0)
{
qse_fprintf (QSE_STDERR,
QSE_T("Usage: %s [options] [file]\n"), argv0);
qse_fprintf (QSE_STDERR,
QSE_T(" -h print this message\n"));
qse_fprintf (QSE_STDERR,
QSE_T(" -u user id\n"));
qse_fprintf (QSE_STDERR,
QSE_T(" -g group id\n"));
qse_fprintf (QSE_STDERR,
QSE_T(" -r chroot\n"));
qse_fprintf (QSE_STDERR,
QSE_T(" -U enable upload\n"));
}
static int handle_args (int argc, qse_char_t* argv[])
{
qse_opt_t opt;
qse_cint_t c;
qse_memset (&opt, 0, QSE_SIZEOF(opt));
opt.str = QSE_T("hu:g:r:");
while ((c = qse_getopt (argc, argv, &opt)) != QSE_CHAR_EOF)
{
switch (c)
{
case QSE_T('h'):
print_usage (argv[0]);
return -1;
case QSE_T('?'):
qse_fprintf (QSE_STDERR, QSE_T("Error: illegal option - %c\n"), opt.opt);
print_usage (argv[0]);
return -1;
case QSE_T(':'):
qse_fprintf (QSE_STDERR, QSE_T("Error: missing argument for %c\n"), opt.opt);
print_usage (argv[0]);
return -1;
case QSE_T('u'):
//opt.arg;
break;
case QSE_T('g'):
//opt.arg;
break;
case QSE_T('r'):
//opt.arg;
break;
case QSE_T('U'):
//opt.arg;
break;
}
}
if (opt.ind < argc)
{
qse_printf (QSE_T("Error: redundant argument - %s\n"), argv[opt.ind]);
print_usage (argv[0]);
return -1;
}
return 0;
}
typedef struct xin_t
{
const qse_char_t* name;
QSE_FILE* fp;
} xin_t;
typedef struct xout_t
{
const qse_char_t* name;
QSE_FILE* fp;
} xout_t;
static int io_in (int cmd, void* arg, qse_char_t* buf, int len)
{
xin_t* xin = (xin_t*)arg;
switch (cmd)
{
case QSE_TGP_IO_OPEN:
xin->fp = (xin->name == QSE_NULL)?
QSE_STDIN:
qse_fopen(xin->name,QSE_T("r"));
return (xin->fp == NULL)? -1: 0;
case QSE_TGP_IO_CLOSE:
if (xin->name != QSE_NULL) qse_fclose (xin->fp);
return 0;
case QSE_TGP_IO_READ:
if (qse_fgets (buf, len, xin->fp) == QSE_NULL) return 0;
return qse_strlen(buf);
}
return -1;
}
static int io_out (int cmd, void* arg, qse_char_t* buf, int len)
{
xout_t* xout = (xout_t*)arg;
switch (cmd)
{
case QSE_TGP_IO_OPEN:
xout->fp = (xout->name == QSE_NULL)?
QSE_STDOUT:
qse_fopen(xout->name,QSE_T("r"));
return (xout->fp == NULL)? -1: 0;
case QSE_TGP_IO_CLOSE:
if (xout->name != QSE_NULL) qse_fclose (xout->fp);
return 0;
case QSE_TGP_IO_WRITE:
qse_fprintf (xout->fp, QSE_T("%.*s"), len, buf);
return len;
}
return -1;
}
int tgp_main (int argc, qse_char_t* argv[])
{
qse_tgp_t* tgp;
xin_t xin;
xout_t xout;
int ret = 0;
if (handle_args (argc, argv) == -1) return -1;
tgp = qse_tgp_open (QSE_NULL, 0);
if (tgp == QSE_NULL)
{
qse_fprintf (QSE_STDERR,
QSE_T("Error: cannot create a tgp instance\n"));
return -1;
}
xin.name = QSE_T("x.tgp");
xout.name = QSE_NULL;
qse_tgp_attachin (tgp, io_in, &xin);
qse_tgp_attachout (tgp, io_out, &xout);
/*
qse_tgp_setexecin (tgp, io, );
qse_tgp_setexecout (tgp, io, );
*/
if (qse_tgp_run (tgp) == -1)
{
qse_fprintf (QSE_STDERR,
QSE_T("Error: cannot run a tgp instance\n"));
ret = -1;
}
qse_tgp_close (tgp);
return ret;
}
int qse_main (int argc, qse_achar_t* argv[])
{
int n;
#if defined(__linux) && defined(_DEBUG)
mtrace ();
#endif
n = qse_runmain (argc, argv, tgp_main);
#if defined(__linux) && defined(_DEBUG)
muntrace ();
#endif
#if defined(_WIN32) && defined(_MSC_VER) && defined(_DEBUG)
_CrtDumpMemoryLeaks ();
wprintf (L"Press ENTER to quit\n");
getchar ();
#endif
return n;
}

5
qse/configure vendored
View File

@ -17458,7 +17458,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/sed/Makefile include/qse/awk/Makefile include/qse/cut/Makefile include/qse/lsp/Makefile include/qse/utl/Makefile lib/Makefile lib/cmn/Makefile lib/sed/Makefile lib/awk/Makefile lib/cut/Makefile lib/lsp/Makefile lib/utl/Makefile cmd/Makefile cmd/sed/Makefile cmd/awk/Makefile cmd/cut/Makefile cmd/lsp/Makefile cmd/utl/Makefile samples/Makefile samples/cmn/Makefile samples/sed/Makefile samples/awk/Makefile samples/utl/Makefile regress/Makefile regress/awk/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/sed/Makefile include/qse/awk/Makefile include/qse/cut/Makefile include/qse/lsp/Makefile include/qse/utl/Makefile lib/Makefile lib/cmn/Makefile lib/sed/Makefile lib/awk/Makefile lib/cut/Makefile lib/lsp/Makefile lib/utl/Makefile cmd/Makefile cmd/sed/Makefile cmd/awk/Makefile cmd/cut/Makefile cmd/lsp/Makefile samples/Makefile samples/cmn/Makefile samples/sed/Makefile samples/awk/Makefile regress/Makefile regress/sed/Makefile regress/awk/Makefile doc/Makefile doc/page/Makefile doc/Doxyfile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -18568,13 +18568,12 @@ do
"cmd/awk/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/awk/Makefile" ;;
"cmd/cut/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/cut/Makefile" ;;
"cmd/lsp/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/lsp/Makefile" ;;
"cmd/utl/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/utl/Makefile" ;;
"samples/Makefile") CONFIG_FILES="$CONFIG_FILES samples/Makefile" ;;
"samples/cmn/Makefile") CONFIG_FILES="$CONFIG_FILES samples/cmn/Makefile" ;;
"samples/sed/Makefile") CONFIG_FILES="$CONFIG_FILES samples/sed/Makefile" ;;
"samples/awk/Makefile") CONFIG_FILES="$CONFIG_FILES samples/awk/Makefile" ;;
"samples/utl/Makefile") CONFIG_FILES="$CONFIG_FILES samples/utl/Makefile" ;;
"regress/Makefile") CONFIG_FILES="$CONFIG_FILES regress/Makefile" ;;
"regress/sed/Makefile") CONFIG_FILES="$CONFIG_FILES regress/sed/Makefile" ;;
"regress/awk/Makefile") CONFIG_FILES="$CONFIG_FILES regress/awk/Makefile" ;;
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"doc/page/Makefile") CONFIG_FILES="$CONFIG_FILES doc/page/Makefile" ;;

View File

@ -272,13 +272,12 @@ AC_CONFIG_FILES([
cmd/awk/Makefile
cmd/cut/Makefile
cmd/lsp/Makefile
cmd/utl/Makefile
samples/Makefile
samples/cmn/Makefile
samples/sed/Makefile
samples/awk/Makefile
samples/utl/Makefile
regress/Makefile
regress/sed/Makefile
regress/awk/Makefile
doc/Makefile
doc/page/Makefile

View File

@ -2,4 +2,5 @@
AUTOMAKE_OPTIONS = no-dependencies
EXTRA_DIST = Doxyfile.in gendoc.sh
SUBDIRS = page page.ko
SUBDIRS = page

View File

@ -234,7 +234,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = no-dependencies
EXTRA_DIST = Doxyfile.in gendoc.sh
SUBDIRS = page page.ko
SUBDIRS = page
all: all-recursive
.SUFFIXES:

View File

@ -123,12 +123,15 @@ dl.el {
.fragment {
font-family: monospace, fixed;
font-size: 105%;
/*font-size: 105%;*/
font-size: 95%;
}
pre.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
/*border: 1px solid #CCCCCC;*/
border: 1px dashed #CCCCCC;
/*background-color: #f5f5f5;*/
background-color: #F0FFF0;
padding: 4px 6px;
margin: 4px 8px 4px 2px;
}

View File

@ -15,6 +15,6 @@ SED="../test/sed/sed01"
# /^INPUT[[:space:]]*=/s/page/page.ja/' < Doxyfile > Doxyfile.ja
doxygen Doxyfile
doxygen Doxyfile.ko
#doxygen Doxyfile.ko
#doxygen Doxyfile.cn
#doxygen Doxyfile.ja

View File

@ -2,18 +2,121 @@
@section awk_intro INTRODUCTION
QSEAWK is an embeddable AWK interpreter that is a part of the @ref qse_intro "QSE" library. The design focuses on building a flexible and robust embedding API with minimal platform dependency. An embedding application is capable of
QSEAWK is an embeddable AWK interpreter and is a part of the @ref qse_intro
"QSE" library. The interpreter implements the language described in the book
<a class="el" href="http://cm.bell-labs.com/cm/cs/awkbook/">
The AWK Proramming Language</a>
with @ref awk_ext "extensions". Its design focuses on building a flexible
and robust embedding API with minimal platform dependency. An embedding
application is capable of
- adding new global variables and functions.
- getting and set the value of a global variable.
- calling a function.
- calling a function with or without parameters and getting its return value.
- customizing I/O handlers for file, pipe, console I/O.
- creating multiple interpreters independent of each other.
- running a single script with different I/O streams independently.
- changing language features by setting options.
- and more
The interpreter implements the language described in the book
The AWK Proramming Language (http://cm.bell-labs.com/cm/cs/awkbook/)
with some extensions.
Embedding an interpreter typically involves the following steps.
- open a new interpreter
- parse in a source script
- open a new runtime context
- execute pattern-action blocks or call a function
- close the runtime context
- close the interpter
The code example below demonstrates the steps in C. It executes the one liner
<b>BEGIN { print "hello, world" }</b>.
@code
/* cc -o hello hello.c -lqsecmn -lqseawk */
#include <qse/awk/std.h>
#include <qse/cmn/stdio.h>
#define FAIL(msg) do { qse_printf(QSE_T("ERR: %s\n"),msg); goto oops; } while(0)
int main ()
{
qse_awk_t* awk = QSE_NULL;
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_val_t* retv;
qse_awk_parsestd_in_t psin;
int ret = -1;
awk = qse_awk_openstd (0); /* open a new interpreter */
if (!awk) FAIL ("cannot open awk");
/* parse the hello world script from a string */
psin.type = QSE_AWK_PARSESTD_CP;
psin.u.cp = QSE_T("BEGIN { print \"hello, world\" }");
if (qse_awk_parsestd (awk, &psin, QSE_NULL) <= -1)
FAIL (qse_awk_geterrmsg(awk));
rtx = qse_awk_rtx_openstd ( /* open a runtime context */
awk, 0, /* no extension */
QSE_T("hello"), /* ARGV[0] */
QSE_NULL, /* stdin */
QSE_NULL /* stdout */
);
if (!rtx) FAIL (qse_awk_geterrmsg(awk));
retv = qse_awk_rtx_loop (rtx); /* exeucte pattern-action blocks */
if (!retv) FAIL (qse_awk_rtx_geterrmsg(rtx));
qse_awk_rtx_refdownval (rtx, retv); /* destroy the return value */
ret = 0;
oops:
if (rtx) qse_awk_rtx_close (rtx); /* close the runtime context */
if (awk) qse_awk_close (awk); /* close the interpreter */
return ret;
}
@endcode
Things can get simpler when you use C++ API as the C++ API supports a single
runtime context for each interpreter.
@code
/* c++ -o hello hello.cpp -lqsecmn -lqseawk -lqseawk++ */
#include <qse/awk/StdAwk.hpp>
#include <iostream>
#ifdef QSE_CHAR_IS_MCHAR
# define xcout std::cout
#else
# define xcout std::wcout
#endif
struct MyAwk: public QSE::StdAwk { ~MyAwk () { QSE::StdAwk::close (); } };
#define FAIL(awk) do { \
xcout << QSE_T("ERR: ") << awk.getErrorMessage() << std::endl; \
return -1; \
} while (0)
int main (int argc, char* argv[])
{
MyAwk awk;
// open a new interpreter
if (awk.open () <= -1) FAIL (awk);
// set ARGV[0]
if (awk.addArgument (QSE_T("hello")) <= -1) FAIL (awk);
// parse the source script string
MyAwk::SourceString in(QSE_T("BEGIN { print \"hello, world\" }"));
if (awk.parse (in, MyAwk::Source::NONE) == QSE_NULL) FAIL (awk);
// execute the BEGIN, pattern-action, END blocks.
MyAwk::Value r;
if (awk.loop (&r) <= -1) FAIL (awk);
return 0;
}
@endcode
@section awk_ext EXTENSIONS
Some language extensions are implemented and they can be enabled by setting the

View File

@ -5,14 +5,14 @@
@b QSE is a code library that implements various Unix utilities in an
embeddable form and provides a set of APIs to embed them into an application.
The APIs have been designed to be flexible enough to access various aspects of
a hosting application and an embedded object from each other. By embedding
a embedding application and an embedded object from each other. By embedding
a Unix utility into an application, a developer is relieved of problems caused
by interacting with external programs and is given tighter control over it.
by interacting with external programs and can have tighter control over it.
Currently the library implements the following utilities:
- @subpage sed "SED Stream Editor"
- @subpage cut "CUT Text Cutter"
Currently the library contains the following utilities:
- @subpage awk "AWK Interpreter"
- @subpage cut "CUT Text Cutter"
- @subpage sed "SED Stream Editor"
As the library grows, more utilities will be added.

View File

@ -1,5 +1,5 @@
/*
* $Id: std.h 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: std.h 316 2009-12-14 12:50:11Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -38,10 +38,10 @@
*/
enum qse_awk_parsestd_type_t
{
QSE_AWK_PARSESTD_FILE = 0, /* file name */
QSE_AWK_PARSESTD_CP = 1, /* character pointer */
QSE_AWK_PARSESTD_CPL = 2, /* character pointer + length */
QSE_AWK_PARSESTD_STDIO = 3 /* standard input/output */
QSE_AWK_PARSESTD_FILE = 0, /**< file name */
QSE_AWK_PARSESTD_CP = 1, /**< character pointer */
QSE_AWK_PARSESTD_CPL = 2, /**< character pointer + length */
QSE_AWK_PARSESTD_STDIO = 3 /**< standard input/output */
};
typedef enum qse_awk_parsestd_type_t qse_awk_parsestd_type_t;

View File

@ -21,6 +21,11 @@
#ifndef _QSE_CMN_STDIO_H_
#define _QSE_CMN_STDIO_H_
/** @file
* #qse_char_t friendly stdio wrapper functions are defined in this file.
*
*/
#include <qse/types.h>
#include <qse/macros.h>
@ -63,7 +68,7 @@
#define QSE_STDOUT stdout
#define QSE_STDERR stderr
typedef int (*qse_getdelim_t) (const qse_char_t* ptr,qse_size_t len, void* arg);
typedef int (*qse_getdelim_t) (const qse_char_t* ptr,qse_size_t len,void* arg);
#ifdef __cplusplus
extern "C" {
@ -84,12 +89,16 @@ QSE_FILE* qse_fopen (const qse_char_t* path, const qse_char_t* mode);
QSE_FILE* qse_popen (const qse_char_t* cmd, const qse_char_t* mode);
/**
* returns -2 on error, -1 on eof, length of data read on success
* @return -2 on error, -1 on eof, length of data read on success
*/
qse_ssize_t qse_getline (qse_char_t **buf, qse_size_t *n, QSE_FILE *fp);
/**
* returns -3 on line breaker error, -2 on error, -1 on eof,
* length of data read on success
* The qse_getdelim() function reads characters from a file pointer @a fp
* until a certain condition is met as defined by @a fn and @a fnarg.
*
* @return -3 on line breaker error, -2 on error, -1 on eof,
* length of data read on success
*/
qse_ssize_t qse_getdelim (
qse_char_t **buf, qse_size_t *n,

View File

@ -1,5 +1,5 @@
/*
* $Id: pio.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: pio.c 316 2009-12-14 12:50:11Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -174,9 +174,19 @@ qse_pio_t* qse_pio_init (
startup.cb = QSE_SIZEOF(startup);
/*
startup.hStdInput = INVALID_HANDLE_VALUE;
startup.hStdOutput = INVALID_HANDLE_VALUE;
startup.hStdOutput = INVALID_HANDLE_VALUE;
*/
startup.hStdInput = GetStdHandle (STD_INPUT_HANDLE);
startup.hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE);
startup.hStdOutput = GetStdHandle (STD_ERROR_HANDLE);
if (startup.hStdInput == INVALID_HANDLE_VALUE ||
startup.hStdOutput == INVALID_HANDLE_VALUE ||
startup.hStdError == INVALID_HANDLE_VALUE) goto oops;
if (oflags & QSE_PIO_WRITEIN) startup.hStdInput = handle[0];

View File

@ -3,11 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include
lib_LTLIBRARIES = libqseutl.la
libqseutl_la_SOURCES = \
http.c \
tgp.c \
tgp.h
http.c
libqseutl_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn
libqseutl_la_LIBADD = -lqsecmn

View File

@ -72,7 +72,7 @@ am__base_list = \
am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libqseutl_la_DEPENDENCIES =
am_libqseutl_la_OBJECTS = http.lo tgp.lo
am_libqseutl_la_OBJECTS = http.lo
libqseutl_la_OBJECTS = $(am_libqseutl_la_OBJECTS)
libqseutl_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@ -237,9 +237,7 @@ top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include
lib_LTLIBRARIES = libqseutl.la
libqseutl_la_SOURCES = \
http.c \
tgp.c \
tgp.h
http.c
libqseutl_la_LDFLAGS = -version-info 1:0:0 -no-undefined -L../cmn
libqseutl_la_LIBADD = -lqsecmn
@ -318,7 +316,6 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tgp.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<

View File

@ -1,260 +0,0 @@
/*
* $Id$
*/
#include <qse/utl/tgp.h>
#include "../cmn/mem.h"
#include "tgp.h"
QSE_IMPLEMENT_COMMON_FUNCTIONS (tgp)
qse_tgp_t* qse_tgp_open (qse_mmgr_t* mmgr, qse_size_t xtn)
{
qse_tgp_t* tgp;
if (mmgr == QSE_NULL)
{
mmgr = QSE_MMGR_GETDFL();
QSE_ASSERTX (mmgr != QSE_NULL,
"Set the memory manager with QSE_MMGR_SETDFL()");
if (mmgr == QSE_NULL) return QSE_NULL;
}
tgp = (qse_tgp_t*) QSE_MMGR_ALLOC (mmgr, QSE_SIZEOF(qse_tgp_t) + xtn);
if (tgp == QSE_NULL) return QSE_NULL;
if (qse_tgp_init (tgp, mmgr) == QSE_NULL)
{
QSE_MMGR_FREE (tgp->mmgr, tgp);
return QSE_NULL;
}
return tgp;
}
void qse_tgp_close (qse_tgp_t* tgp)
{
qse_tgp_fini (tgp);
QSE_MMGR_FREE (tgp->mmgr, tgp);
}
qse_tgp_t* qse_tgp_init (qse_tgp_t* tgp, qse_mmgr_t* mmgr)
{
QSE_MEMSET (tgp, 0, sizeof(*tgp));
tgp->mmgr = mmgr;
return tgp;
}
void qse_tgp_fini (qse_tgp_t* tgp)
{
}
int qse_tgp_geterrnum (qse_tgp_t* tgp)
{
return tgp->errnum;
}
static int getc (qse_tgp_t* tgp, qse_char_t* c)
{
if (tgp->ib.pos >= tgp->ib.len)
{
qse_ssize_t n;
n = tgp->ih.func (QSE_TGP_IO_READ, tgp->ih.arg, tgp->ib.ptr, QSE_COUNTOF(tgp->ib.ptr));
if (n < 0) return -1;
else if (n == 0)
{
*c = QSE_CHAR_EOF;
return 0;
}
else
{
tgp->ib.pos = 0;
tgp->ib.len = n;
}
}
*c = tgp->ib.ptr[tgp->ib.pos++];
return 1;
}
static int putc (qse_tgp_t* tgp, qse_char_t c)
{
if (tgp->ob.len >= QSE_COUNTOF(tgp->ob.ptr))
{
qse_ssize_t n;
/* TODO: submit on a newline as well */
n = tgp->oh.func (QSE_TGP_IO_WRITE, tgp->oh.arg, tgp->ob.ptr, QSE_COUNTOF(tgp->ob.ptr));
if (n < 0) return -1;
else if (n == 0) return 0;
}
tgp->ob.ptr[tgp->ob.len++] = c;
return 1;
}
static int runc (qse_tgp_t* tgp, qse_char_t c)
{
if (tgp->rb.len >= QSE_COUNTOF(tgp->rb.ptr))
{
qse_ssize_t n;
n = tgp->rh.func (QSE_TGP_IO_WRITE, tgp->rh.arg, tgp->rb.ptr, tgp->rb.len);
if (n < 0) return -1;
else if (n == 0) return 0;
tgp->rh.func (QSE_TGP_IO_READ, tgp->rh.arg, tgp->rb.ptr, tgp->rb.len);
}
tgp->rb.ptr[tgp->rb.len++] = c;
return 1;
}
int qse_tgp_run (qse_tgp_t* tgp)
{
qse_bool_t in_tag = QSE_FALSE;
qse_char_t c;
int n;
tgp->ib.pos = 0;
tgp->ib.len = 0;
tgp->ob.len = 0;
tgp->rb.len = 0;
n = tgp->ih.func (QSE_TGP_IO_OPEN, tgp->ih.arg, QSE_NULL, 0);
if (n == -1)
{
/* error */
return -1;
}
if (n == 0)
{
/* reached end of input upon opening the file... */
tgp->ih.func (QSE_TGP_IO_CLOSE, tgp->ih.arg, QSE_NULL, 0);
return 0;
}
n = tgp->oh.func (QSE_TGP_IO_OPEN, tgp->oh.arg, QSE_NULL, 0);
if (n == -1)
{
tgp->ih.func (QSE_TGP_IO_CLOSE, tgp->ih.arg, QSE_NULL, 0);
return -1;
}
if (n == 0)
{
/* reached end of input upon opening the file... */
tgp->oh.func (QSE_TGP_IO_CLOSE, tgp->oh.arg, QSE_NULL, 0);
tgp->ih.func (QSE_TGP_IO_CLOSE, tgp->ih.arg, QSE_NULL, 0);
return 0;
}
while (1)
{
n = getc (tgp, &c);
if (n == -1) return -1;
if (n == 0) break;
if (c == QSE_T('<'))
{
n = getc (tgp, &c);
if (n == -1) return -1;
if (n == 0)
{
putc (tgp, QSE_T('<'));
break;
}
if (c == QSE_T('?'))
{
if (in_tag)
{
/* ERROR - netsted tag */
return -1;
}
else in_tag = QSE_TRUE;
}
else
{
if (putc (tgp, QSE_T('<')) <= 0) return -1;
if (putc (tgp, c) <= 0) return -1;
}
}
else if (c == QSE_T('?'))
{
n = getc (tgp, &c);
if (n == -1) return -1;
if (n == 0)
{
if (putc (tgp, QSE_T('<')) <= 0) return -1;
break;
}
if (c == QSE_T('>'))
{
if (in_tag) in_tag = QSE_FALSE;
else
{
/* ERROR - unpaired tag close */
return -1;
}
}
else
{
if (putc (tgp, QSE_T('?')) <= 0) return -1;
if (putc (tgp, c) <= 0) return -1;
}
}
else if (in_tag)
{
runc (tgp, c);
}
else
{
if (putc (tgp, c) <= 0) return -1;
}
}
tgp->oh.func (QSE_TGP_IO_CLOSE, tgp->oh.arg, QSE_NULL, 0);
tgp->ih.func (QSE_TGP_IO_CLOSE, tgp->ih.arg, QSE_NULL, 0);
return 0;
}
void qse_tgp_attachin (qse_tgp_t* tgp, qse_tgp_io_t io, void* arg)
{
tgp->ih.func = io;
tgp->ih.arg = arg;
}
void qse_tgp_detachin (qse_tgp_t* tgp)
{
tgp->ih.func = QSE_NULL;
tgp->ih.arg = QSE_NULL;
}
void qse_tgp_attachout (qse_tgp_t* tgp, qse_tgp_io_t io, void* arg)
{
tgp->oh.func = io;
tgp->oh.arg = arg;
}
void qse_tgp_detachout (qse_tgp_t* tgp)
{
tgp->oh.func = QSE_NULL;
tgp->oh.arg = QSE_NULL;
}
void qse_tgp_attachexec (qse_tgp_t* tgp, qse_tgp_io_t io, void* arg)
{
tgp->rh.func = io;
tgp->rh.arg = arg;
}
void qse_tgp_detachexec (qse_tgp_t* tgp)
{
tgp->rh.func = QSE_NULL;
tgp->rh.arg = QSE_NULL;
}

View File

@ -1,59 +0,0 @@
/*
* $Id$
*/
#ifndef _QSE_LIB_UTL_TGP_H_
#define _QSE_LIB_UTL_TGP_H_
#include <qse/utl/tgp.h>
struct qse_tgp_t
{
QSE_DEFINE_COMMON_FIELDS (tgp)
void* assoc_data;
int errnum;
struct
{
qse_tgp_io_t func;
void* arg;
} ih;
struct
{
qse_tgp_io_t func;
void* arg;
} oh;
struct
{
qse_tgp_io_t func;
void* arg;
} rh;
struct
{
qse_size_t pos;
qse_size_t len;
qse_char_t ptr[512];
} ib;
struct
{
qse_size_t len;
qse_char_t ptr[512];
} ob;
struct
{
qse_size_t len;
qse_char_t ptr[512];
} rb;
int (*read) (qse_tgp_t* tgp, qse_char_t* buf, int len);
int (*write) (qse_tgp_t* tgp, const qse_char_t* buf, int len);
int (*run) (qse_tgp_t* tgp, const qse_char_t* buf, int len);
};
#endif

View File

@ -1 +1 @@
SUBDIRS = awk
SUBDIRS = awk sed

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 = awk
SUBDIRS = awk sed
all: all-recursive
.SUFFIXES:

View File

@ -0,0 +1,8 @@
AUTOMAKE_OPTIONS = no-dependencies
EXTRA_DIST = \
regress.sh regress.out \
s001.sed s001.dat \
s002.sed s002.dat \
s003.sed s003.dat \
s004.sed s004.dat

View File

@ -14,7 +14,6 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
@ -34,8 +33,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS =
subdir = samples/utl
subdir = regress/sed
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/ac/m4/libtool.m4 \
@ -49,8 +47,8 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
depcomp =
am__depfiles_maybe =
SOURCES =
DIST_SOURCES =
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -92,7 +90,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = -L../../lib/cmn -L../../lib/utl
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@ -193,8 +191,14 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include
LDADD = -lqseutl -lqsecmn $(LIBM)
AUTOMAKE_OPTIONS = no-dependencies
EXTRA_DIST = \
regress.sh regress.out \
s001.sed s001.dat \
s002.sed s002.dat \
s003.sed s003.dat \
s004.sed s004.dat
all: all-am
.SUFFIXES:
@ -207,9 +211,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign samples/utl/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign regress/sed/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign samples/utl/Makefile
$(AUTOMAKE) --foreign regress/sed/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@ -228,49 +232,6 @@ $(top_srcdir)/configure: $(am__configure_deps)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
mostlyclean-libtool:
-rm -f *.lo
@ -316,11 +277,8 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
all-am: Makefile
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@ -348,7 +306,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
@ -372,7 +330,7 @@ install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-exec-am:
install-html: install-html-am
@ -410,22 +368,20 @@ ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
uninstall-am:
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
uninstall-binPROGRAMS
mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.

View File

@ -1 +1 @@
SUBDIRS = cmn sed awk utl
SUBDIRS = cmn sed awk

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 utl
SUBDIRS = cmn sed awk
all: all-recursive
.SUFFIXES:

View File

@ -1,5 +1,5 @@
/*
* $Id: awk01.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: awk01.c 316 2009-12-14 12:50:11Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -39,7 +39,7 @@ int main ()
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_val_t* retv;
qse_awk_parsestd_in_t psin;
int ret;
int ret = -1;
awk = qse_awk_openstd (0);
if (awk == QSE_NULL)
@ -51,12 +51,11 @@ int main ()
psin.type = QSE_AWK_PARSESTD_CP;
psin.u.cp = src;
ret = qse_awk_parsestd (awk, &psin, QSE_NULL);
if (ret <= -1)
if (qse_awk_parsestd (awk, &psin, QSE_NULL) <= -1)
{
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"),
qse_awk_geterrmsg(awk));
ret = -1; goto oops;
goto oops;
}
rtx = qse_awk_rtx_openstd (
@ -70,7 +69,7 @@ int main ()
{
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"),
qse_awk_geterrmsg(awk));
ret = -1; goto oops;
goto oops;
}
retv = qse_awk_rtx_loop (rtx);
@ -78,7 +77,7 @@ int main ()
{
qse_fprintf (QSE_STDERR, QSE_T("ERROR: %s\n"),
qse_awk_rtx_geterrmsg(rtx));
ret = -1; goto oops;
goto oops;
}
qse_awk_rtx_refdownval (rtx, retv);

View File

@ -1,7 +0,0 @@
AM_CPPFLAGS = -I$(top_srcdir)/include
bin_PROGRAMS =
LDFLAGS = -L../../lib/cmn -L../../lib/utl
LDADD = -lqseutl -lqsecmn $(LIBM)