HPCToolkit
hpcfmt.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <inttypes.h>
#include "hpcio.h"
Include dependency graph for hpcfmt.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  hpcfmt_byte8_union_t
 
struct  hpcfmt_str_t
 
struct  hpcfmt_nvpair_t
 
struct  metric_aux_info_s
 

Macros

#define HPCFMT_ThrowIfError(v)   if ( (v) != HPCFMT_OK ) { return HPCFMT_ERR; }
 
#define HPCFMT_List(t)   list_of_ ## t
 
#define HPCFMT_ListRep(t)
 
#define HPCFMT_List_declare(t)   typedef HPCFMT_ListRep(t) HPCFMT_List(t)
 

Typedefs

typedef uint64_t hpcfmt_vma_t
 
typedef uint64_t hpcfmt_uint_t
 
typedef void * hpcfmt_alloc_fn(size_t nbytes)
 
typedef void hpcfmt_free_fn(void *mem)
 
typedef struct hpcfmt_str_t hpcfmt_str_t
 
typedef struct hpcfmt_nvpair_t hpcfmt_nvpair_t
 
typedef struct metric_aux_info_s metric_aux_info_t
 

Enumerations

enum  { HPCFMT_OK = 1, HPCFMT_ERR = -1, HPCFMT_EOF = -2 }
 

Functions

int hpcfmt_fread (void *data, size_t size, FILE *infs)
 
int hpcfmt_fwrite (void *data, size_t size, FILE *outfs)
 
static int hpcfmt_int2_fread (uint16_t *val, FILE *infs)
 
static int hpcfmt_int4_fread (uint32_t *val, FILE *infs)
 
static int hpcfmt_int8_fread (uint64_t *val, FILE *infs)
 
static int hpcfmt_intX_fread (uint8_t *val, size_t size, FILE *infs)
 
static int hpcfmt_real8_fread (double *val, FILE *infs)
 
static int hpcfmt_int2_fwrite (uint16_t val, FILE *outfs)
 
static int hpcfmt_int4_fwrite (uint32_t val, FILE *outfs)
 
static int hpcfmt_int8_fwrite (uint64_t val, FILE *outfs)
 
static int hpcfmt_intX_fwrite (uint8_t *val, size_t size, FILE *outfs)
 
static int hpcfmt_real8_fwrite (double val, FILE *outfs)
 
int hpcfmt_str_fread (char **str, FILE *infs, hpcfmt_alloc_fn alloc)
 
int hpcfmt_str_fwrite (const char *str, FILE *outfs)
 
void hpcfmt_str_free (const char *str, hpcfmt_free_fn dealloc)
 
static const char * hpcfmt_str_ensure (const char *x)
 
int hpcfmt_nvpair_fwrite (hpcfmt_nvpair_t *nvp, FILE *fs)
 
int hpcfmt_nvpairs_vfwrite (FILE *out, va_list args)
 
int hpcfmt_nvpair_fread (hpcfmt_nvpair_t *inp, FILE *infs, hpcfmt_alloc_fn alloc)
 
int hpcfmt_nvpair_fprint (hpcfmt_nvpair_t *nvp, FILE *fs, const char *pre)
 
 HPCFMT_List_declare (hpcfmt_nvpair_t)
 
int hpcfmt_nvpairList_fread (HPCFMT_List(hpcfmt_nvpair_t) *nvps, FILE *infs, hpcfmt_alloc_fn alloc)
 
int hpcfmt_nvpairList_fprint (const HPCFMT_List(hpcfmt_nvpair_t) *nvps, FILE *fs, const char *pre)
 
const char * hpcfmt_nvpairList_search (const HPCFMT_List(hpcfmt_nvpair_t) *lst, const char *name)
 
void hpcfmt_nvpairList_free (HPCFMT_List(hpcfmt_nvpair_t) *nvps, hpcfmt_free_fn dealloc)
 

Macro Definition Documentation

◆ HPCFMT_List

#define HPCFMT_List (   t)    list_of_ ## t

Definition at line 115 of file hpcfmt.h.

◆ HPCFMT_List_declare

#define HPCFMT_List_declare (   t)    typedef HPCFMT_ListRep(t) HPCFMT_List(t)

Definition at line 123 of file hpcfmt.h.

◆ HPCFMT_ListRep

#define HPCFMT_ListRep (   t)
Value:
struct HPCFMT_List(t) { \
uint32_t len; \
t* lst; \
}

Definition at line 117 of file hpcfmt.h.

◆ HPCFMT_ThrowIfError

#define HPCFMT_ThrowIfError (   v)    if ( (v) != HPCFMT_OK ) { return HPCFMT_ERR; }

Definition at line 97 of file hpcfmt.h.

Typedef Documentation

◆ hpcfmt_alloc_fn

typedef void* hpcfmt_alloc_fn(size_t nbytes)

Definition at line 133 of file hpcfmt.h.

◆ hpcfmt_free_fn

typedef void hpcfmt_free_fn(void *mem)

Definition at line 137 of file hpcfmt.h.

◆ hpcfmt_nvpair_t

◆ hpcfmt_str_t

typedef struct hpcfmt_str_t hpcfmt_str_t

◆ hpcfmt_uint_t

typedef uint64_t hpcfmt_uint_t

Definition at line 103 of file hpcfmt.h.

◆ hpcfmt_vma_t

