openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

cint_operators.h (2650B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        cint_operators.h
      8  * Purpose:     CINT operator interfaces
      9  */
     10 
     11 #ifndef __CINT_OPERATORS_H__
     12 #define __CINT_OPERATORS_H__
     13 
     14 #include "cint_config.h"
     15 #include "cint_types.h"
     16 
     17 /*
     18  * Operator Flags
     19  */
     20 #define CINT_OPERATOR_F_ACCEPT_INTEGRAL         0x1
     21 #define CINT_OPERATOR_F_ACCEPT_DOUBLE           0x2
     22 #define CINT_OPERATOR_F_ACCEPT_POINTER          0x4
     23 #define CINT_OPERATOR_F_ACCEPT_ALL              0x8
     24 
     25 #define CINT_OPERATOR_F_LEFT                    0x100
     26 #define CINT_OPERATOR_F_RIGHT                   0x200
     27 #define CINT_OPERATOR_F_TYPE_CHECK              0x400
     28 #define CINT_OPERATOR_F_OPTIONAL                0x800
     29 #define CINT_OPERATOR_F_LOGICAL                 0x1000
     30 
     31 
     32 #define CINT_OPERATOR_FLAGS_UNARY CINT_OPERATOR_F_RIGHT 
     33 #define CINT_OPERATOR_FLAGS_IUNARY CINT_OPERATOR_FLAGS_UNARY | CINT_OPERATOR_F_ACCEPT_INTEGRAL
     34 #define CINT_OPERATOR_FLAGS_AUNARY CINT_OPERATOR_FLAGS_IUNARY | CINT_OPERATOR_F_ACCEPT_DOUBLE
     35 #define CINT_OPERATOR_FLAGS_PUNARY CINT_OPERATOR_FLAGS_AUNARY | CINT_OPERATOR_F_ACCEPT_POINTER
     36 
     37 #define CINT_OPERATOR_FLAGS_BINARY CINT_OPERATOR_F_LEFT | CINT_OPERATOR_F_RIGHT | CINT_OPERATOR_F_TYPE_CHECK
     38 #define CINT_OPERATOR_FLAGS_IBINARY CINT_OPERATOR_FLAGS_BINARY | CINT_OPERATOR_F_ACCEPT_INTEGRAL
     39 #define CINT_OPERATOR_FLAGS_ABINARY CINT_OPERATOR_FLAGS_IBINARY | CINT_OPERATOR_F_ACCEPT_DOUBLE
     40 #define CINT_OPERATOR_FLAGS_PBINARY CINT_OPERATOR_FLAGS_ABINARY | CINT_OPERATOR_F_ACCEPT_POINTER
     41      
     42 
     43 typedef enum cint_operator_e {
     44     
     45 #define CINT_OPERATOR_LIST_ENTRY(name, _entry, f) cintOp##_entry ,
     46 
     47 #include "cint_op_entry.h"
     48 
     49     cintOpLast
     50 
     51 } cint_operator_t; 
     52 
     53 
     54 /*
     55  * Operator operand types
     56  */
     57 typedef enum cint_operand_type_e {
     58     
     59     cintOperandInt,
     60     cintOperandUInt,
     61     cintOperandLong,
     62     cintOperandULong,
     63     cintOperandLongLong,
     64     cintOperandULongLong,
     65     cintOperandDouble,
     66     cintOperandPointer
     67 
     68 } cint_operand_type_t; 
     69     
     70 /*
     71  * Evaluate an operator AST. 
     72  */
     73 struct cint_ast_s; 
     74 struct cint_variable_s; 
     75 
     76 extern struct cint_variable_s* 
     77 cint_eval_operator(struct cint_ast_s* opnode); 
     78 
     79 extern cint_operator_t
     80 cint_operator_type(struct cint_ast_s* ast); 
     81 
     82 struct cint_variable_s*
     83 cint_eval_operator_internal(struct cint_ast_s* ast, cint_operator_t op, 
     84                             struct cint_variable_s* left, 
     85                             struct cint_variable_s* right); 
     86 
     87 extern const char* 
     88 cint_operator_name(cint_operator_t op);
     89 
     90 #endif /* __CINT_OPERATORS_H__ */