blob: e6b18522938d1a02eb3ba4dccc6d1dea214fcc6a [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001#ifndef _ASN1_COMPILER_INTERNAL_H_
2#define _ASN1_COMPILER_INTERNAL_H_
3
Lev Walkin79f54952004-08-13 16:58:19 +00004#ifdef HAVE_CONFIG_H
5#include <config.h>
6#endif
7
Lev Walkinf15320b2004-06-03 03:38:44 +00008#include <stdio.h>
9#include <stdlib.h>
10#include <sys/stat.h> /* for fstat(2) */
11#include <unistd.h> /* for unlink(2) */
12#include <fcntl.h> /* for open(2) */
13#include <glob.h> /* for glob(3) */
Lev Walkin84cd58e2004-08-19 13:29:46 +000014#include <string.h> /* for strlen(3) and memset(3) */
Lev Walkinf15320b2004-06-03 03:38:44 +000015#include <ctype.h> /* for isalnum(3) */
16#include <stdarg.h>
17#include <errno.h>
18#include <assert.h>
19
20#include "asn1compiler.h"
21
22typedef struct arg_s {
23
24 enum asn1c_flags flags;
25
26 void (*logger_cb)(int _severity, const char *fmt, ...);
27
28 int (*default_cb)(struct arg_s *);
29
30 struct compiler_streams *target;
31
32 asn1p_t *asn;
33 asn1p_module_t *mod;
34 asn1p_expr_t *expr;
35
Lev Walkinf15320b2004-06-03 03:38:44 +000036 int embed;
37} arg_t;
38
Lev Walkinf15320b2004-06-03 03:38:44 +000039/*
40 * Logging.
41 */
42#define LOG(ll, fmt, args...) do { \
43 arg->logger_cb(ll, fmt, ##args); \
44 } while(0)
45#define DEBUG(fmt, args...) do { \
46 if(arg->flags & A1C_DEBUG) \
47 LOG(-1, fmt, ##args); \
48 } while(0)
49#define WARNING(fmt, args...) LOG(0, fmt, ##args);
50#define FATAL(fmt, args...) LOG(1, fmt, ##args);
51
52#endif /* _ASN1_COMPILER_INTERNAL_H_ */