lundump.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. ** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $
  3. ** load precompiled Lua chunks
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef lundump_h
  7. #define lundump_h
  8. #ifdef LUA_CROSS_COMPILER
  9. #include <stdint.h>
  10. #else
  11. #include "c_stdint.h"
  12. #endif
  13. #include "lobject.h"
  14. #include "lzio.h"
  15. typedef uint32_t strsize_t;
  16. /* info about target machine for cross-compilation */
  17. typedef struct {
  18. int little_endian;
  19. int sizeof_int;
  20. int sizeof_strsize_t;
  21. int sizeof_lua_Number;
  22. int lua_Number_integral;
  23. int is_arm_fpa;
  24. } DumpTargetInfo;
  25. /* load one chunk; from lundump.c */
  26. LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name);
  27. /* make header; from lundump.c */
  28. LUAI_FUNC void luaU_header (char* h);
  29. /* dump one chunk to a different target; from ldump.c */
  30. int luaU_dump_crosscompile (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip, DumpTargetInfo target);
  31. /* dump one chunk; from ldump.c */
  32. LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip);
  33. #ifdef luac_c
  34. /* print one chunk; from print.c */
  35. LUAI_FUNC void luaU_print (const Proto* f, int full);
  36. #endif
  37. /* for header of binary files -- this is Lua 5.1 */
  38. #define LUAC_VERSION 0x51
  39. /* for header of binary files -- this is the official format */
  40. #define LUAC_FORMAT 0
  41. /* size of header of binary files */
  42. #define LUAC_HEADERSIZE 12
  43. /* error codes from cross-compiler */
  44. /* target integer is too small to hold a value */
  45. #define LUA_ERR_CC_INTOVERFLOW 101
  46. /* target lua_Number is integral but a constant is non-integer */
  47. #define LUA_ERR_CC_NOTINTEGER 102
  48. #endif