lstring.h 838 B

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