Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:05:30

0001 /*
0002  *  qp_dimension.h  --
0003  *  The static type description
0004  *
0005  *  Original:  1-Nov-1994 15:46
0006  *
0007  *  Author:   Maarten Ballintijn <Maarten.Ballintijn@cern.ch>
0008  *
0009  *  $Id$
0010  *
0011  *  $Log$
0012  *  Revision 1.7  1996/04/23 18:38:15  maartenb
0013  *  - Add RCS keywords
0014  *
0015  *
0016  */
0017 
0018 #ifndef CERN_DIMENSION
0019 #define CERN_DIMENSION
0020 
0021 #include    <stdio.h>
0022 
0023 
0024 #include    "cern_types.h"
0025 #include    "hbook_defs.h"
0026 
0027 
0028 typedef int STIndex;
0029 #define STI_INVALID ((STIndex) -1)
0030 
0031 typedef enum _data_type_ {
0032     D_BOOL,         /* the order of the numeric types */
0033     D_UINT,         /* should not be changed !    */
0034     D_ULONG,        /* see type promotion, fcode, etc.*/
0035     D_INT,
0036     D_LONG,
0037     D_FLOAT,
0038     D_DOUBLE,
0039     D_STR,
0040     D_UNDEF,
0041     D_LAST
0042 } DataType;
0043 
0044 
0045 #define D_BOOL_MIN  FALSE
0046 #define D_UINT_MIN  0
0047 #define D_ULONG_MIN 0
0048 #define D_INT_MIN   INT32_MIN
0049 #define D_LONG_MIN  INT64_MIN
0050 #define D_FLOAT_MIN (-FLOAT32_MAX)
0051 #define D_DOUBLE_MIN    (-FLOAT64_MAX)
0052 
0053 #define D_BOOL_MAX  TRUE
0054 #define D_UINT_MAX  UINT32_MAX
0055 #define D_ULONG_MAX UINT64_MAX
0056 #define D_INT_MAX   INT32_MAX
0057 #define D_LONG_MAX  INT64_MAX
0058 #define D_FLOAT_MAX FLOAT32_MAX
0059 #define D_DOUBLE_MAX    FLOAT64_MAX
0060 
0061 
0062 typedef struct _dimension_ {
0063     DataType    dtyp;       /* The basic type */
0064 
0065     bool        isRange;    /* for integer types */
0066     int     ilow, iup;
0067 
0068     int     strSize;    /* for strings */
0069 
0070     int     ndim;       /* == 0 for scalars */
0071     STIndex     idx;        /* last dimension is dynamic */
0072                     /* points to symtab definition */
0073     int     range[MAX_DIMENSION];   /* the range for each */
0074                         /* dimension */
0075     int     max_range[MAX_DIMENSION]; /* the maximum value a */
0076                             /* range can have */
0077 } Dimension;
0078 
0079 
0080 #define MAX_ALIGN   (~1)
0081 
0082 extern long const   datatype_align[];
0083 extern int const    datatype_size[];
0084 extern DataType const   datatype_signed[];
0085 
0086 
0087 Dimension *
0088 dim_new( DataType dtyp );
0089 
0090 Dimension *
0091 dim_copy( Dimension * d );
0092 
0093 Dimension *
0094 dim_combine( DataType dtyp, Dimension * d1, Dimension * d2 );
0095 
0096 Dimension *
0097 dim_combine3(
0098     DataType        dtyp,
0099     Dimension *     d1,
0100     Dimension *     d2,
0101     Dimension *     d3
0102 );
0103 
0104 void
0105 dim_del( Dimension * d );
0106 
0107 bool
0108 dim_static( Dimension * d );
0109 
0110 int
0111 dim_maxsize( Dimension * d );
0112 
0113 void
0114 dump_dimension( FILE * const fp, Dimension * d );
0115 
0116 void
0117 print_dimension( FILE * const fp, Dimension * d );
0118 
0119 const char *
0120 datatype_to_str( DataType dtyp );
0121 
0122 
0123 #endif  /*  CERN_DIMENSION  */