Exemple #1
0
CDFstatus QuitCDF (char *why, Int32 offset, int size, int num, void *value1,
		   void *value2, Logical debug)
{
  
  if (debug) {
    char text[151], texta[41];
    text[0] = NUL;
    strcpyX (text, why, 150);
    if (offset >= 0) {
      snprintf (texta, (size_t) sizeof(texta),
                " (@%ld) ", (long) offset);
      strcatX (text, texta, 150);
    }
    if (strlen(why) < 150) {
      if (num == 2) { /* Two argument values to show. */
        if (size == 4) { /* Each one is a 4-byte int type. */
                         /* Each int is up to 10 digits + sign. */
          char text2[2 * 11 + 6 + 1];
          text2[0] = NUL;
          snprintf (text2, (size_t) sizeof(text2),
		    "(%ld vs %ld)", (long) *(int *)value1,
                    (long) *(int *)value2);
          strcatX (text, text2, 150);
        } else { /* Both are strings. */
          char *text2;
          size_t len = strlen ((char *) value1) + strlen ((char *) value2) + 
                       6 + 1;
          text2 = (char *) cdf_AllocateMemory (len, NULL);
          if (text2 != NULL) {
            text2[0] = NUL;
            snprintf (text2, len, "(%s vs %s)", (char *)value1, (char *)value2);
            strcatX (text, text2, 150);
            cdf_FreeMemory (text2, NULL);
          }
        }
      } else { /* Only one argument value to show. */
        if (size == 4) { /* Each int is up to 10 digits + sign. */
          char text2[11 + 2 + 1];
          text2[0] = NUL;
          snprintf (text2, (size_t) sizeof(text2),
		    "(%ld)", (long) *(int *)value1);
          strcatX (text, text2, 150);
        } else {
          char *text2;
          size_t len = strlen ((char *) value1) + 2 + 1;
          text2 = (char *) cdf_AllocateMemory (len, NULL);
          if (text2 != NULL) {
            text2[0] = NUL;
            snprintf (text2, len, "(%s)", (char *)value1);
            strcatX (text, text2, 150);
            cdf_FreeMemory (text2, NULL);
          }
        }
      }
    }
    printf ("ERROR...%s\n", text);
  }
  return CV2C;
}
Exemple #2
0
CDFstatus QuitCDF (char *why, int isize, int num, void *value1, void *value2,
                   Logical debug)
{

    if (debug) {
        char text[101];
        strcpyX (text, why, 100);
        if (num == 2) {
            if (isize == 4)
                sprintf (EofS(text), " (%ld vs %ld) ", (long) *(int *)value1,
                         (long) *(int *)value2);
            else if (isize == 8)
#if !defined(win32)
                sprintf (EofS(text), " (%lld vs %lld) ", *(OFF_T *)value1, *(OFF_T *)value2);
#else
                sprintf (EofS(text), " (%I64d vs %I64d) ", *(OFF_T *)value1, *(OFF_T *)value2);
#endif
            else
                sprintf (EofS(text), " (%s vs %s) ", (char *)value1, (char *)value2);
            printf ("ERROR...%s\n", text);
        } else {
            if (isize == 4)
Exemple #3
0
static CDFstatus QuitCDF (char *why, OFF_T offset, int isize, int num,
                          void *value1,void *value2, Logical debug)
{

    if (debug) {
        char text[151], texta[41];
        text[0] = NUL;
        strcpyX (text, why, 150);
        if (offset >= 0) {
#if !defined(win32) && !defined(__MINGW32__)
            snprintf (texta, (size_t) sizeof(texta),
                      " (@%lld) ", offset);
#else
            snprintf (texta, (size_t) sizeof(texta),
                      " (@%I64d) ", offset);
#endif
            strcatX (text, texta, 150);
        }
        if (strlen(why) < 150) {
            if (num == 2) { /* Two argument values to show. */
                if (isize == 4) { /* Each one is a 4-byte int type. */
                    /* Each int is up to 10 digits + sign. */
                    char text2[2 * 11 + 6 + 1];
                    text2[0] = (char) NUL;
                    snprintf (text2, (size_t) sizeof(text2),
                              "(%ld vs %ld)", (long) *(int *)value1,
                              (long) *(int *)value2);
                    strcatX (text, text2, 150);
                } else if (isize == 8) { /* Each one is a 8-byte long long type. */
                    /* Each long long is up to 19 digits + sign. */
                    char text2[2 * 20 + 6 + 1];
                    text2[0] = (char) NUL;
#if !defined(win32) && !defined(__MINGW32__)
                    snprintf (text2, (size_t) sizeof(text2),
                              "(%lld vs %lld)", *(OFF_T *)value1, *(OFF_T *)value2);
#else
                    snprintf (text2, (size_t) sizeof(text2),
                              "(%I64d vs %I64d)", *(OFF_T *)value1, *(OFF_T *)value2);
#endif
                    strcatX (text, text2, 150);
                } else { /* Each one is a string. */
                    char *text2;
                    size_t len = strlen ((char *) value1) + strlen ((char *) value2) + 6
                                 + 1;
                    text2 = (char *) cdf_AllocateMemory (len, NULL);
                    if (text2 != NULL) {
                        text2[0] = (char) NUL;
                        snprintf (text2, len, "(%s vs %s)", (char *)value1, (char *)value2);
                        strcatX (text, text2, 150);
                        cdf_FreeMemory (text2, NULL);
                    }
                }
            } else { /* Only one argument value to show. */
                if (isize == 4) { /* 4 extra chars are for 2 " ", "(", and ")". */
                    char text2[11 + 2 + 1];
                    text2[0] = (char) NUL;
                    snprintf (text2, (size_t) sizeof(text2),
                              "(%ld)", (long) *(int *)value1);
                    strcatX (text, text2, 150);
                } else if (isize == 8) {
                    char text2[20 + 2 + 1];
                    text2[0] = (char) NUL;
#if !defined(win32) && !defined(__MINGW32__)
                    snprintf (text2, (size_t) sizeof(text2),
                              "(%lld)", *(OFF_T *)value1);
#else
                    snprintf (text2, (size_t) sizeof(text2),
                              "(%I64d)", *(OFF_T *)value1);
#endif
                    strcatX (text, text2, 150);
                } else {
                    char *text2;
                    size_t len = strlen ((char *) value1)  + 2 + 1;
                    text2 = (char *) cdf_AllocateMemory (len, NULL);
                    if (text2 != NULL) {
                        text2[0] = (char) NUL;
                        snprintf (text2, len, "(%s)", (char *)value1);
                        strcatX (text, text2, 150);
                        cdf_FreeMemory (text2, NULL);
                    }
                }
            }
        }
        printf ("ERROR...%s\n", text);
    }
    return CV3C;
}