lstring.h 776 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. ** $Id: lstring.h,v 1.39 2004/08/24 20:12:06 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 "lgc.h"
  9. #include "lobject.h"
  10. #include "lstate.h"
  11. #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char))
  12. #define sizeudata(u) (sizeof(union Udata)+(u)->len)
  13. #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
  14. #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \
  15. (sizeof(s)/sizeof(char))-1))
  16. #define luaS_fix(s) setbit((s)->tsv.marked, FIXEDBIT)
  17. void luaS_resize (lua_State *L, int newsize);
  18. Udata *luaS_newudata (lua_State *L, size_t s);
  19. TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
  20. #endif