├── test
├── doFileTest.lua
├── .gitignore
├── main.cpp
└── Makefile
├── samples
├── abstraction
│ ├── error_message
│ │ ├── sample.lua
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ └── error_message.cpp
│ ├── class
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── global
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ └── global.cpp
│ ├── pusher
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ └── pusher.cpp
│ ├── state
│ │ ├── .gitignore
│ │ ├── sample.lua
│ │ └── Makefile
│ ├── table
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── function
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── optional
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── reference
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── inheritance
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── function_call
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── polymorphism
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── default_argument
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── ignored_argument
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ └── ignored_argument.cpp
│ ├── table_conversion
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── lua_function_argument
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── synthetic_inheritance
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── reference_wrapper_and_shared_ptr
│ │ ├── .gitignore
│ │ └── Makefile
│ └── Makefile
├── core
│ ├── embedded
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ └── embedded.cpp
│ ├── function_caller
│ │ ├── .gitignore
│ │ └── Makefile
│ ├── reference_wrapper
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ └── reference_wrapper.cpp
│ ├── Makefile
│ ├── hello
│ │ ├── hello.lua
│ │ ├── Makefile
│ │ └── hello.cpp
│ ├── regex
│ │ ├── SubMatch.cpp
│ │ ├── Makefile
│ │ ├── Match.cpp
│ │ ├── SubMatch.hpp
│ │ ├── regex.lua
│ │ └── Match.hpp
│ ├── optional
│ │ ├── optional.lua
│ │ ├── Makefile
│ │ └── library.cpp
│ ├── shared_ptr
│ │ ├── shared_ptr.lua
│ │ └── Makefile
│ ├── inheritance
│ │ ├── inheritance.lua
│ │ └── Makefile
│ ├── class
│ │ ├── Makefile
│ │ └── class.lua
│ ├── error_handling
│ │ ├── Makefile
│ │ └── error_handling.lua
│ ├── luafunction
│ │ ├── Makefile
│ │ └── luafunction.lua
│ ├── adaptors_functions
│ │ ├── Makefile
│ │ └── adaptors_functions.lua
│ ├── default_argument
│ │ ├── Makefile
│ │ └── default_argument.lua
│ ├── function_on_stack
│ │ ├── Makefile
│ │ └── function_on_stack.lua
│ ├── rtti_polymorphism
│ │ ├── Makefile
│ │ └── rtti_polymorphism.lua
│ ├── type_function
│ │ ├── Makefile
│ │ └── type_function.lua
│ ├── ignored_argument
│ │ ├── Makefile
│ │ ├── ignored_argument.lua
│ │ └── VectorOfDoubles.cpp
│ ├── luafunction_argument
│ │ ├── Makefile
│ │ ├── luafunction_argument.lua
│ │ └── algorithm.cpp
│ ├── showcase
│ │ ├── otherlib
│ │ │ ├── Makefile
│ │ │ └── otherlib.cpp
│ │ └── Makefile
│ ├── table_conversion
│ │ └── Makefile
│ └── synthetic_inheritance
│ │ ├── Makefile
│ │ └── synthetic_inheritance.lua
└── Makefile
├── .gitmodules
├── .gitignore
├── LICENSE
├── lib
└── integral
│ ├── Makefile
│ ├── ArgumentTag.hpp
│ ├── MultipleInheritancePack.hpp
│ ├── LuaFunctionArgument.cpp
│ ├── integral.hpp
│ ├── FunctionSignature.hpp
│ ├── IsStringLiteral.hpp
│ ├── basic.cpp
│ ├── Adaptor.hpp
│ ├── IsTemplateClass.hpp
│ ├── ConversionFunctionTraits.hpp
│ ├── State.hpp
│ ├── UserDataWrapperBase.hpp
│ ├── State.cpp
│ ├── UnexpectedStackException.cpp
│ ├── UserDataWrapperBase.cpp
│ ├── Getter.hpp
│ ├── Setter.hpp
│ ├── UserDataWrapper.hpp
│ ├── GlobalReference.hpp
│ ├── generic.hpp
│ ├── GlobalBase.hpp
│ ├── utility.hpp
│ ├── Global.hpp
│ ├── UnexpectedStackException.hpp
│ ├── Table.hpp
│ ├── DefaultArgument.hpp
│ ├── LuaIgnoredArgument.hpp
│ ├── ReferenceValue.hpp
│ ├── FunctorTraits.hpp
│ ├── DefaultArgumentManagerContainer.hpp
│ └── ClassMetatable.hpp
├── NOTES.md
├── Makefile
└── common.mk
/test/doFileTest.lua:
--------------------------------------------------------------------------------
1 | assert(42 == 42)
2 |
--------------------------------------------------------------------------------
/test/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | integral_test
3 |
--------------------------------------------------------------------------------
/samples/abstraction/error_message/sample.lua:
--------------------------------------------------------------------------------
1 | throwException()
2 |
--------------------------------------------------------------------------------
/samples/abstraction/class/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | class
3 |
--------------------------------------------------------------------------------
/samples/abstraction/global/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | global
3 |
--------------------------------------------------------------------------------
/samples/abstraction/pusher/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | pusher
3 |
--------------------------------------------------------------------------------
/samples/abstraction/state/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | state
3 |
--------------------------------------------------------------------------------
/samples/abstraction/table/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | table
3 |
--------------------------------------------------------------------------------
/samples/core/embedded/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | embedded
3 |
--------------------------------------------------------------------------------
/samples/abstraction/function/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | function
3 |
--------------------------------------------------------------------------------
/samples/abstraction/optional/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | optional
3 |
--------------------------------------------------------------------------------
/samples/abstraction/reference/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | reference
3 |
--------------------------------------------------------------------------------
/samples/abstraction/inheritance/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | inheritance
3 |
--------------------------------------------------------------------------------
/samples/abstraction/state/sample.lua:
--------------------------------------------------------------------------------
1 | print("hello from lua file sample code")
2 |
--------------------------------------------------------------------------------
/samples/core/function_caller/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | function_caller
3 |
--------------------------------------------------------------------------------
/samples/abstraction/error_message/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | error_message
3 |
--------------------------------------------------------------------------------
/samples/abstraction/function_call/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | function_call
3 |
--------------------------------------------------------------------------------
/samples/abstraction/polymorphism/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | polymorphism
3 |
--------------------------------------------------------------------------------
/samples/core/reference_wrapper/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | reference_wrapper
3 |
--------------------------------------------------------------------------------
/samples/abstraction/default_argument/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | default_argument
3 |
--------------------------------------------------------------------------------
/samples/abstraction/ignored_argument/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | ignored_argument
3 |
--------------------------------------------------------------------------------
/samples/abstraction/table_conversion/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | table_conversion
3 |
--------------------------------------------------------------------------------
/samples/abstraction/lua_function_argument/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | lua_function_argument
3 |
--------------------------------------------------------------------------------
/samples/abstraction/synthetic_inheritance/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | synthetic_inheritance
3 |
--------------------------------------------------------------------------------
/samples/abstraction/reference_wrapper_and_shared_ptr/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore executable
2 | reference_wrapper_and_shared_ptr
3 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "dependencies/exception"]
2 | path = dependencies/exception
3 | url = https://github.com/aphenriques/exception.git
4 | [submodule "dependencies/Catch2"]
5 | path = dependencies/Catch2
6 | url = https://github.com/catchorg/Catch2.git
7 |
--------------------------------------------------------------------------------
/samples/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: abstraction core all clean
2 |
3 | abstraction:
4 | cd abstraction && $(MAKE) all
5 |
6 | core:
7 | cd core && $(MAKE) all
8 |
9 | all: abstraction core
10 |
11 | clean:
12 | cd abstraction && $(MAKE) $@
13 | cd core && $(MAKE) $@
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Vim temporary files #
2 | #######################
3 | *~
4 | *.swp
5 | *.swo
6 |
7 | # Build files #
8 | #######################
9 | *.d
10 | *.o
11 | *.so
12 | *.dylib
13 | *.a
14 |
15 | # OS generated files #
16 | ######################
17 | .DS_Store
18 | .DS_Store?
19 | ._*
20 | .Spotlight-V100
21 | .Trashes
22 | ehthumbs.db
23 | Thumbs.db
24 |
25 | # utility files and folders #
26 | ######################
27 | xcode
28 |
--------------------------------------------------------------------------------
/samples/core/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | # http://stackoverflow.com/a/11206700
6 |
7 | SUBDIRS:=$(wildcard */.)
8 | TARGETS:=all clean # must not contain '/'
9 |
10 | SUBDIRS_TARGETS:=$(foreach t,$(TARGETS),$(addsuffix $t,$(SUBDIRS)))
11 |
12 | .PHONY: $(TARGETS) $(SUBDIRS_TARGETS) lib
13 |
14 | $(TARGETS): % : $(addsuffix %,$(SUBDIRS))
15 | @echo 'Done "$*" target'
16 |
17 | $(SUBDIRS_TARGETS):
18 | $(MAKE) -C $(@D) $(@F:.%=%)
19 |
20 | # lib as prerequisite so that make -j all won't invoke make lib in parallel in each subdir
21 | $(addsuffix all,$(SUBDIRS)): lib
22 |
23 | lib:
24 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
25 |
--------------------------------------------------------------------------------
/samples/abstraction/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | # http://stackoverflow.com/a/11206700
6 |
7 | SUBDIRS:=$(wildcard */.)
8 | TARGETS:=all clean # must not contain '/'
9 |
10 | SUBDIRS_TARGETS:=$(foreach t,$(TARGETS),$(addsuffix $t,$(SUBDIRS)))
11 |
12 | .PHONY: $(TARGETS) $(SUBDIRS_TARGETS) lib
13 |
14 | $(TARGETS): % : $(addsuffix %,$(SUBDIRS))
15 | @echo 'Done "$*" target'
16 |
17 | $(SUBDIRS_TARGETS):
18 | $(MAKE) -C $(@D) $(@F:.%=%)
19 |
20 | # lib as prerequisite so that make -j all won't invoke make lib in parallel in each subdir
21 | $(addsuffix all,$(SUBDIRS)): lib
22 |
23 | lib:
24 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
25 |
--------------------------------------------------------------------------------
/test/main.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // main.cpp
3 | // integral
4 | //
5 | // Copyright (C) 2016 André Pereira Henriques
6 | // aphenriques (at) outlook (dot) com
7 | //
8 | // This file is part of integral.
9 | //
10 | // integral is free software: you can redistribute it and/or modify
11 | // it under the terms of the GNU General Public License as published by
12 | // the Free Software Foundation, either version 3 of the License, or
13 | // (at your option) any later version.
14 | //
15 | // integral is distributed in the hope that it will be useful,
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | // GNU General Public License for more details.
19 | //
20 | // You should have received a copy of the GNU General Public License
21 | // along with integral. If not, see .
22 | //
23 |
24 | #define CATCH_CONFIG_MAIN
25 | #include
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2013-2023 André Pereira Henriques (aphenriques (at) outlook (dot) com)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/samples/core/hello/hello.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- hello.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2013, 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | require("libhello").printHello()
31 |
--------------------------------------------------------------------------------
/samples/core/regex/SubMatch.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // SubMatch.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include "SubMatch.hpp"
28 | #include "Match.hpp"
29 |
30 | SubMatch::SubMatch(const Match &match, unsigned index) : std::csub_match(match[index]), sharedData_(match.getSharedData()) {}
31 |
--------------------------------------------------------------------------------
/samples/core/optional/optional.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- library.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | library = require("liblibrary")
31 |
32 | print(library.getIdentity(42));
33 | print(library.getIdentity(nil));
34 |
--------------------------------------------------------------------------------
/samples/core/shared_ptr/shared_ptr.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- shared_ptr.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | Object = require("libObject")
31 |
32 | sharedObject = Object.getShared()
33 |
34 | sharedObject:print()
35 |
--------------------------------------------------------------------------------
/lib/integral/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | SRC_DIRS:=. $(wildcard */.)
6 | FILTER_OUT:=
7 | INCLUDE_DIRS:=
8 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
9 | LIB_DIRS:=
10 |
11 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
12 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
13 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
14 | ARFLAGS:=rcs
15 |
16 | ################################################################################
17 |
18 | STATIC_LIB:=$(INTEGRAL_STATIC_LIB)
19 | SHARED_LIB:=$(INTEGRAL_SHARED_LIB)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all static shared clean
27 |
28 | all: static shared
29 |
30 | static: $(STATIC_LIB)
31 |
32 | shared: $(SHARED_LIB)
33 |
34 | $(STATIC_LIB): $(OBJS)
35 | $(AR) $(ARFLAGS) $@ $(OBJS)
36 |
37 | $(SHARED_LIB): $(OBJS)
38 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
39 |
40 | clean:
41 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(STATIC_LIB) $(SHARED_LIB)
42 | # rm -f $(DEPS) $(OBJS) $(STATIC_LIB) $(SHARED_LIB)
43 |
44 | %.d: %.cpp
45 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
46 |
47 | ifneq ($(MAKECMDGOALS),clean)
48 | -include $(DEPS)
49 | endif
50 |
--------------------------------------------------------------------------------
/lib/integral/ArgumentTag.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // ArgumentTag.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_ArgumentTag_hpp
28 | #define integral_ArgumentTag_hpp
29 |
30 | #include
31 |
32 | namespace integral {
33 | namespace detail {
34 | template
35 | class ArgumentTag {};
36 | }
37 | }
38 |
39 | #endif
40 |
--------------------------------------------------------------------------------
/samples/core/inheritance/inheritance.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- inheritance.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | Derived = require("libDerived")
31 |
32 | derived = Derived.new()
33 | derived:base1Method()
34 | derived:base2Method()
35 | derived:baseOfBase1Method()
36 | derived:derivedMethod()
37 |
--------------------------------------------------------------------------------
/samples/core/class/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Object
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/hello/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=hello
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/regex/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Regex
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/optional/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=library
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/shared_ptr/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Object
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/lib/integral/MultipleInheritancePack.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // MultipleInheritancePack.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_MultipleInheritancePack_hpp
28 | #define integral_MultipleInheritancePack_hpp
29 |
30 | namespace integral {
31 | namespace detail {
32 | template
33 | class MultipleInheritancePack : public T... {};
34 | }
35 | }
36 |
37 | #endif
38 |
--------------------------------------------------------------------------------
/samples/abstraction/class/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=class
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/global/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=global
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/pusher/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=pusher
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/state/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=state
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/table/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=table
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/core/embedded/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=embedded
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/core/error_handling/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Object
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/inheritance/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Derived
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/luafunction/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Object
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/abstraction/function/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=function
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/optional/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=optional
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/core/adaptors_functions/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=library
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/default_argument/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Object
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/function_on_stack/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=library
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/rtti_polymorphism/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Derived
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/type_function/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=Container
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/abstraction/inheritance/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=inheritance
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/reference/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=reference
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/core/ignored_argument/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=VectorOfDoubles
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/luafunction_argument/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=algorithm
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/core/showcase/otherlib/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=otherlib
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/abstraction/error_message/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=error_message
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/function_call/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=function_call
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/polymorphism/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=polymorphism
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/core/function_caller/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=function_caller
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/core/reference_wrapper/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=reference_wrapper
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/core/table_conversion/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=table_conversion
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/abstraction/default_argument/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=default_argument
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/ignored_argument/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=ignored_argument
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/table_conversion/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=table_conversion
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/core/synthetic_inheritance/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=SyntheticallyDerived
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
30 | $(MAKE) $(SHARED_LIB)
31 |
32 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
33 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
34 |
35 | clean:
36 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
37 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
38 |
39 | %.d: %.cpp
40 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
41 |
42 | ifneq ($(MAKECMDGOALS),clean)
43 | -include $(DEPS)
44 | endif
45 |
--------------------------------------------------------------------------------
/samples/abstraction/lua_function_argument/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=lua_function_argument
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/synthetic_inheritance/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=synthetic_inheritance
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/samples/abstraction/reference_wrapper_and_shared_ptr/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=reference_wrapper_and_shared_ptr
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/test/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=integral_test
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_DEPENDENCIES_DIR)/Catch2/single_include
10 | LIB_DIRS:=$(LUA_LIB_DIR)
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB) $(LUA_LDLIB) -ldl
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_EXECUTABLE_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
20 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
21 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
22 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
23 |
24 | .PHONY: all run clean
25 |
26 | all:
27 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
28 | $(MAKE) $(TARGET)
29 |
30 | run: all
31 | ./$(TARGET)
32 |
33 | $(TARGET): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(TARGET)
38 | # rm -f $(DEPS) $(OBJS) $(TARGET)
39 |
40 | %.d: %.cpp
41 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
42 |
43 | ifneq ($(MAKECMDGOALS),clean)
44 | -include $(DEPS)
45 | endif
46 |
--------------------------------------------------------------------------------
/lib/integral/LuaFunctionArgument.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // LuaFunctionArgument.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2014, 2016, 2017, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include "LuaFunctionArgument.hpp"
28 | #include
29 | #include "lua_compatibility.hpp"
30 |
31 | namespace integral {
32 | namespace detail {
33 | LuaFunctionArgument::LuaFunctionArgument(lua_State *luaState, int index) : luaState_(luaState), luaAbsoluteStackIndex_(lua_compatibility::absindex(luaState, index)) {}
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/core/showcase/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=../../..
2 |
3 | include $(INTEGRAL_ROOT_DIR)/common.mk
4 |
5 | TARGET:=showcase
6 | SRC_DIRS:=. $(wildcard */.)
7 | FILTER_OUT:=
8 | INCLUDE_DIRS:=$(INTEGRAL_STATIC_LIB_INCLUDE_DIR)
9 | SYSTEM_INCLUDE_DIRS:=$(LUA_INCLUDE_DIR) $(INTEGRAL_EXCEPTION_INCLUDE_DIR)
10 | LIB_DIRS:=
11 | LDLIBS:=$(INTEGRAL_STATIC_LIB_LDLIB)
12 |
13 | # '-isystem ' supress warnings from included headers in . These headers are also excluded from dependency generation
14 | CXXFLAGS:=$(INTEGRAL_CXXFLAGS) $(addprefix -I, $(INCLUDE_DIRS)) $(addprefix -isystem , $(SYSTEM_INCLUDE_DIRS))
15 | LDFLAGS:=$(INTEGRAL_SHARED_LDFLAGS) $(addprefix -L, $(LIB_DIRS))
16 |
17 | ################################################################################
18 |
19 | SHARED_LIB:=lib$(TARGET).$(SHARED_LIB_EXTENSION)
20 |
21 | SRC_DIRS:=$(subst /.,,$(SRC_DIRS))
22 | SRCS:=$(filter-out $(FILTER_OUT), $(wildcard $(addsuffix /*.cpp, $(SRC_DIRS))))
23 | OBJS:=$(addsuffix .o, $(basename $(SRCS)))
24 | DEPS:=$(addsuffix .d, $(basename $(SRCS)))
25 |
26 | .PHONY: all clean
27 |
28 | all:
29 | cd otherlib && $(MAKE) all
30 | cd $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR) && $(MAKE) static
31 | $(MAKE) $(SHARED_LIB)
32 |
33 | $(SHARED_LIB): $(OBJS) $(INTEGRAL_ROOT_DIR)/$(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB)
34 | $(CXX) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
35 |
36 | clean:
37 | cd otherlib && $(MAKE) clean
38 | rm -f $(addsuffix /*.d, $(SRC_DIRS)) $(addsuffix /*.o, $(SRC_DIRS)) $(SHARED_LIB)
39 | # rm -f $(DEPS) $(OBJS) $(SHARED_LIB)
40 |
41 | %.d: %.cpp
42 | $(CXX) $(CXXFLAGS) -MP -MM -MF $@ -MT '$@ $(addsuffix .o, $(basename $<))' $<
43 |
44 | ifneq ($(MAKECMDGOALS),clean)
45 | -include $(DEPS)
46 | endif
47 |
--------------------------------------------------------------------------------
/samples/core/ignored_argument/ignored_argument.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- ignored_argument.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2015, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | VectorOfDoubles = require("libVectorOfDoubles")
31 |
32 | v = VectorOfDoubles.new()
33 | print("#v: " .. #v)
34 | print("v:pushBack(42)")
35 | v:pushBack(42)
36 | print("#v: " .. #v)
37 | print("v:pushBack(42)")
38 | v:pushBack(42)
39 | print("#v: " .. #v)
40 |
--------------------------------------------------------------------------------
/samples/core/luafunction_argument/luafunction_argument.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- luafunction_argument.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2017, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | local algorithm = require("libalgorithm")
31 | local vector = {1, 2, 3}
32 | local doubleVector = algorithm.getTransformed(vector, function(element) return 2*element end)
33 | for i, v in ipairs(doubleVector) do
34 | print("[" .. i .. "]", v)
35 | end
36 |
--------------------------------------------------------------------------------
/samples/core/rtti_polymorphism/rtti_polymorphism.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- rtti_polymorphism.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | Derived = require("libDerived")
31 |
32 | derived = Derived.new()
33 | derived:base1Method()
34 | derived:base2Method()
35 | derived:baseOfBase1Method()
36 | derived:derivedMethod()
37 | print("callAllTypes:")
38 | Derived.callAllTypes(derived, derived, derived, derived)
39 |
--------------------------------------------------------------------------------
/lib/integral/integral.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // integral.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_integral_hpp
28 | #define integral_integral_hpp
29 |
30 | #include "Adaptor.hpp"
31 | #include "ArgumentException.hpp"
32 | #include "ClassMetatable.hpp"
33 | #include "core.hpp"
34 | #include "DefaultArgument.hpp"
35 | #include "Global.hpp"
36 | #include "Pusher.hpp"
37 | #include "State.hpp"
38 | #include "StateView.hpp"
39 | #include "Table.hpp"
40 | #include "UnexpectedStackException.hpp"
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/lib/integral/FunctionSignature.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // FunctionSignature.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_FunctionSignature_hpp
28 | #define integral_FunctionSignature_hpp
29 |
30 | namespace integral {
31 | namespace detail {
32 | template
33 | class FunctionSignature;
34 |
35 | template
36 | class FunctionSignature {
37 | public:
38 | using Signature = R(A...);
39 | };
40 | }
41 | }
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/lib/integral/IsStringLiteral.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // IsStringLiteral.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_IsStringLiteral_hpp
28 | #define integral_IsStringLiteral_hpp
29 |
30 | #include
31 | #include
32 |
33 | namespace integral {
34 | namespace detail {
35 | template
36 | class IsStringLiteral : public std::false_type {};
37 |
38 | template
39 | class IsStringLiteral : public std::true_type {};
40 | }
41 | }
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/samples/core/adaptors_functions/adaptors_functions.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- adaptors_functions.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2015, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | local library = require("liblibrary")
31 |
32 | local constructObject = library.getObjectConstructor()
33 | local object = constructObject("name")
34 | print(object:getName())
35 |
36 | print("library.getInverse(2) = " .. library.getInverse(2))
37 |
38 | local getConstant = library.getConstantFunction(42)
39 | print("getConstant() = " .. getConstant())
40 |
--------------------------------------------------------------------------------
/lib/integral/basic.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // basic.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include "basic.hpp"
28 |
29 | namespace integral {
30 | namespace detail {
31 | namespace basic {
32 | void setLuaFunction(lua_State *luaState, const char *name, lua_CFunction function, int nUpValues) {
33 | lua_pushcclosure(luaState, function, nUpValues);
34 | lua_pushstring(luaState, name);
35 | lua_insert(luaState, -2);
36 | lua_rawset(luaState, -3);
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/integral/Adaptor.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Adaptor.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2014, 2016, 2017, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_Adaptor_hpp
28 | #define integral_Adaptor_hpp
29 |
30 | #include
31 |
32 | namespace integral {
33 | template
34 | class Adaptor : public T {
35 | public:
36 | template
37 | inline Adaptor(A &&...arguments);
38 | };
39 |
40 | //--
41 |
42 | template
43 | template
44 | inline Adaptor::Adaptor(A &&...arguments) : T(std::forward(arguments)...) {}
45 | }
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/lib/integral/IsTemplateClass.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // IsTemplateClass.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_IsTemplateClass_hpp
28 | #define integral_IsTemplateClass_hpp
29 |
30 | #include
31 |
32 | namespace integral {
33 | namespace detail {
34 | template class T, typename U>
35 | class IsTemplateClass : public std::false_type {};
36 |
37 | template class T, typename ...P>
38 | class IsTemplateClass> : public std::true_type {};
39 | }
40 | }
41 |
42 | #endif /* integral_IsTemplateClass_hpp */
43 |
--------------------------------------------------------------------------------
/lib/integral/ConversionFunctionTraits.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // ConversionFunctionTraits.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2016, 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_ConversionFunctionTraits_hpp
28 | #define integral_ConversionFunctionTraits_hpp
29 |
30 | namespace integral {
31 | namespace detail {
32 | template
33 | class ConversionFunctionTraits;
34 |
35 | template
36 | class ConversionFunctionTraits {
37 | public:
38 | using ConversionType = U;
39 | using OriginalType = T;
40 | };
41 | }
42 | }
43 |
44 | #endif
45 |
--------------------------------------------------------------------------------
/samples/core/class/class.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- class.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | Object = require("libObject")
31 |
32 | object = Object.new("string", 42)
33 | persistence = object:getPersistence()
34 | object:setStringAndNumber("new string", 421)
35 | print(object:toString())
36 | object:setStringAndNumberFromPersistence(persistence)
37 | print(object:toString())
38 | object:setNumber(84)
39 | print(object:getNumber())
40 | otherObject = Object.newFromPersistence(persistence)
41 | print(otherObject:toString())
42 |
--------------------------------------------------------------------------------
/samples/core/regex/Match.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Match.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include "Match.hpp"
28 |
29 | Match::Match(const char * string, const std::regex &pattern, Mode mode) : sharedData_(new std::string(string)) {
30 | std::cmatch match;
31 | switch (mode) {
32 | case Mode::EXACT:
33 | std::regex_match(sharedData_->c_str(), match, pattern);
34 | break;
35 | case Mode::PARTIAL:
36 | std::regex_search(sharedData_->c_str(), match, pattern);
37 | break;
38 | }
39 | std::cmatch::operator=(std::move(match));
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/samples/core/regex/SubMatch.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // SubMatch.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef SubMatch_hpp
28 | #define SubMatch_hpp
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | // Forward declaration
35 | class Match;
36 |
37 | class SubMatch : public std::csub_match {
38 | public:
39 | SubMatch(const Match &match, unsigned index);
40 |
41 | private:
42 | // the matching string data must be stored because std::csub_match and std::cmatch rely on it, and there is no guarantee that it would be kept in the lua stack
43 | const std::shared_ptr sharedData_;
44 | };
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/samples/core/synthetic_inheritance/synthetic_inheritance.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- synthetic_inheritance.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | SyntheticallyDerived = require("libSyntheticallyDerived")
31 |
32 | syntheticallyDerived = SyntheticallyDerived.new()
33 | print("-> syntheticallyDerived:baseOfSyntheticBaseMethod():")
34 | syntheticallyDerived:baseOfSyntheticBaseMethod()
35 | print("-> syntheticallyDerived:syntheticBaseMethod():")
36 | syntheticallyDerived:syntheticBaseMethod()
37 | print("-> syntheticallyDerived:syntheticallyDerivedMethod():")
38 | syntheticallyDerived:syntheticallyDerivedMethod()
39 |
--------------------------------------------------------------------------------
/lib/integral/State.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // State.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2016, 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_State_hpp
28 | #define integral_State_hpp
29 |
30 |
31 | #include
32 | #include "StateView.hpp"
33 |
34 | namespace integral {
35 | // State owns de luaState_ it creates
36 | class State : public StateView {
37 | public:
38 | // non-copyable
39 | State(const State &) = delete;
40 | State & operator=(const State &) = delete;
41 |
42 | // throws exception::RuntimeException if cannot create lua state
43 | State();
44 |
45 | // moveable
46 | State(State &&state);
47 |
48 | ~State();
49 | };
50 | }
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/lib/integral/UserDataWrapperBase.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // UserDataWrapperBase.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_UserDataWrapperBase_hpp
28 | #define integral_UserDataWrapperBase_hpp
29 |
30 | namespace integral {
31 | namespace detail {
32 | class UserDataWrapperBase {
33 | public:
34 | // non-copyable
35 | UserDataWrapperBase(const UserDataWrapperBase &) = delete;
36 | UserDataWrapperBase & operator=(const UserDataWrapperBase &) = delete;
37 |
38 | virtual ~UserDataWrapperBase();
39 |
40 | protected:
41 | UserDataWrapperBase() = default;
42 |
43 | };
44 | }
45 | }
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/samples/core/function_on_stack/function_on_stack.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- function_on_stack.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2015, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | local library = require("liblibrary")
31 |
32 | local getPrefixed = library.getPrefixFunction("prefix-")
33 | print(getPrefixed("word"))
34 |
35 | local getSuffixed1 = library.getSuffixFunction1("-suffix1")
36 | print(getSuffixed1("palavra"))
37 |
38 | -- getSuffixFunction2 does the same as getSuffixFunction
39 | local getSuffixed2 = library.getSuffixFunction2("-suffix2")
40 | print(getSuffixed2("palavra"))
41 |
42 | local object = library.newObject("object")
43 | print(object)
44 |
--------------------------------------------------------------------------------
/samples/core/type_function/type_function.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- type_function.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | Container = require("libContainer")
31 |
32 | container = Container.new(42.1)
33 | print("Container.getNumberFromId(container):", Container.getNumberFromId(container)) -- Container type conversion to Id
34 | print("container:getNumberFromId():", container:getNumberFromId()) -- alternative construct
35 | print("Container.getNegativeNumber(container):", Container.getNegativeNumber(container)) -- Container type conversion to double
36 | print("container:getNegativeNumber():", container:getNegativeNumber()) -- alternative construct
37 |
--------------------------------------------------------------------------------
/lib/integral/State.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // State.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2016, 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include "State.hpp"
28 | #include
29 | #include
30 | #include
31 |
32 | namespace integral {
33 | State::State() try : StateView(luaL_newstate()) {
34 | } catch (const StateException &stateException) {
35 | throw exception::RuntimeException(__FILE__, __LINE__, __func__, std::string("[integral] failed to create new lua state: { ") + stateException.what() + " }");
36 | }
37 |
38 | State::State(State &&state) : StateView(std::move(state)) {}
39 |
40 | State::~State() {
41 | if (getLuaState() != nullptr) {
42 | lua_close(getLuaState());
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/lib/integral/UnexpectedStackException.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // UnexpectedStackException.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2016, 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include "UnexpectedStackException.hpp"
28 |
29 | namespace integral {
30 | // If a class is defined in a header file and has a vtable (either it has virtual methods or it derives from classes with virtual methods), it must always have at least one out-of-line virtual method in the class. Without this, the compiler will copy the vtable and RTTI into every .o file that #includes the header, bloating .o file sizes and increasing link times.
31 | // source: http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers
32 | UnexpectedStackException::~UnexpectedStackException() {}
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/NOTES.md:
--------------------------------------------------------------------------------
1 | ## TODO
2 | * compile_flags
3 | * c++2b
4 | * updated exception
5 | * nested namespaces
6 | * SFINAE -> concepts
7 | * static_assert -> concepts
8 | * function traits -> standard library traits or concepts
9 | * update catch
10 | * intel compiler
11 | * coverity
12 | * compare performance with other binding libraries
13 | * frequent
14 | * check FIXME
15 | * run test
16 | * build all samples
17 | * check inlines
18 | * check includes (alphabetical order; necessity)
19 | * check memory leakage
20 | * check copyright notices
21 | * check compatibility with lua 5.1, 5.2 and 5.3 and luaJIT
22 | * update compatibility information on README.md and lua wiki
23 |
24 | ## Rationales
25 | * placement new is done on adjusted userdata allocated space to avoid constructor call on misaligned address
26 | * see basic::pushAlignedObject
27 | * removing occurrences of exchanger::Exchanger outside of exchanger.h is not possible because LuaFunctionArgument.h includes Caller.h which includes exchanger.h (cyclic dependency due to LuaFunctionArgument::call)
28 | * thought overload functions implementation methods result in high performance overhead and inconsistent behaviour with c++ overload mechanism
29 | * LuaPack (multiple return) adds complexity spread out through too much code (high maintence). Adaptors such as LuaTuple offers similar functionality
30 | * safety, robustness and clarity must be prioritized over performance:
31 | * shrinking integral reserved names string size decreases clarity (and it had little performance impact on preliminary tests)
32 | * usage
33 | * monitoring
34 | * configuration
35 | * adjustments
36 | * prototyping
37 |
38 | ## Problems
39 | * Xcode migh emmit a linker warning in the form:
40 | * "Direct access in function ..."
41 | * To fix this, on target (not project) settings set:
42 | * Inline Methods Hidden > No
43 | * error using -flto compiler flag: "ar: .o: plugin needed to handle lto object"
44 | * define:
45 | * AR=gcc-ar
46 |
--------------------------------------------------------------------------------
/lib/integral/UserDataWrapperBase.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // UserDataWrapperBase.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include "UserDataWrapperBase.hpp"
28 |
29 | namespace integral {
30 | namespace detail {
31 | // If a class is defined in a header file and has a vtable (either it has virtual methods or it derives from classes with virtual methods), it must always have at least one out-of-line virtual method in the class. Without this, the compiler will copy the vtable and RTTI into every .o file that #includes the header, bloating .o file sizes and increasing link times.
32 | // source: http://llvm.org/docs/CodingStandards.html#provide-a-virtual-method-anchor-for-classes-in-headers
33 | UserDataWrapperBase::~UserDataWrapperBase() {}
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/samples/core/luafunction/luafunction.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- luafunction.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | Object = require("libObject")
31 |
32 | o1 = Object.new("prefix")
33 | print(o1:getString())
34 | o2 = o1:createSuffixedObjectLuaFunction("_suffix")
35 | print(o2:getString())
36 | o2:addSuffixLuaFunction("_end")
37 | print(o2:getString())
38 |
39 | print("--")
40 | -- argument checking is performed by integral::get
41 | print("wrong parameters handling", pcall(function() Object.createSuffixedObjectLuaFunction("wrong parameters") end))
42 |
43 | print("--")
44 | Object.printUpvalue()
45 | printer = Object.getPrinter("object_printer")
46 | printer()
47 |
48 | print("--")
49 | Object.printMessage()
50 |
51 | print("--")
52 | Object.printStack();
53 |
--------------------------------------------------------------------------------
/lib/integral/Getter.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Getter.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2017, 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_Getter_hpp
28 | #define integral_Getter_hpp
29 |
30 | namespace integral {
31 | namespace detail {
32 | template
33 | class Getter {
34 | public:
35 | inline Getter(R T::* attribute);
36 |
37 | inline R operator()(const T &object) const;
38 |
39 | private:
40 | R T::* const attribute_;
41 | };
42 |
43 | //--
44 |
45 | template
46 | inline Getter::Getter(R T::* attribute) : attribute_(attribute) {}
47 |
48 | template
49 | inline R Getter::operator()(const T &object) const {
50 | return object.*attribute_;
51 | }
52 | }
53 | }
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/lib/integral/Setter.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Setter.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2017, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_Setter_hpp
28 | #define integral_Setter_hpp
29 |
30 | namespace integral {
31 | namespace detail {
32 | template
33 | class Setter {
34 | public:
35 | inline Setter(R T::* attribute);
36 |
37 | inline void operator()(T &object, const R &value) const;
38 |
39 | private:
40 | R T::* const attribute_;
41 | };
42 |
43 | //--
44 |
45 | template
46 | inline Setter::Setter(R T::* attribute) : attribute_(attribute) {}
47 |
48 | template
49 | inline void Setter::operator()(T &object, const R &value) const {
50 | object.*attribute_ = value;
51 | }
52 | }
53 | }
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/lib/integral/UserDataWrapper.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // UserDataWrapper.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_UserDataWrapper_hpp
28 | #define integral_UserDataWrapper_hpp
29 |
30 | #include
31 | #include "UserDataWrapperBase.hpp"
32 |
33 | namespace integral {
34 | namespace detail {
35 | template
36 | class UserDataWrapper : public UserDataWrapperBase, public T {
37 | public:
38 | template
39 | inline UserDataWrapper(A &&...arguments);
40 |
41 | inline ~UserDataWrapper() override;
42 | };
43 |
44 | //--
45 |
46 | template
47 | template
48 | inline UserDataWrapper::UserDataWrapper(A &&...arguments) : T(std::forward(arguments)...) {}
49 |
50 | template
51 | inline UserDataWrapper::~UserDataWrapper() {}
52 | }
53 | }
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/samples/abstraction/pusher/pusher.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // pusher.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | void pushModule(lua_State *luaState) {
33 | integral::push(luaState);
34 | integral::setFunction(
35 | luaState,
36 | "printHello",
37 | [] {
38 | std::cout << "Hello!" << std::endl;
39 | }
40 | );
41 | }
42 |
43 | int main() {
44 | try {
45 | integral::State luaState;
46 | luaState["module"] = integral::Pusher(pushModule);
47 | luaState.doString("module.printHello()");
48 | return EXIT_SUCCESS;
49 | } catch (const std::exception &exception) {
50 | std::cerr << "[pusher] " << exception.what() << std::endl;
51 | } catch (...) {
52 | std::cerr << "unknown exception thrown" << std::endl;
53 | }
54 | return EXIT_FAILURE;
55 | }
56 |
--------------------------------------------------------------------------------
/lib/integral/GlobalReference.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // GlobalReference.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2016, 2017, 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_GlobalReference_hpp
28 | #define integral_GlobalReference_hpp
29 |
30 | #include "GlobalBase.hpp"
31 |
32 | namespace integral::detail {
33 | class GlobalReference : public GlobalBase {
34 | public:
35 | GlobalReference(GlobalReference &&) = default;
36 |
37 | inline GlobalReference(lua_State *luaState);
38 |
39 | inline lua_State * getLuaState() const;
40 | inline void push() const;
41 |
42 | private:
43 | lua_State *luaState_;
44 | };
45 |
46 | //--
47 |
48 | inline GlobalReference::GlobalReference(lua_State *luaState) : luaState_(luaState) {}
49 |
50 | inline lua_State * GlobalReference::getLuaState() const {
51 | return luaState_;
52 | }
53 |
54 | inline void GlobalReference::push() const {
55 | GlobalBase::push(getLuaState());
56 | }
57 | }
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/samples/core/optional/library.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // library.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include
28 | #include
29 | #include
30 | #include
31 |
32 | extern "C" {
33 | LUALIB_API int luaopen_liblibrary(lua_State *luaState) {
34 | try {
35 | integral::push(luaState);
36 | integral::setFunction(luaState, "getIdentity", [](std::optional x) {
37 | return x;
38 | });
39 | return 1;
40 | } catch (const std::exception &exception) {
41 | lua_pushstring(luaState, (std::string("[optional sample setup] ") + exception.what()).c_str());
42 | } catch (...) {
43 | lua_pushstring(luaState, "[shared_ptr sample setup] unknown exception thrown");
44 | }
45 | // Error return outside catch scope so that the exception destructor can be called
46 | return lua_error(luaState);
47 | }
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/samples/core/hello/hello.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // hello.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2017, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | void printHello() {
32 | std::cout << "Hello!" << std::endl;
33 | }
34 |
35 | extern "C" {
36 | LUALIB_API int luaopen_libhello(lua_State *luaState) {
37 | try {
38 | lua_newtable(luaState);
39 | // module table
40 |
41 | integral::setFunction(luaState, "printHello", printHello);
42 |
43 | return 1;
44 | } catch (const std::exception &exception) {
45 | lua_pushstring(luaState, (std::string("[hello sample setup] ") + exception.what()).c_str());
46 | } catch (...) {
47 | lua_pushstring(luaState, "[hello sample setup] unknown exception thrown");
48 | }
49 | // Error return outside catch scope so that the exception destructor can be called
50 | return lua_error(luaState);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/lib/integral/generic.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // generic.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2014, 2016, 2017, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_generic_hpp
28 | #define integral_generic_hpp
29 |
30 | #include
31 |
32 | namespace integral {
33 | namespace detail {
34 | namespace generic {
35 | template
36 | inline void expandDummyTemplatePack(T...);
37 |
38 | constexpr bool getLogicalOr();
39 |
40 | template
41 | constexpr bool getLogicalOr(bool i, B... j);
42 |
43 | //--
44 |
45 | template
46 | inline void expandDummyTemplatePack(T...) {}
47 |
48 |
49 | constexpr bool getLogicalOr() {
50 | return false;
51 | }
52 |
53 | template
54 | constexpr bool getLogicalOr(bool i, B... j) {
55 | return i | getLogicalOr(j...);
56 | }
57 | }
58 | }
59 | }
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/samples/core/default_argument/default_argument.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- default_argument.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | Object = require("libObject")
31 |
32 | object = Object.new()
33 | print("object = Object.new() -- default constructor")
34 | print("object:getString():")
35 | print(object:getString())
36 | print("--")
37 | object = Object.new("object_string")
38 | print([[object = Object.new("object_string")]])
39 | print("object:getString():")
40 | print(object:getString())
41 | print("--")
42 | print("Object.testDefault(nil, nil):")
43 | Object.testDefault(nil, nil)
44 | print("object:testDefault():")
45 | object:testDefault()
46 | print("object:testDefault(4):")
47 | object:testDefault(4)
48 | print("Object.testDefault(nil, 2):")
49 | Object.testDefault(nil, 2)
50 | print("--")
51 | print("Object.testDefault2(nil, \"testDefault2 string argument\"):")
52 | Object.testDefault2(nil, "testDefault2 string argument")
53 |
--------------------------------------------------------------------------------
/lib/integral/GlobalBase.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // GlobalBase.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_GlobalBase_hpp
28 | #define integral_GlobalBase_hpp
29 |
30 | #include
31 | #include
32 | #include "lua_compatibility.hpp"
33 |
34 | namespace integral {
35 | class GlobalBase {
36 | public:
37 | // non-copyable
38 | GlobalBase(const GlobalBase &) = delete;
39 | GlobalBase & operator=(const GlobalBase &) = delete;
40 |
41 | GlobalBase(GlobalBase &&) = default;
42 | GlobalBase() = default;
43 |
44 | inline std::string getReferenceString() const;
45 |
46 | protected:
47 | inline void push(lua_State *luaState) const;
48 | };
49 |
50 | //--
51 |
52 | inline std::string GlobalBase::getReferenceString() const {
53 | return "_G";
54 | }
55 |
56 | inline void GlobalBase::push(lua_State *luaState) const {
57 | detail::lua_compatibility::pushglobaltable(luaState);
58 | }
59 | }
60 |
61 | #endif
62 |
63 |
--------------------------------------------------------------------------------
/samples/core/regex/regex.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- regex.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2013, 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | local Regex = require("libRegex")
31 |
32 | local pattern = Regex.new([[(.)\.(.)]]) -- literal string to avoid dealing with escape characters
33 | local matches = pattern:match("4.2")
34 | print("matches:", matches)
35 | if matches then
36 | print("matches:getSize():", matches:getSize())
37 | for i = 0, matches:getSize() - 1 do
38 | print("matches("..i.."):", matches(i))
39 | end
40 | end
41 |
42 | print("---")
43 |
44 | pattern = Regex.new("(.)")
45 | matches = pattern:search("42")
46 | print("matches:", matches)
47 | -- maybe matches == nil. c++ std::regex implementation may be incomplete
48 | if matches then
49 | print("matches:getSize():", matches:getSize())
50 | for i = 0, matches:getSize() - 1 do
51 | print("matches("..i.."):", matches(i))
52 | end
53 | end
54 |
55 | print("---")
56 |
57 | -- should be nil
58 | print("matches:", pattern:match("42"))
59 |
--------------------------------------------------------------------------------
/samples/abstraction/global/global.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // global.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | int main() {
32 | try {
33 | integral::State luaState;
34 | luaState.openLibs();
35 | luaState["x"] = 42;
36 | luaState["y"] = integral::Global()["x"]; // equivalent to "y = x" in lua
37 | luaState.doString("print(y)"); // prints "42"
38 | luaState["global"] = integral::Global(); // equivalent to "global = _G" in lua
39 | luaState.doString("print(global.y)"); // prints "42"
40 | luaState["t"] = integral::Table().set("x", integral::Global()["global"]["y"]); // equivalent to "t = {x = global.y}" in lua
41 | luaState.doString("print(t.x)"); // prints "42"
42 | return EXIT_SUCCESS;
43 | } catch (const std::exception &exception) {
44 | std::cerr << "[global] " << exception.what() << std::endl;
45 | } catch (...) {
46 | std::cerr << "unknown exception thrown" << std::endl;
47 | }
48 | return EXIT_FAILURE;
49 | }
50 |
--------------------------------------------------------------------------------
/samples/core/regex/Match.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Match.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef Match_hpp
28 | #define Match_hpp
29 |
30 | #include
31 | #include
32 | #include
33 | #include "SubMatch.hpp"
34 |
35 | class Match : public std::cmatch {
36 | public:
37 | enum class Mode {
38 | EXACT,
39 | PARTIAL
40 | };
41 |
42 | Match(const char * string, const std::regex &pattern, Mode mode);
43 | inline SubMatch getSubMatch(unsigned index) const;
44 | inline const std::shared_ptr & getSharedData() const;
45 |
46 | private:
47 | // the matching string data must be stored because std::csub_match and std::cmatch rely on it, and there is no guarantee that lua would not collect it
48 | const std::shared_ptr sharedData_;
49 | };
50 |
51 | //-
52 |
53 | inline SubMatch Match::getSubMatch(unsigned index) const {
54 | return SubMatch(*this, index);
55 | }
56 |
57 | inline const std::shared_ptr & Match::getSharedData() const {
58 | return sharedData_;
59 | }
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | INTEGRAL_ROOT_DIR:=.
2 |
3 | include common.mk
4 |
5 | INSTALL_TOP:=/usr/local
6 | INSTALL_INC:=$(INSTALL_TOP)/include/$(INTEGRAL)
7 | INSTALL_LIB:=$(INSTALL_TOP)/lib
8 |
9 | .PHONY: all static static_release shared shared_release samples test install_exception uninstall_exception install_static install uninstall clean
10 |
11 | # Any of the following make rules can be executed with the `-j` option (`make -j`) for parallel compilation
12 |
13 | all:
14 | cd $(INTEGRAL_LIB_DIR) && $(MAKE) $@
15 |
16 | static:
17 | cd $(INTEGRAL_LIB_DIR) && $(MAKE) $@
18 |
19 | # attention! the object files (.o) are generated without -fPIC, so it is necessary to clean the project in order to build shared targets (and most sample/core targets) which require -fPIC
20 | static_release: clean
21 | cd $(INTEGRAL_LIB_DIR) && $(MAKE) static OPTIMIZED=y WITH_FPIC=n
22 |
23 | shared:
24 | cd $(INTEGRAL_LIB_DIR) && $(MAKE) $@
25 |
26 | shared_release:
27 | cd $(INTEGRAL_LIB_DIR) && $(MAKE) shared OPTIMIZED=y
28 |
29 | samples: static
30 | cd $(INTEGRAL_BIN_DIR) && $(MAKE) all
31 |
32 | test: static
33 | cd $(INTEGRAL_TEST_DIR) && $(MAKE) run
34 |
35 | install_exception:
36 | cd $(INTEGRAL_DEPENDENCIES_DIR)/exception && $(MAKE) install
37 |
38 | uninstall_exception:
39 | cd $(INTEGRAL_DEPENDENCIES_DIR)/exception && $(MAKE) uninstall
40 |
41 | install_static: install_exception
42 | mkdir -p $(INSTALL_INC) $(INSTALL_LIB)
43 | install -p -m 0644 $(INTEGRAL_LIB_DIR)/*.hpp $(INSTALL_INC)
44 | install -p -m 0644 $(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB) $(INSTALL_LIB)
45 |
46 | install_shared: install_exception
47 | mkdir -p $(INSTALL_INC) $(INSTALL_LIB)
48 | install -p -m 0644 $(INTEGRAL_LIB_DIR)/*.hpp $(INSTALL_INC)
49 | install -p -m 0644 $(INTEGRAL_LIB_DIR)/$(INTEGRAL_SHARED_LIB) $(INSTALL_LIB)
50 |
51 | install: install_exception
52 | mkdir -p $(INSTALL_INC) $(INSTALL_LIB)
53 | install -p -m 0644 $(INTEGRAL_LIB_DIR)/*.hpp $(INSTALL_INC)
54 | install -p -m 0644 $(INTEGRAL_LIB_DIR)/$(INTEGRAL_STATIC_LIB) $(INTEGRAL_LIB_DIR)/$(INTEGRAL_SHARED_LIB) $(INSTALL_LIB)
55 |
56 | uninstall: uninstall_exception
57 | $(RM) -R $(INSTALL_INC)
58 | $(RM) $(INSTALL_LIB)/$(INTEGRAL_STATIC_LIB) $(INSTALL_LIB)/$(INTEGRAL_SHARED_LIB)
59 |
60 | clean:
61 | cd $(INTEGRAL_LIB_DIR) && $(MAKE) $@
62 | cd $(INTEGRAL_BIN_DIR) && $(MAKE) $@
63 | cd $(INTEGRAL_TEST_DIR) && $(MAKE) $@
64 |
--------------------------------------------------------------------------------
/lib/integral/utility.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // utility.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_utility_hpp
28 | #define integral_utility_hpp
29 |
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 |
38 | namespace integral {
39 | namespace utility {
40 | std::string getStackString(lua_State *luaState);
41 |
42 | int printStack(lua_State *luaState);
43 |
44 | // stack argument: table
45 | void setHelp(lua_State *luaState, const char *field, const char *fieldDescription);
46 |
47 | // stack argument: table | ?
48 | void setWithHelp(lua_State *luaState, const char *field, const char *fieldDescription);
49 |
50 | void pushNameAndValueList(lua_State *luaState, std::initializer_list> nameAndValueList);
51 |
52 | // stack argument: table
53 | void setNameAndValueListWithHelp(lua_State *luaState, const char *field, std::initializer_list> nameAndValueList);
54 | }
55 | }
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/samples/core/error_handling/error_handling.lua:
--------------------------------------------------------------------------------
1 | --
2 | -- error_handling.lua
3 | -- integral
4 | --
5 | -- MIT License
6 | --
7 | -- Copyright (c) 2014, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | --
9 | -- Permission is hereby granted, free of charge, to any person obtaining a copy
10 | -- of this software and associated documentation files (the "Software"), to deal
11 | -- in the Software without restriction, including without limitation the rights
12 | -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | -- copies of the Software, and to permit persons to whom the Software is
14 | -- furnished to do so, subject to the following conditions:
15 | --
16 | -- The above copyright notice and this permission notice shall be included in all
17 | -- copies or substantial portions of the Software.
18 | --
19 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | -- SOFTWARE.
26 |
27 | -- MacOX specific shared library extension
28 | package.cpath = package.cpath .. ";?.dylib"
29 |
30 | local Object = require("libObject")
31 |
32 | local _, message = pcall(function() Object.new("prefix", 42) end)
33 | print("Constructor argument error message (1): ", message)
34 | local _, message = pcall(function() Object.new() end)
35 | print("Constructor argument error message (2): ", message)
36 | -- correct expression:
37 | local o1 = Object.new("o1_string")
38 |
39 | local _, message = pcall(function() o1.getString(42) end)
40 | print("Function argument error message (1): ", message)
41 | local _, message = pcall(function() o1:getString(42) end)
42 | print("Function argument error message (2): ", message)
43 | -- correct expression:
44 | o1:getString()
45 |
46 | local _, message = pcall(function() o1:createSuffixedObjectLuaFunction(o1) end)
47 | print("Lua Function argument error message: ", message)
48 | -- correct expression:
49 | o1:createSuffixedObjectLuaFunction("_suffix")
50 |
51 | local _, message = pcall(function() Object.throwCppException() end)
52 | print("Thrown exception message: ", message)
53 |
--------------------------------------------------------------------------------
/samples/abstraction/error_message/error_message.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // error_message.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | int main() {
34 | try {
35 | const integral::State luaState;
36 | luaState.openLibs();
37 | luaState["throwException"].setFunction(
38 | [] {
39 | throw std::runtime_error("exception!");
40 | }
41 | );
42 | try {
43 | luaState.doFile("sample.lua");
44 | } catch (const integral::StateException &stateException) {
45 | std::cout << "expected exception: {" << stateException.what() << "}\n";
46 | }
47 | try {
48 | luaState.doString("throwException()");
49 | } catch (const integral::StateException &stateException) {
50 | std::cout << "expected exception: {" << stateException.what() << "}\n";
51 | }
52 | return EXIT_SUCCESS;
53 | } catch (const std::exception &exception) {
54 | std::cerr << "[state] " << exception.what() << std::endl;
55 | } catch (...) {
56 | std::cerr << "unknown exception thrown" << std::endl;
57 | }
58 | return EXIT_FAILURE;
59 | }
60 |
--------------------------------------------------------------------------------
/lib/integral/Global.hpp:
--------------------------------------------------------------------------------
1 | //
2 | // Global.hpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2019, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #ifndef integral_Global_hpp
28 | #define integral_Global_hpp
29 |
30 | #include "GlobalBase.hpp"
31 | #include "ReferenceValue.hpp"
32 |
33 | namespace integral {
34 | class Global : public GlobalBase {
35 | public:
36 | using GlobalBase::push;
37 |
38 | template
39 | detail::ReferenceValue, Global> operator[](K &&key) &&;
40 | };
41 |
42 | namespace detail::exchanger {
43 | template<>
44 | class Exchanger {
45 | public:
46 | inline static void push(lua_State *luaState, const Global &global);
47 | inline static void push(lua_State *luaState);
48 | };
49 | }
50 |
51 | //--
52 |
53 | template
54 | detail::ReferenceValue, Global> Global::operator[](K &&key) && {
55 | return {std::forward(key), std::move(*this)};
56 | }
57 |
58 | namespace detail::exchanger {
59 | inline void Exchanger::push(lua_State *luaState, const Global &global) {
60 | global.push(luaState);
61 | }
62 |
63 | inline void Exchanger::push(lua_State *luaState) {
64 | Global().push(luaState);
65 | }
66 | }
67 | }
68 |
69 | #endif
70 |
71 |
--------------------------------------------------------------------------------
/samples/core/embedded/embedded.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // embedded.cpp
3 | // integral
4 | //
5 | // MIT License
6 | //
7 | // Copyright (c) 2013, 2014, 2016, 2017, 2020 André Pereira Henriques (aphenriques (at) outlook (dot) com)
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in all
17 | // copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 | // SOFTWARE.
26 |
27 | #include
28 | #include
29 | #include
30 |
31 | class Object {
32 | public:
33 | void printMessage() const {
34 | std::cout << "Object " << this << " message!" << std::endl;
35 | }
36 | };
37 |
38 | int main() {
39 | lua_State *luaState = nullptr;
40 |
41 | try {
42 | luaState = luaL_newstate();
43 | if (luaState == nullptr) {
44 | return 1;
45 | }
46 |
47 | integral::pushClassMetatable