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

Rename private headers <foo>_priv.h #573

Merged
merged 4 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ set (HDF4_SRC_INCLUDE_DIRS ${HDF4_HDFSOURCE_DIR} ${HDF4_MFHDFSOURCE_DIR})
set (CMAKE_MODULE_PATH ${HDF_RESOURCES_DIR} ${CMAKE_MODULE_PATH})

#-----------------------------------------------------------------------------
# parse the full version number from hfile.h and include in H4_VERS_INFO
# parse the full version number from hfile_priv.h and include in H4_VERS_INFO
#-----------------------------------------------------------------------------
file (READ ${HDF4_HDFSOURCE_DIR}/hfile.h _hfile_h_contents)
file (READ ${HDF4_HDFSOURCE_DIR}/hfile_priv.h _hfile_h_contents)
string (REGEX REPLACE ".*#define[ \t]+LIBVER_MAJOR[ \t]+([0-9]*).*$"
"\\1" H4_VERS_MAJOR ${_hfile_h_contents})
string (REGEX REPLACE ".*#define[ \t]+LIBVER_MINOR[ \t]+([0-9]*).*$"
Expand Down
11 changes: 5 additions & 6 deletions bin/h4_release_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ fi
# TESTING IF FILES EXISTS
#########################

include_file=(atom.h bitvect.h cdeflate.h cnbit.h cnone.h crle.h cskphuff.h cszip.h dfan.h
dffunc.f90 dffunc.inc dfgr.h df.h dfrig.h dfsd.h dfufp2i.h dynarray.h H4api_adpt.h
h4config.h hbitio.h hchunks.h hcomp.h hcompi.h hconv.h hdatainfo.h hdf2netcdf.h hdf.f90
hdf.h hdfi.h hdf.inc herr.h hfile.h hkit.h hlimits.h hntdefs.h hproto_fortran.h hproto.h
htags.h linklist.h local_nc.h mfan.h mfani.h mfdatainfo.h mffunc.f90 mffunc.inc mfgr.h
mfgri.h mfhdf.h mfhdfi.h mstdio.h netcdf.f90 netcdf.h netcdf.inc tbbt.h vg.h)
include_file=(
dffunc.f90 dffunc.inc H4api_adpt.h h4config.h hbitio.h hcomp.h hdatainfo.h
hdf2netcdf.h hdf.f90 hdf.h hdf.inc herr.h hlimits.h hntdefs.h hproto_fortran.h hproto.h
htags.h mfan.h mfdatainfo.h mffunc.f90 mffunc.inc mfgr.h mfhdf.h netcdf.f90 netcdf.h
netcdf.inc vg.h)

lib_file=(libdf.a libdf.la libhdf4.settings libjpeg.a libmfhdf.a libmfhdf.la libsz.a libz.a)

Expand Down
16 changes: 8 additions & 8 deletions bin/h4vers
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use strict;

### Purpose
# Increments the hdf4 version number by changing the value of
# constants in the hdf/src/hfile.h file. The new version number is
# constants in the hdf/src/hfile_priv.h file. The new version number is
# printed on the standard output. An alternate source file name can be
# specified as an argument. In any case, the original file is saved
# by appending a tilde `~' to the name.
Expand Down Expand Up @@ -61,11 +61,11 @@ use strict;
# and the annotation string is cleared.
#
# If a file is specified then that file is used instead of
# ./hfile.h or ./hdf/src/hfile.h.
# ./hfile_priv.h or ./hdf/src/hfile_priv.h.
#
# If the version number is changed (either `-s' or `-i' was used on
# the command line) then the first line of the README.md and
# release_notes/RELEASE.txt two levels above the hfile.h file are also
# release_notes/RELEASE.txt two levels above the hfile_priv.h file are also
# modified so it looks something like: This is hdf4-1.2.3-pre1 currently
# under development. The AC_INIT macro in configure.in will also change
# in this case to be something like: AC_INIT([HDF4], [hdf4-1.2.3-pre1],
Expand Down Expand Up @@ -128,15 +128,15 @@ Usage: $prog [OPTS] [FILE]
as \"version 1.1 release 0 (pre1)\" will be printed.
FILE
The name of the file that contains version information. This is
seldom necessary since files hfile.h, hdf/src/hfile.h,
src/hfile.h, and ../hdf/src/hfile.h are automatically checked.
seldom necessary since files hfile_priv.h, hdf/src/hfile_priv.h,
src/hfile_priv.h, and ../hdf/src/hfile_priv.h are automatically checked.
EOF
exit 1;
}

