renaming
This commit is contained in:
131
Makefile
131
Makefile
@@ -89,6 +89,9 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
sbin_PROGRAMS = helmetd$(EXEEXT)
|
||||
bin_PROGRAMS = helmetctl$(EXEEXT)
|
||||
noinst_PROGRAMS = libxtools/tconfig_test$(EXEEXT) \
|
||||
libxtools/clconfig_test$(EXEEXT) \
|
||||
libxtools/clcomp_test$(EXEEXT) libxtools/cllexer_test$(EXEEXT)
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
@@ -102,7 +105,7 @@ mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS)
|
||||
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) $(sbin_PROGRAMS)
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
AR = ar
|
||||
ARFLAGS = cru
|
||||
@@ -118,10 +121,10 @@ libxasync_a_OBJECTS = $(am_libxasync_a_OBJECTS)
|
||||
libxtools_a_AR = $(AR) $(ARFLAGS)
|
||||
libxtools_a_LIBADD =
|
||||
am_libxtools_a_OBJECTS = libxtools/bstream.$(OBJEXT) \
|
||||
libxtools/galexer.$(OBJEXT) libxtools/gclexer.$(OBJEXT) \
|
||||
libxtools/cllexer.$(OBJEXT) libxtools/clcomp.$(OBJEXT) \
|
||||
libxtools/massert.$(OBJEXT) libxtools/tccomp.$(OBJEXT) \
|
||||
libxtools/tclexer.$(OBJEXT) libxtools/tconfig.$(OBJEXT) \
|
||||
libxtools/vmapper.$(OBJEXT) libxtools/gconfig.$(OBJEXT)
|
||||
libxtools/vmapper.$(OBJEXT) libxtools/clconfig.$(OBJEXT)
|
||||
libxtools_a_OBJECTS = $(am_libxtools_a_OBJECTS)
|
||||
am_helmetctl_OBJECTS = helmetctl.$(OBJEXT) logger.$(OBJEXT)
|
||||
helmetctl_OBJECTS = $(am_helmetctl_OBJECTS)
|
||||
@@ -130,6 +133,20 @@ am_helmetd_OBJECTS = helmetd.$(OBJEXT) logger.$(OBJEXT) \
|
||||
server.$(OBJEXT)
|
||||
helmetd_OBJECTS = $(am_helmetd_OBJECTS)
|
||||
helmetd_DEPENDENCIES = $(libxtools_NAME) $(libxasync_NAME)
|
||||
am_libxtools_clcomp_test_OBJECTS = libxtools/clcomp_test.$(OBJEXT)
|
||||
libxtools_clcomp_test_OBJECTS = $(am_libxtools_clcomp_test_OBJECTS)
|
||||
libxtools_clcomp_test_DEPENDENCIES = $(libxtools_NAME)
|
||||
am_libxtools_clconfig_test_OBJECTS = \
|
||||
libxtools/clconfig_test.$(OBJEXT)
|
||||
libxtools_clconfig_test_OBJECTS = \
|
||||
$(am_libxtools_clconfig_test_OBJECTS)
|
||||
libxtools_clconfig_test_DEPENDENCIES = $(libxtools_NAME)
|
||||
am_libxtools_cllexer_test_OBJECTS = libxtools/cllexer_test.$(OBJEXT)
|
||||
libxtools_cllexer_test_OBJECTS = $(am_libxtools_cllexer_test_OBJECTS)
|
||||
libxtools_cllexer_test_DEPENDENCIES = $(libxtools_NAME)
|
||||
am_libxtools_tconfig_test_OBJECTS = libxtools/tconfig_test.$(OBJEXT)
|
||||
libxtools_tconfig_test_OBJECTS = $(am_libxtools_tconfig_test_OBJECTS)
|
||||
libxtools_tconfig_test_DEPENDENCIES = $(libxtools_NAME)
|
||||
AM_V_P = $(am__v_P_$(V))
|
||||
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_P_0 = false
|
||||
@@ -158,9 +175,17 @@ am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
||||
$(helmetctl_SOURCES) $(helmetd_SOURCES)
|
||||
$(helmetctl_SOURCES) $(helmetd_SOURCES) \
|
||||
$(libxtools_clcomp_test_SOURCES) \
|
||||
$(libxtools_clconfig_test_SOURCES) \
|
||||
$(libxtools_cllexer_test_SOURCES) \
|
||||
$(libxtools_tconfig_test_SOURCES)
|
||||
DIST_SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
||||
$(helmetctl_SOURCES) $(helmetd_SOURCES)
|
||||
$(helmetctl_SOURCES) $(helmetd_SOURCES) \
|
||||
$(libxtools_clcomp_test_SOURCES) \
|
||||
$(libxtools_clconfig_test_SOURCES) \
|
||||
$(libxtools_cllexer_test_SOURCES) \
|
||||
$(libxtools_tconfig_test_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
@@ -298,7 +323,7 @@ libxtools_NAME = libxtools.a
|
||||
libxasync_NAME = libxasync.a
|
||||
helmetd_SOURCES = helmetd.c \
|
||||
logger.c logger.h \
|
||||
server.c server.h
|
||||
server.c server.h
|
||||
|
||||
helmetd_LDADD = $(libxtools_NAME) $(libxasync_NAME)
|
||||
helmetctl_SOURCES = helmetctl.c \
|
||||
@@ -309,10 +334,10 @@ noinst_LIBRARIES = $(libxtools_NAME) $(libxasync_NAME)
|
||||
libxtools_a_SOURCES = \
|
||||
libxtools/bstream.c \
|
||||
libxtools/bstream.h \
|
||||
libxtools/galexer.c \
|
||||
libxtools/galexer.h \
|
||||
libxtools/gclexer.c \
|
||||
libxtools/gclexer.h \
|
||||
libxtools/cllexer.c \
|
||||
libxtools/cllexer.h \
|
||||
libxtools/clcomp.c \
|
||||
libxtools/clcomp.h \
|
||||
libxtools/massert.c \
|
||||
libxtools/massert.h \
|
||||
libxtools/tccomp.c \
|
||||
@@ -323,13 +348,21 @@ libxtools_a_SOURCES = \
|
||||
libxtools/tconfig.h \
|
||||
libxtools/vmapper.c \
|
||||
libxtools/vmapper.h \
|
||||
libxtools/gconfig.c \
|
||||
libxtools/gconfig.h
|
||||
libxtools/clconfig.c \
|
||||
libxtools/clconfig.h
|
||||
|
||||
libxasync_a_SOURCES = \
|
||||
libxasync/waitgroup.c \
|
||||
libxasync/waitgroup.h
|
||||
|
||||
libxtools_tconfig_test_SOURCES = libxtools/tconfig_test.c
|
||||
libxtools_tconfig_test_LDADD = $(libxtools_NAME)
|
||||
libxtools_clconfig_test_SOURCES = libxtools/clconfig_test.c
|
||||
libxtools_clconfig_test_LDADD = $(libxtools_NAME)
|
||||
libxtools_clcomp_test_SOURCES = libxtools/clcomp_test.c
|
||||
libxtools_clcomp_test_LDADD = $(libxtools_NAME)
|
||||
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
||||
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@@ -409,6 +442,9 @@ uninstall-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
install-sbinPROGRAMS: $(sbin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
|
||||
@@ -467,14 +503,14 @@ libxtools/$(am__dirstamp):
|
||||
@$(MKDIR_P) libxtools
|
||||
@: > libxtools/$(am__dirstamp)
|
||||
libxtools/bstream.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/galexer.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/gclexer.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/cllexer.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/clcomp.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/massert.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/tccomp.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/tclexer.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/tconfig.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/vmapper.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/gconfig.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/clconfig.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools.a: $(libxtools_a_OBJECTS) $(libxtools_a_DEPENDENCIES) $(EXTRA_libxtools_a_DEPENDENCIES)
|
||||
$(AM_V_at)-rm -f libxtools.a
|
||||
@@ -488,6 +524,26 @@ helmetctl$(EXEEXT): $(helmetctl_OBJECTS) $(helmetctl_DEPENDENCIES) $(EXTRA_helme
|
||||
helmetd$(EXEEXT): $(helmetd_OBJECTS) $(helmetd_DEPENDENCIES) $(EXTRA_helmetd_DEPENDENCIES)
|
||||
@rm -f helmetd$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(helmetd_OBJECTS) $(helmetd_LDADD) $(LIBS)
|
||||
libxtools/clcomp_test.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools/clcomp_test$(EXEEXT): $(libxtools_clcomp_test_OBJECTS) $(libxtools_clcomp_test_DEPENDENCIES) $(EXTRA_libxtools_clcomp_test_DEPENDENCIES) libxtools/$(am__dirstamp)
|
||||
@rm -f libxtools/clcomp_test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libxtools_clcomp_test_OBJECTS) $(libxtools_clcomp_test_LDADD) $(LIBS)
|
||||
libxtools/clconfig_test.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools/clconfig_test$(EXEEXT): $(libxtools_clconfig_test_OBJECTS) $(libxtools_clconfig_test_DEPENDENCIES) $(EXTRA_libxtools_clconfig_test_DEPENDENCIES) libxtools/$(am__dirstamp)
|
||||
@rm -f libxtools/clconfig_test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libxtools_clconfig_test_OBJECTS) $(libxtools_clconfig_test_LDADD) $(LIBS)
|
||||
libxtools/cllexer_test.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools/cllexer_test$(EXEEXT): $(libxtools_cllexer_test_OBJECTS) $(libxtools_cllexer_test_DEPENDENCIES) $(EXTRA_libxtools_cllexer_test_DEPENDENCIES) libxtools/$(am__dirstamp)
|
||||
@rm -f libxtools/cllexer_test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libxtools_cllexer_test_OBJECTS) $(libxtools_cllexer_test_LDADD) $(LIBS)
|
||||
libxtools/tconfig_test.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools/tconfig_test$(EXEEXT): $(libxtools_tconfig_test_OBJECTS) $(libxtools_tconfig_test_DEPENDENCIES) $(EXTRA_libxtools_tconfig_test_DEPENDENCIES) libxtools/$(am__dirstamp)
|
||||
@rm -f libxtools/tconfig_test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libxtools_tconfig_test_OBJECTS) $(libxtools_tconfig_test_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
@@ -775,7 +831,8 @@ maintainer-clean-generic:
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-local \
|
||||
clean-noinstLIBRARIES clean-sbinPROGRAMS mostlyclean-am
|
||||
clean-noinstLIBRARIES clean-noinstPROGRAMS clean-sbinPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
@@ -847,30 +904,36 @@ uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
|
||||
clean-binPROGRAMS clean-cscope clean-generic clean-local \
|
||||
clean-noinstLIBRARIES clean-sbinPROGRAMS cscope cscopelist-am \
|
||||
ctags ctags-am dist dist-all dist-bzip2 dist-gzip dist-lzip \
|
||||
dist-shar dist-tarZ dist-xz dist-zip dist-zstd distcheck \
|
||||
distclean distclean-compile distclean-generic distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck 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-sbinPROGRAMS \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
|
||||
uninstall-sbinPROGRAMS
|
||||
clean-noinstLIBRARIES clean-noinstPROGRAMS clean-sbinPROGRAMS \
|
||||
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
|
||||
dist-zstd distcheck distclean distclean-compile \
|
||||
distclean-generic distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck 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-sbinPROGRAMS install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am uninstall-binPROGRAMS uninstall-sbinPROGRAMS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
test: helmetctl
|
||||
./helmetctl
|
||||
test: libxtools/cllexer_test
|
||||
cd libxtools && ./cllexer_test
|
||||
|
||||
#test: libxtools/clcomp_test
|
||||
# cd libxtools && ./clcomp_test
|
||||
|
||||
#test: libxtools/clconfig_test
|
||||
# cd libxtools && ./clconfig_test
|
||||
|
||||
clean-local:
|
||||
rm -f *~
|
||||
rm -f *~
|
||||
rm -f */*~
|
||||
rm -rf autom4te.cache
|
||||
|
||||
|
||||
42
Makefile.am
42
Makefile.am
@@ -12,7 +12,7 @@ bin_PROGRAMS = helmetctl
|
||||
|
||||
helmetd_SOURCES = helmetd.c \
|
||||
logger.c logger.h \
|
||||
server.c server.h
|
||||
server.c server.h
|
||||
helmetd_LDADD = $(libxtools_NAME) $(libxasync_NAME)
|
||||
|
||||
helmetctl_SOURCES = helmetctl.c \
|
||||
@@ -25,10 +25,10 @@ noinst_LIBRARIES = $(libxtools_NAME) $(libxasync_NAME)
|
||||
libxtools_a_SOURCES = \
|
||||
libxtools/bstream.c \
|
||||
libxtools/bstream.h \
|
||||
libxtools/galexer.c \
|
||||
libxtools/galexer.h \
|
||||
libxtools/gclexer.c \
|
||||
libxtools/gclexer.h \
|
||||
libxtools/cllexer.c \
|
||||
libxtools/cllexer.h \
|
||||
libxtools/clcomp.c \
|
||||
libxtools/clcomp.h \
|
||||
libxtools/massert.c \
|
||||
libxtools/massert.h \
|
||||
libxtools/tccomp.c \
|
||||
@@ -39,18 +39,40 @@ libxtools_a_SOURCES = \
|
||||
libxtools/tconfig.h \
|
||||
libxtools/vmapper.c \
|
||||
libxtools/vmapper.h \
|
||||
libxtools/gconfig.c \
|
||||
libxtools/gconfig.h
|
||||
libxtools/clconfig.c \
|
||||
libxtools/clconfig.h
|
||||
|
||||
|
||||
libxasync_a_SOURCES = \
|
||||
libxasync/waitgroup.c \
|
||||
libxasync/waitgroup.h
|
||||
|
||||
test: helmetctl
|
||||
./helmetctl
|
||||
noinst_PROGRAMS = libxtools/tconfig_test
|
||||
libxtools_tconfig_test_SOURCES = libxtools/tconfig_test.c
|
||||
libxtools_tconfig_test_LDADD = $(libxtools_NAME)
|
||||
|
||||
noinst_PROGRAMS += libxtools/clconfig_test
|
||||
libxtools_clconfig_test_SOURCES = libxtools/clconfig_test.c
|
||||
libxtools_clconfig_test_LDADD = $(libxtools_NAME)
|
||||
|
||||
noinst_PROGRAMS += libxtools/clcomp_test
|
||||
libxtools_clcomp_test_SOURCES = libxtools/clcomp_test.c
|
||||
libxtools_clcomp_test_LDADD = $(libxtools_NAME)
|
||||
|
||||
noinst_PROGRAMS += libxtools/cllexer_test
|
||||
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
||||
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
||||
|
||||
test: libxtools/cllexer_test
|
||||
cd libxtools && ./cllexer_test
|
||||
|
||||
#test: libxtools/clcomp_test
|
||||
# cd libxtools && ./clcomp_test
|
||||
|
||||
#test: libxtools/clconfig_test
|
||||
# cd libxtools && ./clconfig_test
|
||||
|
||||
clean-local:
|
||||
rm -f *~
|
||||
rm -f *~
|
||||
rm -f */*~
|
||||
rm -rf autom4te.cache
|
||||
|
||||
131
Makefile.in
131
Makefile.in
@@ -89,6 +89,9 @@ PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
sbin_PROGRAMS = helmetd$(EXEEXT)
|
||||
bin_PROGRAMS = helmetctl$(EXEEXT)
|
||||
noinst_PROGRAMS = libxtools/tconfig_test$(EXEEXT) \
|
||||
libxtools/clconfig_test$(EXEEXT) \
|
||||
libxtools/clcomp_test$(EXEEXT) libxtools/cllexer_test$(EXEEXT)
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
@@ -102,7 +105,7 @@ mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS)
|
||||
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) $(sbin_PROGRAMS)
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
AR = ar
|
||||
ARFLAGS = cru
|
||||
@@ -118,10 +121,10 @@ libxasync_a_OBJECTS = $(am_libxasync_a_OBJECTS)
|
||||
libxtools_a_AR = $(AR) $(ARFLAGS)
|
||||
libxtools_a_LIBADD =
|
||||
am_libxtools_a_OBJECTS = libxtools/bstream.$(OBJEXT) \
|
||||
libxtools/galexer.$(OBJEXT) libxtools/gclexer.$(OBJEXT) \
|
||||
libxtools/cllexer.$(OBJEXT) libxtools/clcomp.$(OBJEXT) \
|
||||
libxtools/massert.$(OBJEXT) libxtools/tccomp.$(OBJEXT) \
|
||||
libxtools/tclexer.$(OBJEXT) libxtools/tconfig.$(OBJEXT) \
|
||||
libxtools/vmapper.$(OBJEXT) libxtools/gconfig.$(OBJEXT)
|
||||
libxtools/vmapper.$(OBJEXT) libxtools/clconfig.$(OBJEXT)
|
||||
libxtools_a_OBJECTS = $(am_libxtools_a_OBJECTS)
|
||||
am_helmetctl_OBJECTS = helmetctl.$(OBJEXT) logger.$(OBJEXT)
|
||||
helmetctl_OBJECTS = $(am_helmetctl_OBJECTS)
|
||||
@@ -130,6 +133,20 @@ am_helmetd_OBJECTS = helmetd.$(OBJEXT) logger.$(OBJEXT) \
|
||||
server.$(OBJEXT)
|
||||
helmetd_OBJECTS = $(am_helmetd_OBJECTS)
|
||||
helmetd_DEPENDENCIES = $(libxtools_NAME) $(libxasync_NAME)
|
||||
am_libxtools_clcomp_test_OBJECTS = libxtools/clcomp_test.$(OBJEXT)
|
||||
libxtools_clcomp_test_OBJECTS = $(am_libxtools_clcomp_test_OBJECTS)
|
||||
libxtools_clcomp_test_DEPENDENCIES = $(libxtools_NAME)
|
||||
am_libxtools_clconfig_test_OBJECTS = \
|
||||
libxtools/clconfig_test.$(OBJEXT)
|
||||
libxtools_clconfig_test_OBJECTS = \
|
||||
$(am_libxtools_clconfig_test_OBJECTS)
|
||||
libxtools_clconfig_test_DEPENDENCIES = $(libxtools_NAME)
|
||||
am_libxtools_cllexer_test_OBJECTS = libxtools/cllexer_test.$(OBJEXT)
|
||||
libxtools_cllexer_test_OBJECTS = $(am_libxtools_cllexer_test_OBJECTS)
|
||||
libxtools_cllexer_test_DEPENDENCIES = $(libxtools_NAME)
|
||||
am_libxtools_tconfig_test_OBJECTS = libxtools/tconfig_test.$(OBJEXT)
|
||||
libxtools_tconfig_test_OBJECTS = $(am_libxtools_tconfig_test_OBJECTS)
|
||||
libxtools_tconfig_test_DEPENDENCIES = $(libxtools_NAME)
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
@@ -158,9 +175,17 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
||||
$(helmetctl_SOURCES) $(helmetd_SOURCES)
|
||||
$(helmetctl_SOURCES) $(helmetd_SOURCES) \
|
||||
$(libxtools_clcomp_test_SOURCES) \
|
||||
$(libxtools_clconfig_test_SOURCES) \
|
||||
$(libxtools_cllexer_test_SOURCES) \
|
||||
$(libxtools_tconfig_test_SOURCES)
|
||||
DIST_SOURCES = $(libxasync_a_SOURCES) $(libxtools_a_SOURCES) \
|
||||
$(helmetctl_SOURCES) $(helmetd_SOURCES)
|
||||
$(helmetctl_SOURCES) $(helmetd_SOURCES) \
|
||||
$(libxtools_clcomp_test_SOURCES) \
|
||||
$(libxtools_clconfig_test_SOURCES) \
|
||||
$(libxtools_cllexer_test_SOURCES) \
|
||||
$(libxtools_tconfig_test_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
@@ -298,7 +323,7 @@ libxtools_NAME = libxtools.a
|
||||
libxasync_NAME = libxasync.a
|
||||
helmetd_SOURCES = helmetd.c \
|
||||
logger.c logger.h \
|
||||
server.c server.h
|
||||
server.c server.h
|
||||
|
||||
helmetd_LDADD = $(libxtools_NAME) $(libxasync_NAME)
|
||||
helmetctl_SOURCES = helmetctl.c \
|
||||
@@ -309,10 +334,10 @@ noinst_LIBRARIES = $(libxtools_NAME) $(libxasync_NAME)
|
||||
libxtools_a_SOURCES = \
|
||||
libxtools/bstream.c \
|
||||
libxtools/bstream.h \
|
||||
libxtools/galexer.c \
|
||||
libxtools/galexer.h \
|
||||
libxtools/gclexer.c \
|
||||
libxtools/gclexer.h \
|
||||
libxtools/cllexer.c \
|
||||
libxtools/cllexer.h \
|
||||
libxtools/clcomp.c \
|
||||
libxtools/clcomp.h \
|
||||
libxtools/massert.c \
|
||||
libxtools/massert.h \
|
||||
libxtools/tccomp.c \
|
||||
@@ -323,13 +348,21 @@ libxtools_a_SOURCES = \
|
||||
libxtools/tconfig.h \
|
||||
libxtools/vmapper.c \
|
||||
libxtools/vmapper.h \
|
||||
libxtools/gconfig.c \
|
||||
libxtools/gconfig.h
|
||||
libxtools/clconfig.c \
|
||||
libxtools/clconfig.h
|
||||
|
||||
libxasync_a_SOURCES = \
|
||||
libxasync/waitgroup.c \
|
||||
libxasync/waitgroup.h
|
||||
|
||||
libxtools_tconfig_test_SOURCES = libxtools/tconfig_test.c
|
||||
libxtools_tconfig_test_LDADD = $(libxtools_NAME)
|
||||
libxtools_clconfig_test_SOURCES = libxtools/clconfig_test.c
|
||||
libxtools_clconfig_test_LDADD = $(libxtools_NAME)
|
||||
libxtools_clcomp_test_SOURCES = libxtools/clcomp_test.c
|
||||
libxtools_clcomp_test_LDADD = $(libxtools_NAME)
|
||||
libxtools_cllexer_test_SOURCES = libxtools/cllexer_test.c
|
||||
libxtools_cllexer_test_LDADD = $(libxtools_NAME)
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
@@ -409,6 +442,9 @@ uninstall-binPROGRAMS:
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
install-sbinPROGRAMS: $(sbin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
|
||||
@@ -467,14 +503,14 @@ libxtools/$(am__dirstamp):
|
||||
@$(MKDIR_P) libxtools
|
||||
@: > libxtools/$(am__dirstamp)
|
||||
libxtools/bstream.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/galexer.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/gclexer.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/cllexer.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/clcomp.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/massert.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/tccomp.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/tclexer.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/tconfig.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/vmapper.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/gconfig.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
libxtools/clconfig.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools.a: $(libxtools_a_OBJECTS) $(libxtools_a_DEPENDENCIES) $(EXTRA_libxtools_a_DEPENDENCIES)
|
||||
$(AM_V_at)-rm -f libxtools.a
|
||||
@@ -488,6 +524,26 @@ helmetctl$(EXEEXT): $(helmetctl_OBJECTS) $(helmetctl_DEPENDENCIES) $(EXTRA_helme
|
||||
helmetd$(EXEEXT): $(helmetd_OBJECTS) $(helmetd_DEPENDENCIES) $(EXTRA_helmetd_DEPENDENCIES)
|
||||
@rm -f helmetd$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(helmetd_OBJECTS) $(helmetd_LDADD) $(LIBS)
|
||||
libxtools/clcomp_test.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools/clcomp_test$(EXEEXT): $(libxtools_clcomp_test_OBJECTS) $(libxtools_clcomp_test_DEPENDENCIES) $(EXTRA_libxtools_clcomp_test_DEPENDENCIES) libxtools/$(am__dirstamp)
|
||||
@rm -f libxtools/clcomp_test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libxtools_clcomp_test_OBJECTS) $(libxtools_clcomp_test_LDADD) $(LIBS)
|
||||
libxtools/clconfig_test.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools/clconfig_test$(EXEEXT): $(libxtools_clconfig_test_OBJECTS) $(libxtools_clconfig_test_DEPENDENCIES) $(EXTRA_libxtools_clconfig_test_DEPENDENCIES) libxtools/$(am__dirstamp)
|
||||
@rm -f libxtools/clconfig_test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libxtools_clconfig_test_OBJECTS) $(libxtools_clconfig_test_LDADD) $(LIBS)
|
||||
libxtools/cllexer_test.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools/cllexer_test$(EXEEXT): $(libxtools_cllexer_test_OBJECTS) $(libxtools_cllexer_test_DEPENDENCIES) $(EXTRA_libxtools_cllexer_test_DEPENDENCIES) libxtools/$(am__dirstamp)
|
||||
@rm -f libxtools/cllexer_test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libxtools_cllexer_test_OBJECTS) $(libxtools_cllexer_test_LDADD) $(LIBS)
|
||||
libxtools/tconfig_test.$(OBJEXT): libxtools/$(am__dirstamp)
|
||||
|
||||
libxtools/tconfig_test$(EXEEXT): $(libxtools_tconfig_test_OBJECTS) $(libxtools_tconfig_test_DEPENDENCIES) $(EXTRA_libxtools_tconfig_test_DEPENDENCIES) libxtools/$(am__dirstamp)
|
||||
@rm -f libxtools/tconfig_test$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(libxtools_tconfig_test_OBJECTS) $(libxtools_tconfig_test_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
@@ -775,7 +831,8 @@ maintainer-clean-generic:
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-local \
|
||||
clean-noinstLIBRARIES clean-sbinPROGRAMS mostlyclean-am
|
||||
clean-noinstLIBRARIES clean-noinstPROGRAMS clean-sbinPROGRAMS \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
@@ -847,30 +904,36 @@ uninstall-am: uninstall-binPROGRAMS uninstall-sbinPROGRAMS
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \
|
||||
clean-binPROGRAMS clean-cscope clean-generic clean-local \
|
||||
clean-noinstLIBRARIES clean-sbinPROGRAMS cscope cscopelist-am \
|
||||
ctags ctags-am dist dist-all dist-bzip2 dist-gzip dist-lzip \
|
||||
dist-shar dist-tarZ dist-xz dist-zip dist-zstd distcheck \
|
||||
distclean distclean-compile distclean-generic distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck 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-sbinPROGRAMS \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
|
||||
uninstall-sbinPROGRAMS
|
||||
clean-noinstLIBRARIES clean-noinstPROGRAMS clean-sbinPROGRAMS \
|
||||
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
|
||||
dist-zstd distcheck distclean distclean-compile \
|
||||
distclean-generic distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck 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-sbinPROGRAMS install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
|
||||
uninstall-am uninstall-binPROGRAMS uninstall-sbinPROGRAMS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
test: helmetctl
|
||||
./helmetctl
|
||||
test: libxtools/cllexer_test
|
||||
cd libxtools && ./cllexer_test
|
||||
|
||||
#test: libxtools/clcomp_test
|
||||
# cd libxtools && ./clcomp_test
|
||||
|
||||
#test: libxtools/clconfig_test
|
||||
# cd libxtools && ./clconfig_test
|
||||
|
||||
clean-local:
|
||||
rm -f *~
|
||||
rm -f *~
|
||||
rm -f */*~
|
||||
rm -rf autom4te.cache
|
||||
|
||||
|
||||
43
libxasync/waitgroup.c.at123455
Normal file
43
libxasync/waitgroup.c.at123455
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
//#include <unistd.h>
|
||||
//#include <semaphore.h>
|
||||
//#include <pthread.h>
|
||||
//#include <stdatomic.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <waitgroup.h>
|
||||
|
||||
wg_t* new_gw(void) {
|
||||
wg_t* wg = malloc(sizeof(wg_t));
|
||||
wg->num = 0;
|
||||
sem_init(&(wg->sem), 1, 0);
|
||||
return wg;
|
||||
}
|
||||
|
||||
void wg_init(wg_t* wg) {
|
||||
wg->num = 0;
|
||||
sem_init(&(wg->sem), 1, 0);
|
||||
}
|
||||
|
||||
void wg_add(wg_t* wg) {
|
||||
wg->num++;
|
||||
}
|
||||
|
||||
void wg_done(wg_t* wg) {
|
||||
if ((--wg->num) == 0) sem_post(&(wg->sem));
|
||||
}
|
||||
|
||||
void wg_wait(wg_t* wg) {
|
||||
if ((wg->num) < 1) sem_post(&(wg->sem));
|
||||
sem_wait(&(wg->sem));
|
||||
}
|
||||
|
||||
void wg_destroy(wg_t* wg) {
|
||||
sem_destroy(&(wg->sem));
|
||||
}
|
||||
|
||||
void wg_free(wg_t* wg) {
|
||||
sem_destroy(&(wg->sem));
|
||||
free(wg);
|
||||
}
|
||||
55
libxtools/clcomp.c
Normal file
55
libxtools/clcomp.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cllexer.h>
|
||||
#include <clcomp.h>
|
||||
|
||||
void clcomp_init(clcomp_t* lexer, char** argv, int argc) {
|
||||
lexer->argv = argv;
|
||||
lexer->argc = argc;
|
||||
lexer->argn = 1;
|
||||
if (lexer->argc > lexer->argn) {
|
||||
cllexer_init(&(lexer->alex), lexer->argv[lexer->argn]);
|
||||
}
|
||||
}
|
||||
|
||||
int clcomp_gettok(clcomp_t* lexer, char* token) {
|
||||
|
||||
if (lexer->argn > lexer->argc) {
|
||||
strcpy(token, "EOF");
|
||||
return TOKEN_ENDF;
|
||||
}
|
||||
|
||||
int toktype = cllexer_gettok(&(lexer->alex), token);
|
||||
if (toktype == TOKEN_ENDF && lexer->argn != lexer->argc) {
|
||||
lexer->argn++;
|
||||
cllexer_init(&(lexer->alex), lexer->argv[lexer->argn]);
|
||||
strcpy(token, "space");
|
||||
return TOKEN_SPACE;
|
||||
}
|
||||
|
||||
return toktype;
|
||||
}
|
||||
|
||||
/*
|
||||
int clcomp_parse(clcomp_t* lexer, char* token) {
|
||||
|
||||
while (toktype != TOKEN_ENDF) {
|
||||
toktype = cllexer_gettok(&lex, token);
|
||||
printf("cllexer_gettok res: %d: %d [%s]\n", i, toktype, token);
|
||||
i++;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void clcomp_destroy(clcomp_t* clcomp) {
|
||||
(void)clcomp;
|
||||
}
|
||||
@@ -11,16 +11,17 @@
|
||||
//#include <stdbool.h>
|
||||
//#include <stdio.h>
|
||||
|
||||
#include <galexer.h>
|
||||
#include <cllexer.h>
|
||||
|
||||
typedef struct {
|
||||
char** argv;
|
||||
int argc;
|
||||
int argn;
|
||||
galexer_t alex;
|
||||
} gclexer_t;
|
||||
cllexer_t alex;
|
||||
} clcomp_t;
|
||||
|
||||
void gclexer_init(gclexer_t* lexer, char** argv, int argc);
|
||||
int gclexer_gettok(gclexer_t* lexer, char* token);
|
||||
void clcomp_init(clcomp_t* lexer, char** argv, int argc);
|
||||
int clcomp_gettok(clcomp_t* lexer, char* token);
|
||||
void clcomp_destroy(clcomp_t* clcomp);
|
||||
|
||||
#endif
|
||||
@@ -8,25 +8,25 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <galexer.h>
|
||||
#include <gclexer.h>
|
||||
#include <cllexer.h>
|
||||
#include <clcomp.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
char*_argv[] = { argv[0], "--qwerty=-num12345", "--foo=-bar" };
|
||||
char*_argv[] = { argv[0], "--qwerty=12345", "--foo=bar" };
|
||||
int _argc = 2;
|
||||
|
||||
gclexer_t lex;
|
||||
gclexer_init(&lex, _argv, _argc);
|
||||
clcomp_t lex;
|
||||
clcomp_init(&lex, _argv, _argc);
|
||||
|
||||
char token[1024];
|
||||
int toktype = TOKEN_NULL;
|
||||
int i = 0;
|
||||
while (toktype != TOKEN_ENDF) {
|
||||
toktype = gclexer_gettok(&lex, token);
|
||||
printf("%d: %d [%s]\n", i, toktype, token);
|
||||
toktype = clcomp_gettok(&lex, token);
|
||||
printf("clcomp_gettok res: %d: %d [%s]\n", i, toktype, token);
|
||||
i++;
|
||||
}
|
||||
|
||||
63
libxtools/clconfig.c
Normal file
63
libxtools/clconfig.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <cllexer.h>
|
||||
#include <clcomp.h>
|
||||
#include <vmapper.h>
|
||||
#include <clconfig.h>
|
||||
|
||||
void clconfig_init(clconfig_t* clconfig, int argc, char **argv) {
|
||||
clcomp_init(&(clconfig->lexer), argv, argc);
|
||||
vmapper_init(&(clconfig->mapper));
|
||||
}
|
||||
|
||||
int clconfig_bind(clconfig_t* clconfig, int type, char* name, void* ptr) {
|
||||
vmapper_t* vmapper = &(clconfig->mapper);
|
||||
return vmapper_bind(vmapper, type, name, ptr);
|
||||
}
|
||||
|
||||
int clconfig_parse(clconfig_t* clconfig) {
|
||||
|
||||
char token[1024];
|
||||
int toktype = TOKEN_NULL;
|
||||
int i = 0;
|
||||
while (toktype != TOKEN_ENDF) {
|
||||
toktype = clcomp_gettok(&(clconfig->lexer), token);
|
||||
printf("clconfig_parse %d: %d [%s]\n", i, toktype, token);
|
||||
i++;
|
||||
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void clconfig_destroy(clconfig_t* clconfig) {
|
||||
clcomp_destroy(&(clconfig->lexer));
|
||||
vmapper_destroy(&(clconfig->mapper));
|
||||
}
|
||||
|
||||
int __main(int argc, char **argv) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
char*_argv[] = { argv[0], "--qwerty=-num12345", "--foo=-bar" };
|
||||
int _argc = 2;
|
||||
|
||||
clcomp_t lex;
|
||||
clcomp_init(&lex, _argv, _argc);
|
||||
|
||||
char token[1024];
|
||||
int toktype = TOKEN_NULL;
|
||||
int i = 0;
|
||||
while (toktype != TOKEN_ENDF) {
|
||||
toktype = clcomp_gettok(&lex, token);
|
||||
printf("%d: %d [%s]\n", i, toktype, token);
|
||||
i++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
29
libxtools/clconfig.h
Normal file
29
libxtools/clconfig.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*/
|
||||
|
||||
#ifndef GCONFIG_H_QWERTY
|
||||
#define GCONFIG_H_QWERTY
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <clcomp.h>
|
||||
#include <vmapper.h>
|
||||
|
||||
typedef struct {
|
||||
clcomp_t lexer;
|
||||
vmapper_t mapper;
|
||||
int argc;
|
||||
char ** argv;
|
||||
} clconfig_t;
|
||||
|
||||
#define GCONF_STR MAPPER_STR
|
||||
#define GCONF_INT MAPPER_INT
|
||||
#define GCONF_BOOL MAPPER_BOOL
|
||||
|
||||
void clconfig_init(clconfig_t* clconfig, int argc, char **argv);
|
||||
int clconfig_bind(clconfig_t* clconfig, int type, char* name, void* ptr);
|
||||
int clconfig_parse(clconfig_t* clconfig);
|
||||
void clconfig_destroy(clconfig_t* clconfig);
|
||||
|
||||
#endif
|
||||
37
libxtools/clconfig_test.c
Normal file
37
libxtools/clconfig_test.c
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <clconfig.h>
|
||||
#include <massert.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
char*_argv[] = { argv[0], "--strkey=num5678", "--intkey=12345" };
|
||||
int _argc = 2;
|
||||
|
||||
clconfig_t clconfig;
|
||||
clconfig_init(&clconfig, _argc, _argv);
|
||||
|
||||
int intkey = 0;
|
||||
char* strkey = NULL;
|
||||
|
||||
clconfig_bind(&clconfig, GCONF_INT, "intkey", &intkey);
|
||||
clconfig_bind(&clconfig, GCONF_STR, "strkey", &strkey);
|
||||
|
||||
int res = clconfig_parse(&clconfig);
|
||||
MASSERT(res == 0);
|
||||
|
||||
clconfig_destroy(&clconfig);
|
||||
|
||||
printf("int key = %d\n", intkey);
|
||||
printf("str key = %s\n", strkey);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <galexer.h>
|
||||
#include <cllexer.h>
|
||||
|
||||
#define LTYPE_LETTER 1
|
||||
#define LTYPE_PREFIX 2
|
||||
@@ -34,7 +34,7 @@ static int get_ltype(char newletter) {
|
||||
return LTYPE_LETTER;
|
||||
}
|
||||
|
||||
void galexer_init(galexer_t* lexer, char* arg) {
|
||||
void cllexer_init(cllexer_t* lexer, char* arg) {
|
||||
lexer->arg = arg;
|
||||
lexer->rpos = 0;
|
||||
lexer->tpos = 0;
|
||||
@@ -42,14 +42,14 @@ void galexer_init(galexer_t* lexer, char* arg) {
|
||||
lexer->newletter = '\0';
|
||||
}
|
||||
|
||||
static void galexer_getletter(galexer_t* lexer, char* arg, int size) {
|
||||
static void cllexer_getletter(cllexer_t* lexer, char* arg, int size) {
|
||||
lexer->newletter = EOF;
|
||||
if (lexer->rpos < size) {
|
||||
lexer->newletter = arg[lexer->rpos++];
|
||||
}
|
||||
}
|
||||
|
||||
int galexer_gettok(galexer_t* lexer, char* token) {
|
||||
int cllexer_gettok(cllexer_t* lexer, char* token) {
|
||||
|
||||
char* arg = lexer->arg;
|
||||
size_t size = strlen(arg);
|
||||
@@ -155,7 +155,7 @@ int galexer_gettok(galexer_t* lexer, char* token) {
|
||||
}
|
||||
}
|
||||
token[lexer->tpos++] = lexer->newletter;
|
||||
galexer_getletter(lexer, arg, size);
|
||||
cllexer_getletter(lexer, arg, size);
|
||||
}
|
||||
|
||||
lexer->currcontext = LCONTEXT_ENDFL;
|
||||
@@ -22,9 +22,9 @@ typedef struct {
|
||||
int rpos;
|
||||
int tpos;
|
||||
char newletter;
|
||||
} galexer_t;
|
||||
} cllexer_t;
|
||||
|
||||
void galexer_init(galexer_t* lexer, char* arg);
|
||||
int galexer_gettok(galexer_t* lexer, char* token);
|
||||
void cllexer_init(cllexer_t* lexer, char* arg);
|
||||
int cllexer_gettok(cllexer_t* lexer, char* token);
|
||||
|
||||
#endif
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <galexer.h>
|
||||
#include <cllexer.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
(void)argc;
|
||||
@@ -16,15 +16,15 @@ int main(int argc, char **argv) {
|
||||
|
||||
char* arg = "--qwerty=-num-12345";
|
||||
|
||||
galexer_t lex;
|
||||
galexer_init(&lex, arg);
|
||||
cllexer_t lex;
|
||||
cllexer_init(&lex, arg);
|
||||
|
||||
char token[1024];
|
||||
int toktype = TOKEN_NULL;
|
||||
int i = 0;
|
||||
while (toktype != TOKEN_ENDF) {
|
||||
toktype = galexer_gettok(&lex, token);
|
||||
printf("%d: %d [%s]\n", i, toktype, token);
|
||||
toktype = cllexer_gettok(&lex, token);
|
||||
printf("cllexer_gettok res: %d: %d [%s]\n", i, toktype, token);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <galexer.h>
|
||||
#include <gclexer.h>
|
||||
|
||||
void gclexer_init(gclexer_t* lexer, char** argv, int argc) {
|
||||
lexer->argv = argv;
|
||||
lexer->argc = argc;
|
||||
lexer->argn = 1;
|
||||
if (lexer->argc > lexer->argn) {
|
||||
galexer_init(&(lexer->alex), lexer->argv[lexer->argn]);
|
||||
}
|
||||
}
|
||||
|
||||
int gclexer_gettok(gclexer_t* lexer, char* token) {
|
||||
|
||||
if (lexer->argn >= lexer->argc) {
|
||||
strcpy(token, "EOF");
|
||||
return TOKEN_ENDF;
|
||||
}
|
||||
|
||||
int toktype = galexer_gettok(&(lexer->alex), token);
|
||||
if (toktype == TOKEN_ENDF && lexer->argn != lexer->argc) {
|
||||
lexer->argn++;
|
||||
galexer_init(&(lexer->alex), lexer->argv[lexer->argn]);
|
||||
strcpy(token, "space");
|
||||
return TOKEN_SPACE;
|
||||
}
|
||||
return toktype;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <galexer.h>
|
||||
#include <gclexer.h>
|
||||
#include <vmapper.h>
|
||||
#include <gconfig.h>
|
||||
|
||||
void gconfig_init(gconfig_t* gconfig, int argc, char **argv) {
|
||||
gclexer_init(&(gconfig->lex), argv, argc);
|
||||
vmapper_init(&(gconfig->mapper));
|
||||
}
|
||||
|
||||
int gconfig_bind(gconfig_t* gconfig, int type, char* name, void* ptr) {
|
||||
vmapper_t* vmapper = &(gconfig->mapper);
|
||||
return vmapper_bind(vmapper, type, name, ptr);
|
||||
}
|
||||
|
||||
int gconfig_parse(gconfig_t* gconfig) {
|
||||
// return tccomp_parse(&(gconfig->comp));
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gconfig_destroy(gconfig_t* gconfig) {
|
||||
//gclexer_destroy(&(gconfig->lexer));
|
||||
vmapper_destroy(&(gconfig->mapper));
|
||||
}
|
||||
|
||||
int __main(int argc, char **argv) {
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
char*_argv[] = { argv[0], "--qwerty=-num12345", "--foo=-bar" };
|
||||
int _argc = 2;
|
||||
|
||||
gclexer_t lex;
|
||||
gclexer_init(&lex, _argv, _argc);
|
||||
|
||||
char token[1024];
|
||||
int toktype = TOKEN_NULL;
|
||||
int i = 0;
|
||||
while (toktype != TOKEN_ENDF) {
|
||||
toktype = gclexer_gettok(&lex, token);
|
||||
printf("%d: %d [%s]\n", i, toktype, token);
|
||||
i++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
||||
*/
|
||||
|
||||
#ifndef GCONFIG_H_QWERTY
|
||||
#define GCONFIG_H_QWERTY
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gclexer.h>
|
||||
|
||||
typedef struct {
|
||||
gclexer_t lex;
|
||||
vmapper_t mapper;
|
||||
} gconfig_t;
|
||||
|
||||
#define GCONF_STR MAPPER_STR
|
||||
#define GCONF_INT MAPPER_INT
|
||||
#define GCONF_BOOL MAPPER_BOOL
|
||||
|
||||
void gconfig_init(gconfig_t* gconfig, int argc, char **argv);
|
||||
int gconfig_bind(gconfig_t* gconfig, int type, char* name, void* ptr);
|
||||
int gconfig_parse(gconfig_t* gconfig);
|
||||
void gconfig_destroy(gconfig_t* gconfig);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user