Blame glib/pcre/pcre_config.c

Packit ae235b
/*************************************************
Packit ae235b
*      Perl-Compatible Regular Expressions       *
Packit ae235b
*************************************************/
Packit ae235b
Packit ae235b
/* PCRE is a library of functions to support regular expressions whose syntax
Packit ae235b
and semantics are as close as possible to those of the Perl 5 language.
Packit ae235b
Packit ae235b
                       Written by Philip Hazel
Packit ae235b
           Copyright (c) 1997-2012 University of Cambridge
Packit ae235b
Packit ae235b
-----------------------------------------------------------------------------
Packit ae235b
Redistribution and use in source and binary forms, with or without
Packit ae235b
modification, are permitted provided that the following conditions are met:
Packit ae235b
Packit ae235b
    * Redistributions of source code must retain the above copyright notice,
Packit ae235b
      this list of conditions and the following disclaimer.
Packit ae235b
Packit ae235b
    * Redistributions in binary form must reproduce the above copyright
Packit ae235b
      notice, this list of conditions and the following disclaimer in the
Packit ae235b
      documentation and/or other materials provided with the distribution.
Packit ae235b
Packit ae235b
    * Neither the name of the University of Cambridge nor the names of its
Packit ae235b
      contributors may be used to endorse or promote products derived from
Packit ae235b
      this software without specific prior written permission.
Packit ae235b
Packit ae235b
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit ae235b
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Packit ae235b
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit ae235b
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
Packit ae235b
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Packit ae235b
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Packit ae235b
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Packit ae235b
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Packit ae235b
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Packit ae235b
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Packit ae235b
POSSIBILITY OF SUCH DAMAGE.
Packit ae235b
-----------------------------------------------------------------------------
Packit ae235b
*/
Packit ae235b
Packit ae235b
Packit ae235b
/* This module contains the external function pcre_config(). */
Packit ae235b
Packit ae235b
Packit ae235b
#include "config.h"
Packit ae235b
Packit ae235b
/* Keep the original link size. */
Packit ae235b
static int real_link_size = LINK_SIZE;
Packit ae235b
Packit ae235b
#include "pcre_internal.h"
Packit ae235b
Packit ae235b
Packit ae235b
/*************************************************
Packit ae235b
* Return info about what features are configured *
Packit ae235b
*************************************************/
Packit ae235b
Packit ae235b
/* This function has an extensible interface so that additional items can be
Packit ae235b
added compatibly.
Packit ae235b
Packit ae235b
Arguments:
Packit ae235b
  what             what information is required
Packit ae235b
  where            where to put the information
Packit ae235b
Packit ae235b
Returns:           0 if data returned, negative on error
Packit ae235b
*/
Packit ae235b
Packit ae235b
#ifdef COMPILE_PCRE8
Packit ae235b
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
Packit ae235b
pcre_config(int what, void *where)
Packit ae235b
#else
Packit ae235b
PCRE_EXP_DEFN int PCRE_CALL_CONVENTION
Packit ae235b
pcre16_config(int what, void *where)
Packit ae235b
#endif
Packit ae235b
{
Packit ae235b
switch (what)
Packit ae235b
  {
Packit ae235b
  case PCRE_CONFIG_UTF8:
Packit ae235b
#if defined COMPILE_PCRE16
Packit ae235b
  *((int *)where) = 0;
Packit ae235b
  return PCRE_ERROR_BADOPTION;
Packit ae235b
#else
Packit ae235b
#if defined SUPPORT_UTF
Packit ae235b
  *((int *)where) = 1;
Packit ae235b
#else
Packit ae235b
  *((int *)where) = 0;
Packit ae235b
#endif
Packit ae235b
  break;
Packit ae235b
#endif
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_UTF16:
Packit ae235b
#if defined COMPILE_PCRE8
Packit ae235b
  *((int *)where) = 0;
Packit ae235b
  return PCRE_ERROR_BADOPTION;
Packit ae235b
#else
Packit ae235b
#if defined SUPPORT_UTF
Packit ae235b
  *((int *)where) = 1;
Packit ae235b
#else
Packit ae235b
  *((int *)where) = 0;
Packit ae235b
#endif
Packit ae235b
  break;
Packit ae235b
#endif
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_UNICODE_PROPERTIES:
Packit ae235b
#ifdef SUPPORT_UCP
Packit ae235b
  *((int *)where) = 1;
Packit ae235b
#else
Packit ae235b
  *((int *)where) = 0;
Packit ae235b
#endif
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_JIT:
Packit ae235b
#ifdef SUPPORT_JIT
Packit ae235b
  *((int *)where) = 1;
Packit ae235b
#else
Packit ae235b
  *((int *)where) = 0;
Packit ae235b
#endif
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_JITTARGET:
Packit ae235b
#ifdef SUPPORT_JIT
Packit ae235b
  *((const char **)where) = PRIV(jit_get_target)();
Packit ae235b
#else
Packit ae235b
  *((const char **)where) = NULL;
Packit ae235b
#endif
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_NEWLINE:
Packit ae235b
  *((int *)where) = NEWLINE;
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_BSR:
Packit ae235b
#ifdef BSR_ANYCRLF
Packit ae235b
  *((int *)where) = 1;
Packit ae235b
#else
Packit ae235b
  *((int *)where) = 0;
Packit ae235b
#endif
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_LINK_SIZE:
Packit ae235b
  *((int *)where) = real_link_size;
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_POSIX_MALLOC_THRESHOLD:
Packit ae235b
  *((int *)where) = POSIX_MALLOC_THRESHOLD;
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_MATCH_LIMIT:
Packit ae235b
  *((unsigned long int *)where) = MATCH_LIMIT;
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_MATCH_LIMIT_RECURSION:
Packit ae235b
  *((unsigned long int *)where) = MATCH_LIMIT_RECURSION;
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  case PCRE_CONFIG_STACKRECURSE:
Packit ae235b
#ifdef NO_RECURSE
Packit ae235b
  *((int *)where) = 0;
Packit ae235b
#else
Packit ae235b
  *((int *)where) = 1;
Packit ae235b
#endif
Packit ae235b
  break;
Packit ae235b
Packit ae235b
  default: return PCRE_ERROR_BADOPTION;
Packit ae235b
  }
Packit ae235b
Packit ae235b
return 0;
Packit ae235b
}
Packit ae235b
Packit ae235b
/* End of pcre_config.c */