diff options
Diffstat (limited to 'tools/gifconv')
-rw-r--r-- | tools/gifconv/Makefile.am | 50 | ||||
-rw-r--r-- | tools/gifconv/Makefile.in | 875 | ||||
-rw-r--r-- | tools/gifconv/decompress.c | 320 | ||||
-rw-r--r-- | tools/gifconv/gif.h | 184 | ||||
-rw-r--r-- | tools/gifconv/gif2hdf.c | 125 | ||||
-rw-r--r-- | tools/gifconv/gif2mem.c | 344 | ||||
-rw-r--r-- | tools/gifconv/gifread.c | 402 | ||||
-rw-r--r-- | tools/gifconv/hdf2gif.c | 404 | ||||
-rw-r--r-- | tools/gifconv/hdfgifwr.c | 521 | ||||
-rw-r--r-- | tools/gifconv/readhdf.c | 254 | ||||
-rw-r--r-- | tools/gifconv/writehdf.c | 117 |
11 files changed, 0 insertions, 3596 deletions
diff --git a/tools/gifconv/Makefile.am b/tools/gifconv/Makefile.am deleted file mode 100644 index e8f6a56..0000000 --- a/tools/gifconv/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -# -# Copyright by the Board of Trustees of the University of Illinois. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. -## -## Makefile.am -## Run automake to generate a Makefile.in from this file. -# -# HDF5 Library Makefile(.in) -# - -include $(top_srcdir)/config/commence.am - -# Include src and tools/lib directories -INCLUDES=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src - -# These are our main targets, the tools - -if BUILD_HDF5_HL_CONDITIONAL -bin_PROGRAMS=gif2h5 h52gif -else -bin_PROGRAMS=h52gif -endif - -if BUILD_HDF5_HL_CONDITIONAL -gif2h5_SOURCES=gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c -endif - -h52gif_SOURCES=hdf2gif.c hdfgifwr.c readhdf.c - - - -# Programs all depend on the hdf5 library and the tools library -if BUILD_HDF5_HL_CONDITIONAL -LDADD=$(LIBH5TOOLS) $(LIBH5_HL) $(LIBHDF5) -else -LDADD=$(LIBH5TOOLS) $(LIBHDF5) -endif - - - -include $(top_srcdir)/config/conclude.am diff --git a/tools/gifconv/Makefile.in b/tools/gifconv/Makefile.in deleted file mode 100644 index 092521c..0000000 --- a/tools/gifconv/Makefile.in +++ /dev/null @@ -1,875 +0,0 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# -# Copyright by the Board of Trustees of the University of Illinois. -# All rights reserved. -# -# This file is part of HDF5. The full HDF5 copyright notice, including -# terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. -# -# HDF5 Library Makefile(.in) -# - -SOURCES = $(gif2h5_SOURCES) $(h52gif_SOURCES) - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/config/commence.am \ - $(top_srcdir)/config/conclude.am -@BUILD_HDF5_HL_CONDITIONAL_FALSE@bin_PROGRAMS = h52gif$(EXEEXT) -@BUILD_HDF5_HL_CONDITIONAL_TRUE@bin_PROGRAMS = gif2h5$(EXEEXT) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ h52gif$(EXEEXT) -subdir = tools/gifconv -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am__gif2h5_SOURCES_DIST = gif2hdf.c gif2mem.c decompress.c gifread.c \ - writehdf.c -@BUILD_HDF5_HL_CONDITIONAL_TRUE@am_gif2h5_OBJECTS = gif2hdf.$(OBJEXT) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ gif2mem.$(OBJEXT) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ decompress.$(OBJEXT) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ gifread.$(OBJEXT) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ writehdf.$(OBJEXT) -gif2h5_OBJECTS = $(am_gif2h5_OBJECTS) -gif2h5_LDADD = $(LDADD) -am__DEPENDENCIES_1 = $(top_builddir)/tools/lib/libh5tools.la -am__DEPENDENCIES_2 = $(top_builddir)/src/libhdf5.la -am__DEPENDENCIES_3 = $(top_builddir)/hl/src/libhdf5_hl.la -@BUILD_HDF5_HL_CONDITIONAL_FALSE@gif2h5_DEPENDENCIES = \ -@BUILD_HDF5_HL_CONDITIONAL_FALSE@ $(am__DEPENDENCIES_1) \ -@BUILD_HDF5_HL_CONDITIONAL_FALSE@ $(am__DEPENDENCIES_2) -@BUILD_HDF5_HL_CONDITIONAL_TRUE@gif2h5_DEPENDENCIES = \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ $(am__DEPENDENCIES_1) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ $(am__DEPENDENCIES_3) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ $(am__DEPENDENCIES_2) -am_h52gif_OBJECTS = hdf2gif.$(OBJEXT) hdfgifwr.$(OBJEXT) \ - readhdf.$(OBJEXT) -h52gif_OBJECTS = $(am_h52gif_OBJECTS) -h52gif_LDADD = $(LDADD) -@BUILD_HDF5_HL_CONDITIONAL_FALSE@h52gif_DEPENDENCIES = \ -@BUILD_HDF5_HL_CONDITIONAL_FALSE@ $(am__DEPENDENCIES_1) \ -@BUILD_HDF5_HL_CONDITIONAL_FALSE@ $(am__DEPENDENCIES_2) -@BUILD_HDF5_HL_CONDITIONAL_TRUE@h52gif_DEPENDENCIES = \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ $(am__DEPENDENCIES_1) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ $(am__DEPENDENCIES_3) \ -@BUILD_HDF5_HL_CONDITIONAL_TRUE@ $(am__DEPENDENCIES_2) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src -depcomp = $(SHELL) $(top_srcdir)/bin/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(gif2h5_SOURCES) $(h52gif_SOURCES) -DIST_SOURCES = $(am__gif2h5_SOURCES_DIST) $(h52gif_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -# Set the paths for AFS installs of autotools for Linux machines -# Ideally, these tools should never be needed during the build. -ACLOCAL = /afs/ncsa/projects/hdf/packages/automake_1.9.5/Linux_2.4/bin/aclocal -I /afs/ncsa/projects/hdf/packages/libtool_1.5.14/Linux_2.4/share/aclocal -ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AM_MAKEFLAGS = @AM_MAKEFLAGS@ -AR = @AR@ -AUTOCONF = /afs/ncsa/projects/hdf/packages/autoconf_2.59/Linux_2.4/bin/autoconf -AUTOHEADER = /afs/ncsa/projects/hdf/packages/autoconf_2.59/Linux_2.4/bin/autoheader -AUTOMAKE = /afs/ncsa/projects/hdf/packages/automake_1.9.5/Linux_2.4/bin/automake -AWK = @AWK@ -BUILD_ALL_CONDITIONAL_FALSE = @BUILD_ALL_CONDITIONAL_FALSE@ -BUILD_ALL_CONDITIONAL_TRUE = @BUILD_ALL_CONDITIONAL_TRUE@ -BUILD_CXX_CONDITIONAL_FALSE = @BUILD_CXX_CONDITIONAL_FALSE@ -BUILD_CXX_CONDITIONAL_TRUE = @BUILD_CXX_CONDITIONAL_TRUE@ -BUILD_FORTRAN_CONDITIONAL_FALSE = @BUILD_FORTRAN_CONDITIONAL_FALSE@ -BUILD_FORTRAN_CONDITIONAL_TRUE = @BUILD_FORTRAN_CONDITIONAL_TRUE@ -BUILD_HDF5_HL_CONDITIONAL_FALSE = @BUILD_HDF5_HL_CONDITIONAL_FALSE@ -BUILD_HDF5_HL_CONDITIONAL_TRUE = @BUILD_HDF5_HL_CONDITIONAL_TRUE@ -BUILD_PABLO_CONDITIONAL_FALSE = @BUILD_PABLO_CONDITIONAL_FALSE@ -BUILD_PABLO_CONDITIONAL_TRUE = @BUILD_PABLO_CONDITIONAL_TRUE@ -BUILD_PARALLEL_CONDITIONAL_FALSE = @BUILD_PARALLEL_CONDITIONAL_FALSE@ -BUILD_PARALLEL_CONDITIONAL_TRUE = @BUILD_PARALLEL_CONDITIONAL_TRUE@ -BUILD_SHARED_ONLY_CONDITIONAL_FALSE = @BUILD_SHARED_ONLY_CONDITIONAL_FALSE@ -BUILD_SHARED_ONLY_CONDITIONAL_TRUE = @BUILD_SHARED_ONLY_CONDITIONAL_TRUE@ -BYTESEX = @BYTESEX@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CC_VERSION = @CC_VERSION@ - -# H5_CFLAGS holds flags that should be used as CFLAGS when building hdf5, -# but which shouldn't be exported to h5cc for building other programs. -CFLAGS = @CFLAGS@ @H5_CFLAGS@ -CONFIG_DATE = @CONFIG_DATE@ -CONFIG_MODE = @CONFIG_MODE@ -CONFIG_USER = @CONFIG_USER@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ @H5_CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ @H5_CXXFLAGS@ -CXX_SHARED_CONDITIONAL_FALSE = @CXX_SHARED_CONDITIONAL_FALSE@ -CXX_SHARED_CONDITIONAL_TRUE = @CXX_SHARED_CONDITIONAL_TRUE@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_PKG = @DEBUG_PKG@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DYNAMIC_DIRS = @DYNAMIC_DIRS@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ - -# Make sure that these variables are exported to the Makefiles -F9XMODEXT = @F9XMODEXT@ -F9XMODFLAG = @F9XMODFLAG@ -F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ -FC = @FC@ -FCFLAGS = @FCFLAGS@ -FCLIBS = @FCLIBS@ -FFLAGS = @FFLAGS@ @H5_FFLAGS@ -FILTERS = @FILTERS@ -FORTRAN_SHARED_CONDITIONAL_FALSE = @FORTRAN_SHARED_CONDITIONAL_FALSE@ -FORTRAN_SHARED_CONDITIONAL_TRUE = @FORTRAN_SHARED_CONDITIONAL_TRUE@ -FSEARCH_DIRS = @FSEARCH_DIRS@ -H5_CFLAGS = @H5_CFLAGS@ -H5_CPPFLAGS = @H5_CPPFLAGS@ -H5_CXXFLAGS = @H5_CXXFLAGS@ -H5_FFLAGS = @H5_FFLAGS@ -H5_VERSION = @H5_VERSION@ -HADDR_T = @HADDR_T@ -HDF5_INTERFACES = @HDF5_INTERFACES@ -HID_T = @HID_T@ -HL = @HL@ -HL_FOR = @HL_FOR@ -HSIZET = @HSIZET@ -HSIZE_T = @HSIZE_T@ -HSSIZE_T = @HSSIZE_T@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -LT_STATIC_EXEC = @LT_STATIC_EXEC@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MPE = @MPE@ -OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PARALLEL = @PARALLEL@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PTHREAD = @PTHREAD@ -RANLIB = @RANLIB@ -ROOT = @ROOT@ -RUNPARALLEL = @RUNPARALLEL@ -RUNSERIAL = @RUNSERIAL@ -R_INTEGER = @R_INTEGER@ -R_LARGE = @R_LARGE@ -SEARCH = @SEARCH@ -SETX = @SETX@ -SET_MAKE = @SET_MAKE@ - -# Hardcode SHELL to be /bin/sh. Most machines have this shell, and -# on at least one machine configure fails to detect its existence (janus). -# Also, when HDF5 is configured on one machine but run on another, -# configure's automatic SHELL detection may not work on the build machine. -SHELL = /bin/sh -SIZE_T = @SIZE_T@ -STATIC_SHARED = @STATIC_SHARED@ -STRIP = @STRIP@ -TESTPARALLEL = @TESTPARALLEL@ -TR = @TR@ -TRACE_API = @TRACE_API@ -USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ -USE_FILTER_FLETCHER32 = @USE_FILTER_FLETCHER32@ -USE_FILTER_NBIT = @USE_FILTER_NBIT@ -USE_FILTER_SCALEOFFSET = @USE_FILTER_SCALEOFFSET@ -USE_FILTER_SHUFFLE = @USE_FILTER_SHUFFLE@ -USE_FILTER_SZIP = @USE_FILTER_SZIP@ -VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_FC = @ac_ct_FC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ - -# Install directories that automake doesn't know about -includedir = $(exec_prefix)/include -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -# Shell commands used in Makefiles -RM = rm -f -CP = cp -TIME = time - -# Some machines need a command to run executables; this is that command -# so that our tests will run. -# We use RUNTESTS instead of RUNSERIAL directly because it may be that -# some tests need to be run with a different command. Older versions -# of the makefiles used the command -# $(LIBTOOL) --mode=execute -# in some directories, for instance. -RUNTESTS = $(RUNSERIAL) - -# Libraries to link to while building -LIBHDF5 = $(top_builddir)/src/libhdf5.la -LIBH5TEST = $(top_builddir)/test/libh5test.la -LIBH5F = $(top_builddir)/fortran/src/libhdf5_fortran.la -LIBH5FTEST = $(top_builddir)/fortran/test/libh5test_fortran.la -LIBH5CPP = $(top_builddir)/c++/src/libhdf5_cpp.la -LIBH5TOOLS = $(top_builddir)/tools/lib/libh5tools.la -LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la -LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la -LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la -docdir = $(exec_prefix)/doc -@BUILD_SHARED_ONLY_CONDITIONAL_FALSE@H5CC = $(bindir)/h5cc - -# Scripts used to build examples -# If only shared libraries have been installed, have h5cc build examples with -# shared libraries instead of static libraries -@BUILD_SHARED_ONLY_CONDITIONAL_TRUE@H5CC = $(bindir)/h5cc -shlib -@BUILD_SHARED_ONLY_CONDITIONAL_FALSE@H5CC_PP = $(bindir)/h5pcc -@BUILD_SHARED_ONLY_CONDITIONAL_TRUE@H5CC_PP = $(bindir)/h5pcc -shlib -@BUILD_SHARED_ONLY_CONDITIONAL_FALSE@H5FC = $(bindir)/h5fc -@BUILD_SHARED_ONLY_CONDITIONAL_TRUE@H5FC = $(bindir)/h5fc -shlib -@BUILD_SHARED_ONLY_CONDITIONAL_FALSE@H5FC_PP = $(bindir)/h5pfc -@BUILD_SHARED_ONLY_CONDITIONAL_TRUE@H5FC_PP = $(bindir)/h5pfc -shlib -@BUILD_SHARED_ONLY_CONDITIONAL_FALSE@H5CPP = $(bindir)/h5c++ -@BUILD_SHARED_ONLY_CONDITIONAL_TRUE@H5CPP = $(bindir)/h5c++ -shlib - -# The trace script; this is used on source files from the C library to -# insert tracing macros. -TRACE = perl $(top_srcdir)/bin/trace - -# .chkexe files are used to mark tests that have run successfully. -# .chklog files are output from those tests. -# *.clog are from the MPE option. -CHECK_CLEANFILES = *.chkexe *.chklog *.clog - -# Include src and tools/lib directories -INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/src -@BUILD_HDF5_HL_CONDITIONAL_TRUE@gif2h5_SOURCES = gif2hdf.c gif2mem.c decompress.c gifread.c writehdf.c -h52gif_SOURCES = hdf2gif.c hdfgifwr.c readhdf.c -@BUILD_HDF5_HL_CONDITIONAL_FALSE@LDADD = $(LIBH5TOOLS) $(LIBHDF5) - -# Programs all depend on the hdf5 library and the tools library -@BUILD_HDF5_HL_CONDITIONAL_TRUE@LDADD = $(LIBH5TOOLS) $(LIBH5_HL) $(LIBHDF5) - -# Automake needs to be taught how to build lib, progs, and tests targets. -# These will be filled in automatically for the most part (e.g., -# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and -# EXTRA_TEST variables are supplied to allow the user to force targets to -# be built at certain times. -LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ - $(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB) - -PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ - $(EXTRA_PROG) - -TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) -TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_) -TEST_PROG_PARA_CHKEXE = $(TEST_PROG_PARA:=.chkexe_) -TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_) -TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/gifconv/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign tools/gifconv/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -gif2h5$(EXEEXT): $(gif2h5_OBJECTS) $(gif2h5_DEPENDENCIES) - @rm -f gif2h5$(EXEEXT) - $(LINK) $(gif2h5_LDFLAGS) $(gif2h5_OBJECTS) $(gif2h5_LDADD) $(LIBS) -h52gif$(EXEEXT): $(h52gif_OBJECTS) $(h52gif_DEPENDENCIES) - @rm -f h52gif$(EXEEXT) - $(LINK) $(h52gif_LDFLAGS) $(h52gif_OBJECTS) $(h52gif_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decompress.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gif2hdf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gif2mem.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gifread.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdf2gif.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hdfgifwr.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readhdf.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/writehdf.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/../../config - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile $(PROGRAMS) all-local -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool mostlyclean-local - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ - clean clean-binPROGRAMS clean-generic clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ - pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-info-am - - -# check-install is a synonym for installcheck. -# Add this build rule here (rather than in conclude.am, where build rules -# normally go) because it should be included in the top-level Makefile.am -# as well. -check-install: installcheck - -# List all build rules defined by HDF5 Makefiles as "PHONY" targets here. -# This tells the Makefiles that these targets are not files to be built but -# commands that should be executed even if a file with the same name already -# exists. -.PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ - build-tests check-clean check-install check-p check-s check-vfd \ - install-doc lib progs tests uninstall-doc _exec_check-s _test - -# lib/progs/tests targets recurse into subdirectories. build-* targets -# build files in this directory. -build-lib: $(LIB) -build-progs: $(LIB) $(PROGS) -build-tests: $(LIB) $(PROGS) $(TESTS) - -# General rule for recursive building targets. -# BUILT_SOURCES contain targets that need to be built before anything else -# in the directory (e.g., for Fortran type detection) -lib progs tests check-s check-p :: $(BUILT_SOURCES) - @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; - @for d in X $(SUBDIRS); do \ - if test $$d != X && test $$d != .; then \ - (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - fi; \ - done - -# General rule for recursive cleaning targets. Like the rule above, -# but doesn't require building BUILT_SOURCES. -check-clean :: - @$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1; - @for d in X $(SUBDIRS); do \ - if test $$d != X && test $$d != .; then \ - (set -x; cd $$d && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ - fi; \ - done -# Tell Automake to build tests when the user types `make all' (this is -# not its default behavior). Also build EXTRA_LIB and EXTRA_PROG since -# Automake won't build them automatically, either. -all-local: $(EXTRA_LIB) $(EXTRA_PROG) $(TESTS) - -# make install-doc doesn't do anything outside of doc directory, but -# Makefiles should recognize it. -# UPDATE: docs no longer reside in this build tree, so this target -# is depreciated. -install-doc uninstall-doc: - @echo "Nothing to be done." - -# clean up files generated by tests so they can be re-run. -build-check-clean: - $(RM) $(CHECK_CLEANFILES) - -# run check-clean whenever mostlyclean is run -mostlyclean-local: build-check-clean - -# Run each test in order, passing $(TEST_FLAGS) to the program. -# Since tests are done in a shell loop, "make -i" does apply inside it. -# Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop. -# The timestamps give a rough idea how much time the tests use. -# -# Note that targets in TESTS (defined above) will be built when the user -# types 'make tests' or 'make check', but only programs in TEST_PROG, -# TEST_PROG_PARA, or TEST_SCRIPT will actually be executed. -check-TESTS: test - -test _test: - @$(MAKE) build-check-s - @$(MAKE) build-check-p - -# Actual execution of check-s. -build-check-s: $(LIB) $(PROGS) $(TESTS) - @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ - echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ - fi - @$(MAKE) $(AM_MAKEFLAGS) _exec_check-s - @if test -n "$(TEST_PROG)$(TEST_SCRIPT)"; then \ - echo "===Serial tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ - fi - -_exec_check-s: $(TEST_PROG_CHKEXE) $(TEST_SCRIPT_CHKSH) - -# The dummy.chkexe here prevents the target from being -# empty if there are no tests in the current directory. -# $${log} is the log file. -# $${tname} is the name of test. -$(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_: - @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummy.chkexe_"; then \ - tname=$(@:.chkexe_=)$(EXEEXT);\ - log=$(@:.chkexe_=.chklog); \ - echo "============================"; \ - if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \ - echo "No need to test $${tname} again."; \ - else \ - echo "============================" > $${log}; \ - if test "X$(HDF_FORTRAN)" = "Xyes"; then \ - echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ - echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - elif test "X$(HDF_CXX)" = "Xyes"; then \ - echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ - echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log};\ - else \ - echo "Testing $${tname} $(TEST_FLAGS)"; \ - echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - fi; \ - echo "============================" >> $${log}; \ - srcdir="$(srcdir)" \ - $(TIME) $(RUNTESTS) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \ - && touch $(@:.chkexe_=.chkexe) || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - (cat $${log} && false) || exit 1; \ - echo "" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ - echo "============================" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)"; \ - cat $${log}; \ - fi; \ - echo "============================"; \ - fi - -# The dummysh.chkexe here prevents the target from being -# empty if there are no tests in the current directory. -# $${log} is the log file. -# $${tname} is the name of test. -$(TEST_SCRIPT_CHKSH) $(TEST_SCRIPT_PARA_CHKSH) dummysh.chkexe_: - @if test "X$@" != "X.chkexe_" && test "X$@" != "Xdummysh.chkexe_"; then \ - cmd=$(@:.chkexe_=);\ - tname=`basename $$cmd`;\ - chkname=`basename $(@:.chkexe_=.chkexe)`;\ - log=`basename $(@:.chkexe_=.chklog)`; \ - echo "============================"; \ - if $(top_srcdir)/bin/newer $${chkname} $$cmd $(SCRIPT_DEPEND); then \ - echo "No need to test $${tname} again."; \ - else \ - echo "============================" > $${log}; \ - if test "X$(HDF_FORTRAN)" = "Xyes"; then \ - echo "Fortran API: Testing $${tname} $(TEST_FLAGS)"; \ - echo "Fortran API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - elif test "X$(HDF_CXX)" = "Xyes"; then \ - echo "C++ API: Testing $${tname} $(TEST_FLAGS)"; \ - echo "C++ API: $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - else \ - echo "Testing $${tname} $(TEST_FLAGS)"; \ - echo "$${tname} $(TEST_FLAGS) Test Log" >> $${log}; \ - fi; \ - echo "============================" >> $${log}; \ - RUNSERIAL="$(RUNSERIAL)" RUNPARALLEL="$(RUNPARALLEL)" \ - srcdir="$(srcdir)" \ - $(TIME) $(SHELL) $$cmd $(TEST_FLAGS) >> $${log} 2>&1 \ - && touch $${chkname} || \ - (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \ - (cat $${log} && false) || exit 1; \ - echo "" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \ - echo "============================" >> $${log}; \ - echo "Finished testing $${tname} $(TEST_FLAGS)"; \ - cat $${log}; \ - fi; \ - echo "============================"; \ - fi - -# Actual execution of check-p. -build-check-p: $(LIB) $(PROGS) $(TESTS) - @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ - echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` begin `date`==="; \ - fi - @if test -n "$(TEST_PROG_PARA)"; then \ - echo "**** Hint ****"; \ - echo "Parallel test files reside in the current directory" \ - "by default."; \ - echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \ - echo " HDF5_PARAPREFIX=/PFS/user/me"; \ - echo " export HDF5_PARAPREFIX"; \ - echo " make check"; \ - echo "**** end of Hint ****"; \ - fi - @for test in $(TEST_PROG_PARA) dummy; do \ - if test $$test != dummy; then \ - $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ \ - RUNTESTS="$(RUNPARALLEL)" || exit 1; \ - fi; \ - done - @for test in $(TEST_SCRIPT_PARA) dummy; do \ - if test $$test != dummy; then \ - $(MAKE) $(AM_MAKEFLAGS) $$test.chkexe_ || exit 1; \ - fi; \ - done - @if test -n "$(TEST_PROG_PARA)$(TEST_SCRIPT_PARA)"; then \ - echo "===Parallel tests in `echo ${PWD} | sed -e s:.*/::` ended `date`===";\ - fi - -# Run test with different Virtual File Driver -check-vfd: - @for vfd in $(VFD_LIST) dummy; do \ - if test $$vfd != dummy; then \ - echo "============================"; \ - echo "Testing Virtual File Driver $$vfd"; \ - echo "============================"; \ - HDF5_DRIVER=$$vfd $(MAKE) $(AM_MAKEFLAGS) check; \ - fi; \ - done -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/tools/gifconv/decompress.c b/tools/gifconv/decompress.c deleted file mode 100644 index 2ebf28d..0000000 --- a/tools/gifconv/decompress.c +++ /dev/null @@ -1,320 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <stdio.h> -#include <stdlib.h> - -#include "gif.h" - -#define NEXTBYTE (*ptr++) - -#define IMAGESEP 0x2c -#define INTERLACEMASK 0x40 -#define COLORMAPMASK 0x80 - -WORD iWIDE, iHIGH, eWIDE, eHIGH, expand, numcols, strip, nostrip; -unsigned long cols[256]; -char *cmd; - -FILE *fp; - -static WORD - XC = 0, YC = 0, /* Output X and Y coords of current pixel */ - InitCodeSize, /* Starting code size, used during Clear */ - CodeSize, /* Code size, read from GIF header */ - BytesPerScanline, /* Bytes per scanline in output raster */ - IWidth, IHeight; /* image dimensions */ -static int - BitOffset = 0, /* Bit Offset of next code */ - Pass = 0, /* Used by output routine if WORDerlaced pic */ - OutCount = 0, /* Decompressor output 'stack count' */ - Code, /* Value returned by ReadCode */ - MaxCode, /* limiting value for current code size */ - ClearCode, /* GIF clear code */ - EOFCode, /* GIF end-of-information code */ - CurCode, OldCode, InCode, /* Decompressor variables */ - FirstFree, /* First free code, generated per GIF spec */ - FreeCode, /* Decompressor, next free slot in hash table */ - FinChar, /* Decompressor variable */ - DataMask, /* AND mask for data size */ - ReadMask; /* Code AND mask for current code size */ - -/*MODIFICATIONS*/ -BYTE tempbyte[10]; -BYTE * tempBYTEptr[10]; -WORD tempint[10]; -WORD ImageCount = 0; -/*END MODIFICATION*/ - -boolean Interlace, HasColormap; - -BYTE *Image; /* The result array */ -BYTE *RawGIF; /* The heap array to hold it, raw */ -BYTE *Raster; /* The raster data stream, unblocked */ - -/* The hash table used by the decompressor */ - -int Prefix[4096]; -int Suffix[4096]; - -/* An output array used by the decompressor */ - -int OutCode[1025]; - -/* The color map, read from the GIF header */ - -int numused; - -/* - * Fetch the next code from the raster data stream. The codes can be any - * length from 3 to 12 bits, packed WORDo 8-bit BYTEs, so we have to maWORDain - * our location in the Raster array as a BIT Offset. We compute the BYTE - * Offset WORDo the raster array by dividing this by 8, pick up three BYTEs, - * compute the bit Offset WORDo our 24-bit chunk, shift to bring the desired - * code to the bottom, then mask it off and return it. - */ -static int -ReadCode(void) -{ - int RawCode, ByteOffset; - - ByteOffset = BitOffset / 8; - RawCode = Raster[ByteOffset] + (0x100 * Raster[ByteOffset + 1]); - - if (CodeSize >= 8) - RawCode += (0x10000 * Raster[ByteOffset + 2]); - - RawCode >>= (BitOffset % 8); - BitOffset += CodeSize; - return (RawCode & ReadMask); -} - -static void -AddToPixel(BYTE Index) -{ - if (YC<IHeight) - *(Image + YC * BytesPerScanline + XC) = Index; - - - - /* Update the X-coordinate, and if it overflows, update the - * Y-coordinate */ - if (++XC == IWidth) { - /* - * If a non-WORDerlaced picture, just increment YC to the next scan - * line. If it's WORDerlaced, deal with the WORDerlace as described - * in the GIF spec. Put the decoded scan line out to the screen if we - * haven't gone past the bottom of it. - */ - XC = 0; - - if (!Interlace) { - YC++; - } else { - switch (Pass) { - case 0: - YC += 8; - - if (YC >= IHeight) { - Pass++; - YC = 4; - } - - break; - case 1: - YC += 8; - - if (YC >= IHeight) { - Pass++; - YC = 2; - } - - break; - case 2: - YC += 4; - - if (YC >= IHeight) { - Pass++; - YC = 1; - } - - break; - case 3: - YC += 2; - break; - default: - break; - } - } - } -} - -/* Main routine. Convert a GIF image to an HDF image */ - -BYTE * -Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead) -{ - int i; - - XC = 0; - YC = 0; - Pass = 0; - OutCount = 0; - BitOffset = 0; - - DataMask = (1 << ((GifHead->PackedField & 0x07) +1)) -1; - Raster = GifImageDesc->GIFImage; - - /* Check for image seperator */ - - /* Now read in values from the image descriptor */ - IWidth = GifImageDesc->ImageWidth; - IHeight = GifImageDesc->ImageHeight; - Interlace = GifImageDesc->PackedField & 0x40; - - /* - * Note that I ignore the possible existence of a local color map. I'm - * told there aren't many files around that use them, and the spec says - * it's defined for future use. This could lead to an error reading some - * files. - */ - - /* - * Start reading the raster data. First we get the WORDial code size and - * compute decompressor constant values, based on this code size. - */ - - CodeSize = GifImageDesc->CodeSize; - ClearCode = (1 << CodeSize); - EOFCode = ClearCode + 1; - FreeCode = FirstFree = ClearCode + 2; - - /* - * The GIF spec has it that the code size is the code size used to compute - * the above values is the code size given in the file, but the code size - * used in compression/decompression is the code size given in the file - * plus one. (thus the ++). - */ - - CodeSize++; - InitCodeSize = CodeSize; - MaxCode = (1 << CodeSize); - ReadMask = MaxCode - 1; - - /* - * Read the raster data. Here we just transpose it from the GIF array to - * the Raster array, turning it from a series of blocks WORDo one long - * data stream, which makes life much easier for ReadCode(). - */ - - /* Allocate the Image */ - - if (!(Image = (BYTE *)malloc((size_t)IWidth*(size_t)IHeight))) { - printf("Out of memory"); - exit(-1); - } - - BytesPerScanline = IWidth; - - /* - * Decompress the file, continuing until you see the GIF EOF code. One - * obvious enhancement is to add checking for corrupt files here. - */ - - Code = ReadCode(); - - while (Code != EOFCode) { - /* - * Clear code sets everything back to its initial value, then reads - * the immediately subsequent code as uncompressed data. - */ - if (Code == ClearCode) { - CodeSize = InitCodeSize; - MaxCode = (1 << CodeSize); - ReadMask = MaxCode - 1; - FreeCode = FirstFree; - CurCode = OldCode = Code = ReadCode(); - FinChar = CurCode & DataMask; - AddToPixel((BYTE)FinChar); - } else { - /* - * If not a clear code, then must be data: save same as CurCode - * and InCode - */ - CurCode = InCode = Code; - - /* - * If greater or equal to FreeCode, not in the hash table yet; - * repeat the last character decoded - */ - if (CurCode >= FreeCode) { - CurCode = OldCode; - OutCode[OutCount++] = FinChar; - } - - /* - * Unless this code is raw data, pursue the chain poWORDed to by - * CurCode through the hash table to its end; each code in the - * chain puts its associated output code on the output queue. - */ - while (CurCode > DataMask) { - if (OutCount > 1024) { - /*return error message*/ - } - - OutCode[OutCount++] = Suffix[CurCode]; - CurCode = Prefix[CurCode]; - } - - /* The last code in the chain is treated as raw data. */ - FinChar = CurCode & DataMask; - OutCode[OutCount++] = FinChar; - - /* - * Now we put the data out to the Output routine. It's been - * stacked LIFO, so deal with it that way... - */ - for (i = OutCount - 1; i >= 0; i--) - AddToPixel((BYTE)OutCode[i]); - - OutCount = 0; - - /* - * Build the hash table on-the-fly. No table is stored in the - * file. - */ - Prefix[FreeCode] = OldCode; - Suffix[FreeCode] = FinChar; - OldCode = InCode; - - /* - * PoWORD to the next slot in the table. If we exceed the current - * MaxCode value, increment the code size unless it's already 12. - * If it is, do nothing: the next code decompressed better be - * CLEAR - */ - FreeCode++; - - if (FreeCode >= MaxCode) - if (CodeSize < 12) { - CodeSize++; - MaxCode *= 2; - ReadMask = (1 << CodeSize) - 1; - } - } - - Code = ReadCode(); - } - - return Image; -} diff --git a/tools/gifconv/gif.h b/tools/gifconv/gif.h deleted file mode 100644 index ad60968..0000000 --- a/tools/gifconv/gif.h +++ /dev/null @@ -1,184 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * Title: GIF.H - * Purpose: GIF Header file - */ -#ifndef GIF_H_ -#define GIF_H_ 1 - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "hdf5.h" - -#define MAX_PAL 768 - -/* set the name length restriction to 64 charachters */ -#define VSNAMELENMAX 64 /* this is a carryover from HDF4 */ - -/* typedef H5T_NATIVE_UINT8 BYTE; */ -typedef unsigned char BYTE; - -/* typedef H5T_NATIVE_UINT16 WORD; */ -typedef unsigned long WORD; - -typedef char CHAR; -typedef unsigned char boolean; - -#define false 0 -#define true 1 - -/* Set the EndianOrder. -** The GIF Reader file should do this. -** Set EndianOrder = 0 if machine is little endian -** EndianOrder = 1 if machine is big endian. -*/ -extern int EndianOrder; - -/* -** The GIF header format. -** -** This structure actually contains the header, logical screen -** descriptor, and the global color table for the GIF image. -*/ -typedef struct _GifHeader { /* Offset Description */ - BYTE PackedField; /* 0Ah Color Information */ - WORD TableSize; - BYTE ImageCount; /* Keep a count of the number of images */ - BYTE CommentCount; - BYTE ApplicationCount; - BYTE PlainTextCount; - BYTE HDFPalette[256][3]; - BYTE HeaderDump[6]; /* BYTE array to dump header contents */ - BYTE LSDDump[7]; /* Logical Screen Descriptor dump */ -} GIFHEAD; - - -/* -** The GIF Image Descriptor. -*/ -typedef struct _GifImageDescriptor { - WORD ImageWidth; /* Width of the image in pixels */ - WORD ImageHeight; /* Height of the image in pixels */ - BYTE PackedField; /* Image and Color Table Data Information */ - WORD TableSize; - WORD CodeSize; /* Minimum LZW CodeSize for image data */ - BYTE HDFPalette[256][3]; - BYTE GIDDump[9]; /* GifImageDescriptor dump */ - - BYTE *Image; /* Decompressed Raster Image */ - BYTE *GIFImage; -} GIFIMAGEDESC; - -/* -** GIF 89a Graphic Control Extension Block -*/ -typedef struct _GifGraphicControlExtension { - BYTE GCEDump[5]; /* Graphic Control Extension Dump */ -} GIFGRAPHICCONTROL; - -/* -** GIF 89a Plain Text Extension Block -*/ -typedef struct _GifPlainTextExtension { - BYTE PTEDump[15]; /* Plain Text Extension Dump */ - BYTE *PlainTextData; /* Plain Text data sub-blocks */ - WORD DataSize; -} GIFPLAINTEXT; - - -/* -** GIF 89a Application Extension Block -*/ -typedef struct _GifApplicationExtension { - BYTE AEDump[14]; /* Application Extension Dump */ - BYTE *ApplicationData; /* Application data sub-blocks */ - WORD DataSize; -} GIFAPPLICATION; - -/* -** GIF 89a Comment Extension Block -*/ -typedef struct _GifCommentExtension { - BYTE CEDump[2]; /* Comment Extension Dump */ - BYTE *CommentData; /* Comment data sub-blocks */ - WORD DataSize; - BYTE Terminator; /* Block Terminator (always 0) */ -} GIFCOMMENT; - -/* -** GIF to HDF Memory Struct -** Purpose : The gif to hdf structure is used to pass all the -** gif data to the memory, which gets caught by the hdf driver -** Its the drivers job to put the data in the appropriate places -** in the HDF file. -** I have assumed that the ImageDescriptors and GraphicControls follow -** one another, ie. I have not associated them with each other. The driver -** must assume a 1-1 correspondance. The same discussion with plain text -** extension. -*/ -typedef struct _GifToMem { - GIFHEAD *GifHeader; - GIFIMAGEDESC **GifImageDesc; - GIFGRAPHICCONTROL **GifGraphicControlExtension; - GIFPLAINTEXT **GifPlainTextExtension; - GIFAPPLICATION **GifApplicationExtension; - GIFCOMMENT **GifCommentExtension; -} GIFTOMEM; - -/* -** Function Prototypes -*/ - -/* GIF2MEM.C */ -GIFTOMEM Gif2Mem(BYTE *); - -/* GIFREAD.C */ -int ReadGifHeader(GIFHEAD *, BYTE **); -int ReadGifImageDesc(GIFIMAGEDESC *, BYTE **); -int ReadGifGraphicControl(GIFGRAPHICCONTROL *, BYTE **); -int ReadGifPlainText(GIFPLAINTEXT *, BYTE **); -int ReadGifApplication(GIFAPPLICATION *, BYTE **); -int ReadGifComment(GIFCOMMENT *, BYTE **); - -/* HDFGIFWR.C */ -int hdfWriteGIF(FILE *fp, BYTE *pic, int ptype, int w, int h, BYTE *rmap, - BYTE *gmap, BYTE *bmap, BYTE *pc2ncmap, int numcols, - int colorstyle, int BitsPerPixel); - -/* WRITEHDF.C */ -int WriteHDF(GIFTOMEM , CHAR * , CHAR *); - -/* Function: ReadHDF -** Return: 0 on completion without error, -1 on error -** Input: CHAR *h5_file - HDF file name -** CHAR *dset_name - Name of the HDF Image dataset -** CHAR *pal_name - Name of the HDF palette -** Output: BYTE* data - the HDF Image to be converted -** BYTE palette[256][3] - the corresponding palette -** hsize_t* image_size - the size of each dimension of the image -*/ -int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, - CHAR *h5_file, CHAR *dset_name, CHAR *pal_name); - -BYTE *Decompress(GIFIMAGEDESC *, GIFHEAD *); -BYTE GetByte(BYTE *); -WORD GetWord(BYTE *); - -void cleanup(BYTE*); - -#endif /* GIF_H_ */ diff --git a/tools/gifconv/gif2hdf.c b/tools/gifconv/gif2hdf.c deleted file mode 100644 index 2863b4b..0000000 --- a/tools/gifconv/gif2hdf.c +++ /dev/null @@ -1,125 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#include "gif.h" - -int -main(int argv , char *argc[]) -{ - GIFTOMEM GifMemoryStruct; - GIFIMAGEDESC gifImageDesc; - - FILE *fpGif; - - /* replacing int32 with long */ - long i, ImageCount; - long filesize; - - BYTE *MemGif; - BYTE *StartPos; - - /* VSNAMELENMAX is a carryover from HDF4 and is #defined to 256 in gif.h */ - char GIFFileName[VSNAMELENMAX]; - char HDFFileName[VSNAMELENMAX]; - - /* - * Initialize all GifMemoryStruct pointers to null to prevent hassles - * later on - */ - GifMemoryStruct.GifHeader = NULL; - GifMemoryStruct.GifImageDesc = NULL; - GifMemoryStruct.GifGraphicControlExtension = NULL; - GifMemoryStruct.GifPlainTextExtension = NULL; - GifMemoryStruct.GifApplicationExtension = NULL; - GifMemoryStruct.GifCommentExtension = NULL; - - if (argv < 3) { - printf("\n\nWrong Usage. Use:\ngif2h5 <GIFFILE> <HDFFILE>\n\n"); - return(-1); - } - - strncpy(GIFFileName , argc[1] , VSNAMELENMAX - 1); - strncpy(HDFFileName , argc[2] , VSNAMELENMAX - 1); - GIFFileName[VSNAMELENMAX - 1] = '\0'; - HDFFileName[VSNAMELENMAX - 1] = '\0'; - - if (!(fpGif = fopen(GIFFileName,"rb"))) { - printf("Unable to open GIF file for reading.\n"); - printf("Filename (including path) must be less than %d charachters in length\n", - VSNAMELENMAX); - exit(-1); - } - - /* Get the whole file into memory. Mem's much faster than I/O */ - fseek(fpGif, 0L , 2); - filesize = ftell(fpGif); - fseek(fpGif, 0L , 0); - - if (filesize == 0) - printf("File Size Zero"); - - if (!(MemGif = StartPos = (BYTE *)malloc((size_t)filesize))) { - printf("Out of memory"); - exit (-1); - } - - if (fread(MemGif,(size_t)filesize,1,fpGif) != 1) { - printf("Corrupted Input File"); - exit(-1); - } - - fseek(fpGif,0L,0); - - /* - * Call Gif2Mem and break the whole file into parts. Gif2Mem also calls - * decompresses the images so we don't have to worry about that - */ - GifMemoryStruct = Gif2Mem(MemGif); - - if (ferror(fpGif)) { - printf("File Stream Error\n\n"); - exit(-1); - } - - fclose(fpGif); - - /* - * Call WriteHDF from here. Go ahead and change WriteHDF to write whatever - * format you want - */ - if (WriteHDF(GifMemoryStruct , argc[2] , argc[1])) - printf("HDF Write Error\n\n"); - - /* Free all buffers */ - /* replacing int32 with long */ - ImageCount = (long)((GifMemoryStruct.GifHeader)->ImageCount); - - for(i = 0; i < ImageCount ; i++) { - gifImageDesc = *(GifMemoryStruct.GifImageDesc[i]); - - if (gifImageDesc.Image != NULL) - free(gifImageDesc.Image); - - if (GifMemoryStruct.GifGraphicControlExtension[i] != NULL) - free(GifMemoryStruct.GifGraphicControlExtension[i]); - } - - free(StartPos); - free(GifMemoryStruct.GifHeader); - free(GifMemoryStruct.GifApplicationExtension); - return 0; -} diff --git a/tools/gifconv/gif2mem.c b/tools/gifconv/gif2mem.c deleted file mode 100644 index 0695995..0000000 --- a/tools/gifconv/gif2mem.c +++ /dev/null @@ -1,344 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * This file contains snippets of code from James Murray's original file to - * display the GIF header information, but most of it has been modified to - * suit gif2hdf - */ - -/****************************************************************************\ -** Title: GIFHEAD.C ** -** Purpose: Display the data in a GIF image file. ** -** Version: 1.0 ** -** Date: March 1992 ** -** Author: James D. Murray, Anaheim, CA, USA ** -** C Compilers: Borland C++ v2.0, Microsoft C v6.00a ** -** ** -** GIFHEAD displays all real information contained within a GIF image ** -** file, including all color tables and extension block information. ** -** GIFHEAD reads both GIF 87a abd 89a-format files. ** -** ** -** Copyright (C) 1991-92 by Graphics Software Labs. All rights reserved. ** -\****************************************************************************/ -#include <stdio.h> - -#include "gif.h" - -#define VERSION "1.00" - -GIFTOMEM -Gif2Mem(BYTE *MemGif) -{ - /* - * The gif structure outline for passing data to memory is given in gif.h. - * These pointers are redunant, should take them out in ver. 2 - */ - GIFHEAD *gifHead; /* GIF Header structure */ - GIFIMAGEDESC **gifImageDesc; /* Logical Image Descriptor struct */ - GIFPLAINTEXT **gifPlainText; /* Plain Text Extension structure */ - GIFAPPLICATION **gifApplication; /* Application Extension structure */ - GIFCOMMENT **gifComment; /* Comment Extension structure */ - GIFGRAPHICCONTROL **gifGraphicControl; /* Graphic Control Extension strct */ - - GIFTOMEM GifMemoryStruct; - - register WORD i; /* Loop counter */ - BYTE Identifier; /* Extension block identifier holder */ - BYTE Label; /* Extension block label holder */ - BYTE ImageCount; /* Count of the number of images in the file */ - BYTE ImageArray; /* Keep the size of the array to store Images */ - BYTE CommentCount; - BYTE CommentArray; - BYTE ApplicationCount; - BYTE ApplicationArray; - BYTE PlainTextCount; - BYTE PlainTextArray; - BYTE GCEflag; - BYTE aTemp; - BYTE j; - BYTE w; /* Two more variables needed only while testing */ - BYTE *b; /* Endian Ordering */ - - /* Allocate memory for the GIF structures */ - /* Plug the structs into GifMemoryStruct at the end */ - /****************************************************/ - if (!(gifHead = (GIFHEAD *)malloc(sizeof(GIFHEAD)))) { - printf("Could not allocate memory for gifHead\n"); - exit(-1); - } - - /* - * The next three have to grow dynamically so we leave them for now and - * let realloc handle it later on. - */ - gifImageDesc = NULL; - gifPlainText = NULL; - gifGraphicControl = NULL; - gifComment = NULL; - gifApplication = NULL; - - /******************************/ - /* Memory allocation complete */ - /******************************/ - - /* Carry out Endian Testing and set Endian Order */ - w = 0x0001; - b = (BYTE *) &w; - EndianOrder = (b[0] ? 1 : 0); - - /* Read the GIF image file header information */ - ReadGifHeader(gifHead, &MemGif); - - /* Check for FILE stream error */ -#if 0 - if (ferror(fpGif)) - { - fputs("GIFHEAD: Error reading header information!\n", stderr); - exit(-3); - } -#endif /* 0 */ - - /* - * Identify, read, and display block information. - */ - ImageCount = ImageArray = 0; - CommentCount = CommentArray = 0; - ApplicationCount = ApplicationArray = 0; - PlainTextCount = PlainTextArray = 0; - GCEflag = 0; - - for (;;) { - Identifier = *MemGif++; - - switch (Identifier) { - case 0x3B: /* Trailer */ - /* - * The counts are stored to make it easier while putting stuff - * into the HDF file and then deallocating space. - */ - gifHead->ImageCount = ImageCount; - gifHead->CommentCount = CommentCount; - gifHead->ApplicationCount = ApplicationCount; - gifHead->PlainTextCount = PlainTextCount; - - /* putting stuff into the gif2mem structure */ - GifMemoryStruct.GifHeader = gifHead; - GifMemoryStruct.GifImageDesc = gifImageDesc; - GifMemoryStruct.GifPlainTextExtension = gifPlainText; - GifMemoryStruct.GifApplicationExtension = gifApplication; - GifMemoryStruct.GifCommentExtension = gifComment; - GifMemoryStruct.GifGraphicControlExtension = gifGraphicControl; - - /* return the struct */ - return GifMemoryStruct; - - case 0x2C: /* Image Descriptor */ - /* - * If there was no image descriptor before this increase image - * count. If an imagedescriptor was present, reset GCEflag - */ - if (GCEflag == 0) - ImageCount++; - else - GCEflag = 0; - - if (ImageCount > ImageArray) { - aTemp = ImageArray; - ImageArray = (ImageArray << 1) + 1; - if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc, - sizeof(GIFIMAGEDESC *) * ImageArray))) { - printf("Out of memory!"); - exit(-1); - } - - if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc( - gifGraphicControl, - sizeof(GIFGRAPHICCONTROL *) * ImageArray))) { - printf("Out of memory!"); - exit(-1); - } - - for (j = aTemp ; j < ImageArray ; j++) { - gifGraphicControl[j] = NULL; - gifImageDesc[j] = NULL; - } - } - - if(!(gifImageDesc[ImageCount-1] = (GIFIMAGEDESC*)malloc(sizeof(GIFIMAGEDESC)))) { - printf("Out of memory!"); - exit(-1); - } - - - if (ReadGifImageDesc(gifImageDesc[ImageCount-1], &MemGif) == -1) - fputs("Error reading Image Descriptor information\n", stderr); - - /* Decompress the Image */ - gifImageDesc[ImageCount-1]->Image = Decompress(gifImageDesc[ImageCount-1], - gifHead); - free(gifImageDesc[ImageCount-1]->GIFImage); - - /* - * Convert the local palette into an HDF compatible palette In - * case the local color table is present, it is written out as - * the HDFPalette If it is absent the global table is written - * as the HDFPalette. - */ - if (!((gifImageDesc[ImageCount-1]->PackedField) & 0x80)) { - /* Check to see if the global color table exists.... */ - if (gifHead->PackedField & 0x80) { - for (i=0 ; i<gifHead->TableSize ; i++) { - gifImageDesc[ImageCount-1]->HDFPalette[i][0] = - gifHead->HDFPalette[i][0]; - gifImageDesc[ImageCount-1]->HDFPalette[i][1] = - gifHead->HDFPalette[i][1]; - gifImageDesc[ImageCount-1]->HDFPalette[i][2] = - gifHead->HDFPalette[i][2]; - } - } - - gifImageDesc[ImageCount-1]->TableSize = gifHead->TableSize; - } - - break; - - case 0x21: /* Extension Block */ - Label = *MemGif++; - - switch (Label) { - case 0x01: /* Plain Text Extension */ - puts("Plain Text Extension\n"); - PlainTextCount++; - - if (PlainTextCount > PlainTextArray) - PlainTextArray = (PlainTextArray << 1) + 1; - - if (!(gifPlainText = (GIFPLAINTEXT **)realloc(gifPlainText , sizeof(GIFPLAINTEXT *) * PlainTextArray))) { - printf("Out of memory!"); - exit(-1); - } - - if(!(gifPlainText[PlainTextCount - 1] = (GIFPLAINTEXT*)malloc(sizeof(GIFPLAINTEXT)))) { - printf("Out of memory!"); - exit(-1); - } - - if (ReadGifPlainText(gifPlainText[PlainTextCount - 1], &MemGif)) - fprintf(stderr, - "Error reading Plain Text Extension information.\n"); - - break; - - case 0xFE: /* Comment Extension */ - CommentCount++; - - if (CommentCount > CommentArray) - CommentArray = (CommentArray << 1) + 1; - - if (!(gifComment = (GIFCOMMENT **)realloc(gifComment , sizeof(GIFCOMMENT *) * CommentArray))) { - printf("Out of memory!"); - exit(-1); - } - - if(!(gifComment[CommentCount - 1] = (GIFCOMMENT *)malloc(sizeof(GIFCOMMENT)))) { - printf("Out of memory!"); - exit(-1); - } - - - if (ReadGifComment(gifComment[CommentCount - 1], &MemGif)) - fprintf(stderr, - "Error reading Comment Extension information\n"); - - break; - - case 0xF9: /* Graphic Control Extension */ - if (GCEflag == 0 ) - ImageCount++; - - GCEflag = 1; - - if (ImageCount > ImageArray) { - aTemp = ImageArray; - ImageArray = (ImageArray << 1) + 1; - - if (!(gifGraphicControl = (GIFGRAPHICCONTROL **)realloc(gifGraphicControl , sizeof(GIFGRAPHICCONTROL *) * ImageArray))) { - printf("Out of memory!"); - exit(-1); - } - - if (!(gifImageDesc = (GIFIMAGEDESC **)realloc(gifImageDesc , sizeof(GIFIMAGEDESC *) * ImageArray))) { - printf("Out of memory!"); - exit(-1); - } - - for (j = aTemp ; j < ImageArray ; j++) { - gifGraphicControl[j] = NULL; - gifImageDesc[j] = NULL; - } - } - - if(!(gifGraphicControl[ImageCount-1] = (GIFGRAPHICCONTROL*)malloc(sizeof(GIFGRAPHICCONTROL)))) { - printf("Out of memory!"); - exit(-1); - } - - - if (ReadGifGraphicControl(gifGraphicControl[ImageCount-1], &MemGif)) - fprintf(stderr, - "Error reading Graphic Control Extension information\n"); - - if (!*MemGif++ == 0) - fprintf(stderr, - "Error reading Graphic Control Extension\n"); - - break; - - case 0xFF: /* Application Extension */ - ApplicationCount++; - - if (ApplicationCount > ApplicationArray) - ApplicationArray = (ApplicationArray << 1) + 1; - - if (!(gifApplication = (GIFAPPLICATION **)realloc(gifApplication , sizeof(GIFAPPLICATION *) * ApplicationArray))) { - printf("Out of memory!"); - exit(-1); - } - - if(!(gifApplication[ApplicationCount - 1] = (GIFAPPLICATION *)malloc(sizeof(GIFAPPLICATION)))) { - printf("Out of memory!"); - exit(-1); - } - - - if (ReadGifApplication(gifApplication[ApplicationCount - 1], &MemGif)) - fprintf(stderr, - "Error reading Application Extension information\n"); - - break; - - default: - printf("Unknown Extension Label: 0x%02x\n", Label); - break; - } - - break; - - default: - fprintf(stderr, - "Unknown Block Separator Character: 0x%02x\n", Identifier); - } - } -} diff --git a/tools/gifconv/gifread.c b/tools/gifconv/gifread.c deleted file mode 100644 index 5f4aba0..0000000 --- a/tools/gifconv/gifread.c +++ /dev/null @@ -1,402 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <stdio.h> -#include <stdlib.h> - -#include "gif.h" - -int EndianOrder; - -static BYTE *ReadDataSubBlocks(BYTE **MemGif2, WORD *DSize); - -WORD -GetWord(BYTE *MemGif) -{ - WORD w; - - if (EndianOrder == 1) { - /* LittleEndian */ - w = (WORD) (*MemGif++ & 0xFF); - w |= (WORD) ((*MemGif++ & 0xFF) << 0x08); - } else { - w = (WORD) (*MemGif++ & 0xFF); - w = ((WORD) (*MemGif++ & 0xFF)) | (w << 0x08); - } - - return w; -} - -BYTE -GetByte(BYTE *MemGif) -{ - return *MemGif; -} - -/* - * Read a GIF image BYTE Header. - * - * This function reads the Header, Logical Screen Descriptor, and - * Global Color Table (if any) from a GIF image file. The information - * is stored in a GIFHEAD structure. - * - * Returns: -1 if a FILE stream error occured during the read, - * otherwise 0 if no error occured. - */ -int -ReadGifHeader(GIFHEAD *GifHead, /* Pointer to GIF header structure */ - BYTE **MemGif2) /* GIF image file input FILE stream */ -{ - WORD i; /* Loop counter */ - WORD tableSize; /* Number of entires in the Global Color Table */ - - GifHead->TableSize = 0; - for (i = 0 ; i < 6 ; i++) { - GifHead->HeaderDump[i] = *(*MemGif2)++; - } - - if (strncmp((const char *)GifHead->HeaderDump , "GIF" , 3)) { - printf("The file does not appear to be a valid GIF file.\n"); - exit(-1); - } - - for (i = 0 ; i < 7 ; i++) { - GifHead->LSDDump[i] = *(*MemGif2)++; - } - - GifHead->PackedField = GifHead->LSDDump[4]; - - /* Check if a Global Color Table is present */ - if (GifHead->PackedField & 0x80) { - /* Read number of color table entries */ - tableSize = (WORD) (1L << ((GifHead->PackedField & 0x07) + 1)); - GifHead->TableSize = tableSize; - - /* Read the Global Color Table */ - - /* - * There are some changes made here apart from just reading in the - * global color table as would seem intuitively obvious. The colors - * are stored in the bottom part of the palette as opposed to the top - */ - - for (i = 0; i < tableSize; i++) { - GifHead->HDFPalette[i][0] = *(*MemGif2)++; - GifHead->HDFPalette[i][1] = *(*MemGif2)++; - GifHead->HDFPalette[i][2] = *(*MemGif2)++; - } - } - - /* Check for a FILE stream error */ -#if 0 - if (ferror(FpGif)) - return -1; -#endif /* 0 */ - - return 0; /* No FILE stream error occured */ -} - - -/* -** Read a GIF Local Image Descriptor. -** -** This function reads the Local Image Descriptor, and Local Color -** Table (if any) from a GIF image file. The information is stored -** in a GIFIMAGEDESC structure. -** -** Note that the ImageSeparator field value in the GIFIMAGEDESC -** structure is assigned by the function calling ReadGifImageDesc(). -** -** Returns: -1 if a FILE stream error occured during the read, -** otherwise 0 if no error occured. -*/ -int -ReadGifImageDesc( - GIFIMAGEDESC *GifImageDesc, /* Pointer to GIF image descriptor structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ - ) -{ - WORD i; /* Loop counter */ - WORD tableSize; /* Number of entries in the Local Color Table */ - /* BYTE Interlace; */ /* PackedField & 0x20 gives information on interlacing */ - BYTE *TempPtr; - int ch , ch1; - - GifImageDesc->TableSize = 0; - for (i = 0 ; i < 9 ; i++) { - GifImageDesc->GIDDump[i] = *(*MemGif2)++; - } - - /* - ** Get the relevant fields. I need ImageWidth and Height actively hence I have - ** taken information from those fields. I intend to keep the GifImageDesc data - ** structure as it is so that anyone needing the rest of the fields can do so - ** quickly. - */ - - if (EndianOrder == 1) /* LittleEndian */ - { - GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF); - GifImageDesc->ImageWidth |= (WORD) ((GifImageDesc->GIDDump[5] & 0xFF) << 0x08); - - GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF); - GifImageDesc->ImageHeight |= (WORD) ((GifImageDesc->GIDDump[7] & 0xFF) << 0x08); - - } - else - { - GifImageDesc->ImageWidth = (WORD) (GifImageDesc->GIDDump[4] & 0xFF); - GifImageDesc->ImageWidth = ((WORD) (GifImageDesc->GIDDump[5] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08); - - GifImageDesc->ImageHeight = (WORD) (GifImageDesc->GIDDump[6] & 0xFF); - GifImageDesc->ImageHeight = ((WORD) (GifImageDesc->GIDDump[7] & 0xFF)) | (GifImageDesc->ImageWidth << 0x08); - - - } - - GifImageDesc->PackedField = GifImageDesc->GIDDump[8]; - - /* Interlace = GifImageDesc->PackedField & 0x20; */ - - /* Check if a Local Color Table is present */ - if (GifImageDesc->PackedField & 0x80) - { - /* Read number of color table entries */ - tableSize = (WORD) (1L << ((GifImageDesc->PackedField & 0x07) + 1)); - GifImageDesc->TableSize = tableSize; - /* Read the Local Color Table */ - for (i = 0; i < tableSize; i++) - { - GifImageDesc->HDFPalette[i][0] = *(*MemGif2)++; - GifImageDesc->HDFPalette[i][1] = *(*MemGif2)++; - GifImageDesc->HDFPalette[i][2] = *(*MemGif2)++; - } - } - - /* - ** Get LZW minimum Code Size - */ - GifImageDesc->CodeSize = (WORD)*(*MemGif2)++; - - /*GifImageDesc->GIFImage = ReadDataSubBlocks(FpGif);*/ - if (!(GifImageDesc->GIFImage = (BYTE *)malloc((GifImageDesc->ImageWidth) * (GifImageDesc->ImageHeight)))) { - printf("Out of memory"); - exit(-1); - } - - - TempPtr = GifImageDesc->GIFImage; - do - { - ch = ch1 = (int)*(*MemGif2)++; - while (ch--) *TempPtr++ = *(*MemGif2)++; - } - while (ch1); - - - return(0); /* No FILE stream error occured */ -} - - -/* -** Read a GIF Graphic Control Extension block. -** -** Note that the Introducer and Label field values in the GIFGRAPHICCONTROL -** structure are assigned by the function calling ReadGifGraphicControl(). -** -** Returns: -1 if a FILE stream error occured during the read, -** otherwise 0 if no error occured. -*/ -int -ReadGifGraphicControl( - GIFGRAPHICCONTROL *GifGraphicControl, /* Pointer to GC Extension structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ - ) -{ - int i; - - for (i = 0 ; i < 5 ; i++) { - GifGraphicControl->GCEDump[i] = *(*MemGif2)++; - } - - return(0); /* No FILE stream error occured */ -} - - -/* -** Read a GIF Plain Text Extension block. -** -** Note that the Introducer and Label field values in the GIFLPLAINTEXT -** structure are assigned by the function calling ReadGifPlainText(). -** -** Returns: -1 if a FILE stream error occured during the read, -** otherwise 0 if no error occured. -*/ -int -ReadGifPlainText( - GIFPLAINTEXT *GifPlainText, /* Pointer to Plain Text Extension structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ - ) -{ - int i; - - for (i = 0 ; i < 13 ; i++) { - GifPlainText->PTEDump[i] = *(*MemGif2)++; - } - - /* Read in the Plain Text data sub-blocks */ - if (!(GifPlainText->PlainTextData = ReadDataSubBlocks(MemGif2 , &(GifPlainText->DataSize)))) - return(1); - - /* - GifPlainText->Terminator = 0; - */ - - /* Check for a FILE stream error */ - /* - if (ferror(FpGif)) - return(-1); - */ - - return(0); /* No FILE stream error occured */ -} - - -/* -** Read a GIF Application Extension block. -** -** Note that the Introducer and Label field values in the GIFAPPLICATION -** structure are assigned by the function calling ReadGifApplication(). -** -** Returns: -1 if a FILE stream error occured during the read, -** otherwise 0 if no error occured. -*/ -int -ReadGifApplication( - GIFAPPLICATION *GifApplication, /* Pointer to Application Extension structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ - ) -{ - int i; - - for (i = 0 ; i < 12 ; i++) { - GifApplication->AEDump[i] = *(*MemGif2)++; - } - - /* Read in the Plain Text data sub-blocks */ - if (!(GifApplication->ApplicationData = ReadDataSubBlocks(MemGif2 , &(GifApplication->DataSize)))) - return(1); - /* - GifApplication->Terminator = 0; - */ - - /* Check for a FILE stream error */ - /* - if (ferror(FpGif)) - return(-1); - */ - - return(0); /* No FILE stream error occured */ -} - - -/* -** Read a GIF Comment Extension block. -** -** Note that the Introducer and Label field values in the GIFCOMMENT -** structure are assigned by the function calling ReadGifComment(). -** -** Returns: -1 if a FILE stream error occured during the read, -** otherwise 0 if no error occured. -*/ -int -ReadGifComment( - GIFCOMMENT *GifComment, /* Pointer to GIF Comment Extension structure */ - BYTE **MemGif2 /* GIF image file input FILE stream */ - ) -{ - - /* Read in the Plain Text data sub-blocks */ - if (!(GifComment->CommentData = ReadDataSubBlocks(MemGif2 , &(GifComment->DataSize)))) - return(1); - - GifComment->Terminator = 0; - - return(0); /* No FILE stream error occured */ -} - - -/* -** Read one or more GIF data sub-blocks and write the information -** to a buffer. -** -** A GIF "sub-block" is a single count byte followed by 1 to 255 -** additional data bytes. -** -** Returns: A NULL pointer if a memory allocation error occured, -** otherwise a valid pointer if no error occured. -*/ -static BYTE * -ReadDataSubBlocks(BYTE **MemGif2, /* GIF image file input FILE stream */ - WORD *DSize) -{ - BYTE *ptr1; /* Pointer used to "walk the heap" */ - BYTE *ptr2; /* Pointer used to mark the top of the heap */ - BYTE dataSize; /* Size of the current data sub-block being read */ - WORD bufSize; /* Total size of the Plain Text data buffer */ - int tempcount = 0; - - bufSize = 0; /* The output buffer is empty */ - - dataSize = *(*MemGif2)++; /* Get the size of the first sub-block */ - - /* Allocate initial data buffer */ - if (!(ptr1 = ptr2 = (BYTE *) malloc((size_t)dataSize + 1))) { - printf("Out of memory. Allocation of memory for data sub-blocks for\neither Comment, Plain Text or Application Extensions failed"); - return((BYTE *) NULL); - } - for (;;) - { - tempcount++; - bufSize += (dataSize); /* Running total of the buffer size */ - *DSize = bufSize; - -#ifdef COMMENTED_OUT - *ptr1++ = dataSize; /* Write the data count */ -#endif /* COMMENTED_OUT */ - while (dataSize--) /* Read/write the Plain Text data */ - *ptr1++ = *(*MemGif2)++; - - /* Check if there is another data sub-block */ - if ((dataSize = *(*MemGif2)++) == 0) - break; /* Block Terminator encountered */ - - /* Increase the buffer size to accomodate the next sub-block */ - if (!(ptr1 = ptr2 = (BYTE *) realloc(ptr2, bufSize + dataSize + 1))) - return((BYTE *) NULL); - - - ptr1 += bufSize; /* Move pointer to the end of the data */ - - - } - - *ptr1++ = '\0'; - - return(ptr2); /* Return a pointer to the sub-block data */ -} - - - - - diff --git a/tools/gifconv/hdf2gif.c b/tools/gifconv/hdf2gif.c deleted file mode 100644 index 52e57f7..0000000 --- a/tools/gifconv/hdf2gif.c +++ /dev/null @@ -1,404 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * NOTES: - * 04/01 - 04/10: been working on it a lot. I think it does gif89 images just - * fine with palettes. So that's cool. Putting in multiple - * images and animation support right now - * 03/29: For some reason I can write .GIF files which IE will open and see - * but kodak imaging does not like. I'm sure its a problem with the GIF - * file, I can't figure out what. - * 03/17: Explicitely deallocate the GIFTOMEM* struct in the main loop. - * Check for both success and failure conditions - */ - -#include <stdio.h> -#include <assert.h> -#include "gif.h" - -#define MAX_FILE_LEN 256 -#define MAX_NUMBER_IMAGES 50 - -int EndianOrder; - -#ifdef NOT_USED -static void -PutByte(BYTE b , FILE *fpGif) -{ - if (fputc(b , fpGif) == EOF) { - printf("File Writing Error, cannot continue"); - exit(-1); - } -} -#endif /* NOT_USED */ - -static void -putword(int w, FILE *fp) -{ - /* writes a 16-bit integer in GIF order (LSB first) */ - fputc(w &0xff, fp); - fputc((w>>8)&0xff,fp); -} - -static void -usage(void) -{ - printf("Usage: h52gif <h5_file> <gif_file> -i <h5_image> [-p <h5_palette>]\n"); - printf("h52gif expects *at least* one h5_image.\n"); - printf("You may repeat -i <h5_image> [-p <h5_palette>] at most 50 times\n"); - printf("(maximum of 50 images).\n"); -} - -FILE *fpGif = NULL; -int main(int argc , char **argv) -{ - - - hsize_t dim_sizes[2]; - BYTE *Image; - - /* compression structs */ - CHAR *HDFName = NULL; - CHAR *GIFName = NULL; - - /* reference variables */ - int has_local_palette; /* treated as a flag */ - - BYTE* b; - - BYTE GlobalPalette[256][3]; - BYTE Red[256]; - BYTE Green[256]; - BYTE Blue[256]; - - int RWidth, RHeight; -#ifdef UNUSED - int LeftOfs, TopOfs; - int CountDown; - int curx , cury; - int w,h; -#endif /* UNUSED */ - int ColorMapSize, InitCodeSize, Background, BitsPerPixel; - int j,nc; - int i; - int numcols = 256; - int time_out = 0; /* time between two images in the animation */ - int n_images , idx; - - BYTE pc2nc[256] , r1[256] , g1[256] , b1[256]; - - /* initial stuff */ - int number_of_images = 0; - int arg_index = 2; - int bool_is_image = 0; /* 0 = false , 1 = true */ - int bool_is_palette = 0; - CHAR* image_name_arr[MAX_NUMBER_IMAGES]; - CHAR* pal_name_arr[MAX_NUMBER_IMAGES]; - - if (argc < 5) { - /* they didn't supply at least one image -- bail */ - usage(); - return 0; - } - - memset(image_name_arr , 0 , MAX_NUMBER_IMAGES); - memset(pal_name_arr , 0 , MAX_NUMBER_IMAGES); - - HDFName = (CHAR *)malloc (strlen(argv[1]) + 1); - GIFName = (CHAR *)malloc (strlen(argv[2]) + 1); - - if (strlen(argv[1] + 1) > MAX_FILE_LEN || strlen(argv[2] + 1) > MAX_FILE_LEN) { - /* supplied file names are too long. bail. */ - usage(); - printf("Supplied filenames exceed maximum length of 256 bytes\n"); - } - - strcpy(HDFName , argv[1]); - strcpy(GIFName , argv[2]); - - /* get the options */ - while (arg_index++ < argc - 1 && number_of_images < MAX_NUMBER_IMAGES) { - if (!strcmp(argv[arg_index] , "-i")) { - bool_is_image = 1; - continue; - } - - if (!strcmp(argv[arg_index] , "-p")) { - bool_is_palette = 1; - continue; - } - - if (!strcmp(argv[arg_index] , "-a")) { - time_out = 10; - continue; - } - - if (bool_is_image) { - /* this is an image */ - /* allocate space to store the image name */ - image_name_arr[number_of_images] = (CHAR*) malloc(strlen(argv[arg_index] + 1)); - strcpy(image_name_arr[number_of_images] , argv[arg_index]); - - /* make the palette array for this NULL */ - pal_name_arr[number_of_images] = NULL; - number_of_images++; - bool_is_image = 0; - continue; - } - - if (bool_is_palette) { - /* this is a palette */ - /* allocate space to store the pal name */ - /* the palette was probably allocated for a previous image */ - pal_name_arr[number_of_images-1] = (CHAR*) malloc(strlen(argv[arg_index] + 1)); - strcpy(pal_name_arr[number_of_images - 1], argv[arg_index]); - bool_is_palette = 0; - continue; - } - - /* oops. This was not meant to happen */ - usage(); - -#if 0 - while (number_of_images--) { - cleanup(image_name_arr[number_of_images]); - cleanup(pal_name_arr[number_of_images]); - } -#endif /* 0 */ - - return -1; - } - - /* we shall always have a palette - read hdf will see to that */ - has_local_palette = true; - - /* Do Endian Order testing and set Endian Order */ - idx = 0x0001; - b = (BYTE *) &idx; - EndianOrder = (b[0] ? 1:0); - - if (!(fpGif = fopen(GIFName , "wb"))) { - printf("Error opening gif file for output. Aborting.\n"); - return -1; - } - - /* hardwire n_images to 1 for now. */ - n_images = number_of_images; - - Background = 0; - for (idx = 0 ; idx < n_images ; idx++) { - /* try to read the image and the palette */ - - /* - * Lots of funky stuff to support multiple images has been taken off. - * Just in case you're extending code, here's what you need to do in - * short: figure out if there is a global palette or not, if there is - * one store that one only. If they are all local or a combination of - * local and global palettes, you will have to write the global - * palette out and then independantly write the smaller local palettes - */ - if (ReadHDF(&Image, GlobalPalette, dim_sizes, HDFName, - image_name_arr[idx], pal_name_arr[idx]) < 0) { - fprintf(stderr , "Unable to read image %s from HDF file %s\n",image_name_arr[idx],HDFName); - return -1; - } - - assert(dim_sizes[0]==(hsize_t)((int)dim_sizes[0])); - assert(dim_sizes[1]==(hsize_t)((int)dim_sizes[1])); - RWidth = (int)dim_sizes[1]; - RHeight = (int)dim_sizes[0]; -#ifdef UNUSED - w = dim_sizes[1]; - h = dim_sizes[0]; - - LeftOfs = TopOfs = 0; -#endif /* UNUSED */ - - - /* - * If the first image does not have a palette, I make my own global - * color table Obviously this is not the best thing to do, better - * steps would be: - * - * 1. Check for either a global palette or a global attribute called - * palette - * 2. Check for palettes in any of the other images. - */ - if (!has_local_palette) { - for (i = 0 ; i < 256 ; i++) { - Red[i] = 255 - i; - Green[i] = 255 - i; - Blue[i] = 255 - i; - } - } else { - for (i = 0 ; i < 256 ; i++){ - Red[i] = GlobalPalette[i][0]; - Green[i] = GlobalPalette[i][1]; - Blue[i] = GlobalPalette[i][2]; - } - } - - for (i = 0; i < 256; i++) { - pc2nc[i] = r1[i] = g1[i] = b1[i] = 0; - } - - /* compute number of unique colors */ - nc = 0; - - for (i = 0; i < numcols; i++) { - /* see if color #i is already used */ - for (j = 0; j < i; j++) { - if (Red[i] == Red[j] && Green[i] == Green[j] && Blue[i] == Blue[j]) - break; - } - - if (j==i) { - /* wasn't found */ - pc2nc[i] = nc; - r1[nc] = Red[i]; - g1[nc] = Green[i]; - b1[nc] = Blue[i]; - nc++; - } else { - pc2nc[i] = pc2nc[j]; - } - } - - /* figure out 'BitsPerPixel' */ - for (i = 1; i < 8; i++) { - if ((1<<i) >= nc) - break; - } - - BitsPerPixel = i; - ColorMapSize = 1 << BitsPerPixel; - -#ifdef UNUSED - CountDown = w * h; /* # of pixels we'll be doing */ -#endif /* UNUSED */ - - if (BitsPerPixel <= 1) - InitCodeSize = 2; - else - InitCodeSize = BitsPerPixel; - -#ifdef UNUSED - curx = cury = 0; -#endif /* UNUSED */ - - if (!fpGif) { - fprintf(stderr, "WriteGIF: file not open for writing\n" ); - return (1); - } - - /* - * If it is the first image we do all the header stuff that isn't - * required for the rest of the images. - */ - if (idx == 0) { - /* Write out the GIF header and logical screen descriptor */ - if (n_images > 1) { - fwrite("GIF89a", sizeof( char ), 6, fpGif); /* the GIF magic number */ - } else { - fwrite("GIF87a", sizeof( char ), 6, fpGif); /* the GIF magic number */ - } - - putword(RWidth, fpGif); /* screen descriptor */ - putword(RHeight, fpGif); - - i = 0x00; /* No, there is no color map */ - i |= (8-1)<<4; /* OR in the color resolution (hardwired 8) */ - i |= (BitsPerPixel - 1); /* OR in the # of bits per pixel */ - fputc(i,fpGif); - - fputc(Background,fpGif); /* background color */ - fputc(0, fpGif); /* future expansion byte */ - - /* - * If loop_times is 0 , put in the application extension to make - * the gif anime loop indefinitely - */ - if (time_out > 0) { - fputc(0x21 , fpGif); - fputc(0xFF , fpGif); - fputc(11 , fpGif); - fwrite("NETSCAPE2.0" , 1 , 11 , fpGif); - fputc(3 , fpGif); - fputc(1 , fpGif); - fputc(0 , fpGif); - fputc(0 , fpGif); - fputc(0 , fpGif); - } - } - - if (n_images > 1) { - /* write a graphic control block */ - fputc(0x21 , fpGif); - fputc(0xF9 , fpGif); - fputc(4 , fpGif); - fputc(4 , fpGif); - putword(time_out , fpGif); - fputc(255, fpGif); - fputc(0 , fpGif); - } - - /* - * Put Image Descriptor - * Hardwiring Left Offset and Top Offset to 0x00 - */ - fputc(0x2c , fpGif); - putword(0x00 , fpGif); - putword(0x00 , fpGif); - putword(RWidth , fpGif); - putword(RHeight , fpGif); - - /* since we always have a local color palette ... */ - fputc((0x80 | (BitsPerPixel - 1)) , fpGif); - - for (i = 0; i < ColorMapSize; i++) { - /* write out Global colormap */ - fputc(r1[i], fpGif); - fputc(g1[i], fpGif); - fputc(b1[i], fpGif); - } - - fputc(InitCodeSize , fpGif); - - i = hdfWriteGIF(fpGif , Image , 0 , (int)dim_sizes[0] , - (int)dim_sizes[1] , r1, g1 , b1 , pc2nc , 256 , 8 , - BitsPerPixel); - fputc(0x00, fpGif); - free(Image); - } - - if (fputc(';',fpGif) == EOF) { - /* Write GIF file terminator */ - fprintf(stderr , "Error!"); - return -1; - } - - fclose(fpGif); - -#if 0 - while(number_of_images--) { - if (image_name_arr[number_of_images]) - free(image_name_arr[number_of_images]); - if (pal_name_arr[number_of_images]) - free(pal_name_arr[number_of_images]); - } -#endif /* 0 */ - - return 0; -} diff --git a/tools/gifconv/hdfgifwr.c b/tools/gifconv/hdfgifwr.c deleted file mode 100644 index b1b5be5..0000000 --- a/tools/gifconv/hdfgifwr.c +++ /dev/null @@ -1,521 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* - * hdfgifwr.c - handles writing of GIF files. - * - * Contains: - * hdfWriteGIF(fp, pic, ptype, w, h, rmap, gmap, bmap, numcols, colorstyle, - * comment) - * - * Note: slightly brain-damaged, in that it'll only write non-interlaced - * GIF files (in the interests of speed, or something) - */ - -/***************************************************************** - * Portions of this code Copyright (C) 1989 by Michael Mauldin. - * Permission is granted to use this file in whole or in - * part for any purpose, educational, recreational or commercial, - * provided that this copyright notice is retained unchanged. - * This software is available to all free of charge by anonymous - * FTP and in the UUNET archives. - * - * - * Authors: Michael Mauldin (mlm@cs.cmu.edu) - * David Rowley (mgardi@watdcsu.waterloo.edu) - * - * Based on: compress.c - File compression ala IEEE Computer, June 1984. - * - * Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) - * Jim McKie (decvax!mcvax!jim) - * Steve Davies (decvax!vax135!petsd!peora!srd) - * Ken Turkowski (decvax!decwrl!turtlevax!ken) - * James A. Woods (decvax!ihnp4!ames!jaw) - * Joe Orost (decvax!vax135!petsd!joe) - *****************************************************************/ - - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "gif.h" - -typedef BYTE byte; -typedef long int count_int; - -/* indicies into conv24MB */ -#define CONV24_8BIT 0 -#define CONV24_24BIT 1 -#define CONV24_SEP1 2 -#define CONV24_LOCK 3 -#define CONV24_SEP2 4 -#define CONV24_FAST 5 -#define CONV24_SLOW 6 -#define CONV24_BEST 7 -#define CONV24_MAX 8 - -/* values 'picType' can take */ -#define PIC8 CONV24_8BIT -#define PIC24 CONV24_24BIT - -/* MONO returns total intensity of r,g,b components */ -#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/ - -#ifdef UNUSED -static int Width, Height; -static int curx, cury; -static long CountDown; -static int Interlace; -#endif /* UNUSED */ - -#ifdef __STDC__ -static void compress(int, FILE *, byte *, int); -static void output(int); -static void cl_block(void); -static void cl_hash(count_int); -static void char_init(void); -static void char_out(int); -static void flush_char(void); -#else -static void compress(), output(), cl_block(), cl_hash(); -static void char_init(), char_out(), flush_char(); -#endif /* __STDC__ */ - -static byte pc2nc[256]; -#ifdef UNUSED -static byte r1[256],g1[256],b1[256]; -#endif /* UNUSED */ - -/*************************************************************/ -int hdfWriteGIF(FILE *fp, byte *pic, int ptype, int w, int h, byte *rmap, - byte *gmap, byte *bmap, byte *pc2ncmap, int numcols, - int colorstyle, int BitsPerPixel) -{ -#ifdef UNUSED - int RWidth, RHeight; - int LeftOfs, TopOfs; - int ColorMapSize, Background; -#endif /* UNUSED */ - int InitCodeSize; - int i; - byte *pic8 = pic; - - /* Shut compiler up... */ - ptype=ptype; - rmap=rmap; - gmap=gmap; - bmap=bmap; - numcols=numcols; - colorstyle=colorstyle; - -#ifdef UNUSED - Interlace = 0; - Background = 0; -#endif /* UNUSED */ - - for (i = 0; i < 256; i++) { - pc2nc[i] = pc2ncmap[i]; -#ifdef UNUSED - r1[i] = rmap[i]; - g1[i] = gmap[i]; - b1[i] = bmap[i]; -#endif /* UNUSED */ - } - -#ifdef UNUSED - ColorMapSize = 1 << BitsPerPixel; - - RWidth = Width = w; - RHeight = Height = h; - LeftOfs = TopOfs = 0; - - CountDown = w * h; /* # of pixels we'll be doing */ -#endif /* UNUSED */ - - if (BitsPerPixel <= 1) - InitCodeSize = 2; - else - InitCodeSize = BitsPerPixel; - -#ifdef UNUSED - curx = cury = 0; -#endif /* UNUSED */ - - if (!fp) { - fprintf(stderr, "WriteGIF: file not open for writing\n" ); - return (1); - } - - compress(InitCodeSize+1, fp, pic8, w*h); - - if (ferror(fp)) - return -1; - - return 0 ; -} - -/***********************************************************************/ -static unsigned long cur_accum = 0; -static int cur_bits = 0; - -#define MAXCODE(n_bits) ( (1 << (n_bits)) - 1) -#ifndef WIN32 -#define min(a,b) ((a>b) ? b : a) -#endif -#define XV_BITS 12 /* BITS was already defined on some systems */ -#define MSDOS 1 -#define HSIZE 5003 /* 80% occupancy */ - -typedef unsigned char char_type; - -static int n_bits; /* number of bits/code */ -static int maxbits = XV_BITS; /* user settable max # bits/code */ -static int maxcode; /* maximum code, given n_bits */ -static int maxmaxcode = 1 << XV_BITS; /* NEVER generate this */ - -static count_int htab [HSIZE]; -static unsigned short codetab [HSIZE]; - -#define HashTabOf(i) htab[i] -#define CodeTabOf(i) codetab[i] - -static int hsize = HSIZE; /* for dynamic table sizing */ - -/* - * To save much memory, we overlay the table used by compress() with those - * used by decompress(). The tab_prefix table is the same size and type as - * the codetab. The tab_suffix table needs 2**BITS characters. We get this - * from the beginning of htab. The output stack uses the rest of htab, and - * contains characters. There is plenty of room for any possible stack (stack - * used to be 8000 characters). - */ - -#define tab_prefixof(i) CodeTabOf(i) -#define tab_suffixof(i) ((char_type *)(htab))[i] -#define de_stack ((char_type *)&tab_suffixof(1<<XV_BITS)) - -static int free_ent = 0; /* first unused entry */ - -/* - * block compression parameters -- after all codes are used up, - * and compression rate changes, start over. - */ -static int clear_flg = 0; - -static long int in_count = 1; /* length of input */ -static long int out_count = 0; /* # of codes output (for debugging) */ - -/* - * compress stdin to stdout - * - * Algorithm: use open addressing double hashing (no chaining) on the prefix - * code / next character combination. We do a variant of Knuth's algorithm D - * (vol. 3, sec. 6.4) along with G. Knott's relatively-prime secondary probe. - * Here, the modular division first probe is gives way to a faster - * exclusive-or manipulation. Also do block compression with an adaptive - * reset, whereby the code table is cleared when the compression ratio - * decreases, but after the table fills. The variable-length output codes are - * re-sized at this point, and a special CLEAR code is generated for the - * decompressor. Late addition: construct the table according to file size - * for noticeable speed improvement on small files. Please direct questions - * about this implementation to ames!jaw. - */ - -static int g_init_bits; -static FILE *g_outfile; - -static int ClearCode; -static int EOFCode; - -/********************************************************/ -static void compress(int init_bits, FILE *outfile, byte *data, int len) -{ - register long fcode; - register int i = 0; - register int c; - register int ent; - register int disp; - register int hsize_reg; - register int hshift; - - /* - * Set up the globals: g_init_bits - initial number of bits g_outfile - - * pointer to output file - */ - g_init_bits = init_bits; - g_outfile = outfile; - - /* initialize 'compress' globals */ - maxbits = XV_BITS; - maxmaxcode = 1<<XV_BITS; - memset(htab, 0, sizeof(htab)); - memset(codetab, 0, sizeof(codetab)); - hsize = HSIZE; - free_ent = 0; - clear_flg = 0; - in_count = 1; - out_count = 0; - cur_accum = 0; - cur_bits = 0; - - /* Set up the necessary values */ - out_count = 0; - clear_flg = 0; - in_count = 1; - maxcode = MAXCODE(n_bits = g_init_bits); - - ClearCode = (1 << (init_bits - 1)); - EOFCode = ClearCode + 1; - free_ent = ClearCode + 2; - - char_init(); - ent = pc2nc[*data++]; - len--; - - hshift = 0; - for (fcode = (long)hsize; fcode < 65536L; fcode *= 2L ) - hshift++; - - hshift = 8 - hshift; /* set hash code range bound */ - - hsize_reg = hsize; - cl_hash( (count_int) hsize_reg); /* clear hash table */ - - output(ClearCode); - - while (len) { - c = pc2nc[*data++]; - len--; - in_count++; - - fcode = (long)(((long) c << maxbits) + ent); - i = (((int) c << hshift) ^ ent); /* xor hashing */ - - if ( HashTabOf (i) == fcode ) { - ent = CodeTabOf (i); - continue; - } else if ( (long)HashTabOf (i) < 0) { - /* empty slot */ - goto nomatch; - } - - disp = hsize_reg - i; /* secondary hash (after G. Knott) */ - - if ( i == 0 ) - disp = 1; - -probe: - if ((i -= disp) < 0) - i += hsize_reg; - - if (HashTabOf (i) == fcode) { - ent = CodeTabOf (i); - continue; - } - - if ((long)HashTabOf (i) >= 0) - goto probe; - -nomatch: - output(ent); - out_count++; - ent = c; - - if (free_ent < maxmaxcode) { - CodeTabOf (i) = free_ent++; /* code -> hashtable */ - HashTabOf (i) = fcode; - } else { - cl_block(); - } - } - - /* Put out the final code */ - output(ent); - out_count++; - output(EOFCode); -} - - -/***************************************************************** - * TAG( output ) - * - * Output the given code. - * Inputs: - * code: A n_bits-bit integer. If == -1, then EOF. This assumes - * that n_bits =< (long)wordsize - 1. - * Outputs: - * Outputs code to the file. - * Assumptions: - * Chars are 8 bits long. - * Algorithm: - * Maintain a BITS character long buffer (so that 8 codes will - * fit in it exactly). Use the VAX insv instruction to insert each - * code in turn. When the buffer fills up empty it and start over. - */ - -static -unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, - 0x001F, 0x003F, 0x007F, 0x00FF, - 0x01FF, 0x03FF, 0x07FF, 0x0FFF, - 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; - -static void -output(int code) -{ - cur_accum &= masks[cur_bits]; - - if (cur_bits > 0) - cur_accum |= ((long)code << cur_bits); - else - cur_accum = code; - - cur_bits += n_bits; - - while( cur_bits >= 8 ) { - char_out( (int)((unsigned int) cur_accum & 0xff) ); - cur_accum >>= 8; - cur_bits -= 8; - } - - /* - * If the next entry is going to be too big for the code size, then - * increase it, if possible. - */ - if (free_ent > maxcode || clear_flg) { - if (clear_flg) { - maxcode = MAXCODE (n_bits = g_init_bits); - clear_flg = 0; - } else { - n_bits++; - - if ( n_bits == maxbits ) - maxcode = maxmaxcode; - else - maxcode = MAXCODE(n_bits); - } - } - - if (code == EOFCode) { - /* At EOF, write the rest of the buffer */ - while( cur_bits > 0 ) { - char_out( (int)((unsigned int)cur_accum & 0xff) ); - cur_accum >>= 8; - cur_bits -= 8; - } - - flush_char(); - fflush( g_outfile ); - -#ifdef FOO - if(ferror( g_outfile)) - FatalError("unable to write GIF file"); -#endif - } -} - -/********************************/ -static void -cl_block(void) /* table clear for block compress */ -{ - /* Clear out the hash table */ - cl_hash((count_int) hsize); - free_ent = ClearCode + 2; - clear_flg = 1; - output(ClearCode); -} - -/********************************/ -static void -cl_hash(count_int hashsize) /* reset code table */ -{ - count_int *htab_p = htab+hashsize; - long i, m1 = -1; - - i = hashsize - 16; - - do { /* might use Sys V memset(3) here */ - *(htab_p-16) = m1; - *(htab_p-15) = m1; - *(htab_p-14) = m1; - *(htab_p-13) = m1; - *(htab_p-12) = m1; - *(htab_p-11) = m1; - *(htab_p-10) = m1; - *(htab_p-9) = m1; - *(htab_p-8) = m1; - *(htab_p-7) = m1; - *(htab_p-6) = m1; - *(htab_p-5) = m1; - *(htab_p-4) = m1; - *(htab_p-3) = m1; - *(htab_p-2) = m1; - *(htab_p-1) = m1; - htab_p -= 16; - } while ((i -= 16) >= 0); - - for ( i += 16; i > 0; i-- ) - *--htab_p = m1; -} - -/****************************************************************************** - * - * GIF Specific routines - * - ******************************************************************************/ - -/* - * Number of characters so far in this 'packet' - */ -static int a_count; - -/* - * Set up the 'byte output' routine - */ -static void -char_init(void) -{ - a_count = 0; -} - -/* - * Define the storage for the packet accumulator - */ -static char accum[ 256 ]; - -/* - * Add a character to the end of the current packet, and if it is 254 - * characters, flush the packet to disk. - */ -static void -char_out(int c) -{ - accum[ a_count++ ] = c; - - if (a_count >= 254) - flush_char(); -} - -/* - * Flush the packet to disk, and reset the accumulator - */ -static void -flush_char(void) -{ - if (a_count > 0) { - fputc( a_count, g_outfile ); - fwrite( accum, 1, (size_t)a_count, g_outfile); - a_count = 0; - } -} diff --git a/tools/gifconv/readhdf.c b/tools/gifconv/readhdf.c deleted file mode 100644 index 5985812..0000000 --- a/tools/gifconv/readhdf.c +++ /dev/null @@ -1,254 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include "gif.h" -#include "h5tools.h" - - -/* just a small cleanup routine before we leave */ -void -cleanup(BYTE *ptr) -{ - if (ptr) - free(ptr); -} - -/* Function: ReadHDF -** Return: 0 on completion without error, -1 on error -** Input: CHAR *h5_file - HDF file name -** CHAR *dset_name - Name of the HDF Image dataset -** CHAR *pal_name - Name of the HDF palette -** Output: BYTE** data - the HDF Image to be converted -** BYTE palette[256][3] - the corresponding palette -** hsize_t* image_size - the size of each dimension of the image -** -** Future Notes: -** The way readHDF works right now is that it expects the user -** to know the exact path to the HDF image. Thus it does not -** parse the HDF file looking for image datasets and corresponding -** palettes. Also it takes in the default palette for the image -** specified, if the palette is missing, it makes a default greyscale -** palette and throws it in. -** -** Modifications: Pedro Vicente Nunes, pvn@ncsa.uiuc.edu -** Date: December 15, 2005 -** Changed the HDF5 read routines to use memory types and sizes, -** for both the image and pallete datasets -** -*/ -int ReadHDF(BYTE** data, BYTE palette[256][3], hsize_t *image_size, - CHAR *h5_file, CHAR *dset_name, CHAR *pal_name) -{ - hid_t fHfile; /* H5 file to open */ - hid_t dspace; /* dataspace identifier for the the dataset */ - hid_t dtype; /* datatype identifier for the the dataset */ - hid_t mtype_id; /* memory data type ID */ - size_t msize; /* memory size of memory type */ - hid_t dset; /* dataset identifier */ - hid_t pal_set; /* dataset for palette */ - hid_t pal_space; /* dataspace for palette */ - hid_t pal_dtype; /* datatype for palette */ - hsize_t datasize; /* size of the image */ - int pal_exist=0; /* do we have a palette? */ - - /* check stuff */ - if (!h5_file || !dset_name || !image_size) { - fprintf(stderr, "NULL is not an acceptable input for HDFread. Aborting.\n"); - return -1; - } - - /* do we have a palette ? */ - if (pal_name) { - pal_exist = 1; - } - - /* try opening the file */ - /* H5 file open calls */ - if ((fHfile = H5Fopen(h5_file , H5F_ACC_RDONLY , H5P_DEFAULT)) < 0) { - fprintf(stderr , "Unable to open HDF file for input. Aborting.\n"); - return -1; - } - - /* open the dataset for reading */ - if ((dset = H5Dopen(fHfile , dset_name)) < 0) { - fprintf(stderr , "Unable to open dataset\n"); - return -1; - } - - dtype = H5Dget_type(dset); - if (dtype < 0) { - fprintf(stderr , "Unable to open datatype\n"); - return -1; - } - if (H5Tget_class(dtype) != H5T_INTEGER) { - fprintf(stderr , "Data is not integer. Cannot convert to GIF\n"); - return -1; - } - if (H5Tget_size(dtype) != 1) { - fprintf(stderr , "Data is %d bytes per pixel. Cannot convert to GIF\n",(int)H5Tget_size(dtype)); - return -1; - } - - /* get the dataspace */ - if ((dspace = H5Dget_space(dset)) < 0) { - fprintf(stderr , "Unable to get dataspace\n"); - return -1; - } - - /* get the dimension size of the image */ - if (H5Sget_simple_extent_dims(dspace , image_size , NULL) <0 ) { - fprintf(stderr , "Unable to get dimension info\n"); - return -1; - } - - /* get memory type */ - if ((mtype_id=h5tools_get_native_type(dtype))<0){ - fprintf(stderr , "Unable to get memory type\n"); - return -1; - } - - /* get memory datatype size */ - if ((msize=H5Tget_size(mtype_id))==0){ - fprintf(stderr , "Unable to get memory size\n"); - return -1; - } - - /* size needed to store the image */ - datasize = image_size[0] * image_size[1]; - - /* allocate memory to store the image */ - if ((*data = (BYTE*) malloc((size_t)datasize*msize)) == NULL) { - fprintf(stderr , "Out of memory, exiting"); - return -1; - } - - /* get the actual image */ - if (H5Dread(dset , mtype_id, H5S_ALL , H5S_ALL , H5P_DEFAULT , *data) < 0) { - fprintf(stderr , "Unable to read data \n"); - cleanup(*data); - return -1; - } - - if (pal_exist) { - hsize_t loc_pal_size[2]; - hsize_t pal_datasize; - hid_t pal_mtype_id; - void *temp_buf; - - /* get the palette dataset */ - if ((pal_set = H5Dopen(fHfile , pal_name)) < 0) { - fprintf(stderr , "Unable to open dataset\n"); - pal_exist = 0; - return -1; - } - - pal_dtype = H5Dget_type(pal_set); - if (dtype < 0) { - fprintf(stderr , "Unable to open palette datatype\n"); - return -1; - } - if (H5Tget_class(pal_dtype) != H5T_INTEGER) { - fprintf(stderr , "Palette data is not integer. Cannot convert to GIF\n"); - return -1; - } - if (H5Tget_size(pal_dtype) != 1) { - fprintf(stderr , "Palette data is %d bytes per pixel. Cannot convert to GIF\n",(int)H5Tget_size(pal_dtype)); - return -1; - } - - /* get the dataspace */ - if ((pal_space = H5Dget_space(pal_set)) < 0) { - fprintf(stderr , "Unable to get dataspace\n"); - pal_exist = 0; - return -1; - } - - /* get the dimension size of the palette. */ - if (H5Sget_simple_extent_dims(pal_space , loc_pal_size , NULL) !=2 ) { - fprintf(stderr , "Unable to get dimension info\n"); - pal_exist = 0; - return -1; - } - - /* get memory type */ - if ((pal_mtype_id=h5tools_get_native_type(pal_dtype))<0){ - fprintf(stderr , "Unable to get memory type\n"); - return -1; - } - - /* get memory datatype size */ - if ((msize=H5Tget_size(pal_mtype_id))==0){ - fprintf(stderr , "Unable to get memory size\n"); - return -1; - } - - /* size needed to store the image */ - pal_datasize = loc_pal_size[0] * loc_pal_size[1]; - - /* copy stuff into a temp buffer and then copy 256*3 elements to palette */ - temp_buf=(void *) malloc((unsigned)(pal_datasize*msize)); - if ( temp_buf==NULL){ - printf( "cannot read into memory\n" ); - return -1; - } - /* - * make sure that the palette is actually 256 X 3 so that we don't - * create overflows - */ - if (pal_datasize > 256 * 3) { - fprintf(stderr , "Palette seems to be more than 256X3 bytes\n"); - fprintf(stderr , "Truncating palette to 256 colors. This might cause a problem with the final image\n"); - pal_datasize = 256 * 3; - } - - /* get the actual palette */ - if (H5Dread(pal_set , pal_mtype_id, H5S_ALL , H5S_ALL , H5P_DEFAULT , temp_buf) < 0) { - fprintf(stderr , "Unable to read data \n"); - cleanup(*data); - cleanup(temp_buf); - return -1; - } - - /* copy stuff into the actual palette */ - memcpy(palette , temp_buf , (size_t)pal_datasize); - - /* get rid of the temp memory */ - cleanup(temp_buf); - - /* close pal ids */ - H5Dclose(pal_set); - H5Sclose(pal_space); - H5Tclose(pal_dtype); - H5Tclose(pal_mtype_id); - /* end of if (pal_exist) */ - } else { - int i; - /* - * if palette does not exist we just go ahead and create a uniform - * greyscale palette - */ - for (i = 0 ; i < 256 ; i++) { - palette[i][0] = 255 - i; - palette[i][1] = 255 - i; - palette[i][2] = 255 - i; - } - } - - /* close everything */ - H5Dclose(dset); - H5Sclose(dspace); - H5Tclose(dtype); - H5Tclose(mtype_id); - H5Fclose(fHfile); - return 0; -} diff --git a/tools/gifconv/writehdf.c b/tools/gifconv/writehdf.c deleted file mode 100644 index 7313d2e..0000000 --- a/tools/gifconv/writehdf.c +++ /dev/null @@ -1,117 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include <string.h> -#include <stdlib.h> -#include <string.h> - -#include "gif.h" -#include "H5IM.h" - -/*------------------------------------------------------------------------- - * Function: WriteHDF - * - * Purpose: Write the GIF image with the HDF5 Image API - * - * Programmer: Unknown - * - * Modifications: pvn - * Use the HDF5 IMAGE API to write the HDF5 image and pallete - * - * Date: January, 31, 2006 - * - *------------------------------------------------------------------------- - */ - -int -WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName , char *GIFFileName) -{ - GIFHEAD gifHead; /* GIF Header structure */ - GIFIMAGEDESC *gifImageDesc; /* Logical Image Descriptor struct */ - - long ImageCount; /* number of images */ -#ifdef UNUSED - long CommentCount, /* number of comments */ - ApplicationCount, /* number of application extensions */ - PlainTextCount; /* number of plain text extensions */ -#endif /* UNUSED */ - - char ImageName[256]; /* Image name for the Image */ - - /* H5 variables */ - hid_t file_id; /* H5 file id */ - - /* temp counter */ - int i; - - /* get the GIFMem stuff */ - gifHead = *(GifMemoryStruct.GifHeader); - - /* get some data from gifHead */ - ImageCount = gifHead.ImageCount; -#ifdef UNUSED - CommentCount = (WORD)gifHead.CommentCount; - ApplicationCount = (WORD)gifHead.ApplicationCount; - PlainTextCount = (WORD)gifHead.PlainTextCount; -#endif /* UNUSED */ - - if ((file_id = H5Fcreate(HDFName , H5F_ACC_TRUNC , H5P_DEFAULT , H5P_DEFAULT)) < 0) { - /* error occured opening the HDF File for write */ - fprintf(stderr , "HDF file could not be opened for writing\n"); - fprintf(stderr , "NOTE: GIF file must be present in the same directory as the binary on UNIX systems.\n"); - exit(1); - } - - /* first create the global palette if there is one */ - if (gifHead.PackedField & 0x80) { /* global palette exists */ - hsize_t dims[2]; /* specify the dimensions of the palette */ - - /* size of the palette is tablesize (rows) X 3 (columns) */ - dims[0] = gifHead.TableSize; - dims[1] = 3; - - /* make a palette */ - if (H5IMmake_palette(file_id,"Global Palette",dims,(unsigned char *)gifHead.HDFPalette)<0) - return -1; - } - - for(i = 0; i < ImageCount; i++) { - hsize_t dims[2]; /* dimensions for the dataset */ - /* get the gifImageDesc */ - gifImageDesc = GifMemoryStruct.GifImageDesc[i]; - - /* set the dimensions */ - dims[0] = gifImageDesc->ImageHeight; - dims[1] = gifImageDesc->ImageWidth; - - /* create the image name */ - sprintf(ImageName , "Image%d" , i); - - /* write image */ - if (H5IMmake_image_8bit(file_id,ImageName,dims[1],dims[0],(gifImageDesc->Image))<0) - return -1; - - /* attach the palette to the image dataset */ - if (H5IMlink_palette(file_id,ImageName,"Global Palette")<0) - return -1; - } - - /* close the H5 file */ - if (H5Fclose(file_id) < 0) { - fprintf(stderr , "Could not close HDF5 file. Aborting...\n"); - return -1; - } - - return 0; -} - |