H5_attribs.c 20 KB
Newer Older
1
/*
gsell's avatar
gsell committed
2
  Copyright (c) 2006-2015, The Regents of the University of California,
3 4 5 6 7 8 9 10
  through Lawrence Berkeley National Laboratory (subject to receipt of any
  required approvals from the U.S. Dept. of Energy) and the Paul Scherrer
  Institut (Switzerland).  All rights reserved.

  License: see file COPYING in top level of source distribution.
*/

#include "h5_private.h"
gsell's avatar
gsell committed
11 12

#include "h5core/h5_debug.h"
13 14 15 16 17 18 19 20
#include "h5core/h5_attribs.h"

/*
   __ _ _              _   _        _ _           _            
  / _(_) | ___    __ _| |_| |_ _ __(_) |__  _   _| |_ ___  ___ 
 | |_| | |/ _ \  / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
 |  _| | |  __/ | (_| | |_| |_| |  | | |_) | |_| | ||  __/\__ \
 |_| |_|_|\___|  \__,_|\__|\__|_|  |_|_.__/ \__,_|\__\___||___/
21

22 23 24 25 26 27 28
   __ _ _   _  ___ _ __ _   _ 
  / _` | | | |/ _ \ '__| | | |
 | (_| | |_| |  __/ |  | |_| |
  \__, |\__,_|\___|_|   \__, |
     |_|                |___/
*/

gsell's avatar
gsell committed
29 30
#define h5_getnfileattribs FC_MANGLING(		\
                h5_getnfileattribs,		\
31 32 33 34 35 36 37 38 39 40
                H5_GETNFILEATTRIBS)
h5_int64_t
h5_getnfileattribs (
	const h5_int64_t* const fh
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t, "fh=%p", (h5_file_p)f);
        H5_API_RETURN (h5_get_num_file_attribs (f));
}

gsell's avatar
gsell committed
41
#define h5_getfileattribinfo FC_MANGLING(	 \
gsell's avatar
gsell committed
42 43
                h5_getfileattribinfo,            \
                H5_GETFILEATTRIBINFO)
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
h5_int64_t
h5_getfileattribinfo (
	const h5_int64_t* const fh,
	const h5_int64_t* attrib_idx,
	char* attrib_name,
        h5_int64_t* attrib_type,
	h5_int64_t* attrib_nelem,
	const int l_attrib_name
        ) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, "
		      "attrib_idx=%lld, "
		      "attrib_name=%p, "
		      "attrib_type=%p, "
		      "attrib_nelem=%p",
		      (h5_file_p)fh,
		      (long long)*attrib_idx,
		      attrib_name, attrib_type, attrib_nelem);
gsell's avatar
gsell committed
63
        h5_int64_t h5err = h5_get_file_attrib_info_by_idx (
64 65 66 67 68 69 70 71 72 73
                f,
                *attrib_idx - 1,
                attrib_name, l_attrib_name,
                attrib_type,
                (h5_size_t*)attrib_nelem);
	h5_strc2for (attrib_name, l_attrib_name);
        convert_type2for (attrib_type);
	H5_API_RETURN (h5err);
}

gsell's avatar
gsell committed
74
#define h5_getfileattribinfo_by_name FC_MANGLING(	 \
gsell's avatar
gsell committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
                h5_getfileattribinfo_by_name,            \
                H5_GETFILEATTRIBINFO_BY_NAME)
h5_int64_t
h5_getfileattribinfo_by_name (
	const h5_int64_t* const fh,
	const char* const _name,
        h5_int64_t* const _type,
	h5_int64_t* const _nelem,
	const int l_name
        ) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, "
		      "name=%.*s, "
		      "type=%p, "
		      "nelem=%p",
		      (h5_file_p)fh,
		      l_name, _name, _type, _nelem);
	char* name = h5_strdupfor2c (_name, l_name);
        h5_int64_t h5err = h5_get_file_attrib_info_by_name (
                f,
                name,
                _type,
                (h5_size_t*)_nelem);
        convert_type2for (_type);
	H5_API_RETURN (h5err);
}

103
/*
104 105 106 107 108 109
   __ _ _              _   _        _ _           _            
  / _(_) | ___    __ _| |_| |_ _ __(_) |__  _   _| |_ ___  ___ 
 | |_| | |/ _ \  / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
 |  _| | |  __/ | (_| | |_| |_| |  | | |_) | |_| | ||  __/\__ \
 |_| |_|_|\___|  \__,_|\__|\__|_|  |_|_.__/ \__,_|\__\___||___/

110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
  _    __    
 (_)  / /__  
 | | / / _ \ 
 | |/ / (_) |
 |_/_/ \___/ 
*/
static inline h5_int64_t
write_file_attrib (
        const h5_file_t f,
	const char* name,
	const int l_name,
        const hid_t type,
	const void* buffer,
	const hsize_t l_buffer
        ) {
	char *name2 = h5_strdupfor2c (name, l_name);
	h5_int64_t herr = h5_write_file_attrib (f, name2, type, buffer, l_buffer );
	free (name2);
        return herr;
}