# Parse arguments
my ($verbose, $set, $inc, $file, $rc);
my (@files) = ("hdf/src/hfile.h", "../hdf/src/hfile.h", "src/hfile.h", "hfile.h");
my (@files) = ("hdf/src/hfile_priv.h", "../hdf/src/hfile_priv.h", "src/hfile_priv.h", "hfile_priv.h");
while ($_ = shift) {
$_ eq "-s" && do {
die "-s switch needs a version number\n" unless @ARGV;
Expand Down Expand Up @@ -168,12 +168,12 @@ die "mutually exclusive options given\n" if $set && $inc;
#print "file is $file.\n";
#print "File array is ", @files;

# Determine file to use as hfile.h, README.md,
# Determine file to use as hfile_priv.h, README.md,
# release_notes/RELEASE.txt, configure.in,
# and config/cmake/scripts/HDF4config.cmake.
# The paths to README.md, release_notes/RELEASE.txt, configure.ac,
# and config/cmake/scripts/HDF4config.cmake
# files are always from the directory two levels above hfile.h.
# files are always from the directory two levels above hfile_priv.h.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my next PR, I plan to put the version macros in hdf.h

unless ($file) {
for (@files) {
($file=$_,last) if -f $_;
Expand Down
63 changes: 32 additions & 31 deletions hdf/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,43 +77,44 @@ set (HDF4_HDF_SRC_CHDRS
${HDF4_HDF_SRC_SOURCE_DIR}/hntdefs.h
${HDF4_HDF_SRC_SOURCE_DIR}/hproto.h
${HDF4_HDF_SRC_SOURCE_DIR}/htags.h
${HDF4_HDF_SRC_SOURCE_DIR}/mfan.h
${HDF4_HDF_SRC_SOURCE_DIR}/mfgr.h
${HDF4_HDF_SRC_SOURCE_DIR}/vg.h
)

# Internal headers end in _priv.h
set (HDF4_PRIVATE_HDF_SRC_CHDRS
${HDF4_HDF_SRC_SOURCE_DIR}/atom.h
${HDF4_HDF_SRC_SOURCE_DIR}/bitvect.h
${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate.h
${HDF4_HDF_SRC_SOURCE_DIR}/cnbit.h
${HDF4_HDF_SRC_SOURCE_DIR}/cnone.h
${HDF4_HDF_SRC_SOURCE_DIR}/crle.h
${HDF4_HDF_SRC_SOURCE_DIR}/cskphuff.h
${HDF4_HDF_SRC_SOURCE_DIR}/cszip.h
${HDF4_HDF_SRC_SOURCE_DIR}/df.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfan.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfgr.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfrig.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfsd.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfufp2i.h
${HDF4_HDF_SRC_SOURCE_DIR}/dynarray.h
${HDF4_HDF_SRC_SOURCE_DIR}/glist.h
${HDF4_HDF_SRC_SOURCE_DIR}/hchunks.h
${HDF4_HDF_SRC_SOURCE_DIR}/hcompi.h
${HDF4_HDF_SRC_SOURCE_DIR}/hconv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hdfi.h
${HDF4_HDF_SRC_SOURCE_DIR}/atom_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/bitvect_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/cdeflate_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/cnbit_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/cnone_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/crle_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/cskphuff_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/cszip_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/df_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfan_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfgr_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfrig_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/dfsd_priv.h
${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}/hchunks_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hcomp_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hconv_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hdf_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/herr_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hfile.h
${HDF4_HDF_SRC_SOURCE_DIR}/hkit.h
${HDF4_HDF_SRC_SOURCE_DIR}/hqueue.h
${HDF4_HDF_SRC_SOURCE_DIR}/linklist.h
${HDF4_HDF_SRC_SOURCE_DIR}/mcache.h
${HDF4_HDF_SRC_SOURCE_DIR}/mfan.h
${HDF4_HDF_SRC_SOURCE_DIR}/mfani.h
${HDF4_HDF_SRC_SOURCE_DIR}/mfgri.h
${HDF4_HDF_SRC_SOURCE_DIR}/mstdio.h
${HDF4_HDF_SRC_SOURCE_DIR}/tbbt.h
${HDF4_HDF_SRC_SOURCE_DIR}/vgint.h
${HDF4_HDF_SRC_SOURCE_DIR}/hfile_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hkit_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/hqueue_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/linklist_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/mcache_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/mfan_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/mfgr_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/mstdio_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/tbbt_priv.h
${HDF4_HDF_SRC_SOURCE_DIR}/vg_priv.h
)

if (BUILD_STATIC_LIBS)
Expand Down
2 changes: 1 addition & 1 deletion hdf/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CSOURCES = atom.c bitvect.c cdeflate.c cnbit.c cnone.c crle.c cskphuff.c \
vgp.c vhi.c vio.c vparse.c vrw.c vsfld.c

CHEADERS = H4api_adpt.h h4config.h hbitio.h hcomp.h hdatainfo.h hdf.h \
herr.h hlimits.h hntdefs.h hproto.h htags.h mfgr.h vg.h
herr.h hlimits.h hntdefs.h hproto.h htags.h mfan.h mfgr.h vg.h

FHEADERS = dffunc.f90 hdf.f90 dffunc.inc hdf.inc

Expand Down
6 changes: 3 additions & 3 deletions hdf/src/atom.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DESIGN
The groups are stored in an array of pointers to store each group in an
element. Each "atomic group" node contains a link to a hash table to
manage the atoms in each group. The allowed "atomic groups" are stored
in an enum (called group_t) in atom.h.
in an enum (called group_t) in atom_priv.h.

BUGS/LIMITATIONS
Can't iterate over the atoms in a group.
Expand All @@ -46,8 +46,8 @@ EXPORTED ROUTINES
HAshutdown - Terminate various static buffers.
*/

#include "hdfi.h"
#include "atom.h"
#include "hdf_priv.h"
#include "atom_priv.h"

/* # of bits to use for Group ID in each atom (change if MAXGROUP>16) */
#define GROUP_BITS 4
Expand Down
15 changes: 5 additions & 10 deletions hdf/src/atom.h → hdf/src/atom_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,14 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*-----------------------------------------------------------------------------
* File: atom.h
* File: atom_priv.h
* Purpose: header file for atom API
* Dependencies:
* Invokes:
* Contents:
* Structure definitions:
* Constant definitions:
*---------------------------------------------------------------------------*/

#ifndef H4_ATOM_H
#define H4_ATOM_H
#ifndef H4_ATOM_PRIV_H
#define H4_ATOM_PRIV_H

#include "hdfi.h"
#include "hdf_priv.h"

/* Do swap using XOR operator. Ugly but fast... -QAK */
#define HAIswap_cache(i, j) \
Expand Down Expand Up @@ -208,4 +203,4 @@ HDFLIBAPI intn HAshutdown(void);
}
#endif

#endif /* H4_ATOM_H */
#endif /* H4_ATOM_PRIV_H */
4 changes: 2 additions & 2 deletions hdf/src/bitvect.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ DESIGN
for finding 1 bits as that is not a use case in the HDF4 library.
*/

#include "hdfi.h"
#include "bitvect.h"
#include "hdf_priv.h"
#include "bitvect_priv.h"

/* Base type of the array used to store the bits */
typedef uint8 bv_base;
Expand Down
10 changes: 5 additions & 5 deletions hdf/src/bitvect.h → hdf/src/bitvect_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*-----------------------------------------------------------------------------
* File: bitvect.h
* File: bitvect_priv.h
* Purpose: header file for bit-vector API
*---------------------------------------------------------------------------*/

#ifndef H4_BITVECT_H
#define H4_BITVECT_H
#ifndef H4_BITVECT_PRIV_H
#define H4_BITVECT_PRIV_H

#include "hdfi.h"
#include "hdf_priv.h"

/* Boolean values used */
typedef enum { BV_FALSE = 0, BV_TRUE = 1 } bv_bool;
Expand Down Expand Up @@ -55,4 +55,4 @@ HDFLIBAPI int32 bv_find_next_zero(bv_ptr b);
}
#endif

#endif /* H4_BITVECT_H */
#endif /* H4_BITVECT_PRIV_H */
16 changes: 3 additions & 13 deletions hdf/src/cdeflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
FILE
cdeflate.c
HDF gzip 'deflate' encoding I/O routines
cdeflate.c - HDF gzip 'deflate' encoding I/O routines

REMARKS

DESIGN

EXPORTED ROUTINES
None of these routines are designed to be called by other users except
for the modeling layer of the compression routines.

AUTHOR
Quincey Koziol
*/

/* General HDF includes */
#include "hdfi.h"
#include "hdf_priv.h"

/* HDF compression includes */
#include "hcompi.h" /* Internal definitions for compression */
#include "hcomp_priv.h" /* Internal definitions for compression */

/* Define the [default] size of the buffer to interact with the file */
#define DEFLATE_BUF_SIZE 4096
Expand Down
12 changes: 6 additions & 6 deletions hdf/src/cdeflate.h → hdf/src/cdeflate_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*-----------------------------------------------------------------------------
* File: cdeflate.h
* File: cdeflate_priv.h
* Purpose: Header file for gzip 'deflate' encoding information.
* Dependencies: should only be included from hcompi.h
* Dependencies: should only be included from hcomp_priv.h
*---------------------------------------------------------------------------*/

#ifndef H4_CDEFLATE_H
#define H4_CDEFLATE_H
#ifndef H4_CDEFLATE_PRIV_H
#define H4_CDEFLATE_PRIV_H

#include "hdfi.h"
#include "hdf_priv.h"

/* Get the gzip 'deflate' header */
#define intf zintf
Expand Down Expand Up @@ -67,4 +67,4 @@ HDFLIBAPI intn HCPcdeflate_endaccess(accrec_t *access_rec);
}
#endif

#endif /* H4_CDEFLATE_H */
#endif /* H4_CDEFLATE_PRIV_H */
13 changes: 3 additions & 10 deletions hdf/src/cnbit.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,17 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
FILE
cnbit.c
HDF N-bit encoding I/O routines
cnbit.c - HDF N-bit encoding I/O routines

REMARKS

DESIGN

EXPORTED ROUTINES
None of these routines are designed to be called by other users except
for the modeling layer of the compression routines.
*/

/* General HDF includes */
#include "hdfi.h"
#include "hdf_priv.h"

/* HDF compression includes */
#include "hcompi.h" /* Internal definitions for compression */
#include "hcomp_priv.h" /* Internal definitions for compression */

/* functions to perform N-bit encoding */
funclist_t cnbit_funcs = {HCPcnbit_stread,
Expand Down
12 changes: 6 additions & 6 deletions hdf/src/cnbit.h → hdf/src/cnbit_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*-----------------------------------------------------------------------------
* File: cnbit.h
* File: cnbit_priv.h
* Purpose: Header file for N-bit encoding information.
* Dependencies: should only be included from hcompi.h
* Dependencies: should only be included from hcomp_priv.h
*---------------------------------------------------------------------------*/

#ifndef H4_CNBIT_H
#define H4_CNBIT_H
#ifndef H4_CNBIT_PRIV_H
#define H4_CNBIT_PRIV_H

#include "hdfi.h"
#include "hdf_priv.h"

/* size of the N-bit buffer */
#define NBIT_BUF_SIZE (MAX_NT_SIZE * 64)
Expand Down Expand Up @@ -80,4 +80,4 @@ HDFLIBAPI intn HCPcnbit_endaccess(accrec_t *access_rec);
}
#endif

#endif /* H4_CNBIT_H */
#endif /* H4_CNBIT_PRIV_H */
Loading
Loading