lstring.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. ** $Id: lstring.h,v 1.31 2001/02/23 17:17:25 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. ** type equivalent to Udata, but with maximum alignment requirements
  12. */
  13. union L_UUdata {
  14. Udata u;
  15. union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
  16. };
  17. /*
  18. ** any TString with mark>=FIXMARK is never collected.
  19. ** Marks>=RESERVEDMARK are used to identify reserved words.
  20. */
  21. #define FIXMARK 2
  22. #define RESERVEDMARK 3
  23. #define sizestring(l) ((lu_mem)sizeof(union L_UTString)+ \
  24. ((lu_mem)(l)+1)*sizeof(l_char))
  25. #define sizeudata(l) ((lu_mem)sizeof(union L_UUdata)+(l))
  26. #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
  27. #define luaS_newliteral(L, s) (luaS_newlstr(L, l_s("") s, \
  28. (sizeof(s)/sizeof(l_char))-1))
  29. void luaS_resize (lua_State *L, int newsize);
  30. Udata *luaS_newudata (lua_State *L, size_t s);
  31. void luaS_freeall (lua_State *L);
  32. TString *luaS_newlstr (lua_State *L, const l_char *str, size_t l);
  33. #endif