diff --git a/public/amtl/am-allocator-policies.h b/public/amtl/am-allocator-policies.h index 28ee2176..8a74adc5 100644 --- a/public/amtl/am-allocator-policies.h +++ b/public/amtl/am-allocator-policies.h @@ -1,29 +1,41 @@ -/* vim: set ts=2 sw=2 tw=99 et: - * - * Copyright (C) 2012 David Anderson - * - * This file is part of SourcePawn. - * - * SourcePawn is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * SourcePawn. If not, see http://www.gnu.org/licenses/. - */ -#ifndef _include_sourcepawn_allocatorpolicies_h_ -#define _include_sourcepawn_allocatorpolicies_h_ +// vim: set sts=8 ts=2 sw=2 tw=99 et: +// +// Copyright (C) 2013, David Anderson and AlliedModders LLC +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of AlliedModders LLC nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef _include_amtl_allocatorpolicies_h_ +#define _include_amtl_allocatorpolicies_h_ #include #include namespace ke { +// The default system allocator policy will crash on out-of-memory. class SystemAllocatorPolicy { protected: @@ -50,4 +62,4 @@ class SystemAllocatorPolicy } -#endif // _include_sourcepawn_allocatorpolicies_h_ +#endif // _include_amtl_allocatorpolicies_h_ diff --git a/public/amtl/am-inline-list.h b/public/amtl/am-inline-list.h index 18b0399b..56aa4204 100644 --- a/public/amtl/am-inline-list.h +++ b/public/amtl/am-inline-list.h @@ -1,36 +1,39 @@ -/** - * vim: set sts=2 ts=8 sw=2 tw=99 noet : - * ============================================================================= - * SourcePawn - * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved. - * ============================================================================= - * - * This program is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, version 3.0, as published by the - * Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - * - * As a special exception, AlliedModders LLC gives you permission to link the - * code of this program (as well as its derivative works) to "Half-Life 2," the - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software - * by the Valve Corporation. You must obey the GNU General Public License in - * all respects for all other code used. Additionally, AlliedModders LLC grants - * this exception to all derivative works. AlliedModders LLC defines further - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), - * or . - */ -#ifndef _include_sourcepawn_inline_list_h_ -#define _include_sourcepawn_inline_list_h_ +// vim: set sts=8 ts=2 sw=2 tw=99 et: +// +// Copyright (C) 2013, David Anderson and AlliedModders LLC +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of AlliedModders LLC nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef _include_amtl_inline_list_h_ +#define _include_amtl_inline_list_h_ #include +namespace ke { + template class InlineList; template @@ -133,5 +136,7 @@ class InlineList } }; -#endif // _include_sourcepawn_inline_list_h_ +} + +#endif // _include_amtl_inline_list_h_ diff --git a/public/amtl/am-thread-posix.h b/public/amtl/am-thread-posix.h index cbbaa89b..d103389e 100644 --- a/public/amtl/am-thread-posix.h +++ b/public/amtl/am-thread-posix.h @@ -1,21 +1,34 @@ -// vim: set ts=8 sts=2 sw=2 tw=99 et: +// vim: set sts=8 ts=2 sw=2 tw=99 et: // -// This file is part of SourcePawn. +// Copyright (C) 2013, David Anderson and AlliedModders LLC +// All rights reserved. // -// SourcePawn is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// SourcePawn is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with SourcePawn. If not, see . -#ifndef _include_sourcepawn_thread_posix_h_ -#define _include_sourcepawn_thread_posix_h_ +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of AlliedModders LLC nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef _include_amtl_thread_posix_h_ +#define _include_amtl_thread_posix_h_ #include #include @@ -196,5 +209,5 @@ class Thread } // namespace ke -#endif // _include_sourcepawn_thread_posix_h_ +#endif // _include_amtl_thread_posix_h_ diff --git a/public/amtl/am-thread-utils.h b/public/amtl/am-thread-utils.h index f8c55d13..98db2616 100644 --- a/public/amtl/am-thread-utils.h +++ b/public/amtl/am-thread-utils.h @@ -1,21 +1,34 @@ -// vim: set ts=8 sts=2 sw=2 tw=99 et: +// vim: set sts=8 ts=2 sw=2 tw=99 et: // -// This file is part of SourcePawn. +// Copyright (C) 2013, David Anderson and AlliedModders LLC +// All rights reserved. // -// SourcePawn is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// SourcePawn is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with SourcePawn. If not, see . -#ifndef _include_sourcepawn_threads_ -#define _include_sourcepawn_threads_ +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of AlliedModders LLC nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef _include_amtl_threads_ +#define _include_amtl_threads_ #include #if defined(_MSC_VER) @@ -249,4 +262,4 @@ class IRunnable # include "am-thread-posix.h" #endif -#endif // _include_sourcepawn_threads_ +#endif // _include_amtl_threads_ diff --git a/public/amtl/am-thread-windows.h b/public/amtl/am-thread-windows.h index f31584f3..5e6970c2 100644 --- a/public/amtl/am-thread-windows.h +++ b/public/amtl/am-thread-windows.h @@ -1,21 +1,34 @@ -// vim: set ts=8 sts=2 sw=2 tw=99 et: +// vim: set sts=8 ts=2 sw=2 tw=99 et: // -// This file is part of SourcePawn. +// Copyright (C) 2013, David Anderson and AlliedModders LLC +// All rights reserved. // -// SourcePawn is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: // -// SourcePawn is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with SourcePawn. If not, see . -#ifndef _include_sourcepawn_thread_windows_h_ -#define _include_sourcepawn_thread_windows_h_ +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of AlliedModders LLC nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef _include_amtl_thread_windows_h_ +#define _include_amtl_thread_windows_h_ #include @@ -145,4 +158,4 @@ class Thread } // namespace ke -#endif // _include_sourcepawn_thread_windows_h_ +#endif // _include_amtl_thread_windows_h_ diff --git a/public/amtl/am-utility.h b/public/amtl/am-utility.h index 42f4308f..cdbf61f5 100644 --- a/public/amtl/am-utility.h +++ b/public/amtl/am-utility.h @@ -1,23 +1,34 @@ -/* vim: set ts=4 sw=4 tw=99 et: - * - * Copyright (C) 2012-2013 David Anderson - * - * This file is part of SourcePawn. - * - * SourcePawn is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * SourcePawn. If not, see http://www.gnu.org/licenses/. - */ -#ifndef _include_jitcraft_utility_h_ -#define _include_jitcraft_utility_h_ +// vim: set sts=8 ts=2 sw=2 tw=99 et: +// +// Copyright (C) 2013, David Anderson and AlliedModders LLC +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of AlliedModders LLC nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef _include_amtl_utility_h_ +#define _include_amtl_utility_h_ #include #include @@ -306,8 +317,6 @@ Max(const T &t1, const T &t2) return t1 > t2 ? t1 : t2; } -#define OFFSETOF(Class, Member) reinterpret_cast(&((Class *)NULL)->Member) - #if defined(_MSC_VER) # define KE_SIZET_FMT "%Iu" #elif defined(__GNUC__) @@ -324,4 +333,4 @@ Max(const T &t1, const T &t2) } -#endif // _include_jitcraft_utility_h_ +#endif // _include_amtl_utility_h_ diff --git a/public/amtl/am-vector.h b/public/amtl/am-vector.h index e028c5b2..c70b2281 100644 --- a/public/amtl/am-vector.h +++ b/public/amtl/am-vector.h @@ -1,21 +1,32 @@ -/* vim: set ts=2 sw=2 tw=99 et: - * - * Copyright (C) 2012 David Anderson - * - * This file is part of SourcePawn. - * - * SourcePawn is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * SourcePawn. If not, see http://www.gnu.org/licenses/. - */ +// vim: set sts=8 ts=2 sw=2 tw=99 et: +// +// Copyright (C) 2013, David Anderson and AlliedModders LLC +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, this +// list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright notice, +// this list of conditions and the following disclaimer in the documentation +// and/or other materials provided with the distribution. +// * Neither the name of AlliedModders LLC nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + #ifndef _INCLUDE_KEIMA_TPL_CPP_VECTOR_H_ #define _INCLUDE_KEIMA_TPL_CPP_VECTOR_H_ @@ -31,9 +42,9 @@ class Vector : public AllocPolicy { public: Vector(AllocPolicy = AllocPolicy()) - : data(NULL), - nitems(0), - maxsize(0) + : data_(NULL), + nitems_(0), + maxsize_(0) { } @@ -44,23 +55,23 @@ class Vector : public AllocPolicy void steal(Vector &other) { zap(); - data = other.data; - nitems = other.nitems; - maxsize = other.maxsize; + data_ = other.data_; + nitems_ = other.nitems_; + maxsize_ = other.maxsize_; other.reset(); } bool append(const T& item) { if (!growIfNeeded(1)) return false; - new (&data[nitems]) T(item); - nitems++; + new (&data_[nitems_]) T(item); + nitems_++; return true; } void infallibleAppend(const T &item) { assert(growIfNeeded(1)); - new (&data[nitems]) T(item); - nitems++; + new (&data_[nitems_]) T(item); + nitems_++; } T popCopy() { T t = at(length() - 1); @@ -68,23 +79,23 @@ class Vector : public AllocPolicy return t; } void pop() { - assert(nitems); - data[nitems - 1].~T(); - nitems--; + assert(nitems_); + data_[nitems_ - 1].~T(); + nitems_--; } bool empty() const { return length() == 0; } size_t length() const { - return nitems; + return nitems_; } T& at(size_t i) { assert(i < length()); - return data[i]; + return data_[i]; } const T& at(size_t i) const { assert(i < length()); - return data[i]; + return data_[i]; } T& operator [](size_t i) { return at(i); @@ -93,7 +104,7 @@ class Vector : public AllocPolicy return at(i); } void clear() { - nitems = 0; + nitems_ = 0; } const T &back() const { return at(length() - 1); @@ -103,7 +114,7 @@ class Vector : public AllocPolicy } T *buffer() const { - return data; + return data_; } bool ensure(size_t desired) { @@ -115,49 +126,49 @@ class Vector : public AllocPolicy private: void zap() { - for (size_t i = 0; i < nitems; i++) - data[i].~T(); - this->free(data); + for (size_t i = 0; i < nitems_; i++) + data_[i].~T(); + this->free(data_); } void reset() { - data = NULL; - nitems = 0; - maxsize = 0; + data_ = NULL; + nitems_ = 0; + maxsize_ = 0; } bool growIfNeeded(size_t needed) { - if (!IsUintPtrAddSafe(nitems, needed)) { + if (!IsUintPtrAddSafe(nitems_, needed)) { this->reportAllocationOverflow(); return false; } - if (nitems + needed < maxsize) + if (nitems_ + needed < maxsize_) return true; - if (maxsize == 0) - maxsize = 8; - while (nitems + needed > maxsize) { - if (!IsUintPtrMultiplySafe(maxsize, 2)) { + if (maxsize_ == 0) + maxsize_ = 8; + while (nitems_ + needed > maxsize_) { + if (!IsUintPtrMultiplySafe(maxsize_, 2)) { this->reportAllocationOverflow(); return false; } - maxsize *= 2; + maxsize_ *= 2; } - T* newdata = (T*)this->malloc(sizeof(T) * maxsize); + T* newdata = (T*)this->malloc(sizeof(T) * maxsize_); if (newdata == NULL) return false; - for (size_t i = 0; i < nitems; i++) { - new (&newdata[i]) T(data[i]); - data[i].~T(); + for (size_t i = 0; i < nitems_; i++) { + new (&newdata[i]) T(data_[i]); + data_[i].~T(); } - this->free(data); - data = newdata; + this->free(data_); + data_ = newdata; return true; } private: - T* data; - size_t nitems; - size_t maxsize; + T* data_; + size_t nitems_; + size_t maxsize_; }; } diff --git a/sourcepawn/jit/BaseRuntime.h b/sourcepawn/jit/BaseRuntime.h index c2fb4bf0..04f3560c 100644 --- a/sourcepawn/jit/BaseRuntime.h +++ b/sourcepawn/jit/BaseRuntime.h @@ -36,7 +36,7 @@ struct floattbl_t /* Jit wants fast access to this so we expose things as public */ class BaseRuntime : public SourcePawn::IPluginRuntime, - public InlineListNode + public ke::InlineListNode { public: BaseRuntime(); diff --git a/sourcepawn/jit/x86/jit_x86.cpp b/sourcepawn/jit/x86/jit_x86.cpp index 57e35315..de801d84 100644 --- a/sourcepawn/jit/x86/jit_x86.cpp +++ b/sourcepawn/jit/x86/jit_x86.cpp @@ -2056,7 +2056,7 @@ void JITX86::PatchAllJumpsForTimeout() { mutex_.AssertCurrentThreadOwns(); - for (InlineList::iterator iter = runtimes_.begin(); iter != runtimes_.end(); iter++) { + for (ke::InlineList::iterator iter = runtimes_.begin(); iter != runtimes_.end(); iter++) { BaseRuntime *rt = *iter; for (size_t i = 0; i < rt->NumJitFunctions(); i++) { JitFunction *fun = rt->GetJitFunction(i); @@ -2075,7 +2075,7 @@ void JITX86::UnpatchAllJumpsFromTimeout() { mutex_.AssertCurrentThreadOwns(); - for (InlineList::iterator iter = runtimes_.begin(); iter != runtimes_.end(); iter++) { + for (ke::InlineList::iterator iter = runtimes_.begin(); iter != runtimes_.end(); iter++) { BaseRuntime *rt = *iter; for (size_t i = 0; i < rt->NumJitFunctions(); i++) { JitFunction *fun = rt->GetJitFunction(i); diff --git a/sourcepawn/jit/x86/jit_x86.h b/sourcepawn/jit/x86/jit_x86.h index bb308d0c..eae3bff8 100644 --- a/sourcepawn/jit/x86/jit_x86.h +++ b/sourcepawn/jit/x86/jit_x86.h @@ -201,7 +201,7 @@ class JITX86 void *m_pJitEntry; /* Entry function */ void *m_pJitReturn; /* Universal return address */ void *m_pJitTimeout; /* Universal timeout address */ - InlineList runtimes_; + ke::InlineList runtimes_; uintptr_t frame_id_; uintptr_t level_; ke::Mutex mutex_;