wrote some functions in SkvEnv using xli functions

This commit is contained in:
hyung-hwan 2018-07-13 11:13:30 +00:00
parent eb35325a96
commit 7a02450a5d
12 changed files with 1058 additions and 50 deletions

3
qse/configure vendored
View File

@ -23510,7 +23510,7 @@ QSE_PROJECT_AUTHOR="${PACKAGE_BUGREPORT}"
QSE_PROJECT_URL="${PACKAGE_URL}" QSE_PROJECT_URL="${PACKAGE_URL}"
ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/cry/Makefile include/qse/si/Makefile include/qse/awk/Makefile include/qse/sed/Makefile include/qse/xli/Makefile include/qse/http/Makefile include/qse/rad/Makefile include/qse/dhcp/Makefile lib/Makefile lib/cmn/Makefile lib/cry/Makefile lib/si/Makefile lib/awk/Makefile lib/sed/Makefile lib/xli/Makefile lib/http/Makefile lib/rad/Makefile lib/dhcp/Makefile lib/qsecmn.pc lib/qsecry.pc lib/qsesi.pc lib/qsesed.pc lib/qseawk.pc lib/qsexli.pc lib/qsehttp.pc lib/qserad.pc lib/qsedhcp.pc cmd/Makefile cmd/awk/Makefile cmd/sed/Makefile cmd/xli/Makefile cmd/http/Makefile samples/Makefile samples/cmn/Makefile samples/cry/Makefile samples/si/Makefile samples/awk/Makefile samples/sed/Makefile samples/http/Makefile samples/rad/Makefile samples/dhcp/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/Doxyfile tools/Makefile" ac_config_files="$ac_config_files Makefile README include/Makefile include/qse/Makefile include/qse/cmn/Makefile include/qse/cry/Makefile include/qse/si/Makefile include/qse/awk/Makefile include/qse/sed/Makefile include/qse/xli/Makefile include/qse/http/Makefile include/qse/rad/Makefile include/qse/dhcp/Makefile lib/Makefile lib/cmn/Makefile lib/cry/Makefile lib/si/Makefile lib/awk/Makefile lib/sed/Makefile lib/xli/Makefile lib/http/Makefile lib/rad/Makefile lib/dhcp/Makefile lib/qsecmn.pc lib/qsecry.pc lib/qsesi.pc lib/qsesed.pc lib/qseawk.pc lib/qsexli.pc lib/qsehttp.pc lib/qserad.pc lib/qsedhcp.pc cmd/Makefile cmd/awk/Makefile cmd/sed/Makefile cmd/xli/Makefile cmd/http/Makefile samples/Makefile samples/cmn/Makefile samples/cry/Makefile samples/si/Makefile samples/awk/Makefile samples/sed/Makefile samples/xli/Makefile samples/http/Makefile samples/rad/Makefile samples/dhcp/Makefile regress/Makefile regress/awk/Makefile regress/awk/regress.sh regress/sed/Makefile regress/sed/regress.sh doc/Makefile doc/Doxyfile tools/Makefile"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure # This file is a shell script that caches the results of configure
@ -24710,6 +24710,7 @@ do
"samples/si/Makefile") CONFIG_FILES="$CONFIG_FILES samples/si/Makefile" ;; "samples/si/Makefile") CONFIG_FILES="$CONFIG_FILES samples/si/Makefile" ;;
"samples/awk/Makefile") CONFIG_FILES="$CONFIG_FILES samples/awk/Makefile" ;; "samples/awk/Makefile") CONFIG_FILES="$CONFIG_FILES samples/awk/Makefile" ;;
"samples/sed/Makefile") CONFIG_FILES="$CONFIG_FILES samples/sed/Makefile" ;; "samples/sed/Makefile") CONFIG_FILES="$CONFIG_FILES samples/sed/Makefile" ;;
"samples/xli/Makefile") CONFIG_FILES="$CONFIG_FILES samples/xli/Makefile" ;;
"samples/http/Makefile") CONFIG_FILES="$CONFIG_FILES samples/http/Makefile" ;; "samples/http/Makefile") CONFIG_FILES="$CONFIG_FILES samples/http/Makefile" ;;
"samples/rad/Makefile") CONFIG_FILES="$CONFIG_FILES samples/rad/Makefile" ;; "samples/rad/Makefile") CONFIG_FILES="$CONFIG_FILES samples/rad/Makefile" ;;
"samples/dhcp/Makefile") CONFIG_FILES="$CONFIG_FILES samples/dhcp/Makefile" ;; "samples/dhcp/Makefile") CONFIG_FILES="$CONFIG_FILES samples/dhcp/Makefile" ;;

