H5_attribs.c 19.9 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
                f,
                *attrib_idx - 1,
                attrib_name, l_attrib_name,
                attrib_type,
                (h5_size_t*)attrib_nelem);
	h5_strc2for (attrib_name, l_attrib_name);
	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
                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);
	H5_API_RETURN (h5err);
}

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

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

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

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

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

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

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

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

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

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

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

gsell's avatar
gsell committed
418
#define h5_getstepattribinfo_by_name FC_MANGLING(	 \
gsell's avatar
gsell committed
419 420 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
                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);
	H5_API_RETURN (h5err);
}

446 447 448 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
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
490
#define h5_writestepattrib_string FC_MANGLING (				\
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506
                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 (
gsell's avatar
gsell committed
507
		f, name, l_name, H5_STRING_T, buffer2, strlen(buffer2)+1 );
508 509 510 511
	free (buffer2);
	H5_API_RETURN (herr);
}

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

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

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

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

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

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

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

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

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