diff options
Diffstat (limited to 'src')
136 files changed, 934 insertions, 1336 deletions
diff --git a/src/admin/fwd.hpp b/src/admin/fwd.hpp index 4865106..46674c8 100644 --- a/src/admin/fwd.hpp +++ b/src/admin/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_ADMIN_FWD_HPP -#define TMWA_ADMIN_FWD_HPP +#pragma once // admin/fwd.hpp - list of type names for admin client // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa { // meh, add more when I feel like it } // namespace tmwa - -#endif // TMWA_ADMIN_FWD_HPP diff --git a/src/admin/ladmin.hpp b/src/admin/ladmin.hpp index 81ed1f2..94783ac 100644 --- a/src/admin/ladmin.hpp +++ b/src/admin/ladmin.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_ADMIN_LADMIN_HPP -#define TMWA_ADMIN_LADMIN_HPP +#pragma once // ladmin.hpp - dummy header to make Make dependencies work. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa { } // namespace tmwa - -#endif // TMWA_ADMIN_LADMIN_HPP diff --git a/src/char/char.hpp b/src/char/char.hpp index ffd6f06..a9c786f 100644 --- a/src/char/char.hpp +++ b/src/char/char.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_CHAR_CHAR_HPP -#define TMWA_CHAR_CHAR_HPP +#pragma once // char.hpp - Character server. // // Copyright © ????-2004 Athena Dev Teams @@ -21,15 +20,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/array.hpp" +#include "../generic/array.hpp" -# include "../net/ip.hpp" +#include "../net/ip.hpp" -# include "../mmo/mmo.hpp" +#include "../mmo/mmo.hpp" namespace tmwa @@ -52,8 +51,6 @@ auto iter_map_sessions() -> decltype(filter_iterator<Session *>(std::declval<Arr void char_log(XString line); -# define CHAR_LOG(fmt, ...) \ +#define CHAR_LOG(fmt, ...) \ char_log(STRPRINTF(fmt, ## __VA_ARGS__)) } // namespace tmwa - -#endif // TMWA_CHAR_CHAR_HPP diff --git a/src/char/fwd.hpp b/src/char/fwd.hpp index 04097a6..31cd1ba 100644 --- a/src/char/fwd.hpp +++ b/src/char/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_CHAR_FWD_HPP -#define TMWA_CHAR_FWD_HPP +#pragma once // char/fwd.hpp - list of type names for char server // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa { // meh, add more when I feel like it } // namespace tmwa - -#endif // TMWA_CHAR_FWD_HPP diff --git a/src/char/int_party.hpp b/src/char/int_party.hpp index 88ce05f..f33fc0d 100644 --- a/src/char/int_party.hpp +++ b/src/char/int_party.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_CHAR_INT_PARTY_HPP -#define TMWA_CHAR_INT_PARTY_HPP +#pragma once // int_party.hpp - Internal party handling. // // Copyright © ????-2004 Athena Dev Teams @@ -21,13 +20,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../net/fwd.hpp" +#include "../net/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" namespace tmwa @@ -41,5 +40,3 @@ void inter_party_leave(PartyId party_id, AccountId account_id); extern AString party_txt; } // namespace tmwa - -#endif // TMWA_CHAR_INT_PARTY_HPP diff --git a/src/char/int_storage.hpp b/src/char/int_storage.hpp index e93be14..b8ec9db 100644 --- a/src/char/int_storage.hpp +++ b/src/char/int_storage.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_CHAR_INT_STORAGE_HPP -#define TMWA_CHAR_INT_STORAGE_HPP +#pragma once // int_storage.hpp - Internal storage handling. // // Copyright © ????-2004 Athena Dev Teams @@ -21,13 +20,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../net/fwd.hpp" +#include "../net/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" namespace tmwa @@ -41,5 +40,3 @@ RecvResult inter_storage_parse_frommap(Session *ms, uint16_t); extern AString storage_txt; } // namespace tmwa - -#endif // TMWA_CHAR_INT_STORAGE_HPP diff --git a/src/char/inter.hpp b/src/char/inter.hpp index ecfaf08..19900f9 100644 --- a/src/char/inter.hpp +++ b/src/char/inter.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_CHAR_INTER_HPP -#define TMWA_CHAR_INTER_HPP +#pragma once // inter.hpp - Internal server. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../net/fwd.hpp" +#include "../net/fwd.hpp" namespace tmwa @@ -37,5 +36,3 @@ RecvResult inter_parse_frommap(Session *ms, uint16_t packet_id); extern int party_share_level; } // namespace tmwa - -#endif // TMWA_CHAR_INTER_HPP diff --git a/src/compat/attr.hpp b/src/compat/attr.hpp index 73fcfc4..238a5d5 100644 --- a/src/compat/attr.hpp +++ b/src/compat/attr.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_ATTR_HPP -#define TMWA_COMPAT_ATTR_HPP +#pragma once // attr.hpp - Attributes. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,16 +18,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa { -# ifdef __clang__ -# define FALLTHROUGH [[clang::fallthrough]] -# else -# define FALLTHROUGH /* fallthrough */ -# endif +#ifdef __clang__ +# define FALLTHROUGH [[clang::fallthrough]] +#else +# define FALLTHROUGH /* fallthrough */ +#endif } // namespace tmwa - -#endif // TMWA_COMPAT_ATTR_HPP diff --git a/src/compat/cast.hpp b/src/compat/cast.hpp index 38a8997..35dbc62 100644 --- a/src/compat/cast.hpp +++ b/src/compat/cast.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_CAST_HPP -#define TMWA_COMPAT_CAST_HPP +#pragma once // cast.hpp - Change the type of a variable. // // Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,10 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <utility> -# include <type_traits> +#include <utility> +#include <type_traits> namespace tmwa @@ -71,5 +70,3 @@ typename std::remove_pointer<T>::type *sign_cast(U *u) return reinterpret_cast<T_ *>(u); } } // namespace tmwa - -#endif // TMWA_COMPAT_CAST_HPP diff --git a/src/compat/fun.hpp b/src/compat/fun.hpp index 53a0ed6..8073fe7 100644 --- a/src/compat/fun.hpp +++ b/src/compat/fun.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_FUN_HPP -#define TMWA_COMPAT_FUN_HPP +#pragma once // fun.hpp - Functional placeholders. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,14 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <functional> +#include <functional> namespace tmwa { namespace ph = std::placeholders; } // namespace tmwa - -#endif // TMWA_COMPAT_FUN_HPP diff --git a/src/compat/fwd.hpp b/src/compat/fwd.hpp index 729b963..45f3c24 100644 --- a/src/compat/fwd.hpp +++ b/src/compat/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_FWD_HPP -#define TMWA_COMPAT_FWD_HPP +#pragma once // compat/fwd.hpp - list of type names for compat libs // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa { // meh, add more when I feel like it } // namespace tmwa - -#endif // TMWA_COMPAT_FWD_HPP diff --git a/src/compat/iter.hpp b/src/compat/iter.hpp index 7ed24da..ff146a0 100644 --- a/src/compat/iter.hpp +++ b/src/compat/iter.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_ITER_HPP -#define TMWA_COMPAT_ITER_HPP +#pragma once // iter.hpp - tools for dealing with iterators // // Copyright © 2012-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <iterator> +#include <iterator> namespace tmwa @@ -152,5 +151,3 @@ IteratorPair<FilterIterator<T, F, C>> filter_iterator(C *c, F f=is_truthy<T>) return {FilterIterator<T, F, C>(c, f), FilterIterator<T, F, C>(c, f)}; } } // namespace tmwa - -#endif // TMWA_COMPAT_ITER_HPP diff --git a/src/compat/memory.hpp b/src/compat/memory.hpp index 702951c..566cc8b 100644 --- a/src/compat/memory.hpp +++ b/src/compat/memory.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_MEMORY_HPP -#define TMWA_COMPAT_MEMORY_HPP +#pragma once // memory.hpp - I forget ... // // Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,10 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <memory> -# include <type_traits> +#include <memory> +#include <type_traits> namespace tmwa @@ -45,5 +44,3 @@ typename std::enable_if<is_array_of_unknown_bound<T>::value, std::unique_ptr<T, return std::unique_ptr<E[], D>(new E[sz]()); } } // namespace tmwa - -#endif // TMWA_COMPAT_MEMORY_HPP diff --git a/src/compat/nullpo.hpp b/src/compat/nullpo.hpp index 6e12f78..5be674a 100644 --- a/src/compat/nullpo.hpp +++ b/src/compat/nullpo.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_NULLPO_HPP -#define TMWA_COMPAT_NULLPO_HPP +#pragma once // nullpo.hpp - Non-fatal pointer assertions. // // Copyright © ????-2004 Athena Dev Teams @@ -31,19 +30,19 @@ /// nullpo_retv(cond) - just return (function returns void) /// nullpo_retr(rv, cond) - return given value instead -# ifndef BUG_FREE -# define nullpo_retr(ret, t) \ +#ifndef BUG_FREE +# define nullpo_retr(ret, t) \ if (nullpo_chk(__FILE__, __LINE__, __PRETTY_FUNCTION__, t)) \ return ret; -# else // BUG_FREE -# define nullpo_retr(ret, t) /*t*/ -# endif // BUG_FREE +#else // BUG_FREE +# define nullpo_retr(ret, t) /*t*/ +#endif // BUG_FREE -# define nullpo_retn(t) nullpo_retr(nullptr, t) -# define nullpo_retz(t) nullpo_retr(0, t) -# define nullpo_retv(t) nullpo_retr(, t) +#define nullpo_retn(t) nullpo_retr(nullptr, t) +#define nullpo_retz(t) nullpo_retr(0, t) +#define nullpo_retv(t) nullpo_retr(, t) -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -63,5 +62,3 @@ bool nullpo_chk(const char *file, int line, const char *func, T *target) return nullpo_chk(file, line, func, static_cast<const void *>(target)); } } // namespace tmwa - -#endif // TMWA_COMPAT_NULLPO_HPP diff --git a/src/compat/rawmem.hpp b/src/compat/rawmem.hpp index dd038be..c271a56 100644 --- a/src/compat/rawmem.hpp +++ b/src/compat/rawmem.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_RAWMEM_HPP -#define TMWA_COMPAT_RAWMEM_HPP +#pragma once // rawmem.hpp - Ignore poisoning and really frob this memory unsafely. // // Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include <cstddef> -# include <cstdint> -# include <cstring> +#include <cstddef> +#include <cstdint> +#include <cstring> -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -51,5 +50,3 @@ void really_memset0(uint8_t *dest, size_t n) memset(dest, '\0', n); } } // namespace tmwa - -#endif // TMWA_COMPAT_RAWMEM_HPP diff --git a/src/compat/time_t.hpp b/src/compat/time_t.hpp index 60005d0..9e7cf25 100644 --- a/src/compat/time_t.hpp +++ b/src/compat/time_t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_COMPAT_TIMET_HPP -#define TMWA_COMPAT_TIMET_HPP +#pragma once // time_t.hpp - time_t with a reliable representation // // Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,14 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" // TODO fix this ordering violation by promoting TimeT here -# include "../mmo/utils.hpp" +#include "../mmo/utils.hpp" namespace tmwa { } // namespace tmwa - -#endif // TMWA_COMPAT_TIMET_HPP diff --git a/src/conf/version.hpp b/src/conf/version.hpp index 23c49a4..df8a8b6 100644 --- a/src/conf/version.hpp +++ b/src/conf/version.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_CONF_VERSION_HPP -#define TMWA_CONF_VERSION_HPP +#pragma once // conf/version.hpp - Import configuration variables related to version. // // Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -21,23 +20,21 @@ // just mention "fwd.hpp" to make formatter happy -# include "conf-raw/str-VERSION_FULL.h" -# include "conf-raw/str-VERSION_HASH.h" +#include "conf-raw/str-VERSION_FULL.h" +#include "conf-raw/str-VERSION_HASH.h" -# include "conf-raw/int-VERSION_MAJOR.h" -# include "conf-raw/int-VERSION_MINOR.h" -# include "conf-raw/int-VERSION_PATCH.h" -# include "conf-raw/int-VERSION_DEVEL.h" +#include "conf-raw/int-VERSION_MAJOR.h" +#include "conf-raw/int-VERSION_MINOR.h" +#include "conf-raw/int-VERSION_PATCH.h" +#include "conf-raw/int-VERSION_DEVEL.h" -# include "conf-raw/str-VENDOR_NAME.h" -# include "conf-raw/int-VENDOR_POINT.h" -# include "conf-raw/str-VENDOR_SOURCE.h" +#include "conf-raw/str-VENDOR_NAME.h" +#include "conf-raw/int-VENDOR_POINT.h" +#include "conf-raw/str-VENDOR_SOURCE.h" -# include "conf-raw/str-VERSION_STRING.h" +#include "conf-raw/str-VERSION_STRING.h" namespace tmwa { } // namespace tmwa - -#endif // TMWA_CONF_VERSION_HPP diff --git a/src/generic/array.hpp b/src/generic/array.hpp index cf50dc8..dccb91e 100644 --- a/src/generic/array.hpp +++ b/src/generic/array.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_ARRAY_HPP -#define TMWA_GENERIC_ARRAY_HPP +#pragma once // array.hpp - A simple bounds-checked array. // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cassert> -# include <cstddef> +#include <cassert> +#include <cstddef> -# include "oops.hpp" +#include "oops.hpp" namespace tmwa @@ -117,5 +116,3 @@ public: template<class T, size_t n> using Array = GenericArray<T, SimpleIndexing<n>>; } // namespace tmwa - -#endif // TMWA_GENERIC_ARRAY_HPP diff --git a/src/generic/db.hpp b/src/generic/db.hpp index 3caac91..90c4f92 100644 --- a/src/generic/db.hpp +++ b/src/generic/db.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_DB_HPP -#define TMWA_GENERIC_DB_HPP +#pragma once // db.hpp - convenience wrappers over std::map<K, V> // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,10 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <map> -# include <memory> +#include <map> +#include <memory> namespace tmwa @@ -180,5 +179,3 @@ public: } }; } // namespace tmwa - -#endif // TMWA_GENERIC_DB_HPP diff --git a/src/generic/dumb_ptr.hpp b/src/generic/dumb_ptr.hpp index 4d4473f..a9d6893 100644 --- a/src/generic/dumb_ptr.hpp +++ b/src/generic/dumb_ptr.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_DUMB_PTR_HPP -#define TMWA_GENERIC_DUMB_PTR_HPP +#pragma once // dumb_ptr.hpp - temporary new/delete wrappers // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,16 +18,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstring> +#include <cstring> -# include <algorithm> -# include <utility> +#include <algorithm> +#include <utility> -# include "../strings/astring.hpp" -# include "../strings/zstring.hpp" -# include "../strings/xstring.hpp" +#include "../strings/astring.hpp" +#include "../strings/zstring.hpp" +#include "../strings/xstring.hpp" namespace tmwa @@ -208,9 +207,9 @@ struct dumb_string return dumb_string::copy(&*s.begin(), &*s.end()); } static -# ifndef __clang__ +#ifndef __clang__ __attribute__((warning("shouldn't use this - slice instead"))) -# endif +#endif dumb_string copyn(const char *sn, size_t n) { return dumb_string::copy(sn, sn + strnlen(sn, n)); @@ -271,5 +270,3 @@ const char *convert_for_printf(dumb_string ds) return ds.c_str(); } } // namespace tmwa - -#endif // TMWA_GENERIC_DUMB_PTR_HPP diff --git a/src/generic/enum.hpp b/src/generic/enum.hpp index 2fe748d..81c9b12 100644 --- a/src/generic/enum.hpp +++ b/src/generic/enum.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_ENUM_HPP -#define TMWA_GENERIC_ENUM_HPP +#pragma once // enum.hpp - Safe building blocks for enumerated types. // // Copyright © 2012-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,17 +18,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cassert> -# include <cstddef> +#include <cassert> +#include <cstddef> -# include <algorithm> -# include <type_traits> +#include <algorithm> +#include <type_traits> -# include "../compat/iter.hpp" +#include "../compat/iter.hpp" -# include "array.hpp" +#include "array.hpp" namespace tmwa @@ -102,7 +101,7 @@ struct remove_enum<E, true> // This really should just go in a namespace // that's how I use it anyway ... -# define ENUM_BITWISE_OPERATORS(E) \ +#define ENUM_BITWISE_OPERATORS(E) \ inline \ E operator & (E l, E r) \ { \ @@ -160,5 +159,3 @@ IteratorPair<ValueIterator<E, EnumMath<E>>> erange(E b, E e) return {b, e}; } } // namespace tmwa - -#endif // TMWA_GENERIC_ENUM_HPP diff --git a/src/generic/fwd.hpp b/src/generic/fwd.hpp index 93d664c..81c4e26 100644 --- a/src/generic/fwd.hpp +++ b/src/generic/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_FWD_HPP -#define TMWA_GENERIC_FWD_HPP +#pragma once // generic/fwd.hpp - list of type names for generic lib // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa @@ -29,5 +28,3 @@ template<class T> class dumb_ptr; class dumb_string; } // namespace tmwa - -#endif // TMWA_GENERIC_FWD_HPP diff --git a/src/generic/intern-pool.hpp b/src/generic/intern-pool.hpp index e209b4b..030aa38 100644 --- a/src/generic/intern-pool.hpp +++ b/src/generic/intern-pool.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_INTERN_POOL_HPP -#define TMWA_GENERIC_INTERN_POOL_HPP +#pragma once // intern-pool.hpp - Cached integer/string lookups. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,17 +18,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cassert> -# include <cstddef> +#include <cassert> +#include <cstddef> -# include <map> -# include <vector> +#include <map> +#include <vector> -# include "../strings/rstring.hpp" -# include "../strings/zstring.hpp" -# include "../strings/xstring.hpp" +#include "../strings/rstring.hpp" +#include "../strings/zstring.hpp" +#include "../strings/xstring.hpp" namespace tmwa @@ -63,5 +62,3 @@ public: } }; } // namespace tmwa - -#endif // TMWA_GENERIC_INTERN_POOL_HPP diff --git a/src/generic/matrix.hpp b/src/generic/matrix.hpp index 36be084..86ce6c2 100644 --- a/src/generic/matrix.hpp +++ b/src/generic/matrix.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_MATRIX_HPP -#define TMWA_GENERIC_MATRIX_HPP +#pragma once // matrix.hpp - A 2D array. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cassert> +#include <cassert> -# include "../compat/memory.hpp" +#include "../compat/memory.hpp" namespace tmwa @@ -78,5 +77,3 @@ public: } }; } // namespace tmwa - -#endif // TMWA_GENERIC_MATRIX_HPP diff --git a/src/generic/md5.hpp b/src/generic/md5.hpp index fbe25d1..50bc987 100644 --- a/src/generic/md5.hpp +++ b/src/generic/md5.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_MD5CALC_HPP -#define TMWA_GENERIC_MD5CALC_HPP +#pragma once // md5.hpp - Fundamental MD5 operations. // // Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,14 +18,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include <array> +#include <array> -# include "../strings/fwd.hpp" -# include "../strings/vstring.hpp" +#include "../strings/fwd.hpp" +#include "../strings/vstring.hpp" namespace tmwa @@ -58,5 +57,3 @@ void MD5_to_str(MD5_state state, md5_string& out); // Convenience MD5_state MD5_from_string(XString msg); } // namespace tmwa - -#endif // TMWA_GENERIC_MD5CALC_HPP diff --git a/src/generic/oops.hpp b/src/generic/oops.hpp index 1501708..f5cf54a 100644 --- a/src/generic/oops.hpp +++ b/src/generic/oops.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_OOPS_HPP -#define TMWA_GENERIC_OOPS_HPP +#pragma once // oops.hpp - Stuff that shouldn't happen. // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstddef> +#include <cstddef> -# include <stdexcept> +#include <stdexcept> namespace tmwa @@ -35,9 +34,7 @@ public: const char *file, size_t line, const char *function); }; -# define ALLEGE(desc, expr) \ +#define ALLEGE(desc, expr) \ if (expr) {} \ else throw AssertionError(desc, #expr, __FILE__, __LINE__, __PRETTY_FUNCTION__) } // namespace tmwa - -#endif // TMWA_GENERIC_OOPS_HPP diff --git a/src/generic/operators.hpp b/src/generic/operators.hpp index 15246ef..bb05765 100644 --- a/src/generic/operators.hpp +++ b/src/generic/operators.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_OPERATORS_HPP -#define TMWA_GENERIC_OPERATORS_HPP +#pragma once // operators.hpp - ADL helper for value wrappers. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -67,5 +66,3 @@ namespace _operators using _operators::Comparable; } // namespace tmwa - -#endif // TMWA_GENERIC_OPERATORS_HPP diff --git a/src/generic/random.hpp b/src/generic/random.hpp index 71883cc..5d67236 100644 --- a/src/generic/random.hpp +++ b/src/generic/random.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_RANDOM_HPP -#define TMWA_GENERIC_RANDOM_HPP +#pragma once // random.hpp - Random number generation. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "random.t.hpp" +#include "random.t.hpp" -# include <random> +#include <random> namespace tmwa @@ -87,5 +86,3 @@ namespace random_ } } // namespace random_ } // namespace tmwa - -#endif // TMWA_GENERIC_RANDOM_HPP diff --git a/src/generic/random.t.hpp b/src/generic/random.t.hpp index c68643a..b4c4764 100644 --- a/src/generic/random.t.hpp +++ b/src/generic/random.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_RANDOM_T_HPP -#define TMWA_GENERIC_RANDOM_T_HPP +#pragma once // random.t.hpp - Random number generation. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -43,5 +42,3 @@ namespace random_ }; } // namespace random_ } // namespace tmwa - -#endif // TMWA_GENERIC_RANDOM_T_HPP diff --git a/src/generic/random2.hpp b/src/generic/random2.hpp index 1aee094..23d165c 100644 --- a/src/generic/random2.hpp +++ b/src/generic/random2.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_RANDOM2_HPP -#define TMWA_GENERIC_RANDOM2_HPP +#pragma once // random2.hpp - Random number generation. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,13 +18,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "random.hpp" +#include "random.hpp" -# include <algorithm> +#include <algorithm> -# include "../compat/iter.hpp" +#include "../compat/iter.hpp" namespace tmwa @@ -95,5 +94,3 @@ namespace random_ } } // namespace random_ } // namespace tmwa - -#endif // TMWA_GENERIC_RANDOM2_HPP diff --git a/src/ints/cmp.hpp b/src/ints/cmp.hpp index 8839899..16384e6 100644 --- a/src/ints/cmp.hpp +++ b/src/ints/cmp.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_INTS_CMP_HPP -#define TMWA_INTS_CMP_HPP +#pragma once // cmp.hpp - comparison related operations // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,17 +18,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <limits> +#include <limits> namespace tmwa { namespace ints { -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wtype-limits" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" template<class T, class U> T saturate(const U& v) { @@ -63,10 +62,8 @@ namespace ints return v; } } -# pragma GCC diagnostic pop +#pragma GCC diagnostic pop } // namespace ints using ints::saturate; } // namespace tmwa - -#endif // TMWA_INTS_CMP_HPP diff --git a/src/ints/fwd.hpp b/src/ints/fwd.hpp index 650e859..a08e546 100644 --- a/src/ints/fwd.hpp +++ b/src/ints/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_INTS_FWD_HPP -#define TMWA_INTS_FWD_HPP +#pragma once // ints/fwd.hpp - list of type names for ints library // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa { // meh, add more when I feel like it } // namespace tmwa - -#endif // TMWA_INTS_FWD_HPP diff --git a/src/ints/little.hpp b/src/ints/little.hpp index 62bd729..0dbbb61 100644 --- a/src/ints/little.hpp +++ b/src/ints/little.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_INTS_LITTLE_HPP -#define TMWA_INTS_LITTLE_HPP +#pragma once // little.hpp - integers of known endianness // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,20 +18,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <endian.h> +#include <endian.h> -# include <cstdint> +#include <cstdint> namespace tmwa { // We implement our own actual swapping, because glibc emits assembly // instead of letting the *compiler* do what it does best. -# if __BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN -# error "broken endians" -# endif +#if __BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN +# error "broken endians" +#endif namespace ints { @@ -139,5 +138,3 @@ using ints::Little16; using ints::Little32; using ints::Little64; } // namespace tmwa - -#endif // TMWA_INTS_LITTLE_HPP diff --git a/src/ints/udl.hpp b/src/ints/udl.hpp index 8d18766..f85a186 100644 --- a/src/ints/udl.hpp +++ b/src/ints/udl.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_INTS_UDL_HPP -#define TMWA_INTS_UDL_HPP +#pragma once // udl.hpp - user-defined literals for integers. // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include <type_traits> +#include <type_traits> namespace tmwa @@ -129,12 +128,12 @@ namespace ints { typedef typename std::make_unsigned<T>::type U; // boo, body of constexpr function can't use variables -# define is_signed bool(T(-1) < T(0)) +#define is_signed bool(T(-1) < T(0)) static_assert(is_signed >= (sign && magnitude), "signed"); -# define max ullong(ullong(U(-1) >> is_signed)) +#define max ullong(ullong(U(-1) >> is_signed)) static_assert(magnitude <= max || (sign && magnitude == max + 1), "magna"); -# undef is_signed -# undef max +#undef is_signed +#undef max return sign ? T(ullong(-magnitude)) : T(magnitude); } }; @@ -226,5 +225,3 @@ using ints::operator "" _n16; using ints::operator "" _n32; using ints::operator "" _n64; } // namespace tmwa - -#endif // TMWA_INTS_UDL_HPP diff --git a/src/ints/wrap.hpp b/src/ints/wrap.hpp index 2573de5..707c787 100644 --- a/src/ints/wrap.hpp +++ b/src/ints/wrap.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_INTS_WRAP_HPP -#define TMWA_INTS_WRAP_HPP +#pragma once // wrap.hpp - basic integer wrapper classes // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include <type_traits> +#include <type_traits> namespace tmwa @@ -109,5 +108,3 @@ using ints::wrapped::Wrapped; using ints::wrapped::unwrap; using ints::wrapped::wrap; } // namespace tmwa - -#endif // TMWA_INTS_WRAP_HPP diff --git a/src/io/cxxstdio.hpp b/src/io/cxxstdio.hpp index 6e49c11..66c2aa8 100644 --- a/src/io/cxxstdio.hpp +++ b/src/io/cxxstdio.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_IO_CXXSTDIO_HPP -#define TMWA_IO_CXXSTDIO_HPP +#pragma once // cxxstdio.hpp - pass C++ types through printf // // Copyright © 2011-2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,14 +18,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdarg> -# include <cstdio> +#include <cstdarg> +#include <cstdio> -# include "../compat/cast.hpp" +#include "../compat/cast.hpp" -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" namespace tmwa @@ -68,7 +67,7 @@ namespace cxxstdio inline const char *convert_for_printf(const char *) = delete; -# if 0 +#if 0 template<class E> constexpr E get_enum_min_value(decltype(E::min_value)) @@ -94,7 +93,7 @@ namespace cxxstdio { return def; } -# else +#else template<class E> constexpr E get_enum_min_value(E) @@ -107,24 +106,24 @@ namespace cxxstdio { return E::max_value; } -# endif +#endif template<class E> class EnumConverter { E& out; typedef typename underlying_type<E>::type U; -# if 0 +#if 0 constexpr static U min_value = U(get_enum_min_value<E>(E(std::numeric_limits<U>::min()))); constexpr static U max_value = U(get_enum_max_value<E>(E(std::numeric_limits<U>::max()))); -# else +#else constexpr static U min_value = U(get_enum_min_value(E())); constexpr static U max_value = U(get_enum_max_value(E())); -# endif +#endif U mid; public: EnumConverter(E& e) @@ -132,10 +131,10 @@ namespace cxxstdio {} ~EnumConverter() { -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wtype-limits" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wtype-limits" if (min_value <= mid && mid <= max_value) -# pragma GCC diagnostic pop +#pragma GCC diagnostic pop out = E(mid); } U *operator &() @@ -159,7 +158,7 @@ namespace cxxstdio } }; -# define XPRINTF(out, fmt, ...) \ +#define XPRINTF(out, fmt, ...) \ ({ \ struct format_impl \ { \ @@ -169,19 +168,19 @@ namespace cxxstdio cxxstdio::PrintFormatter<format_impl>::print(out, ## __VA_ARGS__); \ }) -# define FPRINTF(file, fmt, ...) XPRINTF(/*no_cast<FILE *>*/(file), fmt, ## __VA_ARGS__) -# define PRINTF(fmt, ...) FPRINTF(stdout, fmt, ## __VA_ARGS__) -# define SPRINTF(str, fmt, ...) XPRINTF(base_cast<AString&>(str), fmt, ## __VA_ARGS__) -# define SNPRINTF(str, n, fmt, ...) XPRINTF(base_cast<VString<n-1>&>(str), fmt, ## __VA_ARGS__) +#define FPRINTF(file, fmt, ...) XPRINTF(/*no_cast<FILE *>*/(file), fmt, ## __VA_ARGS__) +#define PRINTF(fmt, ...) FPRINTF(stdout, fmt, ## __VA_ARGS__) +#define SPRINTF(str, fmt, ...) XPRINTF(base_cast<AString&>(str), fmt, ## __VA_ARGS__) +#define SNPRINTF(str, n, fmt, ...) XPRINTF(base_cast<VString<n-1>&>(str), fmt, ## __VA_ARGS__) -# define STRPRINTF(fmt, ...) \ +#define STRPRINTF(fmt, ...) \ ({ \ AString _out_impl; \ SPRINTF(_out_impl, fmt, ## __VA_ARGS__); \ _out_impl; \ }) -# define STRNPRINTF(n, fmt, ...) \ +#define STRNPRINTF(n, fmt, ...) \ ({ \ VString<n - 1> _out_impl; \ SNPRINTF(_out_impl, n, fmt, ## __VA_ARGS__); \ @@ -190,5 +189,3 @@ namespace cxxstdio } // namespace cxxstdio } // namespace tmwa - -#endif // TMWA_IO_CXXSTDIO_HPP diff --git a/src/io/fd.hpp b/src/io/fd.hpp index 9ea4d41..d725c8a 100644 --- a/src/io/fd.hpp +++ b/src/io/fd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_IO_FD_HPP -#define TMWA_IO_FD_HPP +#pragma once // io/fd.hpp - typesafe (but not scopesafe) file descriptors // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <sys/select.h> -# include <sys/socket.h> +#include <sys/select.h> +#include <sys/socket.h> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa @@ -138,24 +137,24 @@ namespace io } void clr(FD fd) { -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" FD_CLR(fd.uncast_dammit(), &fds); -# pragma GCC diagnostic pop +#pragma GCC diagnostic pop } bool isset(FD fd) { -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" return FD_ISSET(fd.uncast_dammit(), &fds); -# pragma GCC diagnostic pop +#pragma GCC diagnostic pop } void set(FD fd) { -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wold-style-cast" FD_SET(fd.uncast_dammit(), &fds); -# pragma GCC diagnostic pop +#pragma GCC diagnostic pop } static @@ -165,5 +164,3 @@ namespace io }; } // namespace io } // namespace tmwa - -#endif // TMWA_IO_FD_HPP diff --git a/src/io/fwd.hpp b/src/io/fwd.hpp index 2032c3b..deeb08c 100644 --- a/src/io/fwd.hpp +++ b/src/io/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_IO_FWD_HPP -#define TMWA_IO_FWD_HPP +#pragma once // io/fwd.hpp - Forward declarations of I/O classes // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa @@ -31,5 +30,3 @@ namespace io class AppendFile; } // namespace io } // namespace tmwa - -#endif // TMWA_IO_FWD_HPP diff --git a/src/io/line.hpp b/src/io/line.hpp index f481505..8244c5e 100644 --- a/src/io/line.hpp +++ b/src/io/line.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_IO_LINE_HPP -#define TMWA_IO_LINE_HPP +#pragma once // io/line.hpp - Input from files, line-by-line // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,13 +18,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/rstring.hpp" -# include "../strings/zstring.hpp" -# include "../strings/literal.hpp" +#include "../strings/rstring.hpp" +#include "../strings/zstring.hpp" +#include "../strings/literal.hpp" -# include "read.hpp" +#include "read.hpp" namespace tmwa @@ -106,5 +105,3 @@ namespace io }; } // namespace io } // namespace tmwa - -#endif // TMWA_IO_LINE_HPP diff --git a/src/io/lock.hpp b/src/io/lock.hpp index e4ec153..005b371 100644 --- a/src/io/lock.hpp +++ b/src/io/lock.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_IO_LOCK_HPP -#define TMWA_IO_LOCK_HPP +#pragma once // io/lock.hpp - Output to files with atomic replacement and backups. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "write.hpp" +#include "write.hpp" -# include "../strings/rstring.hpp" +#include "../strings/rstring.hpp" namespace tmwa @@ -41,5 +40,3 @@ namespace io }; } // namespace io } // namespace tmwa - -#endif // TMWA_IO_LOCK_HPP diff --git a/src/io/read.hpp b/src/io/read.hpp index 6757496..6a44de6 100644 --- a/src/io/read.hpp +++ b/src/io/read.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_IO_READ_HPP -#define TMWA_IO_READ_HPP +#pragma once // io/read.hpp - Input from files. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "fd.hpp" +#include "fd.hpp" namespace tmwa { @@ -52,5 +51,3 @@ namespace io }; } // namespace io } // namespace tmwa - -#endif // TMWA_IO_READ_HPP diff --git a/src/io/tty.hpp b/src/io/tty.hpp index 86dc6d5..f754b91 100644 --- a/src/io/tty.hpp +++ b/src/io/tty.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_IO_TTY_HPP -#define TMWA_IO_TTY_HPP +#pragma once // io/tty.hpp - terminal escape sequences // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,23 +18,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa { -# define SGR_BLACK "\e[30m" -# define SGR_RED "\e[31m" -# define SGR_GREEN "\e[32m" -# define SGR_YELLOW "\e[33m" -# define SGR_BLUE "\e[34m" -# define SGR_MAGENTA "\e[35m" -# define SGR_CYAN "\e[36m" -# define SGR_WHITE "\e[37m" +#define SGR_BLACK "\e[30m" +#define SGR_RED "\e[31m" +#define SGR_GREEN "\e[32m" +#define SGR_YELLOW "\e[33m" +#define SGR_BLUE "\e[34m" +#define SGR_MAGENTA "\e[35m" +#define SGR_CYAN "\e[36m" +#define SGR_WHITE "\e[37m" -# define SGR_BOLD "\e[1m" +#define SGR_BOLD "\e[1m" -# define SGR_RESET "\e[0m" +#define SGR_RESET "\e[0m" } // namespace tmwa - -#endif // TMWA_IO_TTY_HPP diff --git a/src/io/write.hpp b/src/io/write.hpp index 7e57841..11bc679 100644 --- a/src/io/write.hpp +++ b/src/io/write.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_IO_WRITE_HPP -#define TMWA_IO_WRITE_HPP +#pragma once // io/write.hpp - Output to files. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,13 +18,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdarg> +#include <cstdarg> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "fd.hpp" +#include "fd.hpp" namespace tmwa @@ -68,5 +67,3 @@ namespace io int do_vprint(WriteFile& out, const char *fmt, va_list ap); } // namespace io } // namespace tmwa - -#endif // TMWA_IO_WRITE_HPP diff --git a/src/login/fwd.hpp b/src/login/fwd.hpp index ef0b6af..94fe3c0 100644 --- a/src/login/fwd.hpp +++ b/src/login/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_LOGIN_FWD_HPP -#define TMWA_LOGIN_FWD_HPP +#pragma once // login/fwd.hpp - list of type names for login server // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa { // meh, add more when I feel like it } // namespace tmwa - -#endif // TMWA_LOGIN_FWD_HPP diff --git a/src/login/login.hpp b/src/login/login.hpp index e713d44..92f3c76 100644 --- a/src/login/login.hpp +++ b/src/login/login.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_LOGIN_LOGIN_HPP -#define TMWA_LOGIN_LOGIN_HPP +#pragma once // login.hpp - dummy header to make Make dependencies work. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,13 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "login.t.hpp" +#include "login.t.hpp" namespace tmwa { } // namespace tmwa - -#endif // TMWA_LOGIN_LOGIN_HPP diff --git a/src/login/login.t.hpp b/src/login/login.t.hpp index 6de5c98..f2c775a 100644 --- a/src/login/login.t.hpp +++ b/src/login/login.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_LOGIN_LOGIN_T_HPP -#define TMWA_LOGIN_LOGIN_T_HPP +#pragma once // login.t.hpp - externally useful types from login // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" namespace tmwa @@ -43,5 +42,3 @@ ENUM_BITWISE_OPERATORS(VERSION_2) } using e::VERSION_2; } // namespace tmwa - -#endif // TMWA_LOGIN_LOGIN_T_HPP diff --git a/src/map/atcommand.hpp b/src/map/atcommand.hpp index 16b17a3..4bf5277 100644 --- a/src/map/atcommand.hpp +++ b/src/map/atcommand.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_ATCOMMAND_HPP -#define TMWA_MAP_ATCOMMAND_HPP +#pragma once // atcommand.hpp - GM commands. // // Copyright © ????-2004 Athena Dev Teams @@ -21,15 +20,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../net/fwd.hpp" +#include "../net/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" namespace tmwa @@ -46,5 +45,3 @@ extern AString gm_log; void atcommand_config_write(ZString cfgName); } // namespace tmwa - -#endif // TMWA_MAP_ATCOMMAND_HPP diff --git a/src/map/battle.hpp b/src/map/battle.hpp index c5e7d95..97a4a86 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_BATTLE_HPP -#define TMWA_MAP_BATTLE_HPP +#pragma once // battle.hpp - Not so scary code. // // Copyright © ????-2004 Athena Dev Teams @@ -21,19 +20,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "battle.t.hpp" +#include "battle.t.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../net/timer.t.hpp" +#include "../net/timer.t.hpp" -# include "clif.t.hpp" -# include "map.t.hpp" -# include "skill.t.hpp" +#include "clif.t.hpp" +#include "map.t.hpp" +#include "skill.t.hpp" namespace tmwa @@ -227,5 +226,3 @@ extern struct Battle_Config bool battle_config_read(ZString cfgName); void battle_config_check(); } // namespace tmwa - -#endif // TMWA_MAP_BATTLE_HPP diff --git a/src/map/battle.t.hpp b/src/map/battle.t.hpp index fad357d..53c34ff 100644 --- a/src/map/battle.t.hpp +++ b/src/map/battle.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_BATTLE_T_HPP -#define TMWA_MAP_BATTLE_T_HPP +#pragma once // battle.t.hpp - Not so scary code. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" namespace tmwa @@ -243,5 +242,3 @@ earray<Races, Race, Race::COUNT> race_shift //= Races::other, }}; } // namespace tmwa - -#endif // TMWA_MAP_BATTLE_T_HPP diff --git a/src/map/chrif.hpp b/src/map/chrif.hpp index 27c1b50..4711bc5 100644 --- a/src/map/chrif.hpp +++ b/src/map/chrif.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_CHRIF_HPP -#define TMWA_MAP_CHRIF_HPP +#pragma once // chrif.hpp - Network interface to the character server. // // Copyright © ????-2004 Athena Dev Teams @@ -21,15 +20,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../net/fwd.hpp" +#include "../net/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" namespace tmwa @@ -65,5 +64,3 @@ void do_init_chrif(void); // and clif.cpp for the new on_delete stuff ... extern Session *char_session; } // namespace tmwa - -#endif // TMWA_MAP_CHRIF_HPP diff --git a/src/map/clif.hpp b/src/map/clif.hpp index bf208b8..adb4889 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_CLIF_HPP -#define TMWA_MAP_CLIF_HPP +#pragma once // clif.hpp - Network interface to the client. // // Copyright © ????-2004 Athena Dev Teams @@ -21,25 +20,25 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "clif.t.hpp" +#include "clif.t.hpp" -# include <functional> +#include <functional> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../net/timer.t.hpp" +#include "../net/timer.t.hpp" -# include "../mmo/fwd.hpp" -# include "../mmo/mmo.hpp" +#include "../mmo/fwd.hpp" +#include "../mmo/mmo.hpp" -# include "battle.t.hpp" -# include "map.t.hpp" -# include "pc.t.hpp" -# include "skill.t.hpp" +#include "battle.t.hpp" +#include "map.t.hpp" +#include "pc.t.hpp" +#include "skill.t.hpp" namespace tmwa @@ -191,5 +190,3 @@ int clif_foreachclient(std::function<void(dumb_ptr<map_session_data>)>); void do_init_clif(void); } // namespace tmwa - -#endif // TMWA_MAP_CLIF_HPP diff --git a/src/map/clif.t.hpp b/src/map/clif.t.hpp index 9d5df79..1789ee8 100644 --- a/src/map/clif.t.hpp +++ b/src/map/clif.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_CLIF_T_HPP -#define TMWA_MAP_CLIF_T_HPP +#pragma once // clif.t.hpp - Network interface to the client. // // Copyright © ????-2004 Athena Dev Teams @@ -21,18 +20,18 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../ints/little.hpp" +#include "../ints/little.hpp" -# include "../compat/iter.hpp" +#include "../compat/iter.hpp" -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" -# include "../mmo/consts.hpp" -# include "../mmo/enums.hpp" +#include "../mmo/consts.hpp" +#include "../mmo/enums.hpp" namespace tmwa @@ -221,9 +220,9 @@ enum class SP : uint16_t BASEEXP = 1, // sent to client JOBEXP = 2, -# if 0 +#if 0 KARMA = 3, -# endif +#endif // sent to client HP = 5, @@ -308,12 +307,12 @@ enum class SP : uint16_t // sent to client JOBLEVEL = 55, -# if 0 +#if 0 PARTNER = 57, CART = 58, FAME = 59, UNBREAKABLE = 60, -# endif +#endif DEAF = 70, @@ -322,154 +321,154 @@ enum class SP : uint16_t // sent to client ATTACKRANGE = 1000, -# if 0 +#if 0 ATKELE = 1001, -# endif -# if 0 +#endif +#if 0 DEFELE = 1002, -# endif -# if 0 +#endif +#if 0 CASTRATE = 1003, -# endif +#endif MAXHPRATE = 1004, -# if 0 +#if 0 MAXSPRATE = 1005, -# endif -# if 0 +#endif +#if 0 SPRATE = 1006, -# endif +#endif -# if 0 +#if 0 ADDEFF = 1012, -# endif -# if 0 +#endif +#if 0 RESEFF = 1013, -# endif +#endif BASE_ATK = 1014, ASPD_RATE = 1015, HP_RECOV_RATE = 1016, -# if 0 +#if 0 SP_RECOV_RATE = 1017, -# endif -# if 0 +#endif +#if 0 SPEED_RATE = 1018, -# endif +#endif CRITICAL_DEF = 1019, -# if 0 +#if 0 NEAR_ATK_DEF = 1020, -# endif -# if 0 +#endif +#if 0 LONG_ATK_DEF = 1021, -# endif -# if 0 +#endif +#if 0 DOUBLE_RATE = 1022, -# endif +#endif DOUBLE_ADD_RATE = 1023, -# if 0 +#if 0 MATK = 1024, -# endif -# if 0 +#endif +#if 0 MATK_RATE = 1025, -# endif -# if 0 +#endif +#if 0 IGNORE_DEF_ELE = 1026, -# endif -# if 0 +#endif +#if 0 IGNORE_DEF_RACE = 1027, -# endif -# if 0 +#endif +#if 0 ATK_RATE = 1028, -# endif +#endif SPEED_ADDRATE = 1029, -# if 0 +#if 0 ASPD_ADDRATE = 1030, -# endif -# if 0 +#endif +#if 0 MAGIC_ATK_DEF = 1031, -# endif -# if 0 +#endif +#if 0 MISC_ATK_DEF = 1032, -# endif -# if 0 +#endif +#if 0 IGNORE_MDEF_ELE = 1033, -# endif -# if 0 +#endif +#if 0 IGNORE_MDEF_RACE = 1034, -# endif +#endif -# if 0 +#if 0 PERFECT_HIT_RATE = 1038, -# endif -# if 0 +#endif +#if 0 PERFECT_HIT_ADD_RATE = 1039, -# endif -# if 0 +#endif +#if 0 CRITICAL_RATE = 1040, -# endif -# if 0 +#endif +#if 0 GET_ZENY_NUM = 1041, -# endif -# if 0 +#endif +#if 0 ADD_GET_ZENY_NUM = 1042, -# endif +#endif -# if 0 +#if 0 ADD_MONSTER_DROP_ITEM = 1047, -# endif -# if 0 +#endif +#if 0 DEF_RATIO_ATK_ELE = 1048, -# endif -# if 0 +#endif +#if 0 DEF_RATIO_ATK_RACE = 1049, -# endif -# if 0 +#endif +#if 0 ADD_SPEED = 1050, -# endif -# if 0 +#endif +#if 0 HIT_RATE = 1051, -# endif -# if 0 +#endif +#if 0 FLEE_RATE = 1052, -# endif -# if 0 +#endif +#if 0 FLEE2_RATE = 1053, -# endif +#endif DEF_RATE = 1054, DEF2_RATE = 1055, -# if 0 +#if 0 MDEF_RATE = 1056, -# endif -# if 0 +#endif +#if 0 MDEF2_RATE = 1057, -# endif -# if 0 +#endif +#if 0 SPLASH_RANGE = 1058, -# endif -# if 0 +#endif +#if 0 SPLASH_ADD_RANGE = 1059, -# endif +#endif HP_DRAIN_RATE = 1061, -# if 0 +#if 0 SP_DRAIN_RATE = 1062, -# endif -# if 0 +#endif +#if 0 SHORT_WEAPON_DAMAGE_RETURN = 1063, -# endif -# if 0 +#endif +#if 0 LONG_WEAPON_DAMAGE_RETURN = 1064, -# endif +#endif -# if 0 +#if 0 ADDEFF2 = 1067, -# endif +#endif BREAK_WEAPON_RATE = 1068, BREAK_ARMOR_RATE = 1069, ADD_STEAL_RATE = 1070, MAGIC_DAMAGE_RETURN = 1071, -# if 0 +#if 0 RANDOM_ATTACK_INCREASE = 1072, -# endif +#endif }; constexpr @@ -716,5 +715,3 @@ bool network_to_native(SOff1 *native, Little16 network) return network_to_native(&native->index, network); } } // namespace tmwa - -#endif // TMWA_MAP_CLIF_T_HPP diff --git a/src/map/fwd.hpp b/src/map/fwd.hpp index d58637e..fe66b15 100644 --- a/src/map/fwd.hpp +++ b/src/map/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_FWD_HPP -#define TMWA_MAP_FWD_HPP +#pragma once // map/fwd.hpp - list of type names for map server // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa @@ -56,5 +55,3 @@ struct magic_conf_t; struct component_t; struct effect_set_t; } // namespace tmwa - -#endif // TMWA_MAP_FWD_HPP diff --git a/src/map/grfio.hpp b/src/map/grfio.hpp index 002d475..d2ab058 100644 --- a/src/map/grfio.hpp +++ b/src/map/grfio.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_GRFIO_HPP -#define TMWA_MAP_GRFIO_HPP +#pragma once // grfio.hpp - Don't read GRF files, just name-map .wlk files. // // Copyright © ????-2004 Athena Dev Teams @@ -21,15 +20,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include <vector> +#include <vector> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" namespace tmwa @@ -41,5 +40,3 @@ bool load_resnametable(ZString filename); /// Currently there is exactly one .wlk per .gat, but multiples are fine. std::vector<uint8_t> grfio_reads(MapName resourcename); } // namespace tmwa - -#endif // TMWA_MAP_GRFIO_HPP diff --git a/src/map/intif.hpp b/src/map/intif.hpp index 0e23a94..5be61a9 100644 --- a/src/map/intif.hpp +++ b/src/map/intif.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_INTIF_HPP -#define TMWA_MAP_INTIF_HPP +#pragma once // intif.hpp - Network interface to the internal server. // // Copyright © ????-2004 Athena Dev Teams @@ -21,15 +20,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../net/fwd.hpp" +#include "../net/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" namespace tmwa @@ -57,5 +56,3 @@ void intif_party_changemap(dumb_ptr<map_session_data> sd, int online); void intif_party_message(PartyId party_id, AccountId account_id, XString mes); void intif_party_checkconflict(PartyId party_id, AccountId account_id, CharName nick); } // namespace tmwa - -#endif // TMWA_MAP_INTIF_HPP diff --git a/src/map/itemdb.hpp b/src/map/itemdb.hpp index a6d4104..25b4dad 100644 --- a/src/map/itemdb.hpp +++ b/src/map/itemdb.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_ITEMDB_HPP -#define TMWA_MAP_ITEMDB_HPP +#pragma once // itemdb.hpp - Item definitions. // // Copyright © ????-2004 Athena Dev Teams @@ -21,13 +20,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../mmo/ids.hpp" -# include "../mmo/mmo.hpp" +#include "../mmo/ids.hpp" +#include "../mmo/mmo.hpp" -# include "map.t.hpp" -# include "script.hpp" +#include "map.t.hpp" +#include "script.hpp" namespace tmwa @@ -106,5 +105,3 @@ void itemdb_reload(void); void do_final_itemdb(void); bool itemdb_readdb(ZString filename); } // namespace tmwa - -#endif // TMWA_MAP_ITEMDB_HPP diff --git a/src/map/magic-expr-eval.hpp b/src/map/magic-expr-eval.hpp index 82cde5c..a291fcd 100644 --- a/src/map/magic-expr-eval.hpp +++ b/src/map/magic-expr-eval.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAGIC_EXPR_EVAL_HPP -#define TMWA_MAP_MAGIC_EXPR_EVAL_HPP +#pragma once // magic-expr-eval.hpp - Utilities for evaluating magic. // // Copyright © 2004-2011 The Mana World Development Team @@ -20,42 +19,40 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/zstring.hpp" +#include "../strings/zstring.hpp" -# include "magic-interpreter.t.hpp" +#include "magic-interpreter.t.hpp" namespace tmwa { // TODO kill this like I killed VAR -# define ARGINT(x) args[x].v.v_int -# define ARGDIR(x) args[x].v.v_dir -# define ARGSTR(x) ZString(args[x].v.v_string) -# define ARGENTITY(x) args[x].v.v_entity -# define ARGLOCATION(x) args[x].v.v_location -# define ARGAREA(x) args[x].v.v_area -# define ARGSPELL(x) args[x].v.v_spell -# define ARGINVOCATION(x) args[x].v.v_invocation - -# define RESULTINT result->v.v_int -# define RESULTDIR result->v.v_dir -# define RESULTSTR result->v.v_string -# define RESULTENTITY result->v.v_entity -# define RESULTLOCATION result->v.v_location -# define RESULTAREA result->v.v_area -# define RESULTSPELL result->v.v_spell -# define RESULTINVOCATION result->v.v_invocation - -# define ARG_TYPE(x) args[x].ty -# define ENTITY_TYPE(x) ARGENTITY(x)->bl_type - -# define ARGPC(x) (ARGENTITY(x)->is_player()) -# define ARGNPC(x) (ARGENTITY(x)->is_npc()) -# define ARGMOB(x) (ARGENTITY(x)->is_mob()) - -# define ARG_MAY_BE_AREA(x) (ARG_TYPE(x) == TYPE::AREA || ARG_TYPE(x) == TYPE::LOCATION) +#define ARGINT(x) args[x].v.v_int +#define ARGDIR(x) args[x].v.v_dir +#define ARGSTR(x) ZString(args[x].v.v_string) +#define ARGENTITY(x) args[x].v.v_entity +#define ARGLOCATION(x) args[x].v.v_location +#define ARGAREA(x) args[x].v.v_area +#define ARGSPELL(x) args[x].v.v_spell +#define ARGINVOCATION(x) args[x].v.v_invocation + +#define RESULTINT result->v.v_int +#define RESULTDIR result->v.v_dir +#define RESULTSTR result->v.v_string +#define RESULTENTITY result->v.v_entity +#define RESULTLOCATION result->v.v_location +#define RESULTAREA result->v.v_area +#define RESULTSPELL result->v.v_spell +#define RESULTINVOCATION result->v.v_invocation + +#define ARG_TYPE(x) args[x].ty +#define ENTITY_TYPE(x) ARGENTITY(x)->bl_type + +#define ARGPC(x) (ARGENTITY(x)->is_player()) +#define ARGNPC(x) (ARGENTITY(x)->is_npc()) +#define ARGMOB(x) (ARGENTITY(x)->is_mob()) + +#define ARG_MAY_BE_AREA(x) (ARG_TYPE(x) == TYPE::AREA || ARG_TYPE(x) == TYPE::LOCATION) } // namespace tmwa - -#endif // TMWA_MAP_MAGIC_EXPR_EVAL_HPP diff --git a/src/map/magic-expr.hpp b/src/map/magic-expr.hpp index 4bf43e8..e582a66 100644 --- a/src/map/magic-expr.hpp +++ b/src/map/magic-expr.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAGIC_EXPR_HPP -#define TMWA_MAP_MAGIC_EXPR_HPP +#pragma once // magic-expr.hpp - Pure functions for the old magic backend. // // Copyright © 2004-2011 The Mana World Development Team @@ -20,18 +19,18 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../range/fwd.hpp" +#include "../range/fwd.hpp" -# include "../strings/zstring.hpp" -# include "../strings/literal.hpp" +#include "../strings/zstring.hpp" +#include "../strings/literal.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" -# include "magic-interpreter.t.hpp" +#include "magic-interpreter.t.hpp" namespace tmwa @@ -90,7 +89,7 @@ void magic_random_location(location_t *dest, dumb_ptr<area_t> area); // ret -1: not a string, ret 1: no such item, ret 0: OK int magic_find_item(Slice<val_t> args, int index, Item *item, int *stackable); -# define GET_ARG_ITEM(index, dest, stackable) \ +#define GET_ARG_ITEM(index, dest, stackable) \ switch (magic_find_item(args, index, &dest, &stackable)) \ { \ case -1: return 1; \ @@ -108,5 +107,3 @@ int magic_signature_check(ZString opname, ZString funname, ZString signature, void magic_area_rect(map_local **m, int *x, int *y, int *width, int *height, area_t& area); } // namespace tmwa - -#endif // TMWA_MAP_MAGIC_EXPR_HPP diff --git a/src/map/magic-interpreter-base.hpp b/src/map/magic-interpreter-base.hpp index 2f10e72..57dde85 100644 --- a/src/map/magic-interpreter-base.hpp +++ b/src/map/magic-interpreter-base.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAGIC_INTERPRETER_BASE_HPP -#define TMWA_MAP_MAGIC_INTERPRETER_BASE_HPP +#pragma once // magic-interpreter-base.hpp - Core of the old magic system. // // Copyright © 2004-2011 The Mana World Development Team @@ -20,13 +19,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" namespace tmwa @@ -86,5 +85,3 @@ dumb_ptr<spell_t> magic_find_spell(XString invocation); void spell_update_location(dumb_ptr<invocation> invocation); } // namespace tmwa - -#endif // TMWA_MAP_MAGIC_INTERPRETER_BASE_HPP diff --git a/src/map/magic-interpreter.hpp b/src/map/magic-interpreter.hpp index 9b6025c..c9b6c97 100644 --- a/src/map/magic-interpreter.hpp +++ b/src/map/magic-interpreter.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAGIC_INTERPRETER_HPP -#define TMWA_MAP_MAGIC_INTERPRETER_HPP +#pragma once // magic-interpreter.hpp - Old magic. // // Copyright © 2004-2011 The Mana World Development Team @@ -20,27 +19,27 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "magic-interpreter.t.hpp" +#include "magic-interpreter.t.hpp" -# include <cassert> +#include <cassert> -# include <memory> +#include <memory> -# include "../strings/fwd.hpp" -# include "../strings/rstring.hpp" +#include "../strings/fwd.hpp" +#include "../strings/rstring.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../net/timer.t.hpp" +#include "../net/timer.t.hpp" -# include "../mmo/ids.hpp" -# include "../mmo/utils.hpp" +#include "../mmo/ids.hpp" +#include "../mmo/utils.hpp" -# include "map.hpp" -# include "script.hpp" -# include "skill.t.hpp" +#include "map.hpp" +#include "script.hpp" +#include "skill.t.hpp" namespace tmwa @@ -105,7 +104,7 @@ struct val_t /* Expressions */ /* ----------- */ -# define MAX_ARGS 7 /* Max. # of args used in builtin primitive functions */ +#define MAX_ARGS 7 /* Max. # of args used in builtin primitive functions */ struct e_location_t { @@ -311,15 +310,15 @@ struct magic_conf_t /* Execution environment */ // these are not an enum they're a nasty intern hack -# define VAR_MIN_CASTTIME 0 -# define VAR_OBSCURE_CHANCE 1 -# define VAR_CASTER 2 -# define VAR_SPELLPOWER 3 -# define VAR_SPELL 4 -# define VAR_INVOCATION 5 -# define VAR_TARGET 6 -# define VAR_SCRIPTTARGET 7 -# define VAR_LOCATION 8 +#define VAR_MIN_CASTTIME 0 +#define VAR_OBSCURE_CHANCE 1 +#define VAR_CASTER 2 +#define VAR_SPELLPOWER 3 +#define VAR_SPELL 4 +#define VAR_INVOCATION 5 +#define VAR_TARGET 6 +#define VAR_SCRIPTTARGET 7 +#define VAR_LOCATION 8 struct env_t { @@ -337,7 +336,7 @@ struct env_t }; -# define MAX_STACK_SIZE 32 +#define MAX_STACK_SIZE 32 struct cont_activation_record_t { @@ -428,5 +427,3 @@ struct proc_t {} }; } // namespace tmwa - -#endif // TMWA_MAP_MAGIC_INTERPRETER_HPP diff --git a/src/map/magic-interpreter.t.hpp b/src/map/magic-interpreter.t.hpp index addaf18..6c7ff81 100644 --- a/src/map/magic-interpreter.t.hpp +++ b/src/map/magic-interpreter.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAGIC_INTERPRETER_T_HPP -#define TMWA_MAP_MAGIC_INTERPRETER_T_HPP +#pragma once // magic-interpreter.t.hpp - Old magic. // // Copyright © 2004-2011 The Mana World Development Team @@ -20,9 +19,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" namespace tmwa @@ -148,5 +147,3 @@ ENUM_BITWISE_OPERATORS(INVOCATION_FLAG) } using e::INVOCATION_FLAG; } // namespace tmwa - -#endif // TMWA_MAP_MAGIC_INTERPRETER_T_HPP diff --git a/src/map/magic-stmt.hpp b/src/map/magic-stmt.hpp index 3050350..729562e 100644 --- a/src/map/magic-stmt.hpp +++ b/src/map/magic-stmt.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAGIC_STMT_HPP -#define TMWA_MAP_MAGIC_STMT_HPP +#pragma once // magic-stmt.hpp - Imperative commands for the magic backend. // // Copyright © 2004-2011 The Mana World Development Team @@ -20,15 +19,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../range/fwd.hpp" +#include "../range/fwd.hpp" -# include "../strings/zstring.hpp" +#include "../strings/zstring.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "skill.t.hpp" +#include "skill.t.hpp" namespace tmwa @@ -90,5 +89,3 @@ int spell_attack(BlockId caster, BlockId target); void spell_free_invocation(dumb_ptr<invocation> invocation); } // namespace tmwa - -#endif // TMWA_MAP_MAGIC_STMT_HPP diff --git a/src/map/magic-v2.hpp b/src/map/magic-v2.hpp index 9c357bc..07d467e 100644 --- a/src/map/magic-v2.hpp +++ b/src/map/magic-v2.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAGIC_V2_HPP -#define TMWA_MAP_MAGIC_V2_HPP +#pragma once // magic-v2.hpp - second generation magic parser // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/zstring.hpp" +#include "../strings/zstring.hpp" namespace tmwa @@ -30,5 +29,3 @@ bool magic_init0(); // must be called after itemdb initialization bool load_magic_file_v2(ZString filename); } // namespace tmwa - -#endif // TMWA_MAP_MAGIC_V2_HPP diff --git a/src/map/magic.hpp b/src/map/magic.hpp index 4df204f..e06e913 100644 --- a/src/map/magic.hpp +++ b/src/map/magic.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAGIC_HPP -#define TMWA_MAP_MAGIC_HPP +#pragma once // magic.hpp - Entry to the magic system. // // Copyright © 2004-2011 The Mana World Development Team @@ -20,14 +19,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "map.t.hpp" -# include "skill.t.hpp" +#include "map.t.hpp" +#include "skill.t.hpp" namespace tmwa @@ -45,5 +44,3 @@ namespace tmwa */ int magic_message(dumb_ptr<map_session_data> caster, XString source_invocation); } // namespace tmwa - -#endif // TMWA_MAP_MAGIC_HPP diff --git a/src/map/map.hpp b/src/map/map.hpp index af08ae4..e9a37b6 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAP_HPP -#define TMWA_MAP_MAP_HPP +#pragma once // map.hpp - Core of the map server. // // Copyright © ????-2004 Athena Dev Teams @@ -21,43 +20,43 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "map.t.hpp" +#include "map.t.hpp" -# include <chrono> -# include <functional> -# include <list> +#include <chrono> +#include <functional> +#include <list> -# include "../ints/udl.hpp" +#include "../ints/udl.hpp" -# include "../strings/fwd.hpp" -# include "../strings/rstring.hpp" -# include "../strings/astring.hpp" -# include "../strings/vstring.hpp" +#include "../strings/fwd.hpp" +#include "../strings/rstring.hpp" +#include "../strings/astring.hpp" +#include "../strings/vstring.hpp" -# include "../generic/db.hpp" -# include "../generic/dumb_ptr.hpp" -# include "../generic/matrix.hpp" +#include "../generic/db.hpp" +#include "../generic/dumb_ptr.hpp" +#include "../generic/matrix.hpp" -# include "../net/socket.hpp" -# include "../net/timer.t.hpp" +#include "../net/socket.hpp" +#include "../net/timer.t.hpp" -# include "../mmo/utils.hpp" +#include "../mmo/utils.hpp" -# include "battle.t.hpp" -# include "clif.t.hpp" -# include "mapflag.hpp" -# include "mob.t.hpp" -# include "script.hpp" // change to script.t.hpp -# include "skill.t.hpp" +#include "battle.t.hpp" +#include "clif.t.hpp" +#include "mapflag.hpp" +#include "mob.t.hpp" +#include "script.hpp" // change to script.t.hpp +#include "skill.t.hpp" namespace tmwa { constexpr int MAX_NPC_PER_MAP = 512; constexpr int BLOCK_SIZE = 8; -# define AREA_SIZE battle_config.area_size +#define AREA_SIZE battle_config.area_size constexpr std::chrono::seconds LIFETIME_FLOORITEM = std::chrono::minutes(1); constexpr int MAX_SKILL_LEVEL = 100; constexpr int MAX_EVENTTIMER = 32; @@ -608,10 +607,10 @@ void map_quit(dumb_ptr<map_session_data>); int map_addnpc(map_local *, dumb_ptr<npc_data>); void map_log(XString line); -# define MAP_LOG(format, ...) \ +#define MAP_LOG(format, ...) \ map_log(STRPRINTF(format, ## __VA_ARGS__)) -# define MAP_LOG_PC(sd, fmt, ...) \ +#define MAP_LOG_PC(sd, fmt, ...) \ MAP_LOG("PC%d %s:%d,%d " fmt, \ sd->status_key.char_id, (sd->bl_m ? sd->bl_m->name_ : stringish<MapName>("undefined.gat"_s)), sd->bl_x, sd->bl_y, ## __VA_ARGS__) @@ -724,5 +723,3 @@ inline dumb_ptr<npc_data_shop> npc_data::is_shop() { return npc_subtype == NpcSu inline dumb_ptr<npc_data_warp> npc_data::is_warp() { return npc_subtype == NpcSubtype::WARP ? as_warp() : nullptr ; } inline dumb_ptr<npc_data_message> npc_data::is_message() { return npc_subtype == NpcSubtype::MESSAGE ? as_message() : nullptr ; } } // namespace tmwa - -#endif // TMWA_MAP_MAP_HPP diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp index 79e9448..b475f9b 100644 --- a/src/map/map.t.hpp +++ b/src/map/map.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAP_T_HPP -#define TMWA_MAP_MAP_T_HPP +#pragma once // map.t.hpp - Core of the map server. // // Copyright © ????-2004 Athena Dev Teams @@ -21,16 +20,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../strings/vstring.hpp" +#include "../strings/vstring.hpp" -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" -# include "../mmo/ids.hpp" -# include "../mmo/mmo.hpp" +#include "../mmo/ids.hpp" +#include "../mmo/mmo.hpp" namespace tmwa @@ -202,5 +201,3 @@ BlockId account_to_block(AccountId a) { return wrap<BlockId>(unwrap<AccountId>(a inline AccountId block_to_account(BlockId b) { return wrap<AccountId>(unwrap<BlockId>(b)); } } // namespace tmwa - -#endif // TMWA_MAP_MAP_T_HPP diff --git a/src/map/mapflag.hpp b/src/map/mapflag.hpp index 1f42bc9..197d250 100644 --- a/src/map/mapflag.hpp +++ b/src/map/mapflag.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MAPFLAG_HPP -#define TMWA_MAP_MAPFLAG_HPP +#pragma once // mapflag.hpp - booleans that apply to an entire map // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../mmo/extract.hpp" // TODO remove this (requires specializing the *other* half) +#include "../mmo/extract.hpp" // TODO remove this (requires specializing the *other* half) namespace tmwa @@ -83,5 +82,3 @@ bool extract<MapFlag, void, void>(XString str, MapFlag *mf); MapFlag map_flag_from_int(int shift); } // namespace tmwa - -#endif // TMWA_MAP_MAPFLAG_HPP diff --git a/src/map/mob.hpp b/src/map/mob.hpp index 87b7d3f..d0cc07a 100644 --- a/src/map/mob.hpp +++ b/src/map/mob.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MOB_HPP -#define TMWA_MAP_MOB_HPP +#pragma once // mob.hpp - Really scary code. // // Copyright © ????-2004 Athena Dev Teams @@ -21,27 +20,27 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "mob.t.hpp" +#include "mob.t.hpp" -# include "../generic/fwd.hpp" -# include "../generic/enum.hpp" -# include "../generic/random.t.hpp" +#include "../generic/fwd.hpp" +#include "../generic/enum.hpp" +#include "../generic/random.t.hpp" -# include "../net/timer.t.hpp" +#include "../net/timer.t.hpp" -# include "battle.t.hpp" -# include "clif.t.hpp" -# include "map.hpp" -# include "skill.t.hpp" +#include "battle.t.hpp" +#include "clif.t.hpp" +#include "map.hpp" +#include "skill.t.hpp" namespace tmwa { -# define ENGLISH_NAME stringish<MobName>("--en--"_s) -# define JAPANESE_NAME stringish<MobName>("--ja--"_s) -# define MOB_THIS_MAP stringish<MapName>("this"_s) +#define ENGLISH_NAME stringish<MobName>("--en--"_s) +#define JAPANESE_NAME stringish<MobName>("--ja--"_s) +#define MOB_THIS_MAP stringish<MapName>("this"_s) struct mob_skill { @@ -138,5 +137,3 @@ int mob_summonslave(dumb_ptr<mob_data> md2, int *value, int amount, int flag); void mob_reload(void); } // namespace tmwa - -#endif // TMWA_MAP_MOB_HPP diff --git a/src/map/mob.t.hpp b/src/map/mob.t.hpp index b96fb09..160a8a3 100644 --- a/src/map/mob.t.hpp +++ b/src/map/mob.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_MOB_T_HPP -#define TMWA_MAP_MOB_T_HPP +#pragma once // mob.t.hpp - Really scary code. // // Copyright © ????-2004 Athena Dev Teams @@ -21,9 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> namespace tmwa @@ -63,5 +62,3 @@ enum class MobSkillState : uint8_t MSS_CHASE, }; } // namespace tmwa - -#endif // TMWA_MAP_MOB_T_HPP diff --git a/src/map/npc.hpp b/src/map/npc.hpp index d6d3b62..33dd378 100644 --- a/src/map/npc.hpp +++ b/src/map/npc.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_NPC_HPP -#define TMWA_MAP_NPC_HPP +#pragma once // npc.hpp - Noncombatants. // // Copyright © ????-2004 Athena Dev Teams @@ -21,19 +20,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../net/timer.t.hpp" +#include "../net/timer.t.hpp" -# include "../proto2/fwd.hpp" +#include "../proto2/fwd.hpp" -# include "map.hpp" +#include "map.hpp" namespace tmwa @@ -100,5 +99,3 @@ interval_t npc_gettimerevent_tick(dumb_ptr<npc_data_script> nd); void npc_settimerevent_tick(dumb_ptr<npc_data_script> nd, interval_t newtimer); int npc_delete(dumb_ptr<npc_data> nd); } // namespace tmwa - -#endif // TMWA_MAP_NPC_HPP diff --git a/src/map/party.hpp b/src/map/party.hpp index b1c1092..01a8125 100644 --- a/src/map/party.hpp +++ b/src/map/party.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_PARTY_HPP -#define TMWA_MAP_PARTY_HPP +#pragma once // party.hpp - Small groups of temporary allies. // // Copyright © ????-2004 Athena Dev Teams @@ -21,15 +20,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <functional> +#include <functional> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" namespace tmwa @@ -71,5 +70,3 @@ int party_exp_share(PartyPair p, map_local *map, int base_exp, int job_exp); void party_foreachsamemap(std::function<void(dumb_ptr<block_list>)> func, dumb_ptr<map_session_data> sd, int type); } // namespace tmwa - -#endif // TMWA_MAP_PARTY_HPP diff --git a/src/map/path.hpp b/src/map/path.hpp index 019a987..3619e2e 100644 --- a/src/map/path.hpp +++ b/src/map/path.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_PATH_HPP -#define TMWA_MAP_PATH_HPP +#pragma once // path.hpp - Pathfinding system. // // Copyright © ????-2004 Athena Dev Teams @@ -21,12 +20,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa { int path_search(struct walkpath_data *, map_local *, int, int, int, int, int); } // namespace tmwa - -#endif // TMWA_MAP_PATH_HPP diff --git a/src/map/pc.hpp b/src/map/pc.hpp index d40353b..3187cd9 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_PC_HPP -#define TMWA_MAP_PC_HPP +#pragma once // pc.hpp - Player state changes. // // Copyright © ????-2004 Athena Dev Teams @@ -21,20 +20,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "pc.t.hpp" +#include "pc.t.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/dumb_ptr.hpp" +#include "../generic/dumb_ptr.hpp" -# include "../mmo/utils.hpp" +#include "../mmo/utils.hpp" -# include "../proto2/fwd.hpp" +#include "../proto2/fwd.hpp" -# include "clif.t.hpp" -# include "map.hpp" +#include "clif.t.hpp" +#include "map.hpp" namespace tmwa @@ -186,5 +185,3 @@ void pc_show_motd(dumb_ptr<map_session_data> sd); void do_init_pc(void); } // namespace tmwa - -#endif // TMWA_MAP_PC_HPP diff --git a/src/map/pc.t.hpp b/src/map/pc.t.hpp index ec882ab..427e8c3 100644 --- a/src/map/pc.t.hpp +++ b/src/map/pc.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_PC_T_HPP -#define TMWA_MAP_PC_T_HPP +#pragma once // pc.t.hpp - Player state changes. // // Copyright © ????-2004 Athena Dev Teams @@ -22,9 +21,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> namespace tmwa @@ -56,5 +55,3 @@ enum class CalcStatus LATER, }; } // namespace tmwa - -#endif // TMWA_MAP_PC_T_HPP diff --git a/src/map/script.hpp b/src/map/script.hpp index 4d6e8df..ee9a5a9 100644 --- a/src/map/script.hpp +++ b/src/map/script.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_SCRIPT_HPP -#define TMWA_MAP_SCRIPT_HPP +#pragma once // script.hpp - EAthena script frontend, engine, and library. // // Copyright © ????-2004 Athena Dev Teams @@ -21,23 +20,23 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include <vector> +#include <vector> -# include "../range/slice.hpp" +#include "../range/slice.hpp" -# include "../strings/zstring.hpp" +#include "../strings/zstring.hpp" -# include "../generic/db.hpp" -# include "../generic/dumb_ptr.hpp" +#include "../generic/db.hpp" +#include "../generic/dumb_ptr.hpp" -# include "../mmo/ids.hpp" +#include "../mmo/ids.hpp" -# include "clif.t.hpp" -# include "map.t.hpp" +#include "clif.t.hpp" +#include "map.t.hpp" namespace tmwa @@ -201,5 +200,3 @@ void set_script_var_s(dumb_ptr<map_session_data> sd, VarName var, int e, XString int get_script_var_i(dumb_ptr<map_session_data> sd, VarName var, int e); ZString get_script_var_s(dumb_ptr<map_session_data> sd, VarName var, int e); } // namespace tmwa - -#endif // TMWA_MAP_SCRIPT_HPP diff --git a/src/map/skill-pools.hpp b/src/map/skill-pools.hpp index d75d344..c8890e8 100644 --- a/src/map/skill-pools.hpp +++ b/src/map/skill-pools.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_SKILL_POOLS_HPP -#define TMWA_MAP_SKILL_POOLS_HPP +#pragma once // skill-pools.hpp - dummy header to make Make dependencies work. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa { } // namespace tmwa - -#endif // TMWA_MAP_SKILL_POOLS_HPP diff --git a/src/map/skill.hpp b/src/map/skill.hpp index bdaf184..ec353ce 100644 --- a/src/map/skill.hpp +++ b/src/map/skill.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_SKILL_HPP -#define TMWA_MAP_SKILL_HPP +#pragma once // skill.hpp - Old-style skills. // // Copyright © ????-2004 Athena Dev Teams @@ -21,19 +20,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "skill.t.hpp" -# include "skill-pools.hpp" +#include "skill.t.hpp" +#include "skill-pools.hpp" -# include "../strings/fwd.hpp" -# include "../strings/rstring.hpp" -# include "../strings/literal.hpp" +#include "../strings/fwd.hpp" +#include "../strings/rstring.hpp" +#include "../strings/literal.hpp" -# include "../generic/fwd.hpp" -# include "../generic/array.hpp" +#include "../generic/fwd.hpp" +#include "../generic/array.hpp" -# include "map.hpp" +#include "map.hpp" namespace tmwa @@ -168,5 +167,3 @@ int skill_power_bl(dumb_ptr<block_list> bl, SkillID skill); // [Fate] Remember that a certain skill ID belongs to a pool skill void skill_pool_register(SkillID id); } // namespace tmwa - -#endif // TMWA_MAP_SKILL_HPP diff --git a/src/map/skill.t.hpp b/src/map/skill.t.hpp index 014080b..d0e3926 100644 --- a/src/map/skill.t.hpp +++ b/src/map/skill.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_SKILL_T_HPP -#define TMWA_MAP_SKILL_T_HPP +#pragma once // skill.t.hpp - Old-style skills. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" namespace tmwa @@ -135,5 +134,3 @@ ENUM_BITWISE_OPERATORS(SkillFlags) } using e::SkillFlags; } // namespace tmwa - -#endif // TMWA_MAP_SKILL_T_HPP diff --git a/src/map/storage.hpp b/src/map/storage.hpp index cb9cbc5..f3875c8 100644 --- a/src/map/storage.hpp +++ b/src/map/storage.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_STORAGE_HPP -#define TMWA_MAP_STORAGE_HPP +#pragma once // storage.hpp - Storage handling. // // Copyright © ????-2004 Athena Dev Teams @@ -21,13 +20,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "../mmo/fwd.hpp" +#include "../mmo/fwd.hpp" -# include "clif.t.hpp" +#include "clif.t.hpp" namespace tmwa @@ -43,5 +42,3 @@ int storage_storage_quit(dumb_ptr<map_session_data> sd); int storage_storage_save(AccountId account_id, int final); int storage_storage_saved(AccountId account_id); } // namespace tmwa - -#endif // TMWA_MAP_STORAGE_HPP diff --git a/src/map/tmw.hpp b/src/map/tmw.hpp index 610c80c..ffd6f7f 100644 --- a/src/map/tmw.hpp +++ b/src/map/tmw.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_TMW_HPP -#define TMWA_MAP_TMW_HPP +#pragma once // tmw.hpp - Some random functions added by TMW. // // Copyright © 2004-2011 The Mana World Development Team @@ -20,11 +19,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" namespace tmwa @@ -32,5 +31,3 @@ namespace tmwa int tmw_CheckChatSpam(dumb_ptr<map_session_data> sd, XString message); void tmw_GmHackMsg(ZString line); } // namespace tmwa - -#endif // TMWA_MAP_TMW_HPP diff --git a/src/map/trade.hpp b/src/map/trade.hpp index b9fce57..91ed954 100644 --- a/src/map/trade.hpp +++ b/src/map/trade.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MAP_TRADE_HPP -#define TMWA_MAP_TRADE_HPP +#pragma once // trade.hpp - Inter-player item and money transactions. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../generic/fwd.hpp" +#include "../generic/fwd.hpp" -# include "clif.t.hpp" +#include "clif.t.hpp" namespace tmwa @@ -38,5 +37,3 @@ void trade_tradecancel(dumb_ptr<map_session_data> sd); void trade_tradecommit(dumb_ptr<map_session_data> sd); void trade_verifyzeny(dumb_ptr<map_session_data> sd); } // namespace tmwa - -#endif // TMWA_MAP_TRADE_HPP diff --git a/src/mmo/config_parse.hpp b/src/mmo/config_parse.hpp index 5389b5d..50a115e 100644 --- a/src/mmo/config_parse.hpp +++ b/src/mmo/config_parse.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_CONFIG_PARSE_HPP -#define TMWA_MMO_CONFIG_PARSE_HPP +#pragma once // config_parse.hpp - Framework for per-server config parsers. // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa @@ -36,5 +35,3 @@ bool config_split(XString line, XString *key, XString *value); /// Then it defers to the inferior parser for a line it does not understand. bool load_config_file(ZString filename, ConfigItemParser slave); } // namespace tmwa - -#endif // TMWA_MMO_CONFIG_PARSE_HPP diff --git a/src/mmo/consts.hpp b/src/mmo/consts.hpp index 0fdd7de..2a20cff 100644 --- a/src/mmo/consts.hpp +++ b/src/mmo/consts.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_CONSTS_HPP -#define TMWA_MMO_CONSTS_HPP +#pragma once // consts.hpp - Huge mess of constants. // // Copyright © ????-2004 Athena Dev Teams @@ -21,12 +20,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../net/timer.t.hpp" +#include "../net/timer.t.hpp" -# include "ids.hpp" -# include "strs.hpp" +#include "ids.hpp" +#include "strs.hpp" namespace tmwa @@ -48,12 +47,12 @@ constexpr interval_t MAX_WALK_SPEED = std::chrono::seconds(1); constexpr int MAX_STORAGE = 300; constexpr int MAX_PARTY = 12; -# define MIN_HAIR_STYLE battle_config.min_hair_style -# define MAX_HAIR_STYLE battle_config.max_hair_style -# define MIN_HAIR_COLOR battle_config.min_hair_color -# define MAX_HAIR_COLOR battle_config.max_hair_color -# define MIN_CLOTH_COLOR battle_config.min_cloth_color -# define MAX_CLOTH_COLOR battle_config.max_cloth_color +#define MIN_HAIR_STYLE battle_config.min_hair_style +#define MAX_HAIR_STYLE battle_config.max_hair_style +#define MIN_HAIR_COLOR battle_config.min_hair_color +#define MAX_HAIR_COLOR battle_config.max_hair_color +#define MIN_CLOTH_COLOR battle_config.min_cloth_color +#define MAX_CLOTH_COLOR battle_config.max_cloth_color // WTF is this doing here? struct PartyMember @@ -65,5 +64,3 @@ struct PartyMember struct map_session_data *sd; }; } // namespace tmwa - -#endif // TMWA_MMO_CONSTS_HPP diff --git a/src/mmo/core.hpp b/src/mmo/core.hpp index e9ffab6..5b2dbbb 100644 --- a/src/mmo/core.hpp +++ b/src/mmo/core.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_CORE_HPP -#define TMWA_MMO_CORE_HPP +#pragma once // core.hpp - The main loop. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../range/slice.hpp" +#include "../range/slice.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa @@ -44,5 +43,3 @@ extern int do_init(Slice<ZString>); /// or when if we manage to exit() gracefully. extern void term_func(void); } // namespace tmwa - -#endif // TMWA_MMO_CORE_HPP diff --git a/src/mmo/enums.hpp b/src/mmo/enums.hpp index 62ce8ee..bf8a75c 100644 --- a/src/mmo/enums.hpp +++ b/src/mmo/enums.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_ENUMS_HPP -#define TMWA_MMO_ENUMS_HPP +#pragma once // enums.hpp - Common enumerated types // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" namespace tmwa @@ -161,5 +160,3 @@ bool network_to_native(SEX *native, char network) return true; } } // namespace tmwa - -#endif // TMWA_MMO_ENUMS_HPP diff --git a/src/mmo/extract.hpp b/src/mmo/extract.hpp index 16b3cf1..355e2da 100644 --- a/src/mmo/extract.hpp +++ b/src/mmo/extract.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_EXTRACT_HPP -#define TMWA_MMO_EXTRACT_HPP +#pragma once // extract.hpp - a simple, hierarchical, tokenizer // // Copyright © 2012-2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,21 +18,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cerrno> -# include <cstdlib> +#include <cerrno> +#include <cstdlib> -# include <algorithm> -# include <vector> +#include <algorithm> +#include <vector> -# include "../ints/wrap.hpp" +#include "../ints/wrap.hpp" -# include "../strings/xstring.hpp" +#include "../strings/xstring.hpp" -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" -# include "utils.hpp" +#include "utils.hpp" namespace tmwa @@ -231,5 +230,3 @@ bool extract(XString str, Wrapped<R> *w) return extract(str, &w->_value); } } // namespace tmwa - -#endif // TMWA_MMO_EXTRACT_HPP diff --git a/src/mmo/fwd.hpp b/src/mmo/fwd.hpp index 379b370..3b56bfb 100644 --- a/src/mmo/fwd.hpp +++ b/src/mmo/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_FWD_HPP -#define TMWA_MMO_FWD_HPP +#pragma once // mmo/fwd.hpp - list of type names for mmo lib // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa @@ -49,23 +48,21 @@ class MapName; class CharName; class Item; -# if 0 +#if 0 class Point; class SkillValue; -# endif +#endif class GlobalReg; -# if 0 +#if 0 class CharKey; class CharData; class CharPair; -# endif +#endif class Storage; -# if 0 +#if 0 class GM_Account; class PartyMember; -# endif +#endif class PartyMost; class PartyPair; } // namespace tmwa - -#endif // TMWA_MMO_FWD_HPP diff --git a/src/mmo/human_time_diff.hpp b/src/mmo/human_time_diff.hpp index 3fd044d..b5c19fb 100644 --- a/src/mmo/human_time_diff.hpp +++ b/src/mmo/human_time_diff.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_HUMAN_TIME_DIFF_HPP -#define TMWA_MMO_HUMAN_TIME_DIFF_HPP +#pragma once // human_time_diff.hpp - broken deltas // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,13 +18,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <algorithm> +#include <algorithm> -# include "../strings/xstring.hpp" +#include "../strings/xstring.hpp" -# include "extract.hpp" +#include "extract.hpp" namespace tmwa @@ -88,5 +87,3 @@ bool extract(XString str, HumanTimeDiff *iv) return true; } } // namespace tmwa - -#endif // TMWA_MMO_HUMAN_TIME_DIFF_HPP diff --git a/src/mmo/ids.hpp b/src/mmo/ids.hpp index 4225103..4e2b97c 100644 --- a/src/mmo/ids.hpp +++ b/src/mmo/ids.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_IDS_HPP -#define TMWA_MMO_IDS_HPP +#pragma once // ids.hpp - special integer classes for various object IDs // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../ints/little.hpp" -# include "../ints/wrap.hpp" +#include "../ints/little.hpp" +#include "../ints/wrap.hpp" -# include "extract.hpp" +#include "extract.hpp" namespace tmwa @@ -167,5 +166,3 @@ uint32_t convert_for_printf(GmLevel g) return g.get_all_bits(); } } // namespace tmwa - -#endif // TMWA_MMO_IDS_HPP diff --git a/src/mmo/md5more.hpp b/src/mmo/md5more.hpp index f2bc9d0..7d50713 100644 --- a/src/mmo/md5more.hpp +++ b/src/mmo/md5more.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_MD5MORE_HPP -#define TMWA_MMO_MD5MORE_HPP +#pragma once // md5more.hpp - Non-basic MD5 functions. // // Copyright © ????-2004 Athena Dev Teams @@ -21,13 +20,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../generic/md5.hpp" +#include "../generic/md5.hpp" -# include "../io/fwd.hpp" +#include "../io/fwd.hpp" -# include "../net/fwd.hpp" +#include "../net/fwd.hpp" namespace tmwa @@ -47,5 +46,3 @@ bool pass_ok(AccountPass password, AccountCrypt crypted); /// This returns an IP4Address because it is configurable whether it gets called at all IP4Address MD5_ip(IP4Address ip); } // namespace tmwa - -#endif // TMWA_MMO_MD5MORE_HPP diff --git a/src/mmo/mmo.hpp b/src/mmo/mmo.hpp index 8e92ecb..cfa278d 100644 --- a/src/mmo/mmo.hpp +++ b/src/mmo/mmo.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_MMO_HPP -#define TMWA_MMO_MMO_HPP +#pragma once // mmo.hpp - Huge mess of structures. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../compat/memory.hpp" +#include "../compat/memory.hpp" -# include "../proto2/types.hpp" +#include "../proto2/types.hpp" namespace tmwa @@ -68,5 +67,3 @@ struct PartyPair PartyMost *operator->() const { return party_most; } }; } // namespace tmwa - -#endif // TMWA_MMO_MMO_HPP diff --git a/src/mmo/strs.hpp b/src/mmo/strs.hpp index 16e524a..fea0c98 100644 --- a/src/mmo/strs.hpp +++ b/src/mmo/strs.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_STRS_HPP -#define TMWA_MMO_STRS_HPP +#pragma once // strs.hpp - common string types // // Copyright © ????-2004 Athena Dev Teams @@ -21,15 +20,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/vstring.hpp" +#include "../strings/vstring.hpp" namespace tmwa { // affects CharName -# define NAME_IGNORING_CASE 1 +#define NAME_IGNORING_CASE 1 struct AccountName : VString<23> {}; struct AccountPass : VString<23> {}; @@ -39,7 +38,7 @@ struct ServerName : VString<19> {}; struct PartyName : VString<23> {}; struct VarName : VString<31> {}; -# define DEFAULT_EMAIL stringish<AccountEmail>("a@a.com"_s) +#define DEFAULT_EMAIL stringish<AccountEmail>("a@a.com"_s) // It is decreed: a mapname shall not contain an extension class MapName : public strings::_crtp_string<MapName, MapName, strings::ZPair> @@ -94,12 +93,12 @@ public: } VString<23> to__canonical() const { -# if NAME_IGNORING_CASE == 0 +#if NAME_IGNORING_CASE == 0 return to__actual(); -# endif -# if NAME_IGNORING_CASE == 1 +#endif +#if NAME_IGNORING_CASE == 1 return to__lower(); -# endif +#endif } friend bool operator == (const CharName& l, const CharName& r) @@ -125,5 +124,3 @@ CharName stringish<CharName>(VString<23> iv) return CharName(iv); } } // namespace tmwa - -#endif // TMWA_MMO_STRS_HPP diff --git a/src/mmo/utils.hpp b/src/mmo/utils.hpp index 95c89fc..fc3ea74 100644 --- a/src/mmo/utils.hpp +++ b/src/mmo/utils.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_UTILS_HPP -#define TMWA_MMO_UTILS_HPP +#pragma once // utils.hpp - Useful stuff that hasn't been categorized. // // Copyright © ????-2004 Athena Dev Teams @@ -21,21 +20,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstring> -# include <ctime> +#include <cstring> +#include <ctime> -# include <type_traits> +#include <type_traits> -# include "../ints/little.hpp" +#include "../ints/little.hpp" -# include "../strings/fwd.hpp" -# include "../strings/vstring.hpp" +#include "../strings/fwd.hpp" +#include "../strings/vstring.hpp" -# include "../generic/operators.hpp" +#include "../generic/operators.hpp" -# include "../io/fwd.hpp" +#include "../io/fwd.hpp" namespace tmwa @@ -149,16 +148,16 @@ void stamp_time(timestamp_milliseconds_buffer&); void log_with_timestamp(io::WriteFile& out, XString line); // TODO VString? -# define TIMESTAMP_DUMMY "YYYY-MM-DD HH:MM:SS" +#define TIMESTAMP_DUMMY "YYYY-MM-DD HH:MM:SS" static_assert(sizeof(TIMESTAMP_DUMMY) == sizeof(timestamp_seconds_buffer), "timestamp size"); -# define WITH_TIMESTAMP(str) str TIMESTAMP_DUMMY +#define WITH_TIMESTAMP(str) str TIMESTAMP_DUMMY // str: prefix: YYYY-MM-DD HH:MM:SS // sizeof: 01234567890123456789012345678 // str + sizeof: ^ // -1: ^ // there's probably a better way to do this now -# define REPLACE_TIMESTAMP(str, t) \ +#define REPLACE_TIMESTAMP(str, t) \ stamp_time( \ reinterpret_cast<timestamp_seconds_buffer *>( \ str + sizeof(str) \ @@ -166,5 +165,3 @@ static_assert(sizeof(TIMESTAMP_DUMMY) == sizeof(timestamp_seconds_buffer), &t \ ) } // namespace tmwa - -#endif // TMWA_MMO_UTILS_HPP diff --git a/src/mmo/version.hpp b/src/mmo/version.hpp index 634c27f..440dce6 100644 --- a/src/mmo/version.hpp +++ b/src/mmo/version.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_VERSION_HPP -#define TMWA_MMO_VERSION_HPP +#pragma once // version.hpp - Prevent mass rebuild when conf/version.hpp changes. // // Copyright © ????-2004 Athena Dev Teams @@ -21,22 +20,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdint> +#include <cstdint> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa { // TODO make these bitwise enums -# define TMWA_FLAG_REGISTRATION 0x01 +#define TMWA_FLAG_REGISTRATION 0x01 -# define TMWA_SERVER_LOGIN 0x01 -# define TMWA_SERVER_CHAR 0x02 -# define TMWA_SERVER_INTER 0x04 -# define TMWA_SERVER_MAP 0x08 +#define TMWA_SERVER_LOGIN 0x01 +#define TMWA_SERVER_CHAR 0x02 +#define TMWA_SERVER_INTER 0x04 +#define TMWA_SERVER_MAP 0x08 // TODO now that I generate the protocol, split 'flags' out of the struct struct Version @@ -92,5 +91,3 @@ extern LString CURRENT_VERSION_STRING; bool extract(XString str, Version *vers); } // namespace tmwa - -#endif // TMWA_MMO_VERSION_HPP diff --git a/src/net/fwd.hpp b/src/net/fwd.hpp index 2438ccf..2097772 100644 --- a/src/net/fwd.hpp +++ b/src/net/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_NET_FWD_HPP -#define TMWA_NET_FWD_HPP +#pragma once // net/fwd.hpp - list of type names for net lib // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa @@ -32,5 +31,3 @@ class TimerData; enum class RecvResult; } // namespace tmwa - -#endif // TMWA_NET_FWD_HPP diff --git a/src/net/ip.hpp b/src/net/ip.hpp index 9afc691..e9e71f4 100644 --- a/src/net/ip.hpp +++ b/src/net/ip.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_NET_IP_HPP -#define TMWA_NET_IP_HPP +#pragma once // ip.hpp - classes to deal with IP addresses. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,14 +18,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <netinet/in.h> +#include <netinet/in.h> -# include <cstddef> -# include <cstdint> +#include <cstddef> +#include <cstdint> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa @@ -165,5 +164,3 @@ bool extract(XString str, IP4Address *iv); bool extract(XString str, IP4Mask *iv); } // namespace tmwa - -#endif // TMWA_NET_IP_HPP diff --git a/src/net/packets.hpp b/src/net/packets.hpp index e025a63..5cc377c 100644 --- a/src/net/packets.hpp +++ b/src/net/packets.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_NET_PACKETS_HPP -#define TMWA_NET_PACKETS_HPP +#pragma once // packets.hpp - palatable socket buffer accessors // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,20 +18,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <vector> +#include <vector> -# include "../compat/cast.hpp" +#include "../compat/cast.hpp" -# include "../ints/little.hpp" +#include "../ints/little.hpp" -# include "../io/fwd.hpp" +#include "../io/fwd.hpp" // TODO ordering violation, should invert -# include "../proto2/fwd.hpp" +#include "../proto2/fwd.hpp" -# include "socket.hpp" +#include "socket.hpp" namespace tmwa @@ -584,5 +583,3 @@ RecvResult recv_packet_repeatonly(Session *s, AString& repeat) return recv_vpacket<id, 4, repeatsize>(s, head, repeat); } } // namespace tmwa - -#endif // TMWA_NET_PACKETS_HPP diff --git a/src/net/socket.hpp b/src/net/socket.hpp index 64eaf1a..576ef85 100644 --- a/src/net/socket.hpp +++ b/src/net/socket.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_NET_SOCKET_HPP -#define TMWA_NET_SOCKET_HPP +#pragma once // socket.hpp - Network event system. // // Copyright © ????-2004 Athena Dev Teams @@ -21,28 +20,28 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <algorithm> +#include <algorithm> -# include <sys/select.h> +#include <sys/select.h> -# include <memory> +#include <memory> -# include "../compat/iter.hpp" -# include "../compat/rawmem.hpp" -# include "../compat/time_t.hpp" +#include "../compat/iter.hpp" +#include "../compat/rawmem.hpp" +#include "../compat/time_t.hpp" -# include "../strings/astring.hpp" -# include "../strings/vstring.hpp" -# include "../strings/xstring.hpp" +#include "../strings/astring.hpp" +#include "../strings/vstring.hpp" +#include "../strings/xstring.hpp" -# include "../generic/dumb_ptr.hpp" +#include "../generic/dumb_ptr.hpp" -# include "../io/fd.hpp" +#include "../io/fd.hpp" -# include "ip.hpp" -# include "timer.t.hpp" +#include "ip.hpp" +#include "timer.t.hpp" namespace tmwa @@ -176,5 +175,3 @@ void do_sendrecv(interval_t next); /// Call the parser function for every socket that has read data void do_parsepacket(void); } // namespace tmwa - -#endif // TMWA_NET_SOCKET_HPP diff --git a/src/net/timer.hpp b/src/net/timer.hpp index beda3bf..338e339 100644 --- a/src/net/timer.hpp +++ b/src/net/timer.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_NET_TIMER_HPP -#define TMWA_NET_TIMER_HPP +#pragma once // timer.hpp - Future event scheduler. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "timer.t.hpp" +#include "timer.t.hpp" -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa @@ -50,5 +49,3 @@ tick_t file_modified(ZString name); /// Check if there are any events at all scheduled. bool has_timers(); } // namespace tmwa - -#endif // TMWA_NET_TIMER_HPP diff --git a/src/net/timer.t.hpp b/src/net/timer.t.hpp index 5961f51..e983e07 100644 --- a/src/net/timer.t.hpp +++ b/src/net/timer.t.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_NET_TIMER_T_HPP -#define TMWA_NET_TIMER_T_HPP +#pragma once // timer.t.hpp - Future event scheduler. // // Copyright © ????-2004 Athena Dev Teams @@ -21,16 +20,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdlib> +#include <cstdlib> -# include <chrono> -# include <functional> +#include <chrono> +#include <functional> -# include "../ints/little.hpp" +#include "../ints/little.hpp" -# include "../generic/dumb_ptr.hpp" +#include "../generic/dumb_ptr.hpp" namespace tmwa @@ -141,5 +140,3 @@ public: bool operator !() { return !td; } }; } // namespace tmwa - -#endif // TMWA_NET_TIMER_T_HPP diff --git a/src/poison.hpp b/src/poison.hpp index 27707b3..6903e1a 100644 --- a/src/poison.hpp +++ b/src/poison.hpp @@ -1,4 +1,4 @@ -#ifndef GENERATING_DEPENDENCIES +#pragma once // poison.hpp - List of dangerous functions and objects. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -23,6 +23,7 @@ namespace tmwa { +#ifndef GENERATING_DEPENDENCIES // impossible(*) to use safely // removed in C11 # pragma GCC poison gets @@ -119,6 +120,5 @@ namespace tmwa # pragma GCC poison ifstream # pragma GCC poison ofstream # pragma GCC poison fstream -} // namespace tmwa - #endif // GENERATING_DEPENDENCIES +} // namespace tmwa diff --git a/src/proto2/any-user.hpp b/src/proto2/any-user.hpp index be77b21..aeb703b 100644 --- a/src/proto2/any-user.hpp +++ b/src/proto2/any-user.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_ANY_USER_HPP -#define TMWA_PROTO2_ANY_USER_HPP +#pragma once // any-user.hpp - TMWA network protocol: any/user // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -21,9 +20,9 @@ // This is a generated file, edit tools/protocol.py instead -# include "fwd.hpp" +#include "fwd.hpp" -# include "types.hpp" +#include "types.hpp" namespace tmwa { @@ -213,5 +212,3 @@ bool network_to_native(Packet_Payload<0x8000> *native, NetPacket_Payload<0x8000> } } // namespace tmwa - -#endif // TMWA_PROTO2_ANY_USER_HPP diff --git a/src/proto2/char-map.hpp b/src/proto2/char-map.hpp index bd16099..23798b2 100644 --- a/src/proto2/char-map.hpp +++ b/src/proto2/char-map.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_CHAR_MAP_HPP -#define TMWA_PROTO2_CHAR_MAP_HPP +#pragma once // char-map.hpp - TMWA network protocol: char/map // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -21,9 +20,9 @@ // This is a generated file, edit tools/protocol.py instead -# include "fwd.hpp" +#include "fwd.hpp" -# include "types.hpp" +#include "types.hpp" namespace tmwa { @@ -3535,5 +3534,3 @@ bool network_to_native(Packet_Repeat<0x3827> *native, NetPacket_Repeat<0x3827> n } } // namespace tmwa - -#endif // TMWA_PROTO2_CHAR_MAP_HPP diff --git a/src/proto2/char-user.hpp b/src/proto2/char-user.hpp index 89d19de..ed58d69 100644 --- a/src/proto2/char-user.hpp +++ b/src/proto2/char-user.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_CHAR_USER_HPP -#define TMWA_PROTO2_CHAR_USER_HPP +#pragma once // char-user.hpp - TMWA network protocol: char/user // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -21,9 +20,9 @@ // This is a generated file, edit tools/protocol.py instead -# include "fwd.hpp" +#include "fwd.hpp" -# include "types.hpp" +#include "types.hpp" namespace tmwa { @@ -621,5 +620,3 @@ bool network_to_native(Packet_Fixed<0x0071> *native, NetPacket_Fixed<0x0071> net } } // namespace tmwa - -#endif // TMWA_PROTO2_CHAR_USER_HPP diff --git a/src/proto2/fwd.hpp b/src/proto2/fwd.hpp index 82d917d..6077913 100644 --- a/src/proto2/fwd.hpp +++ b/src/proto2/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_FWD_HPP -#define TMWA_PROTO2_FWD_HPP +#pragma once // proto2/fwd.hpp - Forward declarations of network packets // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" -# include <cstdint> +#include <cstdint> namespace tmwa { @@ -1722,5 +1721,3 @@ struct NetPacket_Payload<0x8000>; } // namespace tmwa - -#endif // TMWA_PROTO2_FWD_HPP diff --git a/src/proto2/login-admin.hpp b/src/proto2/login-admin.hpp index f4965d0..9d5fb5e 100644 --- a/src/proto2/login-admin.hpp +++ b/src/proto2/login-admin.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_LOGIN_ADMIN_HPP -#define TMWA_PROTO2_LOGIN_ADMIN_HPP +#pragma once // login-admin.hpp - TMWA network protocol: login/admin // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -21,9 +20,9 @@ // This is a generated file, edit tools/protocol.py instead -# include "fwd.hpp" +#include "fwd.hpp" -# include "types.hpp" +#include "types.hpp" namespace tmwa { @@ -2217,5 +2216,3 @@ bool network_to_native(Packet_Fixed<0x7955> *native, NetPacket_Fixed<0x7955> net } } // namespace tmwa - -#endif // TMWA_PROTO2_LOGIN_ADMIN_HPP diff --git a/src/proto2/login-char.hpp b/src/proto2/login-char.hpp index 6b96a03..6bd939c 100644 --- a/src/proto2/login-char.hpp +++ b/src/proto2/login-char.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_LOGIN_CHAR_HPP -#define TMWA_PROTO2_LOGIN_CHAR_HPP +#pragma once // login-char.hpp - TMWA network protocol: login/char // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -21,9 +20,9 @@ // This is a generated file, edit tools/protocol.py instead -# include "fwd.hpp" +#include "fwd.hpp" -# include "types.hpp" +#include "types.hpp" namespace tmwa { @@ -1234,5 +1233,3 @@ bool network_to_native(Packet_Fixed<0x2741> *native, NetPacket_Fixed<0x2741> net } } // namespace tmwa - -#endif // TMWA_PROTO2_LOGIN_CHAR_HPP diff --git a/src/proto2/login-user.hpp b/src/proto2/login-user.hpp index 822d224..fb6fcc7 100644 --- a/src/proto2/login-user.hpp +++ b/src/proto2/login-user.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_LOGIN_USER_HPP -#define TMWA_PROTO2_LOGIN_USER_HPP +#pragma once // login-user.hpp - TMWA network protocol: login/user // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -21,9 +20,9 @@ // This is a generated file, edit tools/protocol.py instead -# include "fwd.hpp" +#include "fwd.hpp" -# include "types.hpp" +#include "types.hpp" namespace tmwa { @@ -324,5 +323,3 @@ bool network_to_native(Packet_Fixed<0x006a> *native, NetPacket_Fixed<0x006a> net } } // namespace tmwa - -#endif // TMWA_PROTO2_LOGIN_USER_HPP diff --git a/src/proto2/map-user.hpp b/src/proto2/map-user.hpp index efeb0bc..630c4f2 100644 --- a/src/proto2/map-user.hpp +++ b/src/proto2/map-user.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_MAP_USER_HPP -#define TMWA_PROTO2_MAP_USER_HPP +#pragma once // map-user.hpp - TMWA network protocol: map/user // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -21,9 +20,9 @@ // This is a generated file, edit tools/protocol.py instead -# include "fwd.hpp" +#include "fwd.hpp" -# include "types.hpp" +#include "types.hpp" namespace tmwa { @@ -7930,5 +7929,3 @@ bool network_to_native(Packet_Fixed<0x0212> *native, NetPacket_Fixed<0x0212> net } } // namespace tmwa - -#endif // TMWA_PROTO2_MAP_USER_HPP diff --git a/src/proto2/types.hpp b/src/proto2/types.hpp index bd13114..c6581d8 100644 --- a/src/proto2/types.hpp +++ b/src/proto2/types.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_PROTO2_TYPES_HPP -#define TMWA_PROTO2_TYPES_HPP +#pragma once // proto2/types.hpp - Forward declarations of packet component types // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,27 +18,27 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "../generic/array.hpp" -# include "../mmo/consts.hpp" +#include "../generic/array.hpp" +#include "../mmo/consts.hpp" //TODO split the includes -# include <cstdint> -# include "../ints/little.hpp" -# include "../strings/vstring.hpp" -# include "../net/ip.hpp" -# include "../net/timer.t.hpp" -# include "../mmo/consts.hpp" -# include "../mmo/enums.hpp" -# include "../mmo/human_time_diff.hpp" -# include "../mmo/ids.hpp" -# include "../mmo/strs.hpp" -# include "../mmo/utils.hpp" -# include "../mmo/version.hpp" -# include "../login/login.t.hpp" -# include "../map/clif.t.hpp" -# include "../map/skill.t.hpp" +#include <cstdint> +#include "../ints/little.hpp" +#include "../strings/vstring.hpp" +#include "../net/ip.hpp" +#include "../net/timer.t.hpp" +#include "../mmo/consts.hpp" +#include "../mmo/enums.hpp" +#include "../mmo/human_time_diff.hpp" +#include "../mmo/ids.hpp" +#include "../mmo/strs.hpp" +#include "../mmo/utils.hpp" +#include "../mmo/version.hpp" +#include "../login/login.t.hpp" +#include "../map/clif.t.hpp" +#include "../map/skill.t.hpp" namespace tmwa { @@ -1420,5 +1419,3 @@ bool network_to_native(Storage *native, NetStorage network) } } // namespace tmwa - -#endif // TMWA_PROTO2_TYPES_HPP diff --git a/src/range/fwd.hpp b/src/range/fwd.hpp index 65fd010..646eadb 100644 --- a/src/range/fwd.hpp +++ b/src/range/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_RANGE_FWD_HPP -#define TMWA_RANGE_FWD_HPP +#pragma once // range/fwd.hpp - list of type names for range lib // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa @@ -28,5 +27,3 @@ namespace tmwa template<class T> class Slice; } // namespace tmwa - -#endif // TMWA_RANGE_FWD_HPP diff --git a/src/range/slice.hpp b/src/range/slice.hpp index 8cd9203..da52e5f 100644 --- a/src/range/slice.hpp +++ b/src/range/slice.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_GENERIC_SLICE_HPP -#define TMWA_GENERIC_SLICE_HPP +#pragma once // slice.hpp - a borrowed array // // Copyright © 2011-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstddef> +#include <cstddef> -# include <type_traits> -# include <vector> +#include <type_traits> +#include <vector> namespace tmwa @@ -72,6 +71,4 @@ public: }; } // namespace tmwa -# include "slice.tcc" - -#endif // TMWA_GENERIC_SLICE_HPP +#include "slice.tcc" diff --git a/src/sanity.hpp b/src/sanity.hpp index eb4a412..c00d9b2 100644 --- a/src/sanity.hpp +++ b/src/sanity.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_SANITY_HPP -#define TMWA_SANITY_HPP +#pragma once // sanity.hpp - Keep spatulas out of the build environment. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -24,30 +23,28 @@ namespace tmwa { -# ifndef __cplusplus -# error "Please compile in C++ mode" -# endif // __cplusplus +#ifndef __cplusplus +# error "Please compile in C++ mode" +#endif // __cplusplus -# if __GNUC__ < 4 -# error "Your compiler is absolutely ancient. You have no chance ..." -# endif // __GNUC__ < 4 +#if __GNUC__ < 4 +# error "Your compiler is absolutely ancient. You have no chance ..." +#endif // __GNUC__ < 4 -# if __GNUC__ == 4 +#if __GNUC__ == 4 // clang identifies as GCC 4.2, but is mostly okay. // Until a bug-free release of it happens, though, I won't recommend it. // clang 3.2 is the minimum that the CI builds are using -# if __GNUC_MINOR__ < 7 && !defined(__clang__) -# error "Please upgrade to at least GCC 4.7" -# endif // __GNUC_MINOR__ < 7 && !defined(__clang__) -# endif // __GNUC__ == 4 +# if __GNUC_MINOR__ < 7 && !defined(__clang__) +# error "Please upgrade to at least GCC 4.7" +# endif // __GNUC_MINOR__ < 7 && !defined(__clang__) +#endif // __GNUC__ == 4 -# if not defined(__i386__) and not defined(__x86_64__) +#if not defined(__i386__) and not defined(__x86_64__) // Known platform dependencies: // endianness for the [RW]FIFO.* macros // possibly, some signal-handling // some integer sizes (partially fixed for the x32 ABI) -# error "Unsupported platform, we use x86 / amd64 only" -# endif // not __i386__ +# error "Unsupported platform, we use x86 / amd64 only" +#endif // not __i386__ } // namespace tmwa - -#endif // TMWA_SANITY_HPP diff --git a/src/sexpr/bind.hpp b/src/sexpr/bind.hpp index 7250f9d..79d7cae 100644 --- a/src/sexpr/bind.hpp +++ b/src/sexpr/bind.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_SEXPR_BIND_HPP -#define TMWA_SEXPR_BIND_HPP +#pragma once // bind.hpp - Like std::bind, but with arbitrary arguments. // // Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include <utility> +#include <utility> -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -47,5 +46,3 @@ namespace sexpr } } // namespace sexpr } // namespace tmwa - -#endif //TMWA_SEXPR_VARIANT_HPP diff --git a/src/sexpr/fwd.hpp b/src/sexpr/fwd.hpp index 722d923..580b322 100644 --- a/src/sexpr/fwd.hpp +++ b/src/sexpr/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_SEXPR_FWD_HPP -#define TMWA_SEXPR_FWD_HPP +#pragma once // sexpr/fwd.hpp - list of type names for sexpr lib // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa { // meh, add more when I feel like it } // namespace tmwa - -#endif // TMWA_SEXPR_FWD_HPP diff --git a/src/sexpr/lexer.hpp b/src/sexpr/lexer.hpp index bd7b532..63be72d 100644 --- a/src/sexpr/lexer.hpp +++ b/src/sexpr/lexer.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_SEXPR_LEXER_HPP -#define TMWA_SEXPR_LEXER_HPP +#pragma once // lexer.hpp - tokenize a stream of S-expressions // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,17 +18,17 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <vector> +#include <vector> -# include "../strings/fwd.hpp" -# include "../strings/astring.hpp" -# include "../strings/zstring.hpp" +#include "../strings/fwd.hpp" +#include "../strings/astring.hpp" +#include "../strings/zstring.hpp" -# include "../io/line.hpp" +#include "../io/line.hpp" -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -76,5 +75,3 @@ namespace sexpr LString token_name(Lexeme tok); } // namespace sexpr } // namespace tmwa - -#endif // TMWA_SEXPR_LEXER_HPP diff --git a/src/sexpr/parser.hpp b/src/sexpr/parser.hpp index c787e56..feed636 100644 --- a/src/sexpr/parser.hpp +++ b/src/sexpr/parser.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_SEXPR_PARSER_HPP -#define TMWA_SEXPR_PARSER_HPP +#pragma once // parser.hpp - build a tree of S-expressions // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,17 +18,17 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdlib> +#include <cstdlib> -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" -# include "../io/line.hpp" +#include "../io/line.hpp" -# include "lexer.hpp" +#include "lexer.hpp" -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -84,5 +83,3 @@ namespace sexpr bool parse(Lexer& lex, SExpr& out); } // namespace sexpr } // namespace tmwa - -#endif // TMWA_SEXPR_PARSER_HPP diff --git a/src/sexpr/union.hpp b/src/sexpr/union.hpp index e0c3051..6a0b6b0 100644 --- a/src/sexpr/union.hpp +++ b/src/sexpr/union.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_SEXPR_UNION_HPP -#define TMWA_SEXPR_UNION_HPP +#pragma once // union.hpp - A (unsafe!) convenience wrapper for classes in unions. // // Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include <utility> -# include <type_traits> -# include <cstddef> -# include <new> +#include <utility> +#include <type_traits> +#include <cstddef> +#include <new> -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -104,5 +103,3 @@ namespace sexpr }; } // namespace sexpr } // namespace tmwa - -#endif //TMWA_SEXPR_UNION_HPP diff --git a/src/sexpr/variant.hpp b/src/sexpr/variant.hpp index ccbfeaa..04f35dc 100644 --- a/src/sexpr/variant.hpp +++ b/src/sexpr/variant.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_SEXPR_VARIANT_HPP -#define TMWA_SEXPR_VARIANT_HPP +#pragma once // variant.hpp - A single value, multiple type container. Better than boost's. // // Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com> @@ -19,30 +18,30 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include <type_traits> -# include <cstdint> -# include <cstddef> -# include <utility> +#include <type_traits> +#include <cstdint> +#include <cstddef> +#include <utility> -# include "union.hpp" -# include "void.hpp" +#include "union.hpp" +#include "void.hpp" -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa { namespace sexpr { -# define JOIN(a, b) a##b +#define JOIN(a, b) a##b -# define WITH_VAR(ty, var, expr) \ +#define WITH_VAR(ty, var, expr) \ for (bool JOIN(var, _guard) = true; JOIN(var, _guard); ) \ for (ty var = expr; JOIN(var, _guard); JOIN(var, _guard) = false) -# define MATCH(expr) \ +#define MATCH(expr) \ WITH_VAR(auto&&, _match_var, expr) \ switch (tmwa::sexpr::VariantFriend::get_state(_match_var)) -# define CASE(ty, var) \ +#define CASE(ty, var) \ break; \ case tmwa::sexpr::VariantFriend::get_state_for<ty, decltype(_match_var)>(): \ WITH_VAR(ty, var, tmwa::sexpr::VariantFriend::unchecked_get<ty>(_match_var)) @@ -114,6 +113,4 @@ namespace sexpr } // namespace sexpr } // namespace tmwa -# include "variant.tcc" - -#endif //TMWA_SEXPR_VARIANT_HPP +#include "variant.tcc" diff --git a/src/sexpr/void.hpp b/src/sexpr/void.hpp index 9fb6bc4..4ef20cc 100644 --- a/src/sexpr/void.hpp +++ b/src/sexpr/void.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_SEXPR_VOID_HPP -#define TMWA_SEXPR_VOID_HPP +#pragma once // void.hpp - A type that represents nothing and anything. // // Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -39,5 +38,3 @@ namespace sexpr constexpr Void::Void() noexcept = default; } // namespace sexpr } // namespace tmwa - -#endif //TMWA_SEXPR_VOID_HPP diff --git a/src/strings/all.hpp b/src/strings/all.hpp index 9311ba4..8e13b92 100644 --- a/src/strings/all.hpp +++ b/src/strings/all.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_ALL_HPP -#define TMWA_STRINGS_ALL_HPP +#pragma once // strings/all.hpp - All the string classes you'll ever need. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,22 +18,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "base.hpp" -# include "mstring.hpp" -# include "rstring.hpp" -# include "astring.hpp" -# include "tstring.hpp" -# include "sstring.hpp" -# include "zstring.hpp" -# include "xstring.hpp" -# include "literal.hpp" -# include "vstring.hpp" +#include "base.hpp" +#include "mstring.hpp" +#include "rstring.hpp" +#include "astring.hpp" +#include "tstring.hpp" +#include "sstring.hpp" +#include "zstring.hpp" +#include "xstring.hpp" +#include "literal.hpp" +#include "vstring.hpp" namespace tmwa { } // namespace tmwa - -#endif // TMWA_STRINGS_ALL_HPP diff --git a/src/strings/astring.hpp b/src/strings/astring.hpp index cf33cc5..83399f0 100644 --- a/src/strings/astring.hpp +++ b/src/strings/astring.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_ASTRING_HPP -#define TMWA_STRINGS_ASTRING_HPP +#pragma once // strings/astring.hpp - An owned, reference-counted immutable string. // // Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,10 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "base.hpp" -# include "rstring.hpp" +#include "base.hpp" +#include "rstring.hpp" namespace tmwa @@ -33,9 +32,9 @@ namespace strings /// The storage is NUL-terminated class AString : public _crtp_string<AString, AString, ZPair> { -# ifdef __clang__ +#ifdef __clang__ __attribute__((unused)) -# endif +#endif RString *align[0]; char data[255]; unsigned char special; @@ -82,6 +81,4 @@ namespace strings } // namespace strings } // namespace tmwa -# include "astring.tcc" - -#endif // TMWA_STRINGS_ASTRING_HPP +#include "astring.tcc" diff --git a/src/strings/base.hpp b/src/strings/base.hpp index 122d46d..b6b3df0 100644 --- a/src/strings/base.hpp +++ b/src/strings/base.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_BASE_HPP -#define TMWA_STRINGS_BASE_HPP +#pragma once // strings/base.hpp - CRTP base for string implementations. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" -# include "pair.hpp" +#include "fwd.hpp" +#include "pair.hpp" -# include <cstddef> +#include <cstddef> -# include <iterator> +#include <iterator> namespace tmwa @@ -200,6 +199,4 @@ namespace strings } // namespace strings } // namespace tmwa -# include "base.tcc" - -#endif // TMWA_STRINGS_BASE_HPP +#include "base.tcc" diff --git a/src/strings/fwd.hpp b/src/strings/fwd.hpp index 4f1fe89..b1b8266 100644 --- a/src/strings/fwd.hpp +++ b/src/strings/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_FWD_HPP -#define TMWA_STRINGS_FWD_HPP +#pragma once // strings/fwd.hpp - Forward declarations for all the string classes. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,10 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" -# include <cstddef> -# include <cstdint> +#include <cstddef> +#include <cstdint> namespace tmwa @@ -74,5 +73,3 @@ using strings::VString; using strings::operator "" _s; using strings::operator "" _fmt; } // namespace tmwa - -#endif // TMWA_STRINGS_FWD_HPP diff --git a/src/strings/literal.hpp b/src/strings/literal.hpp index 207ccff..5e27a9f 100644 --- a/src/strings/literal.hpp +++ b/src/strings/literal.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_LITERAL_HPP -#define TMWA_STRINGS_LITERAL_HPP +#pragma once // strings/literal.hpp - A string stored in the readonly data segment. // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "base.hpp" +#include "base.hpp" namespace tmwa @@ -77,5 +76,3 @@ namespace strings } } // namespace strings } // namespace tmwa - -#endif // TMWA_STRINGS_LSTRING_HPP diff --git a/src/strings/mstring.hpp b/src/strings/mstring.hpp index b1ecce3..4f40919 100644 --- a/src/strings/mstring.hpp +++ b/src/strings/mstring.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_MSTRING_HPP -#define TMWA_STRINGS_MSTRING_HPP +#pragma once // strings/mstring.hpp - A mutable string. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <deque> +#include <deque> namespace tmwa @@ -66,5 +65,3 @@ namespace strings }; } // namespace strings } // namespace tmwa - -#endif // TMWA_STRINGS_MSTRING_HPP diff --git a/src/strings/pair.hpp b/src/strings/pair.hpp index e249d9e..9c1cd9f 100644 --- a/src/strings/pair.hpp +++ b/src/strings/pair.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_PAIR_HPP -#define TMWA_STRINGS_PAIR_HPP +#pragma once // strings/pair.hpp - Internal contiguous range. // // Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" namespace tmwa @@ -64,5 +63,3 @@ namespace strings }; } // namespace strings } // namespace tmwa - -#endif // TMWA_STRINGS_PAIR_HPP diff --git a/src/strings/rstring.hpp b/src/strings/rstring.hpp index c656622..fd3ee65 100644 --- a/src/strings/rstring.hpp +++ b/src/strings/rstring.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_RSTRING_HPP -#define TMWA_STRINGS_RSTRING_HPP +#pragma once // strings/rstring.hpp - An owned, reference-counted immutable string. // // Copyright © 2013-2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdarg> +#include <cstdarg> -# include "base.hpp" +#include "base.hpp" namespace tmwa @@ -88,6 +87,4 @@ namespace strings } // namespace strings } // namespace tmwa -# include "rstring.tcc" - -#endif // TMWA_STRINGS_RSTRING_HPP +#include "rstring.tcc" diff --git a/src/strings/sstring.hpp b/src/strings/sstring.hpp index 5c5a2f5..a65616d 100644 --- a/src/strings/sstring.hpp +++ b/src/strings/sstring.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_SSTRING_HPP -#define TMWA_STRINGS_SSTRING_HPP +#pragma once // strings/sstring.hpp - A full slice of an RString. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,10 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "base.hpp" -# include "rstring.hpp" +#include "base.hpp" +#include "rstring.hpp" namespace tmwa @@ -59,6 +58,4 @@ namespace strings } // namespace strings } // namespace tmwa -# include "sstring.tcc" - -#endif // TMWA_STRINGS_SSTRING_HPP +#include "sstring.tcc" diff --git a/src/strings/tstring.hpp b/src/strings/tstring.hpp index 054ce69..b0da566 100644 --- a/src/strings/tstring.hpp +++ b/src/strings/tstring.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_TSTRING_HPP -#define TMWA_STRINGS_TSTRING_HPP +#pragma once // strings/tstring.hpp - A tail slice of a string. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,10 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "base.hpp" -# include "rstring.hpp" +#include "base.hpp" +#include "rstring.hpp" namespace tmwa @@ -65,6 +64,4 @@ namespace strings } // namespace strings } // namespace tmwa -# include "tstring.tcc" - -#endif // TMWA_STRINGS_TSTRING_HPP +#include "tstring.tcc" diff --git a/src/strings/vstring.hpp b/src/strings/vstring.hpp index 25051c8..f3437a5 100644 --- a/src/strings/vstring.hpp +++ b/src/strings/vstring.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_VSTRING_HPP -#define TMWA_STRINGS_VSTRING_HPP +#pragma once // strings/vstring.hpp - A small string that stores its own value. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,11 +18,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstdio> +#include <cstdio> -# include "base.hpp" +#include "base.hpp" namespace tmwa @@ -78,6 +77,4 @@ T stringish(VString<sizeof(T) - 1> iv) } } // namespace tmwa -# include "vstring.tcc" - -#endif // TMWA_STRINGS_VSTRING_HPP +#include "vstring.tcc" diff --git a/src/strings/xstring.hpp b/src/strings/xstring.hpp index 0de2be3..2b000c4 100644 --- a/src/strings/xstring.hpp +++ b/src/strings/xstring.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_XSTRING_HPP -#define TMWA_STRINGS_XSTRING_HPP +#pragma once // strings/xstring.hpp - A full borrowed slice. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "base.hpp" +#include "base.hpp" namespace tmwa @@ -60,6 +59,4 @@ namespace strings } // namespace strings } // namespace tmwa -# include "xstring.tcc" - -#endif // TMWA_STRINGS_XSTRING_HPP +#include "xstring.tcc" diff --git a/src/strings/zstring.hpp b/src/strings/zstring.hpp index e82c9fb..1e38662 100644 --- a/src/strings/zstring.hpp +++ b/src/strings/zstring.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_STRINGS_ZSTRING_HPP -#define TMWA_STRINGS_ZSTRING_HPP +#pragma once // strings/zstring.hpp - A borrowed tail slice of a string. // // Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com> @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include "base.hpp" +#include "base.hpp" namespace tmwa @@ -65,6 +64,4 @@ namespace strings } // namespace strings } // namespace tmwa -# include "zstring.tcc" - -#endif // TMWA_STRINGS_ZSTRING_HPP +#include "zstring.tcc" diff --git a/src/tests/fdhack.hpp b/src/tests/fdhack.hpp index 4b9fafe..c75bfea 100644 --- a/src/tests/fdhack.hpp +++ b/src/tests/fdhack.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_TESTS_FDHACK_HPP -#define TMWA_TESTS_FDHACK_HPP +#pragma once // fdhack.hpp - Move file descriptors around. // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,17 +18,17 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "fwd.hpp" +#include "fwd.hpp" -# include <cstddef> -# include <fcntl.h> +#include <cstddef> +#include <fcntl.h> -# include <stdexcept> +#include <stdexcept> -# include "../strings/literal.hpp" -# include "../strings/zstring.hpp" +#include "../strings/literal.hpp" +#include "../strings/zstring.hpp" -# include "../io/fd.hpp" +#include "../io/fd.hpp" namespace tmwa { @@ -57,5 +56,3 @@ public: {} }; } // namespace tmwa - -#endif // TMWA_TESTS_FDHACK_HPP diff --git a/src/tests/fwd.hpp b/src/tests/fwd.hpp index c47fd0f..48627da 100644 --- a/src/tests/fwd.hpp +++ b/src/tests/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_TESTS_FWD_HPP -#define TMWA_TESTS_FWD_HPP +#pragma once // tests/fwd.hpp - list of type names for test libs // // Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com> @@ -19,12 +18,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa { // meh, add more when I feel like it } // namespace tmwa - -#endif // TMWA_TESTS_FWD_HPP diff --git a/src/warnings.hpp b/src/warnings.hpp index c6c6695..97d85e3 100644 --- a/src/warnings.hpp +++ b/src/warnings.hpp @@ -1,4 +1,4 @@ -// no include guards +#pragma once // This is the first file in every compilation, passed by the makefile. // This file contains only preprocessor directions. |