]> git.stg.codes - stg.git/commitdiff
Merge branch 'master' into naffanya-dev
authorNaffanya <naffanya@naffanya.(none)>
Thu, 10 Apr 2014 00:39:50 +0000 (03:39 +0300)
committerNaffanya <naffanya@naffanya.(none)>
Thu, 10 Apr 2014 00:39:50 +0000 (03:39 +0300)
projects/rscriptd/build
projects/sgauth/build
projects/sgauthstress/build
projects/sgconf/build
projects/sgconf/main.cpp
projects/sgconf_xml/build
projects/sgconv/build
projects/stargazer/build

index c7aa090dc9d2bf79a1cd7591ff44813690f2e131..626819323b7b41ac21a1c075f08d050a4d7b9b86 100755 (executable)
@@ -20,6 +20,7 @@ if [ "$1" = "debug" ]
 then
    DEFS="$DEFS -DDEBUG"
    MAKEOPTS="$MAKEOPTS -j1"
+   CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
    CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
    DEBUG="yes"
 else
@@ -27,6 +28,7 @@ else
    DEBUG="no"
 fi
 
+CFLAGS="$CFLAGS -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
index 5ea022a2fc0ed8aa2dc3b083481b84e2c5674590..203e0c889c261162dabaf41fffd80d8aaec6e4e4 100755 (executable)
@@ -20,6 +20,7 @@ if [ "$1" = "debug" ]
 then
    DEFS="$DEFS -DDEBUG"
    MAKEOPTS="$MAKEOPTS -j1"
+   CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
    CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
    DEBUG="yes"
 else
@@ -27,8 +28,9 @@ else
    DEBUG="no"
 fi
 
+CFLAGS="$CFLAGS -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
-LDFLAGS="$CXXFLAGS -L/usr/local/lib"
+LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
 if [ "$sys" = "Linux" ]
 then
index 2b1456593dc88da9a43e861ce87358c9f8831e94..825f00b5cde4b0ef7f933f1205ecf9344e4e1a7b 100755 (executable)
@@ -25,6 +25,7 @@ else
     then
         DEFS="-DDEBUG"
         MAKEOPTS="-j1"
+        CFLAGS="$CFLAGS -ggdb3 -W -Wall"
         CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
         DEBUG="yes"
     else
@@ -33,8 +34,9 @@ else
     fi
 fi
 
+CFLAGS="$CFLAGS -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
-LDFLAGS="$CXXFLAGS -L/usr/local/lib"
+LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
 if [ "$sys" = "Linux" ]
 then
index d7b72363cdc6dc8f23f931c637195989d292b6dd..62fceb2314f19a2c42aab73acbcb778d45cbc429 100755 (executable)
@@ -20,6 +20,7 @@ if [ "$1" = "debug" ]
 then
    DEFS="$DEFS -DDEBUG"
    MAKEOPTS="$MAKEOPTS -j1"
+   CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
    CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
    DEBUG="yes"
 else
@@ -27,6 +28,7 @@ else
    DEBUG="no"
 fi
 
+CFLAGS="$CFLAGS -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
index 2d39cb2cde282e953229cf94e4b9a9a07b6d4b27..9025602e541288294bc25bf7d7880f2befb5f3b8 100644 (file)
@@ -209,6 +209,66 @@ class CONFIG_ACTION : public ACTION
         void ParseHostAndPort(const std::string & hostAndPort);
 };
 
+class COMMAND_FUNCTOR
+{
+    public:
+        virtual ~COMMAND_FUNCTOR() {}
+        virtual bool operator()(const std::string& arg, const std::map<std::string, std::string>& options) = 0;
+};
+
+class COMMAND_ACTION : public ACTION
+{
+    public:
+        COMMAND_ACTION(CONFIG & config,
+                       const std::string & paramDescription,
+                       bool needArgument,
+                       const OPTION_BLOCK& suboptions,
+                       COMMAND_FUNCTOR* funPtr)
+            : m_config(config),
+              m_description(paramDescription),
+              m_argument(needArgument),
+              m_suboptions(suboptions),
+              m_funPtr(funPtr)
+        {}
+
+        virtual ACTION * Clone() const { return new COMMAND_ACTION(*this); }
+
+        virtual std::string ParamDescription() const { return m_description; }
+        virtual std::string DefaultDescription() const { return ""; }
+        virtual OPTION_BLOCK & Suboptions() { return m_suboptions; }
+        virtual PARSER_STATE Parse(int argc, char ** argv)
+        {
+        PARSER_STATE state(false, argc, argv);
+        if (m_argument)
+            {
+            if (argc == 0 ||
+                argv == NULL ||
+                *argv == NULL)
+                throw ERROR("Missing argument.");
+            m_argument = *argv;
+            --state.argc;
+            ++state.argv;
+            }
+        std::list<OPTION_BLOCK>::iterator it(m_suboptions.begin());
+        while (!state.stop && it != m_suboptions.end())
+            {
+            state = it->Parse(state.argc, state.argv);
+            ++it;
+            }
+        m_funPtr(m_argument, m_params);
+        return state;
+        }
+
+    private:
+        CONFIG & m_config;
+        std::string m_description;
+        bool m_needArgument;
+        std::string m_argument;
+        OPTION_BLOCK m_suboptions;
+        std::map<std::string, std::string> m_params;
+        COMMAND_FUNCTOR* m_funPtr;
+};
+
 PARSER_STATE CONFIG_ACTION::Parse(int argc, char ** argv)
 {
 if (argc == 0 ||
index e9cfb40b478eaba32419daefc104d171a0187e9d..9314452b73a5afa31773152d1c7eab17dc7c6fbf 100755 (executable)
@@ -20,6 +20,7 @@ if [ "$1" = "debug" ]
 then
    DEFS="$DEFS -DDEBUG"
    MAKEOPTS="$MAKEOPTS -j1"
+   CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
    CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
    DEBUG="yes"
 else
@@ -27,6 +28,7 @@ else
    DEBUG="no"
 fi
 
+CFLAGS="$CFLAGS -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
index 7e430be2fe4f8438b3ad727862d1b8d5f2649628..580d515a8a9e51eb6764ff02a84214569a5de06f 100755 (executable)
@@ -21,6 +21,7 @@ if [ "$1" = "debug" ]
 then
    DEFS="$DEFS -DDEBUG"
    MAKEOPTS="$MAKEOPTS -j1"
+   CFLAGS="$CFLAGS -ggdb3 -W -Wall -Wextra"
    CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -Wextra"
    DEBUG="yes"
 else
@@ -28,6 +29,7 @@ else
    DEBUG="no"
 fi
 
+CFLAGS="$CFLAGS -ggdb3 -W -Wall -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"
 
index 2061d538b189e2f517b948fad8fda182025f680a..d8ed30924e14203389571f83e1dab77825602140 100755 (executable)
@@ -39,6 +39,7 @@ if [ "$1" = "debug" ]
 then
     DEFS="$DEFS -DDEBUG"
     MAKEOPTS="$MAKEOPTS -j1"
+    CFLAGS="$CFLAGS -ggdb3 -W -Wall"
     CXXFLAGS="$CXXFLAGS -ggdb3 -W -Wall"
     DEBUG="yes"
 else
@@ -46,6 +47,7 @@ else
     DEBUG="no"
 fi
 
+CFLAGS="$CFLAGS -I/usr/local/include"
 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
 LDFLAGS="$LDFLAGS -L/usr/local/lib"