Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some hbitio.h things private #582

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions hdf/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ set (HDF4_PRIVATE_HDF_SRC_CHDRS
${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/dynarray_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/glist_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hbitio_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hchunks_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hcomp_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hconv_priv.h
Expand Down
6 changes: 6 additions & 0 deletions hdf/src/hbitio.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ LOCAL ROUTINES
*/

#include "hdf_priv.h"
#include "hbitio_priv.h"
#include "hfile_priv.h"

/* Define the number of elements in the buffered array */
#define BITBUF_SIZE 4096
/* Macro to define the number of bits able to be read/written at a time */
#define DATANUM (sizeof(uint32) * 8)

/* Local Variables */

const uint8 maskc[9] = {0, 1, 3, 7, 15, 31, 63, 127, 255};
Expand Down
35 changes: 0 additions & 35 deletions hdf/src/hbitio.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,10 @@

#include "hdf.h"

/* Define the number of elements in the buffered array */
#define BITBUF_SIZE 4096
/* Macro to define the number of bits cached in the 'bits' variable */
#define BITNUM (sizeof(uint8) * 8)
/* Macro to define the number of bits able to be read/written at a time */
#define DATANUM (sizeof(uint32) * 8)

typedef struct bitrec_t {
int32 acc_id; /* Access ID for H layer I/O routines */
int32 bit_id; /* Bitfile ID for internal use */
/* Note that since HDF has signed 32bit offset limit we need to change this to signed
since the get passed to Hxxx calls which take signed 32bit arguments */
int32 block_offset; /* offset of the current buffered block in the dataset */
int32 max_offset; /* offset of the last byte written to the dataset */
int32 byte_offset; /* offset of the current byte in the dataset */

intn count; /* bit count to next boundary */
intn buf_read; /* number of bytes read into buffer (necessary for random I/O) */
uint8 access; /* What the access on this file is ('r', 'w', etc..) */
uint8 mode; /* how are we interacting with the data now ('r', 'w', etc) */
uint8 bits; /* extra bit buffer, 0..BITNUM-1 bits */
uint8 *bytep; /* current position in buffer */
uint8 *bytez; /* end of buffer to compare */
uint8 *bytea; /* byte buffer */
} bitrec_t;

/* Function-like Macros */
#define Hputbit(bitid, bit) ((Hbitwrite(bitid, 1, (uint32)bit) == FAIL) ? FAIL : SUCCEED)

#ifdef __cplusplus
extern "C" {
#endif

HDFLIBAPI const uint8 maskc[9];

HDFLIBAPI const uint32 maskl[33];

#ifdef __cplusplus
}
#endif

#endif /* H4_HBITIO_H */
57 changes: 57 additions & 0 deletions hdf/src/hbitio_priv.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF. The full HDF copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
** hbitio_priv.h
**
** Data structures and macros for bitfile access to HDF data objects.
** These are mainly used for compression I/O and N-bit data objects.
*/

#ifndef H4_HBITIO_PRIV_H
#define H4_HBITIO_PRIV_H

#include "hdf.h"

typedef struct bitrec_t {
int32 acc_id; /* Access ID for H layer I/O routines */
int32 bit_id; /* Bitfile ID for internal use */
/* Note that since HDF has signed 32bit offset limit we need to change this to signed
since the get passed to Hxxx calls which take signed 32bit arguments */
int32 block_offset; /* offset of the current buffered block in the dataset */
int32 max_offset; /* offset of the last byte written to the dataset */
int32 byte_offset; /* offset of the current byte in the dataset */

intn count; /* bit count to next boundary */
intn buf_read; /* number of bytes read into buffer (necessary for random I/O) */
uint8 access; /* What the access on this file is ('r', 'w', etc..) */
uint8 mode; /* how are we interacting with the data now ('r', 'w', etc) */
uint8 bits; /* extra bit buffer, 0..BITNUM-1 bits */
uint8 *bytep; /* current position in buffer */
uint8 *bytez; /* end of buffer to compare */
uint8 *bytea; /* byte buffer */
} bitrec_t;

#ifdef __cplusplus
extern "C" {
#endif

HDFLIBAPI const uint8 maskc[9];

HDFLIBAPI const uint32 maskl[33];

#ifdef __cplusplus
}
#endif

#endif /* H4_HBITIO_PRIV_H */
5 changes: 2 additions & 3 deletions hdf/src/hdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,8 @@ typedef intn (*hdf_termfunc_t)(void); /* termination function typedef */
#include "hcomp.h"
#include "herr.h"
#include "hproto.h"
#include "hdatainfo.h" /* data info header */
#include "vg.h" /* Vgroup/Vdata header */
#include "mfgr.h" /* GR header */
#include "vg.h" /* Vgroup/Vdata header */
#include "mfgr.h" /* GR header */

/* these may eventually evolve into real-life functions but not yet */
#define HDFopen(f, a, d) Hopen((f), (a), (d))
Expand Down
16 changes: 16 additions & 0 deletions release_notes/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,22 @@ New features and changes
mstdio.h
tbbt.h

- Most of hbitio.h moved to hbitio_priv.h

Still in hbitio.h:

* BITNUM #define
* Hputbit() function-like macro

These are referenced in older versions of the reference manual, e.g., in
the Hendbitaccess() entry.

Moved to hbitio_priv.h:

* BITBUF_SIZE, DATANUM #defines
* bitrec_t struct
* maskc and maskl variable declarations

- hdfi.h is no longer included by hdf.h

In the past, hdfi.h (an internal header file) was included in the
Expand Down
Loading