lstring.h 942 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. ** $Id: lstring.h,v 1.45 2010/04/03 20:24:18 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_newliteral(L, s) (luaS_newlstr(L, "" s, \
  14. (sizeof(s)/sizeof(char))-1))
  15. #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT)
  16. /*
  17. ** as all string are internalized, string equality becomes
  18. ** pointer equality
  19. */
  20. #define eqstr(a,b) ((a) == (b))
  21. LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
  22. LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e);
  23. LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
  24. LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
  25. #endif