diff options
author | Mu Qiao <qiaomuf@gentoo.org> | 2011-08-03 15:56:10 +0800 |
---|---|---|
committer | Mu Qiao <qiaomuf@gentoo.org> | 2011-08-03 16:58:17 +0800 |
commit | 248faf7d8ad085e237973aa4a4145793cfc3345e (patch) | |
tree | 7ba1a478541ef20e0972051c9dd4bfc470ed8a68 /src | |
parent | Parser: improve the rule for regular expression (diff) | |
download | libbash-248faf7d8ad085e237973aa4a4145793cfc3345e.tar.gz libbash-248faf7d8ad085e237973aa4a4145793cfc3345e.tar.bz2 libbash-248faf7d8ad085e237973aa4a4145793cfc3345e.zip |
Build: install public headers
We need to put all public headers into the include directory.
Diffstat (limited to 'src')
25 files changed, 16 insertions, 487 deletions
diff --git a/src/builtins/break_builtin.cpp b/src/builtins/break_builtin.cpp index 0ee20a7..b781e27 100644 --- a/src/builtins/break_builtin.cpp +++ b/src/builtins/break_builtin.cpp @@ -25,7 +25,7 @@ #include <boost/lexical_cast.hpp> #include "builtins/builtin_exceptions.h" -#include "core/interpreter_exception.h" +#include "exceptions.h" int break_builtin::exec(const std::vector<std::string>& bash_args) { diff --git a/src/builtins/builtin_exceptions.h b/src/builtins/builtin_exceptions.h index e1a443a..89a8cc8 100644 --- a/src/builtins/builtin_exceptions.h +++ b/src/builtins/builtin_exceptions.h @@ -26,7 +26,7 @@ #include <stdexcept> -#include "core/exceptions.h" +#include "exceptions.h" /// /// \class return_exception diff --git a/src/builtins/continue_builtin.cpp b/src/builtins/continue_builtin.cpp index 9bb9469..e27b031 100644 --- a/src/builtins/continue_builtin.cpp +++ b/src/builtins/continue_builtin.cpp @@ -25,7 +25,7 @@ #include <boost/lexical_cast.hpp> #include "builtins/builtin_exceptions.h" -#include "core/exceptions.h" +#include "exceptions.h" int continue_builtin::exec(const std::vector<std::string>& bash_args) { diff --git a/src/builtins/declare_builtin.cpp b/src/builtins/declare_builtin.cpp index 2644bb7..1c85d61 100644 --- a/src/builtins/declare_builtin.cpp +++ b/src/builtins/declare_builtin.cpp @@ -25,8 +25,8 @@ #include <algorithm> #include <iostream> -#include "core/exceptions.h" #include "core/interpreter.h" +#include "exceptions.h" int declare_builtin::exec(const std::vector<std::string>& bash_args) { diff --git a/src/builtins/shift_builtin.cpp b/src/builtins/shift_builtin.cpp index c78c6ae..e36a5e6 100644 --- a/src/builtins/shift_builtin.cpp +++ b/src/builtins/shift_builtin.cpp @@ -25,8 +25,8 @@ #include <boost/lexical_cast.hpp> #include "builtins/builtin_exceptions.h" -#include "core/exceptions.h" #include "core/interpreter.h" +#include "exceptions.h" int shift_builtin::exec(const std::vector<std::string>& bash_args) { diff --git a/src/builtins/shopt_builtin.cpp b/src/builtins/shopt_builtin.cpp index f55c49e..fd9e581 100644 --- a/src/builtins/shopt_builtin.cpp +++ b/src/builtins/shopt_builtin.cpp @@ -23,9 +23,9 @@ #include "builtins/shopt_builtin.h" -#include "core/exceptions.h" #include "core/interpreter.h" #include "cppbash_builtin.h" +#include "exceptions.h" void shopt_builtin::set_opt(const std::vector<std::string>& bash_args, bool value) { diff --git a/src/builtins/source_builtin.cpp b/src/builtins/source_builtin.cpp index d7924ab..91f3397 100644 --- a/src/builtins/source_builtin.cpp +++ b/src/builtins/source_builtin.cpp @@ -31,9 +31,9 @@ #include "builtins/builtin_exceptions.h" #include "cppbash_builtin.h" -#include "core/exceptions.h" #include "core/interpreter.h" #include "core/bash_ast.h" +#include "exceptions.h" namespace { std::mutex parse_mutex; diff --git a/src/builtins/tests/declare_tests.cpp b/src/builtins/tests/declare_tests.cpp index 95f4b61..686c816 100644 --- a/src/builtins/tests/declare_tests.cpp +++ b/src/builtins/tests/declare_tests.cpp @@ -27,9 +27,9 @@ #include <gtest/gtest.h> #include "core/bash_ast.h" -#include "core/exceptions.h" #include "core/interpreter.h" #include "cppbash_builtin.h" +#include "exceptions.h" using namespace std; diff --git a/src/builtins/tests/shift_tests.cpp b/src/builtins/tests/shift_tests.cpp index 8625a6c..05537a1 100644 --- a/src/builtins/tests/shift_tests.cpp +++ b/src/builtins/tests/shift_tests.cpp @@ -23,9 +23,9 @@ #include <boost/lexical_cast.hpp> #include <gtest/gtest.h> -#include "core/exceptions.h" #include "core/interpreter.h" #include "cppbash_builtin.h" +#include "exceptions.h" TEST(shift_builtin_test, bad_argument) { diff --git a/src/builtins/tests/shopt_tests.cpp b/src/builtins/tests/shopt_tests.cpp index 9fe4949..dc43dee 100644 --- a/src/builtins/tests/shopt_tests.cpp +++ b/src/builtins/tests/shopt_tests.cpp @@ -23,9 +23,9 @@ #include <gtest/gtest.h> #include "builtins/builtin_exceptions.h" -#include "core/exceptions.h" #include "core/interpreter.h" #include "cppbash_builtin.h" +#include "exceptions.h" namespace { diff --git a/src/common.h b/src/common.h deleted file mode 100644 index 7203f02..0000000 --- a/src/common.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file common.h -/// \brief common macros and includes -/// - -#ifndef LIBBASH_COMMON_H_ -#define LIBBASH_COMMON_H_ - -/// compiler hint for public symbols -#define LIBBASH_API __attribute__((visibility("default"))) -/// compiler hint for hidden symbols -#define LIBBASH_LOCAL __attribute__((visibility("hidden"))) - -#endif diff --git a/src/core/bash_ast.cpp b/src/core/bash_ast.cpp index ee4fe13..5cca4f4 100644 --- a/src/core/bash_ast.cpp +++ b/src/core/bash_ast.cpp @@ -30,8 +30,8 @@ #include <boost/algorithm/string/trim.hpp> #include <boost/numeric/conversion/cast.hpp> -#include "core/exceptions.h" #include "core/interpreter.h" +#include "exceptions.h" #include "libbashLexer.h" #include "libbashParser.h" #include "libbashWalker.h" diff --git a/src/core/bash_condition.cpp b/src/core/bash_condition.cpp index af57b90..be0aaa2 100644 --- a/src/core/bash_condition.cpp +++ b/src/core/bash_condition.cpp @@ -29,8 +29,8 @@ #include <unistd.h> #include "core/bash_ast.h" -#include "core/exceptions.h" #include "core/interpreter.h" +#include "exceptions.h" namespace { diff --git a/src/core/divide_by_zero_error.h b/src/core/divide_by_zero_error.h deleted file mode 100644 index 59e0fcb..0000000 --- a/src/core/divide_by_zero_error.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file divide_by_zero_error.h -/// \brief implementation for divide_by_zero_error -/// - -#ifndef LIBBASH_CORE_DIVIDE_BY_ZERO_ERROR_H_ -#define LIBBASH_CORE_DIVIDE_BY_ZERO_ERROR_H_ - -#include <stdexcept> -#include <string> - -#include "common.h" -#include "interpreter_exception.h" - -namespace libbash -{ - /// - /// \class divide_by_zero_error - /// \brief exception for dividing by zero error - /// - class LIBBASH_API divide_by_zero_error: public libbash::interpreter_exception - { - public: - /// \brief the constructor - /// \param err_msg the error message - explicit divide_by_zero_error(const std::string& err_msg): - libbash::interpreter_exception(err_msg){} - }; -} - -#endif diff --git a/src/core/exceptions.h b/src/core/exceptions.h deleted file mode 100644 index 519d16a..0000000 --- a/src/core/exceptions.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. - */ -/// -/// \file exceptions.h -/// \author Mu Qiao -/// \brief headers for all exceptions -/// -#ifndef LIBBASH_CORE_EXCEPTIOND_H_ -#define LIBBASH_CORE_EXCEPTIOND_H_ - -#include "core/divide_by_zero_error.h" -#include "core/illegal_argument_exception.h" -#include "core/interpreter_exception.h" -#include "core/parse_exception.h" -#include "core/readonly_exception.h" -#include "core/runtime_exception.h" -#include "core/unsupported_exception.h" - -#endif diff --git a/src/core/function.h b/src/core/function.h index 92ae97c..e4b8aa1 100644 --- a/src/core/function.h +++ b/src/core/function.h @@ -24,10 +24,10 @@ #ifndef LIBBASH_CORE_FUNCTION_H_ #define LIBBASH_CORE_FUNCTION_H_ -#include "core/exceptions.h" - #include <antlr3.h> +#include "exceptions.h" + class bash_ast; class interpreter; diff --git a/src/core/illegal_argument_exception.h b/src/core/illegal_argument_exception.h deleted file mode 100644 index 847b6a8..0000000 --- a/src/core/illegal_argument_exception.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file illegal_argument_exception.h -/// \brief implementation for illegal_argument_exception -/// - -#ifndef LIBBASH_CORE_ILLEGAL_ARGUMENT_EXCEPTION_H_ -#define LIBBASH_CORE_ILLEGAL_ARGUMENT_EXCEPTION_H_ - -#include <stdexcept> -#include <string> - -#include "common.h" -#include "interpreter_exception.h" - -namespace libbash -{ - /// - /// \class illegal_argument_exception - /// \brief exception for parsing errors - /// - class LIBBASH_API illegal_argument_exception: public libbash::interpreter_exception - { - public: - /// \brief the constructor - /// \param err_msg the error message - explicit illegal_argument_exception(const std::string& err_msg): - libbash::interpreter_exception(err_msg){} - }; -} - -#endif diff --git a/src/core/interpreter_exception.h b/src/core/interpreter_exception.h deleted file mode 100644 index 11f909f..0000000 --- a/src/core/interpreter_exception.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file interpreter_exception.h -/// \brief implementation for interpreter_exception -/// - -#ifndef LIBBASH_CORE_INTERPRETER_EXCEPTION_H_ -#define LIBBASH_CORE_INTERPRETER_EXCEPTION_H_ - -#include <stdexcept> -#include <string> - -#include "common.h" - -namespace libbash -{ - /// - /// \class interpreter_exception - /// \brief runtime exception occured during interpreting - /// - class LIBBASH_API interpreter_exception: public std::runtime_error - { - public: - /// \brief the constructor - /// \param err_msg the error message - explicit interpreter_exception(const std::string& err_msg): - runtime_error(err_msg){} - }; -} - -#endif diff --git a/src/core/parse_exception.h b/src/core/parse_exception.h deleted file mode 100644 index 6f19bff..0000000 --- a/src/core/parse_exception.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file parse_exception.h -/// \brief implementation for parse_exception -/// - -#ifndef LIBBASH_CORE_PARSE_EXCEPTION_H_ -#define LIBBASH_CORE_PARSE_EXCEPTION_H_ - -#include <stdexcept> -#include <string> - -#include "common.h" -#include "interpreter_exception.h" - -namespace libbash -{ - /// - /// \class parse_exception - /// \brief exception for parsing errors - /// - class LIBBASH_API parse_exception: public libbash::interpreter_exception - { - public: - /// \brief the constructor - /// \param err_msg the error message - explicit parse_exception(const std::string& err_msg): - libbash::interpreter_exception(err_msg){} - }; -} - -#endif diff --git a/src/core/readonly_exception.h b/src/core/readonly_exception.h deleted file mode 100644 index 16d1106..0000000 --- a/src/core/readonly_exception.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file readonly_exception.h -/// \brief implementation for readonly_exception -/// - -#ifndef LIBBASH_CORE_READONLY_EXCEPTION_H_ -#define LIBBASH_CORE_READONLY_EXCEPTION_H_ - -#include <stdexcept> -#include <string> - -#include "common.h" -#include "interpreter_exception.h" - -namespace libbash -{ - /// - /// \class readonly_exception - /// \brief exception for modifying readonly symbols - /// - class LIBBASH_API readonly_exception: public libbash::interpreter_exception - { - public: - /// \brief the constructor - /// \param err_msg the error message - explicit readonly_exception(const std::string& err_msg): - libbash::interpreter_exception(err_msg){} - }; -} - -#endif diff --git a/src/core/runtime_exception.h b/src/core/runtime_exception.h deleted file mode 100644 index ed87655..0000000 --- a/src/core/runtime_exception.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file runtime_exception.h -/// \brief implementation for runtime_exception -/// - -#ifndef LIBBASH_CORE_RUNTIME_EXCEPTION_H_ -#define LIBBASH_CORE_RUNTIME_EXCEPTION_H_ - -#include <stdexcept> -#include <string> - -#include "common.h" -#include "interpreter_exception.h" - -namespace libbash -{ - /// - /// \class runtime_exception - /// \brief exception for runtime errors - /// - class LIBBASH_API runtime_exception: public libbash::interpreter_exception - { - public: - /// \brief the constructor - /// \param err_msg the error message - explicit runtime_exception(const std::string& err_msg): - libbash::interpreter_exception(err_msg){} - }; -} - -#endif diff --git a/src/core/symbols.hpp b/src/core/symbols.hpp index 5114df1..15a3fa0 100644 --- a/src/core/symbols.hpp +++ b/src/core/symbols.hpp @@ -35,7 +35,7 @@ #include <boost/lexical_cast.hpp> #include <boost/numeric/conversion/cast.hpp> -#include "core/exceptions.h" +#include "exceptions.h" /// /// \class converter diff --git a/src/core/tests/bash_condition_test.cpp b/src/core/tests/bash_condition_test.cpp index 09f441a..d183e53 100644 --- a/src/core/tests/bash_condition_test.cpp +++ b/src/core/tests/bash_condition_test.cpp @@ -30,8 +30,8 @@ #include <gtest/gtest.h> #include "core/bash_condition.h" -#include "core/exceptions.h" #include "core/interpreter.h" +#include "exceptions.h" namespace { diff --git a/src/core/unsupported_exception.h b/src/core/unsupported_exception.h deleted file mode 100644 index 9920a5c..0000000 --- a/src/core/unsupported_exception.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file unsupported_exception.h -/// \brief implementation for unsupported_exception -/// - -#ifndef LIBBASH_CORE_UNSUPPORTED_EXCEPTION_H_ -#define LIBBASH_CORE_UNSUPPORTED_EXCEPTION_H_ - -#include <stdexcept> -#include <string> - -#include "common.h" -#include "interpreter_exception.h" - -namespace libbash -{ - /// - /// \class unsupported_exception - /// \brief exception for unsupported features - /// - class LIBBASH_API unsupported_exception: public libbash::interpreter_exception - { - public: - /// \brief the constructor - /// \param err_msg the error message - explicit unsupported_exception(const std::string& err_msg): - libbash::interpreter_exception(err_msg){} - }; -} - -#endif diff --git a/src/libbash.h b/src/libbash.h deleted file mode 100644 index f42d278..0000000 --- a/src/libbash.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Please use git log for copyright holder and year information - - This file is part of libbash. - - libbash 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 2 of the License, or - (at your option) any later version. - - libbash 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 libbash. If not, see <http://www.gnu.org/licenses/>. -*/ -/// -/// \file libbash.h -/// \brief public interface for libbash -/// - -#ifndef LIBBASH_LIBBASH_H_ -#define LIBBASH_LIBBASH_H_ - -#include <memory> -#include <string> -#include <unordered_map> -#include <vector> - -#include "common.h" -#include "core/exceptions.h" - -namespace libbash -{ - /// - /// \brief interpret a script specifid by path, return a map filled with - /// variables defined in the script - /// \param the path of target script - /// \param[in, out] we use the map to initialize bash environment and store the result - /// \param[out] store the names of the functions defined in the script - /// \return the return status of the script - int LIBBASH_API interpret(const std::string& target_path, - std::unordered_map<std::string, std::vector<std::string>>& variables, - std::vector<std::string>& functions); - - /// - /// \brief interpret a script specifid by path, return a map filled with - /// variables defined in the script - /// \param the path of target script - /// \param the path of a script that you want to source before interpreting - /// \param[in, out] we use the map to initialize bash environment and store the result. The environment will be initialized after preloading. - /// \param[out] store the names of the functions defined in the script - /// \return the return status of the script - int LIBBASH_API interpret(const std::string& target_path, - const std::string& preload_path, - std::unordered_map<std::string, std::vector<std::string>>& variables, - std::vector<std::string>& functions); -} - -#endif |