lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi All,

  I've been having problems trying to compile lua in "new" platforms,
where I don't have locale support, and.. some other things. I managed
to solve my problems by writing a fake locale replacement and also
some fake definitions, but I'm wondering if there is a proper way to
make lua not dependent on such things.

Here are my fake deps and functions, in order to compile lua:

  // Fake lua definitions and functions , to avoid patching lua:
  #define LUA_TMPNAMBUFSIZE       128
  #define lua_tmpnam(b,e)         {  e = (strcpy(b, "/tmp/lua_tmp") != b); }


  const char *getenv(const char *) { return 0; }
  FILE* tmpfile() { assert(!"Invalid call"); return 0; }
  char * setlocale ( int category, const char * locale ) {
assert(!"Invalid call"); return 0;}
  int system(const char *c) { assert(!"Invalid call"); return 0; }

And this is my fake locale.h :

#ifndef __LOCALE_FAKE_LUA_
#define __LOCALE_FAKE_LUA_

#define getlocaledecpoint() '.'
#define LC_ALL 0
#define LC_COLLATE 1
#define LC_CTYPE 2
#define LC_MONETARY 3
#define LC_NUMERIC 4
#define LC_TIME 5

 char * setlocale ( int category, const char * locale );

#endif

locale.h is required to be an independent file, it is included but
only getlocaledecpoint is used...

So my question is, is there a proper way to do not depend on locale,
system, and tmpfile? I don't have a proper implementation, and I don't
actually want it to be used from the scripts either.

Regards,
   JL


-- 
  Jose L. Hidalgo Valiño (PpluX)
  ---- http://www.pplux.com ----