mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[svn-r2242] Removed h5dumputil.c. Its functions have been migrated to h5tools.c.
This commit is contained in:
parent
330d49b27a
commit
e02e441734
@ -244,7 +244,6 @@ h5dump.lo: \
|
||||
$(top_srcdir)/src/H5private.h \
|
||||
$(top_builddir)/src/H5config.h
|
||||
h5dumputil.lo: \
|
||||
$(srcdir)/h5dumputil.c \
|
||||
$(srcdir)/h5dump.h \
|
||||
$(top_srcdir)/src/hdf5.h \
|
||||
$(top_srcdir)/src/H5public.h \
|
||||
|
@ -31,7 +31,7 @@ LIB_OBJ=$(LIB_SRC:.c=.lo)
|
||||
PUB_LIB=
|
||||
|
||||
## Source and object files for programs...
|
||||
PROG_SRC=h5debug.c h5import.c h5ls.c h5repart.c h5dump.c h5dumputil.c \
|
||||
PROG_SRC=h5debug.c h5import.c h5ls.c h5repart.c h5dump.c \
|
||||
h5toh4.c h5dumptst.c pdb2hdf.c
|
||||
PROG_OBJ=$(PROG_SRC:.c=.lo)
|
||||
PRIVATE_HDR=h5tools.h
|
||||
@ -59,8 +59,8 @@ h5ls: h5ls.lo
|
||||
h5repart: h5repart.lo
|
||||
@$(LT_LINK_EXE) $(CFLAGS) -o $@ h5repart.lo $(LIB) $(LIBHDF5) $(LDFLAGS) $(LIBS)
|
||||
|
||||
h5dump: h5dump.lo h5dumputil.lo
|
||||
@$(LT_LINK_EXE) $(CFLAGS) -o $@ h5dump.lo h5dumputil.lo $(LIB) $(LIBHDF5) $(LDFLAGS) $(LIBS)
|
||||
h5dump: h5dump.lo
|
||||
@$(LT_LINK_EXE) $(CFLAGS) -o $@ h5dump.lo $(LIB) $(LIBHDF5) $(LDFLAGS) $(LIBS)
|
||||
|
||||
h5toh4: h5toh4.lo
|
||||
@$(LT_LINK_EXE) $(CFLAGS) -o $@ h5toh4.lo $(LIB) $(LIBHDF5) $(LDFLAGS) $(LIBS)
|
||||
|
@ -1,146 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Purpose: A library for displaying the values of a dataset or an attribute
|
||||
* in a human readable format.
|
||||
*
|
||||
* Note: h5dumputil is a modification of h5tools.c
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <h5dump.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "h5tools.h"
|
||||
|
||||
/*
|
||||
* The output functions need a temporary buffer to hold a piece of the
|
||||
* dataset while it's being printed. This constant sets the limit on the
|
||||
* size of that temporary buffer in bytes. For efficiency's sake, choose the
|
||||
* largest value suitable for your machine (for testing use a small value).
|
||||
*/
|
||||
#if 0
|
||||
#define H5DUMP_BUFSIZE (1024*1024)
|
||||
#else
|
||||
#define H5DUMP_BUFSIZE (1024)
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(X,Y) ((X)<(Y)?(X):(Y))
|
||||
#endif
|
||||
#ifndef NELMTS
|
||||
#define NELMTS(X) (sizeof(X)/sizeof(*X))
|
||||
#endif
|
||||
#define ALIGN(A,Z) ((((A)+(Z)-1)/(Z))*(Z))
|
||||
|
||||
|
||||
extern void indentation(int);
|
||||
|
||||
int print_data(hid_t , hid_t , int);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: h5dump_sprint
|
||||
*
|
||||
* Purpose: Prints the value pointed to by VP into the string S assuming
|
||||
* the data type of VP is TYPE.
|
||||
*
|
||||
* Return: void
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#if 0
|
||||
static void
|
||||
h5dump_sprint(char *s/*out*/, hid_t type, void *vp)
|
||||
{
|
||||
size_t i, n;
|
||||
char temp[1024];
|
||||
int j;
|
||||
H5T_str_t str_pad;
|
||||
|
||||
if (H5Tequal(type, H5T_NATIVE_DOUBLE)) {
|
||||
sprintf(s, "%g", *((double*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_FLOAT)) {
|
||||
sprintf(s, "%g", *((float*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_SHORT)) {
|
||||
sprintf(s, "%d", *((short*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_USHORT)) {
|
||||
sprintf(s, "%u", *((unsigned short*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_INT)) {
|
||||
sprintf(s, "%d", *((int*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_UINT)) {
|
||||
sprintf(s, "%u", *((unsigned*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_LONG)) {
|
||||
sprintf(s, "%ld", *((long*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_ULONG)) {
|
||||
sprintf(s, "%lu", *((unsigned long*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_SCHAR)) {
|
||||
sprintf(s, "%d", *((signed char*)vp));
|
||||
} else if (H5Tequal(type, H5T_NATIVE_UCHAR)) {
|
||||
sprintf(s, "%u", *((unsigned char*)vp));
|
||||
} else if (H5T_STRING==H5Tget_class(type)) {
|
||||
str_pad = H5Tget_strpad(type) ;
|
||||
j = 0;
|
||||
for (i = 0; i < H5Tget_size(type); i++) {
|
||||
switch (*((char*)vp+i)) {
|
||||
case '"':
|
||||
strcpy(s+j, "\\\"");
|
||||
j += strlen("\\\"");
|
||||
break;
|
||||
case '\\':
|
||||
strcpy(s+j, "\\\\");
|
||||
j += strlen("\\\\");
|
||||
break;
|
||||
case '\b':
|
||||
strcpy(s+j, "\\b");
|
||||
j += strlen("\\b");
|
||||
break;
|
||||
case '\f':
|
||||
strcpy(s+j, "\\f");
|
||||
j += strlen("\\f");
|
||||
break;
|
||||
case '\n':
|
||||
strcpy(s+j, "\\n");
|
||||
j += strlen("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
strcpy(s+j, "\\r");
|
||||
j += strlen("\\r");
|
||||
break;
|
||||
case '\t':
|
||||
strcpy(s+j, "\\t");
|
||||
j += strlen("\\t");
|
||||
break;
|
||||
default:
|
||||
if (isprint(*((char*)vp+i))){
|
||||
sprintf(s+j, "%c", *((char*)vp+i));
|
||||
j += strlen(s+j);
|
||||
} else {
|
||||
if (str_pad == H5T_STR_NULLTERM &&
|
||||
*((unsigned char*)vp+i) == '\0' ) {
|
||||
sprintf(s+j, "%c", *((unsigned char*)vp+i));
|
||||
i = H5Tget_size(type);
|
||||
} else {
|
||||
sprintf(s+j, "\\%03o", *((unsigned char*)vp+i));
|
||||
j += strlen(s+j);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
strcpy(temp, "0x");
|
||||
n = H5Tget_size(type);
|
||||
for (i=0; i<n; i++) {
|
||||
sprintf(temp+strlen(temp), "%02x", ((unsigned char*)vp)[i]);
|
||||
}
|
||||
sprintf(s, "%s", temp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user