summaryrefslogtreecommitdiff
path: root/src/wctype
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-01-30 15:45:07 -0500
committerJakob Kaivo <jkk@ung.org>2024-01-30 15:45:07 -0500
commit910a86c095b6d7311d73fa88a632aa9b673243b2 (patch)
treea95289a96455cbb5d3bfe83a974583e05faa1ad1 /src/wctype
parentefef927455cf3ee7566fbe50d4344e3162e11635 (diff)
update standards and safety checks
Diffstat (limited to 'src/wctype')
-rw-r--r--src/wctype/_wctype.h4
-rw-r--r--src/wctype/iswalnum.c8
-rw-r--r--src/wctype/iswalpha.c8
-rw-r--r--src/wctype/iswblank.c10
-rw-r--r--src/wctype/iswcntrl.c8
-rw-r--r--src/wctype/iswctype.c10
-rw-r--r--src/wctype/iswdigit.c8
-rw-r--r--src/wctype/iswgraph.c8
-rw-r--r--src/wctype/iswlower.c8
-rw-r--r--src/wctype/iswprint.c8
-rw-r--r--src/wctype/iswpunct.c8
-rw-r--r--src/wctype/iswspace.c8
-rw-r--r--src/wctype/iswupper.c8
-rw-r--r--src/wctype/iswxdigit.c8
-rw-r--r--src/wctype/towctrans.c10
-rw-r--r--src/wctype/towlower.c8
-rw-r--r--src/wctype/towupper.c8
-rw-r--r--src/wctype/wctrans.c8
-rw-r--r--src/wctype/wctype.c8
19 files changed, 43 insertions, 111 deletions
diff --git a/src/wctype/_wctype.h b/src/wctype/_wctype.h
index cbfccfb4..8dfbf3cd 100644
--- a/src/wctype/_wctype.h
+++ b/src/wctype/_wctype.h
@@ -1 +1,5 @@
#include "ctype/_ctype.h"
+
+/*
+STDC(0)
+*/
diff --git a/src/wctype/iswalnum.c b/src/wctype/iswalnum.c
index 94c67f95..a6511816 100644
--- a/src/wctype/iswalnum.c
+++ b/src/wctype/iswalnum.c
@@ -1,13 +1,12 @@
-#if 0
-
#include <wctype.h>
#include <limits.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is alphanumeric **/
int iswalnum(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
return iswalpha(wc) || iswdigit(wc);
@@ -28,6 +27,3 @@ cclass(alpha) or cclass(digit) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswalpha.c b/src/wctype/iswalpha.c
index 77df7103..5785685c 100644
--- a/src/wctype/iswalpha.c
+++ b/src/wctype/iswalpha.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is alphabetic **/
int iswalpha(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t alpha = wctype("alpha");
@@ -28,6 +27,3 @@ cclass(alpha) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswblank.c b/src/wctype/iswblank.c
index 568b126a..ba90e6d4 100644
--- a/src/wctype/iswblank.c
+++ b/src/wctype/iswblank.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is blank **/
int iswblank(wint_t wc)
{
- ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
+ SIGNAL_SAFE(0);
+ //ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t blank = wctype("blank");
return iswctype(wc, blank);
@@ -27,6 +26,3 @@ class cclass(blank) in the current locale.
/*
STDC(199901)
*/
-
-
-#endif
diff --git a/src/wctype/iswcntrl.c b/src/wctype/iswcntrl.c
index a385e4e7..df56187d 100644
--- a/src/wctype/iswcntrl.c
+++ b/src/wctype/iswcntrl.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is a control character */
int iswcntrl(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t cntrl = wctype("cntrl");
@@ -28,6 +27,3 @@ cclass(cntrl) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswctype.c b/src/wctype/iswctype.c
index fcf84932..a5c64956 100644
--- a/src/wctype/iswctype.c
+++ b/src/wctype/iswctype.c
@@ -1,14 +1,13 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is part of a character class **/
int iswctype(wint_t wc, wctype_t desc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
- ASSERT_REPRESENTABLE(desc, 1, __libc.wctype.nwctype, "wctype_t", 0);
+ //ASSERT_REPRESENTABLE(desc, 1, __libc.wctype.nwctype, "wctype_t", 0);
/* TODO: actual work */
(void)wc; (void)desc;
@@ -32,6 +31,3 @@ returned by fn(wctype), in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswdigit.c b/src/wctype/iswdigit.c
index 23fae1e3..45aa0a22 100644
--- a/src/wctype/iswdigit.c
+++ b/src/wctype/iswdigit.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is a digit **/
int iswdigit(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t digit = wctype("digit");
@@ -28,6 +27,3 @@ cclass(digit) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswgraph.c b/src/wctype/iswgraph.c
index 3175b232..f4eaf94d 100644
--- a/src/wctype/iswgraph.c
+++ b/src/wctype/iswgraph.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is graphic **/
int iswgraph(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t graph = wctype("graph");
@@ -28,6 +27,3 @@ cclass(graph) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswlower.c b/src/wctype/iswlower.c
index b5a9d90b..44c044c8 100644
--- a/src/wctype/iswlower.c
+++ b/src/wctype/iswlower.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a character is a lowercase letter **/
int iswlower(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t lower = wctype("lower");
@@ -28,6 +27,3 @@ cclass(lower) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswprint.c b/src/wctype/iswprint.c
index 5b797d47..59607a0f 100644
--- a/src/wctype/iswprint.c
+++ b/src/wctype/iswprint.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is printable **/
int iswprint(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t print = wctype("print");
@@ -28,6 +27,3 @@ cclass(print) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswpunct.c b/src/wctype/iswpunct.c
index a98792e9..ce5e9982 100644
--- a/src/wctype/iswpunct.c
+++ b/src/wctype/iswpunct.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is punctuation **/
int iswpunct(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t punct = wctype("punct");
@@ -28,6 +27,3 @@ cclass(punct) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswspace.c b/src/wctype/iswspace.c
index d3969043..c23cbc33 100644
--- a/src/wctype/iswspace.c
+++ b/src/wctype/iswspace.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is white-space **/
int iswspace(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t space = wctype("space");
@@ -28,6 +27,3 @@ cclass(space) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswupper.c b/src/wctype/iswupper.c
index b0c5cace..7438e121 100644
--- a/src/wctype/iswupper.c
+++ b/src/wctype/iswupper.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is an uppercase letter **/
int iswupper(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t upper = wctype("upper");
@@ -29,6 +28,3 @@ cclass(upper) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/iswxdigit.c b/src/wctype/iswxdigit.c
index 540834c6..037a316f 100644
--- a/src/wctype/iswxdigit.c
+++ b/src/wctype/iswxdigit.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** test whether a wide character is a hexadecimal digit **/
int iswxdigit(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
wctype_t xdigit = wctype("xdigit");
@@ -28,6 +27,3 @@ class cclass(xdigit) in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/towctrans.c b/src/wctype/towctrans.c
index 68ebcaf0..903889df 100644
--- a/src/wctype/towctrans.c
+++ b/src/wctype/towctrans.c
@@ -1,13 +1,12 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
wint_t towctrans(wint_t wc, wctrans_t desc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
- ASSERT_REPRESENTABLE(desc, 1, __libc.wctype.nwctrans, "wctrans_t", 0);
+ //ASSERT_REPRESENTABLE(desc, 1, __libc.wctype.nwctrans, "wctrans_t", 0);
/* TODO: actual work */
(void)wc; (void)desc;
@@ -30,6 +29,3 @@ fn(wctrans), in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/towlower.c b/src/wctype/towlower.c
index 33714643..30258662 100644
--- a/src/wctype/towlower.c
+++ b/src/wctype/towlower.c
@@ -1,13 +1,12 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
#include <stdlib.h>
-#include "_assert.h"
+#include "_safety.h"
/** convert a wide uppercase letter to lowercase **/
wint_t towlower(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
if (!iswupper(wc)) {
@@ -33,6 +32,3 @@ lowercase letter in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/towupper.c b/src/wctype/towupper.c
index cb2b8096..41e097a7 100644
--- a/src/wctype/towupper.c
+++ b/src/wctype/towupper.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <wctype.h>
#include <wchar.h>
-#include "_assert.h"
+#include "_safety.h"
/** convert a wide lowercase letter to uppercase **/
wint_t towupper(wint_t wc)
{
+ SIGNAL_SAFE(0);
ASSERT_REPRESENTABLE(wc, WCHAR_MIN, WCHAR_MAX, "wchar_t", WEOF);
if (!iswlower(wc)) {
@@ -32,6 +31,3 @@ uppercase letter in the current locale.
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/wctrans.c b/src/wctype/wctrans.c
index 2dbd25fe..5e73a454 100644
--- a/src/wctype/wctrans.c
+++ b/src/wctype/wctrans.c
@@ -1,13 +1,12 @@
-#if 0
-
#include <wctype.h>
#include <string.h>
-#include "_assert.h"
+#include "_safety.h"
#include "_wctype.h"
/** lookup character translation **/
wctrans_t wctrans(const char * property)
{
+ SIGNAL_SAFE(0);
ASSERT_NONNULL(property);
if (!strcmp(property, "tolower")) {
@@ -38,6 +37,3 @@ ctrans(toupper).
/*
STDC(199409)
*/
-
-
-#endif
diff --git a/src/wctype/wctype.c b/src/wctype/wctype.c
index 0a26bc4a..c2390b35 100644
--- a/src/wctype/wctype.c
+++ b/src/wctype/wctype.c
@@ -1,13 +1,12 @@
-#if 0
-
#include <wctype.h>
#include <string.h>
-#include "_assert.h"
+#include "_safety.h"
#include "_wctype.h"
/** lookup character class **/
wctype_t wctype(const char * property)
{
+ SIGNAL_SAFE(0);
ASSERT_NONNULL(property);
if (!strcmp(property, "alnum")) {
@@ -59,6 +58,3 @@ cclass(print), cclass(punct), cclass(space), cclass(upper), and cclass(xdigit).
/*
STDC(199409)
*/
-
-
-#endif