diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2012-08-11 16:45:31 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-10-18 12:43:06 +0000 |
commit | 7c432b265ed7ca5f8304938db73912df8ce35032 (patch) | |
tree | c95de7bee7b742ed92b9924d904adca706e48d80 /xml2ag | |
download | autogen-7c432b265ed7ca5f8304938db73912df8ce35032.tar.gz |
Imported from /srv/lorry/lorry-area/autogen/autogen-5.16.2.tar.gz.HEADautogen-5.16.2master
Diffstat (limited to 'xml2ag')
-rw-r--r-- | xml2ag/Makefile.am | 92 | ||||
-rw-r--r-- | xml2ag/Makefile.in | 892 | ||||
-rw-r--r-- | xml2ag/fork.c | 303 | ||||
-rw-r--r-- | xml2ag/fork.tpl | 223 | ||||
-rw-r--r-- | xml2ag/test/Makefile.am | 43 | ||||
-rw-r--r-- | xml2ag/test/Makefile.in | 551 | ||||
-rwxr-xr-x | xml2ag/test/convert.test | 100 | ||||
-rw-r--r-- | xml2ag/xml2ag.c | 478 | ||||
-rw-r--r-- | xml2ag/xmlopts.def | 180 |
9 files changed, 2862 insertions, 0 deletions
diff --git a/xml2ag/Makefile.am b/xml2ag/Makefile.am new file mode 100644 index 0000000..718aeb2 --- /dev/null +++ b/xml2ag/Makefile.am @@ -0,0 +1,92 @@ +## -*- Mode: Makefile -*- +## --------------------------------------------------------------------- +## Makefile.am -- process this file with automake to produce Makefile.in +## +## Time-stamp: "2012-04-07 09:55:51 bkorb" +## Last Modified: Thu Jul 29 13:42:18 1999 +## Author: Bruce Korb <bkorb@gnu.org> +## +## This file is part of AutoGen. +## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved +## +## AutoGen is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## AutoGen is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along +## with this program. If not, see <http://www.gnu.org/licenses/>. +## +TARG = xml2ag + +bin_PROGRAMS = xml2ag +csrcs = xml2ag.c +gsrcs = xmlopts.c fork.c +BUILT_SOURCES = x.c +nodist_xml2ag_SOURCES = $(BUILT_SOURCES) +SUBDIRS = test +EXTRA_DIST = xmlopts.def fork.tpl fork.c xml2ag.c +xml2ag_LDADD = $(top_builddir)/autoopts/libopts.la $(LIBXML2_LIBS) +man_MANS = $(TARG).1 +DOCFILES = invoke-$(TARG).texi invoke-$(TARG).menu $(TARG).1 +DISTCLEANFILES = $(DOCFILES) $(nodist_xml2ag_SOURCES) stamp-* +INCLUDES = @INCLIST@ $(LIBXML2_CFLAGS) +AGexe = $(top_builddir)/agen5/autogen +CLexe = $(top_builddir)/columns/columns +BOOTENV = top_srcdir="$(top_srcdir)" top_builddir="$(top_builddir)" \ + PATH=`cd ../columns;pwd`:"$$PATH" CLexe="$(CLexe)" + +RUNAG = $(BOOTENV) $(AGexe) $(AGDEPS) \ + -L$(top_srcdir)/autoopts/tpl -L$(top_builddir)/autoopts/tpl \ + --definition=$(srcdir)/xmlopts.def + +CLEAN_RULES = \ + clean-stamp-opts clean-stamp-texi clean-stamp-man clean-stamp-fork +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-opts.d@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-texi.d@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-man.d@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-fork.d@am__quote@ +@AMDEP_TRUE@clean-local : $(CLEAN_RULES) + +@AMDEP_TRUE@AGDEPS = -MF$(DEPDIR)/$@.d -MT$@ -MP +@AMDEP_FALSE@AGDEPS = + +all : gen +gen : $(gsrcs) $(DOCFILES) + +$(getdefs_OBJECTS) xmlopts.c xmlopts.h : stamp-opts +stamp-opts : xmlopts.def $(CLexe) + $(RUNAG) + +fork.c : stamp-fork +stamp-fork : fork.tpl xmlopts.def $(CLexe) + $(RUNAG) -L$(srcdir) -Tfork.tpl + +invoke-$(TARG).texi invoke-$(TARG).menu : stamp-texi +stamp-texi : xmlopts.def $(TARG)$(EXEEXT) ../columns/columns$(EXEEXT) + $(RUNAG) -Tagtexi-cmd -DLEVEL=section + +$(TARG).1 : stamp-man +stamp-man : xmlopts.def $(TARG)$(EXEEXT) ../columns/columns$(EXEEXT) + $(RUNAG) -Tagman-cmd + +$(CLexe) : + cd ../columns ; $(MAKE) $(CLnam) + +x.c : $(gsrcs) $(csrcs) + exec > $@ ; \ + echo '#undef PKGDATADIR' ; \ + echo '#define PKGDATADIR "$(pkgdatadir)"' ; \ + echo ; echo '#define DEFINING 1' ; \ + echo '#include "autoopts/project.h"' ; \ + for f in $(gsrcs) $(csrcs) ; \ + do echo "#include \"$$f\"" ; done + +.NOTPARALLEL: + +# Makefile.am ends here diff --git a/xml2ag/Makefile.in b/xml2ag/Makefile.in new file mode 100644 index 0000000..4aa8d08 --- /dev/null +++ b/xml2ag/Makefile.in @@ -0,0 +1,892 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 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@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +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@ +target_triplet = @target@ +bin_PROGRAMS = xml2ag$(EXEEXT) +subdir = xml2ag +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/config/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \ + $(top_srcdir)/config/extensions.m4 \ + $(top_srcdir)/config/libopts.m4 \ + $(top_srcdir)/config/libtool.m4 \ + $(top_srcdir)/config/ltoptions.m4 \ + $(top_srcdir)/config/ltsugar.m4 \ + $(top_srcdir)/config/ltversion.m4 \ + $(top_srcdir)/config/lt~obsolete.m4 \ + $(top_srcdir)/config/onceonly.m4 \ + $(top_srcdir)/config/snprintfv.m4 \ + $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +PROGRAMS = $(bin_PROGRAMS) +am__objects_1 = x.$(OBJEXT) +nodist_xml2ag_OBJECTS = $(am__objects_1) +xml2ag_OBJECTS = $(nodist_xml2ag_OBJECTS) +am__DEPENDENCIES_1 = +xml2ag_DEPENDENCIES = $(top_builddir)/autoopts/libopts.la \ + $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/config/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 = $(nodist_xml2ag_SOURCES) +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man_MANS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AGEN5_TESTS = @AGEN5_TESTS@ +AG_GUILE = @AG_GUILE@ +AG_LDFLAGS = @AG_LDFLAGS@ +AG_MAJOR_VERSION = @AG_MAJOR_VERSION@ +AG_MINOR_VERSION = @AG_MINOR_VERSION@ +AG_TIMEOUT = @AG_TIMEOUT@ +AG_VERSION = @AG_VERSION@ +AG_XML2 = @AG_XML2@ +AGexe = $(top_builddir)/agen5/autogen +AGnam = @AGnam@ +AMTAR = @AMTAR@ +AO_AGE = @AO_AGE@ +AO_CURRENT = @AO_CURRENT@ +AO_REVISION = @AO_REVISION@ +AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLexe = $(top_builddir)/columns/columns +CLnam = @CLnam@ +CONFIG_SHELL = @CONFIG_SHELL@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_ENABLED = @DEBUG_ENABLED@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +DYNAMIC_AG = @DYNAMIC_AG@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_STATIC = @ENABLE_STATIC@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDexe = @GDexe@ +GDnam = @GDnam@ +GO_AGE = @GO_AGE@ +GO_CURRENT = @GO_CURRENT@ +GO_REVISION = @GO_REVISION@ +GREP = @GREP@ +GUILE_VERSION = @GUILE_VERSION@ +INCLIST = @INCLIST@ +INCSNPRINTFV = @INCSNPRINTFV@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@ +LIBGUILE_LIBS = @LIBGUILE_LIBS@ +LIBGUILE_PATH = @LIBGUILE_PATH@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSNPRINTFV = @LIBSNPRINTFV@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIBXML2_PATH = @LIBXML2_PATH@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +M4_SRC = @M4_SRC@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPTS_TESTDIR = @OPTS_TESTDIR@ +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@ +POSIX_SHELL = @POSIX_SHELL@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TEXI2HTML = @TEXI2HTML@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TARG = xml2ag +csrcs = xml2ag.c +gsrcs = xmlopts.c fork.c +BUILT_SOURCES = x.c +nodist_xml2ag_SOURCES = $(BUILT_SOURCES) +SUBDIRS = test +EXTRA_DIST = xmlopts.def fork.tpl fork.c xml2ag.c +xml2ag_LDADD = $(top_builddir)/autoopts/libopts.la $(LIBXML2_LIBS) +man_MANS = $(TARG).1 +DOCFILES = invoke-$(TARG).texi invoke-$(TARG).menu $(TARG).1 +DISTCLEANFILES = $(DOCFILES) $(nodist_xml2ag_SOURCES) stamp-* +INCLUDES = @INCLIST@ $(LIBXML2_CFLAGS) +BOOTENV = top_srcdir="$(top_srcdir)" top_builddir="$(top_builddir)" \ + PATH=`cd ../columns;pwd`:"$$PATH" CLexe="$(CLexe)" + +RUNAG = $(BOOTENV) $(AGexe) $(AGDEPS) \ + -L$(top_srcdir)/autoopts/tpl -L$(top_builddir)/autoopts/tpl \ + --definition=$(srcdir)/xmlopts.def + +CLEAN_RULES = \ + clean-stamp-opts clean-stamp-texi clean-stamp-man clean-stamp-fork + +@AMDEP_TRUE@AGDEPS = -MF$(DEPDIR)/$@.d -MT$@ -MP +@AMDEP_FALSE@AGDEPS = +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.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) --gnu xml2ag/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu xml2ag/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) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + 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 +xml2ag$(EXEEXT): $(xml2ag_OBJECTS) $(xml2ag_DEPENDENCIES) $(EXTRA_xml2ag_DEPENDENCIES) + @rm -f xml2ag$(EXEEXT) + $(LINK) $(xml2ag_OBJECTS) $(xml2ag_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x.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 +install-man1: $(man_MANS) + @$(NORMAL_INSTALL) + @list1=''; \ + list2='$(man_MANS)'; \ + test -n "$(man1dir)" \ + && test -n "`echo $$list1$$list2`" \ + || exit 0; \ + echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ + { for i in $$list1; do echo "$$i"; done; \ + if test -n "$$list2"; then \ + for i in $$list2; do echo "$$i"; done \ + | sed -n '/\.1[a-z]*$$/p'; \ + fi; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ + done; } + +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man1dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.1[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(RECURSIVE_TARGETS) $(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done +cscopelist-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \ + done + +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: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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: ctags-recursive $(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" + +cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically 'make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + @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 + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +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) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: install-man1 + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + cscopelist-recursive ctags-recursive install install-am \ + install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool cscopelist cscopelist-recursive \ + ctags ctags-recursive 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-man1 install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-man uninstall-man1 + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-opts.d@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-texi.d@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-man.d@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stamp-fork.d@am__quote@ +@AMDEP_TRUE@clean-local : $(CLEAN_RULES) + +all : gen +gen : $(gsrcs) $(DOCFILES) + +$(getdefs_OBJECTS) xmlopts.c xmlopts.h : stamp-opts +stamp-opts : xmlopts.def $(CLexe) + $(RUNAG) + +fork.c : stamp-fork +stamp-fork : fork.tpl xmlopts.def $(CLexe) + $(RUNAG) -L$(srcdir) -Tfork.tpl + +invoke-$(TARG).texi invoke-$(TARG).menu : stamp-texi +stamp-texi : xmlopts.def $(TARG)$(EXEEXT) ../columns/columns$(EXEEXT) + $(RUNAG) -Tagtexi-cmd -DLEVEL=section + +$(TARG).1 : stamp-man +stamp-man : xmlopts.def $(TARG)$(EXEEXT) ../columns/columns$(EXEEXT) + $(RUNAG) -Tagman-cmd + +$(CLexe) : + cd ../columns ; $(MAKE) $(CLnam) + +x.c : $(gsrcs) $(csrcs) + exec > $@ ; \ + echo '#undef PKGDATADIR' ; \ + echo '#define PKGDATADIR "$(pkgdatadir)"' ; \ + echo ; echo '#define DEFINING 1' ; \ + echo '#include "autoopts/project.h"' ; \ + for f in $(gsrcs) $(csrcs) ; \ + do echo "#include \"$$f\"" ; done + +.NOTPARALLEL: + +# Makefile.am ends here + +# 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: diff --git a/xml2ag/fork.c b/xml2ag/fork.c new file mode 100644 index 0000000..aec0d93 --- /dev/null +++ b/xml2ag/fork.c @@ -0,0 +1,303 @@ +/* -*- buffer-read-only: t -*- vi: set ro: + * + * DO NOT EDIT THIS FILE (fork.c) + * + * It has been AutoGen-ed August 11, 2012 at 09:45:31 AM by AutoGen 5.16.2 + * From the definitions ./xmlopts.def + * and the template file fork.tpl + * + * This module will fire up autogen and have it read definitions + * from its standard-in. + */ + +static char const zFsError[] = "%s fs ERROR %d (%s) on %s\n"; + +static void +add_arg(char const * arg, int ix) +{ + char ** arg_vec = xml2agOptions.origArgVect; + int arg_ct = xml2agOptions.origArgCt; + + if (ix >= (int)arg_ct) { + arg_ct += 5; + arg_vec = realloc(arg_vec, sizeof(void*) * (arg_ct+1)); + if (arg_vec == NULL) { + fprintf(stderr, "No memory for %d args\n", arg_ct); + exit(EXIT_FAILURE); + } + xml2agOptions.origArgVect = arg_vec; + } + arg_vec[ ix ] = (void*)arg; +} + +static int +become_child(int * fd, char const* pzInput) +{ + if (pipe(fd) != 0) { + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror( errno ), "pipe(2)"); + exit(EXIT_FAILURE); + } + + fflush(stdout); + fflush(stdin); + + switch (fork()) { + case -1: + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror( errno ), "fork(2)"); + exit(EXIT_FAILURE); + + case 0: + fclose(stdin); + if (dup2(fd[0], STDIN_FILENO) != STDIN_FILENO) { + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror( errno ), "dup2(2) w/ STDIN_FILENO"); + exit(EXIT_FAILURE); + } + close(fd[1]); + break; + + default: + errno = 0; + outFp = fdopen(fd[1], "w"); + if (outFp == NULL) { + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror( errno ), "fdopen(2) w/ pipe[1]"); + exit(EXIT_FAILURE); + } + close(fd[0]); + return 0; + } + + if (! HAVE_OPT( BASE_NAME )) { + if (pzInput == NULL) + pzInput = "stdin"; + else { + char* pz = strrchr(pzInput, '.'); + if (pz != NULL) { + pzInput = pz = strdup(pzInput); + pz = strrchr(pz, '.'); + *pz = '\0'; + } + } + SET_OPT_BASE_NAME(pzInput); + } + + return 1; +} + +void +forkAutogen(char const* pzInput) +{ + int fd[2]; + + if (! become_child(fd, pzInput)) + return; + + { + static char const zAg[] = "autogen"; + char* pzArg; + int ix = 1; + + { + char* pz = malloc(strlen( xml2agOptions.pzProgPath ) + 7); + char* p = strrchr(xml2agOptions.pzProgPath, '/'); + + if (p == NULL) { + strcpy(pz, zAg); + } else { + size_t len = (p - xml2agOptions.pzProgPath) + 1; + memcpy(pz, xml2agOptions.pzProgPath, len); + strcpy(pz + len, zAg); + } + + add_arg(pz, 0); + } + + if (HAVE_OPT(TEMPL_DIRS)) { + int optCt = STACKCT_OPT(TEMPL_DIRS); + char const ** ppOA = STACKLST_OPT(TEMPL_DIRS); + do { + char const * pA = *(ppOA++); + pzArg = malloc(14 + strlen(pA)); + sprintf(pzArg, "--templ-dirs=%s", pA); + add_arg(pzArg, ix++); + } while (--optCt > 0); + } + + if (HAVE_OPT(LIB_TEMPLATE)) { + int optCt = STACKCT_OPT(LIB_TEMPLATE); + char const ** ppOA = STACKLST_OPT(LIB_TEMPLATE); + do { + char const * pA = *(ppOA++); + pzArg = malloc(16 + strlen(pA)); + sprintf(pzArg, "--lib-template=%s", pA); + add_arg(pzArg, ix++); + } while (--optCt > 0); + } + + if (HAVE_OPT(DEFINITIONS)) { + pzArg = malloc(15 + strlen( OPT_ARG( DEFINITIONS ))); + sprintf(pzArg, "--definitions=%s", OPT_ARG( DEFINITIONS )); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(LOAD_SCHEME)) { + pzArg = malloc(15 + strlen( OPT_ARG( LOAD_SCHEME ))); + sprintf(pzArg, "--load-scheme=%s", OPT_ARG( LOAD_SCHEME )); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(LOAD_FUNCTIONS)) { + pzArg = malloc(18 + strlen( OPT_ARG( LOAD_FUNCTIONS ))); + sprintf(pzArg, "--load-functions=%s", OPT_ARG( LOAD_FUNCTIONS )); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(SHELL)) { + pzArg = malloc(9 + strlen( OPT_ARG( SHELL ))); + sprintf(pzArg, "--shell=%s", OPT_ARG( SHELL )); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(NO_FMEMOPEN)) { + add_arg("--no-fmemopen", ix++); + } + + if (HAVE_OPT(EQUATE)) { + pzArg = malloc(10 + strlen( OPT_ARG( EQUATE ))); + sprintf(pzArg, "--equate=%s", OPT_ARG( EQUATE )); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(BASE_NAME)) { + pzArg = malloc(13 + strlen( OPT_ARG( BASE_NAME ))); + sprintf(pzArg, "--base-name=%s", OPT_ARG( BASE_NAME )); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(SOURCE_TIME)) { + add_arg("--source-time", ix++); + } + + if (HAVE_OPT(WRITABLE)) { + add_arg("--writable", ix++); + } + + if (HAVE_OPT(LOOP_LIMIT)) { + pzArg = malloc((size_t)26); + sprintf(pzArg, "--loop-limit=%d", (int)OPT_VALUE_LOOP_LIMIT); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(TIMEOUT)) { + pzArg = malloc((size_t)23); + sprintf(pzArg, "--timeout=%d", (int)OPT_VALUE_TIMEOUT); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(TRACE)) { + static char const * kwlist[] = { + "nothing", "debug-message", "server-shell", + "templates", "block-macros", "expressions", + "everything" }; + pzArg = malloc(9 + strlen( kwlist[ OPT_VALUE_TRACE ] )); + sprintf(pzArg, "--trace=%s", kwlist[ OPT_VALUE_TRACE ]); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(TRACE_OUT)) { + pzArg = malloc(13 + strlen( OPT_ARG( TRACE_OUT ))); + sprintf(pzArg, "--trace-out=%s", OPT_ARG( TRACE_OUT )); + add_arg(pzArg, ix++); + } + + if (HAVE_OPT(SHOW_DEFS)) { + add_arg("--show-defs", ix++); + } + + if (HAVE_OPT(USED_DEFINES)) { + add_arg("--used-defines", ix++); + } + + if (HAVE_OPT(CORE)) { + add_arg("--core", ix++); + } + + if (HAVE_OPT(SKIP_SUFFIX)) { + int optCt = STACKCT_OPT(SKIP_SUFFIX); + char const ** ppOA = STACKLST_OPT(SKIP_SUFFIX); + do { + char const * pA = *(ppOA++); + pzArg = malloc(15 + strlen(pA)); + sprintf(pzArg, "--skip-suffix=%s", pA); + add_arg(pzArg, ix++); + } while (--optCt > 0); + } + + if (HAVE_OPT(SELECT_SUFFIX)) { + int optCt = STACKCT_OPT(SELECT_SUFFIX); + char const ** ppOA = STACKLST_OPT(SELECT_SUFFIX); + do { + char const * pA = *(ppOA++); + pzArg = malloc(17 + strlen(pA)); + sprintf(pzArg, "--select-suffix=%s", pA); + add_arg(pzArg, ix++); + } while (--optCt > 0); + } + + if (HAVE_OPT(DEFINE)) { + int optCt = STACKCT_OPT(DEFINE); + char const ** ppOA = STACKLST_OPT(DEFINE); + do { + char const * pA = *(ppOA++); + pzArg = malloc(10 + strlen(pA)); + sprintf(pzArg, "--define=%s", pA); + add_arg(pzArg, ix++); + } while (--optCt > 0); + } + + if (HAVE_OPT(UNDEFINE)) { + int optCt = STACKCT_OPT(UNDEFINE); + char const ** ppOA = STACKLST_OPT(UNDEFINE); + do { + char const * pA = *(ppOA++); + pzArg = malloc(12 + strlen(pA)); + sprintf(pzArg, "--undefine=%s", pA); + add_arg(pzArg, ix++); + } while (--optCt > 0); + } + + if (HAVE_OPT(MAKE_DEP)) { + int optCt = STACKCT_OPT(MAKE_DEP); + char const ** ppOA = STACKLST_OPT(MAKE_DEP); + do { + char const * pA = *(ppOA++); + pzArg = malloc(12 + strlen(pA)); + sprintf(pzArg, "--make-dep=%s", pA); + add_arg(pzArg, ix++); + } while (--optCt > 0); + } + + xml2agOptions.origArgVect[ix] = NULL; + execvp(xml2agOptions.origArgVect[0], xml2agOptions.origArgVect); + + /* + * IF the first try fails, it may be because xml2ag and autogen have + * different paths. Try again with just plain "autogen" and let + * the OS search "PATH" for the program. + */ + execvp(zAg, xml2agOptions.origArgVect); + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror(errno), "execvp(2)"); + exit(EXIT_FAILURE); + } +} + +/* + * Local Variables: + * c-file-style: "stroustrup" + * indent-tabs-mode: nil + * End: + * end of fork.c */ diff --git a/xml2ag/fork.tpl b/xml2ag/fork.tpl new file mode 100644 index 0000000..e882886 --- /dev/null +++ b/xml2ag/fork.tpl @@ -0,0 +1,223 @@ +[= AutoGen5 Template c=fork.c -*- Mode: C -*- =] +[= # Time-stamp: "2012-04-07 09:56:01 bkorb" + + * This file is part of AutoGen. + * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved + * + * AutoGen is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AutoGen is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + =][= + +(define up-c-name (lambda (ag-name) + (string-upcase! (string->c-name! (get ag-name))) )) + +(dne " * " "/* ")=] + * + * This module will fire up autogen and have it read definitions + * from its standard-in. + */ + +static char const zFsError[] = "%s fs ERROR %d (%s) on %s\n"; + +static void +add_arg(char const * arg, int ix) +{ + char ** arg_vec = xml2agOptions.origArgVect; + int arg_ct = xml2agOptions.origArgCt; + + if (ix >= (int)arg_ct) { + arg_ct += 5; + arg_vec = realloc(arg_vec, sizeof(void*) * (arg_ct+1)); + if (arg_vec == NULL) { + fprintf(stderr, "No memory for %d args\n", arg_ct); + exit(EXIT_FAILURE); + } + xml2agOptions.origArgVect = arg_vec; + } + arg_vec[ ix ] = (void*)arg; +} + +static int +become_child(int * fd, char const* pzInput) +{ + if (pipe(fd) != 0) { + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror( errno ), "pipe(2)"); + exit(EXIT_FAILURE); + } + + fflush(stdout); + fflush(stdin); + + switch (fork()) { + case -1: + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror( errno ), "fork(2)"); + exit(EXIT_FAILURE); + + case 0: + fclose(stdin); + if (dup2(fd[0], STDIN_FILENO) != STDIN_FILENO) { + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror( errno ), "dup2(2) w/ STDIN_FILENO"); + exit(EXIT_FAILURE); + } + close(fd[1]); + break; + + default: + errno = 0; + outFp = fdopen(fd[1], "w"); + if (outFp == NULL) { + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror( errno ), "fdopen(2) w/ pipe[1]"); + exit(EXIT_FAILURE); + } + close(fd[0]); + return 0; + } + + if (! HAVE_OPT( BASE_NAME )) { + if (pzInput == NULL) + pzInput = "stdin"; + else { + char* pz = strrchr(pzInput, '.'); + if (pz != NULL) { + pzInput = pz = strdup(pzInput); + pz = strrchr(pz, '.'); + *pz = '\0'; + } + } + SET_OPT_BASE_NAME(pzInput); + } + + return 1; +} + +void +forkAutogen(char const* pzInput) +{ + int fd[2]; + + if (! become_child(fd, pzInput)) + return; + + { + static char const zAg[] = "autogen"; + char* pzArg; + int ix = 1; + + { + char* pz = malloc(strlen( xml2agOptions.pzProgPath ) + 7); + char* p = strrchr(xml2agOptions.pzProgPath, '/'); + + if (p == NULL) { + strcpy(pz, zAg); + } else { + size_t len = (p - xml2agOptions.pzProgPath) + 1; + memcpy(pz, xml2agOptions.pzProgPath, len); + strcpy(pz + len, zAg); + } + + add_arg(pz, 0); + }[= + + FOR flag =][= + IF (define opt-name (up-c-name "name")) + + (and + (not (~~ opt-name "OVERRIDE_TPL|OUTPUT")) + (not (exist? "documentation")) + ) =][= + + INVOKE handle-option =][= + ENDIF (not override) =][= + ENDFOR =] + + xml2agOptions.origArgVect[ix] = NULL; + execvp(xml2agOptions.origArgVect[0], xml2agOptions.origArgVect); + + /* + * IF the first try fails, it may be because xml2ag and autogen have + * different paths. Try again with just plain "autogen" and let + * the OS search "PATH" for the program. + */ + execvp(zAg, xml2agOptions.origArgVect); + fprintf(stderr, zFsError, xml2agOptions.pzProgName, + errno, strerror(errno), "execvp(2)"); + exit(EXIT_FAILURE); + } +} + +/* + * Local Variables: + * c-file-style: "stroustrup" + * indent-tabs-mode: nil + * End: + * end of [= (out-name) =] */ +[= + +DEFINE handle-option =] + + if (HAVE_OPT([=(. opt-name)=])) {[= + + CASE arg-type =][= + + ==* key =] + static char const * kwlist[] = { +[=(shellf "${CLexe:-columns} -I16 -f'\"%%s\"' -S, --spread=2 <<_EOF_\n%s\n_EOF_" + (join "\n" (stack "keyword")) )=] }; + pzArg = malloc([= (+ 4 (string-length (get "name"))) + =] + strlen( kwlist[ OPT_VALUE_[=(. opt-name)=] ] )); + sprintf(pzArg, "--[=name=]=%s", kwlist[ OPT_VALUE_[= + (. opt-name)=] ]); + add_arg(pzArg, ix++);[= + + ==* num =] + pzArg = malloc((size_t)[= (+ 16 (string-length (get "name"))) =]); + sprintf(pzArg, "--[=name=]=%d", (int)OPT_VALUE_[=(. opt-name)=]); + add_arg(pzArg, ix++);[= + + ==* bool =] + static char z[] = "--[=name=]=false"; + if (OPT_VALUE_[=(. opt-name)=]) + strcpy(z + [= (+ 3 (string-length (get "name"))) =], "true"); + add_arg(z, ix++);[= + + ==* str =][= + IF (exist? "max") =] + int optCt = STACKCT_OPT([=(. opt-name)=]); + char const ** ppOA = STACKLST_OPT([=(. opt-name)=]); + do { + char const * pA = *(ppOA++); + pzArg = malloc([= (+ 4 (string-length (get "name"))) + =] + strlen(pA)); + sprintf(pzArg, "--[=name=]=%s", pA); + add_arg(pzArg, ix++); + } while (--optCt > 0);[= + ELSE !exists-max =] + pzArg = malloc([= (+ 4 (string-length (get "name"))) + =] + strlen( OPT_ARG( [=(. opt-name)=] ))); + sprintf(pzArg, "--[=name=]=%s", OPT_ARG( [=(. opt-name)=] )); + add_arg(pzArg, ix++);[= + ENDIF exists-max =][= + + == "" =] + add_arg("--[=name=]", ix++);[= + + ESAC arg-type =] + }[= + +ENDDEF handle-option + +\=] diff --git a/xml2ag/test/Makefile.am b/xml2ag/test/Makefile.am new file mode 100644 index 0000000..4674e48 --- /dev/null +++ b/xml2ag/test/Makefile.am @@ -0,0 +1,43 @@ +## -*- Mode: Makefile -*- +## +## Makefile.am -- process this file with automake to produce Makefile.in +## +## Author: Bruce Korb <bkorb@gnu.org> +## Time-stamp: "2010-07-18 08:47:05 bkorb" +## +## This file is part of AutoGen. +## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved +## +## AutoGen is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## AutoGen is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along +## with this program. If not, see <http://www.gnu.org/licenses/>. + +TESTS = convert.test +EXTRA_DIST = $(TESTS) + +TESTS_ENVIRONMENT = \ + X2Aexe=`\cd $(top_builddir)/xml2ag ; pwd`/xml2ag$(EXEEXT) \ + srcdir=$(srcdir) top_srcdir=$(top_srcdir) + +distclean-local: + -rm -rf testdir FAILURES + +check : perm-stamp + +$(TESTS) : perm-stamp + +perm-stamp : + cd $(srcdir) ; chmod +x *.test + +# Makefile.am ends here + + XML2AG= diff --git a/xml2ag/test/Makefile.in b/xml2ag/test/Makefile.in new file mode 100644 index 0000000..141866b --- /dev/null +++ b/xml2ag/test/Makefile.in @@ -0,0 +1,551 @@ +# Makefile.in generated by automake 1.12.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 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@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +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@ +target_triplet = @target@ +subdir = xml2ag/test +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/config/ag_macros.m4 \ + $(top_srcdir)/config/extensions.m4 \ + $(top_srcdir)/config/libopts.m4 \ + $(top_srcdir)/config/libtool.m4 \ + $(top_srcdir)/config/ltoptions.m4 \ + $(top_srcdir)/config/ltsugar.m4 \ + $(top_srcdir)/config/ltversion.m4 \ + $(top_srcdir)/config/lt~obsolete.m4 \ + $(top_srcdir)/config/onceonly.m4 \ + $(top_srcdir)/config/snprintfv.m4 \ + $(top_srcdir)/config/unlocked-io.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = $(am__tty_colors_dummy) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AGEN5_TESTS = @AGEN5_TESTS@ +AG_GUILE = @AG_GUILE@ +AG_LDFLAGS = @AG_LDFLAGS@ +AG_MAJOR_VERSION = @AG_MAJOR_VERSION@ +AG_MINOR_VERSION = @AG_MINOR_VERSION@ +AG_TIMEOUT = @AG_TIMEOUT@ +AG_VERSION = @AG_VERSION@ +AG_XML2 = @AG_XML2@ +AGexe = @AGexe@ +AGnam = @AGnam@ +AMTAR = @AMTAR@ +AO_AGE = @AO_AGE@ +AO_CURRENT = @AO_CURRENT@ +AO_REVISION = @AO_REVISION@ +AO_TEMPLATE_VERSION = @AO_TEMPLATE_VERSION@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLexe = @CLexe@ +CLnam = @CLnam@ +CONFIG_SHELL = @CONFIG_SHELL@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEBUG_ENABLED = @DEBUG_ENABLED@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +DYNAMIC_AG = @DYNAMIC_AG@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_STATIC = @ENABLE_STATIC@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDexe = @GDexe@ +GDnam = @GDnam@ +GO_AGE = @GO_AGE@ +GO_CURRENT = @GO_CURRENT@ +GO_REVISION = @GO_REVISION@ +GREP = @GREP@ +GUILE_VERSION = @GUILE_VERSION@ +INCLIST = @INCLIST@ +INCSNPRINTFV = @INCSNPRINTFV@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGUILE_CFLAGS = @LIBGUILE_CFLAGS@ +LIBGUILE_LIBS = @LIBGUILE_LIBS@ +LIBGUILE_PATH = @LIBGUILE_PATH@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBSNPRINTFV = @LIBSNPRINTFV@ +LIBTOOL = @LIBTOOL@ +LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ +LIBXML2_LIBS = @LIBXML2_LIBS@ +LIBXML2_PATH = @LIBXML2_PATH@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +M4_SRC = @M4_SRC@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPTS_TESTDIR = @OPTS_TESTDIR@ +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@ +POSIX_SHELL = @POSIX_SHELL@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TEXI2HTML = @TEXI2HTML@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_aux_dir = @ac_aux_dir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +TESTS = convert.test +EXTRA_DIST = $(TESTS) +TESTS_ENVIRONMENT = \ + X2Aexe=`\cd $(top_builddir)/xml2ag ; pwd`/xml2ag$(EXEEXT) \ + srcdir=$(srcdir) top_srcdir=$(top_srcdir) + + +# Makefile.am ends here +XML2AG = +all: all-am + +.SUFFIXES: +$(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) --gnu xml2ag/test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu xml2ag/test/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): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +cscope cscopelist: + + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi + +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 + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +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-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-local + +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-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 -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am check check-TESTS check-am clean clean-generic \ + clean-libtool distclean distclean-generic distclean-libtool \ + distclean-local 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 + + +distclean-local: + -rm -rf testdir FAILURES + +check : perm-stamp + +$(TESTS) : perm-stamp + +perm-stamp : + cd $(srcdir) ; chmod +x *.test + +# 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: diff --git a/xml2ag/test/convert.test b/xml2ag/test/convert.test new file mode 100755 index 0000000..4eadafc --- /dev/null +++ b/xml2ag/test/convert.test @@ -0,0 +1,100 @@ +#! /bin/sh +# -*- Mode: Shell-script -*- +# ---------------------------------------------------------------------- +# convert.test --- test XML -> AutoGen conversion +# +## Time-stamp: "2010-07-16 15:29:12 bkorb" +## Author: Bruce Korb <bkorb@gnu.org> +## +## This file is part of AutoGen. +## AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved +## +## AutoGen is free software: you can redistribute it and/or modify it +## under the terms of the GNU General Public License as published by the +## Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## AutoGen is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +## See the GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along +## with this program. If not, see <http://www.gnu.org/licenses/>. + +case "X${VERBOSE}" in +X | X[nNfF]* ) VERBOSE=false ;; +* ) set -x ; VERBOSE=true ;; +esac + +# A standard failure function +failure() +{ + cd ${testsubdir} + test -d ../FAILURES || mkdir ../FAILURES + l=`echo *` + ( \cd ../FAILURES ; rm -f $l ) + mv -f * ../FAILURES + echo "$*" + exit 1 +} + +srcdir=`pwd` +testname=convert +[ -d testdir ] || mkdir testdir +cd testdir +testsubdir=`pwd` + +${X2Aexe} -O ${testname}.out <<'_EndOfXML_' +<?xml version="1.0"?> +<ag_example template="sample.tpl"> + <mumble attr="foo"> + <grumble> + <stumble around the 'XML'.> + </grumble> + mumble-1 + <!-- This is just a + /* multi-line comment */ --> + mumble-2 + <grumble> + grumble & "grumble" & grumble. + </grumble> + mumble, mumble + </mumble> + <stumble upon="rough going"/> +</ag_example> +_EndOfXML_ + +cat > ${testname}.samp <<'_EndOfSample_' +/* Parsed from stdin */ +AutoGen Definitions sample.tpl; +XML-version = '1.0'; +XML-standalone = true; +template = 'sample.tpl'; +mumble = { + content = ''; + attr = 'foo'; + grumble = { + content = ''; + text = '<stumble around the \'XML\'.>'; + }; + text = 'mumble-1'; + /* This is just a + /* multi-line comment * / */ + text = 'mumble-2'; + grumble = { + content = ''; + text = 'grumble & "grumble" & grumble.'; + }; + text = 'mumble, mumble'; +}; +stumble = { + content = ''; + upon = 'rough going'; +}; +_EndOfSample_ + +cmp -s ${testname}.samp ${testname}.out || \ + failure "`diff ${testname}.samp ${testname}.out`" + +${VERBOSE} || { cd ${srcdir} ; rm -rf ${testsubdir} ; } diff --git a/xml2ag/xml2ag.c b/xml2ag/xml2ag.c new file mode 100644 index 0000000..331f869 --- /dev/null +++ b/xml2ag/xml2ag.c @@ -0,0 +1,478 @@ + +/** + * \file xml2ag.c + * + * Time-stamp: "2010-08-04 20:49:34 bkorb" + * + * This is the main routine for xml2ag. + * xml2ag Copyright (c) 2002-2012 by Bruce Korb - all rights reserved + * + * This file is part of AutoGen. + * AutoGen copyright (c) 1992-2012 by Bruce Korb - all rights reserved + * + * AutoGen is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AutoGen is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +tSCC zConflict[] = + "the file name operand conflicts with the definitions option.\n"; + +tSCC zTextFmt[] = + "text = '%s';\n"; + + +tSCC* typeName[] = { + "0 - inval", + "ELEMENT_NODE", + "ATTRIBUTE_NODE", + "TEXT_NODE", + "CDATA_SECTION_NODE", + "ENTITY_REF_NODE", + "ENTITY_NODE", + "PI_NODE", + "COMMENT_NODE", + "DOCUMENT_NODE", + "DOCUMENT_TYPE_NODE", + "DOCUMENT_FRAG_NODE", + "NOTATION_NODE", + "HTML_DOCUMENT_NODE", + "DTD_NODE", + "ELEMENT_DECL", + "ATTRIBUTE_DECL", + "ENTITY_DECL", + "NAMESPACE_DECL", + "XINCLUDE_START", + "XINCLUDE_END", + "DOCB_DOCUMENT_NODE" }; + +int level = 0; +FILE* outFp; + +#define CHUNK_SZ 4096 + +/* = = = START-STATIC-FORWARD = = = */ +/* static forward declarations maintained by :mkfwd */ +static char* +loadFile( FILE* fp, size_t* pzSize ); + +static void +emitIndentation( void ); + +static char* +trim( char const* pzSrc, size_t* pSz ); + +static xmlNodePtr +printHeader( xmlDocPtr pDoc ); + +static void +printAttrs( xmlAttrPtr pAttr ); + +static void +printNode( xmlNodePtr pNode ); + +static void +printChildren( xmlNodePtr pNode ); +/* = = = END-STATIC-FORWARD = = = */ +#define TRIM(s,psz) trim( (char const*)(s), (size_t*)(psz) ) + +extern void forkAutogen( char const* pzInput ); + + +int +main( int argc, char** argv ) +{ + xmlDocPtr pDoc; + char const* pzFile = NULL; + + { + int ct = optionProcess( &xml2agOptions, argc, argv ); + argc -= ct; + argv += ct; + + switch (argc) { + case 1: + if (strcmp( *argv, "-" ) != 0) { + if (HAVE_OPT( DEFINITIONS )) { + fprintf( stderr, zConflict ); + USAGE( EXIT_FAILURE ); + } + pzFile = *argv; + break; + } + case 0: + if ( HAVE_OPT( DEFINITIONS ) + && (strcmp( OPT_ARG( DEFINITIONS ), "-" ) != 0) ) + + pzFile = OPT_ARG( DEFINITIONS ); + break; + + default: + fprintf( stderr, "only one argument allowed\n" ); + return EXIT_FAILURE; + } + } + + if (! HAVE_OPT( OUTPUT )) + forkAutogen( pzFile ); + else + outFp = stdout; + + if (pzFile != NULL) { + fprintf( outFp, "/* Parsing file %s */\n", pzFile ); + pDoc = xmlParseFile( pzFile ); + } + else { + size_t sz; + char* pz = loadFile( stdin, &sz ); + pDoc = xmlParseMemory( pz, (int)sz ); + fprintf( outFp, "/* Parsed from stdin */\n" ); + } + + { + static char const z_not_doc[] = + "/* type %d doc is not DOCUMENT or HTML_DOCUMENT */\n"; + + xmlNodePtr pRoot = printHeader( pDoc ); + printAttrs( pRoot->properties ); + switch (pDoc->type) { + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + printChildren( pRoot->children ); + break; + default: + fprintf( outFp, z_not_doc, pDoc->type ); + } + } + + xmlCleanupParser(); + return 0; +} + + +static char* +loadFile( FILE* fp, size_t* pzSize ) +{ + size_t asz = CHUNK_SZ; + size_t usz = 0; + char* mem = malloc( asz ); + + for (;;) { + + if ((usz + CHUNK_SZ) > asz) { + asz += CHUNK_SZ; + mem = realloc( mem, asz ); + } + + if (mem == NULL) { + fprintf(stderr, "Cannot allocate %d byte bufer\n", (int)asz); + exit( EXIT_FAILURE ); + } + + { + size_t rdct = fread(mem + usz, (size_t)1, (size_t)CHUNK_SZ, fp); + usz += rdct; + if (rdct < CHUNK_SZ) + break; + } + } + + *pzSize = usz; + return mem; +} + + +static void +emitIndentation( void ) +{ + int indent = level * 2; + while (--indent >= 0) fputc( ' ', outFp ); +} + + +static char* +trim( char const* pzSrc, size_t* pSz ) +{ + static char zNil[1] = ""; + static char* pzData = NULL; + static size_t dataLen = 0; + size_t strSize; + + if (pzSrc == NULL) { + if (pSz != NULL) *pSz = 0; + return zNil; + } + + /* + * Trim leading and trailing white space. + */ + while (isspace( *pzSrc )) pzSrc++; + + { + char const* pzEnd = pzSrc + strlen( pzSrc ); + while ((pzEnd > pzSrc) && isspace( pzEnd[-1] )) pzEnd--; + + if (pzEnd <= pzSrc) { + if (pSz != NULL) *pSz = 0; + return zNil; + } + strSize = (pzEnd - pzSrc); + } + + /* + * Count the extra backslashes required and ensure our buffer is + * big enough to hold the newly formed string. + */ + { + char const* pz = pzSrc; + for (;;) { + pz += strcspn( pz, "'\\" ); + if (*(pz++) == NUL) + break; + strSize++; + } + } + + if (dataLen <= strSize) { + size_t sz = (strSize + 0x1000) & ~0x0FFFUL; + if (pzData == NULL) + pzData = malloc( sz ); + else pzData = realloc( pzData, sz ); + if (pzData == NULL) { + fprintf( stderr, "ENOMEM allocating 0x%X bytes", (unsigned)sz ); + exit( EXIT_FAILURE ); + } + dataLen = sz; + } + + /* + * Copy the data, adding backslashes in front of + * single quotes and backslashes. + */ + { + char* pzDest = pzData; + for (;;) { + switch (*(pzDest++) = *(pzSrc++)) { + case '\'': pzDest[-1] = '\\'; *(pzDest++) = '\''; break; + case '\\': *(pzDest++) = '\\'; break; + case NUL: goto set_size; + } + if (pzDest == pzData + strSize) + break; + } + + *pzDest = '\0'; + } + + set_size: + if (pSz != NULL) *pSz = strSize; + return pzData; +} + +static xmlNodePtr +printHeader( xmlDocPtr pDoc ) +{ + tSCC zDef[] = "AutoGen Definitions %s%s;\n"; + char const* pzSfx = ".tpl"; + + xmlNodePtr pRootNode = xmlDocGetRootElement( pDoc ); + xmlChar* pTpl = NULL; + xmlChar* pzTpl; + + if (pRootNode == NULL) { + fprintf( stderr, "Root node not found\n" ); + exit( EXIT_FAILURE ); + } + + if (HAVE_OPT( OVERRIDE_TPL )) { + if (strchr( OPT_ARG( OVERRIDE_TPL ), '.' ) != NULL) + pzSfx = ""; + pzTpl = (xmlChar*)(void*)OPT_ARG( OVERRIDE_TPL ); + } + else { + pTpl = xmlGetProp( pRootNode, (xmlChar*)(void*)"template" ); + if (pTpl == NULL) { + fprintf( stderr, "No template was specified.\n" ); + exit( EXIT_FAILURE ); + } + + pzTpl = pTpl; + if (strchr( (char*)pzTpl, '.' ) != NULL) + pzSfx = ""; + } + + fprintf( outFp, zDef, pzTpl, pzSfx ); + if (pTpl != NULL) + free( pTpl ); + + if (pDoc->name != NULL) + fprintf( outFp, "XML-name = '%s';\n", TRIM( pDoc->name, NULL )); + + if (pDoc->version != NULL) + fprintf( outFp, "XML-version = '%s';\n", TRIM( pDoc->version, NULL )); + + if (pDoc->encoding != NULL) + fprintf( outFp, "XML-encoding = '%s';\n", TRIM( pDoc->encoding, NULL )); + + if (pDoc->URL != NULL) + fprintf( outFp, "XML-URL = '%s';\n", TRIM( pDoc->URL, NULL )); + + if (pDoc->standalone) + fputs( "XML-standalone = true;\n", outFp ); + + return pRootNode; +} + +static void +printAttrs( xmlAttrPtr pAttr ) +{ + while (pAttr != NULL) { + char* pzCont = (char*)pAttr->children->content; + + emitIndentation(); + fputs( (char*)(void*)pAttr->name, outFp ); + fputs( " = ", outFp ); + if (pAttr->children->children == NULL) + fprintf( outFp, "'%s';\n", TRIM( pzCont, NULL )); + else { + fputs( "{\n", outFp ); + level++; + if (pzCont != NULL) { + emitIndentation(); + fprintf( outFp, zTextFmt, TRIM( pzCont, NULL )); + } + printChildren( pAttr->children->children ); + level--; + emitIndentation(); + fputs( "};\n", outFp ); + } + + pAttr = pAttr->next; + } +} + + +static void +printNode( xmlNodePtr pNode ) +{ + switch (pNode->type) { + case XML_ELEMENT_NODE: + { + size_t sz; + char* pzTxt; + emitIndentation(); + fputs( (char*)(void*)pNode->name, outFp ); + pzTxt = TRIM( pNode->content, &sz ); + + if ( (pNode->properties == NULL) + && (pNode->children == NULL)) { + + if (sz == 0) + fputs( ";\n", outFp ); + else fprintf( outFp, " = '%s';\n", pzTxt ); + break; + } + + fputs( " = {\n", outFp ); + level++; + emitIndentation(); + fprintf( outFp, "content = '%s';\n", pzTxt ); + printAttrs( pNode->properties ); + printChildren( pNode->children ); + level--; + emitIndentation(); + fputs( "};\n", outFp ); + break; + } + + case XML_ATTRIBUTE_NODE: + fputs( "Misplaced attribute\n", outFp ); + exit( EXIT_FAILURE ); + + case XML_TEXT_NODE: + { + size_t sz; + char* pzTxt = TRIM( pNode->content, &sz ); + if (sz == 0) + break; + emitIndentation(); + fprintf( outFp, zTextFmt, pzTxt ); + break; + } + + case XML_COMMENT_NODE: + { + size_t sz; + char* pzTxt = TRIM( pNode->content, &sz ); + if (sz == 0) + break; + + emitIndentation(); + fputs( "/* ", outFp ); + for (;;) { + char* pz = strstr( pzTxt, "*/" ); + if (pz == NULL) + break; + fwrite(pzTxt, (size_t)((pz - pzTxt) + 1), (size_t)1, outFp); + pzTxt = pz+1; + fputc( ' ', outFp ); + } + fprintf( outFp, "%s */\n", pzTxt ); + break; + } + + case XML_CDATA_SECTION_NODE: + case XML_ENTITY_REF_NODE: + case XML_ENTITY_NODE: + case XML_PI_NODE: + + case XML_DOCUMENT_NODE: + case XML_HTML_DOCUMENT_NODE: + case XML_DOCUMENT_TYPE_NODE: + case XML_DOCUMENT_FRAG_NODE: + case XML_NOTATION_NODE: + case XML_DTD_NODE: + case XML_ELEMENT_DECL: + case XML_ATTRIBUTE_DECL: + case XML_ENTITY_DECL: + case XML_NAMESPACE_DECL: + case XML_XINCLUDE_START: + case XML_XINCLUDE_END: + emitIndentation(); + fprintf( outFp, "/* Unsupported XML node type: %s */\n", + typeName[ pNode->type ]); + break; + + default: + emitIndentation(); + fprintf( outFp, "/* Unknown XML node type %d */\n", pNode->type ); + break; + } +} + + +static void +printChildren( xmlNodePtr pNode ) +{ + while (pNode != NULL) { + printNode( pNode ); + pNode = pNode->next; + } +} + +/* + * Local Variables: + * mode: C + * c-file-style: "stroustrup" + * indent-tabs-mode: nil + * End: + * end of xml2ag/xml2ag.c */ diff --git a/xml2ag/xmlopts.def b/xml2ag/xmlopts.def new file mode 100644 index 0000000..242a874 --- /dev/null +++ b/xml2ag/xmlopts.def @@ -0,0 +1,180 @@ +/* -*- Mode: conf -*- */ + +autogen definitions options; + +// Time-stamp: "2012-04-07 09:05:33 bkorb" + +/* + * This file is part of AutoGen. + * AutoGen Copyright (c) 1992-2012 by Bruce Korb - all rights reserved + * + * AutoGen is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * AutoGen is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ +export = <<- EOExport + #include <sys/types.h> + #include <sys/stat.h> + + #ifndef __USE_POSIX + # define __USE_POSIX /* for glib's pedantic needs */ + #endif + #ifndef __USE_XOPEN_EXTENDED + # define __USE_XOPEN_EXTENDED /* ditto */ + #endif + #include <stdio.h> + #include <ctype.h> + #include <errno.h> + #include <fcntl.h> + #include <limits.h> + #include <stdlib.h> + #include <string.h> + #include <unistd.h> + + #include <libxml/parser.h> + #include <libxml/tree.h> + + extern FILE* outFp; + #ifndef NUL + # define NUL '\0' + #endif + extern void forkAutogen( char const* pzInput ); + EOExport; + +flag = { + name = the-xml2ag-option; + documentation; + descrip = 'All other options are derived from autogen'; +}; + +flag = { + name = output; + value = O; + arg-type = string; + arg-name = file; + descrip = "Output file in lieu of AutoGen processing"; + doc = + "By default, the output is handed to an AutoGen for processing.\n" + "However, you may save the definitions to a file instead."; + + flag_code = <<- FLAG_CODE_END + if (strcmp(pOptDesc->optArg.argString, "-") == 0) + return; + + if (freopen(pOptDesc->optArg.argString, "w", stdout) == NULL) { + fprintf(stderr, "Error %d (%s) opening `%s' for output", + errno, strerror(errno), pOptDesc->optArg.argString); + exit(EXIT_FAILURE); + } + FLAG_CODE_END ; +}; + +flag = { + name = autogen-options; + documentation = <<- _EODoc_ + These options are @i{mostly} just passed throug to @code{autogen}. + The one exception is @code{--override-tpl} which replaces the + default template in the output definitions. It does not get passed + through on the command line. + _EODoc_; + + descrip = 'All other options'; +}; + +#define XML2AG +#option templ-dir $top_srcdir/agen5 +#option templ-dir $top_srcdir/autoopts +#include opts.def + +explain = <<- END_EXPLAIN + This program will convert any arbitrary XML file into equivalent + AutoGen definitions, and invoke AutoGen. + END_EXPLAIN ; + +detail = <<- END_DETAIL + The template will be derived from either: + * the ``--override-tpl'' command line option + * a top level XML attribute named, "template" + + The ``base-name'' for the output will similarly be either: + * the ``--base-name'' command line option + * the base name of the .xml file + END_DETAIL ; + +prog-man-descrip = <<- END_DETAIL + The template will be derived from either: + .br + * the \fB--override-tpl\fP command line option + .br + * a top level XML attribute named, "template" + .br + One or the other \fBmust\fP be provided, or the program will + exit with a failure message. + .sp 1 + The ``base-name'' for the output will similarly be either: + .br + * the \fB--base-name\fP command line option + .br + * the base name of the .xml file + END_DETAIL ; + +prog-info-descrip = <<- END_DETAIL + The template used will be derived from either: + @itemize @bullet + @item + The @strong{--override-tpl} command line option + @item + A top level XML attribute named, "@code{template}" + @end itemize + @noindent + One or the other @strong{must} be provided, or the program will + exit with a failure message. + + The @emph{base-name} for the output will similarly be either: + @itemize @bullet + @item + The @strong{--base-name} command line option. + @item + The base name of the @file{.xml} file. + @end itemize + + The definitions derived from XML generally have an extra layer + of definition. Specifically, this XML input: + @example + <mumble attr="foo"> + mumble-1 + <grumble> + grumble, grumble, grumble. + </grumble>mumble, mumble + </mumble> + @end example + Will get converted into this: + @example + mumble = @{ + grumble = @{ + text = 'grumble, grumble, grumble'; + @}; + text = 'mumble-1'; + text = 'mumble, mumble'; + @}; + @end example + Please notice that some information is lost. AutoGen cannot tell that + "grumble" used to lie between the mumble texts. Also please note that + you cannot assign: + @example + grumble = 'grumble, grumble, grumble.'; + @end example + because if another "grumble" has an attribute or multiple texts, + it becomes impossible to have the definitions be the same type + (compound or text values). + END_DETAIL ; +/* end of opts.def */ |