summaryrefslogtreecommitdiff
path: root/src/locale
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-16 14:00:51 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-16 14:00:51 -0400
commit896e28812c51b9ffdf3efc00c7d7ef699e380a58 (patch)
treeaaa25e093fb4a2ac4c57609e1f745e5ac0734ca8 /src/locale
parent0b0d1fe1d4fbf8560577d81e5af0549683eac8ba (diff)
formatting
Diffstat (limited to 'src/locale')
-rw-r--r--src/locale/LC_ALL.c2
-rw-r--r--src/locale/LC_COLLATE.c2
-rw-r--r--src/locale/LC_CTYPE.c2
-rw-r--r--src/locale/LC_MONETARY.c2
-rw-r--r--src/locale/LC_NUMERIC.c2
-rw-r--r--src/locale/LC_TIME.c2
-rw-r--r--src/locale/NULL.ref1
-rw-r--r--src/locale/__load_locale.c18
-rw-r--r--src/locale/_locale.h28
-rw-r--r--src/locale/localeconv.c3
-rw-r--r--src/locale/setlocale.c16
-rw-r--r--src/locale/struct_lconv.c2
12 files changed, 45 insertions, 35 deletions
diff --git a/src/locale/LC_ALL.c b/src/locale/LC_ALL.c
index 164a18ae..12702e1a 100644
--- a/src/locale/LC_ALL.c
+++ b/src/locale/LC_ALL.c
@@ -1,4 +1,3 @@
-#include <locale.h>
#define LC_ALL (0)
/** all locale categories **/
@@ -7,6 +6,7 @@
is used as the ARGUMENT(category) in a call to FUNCTION(setlocale) to operate
on all categories of the current locale.
***/
+
/*
STDC(1)
*/
diff --git a/src/locale/LC_COLLATE.c b/src/locale/LC_COLLATE.c
index 2708525c..ea46b97f 100644
--- a/src/locale/LC_COLLATE.c
+++ b/src/locale/LC_COLLATE.c
@@ -1,4 +1,3 @@
-#include <locale.h>
#define LC_COLLATE (1)
/** locale collation category **/
@@ -7,6 +6,7 @@
is used as the ARGUMENT(category) in a call to FUNCTION(setlocale) to operate
on the portion of the locale that affects sorting and collating strings.
***/
+
/*
STDC(1)
*/
diff --git a/src/locale/LC_CTYPE.c b/src/locale/LC_CTYPE.c
index 9095cf60..cfe07f22 100644
--- a/src/locale/LC_CTYPE.c
+++ b/src/locale/LC_CTYPE.c
@@ -1,4 +1,3 @@
-#include <locale.h>
#define LC_CTYPE (2)
/** locale character handling category **/
@@ -8,6 +7,7 @@ is used as the ARGUMENT(category) in a call to FUNCTION(setlocale) to operate
on the portion of the locale that affects classifying and transforming
individual characters.
***/
+
/*
STDC(1)
*/
diff --git a/src/locale/LC_MONETARY.c b/src/locale/LC_MONETARY.c
index cdc94832..82b5ca1c 100644
--- a/src/locale/LC_MONETARY.c
+++ b/src/locale/LC_MONETARY.c
@@ -1,4 +1,3 @@
-#include <locale.h>
#define LC_MONETARY (3)
/** locale monetary formatting category **/
@@ -7,6 +6,7 @@
is used as the ARGUMENT(category) in a call to FUNCTION(setlocale) to operate
on the portion of the locale that affects formatting monetary values.
***/
+
/*
STDC(1)
*/
diff --git a/src/locale/LC_NUMERIC.c b/src/locale/LC_NUMERIC.c
index 80459086..1c874956 100644
--- a/src/locale/LC_NUMERIC.c
+++ b/src/locale/LC_NUMERIC.c
@@ -1,4 +1,3 @@
-#include <locale.h>
#define LC_NUMERIC (4)
/** locale number formatting category **/
@@ -8,6 +7,7 @@ is used as the ARGUMENT(category) in a call to FUNCTION(setlocale) to operate
on the portion of the locale that affects formatting numeric values, except
for monetary values.
***/
+
/*
STDC(1)
*/
diff --git a/src/locale/LC_TIME.c b/src/locale/LC_TIME.c
index e3e70662..f97a70a8 100644
--- a/src/locale/LC_TIME.c
+++ b/src/locale/LC_TIME.c
@@ -1,4 +1,3 @@
-#include <locale.h>
#define LC_TIME (5)
/** locale time formatting category **/
@@ -7,6 +6,7 @@
is used as the ARGUMENT(category) in a call to FUNCTION(setlocale) to operate
on the portion of the locale that affects formatting date and time values.
***/
+
/*
STDC(1)
*/
diff --git a/src/locale/NULL.ref b/src/locale/NULL.ref
index e1d480f2..b247705b 100644
--- a/src/locale/NULL.ref
+++ b/src/locale/NULL.ref
@@ -1,3 +1,2 @@
-#include <locale.h>
REFERENCE(stddef/NULL.c)
STDC(1)
diff --git a/src/locale/__load_locale.c b/src/locale/__load_locale.c
index f25392f8..66177eb6 100644
--- a/src/locale/__load_locale.c
+++ b/src/locale/__load_locale.c
@@ -1,19 +1,11 @@
-#include "locale.h"
-#include "limits.h"
-#include "stdio.h"
-#include "string.h"
+#include <locale.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
#include "_locale.h"
#include "ctype/_ctype.h"
-#define LC_COLLATE_MASK (1<<0)
-#define LC_CTYPE_MASK (1<<1)
-#define LC_MONETARY_MASK (1<<2)
-#define LC_NUMERIC_MASK (1<<3)
-#define LC_TIME_MASK (1<<4)
-#define LC_MESSAGES_MASK (1<<5)
-#define LC_ALL_MASK (0xff)
-
#define setall(_map, _input, _mask) do { \
size_t _i; \
for (_i = 0; _i < sizeof(_input) - 1; _i++) { \
@@ -218,6 +210,7 @@ char * __load_locale(struct __locale_t *loc, int mask, const char *name)
}
}
+ #ifdef LC_MESSAGES
if (mask & LC_MESSAGES_MASK) {
strcpy(loc->messages, name);
@@ -230,6 +223,7 @@ char * __load_locale(struct __locale_t *loc, int mask, const char *name)
loc->lc_messages.noexpr = NULL;
}
}
+ #endif
return (char*)name;
}
diff --git a/src/locale/_locale.h b/src/locale/_locale.h
index 8f974ef3..3ca6c546 100644
--- a/src/locale/_locale.h
+++ b/src/locale/_locale.h
@@ -4,6 +4,34 @@
#include <locale.h>
#include <limits.h>
+#ifndef LC_ALL_MASK
+#include "LC_ALL_MASK.c"
+#endif
+
+#ifndef LC_COLLATE_MASK
+#include "LC_COLLATE_MASK.c"
+#endif
+
+#ifndef LC_CTYPE_MASK
+#include "LC_CTYPE_MASK.c"
+#endif
+
+#ifndef LC_NUMERIC_MASK
+#include "LC_NUMERIC_MASK.c"
+#endif
+
+#ifndef LC_TIME_MASK
+#include "LC_TIME_MASK.c"
+#endif
+
+#ifndef LC_MESSAGES_MASK
+#include "LC_MESSAGES_MASK.c"
+#endif
+
+#ifndef LC_MONETARY_MASK
+#include "LC_MONETARY_MASK.c"
+#endif
+
struct __locale_t {
char all[UCHAR_MAX];
diff --git a/src/locale/localeconv.c b/src/locale/localeconv.c
index 0021c13a..90432faf 100644
--- a/src/locale/localeconv.c
+++ b/src/locale/localeconv.c
@@ -2,6 +2,7 @@
#include "_locale.h"
/** return locale-specific information **/
+
struct lconv * localeconv(void)
{
/*
@@ -18,7 +19,5 @@ use in formatting numbers and monetary values.
/*
LC_MONETARY
LC_NUMERIC
-*/
-/*
STDC(1)
*/
diff --git a/src/locale/setlocale.c b/src/locale/setlocale.c
index 72478686..5b5dbcde 100644
--- a/src/locale/setlocale.c
+++ b/src/locale/setlocale.c
@@ -1,15 +1,9 @@
#include <locale.h>
-#include "string.h"
-#include "stdlib.h"
+#include <string.h>
+#include <stdlib.h>
#include "_locale.h"
-#include "LC_ALL_MASK.c"
-#include "LC_COLLATE_MASK.c"
-#include "LC_CTYPE_MASK.c"
-#include "LC_NUMERIC_MASK.c"
-#include "LC_TIME_MASK.c"
-#include "LC_MESSAGES_MASK.c"
-#include "LC_MONETARY_MASK.c"
+/** get or set program locale **/
char * setlocale(int category, const char *locale)
{
@@ -47,8 +41,6 @@ char * setlocale(int category, const char *locale)
return __load_locale(l, mask, locale);
}
-/** get or set program locale **/
-
/***
sets or retrieves the current global locale of the
program. The program locale has global effects of various operations, based
@@ -89,7 +81,5 @@ to support std(POSIX).
RETURN(CONSTANT(NULL), the request could not be honored)
RETURN(NONNULL, the current locale name for ARGUMENT(category))
IMPLEMENTATION(The native environment)
-*/
-/*
STDC(1)
*/
diff --git a/src/locale/struct_lconv.c b/src/locale/struct_lconv.c
index 6f71fa20..561c59c2 100644
--- a/src/locale/struct_lconv.c
+++ b/src/locale/struct_lconv.c
@@ -1,4 +1,3 @@
-#include <locale.h>
struct lconv {
/** The character that separates the whole and decimal portions of non-monetary values **/
char *decimal_point; /* "." */
@@ -60,6 +59,7 @@ struct lconv {
};
/* values specified in comments are for the "C" locale */
+
/*
STDC(1)
*/