git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1613 c06c8d41-db1a-0410-9941-cceddc491573
Q2FZIIGQECGP2FKKWLGDBBQVGCFZ4JTY53PFPJP6X7YKC23AQGFQC JQCVEFFILBCGLBRRKJ3EVVDDZFHZ4GCBSXKN3D5ZSQZ4HGDHMCHQC PL6I2CMSTHY5ZHWVMIQE5YTM5S5VPKBNZM6QJVHZSSKOJGIJ5W4AC CQ24AVAI6SW3AHTIDMLPSTRRBEU6FHRF5I5FD6G5QIYE6PO4BQMQC YE7M665QKDGI7Y5WMERCWJNDZ4FUZ6GRUCK4E6GZH4SWCUM6RWLAC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC // A panic function for the Lua interpreter, usually called when it// runs out of memory when trying to load a file or a chunk of Lua from// an unprotected Lua op. The only cases of unprotected Lua loads are// loads of Lua code from .crawlrc, which is read at start of game.//// If there's an inordinately large .crawlrc (we're talking seriously// massive here) that wants more memory than we're willing to give// Lua, then the game will save and exit until the .crawlrc is fixed.//// Lua can also run out of memory during protected script execution,// such as when running a macro or some other game hook, but in such// cases the Lua interpreter will throw an exception instead of// panicking.//static int clua_panic(lua_State *ls){if (crawl_state.need_save && !crawl_state.saving_game&& !crawl_state.updating_scores){save_game(true);}return (0);}static void *clua_allocator(void *ud, void *ptr, size_t osize, size_t nsize){CLua *cl = static_cast<CLua *>( ud );cl->memory_used += nsize - osize;if (nsize > osize && cl->memory_used >= CLUA_MAX_MEMORY_USE * 1024&& cl->mixed_call_depth)return (NULL);if (!nsize){free(ptr);return (NULL);}elsereturn (realloc(ptr, nsize));}
#if defined(GCC)# define HASH_CONTAINER_NS __gnu_cxx# define HASH_CONTAINERS#endif// Uncomment to enable the Crawl Lua bindings. You can also set this in your// makefile by adding -DCLUA_BINDINGS to the CFLAGS line (this is preferred to// editing AppHdr.h directly).
// Uncomment to enable the Crawl Lua bindings. You can also set this// in your makefile by adding -DCLUA_BINDINGS to the CFLAGS line (this// is preferred to editing AppHdr.h directly).