On Mon, 4 Mar 2002 13:48:58 +0100 (CET)
Bruno Haible <[EMAIL PROTECTED]> wrote:
> Michael B Allen writes:
> > Can I statically link of the codepage headers (e.g. cp1252.h) from
> > libiconv with an MIT Licensed module? I would not actually alter the
> > file of course so a user could not modify the LGPL files in my module
> > any more than if they had used libiconv directly.
>
> Legally speaking: cp1252.h is code, not public header file. As long as
> you don't distribute the resulting binaries/libraries, you can link it
> with anything you want. If you want to distribute the result, however,
> it must all fall under LGPL, which for binaries is roughly equivalent
> to GPL. Namely, you must distribute the source of all the
> binary/library.
Well I would distribute the source but my plan has since changed ...
<snip>
>
> 2) You can convert to an encoding where each character occupies a
> fixed number of bytes, like UCS-4, and specify an output buffer of
> precisely the size that can hold the number of characters that you
> need.
Been there, done that. I want more than that. What I'm doing (mostly
have done) is implementing these signatures:
int enc_mbscpy(const char *src, char **dst, const char *tocode);
int enc_mbsncpy(const char *src, size_t sn, char **dst, size_t dn,
int wn, const char *tocode);
char *dec_mbscpy_new(char **src, const char *fromcode);
char *dec_mbsncpy_new(char **src, size_t sn, size_t dn,
int wn, const char *fromcode);
size_t dec_mbscpy(char **src, char *dst, const char *fromcode);
size_t dec_mbsncpy(char **src, size_t sn, char *dst, size_t dn,
int wn, const char *fromcode);
for encodeing and decoding strings. The two main differences here are
that we're converting to/from "many to one" where the "one" is the locale
dependent multi-byte string encoding (e.g. UTF-8) and that in addition
to contraining the operation by sn and dn bytes you can also contrain
the operation by the number of characters wn. Mbsncpy_new is like a
mbsndup and if dst is NULL for the dec_ functions it still works but
doesn't write anything to memory so it's good for mallocing memory of
the right size before decoding a string. These signatures are ideal for
picking apart file formats, network packets, serializing data, or just
about anything really.
So .... I had manually done UTF-8, UCS-2s, UCS-4s, and was going to do a
few select code pages (e.g. cp1250) pertainent to a few projects of mine
but I dropped all of that and just copied over libiconv-1.7/lib/iconv.c,
converted it minimally, copied over some loop routines, added the number
of characters contraint, and build directly against libiconv-1.7/lib.
Maybe after I test this a little you'll look at it and consider it for
inclusion in the "extras" directory? Otherwise I'll just distribute it
as an LGPL module.
Thanks,
Mike
--
May The Source be with you.
--
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/linux-utf8/