-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgcmd.h
64 lines (45 loc) · 1.36 KB
/
gcmd.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* gawk_cmd.h
*
*/
#ifndef GCMD_GCMD_H
#define GCMD_GCMD_H
/* -- defines -- */
#define GCMD_DEFAULT_GCMD ""
#define GCMD_DEFAULT_GCRS "{}"
#define GCMD_VERSION "GCMD extension: version 1.0"
// shortcut for just __unused
#ifndef __GNUC__
#define __attribute__(A)
#endif
#define __UNUSED __attribute__ (( __unused__ ))
/* -- gawk api boilerplate -- */
// these imports are required for gawkapi.h to work correctly
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
// last but not least, gawkapi.h
#include <gawkapi.h>
/* now that we have imports out of the way, we do still need some other boilerplate */
int plugin_is_GPL_compatible;
static const gawk_api_t *api;
static awk_ext_id_t ext_id;
static const char ext_version[] = GCMD_VERSION;
/* table of functions exported to gawk */
static awk_ext_func_t func_table[] = {0};
/* init function */
static awk_bool_t gcmd_init(void);
/* functions for the gcmd input parser */
static awk_bool_t gcmd_can_take_file(const awk_input_buf_t *iobuf);
static awk_bool_t gcmd_take_control_of(awk_input_buf_t *iobuf);
/* tell gawk that we have an input parser */
static awk_input_parser_t gcmd_ip = {
"gawk_cmd",
gcmd_can_take_file,
gcmd_take_control_of,
NULL
};
/* -- other functions -- */
void gcmd_close(struct awk_input *iobuf);
#endif //GCMD_GCMD_H