H5_attribs.c 20.1 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_log.h"
gsell's avatar
gsell committed
13 14
#include "h5core/h5_file_attribs.h"
#include "h5core/h5_step_attribs.h"
15 16 17 18 19 20 21

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

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

gsell's avatar
gsell committed
30 31
#define h5_getnfileattribs FC_MANGLING(		\
                h5_getnfileattribs,		\
32 33 34 35 36 37 38 39 40 41
                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
42
#define h5_getfileattribinfo FC_MANGLING(	 \
gsell's avatar
gsell committed
43 44
                h5_getfileattribinfo,            \
                H5_GETFILEATTRIBINFO)
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
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
64
        h5_int64_t h5err = h5_get_file_attrib_info_by_idx (
65 66 67 68 69 70 71 72 73 74
                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
75
#define h5_getfileattribinfo_by_name FC_MANGLING(	 \
gsell's avatar
gsell committed
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 103
                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);
}

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 145
  _    __    
 (_)  / /__  
 | | / / _ \ 
 | |/ / (_) |
 |_/_/ \___/ 
*/
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
146
#define h5_writefileattrib_string FC_MANGLING (				\
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
                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 (
163
		f, name, l_name, H5_STRING, buffer2, strlen(buffer2)+1 );
164 165 166 167
	free (buffer2);
	H5_API_RETURN (herr);
}

gsell's avatar
gsell committed
168
#define h5_readfileattrib_string FC_MANGLING (				\
169 170 171 172 173 174 175 176 177 178 179 180 181 182
                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);
183
	h5_int64_t herr = read_file_attrib (f, name, l_name, H5_STRING, buffer);
184 185 186 187
	h5_strc2for (buffer, l_buffer);
	H5_API_RETURN (herr);
}

gsell's avatar
gsell committed
188
#define h5_writefileattrib_r8 FC_MANGLING (	\
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
                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,
206
                               H5_FLOAT64,
207 208 209
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
210 211
#define h5_readfileattrib_r8 FC_MANGLING (	\
                h5_readfileattrib_r8,		\
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
                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, 
227
                H5_FLOAT64,
228 229 230
                (void*)buffer));
}

gsell's avatar
gsell committed
231 232
#define h5_writefileattrib_r4 FC_MANGLING (	\
                h5_writefileattrib_r4,		\
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
                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,
249
                               H5_FLOAT32,
250 251 252
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
253 254
#define h5_readfileattrib_r4 FC_MANGLING (	\
                h5_readfileattrib_r4,		\
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
                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, 
270
                H5_FLOAT32,
271 272 273
                buffer));
}

gsell's avatar
gsell committed
274
#define h5_writefileattrib_i8 FC_MANGLING (	\
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
                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,
292
                               H5T_NATIVE_INT64,
293 294 295
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
296 297
#define h5_readfileattrib_i8 FC_MANGLING (	\
                h5_readfileattrib_i8,		\
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
                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, 
313
                H5T_NATIVE_INT64,
314 315 316
                buffer));
}

gsell's avatar
gsell committed
317
#define h5_writefileattrib_i4 FC_MANGLING (	\
318 319 320 321 322 323 324 325 326 327 328 329
                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
330 331
		      "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);
332 333 334
        H5_API_RETURN (write_file_attrib(
                               f,
                               name, l_name,
335
                               H5T_NATIVE_INT32,
336 337 338
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
339
#define h5_readfileattrib_i4 FC_MANGLING (	\
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
                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, 
356
                H5T_NATIVE_INT32,
357 358 359 360 361 362 363 364 365 366
                buffer));
}

/*
      _                     _   _        _ _           _            
  ___| |_ ___ _ __     __ _| |_| |_ _ __(_) |__  _   _| |_ ___  ___ 
 / __| __/ _ \ '_ \   / _` | __| __| '__| | '_ \| | | | __/ _ \/ __|
 \__ \ ||  __/ |_) | | (_| | |_| |_| |  | | |_) | |_| | ||  __/\__ \
 |___/\__\___| .__/   \__,_|\__|\__|_|  |_|_.__/ \__,_|\__\___||___/
             |_|                                                    
367 368 369 370 371 372 373
 
   __ _ _   _  ___ _ __ _   _ 
  / _` | | | |/ _ \ '__| | | |
 | (_| | |_| |  __/ |  | |_| |
  \__, |\__,_|\___|_|   \__, |
     |_|                |___/
*/
gsell's avatar
gsell committed
374
#define h5_getnstepattribs FC_MANGLING( \
375 376 377 378 379 380 381 382 383 384 385 386 387
                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
388 389 390
#define h5_getstepattribinfo FC_MANGLING(	 \
		h5_getstepattribinfo,		 \
		H5_GETSTEPATTRIBINFO)
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
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
410
        h5_int64_t h5err = h5_get_step_attrib_info_by_idx (
411 412 413 414 415 416 417 418 419 420
                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
421
#define h5_getstepattribinfo_by_name FC_MANGLING(	 \
gsell's avatar
gsell committed
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 449
                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);
}

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 493
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
494
#define h5_writestepattrib_string FC_MANGLING (				\
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510
                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 (
511
		f, name, l_name, H5_STRING, buffer2, strlen(buffer2)+1 );
512 513 514 515
	free (buffer2);
	H5_API_RETURN (herr);
}

gsell's avatar
gsell committed
516
#define h5_readstepattrib_string FC_MANGLING (				\
517 518 519 520 521 522 523 524 525 526 527 528 529 530
                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);
531
	h5_int64_t herr = read_step_attrib (f, name, l_name, H5_STRING, buffer);
532 533 534 535
	h5_strc2for (buffer, l_buffer);
	H5_API_RETURN (herr);
}

gsell's avatar
gsell committed
536
#define h5_writestepattrib_r8 FC_MANGLING (	\
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
                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,
554
                               H5_FLOAT64,
555 556 557
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
558 559
#define h5_readstepattrib_r8 FC_MANGLING (	\
                h5_readstepattrib_r8,		\
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574
                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, 
575
                H5_FLOAT64,
576 577 578
                (void*)buffer));
}

gsell's avatar
gsell committed
579 580
#define h5_writestepattrib_r4 FC_MANGLING (	\
                h5_writestepattrib_r4,		\
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596
                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,
597
                               H5_FLOAT32,
598 599 600
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
601 602
#define h5_readstepattrib_r4 FC_MANGLING (	\
                h5_readstepattrib_r4,		\
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
                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, 
618
                H5_FLOAT32,
619 620 621
                buffer));
}

gsell's avatar
gsell committed
622
#define h5_writestepattrib_i8 FC_MANGLING (	\
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639
                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,
640
                               H5T_NATIVE_INT64,
641 642 643
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
644 645
#define h5_readstepattrib_i8 FC_MANGLING (	\
                h5_readstepattrib_i8,		\
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660
                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, 
661
                H5T_NATIVE_INT64,
662 663 664
                buffer));
}

gsell's avatar
gsell committed
665
#define h5_writestepattrib_i4 FC_MANGLING (	\
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682
                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,
683
                               H5T_NATIVE_INT32,
684 685 686
                               buffer, (hsize_t)*nelem));
}

gsell's avatar
gsell committed
687
#define h5_readstepattrib_i4 FC_MANGLING (	\
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703
                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, 
704
                H5T_NATIVE_INT32,
705 706
                buffer));
}