🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #196

Bug in ctype.h for HP-UX 6.5

#196
From: Piet van Oostrum
Date: Wed, 29 Nov 1989 09:22
124 lines
4862 bytes
    From: darrylo@HPSRDMO.HP.COM (Darryl Okahata)
    Newsgroups: gnu.g++.lib.bug
    Subject: libg++ for HP-UX
    Message-ID: <8911060634.AA06969@hpsrdmo.HP.COM>
    Date: 6 Nov 89 06:34:41 GMT

	 Here are some patches to help libg++ (V1.36 -- the latest
    officially-released version available from labrea) get up and running on
    HP machines.  These patches were made for a g++ configured for
    "hp9k320g", but will probably work for other HP configurations.

	 Problems fixed:

    1. In ctype.h, the ctype classification array is called "_ctype", and
       not "_ctype_".  It is, however, still an array of unsigned char; it
       is NOT an array of short.
---------------
I tried to compile G++/LIBG++ (1.36.1) on HP-UX 6.5, with Darryl's patches.
The ctype patch didn't work out on my system for two reasons:

1. The name is not _ctype, but __ctype on my system.
2. In contrast to other Unix systems the table has the first (superfluous)
element missing, so all (_ctype_+1)'s should be __ctype.

I don't know why this is different on my system, but the following works:
I got the whole system running with the native assembler and loader.
(Just another question: Is there a G++ for the HP9000/800 series?)
------------------------------------------------------------------------
// Here's a ctype.h for SunOS-3 and vax 4.3BSD.  
// It will probably work on most BSD derived systems. 
// Just compare it to the C version to verify.
// No big deal, but it will save you some typing.
   
#ifndef _ctype_h
#pragma once
#define _ctype_h

#include <stdio.h>  /* sorry, but needed for USG stuff */
   
static const int _U = 01;
static const int _L = 02;
static const int _N = 04;
static const int _S = 010;
static const int _P = 020;
static const int _C = 040;


#ifdef USG
static const int _B = 0100;	/* different from BSD */
static const int _X = 0200;	/* different from BSD */
#else
static const int _X = 0100;
static const int _B = 0200;
#endif


#ifdef DGUX
#define CTYPE_TYPE	short
#else
#define CTYPE_TYPE	char
#endif

#if defined(USG) && !defined(hpux)
#define _ctype_ _ctype
#endif

extern "C" {
#ifndef hpux
extern	CTYPE_TYPE	_ctype_[];
}
   
inline int isalpha(char c)  { return ((_ctype_+1)[c]&(_U|_L)); }
inline int isupper(char c)  { return ((_ctype_+1)[c]&_U); }
inline int islower(char c)  { return ((_ctype_+1)[c]&_L); }
inline int isdigit(char c)  { return ((_ctype_+1)[c]&_N); }
inline int isxdigit(char c) { return ((_ctype_+1)[c]&_X); }
inline int isspace(char c)  { return ((_ctype_+1)[c]&_S); }
inline int ispunct(char c)  { return ((_ctype_+1)[c]&_P); }
inline int isalnum(char c)  { return ((_ctype_+1)[c]&(_U|_L|_N)); }
inline int isprint(char c)  { return ((_ctype_+1)[c]&(_P|_U|_L|_N|_B)); }
inline int isgraph(char c)  { return ((_ctype_+1)[c]&(_P|_U|_L|_N)); }
inline int iscntrl(char c)  { return ((_ctype_+1)[c]&_C); }

#else

extern	unsigned char	*__ctype;
}

inline int isalpha(char c)  { return ((__ctype)[c]&(_U|_L)); }
inline int isupper(char c)  { return ((__ctype)[c]&_U); }
inline int islower(char c)  { return ((__ctype)[c]&_L); }
inline int isdigit(char c)  { return ((__ctype)[c]&_N); }
inline int isxdigit(char c) { return ((__ctype)[c]&_X); }
inline int isspace(char c)  { return ((__ctype)[c]&_S); }
inline int ispunct(char c)  { return ((__ctype)[c]&_P); }
inline int isalnum(char c)  { return ((__ctype)[c]&(_U|_L|_N)); }
inline int isprint(char c)  { return ((__ctype)[c]&(_P|_U|_L|_N|_B)); }
inline int isgraph(char c)  { return ((__ctype)[c]&(_P|_U|_L|_N)); }
inline int iscntrl(char c)  { return ((__ctype)[c]&_C); }

#endif

inline int isascii(char c)  { return ((unsigned)(c)<=0177); }
inline int toupper(char c)  { return islower(c)? (c-'a'+'A') : c; }
inline int tolower(char c)  { return isupper(c)? (c-'A'+'a') : c; }
inline int toascii(char c)  { return ((c)&0177); }


#ifdef _ctype_
#undef _ctype_
#endif

#ifdef CTYPE_TYPE
#undef CTYPE_TYPE
#endif

#endif _ctype_h
------------------------------------------------------------------------
-- 
Piet* van Oostrum, Dept of Computer Science, University of Utrecht
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht,  The Netherlands.
Telephone: +31-30-531806   Uucp: uunet!mcsun!hp4nl!ruuinf!piet
Telefax:   +31-30-513791   Internet: piet@cs.ruu.nl      (*`Pete')
Technical Details
Message-ID: <2113@ruuinf.cs.ruu.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcsun!hp4nl!ruuinf!cs.ruu.nl

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcsun!hp4nl!ruuinf!cs.ruu.nl
From: piet@cs.ruu.nl (Piet van Oostrum)
Newsgroups: gnu.g++.lib.bug
Subject: Bug in ctype.h for HP-UX 6.5
Message-ID: <2113@ruuinf.cs.ruu.nl>
Date: 29 Nov 89 09:22:49 GMT
Sender: news@ruuinf.cs.ruu.nl
Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
Organization: Dept of Computer Science, University of Utrecht, Holland
Lines: 124