lstring.h 1010 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. ** $Id: lstring.h,v 1.35 2001/11/28 20:13:13 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) (cast(lu_mem, sizeof(union TString))+ \
  17. (cast(lu_mem, l)+1)*sizeof(char))
  18. #define sizeudata(l) (cast(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, "" s, \
  21. (sizeof(s)/sizeof(char))-1))
  22. #define luaS_fix(s) ((s)->tsv.marked = FIXMARK)
  23. void luaS_resize (lua_State *L, int newsize);
  24. Udata *luaS_newudata (lua_State *L, size_t s);
  25. void luaS_freeall (lua_State *L);
  26. TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
  27. #endif