Exemplo n.º 1
0
char _Locale_frac_digits(struct _Locale_monetary *__loc)
{
  return __loc != 0 ? *(__nl_langinfo_l(FRAC_DIGITS, (__c_locale)__loc)) : CHAR_MAX;
}
Exemplo n.º 2
0
/* 1 if currency_symbol precedes a negative value, 0 if succeeds */
int _Locale_n_cs_precedes(struct _Locale_monetary *__loc)
{
  return __loc != 0 ? *(__nl_langinfo_l(N_CS_PRECEDES, (__c_locale)__loc)) : CHAR_MAX;
}
Exemplo n.º 3
0
char *
nl_langinfo (nl_item item)
{
  return __nl_langinfo_l (item, _NL_CURRENT_LOCALE);
}
Exemplo n.º 4
0
const char *_Locale_negative_sign(struct _Locale_monetary *__loc)
{
  return __loc != 0 ? __nl_langinfo_l(NEGATIVE_SIGN, (__c_locale)__loc) : _empty_str;
}
Exemplo n.º 5
0
const char *_Locale_d_t_fmt(struct _Locale_time *__loc)
{
  return __loc != 0 ? __nl_langinfo_l(D_T_FMT, (__c_locale)__loc) : 0;
}
Exemplo n.º 6
0
const char *_Locale_pm_str(struct _Locale_time* __loc )
{
  return __loc != 0 ? __nl_langinfo_l(PM_STR, (__c_locale)__loc) : _empty_str;
}
Exemplo n.º 7
0
const char *_Locale_int_curr_symbol(struct _Locale_monetary *__loc)
{
  return __loc != 0 ? __nl_langinfo_l(INT_CURR_SYMBOL, (__c_locale)__loc) : 0;
}
Exemplo n.º 8
0
const char *_Locale_abbrev_monthname(struct _Locale_time *__loc, int _m )
{
  return (__loc != 0 && _m >= 0 && _m < 12) ? __nl_langinfo_l(ABMON_1 + _m, (__c_locale)__loc) : 0;
}
Exemplo n.º 9
0
const char *_Locale_true(struct _Locale_numeric *__loc)
{
  return __loc != 0 ? __nl_langinfo_l(YESSTR, (__c_locale)__loc) : "true";
}
Exemplo n.º 10
0
const char *_Locale_false(struct _Locale_numeric *__loc)
{
  return __loc != 0 ? __nl_langinfo_l(NOSTR, (__c_locale)__loc) : "false";
}
Exemplo n.º 11
0
const char* _Locale_grouping(struct _Locale_numeric *__loc)
{
  return (__loc != 0 && _Locale_thousands_sep(__loc) != '\0' ) ?
    (__nl_langinfo_l(GROUPING, (__c_locale)__loc)) : "";
}
Exemplo n.º 12
0
char _Locale_thousands_sep(struct _Locale_numeric *__loc)
{
  return (__loc != 0) ? *(__nl_langinfo_l(THOUSEP, (__c_locale)__loc)) : ',';
}
Exemplo n.º 13
0
char _Locale_decimal_point(struct _Locale_numeric *__loc)
{
  return (__loc != 0) ? *(__nl_langinfo_l(RADIXCHAR, (__c_locale)__loc)) : '.';
}
Exemplo n.º 14
0
/* 1 if a space separates currency_symbol from a negative value. */
int _Locale_n_sep_by_space(struct _Locale_monetary *__loc)
{
  return __loc != 0 ? *(__nl_langinfo_l(N_SEP_BY_SPACE, (__c_locale)__loc)) : CHAR_MAX;
}
Exemplo n.º 15
0
const char *_Locale_currency_symbol(struct _Locale_monetary *__loc)
{
  return __loc != 0 ? __nl_langinfo_l(CURRENCY_SYMBOL, (__c_locale)__loc) : 0;
}
Exemplo n.º 16
0
/*
 * 0 Parentheses surround the quantity and currency_symbol
 * 1 The sign string precedes the quantity and currency_symbol
 * 2 The sign string succeeds the quantity and currency_symbol.
 * 3 The sign string immediately precedes the currency_symbol.
 * 4 The sign string immediately succeeds the currency_symbol.
 */
