blob: fdf953d911d9841253006963baada9117a4eee90 [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>
Lev Walkin84cd58e2004-08-19 13:29:46 +000010#include <string.h> /* for strlen(3) and memset(3) */
Lev Walkinf15320b2004-06-03 03:38:44 +000011#include <ctype.h> /* for isalnum(3) */
Lev Walkin4efbfb72005-02-25 14:20:30 +000012#include <sys/types.h> /* for fstat(2) */
Lev Walkinf15320b2004-06-03 03:38:44 +000013#include <stdarg.h>
14#include <errno.h>
15#include <assert.h>
16
Lev Walkin4efbfb72005-02-25 14:20:30 +000017#ifdef HAVE_SYS_STAT_H
18#include <sys/stat.h> /* for fstat(2) */
19#endif
20
21#ifdef HAVE_UNISTD_H
22#include <unistd.h> /* for unlink(2) */
23#endif
24
25#ifdef WIN32
26#include <io.h>
27#define open _open
28#define close _close
29#define alloca _alloca
30#define snprintf _snprintf
31#define vsnprintf _vsnprintf
32#else
33#include <fcntl.h> /* for open(2) */
34#include <glob.h> /* for glob(3) */
35#endif
36
37#ifdef HAVE_SYS_PARAM_H
38#include <sys/param.h> /* For MAXPATHLEN */
39#endif
40
Lev Walkinf15320b2004-06-03 03:38:44 +000041#include "asn1compiler.h"
42
43typedef struct arg_s {
44
45 enum asn1c_flags flags;
46
47 void (*logger_cb)(int _severity, const char *fmt, ...);
48
49 int (*default_cb)(struct arg_s *);
50
51 struct compiler_streams *target;
52
53 asn1p_t *asn;
Lev Walkinb85a8132005-08-18 13:38:19 +000054 //asn1p_module_t *mod;
Lev Walkinf15320b2004-06-03 03:38:44 +000055 asn1p_expr_t *expr;
56
Lev Walkinf15320b2004-06-03 03:38:44 +000057 int embed;
58} arg_t;
59
Lev Walkinf15320b2004-06-03 03:38:44 +000060/*
61 * Logging.
62 */
63#define LOG(ll, fmt, args...) do { \
64 arg->logger_cb(ll, fmt, ##args); \
65 } while(0)
66#define DEBUG(fmt, args...) do { \
67 if(arg->flags & A1C_DEBUG) \
68 LOG(-1, fmt, ##args); \
69 } while(0)
70#define WARNING(fmt, args...) LOG(0, fmt, ##args);
71#define FATAL(fmt, args...) LOG(1, fmt, ##args);
72
73#endif /* _ASN1_COMPILER_INTERNAL_H_ */