MISR Toolkit  1.5.1
cnbit.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * Copyright by The HDF Group. *
3  * Copyright by the Board of Trustees of the University of Illinois. *
4  * All rights reserved. *
5  * *
6  * This file is part of HDF. The full HDF copyright notice, including *
7  * terms governing use, modification, and redistribution, is contained in *
8  * the files COPYING and Copyright.html. COPYING can be found at the root *
9  * of the source code distribution tree; Copyright.html can be found at *
10  * http://hdfgroup.org/products/hdf4/doc/Copyright.html. If you do not have *
11  * access to either file, you may request a copy from help@hdfgroup.org. *
12  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
13 
14  /* $Id: cnbit.h 4932 2007-09-07 17:17:23Z bmribler $ */
15 
16  /*-----------------------------------------------------------------------------
17  * File: cnbit.h
18  * Purpose: Header file for N-bit encoding information.
19  * Dependencies: should only be included from hcompi.h
20  * Invokes: none
21  * Contents: Structures & definitions for N-bit encoding.
22  * Structure definitions:
23  * Constant definitions:
24  *---------------------------------------------------------------------------*/
25 
26 /* avoid re-inclusion */
27 #ifndef __CNBIT_H
28 #define __CNBIT_H
29 
30 #if defined c_plusplus || defined __cplusplus
31 extern "C"
32 {
33 #endif /* c_plusplus || __cplusplus */
34 
35 /*
36  ** from cnbit.c
37  */
38 
39  extern int32 HCPcnbit_stread
40  (accrec_t * rec);
41 
42  extern int32 HCPcnbit_stwrite
43  (accrec_t * rec);
44 
45  extern int32 HCPcnbit_seek
46  (accrec_t * access_rec, int32 offset, int origin);
47 
48  extern int32 HCPcnbit_inquire
49  (accrec_t * access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref,
50  int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess,
51  int16 *pspecial);
52 
53  extern int32 HCPcnbit_read
54  (accrec_t * access_rec, int32 length, void * data);
55 
56  extern int32 HCPcnbit_write
57  (accrec_t * access_rec, int32 length, const void * data);
58 
59  extern intn HCPcnbit_endaccess
60  (accrec_t * access_rec);
61 
62 #if defined c_plusplus || defined __cplusplus
63 }
64 #endif /* c_plusplus || __cplusplus */
65 
66 /* size of the N-bit buffer */
67 #define NBIT_BUF_SIZE (MAX_NT_SIZE*64)
68 /* size of the N-bit mask buffer (same as buffer size for now) */
69 #define NBIT_MASK_SIZE (MAX_NT_SIZE)
70 
71 typedef struct
72 { /* structure to hold bit vector info */
73  intn offset, /* offset of the bit information */
74  length; /* number of bits in the information */
75  uint8 mask; /* mask for this bit vector */
76 }
78 
79 /* N-bit [en|de]coding information */
80 typedef struct
81  {
82  int32 nt; /* number type of data we are encoding */
83  intn nt_size; /* size of the number-type in the file */
84  intn fill_one; /* whether to fill with 1's or not (0's) */
85  intn sign_ext; /* whether to sign extend or not */
86  uint8 buffer[NBIT_BUF_SIZE]; /* buffer for expanding n-bit data in */
87  intn buf_pos; /* current offset in the expansion buffer */
88  intn mask_off, /* offset of the bit to start masking with */
89  mask_len; /* number of bits to mask */
90  int32 offset; /* offset in the file in terms of bytes */
91  uint8 mask_buf[NBIT_MASK_SIZE]; /* buffer to hold the bitmask */
92  nbit_mask_info_t mask_info[NBIT_MASK_SIZE]; /* information about the mask */
93  intn nt_pos; /* current byte to read or write */
94  }
96 
97 #ifndef CNBIT_MASTER
98 extern funclist_t cnbit_funcs; /* functions to perform N-bit encoding */
99 #else
100 funclist_t cnbit_funcs =
101 { /* functions to perform N-bit encoding */
109 };
110 #endif
111 
112 #endif /* __CNBIT_H */
int32 HCPcnbit_inquire(accrec_t *access_rec, int32 *pfile_id, uint16 *ptag, uint16 *pref, int32 *plength, int32 *poffset, int32 *pposn, int16 *paccess, int16 *pspecial)
uint8 mask
Definition: cnbit.h:75
intn offset
Definition: cnbit.h:73
int32 HCPcnbit_read(accrec_t *access_rec, int32 length, void *data)
int32 HCPcnbit_stwrite(accrec_t *rec)
intn HCPcnbit_endaccess(accrec_t *access_rec)
int32 HCPcnbit_seek(accrec_t *access_rec, int32 offset, int origin)
void origin(double A)
HDFFCLIBAPI intf intf intf intf void * buffer
#define NBIT_BUF_SIZE
Definition: cnbit.h:67
funclist_t cnbit_funcs
int32 HCPcnbit_stread(accrec_t *rec)
HDFFCLIBAPI void * data
#define NBIT_MASK_SIZE
Definition: cnbit.h:69
HDFFCLIBAPI intf * offset
int32 HCPcnbit_write(accrec_t *access_rec, int32 length, const void *data)

MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:52