2 *------------------------------------------------------------------
3 * node.h - definitions for an API generator
5 * Copyright (c) 2004-2009 Cisco and/or its affiliates.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at:
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *------------------------------------------------------------------
27 char *sxerox (const char *s);
29 enum node_subclass { /* WARNING: indices must match the vft... */
48 NODE_N_TYPES, /* number of node types with VFT's */
50 /* pseudo-node(s) used in the lexer keyword table, but
51 NOT in need of a VFT... */
69 extern void *make_node (enum node_subclass type);
71 typedef struct node_ {
72 enum node_subclass type;
79 /* To shut up gcc-4.2.x warnings */
80 #define CDATA0 ((char *)(this->data[0]))
81 #define IDATA1 ((int)(uword)(this->data[1]))
82 #define CDATA2 ((char *)(this->data[2]))
84 #define NODE_FLAG_MANUAL_PRINT (1<<0)
85 #define NODE_FLAG_MANUAL_ENDIAN (1<<1)
86 #define NODE_FLAG_MANUAL_JAVA (1<<2)
87 #define NODE_FLAG_TYPEONLY (1<<3)
88 #define NODE_FLAG_DONT_TRACE (1<<4)
90 typedef struct node_vft_ {
91 void (*print)(struct node_ *);
92 void (*generate)(struct node_ *, enum passid id, FILE *ofp);
93 char *endian_converter;
94 void (*java_method_function)(struct node_ *, enum passid id, FILE *ofp);
95 void (*java_jni_parameter)(struct node_ *, enum passid id, FILE *ofp);
96 void (*java_jni_setup)(struct node_ *, enum passid id, FILE *ofp);
97 void (*java_jni_code)(struct node_ *, enum passid id, FILE *ofp);
98 void (*java_jni_teardown)(struct node_ *, enum passid id, FILE *ofp);