xref: /Universal-ctags/peg/varlink_pre.h (revision b7514e1ec672a8580bea041544e9259a169f09c3)
1 /*
2  *   Copyright (c) 2019 Masatake YAMATO
3  *   Copyright (c) 2019 Red Hat, Inc.
4  *
5  *   This source code is released for free distribution under the terms of the
6  *   GNU General Public License version 2 or (at your option) any later version.
7  *
8  *   This module contains macros, data decls and prototypes to generate tags for Varlink.
9  */
10 
11 /*
12 *   INCLUDE FILES
13 */
14 #include "kind.h"
15 #include "peg_common.h"
16 
17 
18 /*
19 *   MACROS
20 */
21 
22 /*
23 *   DATA DECLARATIONS
24 */
25 typedef enum {
26 	K_INTERFACE,
27 	K_METHOD,
28 	K_IPARAM,
29 	K_OPARAM,
30 	K_STRUCT,
31 	K_FIELD,
32 	K_ENUM,
33 	K_ENUMERATION,
34 	K_ERROR,
35 	K_EDESC,
36 } varlinkKind;
37 
38 static kindDefinition VarlinkKinds [] = {
39 	{ true,  'i', "interface",   "interfaces" },
40 	{ true,  'm', "method",      "methods" },
41 	{ true,  'I', "iparam",      "input parameters" },
42 	{ true,  'O', "oparam",      "output parameters" },
43 	{ true,  's', "struct",      "structs" },
44 	{ true,  'f', "field",       "fields" },
45 	{ true,  'g', "enum",        "enumeration names" },
46 	{ true,  'e', "enumerator",  "enumerators (values inside an enumeration)" },
47 	{ true,  'E', "error",       "errors" },
48 	{ true,  'd', "edesc",       "error descriptors" },
49 };
50 
51 typedef enum  {
52 	METHOD_PARAM_INPUT,
53 	METHOD_PARAM_OUTPUT,
54 } methodParamState;
55 
56 struct parserCtx {
57 	struct parserBaseCtx base;
58 	methodParamState mparam_state;
59 };
60 
61 /*
62 *   FUNCTION PROTOTYPES
63 */
64 static void pushKindContextual (struct parserCtx *auxil);
65 static void setMethodParamState (struct parserCtx *auxil, methodParamState s);
66 static int makeVarlinkTag (struct parserCtx *auxil, const char *name, long offset);
67