static inline h5_int64_t
read_file_attrib (
	const h5_file_t f,
	const char* name,
	const int l_name,
        const hid_t type,
	void* const buffer
	) {
	char* name2 = h5_strdupfor2c ( name, l_name );
	h5_int64_t herr = h5_read_file_attrib (f, name2, type, buffer);
	free (name2);
	return herr;
}

gsell's avatar
gsell committed
145
#define h5_writefileattrib_string FC_MANGLING (				\
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
                h5_writefileattrib_string,                              \
                H5_WRITEFILEATTRIB_STRING)
h5_int64_t
h5_writefileattrib_string (
	h5_int64_t *const fh,
	const char *name,
	const char *buffer,
	const int l_name,
	const int l_buffer
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, name='%.*s', buffer='%.*s'",
		      (h5_file_p)f, l_name, name, l_buffer, buffer);
	char *buffer2 = h5_strdupfor2c (buffer, l_buffer);
	h5_int64_t herr = write_file_attrib (
		f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
	free (buffer2);
	H5_API_RETURN (herr);
}

gsell's avatar
gsell committed
167
#define h5_readfileattrib_string FC_MANGLING (				\
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
                h5_readfileattrib_string,                               \
                H5_READFILEATTRIB_STRING)
h5_int64_t
h5_readfileattrib_string (
	h5_int64_t *const fh,
	const char *name,
	char *buffer,
	const int l_name,
	const int l_buffer
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, name='%.*s', buffer='%.*s'",
		      (h5_file_p)f, l_name, name, l_buffer, buffer);
	h5_int64_t herr = read_file_attrib (f, name, l_name, H5_STRING_T, buffer);
	h5_strc2for (buffer, l_buffer);
	H5_API_RETURN (herr);
}

gsell's avatar
gsell committed
187
#define h5_writefileattrib_r8 FC_MANGLING (	\
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
                h5_writefileattrib_r8,          \
                H5_WRITEFILEATTRIB_R8)
h5_int64_t
h5_writefileattrib_r8 (
	const h5_int64_t *const fh,
	const char *name,
	const h5_int64_t *buffer,
	const h5_int64_t *nelem,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, name='%.*s', buffer=%p, nelem=%lld",
		      (h5_file_p)f, l_name, name, buffer, (long long)*nelem);
        H5_API_RETURN (write_file_attrib(
                               f,
                               name, l_name,
                               H5_FLOAT64_T,
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
209 210
#define h5_readfileattrib_r8 FC_MANGLING (	\
                h5_readfileattrib_r8,		\
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
                H5_READFILEATTRIB_R8 )
h5_int64_t
h5_readfileattrib_r8 (
	h5_int64_t *const fh,
	const char *name,
	h5_int64_t *buffer,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "(h5_file_p)fh=%p, name='%.*s', buffer=%p",
		      (h5_file_p)f, l_name, name, buffer);
        H5_API_RETURN (read_file_attrib(
		f,
                name, l_name, 
                H5_FLOAT64_T,
                (void*)buffer));
}

gsell's avatar
gsell committed
230 231
#define h5_writefileattrib_r4 FC_MANGLING (	\
                h5_writefileattrib_r4,		\
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
                H5_WRITEFILEATTRIB_R4 )
h5_int64_t
h5_writefileattrib_r4 (
	const h5_int64_t *const fh,
	const char *name,
	const h5_int32_t *buffer,
	const h5_int64_t *nelem,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, name='%.*s', buffer=%p, nelem=%lld",
		      (h5_file_p)f, l_name, name, buffer, (long long)*nelem);
        H5_API_RETURN (write_file_attrib(
                               f,
                               name, l_name,
                               H5_FLOAT32_T,
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
252 253
#define h5_readfileattrib_r4 FC_MANGLING (	\
                h5_readfileattrib_r4,		\
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
                H5_READFILEATTRIB_R4 )
h5_int64_t
h5_readfileattrib_r4 (
	const h5_int64_t *const fh,
	const char *name,
	h5_int32_t *buffer,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p",
		      (h5_file_p)f, l_name, name, buffer);
        H5_API_RETURN (read_file_attrib(
		f,
                name, l_name, 
                H5_FLOAT32_T,
                buffer));
}

