NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: ncgen c-test trouble

> In looking at the source in various versions of netCDF, it appears to
> me that the genlib.c source you refer to
...
> has not changed since version 3.4, released in March, 1998, and
> contains no call to the "assert" macro.  The "isprint" function is
> supposed to be found in the runtime C library (or maybe defined as a
> macro) that's declared in /usr/include/ctype.h.  If it invokes
> "assert", that may be a problem with the implementation of isprint(),
> which is supposed to accept integer arguments.
>
> Anyway, if it's convenient, please tell us the compiler and operating
> system on which the assertion violation in testing ncgen showed up.

I use latest Intel compilers for Windows both C/C++ and Fortran on computers
under control of Windows Server 2003 and Windows XP. These tools utilizes
Microsoft C runtime library from Visual Studio 2003. Assertion occured in
file %MSVCDir%\crt\src\isctype.c, line 68. I would like to note that I have
to do a lot of small changes almost in every library that comes in my way,
so I may forgot what exactly I changed after a time. Here is a patch that
will help to cure from this assertion
---------- genlib.patch --------------
--- genlib.orig.c 2004-11-17 02:37:25.000000000 +0500
+++ genlib.c 2005-03-30 13:29:42.993964400 +0600
@@ -1113,7 +1113,7 @@
  case '\\': *cp++ = '\\'; *cp++ = '\\'; break;
  case '\"': *cp++ = '\\'; *cp++ = '\"'; break;
  default:
-     if (!isprint(*istr)) {
+     if (!isprint((unsigned char)*istr)) {
   static char octs[] = "01234567";
   int rem = ((unsigned char)*istr)%64;
   *cp++ = '\\';
@@ -1197,7 +1197,7 @@
     istr++;

     for(ii = 1; ii < ilen; ii++) { /* handle subsequent characters in input
*/
- if (isprint(*istr)) {
+ if (isprint((unsigned char)*istr)) {
      if (! was_print) {
   strcat(cp, "//'");
   cp += 3;


  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: