<commit_before>/* This is part of the netCDF package.  Copyright 2005 University
   Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
   conditions of use.

   This program excersizes HDF5 variable length array code.

   $Id: tst_h_vl2.c,v 1.5 2010/06/01 15:34:52 ed Exp $
*/
#include <nc_tests.h>
#include <hdf5.h>
#include <nc_logging.h>

#define FILE_NAME "tst_vl.nc"
int
main()
{
   printf("\n*** Checking HDF5 VLEN types even more.\n");
#ifdef EXTRA_TESTS
   printf("*** Reading reference file...");
   {
      hid_t fileid, grpid, fapl_id, hdf_typeid = 0, base_hdf_typeid = 0, attid = 0;
      hid_t file_typeid, spaceid, native_typeid;
      H5O_info_t obj_info;
      char obj_name[NC_MAX_NAME + 1];
      hsize_t num_obj, i;
      int obj_class;
      H5T_class_t class;
      size_t size, type_size;
      hssize_t att_npoints;
      int att_ndims;
      hsize_t dims[1]; 
      void *vldata;

      /* Open the file and read the vlen data. */
      if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
      if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI)) ERR;
      if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR;

      if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, fapl_id)) < 0) ERR;
      if ((grpid = H5Gopen(fileid, "/")) < 0) ERR;

      if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR;
      for (i = 0; i < num_obj; i++)
      {
	 if (H5Oget_info_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, 
				i, &obj_info, H5P_DEFAULT) < 0) ERR;
	 obj_class = obj_info.type;
	 if ((size = H5Lget_name_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i,
					NULL, 0, H5P_DEFAULT)) < 0) ERR;
	 if (size > NC_MAX_NAME) ERR;
	 if (H5Lget_name_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i,
				obj_name, size+1, H5P_DEFAULT) < 0) ERR;
	 /*printf("nc4_rec_read_metadata: encountered HDF5 object obj_class %d obj_name %s.\n", 
	   obj_class, obj_name);*/
	 /* Deal with groups and datasets. */
	 switch (obj_class)
	 {
	    case H5O_TYPE_GROUP:
	       printf("group\n");
	       break;
	    case H5O_TYPE_DATASET:
	       printf("dataset\n");
	       break;
	    case H5O_TYPE_NAMED_DATATYPE:
	       printf("type\n");
	       if ((hdf_typeid = H5Topen2(grpid, obj_name, H5P_DEFAULT)) < 0) ERR;
	       if ((class = H5Tget_class(hdf_typeid)) < 0) ERR;
	       switch (class)
	       {
		  case H5T_VLEN:
		     /* Find the base type of this vlen (i.e. what is this a * vlen of?) and its size. */
		     if (!(base_hdf_typeid = H5Tget_super(hdf_typeid))) ERR;
		     if (!(type_size = H5Tget_size(base_hdf_typeid))) ERR;
		     break;
		  default:
		     LOG((0, "unknown datatype class"));
		     return NC_EBADCLASS;
	       }

	       break;
	    case H5G_LINK:
	       break;
	    default:
	       LOG((0, "Unknown object class %d in nc4_rec_read_metadata!",
		    obj_class));
	 } <commit_msg>turned off more bad error output from tst_h_vl2.c.<commit_after>/* This is part of the netCDF package.  Copyright 2005 University
   Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
   conditions of use.

   This program excersizes HDF5 variable length array code.

   $Id: tst_h_vl2.c,v 1.5 2010/06/01 15:34:52 ed Exp $
*/
#include <nc_tests.h>
#include <hdf5.h>
#include <nc_logging.h>

#define FILE_NAME "tst_vl.nc"
int
main()
{
   printf("\n*** Checking HDF5 VLEN types even more.\n");
#ifdef EXTRA_TESTS
   printf("*** Reading reference file...");
   {
      hid_t fileid, grpid, fapl_id, hdf_typeid = 0, base_hdf_typeid = 0, attid = 0;
      hid_t file_typeid, spaceid, native_typeid;
      H5O_info_t obj_info;
      char obj_name[NC_MAX_NAME + 1];
      hsize_t num_obj, i;
      int obj_class;
      H5T_class_t class;
      size_t size, type_size;
      hssize_t att_npoints;
      int att_ndims;
      hsize_t dims[1]; 
      void *vldata;

      /* Open the file and read the vlen data. */
      if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR;
      if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI)) ERR;
      if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR;

      if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, fapl_id)) < 0) ERR;
      if ((grpid = H5Gopen(fileid, "/")) < 0) ERR;

      if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR;
      for (i = 0; i < num_obj; i++)
      {
	 if (H5Oget_info_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, 
				i, &obj_info, H5P_DEFAULT) < 0) ERR_RET;
	 obj_class = obj_info.type;
	 if ((size = H5Lget_name_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i,
					NULL, 0, H5P_DEFAULT)) < 0) ERR_RET;
	 if (size > NC_MAX_NAME) ERR_RET;
	 if (H5Lget_name_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i,
				obj_name, size+1, H5P_DEFAULT) < 0) ERR_RET;
	 /*printf("nc4_rec_read_metadata: encountered HDF5 object obj_class %d obj_name %s.\n", 
	   obj_class, obj_name);*/
	 /* Deal with groups and datasets. */
	 switch (obj_class)
	 {
	    case H5O_TYPE_GROUP:
	       printf("group\n");
	       break;
	    case H5O_TYPE_DATASET:
	       printf("dataset\n");
	       break;
	    case H5O_TYPE_NAMED_DATATYPE:
	       printf("type\n");
	       if ((hdf_typeid = H5Topen2(grpid, obj_name, H5P_DEFAULT)) < 0) ERR_RET;
	       if ((class = H5Tget_class(hdf_typeid)) < 0) ERR_RET;
	       switch (class)
	       {
		  case H5T_VLEN:
		     /* Find the base type of this vlen (i.e. what is this a * vlen of?) and its size. */
		     if (!(base_hdf_typeid = H5Tget_super(hdf_typeid))) ERR_RET;
		     if (!(type_size = H5Tget_size(base_hdf_typeid))) ERR_RET;
		     break;
		  default:
		     LOG((0, "unknown datatype class"));
		     return NC_EBADCLASS;
	       }

	       break;
	    case H5G_LINK:
	       break;
	    default:
	       LOG((0, "Unknown object class %d in nc4_rec_read_metadata!",
		    obj_class));
	 } 
{'fraction_non_alphanumeric': 0.12059783542346676, 'fraction_numerical': 0.028689228654870298, 'mean_word_length': 2.9126344086021505, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1313558', 'n_tokens_mistral': 2532, 'n_tokens_neox': 2324, 'n_words': 547}