Annotation of parser3/src/include/pa_types.h, revision 1.58

1.17      paf         1: /** @file
1.18      paf         2:        Parser: generally used types & constants decls.
                      3: 
1.56      moko        4:        Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com)
                      5:        Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru>
1.2       paf         6: */
                      7: 
1.1       paf         8: #ifndef PA_TYPES_H
                      9: #define PA_TYPES_H
1.42      paf        10: 
1.58    ! moko       11: #define IDENT_PA_TYPES_H "$Id: pa_types.h,v 1.57 2023/11/16 23:54:54 moko Exp $"
1.1       paf        12: 
1.23      paf        13: #include "pa_config_includes.h"
1.4       paf        14: 
1.17      paf        15: /// for rare cases of undefined length using this-sized strings
1.15      paf        16: #define MAX_STRING 0x400
1.50      misha      17: /// buffer size for parser.log
                     18: #define MAX_LOG_STRING 0x400*4
1.17      paf        19: /// for snprintf(buf, MAX_NUMBER, "%.2f")
1.12      paf        20: #define MAX_NUMBER 40
1.2       paf        21: 
1.40      paf        22: //{@ handy types
1.34      paf        23: #undef uchar
                     24: typedef unsigned char uchar;
                     25: 
1.33      paf        26: #undef ushort
                     27: typedef unsigned short ushort;
1.34      paf        28: 
1.1       paf        29: #undef uint
1.33      paf        30: typedef unsigned int uint;
1.34      paf        31: 
1.24      paf        32: #undef ulong
                     33: typedef unsigned long ulong;
1.40      paf        34: //}@
1.2       paf        35: 
1.53      moko       36: #ifndef LLONG_MAX
                     37: #define LLONG_MAX 9223372036854775807LL
                     38: #endif
                     39: 
                     40: #ifndef ULLONG_MAX
                     41: #define ULLONG_MAX 18446744073709551615ULL
                     42: #endif
                     43: 
1.57      moko       44: #ifndef SSIZE_MAX
1.58    ! moko       45: #define SSIZE_MAX (sizeof(size_t)==4 ? INT_MAX : LLONG_MAX)
1.53      moko       46: #endif
                     47: 
1.57      moko       48: inline int clip2int(double value) {
                     49:        return value <= INT_MIN ? INT_MIN : ( value >= INT_MAX ? INT_MAX : (int)value );
                     50: }
                     51: 
                     52: inline uint clip2uint(double value) {
                     53:        return value <= 0 ? 0 : ( value >= UINT_MAX ? UINT_MAX : (uint)value );
                     54: }
1.53      moko       55: 
1.1       paf        56: 
                     57: #endif

E-mail: