log-e-sappho/include/spho/ctx.h

34 lines
677 B
C

#ifndef _SPHO_CTX_H
#define _SPHO_CTX_H
#include "spho/err.h"
#include "spho/scope.h"
#define SPHO_ERR_BUF_LEN 2048
#define SPHO_ERR_FILEBUF_LEN 128
struct spho_ctx {
struct spho_scope glob;
int err;
int err_info;
char errbuf[SPHO_ERR_BUF_LEN];
unsigned int nom_cnt;
#ifdef SPHO_DEBUG
char filebuf[SPHO_ERR_FILEBUF_LEN];
int errline;
#endif
};
struct spho_ctx *spho_ctx_create(void);
void spho_ctx_init(struct spho_ctx *);
void spho_ctx_destroy(struct spho_ctx *);
const char *spho_ctx_strerror(struct spho_ctx *);
struct spho_nom *spho_nom_add(struct spho_ctx *, char *, size_t);
struct spho_nom *spho_nom_get(struct spho_ctx *, char *, size_t);
#endif