9front - general discussion about 9front
 help / color / mirror / Atom feed
* [patch] add isblank to ape/ctype.h
@ 2020-07-24  4:37 Jens Staal
  2020-07-24  5:02 ` [9front] " ori
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Staal @ 2020-07-24  4:37 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

For some reason isblank was not included in ctype.h despite _ISblank being 
defined.

The isblank function is part of standard ctype.h

https://pubs.opengroup.org/onlinepubs/009695399/basedefs/ctype.h.html

I noticed this when  I made a shim wctype.h in my "libwtf" attempt to provide 
wchar dependencies.

[-- Attachment #2: ape_isblank.diff --]
[-- Type: text/x-patch, Size: 1068 bytes --]

# HG changeset patch
# User Jens Staal <staal1978@gmail.com>
# Date 1595564874 -7200
#      Fri Jul 24 06:27:54 2020 +0200
# Node ID e8dfabb75c221d6e354e6a349b154180d172cf56
# Parent  639ad985a75b382b9053812c6943900ef8dd1e91
add isblank to ape/ctype.h

diff -r 639ad985a75b -r e8dfabb75c22 sys/include/ape/ctype.h
--- a/sys/include/ape/ctype.h	Mon Jul 20 18:58:52 2020 -0700
+++ b/sys/include/ape/ctype.h	Fri Jul 24 06:27:54 2020 +0200
@@ -8,6 +8,7 @@
 
 extern int isalnum(int);
 extern int isalpha(int);
+extern int isblank(int);
 extern int iscntrl(int);
 extern int isdigit(int);
 extern int isgraph(int);
@@ -38,6 +39,7 @@
 extern unsigned char _ctype[];
 #define	isalnum(c)	(_ctype[(unsigned char)(c)]&(_ISupper|_ISlower|_ISdigit))
 #define	isalpha(c)	(_ctype[(unsigned char)(c)]&(_ISupper|_ISlower))
+#define	isblank(c)	(_ctype[(unsigned char)(c)]&_ISblank)
 #define	iscntrl(c)	(_ctype[(unsigned char)(c)]&_IScntrl)
 #define	isdigit(c)	(_ctype[(unsigned char)(c)]&_ISdigit)
 #define	isgraph(c)	(_ctype[(unsigned char)(c)]&(_ISpunct|_ISupper|_ISlower|_ISdigit))

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [9front] [patch] add isblank to ape/ctype.h
  2020-07-24  4:37 [patch] add isblank to ape/ctype.h Jens Staal
@ 2020-07-24  5:02 ` ori
  0 siblings, 0 replies; 2+ messages in thread
From: ori @ 2020-07-24  5:02 UTC (permalink / raw)
  To: staal1978, 9front

> +extern int isblank(int);

I think you need to implement this function as well.
You're declaring it, but I don't see an implementation
in ap/gen/isalnum.c.

This means that code like:

	int apply(int (*f)(int), int v) { return f(v); }
	apply(isblank, 'a')

will fail to link.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-24  5:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-24  4:37 [patch] add isblank to ape/ctype.h Jens Staal
2020-07-24  5:02 ` [9front] " ori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).