-
Notifications
You must be signed in to change notification settings - Fork 2
/
pprint.h
27 lines (20 loc) · 997 Bytes
/
pprint.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef _PPRINT_H_
#define _PPRINT_H_
typedef char* (*pprint_value_func)(char* buf, int buf_size, void* ptr);
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))
typedef struct structInfo structInfo;
struct structInfo {
void *data; /* address of struct/variable */
pprint_value_func func; /* callback function for normal variable */
char *structName; /* struct name. if null or empty, then it is a normal variable */
int level; /* 0:top level struct, 1: first level struct or normal variable, ... */
};
/* Entry point of the API */
extern void pprint_struct(char *varName, structInfo info[], int size);
/* value callback printing functions */
extern char *pprint_int (char* buf, int buf_size, void *ptr);
extern char *pprint_long (char* buf, int buf_size, void *ptr);
extern char *pprint_float (char* buf, int buf_size, void *ptr);
extern char *pprint_double(char* buf, int buf_size, void *ptr);
#endif
/* vim: set ts=2 sw=2 expandtab: */