typedef uint64_t hpcfmt_vma_t

Definition at line 102 of file hpcfmt.h.

◆ metric_aux_info_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
HPCFMT_OK 
HPCFMT_ERR 
HPCFMT_EOF 

Definition at line 91 of file hpcfmt.h.

Function Documentation

◆ hpcfmt_fread()

int hpcfmt_fread ( void *  data,
size_t  size,
FILE *  infs 
)

Definition at line 144 of file hpcfmt.c.

Here is the call graph for this function:

◆ hpcfmt_fwrite()

int hpcfmt_fwrite ( void *  data,
size_t  size,
FILE *  outfs 
)

Definition at line 155 of file hpcfmt.c.

Here is the call graph for this function:

◆ hpcfmt_int2_fread()

static int hpcfmt_int2_fread ( uint16_t *  val,
FILE *  infs 
)
inlinestatic

Definition at line 150 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_int2_fwrite()

static int hpcfmt_int2_fwrite ( uint16_t  val,
FILE *  outfs 
)
inlinestatic

Definition at line 207 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_int4_fread()

static int hpcfmt_int4_fread ( uint32_t *  val,
FILE *  infs 
)
inlinestatic

Definition at line 161 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_int4_fwrite()

static int hpcfmt_int4_fwrite ( uint32_t  val,
FILE *  outfs 
)
inlinestatic

Definition at line 217 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_int8_fread()

static int hpcfmt_int8_fread ( uint64_t *  val,
FILE *  infs 
)
inlinestatic

Definition at line 172 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_int8_fwrite()

static int hpcfmt_int8_fwrite ( uint64_t  val,
FILE *  outfs 
)
inlinestatic

Definition at line 227 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_intX_fread()

static int hpcfmt_intX_fread ( uint8_t *  val,
size_t  size,
FILE *  infs 
)
inlinestatic

Definition at line 183 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_intX_fwrite()

static int hpcfmt_intX_fwrite ( uint8_t *  val,
size_t  size,
FILE *  outfs 
)
inlinestatic

Definition at line 237 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ HPCFMT_List_declare()

HPCFMT_List_declare ( hpcfmt_nvpair_t  )

◆ hpcfmt_nvpair_fprint()

int hpcfmt_nvpair_fprint ( hpcfmt_nvpair_t nvp,
FILE *  fs,
const char *  pre 
)

Definition at line 225 of file hpcfmt.c.

Here is the caller graph for this function:

◆ hpcfmt_nvpair_fread()

int hpcfmt_nvpair_fread ( hpcfmt_nvpair_t inp,
FILE *  infs,
hpcfmt_alloc_fn  alloc 
)

Definition at line 215 of file hpcfmt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_nvpair_fwrite()

int hpcfmt_nvpair_fwrite ( hpcfmt_nvpair_t nvp,
FILE *  fs 
)

Definition at line 169 of file hpcfmt.c.

Here is the call graph for this function:

◆ hpcfmt_nvpairList_fprint()

int hpcfmt_nvpairList_fprint ( const HPCFMT_List(hpcfmt_nvpair_t) *  nvps,
FILE *  fs,
const char *  pre 
)

Definition at line 252 of file hpcfmt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_nvpairList_fread()

int hpcfmt_nvpairList_fread ( HPCFMT_List(hpcfmt_nvpair_t) *  nvps,
FILE *  infs,
hpcfmt_alloc_fn  alloc 
)

Definition at line 237 of file hpcfmt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_nvpairList_free()

void hpcfmt_nvpairList_free ( HPCFMT_List(hpcfmt_nvpair_t) *  nvps,
hpcfmt_free_fn  dealloc 
)

Definition at line 276 of file hpcfmt.c.

Here is the caller graph for this function:

◆ hpcfmt_nvpairList_search()

const char* hpcfmt_nvpairList_search ( const HPCFMT_List(hpcfmt_nvpair_t) *  lst,
const char *  name 
)

Definition at line 263 of file hpcfmt.c.

Here is the caller graph for this function:

◆ hpcfmt_nvpairs_vfwrite()

int hpcfmt_nvpairs_vfwrite ( FILE *  out,
va_list  args 
)

Definition at line 188 of file hpcfmt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_real8_fread()

static int hpcfmt_real8_fread ( double *  val,
FILE *  infs 
)
inlinestatic

Definition at line 194 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_real8_fwrite()

static int hpcfmt_real8_fwrite ( double  val,
FILE *  outfs 
)
inlinestatic

Definition at line 247 of file hpcfmt.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_str_ensure()

static const char* hpcfmt_str_ensure ( const char *  x)
inlinestatic

Definition at line 283 of file hpcfmt.h.

Here is the caller graph for this function:

◆ hpcfmt_str_fread()

int hpcfmt_str_fread ( char **  str,
FILE *  infs,
hpcfmt_alloc_fn  alloc 
)

Definition at line 87 of file hpcfmt.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hpcfmt_str_free()

void hpcfmt_str_free ( const char *  str,
hpcfmt_free_fn  dealloc 
)

Definition at line 132 of file hpcfmt.c.

Here is the caller graph for this function:

◆ hpcfmt_str_fwrite()

int hpcfmt_str_fwrite ( const char *  str,
FILE *  outfs 
)

Definition at line 115 of file hpcfmt.c.

Here is the call graph for this function:
Here is the caller graph for this function: