delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/29/12:42:23

Date: Mon, 29 Jan 2001 12:42:19 -0500
Message-Id: <200101291742.MAA10181@envy.delorie.com>
X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp-workers AT delorie DOT com
In-reply-to: <75955792.7119524B.09ACFA57@netscape.net>
(AAganichev AT netscape DOT net)
Subject: Re: locale support: 2nd approach
References: <75955792 DOT 7119524B DOT 09ACFA57 AT netscape DOT net>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Couple of little nits, haven't read it closely yet.

> #include <sys/farptr.h>

Use <sys/farptrgs.h> for libc functions.

> static char lcn_collate[256]  = "C";
> static char lcn_ctype[256]    = "C";
> static char lcn_monetary[256] = "C";
> static char lcn_numeric[256]  = "C";
> static char lcn_time[256]     = "C";
>
> static char currency_symbol[16] = "";
> static char mon_decimal_point[16] = "";
> static char mon_thousands_sep[16] = "";
> static char decimal_point[16] = ".";
> static char thousands_sep[16] = "";

These are really big arrays for such tiny strings.

>   if (category == LC_ALL) {

Please put open braces under the if, not on the same line.

>     switch(category) {

Ditto for switch, plus please put a space after "switch" so it doesn't
look like a function call.

>           tolower(i) = i;
>           toupper(i) = i;

This isn't portable, or even a good idea.

>         if(lcnv) {

Ditto space after "if".

>           strcpy (lcn_monetary, locale);

*no* spaces after function names in DJGPP sources.

>         } else

Braces on their own lines.

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

Types on their own line, start second line with function name.

>   static char rv[256];

Another big buffer to bloat programs with?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019