gsell's avatar
gsell committed
273
#define h5_writefileattrib_i8 FC_MANGLING (	\
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
                h5_writefileattrib_i8,          \
                H5_WRITEFILEATTRIB_I8)
h5_int64_t
h5_writefileattrib_i8 (
	const h5_int64_t *const fh,
	const char *name,
	const h5_int64_t *buffer,
	const h5_int64_t *nelem,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, name='%.*s', buffer=%p, nelem=%lld",
		      (h5_file_p)f, l_name, name, buffer, (long long)*nelem);
        H5_API_RETURN (write_file_attrib(
                               f,
                               name, l_name,
                               H5_INT64_T,
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
295 296
#define h5_readfileattrib_i8 FC_MANGLING (	\
                h5_readfileattrib_i8,		\
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
                H5_READFILEATTRIB_I8 )
h5_int64_t
h5_readfileattrib_i8 (
	const h5_int64_t *const fh,
	const char *name,
	h5_int64_t *buffer,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, name='%.*s', buffer=%p",
		      (h5_file_p)f, l_name, name, buffer);
        H5_API_RETURN (read_file_attrib(
		f,
                name, l_name, 
                H5_INT64_T,
                buffer));
}

gsell's avatar
gsell committed
316
#define h5_writefileattrib_i4 FC_MANGLING (	\
317 318 319 320 321 322 323 324 325 326 327 328
                h5_writefileattrib_i4,          \
                H5_WRITEFILEATTRIB_I4 )
h5_int64_t
h5_writefileattrib_i4 (
	h5_int64_t *const fh,
	const char *name,
	const h5_int32_t *buffer,
	const h5_int64_t *nelem,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
gsell's avatar
gsell committed
329 330
		      "fh=%p, name='%.*s', buffer[12]=%d, %x, %x, nelem=%lld",
		      (h5_file_p)f, l_name, name, buffer[12], buffer[13], buffer[14], (long long)*nelem);
331 332 333 334 335 336 337
        H5_API_RETURN (write_file_attrib(
                               f,
                               name, l_name,
                               H5_INT32_T,
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
338
#define h5_readfileattrib_i4 FC_MANGLING (	\
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
                h5_readfileattrib_i4,           \
                H5_READFILEATTRIB_I4 )
h5_int64_t
h5_readfileattrib_i4 (
	h5_int64_t *const fh,
	const char *name,
	h5_int32_t *buffer,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, name='%.*s', buffer=%p",
		      (h5_file_p)f, l_name, name, buffer);
        H5_API_RETURN (read_file_attrib(
		f,
                name, l_name, 
                H5_INT32_T,
                buffer));
}

/*
      _                     _   _        _ _           _            
  ___| |_ ___ _ __     __ _| |_| |_ _ __(_) |__  _   _| |_ ___  ___ 
 / __| __/ _ \ '_ \   / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
 \__ \ ||  __/ |_) | | (_| | |_| |_| |  | | |_) | |_| | ||  __/\__ \
 |___/\__\___| .__/   \__,_|\__|\__|_|  |_|_.__/ \__,_|\__\___||___/
             |_|                                                    
366 367 368 369 370 371 372
 
   __ _ _   _  ___ _ __ _   _ 
  / _` | | | |/ _ \ '__| | | |
 | (_| | |_| |  __/ |  | |_| |
  \__, |\__,_|\___|_|   \__, |
     |_|                |___/
*/
gsell's avatar
gsell committed
373
#define h5_getnstepattribs FC_MANGLING( \
374 375 376 377 378 379 380 381 382 383 384 385 386
                h5_getnstepattribs,  \
                H5_GETNSTEPATTRIBS)
h5_int64_t
h5_getnstepattribs (
	const h5_int64_t* fh
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
                      "fh=%p",
                      (h5_file_p)f);
        H5_API_RETURN (h5_get_num_step_attribs (f));
}

gsell's avatar
gsell committed
387 388 389
#define h5_getstepattribinfo FC_MANGLING(	 \
		h5_getstepattribinfo,		 \
		H5_GETSTEPATTRIBINFO)
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
h5_int64_t
h5_getstepattribinfo (
	const h5_int64_t* fh,
	const h5_int64_t* attrib_idx,
	char* attrib_name,
        h5_int64_t* attrib_type,
	h5_int64_t* attrib_nelem,
	const int l_attrib_name
        ) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, "
		      "attrib_idx=%lld, "
		      "attrib_name=%p, "
		      "attrib_type=%p, "
		      "attrib_nelem=%p",
		      (h5_file_p)f,
		      (long long)*attrib_idx,
		      attrib_name, attrib_type, attrib_nelem);
