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_config.h (7609B)


      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_config.h
      8  * Purpose:     CINT configuration
      9  */
     10 
     11 #ifndef __CINT_CONFIG_H__
     12 #define __CINT_CONFIG_H__
     13 
     14 /*******************************************************************************
     15  *
     16  * Interpreter Configuration Settings
     17  */
     18 
     19 #ifdef CINT_INCLUDE_CUSTOM_CONFIG
     20 #include <cint_custom_config.h>
     21 #endif
     22 
     23 /*
     24  * Include or exclude the grammar parser. 
     25  *
     26  * When the parser is included, you can call cint_interpreter_parser()
     27  * and allow it to parse and evaluate the input directly. 
     28  *
     29  * When the parser is NOT included you must construct the cint_ast_t* syntax tree yourself
     30  * and pass it to cint_interpreter_evaluate(). 
     31  */
     32 #ifndef CINT_CONFIG_INCLUDE_PARSER
     33 #define CINT_CONFIG_INCLUDE_PARSER 1
     34 #endif
     35 
     36 /*
     37  *
     38  * Defines the number of dimensions supported for arrays.  This should be the
     39  * maximum expected sum of pointer depth and array dimensions.  
     40  *
     41  * int a[5] would be a single dimension array.  int* a[5] would be considered 
     42  * two dimensions [5][]. An int** would be represented internally as a two 
     43  * dimension array with infinite dimension length [][]. int *[5] would be an 
     44  * array of pointers with length five for the first dimensions and infinite for
     45  * the second [5][].  For a type X defined to be a six byte character array, 
     46  * X **[5] would be represented internally as a four dimension type [5][][][6]. 
     47  */
     48 #ifndef CINT_CONFIG_ARRAY_DIMENSION_LIMIT
     49 #define CINT_CONFIG_ARRAY_DIMENSION_LIMIT 6
     50 #endif
     51 
     52 /*
     53  *
     54  * Pointers are represented as arrays of infinite dimension.  
     55  */
     56 #ifndef CINT_CONFIG_POINTER_INFINITE_DIMENSION
     57 #define CINT_CONFIG_POINTER_INFINITE_DIMENSION (int)((unsigned int)(-1) >> 1)
     58 #endif
     59 
     60 /*
     61  *
     62  * Used for character buffers when appending text for printing purposes.
     63  * bcm_pbmp_t variables with many/all ports added may require bigger buffer to
     64  * print into without truncation
     65  */
     66 #ifndef CINT_CONFIG_MAX_STACK_PRINT_BUFFER
     67 #if CINT_CONFIG_INCLUDE_CINT_LOGGER == 1
     68 #define CINT_CONFIG_MAX_STACK_PRINT_BUFFER 5120
     69 #else
     70 #define CINT_CONFIG_MAX_STACK_PRINT_BUFFER 512
     71 #endif
     72 #endif
     73 
     74 /*
     75  * Use readline() functionality for interactive input. 
     76  * Currently requires CINT_READLINE() macro portability. 
     77  */
     78 #ifndef CINT_CONFIG_INCLUDE_PARSER_READLINE
     79 #define CINT_CONFIG_INCLUDE_PARSER_READLINE 1
     80 #endif
     81 
     82 /*
     83  * Enable command line history() functionality for interactive input. 
     84  * Currently requires CINT_ADD_HISTORY() macro portability. 
     85  */
     86 #ifndef CINT_CONFIG_INCLUDE_PARSER_ADD_HISTORY
     87 #define CINT_CONFIG_INCLUDE_PARSER_ADD_HISTORY 1
     88 #endif
     89 
     90 /*
     91  * If the parser is included, this setting assumes the input can be read from stdin
     92  * using the default C stdio environment. 
     93  */
     94 #ifndef CINT_CONFIG_PARSER_STDIN
     95 #define CINT_CONFIG_PARSER_STDIN 1
     96 #endif
     97 
     98 
     99 /*
    100  * Include support for doubles. This support is optional as not all runtime environments
    101  * support them. 
    102  *
    103  * Note -- this allows declaration of both 'float' and 'double' types in the interpreter. 
    104  * However, all 'float' types are actually doubles internally. 
    105  */
    106 #ifndef CINT_CONFIG_INCLUDE_DOUBLES
    107 #define CINT_CONFIG_INCLUDE_DOUBLES 1
    108 #endif
    109 
    110 /*
    111  * Include support for long longs. 
    112  */
    113 #ifndef CINT_CONFIG_INCLUDE_LONGLONGS
    114 #ifdef __PEDANTIC__
    115 #define CINT_CONFIG_INCLUDE_LONGLONGS 0
    116 #else
    117 #define CINT_CONFIG_INCLUDE_LONGLONGS 1
    118 #endif
    119 #endif
    120 
    121 
    122 /*
    123  * Include a default main() application in the library. 
    124  */
    125 #ifndef CINT_CONFIG_INCLUDE_MAIN
    126 #define CINT_CONFIG_INCLUDE_MAIN 0
    127 #endif
    128 
    129 
    130 /*
    131  * Maximum allowable length of a variable name in characters. 
    132  */
    133 #ifndef CINT_CONFIG_MAX_VARIABLE_NAME
    134 #define CINT_CONFIG_MAX_VARIABLE_NAME 64
    135 #endif
    136 
    137 
    138 /*
    139  * The maximum number of function parameters. 
    140  */
    141 #ifndef CINT_CONFIG_MAX_FPARAMS
    142 #define CINT_CONFIG_MAX_FPARAMS 16
    143 #endif
    144 
    145 
    146 /*
    147  * The maximum length of an unconstrained char* that sprintf will print into
    148  */
    149 #ifndef CINT_CONFIG_SPRINTF_BUFFER_LENGTH
    150 #define CINT_CONFIG_SPRINTF_BUFFER_LENGTH 4096
    151 #endif
    152 
    153 
    154 /*
    155  * Include or exclude support for dynamic loading and registration of interpreter data
    156  * using shared libraries:
    157  *
    158  *      #> cint load <lib.so>
    159  * 
    160  * Currently requires a 'dlopen()' style interface. 
    161  * Disabled by default as it is non-portable. 
    162  */ 
    163 
    164 #ifndef CINT_CONFIG_INCLUDE_CINT_LOAD
    165 #define CINT_CONFIG_INCLUDE_CINT_LOAD 1
    166 #endif 
    167 
    168 
    169 
    170 /*
    171  * Include or exclude support for loading and evaluating source files into the 
    172  * interpreter:
    173  *
    174  *      #> cint source "file.c"
    175  *
    176  * Disabled by default as it is non-portable. 
    177  */
    178 #ifndef CINT_CONFIG_INCLUDE_CINT_SOURCE
    179 #define CINT_CONFIG_INCLUDE_CINT_SOURCE 0
    180 #endif
    181 
    182 
    183 /*
    184  * Include support for interpreter execution debug tracing. 
    185  *
    186  * When compiled in, this is enabled or disabled through
    187  * interp.debug.dtrace
    188  *
    189  * When compiled out, the setting has no effect. 
    190  */
    191 #ifndef CINT_CONFIG_INCLUDE_DTRACE
    192 #define CINT_CONFIG_INCLUDE_DTRACE 1
    193 #endif
    194 
    195 
    196 /*
    197  * Include support for generate interpreter debug messages. 
    198  */
    199 #ifndef CINT_CONFIG_INCLUDE_DEBUG
    200 #define CINT_CONFIG_INCLUDE_DEBUG 1
    201 #endif
    202 
    203 
    204 /*
    205  * Support FILE IO
    206  */
    207 #ifndef CINT_CONFIG_FILE_IO
    208 #define CINT_CONFIG_FILE_IO 1
    209 #endif
    210 
    211 
    212 /*
    213  * Support the #include directive.
    214  * Requires CINT_CONFIG_FILE_IO=1
    215  */
    216 #ifndef CINT_CONFIG_INCLUDE_XINCLUDE
    217 #define CINT_CONFIG_INCLUDE_XINCLUDE 1
    218 #endif
    219 
    220 /* check for config consistency */
    221 #if CINT_CONFIG_INCLUDE_XINCLUDE == 1
    222 #if CINT_CONFIG_FILE_IO == 0
    223 #error CINT_CONFIG_INCLUDE_XINCLUDE requires CINT_CONFIG_FILE_IO=1
    224 #endif
    225 #endif
    226 
    227 /*
    228  * Maximum include depth when #includes are supported 
    229  */
    230 #ifndef CINT_CONFIG_XINCLUDE_DEPTH_MAX
    231 #define CINT_CONFIG_XINCLUDE_DEPTH_MAX 128
    232 #endif
    233 
    234 /*
    235  * Assume and use stdlib functionality for all portability macros
    236  * that are otherwise undefined. 
    237  */
    238 #ifndef CINT_CONFIG_INCLUDE_STDLIB
    239 #define CINT_CONFIG_INCLUDE_STDLIB 0
    240 #endif
    241 
    242 /*
    243  * Include test interface data
    244  */
    245 #ifndef CINT_CONFIG_INCLUDE_TEST_DATA
    246 #define CINT_CONFIG_INCLUDE_TEST_DATA 0
    247 #endif
    248 
    249 /*
    250  * Include POSIX timer interface
    251  */
    252 #ifndef CINT_CONFIG_INCLUDE_POSIX_TIMER
    253 #define CINT_CONFIG_INCLUDE_POSIX_TIMER 1
    254 #endif
    255 
    256 /*
    257  * Assume SDK SAL functionality for all portability macros
    258  * that are otherwise undefined.
    259  */
    260 #ifndef CINT_CONFIG_INCLUDE_SDK_SAL
    261 #define CINT_CONFIG_INCLUDE_SDK_SAL 0
    262 #endif
    263 
    264 /* check for config consistency */
    265 #if CINT_CONFIG_INCLUDE_STDLIB == 1
    266 #if CINT_CONFIG_INCLUDE_SDK_SAL != 0
    267 #error Cannot set CINT_CONFIG_INCLUDE_STDLIB and CINT_CONFIG_INCLUDE_SDK_SAL
    268 #endif
    269 #if CINT_CONFIG_INCLUDE_STUBS != 0
    270 #error Cannot set CINT_CONFIG_INCLUDE_STDLIB and CINT_CONFIG_INCLUDE_STUBS
    271 #endif
    272 #elif CINT_CONFIG_INCLUDE_SDK_SAL == 1
    273 #if CINT_CONFIG_INCLUDE_STUBS != 0
    274 #error Cannot set CINT_CONFIG_INCLUDE_SDK_SAL and CINT_CONFIG_INCLUDE_STUBS
    275 #endif
    276 #elif CINT_CONFIG_INCLUDE_STUBS == 1
    277 /* conflicts would have been caught earlier */
    278 #else
    279 #error Must define one of CINT_CONFIG_INCLUDE_{STDLIB,SDK_SAL,STUBS}
    280 #endif
    281 
    282 /*
    283  * Include YAML API interface 
    284  *
    285  * Adds cint command "yapi" to print a YAML formatted dump of the CINT
    286  * datatype database. Primarily used for SDK API analysis.
    287  */
    288 #ifndef CINT_CONFIG_YAPI
    289 #define CINT_CONFIG_YAPI 0
    290 #endif
    291 
    292 
    293 /*
    294  * CINT generally requires requires POSIX extensions, which aren't
    295  * usually available if __STRICT_ANSI__ is defined.
    296  */
    297 #ifdef __STRICT_ANSI__
    298 #ifndef _GNU_SOURCE
    299 #define _GNU_SOURCE
    300 #endif
    301 #endif
    302 
    303 /*
    304  * CINT Logger - disabled by default
    305  */
    306 #ifndef CINT_CONFIG_INCLUDE_CINT_LOGGER
    307 #define CINT_CONFIG_INCLUDE_CINT_LOGGER 0
    308 #endif
    309 
    310 #endif /* __CINT_CONFIG_H__ */
    311 
    312 
    313 
    314