Home | History | Annotate | Line # | Download | only in src
      1 /*	$NetBSD: lundump.h,v 1.8 2023/04/16 20:46:17 nikita Exp $	*/
      2 
      3 /*
      4 ** Id: lundump.h
      5 ** load precompiled Lua chunks
      6 ** See Copyright Notice in lua.h
      7 */
      8 
      9 #ifndef lundump_h
     10 #define lundump_h
     11 
     12 #include "llimits.h"
     13 #include "lobject.h"
     14 #include "lzio.h"
     15 
     16 
     17 /* data to catch conversion errors */
     18 #define LUAC_DATA	"\x19\x93\r\n\x1a\n"
     19 
     20 #define LUAC_INT	0x5678
     21 #define LUAC_NUM	cast_num(370.5)
     22 
     23 /*
     24 ** Encode major-minor version in one byte, one nibble for each
     25 */
     26 #define MYINT(s)	(s[0]-'0')  /* assume one-digit numerals */
     27 #define LUAC_VERSION	(MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR))
     28 
     29 #define LUAC_FORMAT	0	/* this is the official format */
     30 
     31 /* load one chunk; from lundump.c */
     32 LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name);
     33 
     34 /* dump one chunk; from ldump.c */
     35 LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w,
     36                          void* data, int strip);
     37 
     38 #endif
     39