gsell's avatar
gsell committed
409
        h5_int64_t h5err = h5_get_step_attrib_info_by_idx (
410 411 412 413 414 415 416 417 418 419
                f,
                *attrib_idx - 1,
                attrib_name, l_attrib_name,
                attrib_type,
                (h5_size_t*)attrib_nelem);
	h5_strc2for (attrib_name, l_attrib_name);
        convert_type2for (attrib_type);
	H5_API_RETURN (h5err);
}

gsell's avatar
gsell committed
420
#define h5_getstepattribinfo_by_name FC_MANGLING(	 \
gsell's avatar
gsell committed
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
                h5_getstepattribinfo_by_name,            \
                H5_GETSTEPATTRIBINFO_BY_NAME)
h5_int64_t
h5_getstepattribinfo_by_name (
	const h5_int64_t* const fh,
	const char* const _name,
        h5_int64_t* const _type,
	h5_int64_t* const _nelem,
	const int l_name
        ) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "fh=%p, "
		      "name=%.*s, "
		      "type=%p, "
		      "nelem=%p",
		      (h5_file_p)fh,
		      l_name, _name, _type, _nelem);
	char* name = h5_strdupfor2c (_name, l_name);
        h5_int64_t h5err = h5_get_step_attrib_info_by_name (
                f,
                name,
                _type,
                (h5_size_t*)_nelem);
        convert_type2for (_type);
	H5_API_RETURN (h5err);
}

449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
/*
      _                     _   _        _ _           _            
  ___| |_ ___ _ __     __ _| |_| |_ _ __(_) |__  _   _| |_ ___  ___ 
 / __| __/ _ \ '_ \   / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
 \__ \ ||  __/ |_) | | (_| | |_| |_| |  | | |_) | |_| | ||  __/\__ \
 |___/\__\___| .__/   \__,_|\__|\__|_|  |_|_.__/ \__,_|\__\___||___/
             |_|                                                    

  _    __    
 (_)  / /__  
 | | / / _ \ 
 | |/ / (_) |
 |_/_/ \___/ 
*/

464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
static inline h5_int64_t
write_step_attrib (
        const h5_file_t fh,
	const char* name,
	const int l_name,
        const hid_t type,
	const void* buffer,
	const hsize_t l_buffer
        ) {
	char *name2 = h5_strdupfor2c (name, l_name);
	h5_int64_t herr = h5_write_step_attrib (fh, name2, type, buffer, l_buffer );
	free (name2);
        return herr;
}

static inline h5_int64_t
read_step_attrib (
	const h5_file_t fh,
	const char* name,
	const int l_name,
        const hid_t type,
	void* const buffer
	) {
	char* name2 = h5_strdupfor2c ( name, l_name );
	h5_int64_t herr = h5_read_step_attrib (fh, name2, type, buffer);
	free (name2);
	return herr;
}

gsell's avatar
gsell committed
493
#define h5_writestepattrib_string FC_MANGLING (				\
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
                h5_writestepattrib_string,                              \
                H5_WRITESTEPATTRIB_STRING)
h5_int64_t
h5_writestepattrib_string (
	const h5_int64_t *const fh,
	const char *name,
	const char *buffer,
	const int l_name,
	const int l_buffer
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer='%.*s'",
		      (h5_file_p)f, l_name, name, l_buffer, buffer);
	char *buffer2 = h5_strdupfor2c (buffer, l_buffer);
	h5_int64_t herr = write_step_attrib (
		f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
	free (buffer2);
	H5_API_RETURN (herr);
}

gsell's avatar
gsell committed
515
#define h5_readstepattrib_string FC_MANGLING (				\
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534
                h5_readstepattrib_string,                               \
                H5_READSTEPATTRIB_STRING)
h5_int64_t
h5_readstepattrib_string (
	const h5_int64_t *const fh,
	const char *name,
	char *buffer,
	const int l_name,
	const int l_buffer
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer='%.*s'",
		      (h5_file_p)f, l_name, name, l_buffer, buffer);
	h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING_T, buffer);
	h5_strc2for (buffer, l_buffer);
	H5_API_RETURN (herr);
}

gsell's avatar
gsell committed
535
#define h5_writestepattrib_r8 FC_MANGLING (	\
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556
                h5_writestepattrib_r8,          \
                H5_WRITESTEPATTRIB_R8)
