/vendor/pcre/pcre_config.c

http://github.com/feyeleanor/RubyGoLightly · C · 128 lines · 56 code · 21 blank · 51 comment · 1 complexity · 194a913fe404747d3bf814e784fece73 MD5 · raw file

  1. /*************************************************
  2. * Perl-Compatible Regular Expressions *
  3. *************************************************/
  4. /* PCRE is a library of functions to support regular expressions whose syntax
  5. and semantics are as close as possible to those of the Perl 5 language.
  6. Written by Philip Hazel
  7. Copyright (c) 1997-2008 University of Cambridge
  8. -----------------------------------------------------------------------------
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. * Redistributions of source code must retain the above copyright notice,
  12. this list of conditions and the following disclaimer.
  13. * Redistributions in binary form must reproduce the above copyright
  14. notice, this list of conditions and the following disclaimer in the
  15. documentation and/or other materials provided with the distribution.
  16. * Neither the name of the University of Cambridge nor the names of its
  17. contributors may be used to endorse or promote products derived from
  18. this software without specific prior written permission.
  19. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  20. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  23. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29. POSSIBILITY OF SUCH DAMAGE.
  30. -----------------------------------------------------------------------------
  31. */
  32. /* This module contains the external function pcre_config(). */
  33. #ifdef HAVE_CONFIG_H
  34. #include "config.h"
  35. #endif
  36. #include "pcre_internal.h"
  37. /*************************************************
  38. * Return info about what features are configured *
  39. *************************************************/
  40. /* This function has an extensible interface so that additional items can be
  41. added compatibly.
  42. Arguments:
  43. what what information is required
  44. where where to put the information
  45. Returns: 0 if data returned, negative on error
  46. */
  47. PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
  48. pcre_config(int what, void *where)
  49. {
  50. switch (what)
  51. {
  52. case PCRE_CONFIG_UTF8:
  53. #ifdef SUPPORT_UTF8
  54. *((int *)where) = 1;
  55. #else
  56. *((int *)where) = 0;
  57. #endif
  58. break;
  59. case PCRE_CONFIG_UNICODE_PROPERTIES:
  60. #ifdef SUPPORT_UCP
  61. *((int *)where) = 1;
  62. #else
  63. *((int *)where) = 0;
  64. #endif
  65. break;
  66. case PCRE_CONFIG_NEWLINE:
  67. *((int *)where) = NEWLINE;
  68. break;
  69. case PCRE_CONFIG_BSR:
  70. #ifdef BSR_ANYCRLF
  71. *((int *)where) = 1;
  72. #else
  73. *((int *)where) = 0;
  74. #endif
  75. break;
  76. case PCRE_CONFIG_LINK_SIZE:
  77. *((int *)where) = LINK_SIZE;
  78. break;
  79. case PCRE_CONFIG_POSIX_MALLOC_THRESHOLD:
  80. *((int *)where) = POSIX_MALLOC_THRESHOLD;
  81. break;
  82. case PCRE_CONFIG_MATCH_LIMIT:
  83. *((unsigned int *)where) = MATCH_LIMIT;
  84. break;
  85. case PCRE_CONFIG_MATCH_LIMIT_RECURSION:
  86. *((unsigned int *)where) = MATCH_LIMIT_RECURSION;
  87. break;
  88. case PCRE_CONFIG_STACKRECURSE:
  89. #ifdef NO_RECURSE
  90. *((int *)where) = 0;
  91. #else
  92. *((int *)where) = 1;
  93. #endif
  94. break;
  95. default: return PCRE_ERROR_BADOPTION;
  96. }
  97. return 0;
  98. }
  99. /* End of pcre_config.c */