View File

@ -982,6 +982,7 @@ AC_CONFIG_FILES([
samples/si/Makefile samples/si/Makefile
samples/awk/Makefile samples/awk/Makefile
samples/sed/Makefile samples/sed/Makefile
samples/xli/Makefile
samples/http/Makefile samples/http/Makefile
samples/rad/Makefile samples/rad/Makefile
samples/dhcp/Makefile samples/dhcp/Makefile

View File

@ -27,20 +27,55 @@
#ifndef _QSE_LIB_XLI_SKVENV_CLASS_ #ifndef _QSE_LIB_XLI_SKVENV_CLASS_
#define _QSE_LIB_XLI_SKVENV_CLASS_ #define _QSE_LIB_XLI_SKVENV_CLASS_
#include <qse/cmn/LinkedList.hpp>
#include <qse/xli/xli.h>
QSE_BEGIN_NAMESPACE(QSE) QSE_BEGIN_NAMESPACE(QSE)
class SkvEnv class SkvEnv: public Uncopyable, public Mmged
{ {
public: public:
typedef int (SkvEnv::*ProbeProc) (const xp_char_t* val); enum
{
MAX_SCTN_LEN = 64,
MAX_KEY_LEN = 64,
// 64 for sctn, 64 for key, 1 for splitter
MAX_NAME_LEN = 129,
// the default value can't be longer than this
MAX_DVAL_LEN = 256
};
typedef int (SkvEnv::*ProbeProc) (const qse_char_t* val);
struct Item
{
qse_char_t sctn[MAX_SCTN_LEN + 1];
qse_char_t key [MAX_KEY_LEN + 1];
qse_char_t name[MAX_NAME_LEN + 1];
qse_char_t dval[MAX_DVAL_LEN + 1]; // default value
ProbeProc probe;
};
typedef QSE::LinkedList<Item> ItemList;
SkvEnv (Mmgr* mmgr = QSE_NULL);
~SkvEnv ();
int addItem (const qse_char_t* name, const qse_char_t* dval, ProbeProc probe); int addItem (const qse_char_t* name, const qse_char_t* dval, ProbeProc probe);
int removeItem (const qse_char_t* name); int removeItem (const qse_char_t* name);
const qse_char_t* setItemValue (const qse_char_t* name, const qse_char_t* val); const qse_char_t* getValue (const qse_char_t* name) const;
int setValue (const qse_char_t* name, const qse_char_t* value);
int load (const qse_char_t* file);
int store (const qse_char_t* file);
protected: protected:
ItemList item_list;
qse_xli_t* xli;
int split_name (const qse_char_t* name, qse_char_t** sctn, qse_size_t* sctn_len, qse_char_t** key, qse_size_t* key_len); int split_name (const qse_char_t* name, qse_char_t** sctn, qse_size_t* sctn_len, qse_char_t** key, qse_size_t* key_len);
int set_value_with_item (Item& item, const qse_char_t* value);
}; };
QSE_END_NAMESPACE(QSE) QSE_END_NAMESPACE(QSE)
#endif

View File

@ -16,8 +16,6 @@ libqsexli_la_LIBADD = -lqsesi -lqsecmn
if ENABLE_CXX if ENABLE_CXX
lib_LTLIBRARIES += libqsexlixx.la lib_LTLIBRARIES += libqsexlixx.la
libqsexlixx_la_SOURCES = SkvEnv.cpp libqsexlixx_la_SOURCES = SkvEnv.cpp
libqsexlixx_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) libqsexlixx_la_LIBADD = -lqsecmnxx -lqsexli -lqsesi -lqsecmn
libqsexlixx_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
libqsexlixx_la_LIBADD = -lqsexli -lqsecmnxx -lqsexli -lqsesi -lqsecmn $(LIBADD_LIB_COMMON)
endif endif

View File

@ -147,12 +147,8 @@ libqsexli_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(libqsexli_la_LDFLAGS) $(LDFLAGS) -o $@ $(libqsexli_la_LDFLAGS) $(LDFLAGS) -o $@
libqsexlixx_la_DEPENDENCIES = libqsexlixx_la_DEPENDENCIES =
am__libqsexlixx_la_SOURCES_DIST = SkvEnv.cpp am__libqsexlixx_la_SOURCES_DIST = SkvEnv.cpp
@ENABLE_CXX_TRUE@am_libqsexlixx_la_OBJECTS = libqsexlixx_la-SkvEnv.lo @ENABLE_CXX_TRUE@am_libqsexlixx_la_OBJECTS = SkvEnv.lo
libqsexlixx_la_OBJECTS = $(am_libqsexlixx_la_OBJECTS) libqsexlixx_la_OBJECTS = $(am_libqsexlixx_la_OBJECTS)
libqsexlixx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
$(AM_CXXFLAGS) $(CXXFLAGS) $(libqsexlixx_la_LDFLAGS) \
$(LDFLAGS) -o $@
@ENABLE_CXX_TRUE@am_libqsexlixx_la_rpath = -rpath $(libdir) @ENABLE_CXX_TRUE@am_libqsexlixx_la_rpath = -rpath $(libdir)
AM_V_P = $(am__v_P_@AM_V@) AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@ -414,9 +410,7 @@ libqsexli_la_SOURCES = xli.h xli.c err.c \
libqsexli_la_LDFLAGS = -L../cmn -L../si -version-info 1:0:0 -no-undefined libqsexli_la_LDFLAGS = -L../cmn -L../si -version-info 1:0:0 -no-undefined
libqsexli_la_LIBADD = -lqsesi -lqsecmn libqsexli_la_LIBADD = -lqsesi -lqsecmn
@ENABLE_CXX_TRUE@libqsexlixx_la_SOURCES = SkvEnv.cpp @ENABLE_CXX_TRUE@libqsexlixx_la_SOURCES = SkvEnv.cpp
@ENABLE_CXX_TRUE@libqsexlixx_la_CPPFLAGS = $(CPPFLAGS_LIB_COMMON) @ENABLE_CXX_TRUE@libqsexlixx_la_LIBADD = -lqsecmnxx -lqsexli -lqsesi -lqsecmn
@ENABLE_CXX_TRUE@libqsexlixx_la_LDFLAGS = $(LDFLAGS_LIB_COMMON)
@ENABLE_CXX_TRUE@libqsexlixx_la_LIBADD = -lqsexli -lqsecmnxx -lqsexli -lqsesi -lqsecmn $(LIBADD_LIB_COMMON)
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -490,7 +484,7 @@ libqsexli.la: $(libqsexli_la_OBJECTS) $(libqsexli_la_DEPENDENCIES) $(EXTRA_libqs
$(AM_V_CCLD)$(libqsexli_la_LINK) -rpath $(libdir) $(libqsexli_la_OBJECTS) $(libqsexli_la_LIBADD) $(LIBS) $(AM_V_CCLD)$(libqsexli_la_LINK) -rpath $(libdir) $(libqsexli_la_OBJECTS) $(libqsexli_la_LIBADD) $(LIBS)
libqsexlixx.la: $(libqsexlixx_la_OBJECTS) $(libqsexlixx_la_DEPENDENCIES) $(EXTRA_libqsexlixx_la_DEPENDENCIES) libqsexlixx.la: $(libqsexlixx_la_OBJECTS) $(libqsexlixx_la_DEPENDENCIES) $(EXTRA_libqsexlixx_la_DEPENDENCIES)
$(AM_V_CXXLD)$(libqsexlixx_la_LINK) $(am_libqsexlixx_la_rpath) $(libqsexlixx_la_OBJECTS) $(libqsexlixx_la_LIBADD) $(LIBS) $(AM_V_CXXLD)$(CXXLINK) $(am_libqsexlixx_la_rpath) $(libqsexlixx_la_OBJECTS) $(libqsexlixx_la_LIBADD) $(LIBS)
mostlyclean-compile: mostlyclean-compile:
-rm -f *.$(OBJEXT) -rm -f *.$(OBJEXT)
@ -498,8 +492,8 @@ mostlyclean-compile:
distclean-compile: distclean-compile:
-rm -f *.tab.c -rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SkvEnv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libqsexlixx_la-SkvEnv.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read-ini.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read-ini.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read-json.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read-json.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read.Plo@am__quote@
@ -551,13 +545,6 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
libqsexlixx_la-SkvEnv.lo: SkvEnv.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libqsexlixx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libqsexlixx_la-SkvEnv.lo -MD -MP -MF $(DEPDIR)/libqsexlixx_la-SkvEnv.Tpo -c -o libqsexlixx_la-SkvEnv.lo `test -f 'SkvEnv.cpp' || echo '$(srcdir)/'`SkvEnv.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libqsexlixx_la-SkvEnv.Tpo $(DEPDIR)/libqsexlixx_la-SkvEnv.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SkvEnv.cpp' object='libqsexlixx_la-SkvEnv.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libqsexlixx_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libqsexlixx_la-SkvEnv.lo `test -f 'SkvEnv.cpp' || echo '$(srcdir)/'`SkvEnv.cpp
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo

View File

@ -25,36 +25,126 @@
*/ */
#include <qsep/xli/SkvEnv.hpp>
#include <qse/xli/SkvEnv.hpp>
#include <qse/xli/stdxli.h>
#include <qse/cmn/str.h> #include <qse/cmn/str.h>
#include "../cmn/mem-prv.h"
#define SCTN_KEY_SPLITTER QSE_T('*') #define SCTN_KEY_SPLITTER QSE_T('*')
QSE_BEGIN_NAMESPACE(QSE) QSE_BEGIN_NAMESPACE(QSE)
const qse_char_t* SkvEnv::setItemValue (const qse_char_t* name, const qse_char_t* val) static qse_char_t splitter[2] = { SCTN_KEY_SPLITTER, QSE_T('\0') };
SkvEnv::SkvEnv (Mmgr* mmgr): Mmged(mmgr), xli(QSE_NULL)
{
}
SkvEnv::~SkvEnv ()
{
if (this->xli) qse_xli_close (this->xli);
}
int SkvEnv::addItem (const qse_char_t* name, const qse_char_t* dval, ProbeProc probe)
{
qse_char_t* sctn, * key;
qse_size_t sctn_len, key_len;
ItemList::Node* np;
if (this->split_name(name, &sctn, &sctn_len, &key, &key_len) == -1) return -1;
for (np = this->item_list.getHeadNode(); np; np = np->getNextNode())
{
Item& item = np->getValue();
if (qse_strxcmp(sctn, sctn_len, item.sctn) == 0 &&
qse_strxcmp(key, key_len, item.key) == 0) return -1;
}
try { np = this->item_list.append (Item()); }
catch (...) { return -1; }
Item& item = np->getValue();
qse_strxncpy (item.sctn, QSE_COUNTOF(item.sctn), sctn, sctn_len);
qse_strxncpy (item.key, QSE_COUNTOF(item.key), key, key_len);
qse_strxjoin (
item.name, QSE_COUNTOF(item.name),
item.sctn, splitter, item.key, QSE_NULL);
qse_strxcpy (item.dval, QSE_COUNTOF(item.dval), dval);
item.probe = probe;
// set its default value
if (this->setValue(name, item.dval) <= -1)
{
this->item_list.remove (np);
return -1;
}
return 0;
}
int SkvEnv::removeItem (const qse_char_t* name)
{ {
qse_char_t* sctn, * key; qse_char_t* sctn, * key;
qse_size_t sctn_len, key_len; qse_size_t sctn_len, key_len;
if (this->split_name(name, &sctn, &sctn_len, &key, &key_len) == -1) return QSE_NULL; if (this->split_name (name, &sctn, &sctn_len, &key, &key_len) == -1) return -1;
for (ItemList::Node* np = item_list.head(); np; np = np->forward()) for (ItemList::Node* np = item_list.getHeadNode(); np; np = np->getNextNode())
{ {
Item& item = np->value; Item& item = np->value;
if (qse_strxcmp(sctn, sctn_len, item.sctn) == 0 && if (qse_strxcmp(sctn, sctn_len, item.sctn) == 0 &&
qse_strxcmp(key, key_len, item.key) == 0) qse_strxcmp(key, key_len, item.key) == 0)
{ {
if ((this->*item.probe)(val) == -1) return QSE_NULL; this->item_list.remove (np);
this->setValue (item.sctn, item.key, val); return 0;
return val;
} }
} }
return QSE_NULL; return -1;
} }
const qse_char_t* SkvEnv::getValue (const qse_char_t* name) const
{
if (!this->xli) return QSE_NULL;
qse_xli_pair_t* pair = qse_xli_findpair(this->xli, QSE_NULL, name);
if (!pair) return QSE_NULL;
QSE_ASSERT (pair->val != QSE_NULL);
QSE_ASSERT (pair->val->type == QSE_XLI_STR);
return (((qse_xli_str_t*)pair->val))->ptr;
}
int SkvEnv::setValue (const qse_char_t* name, const qse_char_t* value)
{
qse_char_t* sctn, * key;
qse_size_t sctn_len, key_len;
if (this->split_name(name, &sctn, &sctn_len, &key, &key_len) <= -1) return -1;
if (!this->xli)
{
this->xli = qse_xli_openstdwithmmgr(this->getMmgr(), 0, 0, QSE_NULL);
if (!this->xli) return -1;
qse_xli_setopt (this->xli, QSE_XLI_KEYSPLITTER, splitter);
}
// find if the name is a registered item name.
for (ItemList::Node* np = this->item_list.getHeadNode(); np; np = np->getNextNode())
{
Item& item = np->value;
if (qse_strxcmp(sctn, sctn_len, item.sctn) == 0 &&
qse_strxcmp(key, key_len, item.key) == 0)
{
// if it's the registered item name, change the value.
return this->set_value_with_item (item, value);
}
}
return -1;
}
int SkvEnv::split_name (const qse_char_t* name, qse_char_t** sctn, qse_size_t* sctn_len, qse_char_t** key, qse_size_t* key_len) int SkvEnv::split_name (const qse_char_t* name, qse_char_t** sctn, qse_size_t* sctn_len, qse_char_t** key, qse_size_t* key_len)
{ {
@ -64,21 +154,106 @@ int SkvEnv::split_name (const qse_char_t* name, qse_char_t** sctn, qse_size_t* s
QSE_ASSERT (key != QSE_NULL); QSE_ASSERT (key != QSE_NULL);
QSE_ASSERT (key_len != QSE_NULL); QSE_ASSERT (key_len != QSE_NULL);
qse_char_t* s, * k, * p; qse_char_t* p;
qse_size_t sl, kl; qse_cstr_t s, k;
qse_char_t spr[] = { SCTN_KEY_SPLITTER, QSE_CHAR('\0') }; p = qse_strtok(name, splitter, &s);
p = qse_strtok(name, spr, &s, &sl); if (!p || s.len == 0) return -1;
if (!p || sl == 0) return -1; qse_strtok(p, QSE_NULL, &k);
qse_strtok(p, QSE_NULL, &k, &kl); if (k.len == 0) return -1;
if (kl == 0) return -1;
*sctn = s; *sctn = s.ptr;
*sctn_len = sl; *sctn_len = s.len;
*key = k; *key = k.ptr;
*key_len = kl; *key_len = k.len;
return 0; return 0;
} }
int SkvEnv::set_value_with_item (Item& item, const qse_char_t* value)
{
if (item.probe && (this->*item.probe)(value) <= -1) return -1;
qse_cstr_t v = { (qse_char_t*)value, qse_strlen(value) };
qse_xli_pair_t* pair;
pair = qse_xli_setpairwithstr(this->xli, QSE_NULL, item.name, &v, QSE_NULL);
if (!pair)
{
if (qse_xli_geterrnum(this->xli) != QSE_XLI_ENOENT) return -1;
pair = qse_xli_findpair(this->xli, QSE_NULL, item.sctn);
if (!pair)
{
pair = qse_xli_insertpairwithemptylist(this->xli, QSE_NULL, QSE_NULL, item.sctn, QSE_NULL, QSE_NULL);
if (!pair) return -1;
}
QSE_ASSERT (pair->val != QSE_NULL);
QSE_ASSERT (pair->val->type == QSE_XLI_LIST);
if (!qse_xli_insertpairwithstr(this->xli, (qse_xli_list_t*)pair->val, QSE_NULL, item.key, QSE_NULL, QSE_NULL, &v, QSE_NULL)) return -1;
}
return 0;
}
int SkvEnv::load (const qse_char_t* path)
{
qse_xli_t* xli;
if (!this->xli)
{
// this means that no items have been registered with
// this->addItem().
return -1;
}
xli = qse_xli_openstdwithmmgr (this->getMmgr(), 0, 0, QSE_NULL);
if (!xli) return -1;
qse_xli_setopt (xli, QSE_XLI_KEYSPLITTER, splitter);
qse_xli_iostd_t in;
QSE_MEMSET (&in, 0, QSE_SIZEOF(in));
in.type = QSE_XLI_IOSTD_FILE;
in.u.file.path = path;
if (qse_xli_readinistd(xli, &in) <= -1)
{
qse_xli_close (xli);
return -1;
}
for (ItemList::Node* np = this->item_list.getHeadNode(); np; np = np->getNextNode())
{
Item& item = np->value;
qse_xli_pair_t* pair;
pair = qse_xli_findpair(xli, QSE_NULL, item.name);
if (pair)
{
qse_xli_str_t* strv = (qse_xli_str_t*)pair->val;
this->set_value_with_item (item, strv->ptr);
// ignore failure.
}
}
qse_xli_close(xli);
return 0;
}
int SkvEnv::store (const qse_char_t* path)
{
if (!this->xli) return -1;
qse_xli_iostd_t out;
QSE_MEMSET (&out, 0, QSE_SIZEOF(out));
out.type = QSE_XLI_IOSTD_FILE;
out.u.file.path = path;
return qse_xli_writeinistd(this->xli, QSE_NULL, &out);
}
QSE_END_NAMESPACE(QSE) QSE_END_NAMESPACE(QSE)

View File

@ -1 +1 @@
SUBDIRS = cmn cry si awk sed http rad dhcp SUBDIRS = cmn cry si awk sed xli http rad dhcp

View File

@ -350,7 +350,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
SUBDIRS = cmn cry si awk sed http rad dhcp SUBDIRS = cmn cry si awk sed xli http rad dhcp
all: all-recursive all: all-recursive
.SUFFIXES: .SUFFIXES:

View File

@ -0,0 +1,28 @@
AiUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
bin_PROGRAMS = skvenv01
AM_LDFLAGS = -L../../lib/cmn -L../../lib/si -L../../lib/xli
LDADD = -lqsexli -lqsesi -lqsecmn
if WIN32
if WCHAR
LDADD += $(UNICOWS_LIBS)
endif
endif
if ENABLE_CXX
CXXLIB = -lqsexlixx -lqsecmnxx
skvenv01_SOURCES = skvenv01.cpp
skvenv01_LDADD = $(CXXLIB) $(LDADD)
endif

693
qse/samples/xli/Makefile.in Normal file
View File

@ -0,0 +1,693 @@
# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2014 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__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = skvenv01$(EXEEXT)
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
subdir = samples/xli
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_sign.m4 \
$(top_srcdir)/m4/ax_cxx_namespace.m4 \
$(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/ax_numval.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am__skvenv01_SOURCES_DIST = skvenv01.cpp
@ENABLE_CXX_TRUE@am_skvenv01_OBJECTS = skvenv01.$(OBJEXT)
skvenv01_OBJECTS = $(am_skvenv01_OBJECTS)
am__DEPENDENCIES_1 =
@WCHAR_TRUE@@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
@ENABLE_CXX_TRUE@skvenv01_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@ENABLE_CXX_TRUE@ $(am__DEPENDENCIES_3)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include/qse
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(skvenv01_SOURCES)
DIST_SOURCES = $(am__skvenv01_SOURCES_DIST)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHAR_MODE = @CHAR_MODE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DL_LIBS = @DL_LIBS@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTDL_LIBS = @LTDL_LIBS@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPICC = @MPICC@
MPI_CFLAGS = @MPI_CFLAGS@
MPI_CLDFLAGS = @MPI_CLDFLAGS@
MYSQL_CFLAGS = @MYSQL_CFLAGS@
MYSQL_CONFIG = @MYSQL_CONFIG@
MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
MYSQL_VERSION = @MYSQL_VERSION@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
PACKAGE_VERSION_PATCH = @PACKAGE_VERSION_PATCH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
QSE_PROJECT_URL = @QSE_PROJECT_URL@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_OFF64_T = @QSE_SIZEOF_OFF64_T@
QSE_SIZEOF_OFF_T = @QSE_SIZEOF_OFF_T@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
QUADMATH_LIBS = @QUADMATH_LIBS@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@
SED = @SED@
SENDFILE_LIBS = @SENDFILE_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKET_LIBS = @SOCKET_LIBS@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
TRUE = @TRUE@
UCI_LIBS = @UCI_LIBS@
UNICOWS_LIBS = @UNICOWS_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
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@
ax_pthread_config = @ax_pthread_config@
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_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AiUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
AM_LDFLAGS = -L../../lib/cmn -L../../lib/si -L../../lib/xli
LDADD = -lqsexli -lqsesi -lqsecmn $(am__append_1)
@ENABLE_CXX_TRUE@CXXLIB = -lqsexlixx -lqsecmnxx
@ENABLE_CXX_TRUE@skvenv01_SOURCES = skvenv01.cpp
@ENABLE_CXX_TRUE@skvenv01_LDADD = $(CXXLIB) $(LDADD)
all: all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign samples/xli/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign samples/xli/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
skvenv01$(EXEEXT): $(skvenv01_OBJECTS) $(skvenv01_DEPENDENCIES) $(EXTRA_skvenv01_DEPENDENCIES)
@rm -f skvenv01$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(skvenv01_OBJECTS) $(skvenv01_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skvenv01.Po@am__quote@
.cpp.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cpp.lo:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
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-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
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-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
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)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
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-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-binPROGRAMS \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,90 @@
/*
* $Id$
*
Copyright (c) 2006-2014 Chung, Hyung-Hwan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <qse/xli/SkvEnv.hpp>
#include <qse/si/sio.h>
#include <qse/cmn/main.h>
#include <qse/cmn/mbwc.h>
#include <qse/cmn/str.h>
#include <locale.h>
#if defined(_WIN32)
# include <windows.h>
#endif
class MyEnv: public QSE::SkvEnv
{
};
MyEnv myenv;
static int env_main (int argc, qse_char_t* argv[])
{
myenv.addItem (QSE_T("main*target"), QSE_T("file"), QSE_NULL);
myenv.addItem (QSE_T("main*targetq"), QSE_T("file"), QSE_NULL);
myenv.load (QSE_T("myenv.conf"));
//myenv.setValue(QSE_T("main*target"), QSE_T("qqqqqq"));
//myenv.setValue(QSE_T("main*target"), QSE_T("abcdefg"));
//myenv.setValue(QSE_T("main*targetq"), QSE_T("zozo"));
const qse_char_t* v = myenv.getValue(QSE_T("main*target"));
qse_printf (QSE_T("%s\n"), (v? v: QSE_T("<null>")));
myenv.store (QSE_T("myenv.conf"));
return 0;
}
int qse_main (int argc, qse_achar_t* argv[])
{
int x;
qse_open_stdsios ();
{
#if defined(_WIN32)
char locale[100];
UINT codepage = GetConsoleOutputCP();
if (codepage == CP_UTF8)
{
/*SetConsoleOUtputCP (CP_UTF8);*/
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
}
else
{
sprintf (locale, ".%u", (unsigned int)codepage);
setlocale (LC_ALL, locale);
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
}
#else
setlocale (LC_ALL, "");
/*qse_setdflcmgrbyid (QSE_CMGR_SLMB);*/
#endif
}
x = qse_runmain (argc,argv,env_main);
qse_close_stdsios ();
return x;
}