lstring.h 981 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. ** $Id: lstring.h,v 1.28 2001/02/09 19:53:16 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) ((luint32)sizeof(union L_UTString)+(l)+1)
  17. #define sizeudata(l) ((luint32)sizeof(union L_UTString)+(l))
  18. #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))
  19. #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, (sizeof(s))-1))
  20. void luaS_init (lua_State *L);
  21. void luaS_resize (lua_State *L, stringtable *tb, int newsize);
  22. TString *luaS_newudata (lua_State *L, size_t s, void *udata);
  23. int luaS_createudata (lua_State *L, void *udata, TObject *o);
  24. void luaS_freeall (lua_State *L);
  25. TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
  26. #endif