lstring.h 956 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. ** $Id: lstring.h,v 1.32 2001/06/06 18:00:19 roberto Exp roberto $
  3. ** String table (keep all strings handled by Lua)
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef lstring_h
  7. #define lstring_h
  8. #include "lobject.h"
  9. #include "lstate.h"
  10. /*
  11. ** any TString with mark>=FIXMARK is never collected.
  12. ** Marks>=RESERVEDMARK are used to identify reserved words.
  13. */
  14. #define FIXMARK 2
  15. #define RESERVEDMARK 3
  16. #define sizestring(l) ((lu_mem)sizeof(union TString)+ \
  17. ((lu_mem)(l)+1)*sizeof(l_char))
  18. #define sizeudata(l) ((lu_mem)sizeof(union Udata)+(l))
  19. #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
  20. #define luaS_newliteral(L, s) (luaS_newlstr(L, l_s("") s, \
  21. (sizeof(s)/sizeof(l_char))-1))
  22. void luaS_resize (lua_State *L, int newsize);
  23. Udata *luaS_newudata (lua_State *L, size_t s);
  24. void luaS_freeall (lua_State *L);
  25. TString *luaS_newlstr (lua_State *L, const l_char *str, size_t l);
  26. #endif