h5_int64_t
h5_writestepattrib_r8 (
	const h5_int64_t *const fh,
	const char *name,
	const h5_float64_t *buffer,
	const h5_int64_t *nelem,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p, nelem=%lld",
		      (h5_file_p)f, l_name, name, buffer, (long long)*nelem);
        H5_API_RETURN (write_step_attrib(
                               f,
                               name, l_name,
                               H5_FLOAT64_T,
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
557 558
#define h5_readstepattrib_r8 FC_MANGLING (	\
                h5_readstepattrib_r8,		\
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577
                H5_READSTEPATTRIB_R8 )
h5_int64_t
h5_readstepattrib_r8 (
	const h5_int64_t *const fh,
	const char *name,
	h5_float64_t *buffer,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p",
		      (h5_file_p)f, l_name, name, buffer);
        H5_API_RETURN (read_step_attrib(
		f,
                name, l_name, 
                H5_FLOAT64_T,
                (void*)buffer));
}

gsell's avatar
gsell committed
578 579
#define h5_writestepattrib_r4 FC_MANGLING (	\
                h5_writestepattrib_r4,		\
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
                H5_WRITESTEPATTRIB_R4 )
h5_int64_t
h5_writestepattrib_r4 (
	h5_int64_t *const fh,
	const char *name,
	const h5_float64_t *buffer,
	const h5_int64_t *nelem,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p, nelem=%lld",
		      (h5_file_p)f, l_name, name, buffer, (long long)*nelem);
        H5_API_RETURN (write_step_attrib(
                               f,
                               name, l_name,
                               H5_FLOAT32_T,
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
600 601
#define h5_readstepattrib_r4 FC_MANGLING (	\
                h5_readstepattrib_r4,		\
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
                H5_READSTEPATTRIB_R4 )
h5_int64_t
h5_readstepattrib_r4 (
	const h5_int64_t *const fh,
	const char *name,
	h5_float64_t *buffer,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p",
		      (h5_file_p)f, l_name, name, buffer);
        H5_API_RETURN (read_step_attrib(
		f,
                name, l_name, 
                H5_FLOAT32_T,
                buffer));
}

gsell's avatar
gsell committed
621
#define h5_writestepattrib_i8 FC_MANGLING (	\
622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642
                h5_writestepattrib_i8,          \
                H5_WRITESTEPATTRIB_I8)
h5_int64_t
h5_writestepattrib_i8 (
	h5_int64_t *const fh,
	const char *name,
	const h5_float64_t *buffer,
	const h5_int64_t *nelem,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p, nelem=%lld",
		      (h5_file_p)f, l_name, name, buffer, (long long)*nelem);
        H5_API_RETURN (write_step_attrib(
                               f,
                               name, l_name,
                               H5_INT64_T,
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
643 644
#define h5_readstepattrib_i8 FC_MANGLING (	\
                h5_readstepattrib_i8,		\
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
                H5_READSTEPATTRIB_I8 )
h5_int64_t
h5_readstepattrib_i8 (
	const h5_int64_t *const fh,
	const char *name,
	h5_float64_t *buffer,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p",
		      (h5_file_p)f, l_name, name, buffer);
        H5_API_RETURN (read_step_attrib(
		f,
                name, l_name, 
                H5_INT64_T,
                buffer));
}

gsell's avatar
gsell committed
664
#define h5_writestepattrib_i4 FC_MANGLING (	\
665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685
                h5_writestepattrib_i4,          \
                H5_WRITESTEPATTRIB_I4 )
h5_int64_t
h5_writestepattrib_i4 (
	const h5_int64_t *const fh,
	const char *name,
	const h5_float64_t *buffer,
	const h5_int64_t *nelem,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p, nelem=%lld",
		      (h5_file_p)f, l_name, name, buffer, (long long)*nelem);
        H5_API_RETURN (write_step_attrib(
                               f,
                               name, l_name,
                               H5_INT32_T,
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
686
#define h5_readstepattrib_i4 FC_MANGLING (	\
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705
                h5_readstepattrib_i4,           \
                H5_READSTEPATTRIB_I4 )
h5_int64_t
h5_readstepattrib_i4 (
	const h5_int64_t *const fh,
	const char *name,
	h5_float64_t *buffer,
	const int l_name
	) {
	h5_file_t f = h5_filehandlefor2c(fh);
	H5_API_ENTER (h5_int64_t,
		      "f=%p, name='%.*s', buffer=%p",
		      (h5_file_p)f, l_name, name, buffer);
        H5_API_RETURN (read_step_attrib(
		f,
                name, l_name, 
                H5_INT32_T,
                buffer));
}