Re: Fix safe-ctype ctype detection

2001-04-28 Thread Hrvoje Niksic

Herold Heiko [EMAIL PROTECTED] writes:

 OK, after some other needed testing (Hrvoje easily caught my faulty
 wgetrc problem) it does seem to work correctly with __inline and chsize.
 The attached patch will change what is needed (
 windows\{Makefile.src,wget.dep,config.h.ms} for the latest changes.

Thanks for the patches; I've now applied them with the following
ChangeLog:

2001-04-28  Herold Heiko  [EMAIL PROTECTED]

* windows/wget.dep: Update.

* windows/Makefile.src: Update.

* windows/config.h.ms: Define inline to __inline.
Define ftruncate to chsize.

One note: when you're already looking at config.h.ms, you might want
to bring it in full sync with config.h.in.  (Unix uses `configure' to
create `config.h' out of `config.h.in'.)

All one needs to do is look at each entry in config.h.in and either
leave it as-is or #define it to the appropriate stuff.  If it's
unclear what some of the entries do, I can mail you config.h resulting
from the run of configure under Linux.



RE: Fix safe-ctype ctype detection

2001-04-27 Thread Herold Heiko

Seems ok, at least cmpt.c .. getopt.c do compile correctly.
Now in hash.c cl barfs

hash.c
hash.c(228) : error C2054: expected '(' to follow 'inline'
hash.c(230) : error C2085: 'find_mapping' : not in formal parameter list
hash.c(230) : error C2143: syntax error : missing ';' before '{'
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

but that's another story. Sigh.
Heiko

-- 
-- PREVINET S.p.A.[EMAIL PROTECTED]
-- Via Ferretto, 1ph  x39-041-5907073
-- I-31021 Mogliano V.to (TV) fax x39-041-5907087
-- ITALY



-Original Message-
From: Hrvoje Niksic [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 27, 2001 7:02 AM
To: Wget Patches
Subject: Fix safe-ctype ctype detection


Here is what I believe is a better error detection than simply
throwing an error if isalpha is defined.  This code makes sure that an
error gets thrown only if one of is* macros is *used*, thus reenabling
compilation on systems where a header file #includes ctype.h.

2001-04-27  Hrvoje Niksic  [EMAIL PROTECTED]

   * safe-ctype.h: Instead of throwing #error when isalpha is
   defined, redefine it to something that will throw a compile-time
   error if actually *used*.  Do the same for the rest of the
   standard C macros.

Index: src/safe-ctype.h
===
RCS file: /pack/anoncvs/wget/src/safe-ctype.h,v
retrieving revision 1.1
diff -u -r1.1 safe-ctype.h
--- src/safe-ctype.h   2001/03/30 22:36:59 1.1
+++ src/safe-ctype.h   2001/04/27 04:59:59
@@ -35,10 +35,39 @@
 #ifndef SAFE_CTYPE_H
 #define SAFE_CTYPE_H
 
-#ifdef isalpha
- #error safe-ctype.h and ctype.h may not be used simultaneously
-#else
+/* Catch erroneous use of ctype macros.  Files that really know what
+   they're doing can disable this check by defining the
+   I_REALLY_WANT_CTYPE_MACROS preprocessor constant. */
+
+#ifndef I_REALLY_WANT_CTYPE_MACROS
+
+#undef isalpha
+#define isalpha *** Please use ISALPHA ***
+#undef isalnum
+#define isalnum *** Please use ISALNUM ***
+#undef isblank
+#define isblank *** Please use ISBLANK ***
+#undef iscntrl
+#define iscntrl *** Please use ISCNTRL ***
+#undef isdigit
+#define isdigit *** Please use ISDIGIT ***
+#undef isgraph
+#define isgraph *** Please use ISGRAPH ***
+#undef islower
+#define islower *** Please use ISLOWER ***
+#undef isprint
+#define isprint *** Please use ISPRINT ***
+#undef ispunct
+#define ispunct *** Please use ISPUNCT ***
+#undef isspace
+#define isspace *** Please use ISSPACE ***
+#undef isupper
+#define isupper *** Please use ISUPPER ***
+#undef isxdigit
+#define isxdigit *** Please use ISXDIGIT ***
 
+#endif /* I_REALLY_WANT_CTYPE_MACROS */
+
 /* Categories.  */
 
 enum {
@@ -96,5 +125,4 @@
 #define TOUPPER(c) _sch_toupper[(c)  0xff]
 #define TOLOWER(c) _sch_tolower[(c)  0xff]
 
-#endif /* no ctype.h */
 #endif /* SAFE_CTYPE_H */

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Fix safe-ctype ctype detection

2001-04-27 Thread Hrvoje Niksic

[EMAIL PROTECTED] writes:

 (Re: defining inline to nothing) That's strange...VC understands
 inline.

Maybe not in the C environment?  Or maybe Herold inadvertently chose a
strict ANSI or something?

 Try substituting ( #defining ) ftruncate to chsize.  I had this
 problem when trying to compile FTE (fte.sourceforge.net) with
 VisualAge C++ (which also doesn't have ftruncate).

If that works, we can #define ftruncate to chsize in a Windows header.