delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/10/16/19:56:29

Date: Thu, 17 Oct 2002 01:06:58 +0100
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: C99 ctype function: isblank [PATCH]
Message-Id: <E181y1U-0000V7-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Please find below a patch to add the isblank function from
the C99 standard. Here's a simple test program:

---Start test program---
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>

int
main (void)
{
  assert(isblank(' '));
  assert(isblank('\t'));
  assert(!isblank('a'));

  return(EXIT_SUCCESS);
}
---End test program---

OK to commit?

Bye, Rich =]

Index: src/libc/ansi/ctype/makefile
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/ctype/makefile,v
retrieving revision 1.1
diff -p -c -3 -r1.1 makefile
*** src/libc/ansi/ctype/makefile	10 Jul 1994 19:07:28 -0000	1.1
--- src/libc/ansi/ctype/makefile	16 Oct 2002 23:52:30 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ # Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details
  # Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
  TOP=../..
  
*************** SRC += ct_upper.c
*** 7,12 ****
--- 8,14 ----
  SRC += isalnum.c
  SRC += isalpha.c
  SRC += isascii.c
+ SRC += isblank.c
  SRC += iscntrl.c
  SRC += isdigit.c
  SRC += isgraph.c
Index: src/libc/ansi/ctype/isblank.c
===================================================================
RCS file: src/libc/ansi/ctype/isblank.c
diff -N src/libc/ansi/ctype/isblank.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- src/libc/ansi/ctype/isblank.c	16 Oct 2002 23:52:38 -0000
***************
*** 0 ****
--- 1,8 ----
+ /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
+ #include <ctype.h>
+ #include <inlines/ctype.ha>
+ 
+ int (isblank)(int c)
+ {
+   return isblank(c);
+ }
Index: src/libc/ansi/ctype/isblank.txh
===================================================================
RCS file: src/libc/ansi/ctype/isblank.txh
diff -N src/libc/ansi/ctype/isblank.txh
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- src/libc/ansi/ctype/isblank.txh	16 Oct 2002 23:52:46 -0000
***************
*** 0 ****
--- 1,24 ----
+ @c ----------------------------------------------------------------------
+ @node isblank, ctype
+ @subheading Syntax
+ 
+ @example
+ #include <ctype.h>
+ 
+ int isblank(int c);
+ @end example
+ 
+ @subheading Description
+ 
+ Tells if @var{c} is a blank character.  A blank character is used
+ to separate words, e.g.: @samp{ } or @samp{\t}.
+ 
+ @subheading Return Value
+ 
+ Nonzero if @var{c} is a blank character, else zero.
+ 
+ 
+ @subheading Portability
+ 
+ @portability !ansi-c89, ansi-c99, posix
+ 
Index: include/ctype.h
===================================================================
RCS file: /cvs/djgpp/djgpp/include/ctype.h,v
retrieving revision 1.1
diff -p -c -3 -r1.1 ctype.h
*** include/ctype.h	7 Dec 1994 07:02:10 -0000	1.1
--- include/ctype.h	16 Oct 2002 23:52:52 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
  #ifndef __dj_include_ctype_h_
  #define __dj_include_ctype_h_
