mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
35 lines
803 B
C
35 lines
803 B
C
#ifndef INCLUDED_DYNARG
|
|
#define INCLUDED_DYNARG
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdbool.h>
|
|
|
|
struct DynArg {
|
|
bool use_dbl;
|
|
double dbl;
|
|
// TODO: check if this will work on different endianness.
|
|
union {
|
|
char chr;
|
|
long long ll;
|
|
const char *str;
|
|
unsigned long long ull;
|
|
} __attribute__((packed)) arg;
|
|
};
|
|
|
|
struct DynArg DynArg_create();
|
|
void DynArg_init(struct DynArg *dynarg);
|
|
|
|
void DynArg_use_char(struct DynArg *dynarg, char chr);
|
|
void DynArg_use_double(struct DynArg *dynarg, double dbl);
|
|
void DynArg_use_long_long(struct DynArg *dynarg, long long ll);
|
|
void DynArg_use_str(struct DynArg *dynarg, const char *str);
|
|
void DynArg_use_unsigned_long_long(struct DynArg *dynarg, unsigned long long ull);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|