int _Locale_n_sign_posn(struct _Locale_monetary *__loc)
{
  return __loc != 0 ? *(__nl_langinfo_l(N_SIGN_POSN, (__c_locale)__loc)) : CHAR_MAX;
}
Exemplo n.º 17
0
char _Locale_mon_decimal_point(struct _Locale_monetary * __loc)
{
  return __loc != 0 ? *(__nl_langinfo_l(MON_DECIMAL_POINT,(__c_locale)__loc)) : '.';
}
Exemplo n.º 18
0
const char *_Locale_abbrev_dayofweek(struct _Locale_time *__loc, int _d )
{
  return (__loc != 0 && _d >= 0 && _d < 7) ? __nl_langinfo_l(ABDAY_1 + _d, (__c_locale)__loc) : 0;
}
Exemplo n.º 19
0
char _Locale_mon_thousands_sep(struct _Locale_monetary *__loc)
{
  return __loc != 0 ? *(__nl_langinfo_l(MON_THOUSANDS_SEP, (__c_locale)__loc)) : ',';
}
Exemplo n.º 20
0
const char *_Locale_long_d_fmt(struct _Locale_time *__loc )
{
  return __loc != 0 ? __nl_langinfo_l(ERA_D_FMT, (__c_locale)__loc) : 0;
}
Exemplo n.º 21
0
const char *_Locale_mon_grouping(struct _Locale_monetary *__loc)
{
  return (__loc != 0 && _Locale_mon_thousands_sep( __loc ) != '\0' ) ?
    __nl_langinfo_l(MON_GROUPING, (__c_locale)__loc) : _empty_str;
}
Exemplo n.º 22
0
const char *_Locale_t_fmt_ampm(struct _Locale_time *__loc )
{
  return __loc != 0 ? __nl_langinfo_l(T_FMT_AMPM, (__c_locale)__loc) : 0;
}
Exemplo n.º 23
0
const char* __strftime_fmt_1(char (*s)[100],
                             size_t* l,
                             int f,
                             const struct tm* tm,
                             locale_t loc) {
  nl_item item;
  long long val;
  const char* fmt = "-";
  int width = 2;

  switch (f) {
    case 'a':
      if (tm->tm_wday > 6U)
        goto string;
      item = ABDAY_1 + tm->tm_wday;
      goto nl_strcat;
    case 'A':
      if (tm->tm_wday > 6U)
        goto string;
      item = DAY_1 + tm->tm_wday;
      goto nl_strcat;
    case 'h':
    case 'b':
      if (tm->tm_mon > 11U)
        goto string;
      item = ABMON_1 + tm->tm_mon;
      goto nl_strcat;
    case 'B':
      if (tm->tm_mon > 11U)
        goto string;
      item = MON_1 + tm->tm_mon;
      goto nl_strcat;
    case 'c':
      item = D_T_FMT;
      goto nl_strftime;
    case 'C':
      val = (1900LL + tm->tm_year) / 100;
      goto number;
    case 'd':
      val = tm->tm_mday;
      goto number;
    case 'D':
      fmt = "%m/%d/%y";
      goto recu_strftime;
    case 'e':
      *l = snprintf(*s, sizeof *s, "%2d", tm->tm_mday);
      return *s;
    case 'F':
      fmt = "%Y-%m-%d";
      goto recu_strftime;
    case 'g':
    case 'G':
      val = tm->tm_year + 1900LL;
      if (tm->tm_yday < 3 && week_num(tm) != 1)
        val--;
      else if (tm->tm_yday > 360 && week_num(tm) == 1)
        val++;
      if (f == 'g')
        val %= 100;
      else
        width = 4;
      goto number;
    case 'H':
      val = tm->tm_hour;
      goto number;
    case 'I':
      val = tm->tm_hour;
      if (!val)
        val = 12;
      else if (val > 12)
        val -= 12;
      goto number;
    case 'j':
      val = tm->tm_yday + 1;
      width = 3;
      goto number;
    case 'm':
      val = tm->tm_mon + 1;
      goto number;
    case 'M':
      val = tm->tm_min;
      goto number;
    case 'n':
      *l = 1;
      return "\n";
    case 'p':
      item = tm->tm_hour >= 12 ? PM_STR : AM_STR;
      goto nl_strcat;
    case 'r':
      item = T_FMT_AMPM;
      goto nl_strftime;
    case 'R':
      fmt = "%H:%M";
      goto recu_strftime;
    case 's':
      val = __tm_to_secs(tm) - tm->__tm_gmtoff;
      width = 1;
      goto number;
    case 'S':
      val = tm->tm_sec;
      goto number;
    case 't':
      *l = 1;
      return "\t";
    case 'T':
      fmt = "%H:%M:%S";
      goto recu_strftime;
    case 'u':
      val = tm->tm_wday ? tm->tm_wday : 7;
      width = 1;
      goto number;
    case 'U':
      val = (tm->tm_yday + 7U - tm->tm_wday) / 7;
      goto number;
    case 'W':
      val = (tm->tm_yday + 7U - (tm->tm_wday + 6U) % 7) / 7;
      goto number;
    case 'V':
      val = week_num(tm);
      goto number;
    case 'w':
      val = tm->tm_wday;
      width = 1;
      goto number;
    case 'x':
      item = D_FMT;
      goto nl_strftime;
    case 'X':
      item = T_FMT;
      goto nl_strftime;
    case 'y':
      val = tm->tm_year % 100;
      goto number;
    case 'Y':
      val = tm->tm_year + 1900LL;
      if (val >= 10000) {
        *l = snprintf(*s, sizeof *s, "+%lld", val);
        return *s;
      }
      width = 4;
      goto number;
    case 'z':
      if (tm->tm_isdst < 0) {
        *l = 0;
        return "";
      }
      *l = snprintf(*s, sizeof *s, "%+.2d%.2d", (tm->__tm_gmtoff) / 3600,
                    abs(tm->__tm_gmtoff % 3600) / 60);
      return *s;
    case 'Z':
      if (tm->tm_isdst < 0) {
        *l = 0;
        return "";
      }
      fmt = __tm_to_tzname(tm);
      goto string;
    case '%':
      *l = 1;
      return "%";
    default:
      return 0;
  }
number:
  *l = snprintf(*s, sizeof *s, "%0*lld", width, val);
  return *s;
nl_strcat:
  fmt = __nl_langinfo_l(item, loc);
string:
  *l = strlen(fmt);
  return fmt;
nl_strftime:
  fmt = __nl_langinfo_l(item, loc);
recu_strftime:
  *l = __strftime_l(*s, sizeof *s, fmt, tm, loc);
  if (!*l)
    return 0;
  return *s;
}