*************** extern "C" {
*** 10,15 ****
--- 11,17 ----
  
  int	isalnum(int c);
  int	isalpha(int c);
+ int	isblank(int c);
  int	iscntrl(int c);
  int	isdigit(int c);
  int	isgraph(int c);
Index: include/inlines/ctype.ha
===================================================================
RCS file: /cvs/djgpp/djgpp/include/inlines/ctype.ha,v
retrieving revision 1.2
diff -p -c -3 -r1.2 ctype.ha
*** include/inlines/ctype.ha	28 Jun 1998 22:06:22 -0000	1.2
--- include/inlines/ctype.ha	16 Oct 2002 23:53:03 -0000
***************
*** 12,17 ****
--- 12,18 ----
  #define __dj_ISSPACE	0x0100
  #define __dj_ISUPPER	0x0200
  #define __dj_ISXDIGIT	0x0400
+ #define __dj_ISBLANK	0x0800
  
  extern unsigned short __dj_ctype_flags[];
  extern unsigned char __dj_ctype_toupper[];
*************** extern unsigned char __dj_ctype_tolower[
*** 19,24 ****
--- 20,26 ----
  
  #define isalnum(c) (__dj_ctype_flags[(int)(c)+1] & __dj_ISALNUM)
  #define isalpha(c) (__dj_ctype_flags[(int)(c)+1] & __dj_ISALPHA)
+ #define isblank(c) (__dj_ctype_flags[(int)(c)+1] & __dj_ISBLANK)
  #define iscntrl(c) (__dj_ctype_flags[(int)(c)+1] & __dj_ISCNTRL)
  #define isdigit(c) (__dj_ctype_flags[(int)(c)+1] & __dj_ISDIGIT)
  #define isgraph(c) (__dj_ctype_flags[(int)(c)+1] & __dj_ISGRAPH)
*************** extern unsigned char __dj_ctype_tolower[
*** 32,35 ****
  #define tolower(c) (__dj_ctype_tolower[(int)(c)+1])
  #define toupper(c) (__dj_ctype_toupper[(int)(c)+1])
  
! #endif /* __dj_include_inline_ctype_hi_ */
--- 34,37 ----
  #define tolower(c) (__dj_ctype_tolower[(int)(c)+1])
  #define toupper(c) (__dj_ctype_toupper[(int)(c)+1])
  
! #endif /* __dj_include_inline_ctype_ha_ */
Index: src/libc/ansi/ctype/ct_flags.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/ansi/ctype/ct_flags.c,v
retrieving revision 1.1
diff -p -c -3 -r1.1 ct_flags.c
*** src/libc/ansi/ctype/ct_flags.c	24 Jul 1995 05:18:06 -0000	1.1
--- src/libc/ansi/ctype/ct_flags.c	16 Oct 2002 23:53:07 -0000
***************
*** 1,3 ****
--- 1,4 ----
+ /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  #include <ctype.h>
  #include <inlines/ctype.ha>
*************** unsigned short __dj_ctype_flags[] = {
*** 13,19 ****
    __dj_ISCNTRL,											/* CTRL+F, 0x06 */
    __dj_ISCNTRL,											/* CTRL+G, 0x07 */
    __dj_ISCNTRL,											/* CTRL+H, 0x08 */
!   __dj_ISCNTRL | __dj_ISSPACE,									/* CTRL+I, 0x09 */
    __dj_ISCNTRL | __dj_ISSPACE,									/* CTRL+J, 0x0a */
    __dj_ISCNTRL | __dj_ISSPACE,									/* CTRL+K, 0x0b */
    __dj_ISCNTRL | __dj_ISSPACE,									/* CTRL+L, 0x0c */
--- 14,20 ----
    __dj_ISCNTRL,											/* CTRL+F, 0x06 */
    __dj_ISCNTRL,											/* CTRL+G, 0x07 */
    __dj_ISCNTRL,											/* CTRL+H, 0x08 */
!   __dj_ISCNTRL | __dj_ISSPACE | __dj_ISBLANK,							/* CTRL+I, 0x09 */
    __dj_ISCNTRL | __dj_ISSPACE,									/* CTRL+J, 0x0a */
    __dj_ISCNTRL | __dj_ISSPACE,									/* CTRL+K, 0x0b */
    __dj_ISCNTRL | __dj_ISSPACE,									/* CTRL+L, 0x0c */
*************** unsigned short __dj_ctype_flags[] = {
*** 36,42 ****
    __dj_ISCNTRL,											/* CTRL+], 0x1d */
    __dj_ISCNTRL,											/* CTRL+^, 0x1e */
    __dj_ISCNTRL,											/* CTRL+_, 0x1f */
!   __dj_ISPRINT | __dj_ISSPACE,									/* ` ', 0x20 */
    __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT,							/* `!', 0x21 */
    __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT,							/* 0x22 */
    __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT,							/* `#', 0x23 */
--- 37,43 ----
    __dj_ISCNTRL,											/* CTRL+], 0x1d */
    __dj_ISCNTRL,											/* CTRL+^, 0x1e */
    __dj_ISCNTRL,											/* CTRL+_, 0x1f */
!   __dj_ISPRINT | __dj_ISSPACE | __dj_ISBLANK,							/* ` ', 0x20 */
    __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT,							/* `!', 0x21 */
    __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT,							/* 0x22 */
    __dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT,							/* `#', 0x23 */
Index: src/docs/kb/wc204.txi
===================================================================
RCS file: /cvs/djgpp/djgpp/src/docs/kb/wc204.txi,v
retrieving revision 1.119
diff -p -c -3 -r1.119 wc204.txi
*** src/docs/kb/wc204.txi	26 Sep 2002 17:46:13 -0000	1.119
--- src/docs/kb/wc204.txi	16 Oct 2002 23:53:26 -0000
*************** had a value outside the range describabl
*** 771,773 ****
--- 771,776 ----
  @findex realpath AT r{, added to library to increase @sc{posix} compliance}
  The function @code{realpath} was added. @code{realpath} does much the same
  as @code{_fixpath}, but is @sc{posix} compliant and resolves symlinks.
+ 
+ @findex isblank
+ The function @code{isblank} was added.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019