localeconv.c (72284) | localeconv.c (72321) |
---|---|
1/* 2 * Copyright (c) 2001 Alexey Zelkin 3 * Copyright (c) 1991, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 15 unchanged lines hidden (view full) --- 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#if defined(LIBC_SCCS) && !defined(lint) 29#if 0 30static char sccsid[] = "@(#)localeconv.c 8.1 (Berkeley) 6/4/93"; 31#endif | 1/* 2 * Copyright (c) 2001 Alexey Zelkin 3 * Copyright (c) 1991, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 15 unchanged lines hidden (view full) --- 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#if defined(LIBC_SCCS) && !defined(lint) 29#if 0 30static char sccsid[] = "@(#)localeconv.c 8.1 (Berkeley) 6/4/93"; 31#endif |
32static char rcsid[] = "$FreeBSD: head/lib/libc/locale/localeconv.c 72284 2001-02-10 04:32:55Z ache $"; | 32static char rcsid[] = "$FreeBSD: head/lib/libc/locale/localeconv.c 72321 2001-02-10 15:36:46Z phantom $"; |
33#endif /* LIBC_SCCS and not lint */ 34 35#include <locale.h> 36#include <stdlib.h> 37#include <limits.h> 38#include "lmonetary.h" 39#include "lnumeric.h" 40 --- 4 unchanged lines hidden (view full) --- 45 * Because localeconv() may be called many times (especially by library 46 * routines like printf() & strtod()), the approprate members of the 47 * lconv structure are computed only when the monetary or numeric 48 * locale has been changed. 49 */ 50int __mlocale_changed = 1; 51int __nlocale_changed = 1; 52 | 33#endif /* LIBC_SCCS and not lint */ 34 35#include <locale.h> 36#include <stdlib.h> 37#include <limits.h> 38#include "lmonetary.h" 39#include "lnumeric.h" 40 --- 4 unchanged lines hidden (view full) --- 45 * Because localeconv() may be called many times (especially by library 46 * routines like printf() & strtod()), the approprate members of the 47 * lconv structure are computed only when the monetary or numeric 48 * locale has been changed. 49 */ 50int __mlocale_changed = 1; 51int __nlocale_changed = 1; 52 |
53/* XXX: FIXME! */ 54/* Numbers separated by ";" must be parsed into byte array. */ 55static char nogrouping[] = { CHAR_MAX, '\0' }; 56 | |
57static char 58cnv(char *str) { 59 int i = strtol(str, NULL, 10); 60 if (i == -1) 61 i = CHAR_MAX; 62 return (char)i; 63} 64 --- 12 unchanged lines hidden (view full) --- 77#define M_ASSIGN_STR(NAME) (ret.NAME = (char*)mptr->NAME) 78#define M_ASSIGN_CHAR(NAME) (ret.NAME = cnv((char*)mptr->NAME)) 79 80 mptr = __get_current_monetary_locale(); 81 M_ASSIGN_STR(int_curr_symbol); 82 M_ASSIGN_STR(currency_symbol); 83 M_ASSIGN_STR(mon_decimal_point); 84 M_ASSIGN_STR(mon_thousands_sep); | 53static char 54cnv(char *str) { 55 int i = strtol(str, NULL, 10); 56 if (i == -1) 57 i = CHAR_MAX; 58 return (char)i; 59} 60 --- 12 unchanged lines hidden (view full) --- 73#define M_ASSIGN_STR(NAME) (ret.NAME = (char*)mptr->NAME) 74#define M_ASSIGN_CHAR(NAME) (ret.NAME = cnv((char*)mptr->NAME)) 75 76 mptr = __get_current_monetary_locale(); 77 M_ASSIGN_STR(int_curr_symbol); 78 M_ASSIGN_STR(currency_symbol); 79 M_ASSIGN_STR(mon_decimal_point); 80 M_ASSIGN_STR(mon_thousands_sep); |
85 /* XXX: FIXME! */ 86 /* Numbers separated by ";" must be parsed into byte array. */ 87 ret.mon_grouping = nogrouping; | 81 M_ASSIGN_STR(mon_grouping); |
88 M_ASSIGN_STR(positive_sign); 89 M_ASSIGN_STR(negative_sign); 90 M_ASSIGN_CHAR(int_frac_digits); 91 M_ASSIGN_CHAR(frac_digits); 92 M_ASSIGN_CHAR(p_cs_precedes); 93 M_ASSIGN_CHAR(p_sep_by_space); 94 M_ASSIGN_CHAR(n_cs_precedes); 95 M_ASSIGN_CHAR(n_sep_by_space); --- 6 unchanged lines hidden (view full) --- 102 /* LC_NUMERIC part */ 103 struct lc_numeric_T * nptr; 104 105#define N_ASSIGN_STR(NAME) (ret.NAME = (char*)nptr->NAME) 106 107 nptr = __get_current_numeric_locale(); 108 N_ASSIGN_STR(decimal_point); 109 N_ASSIGN_STR(thousands_sep); | 82 M_ASSIGN_STR(positive_sign); 83 M_ASSIGN_STR(negative_sign); 84 M_ASSIGN_CHAR(int_frac_digits); 85 M_ASSIGN_CHAR(frac_digits); 86 M_ASSIGN_CHAR(p_cs_precedes); 87 M_ASSIGN_CHAR(p_sep_by_space); 88 M_ASSIGN_CHAR(n_cs_precedes); 89 M_ASSIGN_CHAR(n_sep_by_space); --- 6 unchanged lines hidden (view full) --- 96 /* LC_NUMERIC part */ 97 struct lc_numeric_T * nptr; 98 99#define N_ASSIGN_STR(NAME) (ret.NAME = (char*)nptr->NAME) 100 101 nptr = __get_current_numeric_locale(); 102 N_ASSIGN_STR(decimal_point); 103 N_ASSIGN_STR(thousands_sep); |
110 /* XXX: FIXME! */ 111 /* Numbers separated by ";" must be parsed into byte array. */ 112 ret.grouping = nogrouping; | 104 N_ASSIGN_STR(grouping); |
113 __nlocale_changed = 0; 114 } 115 116 return (&ret); 117} | 105 __nlocale_changed = 0; 106 } 107 108 return (&ret); 109} |