lstring.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. ** $Id: lstring.h,v 1.25 2000/11/24 17:39:56 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. ** type equivalent to TString, but with maximum alignment requirements
  12. */
  13. union L_UTString {
  14. TString ts;
  15. union L_Umaxalign dummy; /* ensures maximum alignment for `local' udata */
  16. };
  17. /*
  18. ** any TString with mark>=FIXMARK is never collected.
  19. ** Marks>=RESERVEDMARK are used to identify reserved words.
  20. */
  21. #define FIXMARK 2
  22. #define RESERVEDMARK 3
  23. #define sizestring(l) ((lint32)sizeof(TString) + \
  24. ((lint32)(l+1)-TSPACK)*(lint32)sizeof(char))
  25. #define sizeudata(l) ((luint32)sizeof(union L_UTString)+(l))
  26. void luaS_init (lua_State *L);
  27. void luaS_resize (lua_State *L, stringtable *tb, int newsize);
  28. TString *luaS_newudata (lua_State *L, size_t s, void *udata);
  29. TString *luaS_createudata (lua_State *L, void *udata, int tag);
  30. void luaS_freeall (lua_State *L);
  31. TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
  32. TString *luaS_new (lua_State *L, const char *str);
  33. TString *luaS_newfixed (lua_State *L, const char *str);
  34. #endif