summaryrefslogtreecommitdiffstats
path: root/hl/tools/gif2h5/gif.h
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2001-07-24 17:51:22 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2001-07-24 17:51:22 (GMT)
commite685336ab13081f8e4a92b7a4a9b6bf022ae5b23 (patch)
treec6858498dd0d2357f6736df7f2095b5453394bf1 /hl/tools/gif2h5/gif.h
parent953a75e4f164e881a145ca669f1ec34dd1357d05 (diff)
downloadhdf5-e685336ab13081f8e4a92b7a4a9b6bf022ae5b23.zip
hdf5-e685336ab13081f8e4a92b7a4a9b6bf022ae5b23.tar.gz
hdf5-e685336ab13081f8e4a92b7a4a9b6bf022ae5b23.tar.bz2
[svn-r4254]
Purpose: Reformatting Description: Reformatted the code so that it's much clearer and conforms to the HDF5 coding standards. Changed the function headers to use the ANSI style instead of the KnR style. Kept the use of typedef's such as "unsigned char" being "BYTE" and so on since of of this code is copied from some other place and that's the style they use...I didn't want to break things. Platforms tested: It compiles fine on Linux, but there aren't any tests for this package, so...
Diffstat (limited to 'hl/tools/gif2h5/gif.h')
-rw-r--r--hl/tools/gif2h5/gif.h138
1 files changed, 64 insertions, 74 deletions
diff --git a/hl/tools/gif2h5/gif.h b/hl/tools/gif2h5/gif.h
index 3f2a8da..21ce502 100644
--- a/hl/tools/gif2h5/gif.h
+++ b/hl/tools/gif2h5/gif.h
@@ -1,22 +1,21 @@
-/****************************************************************************\
-** Title: GIF.H **
-** Purpose: GIF Header file **
-\****************************************************************************/
-
-#ifndef GIF_H
-#define GIF_H 1
-
-#include <hdf5.h>
+/*
+ * Copyright (C) 2001 National Center for Supercomputing Applications
+ * All rights reserved.
+ *
+ * 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
-/*#include "datatype.h" Data type definitions */
-
/* set the name length restriction to 64 charachters */
#define VSNAMELENMAX 64 /* this is a carryover from HDF4 */
@@ -26,11 +25,11 @@ typedef unsigned char BYTE;
/* typedef H5T_NATIVE_UINT16 WORD; */
typedef unsigned long WORD;
-typedef char CHAR;
-typedef unsigned char boolean;
+typedef char CHAR;
+typedef unsigned char boolean;
-#define false 0;
-#define true 1;
+#define false 0
+#define true 1
/* Set the EndianOrder.
** The GIF Reader file should do this.
@@ -45,77 +44,69 @@ extern int EndianOrder;
** 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 */
+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;
+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 */
+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;
+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;
+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) */
+typedef struct _GifCommentExtension {
+ BYTE CEDump[2]; /* Comment Extension Dump */
+ BYTE *CommentData; /* Comment data sub-blocks */
+ WORD DataSize;
+ BYTE Terminator; /* Block Terminator (always 0) */
} GIFCOMMENT;
/*
@@ -129,8 +120,7 @@ typedef struct _GifCommentExtension
** must assume a 1-1 correspondance. The same discussion with plain text
** extension.
*/
-typedef struct _GifToMem
-{
+typedef struct _GifToMem {
GIFHEAD *GifHeader;
GIFIMAGEDESC **GifImageDesc;
GIFGRAPHICCONTROL **GifGraphicControlExtension;
@@ -139,10 +129,10 @@ typedef struct _GifToMem
GIFCOMMENT **GifCommentExtension;
} GIFTOMEM;
-
/*
** Function Prototypes
*/
+
/* GIF2MEM.C */
GIFTOMEM Gif2Mem(BYTE *);
@@ -157,22 +147,22 @@ int ReadGifComment(GIFCOMMENT *, BYTE **);
/* 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
-**
+/* 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);
+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 *Decompress(GIFIMAGEDESC *, GIFHEAD *);
BYTE GetByte(BYTE *);
WORD GetWord(BYTE *);
void cleanup(BYTE*);
-#endif /* GIF_H */
+#endif /* GIF_H_ */