/*
 *------------------------------------------------------------------
 * node.h - definitions for an API generator
 *
 * Copyright (c) 2004-2009 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *------------------------------------------------------------------
 */

#ifndef _node_h_
#define _node_h_

/*
 * Global prototypes
 */

char *sxerox (const char *s);

enum node_subclass {  /* WARNING: indices must match the vft... */
    NODE_ILLEGAL=0,
    NODE_U8,
    NODE_U16,
    NODE_U32,
    NODE_U64,
    NODE_I8,
    NODE_I16,
    NODE_I32,
    NODE_I64,
    NODE_F64,
    NODE_PACKED,
    NODE_DEFINE,
    NODE_UNION,
    NODE_SCALAR,
    NODE_VECTOR,
    NODE_COMPLEX,
    NODE_NOVERSION,
    NODE_UWORD,
    NODE_N_TYPES,  /* number of node types with VFT's */

    /* pseudo-node(s) used in the lexer keyword table, but
       NOT in need of a VFT... */
    NODE_TYPEONLY,
    NODE_MANUAL_PRINT,
    NODE_MANUAL_ENDIAN,
    NODE_MANUAL_JAVA,
    NODE_DONT_TRACE,
};

enum passid {
    TYPEDEF_PASS=1,
    UNION_DEF_PASS,
    ENDIANFUN_PASS,
    PRINTFUN_PASS,
    JAVA_METHOD_PASS,
    JAVA_JNI_PASS,
    PYTHON_PASS,
};

extern void *make_node (enum node_subclass type);

typedef struct node_ {
    enum node_subclass type;
    struct node_ *peer;
    struct node_ *deeper;
    int flags;
    void *data[2];
} node_t;

/* To shut up gcc-4.2.x warnings */
#define CDATA0 ((char *)(this->data[0]))
#define IDATA1 ((int)(uword)(this->data[1]))

#define NODE_FLAG_MANUAL_PRINT (1<<0)
#define NODE_FLAG_MANUAL_ENDIAN (1<<1)
#define NODE_FLAG_MANUAL_JAVA (1<<2)
#define NODE_FLAG_TYPEONLY (1<<3)
#define NODE_FLAG_DONT_TRACE (1<<4)

typedef struct node_vft_ {
    void (*print)(struct node_ *);
    void (*generate)(struct node_ *, enum passid id, FILE *ofp);
    char *endian_converter;
    void (*java_method_function)(struct node_ *, enum passid id, FILE *ofp);
    void (*java_jni_parameter)(struct node_ *, enum passid id, FILE *ofp);
    void (*java_jni_setup)(struct node_ *, enum passid id, FILE *ofp);
    void (*java_jni_code)(struct node_ *, enum passid id, FILE *ofp);
    void (*java_jni_teardown)(struct node_ *, enum passid id, FILE *ofp);
} node_vft_t;    

#endif /* _node_h */
