Home | History | Annotate | Download | only in Include
      1 /** @file
      2   The header <limits.h> defines several macros that expand to various limits and
      3   parameters of the standard integer types.
      4 
      5   The values given below are constant expressions suitable for
      6   use in #if preprocessing directives. Except for CHAR_BIT and
      7   MB_LEN_MAX, they have the same
      8   type as would an expression that is an object of the corresponding type
      9   converted according to the integer promotions.
     10 
     11   Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>
     12   This program and the accompanying materials are licensed and made available under
     13   the terms and conditions of the BSD License that accompanies this distribution.
     14   The full text of the license may be found at
     15   http://opensource.org/licenses/bsd-license.
     16 
     17   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     19 **/
     20 #ifndef _LIMITS_H
     21 #define _LIMITS_H
     22 #include  <sys/EfiCdefs.h>
     23 #include  <Library/PcdLib.h>
     24 
     25 /* Get the architecturally defined limits for this compilation unit. */
     26 #include  <machine/limits.h>
     27 
     28 /* Define the values required by the ISO/IEC 9899 Specification. */
     29 
     30 /** Maximum number of bytes in a multibyte character, for any supported locale. **/
     31 #define MB_LEN_MAX  4               /* UTF-8 can require up to 4 bytes */
     32 
     33 /** Number of bits comprising the smallest object that is not a bit-field (byte). **/
     34 #define CHAR_BIT    __CHAR_BIT
     35 
     36 /** Minimum value for an object of type signed char. **/
     37 #define SCHAR_MIN   __SCHAR_MIN
     38 
     39 /** Maximum value for an object of type signed char. **/
     40 #define SCHAR_MAX   __SCHAR_MAX
     41 
     42 /** Maximum value for an object of type unsigned char. **/
     43 #define UCHAR_MAX   __UCHAR_MAX
     44 
     45 #ifdef __CHAR_UNSIGNED__
     46   /** Maximum value for an object of type char. **/
     47   #define CHAR_MAX  UCHAR_MAX
     48   /** Minimum value for an object of type char. **/
     49   #define CHAR_MIN  0
     50 #else
     51   /** Maximum value for an object of type char. **/
     52   #define CHAR_MAX  SCHAR_MAX
     53   /** Minimum value for an object of type char. **/
     54   #define CHAR_MIN  SCHAR_MIN
     55 #endif
     56 
     57 /** Minimum value for an object of type short int. **/
     58 #define SHRT_MIN    __SHRT_MIN
     59 
     60 /** Maximum value for an object of type short int. **/
     61 #define SHRT_MAX    __SHRT_MAX
     62 
     63 /** Maximum value for an object of type unsigned short int. **/
     64 #define USHRT_MAX   __USHRT_MAX
     65 
     66 /** Minimum value for an object of type int. **/
     67 #define INT_MIN     __INT_MIN
     68 
     69 /** Maximum value for an object of type int. **/
     70 #define INT_MAX     __INT_MAX
     71 
     72 /** Maximum value for an object of type unsigned int. **/
     73 #define UINT_MAX    __UINT_MAX
     74 
     75 /** Minimum value for an object of type long int. **/
     76 #define LONG_MIN    __LONG_MIN
     77 
     78 /** Maximum value for an object of type long int. **/
     79 #define LONG_MAX    __LONG_MAX
     80 
     81 /** Maximum value for an object of type unsigned long int. **/
     82 #define ULONG_MAX   __ULONG_MAX
     83 
     84 /** Minimum value for an object of type long long int. **/
     85 #define LLONG_MIN   __LLONG_MIN
     86 
     87 /** Maximum value for an object of type long long int. **/
     88 #define LLONG_MAX   __LLONG_MAX
     89 
     90 /** Maximum value for an object of type unsigned long long int. **/
     91 #define ULLONG_MAX  __ULLONG_MAX
     92 
     93 /* Object limits used in the Standard Libraries */
     94 #if (PcdGet32(PcdMaximumAsciiStringLength) > 0)
     95   /** Maximum length of an arbitrary "narrow-character" string. **/
     96   #define ASCII_STRING_MAX    PcdGet32(PcdMaximumAsciiStringLength)
     97 #else
     98   /** Maximum length of an arbitrary "narrow-character" string. **/
     99   #define ASCII_STRING_MAX    256
    100 #endif
    101 
    102 #if (PcdGet32(PcdMaximumUnicodeStringLength) > 0)
    103   /** Maximum length of an arbitrary "wide-character" string. **/
    104   #define UNICODE_STRING_MAX    PcdGet32(PcdMaximumUnicodeStringLength)
    105 #else
    106   /** Maximum length of an arbitrary "wide-character" string. **/
    107   #define UNICODE_STRING_MAX    512
    108 #endif
    109 
    110 /* Limits for BSD Compatibility */
    111 #define NL_TEXTMAX    2048
    112 
    113 #include  <sys/syslimits.h>
    114 
    115 #endif  /* _LIMITS_H */
    116