[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Modules for iconv (Was: UTF-8 patterns in Lua 5.3)
- From: Sean Conner <sean@...>
- Date: Sat, 19 Apr 2014 06:10:49 -0400
It was thus said that the Great Dirk Laurie once stated:
> 2014-04-19 8:55 GMT+02:00 Sean Conner <sean@conman.org>:
> > It was thus said that the Great Dirk Laurie once stated:
> >> 2014-04-18 22:28 GMT+02:00 Sean Conner <sean@conman.org>:
> >>
> >> > requires a C99 compiler
> >>
> >> Does POSIX.1-2001 compliance imply all of C99?
> >
> > I think POSIX only covers functions available, not langauge features. The
> > problematic part of the code is:
> >
> > static int luametaiconv_iconv(lua_State *L)
> > {
> > const char *from;
> > size_t fsize;
> > iconv_t *pic;
> >
> > pic = luaL_checkudata(L,1,TYPE_ICONV);
> > from = luaL_checklstring(L,2,&fsize);
> >
> > size_t rc;
> > size_t tsize = fsize * 8; /* a reasonable guess here */
> > char to[tsize];
> > char *pto = to;
> >
> > I could hoise the variable declarations up above the two function calls,
> > but I still have the variably size array to contend with, and frankly, with
> > C99 being fifteen years old now, I want to use those features, damn it! I
> > don't want to be held hostage to Microsoft, so I'm not changing the code.
>
> Can't you do it with luaL_Buffer instead?
Hmm ... I'm rereading the man page, and I may not be doing it correctly.
I may be able to use luaL_Buffer and a fixed-length output buffer, but I'm
still not going to be hostage to Microsoft (so I'll still use C99 features).
-spc (Will have to work on this tomorrow ... )