Wrap all STL includes to support drv:: and eng::
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
|
||||
#include "animqueue.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include "wrap-map.hpp"
|
||||
#include <cmath>
|
||||
#include "luastack.hpp"
|
||||
#include "animqueue.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
|
||||
AnimStep::AnimStep() {
|
||||
clear();
|
||||
|
||||
@@ -45,12 +45,14 @@
|
||||
#ifndef ANIMQUEUE_HPP
|
||||
#define ANIMQUEUE_HPP
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <deque>
|
||||
#include "wrap-set.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-deque.hpp"
|
||||
#include "wrap-ostream.hpp"
|
||||
#include "wrap-unordered-map.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <ostream>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "streambuffer.hpp"
|
||||
#include "debugcollector.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
|
||||
#include "wrap-algorithm.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "debugcollector.hpp"
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include "util.hpp"
|
||||
|
||||
void DebugCollector::flush() {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef DEBUGCOLLECTOR_HPP
|
||||
#define DEBUGCOLLECTOR_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-memory.hpp"
|
||||
#include "wrap-ostream.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
|
||||
class DebugCollector {
|
||||
private:
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#include "drivenengine.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-utility.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
#include "drivenengine.hpp"
|
||||
|
||||
static std::vector<std::pair<std::string, DrivenEngineMaker>> makers;
|
||||
|
||||
void DrivenEngine::register_maker(const char *kind, DrivenEngineMaker maker) {
|
||||
|
||||
@@ -92,12 +92,13 @@
|
||||
#ifndef DRIVENENGINE_HPP
|
||||
#define DRIVENENGINE_HPP
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
#include "streambuffer.hpp"
|
||||
#include "wrap-memory.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-ostream.hpp"
|
||||
|
||||
#include "util.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
|
||||
class DrivenEngine;
|
||||
using UniqueDrivenEngine = std::unique_ptr<DrivenEngine>;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
|
||||
#include "driver.hpp"
|
||||
#include "driver-util.hpp"
|
||||
#include "drivenengine.hpp"
|
||||
#include "dummycert.hpp"
|
||||
@@ -9,8 +11,7 @@
|
||||
#include "lpxserver.hpp"
|
||||
#include "drivertests.hpp"
|
||||
#include "source.hpp"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#define WINVER 0x0600
|
||||
#define _WIN32_WINNT 0x0600
|
||||
|
||||
#include "driver.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "driver-util.hpp"
|
||||
#include "drivenengine.hpp"
|
||||
#include "dummycert.hpp"
|
||||
@@ -11,7 +14,7 @@
|
||||
#include "lpxserver.hpp"
|
||||
#include "drivertests.hpp"
|
||||
#include "source.hpp"
|
||||
#include <map>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "driver-util.hpp"
|
||||
#include "luastack.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
#ifndef DRIVER_UTIL_HPP
|
||||
#define DRIVER_UTIL_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
|
||||
namespace drv {
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#ifndef DRIVER_HPP
|
||||
#define DRIVER_HPP
|
||||
|
||||
class DrivenEngine;
|
||||
|
||||
void driver_sysinit(int argc, char *argv[]);
|
||||
void driver_drive(int argc, char *argv[]);
|
||||
|
||||
#endif // DRIVER_HPP
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "wrap-string.hpp"
|
||||
|
||||
#include "drivertests.hpp"
|
||||
#include "drivenengine.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
#include "world.hpp"
|
||||
#include "eng-malloc.hpp"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
static void write_closed_message(Channel *ch, StreamBuffer *out) {
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
|
||||
|
||||
#ifndef ENG_MALLOC_HPP
|
||||
#define ENG_MALLOC_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <sstream>
|
||||
|
||||
// dlmalloc is only used on linux.
|
||||
extern "C" {
|
||||
#ifdef __linux__
|
||||
void* dlmalloc(size_t x);
|
||||
void dlfree(void *p);
|
||||
void* dlrealloc(void*, size_t);
|
||||
#else
|
||||
void* dlmalloc(size_t x) { return malloc(x); }
|
||||
void dlfree(void *p) { free(p); }
|
||||
void* dlrealloc(void *p, size_t x) { return realloc(p,x); }
|
||||
#endif
|
||||
}
|
||||
|
||||
// Return the current state of the dlmalloc allocator as a 30-bit hash.
|
||||
extern int dlmalloc_hash();
|
||||
|
||||
// EngAllocator: a class meant to be used as an STL Allocator.
|
||||
// Causes objects to be allocated using dlmalloc and dlfree.
|
||||
template <class T>
|
||||
class EngAllocator
|
||||
{
|
||||
public:
|
||||
using value_type = T;
|
||||
EngAllocator() noexcept {}
|
||||
template <class U> EngAllocator(EngAllocator<U> const&) noexcept {}
|
||||
|
||||
value_type* allocate(std::size_t n)
|
||||
{
|
||||
return static_cast<value_type*>(dlmalloc(n*sizeof(value_type)));
|
||||
}
|
||||
|
||||
void deallocate(value_type* p, std::size_t) noexcept
|
||||
{
|
||||
dlfree(p);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
bool operator==(EngAllocator<T> const&, EngAllocator<U> const&) noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
bool operator!=(EngAllocator<T> const&, EngAllocator<U> const&) noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace eng {
|
||||
|
||||
template<class T>
|
||||
using hash = std::hash<T>;
|
||||
|
||||
template<class T>
|
||||
using less = std::less<T>;
|
||||
|
||||
template<class T>
|
||||
using equal_to = std::equal_to<T>;
|
||||
|
||||
template<class T>
|
||||
using char_traits = std::char_traits<T>;
|
||||
|
||||
template<class A, class B>
|
||||
using pair = std::pair<A, B>;
|
||||
|
||||
template<class C, class T=char_traits<C>>
|
||||
using basic_string = std::basic_string<C, T, EngAllocator<C>>;
|
||||
|
||||
template<class C, class T=char_traits<C>>
|
||||
using basic_stringstream = std::basic_stringstream<C, T, EngAllocator<C>>;
|
||||
|
||||
template<class T>
|
||||
using vector = std::vector<T, EngAllocator<T>>;
|
||||
|
||||
template<class K, class V, class C=less<K>>
|
||||
using map = std::map<K, V, C, EngAllocator<pair<const K, V>>>;
|
||||
|
||||
template<class K, class V, class H=hash<K>, class E=equal_to<K>>
|
||||
using unordered_map = std::unordered_map<K, V, H, E, EngAllocator<pair<const K, V>>>;
|
||||
|
||||
template<class K, class C=std::less<K>>
|
||||
using set = std::set<K, C, EngAllocator<K>>;
|
||||
|
||||
template<class K, class H=hash<K>, class E=equal_to<K>>
|
||||
using unordered_set = std::unordered_set<K, H, E, EngAllocator<K>>;
|
||||
|
||||
using string = basic_string<char>;
|
||||
using stringstream = basic_stringstream<char>;
|
||||
}
|
||||
#endif // ENG_MALLOC_HPP
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
#ifndef GLOBALDB_HPP
|
||||
#define GLOBALDB_HPP
|
||||
|
||||
#include "luastack.hpp"
|
||||
|
||||
|
||||
#endif // GLOBALDB_HPP
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "gui.hpp"
|
||||
#include "luastack.hpp"
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#ifndef GUI_HPP
|
||||
#define GUI_HPP
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
#include "wrap-ostream.hpp"
|
||||
#include "wrap-deque.hpp"
|
||||
|
||||
#include "idalloc.hpp"
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -65,13 +65,17 @@
|
||||
#ifndef IDALLOC_HPP
|
||||
#define IDALLOC_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
#include "wrap-ostream.hpp"
|
||||
#include "wrap-deque.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
#include "debugcollector.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class IdGlobalPool {
|
||||
public:
|
||||
// Construct and destroy global pools. Note that after constructing
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-deque.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
|
||||
#include "invocation.hpp"
|
||||
#include <sstream>
|
||||
|
||||
const std::string &InvocationData::get(const std::string &key) const {
|
||||
static std::string blank_;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#ifndef INVOCATION_HPP
|
||||
#define INVOCATION_HPP
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <deque>
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-deque.hpp"
|
||||
|
||||
#include "streambuffer.hpp"
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include "lpxclient.hpp"
|
||||
#include "wrap-memory.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "drivenengine.hpp"
|
||||
#include "lpxclient.hpp"
|
||||
#include "world.hpp"
|
||||
#include "luaconsole.hpp"
|
||||
#include "invocation.hpp"
|
||||
#include "util.hpp"
|
||||
#include "printbuffer.hpp"
|
||||
#include <memory>
|
||||
|
||||
class LpxClient : public DrivenEngine {
|
||||
public:
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include "lpxserver.hpp"
|
||||
#include "wrap-memory.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "lpxserver.hpp"
|
||||
#include "world.hpp"
|
||||
#include "drivenengine.hpp"
|
||||
#include "luaconsole.hpp"
|
||||
#include "util.hpp"
|
||||
#include "printbuffer.hpp"
|
||||
#include <memory>
|
||||
|
||||
class Client {
|
||||
public:
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include <string.h>
|
||||
#include "luaconsole.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
LuaConsole::LuaConsole() {
|
||||
|
||||
@@ -42,7 +42,9 @@
|
||||
#ifndef LUACONSOLE_HPP
|
||||
#define LUACONSOLE_HPP
|
||||
|
||||
#include <string>
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
|
||||
class LuaConsole {
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
|
||||
#include "wrap-sstream.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
|
||||
#include "luasnap.hpp"
|
||||
#include "luastack.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
LuaSnap::LuaSnap() {
|
||||
|
||||
@@ -154,6 +154,9 @@
|
||||
#ifndef LUASTACK_HPP
|
||||
#define LUASTACK_HPP
|
||||
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
@@ -161,10 +164,6 @@ extern "C" {
|
||||
#include "eris.h"
|
||||
}
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <string_view>
|
||||
|
||||
class LuaSlot {
|
||||
protected:
|
||||
int index_;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include "wrap-algorithm.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "util.hpp"
|
||||
#include "planemap.hpp"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
// Cell X, Y coordinates are packed such that they have 24 bits for X and Y.
|
||||
// A cell is 10 Meters square.
|
||||
// Cell ID zero is used to represent an invalid position.
|
||||
|
||||
@@ -73,11 +73,14 @@
|
||||
#ifndef PLANEMAP_HPP
|
||||
#define PLANEMAP_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
|
||||
#include "util.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class PlaneMap;
|
||||
|
||||
class PlaneItem {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "wrap-ostream.hpp"
|
||||
|
||||
#include "pprint.hpp"
|
||||
#include "util.hpp"
|
||||
#include "table.hpp"
|
||||
#include <ostream>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef PPRINT_HPP
|
||||
#define PPRINT_HPP
|
||||
|
||||
#include "wrap-ostream.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
|
||||
// Atomic print to a stream.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "wrap-algorithm.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
|
||||
#include "printbuffer.hpp"
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
struct PrintBufferCore {
|
||||
// The most recent lines printed.
|
||||
|
||||
@@ -77,14 +77,15 @@
|
||||
#ifndef PRINTBUFFER_HPP
|
||||
#define PRINTBUFFER_HPP
|
||||
|
||||
#include "wrap-deque.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-memory.hpp"
|
||||
#include "wrap-ostream.hpp"
|
||||
|
||||
#include "streambuffer.hpp"
|
||||
#include "util.hpp"
|
||||
#include "invocation.hpp"
|
||||
#include "debugcollector.hpp"
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
|
||||
struct PrintBufferCore;
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
|
||||
#include "wrap-sstream.hpp"
|
||||
#include "wrap-ostream.hpp"
|
||||
|
||||
#include "sched.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
#include "luastack.hpp"
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
|
||||
bool SchedEntry::operator < (const SchedEntry &other) const {
|
||||
if (clock_ < other.clock_) return true;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#ifndef SCHED_HPP
|
||||
#define SCHED_HPP
|
||||
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
#include "wrap-set.hpp"
|
||||
|
||||
#include "streambuffer.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class SchedEntry {
|
||||
private:
|
||||
friend class Schedule;
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-set.hpp"
|
||||
#include "wrap-algorithm.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
|
||||
#include "util.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "traceback.hpp"
|
||||
#include "table.hpp"
|
||||
#include "source.hpp"
|
||||
#include "luasnap.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
LuaDefine(makeclass, "classname", "create a class if it doesn't already exist") {
|
||||
LuaArg classname;
|
||||
LuaRet classtab;
|
||||
@@ -375,7 +376,7 @@ static std::string source_load_lfunctions(lua_State *L) {
|
||||
}
|
||||
|
||||
// Now call the closures in the proper order.
|
||||
std::stringstream errss;
|
||||
std::ostringstream errss;
|
||||
for (const auto &p : indices) {
|
||||
LS.rawget(info, sourcedb, p.second);
|
||||
LS.rawget(closure, info, "loadresult");
|
||||
|
||||
@@ -120,6 +120,8 @@
|
||||
#ifndef SOURCE_HPP
|
||||
#define SOURCE_HPP
|
||||
|
||||
#include "wrap-string.hpp"
|
||||
|
||||
#include "util.hpp"
|
||||
#include "luastack.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
|
||||
@@ -29,9 +29,8 @@
|
||||
#ifndef SPOOKYV2_HPP
|
||||
#define SPOOKYV2_HPP
|
||||
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
class SpookyHash
|
||||
{
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#include "wrap-string.hpp"
|
||||
|
||||
#include "two-mallocs.hpp"
|
||||
#include "streambuffer.hpp"
|
||||
#include "spookyv2.hpp"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
@@ -212,13 +212,15 @@
|
||||
#ifndef STREAMBUFFER_HPP
|
||||
#define STREAMBUFFER_HPP
|
||||
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
#include "wrap-utility.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
|
||||
class StreamException
|
||||
{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
|
||||
#include "wrap-string.hpp"
|
||||
|
||||
#include "table.hpp"
|
||||
#include "source.hpp"
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-memory.hpp"
|
||||
#include "wrap-algorithm.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "util.hpp"
|
||||
#include "gui.hpp"
|
||||
@@ -15,9 +14,10 @@
|
||||
#include "luaconsole.hpp"
|
||||
#include "pprint.hpp"
|
||||
#include "printbuffer.hpp"
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <csignal>
|
||||
|
||||
class TextGame : public DrivenEngine {
|
||||
private:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include <cstring>
|
||||
#include "traceback.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#define TRACEBACK_LEVELS1 12
|
||||
#define TRACEBACK_LEVELS2 10
|
||||
|
||||
|
||||
// Call this with the error message on top of the stack.
|
||||
// The error message is replaced with a traceback.
|
||||
//
|
||||
|
||||
78
luprex/core/cpp/two-mallocs.hpp
Normal file
78
luprex/core/cpp/two-mallocs.hpp
Normal file
@@ -0,0 +1,78 @@
|
||||
|
||||
|
||||
#ifndef TWO_MALLOCS_HPP
|
||||
#define TWO_MALLOCS_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
// dlmalloc is only used on linux.
|
||||
extern "C" {
|
||||
#ifdef __linux__
|
||||
void* dlmalloc(size_t x);
|
||||
void dlfree(void *p);
|
||||
void* dlrealloc(void*, size_t);
|
||||
#else
|
||||
void* dlmalloc(size_t x) { return malloc(x); }
|
||||
void dlfree(void *p) { free(p); }
|
||||
void* dlrealloc(void *p, size_t x) { return realloc(p,x); }
|
||||
#endif
|
||||
}
|
||||
|
||||
// Return the current state of the dlmalloc allocator as a 30-bit hash.
|
||||
extern int dlmalloc_hash();
|
||||
|
||||
// EngAllocator: a class meant to be used as an STL Allocator.
|
||||
// Causes objects to be allocated using dlmalloc and dlfree.
|
||||
template <class T>
|
||||
class EngAllocator
|
||||
{
|
||||
public:
|
||||
using value_type = T;
|
||||
EngAllocator() noexcept {}
|
||||
template <class U> EngAllocator(EngAllocator<U> const&) noexcept {}
|
||||
|
||||
value_type* allocate(std::size_t n)
|
||||
{
|
||||
return static_cast<value_type*>(dlmalloc(n*sizeof(value_type)));
|
||||
}
|
||||
|
||||
void deallocate(value_type* p, std::size_t) noexcept
|
||||
{
|
||||
dlfree(p);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T, class U>
|
||||
bool operator==(EngAllocator<T> const&, EngAllocator<U> const&) noexcept
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class T, class U>
|
||||
bool operator!=(EngAllocator<T> const&, EngAllocator<U> const&) noexcept
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// namespace eng {
|
||||
|
||||
// template<class T>
|
||||
// using hash = std::hash<T>;
|
||||
|
||||
// template<class T>
|
||||
// using less = std::less<T>;
|
||||
|
||||
// template<class T>
|
||||
// using equal_to = std::equal_to<T>;
|
||||
|
||||
// template<class T>
|
||||
// using char_traits = std::char_traits<T>;
|
||||
|
||||
// template<class A, class B>
|
||||
// using pair = std::pair<A, B>;
|
||||
|
||||
|
||||
|
||||
// }
|
||||
#endif // TWO_MALLOCS_HPP
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-vector.hpp"
|
||||
#include "wrap-algorithm.hpp"
|
||||
|
||||
#include "util.hpp"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <cmath>
|
||||
#include <iomanip>
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef WIN32
|
||||
#endif
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef UTIL_HPP
|
||||
#define UTIL_HPP
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include "wrap-string.hpp"
|
||||
#include "wrap-string-view.hpp"
|
||||
#include "wrap-set.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
#include "wrap-algorithm.hpp"
|
||||
#include "wrap-sstream.hpp"
|
||||
#include "wrap-ostream.hpp"
|
||||
#include "wrap-memory.hpp"
|
||||
#include "wrap-utility.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "spookyv2.hpp"
|
||||
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
#ifndef WORLD_HPP
|
||||
#define WORLD_HPP
|
||||
|
||||
#include "wrap-set.hpp"
|
||||
#include "wrap-utility.hpp"
|
||||
#include "wrap-memory.hpp"
|
||||
#include "wrap-unordered-map.hpp"
|
||||
#include "wrap-map.hpp"
|
||||
|
||||
#include "luastack.hpp"
|
||||
#include "planemap.hpp"
|
||||
#include "idalloc.hpp"
|
||||
@@ -14,10 +20,6 @@
|
||||
#include "source.hpp"
|
||||
#include "gui.hpp"
|
||||
#include "luasnap.hpp"
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
class World;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user