From 64c81e40d4706d3685d540febb06e28609641aa4 Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 16 Jul 2014 03:27:25 +0000 Subject: * regcomp.c: Merge Onigmo 5.14.1 25a8a69fc05ae3b56a09. this includes Support for Unicode 7.0 [Bug #9092]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- regint.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 7 deletions(-) (limited to 'regint.h') diff --git a/regint.h b/regint.h index a3e92ee217..5543ca83fc 100644 --- a/regint.h +++ b/regint.h @@ -5,7 +5,7 @@ **********************************************************************/ /*- * Copyright (c) 2002-2008 K.Kosako - * Copyright (c) 2011-2012 K.Takata + * Copyright (c) 2011-2014 K.Takata * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,8 +92,6 @@ # define ARG_UNUSED #endif -/* */ -/* escape other system UChar definition */ #ifndef RUBY_DEFINES_H #include "ruby/ruby.h" #undef xmalloc @@ -101,23 +99,67 @@ #undef xcalloc #undef xfree #endif + +/* */ +/* escape other system UChar definition */ #ifdef ONIG_ESCAPE_UCHAR_COLLISION #undef ONIG_ESCAPE_UCHAR_COLLISION #endif + #define USE_WORD_BEGIN_END /* "\<": word-begin, "\>": word-end */ -#undef USE_MATCH_RANGE_IS_COMPLETE_RANGE #undef USE_CAPTURE_HISTORY #define USE_VARIABLE_META_CHARS #define USE_POSIX_API_REGION_OPTION /* needed for POSIX API support */ #define USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE /* #define USE_COMBINATION_EXPLOSION_CHECK */ /* (X*)* */ +/* multithread config */ /* #define USE_MULTI_THREAD_SYSTEM */ +/* #define USE_DEFAULT_MULTI_THREAD_SYSTEM */ + +#if defined(USE_MULTI_THREAD_SYSTEM) \ + && defined(USE_DEFAULT_MULTI_THREAD_SYSTEM) + +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +extern CRITICAL_SECTION gOnigMutex; +#define THREAD_SYSTEM_INIT InitializeCriticalSection(&gOnigMutex) +#define THREAD_SYSTEM_END DeleteCriticalSection(&gOnigMutex) +#define THREAD_ATOMIC_START EnterCriticalSection(&gOnigMutex) +#define THREAD_ATOMIC_END LeaveCriticalSection(&gOnigMutex) +#define THREAD_PASS Sleep(0) +#else /* _WIN32 */ +#include +#include +extern pthread_mutex_t gOnigMutex; +#define THREAD_SYSTEM_INIT pthread_mutex_init(&gOnigMutex, NULL) +#define THREAD_SYSTEM_END pthread_mutex_destroy(&gOnigMutex) +#define THREAD_ATOMIC_START pthread_mutex_lock(&gOnigMutex) +#define THREAD_ATOMIC_END pthread_mutex_unlock(&gOnigMutex) +#define THREAD_PASS sched_yield() +#endif /* _WIN32 */ + +#else /* USE_DEFAULT_MULTI_THREAD_SYSTEM */ + +#ifndef THREAD_SYSTEM_INIT #define THREAD_SYSTEM_INIT /* depend on thread system */ +#endif +#ifndef THREAD_SYSTEM_END #define THREAD_SYSTEM_END /* depend on thread system */ +#endif +#ifndef THREAD_ATOMIC_START #define THREAD_ATOMIC_START /* depend on thread system */ +#endif +#ifndef THREAD_ATOMIC_END #define THREAD_ATOMIC_END /* depend on thread system */ +#endif +#ifndef THREAD_PASS #define THREAD_PASS /* depend on thread system */ +#endif + +#endif /* USE_DEFAULT_MULTI_THREAD_SYSTEM */ + #ifndef xmalloc #define xmalloc malloc #define xrealloc realloc @@ -235,12 +277,16 @@ # include #endif +#ifdef HAVE_INTTYPES_H +# include +#endif + #ifdef STDC_HEADERS # include #endif -#ifdef __BORLANDC__ -#include +#ifdef _WIN32 +#include /* for alloca() */ #endif #ifdef ONIG_DEBUG @@ -260,6 +306,18 @@ typedef unsigned int uintptr_t; #endif #endif /* _WIN32 */ +#ifndef PRIdPTR +#ifdef _WIN64 +#define PRIdPTR "I64d" +#define PRIuPTR "I64u" +#define PRIxPTR "I64x" +#else +#define PRIdPTR "ld" +#define PRIuPTR "lu" +#define PRIxPTR "lx" +#endif +#endif + #include "regenc.h" RUBY_SYMBOL_EXPORT_BEGIN @@ -366,6 +424,8 @@ typedef unsigned int BitStatusType; (ONIG_OPTION_FIND_LONGEST | ONIG_OPTION_FIND_NOT_EMPTY)) #define IS_NOTBOL(option) ((option) & ONIG_OPTION_NOTBOL) #define IS_NOTEOL(option) ((option) & ONIG_OPTION_NOTEOL) +#define IS_NOTBOS(option) ((option) & ONIG_OPTION_NOTBOS) +#define IS_NOTEOS(option) ((option) & ONIG_OPTION_NOTEOS) #define IS_POSIX_REGION(option) ((option) & ONIG_OPTION_POSIX_REGION) #define IS_ASCII_RANGE(option) ((option) & ONIG_OPTION_ASCII_RANGE) #define IS_POSIX_BRACKET_ALL_RANGE(option) ((option) & ONIG_OPTION_POSIX_BRACKET_ALL_RANGE) @@ -852,7 +912,9 @@ typedef struct { extern OnigOpInfoType OnigOpInfo[]; -/* extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc)); */ +#ifdef ONIG_DEBUG +extern void onig_print_compiled_byte_code P_((FILE* f, UChar* bp, UChar* bpend, UChar** nextp, OnigEncoding enc)); +#endif #ifdef ONIG_DEBUG_STATISTICS extern void onig_statistics_init P_((void)); -- cgit v1.2.1