[build] vendor the parts of ICU we need
This commit is contained in:
committed by
Konstantin Käfer
parent
679d66f36d
commit
f006eb9728
414
vendor/icu/LICENSE
vendored
Normal file
414
vendor/icu/LICENSE
vendored
Normal file
@@ -0,0 +1,414 @@
|
||||
COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)
|
||||
|
||||
Copyright © 1991-2018 Unicode, Inc. All rights reserved.
|
||||
Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Unicode data files and any associated documentation
|
||||
(the "Data Files") or Unicode software and any associated documentation
|
||||
(the "Software") to deal in the Data Files or Software
|
||||
without restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, and/or sell copies of
|
||||
the Data Files or Software, and to permit persons to whom the Data Files
|
||||
or Software are furnished to do so, provided that either
|
||||
(a) this copyright and permission notice appear with all copies
|
||||
of the Data Files or Software, or
|
||||
(b) this copyright and permission notice appear in associated
|
||||
Documentation.
|
||||
|
||||
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
|
||||
NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THE DATA FILES OR SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale,
|
||||
use or other dealings in these Data Files or Software without prior
|
||||
written authorization of the copyright holder.
|
||||
|
||||
---------------------
|
||||
|
||||
Third-Party Software Licenses
|
||||
|
||||
This section contains third-party software notices and/or additional
|
||||
terms for licensed third-party software components included within ICU
|
||||
libraries.
|
||||
|
||||
1. ICU License - ICU 1.8.1 to ICU 57.1
|
||||
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 1995-2016 International Business Machines Corporation and others
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, and/or sell copies of the Software, and to permit persons
|
||||
to whom the Software is furnished to do so, provided that the above
|
||||
copyright notice(s) and this permission notice appear in all copies of
|
||||
the Software and that both the above copyright notice(s) and this
|
||||
permission notice appear in supporting documentation.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
|
||||
SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder
|
||||
shall not be used in advertising or otherwise to promote the sale, use
|
||||
or other dealings in this Software without prior written authorization
|
||||
of the copyright holder.
|
||||
|
||||
All trademarks and registered trademarks mentioned herein are the
|
||||
property of their respective owners.
|
||||
|
||||
2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt)
|
||||
|
||||
# The Google Chrome software developed by Google is licensed under
|
||||
# the BSD license. Other software included in this distribution is
|
||||
# provided under other licenses, as set forth below.
|
||||
#
|
||||
# The BSD License
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# Copyright (C) 2006-2008, Google Inc.
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided with
|
||||
# the distribution.
|
||||
# Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#
|
||||
# The word list in cjdict.txt are generated by combining three word lists
|
||||
# listed below with further processing for compound word breaking. The
|
||||
# frequency is generated with an iterative training against Google web
|
||||
# corpora.
|
||||
#
|
||||
# * Libtabe (Chinese)
|
||||
# - https://sourceforge.net/project/?group_id=1519
|
||||
# - Its license terms and conditions are shown below.
|
||||
#
|
||||
# * IPADIC (Japanese)
|
||||
# - http://chasen.aist-nara.ac.jp/chasen/distribution.html
|
||||
# - Its license terms and conditions are shown below.
|
||||
#
|
||||
# ---------COPYING.libtabe ---- BEGIN--------------------
|
||||
#
|
||||
# /*
|
||||
# * Copyright (c) 1999 TaBE Project.
|
||||
# * Copyright (c) 1999 Pai-Hsiang Hsiao.
|
||||
# * All rights reserved.
|
||||
# *
|
||||
# * Redistribution and use in source and binary forms, with or without
|
||||
# * modification, are permitted provided that the following conditions
|
||||
# * are met:
|
||||
# *
|
||||
# * . Redistributions of source code must retain the above copyright
|
||||
# * notice, this list of conditions and the following disclaimer.
|
||||
# * . Redistributions in binary form must reproduce the above copyright
|
||||
# * notice, this list of conditions and the following disclaimer in
|
||||
# * the documentation and/or other materials provided with the
|
||||
# * distribution.
|
||||
# * . Neither the name of the TaBE Project nor the names of its
|
||||
# * contributors may be used to endorse or promote products derived
|
||||
# * from this software without specific prior written permission.
|
||||
# *
|
||||
# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
# * OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# */
|
||||
#
|
||||
# /*
|
||||
# * Copyright (c) 1999 Computer Systems and Communication Lab,
|
||||
# * Institute of Information Science, Academia
|
||||
# * Sinica. All rights reserved.
|
||||
# *
|
||||
# * Redistribution and use in source and binary forms, with or without
|
||||
# * modification, are permitted provided that the following conditions
|
||||
# * are met:
|
||||
# *
|
||||
# * . Redistributions of source code must retain the above copyright
|
||||
# * notice, this list of conditions and the following disclaimer.
|
||||
# * . Redistributions in binary form must reproduce the above copyright
|
||||
# * notice, this list of conditions and the following disclaimer in
|
||||
# * the documentation and/or other materials provided with the
|
||||
# * distribution.
|
||||
# * . Neither the name of the Computer Systems and Communication Lab
|
||||
# * nor the names of its contributors may be used to endorse or
|
||||
# * promote products derived from this software without specific
|
||||
# * prior written permission.
|
||||
# *
|
||||
# * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
# * OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# */
|
||||
#
|
||||
# Copyright 1996 Chih-Hao Tsai @ Beckman Institute,
|
||||
# University of Illinois
|
||||
# c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4
|
||||
#
|
||||
# ---------------COPYING.libtabe-----END--------------------------------
|
||||
#
|
||||
#
|
||||
# ---------------COPYING.ipadic-----BEGIN-------------------------------
|
||||
#
|
||||
# Copyright 2000, 2001, 2002, 2003 Nara Institute of Science
|
||||
# and Technology. All Rights Reserved.
|
||||
#
|
||||
# Use, reproduction, and distribution of this software is permitted.
|
||||
# Any copy of this software, whether in its original form or modified,
|
||||
# must include both the above copyright notice and the following
|
||||
# paragraphs.
|
||||
#
|
||||
# Nara Institute of Science and Technology (NAIST),
|
||||
# the copyright holders, disclaims all warranties with regard to this
|
||||
# software, including all implied warranties of merchantability and
|
||||
# fitness, in no event shall NAIST be liable for
|
||||
# any special, indirect or consequential damages or any damages
|
||||
# whatsoever resulting from loss of use, data or profits, whether in an
|
||||
# action of contract, negligence or other tortuous action, arising out
|
||||
# of or in connection with the use or performance of this software.
|
||||
#
|
||||
# A large portion of the dictionary entries
|
||||
# originate from ICOT Free Software. The following conditions for ICOT
|
||||
# Free Software applies to the current dictionary as well.
|
||||
#
|
||||
# Each User may also freely distribute the Program, whether in its
|
||||
# original form or modified, to any third party or parties, PROVIDED
|
||||
# that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
|
||||
# on, or be attached to, the Program, which is distributed substantially
|
||||
# in the same form as set out herein and that such intended
|
||||
# distribution, if actually made, will neither violate or otherwise
|
||||
# contravene any of the laws and regulations of the countries having
|
||||
# jurisdiction over the User or the intended distribution itself.
|
||||
#
|
||||
# NO WARRANTY
|
||||
#
|
||||
# The program was produced on an experimental basis in the course of the
|
||||
# research and development conducted during the project and is provided
|
||||
# to users as so produced on an experimental basis. Accordingly, the
|
||||
# program is provided without any warranty whatsoever, whether express,
|
||||
# implied, statutory or otherwise. The term "warranty" used herein
|
||||
# includes, but is not limited to, any warranty of the quality,
|
||||
# performance, merchantability and fitness for a particular purpose of
|
||||
# the program and the nonexistence of any infringement or violation of
|
||||
# any right of any third party.
|
||||
#
|
||||
# Each user of the program will agree and understand, and be deemed to
|
||||
# have agreed and understood, that there is no warranty whatsoever for
|
||||
# the program and, accordingly, the entire risk arising from or
|
||||
# otherwise connected with the program is assumed by the user.
|
||||
#
|
||||
# Therefore, neither ICOT, the copyright holder, or any other
|
||||
# organization that participated in or was otherwise related to the
|
||||
# development of the program and their respective officials, directors,
|
||||
# officers and other employees shall be held liable for any and all
|
||||
# damages, including, without limitation, general, special, incidental
|
||||
# and consequential damages, arising out of or otherwise in connection
|
||||
# with the use or inability to use the program or any product, material
|
||||
# or result produced or otherwise obtained by using the program,
|
||||
# regardless of whether they have been advised of, or otherwise had
|
||||
# knowledge of, the possibility of such damages at any time during the
|
||||
# project or thereafter. Each user will be deemed to have agreed to the
|
||||
# foregoing by his or her commencement of use of the program. The term
|
||||
# "use" as used herein includes, but is not limited to, the use,
|
||||
# modification, copying and distribution of the program and the
|
||||
# production of secondary products from the program.
|
||||
#
|
||||
# In the case where the program, whether in its original form or
|
||||
# modified, was distributed or delivered to or received by a user from
|
||||
# any person, organization or entity other than ICOT, unless it makes or
|
||||
# grants independently of ICOT any specific warranty to the user in
|
||||
# writing, such person, organization or entity, will also be exempted
|
||||
# from and not be held liable to the user for any such damages as noted
|
||||
# above as far as the program is concerned.
|
||||
#
|
||||
# ---------------COPYING.ipadic-----END----------------------------------
|
||||
|
||||
3. Lao Word Break Dictionary Data (laodict.txt)
|
||||
|
||||
# Copyright (c) 2013 International Business Machines Corporation
|
||||
# and others. All Rights Reserved.
|
||||
#
|
||||
# Project: http://code.google.com/p/lao-dictionary/
|
||||
# Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
|
||||
# License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
|
||||
# (copied below)
|
||||
#
|
||||
# This file is derived from the above dictionary, with slight
|
||||
# modifications.
|
||||
# ----------------------------------------------------------------------
|
||||
# Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
#
|
||||
# Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer. Redistributions in
|
||||
# binary form must reproduce the above copyright notice, this list of
|
||||
# conditions and the following disclaimer in the documentation and/or
|
||||
# other materials provided with the distribution.
|
||||
#
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
4. Burmese Word Break Dictionary Data (burmesedict.txt)
|
||||
|
||||
# Copyright (c) 2014 International Business Machines Corporation
|
||||
# and others. All Rights Reserved.
|
||||
#
|
||||
# This list is part of a project hosted at:
|
||||
# github.com/kanyawtech/myanmar-karen-word-lists
|
||||
#
|
||||
# --------------------------------------------------------------------------
|
||||
# Copyright (c) 2013, LeRoy Benjamin Sharon
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met: Redistributions of source code must retain the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer. Redistributions in binary form must reproduce the
|
||||
# above copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# Neither the name Myanmar Karen Word Lists, nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
||||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
5. Time Zone Database
|
||||
|
||||
ICU uses the public domain data and code derived from Time Zone
|
||||
Database for its time zone support. The ownership of the TZ database
|
||||
is explained in BCP 175: Procedure for Maintaining the Time Zone
|
||||
Database section 7.
|
||||
|
||||
# 7. Database Ownership
|
||||
#
|
||||
# The TZ database itself is not an IETF Contribution or an IETF
|
||||
# document. Rather it is a pre-existing and regularly updated work
|
||||
# that is in the public domain, and is intended to remain in the
|
||||
# public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do
|
||||
# not apply to the TZ Database or contributions that individuals make
|
||||
# to it. Should any claims be made and substantiated against the TZ
|
||||
# Database, the organization that is providing the IANA
|
||||
# Considerations defined in this RFC, under the memorandum of
|
||||
# understanding with the IETF, currently ICANN, may act in accordance
|
||||
# with all competent court orders. No ownership claims will be made
|
||||
# by ICANN or the IETF Trust on the database or the code. Any person
|
||||
# making a contribution to the database or code waives all rights to
|
||||
# future claims in that contribution or in the TZ Database.
|
||||
|
||||
6. Google double-conversion
|
||||
|
||||
Copyright 2006-2011, the V8 project authors. All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
272
vendor/icu/include/unicode/bytestream.h
vendored
Normal file
272
vendor/icu/include/unicode/bytestream.h
vendored
Normal file
@@ -0,0 +1,272 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
// Copyright (C) 2009-2012, International Business Machines
|
||||
// Corporation and others. All Rights Reserved.
|
||||
//
|
||||
// Copyright 2007 Google Inc. All Rights Reserved.
|
||||
// Author: sanjay@google.com (Sanjay Ghemawat)
|
||||
//
|
||||
// Abstract interface that consumes a sequence of bytes (ByteSink).
|
||||
//
|
||||
// Used so that we can write a single piece of code that can operate
|
||||
// on a variety of output string types.
|
||||
//
|
||||
// Various implementations of this interface are provided:
|
||||
// ByteSink:
|
||||
// CheckedArrayByteSink Write to a flat array, with bounds checking
|
||||
// StringByteSink Write to an STL string
|
||||
|
||||
// This code is a contribution of Google code, and the style used here is
|
||||
// a compromise between the original Google code and the ICU coding guidelines.
|
||||
// For example, data types are ICU-ified (size_t,int->int32_t),
|
||||
// and API comments doxygen-ified, but function names and behavior are
|
||||
// as in the original, if possible.
|
||||
// Assertion-style error handling, not available in ICU, was changed to
|
||||
// parameter "pinning" similar to UnicodeString.
|
||||
//
|
||||
// In addition, this is only a partial port of the original Google code,
|
||||
// limited to what was needed so far. The (nearly) complete original code
|
||||
// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib
|
||||
// (see ICU ticket 6765, r25517).
|
||||
|
||||
#ifndef __BYTESTREAM_H__
|
||||
#define __BYTESTREAM_H__
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: Interface for writing bytes, and implementation classes.
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uobject.h>
|
||||
#include <unicode/std_string.h>
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* A ByteSink can be filled with bytes.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
class U_COMMON_API ByteSink : public UMemory {
|
||||
public:
|
||||
/**
|
||||
* Default constructor.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
ByteSink() { }
|
||||
/**
|
||||
* Virtual destructor.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
virtual ~ByteSink();
|
||||
|
||||
/**
|
||||
* Append "bytes[0,n-1]" to this.
|
||||
* @param bytes the pointer to the bytes
|
||||
* @param n the number of bytes; must be non-negative
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
virtual void Append(const char* bytes, int32_t n) = 0;
|
||||
|
||||
/**
|
||||
* Returns a writable buffer for appending and writes the buffer's capacity to
|
||||
* *result_capacity. Guarantees *result_capacity>=min_capacity.
|
||||
* May return a pointer to the caller-owned scratch buffer which must have
|
||||
* scratch_capacity>=min_capacity.
|
||||
* The returned buffer is only valid until the next operation
|
||||
* on this ByteSink.
|
||||
*
|
||||
* After writing at most *result_capacity bytes, call Append() with the
|
||||
* pointer returned from this function and the number of bytes written.
|
||||
* Many Append() implementations will avoid copying bytes if this function
|
||||
* returned an internal buffer.
|
||||
*
|
||||
* Partial usage example:
|
||||
* int32_t capacity;
|
||||
* char* buffer = sink->GetAppendBuffer(..., &capacity);
|
||||
* ... Write n bytes into buffer, with n <= capacity.
|
||||
* sink->Append(buffer, n);
|
||||
* In many implementations, that call to Append will avoid copying bytes.
|
||||
*
|
||||
* If the ByteSink allocates or reallocates an internal buffer, it should use
|
||||
* the desired_capacity_hint if appropriate.
|
||||
* If a caller cannot provide a reasonable guess at the desired capacity,
|
||||
* it should pass desired_capacity_hint=0.
|
||||
*
|
||||
* If a non-scratch buffer is returned, the caller may only pass
|
||||
* a prefix to it to Append().
|
||||
* That is, it is not correct to pass an interior pointer to Append().
|
||||
*
|
||||
* The default implementation always returns the scratch buffer.
|
||||
*
|
||||
* @param min_capacity required minimum capacity of the returned buffer;
|
||||
* must be non-negative
|
||||
* @param desired_capacity_hint desired capacity of the returned buffer;
|
||||
* must be non-negative
|
||||
* @param scratch default caller-owned buffer
|
||||
* @param scratch_capacity capacity of the scratch buffer
|
||||
* @param result_capacity pointer to an integer which will be set to the
|
||||
* capacity of the returned buffer
|
||||
* @return a buffer with *result_capacity>=min_capacity
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
virtual char* GetAppendBuffer(int32_t min_capacity,
|
||||
int32_t desired_capacity_hint,
|
||||
char* scratch, int32_t scratch_capacity,
|
||||
int32_t* result_capacity);
|
||||
|
||||
/**
|
||||
* Flush internal buffers.
|
||||
* Some byte sinks use internal buffers or provide buffering
|
||||
* and require calling Flush() at the end of the stream.
|
||||
* The ByteSink should be ready for further Append() calls after Flush().
|
||||
* The default implementation of Flush() does nothing.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
virtual void Flush();
|
||||
|
||||
private:
|
||||
ByteSink(const ByteSink &) = delete;
|
||||
ByteSink &operator=(const ByteSink &) = delete;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------
|
||||
// Some standard implementations
|
||||
|
||||
/**
|
||||
* Implementation of ByteSink that writes to a flat byte array,
|
||||
* with bounds-checking:
|
||||
* This sink will not write more than capacity bytes to outbuf.
|
||||
* If more than capacity bytes are Append()ed, then excess bytes are ignored,
|
||||
* and Overflowed() will return true.
|
||||
* Overflow does not cause a runtime error.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
class U_COMMON_API CheckedArrayByteSink : public ByteSink {
|
||||
public:
|
||||
/**
|
||||
* Constructs a ByteSink that will write to outbuf[0..capacity-1].
|
||||
* @param outbuf buffer to write to
|
||||
* @param capacity size of the buffer
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
CheckedArrayByteSink(char* outbuf, int32_t capacity);
|
||||
/**
|
||||
* Destructor.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
virtual ~CheckedArrayByteSink();
|
||||
/**
|
||||
* Returns the sink to its original state, without modifying the buffer.
|
||||
* Useful for reusing both the buffer and the sink for multiple streams.
|
||||
* Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0
|
||||
* and Overflowed()=FALSE.
|
||||
* @return *this
|
||||
* @stable ICU 4.6
|
||||
*/
|
||||
virtual CheckedArrayByteSink& Reset();
|
||||
/**
|
||||
* Append "bytes[0,n-1]" to this.
|
||||
* @param bytes the pointer to the bytes
|
||||
* @param n the number of bytes; must be non-negative
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
virtual void Append(const char* bytes, int32_t n);
|
||||
/**
|
||||
* Returns a writable buffer for appending and writes the buffer's capacity to
|
||||
* *result_capacity. For details see the base class documentation.
|
||||
* @param min_capacity required minimum capacity of the returned buffer;
|
||||
* must be non-negative
|
||||
* @param desired_capacity_hint desired capacity of the returned buffer;
|
||||
* must be non-negative
|
||||
* @param scratch default caller-owned buffer
|
||||
* @param scratch_capacity capacity of the scratch buffer
|
||||
* @param result_capacity pointer to an integer which will be set to the
|
||||
* capacity of the returned buffer
|
||||
* @return a buffer with *result_capacity>=min_capacity
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
virtual char* GetAppendBuffer(int32_t min_capacity,
|
||||
int32_t desired_capacity_hint,
|
||||
char* scratch, int32_t scratch_capacity,
|
||||
int32_t* result_capacity);
|
||||
/**
|
||||
* Returns the number of bytes actually written to the sink.
|
||||
* @return number of bytes written to the buffer
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
int32_t NumberOfBytesWritten() const { return size_; }
|
||||
/**
|
||||
* Returns true if any bytes were discarded, i.e., if there was an
|
||||
* attempt to write more than 'capacity' bytes.
|
||||
* @return TRUE if more than 'capacity' bytes were Append()ed
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
UBool Overflowed() const { return overflowed_; }
|
||||
/**
|
||||
* Returns the number of bytes appended to the sink.
|
||||
* If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten()
|
||||
* else they return the same number.
|
||||
* @return number of bytes written to the buffer
|
||||
* @stable ICU 4.6
|
||||
*/
|
||||
int32_t NumberOfBytesAppended() const { return appended_; }
|
||||
private:
|
||||
char* outbuf_;
|
||||
const int32_t capacity_;
|
||||
int32_t size_;
|
||||
int32_t appended_;
|
||||
UBool overflowed_;
|
||||
|
||||
CheckedArrayByteSink() = delete;
|
||||
CheckedArrayByteSink(const CheckedArrayByteSink &) = delete;
|
||||
CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete;
|
||||
};
|
||||
|
||||
/**
|
||||
* Implementation of ByteSink that writes to a "string".
|
||||
* The StringClass is usually instantiated with a std::string.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
template<typename StringClass>
|
||||
class StringByteSink : public ByteSink {
|
||||
public:
|
||||
/**
|
||||
* Constructs a ByteSink that will append bytes to the dest string.
|
||||
* @param dest pointer to string object to append to
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringByteSink(StringClass* dest) : dest_(dest) { }
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Constructs a ByteSink that reserves append capacity and will append bytes to the dest string.
|
||||
*
|
||||
* @param dest pointer to string object to append to
|
||||
* @param initialAppendCapacity capacity beyond dest->length() to be reserve()d
|
||||
* @draft ICU 60
|
||||
*/
|
||||
StringByteSink(StringClass* dest, int32_t initialAppendCapacity) : dest_(dest) {
|
||||
if (initialAppendCapacity > 0 &&
|
||||
(uint32_t)initialAppendCapacity > (dest->capacity() - dest->length())) {
|
||||
dest->reserve(dest->length() + initialAppendCapacity);
|
||||
}
|
||||
}
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
/**
|
||||
* Append "bytes[0,n-1]" to this.
|
||||
* @param data the pointer to the bytes
|
||||
* @param n the number of bytes; must be non-negative
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
virtual void Append(const char* data, int32_t n) { dest_->append(data, n); }
|
||||
private:
|
||||
StringClass* dest_;
|
||||
|
||||
StringByteSink() = delete;
|
||||
StringByteSink(const StringByteSink &) = delete;
|
||||
StringByteSink &operator=(const StringByteSink &) = delete;
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif // __BYTESTREAM_H__
|
||||
302
vendor/icu/include/unicode/char16ptr.h
vendored
Normal file
302
vendor/icu/include/unicode/char16ptr.h
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
// © 2017 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
|
||||
// char16ptr.h
|
||||
// created: 2017feb28 Markus W. Scherer
|
||||
|
||||
#ifndef __CHAR16PTR_H__
|
||||
#define __CHAR16PTR_H__
|
||||
|
||||
#include <cstddef>
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: char16_t pointer wrappers with
|
||||
* implicit conversion from bit-compatible raw pointer types.
|
||||
* Also conversion functions from char16_t * to UChar * and OldUChar *.
|
||||
*/
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* \def U_ALIASING_BARRIER
|
||||
* Barrier for pointer anti-aliasing optimizations even across function boundaries.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
// Use the predefined value.
|
||||
#elif (defined(__clang__) || defined(__GNUC__)) && U_PLATFORM != U_PF_BROWSER_NATIVE_CLIENT
|
||||
# define U_ALIASING_BARRIER(ptr) asm volatile("" : : "rm"(ptr) : "memory")
|
||||
#endif
|
||||
|
||||
/**
|
||||
* char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
|
||||
* @stable ICU 59
|
||||
*/
|
||||
class U_COMMON_API Char16Ptr U_FINAL {
|
||||
public:
|
||||
/**
|
||||
* Copies the pointer.
|
||||
* @param p pointer
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline Char16Ptr(char16_t *p);
|
||||
#if !U_CHAR16_IS_TYPEDEF
|
||||
/**
|
||||
* Converts the pointer to char16_t *.
|
||||
* @param p pointer to be converted
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline Char16Ptr(uint16_t *p);
|
||||
#endif
|
||||
#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
|
||||
/**
|
||||
* Converts the pointer to char16_t *.
|
||||
* (Only defined if U_SIZEOF_WCHAR_T==2.)
|
||||
* @param p pointer to be converted
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline Char16Ptr(wchar_t *p);
|
||||
#endif
|
||||
/**
|
||||
* nullptr constructor.
|
||||
* @param p nullptr
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline Char16Ptr(std::nullptr_t p);
|
||||
/**
|
||||
* Destructor.
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline ~Char16Ptr();
|
||||
|
||||
/**
|
||||
* Pointer access.
|
||||
* @return the wrapped pointer
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline char16_t *get() const;
|
||||
/**
|
||||
* char16_t pointer access via type conversion (e.g., static_cast).
|
||||
* @return the wrapped pointer
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline operator char16_t *() const { return get(); }
|
||||
|
||||
private:
|
||||
Char16Ptr() = delete;
|
||||
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
template<typename T> static char16_t *cast(T *t) {
|
||||
U_ALIASING_BARRIER(t);
|
||||
return reinterpret_cast<char16_t *>(t);
|
||||
}
|
||||
|
||||
char16_t *p_;
|
||||
#else
|
||||
union {
|
||||
char16_t *cp;
|
||||
uint16_t *up;
|
||||
wchar_t *wp;
|
||||
} u_;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
|
||||
Char16Ptr::Char16Ptr(char16_t *p) : p_(p) {}
|
||||
#if !U_CHAR16_IS_TYPEDEF
|
||||
Char16Ptr::Char16Ptr(uint16_t *p) : p_(cast(p)) {}
|
||||
#endif
|
||||
#if U_SIZEOF_WCHAR_T==2
|
||||
Char16Ptr::Char16Ptr(wchar_t *p) : p_(cast(p)) {}
|
||||
#endif
|
||||
Char16Ptr::Char16Ptr(std::nullptr_t p) : p_(p) {}
|
||||
Char16Ptr::~Char16Ptr() {
|
||||
U_ALIASING_BARRIER(p_);
|
||||
}
|
||||
|
||||
char16_t *Char16Ptr::get() const { return p_; }
|
||||
|
||||
#else
|
||||
|
||||
Char16Ptr::Char16Ptr(char16_t *p) { u_.cp = p; }
|
||||
#if !U_CHAR16_IS_TYPEDEF
|
||||
Char16Ptr::Char16Ptr(uint16_t *p) { u_.up = p; }
|
||||
#endif
|
||||
#if U_SIZEOF_WCHAR_T==2
|
||||
Char16Ptr::Char16Ptr(wchar_t *p) { u_.wp = p; }
|
||||
#endif
|
||||
Char16Ptr::Char16Ptr(std::nullptr_t p) { u_.cp = p; }
|
||||
Char16Ptr::~Char16Ptr() {}
|
||||
|
||||
char16_t *Char16Ptr::get() const { return u_.cp; }
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
|
||||
* @stable ICU 59
|
||||
*/
|
||||
class U_COMMON_API ConstChar16Ptr U_FINAL {
|
||||
public:
|
||||
/**
|
||||
* Copies the pointer.
|
||||
* @param p pointer
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline ConstChar16Ptr(const char16_t *p);
|
||||
#if !U_CHAR16_IS_TYPEDEF
|
||||
/**
|
||||
* Converts the pointer to char16_t *.
|
||||
* @param p pointer to be converted
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline ConstChar16Ptr(const uint16_t *p);
|
||||
#endif
|
||||
#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
|
||||
/**
|
||||
* Converts the pointer to char16_t *.
|
||||
* (Only defined if U_SIZEOF_WCHAR_T==2.)
|
||||
* @param p pointer to be converted
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline ConstChar16Ptr(const wchar_t *p);
|
||||
#endif
|
||||
/**
|
||||
* nullptr constructor.
|
||||
* @param p nullptr
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline ConstChar16Ptr(const std::nullptr_t p);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline ~ConstChar16Ptr();
|
||||
|
||||
/**
|
||||
* Pointer access.
|
||||
* @return the wrapped pointer
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline const char16_t *get() const;
|
||||
/**
|
||||
* char16_t pointer access via type conversion (e.g., static_cast).
|
||||
* @return the wrapped pointer
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline operator const char16_t *() const { return get(); }
|
||||
|
||||
private:
|
||||
ConstChar16Ptr() = delete;
|
||||
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
template<typename T> static const char16_t *cast(const T *t) {
|
||||
U_ALIASING_BARRIER(t);
|
||||
return reinterpret_cast<const char16_t *>(t);
|
||||
}
|
||||
|
||||
const char16_t *p_;
|
||||
#else
|
||||
union {
|
||||
const char16_t *cp;
|
||||
const uint16_t *up;
|
||||
const wchar_t *wp;
|
||||
} u_;
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
|
||||
ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) : p_(p) {}
|
||||
#if !U_CHAR16_IS_TYPEDEF
|
||||
ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) : p_(cast(p)) {}
|
||||
#endif
|
||||
#if U_SIZEOF_WCHAR_T==2
|
||||
ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) : p_(cast(p)) {}
|
||||
#endif
|
||||
ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) : p_(p) {}
|
||||
ConstChar16Ptr::~ConstChar16Ptr() {
|
||||
U_ALIASING_BARRIER(p_);
|
||||
}
|
||||
|
||||
const char16_t *ConstChar16Ptr::get() const { return p_; }
|
||||
|
||||
#else
|
||||
|
||||
ConstChar16Ptr::ConstChar16Ptr(const char16_t *p) { u_.cp = p; }
|
||||
#if !U_CHAR16_IS_TYPEDEF
|
||||
ConstChar16Ptr::ConstChar16Ptr(const uint16_t *p) { u_.up = p; }
|
||||
#endif
|
||||
#if U_SIZEOF_WCHAR_T==2
|
||||
ConstChar16Ptr::ConstChar16Ptr(const wchar_t *p) { u_.wp = p; }
|
||||
#endif
|
||||
ConstChar16Ptr::ConstChar16Ptr(const std::nullptr_t p) { u_.cp = p; }
|
||||
ConstChar16Ptr::~ConstChar16Ptr() {}
|
||||
|
||||
const char16_t *ConstChar16Ptr::get() const { return u_.cp; }
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Converts from const char16_t * to const UChar *.
|
||||
* Includes an aliasing barrier if available.
|
||||
* @param p pointer
|
||||
* @return p as const UChar *
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline const UChar *toUCharPtr(const char16_t *p) {
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
U_ALIASING_BARRIER(p);
|
||||
#endif
|
||||
return reinterpret_cast<const UChar *>(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts from char16_t * to UChar *.
|
||||
* Includes an aliasing barrier if available.
|
||||
* @param p pointer
|
||||
* @return p as UChar *
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline UChar *toUCharPtr(char16_t *p) {
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
U_ALIASING_BARRIER(p);
|
||||
#endif
|
||||
return reinterpret_cast<UChar *>(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts from const char16_t * to const OldUChar *.
|
||||
* Includes an aliasing barrier if available.
|
||||
* @param p pointer
|
||||
* @return p as const OldUChar *
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline const OldUChar *toOldUCharPtr(const char16_t *p) {
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
U_ALIASING_BARRIER(p);
|
||||
#endif
|
||||
return reinterpret_cast<const OldUChar *>(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts from char16_t * to OldUChar *.
|
||||
* Includes an aliasing barrier if available.
|
||||
* @param p pointer
|
||||
* @return p as OldUChar *
|
||||
* @stable ICU 59
|
||||
*/
|
||||
inline OldUChar *toOldUCharPtr(char16_t *p) {
|
||||
#ifdef U_ALIASING_BARRIER
|
||||
U_ALIASING_BARRIER(p);
|
||||
#endif
|
||||
return reinterpret_cast<OldUChar *>(p);
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif // __CHAR16PTR_H__
|
||||
524
vendor/icu/include/unicode/localpointer.h
vendored
Normal file
524
vendor/icu/include/unicode/localpointer.h
vendored
Normal file
@@ -0,0 +1,524 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: localpointer.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2009nov13
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __LOCALPOINTER_H__
|
||||
#define __LOCALPOINTER_H__
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: "Smart pointers" for use with and in ICU4C C++ code.
|
||||
*
|
||||
* These classes are inspired by
|
||||
* - std::auto_ptr
|
||||
* - boost::scoped_ptr & boost::scoped_array
|
||||
* - Taligent Safe Pointers (TOnlyPointerTo)
|
||||
*
|
||||
* but none of those provide for all of the goals for ICU smart pointers:
|
||||
* - Smart pointer owns the object and releases it when it goes out of scope.
|
||||
* - No transfer of ownership via copy/assignment to reduce misuse. Simpler & more robust.
|
||||
* - ICU-compatible: No exceptions.
|
||||
* - Need to be able to orphan/release the pointer and its ownership.
|
||||
* - Need variants for normal C++ object pointers, C++ arrays, and ICU C service objects.
|
||||
*
|
||||
* For details see http://site.icu-project.org/design/cpp/scoped_ptr
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* "Smart pointer" base class; do not use directly: use LocalPointer etc.
|
||||
*
|
||||
* Base class for smart pointer classes that do not throw exceptions.
|
||||
*
|
||||
* Do not use this base class directly, since it does not delete its pointer.
|
||||
* A subclass must implement methods that delete the pointer:
|
||||
* Destructor and adoptInstead().
|
||||
*
|
||||
* There is no operator T *() provided because the programmer must decide
|
||||
* whether to use getAlias() (without transfer of ownership) or orphan()
|
||||
* (with transfer of ownership and NULLing of the pointer).
|
||||
*
|
||||
* @see LocalPointer
|
||||
* @see LocalArray
|
||||
* @see U_DEFINE_LOCAL_OPEN_POINTER
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
template<typename T>
|
||||
class LocalPointerBase {
|
||||
public:
|
||||
/**
|
||||
* Constructor takes ownership.
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
explicit LocalPointerBase(T *p=NULL) : ptr(p) {}
|
||||
/**
|
||||
* Destructor deletes the object it owns.
|
||||
* Subclass must override: Base class does nothing.
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
~LocalPointerBase() { /* delete ptr; */ }
|
||||
/**
|
||||
* NULL check.
|
||||
* @return TRUE if ==NULL
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
UBool isNull() const { return ptr==NULL; }
|
||||
/**
|
||||
* NULL check.
|
||||
* @return TRUE if !=NULL
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
UBool isValid() const { return ptr!=NULL; }
|
||||
/**
|
||||
* Comparison with a simple pointer, so that existing code
|
||||
* with ==NULL need not be changed.
|
||||
* @param other simple pointer for comparison
|
||||
* @return true if this pointer value equals other
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
bool operator==(const T *other) const { return ptr==other; }
|
||||
/**
|
||||
* Comparison with a simple pointer, so that existing code
|
||||
* with !=NULL need not be changed.
|
||||
* @param other simple pointer for comparison
|
||||
* @return true if this pointer value differs from other
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
bool operator!=(const T *other) const { return ptr!=other; }
|
||||
/**
|
||||
* Access without ownership change.
|
||||
* @return the pointer value
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T *getAlias() const { return ptr; }
|
||||
/**
|
||||
* Access without ownership change.
|
||||
* @return the pointer value as a reference
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T &operator*() const { return *ptr; }
|
||||
/**
|
||||
* Access without ownership change.
|
||||
* @return the pointer value
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T *operator->() const { return ptr; }
|
||||
/**
|
||||
* Gives up ownership; the internal pointer becomes NULL.
|
||||
* @return the pointer value;
|
||||
* caller becomes responsible for deleting the object
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T *orphan() {
|
||||
T *p=ptr;
|
||||
ptr=NULL;
|
||||
return p;
|
||||
}
|
||||
/**
|
||||
* Deletes the object it owns,
|
||||
* and adopts (takes ownership of) the one passed in.
|
||||
* Subclass must override: Base class does not delete the object.
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
void adoptInstead(T *p) {
|
||||
// delete ptr;
|
||||
ptr=p;
|
||||
}
|
||||
protected:
|
||||
/**
|
||||
* Actual pointer.
|
||||
* @internal
|
||||
*/
|
||||
T *ptr;
|
||||
private:
|
||||
// No comparison operators with other LocalPointerBases.
|
||||
bool operator==(const LocalPointerBase<T> &other);
|
||||
bool operator!=(const LocalPointerBase<T> &other);
|
||||
// No ownership sharing: No copy constructor, no assignment operator.
|
||||
LocalPointerBase(const LocalPointerBase<T> &other);
|
||||
void operator=(const LocalPointerBase<T> &other);
|
||||
// No heap allocation. Use only on the stack.
|
||||
static void * U_EXPORT2 operator new(size_t size);
|
||||
static void * U_EXPORT2 operator new[](size_t size);
|
||||
#if U_HAVE_PLACEMENT_NEW
|
||||
static void * U_EXPORT2 operator new(size_t, void *ptr);
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
* "Smart pointer" class, deletes objects via the standard C++ delete operator.
|
||||
* For most methods see the LocalPointerBase base class.
|
||||
*
|
||||
* Usage example:
|
||||
* \code
|
||||
* LocalPointer<UnicodeString> s(new UnicodeString((UChar32)0x50005));
|
||||
* int32_t length=s->length(); // 2
|
||||
* char16_t lead=s->charAt(0); // 0xd900
|
||||
* if(some condition) { return; } // no need to explicitly delete the pointer
|
||||
* s.adoptInstead(new UnicodeString((char16_t)0xfffc));
|
||||
* length=s->length(); // 1
|
||||
* // no need to explicitly delete the pointer
|
||||
* \endcode
|
||||
*
|
||||
* @see LocalPointerBase
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
template<typename T>
|
||||
class LocalPointer : public LocalPointerBase<T> {
|
||||
public:
|
||||
using LocalPointerBase<T>::operator*;
|
||||
using LocalPointerBase<T>::operator->;
|
||||
/**
|
||||
* Constructor takes ownership.
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
explicit LocalPointer(T *p=NULL) : LocalPointerBase<T>(p) {}
|
||||
/**
|
||||
* Constructor takes ownership and reports an error if NULL.
|
||||
*
|
||||
* This constructor is intended to be used with other-class constructors
|
||||
* that may report a failure UErrorCode,
|
||||
* so that callers need to check only for U_FAILURE(errorCode)
|
||||
* and not also separately for isNull().
|
||||
*
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
|
||||
* if p==NULL and no other failure code had been set
|
||||
* @stable ICU 55
|
||||
*/
|
||||
LocalPointer(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) {
|
||||
if(p==NULL && U_SUCCESS(errorCode)) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Move constructor, leaves src with isNull().
|
||||
* @param src source smart pointer
|
||||
* @stable ICU 56
|
||||
*/
|
||||
LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
|
||||
src.ptr=NULL;
|
||||
}
|
||||
/**
|
||||
* Destructor deletes the object it owns.
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
~LocalPointer() {
|
||||
delete LocalPointerBase<T>::ptr;
|
||||
}
|
||||
/**
|
||||
* Move assignment operator, leaves src with isNull().
|
||||
* The behavior is undefined if *this and src are the same object.
|
||||
* @param src source smart pointer
|
||||
* @return *this
|
||||
* @stable ICU 56
|
||||
*/
|
||||
LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT {
|
||||
return moveFrom(src);
|
||||
}
|
||||
// do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
|
||||
/**
|
||||
* Move assignment, leaves src with isNull().
|
||||
* The behavior is undefined if *this and src are the same object.
|
||||
*
|
||||
* Can be called explicitly, does not need C++11 support.
|
||||
* @param src source smart pointer
|
||||
* @return *this
|
||||
* @draft ICU 56
|
||||
*/
|
||||
LocalPointer<T> &moveFrom(LocalPointer<T> &src) U_NOEXCEPT {
|
||||
delete LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=src.ptr;
|
||||
src.ptr=NULL;
|
||||
return *this;
|
||||
}
|
||||
/**
|
||||
* Swap pointers.
|
||||
* @param other other smart pointer
|
||||
* @stable ICU 56
|
||||
*/
|
||||
void swap(LocalPointer<T> &other) U_NOEXCEPT {
|
||||
T *temp=LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=other.ptr;
|
||||
other.ptr=temp;
|
||||
}
|
||||
/**
|
||||
* Non-member LocalPointer swap function.
|
||||
* @param p1 will get p2's pointer
|
||||
* @param p2 will get p1's pointer
|
||||
* @stable ICU 56
|
||||
*/
|
||||
friend inline void swap(LocalPointer<T> &p1, LocalPointer<T> &p2) U_NOEXCEPT {
|
||||
p1.swap(p2);
|
||||
}
|
||||
/**
|
||||
* Deletes the object it owns,
|
||||
* and adopts (takes ownership of) the one passed in.
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
void adoptInstead(T *p) {
|
||||
delete LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=p;
|
||||
}
|
||||
/**
|
||||
* Deletes the object it owns,
|
||||
* and adopts (takes ownership of) the one passed in.
|
||||
*
|
||||
* If U_FAILURE(errorCode), then the current object is retained and the new one deleted.
|
||||
*
|
||||
* If U_SUCCESS(errorCode) but the input pointer is NULL,
|
||||
* then U_MEMORY_ALLOCATION_ERROR is set,
|
||||
* the current object is deleted, and NULL is set.
|
||||
*
|
||||
* @param p simple pointer to an object that is adopted
|
||||
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
|
||||
* if p==NULL and no other failure code had been set
|
||||
* @stable ICU 55
|
||||
*/
|
||||
void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) {
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
delete LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=p;
|
||||
if(p==NULL) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
} else {
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* "Smart pointer" class, deletes objects via the C++ array delete[] operator.
|
||||
* For most methods see the LocalPointerBase base class.
|
||||
* Adds operator[] for array item access.
|
||||
*
|
||||
* Usage example:
|
||||
* \code
|
||||
* LocalArray<UnicodeString> a(new UnicodeString[2]);
|
||||
* a[0].append((char16_t)0x61);
|
||||
* if(some condition) { return; } // no need to explicitly delete the array
|
||||
* a.adoptInstead(new UnicodeString[4]);
|
||||
* a[3].append((char16_t)0x62).append((char16_t)0x63).reverse();
|
||||
* // no need to explicitly delete the array
|
||||
* \endcode
|
||||
*
|
||||
* @see LocalPointerBase
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
template<typename T>
|
||||
class LocalArray : public LocalPointerBase<T> {
|
||||
public:
|
||||
using LocalPointerBase<T>::operator*;
|
||||
using LocalPointerBase<T>::operator->;
|
||||
/**
|
||||
* Constructor takes ownership.
|
||||
* @param p simple pointer to an array of T objects that is adopted
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
explicit LocalArray(T *p=NULL) : LocalPointerBase<T>(p) {}
|
||||
/**
|
||||
* Constructor takes ownership and reports an error if NULL.
|
||||
*
|
||||
* This constructor is intended to be used with other-class constructors
|
||||
* that may report a failure UErrorCode,
|
||||
* so that callers need to check only for U_FAILURE(errorCode)
|
||||
* and not also separately for isNull().
|
||||
*
|
||||
* @param p simple pointer to an array of T objects that is adopted
|
||||
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
|
||||
* if p==NULL and no other failure code had been set
|
||||
* @stable ICU 56
|
||||
*/
|
||||
LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) {
|
||||
if(p==NULL && U_SUCCESS(errorCode)) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Move constructor, leaves src with isNull().
|
||||
* @param src source smart pointer
|
||||
* @stable ICU 56
|
||||
*/
|
||||
LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
|
||||
src.ptr=NULL;
|
||||
}
|
||||
/**
|
||||
* Destructor deletes the array it owns.
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
~LocalArray() {
|
||||
delete[] LocalPointerBase<T>::ptr;
|
||||
}
|
||||
/**
|
||||
* Move assignment operator, leaves src with isNull().
|
||||
* The behavior is undefined if *this and src are the same object.
|
||||
* @param src source smart pointer
|
||||
* @return *this
|
||||
* @stable ICU 56
|
||||
*/
|
||||
LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT {
|
||||
return moveFrom(src);
|
||||
}
|
||||
// do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
|
||||
/**
|
||||
* Move assignment, leaves src with isNull().
|
||||
* The behavior is undefined if *this and src are the same object.
|
||||
*
|
||||
* Can be called explicitly, does not need C++11 support.
|
||||
* @param src source smart pointer
|
||||
* @return *this
|
||||
* @draft ICU 56
|
||||
*/
|
||||
LocalArray<T> &moveFrom(LocalArray<T> &src) U_NOEXCEPT {
|
||||
delete[] LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=src.ptr;
|
||||
src.ptr=NULL;
|
||||
return *this;
|
||||
}
|
||||
/**
|
||||
* Swap pointers.
|
||||
* @param other other smart pointer
|
||||
* @stable ICU 56
|
||||
*/
|
||||
void swap(LocalArray<T> &other) U_NOEXCEPT {
|
||||
T *temp=LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=other.ptr;
|
||||
other.ptr=temp;
|
||||
}
|
||||
/**
|
||||
* Non-member LocalArray swap function.
|
||||
* @param p1 will get p2's pointer
|
||||
* @param p2 will get p1's pointer
|
||||
* @stable ICU 56
|
||||
*/
|
||||
friend inline void swap(LocalArray<T> &p1, LocalArray<T> &p2) U_NOEXCEPT {
|
||||
p1.swap(p2);
|
||||
}
|
||||
/**
|
||||
* Deletes the array it owns,
|
||||
* and adopts (takes ownership of) the one passed in.
|
||||
* @param p simple pointer to an array of T objects that is adopted
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
void adoptInstead(T *p) {
|
||||
delete[] LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=p;
|
||||
}
|
||||
/**
|
||||
* Deletes the array it owns,
|
||||
* and adopts (takes ownership of) the one passed in.
|
||||
*
|
||||
* If U_FAILURE(errorCode), then the current array is retained and the new one deleted.
|
||||
*
|
||||
* If U_SUCCESS(errorCode) but the input pointer is NULL,
|
||||
* then U_MEMORY_ALLOCATION_ERROR is set,
|
||||
* the current array is deleted, and NULL is set.
|
||||
*
|
||||
* @param p simple pointer to an array of T objects that is adopted
|
||||
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
|
||||
* if p==NULL and no other failure code had been set
|
||||
* @stable ICU 56
|
||||
*/
|
||||
void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) {
|
||||
if(U_SUCCESS(errorCode)) {
|
||||
delete[] LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=p;
|
||||
if(p==NULL) {
|
||||
errorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
} else {
|
||||
delete[] p;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Array item access (writable).
|
||||
* No index bounds check.
|
||||
* @param i array index
|
||||
* @return reference to the array item
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }
|
||||
};
|
||||
|
||||
/**
|
||||
* \def U_DEFINE_LOCAL_OPEN_POINTER
|
||||
* "Smart pointer" definition macro, deletes objects via the closeFunction.
|
||||
* Defines a subclass of LocalPointerBase which works just
|
||||
* like LocalPointer<Type> except that this subclass will use the closeFunction
|
||||
* rather than the C++ delete operator.
|
||||
*
|
||||
* Usage example:
|
||||
* \code
|
||||
* LocalUCaseMapPointer csm(ucasemap_open(localeID, options, &errorCode));
|
||||
* utf8OutLength=ucasemap_utf8ToLower(csm.getAlias(),
|
||||
* utf8Out, (int32_t)sizeof(utf8Out),
|
||||
* utf8In, utf8InLength, &errorCode);
|
||||
* if(U_FAILURE(errorCode)) { return; } // no need to explicitly delete the UCaseMap
|
||||
* \endcode
|
||||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction) \
|
||||
class LocalPointerClassName : public LocalPointerBase<Type> { \
|
||||
public: \
|
||||
using LocalPointerBase<Type>::operator*; \
|
||||
using LocalPointerBase<Type>::operator->; \
|
||||
explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
|
||||
LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \
|
||||
: LocalPointerBase<Type>(src.ptr) { \
|
||||
src.ptr=NULL; \
|
||||
} \
|
||||
~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \
|
||||
LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
|
||||
return moveFrom(src); \
|
||||
} \
|
||||
LocalPointerClassName &moveFrom(LocalPointerClassName &src) U_NOEXCEPT { \
|
||||
if (ptr != NULL) { closeFunction(ptr); } \
|
||||
LocalPointerBase<Type>::ptr=src.ptr; \
|
||||
src.ptr=NULL; \
|
||||
return *this; \
|
||||
} \
|
||||
void swap(LocalPointerClassName &other) U_NOEXCEPT { \
|
||||
Type *temp=LocalPointerBase<Type>::ptr; \
|
||||
LocalPointerBase<Type>::ptr=other.ptr; \
|
||||
other.ptr=temp; \
|
||||
} \
|
||||
friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \
|
||||
p1.swap(p2); \
|
||||
} \
|
||||
void adoptInstead(Type *p) { \
|
||||
if (ptr != NULL) { closeFunction(ptr); } \
|
||||
ptr=p; \
|
||||
} \
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* U_SHOW_CPLUSPLUS_API */
|
||||
#endif /* __LOCALPOINTER_H__ */
|
||||
865
vendor/icu/include/unicode/platform.h
vendored
Normal file
865
vendor/icu/include/unicode/platform.h
vendored
Normal file
@@ -0,0 +1,865 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : platform.h
|
||||
*
|
||||
* Date Name Description
|
||||
* 05/13/98 nos Creation (content moved here from ptypes.h).
|
||||
* 03/02/99 stephen Added AS400 support.
|
||||
* 03/30/99 stephen Added Linux support.
|
||||
* 04/13/99 stephen Reworked for autoconf.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _PLATFORM_H
|
||||
#define _PLATFORM_H
|
||||
|
||||
#include <unicode/uconfig.h>
|
||||
#include <unicode/uvernum.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief Basic types for the platform.
|
||||
*
|
||||
* This file used to be generated by autoconf/configure.
|
||||
* Starting with ICU 49, platform.h is a normal source file,
|
||||
* to simplify cross-compiling and working with non-autoconf/make build systems.
|
||||
*
|
||||
* When a value in this file does not work on a platform, then please
|
||||
* try to derive it from the U_PLATFORM value
|
||||
* (for which we might need a new value constant in rare cases)
|
||||
* and/or from other macros that are predefined by the compiler
|
||||
* or defined in standard (POSIX or platform or compiler) headers.
|
||||
*
|
||||
* As a temporary workaround, you can add an explicit <code>#define</code> for some macros
|
||||
* before it is first tested, or add an equivalent -D macro definition
|
||||
* to the compiler's command line.
|
||||
*
|
||||
* Note: Some compilers provide ways to show the predefined macros.
|
||||
* For example, with gcc you can compile an empty .c file and have the compiler
|
||||
* print the predefined macros with
|
||||
* \code
|
||||
* gcc -E -dM -x c /dev/null | sort
|
||||
* \endcode
|
||||
* (You can provide an actual empty .c file rather than /dev/null.
|
||||
* <code>-x c++</code> is for C++.)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Define some things so that they can be documented.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_IN_DOXYGEN
|
||||
/*
|
||||
* Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented.
|
||||
* Solution: #define any defines for non @internal API here, so that they are visible in the docs. If you just set PREDEFINED in Doxyfile.in, they won't be documented.
|
||||
*/
|
||||
|
||||
/* None for now. */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_PLATFORM
|
||||
* The U_PLATFORM macro defines the platform we're on.
|
||||
*
|
||||
* We used to define one different, value-less macro per platform.
|
||||
* That made it hard to know the set of relevant platforms and macros,
|
||||
* and hard to deal with variants of platforms.
|
||||
*
|
||||
* Starting with ICU 49, we define platforms as numeric macros,
|
||||
* with ranges of values for related platforms and their variants.
|
||||
* The U_PLATFORM macro is set to one of these values.
|
||||
*
|
||||
* Historical note from the Solaris Wikipedia article:
|
||||
* AT&T and Sun collaborated on a project to merge the most popular Unix variants
|
||||
* on the market at that time: BSD, System V, and Xenix.
|
||||
* This became Unix System V Release 4 (SVR4).
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
||||
/** Unknown platform. @internal */
|
||||
#define U_PF_UNKNOWN 0
|
||||
/** Windows @internal */
|
||||
#define U_PF_WINDOWS 1000
|
||||
/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */
|
||||
#define U_PF_MINGW 1800
|
||||
/**
|
||||
* Cygwin. Windows, calls to cygwin1.dll for Posix functions,
|
||||
* using MSVC or GNU gcc and binutils.
|
||||
* @internal
|
||||
*/
|
||||
#define U_PF_CYGWIN 1900
|
||||
/* Reserve 2000 for U_PF_UNIX? */
|
||||
/** HP-UX is based on UNIX System V. @internal */
|
||||
#define U_PF_HPUX 2100
|
||||
/** Solaris is a Unix operating system based on SVR4. @internal */
|
||||
#define U_PF_SOLARIS 2600
|
||||
/** BSD is a UNIX operating system derivative. @internal */
|
||||
#define U_PF_BSD 3000
|
||||
/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */
|
||||
#define U_PF_AIX 3100
|
||||
/** IRIX is based on UNIX System V with BSD extensions. @internal */
|
||||
#define U_PF_IRIX 3200
|
||||
/**
|
||||
* Darwin is a POSIX-compliant operating system, composed of code developed by Apple,
|
||||
* as well as code derived from NeXTSTEP, BSD, and other projects,
|
||||
* built around the Mach kernel.
|
||||
* Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based.
|
||||
* (Original description modified from WikiPedia.)
|
||||
* @internal
|
||||
*/
|
||||
#define U_PF_DARWIN 3500
|
||||
/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */
|
||||
#define U_PF_IPHONE 3550
|
||||
/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */
|
||||
#define U_PF_QNX 3700
|
||||
/** Linux is a Unix-like operating system. @internal */
|
||||
#define U_PF_LINUX 4000
|
||||
/**
|
||||
* Native Client is pretty close to Linux.
|
||||
* See https://developer.chrome.com/native-client and
|
||||
* http://www.chromium.org/nativeclient
|
||||
* @internal
|
||||
*/
|
||||
#define U_PF_BROWSER_NATIVE_CLIENT 4020
|
||||
/** Android is based on Linux. @internal */
|
||||
#define U_PF_ANDROID 4050
|
||||
/** Fuchsia is a POSIX-ish platform. @internal */
|
||||
#define U_PF_FUCHSIA 4100
|
||||
/* Maximum value for Linux-based platform is 4499 */
|
||||
/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */
|
||||
#define U_PF_OS390 9000
|
||||
/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */
|
||||
#define U_PF_OS400 9400
|
||||
|
||||
#ifdef U_PLATFORM
|
||||
/* Use the predefined value. */
|
||||
#elif defined(__MINGW32__)
|
||||
# define U_PLATFORM U_PF_MINGW
|
||||
#elif defined(__CYGWIN__)
|
||||
# define U_PLATFORM U_PF_CYGWIN
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
|
||||
# define U_PLATFORM U_PF_WINDOWS
|
||||
#elif defined(__ANDROID__)
|
||||
# define U_PLATFORM U_PF_ANDROID
|
||||
/* Android wchar_t support depends on the API level. */
|
||||
# include <android/api-level.h>
|
||||
#elif defined(__pnacl__) || defined(__native_client__)
|
||||
# define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT
|
||||
#elif defined(__Fuchsia__)
|
||||
# define U_PLATFORM U_PF_FUCHSIA
|
||||
#elif defined(linux) || defined(__linux__) || defined(__linux)
|
||||
# define U_PLATFORM U_PF_LINUX
|
||||
#elif defined(__APPLE__) && defined(__MACH__)
|
||||
# include <TargetConditionals.h>
|
||||
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */
|
||||
# define U_PLATFORM U_PF_IPHONE
|
||||
# else
|
||||
# define U_PLATFORM U_PF_DARWIN
|
||||
# endif
|
||||
#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__)
|
||||
# if defined(__FreeBSD__)
|
||||
# include <sys/endian.h>
|
||||
# endif
|
||||
# define U_PLATFORM U_PF_BSD
|
||||
#elif defined(sun) || defined(__sun)
|
||||
/* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */
|
||||
# define U_PLATFORM U_PF_SOLARIS
|
||||
# if defined(__GNUC__)
|
||||
/* Solaris/GCC needs this header file to get the proper endianness. Normally, this
|
||||
* header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h
|
||||
* is included which does not include this header file.
|
||||
*/
|
||||
# include <sys/isa_defs.h>
|
||||
# endif
|
||||
#elif defined(_AIX) || defined(__TOS_AIX__)
|
||||
# define U_PLATFORM U_PF_AIX
|
||||
#elif defined(_hpux) || defined(hpux) || defined(__hpux)
|
||||
# define U_PLATFORM U_PF_HPUX
|
||||
#elif defined(sgi) || defined(__sgi)
|
||||
# define U_PLATFORM U_PF_IRIX
|
||||
#elif defined(__QNX__) || defined(__QNXNTO__)
|
||||
# define U_PLATFORM U_PF_QNX
|
||||
#elif defined(__TOS_MVS__)
|
||||
# define U_PLATFORM U_PF_OS390
|
||||
#elif defined(__OS400__) || defined(__TOS_OS400__)
|
||||
# define U_PLATFORM U_PF_OS400
|
||||
#else
|
||||
# define U_PLATFORM U_PF_UNKNOWN
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UPRV_INCOMPLETE_CPP11_SUPPORT
|
||||
* This switch turns off ICU 60 NumberFormatter code.
|
||||
* By default, this switch is enabled on AIX and z/OS,
|
||||
* which have poor C++11 support.
|
||||
*
|
||||
* NOTE: This switch is intended to be temporary; see #13393.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#ifndef UPRV_INCOMPLETE_CPP11_SUPPORT
|
||||
# define UPRV_INCOMPLETE_CPP11_SUPPORT (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_SOLARIS )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def CYGWINMSVC
|
||||
* Defined if this is Windows with Cygwin, but using MSVC rather than gcc.
|
||||
* Otherwise undefined.
|
||||
* @internal
|
||||
*/
|
||||
/* Commented out because this is already set in mh-cygwin-msvc
|
||||
#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)
|
||||
# define CYGWINMSVC
|
||||
#endif
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_PLATFORM_USES_ONLY_WIN32_API
|
||||
* Defines whether the platform uses only the Win32 API.
|
||||
* Set to 1 for Windows/MSVC and MinGW but not Cygwin.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_PLATFORM_USES_ONLY_WIN32_API
|
||||
/* Use the predefined value. */
|
||||
#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)
|
||||
# define U_PLATFORM_USES_ONLY_WIN32_API 1
|
||||
#else
|
||||
/* Cygwin implements POSIX. */
|
||||
# define U_PLATFORM_USES_ONLY_WIN32_API 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_PLATFORM_HAS_WIN32_API
|
||||
* Defines whether the Win32 API is available on the platform.
|
||||
* Set to 1 for Windows/MSVC, MinGW and Cygwin.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_PLATFORM_HAS_WIN32_API
|
||||
/* Use the predefined value. */
|
||||
#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
|
||||
# define U_PLATFORM_HAS_WIN32_API 1
|
||||
#else
|
||||
# define U_PLATFORM_HAS_WIN32_API 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_PLATFORM_HAS_WINUWP_API
|
||||
* Defines whether target is intended for Universal Windows Platform API
|
||||
* Set to 1 for Windows10 Release Solution Configuration
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_PLATFORM_HAS_WINUWP_API
|
||||
/* Use the predefined value. */
|
||||
#else
|
||||
# define U_PLATFORM_HAS_WINUWP_API 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_PLATFORM_IMPLEMENTS_POSIX
|
||||
* Defines whether the platform implements (most of) the POSIX API.
|
||||
* Set to 1 for Cygwin and most other platforms.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_PLATFORM_IMPLEMENTS_POSIX
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# define U_PLATFORM_IMPLEMENTS_POSIX 0
|
||||
#else
|
||||
# define U_PLATFORM_IMPLEMENTS_POSIX 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_PLATFORM_IS_LINUX_BASED
|
||||
* Defines whether the platform is Linux or one of its derivatives.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_PLATFORM_IS_LINUX_BASED
|
||||
/* Use the predefined value. */
|
||||
#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499
|
||||
# define U_PLATFORM_IS_LINUX_BASED 1
|
||||
#else
|
||||
# define U_PLATFORM_IS_LINUX_BASED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_PLATFORM_IS_DARWIN_BASED
|
||||
* Defines whether the platform is Darwin or one of its derivatives.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_PLATFORM_IS_DARWIN_BASED
|
||||
/* Use the predefined value. */
|
||||
#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE
|
||||
# define U_PLATFORM_IS_DARWIN_BASED 1
|
||||
#else
|
||||
# define U_PLATFORM_IS_DARWIN_BASED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_HAVE_STDINT_H
|
||||
* Defines whether stdint.h is available. It is a C99 standard header.
|
||||
* We used to include inttypes.h which includes stdint.h but we usually do not need
|
||||
* the additional definitions from inttypes.h.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_STDINT_H
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# if defined(__BORLANDC__) || U_PLATFORM == U_PF_MINGW || (defined(_MSC_VER) && _MSC_VER>=1600)
|
||||
/* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */
|
||||
# define U_HAVE_STDINT_H 1
|
||||
# else
|
||||
# define U_HAVE_STDINT_H 0
|
||||
# endif
|
||||
#elif U_PLATFORM == U_PF_SOLARIS
|
||||
/* Solaris has inttypes.h but not stdint.h. */
|
||||
# define U_HAVE_STDINT_H 0
|
||||
#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)
|
||||
/* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */
|
||||
# define U_HAVE_STDINT_H 0
|
||||
#else
|
||||
# define U_HAVE_STDINT_H 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_HAVE_INTTYPES_H
|
||||
* Defines whether inttypes.h is available. It is a C99 standard header.
|
||||
* We include inttypes.h where it is available but stdint.h is not.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_INTTYPES_H
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM == U_PF_SOLARIS
|
||||
/* Solaris has inttypes.h but not stdint.h. */
|
||||
# define U_HAVE_INTTYPES_H 1
|
||||
#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)
|
||||
/* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */
|
||||
# define U_HAVE_INTTYPES_H 1
|
||||
#else
|
||||
/* Most platforms have both inttypes.h and stdint.h, or neither. */
|
||||
# define U_HAVE_INTTYPES_H U_HAVE_STDINT_H
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/** @{ Compiler and environment features */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* \def U_GCC_MAJOR_MINOR
|
||||
* Indicates whether the compiler is gcc (test for != 0),
|
||||
* and if so, contains its major (times 100) and minor version numbers.
|
||||
* If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0.
|
||||
*
|
||||
* For example, for testing for whether we have gcc, and whether it's 4.6 or higher,
|
||||
* use "#if U_GCC_MAJOR_MINOR >= 406".
|
||||
* @internal
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
# define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
#else
|
||||
# define U_GCC_MAJOR_MINOR 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_IS_BIG_ENDIAN
|
||||
* Determines the endianness of the platform.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_IS_BIG_ENDIAN
|
||||
/* Use the predefined value. */
|
||||
#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)
|
||||
# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
|
||||
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
|
||||
/* gcc */
|
||||
# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)
|
||||
# define U_IS_BIG_ENDIAN 1
|
||||
#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
|
||||
# define U_IS_BIG_ENDIAN 0
|
||||
#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__)
|
||||
/* These platforms do not appear to predefine any endianness macros. */
|
||||
# define U_IS_BIG_ENDIAN 1
|
||||
#elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0)
|
||||
/* HPPA do not appear to predefine any endianness macros. */
|
||||
# define U_IS_BIG_ENDIAN 1
|
||||
#elif defined(sparc) || defined(__sparc) || defined(__sparc__)
|
||||
/* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */
|
||||
# define U_IS_BIG_ENDIAN 1
|
||||
#else
|
||||
# define U_IS_BIG_ENDIAN 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_HAVE_PLACEMENT_NEW
|
||||
* Determines whether to override placement new and delete for STL.
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#ifdef U_HAVE_PLACEMENT_NEW
|
||||
/* Use the predefined value. */
|
||||
#elif defined(__BORLANDC__)
|
||||
# define U_HAVE_PLACEMENT_NEW 0
|
||||
#else
|
||||
# define U_HAVE_PLACEMENT_NEW 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_HAVE_DEBUG_LOCATION_NEW
|
||||
* Define this to define the MFC debug version of the operator new.
|
||||
*
|
||||
* @stable ICU 3.4
|
||||
*/
|
||||
#ifdef U_HAVE_DEBUG_LOCATION_NEW
|
||||
/* Use the predefined value. */
|
||||
#elif defined(_MSC_VER)
|
||||
# define U_HAVE_DEBUG_LOCATION_NEW 1
|
||||
#else
|
||||
# define U_HAVE_DEBUG_LOCATION_NEW 0
|
||||
#endif
|
||||
|
||||
/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
#ifndef __has_cpp_attribute
|
||||
# define __has_cpp_attribute(x) 0
|
||||
#endif
|
||||
#ifndef __has_builtin
|
||||
# define __has_builtin(x) 0
|
||||
#endif
|
||||
#ifndef __has_feature
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
#ifndef __has_extension
|
||||
# define __has_extension(x) 0
|
||||
#endif
|
||||
#ifndef __has_warning
|
||||
# define __has_warning(x) 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_MALLOC_ATTR
|
||||
* Attribute to mark functions as malloc-like
|
||||
* @internal
|
||||
*/
|
||||
#if defined(__GNUC__) && __GNUC__>=3
|
||||
# define U_MALLOC_ATTR __attribute__ ((__malloc__))
|
||||
#else
|
||||
# define U_MALLOC_ATTR
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_ALLOC_SIZE_ATTR
|
||||
* Attribute to specify the size of the allocated buffer for malloc-like functions
|
||||
* @internal
|
||||
*/
|
||||
#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || __has_attribute(alloc_size)
|
||||
# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))
|
||||
# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))
|
||||
#else
|
||||
# define U_ALLOC_SIZE_ATTR(X)
|
||||
# define U_ALLOC_SIZE_ATTR2(X,Y)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_CPLUSPLUS_VERSION
|
||||
* 0 if no C++; 1, 11, 14, ... if C++.
|
||||
* Support for specific features cannot always be determined by the C++ version alone.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_CPLUSPLUS_VERSION
|
||||
# if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus)
|
||||
# undef U_CPLUSPLUS_VERSION
|
||||
# define U_CPLUSPLUS_VERSION 0
|
||||
# endif
|
||||
/* Otherwise use the predefined value. */
|
||||
#elif !defined(__cplusplus)
|
||||
# define U_CPLUSPLUS_VERSION 0
|
||||
#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
|
||||
# define U_CPLUSPLUS_VERSION 14
|
||||
#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
|
||||
# define U_CPLUSPLUS_VERSION 11
|
||||
#else
|
||||
// C++98 or C++03
|
||||
# define U_CPLUSPLUS_VERSION 1
|
||||
#endif
|
||||
|
||||
#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
|
||||
// add in std::nullptr_t
|
||||
namespace std {
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_NOEXCEPT
|
||||
* "noexcept" if supported, otherwise empty.
|
||||
* Some code, especially STL containers, uses move semantics of objects only
|
||||
* if the move constructor and the move operator are declared as not throwing exceptions.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_NOEXCEPT
|
||||
/* Use the predefined value. */
|
||||
#elif defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS /* Visual Studio */
|
||||
# define U_NOEXCEPT
|
||||
#elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_noexcept) || __has_extension(cxx_noexcept) \
|
||||
|| (defined(_MSC_VER) && _MSC_VER >= 1900) /* Visual Studio 2015 */
|
||||
# define U_NOEXCEPT noexcept
|
||||
#else
|
||||
# define U_NOEXCEPT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_FALLTHROUGH
|
||||
* Annotate intentional fall-through between switch labels.
|
||||
* http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough
|
||||
* @internal
|
||||
*/
|
||||
#ifndef __cplusplus
|
||||
// Not for C.
|
||||
#elif defined(U_FALLTHROUGH)
|
||||
// Use the predefined value.
|
||||
#elif defined(__clang__)
|
||||
// Test for compiler vs. feature separately.
|
||||
// Other compilers might choke on the feature test.
|
||||
# if __has_cpp_attribute(clang::fallthrough) || \
|
||||
(__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough"))
|
||||
# define U_FALLTHROUGH [[clang::fallthrough]]
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef U_FALLTHROUGH
|
||||
# define U_FALLTHROUGH
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/** @{ Character data types */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_ASCII_FAMILY 0
|
||||
|
||||
/**
|
||||
* U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_EBCDIC_FAMILY 1
|
||||
|
||||
/**
|
||||
* \def U_CHARSET_FAMILY
|
||||
*
|
||||
* <p>These definitions allow to specify the encoding of text
|
||||
* in the char data type as defined by the platform and the compiler.
|
||||
* It is enough to determine the code point values of "invariant characters",
|
||||
* which are the ones shared by all encodings that are in use
|
||||
* on a given platform.</p>
|
||||
*
|
||||
* <p>Those "invariant characters" should be all the uppercase and lowercase
|
||||
* latin letters, the digits, the space, and "basic punctuation".
|
||||
* Also, '\\n', '\\r', '\\t' should be available.</p>
|
||||
*
|
||||
* <p>The list of "invariant characters" is:<br>
|
||||
* \code
|
||||
* A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _
|
||||
* \endcode
|
||||
* <br>
|
||||
* (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>
|
||||
*
|
||||
* <p>This matches the IBM Syntactic Character Set (CS 640).</p>
|
||||
*
|
||||
* <p>In other words, all the graphic characters in 7-bit ASCII should
|
||||
* be safely accessible except the following:</p>
|
||||
*
|
||||
* \code
|
||||
* '\' <backslash>
|
||||
* '[' <left bracket>
|
||||
* ']' <right bracket>
|
||||
* '{' <left brace>
|
||||
* '}' <right brace>
|
||||
* '^' <circumflex>
|
||||
* '~' <tilde>
|
||||
* '!' <exclamation mark>
|
||||
* '#' <number sign>
|
||||
* '|' <vertical line>
|
||||
* '$' <dollar sign>
|
||||
* '@' <commercial at>
|
||||
* '`' <grave accent>
|
||||
* \endcode
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#ifdef U_CHARSET_FAMILY
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB)
|
||||
# define U_CHARSET_FAMILY U_EBCDIC_FAMILY
|
||||
#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__)
|
||||
# define U_CHARSET_FAMILY U_EBCDIC_FAMILY
|
||||
#else
|
||||
# define U_CHARSET_FAMILY U_ASCII_FAMILY
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_CHARSET_IS_UTF8
|
||||
*
|
||||
* Hardcode the default charset to UTF-8.
|
||||
*
|
||||
* If this is set to 1, then
|
||||
* - ICU will assume that all non-invariant char*, StringPiece, std::string etc.
|
||||
* contain UTF-8 text, regardless of what the system API uses
|
||||
* - some ICU code will use fast functions like u_strFromUTF8()
|
||||
* rather than the more general and more heavy-weight conversion API (ucnv.h)
|
||||
* - ucnv_getDefaultName() always returns "UTF-8"
|
||||
* - ucnv_setDefaultName() is disabled and will not change the default charset
|
||||
* - static builds of ICU are smaller
|
||||
* - more functionality is available with the UCONFIG_NO_CONVERSION build-time
|
||||
* configuration option (see unicode/uconfig.h)
|
||||
* - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable
|
||||
*
|
||||
* @stable ICU 4.2
|
||||
* @see UCONFIG_NO_CONVERSION
|
||||
*/
|
||||
#ifdef U_CHARSET_IS_UTF8
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED
|
||||
# define U_CHARSET_IS_UTF8 1
|
||||
#else
|
||||
# define U_CHARSET_IS_UTF8 0
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/** @{ Information about wchar support */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* \def U_HAVE_WCHAR_H
|
||||
* Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#ifdef U_HAVE_WCHAR_H
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9
|
||||
/*
|
||||
* Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t.
|
||||
* The type and header existed, but the library functions did not work as expected.
|
||||
* The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway.
|
||||
*/
|
||||
# define U_HAVE_WCHAR_H 0
|
||||
#else
|
||||
# define U_HAVE_WCHAR_H 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_SIZEOF_WCHAR_T
|
||||
* U_SIZEOF_WCHAR_T==sizeof(wchar_t)
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#ifdef U_SIZEOF_WCHAR_T
|
||||
/* Use the predefined value. */
|
||||
#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9)
|
||||
/*
|
||||
* Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring.
|
||||
* Newer Mac OS X has size 4.
|
||||
*/
|
||||
# define U_SIZEOF_WCHAR_T 1
|
||||
#elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN
|
||||
# define U_SIZEOF_WCHAR_T 2
|
||||
#elif U_PLATFORM == U_PF_AIX
|
||||
/*
|
||||
* AIX 6.1 information, section "Wide character data representation":
|
||||
* "... the wchar_t datatype is 32-bit in the 64-bit environment and
|
||||
* 16-bit in the 32-bit environment."
|
||||
* and
|
||||
* "All locales use Unicode for their wide character code values (process code),
|
||||
* except the IBM-eucTW codeset."
|
||||
*/
|
||||
# ifdef __64BIT__
|
||||
# define U_SIZEOF_WCHAR_T 4
|
||||
# else
|
||||
# define U_SIZEOF_WCHAR_T 2
|
||||
# endif
|
||||
#elif U_PLATFORM == U_PF_OS390
|
||||
/*
|
||||
* z/OS V1R11 information center, section "LP64 | ILP32":
|
||||
* "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes.
|
||||
* Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes."
|
||||
*/
|
||||
# ifdef _LP64
|
||||
# define U_SIZEOF_WCHAR_T 4
|
||||
# else
|
||||
# define U_SIZEOF_WCHAR_T 2
|
||||
# endif
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
# if defined(__UTF32__)
|
||||
/*
|
||||
* LOCALETYPE(*LOCALEUTF) is specified.
|
||||
* Wide-character strings are in UTF-32,
|
||||
* narrow-character strings are in UTF-8.
|
||||
*/
|
||||
# define U_SIZEOF_WCHAR_T 4
|
||||
# elif defined(__UCS2__)
|
||||
/*
|
||||
* LOCALETYPE(*LOCALEUCS2) is specified.
|
||||
* Wide-character strings are in UCS-2,
|
||||
* narrow-character strings are in EBCDIC.
|
||||
*/
|
||||
# define U_SIZEOF_WCHAR_T 2
|
||||
#else
|
||||
/*
|
||||
* LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.
|
||||
* Wide-character strings are in 16-bit EBCDIC,
|
||||
* narrow-character strings are in EBCDIC.
|
||||
*/
|
||||
# define U_SIZEOF_WCHAR_T 2
|
||||
# endif
|
||||
#else
|
||||
# define U_SIZEOF_WCHAR_T 4
|
||||
#endif
|
||||
|
||||
#ifndef U_HAVE_WCSCPY
|
||||
#define U_HAVE_WCSCPY U_HAVE_WCHAR_H
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* \def U_HAVE_CHAR16_T
|
||||
* Defines whether the char16_t type is available for UTF-16
|
||||
* and u"abc" UTF-16 string literals are supported.
|
||||
* This is a new standard type and standard string literal syntax in C++0x
|
||||
* but has been available in some compilers before.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_CHAR16_T
|
||||
/* Use the predefined value. */
|
||||
#else
|
||||
/*
|
||||
* Notes:
|
||||
* Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef
|
||||
* and does not support u"abc" string literals.
|
||||
* Visual Studio 2015 (_MSC_VER>=1900) and above adds support for
|
||||
* both char16_t and u"abc" string literals.
|
||||
* gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but
|
||||
* does not support u"abc" string literals.
|
||||
* C++11 and C11 require support for UTF-16 literals
|
||||
* TODO: Fix for plain C. Doesn't work on Mac.
|
||||
*/
|
||||
# if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
|
||||
# define U_HAVE_CHAR16_T 1
|
||||
# else
|
||||
# define U_HAVE_CHAR16_T 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @{
|
||||
* \def U_DECLARE_UTF16
|
||||
* Do not use this macro because it is not defined on all platforms.
|
||||
* Use the UNICODE_STRING or U_STRING_DECL macros instead.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_DECLARE_UTF16
|
||||
/* Use the predefined value. */
|
||||
#elif U_HAVE_CHAR16_T \
|
||||
|| (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
|
||||
|| (defined(__HP_aCC) && __HP_aCC >= 035000) \
|
||||
|| (defined(__HP_cc) && __HP_cc >= 111106)
|
||||
# define U_DECLARE_UTF16(string) u ## string
|
||||
#elif U_SIZEOF_WCHAR_T == 2 \
|
||||
&& (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))
|
||||
# define U_DECLARE_UTF16(string) L ## string
|
||||
#else
|
||||
/* Leave U_DECLARE_UTF16 undefined. See unistr.h. */
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/** @{ Symbol import-export control */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef U_EXPORT
|
||||
/* Use the predefined value. */
|
||||
#elif defined(U_STATIC_IMPLEMENTATION)
|
||||
# define U_EXPORT
|
||||
#elif defined(__GNUC__)
|
||||
# define U_EXPORT __attribute__((visibility("default")))
|
||||
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
|
||||
|| (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
|
||||
# define U_EXPORT __global
|
||||
/*#elif defined(__HP_aCC) || defined(__HP_cc)
|
||||
# define U_EXPORT __declspec(dllexport)*/
|
||||
#elif defined(_MSC_VER)
|
||||
# define U_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
# define U_EXPORT
|
||||
#endif
|
||||
|
||||
/* U_CALLCONV is releated to U_EXPORT2 */
|
||||
#ifdef U_EXPORT2
|
||||
/* Use the predefined value. */
|
||||
#elif defined(_MSC_VER)
|
||||
# define U_EXPORT2 __cdecl
|
||||
#else
|
||||
# define U_EXPORT2
|
||||
#endif
|
||||
|
||||
#ifdef U_IMPORT
|
||||
/* Use the predefined value. */
|
||||
#elif defined(_MSC_VER)
|
||||
/* Windows needs to export/import data. */
|
||||
# define U_IMPORT __declspec(dllimport)
|
||||
#else
|
||||
# define U_IMPORT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_CALLCONV
|
||||
* Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
|
||||
* in callback function typedefs to make sure that the calling convention
|
||||
* is compatible.
|
||||
*
|
||||
* This is only used for non-ICU-API functions.
|
||||
* When a function is a public ICU API,
|
||||
* you must use the U_CAPI and U_EXPORT2 qualifiers.
|
||||
*
|
||||
* Please note, you need to use U_CALLCONV after the *.
|
||||
*
|
||||
* NO : "static const char U_CALLCONV *func( . . . )"
|
||||
* YES: "static const char* U_CALLCONV func( . . . )"
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
|
||||
# define U_CALLCONV __cdecl
|
||||
#else
|
||||
# define U_CALLCONV U_EXPORT2
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_CALLCONV_FPTR
|
||||
* Similar to U_CALLCONV, but only used on function pointers.
|
||||
* @internal
|
||||
*/
|
||||
#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
|
||||
# define U_CALLCONV_FPTR U_CALLCONV
|
||||
#else
|
||||
# define U_CALLCONV_FPTR
|
||||
#endif
|
||||
/* @} */
|
||||
|
||||
#endif
|
||||
128
vendor/icu/include/unicode/ptypes.h
vendored
Normal file
128
vendor/icu/include/unicode/ptypes.h
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : ptypes.h
|
||||
*
|
||||
* Date Name Description
|
||||
* 05/13/98 nos Creation (content moved here from ptypes.h).
|
||||
* 03/02/99 stephen Added AS400 support.
|
||||
* 03/30/99 stephen Added Linux support.
|
||||
* 04/13/99 stephen Reworked for autoconf.
|
||||
* 09/18/08 srl Moved basic types back to ptypes.h from platform.h
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Definitions of integer types of various widths
|
||||
*/
|
||||
|
||||
#ifndef _PTYPES_H
|
||||
#define _PTYPES_H
|
||||
|
||||
/**
|
||||
* \def __STDC_LIMIT_MACROS
|
||||
* According to the Linux stdint.h, the ISO C99 standard specifies that in C++ implementations
|
||||
* macros like INT32_MIN and UINTPTR_MAX should only be defined if explicitly requested.
|
||||
* We need to define __STDC_LIMIT_MACROS before including stdint.h in C++ code
|
||||
* that uses such limit macros.
|
||||
* @internal
|
||||
*/
|
||||
#ifndef __STDC_LIMIT_MACROS
|
||||
#define __STDC_LIMIT_MACROS
|
||||
#endif
|
||||
|
||||
/* NULL, size_t, wchar_t */
|
||||
#include <stddef.h>
|
||||
|
||||
/*
|
||||
* If all compilers provided all of the C99 headers and types,
|
||||
* we would just unconditionally #include <stdint.h> here
|
||||
* and not need any of the stuff after including platform.h.
|
||||
*/
|
||||
|
||||
/* Find out if we have stdint.h etc. */
|
||||
#include <unicode/platform.h>
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Generic data types */
|
||||
/*===========================================================================*/
|
||||
|
||||
/* If your platform does not have the <stdint.h> header, you may
|
||||
need to edit the typedefs in the #else section below.
|
||||
Use #if...#else...#endif with predefined compiler macros if possible. */
|
||||
#if U_HAVE_STDINT_H
|
||||
|
||||
/*
|
||||
* We mostly need <stdint.h> (which defines the standard integer types) but not <inttypes.h>.
|
||||
* <inttypes.h> includes <stdint.h> and adds the printf/scanf helpers PRId32, SCNx16 etc.
|
||||
* which we almost never use, plus stuff like imaxabs() which we never use.
|
||||
*/
|
||||
#include <stdint.h>
|
||||
|
||||
#if U_PLATFORM == U_PF_OS390
|
||||
/* The features header is needed to get (u)int64_t sometimes. */
|
||||
#include <features.h>
|
||||
/* z/OS has <stdint.h>, but some versions are missing uint8_t (APAR PK62248). */
|
||||
#if !defined(__uint8_t)
|
||||
#define __uint8_t 1
|
||||
typedef unsigned char uint8_t;
|
||||
#endif
|
||||
#endif /* U_PLATFORM == U_PF_OS390 */
|
||||
|
||||
#elif U_HAVE_INTTYPES_H
|
||||
|
||||
# include <inttypes.h>
|
||||
|
||||
#else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */
|
||||
|
||||
#if ! U_HAVE_INT8_T
|
||||
typedef signed char int8_t;
|
||||
#endif
|
||||
|
||||
#if ! U_HAVE_UINT8_T
|
||||
typedef unsigned char uint8_t;
|
||||
#endif
|
||||
|
||||
#if ! U_HAVE_INT16_T
|
||||
typedef signed short int16_t;
|
||||
#endif
|
||||
|
||||
#if ! U_HAVE_UINT16_T
|
||||
typedef unsigned short uint16_t;
|
||||
#endif
|
||||
|
||||
#if ! U_HAVE_INT32_T
|
||||
typedef signed int int32_t;
|
||||
#endif
|
||||
|
||||
#if ! U_HAVE_UINT32_T
|
||||
typedef unsigned int uint32_t;
|
||||
#endif
|
||||
|
||||
#if ! U_HAVE_INT64_T
|
||||
#ifdef _MSC_VER
|
||||
typedef signed __int64 int64_t;
|
||||
#else
|
||||
typedef signed long long int64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ! U_HAVE_UINT64_T
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
typedef unsigned long long uint64_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */
|
||||
|
||||
#endif /* _PTYPES_H */
|
||||
183
vendor/icu/include/unicode/putil.h
vendored
Normal file
183
vendor/icu/include/unicode/putil.h
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : putil.h
|
||||
*
|
||||
* Date Name Description
|
||||
* 05/14/98 nos Creation (content moved here from utypes.h).
|
||||
* 06/17/99 erm Added IEEE_754
|
||||
* 07/22/98 stephen Added IEEEremainder, max, min, trunc
|
||||
* 08/13/98 stephen Added isNegativeInfinity, isPositiveInfinity
|
||||
* 08/24/98 stephen Added longBitsFromDouble
|
||||
* 03/02/99 stephen Removed openFile(). Added AS400 support.
|
||||
* 04/15/99 stephen Converted to C
|
||||
* 11/15/99 helena Integrated S/390 changes for IEEE support.
|
||||
* 01/11/00 helena Added u_getVersion.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef PUTIL_H
|
||||
#define PUTIL_H
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Platform Utilities
|
||||
*/
|
||||
|
||||
/*==========================================================================*/
|
||||
/* Platform utilities */
|
||||
/*==========================================================================*/
|
||||
|
||||
/**
|
||||
* Platform utilities isolates the platform dependencies of the
|
||||
* library. For each platform which this code is ported to, these
|
||||
* functions may have to be re-implemented.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return the ICU data directory.
|
||||
* The data directory is where common format ICU data files (.dat files)
|
||||
* are loaded from. Note that normal use of the built-in ICU
|
||||
* facilities does not require loading of an external data file;
|
||||
* unless you are adding custom data to ICU, the data directory
|
||||
* does not need to be set.
|
||||
*
|
||||
* The data directory is determined as follows:
|
||||
* If u_setDataDirectory() has been called, that is it, otherwise
|
||||
* if the ICU_DATA environment variable is set, use that, otherwise
|
||||
* If a data directory was specified at ICU build time
|
||||
* <code>
|
||||
* \code
|
||||
* #define ICU_DATA_DIR "path"
|
||||
* \endcode
|
||||
* </code> use that,
|
||||
* otherwise no data directory is available.
|
||||
*
|
||||
* @return the data directory, or an empty string ("") if no data directory has
|
||||
* been specified.
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
|
||||
|
||||
|
||||
/**
|
||||
* Set the ICU data directory.
|
||||
* The data directory is where common format ICU data files (.dat files)
|
||||
* are loaded from. Note that normal use of the built-in ICU
|
||||
* facilities does not require loading of an external data file;
|
||||
* unless you are adding custom data to ICU, the data directory
|
||||
* does not need to be set.
|
||||
*
|
||||
* This function should be called at most once in a process, before the
|
||||
* first ICU operation (e.g., u_init()) that will require the loading of an
|
||||
* ICU data file.
|
||||
* This function is not thread-safe. Use it before calling ICU APIs from
|
||||
* multiple threads.
|
||||
*
|
||||
* @param directory The directory to be set.
|
||||
*
|
||||
* @see u_init
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Return the time zone files override directory, or an empty string if
|
||||
* no directory was specified. Certain time zone resources will be preferentially
|
||||
* loaded from individual files in this directory.
|
||||
*
|
||||
* @return the time zone data override directory.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Set the time zone files override directory.
|
||||
* This function is not thread safe; it must not be called concurrently with
|
||||
* u_getTimeZoneFilesDirectory() or any other use of ICU time zone functions.
|
||||
* This function should only be called before using any ICU service that
|
||||
* will access the time zone data.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2 u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status);
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
|
||||
/**
|
||||
* @{
|
||||
* Filesystem file and path separator characters.
|
||||
* Example: '/' and ':' on Unix, '\\' and ';' on Windows.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#if U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# define U_FILE_SEP_CHAR '\\'
|
||||
# define U_FILE_ALT_SEP_CHAR '/'
|
||||
# define U_PATH_SEP_CHAR ';'
|
||||
# define U_FILE_SEP_STRING "\\"
|
||||
# define U_FILE_ALT_SEP_STRING "/"
|
||||
# define U_PATH_SEP_STRING ";"
|
||||
#else
|
||||
# define U_FILE_SEP_CHAR '/'
|
||||
# define U_FILE_ALT_SEP_CHAR '/'
|
||||
# define U_PATH_SEP_CHAR ':'
|
||||
# define U_FILE_SEP_STRING "/"
|
||||
# define U_FILE_ALT_SEP_STRING "/"
|
||||
# define U_PATH_SEP_STRING ":"
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Convert char characters to UChar characters.
|
||||
* This utility function is useful only for "invariant characters"
|
||||
* that are encoded in the platform default encoding.
|
||||
* They are a small, constant subset of the encoding and include
|
||||
* just the latin letters, digits, and some punctuation.
|
||||
* For details, see U_CHARSET_FAMILY.
|
||||
*
|
||||
* @param cs Input string, points to <code>length</code>
|
||||
* character bytes from a subset of the platform encoding.
|
||||
* @param us Output string, points to memory for <code>length</code>
|
||||
* Unicode characters.
|
||||
* @param length The number of characters to convert; this may
|
||||
* include the terminating <code>NUL</code>.
|
||||
*
|
||||
* @see U_CHARSET_FAMILY
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_charsToUChars(const char *cs, UChar *us, int32_t length);
|
||||
|
||||
/**
|
||||
* Convert UChar characters to char characters.
|
||||
* This utility function is useful only for "invariant characters"
|
||||
* that can be encoded in the platform default encoding.
|
||||
* They are a small, constant subset of the encoding and include
|
||||
* just the latin letters, digits, and some punctuation.
|
||||
* For details, see U_CHARSET_FAMILY.
|
||||
*
|
||||
* @param us Input string, points to <code>length</code>
|
||||
* Unicode characters that can be encoded with the
|
||||
* codepage-invariant subset of the platform encoding.
|
||||
* @param cs Output string, points to memory for <code>length</code>
|
||||
* character bytes.
|
||||
* @param length The number of characters to convert; this may
|
||||
* include the terminating <code>NUL</code>.
|
||||
*
|
||||
* @see U_CHARSET_FAMILY
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_UCharsToChars(const UChar *us, char *cs, int32_t length);
|
||||
|
||||
#endif
|
||||
263
vendor/icu/include/unicode/rep.h
vendored
Normal file
263
vendor/icu/include/unicode/rep.h
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**************************************************************************
|
||||
* Copyright (C) 1999-2012, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
**************************************************************************
|
||||
* Date Name Description
|
||||
* 11/17/99 aliu Creation. Ported from java. Modified to
|
||||
* match current UnicodeString API. Forced
|
||||
* to use name "handleReplaceBetween" because
|
||||
* of existing methods in UnicodeString.
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef REP_H
|
||||
#define REP_H
|
||||
|
||||
#include <unicode/uobject.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: Replaceable String
|
||||
*/
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
class UnicodeString;
|
||||
|
||||
/**
|
||||
* <code>Replaceable</code> is an abstract base class representing a
|
||||
* string of characters that supports the replacement of a range of
|
||||
* itself with a new string of characters. It is used by APIs that
|
||||
* change a piece of text while retaining metadata. Metadata is data
|
||||
* other than the Unicode characters returned by char32At(). One
|
||||
* example of metadata is style attributes; another is an edit
|
||||
* history, marking each character with an author and revision number.
|
||||
*
|
||||
* <p>An implicit aspect of the <code>Replaceable</code> API is that
|
||||
* during a replace operation, new characters take on the metadata of
|
||||
* the old characters. For example, if the string "the <b>bold</b>
|
||||
* font" has range (4, 8) replaced with "strong", then it becomes "the
|
||||
* <b>strong</b> font".
|
||||
*
|
||||
* <p><code>Replaceable</code> specifies ranges using a start
|
||||
* offset and a limit offset. The range of characters thus specified
|
||||
* includes the characters at offset start..limit-1. That is, the
|
||||
* start offset is inclusive, and the limit offset is exclusive.
|
||||
*
|
||||
* <p><code>Replaceable</code> also includes API to access characters
|
||||
* in the string: <code>length()</code>, <code>charAt()</code>,
|
||||
* <code>char32At()</code>, and <code>extractBetween()</code>.
|
||||
*
|
||||
* <p>For a subclass to support metadata, typical behavior of
|
||||
* <code>replace()</code> is the following:
|
||||
* <ul>
|
||||
* <li>Set the metadata of the new text to the metadata of the first
|
||||
* character replaced</li>
|
||||
* <li>If no characters are replaced, use the metadata of the
|
||||
* previous character</li>
|
||||
* <li>If there is no previous character (i.e. start == 0), use the
|
||||
* following character</li>
|
||||
* <li>If there is no following character (i.e. the replaceable was
|
||||
* empty), use default metadata.<br>
|
||||
* <li>If the code point U+FFFF is seen, it should be interpreted as
|
||||
* a special marker having no metadata<li>
|
||||
* </li>
|
||||
* </ul>
|
||||
* If this is not the behavior, the subclass should document any differences.
|
||||
* @author Alan Liu
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
class U_COMMON_API Replaceable : public UObject {
|
||||
|
||||
public:
|
||||
/**
|
||||
* Destructor.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
virtual ~Replaceable();
|
||||
|
||||
/**
|
||||
* Returns the number of 16-bit code units in the text.
|
||||
* @return number of 16-bit code units in text
|
||||
* @stable ICU 1.8
|
||||
*/
|
||||
inline int32_t length() const;
|
||||
|
||||
/**
|
||||
* Returns the 16-bit code unit at the given offset into the text.
|
||||
* @param offset an integer between 0 and <code>length()</code>-1
|
||||
* inclusive
|
||||
* @return 16-bit code unit of text at given offset
|
||||
* @stable ICU 1.8
|
||||
*/
|
||||
inline char16_t charAt(int32_t offset) const;
|
||||
|
||||
/**
|
||||
* Returns the 32-bit code point at the given 16-bit offset into
|
||||
* the text. This assumes the text is stored as 16-bit code units
|
||||
* with surrogate pairs intermixed. If the offset of a leading or
|
||||
* trailing code unit of a surrogate pair is given, return the
|
||||
* code point of the surrogate pair.
|
||||
*
|
||||
* @param offset an integer between 0 and <code>length()</code>-1
|
||||
* inclusive
|
||||
* @return 32-bit code point of text at given offset
|
||||
* @stable ICU 1.8
|
||||
*/
|
||||
inline UChar32 char32At(int32_t offset) const;
|
||||
|
||||
/**
|
||||
* Copies characters in the range [<tt>start</tt>, <tt>limit</tt>)
|
||||
* into the UnicodeString <tt>target</tt>.
|
||||
* @param start offset of first character which will be copied
|
||||
* @param limit offset immediately following the last character to
|
||||
* be copied
|
||||
* @param target UnicodeString into which to copy characters.
|
||||
* @return A reference to <TT>target</TT>
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
virtual void extractBetween(int32_t start,
|
||||
int32_t limit,
|
||||
UnicodeString& target) const = 0;
|
||||
|
||||
/**
|
||||
* Replaces a substring of this object with the given text. If the
|
||||
* characters being replaced have metadata, the new characters
|
||||
* that replace them should be given the same metadata.
|
||||
*
|
||||
* <p>Subclasses must ensure that if the text between start and
|
||||
* limit is equal to the replacement text, that replace has no
|
||||
* effect. That is, any metadata
|
||||
* should be unaffected. In addition, subclasses are encouraged to
|
||||
* check for initial and trailing identical characters, and make a
|
||||
* smaller replacement if possible. This will preserve as much
|
||||
* metadata as possible.
|
||||
* @param start the beginning index, inclusive; <code>0 <= start
|
||||
* <= limit</code>.
|
||||
* @param limit the ending index, exclusive; <code>start <= limit
|
||||
* <= length()</code>.
|
||||
* @param text the text to replace characters <code>start</code>
|
||||
* to <code>limit - 1</code>
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
virtual void handleReplaceBetween(int32_t start,
|
||||
int32_t limit,
|
||||
const UnicodeString& text) = 0;
|
||||
// Note: All other methods in this class take the names of
|
||||
// existing UnicodeString methods. This method is the exception.
|
||||
// It is named differently because all replace methods of
|
||||
// UnicodeString return a UnicodeString&. The 'between' is
|
||||
// required in order to conform to the UnicodeString naming
|
||||
// convention; API taking start/length are named <operation>, and
|
||||
// those taking start/limit are named <operationBetween>. The
|
||||
// 'handle' is added because 'replaceBetween' and
|
||||
// 'doReplaceBetween' are already taken.
|
||||
|
||||
/**
|
||||
* Copies a substring of this object, retaining metadata.
|
||||
* This method is used to duplicate or reorder substrings.
|
||||
* The destination index must not overlap the source range.
|
||||
*
|
||||
* @param start the beginning index, inclusive; <code>0 <= start <=
|
||||
* limit</code>.
|
||||
* @param limit the ending index, exclusive; <code>start <= limit <=
|
||||
* length()</code>.
|
||||
* @param dest the destination index. The characters from
|
||||
* <code>start..limit-1</code> will be copied to <code>dest</code>.
|
||||
* Implementations of this method may assume that <code>dest <= start ||
|
||||
* dest >= limit</code>.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
virtual void copy(int32_t start, int32_t limit, int32_t dest) = 0;
|
||||
|
||||
/**
|
||||
* Returns true if this object contains metadata. If a
|
||||
* Replaceable object has metadata, calls to the Replaceable API
|
||||
* must be made so as to preserve metadata. If it does not, calls
|
||||
* to the Replaceable API may be optimized to improve performance.
|
||||
* The default implementation returns true.
|
||||
* @return true if this object contains metadata
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
virtual UBool hasMetaData() const;
|
||||
|
||||
/**
|
||||
* Clone this object, an instance of a subclass of Replaceable.
|
||||
* Clones can be used concurrently in multiple threads.
|
||||
* If a subclass does not implement clone(), or if an error occurs,
|
||||
* then NULL is returned.
|
||||
* The clone functions in all subclasses return a pointer to a Replaceable
|
||||
* because some compilers do not support covariant (same-as-this)
|
||||
* return types; cast to the appropriate subclass if necessary.
|
||||
* The caller must delete the clone.
|
||||
*
|
||||
* @return a clone of this object
|
||||
*
|
||||
* @see getDynamicClassID
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
virtual Replaceable *clone() const;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
inline Replaceable();
|
||||
|
||||
/*
|
||||
* Assignment operator not declared. The compiler will provide one
|
||||
* which does nothing since this class does not contain any data members.
|
||||
* API/code coverage may show the assignment operator as present and
|
||||
* untested - ignore.
|
||||
* Subclasses need this assignment operator if they use compiler-provided
|
||||
* assignment operators of their own. An alternative to not declaring one
|
||||
* here would be to declare and empty-implement a protected or public one.
|
||||
Replaceable &Replaceable::operator=(const Replaceable &);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Virtual version of length().
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
virtual int32_t getLength() const = 0;
|
||||
|
||||
/**
|
||||
* Virtual version of charAt().
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
virtual char16_t getCharAt(int32_t offset) const = 0;
|
||||
|
||||
/**
|
||||
* Virtual version of char32At().
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
virtual UChar32 getChar32At(int32_t offset) const = 0;
|
||||
};
|
||||
|
||||
inline Replaceable::Replaceable() {}
|
||||
|
||||
inline int32_t
|
||||
Replaceable::length() const {
|
||||
return getLength();
|
||||
}
|
||||
|
||||
inline char16_t
|
||||
Replaceable::charAt(int32_t offset) const {
|
||||
return getCharAt(offset);
|
||||
}
|
||||
|
||||
inline UChar32
|
||||
Replaceable::char32At(int32_t offset) const {
|
||||
return getChar32At(offset);
|
||||
}
|
||||
|
||||
// There is no rep.cpp, see unistr.cpp for Replaceable function implementations.
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
37
vendor/icu/include/unicode/std_string.h
vendored
Normal file
37
vendor/icu/include/unicode/std_string.h
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: std_string.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2009feb19
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __STD_STRING_H__
|
||||
#define __STD_STRING_H__
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: Central ICU header for including the C++ standard <string>
|
||||
* header and for related definitions.
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
// Workaround for a libstdc++ bug before libstdc++4.6 (2011).
|
||||
// https://bugs.llvm.org/show_bug.cgi?id=13364
|
||||
#if defined(__GLIBCXX__)
|
||||
namespace std { class type_info; }
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
#endif // __STD_STRING_H__
|
||||
198
vendor/icu/include/unicode/stringoptions.h
vendored
Normal file
198
vendor/icu/include/unicode/stringoptions.h
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
// © 2017 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
|
||||
// stringoptions.h
|
||||
// created: 2017jun08 Markus W. Scherer
|
||||
|
||||
#ifndef __STRINGOPTIONS_H__
|
||||
#define __STRINGOPTIONS_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Bit set option bit constants for various string and character processing functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Option value for case folding: Use default mappings defined in CaseFolding.txt.
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_FOLD_CASE_DEFAULT 0
|
||||
|
||||
/**
|
||||
* Option value for case folding:
|
||||
*
|
||||
* Use the modified set of mappings provided in CaseFolding.txt to handle dotted I
|
||||
* and dotless i appropriately for Turkic languages (tr, az).
|
||||
*
|
||||
* Before Unicode 3.2, CaseFolding.txt contains mappings marked with 'I' that
|
||||
* are to be included for default mappings and
|
||||
* excluded for the Turkic-specific mappings.
|
||||
*
|
||||
* Unicode 3.2 CaseFolding.txt instead contains mappings marked with 'T' that
|
||||
* are to be excluded for default mappings and
|
||||
* included for the Turkic-specific mappings.
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_FOLD_CASE_EXCLUDE_SPECIAL_I 1
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Titlecase the string as a whole rather than each word.
|
||||
* (Titlecase only the character at index 0, possibly adjusted.)
|
||||
* Option bits value for titlecasing APIs that take an options bit set.
|
||||
*
|
||||
* It is an error to specify multiple titlecasing iterator options together,
|
||||
* including both an options bit and an explicit BreakIterator.
|
||||
*
|
||||
* @see U_TITLECASE_ADJUST_TO_CASED
|
||||
* @draft ICU 60
|
||||
*/
|
||||
#define U_TITLECASE_WHOLE_STRING 0x20
|
||||
|
||||
/**
|
||||
* Titlecase sentences rather than words.
|
||||
* (Titlecase only the first character of each sentence, possibly adjusted.)
|
||||
* Option bits value for titlecasing APIs that take an options bit set.
|
||||
*
|
||||
* It is an error to specify multiple titlecasing iterator options together,
|
||||
* including both an options bit and an explicit BreakIterator.
|
||||
*
|
||||
* @see U_TITLECASE_ADJUST_TO_CASED
|
||||
* @draft ICU 60
|
||||
*/
|
||||
#define U_TITLECASE_SENTENCES 0x40
|
||||
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Do not lowercase non-initial parts of words when titlecasing.
|
||||
* Option bit for titlecasing APIs that take an options bit set.
|
||||
*
|
||||
* By default, titlecasing will titlecase the character at each
|
||||
* (possibly adjusted) BreakIterator index and
|
||||
* lowercase all other characters up to the next iterator index.
|
||||
* With this option, the other characters will not be modified.
|
||||
*
|
||||
* @see U_TITLECASE_ADJUST_TO_CASED
|
||||
* @see UnicodeString::toTitle
|
||||
* @see CaseMap::toTitle
|
||||
* @see ucasemap_setOptions
|
||||
* @see ucasemap_toTitle
|
||||
* @see ucasemap_utf8ToTitle
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
#define U_TITLECASE_NO_LOWERCASE 0x100
|
||||
|
||||
/**
|
||||
* Do not adjust the titlecasing BreakIterator indexes;
|
||||
* titlecase exactly the characters at breaks from the iterator.
|
||||
* Option bit for titlecasing APIs that take an options bit set.
|
||||
*
|
||||
* By default, titlecasing will take each break iterator index,
|
||||
* adjust it to the next relevant character (see U_TITLECASE_ADJUST_TO_CASED),
|
||||
* and titlecase that one.
|
||||
*
|
||||
* Other characters are lowercased.
|
||||
*
|
||||
* It is an error to specify multiple titlecasing adjustment options together.
|
||||
*
|
||||
* @see U_TITLECASE_ADJUST_TO_CASED
|
||||
* @see U_TITLECASE_NO_LOWERCASE
|
||||
* @see UnicodeString::toTitle
|
||||
* @see CaseMap::toTitle
|
||||
* @see ucasemap_setOptions
|
||||
* @see ucasemap_toTitle
|
||||
* @see ucasemap_utf8ToTitle
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
#define U_TITLECASE_NO_BREAK_ADJUSTMENT 0x200
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Adjust each titlecasing BreakIterator index to the next cased character.
|
||||
* (See the Unicode Standard, chapter 3, Default Case Conversion, R3 toTitlecase(X).)
|
||||
* Option bit for titlecasing APIs that take an options bit set.
|
||||
*
|
||||
* This used to be the default index adjustment in ICU.
|
||||
* Since ICU 60, the default index adjustment is to the next character that is
|
||||
* a letter, number, symbol, or private use code point.
|
||||
* (Uncased modifier letters are skipped.)
|
||||
* The difference in behavior is small for word titlecasing,
|
||||
* but the new adjustment is much better for whole-string and sentence titlecasing:
|
||||
* It yields "49ers" and "«丰(abc)»" instead of "49Ers" and "«丰(Abc)»".
|
||||
*
|
||||
* It is an error to specify multiple titlecasing adjustment options together.
|
||||
*
|
||||
* @see U_TITLECASE_NO_BREAK_ADJUSTMENT
|
||||
* @draft ICU 60
|
||||
*/
|
||||
#define U_TITLECASE_ADJUST_TO_CASED 0x400
|
||||
|
||||
/**
|
||||
* Option for string transformation functions to not first reset the Edits object.
|
||||
* Used for example in some case-mapping and normalization functions.
|
||||
*
|
||||
* @see CaseMap
|
||||
* @see Edits
|
||||
* @see Normalizer2
|
||||
* @draft ICU 60
|
||||
*/
|
||||
#define U_EDITS_NO_RESET 0x2000
|
||||
|
||||
/**
|
||||
* Omit unchanged text when recording how source substrings
|
||||
* relate to changed and unchanged result substrings.
|
||||
* Used for example in some case-mapping and normalization functions.
|
||||
*
|
||||
* @see CaseMap
|
||||
* @see Edits
|
||||
* @see Normalizer2
|
||||
* @draft ICU 60
|
||||
*/
|
||||
#define U_OMIT_UNCHANGED_TEXT 0x4000
|
||||
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Option bit for u_strCaseCompare, u_strcasecmp, unorm_compare, etc:
|
||||
* Compare strings in code point order instead of code unit order.
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
#define U_COMPARE_CODE_POINT_ORDER 0x8000
|
||||
|
||||
/**
|
||||
* Option bit for unorm_compare:
|
||||
* Perform case-insensitive comparison.
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
#define U_COMPARE_IGNORE_CASE 0x10000
|
||||
|
||||
/**
|
||||
* Option bit for unorm_compare:
|
||||
* Both input strings are assumed to fulfill FCD conditions.
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
#define UNORM_INPUT_IS_FCD 0x20000
|
||||
|
||||
// Related definitions elsewhere.
|
||||
// Options that are not meaningful in the same functions
|
||||
// can share the same bits.
|
||||
//
|
||||
// Public:
|
||||
// unicode/unorm.h #define UNORM_COMPARE_NORM_OPTIONS_SHIFT 20
|
||||
//
|
||||
// Internal: (may change or be removed)
|
||||
// ucase.h #define _STRCASECMP_OPTIONS_MASK 0xffff
|
||||
// ucase.h #define _FOLD_CASE_OPTIONS_MASK 7
|
||||
// ucasemap_imp.h #define U_TITLECASE_ITERATOR_MASK 0xe0
|
||||
// ucasemap_imp.h #define U_TITLECASE_ADJUSTMENT_MASK 0x600
|
||||
// ustr_imp.h #define _STRNCMP_STYLE 0x1000
|
||||
// unormcmp.cpp #define _COMPARE_EQUIV 0x80000
|
||||
|
||||
#endif // __STRINGOPTIONS_H__
|
||||
224
vendor/icu/include/unicode/stringpiece.h
vendored
Normal file
224
vendor/icu/include/unicode/stringpiece.h
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
// Copyright (C) 2009-2013, International Business Machines
|
||||
// Corporation and others. All Rights Reserved.
|
||||
//
|
||||
// Copyright 2001 and onwards Google Inc.
|
||||
// Author: Sanjay Ghemawat
|
||||
|
||||
// This code is a contribution of Google code, and the style used here is
|
||||
// a compromise between the original Google code and the ICU coding guidelines.
|
||||
// For example, data types are ICU-ified (size_t,int->int32_t),
|
||||
// and API comments doxygen-ified, but function names and behavior are
|
||||
// as in the original, if possible.
|
||||
// Assertion-style error handling, not available in ICU, was changed to
|
||||
// parameter "pinning" similar to UnicodeString.
|
||||
//
|
||||
// In addition, this is only a partial port of the original Google code,
|
||||
// limited to what was needed so far. The (nearly) complete original code
|
||||
// is in the ICU svn repository at icuhtml/trunk/design/strings/contrib
|
||||
// (see ICU ticket 6765, r25517).
|
||||
|
||||
#ifndef __STRINGPIECE_H__
|
||||
#define __STRINGPIECE_H__
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: StringPiece: Read-only byte string wrapper class.
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uobject.h>
|
||||
#include <unicode/std_string.h>
|
||||
|
||||
// Arghh! I wish C++ literals were "string".
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* A string-like object that points to a sized piece of memory.
|
||||
*
|
||||
* We provide non-explicit singleton constructors so users can pass
|
||||
* in a "const char*" or a "string" wherever a "StringPiece" is
|
||||
* expected.
|
||||
*
|
||||
* Functions or methods may use StringPiece parameters to accept either a
|
||||
* "const char*" or a "string" value that will be implicitly converted to a
|
||||
* StringPiece.
|
||||
*
|
||||
* Systematic usage of StringPiece is encouraged as it will reduce unnecessary
|
||||
* conversions from "const char*" to "string" and back again.
|
||||
*
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
class U_COMMON_API StringPiece : public UMemory {
|
||||
private:
|
||||
const char* ptr_;
|
||||
int32_t length_;
|
||||
|
||||
public:
|
||||
/**
|
||||
* Default constructor, creates an empty StringPiece.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece() : ptr_(NULL), length_(0) { }
|
||||
/**
|
||||
* Constructs from a NUL-terminated const char * pointer.
|
||||
* @param str a NUL-terminated const char * pointer
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece(const char* str);
|
||||
/**
|
||||
* Constructs from a std::string.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece(const std::string& str)
|
||||
: ptr_(str.data()), length_(static_cast<int32_t>(str.size())) { }
|
||||
/**
|
||||
* Constructs from a const char * pointer and a specified length.
|
||||
* @param offset a const char * pointer (need not be terminated)
|
||||
* @param len the length of the string; must be non-negative
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece(const char* offset, int32_t len) : ptr_(offset), length_(len) { }
|
||||
/**
|
||||
* Substring of another StringPiece.
|
||||
* @param x the other StringPiece
|
||||
* @param pos start position in x; must be non-negative and <= x.length().
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece(const StringPiece& x, int32_t pos);
|
||||
/**
|
||||
* Substring of another StringPiece.
|
||||
* @param x the other StringPiece
|
||||
* @param pos start position in x; must be non-negative and <= x.length().
|
||||
* @param len length of the substring;
|
||||
* must be non-negative and will be pinned to at most x.length() - pos.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece(const StringPiece& x, int32_t pos, int32_t len);
|
||||
|
||||
/**
|
||||
* Returns the string pointer. May be NULL if it is empty.
|
||||
*
|
||||
* data() may return a pointer to a buffer with embedded NULs, and the
|
||||
* returned buffer may or may not be null terminated. Therefore it is
|
||||
* typically a mistake to pass data() to a routine that expects a NUL
|
||||
* terminated string.
|
||||
* @return the string pointer
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
const char* data() const { return ptr_; }
|
||||
/**
|
||||
* Returns the string length. Same as length().
|
||||
* @return the string length
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
int32_t size() const { return length_; }
|
||||
/**
|
||||
* Returns the string length. Same as size().
|
||||
* @return the string length
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
int32_t length() const { return length_; }
|
||||
/**
|
||||
* Returns whether the string is empty.
|
||||
* @return TRUE if the string is empty
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
UBool empty() const { return length_ == 0; }
|
||||
|
||||
/**
|
||||
* Sets to an empty string.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
void clear() { ptr_ = NULL; length_ = 0; }
|
||||
|
||||
/**
|
||||
* Reset the stringpiece to refer to new data.
|
||||
* @param xdata pointer the new string data. Need not be nul terminated.
|
||||
* @param len the length of the new data
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
void set(const char* xdata, int32_t len) { ptr_ = xdata; length_ = len; }
|
||||
|
||||
/**
|
||||
* Reset the stringpiece to refer to new data.
|
||||
* @param str a pointer to a NUL-terminated string.
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
void set(const char* str);
|
||||
|
||||
/**
|
||||
* Removes the first n string units.
|
||||
* @param n prefix length, must be non-negative and <=length()
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
void remove_prefix(int32_t n) {
|
||||
if (n >= 0) {
|
||||
if (n > length_) {
|
||||
n = length_;
|
||||
}
|
||||
ptr_ += n;
|
||||
length_ -= n;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the last n string units.
|
||||
* @param n suffix length, must be non-negative and <=length()
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
void remove_suffix(int32_t n) {
|
||||
if (n >= 0) {
|
||||
if (n <= length_) {
|
||||
length_ -= n;
|
||||
} else {
|
||||
length_ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum integer, used as a default value for substring methods.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
static const int32_t npos; // = 0x7fffffff;
|
||||
|
||||
/**
|
||||
* Returns a substring of this StringPiece.
|
||||
* @param pos start position; must be non-negative and <= length().
|
||||
* @param len length of the substring;
|
||||
* must be non-negative and will be pinned to at most length() - pos.
|
||||
* @return the substring StringPiece
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
StringPiece substr(int32_t pos, int32_t len = npos) const {
|
||||
return StringPiece(*this, pos, len);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Global operator == for StringPiece
|
||||
* @param x The first StringPiece to compare.
|
||||
* @param y The second StringPiece to compare.
|
||||
* @return TRUE if the string data is equal
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
U_EXPORT UBool U_EXPORT2
|
||||
operator==(const StringPiece& x, const StringPiece& y);
|
||||
|
||||
/**
|
||||
* Global operator != for StringPiece
|
||||
* @param x The first StringPiece to compare.
|
||||
* @param y The second StringPiece to compare.
|
||||
* @return TRUE if the string data is not equal
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
inline UBool operator!=(const StringPiece& x, const StringPiece& y) {
|
||||
return !(x == y);
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif // __STRINGPIECE_H__
|
||||
2201
vendor/icu/include/unicode/ubidi.h
vendored
Normal file
2201
vendor/icu/include/unicode/ubidi.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3731
vendor/icu/include/unicode/uchar.h
vendored
Normal file
3731
vendor/icu/include/unicode/uchar.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
262
vendor/icu/include/unicode/uclean.h
vendored
Normal file
262
vendor/icu/include/unicode/uclean.h
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 2001-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
******************************************************************************
|
||||
* file name: uclean.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2001July05
|
||||
* created by: George Rhoten
|
||||
*/
|
||||
|
||||
#ifndef __UCLEAN_H__
|
||||
#define __UCLEAN_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Initialize and clean up ICU
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize ICU.
|
||||
*
|
||||
* Use of this function is optional. It is OK to simply use ICU
|
||||
* services and functions without first having initialized
|
||||
* ICU by calling u_init().
|
||||
*
|
||||
* u_init() will attempt to load some part of ICU's data, and is
|
||||
* useful as a test for configuration or installation problems that
|
||||
* leave the ICU data inaccessible. A successful invocation of u_init()
|
||||
* does not, however, guarantee that all ICU data is accessible.
|
||||
*
|
||||
* Multiple calls to u_init() cause no harm, aside from the small amount
|
||||
* of time required.
|
||||
*
|
||||
* In old versions of ICU, u_init() was required in multi-threaded applications
|
||||
* to ensure the thread safety of ICU. u_init() is no longer needed for this purpose.
|
||||
*
|
||||
* @param status An ICU UErrorCode parameter. It must not be <code>NULL</code>.
|
||||
* An Error will be returned if some required part of ICU data can not
|
||||
* be loaded or initialized.
|
||||
* The function returns immediately if the input error code indicates a
|
||||
* failure, as usual.
|
||||
*
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_init(UErrorCode *status);
|
||||
|
||||
#ifndef U_HIDE_SYSTEM_API
|
||||
/**
|
||||
* Clean up the system resources, such as allocated memory or open files,
|
||||
* used in all ICU libraries. This will free/delete all memory owned by the
|
||||
* ICU libraries, and return them to their original load state. All open ICU
|
||||
* items (collators, resource bundles, converters, etc.) must be closed before
|
||||
* calling this function, otherwise ICU may not free its allocated memory
|
||||
* (e.g. close your converters and resource bundles before calling this
|
||||
* function). Generally, this function should be called once just before
|
||||
* an application exits. For applications that dynamically load and unload
|
||||
* the ICU libraries (relatively uncommon), u_cleanup() should be called
|
||||
* just before the library unload.
|
||||
* <p>
|
||||
* u_cleanup() also clears any ICU heap functions, mutex functions or
|
||||
* trace functions that may have been set for the process.
|
||||
* This has the effect of restoring ICU to its initial condition, before
|
||||
* any of these override functions were installed. Refer to
|
||||
* u_setMemoryFunctions(), u_setMutexFunctions and
|
||||
* utrace_setFunctions(). If ICU is to be reinitialized after
|
||||
* calling u_cleanup(), these runtime override functions will need to
|
||||
* be set up again if they are still required.
|
||||
* <p>
|
||||
* u_cleanup() is not thread safe. All other threads should stop using ICU
|
||||
* before calling this function.
|
||||
* <p>
|
||||
* Any open ICU items will be left in an undefined state by u_cleanup(),
|
||||
* and any subsequent attempt to use such an item will give unpredictable
|
||||
* results.
|
||||
* <p>
|
||||
* After calling u_cleanup(), an application may continue to use ICU by
|
||||
* calling u_init(). An application must invoke u_init() first from one single
|
||||
* thread before allowing other threads call u_init(). All threads existing
|
||||
* at the time of the first thread's call to u_init() must also call
|
||||
* u_init() themselves before continuing with other ICU operations.
|
||||
* <p>
|
||||
* The use of u_cleanup() just before an application terminates is optional,
|
||||
* but it should be called only once for performance reasons. The primary
|
||||
* benefit is to eliminate reports of memory or resource leaks originating
|
||||
* in ICU code from the results generated by heap analysis tools.
|
||||
* <p>
|
||||
* <strong>Use this function with great care!</strong>
|
||||
* </p>
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
* @system
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_cleanup(void);
|
||||
|
||||
U_CDECL_BEGIN
|
||||
/**
|
||||
* Pointer type for a user supplied memory allocation function.
|
||||
* @param context user supplied value, obtained from u_setMemoryFunctions().
|
||||
* @param size The number of bytes to be allocated
|
||||
* @return Pointer to the newly allocated memory, or NULL if the allocation failed.
|
||||
* @stable ICU 2.8
|
||||
* @system
|
||||
*/
|
||||
typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size);
|
||||
/**
|
||||
* Pointer type for a user supplied memory re-allocation function.
|
||||
* @param context user supplied value, obtained from u_setMemoryFunctions().
|
||||
* @param size The number of bytes to be allocated
|
||||
* @return Pointer to the newly allocated memory, or NULL if the allocation failed.
|
||||
* @stable ICU 2.8
|
||||
* @system
|
||||
*/
|
||||
typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t size);
|
||||
/**
|
||||
* Pointer type for a user supplied memory free function. Behavior should be
|
||||
* similar the standard C library free().
|
||||
* @param context user supplied value, obtained from u_setMemoryFunctions().
|
||||
* @param mem Pointer to the memory block to be resized
|
||||
* @param size The new size for the block
|
||||
* @return Pointer to the resized memory block, or NULL if the resizing failed.
|
||||
* @stable ICU 2.8
|
||||
* @system
|
||||
*/
|
||||
typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem);
|
||||
|
||||
/**
|
||||
* Set the functions that ICU will use for memory allocation.
|
||||
* Use of this function is optional; by default (without this function), ICU will
|
||||
* use the standard C library malloc() and free() functions.
|
||||
* This function can only be used when ICU is in an initial, unused state, before
|
||||
* u_init() has been called.
|
||||
* @param context This pointer value will be saved, and then (later) passed as
|
||||
* a parameter to the memory functions each time they
|
||||
* are called.
|
||||
* @param a Pointer to a user-supplied malloc function.
|
||||
* @param r Pointer to a user-supplied realloc function.
|
||||
* @param f Pointer to a user-supplied free function.
|
||||
* @param status Receives error values.
|
||||
* @stable ICU 2.8
|
||||
* @system
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f,
|
||||
UErrorCode *status);
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/*********************************************************************************
|
||||
*
|
||||
* Deprecated Functions
|
||||
*
|
||||
* The following functions for user supplied mutexes are no longer supported.
|
||||
* Any attempt to use them will return a U_UNSUPPORTED_ERROR.
|
||||
*
|
||||
**********************************************************************************/
|
||||
|
||||
/**
|
||||
* An opaque pointer type that represents an ICU mutex.
|
||||
* For user-implemented mutexes, the value will typically point to a
|
||||
* struct or object that implements the mutex.
|
||||
* @deprecated ICU 52. This type is no longer supported.
|
||||
* @system
|
||||
*/
|
||||
typedef void *UMTX;
|
||||
|
||||
U_CDECL_BEGIN
|
||||
/**
|
||||
* Function Pointer type for a user supplied mutex initialization function.
|
||||
* The user-supplied function will be called by ICU whenever ICU needs to create a
|
||||
* new mutex. The function implementation should create a mutex, and store a pointer
|
||||
* to something that uniquely identifies the mutex into the UMTX that is supplied
|
||||
* as a parameter.
|
||||
* @param context user supplied value, obtained from u_setMutexFunctions().
|
||||
* @param mutex Receives a pointer that identifies the new mutex.
|
||||
* The mutex init function must set the UMTX to a non-null value.
|
||||
* Subsequent calls by ICU to lock, unlock, or destroy a mutex will
|
||||
* identify the mutex by the UMTX value.
|
||||
* @param status Error status. Report errors back to ICU by setting this variable
|
||||
* with an error code.
|
||||
* @deprecated ICU 52. This function is no longer supported.
|
||||
* @system
|
||||
*/
|
||||
typedef void U_CALLCONV UMtxInitFn (const void *context, UMTX *mutex, UErrorCode* status);
|
||||
|
||||
|
||||
/**
|
||||
* Function Pointer type for a user supplied mutex functions.
|
||||
* One of the user-supplied functions with this signature will be called by ICU
|
||||
* whenever ICU needs to lock, unlock, or destroy a mutex.
|
||||
* @param context user supplied value, obtained from u_setMutexFunctions().
|
||||
* @param mutex specify the mutex on which to operate.
|
||||
* @deprecated ICU 52. This function is no longer supported.
|
||||
* @system
|
||||
*/
|
||||
typedef void U_CALLCONV UMtxFn (const void *context, UMTX *mutex);
|
||||
U_CDECL_END
|
||||
|
||||
/**
|
||||
* Set the functions that ICU will use for mutex operations
|
||||
* Use of this function is optional; by default (without this function), ICU will
|
||||
* directly access system functions for mutex operations
|
||||
* This function can only be used when ICU is in an initial, unused state, before
|
||||
* u_init() has been called.
|
||||
* @param context This pointer value will be saved, and then (later) passed as
|
||||
* a parameter to the user-supplied mutex functions each time they
|
||||
* are called.
|
||||
* @param init Pointer to a mutex initialization function. Must be non-null.
|
||||
* @param destroy Pointer to the mutex destroy function. Must be non-null.
|
||||
* @param lock pointer to the mutex lock function. Must be non-null.
|
||||
* @param unlock Pointer to the mutex unlock function. Must be non-null.
|
||||
* @param status Receives error values.
|
||||
* @deprecated ICU 52. This function is no longer supported.
|
||||
* @system
|
||||
*/
|
||||
U_DEPRECATED void U_EXPORT2
|
||||
u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtxFn *lock, UMtxFn *unlock,
|
||||
UErrorCode *status);
|
||||
|
||||
|
||||
/**
|
||||
* Pointer type for a user supplied atomic increment or decrement function.
|
||||
* @param context user supplied value, obtained from u_setAtomicIncDecFunctions().
|
||||
* @param p Pointer to a 32 bit int to be incremented or decremented
|
||||
* @return The value of the variable after the inc or dec operation.
|
||||
* @deprecated ICU 52. This function is no longer supported.
|
||||
* @system
|
||||
*/
|
||||
typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p);
|
||||
|
||||
/**
|
||||
* Set the functions that ICU will use for atomic increment and decrement of int32_t values.
|
||||
* Use of this function is optional; by default (without this function), ICU will
|
||||
* use its own internal implementation of atomic increment/decrement.
|
||||
* This function can only be used when ICU is in an initial, unused state, before
|
||||
* u_init() has been called.
|
||||
* @param context This pointer value will be saved, and then (later) passed as
|
||||
* a parameter to the increment and decrement functions each time they
|
||||
* are called. This function can only be called
|
||||
* @param inc Pointer to a function to do an atomic increment operation. Must be non-null.
|
||||
* @param dec Pointer to a function to do an atomic decrement operation. Must be non-null.
|
||||
* @param status Receives error values.
|
||||
* @deprecated ICU 52. This function is no longer supported.
|
||||
* @system
|
||||
*/
|
||||
U_DEPRECATED void U_EXPORT2
|
||||
u_setAtomicIncDecFunctions(const void *context, UMtxAtomicFn *inc, UMtxAtomicFn *dec,
|
||||
UErrorCode *status);
|
||||
|
||||
#endif /* U_HIDE_DEPRECATED_API */
|
||||
#endif /* U_HIDE_SYSTEM_API */
|
||||
|
||||
#endif
|
||||
455
vendor/icu/include/unicode/uconfig.h
vendored
Normal file
455
vendor/icu/include/unicode/uconfig.h
vendored
Normal file
@@ -0,0 +1,455 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 2002-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* file name: uconfig.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2002sep19
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __UCONFIG_H__
|
||||
#define __UCONFIG_H__
|
||||
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief User-configurable settings
|
||||
*
|
||||
* Miscellaneous switches:
|
||||
*
|
||||
* A number of macros affect a variety of minor aspects of ICU.
|
||||
* Most of them used to be defined elsewhere (e.g., in utypes.h or platform.h)
|
||||
* and moved here to make them easier to find.
|
||||
*
|
||||
* Switches for excluding parts of ICU library code modules:
|
||||
*
|
||||
* Changing these macros allows building partial, smaller libraries for special purposes.
|
||||
* By default, all modules are built.
|
||||
* The switches are fairly coarse, controlling large modules.
|
||||
* Basic services cannot be turned off.
|
||||
*
|
||||
* Building with any of these options does not guarantee that the
|
||||
* ICU build process will completely work. It is recommended that
|
||||
* the ICU libraries and data be built using the normal build.
|
||||
* At that time you should remove the data used by those services.
|
||||
* After building the ICU data library, you should rebuild the ICU
|
||||
* libraries with these switches customized to your needs.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h"
|
||||
* prior to determining default settings for uconfig variables.
|
||||
*
|
||||
* @internal ICU 4.0
|
||||
*/
|
||||
#if defined(UCONFIG_USE_LOCAL)
|
||||
#include "uconfig_local.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_DEBUG
|
||||
* Determines whether to include debugging code.
|
||||
* Automatically set on Windows, but most compilers do not have
|
||||
* related predefined macros.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_DEBUG
|
||||
/* Use the predefined value. */
|
||||
#elif defined(_DEBUG)
|
||||
/*
|
||||
* _DEBUG is defined by Visual Studio debug compilation.
|
||||
* Do *not* test for its NDEBUG macro: It is an orthogonal macro
|
||||
* which disables assert().
|
||||
*/
|
||||
# define U_DEBUG 1
|
||||
# else
|
||||
# define U_DEBUG 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Determines whether to enable auto cleanup of libraries.
|
||||
* @internal
|
||||
*/
|
||||
#ifndef UCLN_NO_AUTO_CLEANUP
|
||||
#define UCLN_NO_AUTO_CLEANUP 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_DISABLE_RENAMING
|
||||
* Determines whether to disable renaming or not.
|
||||
* @internal
|
||||
*/
|
||||
#ifndef U_DISABLE_RENAMING
|
||||
#define U_DISABLE_RENAMING 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_NO_DEFAULT_INCLUDE_UTF_HEADERS
|
||||
* Determines whether utypes.h includes utf.h, utf8.h, utf16.h and utf_old.h.
|
||||
* utypes.h includes those headers if this macro is defined to 0.
|
||||
* Otherwise, each those headers must be included explicitly when using one of their macros.
|
||||
* Defaults to 0 for backward compatibility, except inside ICU.
|
||||
* @stable ICU 49
|
||||
*/
|
||||
#ifdef U_NO_DEFAULT_INCLUDE_UTF_HEADERS
|
||||
/* Use the predefined value. */
|
||||
#elif defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || \
|
||||
defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION) || \
|
||||
defined(U_TOOLUTIL_IMPLEMENTATION)
|
||||
# define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 1
|
||||
#else
|
||||
# define U_NO_DEFAULT_INCLUDE_UTF_HEADERS 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_OVERRIDE_CXX_ALLOCATION
|
||||
* Determines whether to override new and delete.
|
||||
* ICU is normally built such that all of its C++ classes, via their UMemory base,
|
||||
* override operators new and delete to use its internal, customizable,
|
||||
* non-exception-throwing memory allocation functions. (Default value 1 for this macro.)
|
||||
*
|
||||
* This is especially important when the application and its libraries use multiple heaps.
|
||||
* For example, on Windows, this allows the ICU DLL to be used by
|
||||
* applications that statically link the C Runtime library.
|
||||
*
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
#ifndef U_OVERRIDE_CXX_ALLOCATION
|
||||
#define U_OVERRIDE_CXX_ALLOCATION 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_ENABLE_TRACING
|
||||
* Determines whether to enable tracing.
|
||||
* @internal
|
||||
*/
|
||||
#ifndef U_ENABLE_TRACING
|
||||
#define U_ENABLE_TRACING 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_ENABLE_PLUGINS
|
||||
* Determines whether to enable ICU plugins.
|
||||
* @internal
|
||||
*/
|
||||
#ifndef UCONFIG_ENABLE_PLUGINS
|
||||
#define UCONFIG_ENABLE_PLUGINS 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_ENABLE_DYLOAD
|
||||
* Whether to enable Dynamic loading in ICU.
|
||||
* @internal
|
||||
*/
|
||||
#ifndef U_ENABLE_DYLOAD
|
||||
#define U_ENABLE_DYLOAD 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_CHECK_DYLOAD
|
||||
* Whether to test Dynamic loading as an OS capability.
|
||||
* @internal
|
||||
*/
|
||||
#ifndef U_CHECK_DYLOAD
|
||||
#define U_CHECK_DYLOAD 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_DEFAULT_SHOW_DRAFT
|
||||
* Do we allow ICU users to use the draft APIs by default?
|
||||
* @internal
|
||||
*/
|
||||
#ifndef U_DEFAULT_SHOW_DRAFT
|
||||
#define U_DEFAULT_SHOW_DRAFT 1
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Custom icu entry point renaming */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* \def U_HAVE_LIB_SUFFIX
|
||||
* 1 if a custom library suffix is set.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_LIB_SUFFIX
|
||||
/* Use the predefined value. */
|
||||
#elif defined(U_LIB_SUFFIX_C_NAME)
|
||||
# define U_HAVE_LIB_SUFFIX 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_LIB_SUFFIX_C_NAME_STRING
|
||||
* Defines the library suffix as a string with C syntax.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_LIB_SUFFIX_C_NAME_STRING
|
||||
/* Use the predefined value. */
|
||||
#elif defined(U_LIB_SUFFIX_C_NAME)
|
||||
# define CONVERT_TO_STRING(s) #s
|
||||
# define U_LIB_SUFFIX_C_NAME_STRING CONVERT_TO_STRING(U_LIB_SUFFIX_C_NAME)
|
||||
#else
|
||||
# define U_LIB_SUFFIX_C_NAME_STRING ""
|
||||
#endif
|
||||
|
||||
/* common/i18n library switches --------------------------------------------- */
|
||||
|
||||
/**
|
||||
* \def UCONFIG_ONLY_COLLATION
|
||||
* This switch turns off modules that are not needed for collation.
|
||||
*
|
||||
* It does not turn off legacy conversion because that is necessary
|
||||
* for ICU to work on EBCDIC platforms (for the default converter).
|
||||
* If you want "only collation" and do not build for EBCDIC,
|
||||
* then you can define UCONFIG_NO_CONVERSION or UCONFIG_NO_LEGACY_CONVERSION to 1 as well.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#ifndef UCONFIG_ONLY_COLLATION
|
||||
# define UCONFIG_ONLY_COLLATION 0
|
||||
#endif
|
||||
|
||||
#if UCONFIG_ONLY_COLLATION
|
||||
/* common library */
|
||||
# define UCONFIG_NO_BREAK_ITERATION 1
|
||||
# define UCONFIG_NO_IDNA 1
|
||||
|
||||
/* i18n library */
|
||||
# if UCONFIG_NO_COLLATION
|
||||
# error Contradictory collation switches in uconfig.h.
|
||||
# endif
|
||||
# define UCONFIG_NO_FORMATTING 1
|
||||
# define UCONFIG_NO_TRANSLITERATION 1
|
||||
# define UCONFIG_NO_REGULAR_EXPRESSIONS 1
|
||||
#endif
|
||||
|
||||
/* common library switches -------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_FILE_IO
|
||||
* This switch turns off all file access in the common library
|
||||
* where file access is only used for data loading.
|
||||
* ICU data must then be provided in the form of a data DLL (or with an
|
||||
* equivalent way to link to the data residing in an executable,
|
||||
* as in building a combined library with both the common library's code and
|
||||
* the data), or via udata_setCommonData().
|
||||
* Application data must be provided via udata_setAppData() or by using
|
||||
* "open" functions that take pointers to data, for example ucol_openBinary().
|
||||
*
|
||||
* File access is not used at all in the i18n library.
|
||||
*
|
||||
* File access cannot be turned off for the icuio library or for the ICU
|
||||
* test suites and ICU tools.
|
||||
*
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
#ifndef UCONFIG_NO_FILE_IO
|
||||
# define UCONFIG_NO_FILE_IO 0
|
||||
#endif
|
||||
|
||||
#if UCONFIG_NO_FILE_IO && defined(U_TIMEZONE_FILES_DIR)
|
||||
# error Contradictory file io switches in uconfig.h.
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_CONVERSION
|
||||
* ICU will not completely build (compiling the tools fails) with this
|
||||
* switch turned on.
|
||||
* This switch turns off all converters.
|
||||
*
|
||||
* You may want to use this together with U_CHARSET_IS_UTF8 defined to 1
|
||||
* in utypes.h if char* strings in your environment are always in UTF-8.
|
||||
*
|
||||
* @stable ICU 3.2
|
||||
* @see U_CHARSET_IS_UTF8
|
||||
*/
|
||||
#ifndef UCONFIG_NO_CONVERSION
|
||||
# define UCONFIG_NO_CONVERSION 0
|
||||
#endif
|
||||
|
||||
#if UCONFIG_NO_CONVERSION
|
||||
# define UCONFIG_NO_LEGACY_CONVERSION 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_ONLY_HTML_CONVERSION
|
||||
* This switch turns off all of the converters NOT listed in
|
||||
* the HTML encoding standard:
|
||||
* http://www.w3.org/TR/encoding/#names-and-labels
|
||||
*
|
||||
* This is not possible on EBCDIC platforms
|
||||
* because they need ibm-37 or ibm-1047 default converters.
|
||||
*
|
||||
* @stable ICU 55
|
||||
*/
|
||||
#ifndef UCONFIG_ONLY_HTML_CONVERSION
|
||||
# define UCONFIG_ONLY_HTML_CONVERSION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_LEGACY_CONVERSION
|
||||
* This switch turns off all converters except for
|
||||
* - Unicode charsets (UTF-7/8/16/32, CESU-8, SCSU, BOCU-1)
|
||||
* - US-ASCII
|
||||
* - ISO-8859-1
|
||||
*
|
||||
* Turning off legacy conversion is not possible on EBCDIC platforms
|
||||
* because they need ibm-37 or ibm-1047 default converters.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#ifndef UCONFIG_NO_LEGACY_CONVERSION
|
||||
# define UCONFIG_NO_LEGACY_CONVERSION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_NORMALIZATION
|
||||
* This switch turns off normalization.
|
||||
* It implies turning off several other services as well, for example
|
||||
* collation and IDNA.
|
||||
*
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#ifndef UCONFIG_NO_NORMALIZATION
|
||||
# define UCONFIG_NO_NORMALIZATION 0
|
||||
#endif
|
||||
|
||||
#if UCONFIG_NO_NORMALIZATION
|
||||
/* common library */
|
||||
/* ICU 50 CJK dictionary BreakIterator uses normalization */
|
||||
# define UCONFIG_NO_BREAK_ITERATION 1
|
||||
/* IDNA (UTS #46) is implemented via normalization */
|
||||
# define UCONFIG_NO_IDNA 1
|
||||
|
||||
/* i18n library */
|
||||
# if UCONFIG_ONLY_COLLATION
|
||||
# error Contradictory collation switches in uconfig.h.
|
||||
# endif
|
||||
# define UCONFIG_NO_COLLATION 1
|
||||
# define UCONFIG_NO_TRANSLITERATION 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_BREAK_ITERATION
|
||||
* This switch turns off break iteration.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#ifndef UCONFIG_NO_BREAK_ITERATION
|
||||
# define UCONFIG_NO_BREAK_ITERATION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_IDNA
|
||||
* This switch turns off IDNA.
|
||||
*
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#ifndef UCONFIG_NO_IDNA
|
||||
# define UCONFIG_NO_IDNA 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
|
||||
* Determines the default UMessagePatternApostropheMode.
|
||||
* See the documentation for that enum.
|
||||
*
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
#ifndef UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE
|
||||
# define UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE UMSGPAT_APOS_DOUBLE_OPTIONAL
|
||||
#endif
|
||||
|
||||
/* i18n library switches ---------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_COLLATION
|
||||
* This switch turns off collation and collation-based string search.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#ifndef UCONFIG_NO_COLLATION
|
||||
# define UCONFIG_NO_COLLATION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_FORMATTING
|
||||
* This switch turns off formatting and calendar/timezone services.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#ifndef UCONFIG_NO_FORMATTING
|
||||
# define UCONFIG_NO_FORMATTING 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_TRANSLITERATION
|
||||
* This switch turns off transliteration.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#ifndef UCONFIG_NO_TRANSLITERATION
|
||||
# define UCONFIG_NO_TRANSLITERATION 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_REGULAR_EXPRESSIONS
|
||||
* This switch turns off regular expressions.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#ifndef UCONFIG_NO_REGULAR_EXPRESSIONS
|
||||
# define UCONFIG_NO_REGULAR_EXPRESSIONS 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_SERVICE
|
||||
* This switch turns off service registration.
|
||||
*
|
||||
* @stable ICU 3.2
|
||||
*/
|
||||
#ifndef UCONFIG_NO_SERVICE
|
||||
# define UCONFIG_NO_SERVICE 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_HAVE_PARSEALLINPUT
|
||||
* This switch turns on the "parse all input" attribute. Binary incompatible.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#ifndef UCONFIG_HAVE_PARSEALLINPUT
|
||||
# define UCONFIG_HAVE_PARSEALLINPUT 1
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \def UCONFIG_FORMAT_FASTPATHS_49
|
||||
* This switch turns on other formatting fastpaths. Binary incompatible in object DecimalFormat and DecimalFormatSymbols
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#ifndef UCONFIG_FORMAT_FASTPATHS_49
|
||||
# define UCONFIG_FORMAT_FASTPATHS_49 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def UCONFIG_NO_FILTERED_BREAK_ITERATION
|
||||
* This switch turns off filtered break iteration code.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#ifndef UCONFIG_NO_FILTERED_BREAK_ITERATION
|
||||
# define UCONFIG_NO_FILTERED_BREAK_ITERATION 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
437
vendor/icu/include/unicode/udata.h
vendored
Normal file
437
vendor/icu/include/unicode/udata.h
vendored
Normal file
@@ -0,0 +1,437 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: udata.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 1999oct25
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __UDATA_H__
|
||||
#define __UDATA_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/localpointer.h>
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Data loading interface
|
||||
*
|
||||
* <h2>Information about data loading interface</h2>
|
||||
*
|
||||
* This API is used to find and efficiently load data for ICU and applications
|
||||
* using ICU. It provides an abstract interface that specifies a data type and
|
||||
* name to find and load the data. Normally this API is used by other ICU APIs
|
||||
* to load required data out of the ICU data library, but it can be used to
|
||||
* load data out of other places.
|
||||
*
|
||||
* See the User Guide Data Management chapter.
|
||||
*/
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Character used to separate package names from tree names
|
||||
* @internal ICU 3.0
|
||||
*/
|
||||
#define U_TREE_SEPARATOR '-'
|
||||
|
||||
/**
|
||||
* String used to separate package names from tree names
|
||||
* @internal ICU 3.0
|
||||
*/
|
||||
#define U_TREE_SEPARATOR_STRING "-"
|
||||
|
||||
/**
|
||||
* Character used to separate parts of entry names
|
||||
* @internal ICU 3.0
|
||||
*/
|
||||
#define U_TREE_ENTRY_SEP_CHAR '/'
|
||||
|
||||
/**
|
||||
* String used to separate parts of entry names
|
||||
* @internal ICU 3.0
|
||||
*/
|
||||
#define U_TREE_ENTRY_SEP_STRING "/"
|
||||
|
||||
/**
|
||||
* Alias for standard ICU data
|
||||
* @internal ICU 3.0
|
||||
*/
|
||||
#define U_ICUDATA_ALIAS "ICUDATA"
|
||||
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
/**
|
||||
* UDataInfo contains the properties about the requested data.
|
||||
* This is meta data.
|
||||
*
|
||||
* <p>This structure may grow in the future, indicated by the
|
||||
* <code>size</code> field.</p>
|
||||
*
|
||||
* <p>ICU data must be at least 8-aligned, and should be 16-aligned.
|
||||
* The UDataInfo struct begins 4 bytes after the start of the data item,
|
||||
* so it is 4-aligned.
|
||||
*
|
||||
* <p>The platform data property fields help determine if a data
|
||||
* file can be efficiently used on a given machine.
|
||||
* The particular fields are of importance only if the data
|
||||
* is affected by the properties - if there is integer data
|
||||
* with word sizes > 1 byte, char* text, or UChar* text.</p>
|
||||
*
|
||||
* <p>The implementation for the <code>udata_open[Choice]()</code>
|
||||
* functions may reject data based on the value in <code>isBigEndian</code>.
|
||||
* No other field is used by the <code>udata</code> API implementation.</p>
|
||||
*
|
||||
* <p>The <code>dataFormat</code> may be used to identify
|
||||
* the kind of data, e.g. a converter table.</p>
|
||||
*
|
||||
* <p>The <code>formatVersion</code> field should be used to
|
||||
* make sure that the format can be interpreted.
|
||||
* It may be a good idea to check only for the one or two highest
|
||||
* of the version elements to allow the data memory to
|
||||
* get more or somewhat rearranged contents, for as long
|
||||
* as the using code can still interpret the older contents.</p>
|
||||
*
|
||||
* <p>The <code>dataVersion</code> field is intended to be a
|
||||
* common place to store the source version of the data;
|
||||
* for data from the Unicode character database, this could
|
||||
* reflect the Unicode version.</p>
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
typedef struct {
|
||||
/** sizeof(UDataInfo)
|
||||
* @stable ICU 2.0 */
|
||||
uint16_t size;
|
||||
|
||||
/** unused, set to 0
|
||||
* @stable ICU 2.0*/
|
||||
uint16_t reservedWord;
|
||||
|
||||
/* platform data properties */
|
||||
/** 0 for little-endian machine, 1 for big-endian
|
||||
* @stable ICU 2.0 */
|
||||
uint8_t isBigEndian;
|
||||
|
||||
/** see U_CHARSET_FAMILY values in utypes.h
|
||||
* @stable ICU 2.0*/
|
||||
uint8_t charsetFamily;
|
||||
|
||||
/** sizeof(UChar), one of { 1, 2, 4 }
|
||||
* @stable ICU 2.0*/
|
||||
uint8_t sizeofUChar;
|
||||
|
||||
/** unused, set to 0
|
||||
* @stable ICU 2.0*/
|
||||
uint8_t reservedByte;
|
||||
|
||||
/** data format identifier
|
||||
* @stable ICU 2.0*/
|
||||
uint8_t dataFormat[4];
|
||||
|
||||
/** versions: [0] major [1] minor [2] milli [3] micro
|
||||
* @stable ICU 2.0*/
|
||||
uint8_t formatVersion[4];
|
||||
|
||||
/** versions: [0] major [1] minor [2] milli [3] micro
|
||||
* @stable ICU 2.0*/
|
||||
uint8_t dataVersion[4];
|
||||
} UDataInfo;
|
||||
|
||||
/* API for reading data -----------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Forward declaration of the data memory type.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
typedef struct UDataMemory UDataMemory;
|
||||
|
||||
/**
|
||||
* Callback function for udata_openChoice().
|
||||
* @param context parameter passed into <code>udata_openChoice()</code>.
|
||||
* @param type The type of the data as passed into <code>udata_openChoice()</code>.
|
||||
* It may be <code>NULL</code>.
|
||||
* @param name The name of the data as passed into <code>udata_openChoice()</code>.
|
||||
* @param pInfo A pointer to the <code>UDataInfo</code> structure
|
||||
* of data that has been loaded and will be returned
|
||||
* by <code>udata_openChoice()</code> if this function
|
||||
* returns <code>TRUE</code>.
|
||||
* @return TRUE if the current data memory is acceptable
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
typedef UBool U_CALLCONV
|
||||
UDataMemoryIsAcceptable(void *context,
|
||||
const char *type, const char *name,
|
||||
const UDataInfo *pInfo);
|
||||
|
||||
|
||||
/**
|
||||
* Convenience function.
|
||||
* This function works the same as <code>udata_openChoice</code>
|
||||
* except that any data that matches the type and name
|
||||
* is assumed to be acceptable.
|
||||
* @param path Specifies an absolute path and/or a basename for the
|
||||
* finding of the data in the file system.
|
||||
* <code>NULL</code> for ICU data.
|
||||
* @param type A string that specifies the type of data to be loaded.
|
||||
* For example, resource bundles are loaded with type "res",
|
||||
* conversion tables with type "cnv".
|
||||
* This may be <code>NULL</code> or empty.
|
||||
* @param name A string that specifies the name of the data.
|
||||
* @param pErrorCode An ICU UErrorCode parameter. It must not be <code>NULL</code>.
|
||||
* @return A pointer (handle) to a data memory object, or <code>NULL</code>
|
||||
* if an error occurs. Call <code>udata_getMemory()</code>
|
||||
* to get a pointer to the actual data.
|
||||
*
|
||||
* @see udata_openChoice
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE UDataMemory * U_EXPORT2
|
||||
udata_open(const char *path, const char *type, const char *name,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Data loading function.
|
||||
* This function is used to find and load efficiently data for
|
||||
* ICU and applications using ICU.
|
||||
* It provides an abstract interface that allows to specify a data
|
||||
* type and name to find and load the data.
|
||||
*
|
||||
* <p>The implementation depends on platform properties and user preferences
|
||||
* and may involve loading shared libraries (DLLs), mapping
|
||||
* files into memory, or fopen()/fread() files.
|
||||
* It may also involve using static memory or database queries etc.
|
||||
* Several or all data items may be combined into one entity
|
||||
* (DLL, memory-mappable file).</p>
|
||||
*
|
||||
* <p>The data is always preceded by a header that includes
|
||||
* a <code>UDataInfo</code> structure.
|
||||
* The caller's <code>isAcceptable()</code> function is called to make
|
||||
* sure that the data is useful. It may be called several times if it
|
||||
* rejects the data and there is more than one location with data
|
||||
* matching the type and name.</p>
|
||||
*
|
||||
* <p>If <code>path==NULL</code>, then ICU data is loaded.
|
||||
* Otherwise, it is separated into a basename and a basename-less directory string.
|
||||
* The basename is used as the data package name, and the directory is
|
||||
* logically prepended to the ICU data directory string.</p>
|
||||
*
|
||||
* <p>For details about ICU data loading see the User Guide
|
||||
* Data Management chapter. (http://icu-project.org/userguide/icudata.html)</p>
|
||||
*
|
||||
* @param path Specifies an absolute path and/or a basename for the
|
||||
* finding of the data in the file system.
|
||||
* <code>NULL</code> for ICU data.
|
||||
* @param type A string that specifies the type of data to be loaded.
|
||||
* For example, resource bundles are loaded with type "res",
|
||||
* conversion tables with type "cnv".
|
||||
* This may be <code>NULL</code> or empty.
|
||||
* @param name A string that specifies the name of the data.
|
||||
* @param isAcceptable This function is called to verify that loaded data
|
||||
* is useful for the client code. If it returns FALSE
|
||||
* for all data items, then <code>udata_openChoice()</code>
|
||||
* will return with an error.
|
||||
* @param context Arbitrary parameter to be passed into isAcceptable.
|
||||
* @param pErrorCode An ICU UErrorCode parameter. It must not be <code>NULL</code>.
|
||||
* @return A pointer (handle) to a data memory object, or <code>NULL</code>
|
||||
* if an error occurs. Call <code>udata_getMemory()</code>
|
||||
* to get a pointer to the actual data.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE UDataMemory * U_EXPORT2
|
||||
udata_openChoice(const char *path, const char *type, const char *name,
|
||||
UDataMemoryIsAcceptable *isAcceptable, void *context,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Close the data memory.
|
||||
* This function must be called to allow the system to
|
||||
* release resources associated with this data memory.
|
||||
* @param pData The pointer to data memory object
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
udata_close(UDataMemory *pData);
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* \class LocalUDataMemoryPointer
|
||||
* "Smart pointer" class, closes a UDataMemory via udata_close().
|
||||
* For most methods see the LocalPointerBase base class.
|
||||
*
|
||||
* @see LocalPointerBase
|
||||
* @see LocalPointer
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the pointer to the actual data inside the data memory.
|
||||
* The data is read-only.
|
||||
*
|
||||
* ICU data must be at least 8-aligned, and should be 16-aligned.
|
||||
*
|
||||
* @param pData The pointer to data memory object
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE const void * U_EXPORT2
|
||||
udata_getMemory(UDataMemory *pData);
|
||||
|
||||
/**
|
||||
* Get the information from the data memory header.
|
||||
* This allows to get access to the header containing
|
||||
* platform data properties etc. which is not part of
|
||||
* the data itself and can therefore not be accessed
|
||||
* via the pointer that <code>udata_getMemory()</code> returns.
|
||||
*
|
||||
* @param pData pointer to the data memory object
|
||||
* @param pInfo pointer to a UDataInfo object;
|
||||
* its <code>size</code> field must be set correctly,
|
||||
* typically to <code>sizeof(UDataInfo)</code>.
|
||||
*
|
||||
* <code>*pInfo</code> will be filled with the UDataInfo structure
|
||||
* in the data memory object. If this structure is smaller than
|
||||
* <code>pInfo->size</code>, then the <code>size</code> will be
|
||||
* adjusted and only part of the structure will be filled.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
udata_getInfo(UDataMemory *pData, UDataInfo *pInfo);
|
||||
|
||||
/**
|
||||
* This function bypasses the normal ICU data loading process and
|
||||
* allows you to force ICU's system data to come out of a user-specified
|
||||
* area in memory.
|
||||
*
|
||||
* ICU data must be at least 8-aligned, and should be 16-aligned.
|
||||
* See http://userguide.icu-project.org/icudata
|
||||
*
|
||||
* The format of this data is that of the icu common data file, as is
|
||||
* generated by the pkgdata tool with mode=common or mode=dll.
|
||||
* You can read in a whole common mode file and pass the address to the start of the
|
||||
* data, or (with the appropriate link options) pass in the pointer to
|
||||
* the data that has been loaded from a dll by the operating system,
|
||||
* as shown in this code:
|
||||
*
|
||||
* extern const char U_IMPORT U_ICUDATA_ENTRY_POINT [];
|
||||
* // U_ICUDATA_ENTRY_POINT is same as entry point specified to pkgdata tool
|
||||
* UErrorCode status = U_ZERO_ERROR;
|
||||
*
|
||||
* udata_setCommonData(&U_ICUDATA_ENTRY_POINT, &status);
|
||||
*
|
||||
* It is important that the declaration be as above. The entry point
|
||||
* must not be declared as an extern void*.
|
||||
*
|
||||
* Starting with ICU 4.4, it is possible to set several data packages,
|
||||
* one per call to this function.
|
||||
* udata_open() will look for data in the multiple data packages in the order
|
||||
* in which they were set.
|
||||
* The position of the linked-in or default-name ICU .data package in the
|
||||
* search list depends on when the first data item is loaded that is not contained
|
||||
* in the already explicitly set packages.
|
||||
* If data was loaded implicitly before the first call to this function
|
||||
* (for example, via opening a converter, constructing a UnicodeString
|
||||
* from default-codepage data, using formatting or collation APIs, etc.),
|
||||
* then the default data will be first in the list.
|
||||
*
|
||||
* This function has no effect on application (non ICU) data. See udata_setAppData()
|
||||
* for similar functionality for application data.
|
||||
*
|
||||
* @param data pointer to ICU common data
|
||||
* @param err outgoing error status <code>U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR</code>
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
udata_setCommonData(const void *data, UErrorCode *err);
|
||||
|
||||
|
||||
/**
|
||||
* This function bypasses the normal ICU data loading process for application-specific
|
||||
* data and allows you to force the it to come out of a user-specified
|
||||
* pointer.
|
||||
*
|
||||
* ICU data must be at least 8-aligned, and should be 16-aligned.
|
||||
* See http://userguide.icu-project.org/icudata
|
||||
*
|
||||
* The format of this data is that of the icu common data file, like 'icudt26l.dat'
|
||||
* or the corresponding shared library (DLL) file.
|
||||
* The application must read in or otherwise construct an image of the data and then
|
||||
* pass the address of it to this function.
|
||||
*
|
||||
*
|
||||
* Warning: setAppData will set a U_USING_DEFAULT_WARNING code if
|
||||
* data with the specifed path that has already been opened, or
|
||||
* if setAppData with the same path has already been called.
|
||||
* Any such calls to setAppData will have no effect.
|
||||
*
|
||||
*
|
||||
* @param packageName the package name by which the application will refer
|
||||
* to (open) this data
|
||||
* @param data pointer to the data
|
||||
* @param err outgoing error status <code>U_USING_DEFAULT_WARNING, U_UNSUPPORTED_ERROR</code>
|
||||
* @see udata_setCommonData
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
udata_setAppData(const char *packageName, const void *data, UErrorCode *err);
|
||||
|
||||
/**
|
||||
* Possible settings for udata_setFileAccess()
|
||||
* @see udata_setFileAccess
|
||||
* @stable ICU 3.4
|
||||
*/
|
||||
typedef enum UDataFileAccess {
|
||||
/** ICU looks for data in single files first, then in packages. (default) @stable ICU 3.4 */
|
||||
UDATA_FILES_FIRST,
|
||||
/** An alias for the default access mode. @stable ICU 3.4 */
|
||||
UDATA_DEFAULT_ACCESS = UDATA_FILES_FIRST,
|
||||
/** ICU only loads data from packages, not from single files. @stable ICU 3.4 */
|
||||
UDATA_ONLY_PACKAGES,
|
||||
/** ICU loads data from packages first, and only from single files
|
||||
if the data cannot be found in a package. @stable ICU 3.4 */
|
||||
UDATA_PACKAGES_FIRST,
|
||||
/** ICU does not access the file system for data loading. @stable ICU 3.4 */
|
||||
UDATA_NO_FILES,
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* Number of real UDataFileAccess values.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
UDATA_FILE_ACCESS_COUNT
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
} UDataFileAccess;
|
||||
|
||||
/**
|
||||
* This function may be called to control how ICU loads data. It must be called
|
||||
* before any ICU data is loaded, including application data loaded with
|
||||
* ures/ResourceBundle or udata APIs. This function is not multithread safe.
|
||||
* The results of calling it while other threads are loading data are undefined.
|
||||
* @param access The type of file access to be used
|
||||
* @param status Error code.
|
||||
* @see UDataFileAccess
|
||||
* @stable ICU 3.4
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
udata_setFileAccess(UDataFileAccess access, UErrorCode *status);
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
#endif
|
||||
709
vendor/icu/include/unicode/uiter.h
vendored
Normal file
709
vendor/icu/include/unicode/uiter.h
vendored
Normal file
@@ -0,0 +1,709 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002-2011 International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: uiter.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2002jan18
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __UITER_H__
|
||||
#define __UITER_H__
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Unicode Character Iteration
|
||||
*
|
||||
* @see UCharIterator
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
class CharacterIterator;
|
||||
class Replaceable;
|
||||
|
||||
U_NAMESPACE_END
|
||||
#endif
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
struct UCharIterator;
|
||||
typedef struct UCharIterator UCharIterator; /**< C typedef for struct UCharIterator. @stable ICU 2.1 */
|
||||
|
||||
/**
|
||||
* Origin constants for UCharIterator.getIndex() and UCharIterator.move().
|
||||
* @see UCharIteratorMove
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef enum UCharIteratorOrigin {
|
||||
UITER_START, UITER_CURRENT, UITER_LIMIT, UITER_ZERO, UITER_LENGTH
|
||||
} UCharIteratorOrigin;
|
||||
|
||||
/** Constants for UCharIterator. @stable ICU 2.6 */
|
||||
enum {
|
||||
/**
|
||||
* Constant value that may be returned by UCharIteratorMove
|
||||
* indicating that the final UTF-16 index is not known, but that the move succeeded.
|
||||
* This can occur when moving relative to limit or length, or
|
||||
* when moving relative to the current index after a setState()
|
||||
* when the current UTF-16 index is not known.
|
||||
*
|
||||
* It would be very inefficient to have to count from the beginning of the text
|
||||
* just to get the current/limit/length index after moving relative to it.
|
||||
* The actual index can be determined with getIndex(UITER_CURRENT)
|
||||
* which will count the UChars if necessary.
|
||||
*
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
UITER_UNKNOWN_INDEX=-2
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Constant for UCharIterator getState() indicating an error or
|
||||
* an unknown state.
|
||||
* Returned by uiter_getState()/UCharIteratorGetState
|
||||
* when an error occurs.
|
||||
* Also, some UCharIterator implementations may not be able to return
|
||||
* a valid state for each position. This will be clearly documented
|
||||
* for each such iterator (none of the public ones here).
|
||||
*
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#define UITER_NO_STATE ((uint32_t)0xffffffff)
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.getIndex().
|
||||
*
|
||||
* Gets the current position, or the start or limit of the
|
||||
* iteration range.
|
||||
*
|
||||
* This function may perform slowly for UITER_CURRENT after setState() was called,
|
||||
* or for UITER_LENGTH, because an iterator implementation may have to count
|
||||
* UChars if the underlying storage is not UTF-16.
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @param origin get the 0, start, limit, length, or current index
|
||||
* @return the requested index, or U_SENTINEL in an error condition
|
||||
*
|
||||
* @see UCharIteratorOrigin
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
UCharIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.move().
|
||||
*
|
||||
* Use iter->move(iter, index, UITER_ZERO) like CharacterIterator::setIndex(index).
|
||||
*
|
||||
* Moves the current position relative to the start or limit of the
|
||||
* iteration range, or relative to the current position itself.
|
||||
* The movement is expressed in numbers of code units forward
|
||||
* or backward by specifying a positive or negative delta.
|
||||
* Out of bounds movement will be pinned to the start or limit.
|
||||
*
|
||||
* This function may perform slowly for moving relative to UITER_LENGTH
|
||||
* because an iterator implementation may have to count the rest of the
|
||||
* UChars if the native storage is not UTF-16.
|
||||
*
|
||||
* When moving relative to the limit or length, or
|
||||
* relative to the current position after setState() was called,
|
||||
* move() may return UITER_UNKNOWN_INDEX (-2) to avoid an inefficient
|
||||
* determination of the actual UTF-16 index.
|
||||
* The actual index can be determined with getIndex(UITER_CURRENT)
|
||||
* which will count the UChars if necessary.
|
||||
* See UITER_UNKNOWN_INDEX for details.
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @param delta can be positive, zero, or negative
|
||||
* @param origin move relative to the 0, start, limit, length, or current index
|
||||
* @return the new index, or U_SENTINEL on an error condition,
|
||||
* or UITER_UNKNOWN_INDEX when the index is not known.
|
||||
*
|
||||
* @see UCharIteratorOrigin
|
||||
* @see UCharIterator
|
||||
* @see UITER_UNKNOWN_INDEX
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
UCharIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.hasNext().
|
||||
*
|
||||
* Check if current() and next() can still
|
||||
* return another code unit.
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return boolean value for whether current() and next() can still return another code unit
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef UBool U_CALLCONV
|
||||
UCharIteratorHasNext(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.hasPrevious().
|
||||
*
|
||||
* Check if previous() can still return another code unit.
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return boolean value for whether previous() can still return another code unit
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef UBool U_CALLCONV
|
||||
UCharIteratorHasPrevious(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.current().
|
||||
*
|
||||
* Return the code unit at the current position,
|
||||
* or U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the current code unit
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef UChar32 U_CALLCONV
|
||||
UCharIteratorCurrent(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.next().
|
||||
*
|
||||
* Return the code unit at the current index and increment
|
||||
* the index (post-increment, like s[i++]),
|
||||
* or return U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the current code unit (and post-increment the current index)
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef UChar32 U_CALLCONV
|
||||
UCharIteratorNext(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.previous().
|
||||
*
|
||||
* Decrement the index and return the code unit from there
|
||||
* (pre-decrement, like s[--i]),
|
||||
* or return U_SENTINEL if there is none (index is at the start).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the previous code unit (after pre-decrementing the current index)
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef UChar32 U_CALLCONV
|
||||
UCharIteratorPrevious(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.reservedFn().
|
||||
* Reserved for future use.
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @param something some integer argument
|
||||
* @return some integer
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
UCharIteratorReserved(UCharIterator *iter, int32_t something);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.getState().
|
||||
*
|
||||
* Get the "state" of the iterator in the form of a single 32-bit word.
|
||||
* It is recommended that the state value be calculated to be as small as
|
||||
* is feasible. For strings with limited lengths, fewer than 32 bits may
|
||||
* be sufficient.
|
||||
*
|
||||
* This is used together with setState()/UCharIteratorSetState
|
||||
* to save and restore the iterator position more efficiently than with
|
||||
* getIndex()/move().
|
||||
*
|
||||
* The iterator state is defined as a uint32_t value because it is designed
|
||||
* for use in ucol_nextSortKeyPart() which provides 32 bits to store the state
|
||||
* of the character iterator.
|
||||
*
|
||||
* With some UCharIterator implementations (e.g., UTF-8),
|
||||
* getting and setting the UTF-16 index with existing functions
|
||||
* (getIndex(UITER_CURRENT) followed by move(pos, UITER_ZERO)) is possible but
|
||||
* relatively slow because the iterator has to "walk" from a known index
|
||||
* to the requested one.
|
||||
* This takes more time the farther it needs to go.
|
||||
*
|
||||
* An opaque state value allows an iterator implementation to provide
|
||||
* an internal index (UTF-8: the source byte array index) for
|
||||
* fast, constant-time restoration.
|
||||
*
|
||||
* After calling setState(), a getIndex(UITER_CURRENT) may be slow because
|
||||
* the UTF-16 index may not be restored as well, but the iterator can deliver
|
||||
* the correct text contents and move relative to the current position
|
||||
* without performance degradation.
|
||||
*
|
||||
* Some UCharIterator implementations may not be able to return
|
||||
* a valid state for each position, in which case they return UITER_NO_STATE instead.
|
||||
* This will be clearly documented for each such iterator (none of the public ones here).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the state word
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see UCharIteratorSetState
|
||||
* @see UITER_NO_STATE
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
typedef uint32_t U_CALLCONV
|
||||
UCharIteratorGetState(const UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Function type declaration for UCharIterator.setState().
|
||||
*
|
||||
* Restore the "state" of the iterator using a state word from a getState() call.
|
||||
* The iterator object need not be the same one as for which getState() was called,
|
||||
* but it must be of the same type (set up using the same uiter_setXYZ function)
|
||||
* and it must iterate over the same string
|
||||
* (binary identical regardless of memory address).
|
||||
* For more about the state word see UCharIteratorGetState.
|
||||
*
|
||||
* After calling setState(), a getIndex(UITER_CURRENT) may be slow because
|
||||
* the UTF-16 index may not be restored as well, but the iterator can deliver
|
||||
* the correct text contents and move relative to the current position
|
||||
* without performance degradation.
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @param state the state word from a getState() call
|
||||
* on a same-type, same-string iterator
|
||||
* @param pErrorCode Must be a valid pointer to an error code value,
|
||||
* which must not indicate a failure before the function call.
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see UCharIteratorGetState
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
typedef void U_CALLCONV
|
||||
UCharIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
|
||||
|
||||
|
||||
/**
|
||||
* C API for code unit iteration.
|
||||
* This can be used as a C wrapper around
|
||||
* CharacterIterator, Replaceable, or implemented using simple strings, etc.
|
||||
*
|
||||
* There are two roles for using UCharIterator:
|
||||
*
|
||||
* A "provider" sets the necessary function pointers and controls the "protected"
|
||||
* fields of the UCharIterator structure. A "provider" passes a UCharIterator
|
||||
* into C APIs that need a UCharIterator as an abstract, flexible string interface.
|
||||
*
|
||||
* Implementations of such C APIs are "callers" of UCharIterator functions;
|
||||
* they only use the "public" function pointers and never access the "protected"
|
||||
* fields directly.
|
||||
*
|
||||
* The current() and next() functions only check the current index against the
|
||||
* limit, and previous() only checks the current index against the start,
|
||||
* to see if the iterator already reached the end of the iteration range.
|
||||
*
|
||||
* The assumption - in all iterators - is that the index is moved via the API,
|
||||
* which means it won't go out of bounds, or the index is modified by
|
||||
* user code that knows enough about the iterator implementation to set valid
|
||||
* index values.
|
||||
*
|
||||
* UCharIterator functions return code unit values 0..0xffff,
|
||||
* or U_SENTINEL if the iteration bounds are reached.
|
||||
*
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
struct UCharIterator {
|
||||
/**
|
||||
* (protected) Pointer to string or wrapped object or similar.
|
||||
* Not used by caller.
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
const void *context;
|
||||
|
||||
/**
|
||||
* (protected) Length of string or similar.
|
||||
* Not used by caller.
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
int32_t length;
|
||||
|
||||
/**
|
||||
* (protected) Start index or similar.
|
||||
* Not used by caller.
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
int32_t start;
|
||||
|
||||
/**
|
||||
* (protected) Current index or similar.
|
||||
* Not used by caller.
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
int32_t index;
|
||||
|
||||
/**
|
||||
* (protected) Limit index or similar.
|
||||
* Not used by caller.
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
int32_t limit;
|
||||
|
||||
/**
|
||||
* (protected) Used by UTF-8 iterators and possibly others.
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
int32_t reservedField;
|
||||
|
||||
/**
|
||||
* (public) Returns the current position or the
|
||||
* start or limit index of the iteration range.
|
||||
*
|
||||
* @see UCharIteratorGetIndex
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
UCharIteratorGetIndex *getIndex;
|
||||
|
||||
/**
|
||||
* (public) Moves the current position relative to the start or limit of the
|
||||
* iteration range, or relative to the current position itself.
|
||||
* The movement is expressed in numbers of code units forward
|
||||
* or backward by specifying a positive or negative delta.
|
||||
*
|
||||
* @see UCharIteratorMove
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
UCharIteratorMove *move;
|
||||
|
||||
/**
|
||||
* (public) Check if current() and next() can still
|
||||
* return another code unit.
|
||||
*
|
||||
* @see UCharIteratorHasNext
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
UCharIteratorHasNext *hasNext;
|
||||
|
||||
/**
|
||||
* (public) Check if previous() can still return another code unit.
|
||||
*
|
||||
* @see UCharIteratorHasPrevious
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
UCharIteratorHasPrevious *hasPrevious;
|
||||
|
||||
/**
|
||||
* (public) Return the code unit at the current position,
|
||||
* or U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @see UCharIteratorCurrent
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
UCharIteratorCurrent *current;
|
||||
|
||||
/**
|
||||
* (public) Return the code unit at the current index and increment
|
||||
* the index (post-increment, like s[i++]),
|
||||
* or return U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @see UCharIteratorNext
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
UCharIteratorNext *next;
|
||||
|
||||
/**
|
||||
* (public) Decrement the index and return the code unit from there
|
||||
* (pre-decrement, like s[--i]),
|
||||
* or return U_SENTINEL if there is none (index is at the start).
|
||||
*
|
||||
* @see UCharIteratorPrevious
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
UCharIteratorPrevious *previous;
|
||||
|
||||
/**
|
||||
* (public) Reserved for future use. Currently NULL.
|
||||
*
|
||||
* @see UCharIteratorReserved
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
UCharIteratorReserved *reservedFn;
|
||||
|
||||
/**
|
||||
* (public) Return the state of the iterator, to be restored later with setState().
|
||||
* This function pointer is NULL if the iterator does not implement it.
|
||||
*
|
||||
* @see UCharIteratorGet
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
UCharIteratorGetState *getState;
|
||||
|
||||
/**
|
||||
* (public) Restore the iterator state from the state word from a call
|
||||
* to getState().
|
||||
* This function pointer is NULL if the iterator does not implement it.
|
||||
*
|
||||
* @see UCharIteratorSet
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
UCharIteratorSetState *setState;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper function for UCharIterator to get the code point
|
||||
* at the current index.
|
||||
*
|
||||
* Return the code point that includes the code unit at the current position,
|
||||
* or U_SENTINEL if there is none (index is at the limit).
|
||||
* If the current code unit is a lead or trail surrogate,
|
||||
* then the following or preceding surrogate is used to form
|
||||
* the code point value.
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the current code point
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see U16_GET
|
||||
* @see UnicodeString::char32At()
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
U_STABLE UChar32 U_EXPORT2
|
||||
uiter_current32(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Helper function for UCharIterator to get the next code point.
|
||||
*
|
||||
* Return the code point at the current index and increment
|
||||
* the index (post-increment, like s[i++]),
|
||||
* or return U_SENTINEL if there is none (index is at the limit).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the current code point (and post-increment the current index)
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see U16_NEXT
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
U_STABLE UChar32 U_EXPORT2
|
||||
uiter_next32(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Helper function for UCharIterator to get the previous code point.
|
||||
*
|
||||
* Decrement the index and return the code point from there
|
||||
* (pre-decrement, like s[--i]),
|
||||
* or return U_SENTINEL if there is none (index is at the start).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the previous code point (after pre-decrementing the current index)
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see U16_PREV
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
U_STABLE UChar32 U_EXPORT2
|
||||
uiter_previous32(UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Get the "state" of the iterator in the form of a single 32-bit word.
|
||||
* This is a convenience function that calls iter->getState(iter)
|
||||
* if iter->getState is not NULL;
|
||||
* if it is NULL or any other error occurs, then UITER_NO_STATE is returned.
|
||||
*
|
||||
* Some UCharIterator implementations may not be able to return
|
||||
* a valid state for each position, in which case they return UITER_NO_STATE instead.
|
||||
* This will be clearly documented for each such iterator (none of the public ones here).
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @return the state word
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see UCharIteratorGetState
|
||||
* @see UITER_NO_STATE
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
U_STABLE uint32_t U_EXPORT2
|
||||
uiter_getState(const UCharIterator *iter);
|
||||
|
||||
/**
|
||||
* Restore the "state" of the iterator using a state word from a getState() call.
|
||||
* This is a convenience function that calls iter->setState(iter, state, pErrorCode)
|
||||
* if iter->setState is not NULL; if it is NULL, then U_UNSUPPORTED_ERROR is set.
|
||||
*
|
||||
* @param iter the UCharIterator structure ("this pointer")
|
||||
* @param state the state word from a getState() call
|
||||
* on a same-type, same-string iterator
|
||||
* @param pErrorCode Must be a valid pointer to an error code value,
|
||||
* which must not indicate a failure before the function call.
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see UCharIteratorSetState
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Set up a UCharIterator to iterate over a string.
|
||||
*
|
||||
* Sets the UCharIterator function pointers for iteration over the string s
|
||||
* with iteration boundaries start=index=0 and length=limit=string length.
|
||||
* The "provider" may set the start, index, and limit values at any time
|
||||
* within the range 0..length.
|
||||
* The length field will be ignored.
|
||||
*
|
||||
* The string pointer s is set into UCharIterator.context without copying
|
||||
* or reallocating the string contents.
|
||||
*
|
||||
* getState() simply returns the current index.
|
||||
* move() will always return the final index.
|
||||
*
|
||||
* @param iter UCharIterator structure to be set for iteration
|
||||
* @param s String to iterate over
|
||||
* @param length Length of s, or -1 if NUL-terminated
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
uiter_setString(UCharIterator *iter, const UChar *s, int32_t length);
|
||||
|
||||
/**
|
||||
* Set up a UCharIterator to iterate over a UTF-16BE string
|
||||
* (byte vector with a big-endian pair of bytes per UChar).
|
||||
*
|
||||
* Everything works just like with a normal UChar iterator (uiter_setString),
|
||||
* except that UChars are assembled from byte pairs,
|
||||
* and that the length argument here indicates an even number of bytes.
|
||||
*
|
||||
* getState() simply returns the current index.
|
||||
* move() will always return the final index.
|
||||
*
|
||||
* @param iter UCharIterator structure to be set for iteration
|
||||
* @param s UTF-16BE string to iterate over
|
||||
* @param length Length of s as an even number of bytes, or -1 if NUL-terminated
|
||||
* (NUL means pair of 0 bytes at even index from s)
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @see uiter_setString
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length);
|
||||
|
||||
/**
|
||||
* Set up a UCharIterator to iterate over a UTF-8 string.
|
||||
*
|
||||
* Sets the UCharIterator function pointers for iteration over the UTF-8 string s
|
||||
* with UTF-8 iteration boundaries 0 and length.
|
||||
* The implementation counts the UTF-16 index on the fly and
|
||||
* lazily evaluates the UTF-16 length of the text.
|
||||
*
|
||||
* The start field is used as the UTF-8 offset, the limit field as the UTF-8 length.
|
||||
* When the reservedField is not 0, then it contains a supplementary code point
|
||||
* and the UTF-16 index is between the two corresponding surrogates.
|
||||
* At that point, the UTF-8 index is behind that code point.
|
||||
*
|
||||
* The UTF-8 string pointer s is set into UCharIterator.context without copying
|
||||
* or reallocating the string contents.
|
||||
*
|
||||
* getState() returns a state value consisting of
|
||||
* - the current UTF-8 source byte index (bits 31..1)
|
||||
* - a flag (bit 0) that indicates whether the UChar position is in the middle
|
||||
* of a surrogate pair
|
||||
* (from a 4-byte UTF-8 sequence for the corresponding supplementary code point)
|
||||
*
|
||||
* getState() cannot also encode the UTF-16 index in the state value.
|
||||
* move(relative to limit or length), or
|
||||
* move(relative to current) after setState(), may return UITER_UNKNOWN_INDEX.
|
||||
*
|
||||
* @param iter UCharIterator structure to be set for iteration
|
||||
* @param s UTF-8 string to iterate over
|
||||
* @param length Length of s in bytes, or -1 if NUL-terminated
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
uiter_setUTF8(UCharIterator *iter, const char *s, int32_t length);
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
/**
|
||||
* Set up a UCharIterator to wrap around a C++ CharacterIterator.
|
||||
*
|
||||
* Sets the UCharIterator function pointers for iteration using the
|
||||
* CharacterIterator charIter.
|
||||
*
|
||||
* The CharacterIterator pointer charIter is set into UCharIterator.context
|
||||
* without copying or cloning the CharacterIterator object.
|
||||
* The other "protected" UCharIterator fields are set to 0 and will be ignored.
|
||||
* The iteration index and boundaries are controlled by the CharacterIterator.
|
||||
*
|
||||
* getState() simply returns the current index.
|
||||
* move() will always return the final index.
|
||||
*
|
||||
* @param iter UCharIterator structure to be set for iteration
|
||||
* @param charIter CharacterIterator to wrap
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
uiter_setCharacterIterator(UCharIterator *iter, icu::CharacterIterator *charIter);
|
||||
|
||||
/**
|
||||
* Set up a UCharIterator to iterate over a C++ Replaceable.
|
||||
*
|
||||
* Sets the UCharIterator function pointers for iteration over the
|
||||
* Replaceable rep with iteration boundaries start=index=0 and
|
||||
* length=limit=rep->length().
|
||||
* The "provider" may set the start, index, and limit values at any time
|
||||
* within the range 0..length=rep->length().
|
||||
* The length field will be ignored.
|
||||
*
|
||||
* The Replaceable pointer rep is set into UCharIterator.context without copying
|
||||
* or cloning/reallocating the Replaceable object.
|
||||
*
|
||||
* getState() simply returns the current index.
|
||||
* move() will always return the final index.
|
||||
*
|
||||
* @param iter UCharIterator structure to be set for iteration
|
||||
* @param rep Replaceable to iterate over
|
||||
*
|
||||
* @see UCharIterator
|
||||
* @stable ICU 2.1
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
uiter_setReplaceable(UCharIterator *iter, const icu::Replaceable *rep);
|
||||
|
||||
#endif
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
#endif
|
||||
424
vendor/icu/include/unicode/umachine.h
vendored
Normal file
424
vendor/icu/include/unicode/umachine.h
vendored
Normal file
@@ -0,0 +1,424 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: umachine.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 1999sep13
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* This file defines basic types and constants for ICU to be
|
||||
* platform-independent. umachine.h and utf.h are included into
|
||||
* utypes.h to provide all the general definitions for ICU.
|
||||
* All of these definitions used to be in utypes.h before
|
||||
* the UTF-handling macros made this unmaintainable.
|
||||
*/
|
||||
|
||||
#ifndef __UMACHINE_H__
|
||||
#define __UMACHINE_H__
|
||||
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief Basic types and constants for UTF
|
||||
*
|
||||
* <h2> Basic types and constants for UTF </h2>
|
||||
* This file defines basic types and constants for utf.h to be
|
||||
* platform-independent. umachine.h and utf.h are included into
|
||||
* utypes.h to provide all the general definitions for ICU.
|
||||
* All of these definitions used to be in utypes.h before
|
||||
* the UTF-handling macros made this unmaintainable.
|
||||
*
|
||||
*/
|
||||
/*==========================================================================*/
|
||||
/* Include platform-dependent definitions */
|
||||
/* which are contained in the platform-specific file platform.h */
|
||||
/*==========================================================================*/
|
||||
|
||||
#include <unicode/ptypes.h> /* platform.h is included in ptypes.h */
|
||||
|
||||
/*
|
||||
* ANSI C headers:
|
||||
* stddef.h defines wchar_t
|
||||
*/
|
||||
#include <stddef.h>
|
||||
|
||||
/*==========================================================================*/
|
||||
/* For C wrappers, we use the symbol U_STABLE. */
|
||||
/* This works properly if the includer is C or C++. */
|
||||
/* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */
|
||||
/*==========================================================================*/
|
||||
|
||||
/**
|
||||
* \def U_CFUNC
|
||||
* This is used in a declaration of a library private ICU C function.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_CDECL_BEGIN
|
||||
* This is used to begin a declaration of a library private ICU C API.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_CDECL_END
|
||||
* This is used to end a declaration of a library private ICU C API
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define U_CFUNC extern "C"
|
||||
# define U_CDECL_BEGIN extern "C" {
|
||||
# define U_CDECL_END }
|
||||
#else
|
||||
# define U_CFUNC extern
|
||||
# define U_CDECL_BEGIN
|
||||
# define U_CDECL_END
|
||||
#endif
|
||||
|
||||
#ifndef U_ATTRIBUTE_DEPRECATED
|
||||
/**
|
||||
* \def U_ATTRIBUTE_DEPRECATED
|
||||
* This is used for GCC specific attributes
|
||||
* @internal
|
||||
*/
|
||||
#if U_GCC_MAJOR_MINOR >= 302
|
||||
# define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
|
||||
/**
|
||||
* \def U_ATTRIBUTE_DEPRECATED
|
||||
* This is used for Visual C++ specific attributes
|
||||
* @internal
|
||||
*/
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
# define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
|
||||
#else
|
||||
# define U_ATTRIBUTE_DEPRECATED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
|
||||
#define U_CAPI U_CFUNC U_EXPORT
|
||||
/** This is used to declare a function as a stable public ICU C API*/
|
||||
#define U_STABLE U_CAPI
|
||||
/** This is used to declare a function as a draft public ICU C API */
|
||||
#define U_DRAFT U_CAPI
|
||||
/** This is used to declare a function as a deprecated public ICU C API */
|
||||
#define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
|
||||
/** This is used to declare a function as an obsolete public ICU C API */
|
||||
#define U_OBSOLETE U_CAPI
|
||||
/** This is used to declare a function as an internal ICU C API */
|
||||
#define U_INTERNAL U_CAPI
|
||||
|
||||
/**
|
||||
* \def U_OVERRIDE
|
||||
* Defined to the C++11 "override" keyword if available.
|
||||
* Denotes a class or member which is an override of the base class.
|
||||
* May result in an error if it applied to something not an override.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_FINAL
|
||||
* Defined to the C++11 "final" keyword if available.
|
||||
* Denotes a class or member which may not be overridden in subclasses.
|
||||
* May result in an error if subclasses attempt to override.
|
||||
* @internal
|
||||
*/
|
||||
|
||||
#if U_CPLUSPLUS_VERSION >= 11
|
||||
/* C++11 */
|
||||
#ifndef U_OVERRIDE
|
||||
#define U_OVERRIDE override
|
||||
#endif
|
||||
#ifndef U_FINAL
|
||||
#define U_FINAL final
|
||||
#endif
|
||||
#else
|
||||
/* not C++11 - define to nothing */
|
||||
#ifndef U_OVERRIDE
|
||||
#define U_OVERRIDE
|
||||
#endif
|
||||
#ifndef U_FINAL
|
||||
#define U_FINAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*==========================================================================*/
|
||||
/* limits for int32_t etc., like in POSIX inttypes.h */
|
||||
/*==========================================================================*/
|
||||
|
||||
#ifndef INT8_MIN
|
||||
/** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */
|
||||
# define INT8_MIN ((int8_t)(-128))
|
||||
#endif
|
||||
#ifndef INT16_MIN
|
||||
/** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */
|
||||
# define INT16_MIN ((int16_t)(-32767-1))
|
||||
#endif
|
||||
#ifndef INT32_MIN
|
||||
/** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */
|
||||
# define INT32_MIN ((int32_t)(-2147483647-1))
|
||||
#endif
|
||||
|
||||
#ifndef INT8_MAX
|
||||
/** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */
|
||||
# define INT8_MAX ((int8_t)(127))
|
||||
#endif
|
||||
#ifndef INT16_MAX
|
||||
/** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */
|
||||
# define INT16_MAX ((int16_t)(32767))
|
||||
#endif
|
||||
#ifndef INT32_MAX
|
||||
/** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */
|
||||
# define INT32_MAX ((int32_t)(2147483647))
|
||||
#endif
|
||||
|
||||
#ifndef UINT8_MAX
|
||||
/** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */
|
||||
# define UINT8_MAX ((uint8_t)(255U))
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
/** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */
|
||||
# define UINT16_MAX ((uint16_t)(65535U))
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
/** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */
|
||||
# define UINT32_MAX ((uint32_t)(4294967295U))
|
||||
#endif
|
||||
|
||||
#if defined(U_INT64_T_UNAVAILABLE)
|
||||
# error int64_t is required for decimal format and rule-based number format.
|
||||
#else
|
||||
# ifndef INT64_C
|
||||
/**
|
||||
* Provides a platform independent way to specify a signed 64-bit integer constant.
|
||||
* note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
# define INT64_C(c) c ## LL
|
||||
# endif
|
||||
# ifndef UINT64_C
|
||||
/**
|
||||
* Provides a platform independent way to specify an unsigned 64-bit integer constant.
|
||||
* note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
# define UINT64_C(c) c ## ULL
|
||||
# endif
|
||||
# ifndef U_INT64_MIN
|
||||
/** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */
|
||||
# define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1))
|
||||
# endif
|
||||
# ifndef U_INT64_MAX
|
||||
/** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */
|
||||
# define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807)))
|
||||
# endif
|
||||
# ifndef U_UINT64_MAX
|
||||
/** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */
|
||||
# define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615)))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*==========================================================================*/
|
||||
/* Boolean data type */
|
||||
/*==========================================================================*/
|
||||
|
||||
/** The ICU boolean type @stable ICU 2.0 */
|
||||
typedef int8_t UBool;
|
||||
|
||||
#ifndef TRUE
|
||||
/** The TRUE value of a UBool @stable ICU 2.0 */
|
||||
# define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
/** The FALSE value of a UBool @stable ICU 2.0 */
|
||||
# define FALSE 0
|
||||
#endif
|
||||
|
||||
|
||||
/*==========================================================================*/
|
||||
/* Unicode data types */
|
||||
/*==========================================================================*/
|
||||
|
||||
/* wchar_t-related definitions -------------------------------------------- */
|
||||
|
||||
/*
|
||||
* \def U_WCHAR_IS_UTF16
|
||||
* Defined if wchar_t uses UTF-16.
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
/*
|
||||
* \def U_WCHAR_IS_UTF32
|
||||
* Defined if wchar_t uses UTF-32.
|
||||
*
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
|
||||
# ifdef __STDC_ISO_10646__
|
||||
# if (U_SIZEOF_WCHAR_T==2)
|
||||
# define U_WCHAR_IS_UTF16
|
||||
# elif (U_SIZEOF_WCHAR_T==4)
|
||||
# define U_WCHAR_IS_UTF32
|
||||
# endif
|
||||
# elif defined __UCS2__
|
||||
# if (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) && (U_SIZEOF_WCHAR_T==2)
|
||||
# define U_WCHAR_IS_UTF16
|
||||
# endif
|
||||
# elif defined(__UCS4__) || (U_PLATFORM == U_PF_OS400 && defined(__UTF32__))
|
||||
# if (U_SIZEOF_WCHAR_T==4)
|
||||
# define U_WCHAR_IS_UTF32
|
||||
# endif
|
||||
# elif U_PLATFORM_IS_DARWIN_BASED || (U_SIZEOF_WCHAR_T==4 && U_PLATFORM_IS_LINUX_BASED)
|
||||
# define U_WCHAR_IS_UTF32
|
||||
# elif U_PLATFORM_HAS_WIN32_API
|
||||
# define U_WCHAR_IS_UTF16
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* UChar and UChar32 definitions -------------------------------------------- */
|
||||
|
||||
/** Number of bytes in a UChar. @stable ICU 2.0 */
|
||||
#define U_SIZEOF_UCHAR 2
|
||||
|
||||
/**
|
||||
* \def U_CHAR16_IS_TYPEDEF
|
||||
* If 1, then char16_t is a typedef and not a real type (yet)
|
||||
* @internal
|
||||
*/
|
||||
#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
|
||||
// for AIX, uchar.h needs to be included
|
||||
# include <uchar.h>
|
||||
# define U_CHAR16_IS_TYPEDEF 1
|
||||
#elif defined(_MSC_VER) && (_MSC_VER < 1900)
|
||||
// Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type,
|
||||
// and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx
|
||||
# define U_CHAR16_IS_TYPEDEF 1
|
||||
#else
|
||||
# define U_CHAR16_IS_TYPEDEF 0
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \var UChar
|
||||
*
|
||||
* The base type for UTF-16 code units and pointers.
|
||||
* Unsigned 16-bit integer.
|
||||
* Starting with ICU 59, C++ API uses char16_t directly, while C API continues to use UChar.
|
||||
*
|
||||
* UChar is configurable by defining the macro UCHAR_TYPE
|
||||
* on the preprocessor or compiler command line:
|
||||
* -DUCHAR_TYPE=uint16_t or -DUCHAR_TYPE=wchar_t (if U_SIZEOF_WCHAR_T==2) etc.
|
||||
* (The UCHAR_TYPE can also be #defined earlier in this file, for outside the ICU library code.)
|
||||
* This is for transitional use from application code that uses uint16_t or wchar_t for UTF-16.
|
||||
*
|
||||
* The default is UChar=char16_t.
|
||||
*
|
||||
* C++11 defines char16_t as bit-compatible with uint16_t, but as a distinct type.
|
||||
*
|
||||
* In C, char16_t is a simple typedef of uint_least16_t.
|
||||
* ICU requires uint_least16_t=uint16_t for data memory mapping.
|
||||
* On macOS, char16_t is not available because the uchar.h standard header is missing.
|
||||
*
|
||||
* @stable ICU 4.4
|
||||
*/
|
||||
|
||||
#if 1
|
||||
// #if 1 is normal. UChar defaults to char16_t in C++.
|
||||
// For configuration testing of UChar=uint16_t temporarily change this to #if 0.
|
||||
// The intltest Makefile #defines UCHAR_TYPE=char16_t,
|
||||
// so we only #define it to uint16_t if it is undefined so far.
|
||||
#elif !defined(UCHAR_TYPE)
|
||||
# define UCHAR_TYPE uint16_t
|
||||
#endif
|
||||
|
||||
#if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
|
||||
defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION)
|
||||
// Inside the ICU library code, never configurable.
|
||||
typedef char16_t UChar;
|
||||
#elif defined(UCHAR_TYPE)
|
||||
typedef UCHAR_TYPE UChar;
|
||||
#elif defined(__cplusplus)
|
||||
typedef char16_t UChar;
|
||||
#else
|
||||
typedef uint16_t UChar;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \var OldUChar
|
||||
* Default ICU 58 definition of UChar.
|
||||
* A base type for UTF-16 code units and pointers.
|
||||
* Unsigned 16-bit integer.
|
||||
*
|
||||
* Define OldUChar to be wchar_t if that is 16 bits wide.
|
||||
* If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
|
||||
*
|
||||
* This makes the definition of OldUChar platform-dependent
|
||||
* but allows direct string type compatibility with platforms with
|
||||
* 16-bit wchar_t types.
|
||||
*
|
||||
* This is how UChar was defined in ICU 58, for transition convenience.
|
||||
* Exception: ICU 58 UChar was defined to UCHAR_TYPE if that macro was defined.
|
||||
* The current UChar responds to UCHAR_TYPE but OldUChar does not.
|
||||
*
|
||||
* @stable ICU 59
|
||||
*/
|
||||
#if U_SIZEOF_WCHAR_T==2
|
||||
typedef wchar_t OldUChar;
|
||||
#elif defined(__CHAR16_TYPE__)
|
||||
typedef __CHAR16_TYPE__ OldUChar;
|
||||
#else
|
||||
typedef uint16_t OldUChar;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Define UChar32 as a type for single Unicode code points.
|
||||
* UChar32 is a signed 32-bit integer (same as int32_t).
|
||||
*
|
||||
* The Unicode code point range is 0..0x10ffff.
|
||||
* All other values (negative or >=0x110000) are illegal as Unicode code points.
|
||||
* They may be used as sentinel values to indicate "done", "error"
|
||||
* or similar non-code point conditions.
|
||||
*
|
||||
* Before ICU 2.4 (Jitterbug 2146), UChar32 was defined
|
||||
* to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned)
|
||||
* or else to be uint32_t.
|
||||
* That is, the definition of UChar32 was platform-dependent.
|
||||
*
|
||||
* @see U_SENTINEL
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
typedef int32_t UChar32;
|
||||
|
||||
/**
|
||||
* This value is intended for sentinel values for APIs that
|
||||
* (take or) return single code points (UChar32).
|
||||
* It is outside of the Unicode code point range 0..0x10ffff.
|
||||
*
|
||||
* For example, a "done" or "error" value in a new API
|
||||
* could be indicated with U_SENTINEL.
|
||||
*
|
||||
* ICU APIs designed before ICU 2.4 usually define service-specific "done"
|
||||
* values, mostly 0xffff.
|
||||
* Those may need to be distinguished from
|
||||
* actual U+ffff text contents by calling functions like
|
||||
* CharacterIterator::hasNext() or UnicodeString::length().
|
||||
*
|
||||
* @return -1
|
||||
* @see UChar32
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_SENTINEL (-1)
|
||||
|
||||
#include <unicode/urename.h>
|
||||
|
||||
#endif
|
||||
4771
vendor/icu/include/unicode/unistr.h
vendored
Normal file
4771
vendor/icu/include/unicode/unistr.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
322
vendor/icu/include/unicode/uobject.h
vendored
Normal file
322
vendor/icu/include/unicode/uobject.h
vendored
Normal file
@@ -0,0 +1,322 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: uobject.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2002jun26
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __UOBJECT_H__
|
||||
#define __UOBJECT_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C++ API: Common ICU base class UObject.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @{
|
||||
* \def U_NO_THROW
|
||||
* Define this to define the throw() specification so
|
||||
* certain functions do not throw any exceptions
|
||||
*
|
||||
* UMemory operator new methods should have the throw() specification
|
||||
* appended to them, so that the compiler adds the additional NULL check
|
||||
* before calling constructors. Without, if <code>operator new</code> returns NULL the
|
||||
* constructor is still called, and if the constructor references member
|
||||
* data, (which it typically does), the result is a segmentation violation.
|
||||
*
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#ifndef U_NO_THROW
|
||||
#define U_NO_THROW throw()
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* UClassID-based RTTI */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* UClassID is used to identify classes without using the compiler's RTTI.
|
||||
* This was used before C++ compilers consistently supported RTTI.
|
||||
* ICU 4.6 requires compiler RTTI to be turned on.
|
||||
*
|
||||
* Each class hierarchy which needs
|
||||
* to implement polymorphic clone() or operator==() defines two methods,
|
||||
* described in detail below. UClassID values can be compared using
|
||||
* operator==(). Nothing else should be done with them.
|
||||
*
|
||||
* \par
|
||||
* In class hierarchies that implement "poor man's RTTI",
|
||||
* each concrete subclass implements getDynamicClassID() in the same way:
|
||||
*
|
||||
* \code
|
||||
* class Derived {
|
||||
* public:
|
||||
* virtual UClassID getDynamicClassID() const
|
||||
* { return Derived::getStaticClassID(); }
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* Each concrete class implements getStaticClassID() as well, which allows
|
||||
* clients to test for a specific type.
|
||||
*
|
||||
* \code
|
||||
* class Derived {
|
||||
* public:
|
||||
* static UClassID U_EXPORT2 getStaticClassID();
|
||||
* private:
|
||||
* static char fgClassID;
|
||||
* }
|
||||
*
|
||||
* // In Derived.cpp:
|
||||
* UClassID Derived::getStaticClassID()
|
||||
* { return (UClassID)&Derived::fgClassID; }
|
||||
* char Derived::fgClassID = 0; // Value is irrelevant
|
||||
* \endcode
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
typedef void* UClassID;
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* UMemory is the common ICU base class.
|
||||
* All other ICU C++ classes are derived from UMemory (starting with ICU 2.4).
|
||||
*
|
||||
* This is primarily to make it possible and simple to override the
|
||||
* C++ memory management by adding new/delete operators to this base class.
|
||||
*
|
||||
* To override ALL ICU memory management, including that from plain C code,
|
||||
* replace the allocation functions declared in cmemory.h
|
||||
*
|
||||
* UMemory does not contain any virtual functions.
|
||||
* Common "boilerplate" functions are defined in UObject.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
class U_COMMON_API UMemory {
|
||||
public:
|
||||
|
||||
/* test versions for debugging shaper heap memory problems */
|
||||
#ifdef SHAPER_MEMORY_DEBUG
|
||||
static void * NewArray(int size, int count);
|
||||
static void * GrowArray(void * array, int newSize );
|
||||
static void FreeArray(void * array );
|
||||
#endif
|
||||
|
||||
#if U_OVERRIDE_CXX_ALLOCATION
|
||||
/**
|
||||
* Override for ICU4C C++ memory management.
|
||||
* simple, non-class types are allocated using the macros in common/cmemory.h
|
||||
* (uprv_malloc(), uprv_free(), uprv_realloc());
|
||||
* they or something else could be used here to implement C++ new/delete
|
||||
* for ICU4C C++ classes
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
static void * U_EXPORT2 operator new(size_t size) U_NO_THROW;
|
||||
|
||||
/**
|
||||
* Override for ICU4C C++ memory management.
|
||||
* See new().
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
static void * U_EXPORT2 operator new[](size_t size) U_NO_THROW;
|
||||
|
||||
/**
|
||||
* Override for ICU4C C++ memory management.
|
||||
* simple, non-class types are allocated using the macros in common/cmemory.h
|
||||
* (uprv_malloc(), uprv_free(), uprv_realloc());
|
||||
* they or something else could be used here to implement C++ new/delete
|
||||
* for ICU4C C++ classes
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
static void U_EXPORT2 operator delete(void *p) U_NO_THROW;
|
||||
|
||||
/**
|
||||
* Override for ICU4C C++ memory management.
|
||||
* See delete().
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
static void U_EXPORT2 operator delete[](void *p) U_NO_THROW;
|
||||
|
||||
#if U_HAVE_PLACEMENT_NEW
|
||||
/**
|
||||
* Override for ICU4C C++ memory management for STL.
|
||||
* See new().
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NO_THROW { return ptr; }
|
||||
|
||||
/**
|
||||
* Override for ICU4C C++ memory management for STL.
|
||||
* See delete().
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
static inline void U_EXPORT2 operator delete(void *, void *) U_NO_THROW {}
|
||||
#endif /* U_HAVE_PLACEMENT_NEW */
|
||||
#if U_HAVE_DEBUG_LOCATION_NEW
|
||||
/**
|
||||
* This method overrides the MFC debug version of the operator new
|
||||
*
|
||||
* @param size The requested memory size
|
||||
* @param file The file where the allocation was requested
|
||||
* @param line The line where the allocation was requested
|
||||
*/
|
||||
static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NO_THROW;
|
||||
/**
|
||||
* This method provides a matching delete for the MFC debug new
|
||||
*
|
||||
* @param p The pointer to the allocated memory
|
||||
* @param file The file where the allocation was requested
|
||||
* @param line The line where the allocation was requested
|
||||
*/
|
||||
static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NO_THROW;
|
||||
#endif /* U_HAVE_DEBUG_LOCATION_NEW */
|
||||
#endif /* U_OVERRIDE_CXX_ALLOCATION */
|
||||
|
||||
/*
|
||||
* Assignment operator not declared. The compiler will provide one
|
||||
* which does nothing since this class does not contain any data members.
|
||||
* API/code coverage may show the assignment operator as present and
|
||||
* untested - ignore.
|
||||
* Subclasses need this assignment operator if they use compiler-provided
|
||||
* assignment operators of their own. An alternative to not declaring one
|
||||
* here would be to declare and empty-implement a protected or public one.
|
||||
UMemory &UMemory::operator=(const UMemory &);
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
* UObject is the common ICU "boilerplate" class.
|
||||
* UObject inherits UMemory (starting with ICU 2.4),
|
||||
* and all other public ICU C++ classes
|
||||
* are derived from UObject (starting with ICU 2.2).
|
||||
*
|
||||
* UObject contains common virtual functions, in particular a virtual destructor.
|
||||
*
|
||||
* The clone() function is not available in UObject because it is not
|
||||
* implemented by all ICU classes.
|
||||
* Many ICU services provide a clone() function for their class trees,
|
||||
* defined on the service's C++ base class, and all subclasses within that
|
||||
* service class tree return a pointer to the service base class
|
||||
* (which itself is a subclass of UObject).
|
||||
* This is because some compilers do not support covariant (same-as-this)
|
||||
* return types; cast to the appropriate subclass if necessary.
|
||||
*
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
class U_COMMON_API UObject : public UMemory {
|
||||
public:
|
||||
/**
|
||||
* Destructor.
|
||||
*
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
virtual ~UObject();
|
||||
|
||||
/**
|
||||
* ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
|
||||
* The base class implementation returns a dummy value.
|
||||
*
|
||||
* Use compiler RTTI rather than ICU's "poor man's RTTI".
|
||||
* Since ICU 4.6, new ICU C++ class hierarchies do not implement "poor man's RTTI".
|
||||
*
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
virtual UClassID getDynamicClassID() const;
|
||||
|
||||
protected:
|
||||
// the following functions are protected to prevent instantiation and
|
||||
// direct use of UObject itself
|
||||
|
||||
// default constructor
|
||||
// inline UObject() {}
|
||||
|
||||
// copy constructor
|
||||
// inline UObject(const UObject &other) {}
|
||||
|
||||
#if 0
|
||||
// TODO Sometime in the future. Implement operator==().
|
||||
// (This comment inserted in 2.2)
|
||||
// some or all of the following "boilerplate" functions may be made public
|
||||
// in a future ICU4C release when all subclasses implement them
|
||||
|
||||
// assignment operator
|
||||
// (not virtual, see "Taligent's Guide to Designing Programs" pp.73..74)
|
||||
// commented out because the implementation is the same as a compiler's default
|
||||
// UObject &operator=(const UObject &other) { return *this; }
|
||||
|
||||
// comparison operators
|
||||
virtual inline UBool operator==(const UObject &other) const { return this==&other; }
|
||||
inline UBool operator!=(const UObject &other) const { return !operator==(other); }
|
||||
|
||||
// clone() commented out from the base class:
|
||||
// some compilers do not support co-variant return types
|
||||
// (i.e., subclasses would have to return UObject * as well, instead of SubClass *)
|
||||
// see also UObject class documentation.
|
||||
// virtual UObject *clone() const;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assignment operator not declared. The compiler will provide one
|
||||
* which does nothing since this class does not contain any data members.
|
||||
* API/code coverage may show the assignment operator as present and
|
||||
* untested - ignore.
|
||||
* Subclasses need this assignment operator if they use compiler-provided
|
||||
* assignment operators of their own. An alternative to not declaring one
|
||||
* here would be to declare and empty-implement a protected or public one.
|
||||
UObject &UObject::operator=(const UObject &);
|
||||
*/
|
||||
};
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
* This is a simple macro to add ICU RTTI to an ICU object implementation.
|
||||
* This does not go into the header. This should only be used in *.cpp files.
|
||||
*
|
||||
* @param myClass The name of the class that needs RTTI defined.
|
||||
* @internal
|
||||
*/
|
||||
#define UOBJECT_DEFINE_RTTI_IMPLEMENTATION(myClass) \
|
||||
UClassID U_EXPORT2 myClass::getStaticClassID() { \
|
||||
static char classID = 0; \
|
||||
return (UClassID)&classID; \
|
||||
} \
|
||||
UClassID myClass::getDynamicClassID() const \
|
||||
{ return myClass::getStaticClassID(); }
|
||||
|
||||
|
||||
/**
|
||||
* This macro adds ICU RTTI to an ICU abstract class implementation.
|
||||
* This macro should be invoked in *.cpp files. The corresponding
|
||||
* header should declare getStaticClassID.
|
||||
*
|
||||
* @param myClass The name of the class that needs RTTI defined.
|
||||
* @internal
|
||||
*/
|
||||
#define UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(myClass) \
|
||||
UClassID U_EXPORT2 myClass::getStaticClassID() { \
|
||||
static char classID = 0; \
|
||||
return (UClassID)&classID; \
|
||||
}
|
||||
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
1819
vendor/icu/include/unicode/urename.h
vendored
Normal file
1819
vendor/icu/include/unicode/urename.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
675
vendor/icu/include/unicode/uscript.h
vendored
Normal file
675
vendor/icu/include/unicode/uscript.h
vendored
Normal file
@@ -0,0 +1,675 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1997-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
* File USCRIPT.H
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 07/06/2001 Ram Creation.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef USCRIPT_H
|
||||
#define USCRIPT_H
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Unicode Script Information
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constants for ISO 15924 script codes.
|
||||
*
|
||||
* The current set of script code constants supports at least all scripts
|
||||
* that are encoded in the version of Unicode which ICU currently supports.
|
||||
* The names of the constants are usually derived from the
|
||||
* Unicode script property value aliases.
|
||||
* See UAX #24 Unicode Script Property (http://www.unicode.org/reports/tr24/)
|
||||
* and http://www.unicode.org/Public/UCD/latest/ucd/PropertyValueAliases.txt .
|
||||
*
|
||||
* In addition, constants for many ISO 15924 script codes
|
||||
* are included, for use with language tags, CLDR data, and similar.
|
||||
* Some of those codes are not used in the Unicode Character Database (UCD).
|
||||
* For example, there are no characters that have a UCD script property value of
|
||||
* Hans or Hant. All Han ideographs have the Hani script property value in Unicode.
|
||||
*
|
||||
* Private-use codes Qaaa..Qabx are not included, except as used in the UCD or in CLDR.
|
||||
*
|
||||
* Starting with ICU 55, script codes are only added when their scripts
|
||||
* have been or will certainly be encoded in Unicode,
|
||||
* and have been assigned Unicode script property value aliases,
|
||||
* to ensure that their script names are stable and match the names of the constants.
|
||||
* Script codes like Latf and Aran that are not subject to separate encoding
|
||||
* may be added at any time.
|
||||
*
|
||||
* @stable ICU 2.2
|
||||
*/
|
||||
typedef enum UScriptCode {
|
||||
/*
|
||||
* Note: UScriptCode constants and their ISO script code comments
|
||||
* are parsed by preparseucd.py.
|
||||
* It matches lines like
|
||||
* USCRIPT_<Unicode Script value name> = <integer>, / * <ISO script code> * /
|
||||
*/
|
||||
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_INVALID_CODE = -1,
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_COMMON = 0, /* Zyyy */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_INHERITED = 1, /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_ARABIC = 2, /* Arab */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_ARMENIAN = 3, /* Armn */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_BENGALI = 4, /* Beng */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_BOPOMOFO = 5, /* Bopo */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_CHEROKEE = 6, /* Cher */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_COPTIC = 7, /* Copt */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_CYRILLIC = 8, /* Cyrl */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_DESERET = 9, /* Dsrt */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_DEVANAGARI = 10, /* Deva */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_ETHIOPIC = 11, /* Ethi */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_GEORGIAN = 12, /* Geor */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_GOTHIC = 13, /* Goth */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_GREEK = 14, /* Grek */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_GUJARATI = 15, /* Gujr */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_GURMUKHI = 16, /* Guru */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_HAN = 17, /* Hani */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_HANGUL = 18, /* Hang */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_HEBREW = 19, /* Hebr */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_HIRAGANA = 20, /* Hira */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_KANNADA = 21, /* Knda */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_KATAKANA = 22, /* Kana */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_KHMER = 23, /* Khmr */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_LAO = 24, /* Laoo */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_LATIN = 25, /* Latn */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_MALAYALAM = 26, /* Mlym */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_MONGOLIAN = 27, /* Mong */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_MYANMAR = 28, /* Mymr */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_OGHAM = 29, /* Ogam */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_OLD_ITALIC = 30, /* Ital */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_ORIYA = 31, /* Orya */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_RUNIC = 32, /* Runr */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_SINHALA = 33, /* Sinh */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_SYRIAC = 34, /* Syrc */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_TAMIL = 35, /* Taml */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_TELUGU = 36, /* Telu */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_THAANA = 37, /* Thaa */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_THAI = 38, /* Thai */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_TIBETAN = 39, /* Tibt */
|
||||
/** Canadian_Aboriginal script. @stable ICU 2.6 */
|
||||
USCRIPT_CANADIAN_ABORIGINAL = 40, /* Cans */
|
||||
/** Canadian_Aboriginal script (alias). @stable ICU 2.2 */
|
||||
USCRIPT_UCAS = USCRIPT_CANADIAN_ABORIGINAL,
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_YI = 41, /* Yiii */
|
||||
/* New scripts in Unicode 3.2 */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_TAGALOG = 42, /* Tglg */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_HANUNOO = 43, /* Hano */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_BUHID = 44, /* Buhd */
|
||||
/** @stable ICU 2.2 */
|
||||
USCRIPT_TAGBANWA = 45, /* Tagb */
|
||||
|
||||
/* New scripts in Unicode 4 */
|
||||
/** @stable ICU 2.6 */
|
||||
USCRIPT_BRAILLE = 46, /* Brai */
|
||||
/** @stable ICU 2.6 */
|
||||
USCRIPT_CYPRIOT = 47, /* Cprt */
|
||||
/** @stable ICU 2.6 */
|
||||
USCRIPT_LIMBU = 48, /* Limb */
|
||||
/** @stable ICU 2.6 */
|
||||
USCRIPT_LINEAR_B = 49, /* Linb */
|
||||
/** @stable ICU 2.6 */
|
||||
USCRIPT_OSMANYA = 50, /* Osma */
|
||||
/** @stable ICU 2.6 */
|
||||
USCRIPT_SHAVIAN = 51, /* Shaw */
|
||||
/** @stable ICU 2.6 */
|
||||
USCRIPT_TAI_LE = 52, /* Tale */
|
||||
/** @stable ICU 2.6 */
|
||||
USCRIPT_UGARITIC = 53, /* Ugar */
|
||||
|
||||
/** New script code in Unicode 4.0.1 @stable ICU 3.0 */
|
||||
USCRIPT_KATAKANA_OR_HIRAGANA = 54,/*Hrkt */
|
||||
|
||||
/* New scripts in Unicode 4.1 */
|
||||
/** @stable ICU 3.4 */
|
||||
USCRIPT_BUGINESE = 55, /* Bugi */
|
||||
/** @stable ICU 3.4 */
|
||||
USCRIPT_GLAGOLITIC = 56, /* Glag */
|
||||
/** @stable ICU 3.4 */
|
||||
USCRIPT_KHAROSHTHI = 57, /* Khar */
|
||||
/** @stable ICU 3.4 */
|
||||
USCRIPT_SYLOTI_NAGRI = 58, /* Sylo */
|
||||
/** @stable ICU 3.4 */
|
||||
USCRIPT_NEW_TAI_LUE = 59, /* Talu */
|
||||
/** @stable ICU 3.4 */
|
||||
USCRIPT_TIFINAGH = 60, /* Tfng */
|
||||
/** @stable ICU 3.4 */
|
||||
USCRIPT_OLD_PERSIAN = 61, /* Xpeo */
|
||||
|
||||
/* New script codes from Unicode and ISO 15924 */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_BALINESE = 62, /* Bali */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_BATAK = 63, /* Batk */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_BLISSYMBOLS = 64, /* Blis */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_BRAHMI = 65, /* Brah */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_CHAM = 66, /* Cham */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_CIRTH = 67, /* Cirt */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_OLD_CHURCH_SLAVONIC_CYRILLIC = 68, /* Cyrs */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_DEMOTIC_EGYPTIAN = 69, /* Egyd */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_HIERATIC_EGYPTIAN = 70, /* Egyh */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_EGYPTIAN_HIEROGLYPHS = 71, /* Egyp */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_KHUTSURI = 72, /* Geok */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_SIMPLIFIED_HAN = 73, /* Hans */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_TRADITIONAL_HAN = 74, /* Hant */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_PAHAWH_HMONG = 75, /* Hmng */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_OLD_HUNGARIAN = 76, /* Hung */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_HARAPPAN_INDUS = 77, /* Inds */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_JAVANESE = 78, /* Java */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_KAYAH_LI = 79, /* Kali */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_LATIN_FRAKTUR = 80, /* Latf */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_LATIN_GAELIC = 81, /* Latg */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_LEPCHA = 82, /* Lepc */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_LINEAR_A = 83, /* Lina */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_MANDAIC = 84, /* Mand */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_MANDAEAN = USCRIPT_MANDAIC,
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_MAYAN_HIEROGLYPHS = 85, /* Maya */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_MEROITIC_HIEROGLYPHS = 86, /* Mero */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_MEROITIC = USCRIPT_MEROITIC_HIEROGLYPHS,
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_NKO = 87, /* Nkoo */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_ORKHON = 88, /* Orkh */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_OLD_PERMIC = 89, /* Perm */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_PHAGS_PA = 90, /* Phag */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_PHOENICIAN = 91, /* Phnx */
|
||||
/** @stable ICU 52 */
|
||||
USCRIPT_MIAO = 92, /* Plrd */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_PHONETIC_POLLARD = USCRIPT_MIAO,
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_RONGORONGO = 93, /* Roro */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_SARATI = 94, /* Sara */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_ESTRANGELO_SYRIAC = 95, /* Syre */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_WESTERN_SYRIAC = 96, /* Syrj */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_EASTERN_SYRIAC = 97, /* Syrn */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_TENGWAR = 98, /* Teng */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_VAI = 99, /* Vaii */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_VISIBLE_SPEECH = 100,/* Visp */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_CUNEIFORM = 101,/* Xsux */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_UNWRITTEN_LANGUAGES = 102,/* Zxxx */
|
||||
/** @stable ICU 3.6 */
|
||||
USCRIPT_UNKNOWN = 103,/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */
|
||||
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_CARIAN = 104,/* Cari */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_JAPANESE = 105,/* Jpan */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_LANNA = 106,/* Lana */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_LYCIAN = 107,/* Lyci */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_LYDIAN = 108,/* Lydi */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_OL_CHIKI = 109,/* Olck */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_REJANG = 110,/* Rjng */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_SAURASHTRA = 111,/* Saur */
|
||||
/** Sutton SignWriting @stable ICU 3.8 */
|
||||
USCRIPT_SIGN_WRITING = 112,/* Sgnw */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_SUNDANESE = 113,/* Sund */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_MOON = 114,/* Moon */
|
||||
/** @stable ICU 3.8 */
|
||||
USCRIPT_MEITEI_MAYEK = 115,/* Mtei */
|
||||
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_IMPERIAL_ARAMAIC = 116,/* Armi */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_AVESTAN = 117,/* Avst */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_CHAKMA = 118,/* Cakm */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_KOREAN = 119,/* Kore */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_KAITHI = 120,/* Kthi */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_MANICHAEAN = 121,/* Mani */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_INSCRIPTIONAL_PAHLAVI = 122,/* Phli */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_PSALTER_PAHLAVI = 123,/* Phlp */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_BOOK_PAHLAVI = 124,/* Phlv */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_INSCRIPTIONAL_PARTHIAN = 125,/* Prti */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_SAMARITAN = 126,/* Samr */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_TAI_VIET = 127,/* Tavt */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_MATHEMATICAL_NOTATION = 128,/* Zmth */
|
||||
/** @stable ICU 4.0 */
|
||||
USCRIPT_SYMBOLS = 129,/* Zsym */
|
||||
|
||||
/** @stable ICU 4.4 */
|
||||
USCRIPT_BAMUM = 130,/* Bamu */
|
||||
/** @stable ICU 4.4 */
|
||||
USCRIPT_LISU = 131,/* Lisu */
|
||||
/** @stable ICU 4.4 */
|
||||
USCRIPT_NAKHI_GEBA = 132,/* Nkgb */
|
||||
/** @stable ICU 4.4 */
|
||||
USCRIPT_OLD_SOUTH_ARABIAN = 133,/* Sarb */
|
||||
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_BASSA_VAH = 134,/* Bass */
|
||||
/** @stable ICU 54 */
|
||||
USCRIPT_DUPLOYAN = 135,/* Dupl */
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/** @deprecated ICU 54 Typo, use USCRIPT_DUPLOYAN */
|
||||
USCRIPT_DUPLOYAN_SHORTAND = USCRIPT_DUPLOYAN,
|
||||
#endif /* U_HIDE_DEPRECATED_API */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_ELBASAN = 136,/* Elba */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_GRANTHA = 137,/* Gran */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_KPELLE = 138,/* Kpel */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_LOMA = 139,/* Loma */
|
||||
/** Mende Kikakui @stable ICU 4.6 */
|
||||
USCRIPT_MENDE = 140,/* Mend */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_MEROITIC_CURSIVE = 141,/* Merc */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_OLD_NORTH_ARABIAN = 142,/* Narb */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_NABATAEAN = 143,/* Nbat */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_PALMYRENE = 144,/* Palm */
|
||||
/** @stable ICU 54 */
|
||||
USCRIPT_KHUDAWADI = 145,/* Sind */
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_SINDHI = USCRIPT_KHUDAWADI,
|
||||
/** @stable ICU 4.6 */
|
||||
USCRIPT_WARANG_CITI = 146,/* Wara */
|
||||
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_AFAKA = 147,/* Afak */
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_JURCHEN = 148,/* Jurc */
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_MRO = 149,/* Mroo */
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_NUSHU = 150,/* Nshu */
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_SHARADA = 151,/* Shrd */
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_SORA_SOMPENG = 152,/* Sora */
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_TAKRI = 153,/* Takr */
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_TANGUT = 154,/* Tang */
|
||||
/** @stable ICU 4.8 */
|
||||
USCRIPT_WOLEAI = 155,/* Wole */
|
||||
|
||||
/** @stable ICU 49 */
|
||||
USCRIPT_ANATOLIAN_HIEROGLYPHS = 156,/* Hluw */
|
||||
/** @stable ICU 49 */
|
||||
USCRIPT_KHOJKI = 157,/* Khoj */
|
||||
/** @stable ICU 49 */
|
||||
USCRIPT_TIRHUTA = 158,/* Tirh */
|
||||
|
||||
/** @stable ICU 52 */
|
||||
USCRIPT_CAUCASIAN_ALBANIAN = 159,/* Aghb */
|
||||
/** @stable ICU 52 */
|
||||
USCRIPT_MAHAJANI = 160,/* Mahj */
|
||||
|
||||
/** @stable ICU 54 */
|
||||
USCRIPT_AHOM = 161,/* Ahom */
|
||||
/** @stable ICU 54 */
|
||||
USCRIPT_HATRAN = 162,/* Hatr */
|
||||
/** @stable ICU 54 */
|
||||
USCRIPT_MODI = 163,/* Modi */
|
||||
/** @stable ICU 54 */
|
||||
USCRIPT_MULTANI = 164,/* Mult */
|
||||
/** @stable ICU 54 */
|
||||
USCRIPT_PAU_CIN_HAU = 165,/* Pauc */
|
||||
/** @stable ICU 54 */
|
||||
USCRIPT_SIDDHAM = 166,/* Sidd */
|
||||
|
||||
/** @stable ICU 58 */
|
||||
USCRIPT_ADLAM = 167,/* Adlm */
|
||||
/** @stable ICU 58 */
|
||||
USCRIPT_BHAIKSUKI = 168,/* Bhks */
|
||||
/** @stable ICU 58 */
|
||||
USCRIPT_MARCHEN = 169,/* Marc */
|
||||
/** @stable ICU 58 */
|
||||
USCRIPT_NEWA = 170,/* Newa */
|
||||
/** @stable ICU 58 */
|
||||
USCRIPT_OSAGE = 171,/* Osge */
|
||||
|
||||
/** @stable ICU 58 */
|
||||
USCRIPT_HAN_WITH_BOPOMOFO = 172,/* Hanb */
|
||||
/** @stable ICU 58 */
|
||||
USCRIPT_JAMO = 173,/* Jamo */
|
||||
/** @stable ICU 58 */
|
||||
USCRIPT_SYMBOLS_EMOJI = 174,/* Zsye */
|
||||
|
||||
/** @stable ICU 60 */
|
||||
USCRIPT_MASARAM_GONDI = 175,/* Gonm */
|
||||
/** @stable ICU 60 */
|
||||
USCRIPT_SOYOMBO = 176,/* Soyo */
|
||||
/** @stable ICU 60 */
|
||||
USCRIPT_ZANABAZAR_SQUARE = 177,/* Zanb */
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal UScriptCode value.
|
||||
* The highest value is available via u_getIntPropertyMaxValue(UCHAR_SCRIPT).
|
||||
*
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
USCRIPT_CODE_LIMIT = 178
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
} UScriptCode;
|
||||
|
||||
/**
|
||||
* Gets the script codes associated with the given locale or ISO 15924 abbreviation or name.
|
||||
* Fills in USCRIPT_MALAYALAM given "Malayam" OR "Mlym".
|
||||
* Fills in USCRIPT_LATIN given "en" OR "en_US"
|
||||
* If the required capacity is greater than the capacity of the destination buffer,
|
||||
* then the error code is set to U_BUFFER_OVERFLOW_ERROR and the required capacity is returned.
|
||||
*
|
||||
* <p>Note: To search by short or long script alias only, use
|
||||
* u_getPropertyValueEnum(UCHAR_SCRIPT, alias) instead. That does
|
||||
* a fast lookup with no access of the locale data.
|
||||
*
|
||||
* @param nameOrAbbrOrLocale name of the script, as given in
|
||||
* PropertyValueAliases.txt, or ISO 15924 code or locale
|
||||
* @param fillIn the UScriptCode buffer to fill in the script code
|
||||
* @param capacity the capacity (size) of UScriptCode buffer passed in.
|
||||
* @param err the error status code.
|
||||
* @return The number of script codes filled in the buffer passed in
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
U_STABLE int32_t U_EXPORT2
|
||||
uscript_getCode(const char* nameOrAbbrOrLocale,UScriptCode* fillIn,int32_t capacity,UErrorCode *err);
|
||||
|
||||
/**
|
||||
* Returns the long Unicode script name, if there is one.
|
||||
* Otherwise returns the 4-letter ISO 15924 script code.
|
||||
* Returns "Malayam" given USCRIPT_MALAYALAM.
|
||||
*
|
||||
* @param scriptCode UScriptCode enum
|
||||
* @return long script name as given in PropertyValueAliases.txt, or the 4-letter code,
|
||||
* or NULL if scriptCode is invalid
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
U_STABLE const char* U_EXPORT2
|
||||
uscript_getName(UScriptCode scriptCode);
|
||||
|
||||
/**
|
||||
* Returns the 4-letter ISO 15924 script code,
|
||||
* which is the same as the short Unicode script name if Unicode has names for the script.
|
||||
* Returns "Mlym" given USCRIPT_MALAYALAM.
|
||||
*
|
||||
* @param scriptCode UScriptCode enum
|
||||
* @return short script name (4-letter code), or NULL if scriptCode is invalid
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
U_STABLE const char* U_EXPORT2
|
||||
uscript_getShortName(UScriptCode scriptCode);
|
||||
|
||||
/**
|
||||
* Gets the script code associated with the given codepoint.
|
||||
* Returns USCRIPT_MALAYALAM given 0x0D02
|
||||
* @param codepoint UChar32 codepoint
|
||||
* @param err the error status code.
|
||||
* @return The UScriptCode, or 0 if codepoint is invalid
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
U_STABLE UScriptCode U_EXPORT2
|
||||
uscript_getScript(UChar32 codepoint, UErrorCode *err);
|
||||
|
||||
/**
|
||||
* Do the Script_Extensions of code point c contain script sc?
|
||||
* If c does not have explicit Script_Extensions, then this tests whether
|
||||
* c has the Script property value sc.
|
||||
*
|
||||
* Some characters are commonly used in multiple scripts.
|
||||
* For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
|
||||
* @param c code point
|
||||
* @param sc script code
|
||||
* @return TRUE if sc is in Script_Extensions(c)
|
||||
* @stable ICU 49
|
||||
*/
|
||||
U_STABLE UBool U_EXPORT2
|
||||
uscript_hasScript(UChar32 c, UScriptCode sc);
|
||||
|
||||
/**
|
||||
* Writes code point c's Script_Extensions as a list of UScriptCode values
|
||||
* to the output scripts array and returns the number of script codes.
|
||||
* - If c does have Script_Extensions, then the Script property value
|
||||
* (normally Common or Inherited) is not included.
|
||||
* - If c does not have Script_Extensions, then the one Script code is written to the output array.
|
||||
* - If c is not a valid code point, then the one USCRIPT_UNKNOWN code is written.
|
||||
* In other words, if the return value is 1,
|
||||
* then the output array contains exactly c's single Script code.
|
||||
* If the return value is n>=2, then the output array contains c's n Script_Extensions script codes.
|
||||
*
|
||||
* Some characters are commonly used in multiple scripts.
|
||||
* For more information, see UAX #24: http://www.unicode.org/reports/tr24/.
|
||||
*
|
||||
* If there are more than capacity script codes to be written, then
|
||||
* U_BUFFER_OVERFLOW_ERROR is set and the number of Script_Extensions is returned.
|
||||
* (Usual ICU buffer handling behavior.)
|
||||
*
|
||||
* @param c code point
|
||||
* @param scripts output script code array
|
||||
* @param capacity capacity of the scripts array
|
||||
* @param errorCode Standard ICU error code. Its input value must
|
||||
* pass the U_SUCCESS() test, or else the function returns
|
||||
* immediately. Check for U_FAILURE() on output or use with
|
||||
* function chaining. (See User Guide for details.)
|
||||
* @return number of script codes in c's Script_Extensions, or 1 for the single Script value,
|
||||
* written to scripts unless U_BUFFER_OVERFLOW_ERROR indicates insufficient capacity
|
||||
* @stable ICU 49
|
||||
*/
|
||||
U_STABLE int32_t U_EXPORT2
|
||||
uscript_getScriptExtensions(UChar32 c,
|
||||
UScriptCode *scripts, int32_t capacity,
|
||||
UErrorCode *errorCode);
|
||||
|
||||
/**
|
||||
* Script usage constants.
|
||||
* See UAX #31 Unicode Identifier and Pattern Syntax.
|
||||
* http://www.unicode.org/reports/tr31/#Table_Candidate_Characters_for_Exclusion_from_Identifiers
|
||||
*
|
||||
* @stable ICU 51
|
||||
*/
|
||||
typedef enum UScriptUsage {
|
||||
/** Not encoded in Unicode. @stable ICU 51 */
|
||||
USCRIPT_USAGE_NOT_ENCODED,
|
||||
/** Unknown script usage. @stable ICU 51 */
|
||||
USCRIPT_USAGE_UNKNOWN,
|
||||
/** Candidate for Exclusion from Identifiers. @stable ICU 51 */
|
||||
USCRIPT_USAGE_EXCLUDED,
|
||||
/** Limited Use script. @stable ICU 51 */
|
||||
USCRIPT_USAGE_LIMITED_USE,
|
||||
/** Aspirational Use script. @stable ICU 51 */
|
||||
USCRIPT_USAGE_ASPIRATIONAL,
|
||||
/** Recommended script. @stable ICU 51 */
|
||||
USCRIPT_USAGE_RECOMMENDED
|
||||
} UScriptUsage;
|
||||
|
||||
/**
|
||||
* Writes the script sample character string.
|
||||
* This string normally consists of one code point but might be longer.
|
||||
* The string is empty if the script is not encoded.
|
||||
*
|
||||
* @param script script code
|
||||
* @param dest output string array
|
||||
* @param capacity number of UChars in the dest array
|
||||
* @param pErrorCode standard ICU in/out error code, must pass U_SUCCESS() on input
|
||||
* @return the string length, even if U_BUFFER_OVERFLOW_ERROR
|
||||
* @stable ICU 51
|
||||
*/
|
||||
U_STABLE int32_t U_EXPORT2
|
||||
uscript_getSampleString(UScriptCode script, UChar *dest, int32_t capacity, UErrorCode *pErrorCode);
|
||||
|
||||
#if U_SHOW_CPLUSPLUS_API
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
class UnicodeString;
|
||||
U_NAMESPACE_END
|
||||
|
||||
/**
|
||||
* Returns the script sample character string.
|
||||
* This string normally consists of one code point but might be longer.
|
||||
* The string is empty if the script is not encoded.
|
||||
*
|
||||
* @param script script code
|
||||
* @return the sample character string
|
||||
* @stable ICU 51
|
||||
*/
|
||||
U_COMMON_API icu::UnicodeString U_EXPORT2
|
||||
uscript_getSampleUnicodeString(UScriptCode script);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the script usage according to UAX #31 Unicode Identifier and Pattern Syntax.
|
||||
* Returns USCRIPT_USAGE_NOT_ENCODED if the script is not encoded in Unicode.
|
||||
*
|
||||
* @param script script code
|
||||
* @return script usage
|
||||
* @see UScriptUsage
|
||||
* @stable ICU 51
|
||||
*/
|
||||
U_STABLE UScriptUsage U_EXPORT2
|
||||
uscript_getUsage(UScriptCode script);
|
||||
|
||||
/**
|
||||
* Returns TRUE if the script is written right-to-left.
|
||||
* For example, Arab and Hebr.
|
||||
*
|
||||
* @param script script code
|
||||
* @return TRUE if the script is right-to-left
|
||||
* @stable ICU 51
|
||||
*/
|
||||
U_STABLE UBool U_EXPORT2
|
||||
uscript_isRightToLeft(UScriptCode script);
|
||||
|
||||
/**
|
||||
* Returns TRUE if the script allows line breaks between letters (excluding hyphenation).
|
||||
* Such a script typically requires dictionary-based line breaking.
|
||||
* For example, Hani and Thai.
|
||||
*
|
||||
* @param script script code
|
||||
* @return TRUE if the script allows line breaks between letters
|
||||
* @stable ICU 51
|
||||
*/
|
||||
U_STABLE UBool U_EXPORT2
|
||||
uscript_breaksBetweenLetters(UScriptCode script);
|
||||
|
||||
/**
|
||||
* Returns TRUE if in modern (or most recent) usage of the script case distinctions are customary.
|
||||
* For example, Latn and Cyrl.
|
||||
*
|
||||
* @param script script code
|
||||
* @return TRUE if the script is cased
|
||||
* @stable ICU 51
|
||||
*/
|
||||
U_STABLE UBool U_EXPORT2
|
||||
uscript_isCased(UScriptCode script);
|
||||
|
||||
#endif
|
||||
1130
vendor/icu/include/unicode/uset.h
vendored
Normal file
1130
vendor/icu/include/unicode/uset.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
476
vendor/icu/include/unicode/ushape.h
vendored
Normal file
476
vendor/icu/include/unicode/ushape.h
vendored
Normal file
@@ -0,0 +1,476 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: ushape.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2000jun29
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __USHAPE_H__
|
||||
#define __USHAPE_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Arabic shaping
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Shape Arabic text on a character basis.
|
||||
*
|
||||
* <p>This function performs basic operations for "shaping" Arabic text. It is most
|
||||
* useful for use with legacy data formats and legacy display technology
|
||||
* (simple terminals). All operations are performed on Unicode characters.</p>
|
||||
*
|
||||
* <p>Text-based shaping means that some character code points in the text are
|
||||
* replaced by others depending on the context. It transforms one kind of text
|
||||
* into another. In comparison, modern displays for Arabic text select
|
||||
* appropriate, context-dependent font glyphs for each text element, which means
|
||||
* that they transform text into a glyph vector.</p>
|
||||
*
|
||||
* <p>Text transformations are necessary when modern display technology is not
|
||||
* available or when text needs to be transformed to or from legacy formats that
|
||||
* use "shaped" characters. Since the Arabic script is cursive, connecting
|
||||
* adjacent letters to each other, computers select images for each letter based
|
||||
* on the surrounding letters. This usually results in four images per Arabic
|
||||
* letter: initial, middle, final, and isolated forms. In Unicode, on the other
|
||||
* hand, letters are normally stored abstract, and a display system is expected
|
||||
* to select the necessary glyphs. (This makes searching and other text
|
||||
* processing easier because the same letter has only one code.) It is possible
|
||||
* to mimic this with text transformations because there are characters in
|
||||
* Unicode that are rendered as letters with a specific shape
|
||||
* (or cursive connectivity). They were included for interoperability with
|
||||
* legacy systems and codepages, and for unsophisticated display systems.</p>
|
||||
*
|
||||
* <p>A second kind of text transformations is supported for Arabic digits:
|
||||
* For compatibility with legacy codepages that only include European digits,
|
||||
* it is possible to replace one set of digits by another, changing the
|
||||
* character code points. These operations can be performed for either
|
||||
* Arabic-Indic Digits (U+0660...U+0669) or Eastern (Extended) Arabic-Indic
|
||||
* digits (U+06f0...U+06f9).</p>
|
||||
*
|
||||
* <p>Some replacements may result in more or fewer characters (code points).
|
||||
* By default, this means that the destination buffer may receive text with a
|
||||
* length different from the source length. Some legacy systems rely on the
|
||||
* length of the text to be constant. They expect extra spaces to be added
|
||||
* or consumed either next to the affected character or at the end of the
|
||||
* text.</p>
|
||||
*
|
||||
* <p>For details about the available operations, see the description of the
|
||||
* <code>U_SHAPE_...</code> options.</p>
|
||||
*
|
||||
* @param source The input text.
|
||||
*
|
||||
* @param sourceLength The number of UChars in <code>source</code>.
|
||||
*
|
||||
* @param dest The destination buffer that will receive the results of the
|
||||
* requested operations. It may be <code>NULL</code> only if
|
||||
* <code>destSize</code> is 0. The source and destination must not
|
||||
* overlap.
|
||||
*
|
||||
* @param destSize The size (capacity) of the destination buffer in UChars.
|
||||
* If <code>destSize</code> is 0, then no output is produced,
|
||||
* but the necessary buffer size is returned ("preflighting").
|
||||
*
|
||||
* @param options This is a 32-bit set of flags that specify the operations
|
||||
* that are performed on the input text. If no error occurs,
|
||||
* then the result will always be written to the destination
|
||||
* buffer.
|
||||
*
|
||||
* @param pErrorCode must be a valid pointer to an error code value,
|
||||
* which must not indicate a failure before the function call.
|
||||
*
|
||||
* @return The number of UChars written to the destination buffer.
|
||||
* If an error occurred, then no output was written, or it may be
|
||||
* incomplete. If <code>U_BUFFER_OVERFLOW_ERROR</code> is set, then
|
||||
* the return value indicates the necessary destination buffer size.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE int32_t U_EXPORT2
|
||||
u_shapeArabic(const UChar *source, int32_t sourceLength,
|
||||
UChar *dest, int32_t destSize,
|
||||
uint32_t options,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Memory option: allow the result to have a different length than the source.
|
||||
* Affects: LamAlef options
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_LENGTH_GROW_SHRINK 0
|
||||
|
||||
/**
|
||||
* Memory option: allow the result to have a different length than the source.
|
||||
* Affects: LamAlef options
|
||||
* This option is an alias to U_SHAPE_LENGTH_GROW_SHRINK
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_LAMALEF_RESIZE 0
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* If more room is necessary, then try to consume spaces next to modified characters.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_LENGTH_FIXED_SPACES_NEAR 1
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* If more room is necessary, then try to consume spaces next to modified characters.
|
||||
* Affects: LamAlef options
|
||||
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_NEAR
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_LAMALEF_NEAR 1
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* If more room is necessary, then try to consume spaces at the end of the text.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_LENGTH_FIXED_SPACES_AT_END 2
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* If more room is necessary, then try to consume spaces at the end of the text.
|
||||
* Affects: LamAlef options
|
||||
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_END
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_LAMALEF_END 2
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* If more room is necessary, then try to consume spaces at the beginning of the text.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING 3
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* If more room is necessary, then try to consume spaces at the beginning of the text.
|
||||
* Affects: LamAlef options
|
||||
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_LAMALEF_BEGIN 3
|
||||
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* Shaping Mode: For each LAMALEF character found, expand LAMALEF using space at end.
|
||||
* If there is no space at end, use spaces at beginning of the buffer. If there
|
||||
* is no space at beginning of the buffer, use spaces at the near (i.e. the space
|
||||
* after the LAMALEF character).
|
||||
* If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
|
||||
* will be set in pErrorCode
|
||||
*
|
||||
* Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END.
|
||||
* Affects: LamAlef options
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_LAMALEF_AUTO 0x10000
|
||||
|
||||
/** Bit mask for memory options. @stable ICU 2.0 */
|
||||
#define U_SHAPE_LENGTH_MASK 0x10003 /* Changed old value 3 */
|
||||
|
||||
|
||||
/**
|
||||
* Bit mask for LamAlef memory options.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_LAMALEF_MASK 0x10003 /* updated */
|
||||
|
||||
/** Direction indicator: the source is in logical (keyboard) order. @stable ICU 2.0 */
|
||||
#define U_SHAPE_TEXT_DIRECTION_LOGICAL 0
|
||||
|
||||
/**
|
||||
* Direction indicator:
|
||||
* the source is in visual RTL order,
|
||||
* the rightmost displayed character stored first.
|
||||
* This option is an alias to U_SHAPE_TEXT_DIRECTION_LOGICAL
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_TEXT_DIRECTION_VISUAL_RTL 0
|
||||
|
||||
/**
|
||||
* Direction indicator:
|
||||
* the source is in visual LTR order,
|
||||
* the leftmost displayed character stored first.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_TEXT_DIRECTION_VISUAL_LTR 4
|
||||
|
||||
/** Bit mask for direction indicators. @stable ICU 2.0 */
|
||||
#define U_SHAPE_TEXT_DIRECTION_MASK 4
|
||||
|
||||
|
||||
/** Letter shaping option: do not perform letter shaping. @stable ICU 2.0 */
|
||||
#define U_SHAPE_LETTERS_NOOP 0
|
||||
|
||||
/** Letter shaping option: replace abstract letter characters by "shaped" ones. @stable ICU 2.0 */
|
||||
#define U_SHAPE_LETTERS_SHAPE 8
|
||||
|
||||
/** Letter shaping option: replace "shaped" letter characters by abstract ones. @stable ICU 2.0 */
|
||||
#define U_SHAPE_LETTERS_UNSHAPE 0x10
|
||||
|
||||
/**
|
||||
* Letter shaping option: replace abstract letter characters by "shaped" ones.
|
||||
* The only difference with U_SHAPE_LETTERS_SHAPE is that Tashkeel letters
|
||||
* are always "shaped" into the isolated form instead of the medial form
|
||||
* (selecting code points from the Arabic Presentation Forms-B block).
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED 0x18
|
||||
|
||||
|
||||
/** Bit mask for letter shaping options. @stable ICU 2.0 */
|
||||
#define U_SHAPE_LETTERS_MASK 0x18
|
||||
|
||||
|
||||
/** Digit shaping option: do not perform digit shaping. @stable ICU 2.0 */
|
||||
#define U_SHAPE_DIGITS_NOOP 0
|
||||
|
||||
/**
|
||||
* Digit shaping option:
|
||||
* Replace European digits (U+0030...) by Arabic-Indic digits.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_DIGITS_EN2AN 0x20
|
||||
|
||||
/**
|
||||
* Digit shaping option:
|
||||
* Replace Arabic-Indic digits by European digits (U+0030...).
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_DIGITS_AN2EN 0x40
|
||||
|
||||
/**
|
||||
* Digit shaping option:
|
||||
* Replace European digits (U+0030...) by Arabic-Indic digits if the most recent
|
||||
* strongly directional character is an Arabic letter
|
||||
* (<code>u_charDirection()</code> result <code>U_RIGHT_TO_LEFT_ARABIC</code> [AL]).<br>
|
||||
* The direction of "preceding" depends on the direction indicator option.
|
||||
* For the first characters, the preceding strongly directional character
|
||||
* (initial state) is assumed to be not an Arabic letter
|
||||
* (it is <code>U_LEFT_TO_RIGHT</code> [L] or <code>U_RIGHT_TO_LEFT</code> [R]).
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_DIGITS_ALEN2AN_INIT_LR 0x60
|
||||
|
||||
/**
|
||||
* Digit shaping option:
|
||||
* Replace European digits (U+0030...) by Arabic-Indic digits if the most recent
|
||||
* strongly directional character is an Arabic letter
|
||||
* (<code>u_charDirection()</code> result <code>U_RIGHT_TO_LEFT_ARABIC</code> [AL]).<br>
|
||||
* The direction of "preceding" depends on the direction indicator option.
|
||||
* For the first characters, the preceding strongly directional character
|
||||
* (initial state) is assumed to be an Arabic letter.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_SHAPE_DIGITS_ALEN2AN_INIT_AL 0x80
|
||||
|
||||
/** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */
|
||||
#define U_SHAPE_DIGITS_RESERVED 0xa0
|
||||
|
||||
/** Bit mask for digit shaping options. @stable ICU 2.0 */
|
||||
#define U_SHAPE_DIGITS_MASK 0xe0
|
||||
|
||||
|
||||
/** Digit type option: Use Arabic-Indic digits (U+0660...U+0669). @stable ICU 2.0 */
|
||||
#define U_SHAPE_DIGIT_TYPE_AN 0
|
||||
|
||||
/** Digit type option: Use Eastern (Extended) Arabic-Indic digits (U+06f0...U+06f9). @stable ICU 2.0 */
|
||||
#define U_SHAPE_DIGIT_TYPE_AN_EXTENDED 0x100
|
||||
|
||||
/** Not a valid option value. May be replaced by a new option. @stable ICU 2.0 */
|
||||
#define U_SHAPE_DIGIT_TYPE_RESERVED 0x200
|
||||
|
||||
/** Bit mask for digit type options. @stable ICU 2.0 */
|
||||
#define U_SHAPE_DIGIT_TYPE_MASK 0x300 /* I need to change this from 0x3f00 to 0x300 */
|
||||
|
||||
/**
|
||||
* Tashkeel aggregation option:
|
||||
* Replaces any combination of U+0651 with one of
|
||||
* U+064C, U+064D, U+064E, U+064F, U+0650 with
|
||||
* U+FC5E, U+FC5F, U+FC60, U+FC61, U+FC62 consecutively.
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
#define U_SHAPE_AGGREGATE_TASHKEEL 0x4000
|
||||
/** Tashkeel aggregation option: do not aggregate tashkeels. @stable ICU 3.6 */
|
||||
#define U_SHAPE_AGGREGATE_TASHKEEL_NOOP 0
|
||||
/** Bit mask for tashkeel aggregation. @stable ICU 3.6 */
|
||||
#define U_SHAPE_AGGREGATE_TASHKEEL_MASK 0x4000
|
||||
|
||||
/**
|
||||
* Presentation form option:
|
||||
* Don't replace Arabic Presentation Forms-A and Arabic Presentation Forms-B
|
||||
* characters with 0+06xx characters, before shaping.
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
#define U_SHAPE_PRESERVE_PRESENTATION 0x8000
|
||||
/** Presentation form option:
|
||||
* Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with
|
||||
* their unshaped correspondants in range 0+06xx, before shaping.
|
||||
* @stable ICU 3.6
|
||||
*/
|
||||
#define U_SHAPE_PRESERVE_PRESENTATION_NOOP 0
|
||||
/** Bit mask for preserve presentation form. @stable ICU 3.6 */
|
||||
#define U_SHAPE_PRESERVE_PRESENTATION_MASK 0x8000
|
||||
|
||||
/* Seen Tail option */
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* Shaping mode: The SEEN family character will expand into two characters using space near
|
||||
* the SEEN family character(i.e. the space after the character).
|
||||
* If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
|
||||
* will be set in pErrorCode
|
||||
*
|
||||
* De-shaping mode: Any Seen character followed by Tail character will be
|
||||
* replaced by one cell Seen and a space will replace the Tail.
|
||||
* Affects: Seen options
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_SEEN_TWOCELL_NEAR 0x200000
|
||||
|
||||
/**
|
||||
* Bit mask for Seen memory options.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_SEEN_MASK 0x700000
|
||||
|
||||
/* YehHamza option */
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* Shaping mode: The YEHHAMZA character will expand into two characters using space near it
|
||||
* (i.e. the space after the character
|
||||
* If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
|
||||
* will be set in pErrorCode
|
||||
*
|
||||
* De-shaping mode: Any Yeh (final or isolated) character followed by Hamza character will be
|
||||
* replaced by one cell YehHamza and space will replace the Hamza.
|
||||
* Affects: YehHamza options
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_YEHHAMZA_TWOCELL_NEAR 0x1000000
|
||||
|
||||
|
||||
/**
|
||||
* Bit mask for YehHamza memory options.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_YEHHAMZA_MASK 0x3800000
|
||||
|
||||
/* New Tashkeel options */
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* Shaping mode: Tashkeel characters will be replaced by spaces.
|
||||
* Spaces will be placed at beginning of the buffer
|
||||
*
|
||||
* De-shaping mode: N/A
|
||||
* Affects: Tashkeel options
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_TASHKEEL_BEGIN 0x40000
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* Shaping mode: Tashkeel characters will be replaced by spaces.
|
||||
* Spaces will be placed at end of the buffer
|
||||
*
|
||||
* De-shaping mode: N/A
|
||||
* Affects: Tashkeel options
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_TASHKEEL_END 0x60000
|
||||
|
||||
/**
|
||||
* Memory option: allow the result to have a different length than the source.
|
||||
* Shaping mode: Tashkeel characters will be removed, buffer length will shrink.
|
||||
* De-shaping mode: N/A
|
||||
*
|
||||
* Affect: Tashkeel options
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_TASHKEEL_RESIZE 0x80000
|
||||
|
||||
/**
|
||||
* Memory option: the result must have the same length as the source.
|
||||
* Shaping mode: Tashkeel characters will be replaced by Tatweel if it is connected to adjacent
|
||||
* characters (i.e. shaped on Tatweel) or replaced by space if it is not connected.
|
||||
*
|
||||
* De-shaping mode: N/A
|
||||
* Affects: YehHamza options
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL 0xC0000
|
||||
|
||||
/**
|
||||
* Bit mask for Tashkeel replacement with Space or Tatweel memory options.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_TASHKEEL_MASK 0xE0000
|
||||
|
||||
|
||||
/* Space location Control options */
|
||||
/**
|
||||
* This option affect the meaning of BEGIN and END options. if this option is not used the default
|
||||
* for BEGIN and END will be as following:
|
||||
* The Default (for both Visual LTR, Visual RTL and Logical Text)
|
||||
* 1. BEGIN always refers to the start address of physical memory.
|
||||
* 2. END always refers to the end address of physical memory.
|
||||
*
|
||||
* If this option is used it will swap the meaning of BEGIN and END only for Visual LTR text.
|
||||
*
|
||||
* The effect on BEGIN and END Memory Options will be as following:
|
||||
* A. BEGIN For Visual LTR text: This will be the beginning (right side) of the visual text(
|
||||
* corresponding to the physical memory address end for Visual LTR text, Same as END in
|
||||
* default behavior)
|
||||
* B. BEGIN For Logical text: Same as BEGIN in default behavior.
|
||||
* C. END For Visual LTR text: This will be the end (left side) of the visual text (corresponding
|
||||
* to the physical memory address beginning for Visual LTR text, Same as BEGIN in default behavior.
|
||||
* D. END For Logical text: Same as END in default behavior).
|
||||
* Affects: All LamAlef BEGIN, END and AUTO options.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END 0x4000000
|
||||
|
||||
/**
|
||||
* Bit mask for swapping BEGIN and END for Visual LTR text
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK 0x4000000
|
||||
|
||||
/**
|
||||
* If this option is used, shaping will use the new Unicode code point for TAIL (i.e. 0xFE73).
|
||||
* If this option is not specified (Default), old unofficial Unicode TAIL code point is used (i.e. 0x200B)
|
||||
* De-shaping will not use this option as it will always search for both the new Unicode code point for the
|
||||
* TAIL (i.e. 0xFE73) or the old unofficial Unicode TAIL code point (i.e. 0x200B) and de-shape the
|
||||
* Seen-Family letter accordingly.
|
||||
*
|
||||
* Shaping Mode: Only shaping.
|
||||
* De-shaping Mode: N/A.
|
||||
* Affects: All Seen options
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
#define U_SHAPE_TAIL_NEW_UNICODE 0x8000000
|
||||
|
||||
/**
|
||||
* Bit mask for new Unicode Tail option
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
#define U_SHAPE_TAIL_TYPE_MASK 0x8000000
|
||||
|
||||
#endif
|
||||
1692
vendor/icu/include/unicode/ustring.h
vendored
Normal file
1692
vendor/icu/include/unicode/ustring.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
225
vendor/icu/include/unicode/utf.h
vendored
Normal file
225
vendor/icu/include/unicode/utf.h
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: utf.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 1999sep09
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: Code point macros
|
||||
*
|
||||
* This file defines macros for checking whether a code point is
|
||||
* a surrogate or a non-character etc.
|
||||
*
|
||||
* If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 0 then utf.h is included by utypes.h
|
||||
* and itself includes utf8.h and utf16.h after some
|
||||
* common definitions.
|
||||
* If U_NO_DEFAULT_INCLUDE_UTF_HEADERS is 1 then each of these headers must be
|
||||
* included explicitly if their definitions are used.
|
||||
*
|
||||
* utf8.h and utf16.h define macros for efficiently getting code points
|
||||
* in and out of UTF-8/16 strings.
|
||||
* utf16.h macros have "U16_" prefixes.
|
||||
* utf8.h defines similar macros with "U8_" prefixes for UTF-8 string handling.
|
||||
*
|
||||
* ICU mostly processes 16-bit Unicode strings.
|
||||
* Most of the time, such strings are well-formed UTF-16.
|
||||
* Single, unpaired surrogates must be handled as well, and are treated in ICU
|
||||
* like regular code points where possible.
|
||||
* (Pairs of surrogate code points are indistinguishable from supplementary
|
||||
* code points encoded as pairs of supplementary code units.)
|
||||
*
|
||||
* In fact, almost all Unicode code points in normal text (>99%)
|
||||
* are on the BMP (<=U+ffff) and even <=U+d7ff.
|
||||
* ICU functions handle supplementary code points (U+10000..U+10ffff)
|
||||
* but are optimized for the much more frequently occurring BMP code points.
|
||||
*
|
||||
* umachine.h defines UChar to be an unsigned 16-bit integer.
|
||||
* Since ICU 59, ICU uses char16_t in C++, UChar only in C,
|
||||
* and defines UChar=char16_t by default. See the UChar API docs for details.
|
||||
*
|
||||
* UChar32 is defined to be a signed 32-bit integer (int32_t), large enough for a 21-bit
|
||||
* Unicode code point (Unicode scalar value, 0..0x10ffff) and U_SENTINEL (-1).
|
||||
* Before ICU 2.4, the definition of UChar32 was similarly platform-dependent as
|
||||
* the definition of UChar. For details see the documentation for UChar32 itself.
|
||||
*
|
||||
* utf.h defines a small number of C macros for single Unicode code points.
|
||||
* These are simple checks for surrogates and non-characters.
|
||||
* For actual Unicode character properties see uchar.h.
|
||||
*
|
||||
* By default, string operations must be done with error checking in case
|
||||
* a string is not well-formed UTF-16 or UTF-8.
|
||||
*
|
||||
* The U16_ macros detect if a surrogate code unit is unpaired
|
||||
* (lead unit without trail unit or vice versa) and just return the unit itself
|
||||
* as the code point.
|
||||
*
|
||||
* The U8_ macros detect illegal byte sequences and return a negative value.
|
||||
* Starting with ICU 60, the observable length of a single illegal byte sequence
|
||||
* skipped by one of these macros follows the Unicode 6+ recommendation
|
||||
* which is consistent with the W3C Encoding Standard.
|
||||
*
|
||||
* There are ..._OR_FFFD versions of both U16_ and U8_ macros
|
||||
* that return U+FFFD for illegal code unit sequences.
|
||||
*
|
||||
* The regular "safe" macros require that the initial, passed-in string index
|
||||
* is within bounds. They only check the index when they read more than one
|
||||
* code unit. This is usually done with code similar to the following loop:
|
||||
* <pre>while(i<length) {
|
||||
* U16_NEXT(s, i, length, c);
|
||||
* // use c
|
||||
* }</pre>
|
||||
*
|
||||
* When it is safe to assume that text is well-formed UTF-16
|
||||
* (does not contain single, unpaired surrogates), then one can use
|
||||
* U16_..._UNSAFE macros.
|
||||
* These do not check for proper code unit sequences or truncated text and may
|
||||
* yield wrong results or even cause a crash if they are used with "malformed"
|
||||
* text.
|
||||
* In practice, U16_..._UNSAFE macros will produce slightly less code but
|
||||
* should not be faster because the processing is only different when a
|
||||
* surrogate code unit is detected, which will be rare.
|
||||
*
|
||||
* Similarly for UTF-8, there are "safe" macros without a suffix,
|
||||
* and U8_..._UNSAFE versions.
|
||||
* The performance differences are much larger here because UTF-8 provides so
|
||||
* many opportunities for malformed sequences.
|
||||
* The unsafe UTF-8 macros are entirely implemented inside the macro definitions
|
||||
* and are fast, while the safe UTF-8 macros call functions for some complicated cases.
|
||||
*
|
||||
* Unlike with UTF-16, malformed sequences cannot be expressed with distinct
|
||||
* code point values (0..U+10ffff). They are indicated with negative values instead.
|
||||
*
|
||||
* For more information see the ICU User Guide Strings chapter
|
||||
* (http://userguide.icu-project.org/strings).
|
||||
*
|
||||
* <em>Usage:</em>
|
||||
* ICU coding guidelines for if() statements should be followed when using these macros.
|
||||
* Compound statements (curly braces {}) must be used for if-else-while...
|
||||
* bodies and all macro statements should be terminated with semicolon.
|
||||
*
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
#ifndef __UTF_H__
|
||||
#define __UTF_H__
|
||||
|
||||
#include <unicode/umachine.h>
|
||||
/* include the utfXX.h after the following definitions */
|
||||
|
||||
/* single-code point definitions -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Is this code point a Unicode noncharacter?
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_IS_UNICODE_NONCHAR(c) \
|
||||
((c)>=0xfdd0 && \
|
||||
((c)<=0xfdef || ((c)&0xfffe)==0xfffe) && (c)<=0x10ffff)
|
||||
|
||||
/**
|
||||
* Is c a Unicode code point value (0..U+10ffff)
|
||||
* that can be assigned a character?
|
||||
*
|
||||
* Code points that are not characters include:
|
||||
* - single surrogate code points (U+d800..U+dfff, 2048 code points)
|
||||
* - the last two code points on each plane (U+__fffe and U+__ffff, 34 code points)
|
||||
* - U+fdd0..U+fdef (new with Unicode 3.1, 32 code points)
|
||||
* - the highest Unicode code point value is U+10ffff
|
||||
*
|
||||
* This means that all code points below U+d800 are character code points,
|
||||
* and that boundary is tested first for performance.
|
||||
*
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_IS_UNICODE_CHAR(c) \
|
||||
((uint32_t)(c)<0xd800 || \
|
||||
(0xdfff<(c) && (c)<=0x10ffff && !U_IS_UNICODE_NONCHAR(c)))
|
||||
|
||||
/**
|
||||
* Is this code point a BMP code point (U+0000..U+ffff)?
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
#define U_IS_BMP(c) ((uint32_t)(c)<=0xffff)
|
||||
|
||||
/**
|
||||
* Is this code point a supplementary code point (U+10000..U+10ffff)?
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
|
||||
|
||||
/**
|
||||
* Is this code point a lead surrogate (U+d800..U+dbff)?
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
|
||||
|
||||
/**
|
||||
* Is this code point a trail surrogate (U+dc00..U+dfff)?
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
|
||||
|
||||
/**
|
||||
* Is this code point a surrogate (U+d800..U+dfff)?
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800)
|
||||
|
||||
/**
|
||||
* Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
|
||||
* is it a lead surrogate?
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
|
||||
|
||||
/**
|
||||
* Assuming c is a surrogate code point (U_IS_SURROGATE(c)),
|
||||
* is it a trail surrogate?
|
||||
* @param c 32-bit code point
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
|
||||
|
||||
/* include the utfXX.h ------------------------------------------------------ */
|
||||
|
||||
#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS
|
||||
|
||||
#include <unicode/utf8.h>
|
||||
#include <unicode/utf16.h>
|
||||
|
||||
/* utf_old.h contains deprecated, pre-ICU 2.4 definitions */
|
||||
#include <unicode/utf_old.h>
|
||||
|
||||
#endif /* !U_NO_DEFAULT_INCLUDE_UTF_HEADERS */
|
||||
|
||||
#endif /* __UTF_H__ */
|
||||
745
vendor/icu/include/unicode/utf16.h
vendored
Normal file
745
vendor/icu/include/unicode/utf16.h
vendored
Normal file
@@ -0,0 +1,745 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: utf16.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 1999sep09
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: 16-bit Unicode handling macros
|
||||
*
|
||||
* This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings.
|
||||
*
|
||||
* For more information see utf.h and the ICU User Guide Strings chapter
|
||||
* (http://userguide.icu-project.org/strings).
|
||||
*
|
||||
* <em>Usage:</em>
|
||||
* ICU coding guidelines for if() statements should be followed when using these macros.
|
||||
* Compound statements (curly braces {}) must be used for if-else-while...
|
||||
* bodies and all macro statements should be terminated with semicolon.
|
||||
*/
|
||||
|
||||
#ifndef __UTF16_H__
|
||||
#define __UTF16_H__
|
||||
|
||||
#include <unicode/umachine.h>
|
||||
#ifndef __UTF_H__
|
||||
# include "unicode/utf.h"
|
||||
#endif
|
||||
|
||||
/* single-code point definitions -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Does this code unit alone encode a code point (BMP, not a surrogate)?
|
||||
* @param c 16-bit code unit
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c)
|
||||
|
||||
/**
|
||||
* Is this code unit a lead surrogate (U+d800..U+dbff)?
|
||||
* @param c 16-bit code unit
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800)
|
||||
|
||||
/**
|
||||
* Is this code unit a trail surrogate (U+dc00..U+dfff)?
|
||||
* @param c 16-bit code unit
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00)
|
||||
|
||||
/**
|
||||
* Is this code unit a surrogate (U+d800..U+dfff)?
|
||||
* @param c 16-bit code unit
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c)
|
||||
|
||||
/**
|
||||
* Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
|
||||
* is it a lead surrogate?
|
||||
* @param c 16-bit code unit
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0)
|
||||
|
||||
/**
|
||||
* Assuming c is a surrogate code point (U16_IS_SURROGATE(c)),
|
||||
* is it a trail surrogate?
|
||||
* @param c 16-bit code unit
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
#define U16_IS_SURROGATE_TRAIL(c) (((c)&0x400)!=0)
|
||||
|
||||
/**
|
||||
* Helper constant for U16_GET_SUPPLEMENTARY.
|
||||
* @internal
|
||||
*/
|
||||
#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000)
|
||||
|
||||
/**
|
||||
* Get a supplementary code point value (U+10000..U+10ffff)
|
||||
* from its lead and trail surrogates.
|
||||
* The result is undefined if the input values are not
|
||||
* lead and trail surrogates.
|
||||
*
|
||||
* @param lead lead surrogate (U+d800..U+dbff)
|
||||
* @param trail trail surrogate (U+dc00..U+dfff)
|
||||
* @return supplementary code point (U+10000..U+10ffff)
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_GET_SUPPLEMENTARY(lead, trail) \
|
||||
(((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET)
|
||||
|
||||
|
||||
/**
|
||||
* Get the lead surrogate (0xd800..0xdbff) for a
|
||||
* supplementary code point (0x10000..0x10ffff).
|
||||
* @param supplementary 32-bit code point (U+10000..U+10ffff)
|
||||
* @return lead surrogate (U+d800..U+dbff) for supplementary
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0)
|
||||
|
||||
/**
|
||||
* Get the trail surrogate (0xdc00..0xdfff) for a
|
||||
* supplementary code point (0x10000..0x10ffff).
|
||||
* @param supplementary 32-bit code point (U+10000..U+10ffff)
|
||||
* @return trail surrogate (U+dc00..U+dfff) for supplementary
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00)
|
||||
|
||||
/**
|
||||
* How many 16-bit code units are used to encode this Unicode code point? (1 or 2)
|
||||
* The result is not defined if c is not a Unicode code point (U+0000..U+10ffff).
|
||||
* @param c 32-bit code point
|
||||
* @return 1 or 2
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_LENGTH(c) ((uint32_t)(c)<=0xffff ? 1 : 2)
|
||||
|
||||
/**
|
||||
* The maximum number of 16-bit code units per Unicode code point (U+0000..U+10ffff).
|
||||
* @return 2
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_MAX_LENGTH 2
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a random-access offset,
|
||||
* without changing the offset.
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* The offset may point to either the lead or trail surrogate unit
|
||||
* for a supplementary code point, in which case the macro will read
|
||||
* the adjacent matching surrogate as well.
|
||||
* The result is undefined if the offset points to a single, unpaired surrogate.
|
||||
* Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_GET
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_GET_UNSAFE(s, i, c) { \
|
||||
(c)=(s)[i]; \
|
||||
if(U16_IS_SURROGATE(c)) { \
|
||||
if(U16_IS_SURROGATE_LEAD(c)) { \
|
||||
(c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)+1]); \
|
||||
} else { \
|
||||
(c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a random-access offset,
|
||||
* without changing the offset.
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The offset may point to either the lead or trail surrogate unit
|
||||
* for a supplementary code point, in which case the macro will read
|
||||
* the adjacent matching surrogate as well.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* If the offset points to a single, unpaired surrogate, then
|
||||
* c is set to that unpaired surrogate.
|
||||
* Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param start starting string offset (usually 0)
|
||||
* @param i string offset, must be start<=i<length
|
||||
* @param length string length
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_GET_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_GET(s, start, i, length, c) { \
|
||||
(c)=(s)[i]; \
|
||||
if(U16_IS_SURROGATE(c)) { \
|
||||
uint16_t __c2; \
|
||||
if(U16_IS_SURROGATE_LEAD(c)) { \
|
||||
if((i)+1!=(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
|
||||
(c)=U16_GET_SUPPLEMENTARY((c), __c2); \
|
||||
} \
|
||||
} else { \
|
||||
if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
|
||||
(c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a random-access offset,
|
||||
* without changing the offset.
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The offset may point to either the lead or trail surrogate unit
|
||||
* for a supplementary code point, in which case the macro will read
|
||||
* the adjacent matching surrogate as well.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* If the offset points to a single, unpaired surrogate, then
|
||||
* c is set to U+FFFD.
|
||||
* Iteration through a string is more efficient with U16_NEXT_UNSAFE or U16_NEXT_OR_FFFD.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param start starting string offset (usually 0)
|
||||
* @param i string offset, must be start<=i<length
|
||||
* @param length string length
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_GET_UNSAFE
|
||||
* @draft ICU 60
|
||||
*/
|
||||
#define U16_GET_OR_FFFD(s, start, i, length, c) { \
|
||||
(c)=(s)[i]; \
|
||||
if(U16_IS_SURROGATE(c)) { \
|
||||
uint16_t __c2; \
|
||||
if(U16_IS_SURROGATE_LEAD(c)) { \
|
||||
if((i)+1!=(length) && U16_IS_TRAIL(__c2=(s)[(i)+1])) { \
|
||||
(c)=U16_GET_SUPPLEMENTARY((c), __c2); \
|
||||
} else { \
|
||||
(c)=0xfffd; \
|
||||
} \
|
||||
} else { \
|
||||
if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
|
||||
(c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
|
||||
} else { \
|
||||
(c)=0xfffd; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
/* definitions with forward iteration --------------------------------------- */
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a code point boundary offset,
|
||||
* and advance the offset to the next code point boundary.
|
||||
* (Post-incrementing forward iteration.)
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* The offset may point to the lead surrogate unit
|
||||
* for a supplementary code point, in which case the macro will read
|
||||
* the following trail surrogate as well.
|
||||
* If the offset points to a trail surrogate, then that itself
|
||||
* will be returned as the code point.
|
||||
* The result is undefined if the offset points to a single, unpaired lead surrogate.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_NEXT
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_NEXT_UNSAFE(s, i, c) { \
|
||||
(c)=(s)[(i)++]; \
|
||||
if(U16_IS_LEAD(c)) { \
|
||||
(c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a code point boundary offset,
|
||||
* and advance the offset to the next code point boundary.
|
||||
* (Post-incrementing forward iteration.)
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* The offset may point to the lead surrogate unit
|
||||
* for a supplementary code point, in which case the macro will read
|
||||
* the following trail surrogate as well.
|
||||
* If the offset points to a trail surrogate or
|
||||
* to a single, unpaired lead surrogate, then c is set to that unpaired surrogate.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset, must be i<length
|
||||
* @param length string length
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_NEXT_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_NEXT(s, i, length, c) { \
|
||||
(c)=(s)[(i)++]; \
|
||||
if(U16_IS_LEAD(c)) { \
|
||||
uint16_t __c2; \
|
||||
if((i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
|
||||
++(i); \
|
||||
(c)=U16_GET_SUPPLEMENTARY((c), __c2); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a code point boundary offset,
|
||||
* and advance the offset to the next code point boundary.
|
||||
* (Post-incrementing forward iteration.)
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* The offset may point to the lead surrogate unit
|
||||
* for a supplementary code point, in which case the macro will read
|
||||
* the following trail surrogate as well.
|
||||
* If the offset points to a trail surrogate or
|
||||
* to a single, unpaired lead surrogate, then c is set to U+FFFD.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset, must be i<length
|
||||
* @param length string length
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_NEXT_UNSAFE
|
||||
* @draft ICU 60
|
||||
*/
|
||||
#define U16_NEXT_OR_FFFD(s, i, length, c) { \
|
||||
(c)=(s)[(i)++]; \
|
||||
if(U16_IS_SURROGATE(c)) { \
|
||||
uint16_t __c2; \
|
||||
if(U16_IS_SURROGATE_LEAD(c) && (i)!=(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \
|
||||
++(i); \
|
||||
(c)=U16_GET_SUPPLEMENTARY((c), __c2); \
|
||||
} else { \
|
||||
(c)=0xfffd; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Append a code point to a string, overwriting 1 or 2 code units.
|
||||
* The offset points to the current end of the string contents
|
||||
* and is advanced (post-increment).
|
||||
* "Unsafe" macro, assumes a valid code point and sufficient space in the string.
|
||||
* Otherwise, the result is undefined.
|
||||
*
|
||||
* @param s const UChar * string buffer
|
||||
* @param i string offset
|
||||
* @param c code point to append
|
||||
* @see U16_APPEND
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_APPEND_UNSAFE(s, i, c) { \
|
||||
if((uint32_t)(c)<=0xffff) { \
|
||||
(s)[(i)++]=(uint16_t)(c); \
|
||||
} else { \
|
||||
(s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
|
||||
(s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a code point to a string, overwriting 1 or 2 code units.
|
||||
* The offset points to the current end of the string contents
|
||||
* and is advanced (post-increment).
|
||||
* "Safe" macro, checks for a valid code point.
|
||||
* If a surrogate pair is written, checks for sufficient space in the string.
|
||||
* If the code point is not valid or a trail surrogate does not fit,
|
||||
* then isError is set to TRUE.
|
||||
*
|
||||
* @param s const UChar * string buffer
|
||||
* @param i string offset, must be i<capacity
|
||||
* @param capacity size of the string buffer
|
||||
* @param c code point to append
|
||||
* @param isError output UBool set to TRUE if an error occurs, otherwise not modified
|
||||
* @see U16_APPEND_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_APPEND(s, i, capacity, c, isError) { \
|
||||
if((uint32_t)(c)<=0xffff) { \
|
||||
(s)[(i)++]=(uint16_t)(c); \
|
||||
} else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \
|
||||
(s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
|
||||
(s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
|
||||
} else /* c>0x10ffff or not enough space */ { \
|
||||
(isError)=TRUE; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the string offset from one code point boundary to the next.
|
||||
* (Post-incrementing iteration.)
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @see U16_FWD_1
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_FWD_1_UNSAFE(s, i) { \
|
||||
if(U16_IS_LEAD((s)[(i)++])) { \
|
||||
++(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the string offset from one code point boundary to the next.
|
||||
* (Post-incrementing iteration.)
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset, must be i<length
|
||||
* @param length string length
|
||||
* @see U16_FWD_1_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_FWD_1(s, i, length) { \
|
||||
if(U16_IS_LEAD((s)[(i)++]) && (i)!=(length) && U16_IS_TRAIL((s)[i])) { \
|
||||
++(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the string offset from one code point boundary to the n-th next one,
|
||||
* i.e., move forward by n code points.
|
||||
* (Post-incrementing iteration.)
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @param n number of code points to skip
|
||||
* @see U16_FWD_N
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_FWD_N_UNSAFE(s, i, n) { \
|
||||
int32_t __N=(n); \
|
||||
while(__N>0) { \
|
||||
U16_FWD_1_UNSAFE(s, i); \
|
||||
--__N; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the string offset from one code point boundary to the n-th next one,
|
||||
* i.e., move forward by n code points.
|
||||
* (Post-incrementing iteration.)
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i int32_t string offset, must be i<length
|
||||
* @param length int32_t string length
|
||||
* @param n number of code points to skip
|
||||
* @see U16_FWD_N_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_FWD_N(s, i, length, n) { \
|
||||
int32_t __N=(n); \
|
||||
while(__N>0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
|
||||
U16_FWD_1(s, i, length); \
|
||||
--__N; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust a random-access offset to a code point boundary
|
||||
* at the start of a code point.
|
||||
* If the offset points to the trail surrogate of a surrogate pair,
|
||||
* then the offset is decremented.
|
||||
* Otherwise, it is not modified.
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @see U16_SET_CP_START
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_SET_CP_START_UNSAFE(s, i) { \
|
||||
if(U16_IS_TRAIL((s)[i])) { \
|
||||
--(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust a random-access offset to a code point boundary
|
||||
* at the start of a code point.
|
||||
* If the offset points to the trail surrogate of a surrogate pair,
|
||||
* then the offset is decremented.
|
||||
* Otherwise, it is not modified.
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param start starting string offset (usually 0)
|
||||
* @param i string offset, must be start<=i
|
||||
* @see U16_SET_CP_START_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_SET_CP_START(s, start, i) { \
|
||||
if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
|
||||
--(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
/* definitions with backward iteration -------------------------------------- */
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one
|
||||
* and get the code point between them.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* The input offset may be the same as the string length.
|
||||
* If the offset is behind a trail surrogate unit
|
||||
* for a supplementary code point, then the macro will read
|
||||
* the preceding lead surrogate as well.
|
||||
* If the offset is behind a lead surrogate, then that itself
|
||||
* will be returned as the code point.
|
||||
* The result is undefined if the offset is behind a single, unpaired trail surrogate.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_PREV
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_PREV_UNSAFE(s, i, c) { \
|
||||
(c)=(s)[--(i)]; \
|
||||
if(U16_IS_TRAIL(c)) { \
|
||||
(c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one
|
||||
* and get the code point between them.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The input offset may be the same as the string length.
|
||||
* If the offset is behind a trail surrogate unit
|
||||
* for a supplementary code point, then the macro will read
|
||||
* the preceding lead surrogate as well.
|
||||
* If the offset is behind a lead surrogate or behind a single, unpaired
|
||||
* trail surrogate, then c is set to that unpaired surrogate.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param start starting string offset (usually 0)
|
||||
* @param i string offset, must be start<i
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_PREV_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_PREV(s, start, i, c) { \
|
||||
(c)=(s)[--(i)]; \
|
||||
if(U16_IS_TRAIL(c)) { \
|
||||
uint16_t __c2; \
|
||||
if((i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
|
||||
--(i); \
|
||||
(c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one
|
||||
* and get the code point between them.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The input offset may be the same as the string length.
|
||||
* If the offset is behind a trail surrogate unit
|
||||
* for a supplementary code point, then the macro will read
|
||||
* the preceding lead surrogate as well.
|
||||
* If the offset is behind a lead surrogate or behind a single, unpaired
|
||||
* trail surrogate, then c is set to U+FFFD.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param start starting string offset (usually 0)
|
||||
* @param i string offset, must be start<i
|
||||
* @param c output UChar32 variable
|
||||
* @see U16_PREV_UNSAFE
|
||||
* @draft ICU 60
|
||||
*/
|
||||
#define U16_PREV_OR_FFFD(s, start, i, c) { \
|
||||
(c)=(s)[--(i)]; \
|
||||
if(U16_IS_SURROGATE(c)) { \
|
||||
uint16_t __c2; \
|
||||
if(U16_IS_SURROGATE_TRAIL(c) && (i)>(start) && U16_IS_LEAD(__c2=(s)[(i)-1])) { \
|
||||
--(i); \
|
||||
(c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
|
||||
} else { \
|
||||
(c)=0xfffd; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* The input offset may be the same as the string length.
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @see U16_BACK_1
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_BACK_1_UNSAFE(s, i) { \
|
||||
if(U16_IS_TRAIL((s)[--(i)])) { \
|
||||
--(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* The input offset may be the same as the string length.
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param start starting string offset (usually 0)
|
||||
* @param i string offset, must be start<i
|
||||
* @see U16_BACK_1_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_BACK_1(s, start, i) { \
|
||||
if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
|
||||
--(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the n-th one before it,
|
||||
* i.e., move backward by n code points.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* The input offset may be the same as the string length.
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @param n number of code points to skip
|
||||
* @see U16_BACK_N
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_BACK_N_UNSAFE(s, i, n) { \
|
||||
int32_t __N=(n); \
|
||||
while(__N>0) { \
|
||||
U16_BACK_1_UNSAFE(s, i); \
|
||||
--__N; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the n-th one before it,
|
||||
* i.e., move backward by n code points.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* The input offset may be the same as the string length.
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param start start of string
|
||||
* @param i string offset, must be start<i
|
||||
* @param n number of code points to skip
|
||||
* @see U16_BACK_N_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_BACK_N(s, start, i, n) { \
|
||||
int32_t __N=(n); \
|
||||
while(__N>0 && (i)>(start)) { \
|
||||
U16_BACK_1(s, start, i); \
|
||||
--__N; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust a random-access offset to a code point boundary after a code point.
|
||||
* If the offset is behind the lead surrogate of a surrogate pair,
|
||||
* then the offset is incremented.
|
||||
* Otherwise, it is not modified.
|
||||
* The input offset may be the same as the string length.
|
||||
* "Unsafe" macro, assumes well-formed UTF-16.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param i string offset
|
||||
* @see U16_SET_CP_LIMIT
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_SET_CP_LIMIT_UNSAFE(s, i) { \
|
||||
if(U16_IS_LEAD((s)[(i)-1])) { \
|
||||
++(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust a random-access offset to a code point boundary after a code point.
|
||||
* If the offset is behind the lead surrogate of a surrogate pair,
|
||||
* then the offset is incremented.
|
||||
* Otherwise, it is not modified.
|
||||
* The input offset may be the same as the string length.
|
||||
* "Safe" macro, handles unpaired surrogates and checks for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* @param s const UChar * string
|
||||
* @param start int32_t starting string offset (usually 0)
|
||||
* @param i int32_t string offset, start<=i<=length
|
||||
* @param length int32_t string length
|
||||
* @see U16_SET_CP_LIMIT_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U16_SET_CP_LIMIT(s, start, i, length) { \
|
||||
if((start)<(i) && ((i)<(length) || (length)<0) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
|
||||
++(i); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
882
vendor/icu/include/unicode/utf8.h
vendored
Normal file
882
vendor/icu/include/unicode/utf8.h
vendored
Normal file
@@ -0,0 +1,882 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: utf8.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 1999sep13
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: 8-bit Unicode handling macros
|
||||
*
|
||||
* This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings.
|
||||
*
|
||||
* For more information see utf.h and the ICU User Guide Strings chapter
|
||||
* (http://userguide.icu-project.org/strings).
|
||||
*
|
||||
* <em>Usage:</em>
|
||||
* ICU coding guidelines for if() statements should be followed when using these macros.
|
||||
* Compound statements (curly braces {}) must be used for if-else-while...
|
||||
* bodies and all macro statements should be terminated with semicolon.
|
||||
*/
|
||||
|
||||
#ifndef __UTF8_H__
|
||||
#define __UTF8_H__
|
||||
|
||||
#include <unicode/umachine.h>
|
||||
#ifndef __UTF_H__
|
||||
# include "unicode/utf.h"
|
||||
#endif
|
||||
|
||||
/* internal definitions ----------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Counts the trail bytes for a UTF-8 lead byte.
|
||||
* Returns 0 for 0..0xc1 as well as for 0xf5..0xff.
|
||||
* leadByte might be evaluated multiple times.
|
||||
*
|
||||
* This is internal since it is not meant to be called directly by external clients;
|
||||
* however it is called by public macros in this file and thus must remain stable.
|
||||
*
|
||||
* @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
|
||||
* @internal
|
||||
*/
|
||||
#define U8_COUNT_TRAIL_BYTES(leadByte) \
|
||||
(U8_IS_LEAD(leadByte) ? \
|
||||
((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+1 : 0)
|
||||
|
||||
/**
|
||||
* Counts the trail bytes for a UTF-8 lead byte of a valid UTF-8 sequence.
|
||||
* Returns 0 for 0..0xc1. Undefined for 0xf5..0xff.
|
||||
* leadByte might be evaluated multiple times.
|
||||
*
|
||||
* This is internal since it is not meant to be called directly by external clients;
|
||||
* however it is called by public macros in this file and thus must remain stable.
|
||||
*
|
||||
* @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
|
||||
* @internal
|
||||
*/
|
||||
#define U8_COUNT_TRAIL_BYTES_UNSAFE(leadByte) \
|
||||
(((uint8_t)(leadByte)>=0xc2)+((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0))
|
||||
|
||||
/**
|
||||
* Mask a UTF-8 lead byte, leave only the lower bits that form part of the code point value.
|
||||
*
|
||||
* This is internal since it is not meant to be called directly by external clients;
|
||||
* however it is called by public macros in this file and thus must remain stable.
|
||||
* @internal
|
||||
*/
|
||||
#define U8_MASK_LEAD_BYTE(leadByte, countTrailBytes) ((leadByte)&=(1<<(6-(countTrailBytes)))-1)
|
||||
|
||||
/**
|
||||
* Internal bit vector for 3-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD3_AND_T1.
|
||||
* Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
|
||||
* Lead byte E0..EF bits 3..0 are used as byte index,
|
||||
* first trail byte bits 7..5 are used as bit index into that byte.
|
||||
* @see U8_IS_VALID_LEAD3_AND_T1
|
||||
* @internal
|
||||
*/
|
||||
#define U8_LEAD3_T1_BITS "\x20\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x30\x10\x30\x30"
|
||||
|
||||
/**
|
||||
* Internal 3-byte UTF-8 validity check.
|
||||
* Non-zero if lead byte E0..EF and first trail byte 00..FF start a valid sequence.
|
||||
* @internal
|
||||
*/
|
||||
#define U8_IS_VALID_LEAD3_AND_T1(lead, t1) (U8_LEAD3_T1_BITS[(lead)&0xf]&(1<<((uint8_t)(t1)>>5)))
|
||||
|
||||
/**
|
||||
* Internal bit vector for 4-byte UTF-8 validity check, for use in U8_IS_VALID_LEAD4_AND_T1.
|
||||
* Each bit indicates whether one lead byte + first trail byte pair starts a valid sequence.
|
||||
* First trail byte bits 7..4 are used as byte index,
|
||||
* lead byte F0..F4 bits 2..0 are used as bit index into that byte.
|
||||
* @see U8_IS_VALID_LEAD4_AND_T1
|
||||
* @internal
|
||||
*/
|
||||
#define U8_LEAD4_T1_BITS "\x00\x00\x00\x00\x00\x00\x00\x00\x1E\x0F\x0F\x0F\x00\x00\x00\x00"
|
||||
|
||||
/**
|
||||
* Internal 4-byte UTF-8 validity check.
|
||||
* Non-zero if lead byte F0..F4 and first trail byte 00..FF start a valid sequence.
|
||||
* @internal
|
||||
*/
|
||||
#define U8_IS_VALID_LEAD4_AND_T1(lead, t1) (U8_LEAD4_T1_BITS[(uint8_t)(t1)>>4]&(1<<((lead)&7)))
|
||||
|
||||
/**
|
||||
* Function for handling "next code point" with error-checking.
|
||||
*
|
||||
* This is internal since it is not meant to be called directly by external clients;
|
||||
* however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
|
||||
* file and thus must remain stable, and should not be hidden when other internal
|
||||
* functions are hidden (otherwise public macros would fail to compile).
|
||||
* @internal
|
||||
*/
|
||||
U_STABLE UChar32 U_EXPORT2
|
||||
utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict);
|
||||
|
||||
/**
|
||||
* Function for handling "append code point" with error-checking.
|
||||
*
|
||||
* This is internal since it is not meant to be called directly by external clients;
|
||||
* however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
|
||||
* file and thus must remain stable, and should not be hidden when other internal
|
||||
* functions are hidden (otherwise public macros would fail to compile).
|
||||
* @internal
|
||||
*/
|
||||
U_STABLE int32_t U_EXPORT2
|
||||
utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError);
|
||||
|
||||
/**
|
||||
* Function for handling "previous code point" with error-checking.
|
||||
*
|
||||
* This is internal since it is not meant to be called directly by external clients;
|
||||
* however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
|
||||
* file and thus must remain stable, and should not be hidden when other internal
|
||||
* functions are hidden (otherwise public macros would fail to compile).
|
||||
* @internal
|
||||
*/
|
||||
U_STABLE UChar32 U_EXPORT2
|
||||
utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict);
|
||||
|
||||
/**
|
||||
* Function for handling "skip backward one code point" with error-checking.
|
||||
*
|
||||
* This is internal since it is not meant to be called directly by external clients;
|
||||
* however it is U_STABLE (not U_INTERNAL) since it is called by public macros in this
|
||||
* file and thus must remain stable, and should not be hidden when other internal
|
||||
* functions are hidden (otherwise public macros would fail to compile).
|
||||
* @internal
|
||||
*/
|
||||
U_STABLE int32_t U_EXPORT2
|
||||
utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
|
||||
|
||||
/* single-code point definitions -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Does this code unit (byte) encode a code point by itself (US-ASCII 0..0x7f)?
|
||||
* @param c 8-bit code unit (byte)
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_IS_SINGLE(c) (((c)&0x80)==0)
|
||||
|
||||
/**
|
||||
* Is this code unit (byte) a UTF-8 lead byte? (0xC2..0xF4)
|
||||
* @param c 8-bit code unit (byte)
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_IS_LEAD(c) ((uint8_t)((c)-0xc2)<=0x32)
|
||||
// 0x32=0xf4-0xc2
|
||||
|
||||
/**
|
||||
* Is this code unit (byte) a UTF-8 trail byte? (0x80..0xBF)
|
||||
* @param c 8-bit code unit (byte)
|
||||
* @return TRUE or FALSE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_IS_TRAIL(c) ((int8_t)(c)<-0x40)
|
||||
|
||||
/**
|
||||
* How many code units (bytes) are used for the UTF-8 encoding
|
||||
* of this Unicode code point?
|
||||
* @param c 32-bit code point
|
||||
* @return 1..4, or 0 if c is a surrogate or not a Unicode code point
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_LENGTH(c) \
|
||||
((uint32_t)(c)<=0x7f ? 1 : \
|
||||
((uint32_t)(c)<=0x7ff ? 2 : \
|
||||
((uint32_t)(c)<=0xd7ff ? 3 : \
|
||||
((uint32_t)(c)<=0xdfff || (uint32_t)(c)>0x10ffff ? 0 : \
|
||||
((uint32_t)(c)<=0xffff ? 3 : 4)\
|
||||
) \
|
||||
) \
|
||||
) \
|
||||
)
|
||||
|
||||
/**
|
||||
* The maximum number of UTF-8 code units (bytes) per Unicode code point (U+0000..U+10ffff).
|
||||
* @return 4
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_MAX_LENGTH 4
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a random-access offset,
|
||||
* without changing the offset.
|
||||
* The offset may point to either the lead byte or one of the trail bytes
|
||||
* for a code point, in which case the macro will read all of the bytes
|
||||
* for the code point.
|
||||
* The result is undefined if the offset points to an illegal UTF-8
|
||||
* byte sequence.
|
||||
* Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @param c output UChar32 variable
|
||||
* @see U8_GET
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_GET_UNSAFE(s, i, c) { \
|
||||
int32_t _u8_get_unsafe_index=(int32_t)(i); \
|
||||
U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \
|
||||
U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a random-access offset,
|
||||
* without changing the offset.
|
||||
* The offset may point to either the lead byte or one of the trail bytes
|
||||
* for a code point, in which case the macro will read all of the bytes
|
||||
* for the code point.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* If the offset points to an illegal UTF-8 byte sequence, then
|
||||
* c is set to a negative value.
|
||||
* Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t starting string offset
|
||||
* @param i int32_t string offset, must be start<=i<length
|
||||
* @param length int32_t string length
|
||||
* @param c output UChar32 variable, set to <0 in case of an error
|
||||
* @see U8_GET_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_GET(s, start, i, length, c) { \
|
||||
int32_t _u8_get_index=(i); \
|
||||
U8_SET_CP_START(s, start, _u8_get_index); \
|
||||
U8_NEXT(s, _u8_get_index, length, c); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a random-access offset,
|
||||
* without changing the offset.
|
||||
* The offset may point to either the lead byte or one of the trail bytes
|
||||
* for a code point, in which case the macro will read all of the bytes
|
||||
* for the code point.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* If the offset points to an illegal UTF-8 byte sequence, then
|
||||
* c is set to U+FFFD.
|
||||
* Iteration through a string is more efficient with U8_NEXT_UNSAFE or U8_NEXT_OR_FFFD.
|
||||
*
|
||||
* This macro does not distinguish between a real U+FFFD in the text
|
||||
* and U+FFFD returned for an ill-formed sequence.
|
||||
* Use U8_GET() if that distinction is important.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t starting string offset
|
||||
* @param i int32_t string offset, must be start<=i<length
|
||||
* @param length int32_t string length
|
||||
* @param c output UChar32 variable, set to U+FFFD in case of an error
|
||||
* @see U8_GET
|
||||
* @stable ICU 51
|
||||
*/
|
||||
#define U8_GET_OR_FFFD(s, start, i, length, c) { \
|
||||
int32_t _u8_get_index=(i); \
|
||||
U8_SET_CP_START(s, start, _u8_get_index); \
|
||||
U8_NEXT_OR_FFFD(s, _u8_get_index, length, c); \
|
||||
}
|
||||
|
||||
/* definitions with forward iteration --------------------------------------- */
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a code point boundary offset,
|
||||
* and advance the offset to the next code point boundary.
|
||||
* (Post-incrementing forward iteration.)
|
||||
* "Unsafe" macro, assumes well-formed UTF-8.
|
||||
*
|
||||
* The offset may point to the lead byte of a multi-byte sequence,
|
||||
* in which case the macro will read the whole sequence.
|
||||
* The result is undefined if the offset points to a trail byte
|
||||
* or an illegal UTF-8 sequence.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @param c output UChar32 variable
|
||||
* @see U8_NEXT
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_NEXT_UNSAFE(s, i, c) { \
|
||||
(c)=(uint8_t)(s)[(i)++]; \
|
||||
if(!U8_IS_SINGLE(c)) { \
|
||||
if((c)<0xe0) { \
|
||||
(c)=(((c)&0x1f)<<6)|((s)[(i)++]&0x3f); \
|
||||
} else if((c)<0xf0) { \
|
||||
/* no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */ \
|
||||
(c)=(UChar)(((c)<<12)|(((s)[i]&0x3f)<<6)|((s)[(i)+1]&0x3f)); \
|
||||
(i)+=2; \
|
||||
} else { \
|
||||
(c)=(((c)&7)<<18)|(((s)[i]&0x3f)<<12)|(((s)[(i)+1]&0x3f)<<6)|((s)[(i)+2]&0x3f); \
|
||||
(i)+=3; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a code point boundary offset,
|
||||
* and advance the offset to the next code point boundary.
|
||||
* (Post-incrementing forward iteration.)
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* The offset may point to the lead byte of a multi-byte sequence,
|
||||
* in which case the macro will read the whole sequence.
|
||||
* If the offset points to a trail byte or an illegal UTF-8 sequence, then
|
||||
* c is set to a negative value.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i int32_t string offset, must be i<length
|
||||
* @param length int32_t string length
|
||||
* @param c output UChar32 variable, set to <0 in case of an error
|
||||
* @see U8_NEXT_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_NEXT(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, U_SENTINEL)
|
||||
|
||||
/**
|
||||
* Get a code point from a string at a code point boundary offset,
|
||||
* and advance the offset to the next code point boundary.
|
||||
* (Post-incrementing forward iteration.)
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* The offset may point to the lead byte of a multi-byte sequence,
|
||||
* in which case the macro will read the whole sequence.
|
||||
* If the offset points to a trail byte or an illegal UTF-8 sequence, then
|
||||
* c is set to U+FFFD.
|
||||
*
|
||||
* This macro does not distinguish between a real U+FFFD in the text
|
||||
* and U+FFFD returned for an ill-formed sequence.
|
||||
* Use U8_NEXT() if that distinction is important.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i int32_t string offset, must be i<length
|
||||
* @param length int32_t string length
|
||||
* @param c output UChar32 variable, set to U+FFFD in case of an error
|
||||
* @see U8_NEXT
|
||||
* @stable ICU 51
|
||||
*/
|
||||
#define U8_NEXT_OR_FFFD(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, 0xfffd)
|
||||
|
||||
/** @internal */
|
||||
#define U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, sub) { \
|
||||
(c)=(uint8_t)(s)[(i)++]; \
|
||||
if(!U8_IS_SINGLE(c)) { \
|
||||
uint8_t __t = 0; \
|
||||
if((i)!=(length) && \
|
||||
/* fetch/validate/assemble all but last trail byte */ \
|
||||
((c)>=0xe0 ? \
|
||||
((c)<0xf0 ? /* U+0800..U+FFFF except surrogates */ \
|
||||
U8_LEAD3_T1_BITS[(c)&=0xf]&(1<<((__t=(s)[i])>>5)) && \
|
||||
(__t&=0x3f, 1) \
|
||||
: /* U+10000..U+10FFFF */ \
|
||||
((c)-=0xf0)<=4 && \
|
||||
U8_LEAD4_T1_BITS[(__t=(s)[i])>>4]&(1<<(c)) && \
|
||||
((c)=((c)<<6)|(__t&0x3f), ++(i)!=(length)) && \
|
||||
(__t=(s)[i]-0x80)<=0x3f) && \
|
||||
/* valid second-to-last trail byte */ \
|
||||
((c)=((c)<<6)|__t, ++(i)!=(length)) \
|
||||
: /* U+0080..U+07FF */ \
|
||||
(c)>=0xc2 && ((c)&=0x1f, 1)) && \
|
||||
/* last trail byte */ \
|
||||
(__t=(s)[i]-0x80)<=0x3f && \
|
||||
((c)=((c)<<6)|__t, ++(i), 1)) { \
|
||||
} else { \
|
||||
(c)=(sub); /* ill-formed*/ \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a code point to a string, overwriting 1 to 4 bytes.
|
||||
* The offset points to the current end of the string contents
|
||||
* and is advanced (post-increment).
|
||||
* "Unsafe" macro, assumes a valid code point and sufficient space in the string.
|
||||
* Otherwise, the result is undefined.
|
||||
*
|
||||
* @param s const uint8_t * string buffer
|
||||
* @param i string offset
|
||||
* @param c code point to append
|
||||
* @see U8_APPEND
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_APPEND_UNSAFE(s, i, c) { \
|
||||
uint32_t __uc=(c); \
|
||||
if(__uc<=0x7f) { \
|
||||
(s)[(i)++]=(uint8_t)__uc; \
|
||||
} else { \
|
||||
if(__uc<=0x7ff) { \
|
||||
(s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \
|
||||
} else { \
|
||||
if(__uc<=0xffff) { \
|
||||
(s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \
|
||||
} else { \
|
||||
(s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \
|
||||
(s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \
|
||||
} \
|
||||
(s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
|
||||
} \
|
||||
(s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a code point to a string, overwriting 1 to 4 bytes.
|
||||
* The offset points to the current end of the string contents
|
||||
* and is advanced (post-increment).
|
||||
* "Safe" macro, checks for a valid code point.
|
||||
* If a non-ASCII code point is written, checks for sufficient space in the string.
|
||||
* If the code point is not valid or trail bytes do not fit,
|
||||
* then isError is set to TRUE.
|
||||
*
|
||||
* @param s const uint8_t * string buffer
|
||||
* @param i int32_t string offset, must be i<capacity
|
||||
* @param capacity int32_t size of the string buffer
|
||||
* @param c UChar32 code point to append
|
||||
* @param isError output UBool set to TRUE if an error occurs, otherwise not modified
|
||||
* @see U8_APPEND_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_APPEND(s, i, capacity, c, isError) { \
|
||||
uint32_t __uc=(c); \
|
||||
if(__uc<=0x7f) { \
|
||||
(s)[(i)++]=(uint8_t)__uc; \
|
||||
} else if(__uc<=0x7ff && (i)+1<(capacity)) { \
|
||||
(s)[(i)++]=(uint8_t)((__uc>>6)|0xc0); \
|
||||
(s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
|
||||
} else if((__uc<=0xd7ff || (0xe000<=__uc && __uc<=0xffff)) && (i)+2<(capacity)) { \
|
||||
(s)[(i)++]=(uint8_t)((__uc>>12)|0xe0); \
|
||||
(s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
|
||||
(s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
|
||||
} else if(0xffff<__uc && __uc<=0x10ffff && (i)+3<(capacity)) { \
|
||||
(s)[(i)++]=(uint8_t)((__uc>>18)|0xf0); \
|
||||
(s)[(i)++]=(uint8_t)(((__uc>>12)&0x3f)|0x80); \
|
||||
(s)[(i)++]=(uint8_t)(((__uc>>6)&0x3f)|0x80); \
|
||||
(s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
|
||||
} else { \
|
||||
(isError)=TRUE; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the string offset from one code point boundary to the next.
|
||||
* (Post-incrementing iteration.)
|
||||
* "Unsafe" macro, assumes well-formed UTF-8.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @see U8_FWD_1
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_FWD_1_UNSAFE(s, i) { \
|
||||
(i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the string offset from one code point boundary to the next.
|
||||
* (Post-incrementing iteration.)
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i int32_t string offset, must be i<length
|
||||
* @param length int32_t string length
|
||||
* @see U8_FWD_1_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_FWD_1(s, i, length) { \
|
||||
uint8_t __b=(s)[(i)++]; \
|
||||
if(U8_IS_LEAD(__b) && (i)!=(length)) { \
|
||||
uint8_t __t1=(s)[i]; \
|
||||
if((0xe0<=__b && __b<0xf0)) { \
|
||||
if(U8_IS_VALID_LEAD3_AND_T1(__b, __t1) && \
|
||||
++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \
|
||||
++(i); \
|
||||
} \
|
||||
} else if(__b<0xe0) { \
|
||||
if(U8_IS_TRAIL(__t1)) { \
|
||||
++(i); \
|
||||
} \
|
||||
} else /* c>=0xf0 */ { \
|
||||
if(U8_IS_VALID_LEAD4_AND_T1(__b, __t1) && \
|
||||
++(i)!=(length) && U8_IS_TRAIL((s)[i]) && \
|
||||
++(i)!=(length) && U8_IS_TRAIL((s)[i])) { \
|
||||
++(i); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the string offset from one code point boundary to the n-th next one,
|
||||
* i.e., move forward by n code points.
|
||||
* (Post-incrementing iteration.)
|
||||
* "Unsafe" macro, assumes well-formed UTF-8.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @param n number of code points to skip
|
||||
* @see U8_FWD_N
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_FWD_N_UNSAFE(s, i, n) { \
|
||||
int32_t __N=(n); \
|
||||
while(__N>0) { \
|
||||
U8_FWD_1_UNSAFE(s, i); \
|
||||
--__N; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Advance the string offset from one code point boundary to the n-th next one,
|
||||
* i.e., move forward by n code points.
|
||||
* (Post-incrementing iteration.)
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i int32_t string offset, must be i<length
|
||||
* @param length int32_t string length
|
||||
* @param n number of code points to skip
|
||||
* @see U8_FWD_N_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_FWD_N(s, i, length, n) { \
|
||||
int32_t __N=(n); \
|
||||
while(__N>0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
|
||||
U8_FWD_1(s, i, length); \
|
||||
--__N; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust a random-access offset to a code point boundary
|
||||
* at the start of a code point.
|
||||
* If the offset points to a UTF-8 trail byte,
|
||||
* then the offset is moved backward to the corresponding lead byte.
|
||||
* Otherwise, it is not modified.
|
||||
* "Unsafe" macro, assumes well-formed UTF-8.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @see U8_SET_CP_START
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_SET_CP_START_UNSAFE(s, i) { \
|
||||
while(U8_IS_TRAIL((s)[i])) { --(i); } \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust a random-access offset to a code point boundary
|
||||
* at the start of a code point.
|
||||
* If the offset points to a UTF-8 trail byte,
|
||||
* then the offset is moved backward to the corresponding lead byte.
|
||||
* Otherwise, it is not modified.
|
||||
*
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
* Unlike U8_TRUNCATE_IF_INCOMPLETE(), this macro always reads s[i].
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t starting string offset (usually 0)
|
||||
* @param i int32_t string offset, must be start<=i
|
||||
* @see U8_SET_CP_START_UNSAFE
|
||||
* @see U8_TRUNCATE_IF_INCOMPLETE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_SET_CP_START(s, start, i) { \
|
||||
if(U8_IS_TRAIL((s)[(i)])) { \
|
||||
(i)=utf8_back1SafeBody(s, start, (i)); \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
/**
|
||||
* If the string ends with a UTF-8 byte sequence that is valid so far
|
||||
* but incomplete, then reduce the length of the string to end before
|
||||
* the lead byte of that incomplete sequence.
|
||||
* For example, if the string ends with E1 80, the length is reduced by 2.
|
||||
*
|
||||
* In all other cases (the string ends with a complete sequence, or it is not
|
||||
* possible for any further trail byte to extend the trailing sequence)
|
||||
* the length remains unchanged.
|
||||
*
|
||||
* Useful for processing text split across multiple buffers
|
||||
* (save the incomplete sequence for later)
|
||||
* and for optimizing iteration
|
||||
* (check for string length only once per character).
|
||||
*
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
* Unlike U8_SET_CP_START(), this macro never reads s[length].
|
||||
*
|
||||
* (In UTF-16, simply check for U16_IS_LEAD(last code unit).)
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t starting string offset (usually 0)
|
||||
* @param length int32_t string length (usually start<=length)
|
||||
* @see U8_SET_CP_START
|
||||
* @draft ICU 61
|
||||
*/
|
||||
#define U8_TRUNCATE_IF_INCOMPLETE(s, start, length) \
|
||||
if((length)>(start)) { \
|
||||
uint8_t __b1=s[(length)-1]; \
|
||||
if(U8_IS_SINGLE(__b1)) { \
|
||||
/* common ASCII character */ \
|
||||
} else if(U8_IS_LEAD(__b1)) { \
|
||||
--(length); \
|
||||
} else if(U8_IS_TRAIL(__b1) && ((length)-2)>=(start)) { \
|
||||
uint8_t __b2=s[(length)-2]; \
|
||||
if(0xe0<=__b2 && __b2<=0xf4) { \
|
||||
if(__b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(__b2, __b1) : \
|
||||
U8_IS_VALID_LEAD4_AND_T1(__b2, __b1)) { \
|
||||
(length)-=2; \
|
||||
} \
|
||||
} else if(U8_IS_TRAIL(__b2) && ((length)-3)>=(start)) { \
|
||||
uint8_t __b3=s[(length)-3]; \
|
||||
if(0xf0<=__b3 && __b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(__b3, __b2)) { \
|
||||
(length)-=3; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
|
||||
/* definitions with backward iteration -------------------------------------- */
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one
|
||||
* and get the code point between them.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* "Unsafe" macro, assumes well-formed UTF-8.
|
||||
*
|
||||
* The input offset may be the same as the string length.
|
||||
* If the offset is behind a multi-byte sequence, then the macro will read
|
||||
* the whole sequence.
|
||||
* If the offset is behind a lead byte, then that itself
|
||||
* will be returned as the code point.
|
||||
* The result is undefined if the offset is behind an illegal UTF-8 sequence.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @param c output UChar32 variable
|
||||
* @see U8_PREV
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_PREV_UNSAFE(s, i, c) { \
|
||||
(c)=(uint8_t)(s)[--(i)]; \
|
||||
if(U8_IS_TRAIL(c)) { \
|
||||
uint8_t __b, __count=1, __shift=6; \
|
||||
\
|
||||
/* c is a trail byte */ \
|
||||
(c)&=0x3f; \
|
||||
for(;;) { \
|
||||
__b=(s)[--(i)]; \
|
||||
if(__b>=0xc0) { \
|
||||
U8_MASK_LEAD_BYTE(__b, __count); \
|
||||
(c)|=(UChar32)__b<<__shift; \
|
||||
break; \
|
||||
} else { \
|
||||
(c)|=(UChar32)(__b&0x3f)<<__shift; \
|
||||
++__count; \
|
||||
__shift+=6; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one
|
||||
* and get the code point between them.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* The input offset may be the same as the string length.
|
||||
* If the offset is behind a multi-byte sequence, then the macro will read
|
||||
* the whole sequence.
|
||||
* If the offset is behind a lead byte, then that itself
|
||||
* will be returned as the code point.
|
||||
* If the offset is behind an illegal UTF-8 sequence, then c is set to a negative value.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t starting string offset (usually 0)
|
||||
* @param i int32_t string offset, must be start<i
|
||||
* @param c output UChar32 variable, set to <0 in case of an error
|
||||
* @see U8_PREV_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_PREV(s, start, i, c) { \
|
||||
(c)=(uint8_t)(s)[--(i)]; \
|
||||
if(!U8_IS_SINGLE(c)) { \
|
||||
(c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one
|
||||
* and get the code point between them.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* The input offset may be the same as the string length.
|
||||
* If the offset is behind a multi-byte sequence, then the macro will read
|
||||
* the whole sequence.
|
||||
* If the offset is behind a lead byte, then that itself
|
||||
* will be returned as the code point.
|
||||
* If the offset is behind an illegal UTF-8 sequence, then c is set to U+FFFD.
|
||||
*
|
||||
* This macro does not distinguish between a real U+FFFD in the text
|
||||
* and U+FFFD returned for an ill-formed sequence.
|
||||
* Use U8_PREV() if that distinction is important.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t starting string offset (usually 0)
|
||||
* @param i int32_t string offset, must be start<i
|
||||
* @param c output UChar32 variable, set to U+FFFD in case of an error
|
||||
* @see U8_PREV
|
||||
* @stable ICU 51
|
||||
*/
|
||||
#define U8_PREV_OR_FFFD(s, start, i, c) { \
|
||||
(c)=(uint8_t)(s)[--(i)]; \
|
||||
if(!U8_IS_SINGLE(c)) { \
|
||||
(c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -3); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* The input offset may be the same as the string length.
|
||||
* "Unsafe" macro, assumes well-formed UTF-8.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @see U8_BACK_1
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_BACK_1_UNSAFE(s, i) { \
|
||||
while(U8_IS_TRAIL((s)[--(i)])) {} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the previous one.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* The input offset may be the same as the string length.
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t starting string offset (usually 0)
|
||||
* @param i int32_t string offset, must be start<i
|
||||
* @see U8_BACK_1_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_BACK_1(s, start, i) { \
|
||||
if(U8_IS_TRAIL((s)[--(i)])) { \
|
||||
(i)=utf8_back1SafeBody(s, start, (i)); \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the n-th one before it,
|
||||
* i.e., move backward by n code points.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* The input offset may be the same as the string length.
|
||||
* "Unsafe" macro, assumes well-formed UTF-8.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @param n number of code points to skip
|
||||
* @see U8_BACK_N
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_BACK_N_UNSAFE(s, i, n) { \
|
||||
int32_t __N=(n); \
|
||||
while(__N>0) { \
|
||||
U8_BACK_1_UNSAFE(s, i); \
|
||||
--__N; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the string offset from one code point boundary to the n-th one before it,
|
||||
* i.e., move backward by n code points.
|
||||
* (Pre-decrementing backward iteration.)
|
||||
* The input offset may be the same as the string length.
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t index of the start of the string
|
||||
* @param i int32_t string offset, must be start<i
|
||||
* @param n number of code points to skip
|
||||
* @see U8_BACK_N_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_BACK_N(s, start, i, n) { \
|
||||
int32_t __N=(n); \
|
||||
while(__N>0 && (i)>(start)) { \
|
||||
U8_BACK_1(s, start, i); \
|
||||
--__N; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust a random-access offset to a code point boundary after a code point.
|
||||
* If the offset is behind a partial multi-byte sequence,
|
||||
* then the offset is incremented to behind the whole sequence.
|
||||
* Otherwise, it is not modified.
|
||||
* The input offset may be the same as the string length.
|
||||
* "Unsafe" macro, assumes well-formed UTF-8.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param i string offset
|
||||
* @see U8_SET_CP_LIMIT
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_SET_CP_LIMIT_UNSAFE(s, i) { \
|
||||
U8_BACK_1_UNSAFE(s, i); \
|
||||
U8_FWD_1_UNSAFE(s, i); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust a random-access offset to a code point boundary after a code point.
|
||||
* If the offset is behind a partial multi-byte sequence,
|
||||
* then the offset is incremented to behind the whole sequence.
|
||||
* Otherwise, it is not modified.
|
||||
* The input offset may be the same as the string length.
|
||||
* "Safe" macro, checks for illegal sequences and for string boundaries.
|
||||
*
|
||||
* The length can be negative for a NUL-terminated string.
|
||||
*
|
||||
* @param s const uint8_t * string
|
||||
* @param start int32_t starting string offset (usually 0)
|
||||
* @param i int32_t string offset, must be start<=i<=length
|
||||
* @param length int32_t string length
|
||||
* @see U8_SET_CP_LIMIT_UNSAFE
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U8_SET_CP_LIMIT(s, start, i, length) { \
|
||||
if((start)<(i) && ((i)<(length) || (length)<0)) { \
|
||||
U8_BACK_1(s, start, i); \
|
||||
U8_FWD_1(s, i, length); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif
|
||||
1204
vendor/icu/include/unicode/utf_old.h
vendored
Normal file
1204
vendor/icu/include/unicode/utf_old.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
704
vendor/icu/include/unicode/utypes.h
vendored
Normal file
704
vendor/icu/include/unicode/utypes.h
vendored
Normal file
@@ -0,0 +1,704 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1996-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
* FILE NAME : UTYPES.H (formerly ptypes.h)
|
||||
*
|
||||
* Date Name Description
|
||||
* 12/11/96 helena Creation.
|
||||
* 02/27/97 aliu Added typedefs for UClassID, int8, int16, int32,
|
||||
* uint8, uint16, and uint32.
|
||||
* 04/01/97 aliu Added XP_CPLUSPLUS and modified to work under C as
|
||||
* well as C++.
|
||||
* Modified to use memcpy() for uprv_arrayCopy() fns.
|
||||
* 04/14/97 aliu Added TPlatformUtilities.
|
||||
* 05/07/97 aliu Added import/export specifiers (replacing the old
|
||||
* broken EXT_CLASS). Added version number for our
|
||||
* code. Cleaned up header.
|
||||
* 6/20/97 helena Java class name change.
|
||||
* 08/11/98 stephen UErrorCode changed from typedef to enum
|
||||
* 08/12/98 erm Changed T_ANALYTIC_PACKAGE_VERSION to 3
|
||||
* 08/14/98 stephen Added uprv_arrayCopy() for int8_t, int16_t, int32_t
|
||||
* 12/09/98 jfitz Added BUFFER_OVERFLOW_ERROR (bug 1100066)
|
||||
* 04/20/99 stephen Cleaned up & reworked for autoconf.
|
||||
* Renamed to utypes.h.
|
||||
* 05/05/99 stephen Changed to use <inttypes.h>
|
||||
* 12/07/99 helena Moved copyright notice string from ucnv_bld.h here.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef UTYPES_H
|
||||
#define UTYPES_H
|
||||
|
||||
|
||||
#include <unicode/umachine.h>
|
||||
#include <unicode/uversion.h>
|
||||
#include <unicode/uconfig.h>
|
||||
#include <float.h>
|
||||
|
||||
#if !U_NO_DEFAULT_INCLUDE_UTF_HEADERS
|
||||
# include "unicode/utf.h"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* \file
|
||||
* \brief Basic definitions for ICU, for both C and C++ APIs
|
||||
*
|
||||
* This file defines basic types, constants, and enumerations directly or
|
||||
* indirectly by including other header files, especially utf.h for the
|
||||
* basic character and string definitions and umachine.h for consistent
|
||||
* integer and other types.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \def U_SHOW_CPLUSPLUS_API
|
||||
* @internal
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
# ifndef U_SHOW_CPLUSPLUS_API
|
||||
# define U_SHOW_CPLUSPLUS_API 1
|
||||
# endif
|
||||
#else
|
||||
# undef U_SHOW_CPLUSPLUS_API
|
||||
# define U_SHOW_CPLUSPLUS_API 0
|
||||
#endif
|
||||
|
||||
/** @{ API visibility control */
|
||||
|
||||
/**
|
||||
* \def U_HIDE_DRAFT_API
|
||||
* Define this to 1 to request that draft API be "hidden"
|
||||
* @internal
|
||||
*/
|
||||
/**
|
||||
* \def U_HIDE_INTERNAL_API
|
||||
* Define this to 1 to request that internal API be "hidden"
|
||||
* @internal
|
||||
*/
|
||||
#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_DRAFT_API)
|
||||
#define U_HIDE_DRAFT_API 1
|
||||
#endif
|
||||
#if !U_DEFAULT_SHOW_DRAFT && !defined(U_SHOW_INTERNAL_API)
|
||||
#define U_HIDE_INTERNAL_API 1
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* ICUDATA naming scheme */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* \def U_ICUDATA_TYPE_LETTER
|
||||
*
|
||||
* This is a platform-dependent string containing one letter:
|
||||
* - b for big-endian, ASCII-family platforms
|
||||
* - l for little-endian, ASCII-family platforms
|
||||
* - e for big-endian, EBCDIC-family platforms
|
||||
* This letter is part of the common data file name.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_ICUDATA_TYPE_LITLETTER
|
||||
* The non-string form of U_ICUDATA_TYPE_LETTER
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#if U_CHARSET_FAMILY
|
||||
# if U_IS_BIG_ENDIAN
|
||||
/* EBCDIC - should always be BE */
|
||||
# define U_ICUDATA_TYPE_LETTER "e"
|
||||
# define U_ICUDATA_TYPE_LITLETTER e
|
||||
# else
|
||||
# error "Don't know what to do with little endian EBCDIC!"
|
||||
# define U_ICUDATA_TYPE_LETTER "x"
|
||||
# define U_ICUDATA_TYPE_LITLETTER x
|
||||
# endif
|
||||
#else
|
||||
# if U_IS_BIG_ENDIAN
|
||||
/* Big-endian ASCII */
|
||||
# define U_ICUDATA_TYPE_LETTER "b"
|
||||
# define U_ICUDATA_TYPE_LITLETTER b
|
||||
# else
|
||||
/* Little-endian ASCII */
|
||||
# define U_ICUDATA_TYPE_LETTER "l"
|
||||
# define U_ICUDATA_TYPE_LITLETTER l
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* A single string literal containing the icudata stub name. i.e. 'icudt18e' for
|
||||
* ICU 1.8.x on EBCDIC, etc..
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#define U_ICUDATA_NAME "icudt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
#define U_USRDATA_NAME "usrdt" U_ICU_VERSION_SHORT U_ICUDATA_TYPE_LETTER /**< @internal */
|
||||
#define U_USE_USRDATA 0 /**< @internal */
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
/**
|
||||
* U_ICU_ENTRY_POINT is the name of the DLL entry point to the ICU data library.
|
||||
* Defined as a literal, not a string.
|
||||
* Tricky Preprocessor use - ## operator replaces macro parameters with the literal string
|
||||
* from the corresponding macro invocation, _before_ other macro substitutions.
|
||||
* Need a nested \#defines to get the actual version numbers rather than
|
||||
* the literal text U_ICU_VERSION_MAJOR_NUM into the name.
|
||||
* The net result will be something of the form
|
||||
* \#define U_ICU_ENTRY_POINT icudt19_dat
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_ICUDATA_ENTRY_POINT U_DEF2_ICUDATA_ENTRY_POINT(U_ICU_VERSION_MAJOR_NUM,U_LIB_SUFFIX_C_NAME)
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/**
|
||||
* Do not use. Note that it's OK for the 2nd argument to be undefined (literal).
|
||||
* @internal
|
||||
*/
|
||||
#define U_DEF2_ICUDATA_ENTRY_POINT(major,suff) U_DEF_ICUDATA_ENTRY_POINT(major,suff)
|
||||
|
||||
/**
|
||||
* Do not use.
|
||||
* @internal
|
||||
*/
|
||||
#ifndef U_DEF_ICUDATA_ENTRY_POINT
|
||||
/* affected by symbol renaming. See platform.h */
|
||||
#ifndef U_LIB_SUFFIX_C_NAME
|
||||
#define U_DEF_ICUDATA_ENTRY_POINT(major, suff) icudt##major##_dat
|
||||
#else
|
||||
#define U_DEF_ICUDATA_ENTRY_POINT(major, suff) icudt##suff ## major##_dat
|
||||
#endif
|
||||
#endif
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
/**
|
||||
* \def NULL
|
||||
* Define NULL if necessary, to nullptr for C++ and to ((void *)0) for C.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL nullptr
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Calendar/TimeZone data types */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* Date and Time data type.
|
||||
* This is a primitive data type that holds the date and time
|
||||
* as the number of milliseconds since 1970-jan-01, 00:00 UTC.
|
||||
* UTC leap seconds are ignored.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
typedef double UDate;
|
||||
|
||||
/** The number of milliseconds per second @stable ICU 2.0 */
|
||||
#define U_MILLIS_PER_SECOND (1000)
|
||||
/** The number of milliseconds per minute @stable ICU 2.0 */
|
||||
#define U_MILLIS_PER_MINUTE (60000)
|
||||
/** The number of milliseconds per hour @stable ICU 2.0 */
|
||||
#define U_MILLIS_PER_HOUR (3600000)
|
||||
/** The number of milliseconds per day @stable ICU 2.0 */
|
||||
#define U_MILLIS_PER_DAY (86400000)
|
||||
|
||||
/**
|
||||
* Maximum UDate value
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
#define U_DATE_MAX DBL_MAX
|
||||
|
||||
/**
|
||||
* Minimum UDate value
|
||||
* @stable ICU 4.8
|
||||
*/
|
||||
#define U_DATE_MIN -U_DATE_MAX
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Shared library/DLL import-export API control */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* Control of symbol import/export.
|
||||
* ICU is separated into three libraries.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_COMBINED_IMPLEMENTATION
|
||||
* Set to export library symbols from inside the ICU library
|
||||
* when all of ICU is in a single library.
|
||||
* This can be set as a compiler option while building ICU, and it
|
||||
* needs to be the first one tested to override U_COMMON_API, U_I18N_API, etc.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_DATA_API
|
||||
* Set to export library symbols from inside the stubdata library,
|
||||
* and to import them from outside.
|
||||
* @stable ICU 3.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_COMMON_API
|
||||
* Set to export library symbols from inside the common library,
|
||||
* and to import them from outside.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_I18N_API
|
||||
* Set to export library symbols from inside the i18n library,
|
||||
* and to import them from outside.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_LAYOUT_API
|
||||
* Set to export library symbols from inside the layout engine library,
|
||||
* and to import them from outside.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_LAYOUTEX_API
|
||||
* Set to export library symbols from inside the layout extensions library,
|
||||
* and to import them from outside.
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_IO_API
|
||||
* Set to export library symbols from inside the ustdio library,
|
||||
* and to import them from outside.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_TOOLUTIL_API
|
||||
* Set to export library symbols from inside the toolutil library,
|
||||
* and to import them from outside.
|
||||
* @stable ICU 3.4
|
||||
*/
|
||||
|
||||
#if defined(U_COMBINED_IMPLEMENTATION)
|
||||
#define U_DATA_API U_EXPORT
|
||||
#define U_COMMON_API U_EXPORT
|
||||
#define U_I18N_API U_EXPORT
|
||||
#define U_LAYOUT_API U_EXPORT
|
||||
#define U_LAYOUTEX_API U_EXPORT
|
||||
#define U_IO_API U_EXPORT
|
||||
#define U_TOOLUTIL_API U_EXPORT
|
||||
#elif defined(U_STATIC_IMPLEMENTATION)
|
||||
#define U_DATA_API
|
||||
#define U_COMMON_API
|
||||
#define U_I18N_API
|
||||
#define U_LAYOUT_API
|
||||
#define U_LAYOUTEX_API
|
||||
#define U_IO_API
|
||||
#define U_TOOLUTIL_API
|
||||
#elif defined(U_COMMON_IMPLEMENTATION)
|
||||
#define U_DATA_API U_IMPORT
|
||||
#define U_COMMON_API U_EXPORT
|
||||
#define U_I18N_API U_IMPORT
|
||||
#define U_LAYOUT_API U_IMPORT
|
||||
#define U_LAYOUTEX_API U_IMPORT
|
||||
#define U_IO_API U_IMPORT
|
||||
#define U_TOOLUTIL_API U_IMPORT
|
||||
#elif defined(U_I18N_IMPLEMENTATION)
|
||||
#define U_DATA_API U_IMPORT
|
||||
#define U_COMMON_API U_IMPORT
|
||||
#define U_I18N_API U_EXPORT
|
||||
#define U_LAYOUT_API U_IMPORT
|
||||
#define U_LAYOUTEX_API U_IMPORT
|
||||
#define U_IO_API U_IMPORT
|
||||
#define U_TOOLUTIL_API U_IMPORT
|
||||
#elif defined(U_LAYOUT_IMPLEMENTATION)
|
||||
#define U_DATA_API U_IMPORT
|
||||
#define U_COMMON_API U_IMPORT
|
||||
#define U_I18N_API U_IMPORT
|
||||
#define U_LAYOUT_API U_EXPORT
|
||||
#define U_LAYOUTEX_API U_IMPORT
|
||||
#define U_IO_API U_IMPORT
|
||||
#define U_TOOLUTIL_API U_IMPORT
|
||||
#elif defined(U_LAYOUTEX_IMPLEMENTATION)
|
||||
#define U_DATA_API U_IMPORT
|
||||
#define U_COMMON_API U_IMPORT
|
||||
#define U_I18N_API U_IMPORT
|
||||
#define U_LAYOUT_API U_IMPORT
|
||||
#define U_LAYOUTEX_API U_EXPORT
|
||||
#define U_IO_API U_IMPORT
|
||||
#define U_TOOLUTIL_API U_IMPORT
|
||||
#elif defined(U_IO_IMPLEMENTATION)
|
||||
#define U_DATA_API U_IMPORT
|
||||
#define U_COMMON_API U_IMPORT
|
||||
#define U_I18N_API U_IMPORT
|
||||
#define U_LAYOUT_API U_IMPORT
|
||||
#define U_LAYOUTEX_API U_IMPORT
|
||||
#define U_IO_API U_EXPORT
|
||||
#define U_TOOLUTIL_API U_IMPORT
|
||||
#elif defined(U_TOOLUTIL_IMPLEMENTATION)
|
||||
#define U_DATA_API U_IMPORT
|
||||
#define U_COMMON_API U_IMPORT
|
||||
#define U_I18N_API U_IMPORT
|
||||
#define U_LAYOUT_API U_IMPORT
|
||||
#define U_LAYOUTEX_API U_IMPORT
|
||||
#define U_IO_API U_IMPORT
|
||||
#define U_TOOLUTIL_API U_EXPORT
|
||||
#else
|
||||
#define U_DATA_API U_IMPORT
|
||||
#define U_COMMON_API U_IMPORT
|
||||
#define U_I18N_API U_IMPORT
|
||||
#define U_LAYOUT_API U_IMPORT
|
||||
#define U_LAYOUTEX_API U_IMPORT
|
||||
#define U_IO_API U_IMPORT
|
||||
#define U_TOOLUTIL_API U_IMPORT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_STANDARD_CPP_NAMESPACE
|
||||
* Control of C++ Namespace
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define U_STANDARD_CPP_NAMESPACE ::
|
||||
#else
|
||||
#define U_STANDARD_CPP_NAMESPACE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* UErrorCode */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* Error code to replace exception handling, so that the code is compatible with all C++ compilers,
|
||||
* and to use the same mechanism for C and C++.
|
||||
*
|
||||
* \par
|
||||
* ICU functions that take a reference (C++) or a pointer (C) to a UErrorCode
|
||||
* first test if(U_FAILURE(errorCode)) { return immediately; }
|
||||
* so that in a chain of such functions the first one that sets an error code
|
||||
* causes the following ones to not perform any operations.
|
||||
*
|
||||
* \par
|
||||
* Error codes should be tested using U_FAILURE() and U_SUCCESS().
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
typedef enum UErrorCode {
|
||||
/* The ordering of U_ERROR_INFO_START Vs U_USING_FALLBACK_WARNING looks weird
|
||||
* and is that way because VC++ debugger displays first encountered constant,
|
||||
* which is not the what the code is used for
|
||||
*/
|
||||
|
||||
U_USING_FALLBACK_WARNING = -128, /**< A resource bundle lookup returned a fallback result (not an error) */
|
||||
|
||||
U_ERROR_WARNING_START = -128, /**< Start of information results (semantically successful) */
|
||||
|
||||
U_USING_DEFAULT_WARNING = -127, /**< A resource bundle lookup returned a result from the root locale (not an error) */
|
||||
|
||||
U_SAFECLONE_ALLOCATED_WARNING = -126, /**< A SafeClone operation required allocating memory (informational only) */
|
||||
|
||||
U_STATE_OLD_WARNING = -125, /**< ICU has to use compatibility layer to construct the service. Expect performance/memory usage degradation. Consider upgrading */
|
||||
|
||||
U_STRING_NOT_TERMINATED_WARNING = -124,/**< An output string could not be NUL-terminated because output length==destCapacity. */
|
||||
|
||||
U_SORT_KEY_TOO_SHORT_WARNING = -123, /**< Number of levels requested in getBound is higher than the number of levels in the sort key */
|
||||
|
||||
U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */
|
||||
|
||||
U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */
|
||||
|
||||
U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal UErrorCode warning value.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_ERROR_WARNING_LIMIT,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
|
||||
U_ZERO_ERROR = 0, /**< No error, no warning. */
|
||||
|
||||
U_ILLEGAL_ARGUMENT_ERROR = 1, /**< Start of codes indicating failure */
|
||||
U_MISSING_RESOURCE_ERROR = 2, /**< The requested resource cannot be found */
|
||||
U_INVALID_FORMAT_ERROR = 3, /**< Data format is not what is expected */
|
||||
U_FILE_ACCESS_ERROR = 4, /**< The requested file cannot be found */
|
||||
U_INTERNAL_PROGRAM_ERROR = 5, /**< Indicates a bug in the library code */
|
||||
U_MESSAGE_PARSE_ERROR = 6, /**< Unable to parse a message (message format) */
|
||||
U_MEMORY_ALLOCATION_ERROR = 7, /**< Memory allocation error */
|
||||
U_INDEX_OUTOFBOUNDS_ERROR = 8, /**< Trying to access the index that is out of bounds */
|
||||
U_PARSE_ERROR = 9, /**< Equivalent to Java ParseException */
|
||||
U_INVALID_CHAR_FOUND = 10, /**< Character conversion: Unmappable input sequence. In other APIs: Invalid character. */
|
||||
U_TRUNCATED_CHAR_FOUND = 11, /**< Character conversion: Incomplete input sequence. */
|
||||
U_ILLEGAL_CHAR_FOUND = 12, /**< Character conversion: Illegal input sequence/combination of input units. */
|
||||
U_INVALID_TABLE_FORMAT = 13, /**< Conversion table file found, but corrupted */
|
||||
U_INVALID_TABLE_FILE = 14, /**< Conversion table file not found */
|
||||
U_BUFFER_OVERFLOW_ERROR = 15, /**< A result would not fit in the supplied buffer */
|
||||
U_UNSUPPORTED_ERROR = 16, /**< Requested operation not supported in current context */
|
||||
U_RESOURCE_TYPE_MISMATCH = 17, /**< an operation is requested over a resource that does not support it */
|
||||
U_ILLEGAL_ESCAPE_SEQUENCE = 18, /**< ISO-2022 illegal escape sequence */
|
||||
U_UNSUPPORTED_ESCAPE_SEQUENCE = 19, /**< ISO-2022 unsupported escape sequence */
|
||||
U_NO_SPACE_AVAILABLE = 20, /**< No space available for in-buffer expansion for Arabic shaping */
|
||||
U_CE_NOT_FOUND_ERROR = 21, /**< Currently used only while setting variable top, but can be used generally */
|
||||
U_PRIMARY_TOO_LONG_ERROR = 22, /**< User tried to set variable top to a primary that is longer than two bytes */
|
||||
U_STATE_TOO_OLD_ERROR = 23, /**< ICU cannot construct a service from this state, as it is no longer supported */
|
||||
U_TOO_MANY_ALIASES_ERROR = 24, /**< There are too many aliases in the path to the requested resource.
|
||||
It is very possible that a circular alias definition has occurred */
|
||||
U_ENUM_OUT_OF_SYNC_ERROR = 25, /**< UEnumeration out of sync with underlying collection */
|
||||
U_INVARIANT_CONVERSION_ERROR = 26, /**< Unable to convert a UChar* string to char* with the invariant converter. */
|
||||
U_INVALID_STATE_ERROR = 27, /**< Requested operation can not be completed with ICU in its current state */
|
||||
U_COLLATOR_VERSION_MISMATCH = 28, /**< Collator version is not compatible with the base version */
|
||||
U_USELESS_COLLATOR_ERROR = 29, /**< Collator is options only and no base is specified */
|
||||
U_NO_WRITE_PERMISSION = 30, /**< Attempt to modify read-only or constant data. */
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest standard error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_STANDARD_ERROR_LIMIT,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
|
||||
/*
|
||||
* Error codes in the range 0x10000 0x10100 are reserved for Transliterator.
|
||||
*/
|
||||
U_BAD_VARIABLE_DEFINITION=0x10000,/**< Missing '$' or duplicate variable name */
|
||||
U_PARSE_ERROR_START = 0x10000, /**< Start of Transliterator errors */
|
||||
U_MALFORMED_RULE, /**< Elements of a rule are misplaced */
|
||||
U_MALFORMED_SET, /**< A UnicodeSet pattern is invalid*/
|
||||
U_MALFORMED_SYMBOL_REFERENCE, /**< UNUSED as of ICU 2.4 */
|
||||
U_MALFORMED_UNICODE_ESCAPE, /**< A Unicode escape pattern is invalid*/
|
||||
U_MALFORMED_VARIABLE_DEFINITION, /**< A variable definition is invalid */
|
||||
U_MALFORMED_VARIABLE_REFERENCE, /**< A variable reference is invalid */
|
||||
U_MISMATCHED_SEGMENT_DELIMITERS, /**< UNUSED as of ICU 2.4 */
|
||||
U_MISPLACED_ANCHOR_START, /**< A start anchor appears at an illegal position */
|
||||
U_MISPLACED_CURSOR_OFFSET, /**< A cursor offset occurs at an illegal position */
|
||||
U_MISPLACED_QUANTIFIER, /**< A quantifier appears after a segment close delimiter */
|
||||
U_MISSING_OPERATOR, /**< A rule contains no operator */
|
||||
U_MISSING_SEGMENT_CLOSE, /**< UNUSED as of ICU 2.4 */
|
||||
U_MULTIPLE_ANTE_CONTEXTS, /**< More than one ante context */
|
||||
U_MULTIPLE_CURSORS, /**< More than one cursor */
|
||||
U_MULTIPLE_POST_CONTEXTS, /**< More than one post context */
|
||||
U_TRAILING_BACKSLASH, /**< A dangling backslash */
|
||||
U_UNDEFINED_SEGMENT_REFERENCE, /**< A segment reference does not correspond to a defined segment */
|
||||
U_UNDEFINED_VARIABLE, /**< A variable reference does not correspond to a defined variable */
|
||||
U_UNQUOTED_SPECIAL, /**< A special character was not quoted or escaped */
|
||||
U_UNTERMINATED_QUOTE, /**< A closing single quote is missing */
|
||||
U_RULE_MASK_ERROR, /**< A rule is hidden by an earlier more general rule */
|
||||
U_MISPLACED_COMPOUND_FILTER, /**< A compound filter is in an invalid location */
|
||||
U_MULTIPLE_COMPOUND_FILTERS, /**< More than one compound filter */
|
||||
U_INVALID_RBT_SYNTAX, /**< A "::id" rule was passed to the RuleBasedTransliterator parser */
|
||||
U_INVALID_PROPERTY_PATTERN, /**< UNUSED as of ICU 2.4 */
|
||||
U_MALFORMED_PRAGMA, /**< A 'use' pragma is invalid */
|
||||
U_UNCLOSED_SEGMENT, /**< A closing ')' is missing */
|
||||
U_ILLEGAL_CHAR_IN_SEGMENT, /**< UNUSED as of ICU 2.4 */
|
||||
U_VARIABLE_RANGE_EXHAUSTED, /**< Too many stand-ins generated for the given variable range */
|
||||
U_VARIABLE_RANGE_OVERLAP, /**< The variable range overlaps characters used in rules */
|
||||
U_ILLEGAL_CHARACTER, /**< A special character is outside its allowed context */
|
||||
U_INTERNAL_TRANSLITERATOR_ERROR, /**< Internal transliterator system error */
|
||||
U_INVALID_ID, /**< A "::id" rule specifies an unknown transliterator */
|
||||
U_INVALID_FUNCTION, /**< A "&fn()" rule specifies an unknown transliterator */
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal Transliterator error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_PARSE_ERROR_LIMIT,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
|
||||
/*
|
||||
* Error codes in the range 0x10100 0x10200 are reserved for the formatting API.
|
||||
*/
|
||||
U_UNEXPECTED_TOKEN=0x10100, /**< Syntax error in format pattern */
|
||||
U_FMT_PARSE_ERROR_START=0x10100, /**< Start of format library errors */
|
||||
U_MULTIPLE_DECIMAL_SEPARATORS, /**< More than one decimal separator in number pattern */
|
||||
U_MULTIPLE_DECIMAL_SEPERATORS = U_MULTIPLE_DECIMAL_SEPARATORS, /**< Typo: kept for backward compatibility. Use U_MULTIPLE_DECIMAL_SEPARATORS */
|
||||
U_MULTIPLE_EXPONENTIAL_SYMBOLS, /**< More than one exponent symbol in number pattern */
|
||||
U_MALFORMED_EXPONENTIAL_PATTERN, /**< Grouping symbol in exponent pattern */
|
||||
U_MULTIPLE_PERCENT_SYMBOLS, /**< More than one percent symbol in number pattern */
|
||||
U_MULTIPLE_PERMILL_SYMBOLS, /**< More than one permill symbol in number pattern */
|
||||
U_MULTIPLE_PAD_SPECIFIERS, /**< More than one pad symbol in number pattern */
|
||||
U_PATTERN_SYNTAX_ERROR, /**< Syntax error in format pattern */
|
||||
U_ILLEGAL_PAD_POSITION, /**< Pad symbol misplaced in number pattern */
|
||||
U_UNMATCHED_BRACES, /**< Braces do not match in message pattern */
|
||||
U_UNSUPPORTED_PROPERTY, /**< UNUSED as of ICU 2.4 */
|
||||
U_UNSUPPORTED_ATTRIBUTE, /**< UNUSED as of ICU 2.4 */
|
||||
U_ARGUMENT_TYPE_MISMATCH, /**< Argument name and argument index mismatch in MessageFormat functions */
|
||||
U_DUPLICATE_KEYWORD, /**< Duplicate keyword in PluralFormat */
|
||||
U_UNDEFINED_KEYWORD, /**< Undefined Plural keyword */
|
||||
U_DEFAULT_KEYWORD_MISSING, /**< Missing DEFAULT rule in plural rules */
|
||||
U_DECIMAL_NUMBER_SYNTAX_ERROR, /**< Decimal number syntax error */
|
||||
U_FORMAT_INEXACT_ERROR, /**< Cannot format a number exactly and rounding mode is ROUND_UNNECESSARY @stable ICU 4.8 */
|
||||
#ifndef U_HIDE_DRAFT_API
|
||||
U_NUMBER_ARG_OUTOFBOUNDS_ERROR, /**< The argument to a NumberFormatter helper method was out of bounds; the bounds are usually 0 to 999. @draft ICU 61 */
|
||||
#endif // U_HIDE_DRAFT_API
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal formatting API error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_FMT_PARSE_ERROR_LIMIT = 0x10113,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
|
||||
/*
|
||||
* Error codes in the range 0x10200 0x102ff are reserved for BreakIterator.
|
||||
*/
|
||||
U_BRK_INTERNAL_ERROR=0x10200, /**< An internal error (bug) was detected. */
|
||||
U_BRK_ERROR_START=0x10200, /**< Start of codes indicating Break Iterator failures */
|
||||
U_BRK_HEX_DIGITS_EXPECTED, /**< Hex digits expected as part of a escaped char in a rule. */
|
||||
U_BRK_SEMICOLON_EXPECTED, /**< Missing ';' at the end of a RBBI rule. */
|
||||
U_BRK_RULE_SYNTAX, /**< Syntax error in RBBI rule. */
|
||||
U_BRK_UNCLOSED_SET, /**< UnicodeSet writing an RBBI rule missing a closing ']'. */
|
||||
U_BRK_ASSIGN_ERROR, /**< Syntax error in RBBI rule assignment statement. */
|
||||
U_BRK_VARIABLE_REDFINITION, /**< RBBI rule $Variable redefined. */
|
||||
U_BRK_MISMATCHED_PAREN, /**< Mis-matched parentheses in an RBBI rule. */
|
||||
U_BRK_NEW_LINE_IN_QUOTED_STRING, /**< Missing closing quote in an RBBI rule. */
|
||||
U_BRK_UNDEFINED_VARIABLE, /**< Use of an undefined $Variable in an RBBI rule. */
|
||||
U_BRK_INIT_ERROR, /**< Initialization failure. Probable missing ICU Data. */
|
||||
U_BRK_RULE_EMPTY_SET, /**< Rule contains an empty Unicode Set. */
|
||||
U_BRK_UNRECOGNIZED_OPTION, /**< !!option in RBBI rules not recognized. */
|
||||
U_BRK_MALFORMED_RULE_TAG, /**< The {nnn} tag on a rule is malformed */
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal BreakIterator error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_BRK_ERROR_LIMIT,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
|
||||
/*
|
||||
* Error codes in the range 0x10300-0x103ff are reserved for regular expression related errors.
|
||||
*/
|
||||
U_REGEX_INTERNAL_ERROR=0x10300, /**< An internal error (bug) was detected. */
|
||||
U_REGEX_ERROR_START=0x10300, /**< Start of codes indicating Regexp failures */
|
||||
U_REGEX_RULE_SYNTAX, /**< Syntax error in regexp pattern. */
|
||||
U_REGEX_INVALID_STATE, /**< RegexMatcher in invalid state for requested operation */
|
||||
U_REGEX_BAD_ESCAPE_SEQUENCE, /**< Unrecognized backslash escape sequence in pattern */
|
||||
U_REGEX_PROPERTY_SYNTAX, /**< Incorrect Unicode property */
|
||||
U_REGEX_UNIMPLEMENTED, /**< Use of regexp feature that is not yet implemented. */
|
||||
U_REGEX_MISMATCHED_PAREN, /**< Incorrectly nested parentheses in regexp pattern. */
|
||||
U_REGEX_NUMBER_TOO_BIG, /**< Decimal number is too large. */
|
||||
U_REGEX_BAD_INTERVAL, /**< Error in {min,max} interval */
|
||||
U_REGEX_MAX_LT_MIN, /**< In {min,max}, max is less than min. */
|
||||
U_REGEX_INVALID_BACK_REF, /**< Back-reference to a non-existent capture group. */
|
||||
U_REGEX_INVALID_FLAG, /**< Invalid value for match mode flags. */
|
||||
U_REGEX_LOOK_BEHIND_LIMIT, /**< Look-Behind pattern matches must have a bounded maximum length. */
|
||||
U_REGEX_SET_CONTAINS_STRING, /**< Regexps cannot have UnicodeSets containing strings.*/
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
U_REGEX_OCTAL_TOO_BIG, /**< Octal character constants must be <= 0377. @deprecated ICU 54. This error cannot occur. */
|
||||
#endif /* U_HIDE_DEPRECATED_API */
|
||||
U_REGEX_MISSING_CLOSE_BRACKET=U_REGEX_SET_CONTAINS_STRING+2, /**< Missing closing bracket on a bracket expression. */
|
||||
U_REGEX_INVALID_RANGE, /**< In a character range [x-y], x is greater than y. */
|
||||
U_REGEX_STACK_OVERFLOW, /**< Regular expression backtrack stack overflow. */
|
||||
U_REGEX_TIME_OUT, /**< Maximum allowed match time exceeded */
|
||||
U_REGEX_STOPPED_BY_CALLER, /**< Matching operation aborted by user callback fn. */
|
||||
U_REGEX_PATTERN_TOO_BIG, /**< Pattern exceeds limits on size or complexity. @stable ICU 55 */
|
||||
U_REGEX_INVALID_CAPTURE_GROUP_NAME, /**< Invalid capture group name. @stable ICU 55 */
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal regular expression error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_REGEX_ERROR_LIMIT=U_REGEX_STOPPED_BY_CALLER+3,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
|
||||
/*
|
||||
* Error codes in the range 0x10400-0x104ff are reserved for IDNA related error codes.
|
||||
*/
|
||||
U_IDNA_PROHIBITED_ERROR=0x10400,
|
||||
U_IDNA_ERROR_START=0x10400,
|
||||
U_IDNA_UNASSIGNED_ERROR,
|
||||
U_IDNA_CHECK_BIDI_ERROR,
|
||||
U_IDNA_STD3_ASCII_RULES_ERROR,
|
||||
U_IDNA_ACE_PREFIX_ERROR,
|
||||
U_IDNA_VERIFICATION_ERROR,
|
||||
U_IDNA_LABEL_TOO_LONG_ERROR,
|
||||
U_IDNA_ZERO_LENGTH_LABEL_ERROR,
|
||||
U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR,
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal IDNA error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_IDNA_ERROR_LIMIT,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
/*
|
||||
* Aliases for StringPrep
|
||||
*/
|
||||
U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR,
|
||||
U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR,
|
||||
U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR,
|
||||
|
||||
/*
|
||||
* Error codes in the range 0x10500-0x105ff are reserved for Plugin related error codes.
|
||||
*/
|
||||
U_PLUGIN_ERROR_START=0x10500, /**< Start of codes indicating plugin failures */
|
||||
U_PLUGIN_TOO_HIGH=0x10500, /**< The plugin's level is too high to be loaded right now. */
|
||||
U_PLUGIN_DIDNT_SET_LEVEL, /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal plug-in error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_PLUGIN_ERROR_LIMIT,
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* One more than the highest normal error code.
|
||||
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
||||
*/
|
||||
U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT
|
||||
#endif // U_HIDE_DEPRECATED_API
|
||||
} UErrorCode;
|
||||
|
||||
/* Use the following to determine if an UErrorCode represents */
|
||||
/* operational success or failure. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
/**
|
||||
* Does the error code indicate success?
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
static
|
||||
inline UBool U_SUCCESS(UErrorCode code) { return (UBool)(code<=U_ZERO_ERROR); }
|
||||
/**
|
||||
* Does the error code indicate a failure?
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
static
|
||||
inline UBool U_FAILURE(UErrorCode code) { return (UBool)(code>U_ZERO_ERROR); }
|
||||
#else
|
||||
/**
|
||||
* Does the error code indicate success?
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
# define U_SUCCESS(x) ((x)<=U_ZERO_ERROR)
|
||||
/**
|
||||
* Does the error code indicate a failure?
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
# define U_FAILURE(x) ((x)>U_ZERO_ERROR)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return a string for a UErrorCode value.
|
||||
* The string will be the same as the name of the error code constant
|
||||
* in the UErrorCode enum above.
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE const char * U_EXPORT2
|
||||
u_errorName(UErrorCode code);
|
||||
|
||||
|
||||
#endif /* _UTYPES */
|
||||
178
vendor/icu/include/unicode/uvernum.h
vendored
Normal file
178
vendor/icu/include/unicode/uvernum.h
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2000-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*
|
||||
* file name: uvernum.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* Created by: Vladimir Weinstein
|
||||
* Updated by: Steven R. Loomis
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: definitions of ICU version numbers
|
||||
*
|
||||
* This file is included by uversion.h and other files. This file contains only
|
||||
* macros and definitions. The actual version numbers are defined here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* IMPORTANT: When updating version, the following things need to be done:
|
||||
* source/common/unicode/uvernum.h - this file: update major, minor,
|
||||
* patchlevel, suffix, version, short version constants, namespace,
|
||||
* renaming macro, and copyright
|
||||
*
|
||||
* The following files need to be updated as well, which can be done
|
||||
* by running the UNIX makefile target 'update-windows-makefiles' in icu/source.
|
||||
*
|
||||
*
|
||||
* source/common/common.vcxproj - update 'Output file name' on the link tab so
|
||||
* that it contains the new major/minor combination
|
||||
* source/i18n/i18n.vcxproj - same as for the common.vcxproj
|
||||
* source/layoutex/layoutex.vcproj - same
|
||||
* source/stubdata/stubdata.vcproj - same as for the common.vcxproj
|
||||
* source/io/io.vcproj - same as for the common.vcxproj
|
||||
* source/data/makedata.mak - change U_ICUDATA_NAME so that it contains
|
||||
* the new major/minor combination and the Unicode version.
|
||||
*/
|
||||
|
||||
#ifndef UVERNUM_H
|
||||
#define UVERNUM_H
|
||||
|
||||
/** The standard copyright notice that gets compiled into each library.
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_COPYRIGHT_STRING \
|
||||
" Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html "
|
||||
|
||||
/** The current ICU major version as an integer.
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_ICU_VERSION_MAJOR_NUM 61
|
||||
|
||||
/** The current ICU minor version as an integer.
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#define U_ICU_VERSION_MINOR_NUM 1
|
||||
|
||||
/** The current ICU patchlevel version as an integer.
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_ICU_VERSION_PATCHLEVEL_NUM 0
|
||||
|
||||
/** The current ICU build level version as an integer.
|
||||
* This value is for use by ICU clients. It defaults to 0.
|
||||
* @stable ICU 4.0
|
||||
*/
|
||||
#ifndef U_ICU_VERSION_BUILDLEVEL_NUM
|
||||
#define U_ICU_VERSION_BUILDLEVEL_NUM 0
|
||||
#endif
|
||||
|
||||
/** Glued version suffix for renamers
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#define U_ICU_VERSION_SUFFIX _61
|
||||
|
||||
/**
|
||||
* \def U_DEF2_ICU_ENTRY_POINT_RENAME
|
||||
* @internal
|
||||
*/
|
||||
/**
|
||||
* \def U_DEF_ICU_ENTRY_POINT_RENAME
|
||||
* @internal
|
||||
*/
|
||||
/** Glued version suffix function for renamers
|
||||
* This value will change in the subsequent releases of ICU.
|
||||
* If a custom suffix (such as matching library suffixes) is desired, this can be modified.
|
||||
* Note that if present, platform.h may contain an earlier definition of this macro.
|
||||
* \def U_ICU_ENTRY_POINT_RENAME
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
|
||||
#ifndef U_ICU_ENTRY_POINT_RENAME
|
||||
#ifdef U_HAVE_LIB_SUFFIX
|
||||
#define U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z) x ## y ## z
|
||||
#define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y,z) U_DEF_ICU_ENTRY_POINT_RENAME(x,y,z)
|
||||
#define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX,U_LIB_SUFFIX_C_NAME)
|
||||
#else
|
||||
#define U_DEF_ICU_ENTRY_POINT_RENAME(x,y) x ## y
|
||||
#define U_DEF2_ICU_ENTRY_POINT_RENAME(x,y) U_DEF_ICU_ENTRY_POINT_RENAME(x,y)
|
||||
#define U_ICU_ENTRY_POINT_RENAME(x) U_DEF2_ICU_ENTRY_POINT_RENAME(x,U_ICU_VERSION_SUFFIX)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** The current ICU library version as a dotted-decimal string. The patchlevel
|
||||
* only appears in this string if it non-zero.
|
||||
* This value will change in the subsequent releases of ICU
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_ICU_VERSION "61.1"
|
||||
|
||||
/**
|
||||
* The current ICU library major version number as a string, for library name suffixes.
|
||||
* This value will change in subsequent releases of ICU.
|
||||
*
|
||||
* Until ICU 4.8, this was the combination of the single-digit major and minor ICU version numbers
|
||||
* into one string without dots ("48").
|
||||
* Since ICU 49, it is the double-digit major ICU version number.
|
||||
* See http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU
|
||||
*
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
#define U_ICU_VERSION_SHORT "61"
|
||||
|
||||
#ifndef U_HIDE_INTERNAL_API
|
||||
/** Data version in ICU4C.
|
||||
* @internal ICU 4.4 Internal Use Only
|
||||
**/
|
||||
#define U_ICU_DATA_VERSION "61.1"
|
||||
#endif /* U_HIDE_INTERNAL_API */
|
||||
|
||||
/*===========================================================================
|
||||
* ICU collation framework version information
|
||||
* Version info that can be obtained from a collator is affected by these
|
||||
* numbers in a secret and magic way. Please use collator version as whole
|
||||
*===========================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* Collation runtime version (sort key generator, strcoll).
|
||||
* If the version is different, sort keys for the same string could be different.
|
||||
* This value may change in subsequent releases of ICU.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define UCOL_RUNTIME_VERSION 9
|
||||
|
||||
/**
|
||||
* Collation builder code version.
|
||||
* When this is different, the same tailoring might result
|
||||
* in assigning different collation elements to code points.
|
||||
* This value may change in subsequent releases of ICU.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define UCOL_BUILDER_VERSION 9
|
||||
|
||||
#ifndef U_HIDE_DEPRECATED_API
|
||||
/**
|
||||
* Constant 1.
|
||||
* This was intended to be the version of collation tailorings,
|
||||
* but instead the tailoring data carries a version number.
|
||||
* @deprecated ICU 54
|
||||
*/
|
||||
#define UCOL_TAILORINGS_VERSION 1
|
||||
#endif /* U_HIDE_DEPRECATED_API */
|
||||
|
||||
#endif
|
||||
201
vendor/icu/include/unicode/uversion.h
vendored
Normal file
201
vendor/icu/include/unicode/uversion.h
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2000-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
*
|
||||
* file name: uversion.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* Created by: Vladimir Weinstein
|
||||
*
|
||||
* Gets included by utypes.h and Windows .rc files
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: API for accessing ICU version numbers.
|
||||
*/
|
||||
/*===========================================================================*/
|
||||
/* Main ICU version information */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifndef UVERSION_H
|
||||
#define UVERSION_H
|
||||
|
||||
#include <unicode/umachine.h>
|
||||
|
||||
/* Actual version info lives in uvernum.h */
|
||||
#include <unicode/uvernum.h>
|
||||
|
||||
/** Maximum length of the copyright string.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_COPYRIGHT_STRING_LENGTH 128
|
||||
|
||||
/** An ICU version consists of up to 4 numbers from 0..255.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_MAX_VERSION_LENGTH 4
|
||||
|
||||
/** In a string, ICU version fields are delimited by dots.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_VERSION_DELIMITER '.'
|
||||
|
||||
/** The maximum length of an ICU version string.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
#define U_MAX_VERSION_STRING_LENGTH 20
|
||||
|
||||
/** The binary form of a version on ICU APIs is an array of 4 uint8_t.
|
||||
* To compare two versions, use memcmp(v1,v2,sizeof(UVersionInfo)).
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
|
||||
|
||||
/*===========================================================================*/
|
||||
/* C++ namespace if supported. Versioned unless versioning is disabled. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* \def U_NAMESPACE_BEGIN
|
||||
* This is used to begin a declaration of a public ICU C++ API.
|
||||
* When not compiling for C++, it does nothing.
|
||||
* When compiling for C++, it begins an extern "C++" linkage block (to protect
|
||||
* against cases in which an external client includes ICU header files inside
|
||||
* an extern "C" linkage block).
|
||||
*
|
||||
* It also begins a versioned-ICU-namespace block.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_NAMESPACE_END
|
||||
* This is used to end a declaration of a public ICU C++ API.
|
||||
* When not compiling for C++, it does nothing.
|
||||
* When compiling for C++, it ends the extern "C++" block begun by
|
||||
* U_NAMESPACE_BEGIN.
|
||||
*
|
||||
* It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_NAMESPACE_USE
|
||||
* This is used to specify that the rest of the code uses the
|
||||
* public ICU C++ API namespace.
|
||||
* This is invoked by default; we recommend that you turn it off:
|
||||
* See the "Recommended Build Options" section of the ICU4C readme
|
||||
* (http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild)
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
/**
|
||||
* \def U_NAMESPACE_QUALIFIER
|
||||
* This is used to qualify that a function or class is part of
|
||||
* the public ICU C++ API namespace.
|
||||
*
|
||||
* This macro is unnecessary since ICU 49 requires namespace support.
|
||||
* You can just use "icu::" instead.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
|
||||
/* Define C++ namespace symbols. */
|
||||
#ifdef __cplusplus
|
||||
# if U_DISABLE_RENAMING
|
||||
# define U_ICU_NAMESPACE icu
|
||||
namespace U_ICU_NAMESPACE { }
|
||||
# else
|
||||
# define U_ICU_NAMESPACE U_ICU_ENTRY_POINT_RENAME(icu)
|
||||
namespace U_ICU_NAMESPACE { }
|
||||
namespace icu = U_ICU_NAMESPACE;
|
||||
# endif
|
||||
|
||||
# define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
|
||||
# define U_NAMESPACE_END } }
|
||||
# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
|
||||
# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
|
||||
|
||||
# ifndef U_USING_ICU_NAMESPACE
|
||||
# if defined(U_COMBINED_IMPLEMENTATION) || defined(U_COMMON_IMPLEMENTATION) || \
|
||||
defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || \
|
||||
defined(U_LAYOUTEX_IMPLEMENTATION) || defined(U_TOOLUTIL_IMPLEMENTATION)
|
||||
# define U_USING_ICU_NAMESPACE 0
|
||||
# else
|
||||
# define U_USING_ICU_NAMESPACE 0
|
||||
# endif
|
||||
# endif
|
||||
# if U_USING_ICU_NAMESPACE
|
||||
U_NAMESPACE_USE
|
||||
# endif
|
||||
#else
|
||||
# define U_NAMESPACE_BEGIN
|
||||
# define U_NAMESPACE_END
|
||||
# define U_NAMESPACE_USE
|
||||
# define U_NAMESPACE_QUALIFIER
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* General version helper functions. Definitions in putil.c */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* Parse a string with dotted-decimal version information and
|
||||
* fill in a UVersionInfo structure with the result.
|
||||
* Definition of this function lives in putil.c
|
||||
*
|
||||
* @param versionArray The destination structure for the version information.
|
||||
* @param versionString A string with dotted-decimal version information,
|
||||
* with up to four non-negative number fields with
|
||||
* values of up to 255 each.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_versionFromString(UVersionInfo versionArray, const char *versionString);
|
||||
|
||||
/**
|
||||
* Parse a Unicode string with dotted-decimal version information and
|
||||
* fill in a UVersionInfo structure with the result.
|
||||
* Definition of this function lives in putil.c
|
||||
*
|
||||
* @param versionArray The destination structure for the version information.
|
||||
* @param versionString A Unicode string with dotted-decimal version
|
||||
* information, with up to four non-negative number
|
||||
* fields with values of up to 255 each.
|
||||
* @stable ICU 4.2
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_versionFromUString(UVersionInfo versionArray, const UChar *versionString);
|
||||
|
||||
|
||||
/**
|
||||
* Write a string with dotted-decimal version information according
|
||||
* to the input UVersionInfo.
|
||||
* Definition of this function lives in putil.c
|
||||
*
|
||||
* @param versionArray The version information to be written as a string.
|
||||
* @param versionString A string buffer that will be filled in with
|
||||
* a string corresponding to the numeric version
|
||||
* information in versionArray.
|
||||
* The buffer size must be at least U_MAX_VERSION_STRING_LENGTH.
|
||||
* @stable ICU 2.4
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_versionToString(const UVersionInfo versionArray, char *versionString);
|
||||
|
||||
/**
|
||||
* Gets the ICU release version. The version array stores the version information
|
||||
* for ICU. For example, release "1.3.31.2" is then represented as 0x01031F02.
|
||||
* Definition of this function lives in putil.c
|
||||
*
|
||||
* @param versionArray the version # information, the result will be filled in
|
||||
* @stable ICU 2.0
|
||||
*/
|
||||
U_STABLE void U_EXPORT2
|
||||
u_getVersion(UVersionInfo versionArray);
|
||||
#endif
|
||||
138
vendor/icu/src/cmemory.cpp
vendored
Normal file
138
vendor/icu/src/cmemory.cpp
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* File cmemory.c ICU Heap allocation.
|
||||
* All ICU heap allocation, both for C and C++ new of ICU
|
||||
* class types, comes through these functions.
|
||||
*
|
||||
* If you have a need to replace ICU allocation, this is the
|
||||
* place to do it.
|
||||
*
|
||||
* Note that uprv_malloc(0) returns a non-NULL pointer, and
|
||||
* that a subsequent free of that pointer value is a NOP.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
#include <unicode/uclean.h>
|
||||
#include "cmemory.h"
|
||||
#include "putilimp.h"
|
||||
#include "uassert.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
/* uprv_malloc(0) returns a pointer to this read-only data. */
|
||||
static const int32_t zeroMem[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
/* Function Pointers for user-supplied heap functions */
|
||||
static const void *pContext;
|
||||
static UMemAllocFn *pAlloc;
|
||||
static UMemReallocFn *pRealloc;
|
||||
static UMemFreeFn *pFree;
|
||||
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
#include <stdio.h>
|
||||
static int n=0;
|
||||
static long b=0;
|
||||
#endif
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_malloc(size_t s) {
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
#if 1
|
||||
putchar('>');
|
||||
fflush(stdout);
|
||||
#else
|
||||
fprintf(stderr,"MALLOC\t#%d\t%ul bytes\t%ul total\n", ++n,s,(b+=s)); fflush(stderr);
|
||||
#endif
|
||||
#endif
|
||||
if (s > 0) {
|
||||
if (pAlloc) {
|
||||
return (*pAlloc)(pContext, s);
|
||||
} else {
|
||||
return uprv_default_malloc(s);
|
||||
}
|
||||
} else {
|
||||
return (void *)zeroMem;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_realloc(void * buffer, size_t size) {
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
putchar('~');
|
||||
fflush(stdout);
|
||||
#endif
|
||||
if (buffer == zeroMem) {
|
||||
return uprv_malloc(size);
|
||||
} else if (size == 0) {
|
||||
if (pFree) {
|
||||
(*pFree)(pContext, buffer);
|
||||
} else {
|
||||
uprv_default_free(buffer);
|
||||
}
|
||||
return (void *)zeroMem;
|
||||
} else {
|
||||
if (pRealloc) {
|
||||
return (*pRealloc)(pContext, buffer, size);
|
||||
} else {
|
||||
return uprv_default_realloc(buffer, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uprv_free(void *buffer) {
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
putchar('<');
|
||||
fflush(stdout);
|
||||
#endif
|
||||
if (buffer != zeroMem) {
|
||||
if (pFree) {
|
||||
(*pFree)(pContext, buffer);
|
||||
} else {
|
||||
uprv_default_free(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_calloc(size_t num, size_t size) {
|
||||
void *mem = NULL;
|
||||
size *= num;
|
||||
mem = uprv_malloc(size);
|
||||
if (mem) {
|
||||
uprv_memset(mem, 0, size);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMemFreeFn *f, UErrorCode *status)
|
||||
{
|
||||
if (U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
if (a==NULL || r==NULL || f==NULL) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
pContext = context;
|
||||
pAlloc = a;
|
||||
pRealloc = r;
|
||||
pFree = f;
|
||||
}
|
||||
|
||||
|
||||
U_CFUNC UBool cmemory_cleanup(void) {
|
||||
pContext = NULL;
|
||||
pAlloc = NULL;
|
||||
pRealloc = NULL;
|
||||
pFree = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
638
vendor/icu/src/cmemory.h
vendored
Normal file
638
vendor/icu/src/cmemory.h
vendored
Normal file
@@ -0,0 +1,638 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* File CMEMORY.H
|
||||
*
|
||||
* Contains stdlib.h/string.h memory functions
|
||||
*
|
||||
* @author Bertrand A. Damiba
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 6/20/98 Bertrand Created.
|
||||
* 05/03/99 stephen Changed from functions to macros.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef CMEMORY_H
|
||||
#define CMEMORY_H
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <unicode/localpointer.h>
|
||||
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define uprv_memcpy(dst, src, size) U_STANDARD_CPP_NAMESPACE memcpy(dst, src, size)
|
||||
#define uprv_memmove(dst, src, size) U_STANDARD_CPP_NAMESPACE memmove(dst, src, size)
|
||||
|
||||
/**
|
||||
* \def UPRV_LENGTHOF
|
||||
* Convenience macro to determine the length of a fixed array at compile-time.
|
||||
* @param array A fixed length array
|
||||
* @return The length of the array, in elements
|
||||
* @internal
|
||||
*/
|
||||
#define UPRV_LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
|
||||
#define uprv_memset(buffer, mark, size) U_STANDARD_CPP_NAMESPACE memset(buffer, mark, size)
|
||||
#define uprv_memcmp(buffer1, buffer2, size) U_STANDARD_CPP_NAMESPACE memcmp(buffer1, buffer2,size)
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_malloc(size_t s) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR(1);
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_realloc(void *mem, size_t size) U_ALLOC_SIZE_ATTR(2);
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uprv_free(void *mem);
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uprv_calloc(size_t num, size_t size) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR2(1,2);
|
||||
|
||||
/**
|
||||
* This should align the memory properly on any machine.
|
||||
* This is very useful for the safeClone functions.
|
||||
*/
|
||||
typedef union {
|
||||
long t1;
|
||||
double t2;
|
||||
void *t3;
|
||||
} UAlignedMemory;
|
||||
|
||||
/**
|
||||
* Get the least significant bits of a pointer (a memory address).
|
||||
* For example, with a mask of 3, the macro gets the 2 least significant bits,
|
||||
* which will be 0 if the pointer is 32-bit (4-byte) aligned.
|
||||
*
|
||||
* ptrdiff_t is the most appropriate integer type to cast to.
|
||||
* size_t should work too, since on most (or all?) platforms it has the same
|
||||
* width as ptrdiff_t.
|
||||
*/
|
||||
#define U_POINTER_MASK_LSB(ptr, mask) (((ptrdiff_t)(char *)(ptr)) & (mask))
|
||||
|
||||
/**
|
||||
* Get the amount of bytes that a pointer is off by from
|
||||
* the previous UAlignedMemory-aligned pointer.
|
||||
*/
|
||||
#define U_ALIGNMENT_OFFSET(ptr) U_POINTER_MASK_LSB(ptr, sizeof(UAlignedMemory) - 1)
|
||||
|
||||
/**
|
||||
* Get the amount of bytes to add to a pointer
|
||||
* in order to get the next UAlignedMemory-aligned address.
|
||||
*/
|
||||
#define U_ALIGNMENT_OFFSET_UP(ptr) (sizeof(UAlignedMemory) - U_ALIGNMENT_OFFSET(ptr))
|
||||
|
||||
/**
|
||||
* Heap clean up function, called from u_cleanup()
|
||||
* Clears any user heap functions from u_setMemoryFunctions()
|
||||
* Does NOT deallocate any remaining allocated memory.
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
cmemory_cleanup(void);
|
||||
|
||||
/**
|
||||
* A function called by <TT>uhash_remove</TT>,
|
||||
* <TT>uhash_close</TT>, or <TT>uhash_put</TT> to delete
|
||||
* an existing key or value.
|
||||
* @param obj A key or value stored in a hashtable
|
||||
* @see uprv_deleteUObject
|
||||
*/
|
||||
typedef void U_CALLCONV UObjectDeleter(void* obj);
|
||||
|
||||
/**
|
||||
* Deleter for UObject instances.
|
||||
* Works for all subclasses of UObject because it has a virtual destructor.
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
uprv_deleteUObject(void *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
* "Smart pointer" class, deletes memory via uprv_free().
|
||||
* For most methods see the LocalPointerBase base class.
|
||||
* Adds operator[] for array item access.
|
||||
*
|
||||
* @see LocalPointerBase
|
||||
*/
|
||||
template<typename T>
|
||||
class LocalMemory : public LocalPointerBase<T> {
|
||||
public:
|
||||
using LocalPointerBase<T>::operator*;
|
||||
using LocalPointerBase<T>::operator->;
|
||||
/**
|
||||
* Constructor takes ownership.
|
||||
* @param p simple pointer to an array of T items that is adopted
|
||||
*/
|
||||
explicit LocalMemory(T *p=NULL) : LocalPointerBase<T>(p) {}
|
||||
/**
|
||||
* Move constructor, leaves src with isNull().
|
||||
* @param src source smart pointer
|
||||
*/
|
||||
LocalMemory(LocalMemory<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
|
||||
src.ptr=NULL;
|
||||
}
|
||||
/**
|
||||
* Destructor deletes the memory it owns.
|
||||
*/
|
||||
~LocalMemory() {
|
||||
uprv_free(LocalPointerBase<T>::ptr);
|
||||
}
|
||||
/**
|
||||
* Move assignment operator, leaves src with isNull().
|
||||
* The behavior is undefined if *this and src are the same object.
|
||||
* @param src source smart pointer
|
||||
* @return *this
|
||||
*/
|
||||
LocalMemory<T> &operator=(LocalMemory<T> &&src) U_NOEXCEPT {
|
||||
return moveFrom(src);
|
||||
}
|
||||
/**
|
||||
* Move assignment, leaves src with isNull().
|
||||
* The behavior is undefined if *this and src are the same object.
|
||||
*
|
||||
* Can be called explicitly, does not need C++11 support.
|
||||
* @param src source smart pointer
|
||||
* @return *this
|
||||
*/
|
||||
LocalMemory<T> &moveFrom(LocalMemory<T> &src) U_NOEXCEPT {
|
||||
delete[] LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=src.ptr;
|
||||
src.ptr=NULL;
|
||||
return *this;
|
||||
}
|
||||
/**
|
||||
* Swap pointers.
|
||||
* @param other other smart pointer
|
||||
*/
|
||||
void swap(LocalMemory<T> &other) U_NOEXCEPT {
|
||||
T *temp=LocalPointerBase<T>::ptr;
|
||||
LocalPointerBase<T>::ptr=other.ptr;
|
||||
other.ptr=temp;
|
||||
}
|
||||
/**
|
||||
* Non-member LocalMemory swap function.
|
||||
* @param p1 will get p2's pointer
|
||||
* @param p2 will get p1's pointer
|
||||
*/
|
||||
friend inline void swap(LocalMemory<T> &p1, LocalMemory<T> &p2) U_NOEXCEPT {
|
||||
p1.swap(p2);
|
||||
}
|
||||
/**
|
||||
* Deletes the array it owns,
|
||||
* and adopts (takes ownership of) the one passed in.
|
||||
* @param p simple pointer to an array of T items that is adopted
|
||||
*/
|
||||
void adoptInstead(T *p) {
|
||||
uprv_free(LocalPointerBase<T>::ptr);
|
||||
LocalPointerBase<T>::ptr=p;
|
||||
}
|
||||
/**
|
||||
* Deletes the array it owns, allocates a new one and reset its bytes to 0.
|
||||
* Returns the new array pointer.
|
||||
* If the allocation fails, then the current array is unchanged and
|
||||
* this method returns NULL.
|
||||
* @param newCapacity must be >0
|
||||
* @return the allocated array pointer, or NULL if the allocation failed
|
||||
*/
|
||||
inline T *allocateInsteadAndReset(int32_t newCapacity=1);
|
||||
/**
|
||||
* Deletes the array it owns and allocates a new one, copying length T items.
|
||||
* Returns the new array pointer.
|
||||
* If the allocation fails, then the current array is unchanged and
|
||||
* this method returns NULL.
|
||||
* @param newCapacity must be >0
|
||||
* @param length number of T items to be copied from the old array to the new one;
|
||||
* must be no more than the capacity of the old array,
|
||||
* which the caller must track because the LocalMemory does not track it
|
||||
* @return the allocated array pointer, or NULL if the allocation failed
|
||||
*/
|
||||
inline T *allocateInsteadAndCopy(int32_t newCapacity=1, int32_t length=0);
|
||||
/**
|
||||
* Array item access (writable).
|
||||
* No index bounds check.
|
||||
* @param i array index
|
||||
* @return reference to the array item
|
||||
*/
|
||||
T &operator[](ptrdiff_t i) const { return LocalPointerBase<T>::ptr[i]; }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline T *LocalMemory<T>::allocateInsteadAndReset(int32_t newCapacity) {
|
||||
if(newCapacity>0) {
|
||||
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
|
||||
if(p!=NULL) {
|
||||
uprv_memset(p, 0, newCapacity*sizeof(T));
|
||||
uprv_free(LocalPointerBase<T>::ptr);
|
||||
LocalPointerBase<T>::ptr=p;
|
||||
}
|
||||
return p;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t length) {
|
||||
if(newCapacity>0) {
|
||||
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
|
||||
if(p!=NULL) {
|
||||
if(length>0) {
|
||||
if(length>newCapacity) {
|
||||
length=newCapacity;
|
||||
}
|
||||
uprv_memcpy(p, LocalPointerBase<T>::ptr, (size_t)length*sizeof(T));
|
||||
}
|
||||
uprv_free(LocalPointerBase<T>::ptr);
|
||||
LocalPointerBase<T>::ptr=p;
|
||||
}
|
||||
return p;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple array/buffer management class using uprv_malloc() and uprv_free().
|
||||
* Provides an internal array with fixed capacity. Can alias another array
|
||||
* or allocate one.
|
||||
*
|
||||
* The array address is properly aligned for type T. It might not be properly
|
||||
* aligned for types larger than T (or larger than the largest subtype of T).
|
||||
*
|
||||
* Unlike LocalMemory and LocalArray, this class never adopts
|
||||
* (takes ownership of) another array.
|
||||
*/
|
||||
template<typename T, int32_t stackCapacity>
|
||||
class MaybeStackArray {
|
||||
public:
|
||||
/**
|
||||
* Default constructor initializes with internal T[stackCapacity] buffer.
|
||||
*/
|
||||
MaybeStackArray() : ptr(stackArray), capacity(stackCapacity), needToRelease(FALSE) {}
|
||||
/**
|
||||
* Automatically allocates the heap array if the argument is larger than the stack capacity.
|
||||
* Intended for use when an approximate capacity is known at compile time but the true
|
||||
* capacity is not known until runtime.
|
||||
*/
|
||||
MaybeStackArray(int32_t newCapacity) : MaybeStackArray() {
|
||||
if (capacity < newCapacity) { resize(newCapacity); }
|
||||
};
|
||||
/**
|
||||
* Destructor deletes the array (if owned).
|
||||
*/
|
||||
~MaybeStackArray() { releaseArray(); }
|
||||
/**
|
||||
* Returns the array capacity (number of T items).
|
||||
* @return array capacity
|
||||
*/
|
||||
int32_t getCapacity() const { return capacity; }
|
||||
/**
|
||||
* Access without ownership change.
|
||||
* @return the array pointer
|
||||
*/
|
||||
T *getAlias() const { return ptr; }
|
||||
/**
|
||||
* Returns the array limit. Simple convenience method.
|
||||
* @return getAlias()+getCapacity()
|
||||
*/
|
||||
T *getArrayLimit() const { return getAlias()+capacity; }
|
||||
// No "operator T *() const" because that can make
|
||||
// expressions like mbs[index] ambiguous for some compilers.
|
||||
/**
|
||||
* Array item access (const).
|
||||
* No index bounds check.
|
||||
* @param i array index
|
||||
* @return reference to the array item
|
||||
*/
|
||||
const T &operator[](ptrdiff_t i) const { return ptr[i]; }
|
||||
/**
|
||||
* Array item access (writable).
|
||||
* No index bounds check.
|
||||
* @param i array index
|
||||
* @return reference to the array item
|
||||
*/
|
||||
T &operator[](ptrdiff_t i) { return ptr[i]; }
|
||||
/**
|
||||
* Deletes the array (if owned) and aliases another one, no transfer of ownership.
|
||||
* If the arguments are illegal, then the current array is unchanged.
|
||||
* @param otherArray must not be NULL
|
||||
* @param otherCapacity must be >0
|
||||
*/
|
||||
void aliasInstead(T *otherArray, int32_t otherCapacity) {
|
||||
if(otherArray!=NULL && otherCapacity>0) {
|
||||
releaseArray();
|
||||
ptr=otherArray;
|
||||
capacity=otherCapacity;
|
||||
needToRelease=FALSE;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Deletes the array (if owned) and allocates a new one, copying length T items.
|
||||
* Returns the new array pointer.
|
||||
* If the allocation fails, then the current array is unchanged and
|
||||
* this method returns NULL.
|
||||
* @param newCapacity can be less than or greater than the current capacity;
|
||||
* must be >0
|
||||
* @param length number of T items to be copied from the old array to the new one
|
||||
* @return the allocated array pointer, or NULL if the allocation failed
|
||||
*/
|
||||
inline T *resize(int32_t newCapacity, int32_t length=0);
|
||||
/**
|
||||
* Gives up ownership of the array if owned, or else clones it,
|
||||
* copying length T items; resets itself to the internal stack array.
|
||||
* Returns NULL if the allocation failed.
|
||||
* @param length number of T items to copy when cloning,
|
||||
* and capacity of the clone when cloning
|
||||
* @param resultCapacity will be set to the returned array's capacity (output-only)
|
||||
* @return the array pointer;
|
||||
* caller becomes responsible for deleting the array
|
||||
*/
|
||||
inline T *orphanOrClone(int32_t length, int32_t &resultCapacity);
|
||||
private:
|
||||
T *ptr;
|
||||
int32_t capacity;
|
||||
UBool needToRelease;
|
||||
T stackArray[stackCapacity];
|
||||
void releaseArray() {
|
||||
if(needToRelease) {
|
||||
uprv_free(ptr);
|
||||
}
|
||||
}
|
||||
/* No comparison operators with other MaybeStackArray's. */
|
||||
bool operator==(const MaybeStackArray & /*other*/) {return FALSE;}
|
||||
bool operator!=(const MaybeStackArray & /*other*/) {return TRUE;}
|
||||
/* No ownership transfer: No copy constructor, no assignment operator. */
|
||||
MaybeStackArray(const MaybeStackArray & /*other*/) {}
|
||||
void operator=(const MaybeStackArray & /*other*/) {}
|
||||
|
||||
// No heap allocation. Use only on the stack.
|
||||
// (Declaring these functions private triggers a cascade of problems:
|
||||
// MSVC insists on exporting an instantiation of MaybeStackArray, which
|
||||
// requires that all functions be defined.
|
||||
// An empty implementation of new() is rejected, it must return a value.
|
||||
// Returning NULL is rejected by gcc for operator new.
|
||||
// The expedient thing is just not to override operator new.
|
||||
// While relatively pointless, heap allocated instances will function.
|
||||
// static void * U_EXPORT2 operator new(size_t size);
|
||||
// static void * U_EXPORT2 operator new[](size_t size);
|
||||
#if U_HAVE_PLACEMENT_NEW
|
||||
// static void * U_EXPORT2 operator new(size_t, void *ptr);
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename T, int32_t stackCapacity>
|
||||
inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t length) {
|
||||
if(newCapacity>0) {
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
::fprintf(::stderr,"MaybeStacArray (resize) alloc %d * %lu\n", newCapacity,sizeof(T));
|
||||
#endif
|
||||
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
|
||||
if(p!=NULL) {
|
||||
if(length>0) {
|
||||
if(length>capacity) {
|
||||
length=capacity;
|
||||
}
|
||||
if(length>newCapacity) {
|
||||
length=newCapacity;
|
||||
}
|
||||
uprv_memcpy(p, ptr, (size_t)length*sizeof(T));
|
||||
}
|
||||
releaseArray();
|
||||
ptr=p;
|
||||
capacity=newCapacity;
|
||||
needToRelease=TRUE;
|
||||
}
|
||||
return p;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, int32_t stackCapacity>
|
||||
inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32_t &resultCapacity) {
|
||||
T *p;
|
||||
if(needToRelease) {
|
||||
p=ptr;
|
||||
} else if(length<=0) {
|
||||
return NULL;
|
||||
} else {
|
||||
if(length>capacity) {
|
||||
length=capacity;
|
||||
}
|
||||
p=(T *)uprv_malloc(length*sizeof(T));
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
::fprintf(::stderr,"MaybeStacArray (orphan) alloc %d * %lu\n", length,sizeof(T));
|
||||
#endif
|
||||
if(p==NULL) {
|
||||
return NULL;
|
||||
}
|
||||
uprv_memcpy(p, ptr, (size_t)length*sizeof(T));
|
||||
}
|
||||
resultCapacity=length;
|
||||
ptr=stackArray;
|
||||
capacity=stackCapacity;
|
||||
needToRelease=FALSE;
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* Variant of MaybeStackArray that allocates a header struct and an array
|
||||
* in one contiguous memory block, using uprv_malloc() and uprv_free().
|
||||
* Provides internal memory with fixed array capacity. Can alias another memory
|
||||
* block or allocate one.
|
||||
* The stackCapacity is the number of T items in the internal memory,
|
||||
* not counting the H header.
|
||||
* Unlike LocalMemory and LocalArray, this class never adopts
|
||||
* (takes ownership of) another memory block.
|
||||
*/
|
||||
template<typename H, typename T, int32_t stackCapacity>
|
||||
class MaybeStackHeaderAndArray {
|
||||
public:
|
||||
/**
|
||||
* Default constructor initializes with internal H+T[stackCapacity] buffer.
|
||||
*/
|
||||
MaybeStackHeaderAndArray() : ptr(&stackHeader), capacity(stackCapacity), needToRelease(FALSE) {}
|
||||
/**
|
||||
* Destructor deletes the memory (if owned).
|
||||
*/
|
||||
~MaybeStackHeaderAndArray() { releaseMemory(); }
|
||||
/**
|
||||
* Returns the array capacity (number of T items).
|
||||
* @return array capacity
|
||||
*/
|
||||
int32_t getCapacity() const { return capacity; }
|
||||
/**
|
||||
* Access without ownership change.
|
||||
* @return the header pointer
|
||||
*/
|
||||
H *getAlias() const { return ptr; }
|
||||
/**
|
||||
* Returns the array start.
|
||||
* @return array start, same address as getAlias()+1
|
||||
*/
|
||||
T *getArrayStart() const { return reinterpret_cast<T *>(getAlias()+1); }
|
||||
/**
|
||||
* Returns the array limit.
|
||||
* @return array limit
|
||||
*/
|
||||
T *getArrayLimit() const { return getArrayStart()+capacity; }
|
||||
/**
|
||||
* Access without ownership change. Same as getAlias().
|
||||
* A class instance can be used directly in expressions that take a T *.
|
||||
* @return the header pointer
|
||||
*/
|
||||
operator H *() const { return ptr; }
|
||||
/**
|
||||
* Array item access (writable).
|
||||
* No index bounds check.
|
||||
* @param i array index
|
||||
* @return reference to the array item
|
||||
*/
|
||||
T &operator[](ptrdiff_t i) { return getArrayStart()[i]; }
|
||||
/**
|
||||
* Deletes the memory block (if owned) and aliases another one, no transfer of ownership.
|
||||
* If the arguments are illegal, then the current memory is unchanged.
|
||||
* @param otherArray must not be NULL
|
||||
* @param otherCapacity must be >0
|
||||
*/
|
||||
void aliasInstead(H *otherMemory, int32_t otherCapacity) {
|
||||
if(otherMemory!=NULL && otherCapacity>0) {
|
||||
releaseMemory();
|
||||
ptr=otherMemory;
|
||||
capacity=otherCapacity;
|
||||
needToRelease=FALSE;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Deletes the memory block (if owned) and allocates a new one,
|
||||
* copying the header and length T array items.
|
||||
* Returns the new header pointer.
|
||||
* If the allocation fails, then the current memory is unchanged and
|
||||
* this method returns NULL.
|
||||
* @param newCapacity can be less than or greater than the current capacity;
|
||||
* must be >0
|
||||
* @param length number of T items to be copied from the old array to the new one
|
||||
* @return the allocated pointer, or NULL if the allocation failed
|
||||
*/
|
||||
inline H *resize(int32_t newCapacity, int32_t length=0);
|
||||
/**
|
||||
* Gives up ownership of the memory if owned, or else clones it,
|
||||
* copying the header and length T array items; resets itself to the internal memory.
|
||||
* Returns NULL if the allocation failed.
|
||||
* @param length number of T items to copy when cloning,
|
||||
* and array capacity of the clone when cloning
|
||||
* @param resultCapacity will be set to the returned array's capacity (output-only)
|
||||
* @return the header pointer;
|
||||
* caller becomes responsible for deleting the array
|
||||
*/
|
||||
inline H *orphanOrClone(int32_t length, int32_t &resultCapacity);
|
||||
private:
|
||||
H *ptr;
|
||||
int32_t capacity;
|
||||
UBool needToRelease;
|
||||
// stackHeader must precede stackArray immediately.
|
||||
H stackHeader;
|
||||
T stackArray[stackCapacity];
|
||||
void releaseMemory() {
|
||||
if(needToRelease) {
|
||||
uprv_free(ptr);
|
||||
}
|
||||
}
|
||||
/* No comparison operators with other MaybeStackHeaderAndArray's. */
|
||||
bool operator==(const MaybeStackHeaderAndArray & /*other*/) {return FALSE;}
|
||||
bool operator!=(const MaybeStackHeaderAndArray & /*other*/) {return TRUE;}
|
||||
/* No ownership transfer: No copy constructor, no assignment operator. */
|
||||
MaybeStackHeaderAndArray(const MaybeStackHeaderAndArray & /*other*/) {}
|
||||
void operator=(const MaybeStackHeaderAndArray & /*other*/) {}
|
||||
|
||||
// No heap allocation. Use only on the stack.
|
||||
// (Declaring these functions private triggers a cascade of problems;
|
||||
// see the MaybeStackArray class for details.)
|
||||
// static void * U_EXPORT2 operator new(size_t size);
|
||||
// static void * U_EXPORT2 operator new[](size_t size);
|
||||
#if U_HAVE_PLACEMENT_NEW
|
||||
// static void * U_EXPORT2 operator new(size_t, void *ptr);
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename H, typename T, int32_t stackCapacity>
|
||||
inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::resize(int32_t newCapacity,
|
||||
int32_t length) {
|
||||
if(newCapacity>=0) {
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
::fprintf(::stderr,"MaybeStackHeaderAndArray alloc %d + %d * %ul\n", sizeof(H),newCapacity,sizeof(T));
|
||||
#endif
|
||||
H *p=(H *)uprv_malloc(sizeof(H)+newCapacity*sizeof(T));
|
||||
if(p!=NULL) {
|
||||
if(length<0) {
|
||||
length=0;
|
||||
} else if(length>0) {
|
||||
if(length>capacity) {
|
||||
length=capacity;
|
||||
}
|
||||
if(length>newCapacity) {
|
||||
length=newCapacity;
|
||||
}
|
||||
}
|
||||
uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T));
|
||||
releaseMemory();
|
||||
ptr=p;
|
||||
capacity=newCapacity;
|
||||
needToRelease=TRUE;
|
||||
}
|
||||
return p;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename H, typename T, int32_t stackCapacity>
|
||||
inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t length,
|
||||
int32_t &resultCapacity) {
|
||||
H *p;
|
||||
if(needToRelease) {
|
||||
p=ptr;
|
||||
} else {
|
||||
if(length<0) {
|
||||
length=0;
|
||||
} else if(length>capacity) {
|
||||
length=capacity;
|
||||
}
|
||||
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
|
||||
::fprintf(::stderr,"MaybeStackHeaderAndArray (orphan) alloc %ul + %d * %lu\n", sizeof(H),length,sizeof(T));
|
||||
#endif
|
||||
p=(H *)uprv_malloc(sizeof(H)+length*sizeof(T));
|
||||
if(p==NULL) {
|
||||
return NULL;
|
||||
}
|
||||
uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T));
|
||||
}
|
||||
resultCapacity=length;
|
||||
ptr=&stackHeader;
|
||||
capacity=stackCapacity;
|
||||
needToRelease=FALSE;
|
||||
return p;
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* __cplusplus */
|
||||
#endif /* CMEMORY_H */
|
||||
341
vendor/icu/src/cstring.cpp
vendored
Normal file
341
vendor/icu/src/cstring.cpp
vendored
Normal file
@@ -0,0 +1,341 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* File CSTRING.C
|
||||
*
|
||||
* @author Helena Shih
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 6/18/98 hshih Created
|
||||
* 09/08/98 stephen Added include for ctype, for Mac Port
|
||||
* 11/15/99 helena Integrated S/390 IEEE changes.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unicode/utypes.h>
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "uassert.h"
|
||||
|
||||
/*
|
||||
* We hardcode case conversion for invariant characters to match our expectation
|
||||
* and the compiler execution charset.
|
||||
* This prevents problems on systems
|
||||
* - with non-default casing behavior, like Turkish system locales where
|
||||
* tolower('I') maps to dotless i and toupper('i') maps to dotted I
|
||||
* - where there are no lowercase Latin characters at all, or using different
|
||||
* codes (some old EBCDIC codepages)
|
||||
*
|
||||
* This works because the compiler usually runs on a platform where the execution
|
||||
* charset includes all of the invariant characters at their expected
|
||||
* code positions, so that the char * string literals in ICU code match
|
||||
* the char literals here.
|
||||
*
|
||||
* Note that the set of lowercase Latin letters is discontiguous in EBCDIC
|
||||
* and the set of uppercase Latin letters is discontiguous as well.
|
||||
*/
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uprv_isASCIILetter(char c) {
|
||||
#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
return
|
||||
('a'<=c && c<='i') || ('j'<=c && c<='r') || ('s'<=c && c<='z') ||
|
||||
('A'<=c && c<='I') || ('J'<=c && c<='R') || ('S'<=c && c<='Z');
|
||||
#else
|
||||
return ('a'<=c && c<='z') || ('A'<=c && c<='Z');
|
||||
#endif
|
||||
}
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_toupper(char c) {
|
||||
#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
if(('a'<=c && c<='i') || ('j'<=c && c<='r') || ('s'<=c && c<='z')) {
|
||||
c=(char)(c+('A'-'a'));
|
||||
}
|
||||
#else
|
||||
if('a'<=c && c<='z') {
|
||||
c=(char)(c+('A'-'a'));
|
||||
}
|
||||
#endif
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Commented out because cstring.h defines uprv_tolower() to be
|
||||
* the same as either uprv_asciitolower() or uprv_ebcdictolower()
|
||||
* to reduce the amount of code to cover with tests.
|
||||
*
|
||||
* Note that this uprv_tolower() definition is likely to work for most
|
||||
* charset families, not just ASCII and EBCDIC, because its #else branch
|
||||
* is written generically.
|
||||
*/
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_tolower(char c) {
|
||||
#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
if(('A'<=c && c<='I') || ('J'<=c && c<='R') || ('S'<=c && c<='Z')) {
|
||||
c=(char)(c+('a'-'A'));
|
||||
}
|
||||
#else
|
||||
if('A'<=c && c<='Z') {
|
||||
c=(char)(c+('a'-'A'));
|
||||
}
|
||||
#endif
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_asciitolower(char c) {
|
||||
if(0x41<=c && c<=0x5a) {
|
||||
c=(char)(c+0x20);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_ebcdictolower(char c) {
|
||||
if( (0xc1<=(uint8_t)c && (uint8_t)c<=0xc9) ||
|
||||
(0xd1<=(uint8_t)c && (uint8_t)c<=0xd9) ||
|
||||
(0xe2<=(uint8_t)c && (uint8_t)c<=0xe9)
|
||||
) {
|
||||
c=(char)(c-0x40);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
U_CAPI char* U_EXPORT2
|
||||
T_CString_toLowerCase(char* str)
|
||||
{
|
||||
char* origPtr = str;
|
||||
|
||||
if (str) {
|
||||
do
|
||||
*str = (char)uprv_tolower(*str);
|
||||
while (*(str++));
|
||||
}
|
||||
|
||||
return origPtr;
|
||||
}
|
||||
|
||||
U_CAPI char* U_EXPORT2
|
||||
T_CString_toUpperCase(char* str)
|
||||
{
|
||||
char* origPtr = str;
|
||||
|
||||
if (str) {
|
||||
do
|
||||
*str = (char)uprv_toupper(*str);
|
||||
while (*(str++));
|
||||
}
|
||||
|
||||
return origPtr;
|
||||
}
|
||||
|
||||
/*
|
||||
* Takes a int32_t and fills in a char* string with that number "radix"-based.
|
||||
* Does not handle negative values (makes an empty string for them).
|
||||
* Writes at most 12 chars ("-2147483647" plus NUL).
|
||||
* Returns the length of the string (not including the NUL).
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
T_CString_integerToString(char* buffer, int32_t v, int32_t radix)
|
||||
{
|
||||
char tbuf[30];
|
||||
int32_t tbx = sizeof(tbuf);
|
||||
uint8_t digit;
|
||||
int32_t length = 0;
|
||||
uint32_t uval;
|
||||
|
||||
U_ASSERT(radix>=2 && radix<=16);
|
||||
uval = (uint32_t) v;
|
||||
if(v<0 && radix == 10) {
|
||||
/* Only in base 10 do we conside numbers to be signed. */
|
||||
uval = (uint32_t)(-v);
|
||||
buffer[length++] = '-';
|
||||
}
|
||||
|
||||
tbx = sizeof(tbuf)-1;
|
||||
tbuf[tbx] = 0; /* We are generating the digits backwards. Null term the end. */
|
||||
do {
|
||||
digit = (uint8_t)(uval % radix);
|
||||
tbuf[--tbx] = (char)(T_CString_itosOffset(digit));
|
||||
uval = uval / radix;
|
||||
} while (uval != 0);
|
||||
|
||||
/* copy converted number into user buffer */
|
||||
uprv_strcpy(buffer+length, tbuf+tbx);
|
||||
length += sizeof(tbuf) - tbx -1;
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Takes a int64_t and fills in a char* string with that number "radix"-based.
|
||||
* Writes at most 21: chars ("-9223372036854775807" plus NUL).
|
||||
* Returns the length of the string, not including the terminating NULL.
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
T_CString_int64ToString(char* buffer, int64_t v, uint32_t radix)
|
||||
{
|
||||
char tbuf[30];
|
||||
int32_t tbx = sizeof(tbuf);
|
||||
uint8_t digit;
|
||||
int32_t length = 0;
|
||||
uint64_t uval;
|
||||
|
||||
U_ASSERT(radix>=2 && radix<=16);
|
||||
uval = (uint64_t) v;
|
||||
if(v<0 && radix == 10) {
|
||||
/* Only in base 10 do we conside numbers to be signed. */
|
||||
uval = (uint64_t)(-v);
|
||||
buffer[length++] = '-';
|
||||
}
|
||||
|
||||
tbx = sizeof(tbuf)-1;
|
||||
tbuf[tbx] = 0; /* We are generating the digits backwards. Null term the end. */
|
||||
do {
|
||||
digit = (uint8_t)(uval % radix);
|
||||
tbuf[--tbx] = (char)(T_CString_itosOffset(digit));
|
||||
uval = uval / radix;
|
||||
} while (uval != 0);
|
||||
|
||||
/* copy converted number into user buffer */
|
||||
uprv_strcpy(buffer+length, tbuf+tbx);
|
||||
length += sizeof(tbuf) - tbx -1;
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
T_CString_stringToInteger(const char *integerString, int32_t radix)
|
||||
{
|
||||
char *end;
|
||||
return uprv_strtoul(integerString, &end, radix);
|
||||
|
||||
}
|
||||
|
||||
U_CAPI int U_EXPORT2
|
||||
uprv_stricmp(const char *str1, const char *str2) {
|
||||
if(str1==NULL) {
|
||||
if(str2==NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if(str2==NULL) {
|
||||
return 1;
|
||||
} else {
|
||||
/* compare non-NULL strings lexically with lowercase */
|
||||
int rc;
|
||||
unsigned char c1, c2;
|
||||
|
||||
for(;;) {
|
||||
c1=(unsigned char)*str1;
|
||||
c2=(unsigned char)*str2;
|
||||
if(c1==0) {
|
||||
if(c2==0) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if(c2==0) {
|
||||
return 1;
|
||||
} else {
|
||||
/* compare non-zero characters with lowercase */
|
||||
rc=(int)(unsigned char)uprv_tolower(c1)-(int)(unsigned char)uprv_tolower(c2);
|
||||
if(rc!=0) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
++str1;
|
||||
++str2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI int U_EXPORT2
|
||||
uprv_strnicmp(const char *str1, const char *str2, uint32_t n) {
|
||||
if(str1==NULL) {
|
||||
if(str2==NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if(str2==NULL) {
|
||||
return 1;
|
||||
} else {
|
||||
/* compare non-NULL strings lexically with lowercase */
|
||||
int rc;
|
||||
unsigned char c1, c2;
|
||||
|
||||
for(; n--;) {
|
||||
c1=(unsigned char)*str1;
|
||||
c2=(unsigned char)*str2;
|
||||
if(c1==0) {
|
||||
if(c2==0) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else if(c2==0) {
|
||||
return 1;
|
||||
} else {
|
||||
/* compare non-zero characters with lowercase */
|
||||
rc=(int)(unsigned char)uprv_tolower(c1)-(int)(unsigned char)uprv_tolower(c2);
|
||||
if(rc!=0) {
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
++str1;
|
||||
++str2;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_CAPI char* U_EXPORT2
|
||||
uprv_strdup(const char *src) {
|
||||
size_t len = uprv_strlen(src) + 1;
|
||||
char *dup = (char *) uprv_malloc(len);
|
||||
|
||||
if (dup) {
|
||||
uprv_memcpy(dup, src, len);
|
||||
}
|
||||
|
||||
return dup;
|
||||
}
|
||||
|
||||
U_CAPI char* U_EXPORT2
|
||||
uprv_strndup(const char *src, int32_t n) {
|
||||
char *dup;
|
||||
|
||||
if(n < 0) {
|
||||
dup = uprv_strdup(src);
|
||||
} else {
|
||||
dup = (char*)uprv_malloc(n+1);
|
||||
if (dup) {
|
||||
uprv_memcpy(dup, src, n);
|
||||
dup[n] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return dup;
|
||||
}
|
||||
124
vendor/icu/src/cstring.h
vendored
Normal file
124
vendor/icu/src/cstring.h
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* File CSTRING.H
|
||||
*
|
||||
* Contains CString interface
|
||||
*
|
||||
* @author Helena Shih
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 6/17/98 hshih Created.
|
||||
* 05/03/99 stephen Changed from functions to macros.
|
||||
* 06/14/99 stephen Added icu_strncat, icu_strncmp, icu_tolower
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef CSTRING_H
|
||||
#define CSTRING_H 1
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include "cmemory.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define uprv_strcpy(dst, src) U_STANDARD_CPP_NAMESPACE strcpy(dst, src)
|
||||
#define uprv_strlen(str) U_STANDARD_CPP_NAMESPACE strlen(str)
|
||||
#define uprv_strcmp(s1, s2) U_STANDARD_CPP_NAMESPACE strcmp(s1, s2)
|
||||
#define uprv_strcat(dst, src) U_STANDARD_CPP_NAMESPACE strcat(dst, src)
|
||||
#define uprv_strchr(s, c) U_STANDARD_CPP_NAMESPACE strchr(s, c)
|
||||
#define uprv_strstr(s, c) U_STANDARD_CPP_NAMESPACE strstr(s, c)
|
||||
#define uprv_strrchr(s, c) U_STANDARD_CPP_NAMESPACE strrchr(s, c)
|
||||
#define uprv_strncpy(dst, src, size) U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size)
|
||||
#define uprv_strncmp(s1, s2, n) U_STANDARD_CPP_NAMESPACE strncmp(s1, s2, n)
|
||||
#define uprv_strncat(dst, src, n) U_STANDARD_CPP_NAMESPACE strncat(dst, src, n)
|
||||
|
||||
/**
|
||||
* Is c an ASCII-repertoire letter a-z or A-Z?
|
||||
* Note: The implementation is specific to whether ICU is compiled for
|
||||
* an ASCII-based or EBCDIC-based machine. There just does not seem to be a better name for this.
|
||||
*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uprv_isASCIILetter(char c);
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_toupper(char c);
|
||||
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_asciitolower(char c);
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_ebcdictolower(char c);
|
||||
|
||||
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
||||
# define uprv_tolower uprv_asciitolower
|
||||
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
# define uprv_tolower uprv_ebcdictolower
|
||||
#else
|
||||
# error U_CHARSET_FAMILY is not valid
|
||||
#endif
|
||||
|
||||
#define uprv_strtod(source, end) U_STANDARD_CPP_NAMESPACE strtod(source, end)
|
||||
#define uprv_strtoul(str, end, base) U_STANDARD_CPP_NAMESPACE strtoul(str, end, base)
|
||||
#define uprv_strtol(str, end, base) U_STANDARD_CPP_NAMESPACE strtol(str, end, base)
|
||||
|
||||
/* Conversion from a digit to the character with radix base from 2-19 */
|
||||
/* May need to use U_UPPER_ORDINAL*/
|
||||
#define T_CString_itosOffset(a) ((a)<=9?('0'+(a)):('A'+(a)-10))
|
||||
|
||||
U_CAPI char* U_EXPORT2
|
||||
uprv_strdup(const char *src);
|
||||
|
||||
/**
|
||||
* uprv_malloc n+1 bytes, and copy n bytes from src into the new string.
|
||||
* Terminate with a null at offset n. If n is -1, works like uprv_strdup
|
||||
* @param src
|
||||
* @param n length of the input string, not including null.
|
||||
* @return new string (owned by caller, use uprv_free to free).
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI char* U_EXPORT2
|
||||
uprv_strndup(const char *src, int32_t n);
|
||||
|
||||
U_CAPI char* U_EXPORT2
|
||||
T_CString_toLowerCase(char* str);
|
||||
|
||||
U_CAPI char* U_EXPORT2
|
||||
T_CString_toUpperCase(char* str);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
T_CString_integerToString(char *buffer, int32_t n, int32_t radix);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
T_CString_int64ToString(char *buffer, int64_t n, uint32_t radix);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
T_CString_stringToInteger(const char *integerString, int32_t radix);
|
||||
|
||||
/**
|
||||
* Case-insensitive, language-independent string comparison
|
||||
* limited to the ASCII character repertoire.
|
||||
*/
|
||||
U_CAPI int U_EXPORT2
|
||||
uprv_stricmp(const char *str1, const char *str2);
|
||||
|
||||
/**
|
||||
* Case-insensitive, language-independent string comparison
|
||||
* limited to the ASCII character repertoire.
|
||||
*/
|
||||
U_CAPI int U_EXPORT2
|
||||
uprv_strnicmp(const char *str1, const char *str2, uint32_t n);
|
||||
|
||||
#endif /* ! CSTRING_H */
|
||||
58
vendor/icu/src/cwchar.h
vendored
Normal file
58
vendor/icu/src/cwchar.h
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: cwchar.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2001may25
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* This file contains ICU-internal definitions of wchar_t operations.
|
||||
* These definitions were moved here from cstring.h so that fewer
|
||||
* ICU implementation files include wchar.h.
|
||||
*/
|
||||
|
||||
#ifndef __CWCHAR_H__
|
||||
#define __CWCHAR_H__
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/* Do this after utypes.h so that we have U_HAVE_WCHAR_H . */
|
||||
#if U_HAVE_WCHAR_H
|
||||
# include <wchar.h>
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Wide-character functions */
|
||||
/*===========================================================================*/
|
||||
|
||||
/* The following are not available on all systems, defined in wchar.h or string.h. */
|
||||
#if U_HAVE_WCSCPY
|
||||
# define uprv_wcscpy wcscpy
|
||||
# define uprv_wcscat wcscat
|
||||
# define uprv_wcslen wcslen
|
||||
#else
|
||||
U_CAPI wchar_t* U_EXPORT2
|
||||
uprv_wcscpy(wchar_t *dst, const wchar_t *src);
|
||||
U_CAPI wchar_t* U_EXPORT2
|
||||
uprv_wcscat(wchar_t *dst, const wchar_t *src);
|
||||
U_CAPI size_t U_EXPORT2
|
||||
uprv_wcslen(const wchar_t *src);
|
||||
#endif
|
||||
|
||||
/* The following are part of the ANSI C standard, defined in stdlib.h . */
|
||||
#define uprv_wcstombs(mbstr, wcstr, count) U_STANDARD_CPP_NAMESPACE wcstombs(mbstr, wcstr, count)
|
||||
#define uprv_mbstowcs(wcstr, mbstr, count) U_STANDARD_CPP_NAMESPACE mbstowcs(wcstr, mbstr, count)
|
||||
|
||||
|
||||
#endif
|
||||
79
vendor/icu/src/mutex.h
vendored
Normal file
79
vendor/icu/src/mutex.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2013, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
//----------------------------------------------------------------------------
|
||||
// File: mutex.h
|
||||
//
|
||||
// Lightweight C++ wrapper for umtx_ C mutex functions
|
||||
//
|
||||
// Author: Alan Liu 1/31/97
|
||||
// History:
|
||||
// 06/04/97 helena Updated setImplementation as per feedback from 5/21 drop.
|
||||
// 04/07/1999 srl refocused as a thin wrapper
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
#ifndef MUTEX_H
|
||||
#define MUTEX_H
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uobject.h>
|
||||
#include "umutex.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Code within that accesses shared static or global data should
|
||||
// should instantiate a Mutex object while doing so. You should make your own
|
||||
// private mutex where possible.
|
||||
|
||||
// For example:
|
||||
//
|
||||
// UMutex myMutex;
|
||||
//
|
||||
// void Function(int arg1, int arg2)
|
||||
// {
|
||||
// static Object* foo; // Shared read-write object
|
||||
// Mutex mutex(&myMutex); // or no args for the global lock
|
||||
// foo->Method();
|
||||
// // When 'mutex' goes out of scope and gets destroyed here, the lock is released
|
||||
// }
|
||||
//
|
||||
// Note: Do NOT use the form 'Mutex mutex();' as that merely forward-declares a function
|
||||
// returning a Mutex. This is a common mistake which silently slips through the
|
||||
// compiler!!
|
||||
//
|
||||
|
||||
class U_COMMON_API Mutex : public UMemory {
|
||||
public:
|
||||
inline Mutex(UMutex *mutex = NULL);
|
||||
inline ~Mutex();
|
||||
|
||||
private:
|
||||
UMutex *fMutex;
|
||||
|
||||
Mutex(const Mutex &other); // forbid copying of this class
|
||||
Mutex &operator=(const Mutex &other); // forbid copying of this class
|
||||
};
|
||||
|
||||
inline Mutex::Mutex(UMutex *mutex)
|
||||
: fMutex(mutex)
|
||||
{
|
||||
umtx_lock(fMutex);
|
||||
}
|
||||
|
||||
inline Mutex::~Mutex()
|
||||
{
|
||||
umtx_unlock(fMutex);
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif //_MUTEX_
|
||||
//eof
|
||||
612
vendor/icu/src/putilimp.h
vendored
Normal file
612
vendor/icu/src/putilimp.h
vendored
Normal file
@@ -0,0 +1,612 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : putilimp.h
|
||||
*
|
||||
* Date Name Description
|
||||
* 10/17/04 grhoten Move internal functions from putil.h to this file.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef PUTILIMP_H
|
||||
#define PUTILIMP_H
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/putil.h>
|
||||
|
||||
/**
|
||||
* \def U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
|
||||
* Nearly all CPUs and compilers implement a right-shift of a signed integer
|
||||
* as an Arithmetic Shift Right which copies the sign bit (the Most Significant Bit (MSB))
|
||||
* into the vacated bits (sign extension).
|
||||
* For example, (int32_t)0xfff5fff3>>4 becomes 0xffff5fff and -1>>1=-1.
|
||||
*
|
||||
* This can be useful for storing a signed value in the upper bits
|
||||
* and another bit field in the lower bits.
|
||||
* The signed value can be retrieved by simple right-shifting.
|
||||
*
|
||||
* This is consistent with the Java language.
|
||||
*
|
||||
* However, the C standard allows compilers to implement a right-shift of a signed integer
|
||||
* as a Logical Shift Right which copies a 0 into the vacated bits.
|
||||
* For example, (int32_t)0xfff5fff3>>4 becomes 0x0fff5fff and -1>>1=0x7fffffff.
|
||||
*
|
||||
* Code that depends on the natural behavior should be guarded with this macro,
|
||||
* with an alternate path for unusual platforms.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
|
||||
/* Use the predefined value. */
|
||||
#else
|
||||
/*
|
||||
* Nearly all CPUs & compilers implement a right-shift of a signed integer
|
||||
* as an Arithmetic Shift Right (with sign extension).
|
||||
*/
|
||||
# define U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC 1
|
||||
#endif
|
||||
|
||||
/** Define this to 1 if your platform supports IEEE 754 floating point,
|
||||
to 0 if it does not. */
|
||||
#ifndef IEEE_754
|
||||
# define IEEE_754 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* uintptr_t is an optional part of the standard definitions in stdint.h.
|
||||
* The opengroup.org documentation for stdint.h says
|
||||
* "On XSI-conformant systems, the intptr_t and uintptr_t types are required;
|
||||
* otherwise, they are optional."
|
||||
* We assume that when uintptr_t is defined, UINTPTR_MAX is defined as well.
|
||||
*
|
||||
* Do not use ptrdiff_t since it is signed. size_t is unsigned.
|
||||
*/
|
||||
/* TODO: This check fails on some z environments. Filed a ticket #9357 for this. */
|
||||
#if !defined(__intptr_t_defined) && !defined(UINTPTR_MAX) && (U_PLATFORM != U_PF_OS390)
|
||||
typedef size_t uintptr_t;
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/** @{ Information about POSIX support */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef U_HAVE_NL_LANGINFO_CODESET
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_ANDROID || U_PLATFORM == U_PF_QNX
|
||||
# define U_HAVE_NL_LANGINFO_CODESET 0
|
||||
#else
|
||||
# define U_HAVE_NL_LANGINFO_CODESET 1
|
||||
#endif
|
||||
|
||||
#ifdef U_NL_LANGINFO_CODESET
|
||||
/* Use the predefined value. */
|
||||
#elif !U_HAVE_NL_LANGINFO_CODESET
|
||||
# define U_NL_LANGINFO_CODESET -1
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
/* not defined */
|
||||
#else
|
||||
# define U_NL_LANGINFO_CODESET CODESET
|
||||
#endif
|
||||
|
||||
#ifdef U_TZSET
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
// UWP doesn't support tzset or environment variables for tz
|
||||
#if U_PLATFORM_HAS_WINUWP_API == 0
|
||||
# define U_TZSET _tzset
|
||||
#endif
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
/* not defined */
|
||||
#else
|
||||
# define U_TZSET tzset
|
||||
#endif
|
||||
|
||||
#if defined(U_TIMEZONE) || defined(U_HAVE_TIMEZONE)
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM == U_PF_ANDROID
|
||||
# define U_TIMEZONE timezone
|
||||
#elif defined(__UCLIBC__)
|
||||
// uClibc does not have __timezone or _timezone.
|
||||
#elif defined(_NEWLIB_VERSION)
|
||||
# define U_TIMEZONE _timezone
|
||||
#elif defined(__GLIBC__)
|
||||
// glibc
|
||||
# define U_TIMEZONE __timezone
|
||||
#elif U_PLATFORM_IS_LINUX_BASED
|
||||
// not defined
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# define U_TIMEZONE _timezone
|
||||
#elif U_PLATFORM == U_PF_BSD && !defined(__NetBSD__)
|
||||
/* not defined */
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
/* not defined */
|
||||
#elif U_PLATFORM == U_PF_IPHONE
|
||||
/* not defined */
|
||||
#else
|
||||
# define U_TIMEZONE timezone
|
||||
#endif
|
||||
|
||||
#ifdef U_TZNAME
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
/* not usable on all windows platforms */
|
||||
#if U_PLATFORM_HAS_WINUWP_API == 0
|
||||
# define U_TZNAME _tzname
|
||||
#endif
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
/* not defined */
|
||||
#else
|
||||
# define U_TZNAME tzname
|
||||
#endif
|
||||
|
||||
#ifdef U_HAVE_MMAP
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# define U_HAVE_MMAP 0
|
||||
#else
|
||||
# define U_HAVE_MMAP 1
|
||||
#endif
|
||||
|
||||
#ifdef U_HAVE_POPEN
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# define U_HAVE_POPEN 0
|
||||
#elif U_PLATFORM == U_PF_OS400
|
||||
# define U_HAVE_POPEN 0
|
||||
#else
|
||||
# define U_HAVE_POPEN 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \def U_HAVE_DIRENT_H
|
||||
* Defines whether dirent.h is available.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_DIRENT_H
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# define U_HAVE_DIRENT_H 0
|
||||
#else
|
||||
# define U_HAVE_DIRENT_H 1
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/** @{ GCC built in functions for atomic memory operations */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* \def U_HAVE_GCC_ATOMICS
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_GCC_ATOMICS
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM == U_PF_MINGW
|
||||
#define U_HAVE_GCC_ATOMICS 0
|
||||
#elif U_GCC_MAJOR_MINOR >= 404 || defined(__clang__)
|
||||
/* TODO: Intel icc and IBM xlc on AIX also support gcc atomics. (Intel originated them.)
|
||||
* Add them for these compilers.
|
||||
* Note: Clang sets __GNUC__ defines for version 4.2, so misses the 4.4 test here.
|
||||
*/
|
||||
# define U_HAVE_GCC_ATOMICS 1
|
||||
#else
|
||||
# define U_HAVE_GCC_ATOMICS 0
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* \def U_HAVE_STD_ATOMICS
|
||||
* Defines whether the standard C++11 <atomic> is available.
|
||||
* ICU will use this when available,
|
||||
* otherwise will fall back to compiler or platform specific alternatives.
|
||||
* @internal
|
||||
*/
|
||||
#ifdef U_HAVE_STD_ATOMICS
|
||||
/* Use the predefined value. */
|
||||
#elif U_CPLUSPLUS_VERSION < 11
|
||||
/* Not C++11, disable use of atomics */
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
#elif __clang__ && __clang_major__==3 && __clang_minor__<=1
|
||||
/* Clang 3.1, has atomic variable initializer bug. */
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
#else
|
||||
/* U_HAVE_ATOMIC is typically set by an autoconf test of #include <atomic> */
|
||||
/* Can be set manually, or left undefined, on platforms without autoconf. */
|
||||
# if defined(U_HAVE_ATOMIC) && U_HAVE_ATOMIC
|
||||
# define U_HAVE_STD_ATOMICS 1
|
||||
# else
|
||||
# define U_HAVE_STD_ATOMICS 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* \def U_HAVE_CLANG_ATOMICS
|
||||
* Defines whether Clang c11 style built-in atomics are available.
|
||||
* These are used in preference to gcc atomics when both are available.
|
||||
*/
|
||||
#ifdef U_HAVE_CLANG_ATOMICS
|
||||
/* Use the predefined value. */
|
||||
#elif __has_builtin(__c11_atomic_load) && \
|
||||
__has_builtin(__c11_atomic_store) && \
|
||||
__has_builtin(__c11_atomic_fetch_add) && \
|
||||
__has_builtin(__c11_atomic_fetch_sub)
|
||||
# define U_HAVE_CLANG_ATOMICS 1
|
||||
#else
|
||||
# define U_HAVE_CLANG_ATOMICS 0
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/** @{ Programs used by ICU code */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* \def U_MAKE_IS_NMAKE
|
||||
* Defines whether the "make" program is Windows nmake.
|
||||
*/
|
||||
#ifdef U_MAKE_IS_NMAKE
|
||||
/* Use the predefined value. */
|
||||
#elif U_PLATFORM == U_PF_WINDOWS
|
||||
# define U_MAKE_IS_NMAKE 1
|
||||
#else
|
||||
# define U_MAKE_IS_NMAKE 0
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/*==========================================================================*/
|
||||
/* Platform utilities */
|
||||
/*==========================================================================*/
|
||||
|
||||
/**
|
||||
* Platform utilities isolates the platform dependencies of the
|
||||
* library. For each platform which this code is ported to, these
|
||||
* functions may have to be re-implemented.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Floating point utility to determine if a double is Not a Number (NaN).
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL UBool U_EXPORT2 uprv_isNaN(double d);
|
||||
/**
|
||||
* Floating point utility to determine if a double has an infinite value.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL UBool U_EXPORT2 uprv_isInfinite(double d);
|
||||
/**
|
||||
* Floating point utility to determine if a double has a positive infinite value.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL UBool U_EXPORT2 uprv_isPositiveInfinity(double d);
|
||||
/**
|
||||
* Floating point utility to determine if a double has a negative infinite value.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL UBool U_EXPORT2 uprv_isNegativeInfinity(double d);
|
||||
/**
|
||||
* Floating point utility that returns a Not a Number (NaN) value.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_getNaN(void);
|
||||
/**
|
||||
* Floating point utility that returns an infinite value.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_getInfinity(void);
|
||||
|
||||
/**
|
||||
* Floating point utility to truncate a double.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_trunc(double d);
|
||||
/**
|
||||
* Floating point utility to calculate the floor of a double.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_floor(double d);
|
||||
/**
|
||||
* Floating point utility to calculate the ceiling of a double.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_ceil(double d);
|
||||
/**
|
||||
* Floating point utility to calculate the absolute value of a double.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_fabs(double d);
|
||||
/**
|
||||
* Floating point utility to calculate the fractional and integer parts of a double.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_modf(double d, double* pinteger);
|
||||
/**
|
||||
* Floating point utility to calculate the remainder of a double divided by another double.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_fmod(double d, double y);
|
||||
/**
|
||||
* Floating point utility to calculate d to the power of exponent (d^exponent).
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_pow(double d, double exponent);
|
||||
/**
|
||||
* Floating point utility to calculate 10 to the power of exponent (10^exponent).
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_pow10(int32_t exponent);
|
||||
/**
|
||||
* Floating point utility to calculate the maximum value of two doubles.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_fmax(double d, double y);
|
||||
/**
|
||||
* Floating point utility to calculate the minimum value of two doubles.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_fmin(double d, double y);
|
||||
/**
|
||||
* Private utility to calculate the maximum value of two integers.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL int32_t U_EXPORT2 uprv_max(int32_t d, int32_t y);
|
||||
/**
|
||||
* Private utility to calculate the minimum value of two integers.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL int32_t U_EXPORT2 uprv_min(int32_t d, int32_t y);
|
||||
|
||||
#if U_IS_BIG_ENDIAN
|
||||
# define uprv_isNegative(number) (*((signed char *)&(number))<0)
|
||||
#else
|
||||
# define uprv_isNegative(number) (*((signed char *)&(number)+sizeof(number)-1)<0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the largest positive number that can be represented by an integer
|
||||
* type of arbitrary bit length.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_maxMantissa(void);
|
||||
|
||||
/**
|
||||
* Floating point utility to calculate the logarithm of a double.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_log(double d);
|
||||
|
||||
/**
|
||||
* Does common notion of rounding e.g. uprv_floor(x + 0.5);
|
||||
* @param x the double number
|
||||
* @return the rounded double
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL double U_EXPORT2 uprv_round(double x);
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Returns the number of digits after the decimal point in a double number x.
|
||||
*
|
||||
* @param x the double number
|
||||
* @return the number of digits after the decimal point in a double number x.
|
||||
* @internal
|
||||
*/
|
||||
/*U_INTERNAL int32_t U_EXPORT2 uprv_digitsAfterDecimal(double x);*/
|
||||
#endif
|
||||
|
||||
#if !U_CHARSET_IS_UTF8
|
||||
/**
|
||||
* Please use ucnv_getDefaultName() instead.
|
||||
* Return the default codepage for this platform and locale.
|
||||
* This function can call setlocale() on Unix platforms. Please read the
|
||||
* platform documentation on setlocale() before calling this function.
|
||||
* @return the default codepage for this platform
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Please use uloc_getDefault() instead.
|
||||
* Return the default locale ID string by querying the system, or
|
||||
* zero if one cannot be found.
|
||||
* This function can call setlocale() on Unix platforms. Please read the
|
||||
* platform documentation on setlocale() before calling this function.
|
||||
* @return the default locale ID string
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void);
|
||||
|
||||
/**
|
||||
* Time zone utilities
|
||||
*
|
||||
* Wrappers for C runtime library functions relating to timezones.
|
||||
* The t_tzset() function (similar to tzset) uses the current setting
|
||||
* of the environment variable TZ to assign values to three global
|
||||
* variables: daylight, timezone, and tzname. These variables have the
|
||||
* following meanings, and are declared in <time.h>.
|
||||
*
|
||||
* daylight Nonzero if daylight-saving-time zone (DST) is specified
|
||||
* in TZ; otherwise, 0. Default value is 1.
|
||||
* timezone Difference in seconds between coordinated universal
|
||||
* time and local time. E.g., -28,800 for PST (GMT-8hrs)
|
||||
* tzname(0) Three-letter time-zone name derived from TZ environment
|
||||
* variable. E.g., "PST".
|
||||
* tzname(1) Three-letter DST zone name derived from TZ environment
|
||||
* variable. E.g., "PDT". If DST zone is omitted from TZ,
|
||||
* tzname(1) is an empty string.
|
||||
*
|
||||
* Notes: For example, to set the TZ environment variable to correspond
|
||||
* to the current time zone in Germany, you can use one of the
|
||||
* following statements:
|
||||
*
|
||||
* set TZ=GST1GDT
|
||||
* set TZ=GST+1GDT
|
||||
*
|
||||
* If the TZ value is not set, t_tzset() attempts to use the time zone
|
||||
* information specified by the operating system. Under Windows NT
|
||||
* and Windows 95, this information is specified in the Control Panel's
|
||||
* Date/Time application.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2 uprv_tzset(void);
|
||||
|
||||
/**
|
||||
* Difference in seconds between coordinated universal
|
||||
* time and local time. E.g., -28,800 for PST (GMT-8hrs)
|
||||
* @return the difference in seconds between coordinated universal time and local time.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL int32_t U_EXPORT2 uprv_timezone(void);
|
||||
|
||||
/**
|
||||
* tzname(0) Three-letter time-zone name derived from TZ environment
|
||||
* variable. E.g., "PST".
|
||||
* tzname(1) Three-letter DST zone name derived from TZ environment
|
||||
* variable. E.g., "PDT". If DST zone is omitted from TZ,
|
||||
* tzname(1) is an empty string.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL const char* U_EXPORT2 uprv_tzname(int n);
|
||||
|
||||
/**
|
||||
* Reset the global tzname cache.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL void uprv_tzname_clear_cache();
|
||||
|
||||
/**
|
||||
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
|
||||
* This function is affected by 'faketime' and should be the bottleneck for all user-visible ICU time functions.
|
||||
* @return the UTC time measured in milliseconds
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL UDate U_EXPORT2 uprv_getUTCtime(void);
|
||||
|
||||
/**
|
||||
* Get UTC (GMT) time measured in milliseconds since 0:00 on 1/1/1970.
|
||||
* This function is not affected by 'faketime', so it should only be used by low level test functions- not by anything that
|
||||
* exposes time to the end user.
|
||||
* @return the UTC time measured in milliseconds
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL UDate U_EXPORT2 uprv_getRawUTCtime(void);
|
||||
|
||||
/**
|
||||
* Determine whether a pathname is absolute or not, as defined by the platform.
|
||||
* @param path Pathname to test
|
||||
* @return TRUE if the path is absolute
|
||||
* @internal (ICU 3.0)
|
||||
*/
|
||||
U_INTERNAL UBool U_EXPORT2 uprv_pathIsAbsolute(const char *path);
|
||||
|
||||
/**
|
||||
* Use U_MAX_PTR instead of this function.
|
||||
* @param void pointer to test
|
||||
* @return the largest possible pointer greater than the base
|
||||
* @internal (ICU 3.8)
|
||||
*/
|
||||
U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base);
|
||||
|
||||
/**
|
||||
* Maximum value of a (void*) - use to indicate the limit of an 'infinite' buffer.
|
||||
* In fact, buffer sizes must not exceed 2GB so that the difference between
|
||||
* the buffer limit and the buffer start can be expressed in an int32_t.
|
||||
*
|
||||
* The definition of U_MAX_PTR must fulfill the following conditions:
|
||||
* - return the largest possible pointer greater than base
|
||||
* - return a valid pointer according to the machine architecture (AS/400, 64-bit, etc.)
|
||||
* - avoid wrapping around at high addresses
|
||||
* - make sure that the returned pointer is not farther from base than 0x7fffffff bytes
|
||||
*
|
||||
* @param base The beginning of a buffer to find the maximum offset from
|
||||
* @internal
|
||||
*/
|
||||
#ifndef U_MAX_PTR
|
||||
# if U_PLATFORM == U_PF_OS390 && !defined(_LP64)
|
||||
/* We have 31-bit pointers. */
|
||||
# define U_MAX_PTR(base) ((void *)0x7fffffff)
|
||||
# elif U_PLATFORM == U_PF_OS400
|
||||
# define U_MAX_PTR(base) uprv_maximumPtr((void *)base)
|
||||
# elif 0
|
||||
/*
|
||||
* For platforms where pointers are scalar values (which is normal, but unlike i5/OS)
|
||||
* but that do not define uintptr_t.
|
||||
*
|
||||
* However, this does not work on modern compilers:
|
||||
* The C++ standard does not define pointer overflow, and allows compilers to
|
||||
* assume that p+u>p for any pointer p and any integer u>0.
|
||||
* Thus, modern compilers optimize away the ">" comparison.
|
||||
* (See ICU tickets #7187 and #8096.)
|
||||
*/
|
||||
# define U_MAX_PTR(base) \
|
||||
((void *)(((char *)(base)+0x7fffffffu) > (char *)(base) \
|
||||
? ((char *)(base)+0x7fffffffu) \
|
||||
: (char *)-1))
|
||||
# else
|
||||
/* Default version. C++ standard compliant for scalar pointers. */
|
||||
# define U_MAX_PTR(base) \
|
||||
((void *)(((uintptr_t)(base)+0x7fffffffu) > (uintptr_t)(base) \
|
||||
? ((uintptr_t)(base)+0x7fffffffu) \
|
||||
: (uintptr_t)-1))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Dynamic Library Functions */
|
||||
|
||||
typedef void (UVoidFunction)(void);
|
||||
|
||||
#if U_ENABLE_DYLOAD
|
||||
/**
|
||||
* Load a library
|
||||
* @internal (ICU 4.4)
|
||||
*/
|
||||
U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Close a library
|
||||
* @internal (ICU 4.4)
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Extract a symbol from a library (function)
|
||||
* @internal (ICU 4.8)
|
||||
*/
|
||||
U_INTERNAL UVoidFunction* U_EXPORT2 uprv_dlsym_func( void *lib, const char *symbolName, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Extract a symbol from a library (function)
|
||||
* Not implemented, no clients.
|
||||
* @internal
|
||||
*/
|
||||
/* U_INTERNAL void * U_EXPORT2 uprv_dlsym_data( void *lib, const char *symbolName, UErrorCode *status); */
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Define malloc and related functions
|
||||
* @internal
|
||||
*/
|
||||
#if U_PLATFORM == U_PF_OS400
|
||||
# define uprv_default_malloc(x) _C_TS_malloc(x)
|
||||
# define uprv_default_realloc(x,y) _C_TS_realloc(x,y)
|
||||
# define uprv_default_free(x) _C_TS_free(x)
|
||||
/* also _C_TS_calloc(x) */
|
||||
#else
|
||||
/* C defaults */
|
||||
# define uprv_default_malloc(x) malloc(x)
|
||||
# define uprv_default_realloc(x,y) realloc(x,y)
|
||||
# define uprv_default_free(x) free(x)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
34
vendor/icu/src/uassert.h
vendored
Normal file
34
vendor/icu/src/uassert.h
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* File uassert.h
|
||||
*
|
||||
* Contains U_ASSERT macro
|
||||
*
|
||||
* By default, U_ASSERT just wraps the C library assert macro.
|
||||
* By changing the definition here, the assert behavior for ICU can be changed
|
||||
* without affecting other non-ICU uses of the C library assert().
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef U_ASSERT_H
|
||||
#define U_ASSERT_H
|
||||
/* utypes.h is included to get the proper define for uint8_t */
|
||||
#include <unicode/utypes.h>
|
||||
#if U_DEBUG
|
||||
# include <assert.h>
|
||||
# define U_ASSERT(exp) assert(exp)
|
||||
#else
|
||||
# define U_ASSERT(exp)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
3039
vendor/icu/src/ubidi.cpp
vendored
Normal file
3039
vendor/icu/src/ubidi.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
254
vendor/icu/src/ubidi_props.cpp
vendored
Normal file
254
vendor/icu/src/ubidi_props.cpp
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2004-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: ubidi_props.c
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2004dec30
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Low-level Unicode bidi/shaping properties access.
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uset.h>
|
||||
#include <unicode/udata.h> /* UDataInfo */
|
||||
#include "ucmndata.h" /* DataHeader */
|
||||
#include "udatamem.h"
|
||||
#include "uassert.h"
|
||||
#include "cmemory.h"
|
||||
#include "utrie2.h"
|
||||
#include "ubidi_props.h"
|
||||
#include "ucln_cmn.h"
|
||||
|
||||
struct UBiDiProps {
|
||||
UDataMemory *mem;
|
||||
const int32_t *indexes;
|
||||
const uint32_t *mirrors;
|
||||
const uint8_t *jgArray;
|
||||
const uint8_t *jgArray2;
|
||||
|
||||
UTrie2 trie;
|
||||
uint8_t formatVersion[4];
|
||||
};
|
||||
|
||||
/* ubidi_props_data.h is machine-generated by genbidi --csource */
|
||||
#define INCLUDED_FROM_UBIDI_PROPS_C
|
||||
#include "ubidi_props_data.h"
|
||||
|
||||
/* set of property starts for UnicodeSet ------------------------------------ */
|
||||
|
||||
static UBool U_CALLCONV
|
||||
_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
|
||||
(void)end;
|
||||
(void)value;
|
||||
/* add the start code point to the USet */
|
||||
const USetAdder *sa=(const USetAdder *)context;
|
||||
sa->add(sa->set, start);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U_CFUNC void
|
||||
ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
||||
int32_t i, length;
|
||||
UChar32 c, start, limit;
|
||||
|
||||
const uint8_t *jgArray;
|
||||
uint8_t prev, jg;
|
||||
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* add the start code point of each same-value range of the trie */
|
||||
utrie2_enum(&ubidi_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
|
||||
|
||||
/* add the code points from the bidi mirroring table */
|
||||
length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
|
||||
for(i=0; i<length; ++i) {
|
||||
c=UBIDI_GET_MIRROR_CODE_POINT(ubidi_props_singleton.mirrors[i]);
|
||||
sa->addRange(sa->set, c, c+1);
|
||||
}
|
||||
|
||||
/* add the code points from the Joining_Group array where the value changes */
|
||||
start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START];
|
||||
limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT];
|
||||
jgArray=ubidi_props_singleton.jgArray;
|
||||
for(;;) {
|
||||
prev=0;
|
||||
while(start<limit) {
|
||||
jg=*jgArray++;
|
||||
if(jg!=prev) {
|
||||
sa->add(sa->set, start);
|
||||
prev=jg;
|
||||
}
|
||||
++start;
|
||||
}
|
||||
if(prev!=0) {
|
||||
/* add the limit code point if the last value was not 0 (it is now start==limit) */
|
||||
sa->add(sa->set, limit);
|
||||
}
|
||||
if(limit==ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT]) {
|
||||
/* switch to the second Joining_Group range */
|
||||
start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START2];
|
||||
limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT2];
|
||||
jgArray=ubidi_props_singleton.jgArray2;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* add code points with hardcoded properties, plus the ones following them */
|
||||
|
||||
/* (none right now) */
|
||||
}
|
||||
|
||||
/* property access functions ------------------------------------------------ */
|
||||
|
||||
U_CFUNC int32_t
|
||||
ubidi_getMaxValue(UProperty which) {
|
||||
int32_t max=ubidi_props_singleton.indexes[UBIDI_MAX_VALUES_INDEX];
|
||||
switch(which) {
|
||||
case UCHAR_BIDI_CLASS:
|
||||
return (max&UBIDI_CLASS_MASK);
|
||||
case UCHAR_JOINING_GROUP:
|
||||
return (max&UBIDI_MAX_JG_MASK)>>UBIDI_MAX_JG_SHIFT;
|
||||
case UCHAR_JOINING_TYPE:
|
||||
return (max&UBIDI_JT_MASK)>>UBIDI_JT_SHIFT;
|
||||
case UCHAR_BIDI_PAIRED_BRACKET_TYPE:
|
||||
return (max&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT;
|
||||
default:
|
||||
return -1; /* undefined */
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI UCharDirection
|
||||
ubidi_getClass(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UCharDirection)UBIDI_GET_CLASS(props);
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isMirrored(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UBool)UBIDI_GET_FLAG(props, UBIDI_IS_MIRRORED_SHIFT);
|
||||
}
|
||||
|
||||
static UChar32
|
||||
getMirror(UChar32 c, uint16_t props) {
|
||||
int32_t delta=UBIDI_GET_MIRROR_DELTA(props);
|
||||
if(delta!=UBIDI_ESC_MIRROR_DELTA) {
|
||||
return c+delta;
|
||||
} else {
|
||||
/* look for mirror code point in the mirrors[] table */
|
||||
const uint32_t *mirrors;
|
||||
uint32_t m;
|
||||
int32_t i, length;
|
||||
UChar32 c2;
|
||||
|
||||
mirrors=ubidi_props_singleton.mirrors;
|
||||
length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
|
||||
|
||||
/* linear search */
|
||||
for(i=0; i<length; ++i) {
|
||||
m=mirrors[i];
|
||||
c2=UBIDI_GET_MIRROR_CODE_POINT(m);
|
||||
if(c==c2) {
|
||||
/* found c, return its mirror code point using the index in m */
|
||||
return UBIDI_GET_MIRROR_CODE_POINT(mirrors[UBIDI_GET_MIRROR_INDEX(m)]);
|
||||
} else if(c<c2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* c not found, return it itself */
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
U_CFUNC UChar32
|
||||
ubidi_getMirror(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return getMirror(c, props);
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isBidiControl(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UBool)UBIDI_GET_FLAG(props, UBIDI_BIDI_CONTROL_SHIFT);
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isJoinControl(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UBool)UBIDI_GET_FLAG(props, UBIDI_JOIN_CONTROL_SHIFT);
|
||||
}
|
||||
|
||||
U_CFUNC UJoiningType
|
||||
ubidi_getJoiningType(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UJoiningType)((props&UBIDI_JT_MASK)>>UBIDI_JT_SHIFT);
|
||||
}
|
||||
|
||||
U_CFUNC UJoiningGroup
|
||||
ubidi_getJoiningGroup(UChar32 c) {
|
||||
UChar32 start, limit;
|
||||
|
||||
start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START];
|
||||
limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT];
|
||||
if(start<=c && c<limit) {
|
||||
return (UJoiningGroup)ubidi_props_singleton.jgArray[c-start];
|
||||
}
|
||||
start=ubidi_props_singleton.indexes[UBIDI_IX_JG_START2];
|
||||
limit=ubidi_props_singleton.indexes[UBIDI_IX_JG_LIMIT2];
|
||||
if(start<=c && c<limit) {
|
||||
return (UJoiningGroup)ubidi_props_singleton.jgArray2[c-start];
|
||||
}
|
||||
return U_JG_NO_JOINING_GROUP;
|
||||
}
|
||||
|
||||
U_CFUNC UBidiPairedBracketType
|
||||
ubidi_getPairedBracketType(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
return (UBidiPairedBracketType)((props&UBIDI_BPT_MASK)>>UBIDI_BPT_SHIFT);
|
||||
}
|
||||
|
||||
U_CFUNC UChar32
|
||||
ubidi_getPairedBracket(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ubidi_props_singleton.trie, c);
|
||||
if((props&UBIDI_BPT_MASK)==0) {
|
||||
return c;
|
||||
} else {
|
||||
return getMirror(c, props);
|
||||
}
|
||||
}
|
||||
|
||||
/* public API (see uchar.h) ------------------------------------------------- */
|
||||
|
||||
U_CFUNC UCharDirection
|
||||
u_charDirection(UChar32 c) {
|
||||
return ubidi_getClass(c);
|
||||
}
|
||||
|
||||
U_CFUNC UBool
|
||||
u_isMirrored(UChar32 c) {
|
||||
return ubidi_isMirrored(c);
|
||||
}
|
||||
|
||||
U_CFUNC UChar32
|
||||
u_charMirror(UChar32 c) {
|
||||
return ubidi_getMirror(c);
|
||||
}
|
||||
|
||||
U_STABLE UChar32 U_EXPORT2
|
||||
u_getBidiPairedBracket(UChar32 c) {
|
||||
return ubidi_getPairedBracket(c);
|
||||
}
|
||||
148
vendor/icu/src/ubidi_props.h
vendored
Normal file
148
vendor/icu/src/ubidi_props.h
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2004-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: ubidi_props.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2004dec30
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Low-level Unicode bidi/shaping properties access.
|
||||
*/
|
||||
|
||||
#ifndef __UBIDI_PROPS_H__
|
||||
#define __UBIDI_PROPS_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uset.h>
|
||||
#include "putilimp.h"
|
||||
#include "uset_imp.h"
|
||||
#include "udataswp.h"
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
/* library API -------------------------------------------------------------- */
|
||||
|
||||
U_CFUNC void
|
||||
ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
|
||||
|
||||
/* property access functions */
|
||||
|
||||
U_CFUNC int32_t
|
||||
ubidi_getMaxValue(UProperty which);
|
||||
|
||||
U_CAPI UCharDirection
|
||||
ubidi_getClass(UChar32 c);
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isMirrored(UChar32 c);
|
||||
|
||||
U_CFUNC UChar32
|
||||
ubidi_getMirror(UChar32 c);
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isBidiControl(UChar32 c);
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_isJoinControl(UChar32 c);
|
||||
|
||||
U_CFUNC UJoiningType
|
||||
ubidi_getJoiningType(UChar32 c);
|
||||
|
||||
U_CFUNC UJoiningGroup
|
||||
ubidi_getJoiningGroup(UChar32 c);
|
||||
|
||||
U_CFUNC UBidiPairedBracketType
|
||||
ubidi_getPairedBracketType(UChar32 c);
|
||||
|
||||
U_CFUNC UChar32
|
||||
ubidi_getPairedBracket(UChar32 c);
|
||||
|
||||
/* file definitions --------------------------------------------------------- */
|
||||
|
||||
#define UBIDI_DATA_NAME "ubidi"
|
||||
#define UBIDI_DATA_TYPE "icu"
|
||||
|
||||
/* format "BiDi" */
|
||||
#define UBIDI_FMT_0 0x42
|
||||
#define UBIDI_FMT_1 0x69
|
||||
#define UBIDI_FMT_2 0x44
|
||||
#define UBIDI_FMT_3 0x69
|
||||
|
||||
/* indexes into indexes[] */
|
||||
enum {
|
||||
UBIDI_IX_INDEX_TOP,
|
||||
UBIDI_IX_LENGTH,
|
||||
UBIDI_IX_TRIE_SIZE,
|
||||
UBIDI_IX_MIRROR_LENGTH,
|
||||
|
||||
UBIDI_IX_JG_START,
|
||||
UBIDI_IX_JG_LIMIT,
|
||||
UBIDI_IX_JG_START2, /* new in format version 2.2, ICU 54 */
|
||||
UBIDI_IX_JG_LIMIT2,
|
||||
|
||||
UBIDI_MAX_VALUES_INDEX=15,
|
||||
UBIDI_IX_TOP=16
|
||||
};
|
||||
|
||||
/* definitions for 16-bit bidi/shaping properties word ---------------------- */
|
||||
|
||||
enum {
|
||||
/* UBIDI_CLASS_SHIFT=0, */ /* bidi class: 5 bits (4..0) */
|
||||
UBIDI_JT_SHIFT=5, /* joining type: 3 bits (7..5) */
|
||||
|
||||
UBIDI_BPT_SHIFT=8, /* Bidi_Paired_Bracket_Type(bpt): 2 bits (9..8) */
|
||||
|
||||
UBIDI_JOIN_CONTROL_SHIFT=10,
|
||||
UBIDI_BIDI_CONTROL_SHIFT=11,
|
||||
|
||||
UBIDI_IS_MIRRORED_SHIFT=12, /* 'is mirrored' */
|
||||
UBIDI_MIRROR_DELTA_SHIFT=13, /* bidi mirroring delta: 3 bits (15..13) */
|
||||
|
||||
UBIDI_MAX_JG_SHIFT=16 /* max JG value in indexes[UBIDI_MAX_VALUES_INDEX] bits 23..16 */
|
||||
};
|
||||
|
||||
#define UBIDI_CLASS_MASK 0x0000001f
|
||||
#define UBIDI_JT_MASK 0x000000e0
|
||||
#define UBIDI_BPT_MASK 0x00000300
|
||||
|
||||
#define UBIDI_MAX_JG_MASK 0x00ff0000
|
||||
|
||||
#define UBIDI_GET_CLASS(props) ((props)&UBIDI_CLASS_MASK)
|
||||
#define UBIDI_GET_FLAG(props, shift) (((props)>>(shift))&1)
|
||||
|
||||
#if U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
|
||||
# define UBIDI_GET_MIRROR_DELTA(props) ((int16_t)(props)>>UBIDI_MIRROR_DELTA_SHIFT)
|
||||
#else
|
||||
# define UBIDI_GET_MIRROR_DELTA(props) (int16_t)(((props)&0x8000) ? (((props)>>UBIDI_MIRROR_DELTA_SHIFT)|0xe000) : ((props)>>UBIDI_MIRROR_DELTA_SHIFT))
|
||||
#endif
|
||||
|
||||
enum {
|
||||
UBIDI_ESC_MIRROR_DELTA=-4,
|
||||
UBIDI_MIN_MIRROR_DELTA=-3,
|
||||
UBIDI_MAX_MIRROR_DELTA=3
|
||||
};
|
||||
|
||||
/* definitions for 32-bit mirror table entry -------------------------------- */
|
||||
|
||||
enum {
|
||||
/* the source Unicode code point takes 21 bits (20..0) */
|
||||
UBIDI_MIRROR_INDEX_SHIFT=21,
|
||||
UBIDI_MAX_MIRROR_INDEX=0x7ff
|
||||
};
|
||||
|
||||
#define UBIDI_GET_MIRROR_CODE_POINT(m) (UChar32)((m)&0x1fffff)
|
||||
|
||||
#define UBIDI_GET_MIRROR_INDEX(m) ((m)>>UBIDI_MIRROR_INDEX_SHIFT)
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
#endif
|
||||
841
vendor/icu/src/ubidi_props_data.h
vendored
Normal file
841
vendor/icu/src/ubidi_props_data.h
vendored
Normal file
@@ -0,0 +1,841 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
//
|
||||
// Copyright (C) 1999-2016, International Business Machines
|
||||
// Corporation and others. All Rights Reserved.
|
||||
//
|
||||
// file name: ubidi_props_data.h
|
||||
//
|
||||
// machine-generated by: icu/tools/unicode/c/genprops/bidipropsbuilder.cpp
|
||||
|
||||
|
||||
#ifdef INCLUDED_FROM_UBIDI_PROPS_C
|
||||
|
||||
static const UVersionInfo ubidi_props_dataVersion={0xa,0,0,0};
|
||||
|
||||
static const int32_t ubidi_props_indexes[UBIDI_IX_TOP]={0x10,0x6028,0x5cb0,0x1a,0x620,0x8c0,0x10ac0,0x10af0,0,0,0,0,0,0,0,0x6302b6};
|
||||
|
||||
static const uint16_t ubidi_props_trieIndex[11856]={
|
||||
0x36a,0x372,0x37a,0x382,0x39a,0x3a2,0x3aa,0x3b2,0x38a,0x392,0x38a,0x392,0x38a,0x392,0x38a,0x392,
|
||||
0x38a,0x392,0x38a,0x392,0x3b8,0x3c0,0x3c8,0x3d0,0x3d8,0x3e0,0x3dc,0x3e4,0x3ec,0x3f4,0x3ef,0x3f7,
|
||||
0x38a,0x392,0x38a,0x392,0x3ff,0x407,0x38a,0x392,0x38a,0x392,0x38a,0x392,0x40d,0x415,0x41d,0x425,
|
||||
0x42d,0x435,0x43d,0x445,0x44b,0x453,0x45b,0x463,0x46b,0x473,0x479,0x481,0x489,0x491,0x499,0x4a1,
|
||||
0x4ad,0x4a9,0x4b5,0x4bd,0x41f,0x4cd,0x4d5,0x4c5,0x4dd,0x4df,0x4e7,0x4ef,0x4f7,0x4f8,0x500,0x508,
|
||||
0x510,0x4f8,0x518,0x51d,0x510,0x4f8,0x525,0x52d,0x4f7,0x535,0x53d,0x4ef,0x542,0x38a,0x54a,0x54e,
|
||||
0x556,0x557,0x55f,0x567,0x4f7,0x56f,0x577,0x4ef,0x401,0x57b,0x500,0x4ef,0x38a,0x38a,0x583,0x38a,
|
||||
0x38a,0x589,0x591,0x38a,0x38a,0x595,0x59d,0x38a,0x5a1,0x5a8,0x38a,0x5b0,0x5b8,0x5bf,0x541,0x38a,
|
||||
0x38a,0x5c7,0x5cf,0x5d7,0x5df,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x5e7,0x38a,0x5ef,0x38a,0x38a,0x38a,
|
||||
0x5f7,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x5ff,0x38a,0x38a,0x38a,0x607,0x607,0x504,0x504,0x38a,0x60d,0x615,0x5ef,
|
||||
0x62b,0x61d,0x61d,0x633,0x63a,0x623,0x38a,0x38a,0x38a,0x642,0x64a,0x38a,0x38a,0x38a,0x64c,0x654,
|
||||
0x65c,0x38a,0x663,0x66b,0x38a,0x673,0x38a,0x38a,0x534,0x67b,0x542,0x683,0x401,0x68b,0x38a,0x692,
|
||||
0x38a,0x697,0x38a,0x38a,0x38a,0x38a,0x69d,0x6a5,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x3d8,0x6ad,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x6b5,0x6bd,0x6c1,
|
||||
0x6d9,0x6df,0x6c9,0x6d1,0x6e7,0x6ef,0x6f3,0x5c2,0x6fb,0x703,0x70b,0x38a,0x713,0x654,0x654,0x654,
|
||||
0x723,0x72b,0x733,0x73b,0x740,0x748,0x750,0x71b,0x758,0x760,0x38a,0x766,0x76d,0x654,0x654,0x654,
|
||||
0x654,0x56d,0x773,0x654,0x77b,0x38a,0x38a,0x651,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,
|
||||
0x654,0x654,0x654,0x654,0x654,0x783,0x654,0x654,0x654,0x654,0x654,0x789,0x654,0x654,0x791,0x799,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x654,0x654,0x654,0x654,0x7a9,0x7b0,0x7b8,0x7a1,
|
||||
0x7c8,0x7d0,0x7d8,0x7df,0x7e7,0x7ef,0x7f6,0x7c0,0x654,0x654,0x654,0x7fe,0x804,0x80a,0x812,0x817,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x81e,0x38a,0x38a,0x38a,0x826,0x38a,0x38a,0x38a,0x3d8,
|
||||
0x82e,0x836,0x763,0x38a,0x839,0x654,0x654,0x657,0x654,0x654,0x654,0x654,0x654,0x654,0x840,0x846,
|
||||
0x856,0x84e,0x38a,0x38a,0x85e,0x5f7,0x38a,0x3b1,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x654,0x825,
|
||||
0x3bf,0x38a,0x866,0x86e,0x38a,0x876,0x817,0x38a,0x38a,0x38a,0x38a,0x87e,0x38a,0x38a,0x64c,0x3b0,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x654,0x654,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x866,0x654,0x56d,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x885,0x38a,0x38a,0x88a,0x557,0x38a,0x38a,0x5a3,0x654,0x64b,0x38a,0x38a,0x892,0x38a,0x38a,0x38a,
|
||||
0x89a,0x8a1,0x61d,0x8a9,0x38a,0x38a,0x579,0x8b1,0x38a,0x8b8,0x8bf,0x38a,0x4dd,0x8c4,0x38a,0x4f6,
|
||||
0x38a,0x8cc,0x8d4,0x4f8,0x38a,0x8d8,0x4f7,0x8e0,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x8e7,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x8fb,0x8ef,0x8f3,0x489,0x489,0x489,0x489,0x489,
|
||||
0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0x903,0x489,0x489,0x489,0x489,0x90b,0x90f,
|
||||
0x917,0x91f,0x923,0x92b,0x489,0x489,0x489,0x92f,0x937,0x37a,0x93f,0x947,0x38a,0x38a,0x38a,0x94f,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0xe28,0xe28,0xe68,0xea8,0xe28,0xe28,0xe28,0xe28,0xe28,0xe28,0xee0,0xf20,0xf60,0xf70,0xfb0,0xfbc,
|
||||
0xe28,0xe28,0xffc,0xe28,0xe28,0xe28,0x1034,0x1074,0x10b4,0x10f4,0x112c,0x116c,0x11ac,0x11e4,0x1224,0x1264,
|
||||
0xa40,0xa80,0xac0,0xafa,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xb25,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xb62,0x1a0,0x1a0,0xb97,0xbd7,0xc17,0xc57,0xc97,0xcd7,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0xd57,0xd67,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,
|
||||
0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0x1a0,0xd17,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x957,0x38a,0x654,0x654,0x95f,0x5f7,0x38a,0x4f0,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x967,0x38a,0x38a,0x38a,0x96e,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x976,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,
|
||||
0x97e,0x982,0x41f,0x41f,0x41f,0x41f,0x992,0x98a,0x41f,0x99a,0x41f,0x41f,0x9a2,0x9a8,0x41f,0x41f,
|
||||
0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,
|
||||
0x41f,0x41f,0x41f,0x9b0,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,
|
||||
0x4f7,0x9b8,0x9bf,0x9c6,0x401,0x9c9,0x38a,0x38a,0x4dd,0x9d1,0x38a,0x9d7,0x401,0x9dc,0x609,0x38a,
|
||||
0x38a,0x9e4,0x38a,0x38a,0x38a,0x38a,0x826,0x9ec,0x401,0x4f8,0x556,0x9f3,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x9b8,0x9fb,0x38a,0x38a,0x9ff,0xa07,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0xa0b,0xa13,0x38a,
|
||||
0x38a,0xa1b,0x556,0xa23,0x38a,0xa29,0x38a,0x38a,0x5e7,0xa31,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0xa39,0xa3d,0xa45,0x38a,0xa4c,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0xa53,0x38a,0x38a,0xa61,0xa5b,
|
||||
0x38a,0x38a,0x38a,0xa69,0xa71,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0xa75,0x38a,0xa7b,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0xa81,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x511,0xa89,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0xa90,0xa98,0xa9e,0x38a,0x38a,0x654,0x654,0xaa6,0x38a,0x38a,0x38a,0x38a,0x38a,0x654,
|
||||
0x654,0xaae,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0xab4,0x38a,0xabb,
|
||||
0x38a,0xab7,0x38a,0xabe,0x38a,0xac6,0xaca,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x3d8,0xad2,0x3d8,0xad9,0xae0,0xae8,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0xaf0,0xaf8,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0xb00,0x41f,0xb08,
|
||||
0xb08,0xb0f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,
|
||||
0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,
|
||||
0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x489,0x489,0x489,0x489,0x489,0x489,0x489,0xb17,0x41f,
|
||||
0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x41f,0x654,0xb1f,0x654,0x654,0x657,0xb24,0xb28,0x840,0xb30,
|
||||
0x38a,0x38a,0xb36,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x764,0x38a,0x38a,0x38a,0x38a,0x654,
|
||||
0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,
|
||||
0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0x654,0xb3e,0xb46,0x654,
|
||||
0x654,0x654,0x657,0x654,0x654,0xb3e,0x38a,0xb1f,0x654,0xb4e,0x654,0xb56,0x842,0x38a,0x38a,0xb1f,
|
||||
0xb5a,0xb62,0x659,0x656,0x38a,0xb6a,0x56d,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0xb72,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,
|
||||
0x38a,0x38a,0x38a,0x38a,0x38a,0x38a,0xb72,0xb82,0xb7a,0xb7a,0xb7a,0xb83,0xb83,0xb83,0xb83,0x3d8,
|
||||
0x3d8,0x3d8,0x3d8,0x3d8,0x3d8,0x3d8,0xb8b,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,
|
||||
0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,
|
||||
0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,
|
||||
0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,
|
||||
0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0xb83,0x369,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
|
||||
0x12,8,7,8,9,7,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
|
||||
0x12,0x12,0x12,0x12,7,7,7,8,9,0xa,0xa,4,4,4,0xa,0xa,
|
||||
0x310a,0xf20a,0xa,3,6,3,6,6,2,2,2,2,2,2,2,2,
|
||||
2,2,6,0xa,0x500a,0xa,0xd00a,0xa,0xa,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0x510a,0xa,0xd20a,0xa,0xa,0xa,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0x510a,0xa,0xd20a,0xa,0x12,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0x12,0x12,0x12,0x12,0x12,7,0x12,0x12,
|
||||
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
|
||||
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,6,0xa,4,4,4,4,0xa,0xa,
|
||||
0xa,0xa,0,0x900a,0xa,0xb2,0xa,0xa,4,4,2,2,0xa,0,0xa,0xa,
|
||||
0xa,2,0,0x900a,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0xa,0xa,0,0,0,0,0,
|
||||
0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0,0,0,0,0xa,0xa,0,0,0,0,0,0,0,0,0xa,0,
|
||||
0,0,0,0,0xa,0xa,0,0xa,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0,
|
||||
0,0xa,0xa,4,1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,1,0xb1,1,0xb1,0xb1,1,0xb1,0xb1,1,0xb1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,5,5,5,5,5,5,0xa,0xa,0xd,4,4,0xd,
|
||||
6,0xd,0xa,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,
|
||||
0x8ad,0xd,0xd,0xd,0x4d,0xd,0x8d,0x8d,0x8d,0x8d,0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,
|
||||
0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
|
||||
0x4d,0x4d,0x4d,0x4d,0x2d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,5,5,5,5,5,5,5,5,5,5,4,5,
|
||||
5,0xd,0x4d,0x4d,0xb1,0x8d,0x8d,0x8d,0xd,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,
|
||||
0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,
|
||||
0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
|
||||
0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,
|
||||
0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x8d,
|
||||
0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x8d,0x8d,
|
||||
0xd,0x8d,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,5,0xa,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xd,0xd,0xb1,0xb1,0xa,0xb1,0xb1,0xb1,0xb1,0x8d,0x8d,2,2,2,2,
|
||||
2,2,2,2,2,2,0x4d,0x4d,0x4d,0xd,0xd,0x4d,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xad,0x8d,0xb1,0x4d,0x4d,
|
||||
0x4d,0x8d,0x8d,0x8d,0x8d,0x8d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,
|
||||
0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,0x4d,0x8d,0x4d,0x4d,0x8d,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xd,
|
||||
0xd,0x8d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,0x8d,
|
||||
0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,
|
||||
0x8d,0x4d,0x4d,0x4d,0x4d,0x8d,0x4d,0x8d,0x8d,0x4d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,
|
||||
0x4d,0x4d,0x4d,0x4d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,1,1,1,1,1,1,1,1,1,1,0x41,0x41,
|
||||
0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
|
||||
0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,0xa,0xa,0xa,0xa,0x21,1,
|
||||
1,1,1,1,0xb1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,0xb1,0xb1,0xb1,0xb1,1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0x81,0x41,0x41,0x41,0x41,0x41,0x81,0x81,0x41,0x81,0x41,0x41,
|
||||
0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x81,0x41,1,1,1,0xb1,0xb1,0xb1,
|
||||
1,1,1,1,0x4d,0xd,0x4d,0x4d,0x4d,0x4d,0xd,0x8d,0x4d,0x8d,0x8d,0xd,
|
||||
0xd,0xd,0xd,0xd,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,0xb1,0xb1,5,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x4d,0x8d,0x8d,
|
||||
0x8d,0xd,0x8d,0x4d,0x4d,0x8d,0x8d,0x4d,0x4d,0xd,0x4d,0x4d,0x4d,0x8d,0x4d,0x4d,
|
||||
0x4d,0x4d,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0xb1,0,0xb1,0,0,0,0,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0xb1,0,0,0,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,
|
||||
0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,4,4,0,0,0,0,0,0,0,4,0,0,0,0,
|
||||
0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0,0,
|
||||
0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0xb1,0xb1,0,0,0,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,
|
||||
0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,4,0,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0xb1,0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,
|
||||
0,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,4,0xa,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,
|
||||
0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,
|
||||
0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xb1,0,0,0xa0,0,0,0,0,
|
||||
0,0,0xa0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
|
||||
0,0,0,4,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,
|
||||
0xb1,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0xb1,0,0xb1,0,0xb1,0x310a,0xf20a,0x310a,0xf20a,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0xb1,0xb1,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,
|
||||
0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,
|
||||
0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0xa,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0x310a,0xf20a,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,4,
|
||||
0,0xb1,0,0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
|
||||
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
|
||||
0x40,0x40,0x40,0x40,0x40,0xb1,0x40,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0x4a,0xa,0xa,0x2a,0xb1,0xb1,0xb1,0x12,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0x40,0x40,0x40,0x40,
|
||||
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
|
||||
0x40,0x40,0x40,0x40,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0x40,
|
||||
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
|
||||
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xb1,0xb1,0xb1,0,0,0,0,0xb1,
|
||||
0xb1,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,
|
||||
0,0xb1,0xb1,0xb1,0,0,0,0,0xa,0,0,0,0xa,0xa,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0xb1,0xb1,0,0,0xb1,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0xb1,0,
|
||||
0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0xb1,0xb1,0,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0,
|
||||
0xb1,0xb1,0,0,0,0xb1,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,
|
||||
0,0xb1,0,0,0,0,0,0,0xb1,0,0,0,0xb1,0xb1,0,0,
|
||||
0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xa,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xa,0xa,0,0xa,0xa,0xa,0xa,6,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,9,0xb2,0xb2,0xb2,0xb2,0xb2,0x12,0x814,0x815,0x813,0x816,0xb2,0xb2,
|
||||
0xb2,0xb2,0xb2,0xb2,2,0,0,0,2,2,2,2,2,2,3,3,
|
||||
0xa,0x310a,0xf20a,0,9,9,9,9,9,9,9,9,9,9,9,0xb2,
|
||||
0x412,0x432,0x8a0,0x8a1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,9,7,0x8ab,0x8ae,0x8b0,0x8ac,0x8af,6,4,4,4,4,
|
||||
4,0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,2,2,2,2,
|
||||
2,2,2,2,2,2,3,3,0xa,0x310a,0xf20a,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
|
||||
4,4,4,4,4,4,4,4,4,4,4,4,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa,0xa,0,0xa,
|
||||
0xa,0xa,0xa,0,0xa,0xa,0,0,0,0,0,0,0,0,0,0,
|
||||
0xa,0,0xa,0xa,0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0,0xa,0,0xa,0,0xa,0,0,0,0,4,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0xa,0xa,0,0,0,0,0x100a,0xa,0xa,0xa,
|
||||
0xa,0,0,0,0,0,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,
|
||||
0,0,0,0,0,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,
|
||||
0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a,0x900a,0x900a,
|
||||
0x900a,0x100a,0x900a,0x900a,0x100a,0x100a,0x900a,0x900a,0x900a,0x900a,0x900a,0x100a,0xa,0x100a,0x100a,0x100a,
|
||||
0x100a,0xa,0xa,0xa,0x700a,0x700a,0x700a,0xb00a,0xb00a,0xb00a,0xa,0xa,0xa,0x100a,3,4,
|
||||
0xa,0x900a,0x100a,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a,0x100a,0x100a,0xa,
|
||||
0x100a,0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,
|
||||
0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x300a,0xf00a,0x100a,0x100a,0x100a,0x100a,0x100a,0x900a,
|
||||
0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,
|
||||
0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0x100a,0xa,
|
||||
0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,
|
||||
0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x100a,0xa,0xa,0x300a,
|
||||
0xf00a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0x300a,0xf00a,0xa,0xa,0x900a,0x100a,0x900a,0x900a,0x100a,0x900a,0x100a,0x100a,0x100a,0x100a,
|
||||
0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x100a,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x900a,0xa,0xa,
|
||||
0x300a,0xf00a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,0,0,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,
|
||||
0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0x100a,0xa,0xa,0x300a,0xf00a,0x310a,0xf20a,0xa,0x300a,0xf00a,0xa,0x500a,
|
||||
0x100a,0xd00a,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,
|
||||
0x100a,0x300a,0xf00a,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,
|
||||
0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0x100a,0xa,0x100a,0x100a,0x100a,0xa,0xa,0x100a,0x100a,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x900a,0x100a,0x100a,0x300a,0xf00a,0xa,0xa,
|
||||
0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,
|
||||
0xf20a,0x710a,0x320a,0xf10a,0xb20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0x100a,
|
||||
0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0x300a,0xf00a,0x100a,0x100a,0x300a,0xf00a,0xa,0xa,0xa,0x100a,0xa,0xa,0xa,0xa,0x100a,0x300a,
|
||||
0xf00a,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x100a,0xa,0xa,0xa,
|
||||
0xa,0xa,0x100a,0x900a,0x900a,0x900a,0x100a,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0xa,
|
||||
0xa,0xa,0xa,0x100a,0xa,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x100a,0xa,0x100a,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,
|
||||
0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a,
|
||||
0x100a,0x100a,0xa,0xa,0x100a,0xa,0x100a,0xa,0xa,0x100a,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,
|
||||
0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x100a,0x100a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0x300a,0xf00a,0xa,0xa,0xa,0xa,0x100a,0x100a,0x100a,0x100a,0xa,0x100a,0x100a,0xa,0xa,0x100a,
|
||||
0x100a,0xa,0xa,0xa,0xa,0x300a,0xf00a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,
|
||||
0xf00a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x300a,
|
||||
0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x100a,
|
||||
0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,0x300a,0xf00a,0x100a,0x100a,0x300a,
|
||||
0xf00a,0x100a,0x100a,0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x100a,
|
||||
0x100a,0x100a,0x100a,0x100a,0x100a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0x300a,0xf00a,0xa,
|
||||
0xa,0xa,0xa,0xa,0x100a,0xa,0x900a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,
|
||||
0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0xb1,0xa,0xa,0x300a,0xf00a,0x300a,0xf00a,0xa,0xa,
|
||||
0xa,0x300a,0xf00a,0xa,0x300a,0xf00a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0x300a,0xf00a,0xa,0xa,0x300a,0xf00a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,
|
||||
0x310a,0xf20a,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0,0,0,0,0xa,0,0,0,0,0,0,0,
|
||||
0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xa,0,0,0,0,0,0xa,0xa,
|
||||
0,0,0,0,0,0xa,0xa,0xa,9,0xa,0xa,0xa,0xa,0,0,0,
|
||||
0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,
|
||||
0x310a,0xf20a,0x310a,0xf20a,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xb1,0xb1,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa,
|
||||
0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0xa,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xa,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa,0xa,0,0,0,0,0,0,0,0,
|
||||
0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0xb1,0,0,0,0xb1,0,
|
||||
0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0xa,0xa,0xa,0xa,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,
|
||||
0,0,0,0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
|
||||
0x40,0x40,0x40,0x40,0x40,0x40,0x60,0,0xa,0xa,0xa,0xa,0,0,0,0,
|
||||
0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
|
||||
0,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0xb1,0,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,0,0,0,0,0xb1,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,
|
||||
0,0,0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,
|
||||
0,0xb1,0,0,0xb1,0,0,0,0,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,
|
||||
1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,1,0xb1,1,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0x12,0x12,0x12,0x12,
|
||||
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xd,0xd,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,6,0xa,6,0,
|
||||
0xa,6,0xa,0xa,0xa,0x310a,0xf20a,0x310a,0xf20a,0x310a,0xf20a,4,0xa,0xa,3,3,
|
||||
0x300a,0xf00a,0xa,0,0xa,4,4,0xa,0,0,0,0,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xb2,0,0xa,0xa,4,
|
||||
4,4,0xa,0xa,0x310a,0xf20a,0xa,3,6,3,6,6,2,2,2,2,
|
||||
2,2,2,2,2,2,6,0xa,0x500a,0xa,0xd00a,0xa,0xa,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0x510a,0xa,0xd20a,0xa,0x310a,0xf20a,0xa,0x310a,0xf20a,
|
||||
0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,4,4,0xa,0xa,
|
||||
0xa,4,4,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0x12,0x12,0x12,0x12,
|
||||
0x12,0x12,0x12,0x12,0x12,0xaa,0xaa,0xaa,0xa,0xa,0x12,0x12,0,0xa,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0xb1,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0,0,0,0,0,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,0xa,1,0xb1,0xb1,0xb1,1,0xb1,0xb1,1,
|
||||
1,1,1,1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
0xb1,0xb1,0xb1,1,1,1,1,0xb1,0x41,0x81,1,1,0x81,0xb1,0xb1,1,
|
||||
1,1,1,0x41,0x41,0x41,0x41,0x81,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,0x41,0x41,0x41,0x41,0x41,0x81,1,0x81,
|
||||
1,0x81,0x81,1,1,0x61,0x81,0x81,0x81,0x81,0x81,0x41,0x41,0x41,0x41,0x61,
|
||||
0x41,0x41,0x41,0x41,0x41,0x81,0x41,0x41,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
1,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0x41,0x81,0x41,0x81,0x81,0x81,0x41,0x41,
|
||||
0x41,0x81,0x41,0x41,0x81,0x41,0x81,0x81,0x41,0x81,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,0x81,0x81,0x81,0x81,0x41,0x41,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
|
||||
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,
|
||||
0,0xa0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
|
||||
0xb1,0xb1,0,0,0xb1,0,0xb1,0xb1,0,0,0,0,0,0,0xb1,0,
|
||||
0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0xb1,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,
|
||||
0xb1,0xb1,0,0,0,0,0,0,0xb1,0xb1,0,0xb1,0xb1,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xb1,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0,0xb1,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb1,
|
||||
0,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,
|
||||
0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,
|
||||
0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,
|
||||
0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xa0,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,
|
||||
0,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0xb1,0,
|
||||
0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0xb2,0xb2,0xb2,0xb2,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xb1,0xb1,0xb1,0xa,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0x100a,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0x100a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0x100a,0,0,0,0,
|
||||
0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
|
||||
2,2,2,2,2,2,2,2,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,
|
||||
0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0,0,0,0,0,0,0,0,0xb1,0,0,0,0,0,0,
|
||||
0,0,0,0,0xb1,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0xb1,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0,0xb1,0xb1,0,0xb1,0xb1,0xb1,0xb1,0xb1,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,
|
||||
0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
|
||||
0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,1,1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,0xd,0xd,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xd,0xd,
|
||||
0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xd,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,
|
||||
0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
2,2,2,2,2,2,2,2,2,2,2,0xa,0xa,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0xa,0xa,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,
|
||||
0xa,0xa,0xa,0xa,0xa,0xa,0xa,0xa,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0x12,0x12,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,
|
||||
0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,
|
||||
0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0xb2,0x12,0xb2,0x12,0x12,0x12,0x12,0x12,0x12,
|
||||
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,
|
||||
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0xb1,0xb1,0xb1,0xb1,
|
||||
0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0xb1,0x12,0x12,0x12,0x12,
|
||||
0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0,0,0,0
|
||||
};
|
||||
|
||||
static const uint32_t ubidi_props_mirrors[26]={
|
||||
0x2000ab,0xbb,0x2a02215,0x1202243,0x2802298,0x2c022a6,0x30022a8,0x2e022a9,0x32022ab,0x6022cd,0x1e022f2,0x20022f3,0x22022f4,0x24022f6,0x26022f7,0x14022fa,
|
||||
0x16022fb,0x18022fc,0x1a022fd,0x1c022fe,0x8029b8,0x4029f5,0xa02ade,0xe02ae3,0xc02ae4,0x1002ae5
|
||||
};
|
||||
|
||||
static const uint8_t ubidi_props_jgArray[672]={
|
||||
0x2d,0,3,3,0x2c,3,0x2d,3,4,0x2a,4,4,0xd,0xd,0xd,6,
|
||||
6,0x1f,0x1f,0x23,0x23,0x21,0x21,0x28,0x28,1,1,0xb,0xb,0x37,0x37,0x37,
|
||||
0,9,0x1d,0x13,0x16,0x18,0x1a,0x10,0x2c,0x2d,0x2d,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0x1d,
|
||||
0,3,3,3,0,3,0x2c,0x2c,0x2d,4,4,4,4,4,4,4,
|
||||
4,0xd,0xd,0xd,0xd,0xd,0xd,0xd,6,6,6,6,6,6,6,6,
|
||||
6,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x1f,0x23,0x23,0x23,0x21,0x21,0x28,
|
||||
1,9,9,9,9,9,9,0x1d,0x1d,0xb,0x26,0xb,0x13,0x13,0x13,0xb,
|
||||
0xb,0xb,0xb,0xb,0xb,0x16,0x16,0x16,0x16,0x1a,0x1a,0x1a,0x1a,0x38,0x15,0xd,
|
||||
0x2a,0x11,0x11,0xe,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x2c,0x37,0x2f,0x37,0x2c,
|
||||
0x2d,0x2d,0x2e,0x2e,0,0x2a,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0x1f,
|
||||
0,0,0,0,0,0,0,0,0,0,0x23,0x21,1,0,0,0x15,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
2,0,5,0xc,0xc,7,7,0xf,0x27,0x32,0x12,0x2b,0x2b,0x30,0x31,0x14,
|
||||
0x17,0x19,0x1b,0x24,0xa,8,0x1c,0x20,0x22,0x1e,7,0x25,0x29,5,0xc,7,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0x35,0x34,0x33,
|
||||
4,4,4,4,4,4,4,0xd,0xd,6,6,0x1f,0x23,1,1,1,
|
||||
9,9,0xb,0xb,0xb,0x18,0x18,0x1a,0x1a,0x1a,0x16,0x1f,0x1f,0x23,0xd,0xd,
|
||||
0x23,0x1f,0xd,3,3,0x37,0x37,0x2d,0x2c,0x2c,0x36,0x36,0xd,0x23,0x23,0x13,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0x5d,0x5a,0x60,0x63,0x5e,0x5f,0x59,0x61,0x5b,0x5c,0x62,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
4,4,0xd,0x28,9,0x1d,0x16,0x18,0x2d,0x2d,0x1f,0x2c,0x39,0,6,0x21,
|
||||
0xb,0x55,0x1f,1,0x13,0,4,4,4,0x1f,0x2d,0x56,0x58,0x57,0,0
|
||||
};
|
||||
|
||||
static const uint8_t ubidi_props_jgArray2[48]={
|
||||
0x3a,0x3c,0x3c,0x40,0x40,0x3d,0,0x52,0,0x54,0x54,0,0,0x41,0x4f,0x53,
|
||||
0x43,0x43,0x43,0x44,0x3e,0x50,0x45,0x46,0x4c,0x3b,0x3b,0x48,0x48,0x4b,0x49,0x49,
|
||||
0x49,0x4a,0,0,0x4d,0,0,0,0,0,0,0x47,0x3f,0x4e,0x51,0x42
|
||||
};
|
||||
|
||||
static const UBiDiProps ubidi_props_singleton={
|
||||
NULL,
|
||||
ubidi_props_indexes,
|
||||
ubidi_props_mirrors,
|
||||
ubidi_props_jgArray,
|
||||
ubidi_props_jgArray2,
|
||||
{
|
||||
ubidi_props_trieIndex,
|
||||
ubidi_props_trieIndex+3496,
|
||||
NULL,
|
||||
3496,
|
||||
8360,
|
||||
0x1a0,
|
||||
0xe28,
|
||||
0x0,
|
||||
0x0,
|
||||
0x110000,
|
||||
0x2e4c,
|
||||
NULL, 0, FALSE, FALSE, 0, NULL
|
||||
},
|
||||
{ 2,2,0,0 }
|
||||
};
|
||||
|
||||
#endif // INCLUDED_FROM_UBIDI_PROPS_C
|
||||
468
vendor/icu/src/ubidiimp.h
vendored
Normal file
468
vendor/icu/src/ubidiimp.h
vendored
Normal file
@@ -0,0 +1,468 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: ubidiimp.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 1999aug06
|
||||
* created by: Markus W. Scherer, updated by Matitiahu Allouche
|
||||
*/
|
||||
|
||||
#ifndef UBIDIIMP_H
|
||||
#define UBIDIIMP_H
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/ubidi.h>
|
||||
#include <unicode/uchar.h>
|
||||
#include "ubidi_props.h"
|
||||
|
||||
/* miscellaneous definitions ---------------------------------------------- */
|
||||
|
||||
typedef uint8_t DirProp;
|
||||
typedef uint32_t Flags;
|
||||
|
||||
/* Comparing the description of the BiDi algorithm with this implementation
|
||||
is easier with the same names for the BiDi types in the code as there.
|
||||
See UCharDirection in uchar.h .
|
||||
*/
|
||||
enum {
|
||||
L= U_LEFT_TO_RIGHT, /* 0 */
|
||||
R= U_RIGHT_TO_LEFT, /* 1 */
|
||||
EN= U_EUROPEAN_NUMBER, /* 2 */
|
||||
ES= U_EUROPEAN_NUMBER_SEPARATOR, /* 3 */
|
||||
ET= U_EUROPEAN_NUMBER_TERMINATOR, /* 4 */
|
||||
AN= U_ARABIC_NUMBER, /* 5 */
|
||||
CS= U_COMMON_NUMBER_SEPARATOR, /* 6 */
|
||||
B= U_BLOCK_SEPARATOR, /* 7 */
|
||||
S= U_SEGMENT_SEPARATOR, /* 8 */
|
||||
WS= U_WHITE_SPACE_NEUTRAL, /* 9 */
|
||||
ON= U_OTHER_NEUTRAL, /* 10 */
|
||||
LRE=U_LEFT_TO_RIGHT_EMBEDDING, /* 11 */
|
||||
LRO=U_LEFT_TO_RIGHT_OVERRIDE, /* 12 */
|
||||
AL= U_RIGHT_TO_LEFT_ARABIC, /* 13 */
|
||||
RLE=U_RIGHT_TO_LEFT_EMBEDDING, /* 14 */
|
||||
RLO=U_RIGHT_TO_LEFT_OVERRIDE, /* 15 */
|
||||
PDF=U_POP_DIRECTIONAL_FORMAT, /* 16 */
|
||||
NSM=U_DIR_NON_SPACING_MARK, /* 17 */
|
||||
BN= U_BOUNDARY_NEUTRAL, /* 18 */
|
||||
FSI=U_FIRST_STRONG_ISOLATE, /* 19 */
|
||||
LRI=U_LEFT_TO_RIGHT_ISOLATE, /* 20 */
|
||||
RLI=U_RIGHT_TO_LEFT_ISOLATE, /* 21 */
|
||||
PDI=U_POP_DIRECTIONAL_ISOLATE, /* 22 */
|
||||
ENL, /* EN after W7 */ /* 23 */
|
||||
ENR, /* EN not subject to W7 */ /* 24 */
|
||||
dirPropCount
|
||||
};
|
||||
|
||||
/* Sometimes, bit values are more appropriate
|
||||
to deal with directionality properties.
|
||||
Abbreviations in these macro names refer to names
|
||||
used in the BiDi algorithm.
|
||||
*/
|
||||
#define DIRPROP_FLAG(dir) (1UL<<(dir))
|
||||
#define PURE_DIRPROP(prop) ((prop)&~0xE0) ?????????????????????????
|
||||
|
||||
/* special flag for multiple runs from explicit embedding codes */
|
||||
#define DIRPROP_FLAG_MULTI_RUNS (1UL<<31)
|
||||
|
||||
/* are there any characters that are LTR or RTL? */
|
||||
#define MASK_LTR (DIRPROP_FLAG(L)|DIRPROP_FLAG(EN)|DIRPROP_FLAG(ENL)|DIRPROP_FLAG(ENR)|DIRPROP_FLAG(AN)|DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO)|DIRPROP_FLAG(LRI))
|
||||
#define MASK_RTL (DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)|DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO)|DIRPROP_FLAG(RLI))
|
||||
#define MASK_R_AL (DIRPROP_FLAG(R)|DIRPROP_FLAG(AL))
|
||||
#define MASK_STRONG_EN_AN (DIRPROP_FLAG(L)|DIRPROP_FLAG(R)|DIRPROP_FLAG(AL)|DIRPROP_FLAG(EN)|DIRPROP_FLAG(AN))
|
||||
|
||||
/* explicit embedding codes */
|
||||
#define MASK_EXPLICIT (DIRPROP_FLAG(LRE)|DIRPROP_FLAG(LRO)|DIRPROP_FLAG(RLE)|DIRPROP_FLAG(RLO)|DIRPROP_FLAG(PDF))
|
||||
|
||||
/* explicit isolate codes */
|
||||
#define MASK_ISO (DIRPROP_FLAG(LRI)|DIRPROP_FLAG(RLI)|DIRPROP_FLAG(FSI)|DIRPROP_FLAG(PDI))
|
||||
|
||||
#define MASK_BN_EXPLICIT (DIRPROP_FLAG(BN)|MASK_EXPLICIT)
|
||||
|
||||
/* paragraph and segment separators */
|
||||
#define MASK_B_S (DIRPROP_FLAG(B)|DIRPROP_FLAG(S))
|
||||
|
||||
/* all types that are counted as White Space or Neutral in some steps */
|
||||
#define MASK_WS (MASK_B_S|DIRPROP_FLAG(WS)|MASK_BN_EXPLICIT|MASK_ISO)
|
||||
|
||||
/* types that are neutrals or could becomes neutrals in (Wn) */
|
||||
#define MASK_POSSIBLE_N (DIRPROP_FLAG(ON)|DIRPROP_FLAG(CS)|DIRPROP_FLAG(ES)|DIRPROP_FLAG(ET)|MASK_WS)
|
||||
|
||||
/*
|
||||
* These types may be changed to "e",
|
||||
* the embedding type (L or R) of the run,
|
||||
* in the BiDi algorithm (N2)
|
||||
*/
|
||||
#define MASK_EMBEDDING (DIRPROP_FLAG(NSM)|MASK_POSSIBLE_N)
|
||||
|
||||
/* the dirProp's L and R are defined to 0 and 1 values in UCharDirection */
|
||||
#define GET_LR_FROM_LEVEL(level) ((DirProp)((level)&1))
|
||||
|
||||
#define IS_DEFAULT_LEVEL(level) ((level)>=0xfe)
|
||||
|
||||
/*
|
||||
* The following bit is used for the directional isolate status.
|
||||
* Stack entries corresponding to isolate sequences are greater than ISOLATE.
|
||||
*/
|
||||
#define ISOLATE 0x0100
|
||||
|
||||
U_CFUNC UBiDiLevel
|
||||
ubidi_getParaLevelAtIndex(const UBiDi *pBiDi, int32_t index);
|
||||
|
||||
#define GET_PARALEVEL(ubidi, index) \
|
||||
((UBiDiLevel)(!(ubidi)->defaultParaLevel || (index)<(ubidi)->paras[0].limit ? \
|
||||
(ubidi)->paraLevel : ubidi_getParaLevelAtIndex((ubidi), (index))))
|
||||
|
||||
/* number of paras entries allocated initially without malloc */
|
||||
#define SIMPLE_PARAS_COUNT 10
|
||||
/* number of isolate entries allocated initially without malloc */
|
||||
#define SIMPLE_ISOLATES_COUNT 5
|
||||
/* number of isolate run entries for paired brackets allocated initially without malloc */
|
||||
#define SIMPLE_OPENINGS_COUNT 20
|
||||
|
||||
#define CR 0x000D
|
||||
#define LF 0x000A
|
||||
|
||||
/* Run structure for reordering --------------------------------------------- */
|
||||
enum {
|
||||
LRM_BEFORE=1,
|
||||
LRM_AFTER=2,
|
||||
RLM_BEFORE=4,
|
||||
RLM_AFTER=8
|
||||
};
|
||||
|
||||
typedef struct Para {
|
||||
int32_t limit;
|
||||
int32_t level;
|
||||
} Para;
|
||||
|
||||
enum { /* flags for Opening.flags */
|
||||
FOUND_L=DIRPROP_FLAG(L),
|
||||
FOUND_R=DIRPROP_FLAG(R)
|
||||
};
|
||||
|
||||
typedef struct Opening {
|
||||
int32_t position; /* position of opening bracket */
|
||||
int32_t match; /* matching char or -position of closing bracket */
|
||||
int32_t contextPos; /* position of last strong char found before opening */
|
||||
uint16_t flags; /* bits for L or R/AL found within the pair */
|
||||
UBiDiDirection contextDir; /* L or R according to last strong char before opening */
|
||||
uint8_t filler; /* to complete a nice multiple of 4 chars */
|
||||
} Opening;
|
||||
|
||||
typedef struct IsoRun {
|
||||
int32_t contextPos; /* position of char determining context */
|
||||
uint16_t start; /* index of first opening entry for this run */
|
||||
uint16_t limit; /* index after last opening entry for this run */
|
||||
UBiDiLevel level; /* level of this run */
|
||||
DirProp lastStrong; /* bidi class of last strong char found in this run */
|
||||
DirProp lastBase; /* bidi class of last base char found in this run */
|
||||
UBiDiDirection contextDir; /* L or R to use as context for following openings */
|
||||
} IsoRun;
|
||||
|
||||
typedef struct BracketData {
|
||||
UBiDi *pBiDi;
|
||||
/* array of opening entries which should be enough in most cases; no malloc() */
|
||||
Opening simpleOpenings[SIMPLE_OPENINGS_COUNT];
|
||||
Opening *openings; /* pointer to current array of entries */
|
||||
int32_t openingsCount; /* number of allocated entries */
|
||||
int32_t isoRunLast; /* index of last used entry */
|
||||
/* array of nested isolated sequence entries; can never excess UBIDI_MAX_EXPLICIT_LEVEL
|
||||
+ 1 for index 0, + 1 for before the first isolated sequence */
|
||||
IsoRun isoRuns[UBIDI_MAX_EXPLICIT_LEVEL+2];
|
||||
UBool isNumbersSpecial; /* reordering mode for NUMBERS_SPECIAL */
|
||||
} BracketData;
|
||||
|
||||
typedef struct Isolate {
|
||||
int32_t startON;
|
||||
int32_t start1;
|
||||
int32_t state;
|
||||
int16_t stateImp;
|
||||
} Isolate;
|
||||
|
||||
typedef struct Run {
|
||||
int32_t logicalStart, /* first character of the run; b31 indicates even/odd level */
|
||||
visualLimit, /* last visual position of the run +1 */
|
||||
insertRemove; /* if >0, flags for inserting LRM/RLM before/after run,
|
||||
if <0, count of bidi controls within run */
|
||||
} Run;
|
||||
|
||||
/* in a Run, logicalStart will get this bit set if the run level is odd */
|
||||
#define INDEX_ODD_BIT (1UL<<31)
|
||||
|
||||
#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)(level)<<31))
|
||||
#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)(level)<<31))
|
||||
#define REMOVE_ODD_BIT(x) ((x)&=~INDEX_ODD_BIT)
|
||||
|
||||
#define GET_INDEX(x) ((x)&~INDEX_ODD_BIT)
|
||||
#define GET_ODD_BIT(x) ((uint32_t)(x)>>31)
|
||||
#define IS_ODD_RUN(x) ((UBool)(((x)&INDEX_ODD_BIT)!=0))
|
||||
#define IS_EVEN_RUN(x) ((UBool)(((x)&INDEX_ODD_BIT)==0))
|
||||
|
||||
U_CFUNC UBool
|
||||
ubidi_getRuns(UBiDi *pBiDi, UErrorCode *pErrorCode);
|
||||
|
||||
/** BiDi control code points */
|
||||
enum {
|
||||
ZWNJ_CHAR=0x200c,
|
||||
ZWJ_CHAR,
|
||||
LRM_CHAR,
|
||||
RLM_CHAR,
|
||||
LRE_CHAR=0x202a,
|
||||
RLE_CHAR,
|
||||
PDF_CHAR,
|
||||
LRO_CHAR,
|
||||
RLO_CHAR,
|
||||
LRI_CHAR=0x2066,
|
||||
RLI_CHAR,
|
||||
FSI_CHAR,
|
||||
PDI_CHAR
|
||||
};
|
||||
|
||||
#define IS_BIDI_CONTROL_CHAR(c) (((uint32_t)(c)&0xfffffffc)==ZWNJ_CHAR || (uint32_t)((c)-LRE_CHAR)<5 || (uint32_t)((c)-LRI_CHAR)<4)
|
||||
|
||||
/* InsertPoints structure for noting where to put BiDi marks ---------------- */
|
||||
|
||||
typedef struct Point {
|
||||
int32_t pos; /* position in text */
|
||||
int32_t flag; /* flag for LRM/RLM, before/after */
|
||||
} Point;
|
||||
|
||||
typedef struct InsertPoints {
|
||||
int32_t capacity; /* number of points allocated */
|
||||
int32_t size; /* number of points used */
|
||||
int32_t confirmed; /* number of points confirmed */
|
||||
UErrorCode errorCode; /* for eventual memory shortage */
|
||||
Point *points; /* pointer to array of points */
|
||||
} InsertPoints;
|
||||
|
||||
|
||||
/* UBiDi structure ----------------------------------------------------------- */
|
||||
|
||||
struct UBiDi {
|
||||
/* pointer to parent paragraph object (pointer to self if this object is
|
||||
* a paragraph object); set to NULL in a newly opened object; set to a
|
||||
* real value after a successful execution of ubidi_setPara or ubidi_setLine
|
||||
*/
|
||||
const UBiDi * pParaBiDi;
|
||||
|
||||
/* alias pointer to the current text */
|
||||
const UChar *text;
|
||||
|
||||
/* length of the current text */
|
||||
int32_t originalLength;
|
||||
|
||||
/* if the UBIDI_OPTION_STREAMING option is set, this is the length
|
||||
* of text actually processed by ubidi_setPara, which may be shorter than
|
||||
* the original length.
|
||||
* Otherwise, it is identical to the original length.
|
||||
*/
|
||||
int32_t length;
|
||||
|
||||
/* if the UBIDI_OPTION_REMOVE_CONTROLS option is set, and/or
|
||||
* marks are allowed to be inserted in one of the reordering mode, the
|
||||
* length of the result string may be different from the processed length.
|
||||
*/
|
||||
int32_t resultLength;
|
||||
|
||||
/* memory sizes in bytes */
|
||||
int32_t dirPropsSize, levelsSize, openingsSize, parasSize, runsSize, isolatesSize;
|
||||
|
||||
/* allocated memory */
|
||||
DirProp *dirPropsMemory;
|
||||
UBiDiLevel *levelsMemory;
|
||||
Opening *openingsMemory;
|
||||
Para *parasMemory;
|
||||
Run *runsMemory;
|
||||
Isolate *isolatesMemory;
|
||||
|
||||
/* indicators for whether memory may be allocated after ubidi_open() */
|
||||
UBool mayAllocateText, mayAllocateRuns;
|
||||
|
||||
/* arrays with one value per text-character */
|
||||
DirProp *dirProps;
|
||||
UBiDiLevel *levels;
|
||||
|
||||
/* are we performing an approximation of the "inverse BiDi" algorithm? */
|
||||
UBool isInverse;
|
||||
|
||||
/* are we using the basic algorithm or its variation? */
|
||||
UBiDiReorderingMode reorderingMode;
|
||||
|
||||
/* UBIDI_REORDER_xxx values must be ordered so that all the regular
|
||||
* logical to visual modes come first, and all inverse BiDi modes
|
||||
* come last.
|
||||
*/
|
||||
#define UBIDI_REORDER_LAST_LOGICAL_TO_VISUAL UBIDI_REORDER_NUMBERS_SPECIAL
|
||||
|
||||
/* bitmask for reordering options */
|
||||
uint32_t reorderingOptions;
|
||||
|
||||
/* must block separators receive level 0? */
|
||||
UBool orderParagraphsLTR;
|
||||
|
||||
/* the paragraph level */
|
||||
UBiDiLevel paraLevel;
|
||||
/* original paraLevel when contextual */
|
||||
/* must be one of UBIDI_DEFAULT_xxx or 0 if not contextual */
|
||||
UBiDiLevel defaultParaLevel;
|
||||
|
||||
/* context data */
|
||||
const UChar *prologue;
|
||||
int32_t proLength;
|
||||
const UChar *epilogue;
|
||||
int32_t epiLength;
|
||||
|
||||
/* the following is set in ubidi_setPara, used in processPropertySeq */
|
||||
const struct ImpTabPair * pImpTabPair; /* pointer to levels state table pair */
|
||||
|
||||
/* the overall paragraph or line directionality - see UBiDiDirection */
|
||||
UBiDiDirection direction;
|
||||
|
||||
/* flags is a bit set for which directional properties are in the text */
|
||||
Flags flags;
|
||||
|
||||
/* lastArabicPos is index to the last AL in the text, -1 if none */
|
||||
int32_t lastArabicPos;
|
||||
|
||||
/* characters after trailingWSStart are WS and are */
|
||||
/* implicitly at the paraLevel (rule (L1)) - levels may not reflect that */
|
||||
int32_t trailingWSStart;
|
||||
|
||||
/* fields for paragraph handling */
|
||||
int32_t paraCount; /* set in getDirProps() */
|
||||
/* filled in getDirProps() */
|
||||
Para *paras;
|
||||
|
||||
/* for relatively short text, we only need a tiny array of paras (no malloc()) */
|
||||
Para simpleParas[SIMPLE_PARAS_COUNT];
|
||||
|
||||
/* fields for line reordering */
|
||||
int32_t runCount; /* ==-1: runs not set up yet */
|
||||
Run *runs;
|
||||
|
||||
/* for non-mixed text, we only need a tiny array of runs (no malloc()) */
|
||||
Run simpleRuns[1];
|
||||
|
||||
/* maximum or current nesting depth of isolate sequences */
|
||||
/* Within resolveExplicitLevels() and checkExplicitLevels(), this is the maximal
|
||||
nesting encountered.
|
||||
Within resolveImplicitLevels(), this is the index of the current isolates
|
||||
stack entry. */
|
||||
int32_t isolateCount;
|
||||
Isolate *isolates;
|
||||
|
||||
/* for simple text, have a small stack (no malloc()) */
|
||||
Isolate simpleIsolates[SIMPLE_ISOLATES_COUNT];
|
||||
|
||||
/* for inverse Bidi with insertion of directional marks */
|
||||
InsertPoints insertPoints;
|
||||
|
||||
/* for option UBIDI_OPTION_REMOVE_CONTROLS */
|
||||
int32_t controlCount;
|
||||
|
||||
/* for Bidi class callback */
|
||||
UBiDiClassCallback *fnClassCallback; /* action pointer */
|
||||
const void *coClassCallback; /* context pointer */
|
||||
};
|
||||
|
||||
#define IS_VALID_PARA(x) ((x) && ((x)->pParaBiDi==(x)))
|
||||
#define IS_VALID_PARA_OR_LINE(x) ((x) && ((x)->pParaBiDi==(x) || (((x)->pParaBiDi) && (x)->pParaBiDi->pParaBiDi==(x)->pParaBiDi)))
|
||||
|
||||
typedef union {
|
||||
DirProp *dirPropsMemory;
|
||||
UBiDiLevel *levelsMemory;
|
||||
Opening *openingsMemory;
|
||||
Para *parasMemory;
|
||||
Run *runsMemory;
|
||||
Isolate *isolatesMemory;
|
||||
} BidiMemoryForAllocation;
|
||||
|
||||
/* Macros for initial checks at function entry */
|
||||
#define RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrcode, retvalue) \
|
||||
if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return retvalue
|
||||
#define RETURN_IF_NOT_VALID_PARA(bidi, errcode, retvalue) \
|
||||
if(!IS_VALID_PARA(bidi)) { \
|
||||
errcode=U_INVALID_STATE_ERROR; \
|
||||
return retvalue; \
|
||||
}
|
||||
#define RETURN_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode, retvalue) \
|
||||
if(!IS_VALID_PARA_OR_LINE(bidi)) { \
|
||||
errcode=U_INVALID_STATE_ERROR; \
|
||||
return retvalue; \
|
||||
}
|
||||
#define RETURN_IF_BAD_RANGE(arg, start, limit, errcode, retvalue) \
|
||||
if((arg)<(start) || (arg)>=(limit)) { \
|
||||
(errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
|
||||
return retvalue; \
|
||||
}
|
||||
|
||||
#define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) \
|
||||
if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return
|
||||
#define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) \
|
||||
if(!IS_VALID_PARA(bidi)) { \
|
||||
errcode=U_INVALID_STATE_ERROR; \
|
||||
return; \
|
||||
}
|
||||
#define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) \
|
||||
if(!IS_VALID_PARA_OR_LINE(bidi)) { \
|
||||
errcode=U_INVALID_STATE_ERROR; \
|
||||
return; \
|
||||
}
|
||||
#define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) \
|
||||
if((arg)<(start) || (arg)>=(limit)) { \
|
||||
(errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
|
||||
return; \
|
||||
}
|
||||
|
||||
/* helper function to (re)allocate memory if allowed */
|
||||
U_CFUNC UBool
|
||||
ubidi_getMemory(BidiMemoryForAllocation *pMemory, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded);
|
||||
|
||||
/* helper macros for each allocated array in UBiDi */
|
||||
#define getDirPropsMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \
|
||||
(pBiDi)->mayAllocateText, (length))
|
||||
|
||||
#define getLevelsMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \
|
||||
(pBiDi)->mayAllocateText, (length))
|
||||
|
||||
#define getRunsMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \
|
||||
(pBiDi)->mayAllocateRuns, (length)*sizeof(Run))
|
||||
|
||||
/* additional macros used by ubidi_open() - always allow allocation */
|
||||
#define getInitialDirPropsMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->dirPropsMemory, &(pBiDi)->dirPropsSize, \
|
||||
TRUE, (length))
|
||||
|
||||
#define getInitialLevelsMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->levelsMemory, &(pBiDi)->levelsSize, \
|
||||
TRUE, (length))
|
||||
|
||||
#define getInitialOpeningsMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->openingsMemory, &(pBiDi)->openingsSize, \
|
||||
TRUE, (length)*sizeof(Opening))
|
||||
|
||||
#define getInitialParasMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->parasMemory, &(pBiDi)->parasSize, \
|
||||
TRUE, (length)*sizeof(Para))
|
||||
|
||||
#define getInitialRunsMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->runsMemory, &(pBiDi)->runsSize, \
|
||||
TRUE, (length)*sizeof(Run))
|
||||
|
||||
#define getInitialIsolatesMemory(pBiDi, length) \
|
||||
ubidi_getMemory((BidiMemoryForAllocation *)&(pBiDi)->isolatesMemory, &(pBiDi)->isolatesSize, \
|
||||
TRUE, (length)*sizeof(Isolate))
|
||||
|
||||
#endif
|
||||
1349
vendor/icu/src/ubidiln.cpp
vendored
Normal file
1349
vendor/icu/src/ubidiln.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
640
vendor/icu/src/ubidiwrt.cpp
vendored
Normal file
640
vendor/icu/src/ubidiwrt.cpp
vendored
Normal file
@@ -0,0 +1,640 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: ubidiwrt.c
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 1999aug06
|
||||
* created by: Markus W. Scherer, updated by Matitiahu Allouche
|
||||
*
|
||||
* This file contains implementations for BiDi functions that use
|
||||
* the core algorithm and core API to write reordered text.
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/ustring.h>
|
||||
#include <unicode/uchar.h>
|
||||
#include <unicode/ubidi.h>
|
||||
#include <unicode/utf16.h>
|
||||
#include "cmemory.h"
|
||||
#include "ustr_imp.h"
|
||||
#include "ubidiimp.h"
|
||||
|
||||
/*
|
||||
* The function implementations in this file are designed
|
||||
* for UTF-16 and UTF-32, not for UTF-8.
|
||||
*
|
||||
* Assumptions that are not true for UTF-8:
|
||||
* - Any code point always needs the same number of code units
|
||||
* ("minimum-length-problem" of UTF-8)
|
||||
* - The BiDi control characters need only one code unit each
|
||||
*
|
||||
* Further assumptions for all UTFs:
|
||||
* - u_charMirror(c) needs the same number of code units as c
|
||||
*/
|
||||
#if UTF_SIZE==8
|
||||
# error reimplement ubidi_writeReordered() for UTF-8, see comment above
|
||||
#endif
|
||||
|
||||
#define IS_COMBINING(type) ((1UL<<(type))&(1UL<<U_NON_SPACING_MARK|1UL<<U_COMBINING_SPACING_MARK|1UL<<U_ENCLOSING_MARK))
|
||||
|
||||
/*
|
||||
* When we have UBIDI_OUTPUT_REVERSE set on ubidi_writeReordered(), then we
|
||||
* semantically write RTL runs in reverse and later reverse them again.
|
||||
* Instead, we actually write them in forward order to begin with.
|
||||
* However, if the RTL run was to be mirrored, we need to mirror here now
|
||||
* since the implicit second reversal must not do it.
|
||||
* It looks strange to do mirroring in LTR output, but it is only because
|
||||
* we are writing RTL output in reverse.
|
||||
*/
|
||||
static int32_t
|
||||
doWriteForward(const UChar *src, int32_t srcLength,
|
||||
UChar *dest, int32_t destSize,
|
||||
uint16_t options,
|
||||
UErrorCode *pErrorCode) {
|
||||
/* optimize for several combinations of options */
|
||||
switch(options&(UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING)) {
|
||||
case 0: {
|
||||
/* simply copy the LTR run to the destination */
|
||||
int32_t length=srcLength;
|
||||
if(destSize<length) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
return srcLength;
|
||||
}
|
||||
do {
|
||||
*dest++=*src++;
|
||||
} while(--length>0);
|
||||
return srcLength;
|
||||
}
|
||||
case UBIDI_DO_MIRRORING: {
|
||||
/* do mirroring */
|
||||
int32_t i=0, j=0;
|
||||
UChar32 c;
|
||||
|
||||
if(destSize<srcLength) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
return srcLength;
|
||||
}
|
||||
do {
|
||||
U16_NEXT(src, i, srcLength, c);
|
||||
c=u_charMirror(c);
|
||||
U16_APPEND_UNSAFE(dest, j, c);
|
||||
} while(i<srcLength);
|
||||
return srcLength;
|
||||
}
|
||||
case UBIDI_REMOVE_BIDI_CONTROLS: {
|
||||
/* copy the LTR run and remove any BiDi control characters */
|
||||
int32_t remaining=destSize;
|
||||
UChar c;
|
||||
do {
|
||||
c=*src++;
|
||||
if(!IS_BIDI_CONTROL_CHAR(c)) {
|
||||
if(--remaining<0) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
|
||||
/* preflight the length */
|
||||
while(--srcLength>0) {
|
||||
c=*src++;
|
||||
if(!IS_BIDI_CONTROL_CHAR(c)) {
|
||||
--remaining;
|
||||
}
|
||||
}
|
||||
return destSize-remaining;
|
||||
}
|
||||
*dest++=c;
|
||||
}
|
||||
} while(--srcLength>0);
|
||||
return destSize-remaining;
|
||||
}
|
||||
default: {
|
||||
/* remove BiDi control characters and do mirroring */
|
||||
int32_t remaining=destSize;
|
||||
int32_t i, j=0;
|
||||
UChar32 c;
|
||||
do {
|
||||
i=0;
|
||||
U16_NEXT(src, i, srcLength, c);
|
||||
src+=i;
|
||||
srcLength-=i;
|
||||
if(!IS_BIDI_CONTROL_CHAR(c)) {
|
||||
remaining-=i;
|
||||
if(remaining<0) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
|
||||
/* preflight the length */
|
||||
while(srcLength>0) {
|
||||
c=*src++;
|
||||
if(!IS_BIDI_CONTROL_CHAR(c)) {
|
||||
--remaining;
|
||||
}
|
||||
--srcLength;
|
||||
}
|
||||
return destSize-remaining;
|
||||
}
|
||||
c=u_charMirror(c);
|
||||
U16_APPEND_UNSAFE(dest, j, c);
|
||||
}
|
||||
} while(srcLength>0);
|
||||
return j;
|
||||
}
|
||||
} /* end of switch */
|
||||
}
|
||||
|
||||
static int32_t
|
||||
doWriteReverse(const UChar *src, int32_t srcLength,
|
||||
UChar *dest, int32_t destSize,
|
||||
uint16_t options,
|
||||
UErrorCode *pErrorCode) {
|
||||
/*
|
||||
* RTL run -
|
||||
*
|
||||
* RTL runs need to be copied to the destination in reverse order
|
||||
* of code points, not code units, to keep Unicode characters intact.
|
||||
*
|
||||
* The general strategy for this is to read the source text
|
||||
* in backward order, collect all code units for a code point
|
||||
* (and optionally following combining characters, see below),
|
||||
* and copy all these code units in ascending order
|
||||
* to the destination for this run.
|
||||
*
|
||||
* Several options request whether combining characters
|
||||
* should be kept after their base characters,
|
||||
* whether BiDi control characters should be removed, and
|
||||
* whether characters should be replaced by their mirror-image
|
||||
* equivalent Unicode characters.
|
||||
*/
|
||||
int32_t i, j;
|
||||
UChar32 c;
|
||||
|
||||
/* optimize for several combinations of options */
|
||||
switch(options&(UBIDI_REMOVE_BIDI_CONTROLS|UBIDI_DO_MIRRORING|UBIDI_KEEP_BASE_COMBINING)) {
|
||||
case 0:
|
||||
/*
|
||||
* With none of the "complicated" options set, the destination
|
||||
* run will have the same length as the source run,
|
||||
* and there is no mirroring and no keeping combining characters
|
||||
* with their base characters.
|
||||
*/
|
||||
if(destSize<srcLength) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
return srcLength;
|
||||
}
|
||||
destSize=srcLength;
|
||||
|
||||
/* preserve character integrity */
|
||||
do {
|
||||
/* i is always after the last code unit known to need to be kept in this segment */
|
||||
i=srcLength;
|
||||
|
||||
/* collect code units for one base character */
|
||||
U16_BACK_1(src, 0, srcLength);
|
||||
|
||||
/* copy this base character */
|
||||
j=srcLength;
|
||||
do {
|
||||
*dest++=src[j++];
|
||||
} while(j<i);
|
||||
} while(srcLength>0);
|
||||
break;
|
||||
case UBIDI_KEEP_BASE_COMBINING:
|
||||
/*
|
||||
* Here, too, the destination
|
||||
* run will have the same length as the source run,
|
||||
* and there is no mirroring.
|
||||
* We do need to keep combining characters with their base characters.
|
||||
*/
|
||||
if(destSize<srcLength) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
return srcLength;
|
||||
}
|
||||
destSize=srcLength;
|
||||
|
||||
/* preserve character integrity */
|
||||
do {
|
||||
/* i is always after the last code unit known to need to be kept in this segment */
|
||||
i=srcLength;
|
||||
|
||||
/* collect code units and modifier letters for one base character */
|
||||
do {
|
||||
U16_PREV(src, 0, srcLength, c);
|
||||
} while(srcLength>0 && IS_COMBINING(u_charType(c)));
|
||||
|
||||
/* copy this "user character" */
|
||||
j=srcLength;
|
||||
do {
|
||||
*dest++=src[j++];
|
||||
} while(j<i);
|
||||
} while(srcLength>0);
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* With several "complicated" options set, this is the most
|
||||
* general and the slowest copying of an RTL run.
|
||||
* We will do mirroring, remove BiDi controls, and
|
||||
* keep combining characters with their base characters
|
||||
* as requested.
|
||||
*/
|
||||
if(!(options&UBIDI_REMOVE_BIDI_CONTROLS)) {
|
||||
i=srcLength;
|
||||
} else {
|
||||
/* we need to find out the destination length of the run,
|
||||
which will not include the BiDi control characters */
|
||||
int32_t length=srcLength;
|
||||
UChar ch;
|
||||
|
||||
i=0;
|
||||
do {
|
||||
ch=*src++;
|
||||
if(!IS_BIDI_CONTROL_CHAR(ch)) {
|
||||
++i;
|
||||
}
|
||||
} while(--length>0);
|
||||
src-=srcLength;
|
||||
}
|
||||
|
||||
if(destSize<i) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
return i;
|
||||
}
|
||||
destSize=i;
|
||||
|
||||
/* preserve character integrity */
|
||||
do {
|
||||
/* i is always after the last code unit known to need to be kept in this segment */
|
||||
i=srcLength;
|
||||
|
||||
/* collect code units for one base character */
|
||||
U16_PREV(src, 0, srcLength, c);
|
||||
if(options&UBIDI_KEEP_BASE_COMBINING) {
|
||||
/* collect modifier letters for this base character */
|
||||
while(srcLength>0 && IS_COMBINING(u_charType(c))) {
|
||||
U16_PREV(src, 0, srcLength, c);
|
||||
}
|
||||
}
|
||||
|
||||
if(options&UBIDI_REMOVE_BIDI_CONTROLS && IS_BIDI_CONTROL_CHAR(c)) {
|
||||
/* do not copy this BiDi control character */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* copy this "user character" */
|
||||
j=srcLength;
|
||||
if(options&UBIDI_DO_MIRRORING) {
|
||||
/* mirror only the base character */
|
||||
int32_t k=0;
|
||||
c=u_charMirror(c);
|
||||
U16_APPEND_UNSAFE(dest, k, c);
|
||||
dest+=k;
|
||||
j+=k;
|
||||
}
|
||||
while(j<i) {
|
||||
*dest++=src[j++];
|
||||
}
|
||||
} while(srcLength>0);
|
||||
break;
|
||||
} /* end of switch */
|
||||
|
||||
return destSize;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ubidi_writeReverse(const UChar *src, int32_t srcLength,
|
||||
UChar *dest, int32_t destSize,
|
||||
uint16_t options,
|
||||
UErrorCode *pErrorCode) {
|
||||
int32_t destLength;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* more error checking */
|
||||
if( src==NULL || srcLength<-1 ||
|
||||
destSize<0 || (destSize>0 && dest==NULL))
|
||||
{
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* do input and output overlap? */
|
||||
if( dest!=NULL &&
|
||||
((src>=dest && src<dest+destSize) ||
|
||||
(dest>=src && dest<src+srcLength)))
|
||||
{
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(srcLength==-1) {
|
||||
srcLength=u_strlen(src);
|
||||
}
|
||||
if(srcLength>0) {
|
||||
destLength=doWriteReverse(src, srcLength, dest, destSize, options, pErrorCode);
|
||||
} else {
|
||||
/* nothing to do */
|
||||
destLength=0;
|
||||
}
|
||||
|
||||
return u_terminateUChars(dest, destSize, destLength, pErrorCode);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ubidi_writeReordered(UBiDi *pBiDi,
|
||||
UChar *dest, int32_t destSize,
|
||||
uint16_t options,
|
||||
UErrorCode *pErrorCode) {
|
||||
const UChar *text;
|
||||
UChar *saveDest;
|
||||
int32_t length, destCapacity;
|
||||
int32_t run, runCount, logicalStart, runLength;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* more error checking */
|
||||
if( pBiDi==NULL ||
|
||||
(text=pBiDi->text)==NULL || (length=pBiDi->length)<0 ||
|
||||
destSize<0 || (destSize>0 && dest==NULL))
|
||||
{
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* do input and output overlap? */
|
||||
if( dest!=NULL &&
|
||||
((text>=dest && text<dest+destSize) ||
|
||||
(dest>=text && dest<text+pBiDi->originalLength)))
|
||||
{
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(length==0) {
|
||||
/* nothing to do */
|
||||
return u_terminateUChars(dest, destSize, 0, pErrorCode);
|
||||
}
|
||||
|
||||
runCount=ubidi_countRuns(pBiDi, pErrorCode);
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* destSize shrinks, later destination length=destCapacity-destSize */
|
||||
saveDest=dest;
|
||||
destCapacity=destSize;
|
||||
|
||||
/*
|
||||
* Option "insert marks" implies UBIDI_INSERT_LRM_FOR_NUMERIC if the
|
||||
* reordering mode (checked below) is appropriate.
|
||||
*/
|
||||
if(pBiDi->reorderingOptions & UBIDI_OPTION_INSERT_MARKS) {
|
||||
options|=UBIDI_INSERT_LRM_FOR_NUMERIC;
|
||||
options&=~UBIDI_REMOVE_BIDI_CONTROLS;
|
||||
}
|
||||
/*
|
||||
* Option "remove controls" implies UBIDI_REMOVE_BIDI_CONTROLS
|
||||
* and cancels UBIDI_INSERT_LRM_FOR_NUMERIC.
|
||||
*/
|
||||
if(pBiDi->reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
|
||||
options|=UBIDI_REMOVE_BIDI_CONTROLS;
|
||||
options&=~UBIDI_INSERT_LRM_FOR_NUMERIC;
|
||||
}
|
||||
/*
|
||||
* If we do not perform the "inverse BiDi" algorithm, then we
|
||||
* don't need to insert any LRMs, and don't need to test for it.
|
||||
*/
|
||||
if((pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_NUMBERS_AS_L) &&
|
||||
(pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_LIKE_DIRECT) &&
|
||||
(pBiDi->reorderingMode != UBIDI_REORDER_INVERSE_FOR_NUMBERS_SPECIAL) &&
|
||||
(pBiDi->reorderingMode != UBIDI_REORDER_RUNS_ONLY)) {
|
||||
options&=~UBIDI_INSERT_LRM_FOR_NUMERIC;
|
||||
}
|
||||
/*
|
||||
* Iterate through all visual runs and copy the run text segments to
|
||||
* the destination, according to the options.
|
||||
*
|
||||
* The tests for where to insert LRMs ignore the fact that there may be
|
||||
* BN codes or non-BMP code points at the beginning and end of a run;
|
||||
* they may insert LRMs unnecessarily but the tests are faster this way
|
||||
* (this would have to be improved for UTF-8).
|
||||
*
|
||||
* Note that the only errors that are set by doWriteXY() are buffer overflow
|
||||
* errors. Ignore them until the end, and continue for preflighting.
|
||||
*/
|
||||
if(!(options&UBIDI_OUTPUT_REVERSE)) {
|
||||
/* forward output */
|
||||
if(!(options&UBIDI_INSERT_LRM_FOR_NUMERIC)) {
|
||||
/* do not insert BiDi controls */
|
||||
for(run=0; run<runCount; ++run) {
|
||||
if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength)) {
|
||||
runLength=doWriteForward(text+logicalStart, runLength,
|
||||
dest, destSize,
|
||||
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
|
||||
} else {
|
||||
runLength=doWriteReverse(text+logicalStart, runLength,
|
||||
dest, destSize,
|
||||
options, pErrorCode);
|
||||
}
|
||||
if(dest!=NULL) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
}
|
||||
} else {
|
||||
/* insert BiDi controls for "inverse BiDi" */
|
||||
const DirProp *dirProps=pBiDi->dirProps;
|
||||
const UChar *src;
|
||||
UChar uc;
|
||||
UBiDiDirection dir;
|
||||
int32_t markFlag;
|
||||
|
||||
for(run=0; run<runCount; ++run) {
|
||||
dir=ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength);
|
||||
src=text+logicalStart;
|
||||
/* check if something relevant in insertPoints */
|
||||
markFlag=pBiDi->runs[run].insertRemove;
|
||||
if(markFlag<0) { /* BiDi controls count */
|
||||
markFlag=0;
|
||||
}
|
||||
|
||||
if(UBIDI_LTR==dir) {
|
||||
if((pBiDi->isInverse) &&
|
||||
(/*run>0 &&*/ dirProps[logicalStart]!=L)) {
|
||||
markFlag |= LRM_BEFORE;
|
||||
}
|
||||
if (markFlag & LRM_BEFORE) {
|
||||
uc=LRM_CHAR;
|
||||
}
|
||||
else if (markFlag & RLM_BEFORE) {
|
||||
uc=RLM_CHAR;
|
||||
}
|
||||
else uc=0;
|
||||
if(uc) {
|
||||
if(destSize>0) {
|
||||
*dest++=uc;
|
||||
}
|
||||
--destSize;
|
||||
}
|
||||
|
||||
runLength=doWriteForward(src, runLength,
|
||||
dest, destSize,
|
||||
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
|
||||
if(dest!=NULL) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
||||
if((pBiDi->isInverse) &&
|
||||
(/*run<runCount-1 &&*/ dirProps[logicalStart+runLength-1]!=L)) {
|
||||
markFlag |= LRM_AFTER;
|
||||
}
|
||||
if (markFlag & LRM_AFTER) {
|
||||
uc=LRM_CHAR;
|
||||
}
|
||||
else if (markFlag & RLM_AFTER) {
|
||||
uc=RLM_CHAR;
|
||||
}
|
||||
else uc=0;
|
||||
if(uc) {
|
||||
if(destSize>0) {
|
||||
*dest++=uc;
|
||||
}
|
||||
--destSize;
|
||||
}
|
||||
} else { /* RTL run */
|
||||
if((pBiDi->isInverse) &&
|
||||
(/*run>0 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1])))) {
|
||||
markFlag |= RLM_BEFORE;
|
||||
}
|
||||
if (markFlag & LRM_BEFORE) {
|
||||
uc=LRM_CHAR;
|
||||
}
|
||||
else if (markFlag & RLM_BEFORE) {
|
||||
uc=RLM_CHAR;
|
||||
}
|
||||
else uc=0;
|
||||
if(uc) {
|
||||
if(destSize>0) {
|
||||
*dest++=uc;
|
||||
}
|
||||
--destSize;
|
||||
}
|
||||
|
||||
runLength=doWriteReverse(src, runLength,
|
||||
dest, destSize,
|
||||
options, pErrorCode);
|
||||
if(dest!=NULL) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
||||
if((pBiDi->isInverse) &&
|
||||
(/*run<runCount-1 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart])))) {
|
||||
markFlag |= RLM_AFTER;
|
||||
}
|
||||
if (markFlag & LRM_AFTER) {
|
||||
uc=LRM_CHAR;
|
||||
}
|
||||
else if (markFlag & RLM_AFTER) {
|
||||
uc=RLM_CHAR;
|
||||
}
|
||||
else uc=0;
|
||||
if(uc) {
|
||||
if(destSize>0) {
|
||||
*dest++=uc;
|
||||
}
|
||||
--destSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* reverse output */
|
||||
if(!(options&UBIDI_INSERT_LRM_FOR_NUMERIC)) {
|
||||
/* do not insert BiDi controls */
|
||||
for(run=runCount; --run>=0;) {
|
||||
if(UBIDI_LTR==ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength)) {
|
||||
runLength=doWriteReverse(text+logicalStart, runLength,
|
||||
dest, destSize,
|
||||
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
|
||||
} else {
|
||||
runLength=doWriteForward(text+logicalStart, runLength,
|
||||
dest, destSize,
|
||||
options, pErrorCode);
|
||||
}
|
||||
if(dest!=NULL) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
}
|
||||
} else {
|
||||
/* insert BiDi controls for "inverse BiDi" */
|
||||
const DirProp *dirProps=pBiDi->dirProps;
|
||||
const UChar *src;
|
||||
UBiDiDirection dir;
|
||||
|
||||
for(run=runCount; --run>=0;) {
|
||||
/* reverse output */
|
||||
dir=ubidi_getVisualRun(pBiDi, run, &logicalStart, &runLength);
|
||||
src=text+logicalStart;
|
||||
|
||||
if(UBIDI_LTR==dir) {
|
||||
if(/*run<runCount-1 &&*/ dirProps[logicalStart+runLength-1]!=L) {
|
||||
if(destSize>0) {
|
||||
*dest++=LRM_CHAR;
|
||||
}
|
||||
--destSize;
|
||||
}
|
||||
|
||||
runLength=doWriteReverse(src, runLength,
|
||||
dest, destSize,
|
||||
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
|
||||
if(dest!=NULL) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
||||
if(/*run>0 &&*/ dirProps[logicalStart]!=L) {
|
||||
if(destSize>0) {
|
||||
*dest++=LRM_CHAR;
|
||||
}
|
||||
--destSize;
|
||||
}
|
||||
} else {
|
||||
if(/*run<runCount-1 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart]))) {
|
||||
if(destSize>0) {
|
||||
*dest++=RLM_CHAR;
|
||||
}
|
||||
--destSize;
|
||||
}
|
||||
|
||||
runLength=doWriteForward(src, runLength,
|
||||
dest, destSize,
|
||||
options, pErrorCode);
|
||||
if(dest!=NULL) {
|
||||
dest+=runLength;
|
||||
}
|
||||
destSize-=runLength;
|
||||
|
||||
if(/*run>0 &&*/ !(MASK_R_AL&DIRPROP_FLAG(dirProps[logicalStart+runLength-1]))) {
|
||||
if(destSize>0) {
|
||||
*dest++=RLM_CHAR;
|
||||
}
|
||||
--destSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return u_terminateUChars(saveDest, destCapacity, destCapacity-destSize, pErrorCode);
|
||||
}
|
||||
725
vendor/icu/src/uchar.cpp
vendored
Normal file
725
vendor/icu/src/uchar.cpp
vendored
Normal file
@@ -0,0 +1,725 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
********************************************************************************
|
||||
* Copyright (C) 1996-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
********************************************************************************
|
||||
*
|
||||
* File UCHAR.C
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 04/02/97 aliu Creation.
|
||||
* 4/15/99 Madhu Updated all the function definitions for C Implementation
|
||||
* 5/20/99 Madhu Added the function u_getVersion()
|
||||
* 8/19/1999 srl Upgraded scripts to Unicode3.0
|
||||
* 11/11/1999 weiv added u_isalnum(), cleaned comments
|
||||
* 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion.
|
||||
* 06/20/2000 helena OS/400 port changes; mostly typecast.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uchar.h>
|
||||
#include <unicode/uscript.h>
|
||||
#include <unicode/udata.h>
|
||||
#include "uassert.h"
|
||||
#include "cmemory.h"
|
||||
#include "ucln_cmn.h"
|
||||
#include "utrie2.h"
|
||||
#include "udataswp.h"
|
||||
#include "uprops.h"
|
||||
#include "ustr_imp.h"
|
||||
|
||||
/* uchar_props_data.h is machine-generated by genprops --csource */
|
||||
#define INCLUDED_FROM_UCHAR_C
|
||||
#include "uchar_props_data.h"
|
||||
|
||||
/* constants and macros for access to the data ------------------------------ */
|
||||
|
||||
/* getting a uint32_t properties word from the data */
|
||||
#define GET_PROPS(c, result) ((result)=UTRIE2_GET16(&propsTrie, c));
|
||||
|
||||
/* API functions ------------------------------------------------------------ */
|
||||
|
||||
/* Gets the Unicode character's general category.*/
|
||||
U_CAPI int8_t U_EXPORT2
|
||||
u_charType(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (int8_t)GET_CATEGORY(props);
|
||||
}
|
||||
|
||||
/* Enumerate all code points with their general categories. */
|
||||
struct _EnumTypeCallback {
|
||||
UCharEnumTypeRange *enumRange;
|
||||
const void *context;
|
||||
};
|
||||
|
||||
static uint32_t U_CALLCONV
|
||||
_enumTypeValue(const void *context, uint32_t value) {
|
||||
(void)context;
|
||||
return GET_CATEGORY(value);
|
||||
}
|
||||
|
||||
static UBool U_CALLCONV
|
||||
_enumTypeRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
|
||||
/* just cast the value to UCharCategory */
|
||||
return ((struct _EnumTypeCallback *)context)->
|
||||
enumRange(((struct _EnumTypeCallback *)context)->context,
|
||||
start, end+1, (UCharCategory)value);
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context) {
|
||||
struct _EnumTypeCallback callback;
|
||||
|
||||
if(enumRange==NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback.enumRange=enumRange;
|
||||
callback.context=context;
|
||||
utrie2_enum(&propsTrie, _enumTypeValue, _enumTypeRange, &callback);
|
||||
}
|
||||
|
||||
/* Checks if ch is a lower case letter.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_islower(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(GET_CATEGORY(props)==U_LOWERCASE_LETTER);
|
||||
}
|
||||
|
||||
/* Checks if ch is an upper case letter.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isupper(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(GET_CATEGORY(props)==U_UPPERCASE_LETTER);
|
||||
}
|
||||
|
||||
/* Checks if ch is a title case letter; usually upper case letters.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_istitle(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(GET_CATEGORY(props)==U_TITLECASE_LETTER);
|
||||
}
|
||||
|
||||
/* Checks if ch is a decimal digit. */
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isdigit(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(GET_CATEGORY(props)==U_DECIMAL_DIGIT_NUMBER);
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isxdigit(UChar32 c) {
|
||||
uint32_t props;
|
||||
|
||||
/* check ASCII and Fullwidth ASCII a-fA-F */
|
||||
if(
|
||||
(c<=0x66 && c>=0x41 && (c<=0x46 || c>=0x61)) ||
|
||||
(c>=0xff21 && c<=0xff46 && (c<=0xff26 || c>=0xff41))
|
||||
) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(GET_CATEGORY(props)==U_DECIMAL_DIGIT_NUMBER);
|
||||
}
|
||||
|
||||
/* Checks if the Unicode character is a letter.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isalpha(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&U_GC_L_MASK)!=0);
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isUAlphabetic(UChar32 c) {
|
||||
return (u_getUnicodeProperties(c, 1)&U_MASK(UPROPS_ALPHABETIC))!=0;
|
||||
}
|
||||
|
||||
/* Checks if c is a letter or a decimal digit */
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isalnum(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_ND_MASK))!=0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if c is alphabetic, or a decimal digit; implements UCHAR_POSIX_ALNUM.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
u_isalnumPOSIX(UChar32 c) {
|
||||
return (UBool)(u_isUAlphabetic(c) || u_isdigit(c));
|
||||
}
|
||||
|
||||
/* Checks if ch is a unicode character with assigned character type.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isdefined(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(GET_CATEGORY(props)!=0);
|
||||
}
|
||||
|
||||
/* Checks if the Unicode character is a base form character that can take a diacritic.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isbase(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_N_MASK|U_GC_MC_MASK|U_GC_ME_MASK))!=0);
|
||||
}
|
||||
|
||||
/* Checks if the Unicode character is a control character.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_iscntrl(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&(U_GC_CC_MASK|U_GC_CF_MASK|U_GC_ZL_MASK|U_GC_ZP_MASK))!=0);
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isISOControl(UChar32 c) {
|
||||
return (uint32_t)c<=0x9f && (c<=0x1f || c>=0x7f);
|
||||
}
|
||||
|
||||
/* Some control characters that are used as space. */
|
||||
#define IS_THAT_CONTROL_SPACE(c) \
|
||||
(c<=0x9f && ((c>=TAB && c<=CR) || (c>=0x1c && c <=0x1f) || c==NL))
|
||||
|
||||
/* Java has decided that U+0085 New Line is not whitespace any more. */
|
||||
#define IS_THAT_ASCII_CONTROL_SPACE(c) \
|
||||
(c<=0x1f && c>=TAB && (c<=CR || c>=0x1c))
|
||||
|
||||
/* Checks if the Unicode character is a space character.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isspace(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&U_GC_Z_MASK)!=0 || IS_THAT_CONTROL_SPACE(c));
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isJavaSpaceChar(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&U_GC_Z_MASK)!=0);
|
||||
}
|
||||
|
||||
/* Checks if the Unicode character is a whitespace character.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isWhitespace(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(
|
||||
((CAT_MASK(props)&U_GC_Z_MASK)!=0 &&
|
||||
c!=NBSP && c!=FIGURESP && c!=NNBSP) || /* exclude no-break spaces */
|
||||
IS_THAT_ASCII_CONTROL_SPACE(c)
|
||||
);
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isblank(UChar32 c) {
|
||||
if((uint32_t)c<=0x9f) {
|
||||
return c==9 || c==0x20; /* TAB or SPACE */
|
||||
} else {
|
||||
/* Zs */
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(GET_CATEGORY(props)==U_SPACE_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isUWhiteSpace(UChar32 c) {
|
||||
return (u_getUnicodeProperties(c, 1)&U_MASK(UPROPS_WHITE_SPACE))!=0;
|
||||
}
|
||||
|
||||
/* Checks if the Unicode character is printable.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isprint(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
/* comparing ==0 returns FALSE for the categories mentioned */
|
||||
return (UBool)((CAT_MASK(props)&U_GC_C_MASK)==0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if c is in \p{graph}\p{blank} - \p{cntrl}.
|
||||
* Implements UCHAR_POSIX_PRINT.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
u_isprintPOSIX(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
/*
|
||||
* The only cntrl character in graph+blank is TAB (in blank).
|
||||
* Here we implement (blank-TAB)=Zs instead of calling u_isblank().
|
||||
*/
|
||||
return (UBool)((GET_CATEGORY(props)==U_SPACE_SEPARATOR) || u_isgraphPOSIX(c));
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isgraph(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
/* comparing ==0 returns FALSE for the categories mentioned */
|
||||
return (UBool)((CAT_MASK(props)&
|
||||
(U_GC_CC_MASK|U_GC_CF_MASK|U_GC_CS_MASK|U_GC_CN_MASK|U_GC_Z_MASK))
|
||||
==0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if c is in
|
||||
* [^\p{space}\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]
|
||||
* with space=\p{Whitespace} and Control=Cc.
|
||||
* Implements UCHAR_POSIX_GRAPH.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
u_isgraphPOSIX(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
/* \p{space}\p{gc=Control} == \p{gc=Z}\p{Control} */
|
||||
/* comparing ==0 returns FALSE for the categories mentioned */
|
||||
return (UBool)((CAT_MASK(props)&
|
||||
(U_GC_CC_MASK|U_GC_CS_MASK|U_GC_CN_MASK|U_GC_Z_MASK))
|
||||
==0);
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_ispunct(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&U_GC_P_MASK)!=0);
|
||||
}
|
||||
|
||||
/* Checks if the Unicode character can start a Unicode identifier.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isIDStart(UChar32 c) {
|
||||
/* same as u_isalpha() */
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_NL_MASK))!=0);
|
||||
}
|
||||
|
||||
/* Checks if the Unicode character can be a Unicode identifier part other than starting the
|
||||
identifier.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isIDPart(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(
|
||||
(CAT_MASK(props)&
|
||||
(U_GC_ND_MASK|U_GC_NL_MASK|
|
||||
U_GC_L_MASK|
|
||||
U_GC_PC_MASK|U_GC_MC_MASK|U_GC_MN_MASK)
|
||||
)!=0 ||
|
||||
u_isIDIgnorable(c));
|
||||
}
|
||||
|
||||
/*Checks if the Unicode character can be ignorable in a Java or Unicode identifier.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isIDIgnorable(UChar32 c) {
|
||||
if(c<=0x9f) {
|
||||
return u_isISOControl(c) && !IS_THAT_ASCII_CONTROL_SPACE(c);
|
||||
} else {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(GET_CATEGORY(props)==U_FORMAT_CHAR);
|
||||
}
|
||||
}
|
||||
|
||||
/*Checks if the Unicode character can start a Java identifier.*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isJavaIDStart(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_SC_MASK|U_GC_PC_MASK))!=0);
|
||||
}
|
||||
|
||||
/*Checks if the Unicode character can be a Java identifier part other than starting the
|
||||
* identifier.
|
||||
*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isJavaIDPart(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return (UBool)(
|
||||
(CAT_MASK(props)&
|
||||
(U_GC_ND_MASK|U_GC_NL_MASK|
|
||||
U_GC_L_MASK|
|
||||
U_GC_SC_MASK|U_GC_PC_MASK|
|
||||
U_GC_MC_MASK|U_GC_MN_MASK)
|
||||
)!=0 ||
|
||||
u_isIDIgnorable(c));
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_charDigitValue(UChar32 c) {
|
||||
uint32_t props;
|
||||
int32_t value;
|
||||
GET_PROPS(c, props);
|
||||
value=(int32_t)GET_NUMERIC_TYPE_VALUE(props)-UPROPS_NTV_DECIMAL_START;
|
||||
if(value<=9) {
|
||||
return value;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI double U_EXPORT2
|
||||
u_getNumericValue(UChar32 c) {
|
||||
uint32_t props;
|
||||
int32_t ntv;
|
||||
GET_PROPS(c, props);
|
||||
ntv=(int32_t)GET_NUMERIC_TYPE_VALUE(props);
|
||||
|
||||
if(ntv==UPROPS_NTV_NONE) {
|
||||
return U_NO_NUMERIC_VALUE;
|
||||
} else if(ntv<UPROPS_NTV_DIGIT_START) {
|
||||
/* decimal digit */
|
||||
return ntv-UPROPS_NTV_DECIMAL_START;
|
||||
} else if(ntv<UPROPS_NTV_NUMERIC_START) {
|
||||
/* other digit */
|
||||
return ntv-UPROPS_NTV_DIGIT_START;
|
||||
} else if(ntv<UPROPS_NTV_FRACTION_START) {
|
||||
/* small integer */
|
||||
return ntv-UPROPS_NTV_NUMERIC_START;
|
||||
} else if(ntv<UPROPS_NTV_LARGE_START) {
|
||||
/* fraction */
|
||||
int32_t numerator=(ntv>>4)-12;
|
||||
int32_t denominator=(ntv&0xf)+1;
|
||||
return (double)numerator/denominator;
|
||||
} else if(ntv<UPROPS_NTV_BASE60_START) {
|
||||
/* large, single-significant-digit integer */
|
||||
double numValue;
|
||||
int32_t mant=(ntv>>5)-14;
|
||||
int32_t exp=(ntv&0x1f)+2;
|
||||
numValue=mant;
|
||||
|
||||
/* multiply by 10^exp without math.h */
|
||||
while(exp>=4) {
|
||||
numValue*=10000.;
|
||||
exp-=4;
|
||||
}
|
||||
switch(exp) {
|
||||
case 3:
|
||||
numValue*=1000.;
|
||||
break;
|
||||
case 2:
|
||||
numValue*=100.;
|
||||
break;
|
||||
case 1:
|
||||
numValue*=10.;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return numValue;
|
||||
} else if(ntv<UPROPS_NTV_FRACTION20_START) {
|
||||
/* sexagesimal (base 60) integer */
|
||||
int32_t numValue=(ntv>>2)-0xbf;
|
||||
int32_t exp=(ntv&3)+1;
|
||||
|
||||
switch(exp) {
|
||||
case 4:
|
||||
numValue*=60*60*60*60;
|
||||
break;
|
||||
case 3:
|
||||
numValue*=60*60*60;
|
||||
break;
|
||||
case 2:
|
||||
numValue*=60*60;
|
||||
break;
|
||||
case 1:
|
||||
numValue*=60;
|
||||
break;
|
||||
case 0:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return numValue;
|
||||
} else if(ntv<UPROPS_NTV_RESERVED_START) {
|
||||
// fraction-20 e.g. 3/80
|
||||
int32_t frac20=ntv-UPROPS_NTV_FRACTION20_START; // 0..0x17
|
||||
int32_t numerator=2*(frac20&3)+1;
|
||||
int32_t denominator=20<<(frac20>>2);
|
||||
return (double)numerator/denominator;
|
||||
} else {
|
||||
/* reserved */
|
||||
return U_NO_NUMERIC_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_digit(UChar32 ch, int8_t radix) {
|
||||
int8_t value;
|
||||
if((uint8_t)(radix-2)<=(36-2)) {
|
||||
value=(int8_t)u_charDigitValue(ch);
|
||||
if(value<0) {
|
||||
/* ch is not a decimal digit, try latin letters */
|
||||
if(ch>=0x61 && ch<=0x7A) {
|
||||
value=(int8_t)(ch-0x57); /* ch - 'a' + 10 */
|
||||
} else if(ch>=0x41 && ch<=0x5A) {
|
||||
value=(int8_t)(ch-0x37); /* ch - 'A' + 10 */
|
||||
} else if(ch>=0xFF41 && ch<=0xFF5A) {
|
||||
value=(int8_t)(ch-0xFF37); /* fullwidth ASCII a-z */
|
||||
} else if(ch>=0xFF21 && ch<=0xFF3A) {
|
||||
value=(int8_t)(ch-0xFF17); /* fullwidth ASCII A-Z */
|
||||
}
|
||||
}
|
||||
} else {
|
||||
value=-1; /* invalid radix */
|
||||
}
|
||||
return (int8_t)((value<radix) ? value : -1);
|
||||
}
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
u_forDigit(int32_t digit, int8_t radix) {
|
||||
if((uint8_t)(radix-2)>(36-2) || (uint32_t)digit>=(uint32_t)radix) {
|
||||
return 0;
|
||||
} else if(digit<10) {
|
||||
return (UChar32)(0x30+digit);
|
||||
} else {
|
||||
return (UChar32)((0x61-10)+digit);
|
||||
}
|
||||
}
|
||||
|
||||
/* miscellaneous, and support for uprops.cpp -------------------------------- */
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_getUnicodeVersion(UVersionInfo versionArray) {
|
||||
if(versionArray!=NULL) {
|
||||
uprv_memcpy(versionArray, dataVersion, U_MAX_VERSION_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
U_CFUNC uint32_t
|
||||
u_getMainProperties(UChar32 c) {
|
||||
uint32_t props;
|
||||
GET_PROPS(c, props);
|
||||
return props;
|
||||
}
|
||||
|
||||
U_CFUNC uint32_t
|
||||
u_getUnicodeProperties(UChar32 c, int32_t column) {
|
||||
U_ASSERT(column>=0);
|
||||
if(column>=propsVectorsColumns) {
|
||||
return 0;
|
||||
} else {
|
||||
uint16_t vecIndex=UTRIE2_GET16(&propsVectorsTrie, c);
|
||||
return propsVectors[vecIndex+column];
|
||||
}
|
||||
}
|
||||
|
||||
U_CFUNC int32_t
|
||||
uprv_getMaxValues(int32_t column) {
|
||||
switch(column) {
|
||||
case 0:
|
||||
return indexes[UPROPS_MAX_VALUES_INDEX];
|
||||
case 2:
|
||||
return indexes[UPROPS_MAX_VALUES_2_INDEX];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_charAge(UChar32 c, UVersionInfo versionArray) {
|
||||
if(versionArray!=NULL) {
|
||||
uint32_t version=u_getUnicodeProperties(c, 0)>>UPROPS_AGE_SHIFT;
|
||||
versionArray[0]=(uint8_t)(version>>4);
|
||||
versionArray[1]=(uint8_t)(version&0xf);
|
||||
versionArray[2]=versionArray[3]=0;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI UScriptCode U_EXPORT2
|
||||
uscript_getScript(UChar32 c, UErrorCode *pErrorCode) {
|
||||
uint32_t scriptX;
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return USCRIPT_INVALID_CODE;
|
||||
}
|
||||
if((uint32_t)c>0x10ffff) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return USCRIPT_INVALID_CODE;
|
||||
}
|
||||
scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
|
||||
if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
|
||||
return (UScriptCode)scriptX;
|
||||
} else if(scriptX<UPROPS_SCRIPT_X_WITH_INHERITED) {
|
||||
return USCRIPT_COMMON;
|
||||
} else if(scriptX<UPROPS_SCRIPT_X_WITH_OTHER) {
|
||||
return USCRIPT_INHERITED;
|
||||
} else {
|
||||
return (UScriptCode)scriptExtensions[scriptX&UPROPS_SCRIPT_MASK];
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uscript_hasScript(UChar32 c, UScriptCode sc) {
|
||||
const uint16_t *scx;
|
||||
uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
|
||||
if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
|
||||
return sc==(UScriptCode)scriptX;
|
||||
}
|
||||
|
||||
scx=scriptExtensions+(scriptX&UPROPS_SCRIPT_MASK);
|
||||
if(scriptX>=UPROPS_SCRIPT_X_WITH_OTHER) {
|
||||
scx=scriptExtensions+scx[1];
|
||||
}
|
||||
if(sc>=USCRIPT_CODE_LIMIT) {
|
||||
/* Guard against bogus input that would make us go past the Script_Extensions terminator. */
|
||||
return FALSE;
|
||||
}
|
||||
while(sc>*scx) {
|
||||
++scx;
|
||||
}
|
||||
return sc==(*scx&0x7fff);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uscript_getScriptExtensions(UChar32 c,
|
||||
UScriptCode *scripts, int32_t capacity,
|
||||
UErrorCode *pErrorCode) {
|
||||
uint32_t scriptX;
|
||||
int32_t length;
|
||||
const uint16_t *scx;
|
||||
uint16_t sx;
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(capacity<0 || (capacity>0 && scripts==NULL)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
|
||||
if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
|
||||
if(capacity==0) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
} else {
|
||||
scripts[0]=(UScriptCode)scriptX;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
scx=scriptExtensions+(scriptX&UPROPS_SCRIPT_MASK);
|
||||
if(scriptX>=UPROPS_SCRIPT_X_WITH_OTHER) {
|
||||
scx=scriptExtensions+scx[1];
|
||||
}
|
||||
length=0;
|
||||
do {
|
||||
sx=*scx++;
|
||||
if(length<capacity) {
|
||||
scripts[length]=(UScriptCode)(sx&0x7fff);
|
||||
}
|
||||
++length;
|
||||
} while(sx<0x8000);
|
||||
if(length>capacity) {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
U_CAPI UBlockCode U_EXPORT2
|
||||
ublock_getCode(UChar32 c) {
|
||||
return (UBlockCode)((u_getUnicodeProperties(c, 0)&UPROPS_BLOCK_MASK)>>UPROPS_BLOCK_SHIFT);
|
||||
}
|
||||
|
||||
/* property starts for UnicodeSet ------------------------------------------- */
|
||||
|
||||
static UBool U_CALLCONV
|
||||
_enumPropertyStartsRange(const void *context, UChar32 start, UChar32 end, uint32_t value) {
|
||||
/* add the start code point to the USet */
|
||||
const USetAdder *sa=(const USetAdder *)context;
|
||||
sa->add(sa->set, start);
|
||||
(void)end;
|
||||
(void)value;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define USET_ADD_CP_AND_NEXT(sa, cp) sa->add(sa->set, cp); sa->add(sa->set, cp+1)
|
||||
|
||||
U_CFUNC void U_EXPORT2
|
||||
uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* add the start code point of each same-value range of the main trie */
|
||||
utrie2_enum(&propsTrie, NULL, _enumPropertyStartsRange, sa);
|
||||
|
||||
/* add code points with hardcoded properties, plus the ones following them */
|
||||
|
||||
/* add for u_isblank() */
|
||||
USET_ADD_CP_AND_NEXT(sa, TAB);
|
||||
|
||||
/* add for IS_THAT_CONTROL_SPACE() */
|
||||
sa->add(sa->set, CR+1); /* range TAB..CR */
|
||||
sa->add(sa->set, 0x1c);
|
||||
sa->add(sa->set, 0x1f+1);
|
||||
USET_ADD_CP_AND_NEXT(sa, NL);
|
||||
|
||||
/* add for u_isIDIgnorable() what was not added above */
|
||||
sa->add(sa->set, DEL); /* range DEL..NBSP-1, NBSP added below */
|
||||
sa->add(sa->set, HAIRSP);
|
||||
sa->add(sa->set, RLM+1);
|
||||
sa->add(sa->set, INHSWAP);
|
||||
sa->add(sa->set, NOMDIG+1);
|
||||
USET_ADD_CP_AND_NEXT(sa, ZWNBSP);
|
||||
|
||||
/* add no-break spaces for u_isWhitespace() what was not added above */
|
||||
USET_ADD_CP_AND_NEXT(sa, NBSP);
|
||||
USET_ADD_CP_AND_NEXT(sa, FIGURESP);
|
||||
USET_ADD_CP_AND_NEXT(sa, NNBSP);
|
||||
|
||||
/* add for u_digit() */
|
||||
sa->add(sa->set, U_a);
|
||||
sa->add(sa->set, U_z+1);
|
||||
sa->add(sa->set, U_A);
|
||||
sa->add(sa->set, U_Z+1);
|
||||
sa->add(sa->set, U_FW_a);
|
||||
sa->add(sa->set, U_FW_z+1);
|
||||
sa->add(sa->set, U_FW_A);
|
||||
sa->add(sa->set, U_FW_Z+1);
|
||||
|
||||
/* add for u_isxdigit() */
|
||||
sa->add(sa->set, U_f+1);
|
||||
sa->add(sa->set, U_F+1);
|
||||
sa->add(sa->set, U_FW_f+1);
|
||||
sa->add(sa->set, U_FW_F+1);
|
||||
|
||||
/* add for UCHAR_DEFAULT_IGNORABLE_CODE_POINT what was not added above */
|
||||
sa->add(sa->set, WJ); /* range WJ..NOMDIG */
|
||||
sa->add(sa->set, 0xfff0);
|
||||
sa->add(sa->set, 0xfffb+1);
|
||||
sa->add(sa->set, 0xe0000);
|
||||
sa->add(sa->set, 0xe0fff+1);
|
||||
|
||||
/* add for UCHAR_GRAPHEME_BASE and others */
|
||||
USET_ADD_CP_AND_NEXT(sa, CGJ);
|
||||
}
|
||||
|
||||
U_CFUNC void U_EXPORT2
|
||||
upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* add the start code point of each same-value range of the properties vectors trie */
|
||||
utrie2_enum(&propsVectorsTrie, NULL, _enumPropertyStartsRange, sa);
|
||||
}
|
||||
3622
vendor/icu/src/uchar_props_data.h
vendored
Normal file
3622
vendor/icu/src/uchar_props_data.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
91
vendor/icu/src/ucln.h
vendored
Normal file
91
vendor/icu/src/ucln.h
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001-2013, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: ucln.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2001July05
|
||||
* created by: George Rhoten
|
||||
*/
|
||||
|
||||
#ifndef __UCLN_H__
|
||||
#define __UCLN_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/** These are the functions used to register a library's memory cleanup
|
||||
* functions. Each library should define a single library register function
|
||||
* to call this API. In the i18n library, it is ucln_i18n_registerCleanup().
|
||||
*
|
||||
* None of the cleanup functions should use a mutex to clean up an API's
|
||||
* allocated memory because a cleanup function is not meant to be thread safe,
|
||||
* and plenty of data cannot be reference counted in order to make sure that
|
||||
* no one else needs the allocated data.
|
||||
*
|
||||
* In order to make a cleanup function get called when u_cleanup is called,
|
||||
* You should add your function to the library specific cleanup function.
|
||||
* If the cleanup function is not in the common library, the code that
|
||||
* allocates the memory should call the library specific cleanup function.
|
||||
* For instance, in the i18n library, any memory allocated statically must
|
||||
* call ucln_i18n_registerCleanup() from the ucln_in.h header. These library
|
||||
* cleanup functions are needed in order to prevent a circular dependency
|
||||
* between the common library and any other library.
|
||||
*
|
||||
* The order of the cleanup is very important. In general, an API that
|
||||
* depends on a second API should be cleaned up before the second API.
|
||||
* For instance, the default converter in ustring depends upon the converter
|
||||
* API. So the default converter should be closed before the converter API
|
||||
* has its cache flushed. This will prevent any memory leaks due to
|
||||
* reference counting.
|
||||
*
|
||||
* Please see common/ucln_cmn.{h,c} and i18n/ucln_in.{h,c} for examples.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data Type for cleanup function selector. These roughly correspond to libraries.
|
||||
*/
|
||||
typedef enum ECleanupLibraryType {
|
||||
UCLN_START = -1,
|
||||
UCLN_UPLUG, /* ICU plugins */
|
||||
UCLN_CUSTOM, /* Custom is for anyone else. */
|
||||
UCLN_CTESTFW,
|
||||
UCLN_TOOLUTIL,
|
||||
UCLN_LAYOUTEX,
|
||||
UCLN_LAYOUT,
|
||||
UCLN_IO,
|
||||
UCLN_I18N,
|
||||
UCLN_COMMON /* This must be the last one to cleanup. */
|
||||
} ECleanupLibraryType;
|
||||
|
||||
/**
|
||||
* Data type for cleanup function pointer
|
||||
*/
|
||||
U_CDECL_BEGIN
|
||||
typedef UBool U_CALLCONV cleanupFunc(void);
|
||||
typedef void U_CALLCONV initFunc(UErrorCode *);
|
||||
U_CDECL_END
|
||||
|
||||
/**
|
||||
* Register a cleanup function
|
||||
* @param type which library to register for.
|
||||
* @param func the function pointer
|
||||
*/
|
||||
U_CAPI void U_EXPORT2 ucln_registerCleanup(ECleanupLibraryType type,
|
||||
cleanupFunc *func);
|
||||
|
||||
/**
|
||||
* Request cleanup for one specific library.
|
||||
* Not thread safe.
|
||||
* @param type which library to cleanup
|
||||
*/
|
||||
U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType type);
|
||||
|
||||
#endif
|
||||
73
vendor/icu/src/ucln_cmn.h
vendored
Normal file
73
vendor/icu/src/ucln_cmn.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
* Copyright (C) 2001-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
******************************************************************************
|
||||
* file name: ucln_cmn.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2001July05
|
||||
* created by: George Rhoten
|
||||
*/
|
||||
|
||||
#ifndef __UCLN_CMN_H__
|
||||
#define __UCLN_CMN_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include "ucln.h"
|
||||
|
||||
/* These are the cleanup functions for various APIs. */
|
||||
/* @return true if cleanup complete successfully.*/
|
||||
U_CFUNC UBool umtx_cleanup(void);
|
||||
|
||||
U_CFUNC UBool utrace_cleanup(void);
|
||||
|
||||
U_CFUNC UBool ucln_lib_cleanup(void);
|
||||
|
||||
/*
|
||||
Please keep the order of enums declared in same order
|
||||
as the cleanup functions are suppose to be called. */
|
||||
typedef enum ECleanupCommonType {
|
||||
UCLN_COMMON_START = -1,
|
||||
UCLN_COMMON_USPREP,
|
||||
UCLN_COMMON_BREAKITERATOR,
|
||||
UCLN_COMMON_RBBI,
|
||||
UCLN_COMMON_SERVICE,
|
||||
UCLN_COMMON_LOCALE_KEY_TYPE,
|
||||
UCLN_COMMON_LOCALE,
|
||||
UCLN_COMMON_LOCALE_AVAILABLE,
|
||||
UCLN_COMMON_ULOC,
|
||||
UCLN_COMMON_CURRENCY,
|
||||
UCLN_COMMON_LOADED_NORMALIZER2,
|
||||
UCLN_COMMON_NORMALIZER2,
|
||||
UCLN_COMMON_USET,
|
||||
UCLN_COMMON_UNAMES,
|
||||
UCLN_COMMON_UPROPS,
|
||||
UCLN_COMMON_UCNV,
|
||||
UCLN_COMMON_UCNV_IO,
|
||||
UCLN_COMMON_UDATA,
|
||||
UCLN_COMMON_PUTIL,
|
||||
UCLN_COMMON_LIST_FORMATTER,
|
||||
UCLN_COMMON_UINIT,
|
||||
|
||||
/*
|
||||
Unified caches caches collation stuff. Collation data structures
|
||||
contain resource bundles which means that unified cache cleanup
|
||||
must happen before resource bundle clean up.
|
||||
*/
|
||||
UCLN_COMMON_UNIFIED_CACHE,
|
||||
UCLN_COMMON_URES,
|
||||
UCLN_COMMON_COUNT /* This must be last */
|
||||
} ECleanupCommonType;
|
||||
|
||||
/* Main library cleanup registration function. */
|
||||
/* See common/ucln.h for details on adding a cleanup function. */
|
||||
/* Note: the global mutex must not be held when calling this function. */
|
||||
U_CFUNC void U_EXPORT2 ucln_common_registerCleanup(ECleanupCommonType type,
|
||||
cleanupFunc *func);
|
||||
|
||||
#endif
|
||||
117
vendor/icu/src/ucmndata.h
vendored
Normal file
117
vendor/icu/src/ucmndata.h
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------
|
||||
*
|
||||
* UCommonData An abstract interface for dealing with ICU Common Data Files.
|
||||
* ICU Common Data Files are a grouping of a number of individual
|
||||
* data items (resources, converters, tables, anything) into a
|
||||
* single file or dll. The combined format includes a table of
|
||||
* contents for locating the individual items by name.
|
||||
*
|
||||
* Two formats for the table of contents are supported, which is
|
||||
* why there is an abstract inteface involved.
|
||||
*
|
||||
* These functions are part of the ICU internal implementation, and
|
||||
* are not inteded to be used directly by applications.
|
||||
*/
|
||||
|
||||
#ifndef __UCMNDATA_H__
|
||||
#define __UCMNDATA_H__
|
||||
|
||||
#include <unicode/udata.h>
|
||||
#include "umapfile.h"
|
||||
|
||||
|
||||
#define COMMON_DATA_NAME U_ICUDATA_NAME
|
||||
|
||||
typedef struct {
|
||||
uint16_t headerSize;
|
||||
uint8_t magic1;
|
||||
uint8_t magic2;
|
||||
} MappedData;
|
||||
|
||||
|
||||
typedef struct {
|
||||
MappedData dataHeader;
|
||||
UDataInfo info;
|
||||
} DataHeader;
|
||||
|
||||
typedef struct {
|
||||
uint32_t nameOffset;
|
||||
uint32_t dataOffset;
|
||||
} UDataOffsetTOCEntry;
|
||||
|
||||
typedef struct {
|
||||
uint32_t count;
|
||||
/**
|
||||
* Variable-length array declared with length 1 to disable bounds checkers.
|
||||
* The actual array length is in the count field.
|
||||
*/
|
||||
UDataOffsetTOCEntry entry[1];
|
||||
} UDataOffsetTOC;
|
||||
|
||||
/**
|
||||
* Get the header size from a const DataHeader *udh.
|
||||
* Handles opposite-endian data.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC uint16_t
|
||||
udata_getHeaderSize(const DataHeader *udh);
|
||||
|
||||
/**
|
||||
* Get the UDataInfo.size from a const UDataInfo *info.
|
||||
* Handles opposite-endian data.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC uint16_t
|
||||
udata_getInfoSize(const UDataInfo *info);
|
||||
|
||||
U_CDECL_BEGIN
|
||||
/*
|
||||
* "Virtual" functions for data lookup.
|
||||
* To call one, given a UDataMemory *p, the code looks like this:
|
||||
* p->vFuncs.Lookup(p, tocEntryName, pErrorCode);
|
||||
* (I sure do wish this was written in C++, not C)
|
||||
*/
|
||||
|
||||
typedef const DataHeader *
|
||||
(U_CALLCONV * LookupFn)(const UDataMemory *pData,
|
||||
const char *tocEntryName,
|
||||
int32_t *pLength,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
typedef uint32_t
|
||||
(U_CALLCONV * NumEntriesFn)(const UDataMemory *pData);
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
typedef struct {
|
||||
LookupFn Lookup;
|
||||
NumEntriesFn NumEntries;
|
||||
} commonDataFuncs;
|
||||
|
||||
|
||||
/*
|
||||
* Functions to check whether a UDataMemory refers to memory containing
|
||||
* a recognizable header and table of contents a Common Data Format
|
||||
*
|
||||
* If a valid header and TOC are found,
|
||||
* set the CommonDataFuncs function dispatch vector in the UDataMemory
|
||||
* to point to the right functions for the TOC type.
|
||||
* otherwise
|
||||
* set an errorcode.
|
||||
*/
|
||||
U_CFUNC void udata_checkCommonData(UDataMemory *pData, UErrorCode *pErrorCode);
|
||||
|
||||
#endif
|
||||
61
vendor/icu/src/udatamem.h
vendored
Normal file
61
vendor/icu/src/udatamem.h
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------
|
||||
*
|
||||
* UDataMemory A class-like struct that serves as a handle to a piece of memory
|
||||
* that contains some ICU data (resource, converters, whatever.)
|
||||
*
|
||||
* When an application opens ICU data (with udata_open, for example,
|
||||
* a UDataMemory * is returned.
|
||||
*
|
||||
*----------------------------------------------------------------------------------*/
|
||||
#ifndef __UDATAMEM_H__
|
||||
#define __UDATAMEM_H__
|
||||
|
||||
#include <unicode/udata.h>
|
||||
#include "ucmndata.h"
|
||||
|
||||
struct UDataMemory {
|
||||
const commonDataFuncs *vFuncs; /* Function Pointers for accessing TOC */
|
||||
|
||||
const DataHeader *pHeader; /* Header of the memory being described by this */
|
||||
/* UDataMemory object. */
|
||||
const void *toc; /* For common memory, table of contents for */
|
||||
/* the pieces within. */
|
||||
UBool heapAllocated; /* True if this UDataMemory Object is on the */
|
||||
/* heap and thus needs to be deleted when closed. */
|
||||
|
||||
void *mapAddr; /* For mapped or allocated memory, the start addr. */
|
||||
/* Only non-null if a close operation should unmap */
|
||||
/* the associated data. */
|
||||
void *map; /* Handle, or other data, OS dependent. */
|
||||
/* Only non-null if a close operation should unmap */
|
||||
/* the associated data, and additional info */
|
||||
/* beyond the mapAddr is needed to do that. */
|
||||
int32_t length; /* Length of the data in bytes; -1 if unknown. */
|
||||
};
|
||||
|
||||
U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr);
|
||||
U_CFUNC void UDatamemory_assign (UDataMemory *dest, UDataMemory *source);
|
||||
U_CFUNC void UDataMemory_init (UDataMemory *This);
|
||||
U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This);
|
||||
U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr);
|
||||
|
||||
U_CFUNC const DataHeader *UDataMemory_normalizeDataPointer(const void *p);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
udata_getLength(const UDataMemory *pData);
|
||||
|
||||
U_CAPI const void * U_EXPORT2
|
||||
udata_getRawMemory(const UDataMemory *pData);
|
||||
|
||||
#endif
|
||||
473
vendor/icu/src/udataswp.cpp
vendored
Normal file
473
vendor/icu/src/udataswp.cpp
vendored
Normal file
@@ -0,0 +1,473 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2003-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: udataswp.c
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2003jun05
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Definitions for ICU data transformations for different platforms,
|
||||
* changing between big- and little-endian data and/or between
|
||||
* charset families (ASCII<->EBCDIC).
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/udata.h> /* UDataInfo */
|
||||
#include "ucmndata.h" /* DataHeader */
|
||||
#include "cmemory.h"
|
||||
#include "udataswp.h"
|
||||
|
||||
/* swapping primitives ------------------------------------------------------ */
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
uprv_swapArray16(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const uint16_t *p;
|
||||
uint16_t *q;
|
||||
int32_t count;
|
||||
uint16_t x;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup and swapping */
|
||||
p=(const uint16_t *)inData;
|
||||
q=(uint16_t *)outData;
|
||||
count=length/2;
|
||||
while(count>0) {
|
||||
x=*p++;
|
||||
*q++=(uint16_t)((x<<8)|(x>>8));
|
||||
--count;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
uprv_copyArray16(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(length>0 && inData!=outData) {
|
||||
uprv_memcpy(outData, inData, length);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
uprv_swapArray32(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const uint32_t *p;
|
||||
uint32_t *q;
|
||||
int32_t count;
|
||||
uint32_t x;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup and swapping */
|
||||
p=(const uint32_t *)inData;
|
||||
q=(uint32_t *)outData;
|
||||
count=length/4;
|
||||
while(count>0) {
|
||||
x=*p++;
|
||||
*q++=(uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
|
||||
--count;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
uprv_copyArray32(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(length>0 && inData!=outData) {
|
||||
uprv_memcpy(outData, inData, length);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
uprv_swapArray64(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const uint64_t *p;
|
||||
uint64_t *q;
|
||||
int32_t count;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup and swapping */
|
||||
p=(const uint64_t *)inData;
|
||||
q=(uint64_t *)outData;
|
||||
count=length/8;
|
||||
while(count>0) {
|
||||
uint64_t x=*p++;
|
||||
x=(x<<56)|((x&0xff00)<<40)|((x&0xff0000)<<24)|((x&0xff000000)<<8)|
|
||||
((x>>8)&0xff000000)|((x>>24)&0xff0000)|((x>>40)&0xff00)|(x>>56);
|
||||
*q++=x;
|
||||
--count;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
static int32_t U_CALLCONV
|
||||
uprv_copyArray64(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(length>0 && inData!=outData) {
|
||||
uprv_memcpy(outData, inData, length);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
static uint16_t U_CALLCONV
|
||||
uprv_readSwapUInt16(uint16_t x) {
|
||||
return (uint16_t)((x<<8)|(x>>8));
|
||||
}
|
||||
|
||||
static uint16_t U_CALLCONV
|
||||
uprv_readDirectUInt16(uint16_t x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
static uint32_t U_CALLCONV
|
||||
uprv_readSwapUInt32(uint32_t x) {
|
||||
return (uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
|
||||
}
|
||||
|
||||
static uint32_t U_CALLCONV
|
||||
uprv_readDirectUInt32(uint32_t x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
static void U_CALLCONV
|
||||
uprv_writeSwapUInt16(uint16_t *p, uint16_t x) {
|
||||
*p=(uint16_t)((x<<8)|(x>>8));
|
||||
}
|
||||
|
||||
static void U_CALLCONV
|
||||
uprv_writeDirectUInt16(uint16_t *p, uint16_t x) {
|
||||
*p=x;
|
||||
}
|
||||
|
||||
static void U_CALLCONV
|
||||
uprv_writeSwapUInt32(uint32_t *p, uint32_t x) {
|
||||
*p=(uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
|
||||
}
|
||||
|
||||
static void U_CALLCONV
|
||||
uprv_writeDirectUInt32(uint32_t *p, uint32_t x) {
|
||||
*p=x;
|
||||
}
|
||||
|
||||
U_CAPI int16_t U_EXPORT2
|
||||
udata_readInt16(const UDataSwapper *ds, int16_t x) {
|
||||
return (int16_t)ds->readUInt16((uint16_t)x);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
udata_readInt32(const UDataSwapper *ds, int32_t x) {
|
||||
return (int32_t)ds->readUInt32((uint32_t)x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap a block of invariant, NUL-terminated strings, but not padding
|
||||
* bytes after the last string.
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
udata_swapInvStringBlock(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const char *inChars;
|
||||
int32_t stringsLength;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* reduce the strings length to not include bytes after the last NUL */
|
||||
inChars=(const char *)inData;
|
||||
stringsLength=length;
|
||||
while(stringsLength>0 && inChars[stringsLength-1]!=0) {
|
||||
--stringsLength;
|
||||
}
|
||||
|
||||
/* swap up to the last NUL */
|
||||
ds->swapInvChars(ds, inData, stringsLength, outData, pErrorCode);
|
||||
|
||||
/* copy the bytes after the last NUL */
|
||||
if(inData!=outData && length>stringsLength) {
|
||||
uprv_memcpy((char *)outData+stringsLength, inChars+stringsLength, length-stringsLength);
|
||||
}
|
||||
|
||||
/* return the length including padding bytes */
|
||||
if(U_SUCCESS(*pErrorCode)) {
|
||||
return length;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
udata_printError(const UDataSwapper *ds,
|
||||
const char *fmt,
|
||||
...) {
|
||||
va_list args;
|
||||
|
||||
if(ds->printError!=NULL) {
|
||||
va_start(args, fmt);
|
||||
ds->printError(ds->printErrorContext, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
||||
|
||||
/* swap a data header ------------------------------------------------------- */
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
udata_swapDataHeader(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const DataHeader *pHeader;
|
||||
uint16_t headerSize, infoSize;
|
||||
|
||||
/* argument checking */
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check minimum length and magic bytes */
|
||||
pHeader=(const DataHeader *)inData;
|
||||
if( (length>=0 && length<(int32_t)sizeof(DataHeader)) ||
|
||||
pHeader->dataHeader.magic1!=0xda ||
|
||||
pHeader->dataHeader.magic2!=0x27 ||
|
||||
pHeader->info.sizeofUChar!=2
|
||||
) {
|
||||
udata_printError(ds, "udata_swapDataHeader(): initial bytes do not look like ICU data\n");
|
||||
*pErrorCode=U_UNSUPPORTED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
headerSize=ds->readUInt16(pHeader->dataHeader.headerSize);
|
||||
infoSize=ds->readUInt16(pHeader->info.size);
|
||||
|
||||
if( headerSize<sizeof(DataHeader) ||
|
||||
infoSize<sizeof(UDataInfo) ||
|
||||
headerSize<(sizeof(pHeader->dataHeader)+infoSize) ||
|
||||
(length>=0 && length<headerSize)
|
||||
) {
|
||||
udata_printError(ds, "udata_swapDataHeader(): header size mismatch - headerSize %d infoSize %d length %d\n",
|
||||
headerSize, infoSize, length);
|
||||
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(length>0) {
|
||||
DataHeader *outHeader;
|
||||
const char *s;
|
||||
int32_t maxLength;
|
||||
|
||||
/* Most of the fields are just bytes and need no swapping. */
|
||||
if(inData!=outData) {
|
||||
uprv_memcpy(outData, inData, headerSize);
|
||||
}
|
||||
outHeader=(DataHeader *)outData;
|
||||
|
||||
outHeader->info.isBigEndian = ds->outIsBigEndian;
|
||||
outHeader->info.charsetFamily = ds->outCharset;
|
||||
|
||||
/* swap headerSize */
|
||||
ds->swapArray16(ds, &pHeader->dataHeader.headerSize, 2, &outHeader->dataHeader.headerSize, pErrorCode);
|
||||
|
||||
/* swap UDataInfo size and reservedWord */
|
||||
ds->swapArray16(ds, &pHeader->info.size, 4, &outHeader->info.size, pErrorCode);
|
||||
|
||||
/* swap copyright statement after the UDataInfo */
|
||||
infoSize+=sizeof(pHeader->dataHeader);
|
||||
s=(const char *)inData+infoSize;
|
||||
maxLength=headerSize-infoSize;
|
||||
/* get the length of the string */
|
||||
for(length=0; length<maxLength && s[length]!=0; ++length) {}
|
||||
/* swap the string contents */
|
||||
ds->swapInvChars(ds, s, length, (char *)outData+infoSize, pErrorCode);
|
||||
}
|
||||
|
||||
return headerSize;
|
||||
}
|
||||
|
||||
/* API functions ------------------------------------------------------------ */
|
||||
|
||||
U_CAPI UDataSwapper * U_EXPORT2
|
||||
udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset,
|
||||
UBool outIsBigEndian, uint8_t outCharset,
|
||||
UErrorCode *pErrorCode) {
|
||||
UDataSwapper *swapper;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
}
|
||||
if(inCharset>U_EBCDIC_FAMILY || outCharset>U_EBCDIC_FAMILY) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* allocate the swapper */
|
||||
swapper=(UDataSwapper *)uprv_malloc(sizeof(UDataSwapper));
|
||||
if(swapper==NULL) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
uprv_memset(swapper, 0, sizeof(UDataSwapper));
|
||||
|
||||
/* set values and functions pointers according to in/out parameters */
|
||||
swapper->inIsBigEndian=inIsBigEndian;
|
||||
swapper->inCharset=inCharset;
|
||||
swapper->outIsBigEndian=outIsBigEndian;
|
||||
swapper->outCharset=outCharset;
|
||||
|
||||
swapper->readUInt16= inIsBigEndian==U_IS_BIG_ENDIAN ? uprv_readDirectUInt16 : uprv_readSwapUInt16;
|
||||
swapper->readUInt32= inIsBigEndian==U_IS_BIG_ENDIAN ? uprv_readDirectUInt32 : uprv_readSwapUInt32;
|
||||
|
||||
swapper->writeUInt16= outIsBigEndian==U_IS_BIG_ENDIAN ? uprv_writeDirectUInt16 : uprv_writeSwapUInt16;
|
||||
swapper->writeUInt32= outIsBigEndian==U_IS_BIG_ENDIAN ? uprv_writeDirectUInt32 : uprv_writeSwapUInt32;
|
||||
|
||||
swapper->compareInvChars= outCharset==U_ASCII_FAMILY ? uprv_compareInvAscii : uprv_compareInvEbcdic;
|
||||
|
||||
if(inIsBigEndian==outIsBigEndian) {
|
||||
swapper->swapArray16=uprv_copyArray16;
|
||||
swapper->swapArray32=uprv_copyArray32;
|
||||
swapper->swapArray64=uprv_copyArray64;
|
||||
} else {
|
||||
swapper->swapArray16=uprv_swapArray16;
|
||||
swapper->swapArray32=uprv_swapArray32;
|
||||
swapper->swapArray64=uprv_swapArray64;
|
||||
}
|
||||
|
||||
if(inCharset==U_ASCII_FAMILY) {
|
||||
swapper->swapInvChars= outCharset==U_ASCII_FAMILY ? uprv_copyAscii : uprv_ebcdicFromAscii;
|
||||
} else /* U_EBCDIC_FAMILY */ {
|
||||
swapper->swapInvChars= outCharset==U_EBCDIC_FAMILY ? uprv_copyEbcdic : uprv_asciiFromEbcdic;
|
||||
}
|
||||
|
||||
return swapper;
|
||||
}
|
||||
|
||||
U_CAPI UDataSwapper * U_EXPORT2
|
||||
udata_openSwapperForInputData(const void *data, int32_t length,
|
||||
UBool outIsBigEndian, uint8_t outCharset,
|
||||
UErrorCode *pErrorCode) {
|
||||
const DataHeader *pHeader;
|
||||
uint16_t headerSize, infoSize;
|
||||
UBool inIsBigEndian;
|
||||
int8_t inCharset;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return NULL;
|
||||
}
|
||||
if( data==NULL ||
|
||||
(length>=0 && length<(int32_t)sizeof(DataHeader)) ||
|
||||
outCharset>U_EBCDIC_FAMILY
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pHeader=(const DataHeader *)data;
|
||||
if( (length>=0 && length<(int32_t)sizeof(DataHeader)) ||
|
||||
pHeader->dataHeader.magic1!=0xda ||
|
||||
pHeader->dataHeader.magic2!=0x27 ||
|
||||
pHeader->info.sizeofUChar!=2
|
||||
) {
|
||||
*pErrorCode=U_UNSUPPORTED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inIsBigEndian=(UBool)pHeader->info.isBigEndian;
|
||||
inCharset=pHeader->info.charsetFamily;
|
||||
|
||||
if(inIsBigEndian==U_IS_BIG_ENDIAN) {
|
||||
headerSize=pHeader->dataHeader.headerSize;
|
||||
infoSize=pHeader->info.size;
|
||||
} else {
|
||||
headerSize=uprv_readSwapUInt16(pHeader->dataHeader.headerSize);
|
||||
infoSize=uprv_readSwapUInt16(pHeader->info.size);
|
||||
}
|
||||
|
||||
if( headerSize<sizeof(DataHeader) ||
|
||||
infoSize<sizeof(UDataInfo) ||
|
||||
headerSize<(sizeof(pHeader->dataHeader)+infoSize) ||
|
||||
(length>=0 && length<headerSize)
|
||||
) {
|
||||
*pErrorCode=U_UNSUPPORTED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return udata_openSwapper(inIsBigEndian, inCharset, outIsBigEndian, outCharset, pErrorCode);
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
udata_closeSwapper(UDataSwapper *ds) {
|
||||
uprv_free(ds);
|
||||
}
|
||||
367
vendor/icu/src/udataswp.h
vendored
Normal file
367
vendor/icu/src/udataswp.h
vendored
Normal file
@@ -0,0 +1,367 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2003-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: udataswp.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2003jun05
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Definitions for ICU data transformations for different platforms,
|
||||
* changing between big- and little-endian data and/or between
|
||||
* charset families (ASCII<->EBCDIC).
|
||||
*/
|
||||
|
||||
#ifndef __UDATASWP_H__
|
||||
#define __UDATASWP_H__
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/* forward declaration */
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
struct UDataSwapper;
|
||||
typedef struct UDataSwapper UDataSwapper;
|
||||
|
||||
/**
|
||||
* Function type for data transformation.
|
||||
* Transforms data, or just returns the length of the data if
|
||||
* the input length is -1.
|
||||
* Swap functions assume that their data pointers are aligned properly.
|
||||
*
|
||||
* Quick implementation outline:
|
||||
* (best to copy and adapt and existing swapper implementation)
|
||||
* check that the data looks like the expected format
|
||||
* if(length<0) {
|
||||
* preflight:
|
||||
* never dereference outData
|
||||
* read inData and determine the data size
|
||||
* assume that inData is long enough for this
|
||||
* } else {
|
||||
* outData can be NULL if length==0
|
||||
* inData==outData (in-place swapping) possible but not required!
|
||||
* verify that length>=(actual size)
|
||||
* if there is a chance that not every byte up to size is reached
|
||||
* due to padding etc.:
|
||||
* if(inData!=outData) {
|
||||
* memcpy(outData, inData, actual size);
|
||||
* }
|
||||
* swap contents
|
||||
* }
|
||||
* return actual size
|
||||
*
|
||||
* Further implementation notes:
|
||||
* - read integers from inData before swapping them
|
||||
* because in-place swapping can make them unreadable
|
||||
* - compareInvChars compares a local Unicode string with already-swapped
|
||||
* output charset strings
|
||||
*
|
||||
* @param ds Pointer to UDataSwapper containing global data about the
|
||||
* transformation and function pointers for handling primitive
|
||||
* types.
|
||||
* @param inData Pointer to the input data to be transformed or examined.
|
||||
* @param length Length of the data, counting bytes. May be -1 for preflighting.
|
||||
* If length>=0, then transform the data.
|
||||
* If length==-1, then only determine the length of the data.
|
||||
* The length cannot be determined from the data itself for all
|
||||
* types of data (e.g., not for simple arrays of integers).
|
||||
* @param outData Pointer to the output data buffer.
|
||||
* If length>=0 (transformation), then the output buffer must
|
||||
* have a capacity of at least length.
|
||||
* If length==-1, then outData will not be used and can be NULL.
|
||||
* @param pErrorCode ICU UErrorCode parameter, must not be NULL and must
|
||||
* fulfill U_SUCCESS on input.
|
||||
* @return The actual length of the data.
|
||||
*
|
||||
* @see UDataSwapper
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
UDataSwapFn(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Convert one uint16_t from input to platform endianness.
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
typedef uint16_t U_CALLCONV
|
||||
UDataReadUInt16(uint16_t x);
|
||||
|
||||
/**
|
||||
* Convert one uint32_t from input to platform endianness.
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
typedef uint32_t U_CALLCONV
|
||||
UDataReadUInt32(uint32_t x);
|
||||
|
||||
/**
|
||||
* Convert one uint16_t from platform to input endianness.
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
typedef void U_CALLCONV
|
||||
UDataWriteUInt16(uint16_t *p, uint16_t x);
|
||||
|
||||
/**
|
||||
* Convert one uint32_t from platform to input endianness.
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
typedef void U_CALLCONV
|
||||
UDataWriteUInt32(uint32_t *p, uint32_t x);
|
||||
|
||||
/**
|
||||
* Compare invariant-character strings, one in the output data and the
|
||||
* other one caller-provided in Unicode.
|
||||
* An output data string is compared because strings are usually swapped
|
||||
* before the rest of the data, to allow for sorting of string tables
|
||||
* according to the output charset.
|
||||
* You can use -1 for the length parameters of NUL-terminated strings as usual.
|
||||
* Returns Unicode code point order for invariant characters.
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
UDataCompareInvChars(const UDataSwapper *ds,
|
||||
const char *outString, int32_t outLength,
|
||||
const UChar *localString, int32_t localLength);
|
||||
|
||||
/**
|
||||
* Function for message output when an error occurs during data swapping.
|
||||
* A format string and variable number of arguments are passed
|
||||
* like for vprintf().
|
||||
*
|
||||
* @param context A function-specific context pointer.
|
||||
* @param fmt The format string.
|
||||
* @param args The arguments for format string inserts.
|
||||
*
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
typedef void U_CALLCONV
|
||||
UDataPrintError(void *context, const char *fmt, va_list args);
|
||||
|
||||
struct UDataSwapper {
|
||||
/** Input endianness. @internal ICU 2.8 */
|
||||
UBool inIsBigEndian;
|
||||
/** Input charset family. @see U_CHARSET_FAMILY @internal ICU 2.8 */
|
||||
uint8_t inCharset;
|
||||
/** Output endianness. @internal ICU 2.8 */
|
||||
UBool outIsBigEndian;
|
||||
/** Output charset family. @see U_CHARSET_FAMILY @internal ICU 2.8 */
|
||||
uint8_t outCharset;
|
||||
|
||||
/* basic functions for reading data values */
|
||||
|
||||
/** Convert one uint16_t from input to platform endianness. @internal ICU 2.8 */
|
||||
UDataReadUInt16 *readUInt16;
|
||||
/** Convert one uint32_t from input to platform endianness. @internal ICU 2.8 */
|
||||
UDataReadUInt32 *readUInt32;
|
||||
/** Compare an invariant-character output string with a local one. @internal ICU 2.8 */
|
||||
UDataCompareInvChars *compareInvChars;
|
||||
|
||||
/* basic functions for writing data values */
|
||||
|
||||
/** Convert one uint16_t from platform to input endianness. @internal ICU 2.8 */
|
||||
UDataWriteUInt16 *writeUInt16;
|
||||
/** Convert one uint32_t from platform to input endianness. @internal ICU 2.8 */
|
||||
UDataWriteUInt32 *writeUInt32;
|
||||
|
||||
/* basic functions for data transformations */
|
||||
|
||||
/** Transform an array of 16-bit integers. @internal ICU 2.8 */
|
||||
UDataSwapFn *swapArray16;
|
||||
/** Transform an array of 32-bit integers. @internal ICU 2.8 */
|
||||
UDataSwapFn *swapArray32;
|
||||
/** Transform an array of 64-bit integers. @internal ICU 53 */
|
||||
UDataSwapFn *swapArray64;
|
||||
/** Transform an invariant-character string. @internal ICU 2.8 */
|
||||
UDataSwapFn *swapInvChars;
|
||||
|
||||
/**
|
||||
* Function for message output when an error occurs during data swapping.
|
||||
* Can be NULL.
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
UDataPrintError *printError;
|
||||
/** Context pointer for printError. @internal ICU 2.8 */
|
||||
void *printErrorContext;
|
||||
};
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
U_CAPI UDataSwapper * U_EXPORT2
|
||||
udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset,
|
||||
UBool outIsBigEndian, uint8_t outCharset,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Open a UDataSwapper for the given input data and the specified output
|
||||
* characteristics.
|
||||
* Values of -1 for any of the characteristics mean the local platform's
|
||||
* characteristics.
|
||||
*
|
||||
* @see udata_swap
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
U_CAPI UDataSwapper * U_EXPORT2
|
||||
udata_openSwapperForInputData(const void *data, int32_t length,
|
||||
UBool outIsBigEndian, uint8_t outCharset,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
udata_closeSwapper(UDataSwapper *ds);
|
||||
|
||||
/**
|
||||
* Read the beginning of an ICU data piece, recognize magic bytes,
|
||||
* swap the structure.
|
||||
* Set a U_UNSUPPORTED_ERROR if it does not look like an ICU data piece.
|
||||
*
|
||||
* @return The size of the data header, in bytes.
|
||||
*
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
udata_swapDataHeader(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Convert one int16_t from input to platform endianness.
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
U_CAPI int16_t U_EXPORT2
|
||||
udata_readInt16(const UDataSwapper *ds, int16_t x);
|
||||
|
||||
/**
|
||||
* Convert one int32_t from input to platform endianness.
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
udata_readInt32(const UDataSwapper *ds, int32_t x);
|
||||
|
||||
/**
|
||||
* Swap a block of invariant, NUL-terminated strings, but not padding
|
||||
* bytes after the last string.
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
udata_swapInvStringBlock(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
udata_printError(const UDataSwapper *ds,
|
||||
const char *fmt,
|
||||
...);
|
||||
|
||||
/* internal exports from putil.c -------------------------------------------- */
|
||||
|
||||
/* declared here to keep them out of the public putil.h */
|
||||
|
||||
/**
|
||||
* Swap invariant char * strings ASCII->EBCDIC.
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uprv_ebcdicFromAscii(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Copy invariant ASCII char * strings and verify they are invariant.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC int32_t
|
||||
uprv_copyAscii(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Swap invariant char * strings EBCDIC->ASCII.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC int32_t
|
||||
uprv_asciiFromEbcdic(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Copy invariant EBCDIC char * strings and verify they are invariant.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC int32_t
|
||||
uprv_copyEbcdic(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Compare ASCII invariant char * with Unicode invariant UChar *
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC int32_t
|
||||
uprv_compareInvAscii(const UDataSwapper *ds,
|
||||
const char *outString, int32_t outLength,
|
||||
const UChar *localString, int32_t localLength);
|
||||
|
||||
/**
|
||||
* Compare EBCDIC invariant char * with Unicode invariant UChar *
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC int32_t
|
||||
uprv_compareInvEbcdic(const UDataSwapper *ds,
|
||||
const char *outString, int32_t outLength,
|
||||
const UChar *localString, int32_t localLength);
|
||||
|
||||
/**
|
||||
* \def uprv_compareInvWithUChar
|
||||
* Compare an invariant-character strings with a UChar string
|
||||
* @internal
|
||||
*/
|
||||
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
||||
# define uprv_compareInvWithUChar uprv_compareInvAscii
|
||||
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
# define uprv_compareInvWithUChar uprv_compareInvEbcdic
|
||||
#else
|
||||
# error Unknown charset family!
|
||||
#endif
|
||||
|
||||
|
||||
/* material... -------------------------------------------------------------- */
|
||||
|
||||
#if 0
|
||||
|
||||
/* udata.h */
|
||||
|
||||
/**
|
||||
* Public API function in udata.c
|
||||
*
|
||||
* Same as udata_openChoice() but automatically swaps the data.
|
||||
* isAcceptable, if not NULL, may accept data with endianness and charset family
|
||||
* different from the current platform's properties.
|
||||
* If the data is acceptable and the platform properties do not match, then
|
||||
* the swap function is called to swap an allocated version of the data.
|
||||
* Preflighting may or may not be performed depending on whether the size of
|
||||
* the loaded data item is known.
|
||||
*
|
||||
* @param isAcceptable Same as for udata_openChoice(). May be NULL.
|
||||
*
|
||||
* @internal ICU 2.8
|
||||
*/
|
||||
U_CAPI UDataMemory * U_EXPORT2
|
||||
udata_openSwap(const char *path, const char *type, const char *name,
|
||||
UDataMemoryIsAcceptable *isAcceptable, void *isAcceptableContext,
|
||||
UDataSwapFn *swap,
|
||||
UDataPrintError *printError, void *printErrorContext,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
615
vendor/icu/src/uinvchar.cpp
vendored
Normal file
615
vendor/icu/src/uinvchar.cpp
vendored
Normal file
@@ -0,0 +1,615 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: uinvchar.c
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:2
|
||||
*
|
||||
* created on: 2004sep14
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Functions for handling invariant characters, moved here from putil.c
|
||||
* for better modularization.
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/ustring.h>
|
||||
#include "udataswp.h"
|
||||
#include "cstring.h"
|
||||
#include "cmemory.h"
|
||||
#include "uassert.h"
|
||||
#include "uinvchar.h"
|
||||
|
||||
/* invariant-character handling --------------------------------------------- */
|
||||
|
||||
/*
|
||||
* These maps for ASCII to/from EBCDIC map invariant characters (see utypes.h)
|
||||
* appropriately for most EBCDIC codepages.
|
||||
*
|
||||
* They currently also map most other ASCII graphic characters,
|
||||
* appropriately for codepages 37 and 1047.
|
||||
* Exceptions: The characters for []^ have different codes in 37 & 1047.
|
||||
* Both versions are mapped to ASCII.
|
||||
*
|
||||
* ASCII 37 1047
|
||||
* [ 5B BA AD
|
||||
* ] 5D BB BD
|
||||
* ^ 5E B0 5F
|
||||
*
|
||||
* There are no mappings for variant characters from Unicode to EBCDIC.
|
||||
*
|
||||
* Currently, C0 control codes are also included in these maps.
|
||||
* Exceptions: S/390 Open Edition swaps LF and NEL codes compared with other
|
||||
* EBCDIC platforms; both codes (15 and 25) are mapped to ASCII LF (0A),
|
||||
* but there is no mapping for ASCII LF back to EBCDIC.
|
||||
*
|
||||
* ASCII EBCDIC S/390-OE
|
||||
* LF 0A 25 15
|
||||
* NEL 85 15 25
|
||||
*
|
||||
* The maps below explicitly exclude the variant
|
||||
* control and graphical characters that are in ASCII-based
|
||||
* codepages at 0x80 and above.
|
||||
* "No mapping" is expressed by mapping to a 00 byte.
|
||||
*
|
||||
* These tables do not establish a converter or a codepage.
|
||||
*/
|
||||
|
||||
static const uint8_t asciiFromEbcdic[256]={
|
||||
0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x00, 0x0a, 0x08, 0x00, 0x18, 0x19, 0x00, 0x00, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x17, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07,
|
||||
0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1a,
|
||||
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
|
||||
0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
|
||||
0x2d, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
|
||||
|
||||
0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00,
|
||||
0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5d, 0x00, 0x5d, 0x00, 0x00,
|
||||
|
||||
0x7b, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7d, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5c, 0x00, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
static const uint8_t ebcdicFromAscii[256]={
|
||||
0x00, 0x01, 0x02, 0x03, 0x37, 0x2d, 0x2e, 0x2f, 0x16, 0x05, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x3c, 0x3d, 0x32, 0x26, 0x18, 0x19, 0x3f, 0x27, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x40, 0x00, 0x7f, 0x00, 0x00, 0x6c, 0x50, 0x7d, 0x4d, 0x5d, 0x5c, 0x4e, 0x6b, 0x60, 0x4b, 0x61,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0x7a, 0x5e, 0x4c, 0x7e, 0x6e, 0x6f,
|
||||
|
||||
0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6,
|
||||
0xd7, 0xd8, 0xd9, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x6d,
|
||||
0x00, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
|
||||
0x97, 0x98, 0x99, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0x00, 0x00, 0x00, 0x00, 0x07,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
/* Same as asciiFromEbcdic[] except maps all letters to lowercase. */
|
||||
static const uint8_t lowercaseAsciiFromEbcdic[256]={
|
||||
0x00, 0x01, 0x02, 0x03, 0x00, 0x09, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x00, 0x0a, 0x08, 0x00, 0x18, 0x19, 0x00, 0x00, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x17, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07,
|
||||
0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x14, 0x15, 0x00, 0x1a,
|
||||
|
||||
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x3c, 0x28, 0x2b, 0x7c,
|
||||
0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x24, 0x2a, 0x29, 0x3b, 0x5e,
|
||||
0x2d, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x25, 0x5f, 0x3e, 0x3f,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x3a, 0x23, 0x40, 0x27, 0x3d, 0x22,
|
||||
|
||||
0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x7e, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00,
|
||||
0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5d, 0x00, 0x5d, 0x00, 0x00,
|
||||
|
||||
0x7b, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7d, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x7c, 0x00, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/*
|
||||
* Bit sets indicating which characters of the ASCII repertoire
|
||||
* (by ASCII/Unicode code) are "invariant".
|
||||
* See utypes.h for more details.
|
||||
*
|
||||
* As invariant are considered the characters of the ASCII repertoire except
|
||||
* for the following:
|
||||
* 21 '!' <exclamation mark>
|
||||
* 23 '#' <number sign>
|
||||
* 24 '$' <dollar sign>
|
||||
*
|
||||
* 40 '@' <commercial at>
|
||||
*
|
||||
* 5b '[' <left bracket>
|
||||
* 5c '\' <backslash>
|
||||
* 5d ']' <right bracket>
|
||||
* 5e '^' <circumflex>
|
||||
*
|
||||
* 60 '`' <grave accent>
|
||||
*
|
||||
* 7b '{' <left brace>
|
||||
* 7c '|' <vertical line>
|
||||
* 7d '}' <right brace>
|
||||
* 7e '~' <tilde>
|
||||
*/
|
||||
static const uint32_t invariantChars[4]={
|
||||
0xfffffbff, /* 00..1f but not 0a */
|
||||
0xffffffe5, /* 20..3f but not 21 23 24 */
|
||||
0x87fffffe, /* 40..5f but not 40 5b..5e */
|
||||
0x87fffffe /* 60..7f but not 60 7b..7e */
|
||||
};
|
||||
|
||||
/*
|
||||
* test unsigned types (or values known to be non-negative) for invariant characters,
|
||||
* tests ASCII-family character values
|
||||
*/
|
||||
#define UCHAR_IS_INVARIANT(c) (((c)<=0x7f) && (invariantChars[(c)>>5]&((uint32_t)1<<((c)&0x1f)))!=0)
|
||||
|
||||
/* test signed types for invariant characters, adds test for positive values */
|
||||
#define SCHAR_IS_INVARIANT(c) ((0<=(c)) && UCHAR_IS_INVARIANT(c))
|
||||
|
||||
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
||||
#define CHAR_TO_UCHAR(c) c
|
||||
#define UCHAR_TO_CHAR(c) c
|
||||
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
#define CHAR_TO_UCHAR(u) asciiFromEbcdic[u]
|
||||
#define UCHAR_TO_CHAR(u) ebcdicFromAscii[u]
|
||||
#else
|
||||
# error U_CHARSET_FAMILY is not valid
|
||||
#endif
|
||||
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_charsToUChars(const char *cs, UChar *us, int32_t length) {
|
||||
UChar u;
|
||||
uint8_t c;
|
||||
|
||||
/*
|
||||
* Allow the entire ASCII repertoire to be mapped _to_ Unicode.
|
||||
* For EBCDIC systems, this works for characters with codes from
|
||||
* codepages 37 and 1047 or compatible.
|
||||
*/
|
||||
while(length>0) {
|
||||
c=(uint8_t)(*cs++);
|
||||
u=(UChar)CHAR_TO_UCHAR(c);
|
||||
U_ASSERT((u!=0 || c==0)); /* only invariant chars converted? */
|
||||
*us++=u;
|
||||
--length;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
u_UCharsToChars(const UChar *us, char *cs, int32_t length) {
|
||||
UChar u;
|
||||
|
||||
while(length>0) {
|
||||
u=*us++;
|
||||
if(!UCHAR_IS_INVARIANT(u)) {
|
||||
U_ASSERT(FALSE); /* Variant characters were used. These are not portable in ICU. */
|
||||
u=0;
|
||||
}
|
||||
*cs++=(char)UCHAR_TO_CHAR(u);
|
||||
--length;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uprv_isInvariantString(const char *s, int32_t length) {
|
||||
uint8_t c;
|
||||
|
||||
for(;;) {
|
||||
if(length<0) {
|
||||
/* NUL-terminated */
|
||||
c=(uint8_t)*s++;
|
||||
if(c==0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* count length */
|
||||
if(length==0) {
|
||||
break;
|
||||
}
|
||||
--length;
|
||||
c=(uint8_t)*s++;
|
||||
if(c==0) {
|
||||
continue; /* NUL is invariant */
|
||||
}
|
||||
}
|
||||
/* c!=0 now, one branch below checks c==0 for variant characters */
|
||||
|
||||
/*
|
||||
* no assertions here because these functions are legitimately called
|
||||
* for strings with variant characters
|
||||
*/
|
||||
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
||||
if(!UCHAR_IS_INVARIANT(c)) {
|
||||
return FALSE; /* found a variant char */
|
||||
}
|
||||
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
c=CHAR_TO_UCHAR(c);
|
||||
if(c==0 || !UCHAR_IS_INVARIANT(c)) {
|
||||
return FALSE; /* found a variant char */
|
||||
}
|
||||
#else
|
||||
# error U_CHARSET_FAMILY is not valid
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
uprv_isInvariantUString(const UChar *s, int32_t length) {
|
||||
UChar c;
|
||||
|
||||
for(;;) {
|
||||
if(length<0) {
|
||||
/* NUL-terminated */
|
||||
c=*s++;
|
||||
if(c==0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* count length */
|
||||
if(length==0) {
|
||||
break;
|
||||
}
|
||||
--length;
|
||||
c=*s++;
|
||||
}
|
||||
|
||||
/*
|
||||
* no assertions here because these functions are legitimately called
|
||||
* for strings with variant characters
|
||||
*/
|
||||
if(!UCHAR_IS_INVARIANT(c)) {
|
||||
return FALSE; /* found a variant char */
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* UDataSwapFn implementations used in udataswp.c ------- */
|
||||
|
||||
/* convert ASCII to EBCDIC and verify that all characters are invariant */
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uprv_ebcdicFromAscii(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const uint8_t *s;
|
||||
uint8_t *t;
|
||||
uint8_t c;
|
||||
|
||||
int32_t count;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup and swapping */
|
||||
s=(const uint8_t *)inData;
|
||||
t=(uint8_t *)outData;
|
||||
count=length;
|
||||
while(count>0) {
|
||||
c=*s++;
|
||||
if(!UCHAR_IS_INVARIANT(c)) {
|
||||
udata_printError(ds, "uprv_ebcdicFromAscii() string[%d] contains a variant character in position %d\n",
|
||||
length, length-count);
|
||||
*pErrorCode=U_INVALID_CHAR_FOUND;
|
||||
return 0;
|
||||
}
|
||||
*t++=ebcdicFromAscii[c];
|
||||
--count;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/* this function only checks and copies ASCII strings without conversion */
|
||||
U_CFUNC int32_t
|
||||
uprv_copyAscii(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const uint8_t *s;
|
||||
uint8_t c;
|
||||
|
||||
int32_t count;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup and checking */
|
||||
s=(const uint8_t *)inData;
|
||||
count=length;
|
||||
while(count>0) {
|
||||
c=*s++;
|
||||
if(!UCHAR_IS_INVARIANT(c)) {
|
||||
udata_printError(ds, "uprv_copyFromAscii() string[%d] contains a variant character in position %d\n",
|
||||
length, length-count);
|
||||
*pErrorCode=U_INVALID_CHAR_FOUND;
|
||||
return 0;
|
||||
}
|
||||
--count;
|
||||
}
|
||||
|
||||
if(length>0 && inData!=outData) {
|
||||
uprv_memcpy(outData, inData, length);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/* convert EBCDIC to ASCII and verify that all characters are invariant */
|
||||
U_CFUNC int32_t
|
||||
uprv_asciiFromEbcdic(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const uint8_t *s;
|
||||
uint8_t *t;
|
||||
uint8_t c;
|
||||
|
||||
int32_t count;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup and swapping */
|
||||
s=(const uint8_t *)inData;
|
||||
t=(uint8_t *)outData;
|
||||
count=length;
|
||||
while(count>0) {
|
||||
c=*s++;
|
||||
if(c!=0 && ((c=asciiFromEbcdic[c])==0 || !UCHAR_IS_INVARIANT(c))) {
|
||||
udata_printError(ds, "uprv_asciiFromEbcdic() string[%d] contains a variant character in position %d\n",
|
||||
length, length-count);
|
||||
*pErrorCode=U_INVALID_CHAR_FOUND;
|
||||
return 0;
|
||||
}
|
||||
*t++=c;
|
||||
--count;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/* this function only checks and copies EBCDIC strings without conversion */
|
||||
U_CFUNC int32_t
|
||||
uprv_copyEbcdic(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const uint8_t *s;
|
||||
uint8_t c;
|
||||
|
||||
int32_t count;
|
||||
|
||||
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup and checking */
|
||||
s=(const uint8_t *)inData;
|
||||
count=length;
|
||||
while(count>0) {
|
||||
c=*s++;
|
||||
if(c!=0 && ((c=asciiFromEbcdic[c])==0 || !UCHAR_IS_INVARIANT(c))) {
|
||||
udata_printError(ds, "uprv_copyEbcdic() string[%] contains a variant character in position %d\n",
|
||||
length, length-count);
|
||||
*pErrorCode=U_INVALID_CHAR_FOUND;
|
||||
return 0;
|
||||
}
|
||||
--count;
|
||||
}
|
||||
|
||||
if(length>0 && inData!=outData) {
|
||||
uprv_memcpy(outData, inData, length);
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/* compare invariant strings; variant characters compare less than others and unlike each other */
|
||||
U_CFUNC int32_t
|
||||
uprv_compareInvAscii(const UDataSwapper *ds,
|
||||
const char *outString, int32_t outLength,
|
||||
const UChar *localString, int32_t localLength) {
|
||||
(void)ds;
|
||||
int32_t minLength;
|
||||
UChar32 c1, c2;
|
||||
uint8_t c;
|
||||
|
||||
if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(outLength<0) {
|
||||
outLength=(int32_t)uprv_strlen(outString);
|
||||
}
|
||||
if(localLength<0) {
|
||||
localLength=u_strlen(localString);
|
||||
}
|
||||
|
||||
minLength= outLength<localLength ? outLength : localLength;
|
||||
|
||||
while(minLength>0) {
|
||||
c=(uint8_t)*outString++;
|
||||
if(UCHAR_IS_INVARIANT(c)) {
|
||||
c1=c;
|
||||
} else {
|
||||
c1=-1;
|
||||
}
|
||||
|
||||
c2=*localString++;
|
||||
if(!UCHAR_IS_INVARIANT(c2)) {
|
||||
c2=-2;
|
||||
}
|
||||
|
||||
if((c1-=c2)!=0) {
|
||||
return c1;
|
||||
}
|
||||
|
||||
--minLength;
|
||||
}
|
||||
|
||||
/* strings start with same prefix, compare lengths */
|
||||
return outLength-localLength;
|
||||
}
|
||||
|
||||
U_CFUNC int32_t
|
||||
uprv_compareInvEbcdic(const UDataSwapper *ds,
|
||||
const char *outString, int32_t outLength,
|
||||
const UChar *localString, int32_t localLength) {
|
||||
(void)ds;
|
||||
int32_t minLength;
|
||||
UChar32 c1, c2;
|
||||
uint8_t c;
|
||||
|
||||
if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(outLength<0) {
|
||||
outLength=(int32_t)uprv_strlen(outString);
|
||||
}
|
||||
if(localLength<0) {
|
||||
localLength=u_strlen(localString);
|
||||
}
|
||||
|
||||
minLength= outLength<localLength ? outLength : localLength;
|
||||
|
||||
while(minLength>0) {
|
||||
c=(uint8_t)*outString++;
|
||||
if(c==0) {
|
||||
c1=0;
|
||||
} else if((c1=asciiFromEbcdic[c])!=0 && UCHAR_IS_INVARIANT(c1)) {
|
||||
/* c1 is set */
|
||||
} else {
|
||||
c1=-1;
|
||||
}
|
||||
|
||||
c2=*localString++;
|
||||
if(!UCHAR_IS_INVARIANT(c2)) {
|
||||
c2=-2;
|
||||
}
|
||||
|
||||
if((c1-=c2)!=0) {
|
||||
return c1;
|
||||
}
|
||||
|
||||
--minLength;
|
||||
}
|
||||
|
||||
/* strings start with same prefix, compare lengths */
|
||||
return outLength-localLength;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2) {
|
||||
int32_t c1, c2;
|
||||
|
||||
for(;; ++s1, ++s2) {
|
||||
c1=(uint8_t)*s1;
|
||||
c2=(uint8_t)*s2;
|
||||
if(c1!=c2) {
|
||||
if(c1!=0 && ((c1=asciiFromEbcdic[c1])==0 || !UCHAR_IS_INVARIANT(c1))) {
|
||||
c1=-(int32_t)(uint8_t)*s1;
|
||||
}
|
||||
if(c2!=0 && ((c2=asciiFromEbcdic[c2])==0 || !UCHAR_IS_INVARIANT(c2))) {
|
||||
c2=-(int32_t)(uint8_t)*s2;
|
||||
}
|
||||
return c1-c2;
|
||||
} else if(c1==0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI char U_EXPORT2
|
||||
uprv_ebcdicToLowercaseAscii(char c) {
|
||||
return (char)lowercaseAsciiFromEbcdic[(uint8_t)c];
|
||||
}
|
||||
|
||||
U_INTERNAL uint8_t* U_EXPORT2
|
||||
uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
|
||||
{
|
||||
uint8_t *orig_dst = dst;
|
||||
|
||||
if(n==-1) {
|
||||
n = static_cast<int32_t>(uprv_strlen((const char*)src)+1); /* copy NUL */
|
||||
}
|
||||
/* copy non-null */
|
||||
while(*src && n>0) {
|
||||
*(dst++) = asciiFromEbcdic[*(src++)];
|
||||
n--;
|
||||
}
|
||||
/* pad */
|
||||
while(n>0) {
|
||||
*(dst++) = 0;
|
||||
n--;
|
||||
}
|
||||
return orig_dst;
|
||||
}
|
||||
|
||||
U_INTERNAL uint8_t* U_EXPORT2
|
||||
uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
|
||||
{
|
||||
uint8_t *orig_dst = dst;
|
||||
|
||||
if(n==-1) {
|
||||
n = static_cast<int32_t>(uprv_strlen((const char*)src)+1); /* copy NUL */
|
||||
}
|
||||
/* copy non-null */
|
||||
while(*src && n>0) {
|
||||
char ch = ebcdicFromAscii[*(src++)];
|
||||
if(ch == 0) {
|
||||
ch = ebcdicFromAscii[0x3f]; /* questionmark (subchar) */
|
||||
}
|
||||
*(dst++) = ch;
|
||||
n--;
|
||||
}
|
||||
/* pad */
|
||||
while(n>0) {
|
||||
*(dst++) = 0;
|
||||
n--;
|
||||
}
|
||||
return orig_dst;
|
||||
}
|
||||
|
||||
146
vendor/icu/src/uinvchar.h
vendored
Normal file
146
vendor/icu/src/uinvchar.h
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: uinvchar.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:2
|
||||
*
|
||||
* created on: 2004sep14
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Definitions for handling invariant characters, moved here from putil.c
|
||||
* for better modularization.
|
||||
*/
|
||||
|
||||
#ifndef __UINVCHAR_H__
|
||||
#define __UINVCHAR_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#ifdef __cplusplus
|
||||
#include <unicode/unistr.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Check if a char string only contains invariant characters.
|
||||
* See utypes.h for details.
|
||||
*
|
||||
* @param s Input string pointer.
|
||||
* @param length Length of the string, can be -1 if NUL-terminated.
|
||||
* @return TRUE if s contains only invariant characters.
|
||||
*
|
||||
* @internal (ICU 2.8)
|
||||
*/
|
||||
U_INTERNAL UBool U_EXPORT2
|
||||
uprv_isInvariantString(const char *s, int32_t length);
|
||||
|
||||
/**
|
||||
* Check if a Unicode string only contains invariant characters.
|
||||
* See utypes.h for details.
|
||||
*
|
||||
* @param s Input string pointer.
|
||||
* @param length Length of the string, can be -1 if NUL-terminated.
|
||||
* @return TRUE if s contains only invariant characters.
|
||||
*
|
||||
* @internal (ICU 2.8)
|
||||
*/
|
||||
U_INTERNAL UBool U_EXPORT2
|
||||
uprv_isInvariantUString(const UChar *s, int32_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/**
|
||||
* Check if a UnicodeString only contains invariant characters.
|
||||
* See utypes.h for details.
|
||||
*
|
||||
* @param s Input string.
|
||||
* @return TRUE if s contains only invariant characters.
|
||||
*/
|
||||
U_INTERNAL inline UBool U_EXPORT2
|
||||
uprv_isInvariantUnicodeString(const icu::UnicodeString &s) {
|
||||
return uprv_isInvariantUString(icu::toUCharPtr(s.getBuffer()), s.length());
|
||||
}
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* \def U_UPPER_ORDINAL
|
||||
* Get the ordinal number of an uppercase invariant character
|
||||
* @internal
|
||||
*/
|
||||
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
||||
# define U_UPPER_ORDINAL(x) ((x)-'A')
|
||||
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
# define U_UPPER_ORDINAL(x) (((x) < 'J') ? ((x)-'A') : \
|
||||
(((x) < 'S') ? ((x)-'J'+9) : \
|
||||
((x)-'S'+18)))
|
||||
#else
|
||||
# error Unknown charset family!
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Compare two EBCDIC invariant-character strings in ASCII order.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL int32_t U_EXPORT2
|
||||
uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2);
|
||||
|
||||
/**
|
||||
* \def uprv_compareInvCharsAsAscii
|
||||
* Compare two invariant-character strings in ASCII order.
|
||||
* @internal
|
||||
*/
|
||||
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
||||
# define uprv_compareInvCharsAsAscii(s1, s2) uprv_strcmp(s1, s2)
|
||||
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
# define uprv_compareInvCharsAsAscii(s1, s2) uprv_compareInvEbcdicAsAscii(s1, s2)
|
||||
#else
|
||||
# error Unknown charset family!
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Converts an EBCDIC invariant character to lowercase ASCII.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL char U_EXPORT2
|
||||
uprv_ebcdicToLowercaseAscii(char c);
|
||||
|
||||
/**
|
||||
* \def uprv_invCharToLowercaseAscii
|
||||
* Converts an invariant character to lowercase ASCII.
|
||||
* @internal
|
||||
*/
|
||||
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
|
||||
# define uprv_invCharToLowercaseAscii uprv_asciitolower
|
||||
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
|
||||
# define uprv_invCharToLowercaseAscii uprv_ebcdicToLowercaseAscii
|
||||
#else
|
||||
# error Unknown charset family!
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copy EBCDIC to ASCII
|
||||
* @internal
|
||||
* @see uprv_strncpy
|
||||
*/
|
||||
U_INTERNAL uint8_t* U_EXPORT2
|
||||
uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
|
||||
|
||||
|
||||
/**
|
||||
* Copy ASCII to EBCDIC
|
||||
* @internal
|
||||
* @see uprv_strncpy
|
||||
*/
|
||||
U_INTERNAL uint8_t* U_EXPORT2
|
||||
uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
57
vendor/icu/src/umapfile.h
vendored
Normal file
57
vendor/icu/src/umapfile.h
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2011, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/*----------------------------------------------------------------------------------
|
||||
*
|
||||
* Memory mapped file wrappers for use by the ICU Data Implementation
|
||||
*
|
||||
* Porting note: The implementation of these functions is very platform specific.
|
||||
* Not all platforms can do real memory mapping. Those that can't
|
||||
* still must implement these functions, getting the data into memory using
|
||||
* whatever means are available.
|
||||
*
|
||||
* These functions are part of the ICU internal implementation, and
|
||||
* are not inteded to be used directly by applications.
|
||||
*
|
||||
*----------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __UMAPFILE_H__
|
||||
#define __UMAPFILE_H__
|
||||
|
||||
#include <unicode/putil.h>
|
||||
#include <unicode/udata.h>
|
||||
#include "putilimp.h"
|
||||
|
||||
U_CFUNC UBool uprv_mapFile(UDataMemory *pdm, const char *path);
|
||||
U_CFUNC void uprv_unmapFile(UDataMemory *pData);
|
||||
|
||||
/* MAP_NONE: no memory mapping, no file access at all */
|
||||
#define MAP_NONE 0
|
||||
#define MAP_WIN32 1
|
||||
#define MAP_POSIX 2
|
||||
#define MAP_STDIO 3
|
||||
#define MAP_390DLL 4
|
||||
|
||||
#if UCONFIG_NO_FILE_IO
|
||||
# define MAP_IMPLEMENTATION MAP_NONE
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
# define MAP_IMPLEMENTATION MAP_WIN32
|
||||
#elif U_HAVE_MMAP || U_PLATFORM == U_PF_OS390
|
||||
# if U_PLATFORM == U_PF_OS390 && defined (OS390_STUBDATA)
|
||||
/* No memory mapping for 390 batch mode. Fake it using dll loading. */
|
||||
# define MAP_IMPLEMENTATION MAP_390DLL
|
||||
# else
|
||||
# define MAP_IMPLEMENTATION MAP_POSIX
|
||||
# endif
|
||||
#else /* unknown platform, no memory map implementation: use stdio.h and uprv_malloc() instead */
|
||||
# define MAP_IMPLEMENTATION MAP_STDIO
|
||||
#endif
|
||||
|
||||
#endif
|
||||
26
vendor/icu/src/umath.cpp
vendored
Normal file
26
vendor/icu/src/umath.cpp
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2006, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* This file contains platform independent math.
|
||||
*/
|
||||
|
||||
#include "putilimp.h"
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uprv_max(int32_t x, int32_t y)
|
||||
{
|
||||
return (x > y ? x : y);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uprv_min(int32_t x, int32_t y)
|
||||
{
|
||||
return (x > y ? y : x);
|
||||
}
|
||||
|
||||
451
vendor/icu/src/umutex.h
vendored
Normal file
451
vendor/icu/src/umutex.h
vendored
Normal file
@@ -0,0 +1,451 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1997-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
* File UMUTEX.H
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 04/02/97 aliu Creation.
|
||||
* 04/07/99 srl rewrite - C interface, multiple mutices
|
||||
* 05/13/99 stephen Changed to umutex (from cmutex)
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef UMUTEX_H
|
||||
#define UMUTEX_H
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uclean.h>
|
||||
#include "putilimp.h"
|
||||
|
||||
|
||||
|
||||
// Forward Declarations. UMutex is not in the ICU namespace (yet) because
|
||||
// there are some remaining references from plain C.
|
||||
struct UMutex;
|
||||
struct UConditionVar;
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
struct UInitOnce;
|
||||
U_NAMESPACE_END
|
||||
|
||||
// Stringify macros, to allow #include of user supplied atomic & mutex files.
|
||||
#define U_MUTEX_STR(s) #s
|
||||
#define U_MUTEX_XSTR(s) U_MUTEX_STR(s)
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Low Level Atomic Operations.
|
||||
* Compiler dependent. Not operating system dependent.
|
||||
*
|
||||
****************************************************************************/
|
||||
#if defined (U_USER_ATOMICS_H)
|
||||
#include U_MUTEX_XSTR(U_USER_ATOMICS_H)
|
||||
|
||||
#elif U_HAVE_STD_ATOMICS
|
||||
|
||||
// C++11 atomics are available.
|
||||
|
||||
#include <atomic>
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
typedef std::atomic<int32_t> u_atomic_int32_t;
|
||||
#define ATOMIC_INT32_T_INITIALIZER(val) ATOMIC_VAR_INIT(val)
|
||||
|
||||
inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) {
|
||||
return var.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
inline void umtx_storeRelease(u_atomic_int32_t &var, int32_t val) {
|
||||
var.store(val, std::memory_order_release);
|
||||
}
|
||||
|
||||
inline int32_t umtx_atomic_inc(u_atomic_int32_t *var) {
|
||||
return var->fetch_add(1) + 1;
|
||||
}
|
||||
|
||||
inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) {
|
||||
return var->fetch_sub(1) - 1;
|
||||
}
|
||||
U_NAMESPACE_END
|
||||
|
||||
#elif U_PLATFORM_HAS_WIN32_API
|
||||
|
||||
// MSVC compiler. Reads and writes of volatile variables have
|
||||
// acquire and release memory semantics, respectively.
|
||||
// This is a Microsoft extension, not standard C++ behavior.
|
||||
//
|
||||
// Update: can't use this because of MinGW, built with gcc.
|
||||
// Original plan was to use gcc atomics for MinGW, but they
|
||||
// aren't supported, so we fold MinGW into this path.
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
# define VC_EXTRALEAN
|
||||
# define NOUSER
|
||||
# define NOSERVICE
|
||||
# define NOIME
|
||||
# define NOMCX
|
||||
# ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# include <windows.h>
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
typedef volatile LONG u_atomic_int32_t;
|
||||
#define ATOMIC_INT32_T_INITIALIZER(val) val
|
||||
|
||||
inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) {
|
||||
return InterlockedCompareExchange(&var, 0, 0);
|
||||
}
|
||||
|
||||
inline void umtx_storeRelease(u_atomic_int32_t &var, int32_t val) {
|
||||
InterlockedExchange(&var, val);
|
||||
}
|
||||
|
||||
|
||||
inline int32_t umtx_atomic_inc(u_atomic_int32_t *var) {
|
||||
return InterlockedIncrement(var);
|
||||
}
|
||||
|
||||
inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) {
|
||||
return InterlockedDecrement(var);
|
||||
}
|
||||
U_NAMESPACE_END
|
||||
|
||||
|
||||
#elif U_HAVE_CLANG_ATOMICS
|
||||
/*
|
||||
* Clang __c11 atomic built-ins
|
||||
*/
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
typedef _Atomic(int32_t) u_atomic_int32_t;
|
||||
#define ATOMIC_INT32_T_INITIALIZER(val) val
|
||||
|
||||
inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) {
|
||||
return __c11_atomic_load(&var, __ATOMIC_ACQUIRE);
|
||||
}
|
||||
|
||||
inline void umtx_storeRelease(u_atomic_int32_t &var, int32_t val) {
|
||||
return __c11_atomic_store(&var, val, __ATOMIC_RELEASE);
|
||||
}
|
||||
|
||||
inline int32_t umtx_atomic_inc(u_atomic_int32_t *var) {
|
||||
return __c11_atomic_fetch_add(var, 1, __ATOMIC_SEQ_CST) + 1;
|
||||
}
|
||||
|
||||
inline int32_t umtx_atomic_dec(u_atomic_int32_t *var) {
|
||||
return __c11_atomic_fetch_sub(var, 1, __ATOMIC_SEQ_CST) - 1;
|
||||
}
|
||||
U_NAMESPACE_END
|
||||
|
||||
|
||||
#elif U_HAVE_GCC_ATOMICS
|
||||
/*
|
||||
* gcc atomic ops. These are available on several other compilers as well.
|
||||
*/
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
typedef int32_t u_atomic_int32_t;
|
||||
#define ATOMIC_INT32_T_INITIALIZER(val) val
|
||||
|
||||
inline int32_t umtx_loadAcquire(u_atomic_int32_t &var) {
|
||||
int32_t val = var;
|
||||
__sync_synchronize();
|
||||
return val;
|
||||
}
|
||||
|
||||
inline void umtx_storeRelease(u_atomic_int32_t &var, int32_t val) {
|
||||
__sync_synchronize();
|
||||
var = val;
|
||||
}
|
||||
|
||||
inline int32_t umtx_atomic_inc(u_atomic_int32_t *p) {
|
||||
return __sync_add_and_fetch(p, 1);
|
||||
}
|
||||
|
||||
inline int32_t umtx_atomic_dec(u_atomic_int32_t *p) {
|
||||
return __sync_sub_and_fetch(p, 1);
|
||||
}
|
||||
U_NAMESPACE_END
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Unknown Platform. Use out-of-line functions, which in turn use mutexes.
|
||||
* Slow but correct.
|
||||
*/
|
||||
|
||||
#define U_NO_PLATFORM_ATOMICS
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
typedef int32_t u_atomic_int32_t;
|
||||
#define ATOMIC_INT32_T_INITIALIZER(val) val
|
||||
|
||||
U_COMMON_API int32_t U_EXPORT2
|
||||
umtx_loadAcquire(u_atomic_int32_t &var);
|
||||
|
||||
U_COMMON_API void U_EXPORT2
|
||||
umtx_storeRelease(u_atomic_int32_t &var, int32_t val);
|
||||
|
||||
U_COMMON_API int32_t U_EXPORT2
|
||||
umtx_atomic_inc(u_atomic_int32_t *p);
|
||||
|
||||
U_COMMON_API int32_t U_EXPORT2
|
||||
umtx_atomic_dec(u_atomic_int32_t *p);
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif /* Low Level Atomic Ops Platfrom Chain */
|
||||
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
*
|
||||
* UInitOnce Definitions.
|
||||
* These are platform neutral.
|
||||
*
|
||||
*************************************************************************************************/
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
struct UInitOnce {
|
||||
u_atomic_int32_t fState;
|
||||
UErrorCode fErrCode;
|
||||
void reset() {fState = 0;};
|
||||
UBool isReset() {return umtx_loadAcquire(fState) == 0;};
|
||||
// Note: isReset() is used by service registration code.
|
||||
// Thread safety of this usage needs review.
|
||||
};
|
||||
|
||||
#define U_INITONCE_INITIALIZER {ATOMIC_INT32_T_INITIALIZER(0), U_ZERO_ERROR}
|
||||
|
||||
|
||||
U_COMMON_API UBool U_EXPORT2 umtx_initImplPreInit(UInitOnce &);
|
||||
U_COMMON_API void U_EXPORT2 umtx_initImplPostInit(UInitOnce &);
|
||||
|
||||
template<class T> void umtx_initOnce(UInitOnce &uio, T *obj, void (U_CALLCONV T::*fp)()) {
|
||||
if (umtx_loadAcquire(uio.fState) == 2) {
|
||||
return;
|
||||
}
|
||||
if (umtx_initImplPreInit(uio)) {
|
||||
(obj->*fp)();
|
||||
umtx_initImplPostInit(uio);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// umtx_initOnce variant for plain functions, or static class functions.
|
||||
// No context parameter.
|
||||
inline void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)()) {
|
||||
if (umtx_loadAcquire(uio.fState) == 2) {
|
||||
return;
|
||||
}
|
||||
if (umtx_initImplPreInit(uio)) {
|
||||
(*fp)();
|
||||
umtx_initImplPostInit(uio);
|
||||
}
|
||||
}
|
||||
|
||||
// umtx_initOnce variant for plain functions, or static class functions.
|
||||
// With ErrorCode, No context parameter.
|
||||
inline void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(UErrorCode &), UErrorCode &errCode) {
|
||||
if (U_FAILURE(errCode)) {
|
||||
return;
|
||||
}
|
||||
if (umtx_loadAcquire(uio.fState) != 2 && umtx_initImplPreInit(uio)) {
|
||||
// We run the initialization.
|
||||
(*fp)(errCode);
|
||||
uio.fErrCode = errCode;
|
||||
umtx_initImplPostInit(uio);
|
||||
} else {
|
||||
// Someone else already ran the initialization.
|
||||
if (U_FAILURE(uio.fErrCode)) {
|
||||
errCode = uio.fErrCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// umtx_initOnce variant for plain functions, or static class functions,
|
||||
// with a context parameter.
|
||||
template<class T> void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(T), T context) {
|
||||
if (umtx_loadAcquire(uio.fState) == 2) {
|
||||
return;
|
||||
}
|
||||
if (umtx_initImplPreInit(uio)) {
|
||||
(*fp)(context);
|
||||
umtx_initImplPostInit(uio);
|
||||
}
|
||||
}
|
||||
|
||||
// umtx_initOnce variant for plain functions, or static class functions,
|
||||
// with a context parameter and an error code.
|
||||
template<class T> void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(T, UErrorCode &), T context, UErrorCode &errCode) {
|
||||
if (U_FAILURE(errCode)) {
|
||||
return;
|
||||
}
|
||||
if (umtx_loadAcquire(uio.fState) != 2 && umtx_initImplPreInit(uio)) {
|
||||
// We run the initialization.
|
||||
(*fp)(context, errCode);
|
||||
uio.fErrCode = errCode;
|
||||
umtx_initImplPostInit(uio);
|
||||
} else {
|
||||
// Someone else already ran the initialization.
|
||||
if (U_FAILURE(uio.fErrCode)) {
|
||||
errCode = uio.fErrCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
|
||||
|
||||
/*************************************************************************************************
|
||||
*
|
||||
* Mutex Definitions. Platform Dependent, #if platform chain follows.
|
||||
* TODO: Add a C++11 version.
|
||||
* Need to convert all mutex using files to C++ first.
|
||||
*
|
||||
*************************************************************************************************/
|
||||
|
||||
#if defined(U_USER_MUTEX_H)
|
||||
// #inlcude "U_USER_MUTEX_H"
|
||||
#include U_MUTEX_XSTR(U_USER_MUTEX_H)
|
||||
|
||||
#elif U_PLATFORM_USES_ONLY_WIN32_API
|
||||
|
||||
/* For CRITICAL_SECTION */
|
||||
|
||||
/*
|
||||
* Note: there is an earlier include of windows.h in this file, but it is in
|
||||
* different conditionals.
|
||||
* This one is needed if we are using C++11 for atomic ops, but
|
||||
* win32 APIs for Critical Sections.
|
||||
*/
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
# define VC_EXTRALEAN
|
||||
# define NOUSER
|
||||
# define NOSERVICE
|
||||
# define NOIME
|
||||
# define NOMCX
|
||||
# ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
# include <windows.h>
|
||||
|
||||
|
||||
typedef struct UMutex {
|
||||
icu::UInitOnce fInitOnce;
|
||||
CRITICAL_SECTION fCS;
|
||||
} UMutex;
|
||||
|
||||
/* Initializer for a static UMUTEX. Deliberately contains no value for the
|
||||
* CRITICAL_SECTION.
|
||||
*/
|
||||
#define U_MUTEX_INITIALIZER {U_INITONCE_INITIALIZER}
|
||||
|
||||
struct UConditionVar {
|
||||
HANDLE fEntryGate;
|
||||
HANDLE fExitGate;
|
||||
int32_t fWaitCount;
|
||||
};
|
||||
|
||||
#define U_CONDITION_INITIALIZER {NULL, NULL, 0}
|
||||
|
||||
|
||||
|
||||
#elif U_PLATFORM_IMPLEMENTS_POSIX
|
||||
|
||||
/*
|
||||
* POSIX platform
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
struct UMutex {
|
||||
pthread_mutex_t fMutex;
|
||||
};
|
||||
typedef struct UMutex UMutex;
|
||||
#define U_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER}
|
||||
|
||||
struct UConditionVar {
|
||||
pthread_cond_t fCondition;
|
||||
};
|
||||
#define U_CONDITION_INITIALIZER {PTHREAD_COND_INITIALIZER}
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Unknow platform type.
|
||||
* This is an error condition. ICU requires mutexes.
|
||||
*/
|
||||
|
||||
#error Unknown Platform.
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**************************************************************************************
|
||||
*
|
||||
* Mutex Implementation function declaratations.
|
||||
* Declarations are platform neutral.
|
||||
* Implementations, in umutex.cpp, are platform specific.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/* Lock a mutex.
|
||||
* @param mutex The given mutex to be locked. Pass NULL to specify
|
||||
* the global ICU mutex. Recursive locks are an error
|
||||
* and may cause a deadlock on some platforms.
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex);
|
||||
|
||||
/* Unlock a mutex.
|
||||
* @param mutex The given mutex to be unlocked. Pass NULL to specify
|
||||
* the global ICU mutex.
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex);
|
||||
|
||||
/*
|
||||
* Wait on a condition variable.
|
||||
* The calling thread will unlock the mutex and wait on the condition variable.
|
||||
* The mutex must be locked by the calling thread when invoking this function.
|
||||
*
|
||||
* @param cond the condition variable to wait on.
|
||||
* @param mutex the associated mutex.
|
||||
*/
|
||||
|
||||
U_INTERNAL void U_EXPORT2 umtx_condWait(UConditionVar *cond, UMutex *mutex);
|
||||
|
||||
|
||||
/*
|
||||
* Broadcast wakeup of all threads waiting on a Condition.
|
||||
* The associated mutex must be locked by the calling thread when calling
|
||||
* this function; this is a temporary ICU restriction.
|
||||
*
|
||||
* @param cond the condition variable.
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2 umtx_condBroadcast(UConditionVar *cond);
|
||||
|
||||
/*
|
||||
* Signal a condition variable, waking up one waiting thread.
|
||||
* CAUTION: Do not use. Place holder only. Not implemented for Windows.
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2 umtx_condSignal(UConditionVar *cond);
|
||||
|
||||
#endif /* UMUTEX_H */
|
||||
/*eof*/
|
||||
463
vendor/icu/src/uprops.h
vendored
Normal file
463
vendor/icu/src/uprops.h
vendored
Normal file
@@ -0,0 +1,463 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2002-2016, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: uprops.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2002feb24
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Constants for mostly non-core Unicode character properties
|
||||
* stored in uprops.icu.
|
||||
*/
|
||||
|
||||
#ifndef __UPROPS_H__
|
||||
#define __UPROPS_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uset.h>
|
||||
#include "uset_imp.h"
|
||||
#include "udataswp.h"
|
||||
|
||||
/* indexes[] entries */
|
||||
enum {
|
||||
UPROPS_PROPS32_INDEX,
|
||||
UPROPS_EXCEPTIONS_INDEX,
|
||||
UPROPS_EXCEPTIONS_TOP_INDEX,
|
||||
|
||||
UPROPS_ADDITIONAL_TRIE_INDEX,
|
||||
UPROPS_ADDITIONAL_VECTORS_INDEX,
|
||||
UPROPS_ADDITIONAL_VECTORS_COLUMNS_INDEX,
|
||||
|
||||
UPROPS_SCRIPT_EXTENSIONS_INDEX,
|
||||
|
||||
UPROPS_RESERVED_INDEX_7,
|
||||
UPROPS_RESERVED_INDEX_8,
|
||||
|
||||
/* size of the data file (number of 32-bit units after the header) */
|
||||
UPROPS_DATA_TOP_INDEX,
|
||||
|
||||
/* maximum values for code values in vector word 0 */
|
||||
UPROPS_MAX_VALUES_INDEX=10,
|
||||
/* maximum values for code values in vector word 2 */
|
||||
UPROPS_MAX_VALUES_2_INDEX,
|
||||
|
||||
UPROPS_INDEX_COUNT=16
|
||||
};
|
||||
|
||||
/* definitions for the main properties words */
|
||||
enum {
|
||||
/* general category shift==0 0 (5 bits) */
|
||||
/* reserved 5 (1 bit) */
|
||||
UPROPS_NUMERIC_TYPE_VALUE_SHIFT=6 /* 6 (10 bits) */
|
||||
};
|
||||
|
||||
#define GET_CATEGORY(props) ((props)&0x1f)
|
||||
#define CAT_MASK(props) U_MASK(GET_CATEGORY(props))
|
||||
|
||||
#define GET_NUMERIC_TYPE_VALUE(props) ((props)>>UPROPS_NUMERIC_TYPE_VALUE_SHIFT)
|
||||
|
||||
/* constants for the storage form of numeric types and values */
|
||||
enum {
|
||||
/** No numeric value. */
|
||||
UPROPS_NTV_NONE=0,
|
||||
/** Decimal digits: nv=0..9 */
|
||||
UPROPS_NTV_DECIMAL_START=1,
|
||||
/** Other digits: nv=0..9 */
|
||||
UPROPS_NTV_DIGIT_START=11,
|
||||
/** Small integers: nv=0..154 */
|
||||
UPROPS_NTV_NUMERIC_START=21,
|
||||
/** Fractions: ((ntv>>4)-12) / ((ntv&0xf)+1) = -1..17 / 1..16 */
|
||||
UPROPS_NTV_FRACTION_START=0xb0,
|
||||
/**
|
||||
* Large integers:
|
||||
* ((ntv>>5)-14) * 10^((ntv&0x1f)+2) = (1..9)*(10^2..10^33)
|
||||
* (only one significant decimal digit)
|
||||
*/
|
||||
UPROPS_NTV_LARGE_START=0x1e0,
|
||||
/**
|
||||
* Sexagesimal numbers:
|
||||
* ((ntv>>2)-0xbf) * 60^((ntv&3)+1) = (1..9)*(60^1..60^4)
|
||||
*/
|
||||
UPROPS_NTV_BASE60_START=0x300,
|
||||
/**
|
||||
* Fraction-20 values:
|
||||
* frac20 = ntv-0x324 = 0..0x17 -> 1|3|5|7 / 20|40|80|160|320|640
|
||||
* numerator: num = 2*(frac20&3)+1
|
||||
* denominator: den = 20<<(frac20>>2)
|
||||
*/
|
||||
UPROPS_NTV_FRACTION20_START=UPROPS_NTV_BASE60_START+36, // 0x300+9*4=0x324
|
||||
/** No numeric value (yet). */
|
||||
UPROPS_NTV_RESERVED_START=UPROPS_NTV_FRACTION20_START+24, // 0x324+6*4=0x34c
|
||||
|
||||
UPROPS_NTV_MAX_SMALL_INT=UPROPS_NTV_FRACTION_START-UPROPS_NTV_NUMERIC_START-1
|
||||
};
|
||||
|
||||
#define UPROPS_NTV_GET_TYPE(ntv) \
|
||||
((ntv==UPROPS_NTV_NONE) ? U_NT_NONE : \
|
||||
(ntv<UPROPS_NTV_DIGIT_START) ? U_NT_DECIMAL : \
|
||||
(ntv<UPROPS_NTV_NUMERIC_START) ? U_NT_DIGIT : \
|
||||
U_NT_NUMERIC)
|
||||
|
||||
/* number of properties vector words */
|
||||
#define UPROPS_VECTOR_WORDS 3
|
||||
|
||||
/*
|
||||
* Properties in vector word 0
|
||||
* Bits
|
||||
* 31..24 DerivedAge version major/minor one nibble each
|
||||
* 23..22 3..1: Bits 7..0 = Script_Extensions index
|
||||
* 3: Script value from Script_Extensions
|
||||
* 2: Script=Inherited
|
||||
* 1: Script=Common
|
||||
* 0: Script=bits 7..0
|
||||
* 21..20 reserved
|
||||
* 19..17 East Asian Width
|
||||
* 16.. 8 UBlockCode
|
||||
* 7.. 0 UScriptCode, or index to Script_Extensions
|
||||
*/
|
||||
|
||||
/* derived age: one nibble each for major and minor version numbers */
|
||||
#define UPROPS_AGE_MASK 0xff000000
|
||||
#define UPROPS_AGE_SHIFT 24
|
||||
|
||||
/* Script_Extensions: mask includes Script */
|
||||
#define UPROPS_SCRIPT_X_MASK 0x00c000ff
|
||||
#define UPROPS_SCRIPT_X_SHIFT 22
|
||||
|
||||
#define UPROPS_EA_MASK 0x000e0000
|
||||
#define UPROPS_EA_SHIFT 17
|
||||
|
||||
#define UPROPS_BLOCK_MASK 0x0001ff00
|
||||
#define UPROPS_BLOCK_SHIFT 8
|
||||
|
||||
#define UPROPS_SCRIPT_MASK 0x000000ff
|
||||
|
||||
/* UPROPS_SCRIPT_X_WITH_COMMON must be the lowest value that involves Script_Extensions. */
|
||||
#define UPROPS_SCRIPT_X_WITH_COMMON 0x400000
|
||||
#define UPROPS_SCRIPT_X_WITH_INHERITED 0x800000
|
||||
#define UPROPS_SCRIPT_X_WITH_OTHER 0xc00000
|
||||
|
||||
/*
|
||||
* Properties in vector word 1
|
||||
* Each bit encodes one binary property.
|
||||
* The following constants represent the bit number, use 1<<UPROPS_XYZ.
|
||||
* UPROPS_BINARY_1_TOP<=32!
|
||||
*
|
||||
* Keep this list of property enums in sync with
|
||||
* propListNames[] in icu/source/tools/genprops/props2.c!
|
||||
*
|
||||
* ICU 2.6/uprops format version 3.2 stores full properties instead of "Other_".
|
||||
*/
|
||||
enum {
|
||||
UPROPS_WHITE_SPACE,
|
||||
UPROPS_DASH,
|
||||
UPROPS_HYPHEN,
|
||||
UPROPS_QUOTATION_MARK,
|
||||
UPROPS_TERMINAL_PUNCTUATION,
|
||||
UPROPS_MATH,
|
||||
UPROPS_HEX_DIGIT,
|
||||
UPROPS_ASCII_HEX_DIGIT,
|
||||
UPROPS_ALPHABETIC,
|
||||
UPROPS_IDEOGRAPHIC,
|
||||
UPROPS_DIACRITIC,
|
||||
UPROPS_EXTENDER,
|
||||
UPROPS_NONCHARACTER_CODE_POINT,
|
||||
UPROPS_GRAPHEME_EXTEND,
|
||||
UPROPS_GRAPHEME_LINK,
|
||||
UPROPS_IDS_BINARY_OPERATOR,
|
||||
UPROPS_IDS_TRINARY_OPERATOR,
|
||||
UPROPS_RADICAL,
|
||||
UPROPS_UNIFIED_IDEOGRAPH,
|
||||
UPROPS_DEFAULT_IGNORABLE_CODE_POINT,
|
||||
UPROPS_DEPRECATED,
|
||||
UPROPS_LOGICAL_ORDER_EXCEPTION,
|
||||
UPROPS_XID_START,
|
||||
UPROPS_XID_CONTINUE,
|
||||
UPROPS_ID_START, /* ICU 2.6, uprops format version 3.2 */
|
||||
UPROPS_ID_CONTINUE,
|
||||
UPROPS_GRAPHEME_BASE,
|
||||
UPROPS_S_TERM, /* new in ICU 3.0 and Unicode 4.0.1 */
|
||||
UPROPS_VARIATION_SELECTOR,
|
||||
UPROPS_PATTERN_SYNTAX, /* new in ICU 3.4 and Unicode 4.1 */
|
||||
UPROPS_PATTERN_WHITE_SPACE,
|
||||
UPROPS_PREPENDED_CONCATENATION_MARK, // new in ICU 60 and Unicode 10
|
||||
UPROPS_BINARY_1_TOP /* ==32 - full! */
|
||||
};
|
||||
|
||||
/*
|
||||
* Properties in vector word 2
|
||||
* Bits
|
||||
* 31..27 http://www.unicode.org/reports/tr51/#Emoji_Properties
|
||||
* 26 reserved
|
||||
* 25..20 Line Break
|
||||
* 19..15 Sentence Break
|
||||
* 14..10 Word Break
|
||||
* 9.. 5 Grapheme Cluster Break
|
||||
* 4.. 0 Decomposition Type
|
||||
*/
|
||||
enum {
|
||||
UPROPS_2_EMOJI_COMPONENT=27,
|
||||
UPROPS_2_EMOJI,
|
||||
UPROPS_2_EMOJI_PRESENTATION,
|
||||
UPROPS_2_EMOJI_MODIFIER,
|
||||
UPROPS_2_EMOJI_MODIFIER_BASE
|
||||
};
|
||||
|
||||
#define UPROPS_LB_MASK 0x03f00000
|
||||
#define UPROPS_LB_SHIFT 20
|
||||
|
||||
#define UPROPS_SB_MASK 0x000f8000
|
||||
#define UPROPS_SB_SHIFT 15
|
||||
|
||||
#define UPROPS_WB_MASK 0x00007c00
|
||||
#define UPROPS_WB_SHIFT 10
|
||||
|
||||
#define UPROPS_GCB_MASK 0x000003e0
|
||||
#define UPROPS_GCB_SHIFT 5
|
||||
|
||||
#define UPROPS_DT_MASK 0x0000001f
|
||||
|
||||
/**
|
||||
* Gets the main properties value for a code point.
|
||||
* Implemented in uchar.c for uprops.cpp.
|
||||
*/
|
||||
U_CFUNC uint32_t
|
||||
u_getMainProperties(UChar32 c);
|
||||
|
||||
/**
|
||||
* Get a properties vector word for a code point.
|
||||
* Implemented in uchar.c for uprops.cpp.
|
||||
* @return 0 if no data or illegal argument
|
||||
*/
|
||||
U_CFUNC uint32_t
|
||||
u_getUnicodeProperties(UChar32 c, int32_t column);
|
||||
|
||||
/**
|
||||
* Get the the maximum values for some enum/int properties.
|
||||
* Use the same column numbers as for u_getUnicodeProperties().
|
||||
* The returned value will contain maximum values stored in the same bit fields
|
||||
* as where the enum values are stored in the u_getUnicodeProperties()
|
||||
* return values for the same columns.
|
||||
*
|
||||
* Valid columns are those for properties words that contain enumerated values.
|
||||
* (ICU 2.6: columns 0 and 2)
|
||||
* For other column numbers, this function will return 0.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC int32_t
|
||||
uprv_getMaxValues(int32_t column);
|
||||
|
||||
/**
|
||||
* Checks if c is alphabetic, or a decimal digit; implements UCHAR_POSIX_ALNUM.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
u_isalnumPOSIX(UChar32 c);
|
||||
|
||||
/**
|
||||
* Checks if c is in
|
||||
* [^\p{space}\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]
|
||||
* with space=\p{Whitespace} and Control=Cc.
|
||||
* Implements UCHAR_POSIX_GRAPH.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
u_isgraphPOSIX(UChar32 c);
|
||||
|
||||
/**
|
||||
* Checks if c is in \p{graph}\p{blank} - \p{cntrl}.
|
||||
* Implements UCHAR_POSIX_PRINT.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC UBool
|
||||
u_isprintPOSIX(UChar32 c);
|
||||
|
||||
/** Turn a bit index into a bit flag. @internal */
|
||||
#define FLAG(n) ((uint32_t)1<<(n))
|
||||
|
||||
/** Flags for general categories in the order of UCharCategory. @internal */
|
||||
#define _Cn FLAG(U_GENERAL_OTHER_TYPES)
|
||||
#define _Lu FLAG(U_UPPERCASE_LETTER)
|
||||
#define _Ll FLAG(U_LOWERCASE_LETTER)
|
||||
#define _Lt FLAG(U_TITLECASE_LETTER)
|
||||
#define _Lm FLAG(U_MODIFIER_LETTER)
|
||||
/* #define _Lo FLAG(U_OTHER_LETTER) -- conflicts with MS Visual Studio 9.0 xiosbase */
|
||||
#define _Mn FLAG(U_NON_SPACING_MARK)
|
||||
#define _Me FLAG(U_ENCLOSING_MARK)
|
||||
#define _Mc FLAG(U_COMBINING_SPACING_MARK)
|
||||
#define _Nd FLAG(U_DECIMAL_DIGIT_NUMBER)
|
||||
#define _Nl FLAG(U_LETTER_NUMBER)
|
||||
#define _No FLAG(U_OTHER_NUMBER)
|
||||
#define _Zs FLAG(U_SPACE_SEPARATOR)
|
||||
#define _Zl FLAG(U_LINE_SEPARATOR)
|
||||
#define _Zp FLAG(U_PARAGRAPH_SEPARATOR)
|
||||
#define _Cc FLAG(U_CONTROL_CHAR)
|
||||
#define _Cf FLAG(U_FORMAT_CHAR)
|
||||
#define _Co FLAG(U_PRIVATE_USE_CHAR)
|
||||
#define _Cs FLAG(U_SURROGATE)
|
||||
#define _Pd FLAG(U_DASH_PUNCTUATION)
|
||||
#define _Ps FLAG(U_START_PUNCTUATION)
|
||||
/* #define _Pe FLAG(U_END_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 xlocnum */
|
||||
/* #define _Pc FLAG(U_CONNECTOR_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 streambuf */
|
||||
#define _Po FLAG(U_OTHER_PUNCTUATION)
|
||||
#define _Sm FLAG(U_MATH_SYMBOL)
|
||||
#define _Sc FLAG(U_CURRENCY_SYMBOL)
|
||||
#define _Sk FLAG(U_MODIFIER_SYMBOL)
|
||||
#define _So FLAG(U_OTHER_SYMBOL)
|
||||
#define _Pi FLAG(U_INITIAL_PUNCTUATION)
|
||||
/* #define _Pf FLAG(U_FINAL_PUNCTUATION) -- conflicts with MS Visual Studio 9.0 streambuf */
|
||||
|
||||
/** Some code points. @internal */
|
||||
enum {
|
||||
TAB =0x0009,
|
||||
LF =0x000a,
|
||||
FF =0x000c,
|
||||
CR =0x000d,
|
||||
U_A =0x0041,
|
||||
U_F =0x0046,
|
||||
U_Z =0x005a,
|
||||
U_a =0x0061,
|
||||
U_f =0x0066,
|
||||
U_z =0x007a,
|
||||
DEL =0x007f,
|
||||
NL =0x0085,
|
||||
NBSP =0x00a0,
|
||||
CGJ =0x034f,
|
||||
FIGURESP=0x2007,
|
||||
HAIRSP =0x200a,
|
||||
ZWNJ =0x200c,
|
||||
ZWJ =0x200d,
|
||||
RLM =0x200f,
|
||||
NNBSP =0x202f,
|
||||
WJ =0x2060,
|
||||
INHSWAP =0x206a,
|
||||
NOMDIG =0x206f,
|
||||
U_FW_A =0xff21,
|
||||
U_FW_F =0xff26,
|
||||
U_FW_Z =0xff3a,
|
||||
U_FW_a =0xff41,
|
||||
U_FW_f =0xff46,
|
||||
U_FW_z =0xff5a,
|
||||
ZWNBSP =0xfeff
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the maximum length of a (regular/1.0/extended) character name.
|
||||
* @return 0 if no character names available.
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uprv_getMaxCharNameLength(void);
|
||||
|
||||
/**
|
||||
* Fills set with characters that are used in Unicode character names.
|
||||
* Includes all characters that are used in regular/Unicode 1.0/extended names.
|
||||
* Just empties the set if no character names are available.
|
||||
* @param sa USetAdder to receive characters.
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
uprv_getCharNameCharacters(const USetAdder *sa);
|
||||
|
||||
/**
|
||||
* Constants for which data and implementation files provide which properties.
|
||||
* Used by UnicodeSet for service-specific property enumeration.
|
||||
* @internal
|
||||
*/
|
||||
enum UPropertySource {
|
||||
/** No source, not a supported property. */
|
||||
UPROPS_SRC_NONE,
|
||||
/** From uchar.c/uprops.icu main trie */
|
||||
UPROPS_SRC_CHAR,
|
||||
/** From uchar.c/uprops.icu properties vectors trie */
|
||||
UPROPS_SRC_PROPSVEC,
|
||||
/** From unames.c/unames.icu */
|
||||
UPROPS_SRC_NAMES,
|
||||
/** From ucase.c/ucase.icu */
|
||||
UPROPS_SRC_CASE,
|
||||
/** From ubidi_props.c/ubidi.icu */
|
||||
UPROPS_SRC_BIDI,
|
||||
/** From uchar.c/uprops.icu main trie as well as properties vectors trie */
|
||||
UPROPS_SRC_CHAR_AND_PROPSVEC,
|
||||
/** From ucase.c/ucase.icu as well as unorm.cpp/unorm.icu */
|
||||
UPROPS_SRC_CASE_AND_NORM,
|
||||
/** From normalizer2impl.cpp/nfc.nrm */
|
||||
UPROPS_SRC_NFC,
|
||||
/** From normalizer2impl.cpp/nfkc.nrm */
|
||||
UPROPS_SRC_NFKC,
|
||||
/** From normalizer2impl.cpp/nfkc_cf.nrm */
|
||||
UPROPS_SRC_NFKC_CF,
|
||||
/** From normalizer2impl.cpp/nfc.nrm canonical iterator data */
|
||||
UPROPS_SRC_NFC_CANON_ITER,
|
||||
/** One more than the highest UPropertySource (UPROPS_SRC_) constant. */
|
||||
UPROPS_SRC_COUNT
|
||||
};
|
||||
typedef enum UPropertySource UPropertySource;
|
||||
|
||||
/**
|
||||
* @see UPropertySource
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC UPropertySource U_EXPORT2
|
||||
uprops_getSource(UProperty which);
|
||||
|
||||
/**
|
||||
* Enumerate uprops.icu's main data trie and add the
|
||||
* start of each range of same properties to the set.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC void U_EXPORT2
|
||||
uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Enumerate uprops.icu's properties vectors trie and add the
|
||||
* start of each range of same properties to the set.
|
||||
* @internal
|
||||
*/
|
||||
U_CFUNC void U_EXPORT2
|
||||
upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Return a set of characters for property enumeration.
|
||||
* For each two consecutive characters (start, limit) in the set,
|
||||
* all of the properties for start..limit-1 are all the same.
|
||||
*
|
||||
* @param sa USetAdder to receive result. Existing contents are lost.
|
||||
* @internal
|
||||
*/
|
||||
/*U_CFUNC void U_EXPORT2
|
||||
uprv_getInclusions(const USetAdder *sa, UErrorCode *pErrorCode);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Swap the ICU Unicode character names file. See uchar.c.
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uchar_swapNames(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
class UnicodeSet;
|
||||
|
||||
// implemented in uniset_props.cpp
|
||||
U_CFUNC UnicodeSet *
|
||||
uniset_getUnicode32Instance(UErrorCode &errorCode);
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
62
vendor/icu/src/uset_imp.h
vendored
Normal file
62
vendor/icu/src/uset_imp.h
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2004-2007, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: uset_imp.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2004sep07
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Internal USet definitions.
|
||||
*/
|
||||
|
||||
#ifndef __USET_IMP_H__
|
||||
#define __USET_IMP_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/uset.h>
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
typedef void U_CALLCONV
|
||||
USetAdd(USet *set, UChar32 c);
|
||||
|
||||
typedef void U_CALLCONV
|
||||
USetAddRange(USet *set, UChar32 start, UChar32 end);
|
||||
|
||||
typedef void U_CALLCONV
|
||||
USetAddString(USet *set, const UChar *str, int32_t length);
|
||||
|
||||
typedef void U_CALLCONV
|
||||
USetRemove(USet *set, UChar32 c);
|
||||
|
||||
typedef void U_CALLCONV
|
||||
USetRemoveRange(USet *set, UChar32 start, UChar32 end);
|
||||
|
||||
/**
|
||||
* Interface for adding items to a USet, to keep low-level code from
|
||||
* statically depending on the USet implementation.
|
||||
* Calls will look like sa->add(sa->set, c);
|
||||
*/
|
||||
struct USetAdder {
|
||||
USet *set;
|
||||
USetAdd *add;
|
||||
USetAddRange *addRange;
|
||||
USetAddString *addString;
|
||||
USetRemove *remove;
|
||||
USetRemoveRange *removeRange;
|
||||
};
|
||||
typedef struct USetAdder USetAdder;
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
#endif
|
||||
|
||||
1728
vendor/icu/src/ushape.cpp
vendored
Normal file
1728
vendor/icu/src/ushape.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
143
vendor/icu/src/ustr_imp.h
vendored
Normal file
143
vendor/icu/src/ustr_imp.h
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1999-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* file name: ustr_imp.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2001jan30
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __USTR_IMP_H__
|
||||
#define __USTR_IMP_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/utf8.h>
|
||||
|
||||
/**
|
||||
* Internal option for unorm_cmpEquivFold() for strncmp style.
|
||||
* If set, checks for both string length and terminating NUL.
|
||||
*/
|
||||
#define _STRNCMP_STYLE 0x1000
|
||||
|
||||
/**
|
||||
* Compare two strings in code point order or code unit order.
|
||||
* Works in strcmp style (both lengths -1),
|
||||
* strncmp style (lengths equal and >=0, flag TRUE),
|
||||
* and memcmp/UnicodeString style (at least one length >=0).
|
||||
*/
|
||||
U_CFUNC int32_t U_EXPORT2
|
||||
uprv_strCompare(const UChar *s1, int32_t length1,
|
||||
const UChar *s2, int32_t length2,
|
||||
UBool strncmpStyle, UBool codePointOrder);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ustr_hashUCharsN(const UChar *str, int32_t length);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ustr_hashCharsN(const char *str, int32_t length);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ustr_hashICharsN(const char *str, int32_t length);
|
||||
|
||||
/**
|
||||
* NUL-terminate a UChar * string if possible.
|
||||
* If length < destCapacity then NUL-terminate.
|
||||
* If length == destCapacity then do not terminate but set U_STRING_NOT_TERMINATED_WARNING.
|
||||
* If length > destCapacity then do not terminate but set U_BUFFER_OVERFLOW_ERROR.
|
||||
*
|
||||
* @param dest Destination buffer, can be NULL if destCapacity==0.
|
||||
* @param destCapacity Number of UChars available at dest.
|
||||
* @param length Number of UChars that were (to be) written to dest.
|
||||
* @param pErrorCode ICU error code.
|
||||
* @return length
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* NUL-terminate a char * string if possible.
|
||||
* Same as u_terminateUChars() but for a different string type.
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_terminateChars(char *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* NUL-terminate a UChar32 * string if possible.
|
||||
* Same as u_terminateUChars() but for a different string type.
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_terminateUChar32s(UChar32 *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* NUL-terminate a wchar_t * string if possible.
|
||||
* Same as u_terminateUChars() but for a different string type.
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Counts the bytes of any whole valid sequence for a UTF-8 lead byte.
|
||||
* Returns 1 for ASCII 0..0x7f.
|
||||
* Returns 0 for 0x80..0xc1 as well as for 0xf5..0xff.
|
||||
* leadByte might be evaluated multiple times.
|
||||
*
|
||||
* @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
|
||||
* @return 0..4
|
||||
*/
|
||||
#define U8_COUNT_BYTES(leadByte) \
|
||||
(U8_IS_SINGLE(leadByte) ? 1 : U8_COUNT_BYTES_NON_ASCII(leadByte))
|
||||
|
||||
/**
|
||||
* Counts the bytes of any whole valid sequence for a UTF-8 lead byte.
|
||||
* Returns 0 for 0x00..0xc1 as well as for 0xf5..0xff.
|
||||
* leadByte might be evaluated multiple times.
|
||||
*
|
||||
* @param leadByte The first byte of a UTF-8 sequence. Must be 0..0xff.
|
||||
* @return 0 or 2..4
|
||||
*/
|
||||
#define U8_COUNT_BYTES_NON_ASCII(leadByte) \
|
||||
(U8_IS_LEAD(leadByte) ? ((uint8_t)(leadByte)>=0xe0)+((uint8_t)(leadByte)>=0xf0)+2 : 0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
class UTF8 {
|
||||
public:
|
||||
UTF8() = delete; // all static
|
||||
|
||||
/**
|
||||
* Is t a valid UTF-8 trail byte?
|
||||
*
|
||||
* @param prev Must be the preceding lead byte if i==1 and length>=3;
|
||||
* otherwise ignored.
|
||||
* @param t The i-th byte following the lead byte.
|
||||
* @param i The index (1..3) of byte t in the byte sequence. 0<i<length
|
||||
* @param length The length (2..4) of the byte sequence according to the lead byte.
|
||||
* @return TRUE if t is a valid trail byte in this context.
|
||||
*/
|
||||
static inline UBool isValidTrail(int32_t prev, uint8_t t, int32_t i, int32_t length) {
|
||||
// The first trail byte after a 3- or 4-byte lead byte
|
||||
// needs to be validated together with its lead byte.
|
||||
if (length <= 2 || i > 1) {
|
||||
return U8_IS_TRAIL(t);
|
||||
} else if (length == 3) {
|
||||
return U8_IS_VALID_LEAD3_AND_T1(prev, t);
|
||||
} else { // length == 4
|
||||
return U8_IS_VALID_LEAD4_AND_T1(prev, t);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif
|
||||
1519
vendor/icu/src/ustring.cpp
vendored
Normal file
1519
vendor/icu/src/ustring.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
329
vendor/icu/src/utf_impl.cpp
vendored
Normal file
329
vendor/icu/src/utf_impl.cpp
vendored
Normal file
@@ -0,0 +1,329 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2012, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: utf_impl.cpp
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 1999sep13
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* This file provides implementation functions for macros in the utfXX.h
|
||||
* that would otherwise be too long as macros.
|
||||
*/
|
||||
|
||||
/* set import/export definitions */
|
||||
#ifndef U_UTF8_IMPL
|
||||
# define U_UTF8_IMPL
|
||||
#endif
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/utf.h>
|
||||
#include <unicode/utf8.h>
|
||||
#include "uassert.h"
|
||||
|
||||
/*
|
||||
* Table of the number of utf8 trail bytes, indexed by the lead byte.
|
||||
* Used by the deprecated macro UTF8_COUNT_TRAIL_BYTES, defined in utf_old.h
|
||||
*
|
||||
* The current macro, U8_COUNT_TRAIL_BYTES, does _not_ use this table.
|
||||
*
|
||||
* Note that this table cannot be removed, even if UTF8_COUNT_TRAIL_BYTES were
|
||||
* changed to no longer use it. References to the table from expansions of UTF8_COUNT_TRAIL_BYTES
|
||||
* may exist in old client code that must continue to run with newer icu library versions.
|
||||
*
|
||||
* This table could be replaced on many machines by
|
||||
* a few lines of assembler code using an
|
||||
* "index of first 0-bit from msb" instruction and
|
||||
* one or two more integer instructions.
|
||||
*
|
||||
* For example, on an i386, do something like
|
||||
* - MOV AL, leadByte
|
||||
* - NOT AL (8-bit, leave b15..b8==0..0, reverse only b7..b0)
|
||||
* - MOV AH, 0
|
||||
* - BSR BX, AX (16-bit)
|
||||
* - MOV AX, 6 (result)
|
||||
* - JZ finish (ZF==1 if leadByte==0xff)
|
||||
* - SUB AX, BX (result)
|
||||
* -finish:
|
||||
* (BSR: Bit Scan Reverse, scans for a 1-bit, starting from the MSB)
|
||||
*/
|
||||
extern "C" U_EXPORT const uint8_t
|
||||
utf8_countTrailBytes[256]={
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
// illegal C0 & C1
|
||||
// 2-byte lead bytes C2..DF
|
||||
0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
||||
// 3-byte lead bytes E0..EF
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
// 4-byte lead bytes F0..F4
|
||||
// illegal F5..FF
|
||||
3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
static const UChar32
|
||||
utf8_errorValue[6]={
|
||||
// Same values as UTF8_ERROR_VALUE_1, UTF8_ERROR_VALUE_2, UTF_ERROR_VALUE,
|
||||
// but without relying on the obsolete unicode/utf_old.h.
|
||||
0x15, 0x9f, 0xffff,
|
||||
0x10ffff
|
||||
};
|
||||
|
||||
static UChar32
|
||||
errorValue(int32_t count, int8_t strict) {
|
||||
if(strict>=0) {
|
||||
return utf8_errorValue[count];
|
||||
} else if(strict==-3) {
|
||||
return 0xfffd;
|
||||
} else {
|
||||
return U_SENTINEL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle the non-inline part of the U8_NEXT() and U8_NEXT_FFFD() macros
|
||||
* and their obsolete sibling UTF8_NEXT_CHAR_SAFE().
|
||||
*
|
||||
* U8_NEXT() supports NUL-terminated strings indicated via length<0.
|
||||
*
|
||||
* The "strict" parameter controls the error behavior:
|
||||
* <0 "Safe" behavior of U8_NEXT():
|
||||
* -1: All illegal byte sequences yield U_SENTINEL=-1.
|
||||
* -2: Same as -1, except for lenient treatment of surrogate code points as legal.
|
||||
* Some implementations use this for roundtripping of
|
||||
* Unicode 16-bit strings that are not well-formed UTF-16, that is, they
|
||||
* contain unpaired surrogates.
|
||||
* -3: All illegal byte sequences yield U+FFFD.
|
||||
* 0 Obsolete "safe" behavior of UTF8_NEXT_CHAR_SAFE(..., FALSE):
|
||||
* All illegal byte sequences yield a positive code point such that this
|
||||
* result code point would be encoded with the same number of bytes as
|
||||
* the illegal sequence.
|
||||
* >0 Obsolete "strict" behavior of UTF8_NEXT_CHAR_SAFE(..., TRUE):
|
||||
* Same as the obsolete "safe" behavior, but non-characters are also treated
|
||||
* like illegal sequences.
|
||||
*
|
||||
* Note that a UBool is the same as an int8_t.
|
||||
*/
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
utf8_nextCharSafeBody(const uint8_t *s, int32_t *pi, int32_t length, UChar32 c, UBool strict) {
|
||||
// *pi is one after byte c.
|
||||
int32_t i=*pi;
|
||||
// length can be negative for NUL-terminated strings: Read and validate one byte at a time.
|
||||
if(i==length || c>0xf4) {
|
||||
// end of string, or not a lead byte
|
||||
} else if(c>=0xf0) {
|
||||
// Test for 4-byte sequences first because
|
||||
// U8_NEXT() handles shorter valid sequences inline.
|
||||
uint8_t t1=s[i], t2, t3;
|
||||
c&=7;
|
||||
if(U8_IS_VALID_LEAD4_AND_T1(c, t1) &&
|
||||
++i!=length && (t2=s[i]-0x80)<=0x3f &&
|
||||
++i!=length && (t3=s[i]-0x80)<=0x3f) {
|
||||
++i;
|
||||
c=(c<<18)|((t1&0x3f)<<12)|(t2<<6)|t3;
|
||||
// strict: forbid non-characters like U+fffe
|
||||
if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
|
||||
*pi=i;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
} else if(c>=0xe0) {
|
||||
c&=0xf;
|
||||
if(strict!=-2) {
|
||||
uint8_t t1=s[i], t2;
|
||||
if(U8_IS_VALID_LEAD3_AND_T1(c, t1) &&
|
||||
++i!=length && (t2=s[i]-0x80)<=0x3f) {
|
||||
++i;
|
||||
c=(c<<12)|((t1&0x3f)<<6)|t2;
|
||||
// strict: forbid non-characters like U+fffe
|
||||
if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
|
||||
*pi=i;
|
||||
return c;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// strict=-2 -> lenient: allow surrogates
|
||||
uint8_t t1=s[i]-0x80, t2;
|
||||
if(t1<=0x3f && (c>0 || t1>=0x20) &&
|
||||
++i!=length && (t2=s[i]-0x80)<=0x3f) {
|
||||
*pi=i+1;
|
||||
return (c<<12)|(t1<<6)|t2;
|
||||
}
|
||||
}
|
||||
} else if(c>=0xc2) {
|
||||
uint8_t t1=s[i]-0x80;
|
||||
if(t1<=0x3f) {
|
||||
*pi=i+1;
|
||||
return ((c-0xc0)<<6)|t1;
|
||||
}
|
||||
} // else 0x80<=c<0xc2 is not a lead byte
|
||||
|
||||
/* error handling */
|
||||
c=errorValue(i-*pi, strict);
|
||||
*pi=i;
|
||||
return c;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool *pIsError) {
|
||||
if((uint32_t)(c)<=0x7ff) {
|
||||
if((i)+1<(length)) {
|
||||
(s)[(i)++]=(uint8_t)(((c)>>6)|0xc0);
|
||||
(s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
|
||||
return i;
|
||||
}
|
||||
} else if((uint32_t)(c)<=0xffff) {
|
||||
/* Starting with Unicode 3.2, surrogate code points must not be encoded in UTF-8. */
|
||||
if((i)+2<(length) && !U_IS_SURROGATE(c)) {
|
||||
(s)[(i)++]=(uint8_t)(((c)>>12)|0xe0);
|
||||
(s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80);
|
||||
(s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
|
||||
return i;
|
||||
}
|
||||
} else if((uint32_t)(c)<=0x10ffff) {
|
||||
if((i)+3<(length)) {
|
||||
(s)[(i)++]=(uint8_t)(((c)>>18)|0xf0);
|
||||
(s)[(i)++]=(uint8_t)((((c)>>12)&0x3f)|0x80);
|
||||
(s)[(i)++]=(uint8_t)((((c)>>6)&0x3f)|0x80);
|
||||
(s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
/* c>0x10ffff or not enough space, write an error value */
|
||||
if(pIsError!=NULL) {
|
||||
*pIsError=TRUE;
|
||||
} else {
|
||||
length-=i;
|
||||
if(length>0) {
|
||||
int32_t offset;
|
||||
if(length>3) {
|
||||
length=3;
|
||||
}
|
||||
s+=i;
|
||||
offset=0;
|
||||
c=utf8_errorValue[length-1];
|
||||
U8_APPEND_UNSAFE(s, offset, c);
|
||||
i=i+offset;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
utf8_prevCharSafeBody(const uint8_t *s, int32_t start, int32_t *pi, UChar32 c, UBool strict) {
|
||||
// *pi is the index of byte c.
|
||||
int32_t i=*pi;
|
||||
if(U8_IS_TRAIL(c) && i>start) {
|
||||
uint8_t b1=s[--i];
|
||||
if(U8_IS_LEAD(b1)) {
|
||||
if(b1<0xe0) {
|
||||
*pi=i;
|
||||
return ((b1-0xc0)<<6)|(c&0x3f);
|
||||
} else if(b1<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b1, c) : U8_IS_VALID_LEAD4_AND_T1(b1, c)) {
|
||||
// Truncated 3- or 4-byte sequence.
|
||||
*pi=i;
|
||||
return errorValue(1, strict);
|
||||
}
|
||||
} else if(U8_IS_TRAIL(b1) && i>start) {
|
||||
// Extract the value bits from the last trail byte.
|
||||
c&=0x3f;
|
||||
uint8_t b2=s[--i];
|
||||
if(0xe0<=b2 && b2<=0xf4) {
|
||||
if(b2<0xf0) {
|
||||
b2&=0xf;
|
||||
if(strict!=-2) {
|
||||
if(U8_IS_VALID_LEAD3_AND_T1(b2, b1)) {
|
||||
*pi=i;
|
||||
c=(b2<<12)|((b1&0x3f)<<6)|c;
|
||||
if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
|
||||
return c;
|
||||
} else {
|
||||
// strict: forbid non-characters like U+fffe
|
||||
return errorValue(2, strict);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// strict=-2 -> lenient: allow surrogates
|
||||
b1-=0x80;
|
||||
if((b2>0 || b1>=0x20)) {
|
||||
*pi=i;
|
||||
return (b2<<12)|(b1<<6)|c;
|
||||
}
|
||||
}
|
||||
} else if(U8_IS_VALID_LEAD4_AND_T1(b2, b1)) {
|
||||
// Truncated 4-byte sequence.
|
||||
*pi=i;
|
||||
return errorValue(2, strict);
|
||||
}
|
||||
} else if(U8_IS_TRAIL(b2) && i>start) {
|
||||
uint8_t b3=s[--i];
|
||||
if(0xf0<=b3 && b3<=0xf4) {
|
||||
b3&=7;
|
||||
if(U8_IS_VALID_LEAD4_AND_T1(b3, b2)) {
|
||||
*pi=i;
|
||||
c=(b3<<18)|((b2&0x3f)<<12)|((b1&0x3f)<<6)|c;
|
||||
if(strict<=0 || !U_IS_UNICODE_NONCHAR(c)) {
|
||||
return c;
|
||||
} else {
|
||||
// strict: forbid non-characters like U+fffe
|
||||
return errorValue(3, strict);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return errorValue(0, strict);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i) {
|
||||
// Same as utf8_prevCharSafeBody(..., strict=-1) minus assembling code points.
|
||||
int32_t orig_i=i;
|
||||
uint8_t c=s[i];
|
||||
if(U8_IS_TRAIL(c) && i>start) {
|
||||
uint8_t b1=s[--i];
|
||||
if(U8_IS_LEAD(b1)) {
|
||||
if(b1<0xe0 ||
|
||||
(b1<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b1, c) : U8_IS_VALID_LEAD4_AND_T1(b1, c))) {
|
||||
return i;
|
||||
}
|
||||
} else if(U8_IS_TRAIL(b1) && i>start) {
|
||||
uint8_t b2=s[--i];
|
||||
if(0xe0<=b2 && b2<=0xf4) {
|
||||
if(b2<0xf0 ? U8_IS_VALID_LEAD3_AND_T1(b2, b1) : U8_IS_VALID_LEAD4_AND_T1(b2, b1)) {
|
||||
return i;
|
||||
}
|
||||
} else if(U8_IS_TRAIL(b2) && i>start) {
|
||||
uint8_t b3=s[--i];
|
||||
if(0xf0<=b3 && b3<=0xf4 && U8_IS_VALID_LEAD4_AND_T1(b3, b2)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return orig_i;
|
||||
}
|
||||
767
vendor/icu/src/utrie2.cpp
vendored
Normal file
767
vendor/icu/src/utrie2.cpp
vendored
Normal file
@@ -0,0 +1,767 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: utrie2.cpp
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2008aug16 (starting from a copy of utrie.c)
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* This is a common implementation of a Unicode trie.
|
||||
* It is a kind of compressed, serializable table of 16- or 32-bit values associated with
|
||||
* Unicode code points (0..0x10ffff).
|
||||
* This is the second common version of a Unicode trie (hence the name UTrie2).
|
||||
* See utrie2.h for a comparison.
|
||||
*
|
||||
* This file contains only the runtime and enumeration code, for read-only access.
|
||||
* See utrie2_builder.c for the builder code.
|
||||
*/
|
||||
#ifdef UTRIE2_DEBUG
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/utf.h>
|
||||
#include <unicode/utf8.h>
|
||||
#include <unicode/utf16.h>
|
||||
#include "cmemory.h"
|
||||
#include "utrie2.h"
|
||||
#include "utrie2_impl.h"
|
||||
#include "uassert.h"
|
||||
|
||||
/* Public UTrie2 API implementation ----------------------------------------- */
|
||||
|
||||
static uint32_t
|
||||
get32(const UNewTrie2 *trie, UChar32 c, UBool fromLSCP) {
|
||||
int32_t i2, block;
|
||||
|
||||
if(c>=trie->highStart && (!U_IS_LEAD(c) || fromLSCP)) {
|
||||
return trie->data[trie->dataLength-UTRIE2_DATA_GRANULARITY];
|
||||
}
|
||||
|
||||
if(U_IS_LEAD(c) && fromLSCP) {
|
||||
i2=(UTRIE2_LSCP_INDEX_2_OFFSET-(0xd800>>UTRIE2_SHIFT_2))+
|
||||
(c>>UTRIE2_SHIFT_2);
|
||||
} else {
|
||||
i2=trie->index1[c>>UTRIE2_SHIFT_1]+
|
||||
((c>>UTRIE2_SHIFT_2)&UTRIE2_INDEX_2_MASK);
|
||||
}
|
||||
block=trie->index2[i2];
|
||||
return trie->data[block+(c&UTRIE2_DATA_MASK)];
|
||||
}
|
||||
|
||||
U_CAPI uint32_t U_EXPORT2
|
||||
utrie2_get32(const UTrie2 *trie, UChar32 c) {
|
||||
if(trie->data16!=NULL) {
|
||||
return UTRIE2_GET16(trie, c);
|
||||
} else if(trie->data32!=NULL) {
|
||||
return UTRIE2_GET32(trie, c);
|
||||
} else if((uint32_t)c>0x10ffff) {
|
||||
return trie->errorValue;
|
||||
} else {
|
||||
return get32(trie->newTrie, c, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI uint32_t U_EXPORT2
|
||||
utrie2_get32FromLeadSurrogateCodeUnit(const UTrie2 *trie, UChar32 c) {
|
||||
if(!U_IS_LEAD(c)) {
|
||||
return trie->errorValue;
|
||||
}
|
||||
if(trie->data16!=NULL) {
|
||||
return UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, c);
|
||||
} else if(trie->data32!=NULL) {
|
||||
return UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c);
|
||||
} else {
|
||||
return get32(trie->newTrie, c, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
u8Index(const UTrie2 *trie, UChar32 c, int32_t i) {
|
||||
int32_t idx=
|
||||
_UTRIE2_INDEX_FROM_CP(
|
||||
trie,
|
||||
trie->data32==NULL ? trie->indexLength : 0,
|
||||
c);
|
||||
return (idx<<3)|i;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_internalU8NextIndex(const UTrie2 *trie, UChar32 c,
|
||||
const uint8_t *src, const uint8_t *limit) {
|
||||
int32_t i, length;
|
||||
i=0;
|
||||
/* support 64-bit pointers by avoiding cast of arbitrary difference */
|
||||
if((limit-src)<=7) {
|
||||
length=(int32_t)(limit-src);
|
||||
} else {
|
||||
length=7;
|
||||
}
|
||||
c=utf8_nextCharSafeBody(src, &i, length, c, -1);
|
||||
return u8Index(trie, c, i);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
|
||||
const uint8_t *start, const uint8_t *src) {
|
||||
int32_t i, length;
|
||||
/* support 64-bit pointers by avoiding cast of arbitrary difference */
|
||||
if((src-start)<=7) {
|
||||
i=length=(int32_t)(src-start);
|
||||
} else {
|
||||
i=length=7;
|
||||
start=src-7;
|
||||
}
|
||||
c=utf8_prevCharSafeBody(start, 0, &i, c, -1);
|
||||
i=length-i; /* number of bytes read backward from src */
|
||||
return u8Index(trie, c, i);
|
||||
}
|
||||
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
utrie2_openFromSerialized(UTrie2ValueBits valueBits,
|
||||
const void *data, int32_t length, int32_t *pActualLength,
|
||||
UErrorCode *pErrorCode) {
|
||||
const UTrie2Header *header;
|
||||
const uint16_t *p16;
|
||||
int32_t actualLength;
|
||||
|
||||
UTrie2 tempTrie;
|
||||
UTrie2 *trie;
|
||||
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( length<=0 || (U_POINTER_MASK_LSB(data, 3)!=0) ||
|
||||
valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* enough data for a trie header? */
|
||||
if(length<(int32_t)sizeof(UTrie2Header)) {
|
||||
*pErrorCode=U_INVALID_FORMAT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check the signature */
|
||||
header=(const UTrie2Header *)data;
|
||||
if(header->signature!=UTRIE2_SIG) {
|
||||
*pErrorCode=U_INVALID_FORMAT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get the options */
|
||||
if(valueBits!=(UTrie2ValueBits)(header->options&UTRIE2_OPTIONS_VALUE_BITS_MASK)) {
|
||||
*pErrorCode=U_INVALID_FORMAT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get the length values and offsets */
|
||||
uprv_memset(&tempTrie, 0, sizeof(tempTrie));
|
||||
tempTrie.indexLength=header->indexLength;
|
||||
tempTrie.dataLength=header->shiftedDataLength<<UTRIE2_INDEX_SHIFT;
|
||||
tempTrie.index2NullOffset=header->index2NullOffset;
|
||||
tempTrie.dataNullOffset=header->dataNullOffset;
|
||||
|
||||
tempTrie.highStart=header->shiftedHighStart<<UTRIE2_SHIFT_1;
|
||||
tempTrie.highValueIndex=tempTrie.dataLength-UTRIE2_DATA_GRANULARITY;
|
||||
if(valueBits==UTRIE2_16_VALUE_BITS) {
|
||||
tempTrie.highValueIndex+=tempTrie.indexLength;
|
||||
}
|
||||
|
||||
/* calculate the actual length */
|
||||
actualLength=(int32_t)sizeof(UTrie2Header)+tempTrie.indexLength*2;
|
||||
if(valueBits==UTRIE2_16_VALUE_BITS) {
|
||||
actualLength+=tempTrie.dataLength*2;
|
||||
} else {
|
||||
actualLength+=tempTrie.dataLength*4;
|
||||
}
|
||||
if(length<actualLength) {
|
||||
*pErrorCode=U_INVALID_FORMAT_ERROR; /* not enough bytes */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* allocate the trie */
|
||||
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
|
||||
if(trie==NULL) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
uprv_memcpy(trie, &tempTrie, sizeof(tempTrie));
|
||||
trie->memory=(uint32_t *)data;
|
||||
trie->length=actualLength;
|
||||
trie->isMemoryOwned=FALSE;
|
||||
|
||||
/* set the pointers to its index and data arrays */
|
||||
p16=(const uint16_t *)(header+1);
|
||||
trie->index=p16;
|
||||
p16+=trie->indexLength;
|
||||
|
||||
/* get the data */
|
||||
switch(valueBits) {
|
||||
case UTRIE2_16_VALUE_BITS:
|
||||
trie->data16=p16;
|
||||
trie->data32=NULL;
|
||||
trie->initialValue=trie->index[trie->dataNullOffset];
|
||||
trie->errorValue=trie->data16[UTRIE2_BAD_UTF8_DATA_OFFSET];
|
||||
break;
|
||||
case UTRIE2_32_VALUE_BITS:
|
||||
trie->data16=NULL;
|
||||
trie->data32=(const uint32_t *)p16;
|
||||
trie->initialValue=trie->data32[trie->dataNullOffset];
|
||||
trie->errorValue=trie->data32[UTRIE2_BAD_UTF8_DATA_OFFSET];
|
||||
break;
|
||||
default:
|
||||
*pErrorCode=U_INVALID_FORMAT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(pActualLength!=NULL) {
|
||||
*pActualLength=actualLength;
|
||||
}
|
||||
return trie;
|
||||
}
|
||||
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
utrie2_openDummy(UTrie2ValueBits valueBits,
|
||||
uint32_t initialValue, uint32_t errorValue,
|
||||
UErrorCode *pErrorCode) {
|
||||
UTrie2 *trie;
|
||||
UTrie2Header *header;
|
||||
uint32_t *p;
|
||||
uint16_t *dest16;
|
||||
int32_t indexLength, dataLength, length, i;
|
||||
int32_t dataMove; /* >0 if the data is moved to the end of the index array */
|
||||
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* calculate the total length of the dummy trie data */
|
||||
indexLength=UTRIE2_INDEX_1_OFFSET;
|
||||
dataLength=UTRIE2_DATA_START_OFFSET+UTRIE2_DATA_GRANULARITY;
|
||||
length=(int32_t)sizeof(UTrie2Header)+indexLength*2;
|
||||
if(valueBits==UTRIE2_16_VALUE_BITS) {
|
||||
length+=dataLength*2;
|
||||
} else {
|
||||
length+=dataLength*4;
|
||||
}
|
||||
|
||||
/* allocate the trie */
|
||||
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
|
||||
if(trie==NULL) {
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
uprv_memset(trie, 0, sizeof(UTrie2));
|
||||
trie->memory=uprv_malloc(length);
|
||||
if(trie->memory==NULL) {
|
||||
uprv_free(trie);
|
||||
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
|
||||
return 0;
|
||||
}
|
||||
trie->length=length;
|
||||
trie->isMemoryOwned=TRUE;
|
||||
|
||||
/* set the UTrie2 fields */
|
||||
if(valueBits==UTRIE2_16_VALUE_BITS) {
|
||||
dataMove=indexLength;
|
||||
} else {
|
||||
dataMove=0;
|
||||
}
|
||||
|
||||
trie->indexLength=indexLength;
|
||||
trie->dataLength=dataLength;
|
||||
trie->index2NullOffset=UTRIE2_INDEX_2_OFFSET;
|
||||
trie->dataNullOffset=(uint16_t)dataMove;
|
||||
trie->initialValue=initialValue;
|
||||
trie->errorValue=errorValue;
|
||||
trie->highStart=0;
|
||||
trie->highValueIndex=dataMove+UTRIE2_DATA_START_OFFSET;
|
||||
|
||||
/* set the header fields */
|
||||
header=(UTrie2Header *)trie->memory;
|
||||
|
||||
header->signature=UTRIE2_SIG; /* "Tri2" */
|
||||
header->options=(uint16_t)valueBits;
|
||||
|
||||
header->indexLength=(uint16_t)indexLength;
|
||||
header->shiftedDataLength=(uint16_t)(dataLength>>UTRIE2_INDEX_SHIFT);
|
||||
header->index2NullOffset=(uint16_t)UTRIE2_INDEX_2_OFFSET;
|
||||
header->dataNullOffset=(uint16_t)dataMove;
|
||||
header->shiftedHighStart=0;
|
||||
|
||||
/* fill the index and data arrays */
|
||||
dest16=(uint16_t *)(header+1);
|
||||
trie->index=dest16;
|
||||
|
||||
/* write the index-2 array values shifted right by UTRIE2_INDEX_SHIFT */
|
||||
for(i=0; i<UTRIE2_INDEX_2_BMP_LENGTH; ++i) {
|
||||
*dest16++=(uint16_t)(dataMove>>UTRIE2_INDEX_SHIFT); /* null data block */
|
||||
}
|
||||
|
||||
/* write UTF-8 2-byte index-2 values, not right-shifted */
|
||||
for(i=0; i<(0xc2-0xc0); ++i) { /* C0..C1 */
|
||||
*dest16++=(uint16_t)(dataMove+UTRIE2_BAD_UTF8_DATA_OFFSET);
|
||||
}
|
||||
for(; i<(0xe0-0xc0); ++i) { /* C2..DF */
|
||||
*dest16++=(uint16_t)dataMove;
|
||||
}
|
||||
|
||||
/* write the 16/32-bit data array */
|
||||
switch(valueBits) {
|
||||
case UTRIE2_16_VALUE_BITS:
|
||||
/* write 16-bit data values */
|
||||
trie->data16=dest16;
|
||||
trie->data32=NULL;
|
||||
for(i=0; i<0x80; ++i) {
|
||||
*dest16++=(uint16_t)initialValue;
|
||||
}
|
||||
for(; i<0xc0; ++i) {
|
||||
*dest16++=(uint16_t)errorValue;
|
||||
}
|
||||
/* highValue and reserved values */
|
||||
for(i=0; i<UTRIE2_DATA_GRANULARITY; ++i) {
|
||||
*dest16++=(uint16_t)initialValue;
|
||||
}
|
||||
break;
|
||||
case UTRIE2_32_VALUE_BITS:
|
||||
/* write 32-bit data values */
|
||||
p=(uint32_t *)dest16;
|
||||
trie->data16=NULL;
|
||||
trie->data32=p;
|
||||
for(i=0; i<0x80; ++i) {
|
||||
*p++=initialValue;
|
||||
}
|
||||
for(; i<0xc0; ++i) {
|
||||
*p++=errorValue;
|
||||
}
|
||||
/* highValue and reserved values */
|
||||
for(i=0; i<UTRIE2_DATA_GRANULARITY; ++i) {
|
||||
*p++=initialValue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return trie;
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_close(UTrie2 *trie) {
|
||||
if(trie!=NULL) {
|
||||
if(trie->isMemoryOwned) {
|
||||
uprv_free(trie->memory);
|
||||
}
|
||||
if(trie->newTrie!=NULL) {
|
||||
uprv_free(trie->newTrie->data);
|
||||
uprv_free(trie->newTrie);
|
||||
}
|
||||
uprv_free(trie);
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_getVersion(const void *data, int32_t length, UBool anyEndianOk) {
|
||||
uint32_t signature;
|
||||
if(length<16 || data==NULL || (U_POINTER_MASK_LSB(data, 3)!=0)) {
|
||||
return 0;
|
||||
}
|
||||
signature=*(const uint32_t *)data;
|
||||
if(signature==UTRIE2_SIG) {
|
||||
return 2;
|
||||
}
|
||||
if(anyEndianOk && signature==UTRIE2_OE_SIG) {
|
||||
return 2;
|
||||
}
|
||||
if(signature==UTRIE_SIG) {
|
||||
return 1;
|
||||
}
|
||||
if(anyEndianOk && signature==UTRIE_OE_SIG) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
utrie2_isFrozen(const UTrie2 *trie) {
|
||||
return (UBool)(trie->newTrie==NULL);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_serialize(const UTrie2 *trie,
|
||||
void *data, int32_t capacity,
|
||||
UErrorCode *pErrorCode) {
|
||||
/* argument check */
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if( trie==NULL || trie->memory==NULL || trie->newTrie!=NULL ||
|
||||
capacity<0 || (capacity>0 && (data==NULL || (U_POINTER_MASK_LSB(data, 3)!=0)))
|
||||
) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(capacity>=trie->length) {
|
||||
uprv_memcpy(data, trie->memory, trie->length);
|
||||
} else {
|
||||
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
|
||||
}
|
||||
return trie->length;
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_swap(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode) {
|
||||
const UTrie2Header *inTrie;
|
||||
UTrie2Header trie;
|
||||
int32_t dataLength, size;
|
||||
UTrie2ValueBits valueBits;
|
||||
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) {
|
||||
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* setup and swapping */
|
||||
if(length>=0 && length<(int32_t)sizeof(UTrie2Header)) {
|
||||
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
inTrie=(const UTrie2Header *)inData;
|
||||
trie.signature=ds->readUInt32(inTrie->signature);
|
||||
trie.options=ds->readUInt16(inTrie->options);
|
||||
trie.indexLength=ds->readUInt16(inTrie->indexLength);
|
||||
trie.shiftedDataLength=ds->readUInt16(inTrie->shiftedDataLength);
|
||||
|
||||
valueBits=(UTrie2ValueBits)(trie.options&UTRIE2_OPTIONS_VALUE_BITS_MASK);
|
||||
dataLength=(int32_t)trie.shiftedDataLength<<UTRIE2_INDEX_SHIFT;
|
||||
|
||||
if( trie.signature!=UTRIE2_SIG ||
|
||||
valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits ||
|
||||
trie.indexLength<UTRIE2_INDEX_1_OFFSET ||
|
||||
dataLength<UTRIE2_DATA_START_OFFSET
|
||||
) {
|
||||
*pErrorCode=U_INVALID_FORMAT_ERROR; /* not a UTrie */
|
||||
return 0;
|
||||
}
|
||||
|
||||
size=sizeof(UTrie2Header)+trie.indexLength*2;
|
||||
switch(valueBits) {
|
||||
case UTRIE2_16_VALUE_BITS:
|
||||
size+=dataLength*2;
|
||||
break;
|
||||
case UTRIE2_32_VALUE_BITS:
|
||||
size+=dataLength*4;
|
||||
break;
|
||||
default:
|
||||
*pErrorCode=U_INVALID_FORMAT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(length>=0) {
|
||||
UTrie2Header *outTrie;
|
||||
|
||||
if(length<size) {
|
||||
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
outTrie=(UTrie2Header *)outData;
|
||||
|
||||
/* swap the header */
|
||||
ds->swapArray32(ds, &inTrie->signature, 4, &outTrie->signature, pErrorCode);
|
||||
ds->swapArray16(ds, &inTrie->options, 12, &outTrie->options, pErrorCode);
|
||||
|
||||
/* swap the index and the data */
|
||||
switch(valueBits) {
|
||||
case UTRIE2_16_VALUE_BITS:
|
||||
ds->swapArray16(ds, inTrie+1, (trie.indexLength+dataLength)*2, outTrie+1, pErrorCode);
|
||||
break;
|
||||
case UTRIE2_32_VALUE_BITS:
|
||||
ds->swapArray16(ds, inTrie+1, trie.indexLength*2, outTrie+1, pErrorCode);
|
||||
ds->swapArray32(ds, (const uint16_t *)(inTrie+1)+trie.indexLength, dataLength*4,
|
||||
(uint16_t *)(outTrie+1)+trie.indexLength, pErrorCode);
|
||||
break;
|
||||
default:
|
||||
*pErrorCode=U_INVALID_FORMAT_ERROR;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
// utrie2_swapAnyVersion() should be defined here but lives in utrie2_builder.c
|
||||
// to avoid a dependency from utrie2.cpp on utrie.c.
|
||||
|
||||
/* enumeration -------------------------------------------------------------- */
|
||||
|
||||
#define MIN_VALUE(a, b) ((a)<(b) ? (a) : (b))
|
||||
|
||||
/* default UTrie2EnumValue() returns the input value itself */
|
||||
static uint32_t U_CALLCONV
|
||||
enumSameValue(const void * /*context*/, uint32_t value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate all ranges of code points with the same relevant values.
|
||||
* The values are transformed from the raw trie entries by the enumValue function.
|
||||
*
|
||||
* Currently requires start<limit and both start and limit must be multiples
|
||||
* of UTRIE2_DATA_BLOCK_LENGTH.
|
||||
*
|
||||
* Optimizations:
|
||||
* - Skip a whole block if we know that it is filled with a single value,
|
||||
* and it is the same as we visited just before.
|
||||
* - Handle the null block specially because we know a priori that it is filled
|
||||
* with a single value.
|
||||
*/
|
||||
static void
|
||||
enumEitherTrie(const UTrie2 *trie,
|
||||
UChar32 start, UChar32 limit,
|
||||
UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange, const void *context) {
|
||||
const uint32_t *data32;
|
||||
const uint16_t *idx;
|
||||
|
||||
uint32_t value, prevValue, initialValue;
|
||||
UChar32 c, prev, highStart;
|
||||
int32_t j, i2Block, prevI2Block, index2NullOffset, block, prevBlock, nullBlock;
|
||||
|
||||
if(enumRange==NULL) {
|
||||
return;
|
||||
}
|
||||
if(enumValue==NULL) {
|
||||
enumValue=enumSameValue;
|
||||
}
|
||||
|
||||
if(trie->newTrie==NULL) {
|
||||
/* frozen trie */
|
||||
idx=trie->index;
|
||||
U_ASSERT(idx!=NULL); /* the following code assumes trie->newTrie is not NULL when idx is NULL */
|
||||
data32=trie->data32;
|
||||
|
||||
index2NullOffset=trie->index2NullOffset;
|
||||
nullBlock=trie->dataNullOffset;
|
||||
} else {
|
||||
/* unfrozen, mutable trie */
|
||||
idx=NULL;
|
||||
data32=trie->newTrie->data;
|
||||
U_ASSERT(data32!=NULL); /* the following code assumes idx is not NULL when data32 is NULL */
|
||||
|
||||
index2NullOffset=trie->newTrie->index2NullOffset;
|
||||
nullBlock=trie->newTrie->dataNullOffset;
|
||||
}
|
||||
|
||||
highStart=trie->highStart;
|
||||
|
||||
/* get the enumeration value that corresponds to an initial-value trie data entry */
|
||||
initialValue=enumValue(context, trie->initialValue);
|
||||
|
||||
/* set variables for previous range */
|
||||
prevI2Block=-1;
|
||||
prevBlock=-1;
|
||||
prev=start;
|
||||
prevValue=0;
|
||||
|
||||
/* enumerate index-2 blocks */
|
||||
for(c=start; c<limit && c<highStart;) {
|
||||
/* Code point limit for iterating inside this i2Block. */
|
||||
UChar32 tempLimit=c+UTRIE2_CP_PER_INDEX_1_ENTRY;
|
||||
if(limit<tempLimit) {
|
||||
tempLimit=limit;
|
||||
}
|
||||
if(c<=0xffff) {
|
||||
if(!U_IS_SURROGATE(c)) {
|
||||
i2Block=c>>UTRIE2_SHIFT_2;
|
||||
} else if(U_IS_SURROGATE_LEAD(c)) {
|
||||
/*
|
||||
* Enumerate values for lead surrogate code points, not code units:
|
||||
* This special block has half the normal length.
|
||||
*/
|
||||
i2Block=UTRIE2_LSCP_INDEX_2_OFFSET;
|
||||
tempLimit=MIN_VALUE(0xdc00, limit);
|
||||
} else {
|
||||
/*
|
||||
* Switch back to the normal part of the index-2 table.
|
||||
* Enumerate the second half of the surrogates block.
|
||||
*/
|
||||
i2Block=0xd800>>UTRIE2_SHIFT_2;
|
||||
tempLimit=MIN_VALUE(0xe000, limit);
|
||||
}
|
||||
} else {
|
||||
/* supplementary code points */
|
||||
if(idx!=NULL) {
|
||||
i2Block=idx[(UTRIE2_INDEX_1_OFFSET-UTRIE2_OMITTED_BMP_INDEX_1_LENGTH)+
|
||||
(c>>UTRIE2_SHIFT_1)];
|
||||
} else {
|
||||
i2Block=trie->newTrie->index1[c>>UTRIE2_SHIFT_1];
|
||||
}
|
||||
if(i2Block==prevI2Block && (c-prev)>=UTRIE2_CP_PER_INDEX_1_ENTRY) {
|
||||
/*
|
||||
* The index-2 block is the same as the previous one, and filled with prevValue.
|
||||
* Only possible for supplementary code points because the linear-BMP index-2
|
||||
* table creates unique i2Block values.
|
||||
*/
|
||||
c+=UTRIE2_CP_PER_INDEX_1_ENTRY;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
prevI2Block=i2Block;
|
||||
if(i2Block==index2NullOffset) {
|
||||
/* this is the null index-2 block */
|
||||
if(prevValue!=initialValue) {
|
||||
if(prev<c && !enumRange(context, prev, c-1, prevValue)) {
|
||||
return;
|
||||
}
|
||||
prevBlock=nullBlock;
|
||||
prev=c;
|
||||
prevValue=initialValue;
|
||||
}
|
||||
c+=UTRIE2_CP_PER_INDEX_1_ENTRY;
|
||||
} else {
|
||||
/* enumerate data blocks for one index-2 block */
|
||||
int32_t i2, i2Limit;
|
||||
i2=(c>>UTRIE2_SHIFT_2)&UTRIE2_INDEX_2_MASK;
|
||||
if((c>>UTRIE2_SHIFT_1)==(tempLimit>>UTRIE2_SHIFT_1)) {
|
||||
i2Limit=(tempLimit>>UTRIE2_SHIFT_2)&UTRIE2_INDEX_2_MASK;
|
||||
} else {
|
||||
i2Limit=UTRIE2_INDEX_2_BLOCK_LENGTH;
|
||||
}
|
||||
for(; i2<i2Limit; ++i2) {
|
||||
if(idx!=NULL) {
|
||||
block=(int32_t)idx[i2Block+i2]<<UTRIE2_INDEX_SHIFT;
|
||||
} else {
|
||||
block=trie->newTrie->index2[i2Block+i2];
|
||||
}
|
||||
if(block==prevBlock && (c-prev)>=UTRIE2_DATA_BLOCK_LENGTH) {
|
||||
/* the block is the same as the previous one, and filled with prevValue */
|
||||
c+=UTRIE2_DATA_BLOCK_LENGTH;
|
||||
continue;
|
||||
}
|
||||
prevBlock=block;
|
||||
if(block==nullBlock) {
|
||||
/* this is the null data block */
|
||||
if(prevValue!=initialValue) {
|
||||
if(prev<c && !enumRange(context, prev, c-1, prevValue)) {
|
||||
return;
|
||||
}
|
||||
prev=c;
|
||||
prevValue=initialValue;
|
||||
}
|
||||
c+=UTRIE2_DATA_BLOCK_LENGTH;
|
||||
} else {
|
||||
for(j=0; j<UTRIE2_DATA_BLOCK_LENGTH; ++j) {
|
||||
value=enumValue(context, data32!=NULL ? data32[block+j] : idx[block+j]);
|
||||
if(value!=prevValue) {
|
||||
if(prev<c && !enumRange(context, prev, c-1, prevValue)) {
|
||||
return;
|
||||
}
|
||||
prev=c;
|
||||
prevValue=value;
|
||||
}
|
||||
++c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(c>limit) {
|
||||
c=limit; /* could be higher if in the index2NullOffset */
|
||||
} else if(c<limit) {
|
||||
/* c==highStart<limit */
|
||||
uint32_t highValue;
|
||||
if(idx!=NULL) {
|
||||
highValue=
|
||||
data32!=NULL ?
|
||||
data32[trie->highValueIndex] :
|
||||
idx[trie->highValueIndex];
|
||||
} else {
|
||||
highValue=trie->newTrie->data[trie->newTrie->dataLength-UTRIE2_DATA_GRANULARITY];
|
||||
}
|
||||
value=enumValue(context, highValue);
|
||||
if(value!=prevValue) {
|
||||
if(prev<c && !enumRange(context, prev, c-1, prevValue)) {
|
||||
return;
|
||||
}
|
||||
prev=c;
|
||||
prevValue=value;
|
||||
}
|
||||
c=limit;
|
||||
}
|
||||
|
||||
/* deliver last range */
|
||||
enumRange(context, prev, c-1, prevValue);
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_enum(const UTrie2 *trie,
|
||||
UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange, const void *context) {
|
||||
enumEitherTrie(trie, 0, 0x110000, enumValue, enumRange, context);
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_enumForLeadSurrogate(const UTrie2 *trie, UChar32 lead,
|
||||
UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange,
|
||||
const void *context) {
|
||||
if(!U16_IS_LEAD(lead)) {
|
||||
return;
|
||||
}
|
||||
lead=(lead-0xd7c0)<<10; /* start code point */
|
||||
enumEitherTrie(trie, lead, lead+0x400, enumValue, enumRange, context);
|
||||
}
|
||||
|
||||
/* C++ convenience wrappers ------------------------------------------------- */
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
uint16_t BackwardUTrie2StringIterator::previous16() {
|
||||
codePointLimit=codePointStart;
|
||||
if(start>=codePointStart) {
|
||||
codePoint=U_SENTINEL;
|
||||
return trie->errorValue;
|
||||
}
|
||||
uint16_t result;
|
||||
UTRIE2_U16_PREV16(trie, start, codePointStart, codePoint, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
uint16_t ForwardUTrie2StringIterator::next16() {
|
||||
codePointStart=codePointLimit;
|
||||
if(codePointLimit==limit) {
|
||||
codePoint=U_SENTINEL;
|
||||
return trie->errorValue;
|
||||
}
|
||||
uint16_t result;
|
||||
UTRIE2_U16_NEXT16(trie, codePointLimit, limit, codePoint, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
U_NAMESPACE_END
|
||||
986
vendor/icu/src/utrie2.h
vendored
Normal file
986
vendor/icu/src/utrie2.h
vendored
Normal file
@@ -0,0 +1,986 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: utrie2.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2008aug16 (starting from a copy of utrie.h)
|
||||
* created by: Markus W. Scherer
|
||||
*/
|
||||
|
||||
#ifndef __UTRIE2_H__
|
||||
#define __UTRIE2_H__
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
#include <unicode/utf8.h>
|
||||
#include "putilimp.h"
|
||||
#include "udataswp.h"
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
struct UTrie; /* forward declaration */
|
||||
#ifndef __UTRIE_H__
|
||||
typedef struct UTrie UTrie;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* This is a common implementation of a Unicode trie.
|
||||
* It is a kind of compressed, serializable table of 16- or 32-bit values associated with
|
||||
* Unicode code points (0..0x10ffff). (A map from code points to integers.)
|
||||
*
|
||||
* This is the second common version of a Unicode trie (hence the name UTrie2).
|
||||
* Compared with UTrie version 1:
|
||||
* - Still splitting BMP code points 11:5 bits for index and data table lookups.
|
||||
* - Still separate data for lead surrogate code _units_ vs. code _points_,
|
||||
* but the lead surrogate code unit values are not required any more
|
||||
* for data lookup for supplementary code points.
|
||||
* - The "folding" mechanism is removed. In UTrie version 1, this somewhat
|
||||
* hard-to-explain mechanism was meant to be used for optimized UTF-16
|
||||
* processing, with application-specific encoding of indexing bits
|
||||
* in the lead surrogate data for the associated supplementary code points.
|
||||
* - For the last single-value code point range (ending with U+10ffff),
|
||||
* the starting code point ("highStart") and the value are stored.
|
||||
* - For supplementary code points U+10000..highStart-1 a three-table lookup
|
||||
* (two index tables and one data table) is used. The first index
|
||||
* is truncated, omitting both the BMP portion and the high range.
|
||||
* - There is a special small index for 2-byte UTF-8, and the initial data
|
||||
* entries are designed for fast 1/2-byte UTF-8 lookup.
|
||||
* Starting with ICU 60, C0 and C1 are not recognized as UTF-8 lead bytes any more at all,
|
||||
* and the associated 2-byte indexes are unused.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Trie structure.
|
||||
* Use only with public API macros and functions.
|
||||
*/
|
||||
struct UTrie2;
|
||||
typedef struct UTrie2 UTrie2;
|
||||
|
||||
/* Public UTrie2 API functions: read-only access ---------------------------- */
|
||||
|
||||
/**
|
||||
* Selectors for the width of a UTrie2 data value.
|
||||
*/
|
||||
enum UTrie2ValueBits {
|
||||
/** 16 bits per UTrie2 data value. */
|
||||
UTRIE2_16_VALUE_BITS,
|
||||
/** 32 bits per UTrie2 data value. */
|
||||
UTRIE2_32_VALUE_BITS,
|
||||
/** Number of selectors for the width of UTrie2 data values. */
|
||||
UTRIE2_COUNT_VALUE_BITS
|
||||
};
|
||||
typedef enum UTrie2ValueBits UTrie2ValueBits;
|
||||
|
||||
/**
|
||||
* Open a frozen trie from its serialized from, stored in 32-bit-aligned memory.
|
||||
* Inverse of utrie2_serialize().
|
||||
* The memory must remain valid and unchanged as long as the trie is used.
|
||||
* You must utrie2_close() the trie once you are done using it.
|
||||
*
|
||||
* @param valueBits selects the data entry size; results in an
|
||||
* U_INVALID_FORMAT_ERROR if it does not match the serialized form
|
||||
* @param data a pointer to 32-bit-aligned memory containing the serialized form of a UTrie2
|
||||
* @param length the number of bytes available at data;
|
||||
* can be more than necessary
|
||||
* @param pActualLength receives the actual number of bytes at data taken up by the trie data;
|
||||
* can be NULL
|
||||
* @param pErrorCode an in/out ICU UErrorCode
|
||||
* @return the unserialized trie
|
||||
*
|
||||
* @see utrie2_open
|
||||
* @see utrie2_serialize
|
||||
*/
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
utrie2_openFromSerialized(UTrie2ValueBits valueBits,
|
||||
const void *data, int32_t length, int32_t *pActualLength,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Open a frozen, empty "dummy" trie.
|
||||
* A dummy trie is an empty trie, used when a real data trie cannot
|
||||
* be loaded. Equivalent to calling utrie2_open() and utrie2_freeze(),
|
||||
* but without internally creating and compacting/serializing the
|
||||
* builder data structure.
|
||||
*
|
||||
* The trie always returns the initialValue,
|
||||
* or the errorValue for out-of-range code points and illegal UTF-8.
|
||||
*
|
||||
* You must utrie2_close() the trie once you are done using it.
|
||||
*
|
||||
* @param valueBits selects the data entry size
|
||||
* @param initialValue the initial value that is set for all code points
|
||||
* @param errorValue the value for out-of-range code points and illegal UTF-8
|
||||
* @param pErrorCode an in/out ICU UErrorCode
|
||||
* @return the dummy trie
|
||||
*
|
||||
* @see utrie2_openFromSerialized
|
||||
* @see utrie2_open
|
||||
*/
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
utrie2_openDummy(UTrie2ValueBits valueBits,
|
||||
uint32_t initialValue, uint32_t errorValue,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Get a value from a code point as stored in the trie.
|
||||
* Easier to use than UTRIE2_GET16() and UTRIE2_GET32() but slower.
|
||||
* Easier to use because, unlike the macros, this function works on all UTrie2
|
||||
* objects, frozen or not, holding 16-bit or 32-bit data values.
|
||||
*
|
||||
* @param trie the trie
|
||||
* @param c the code point
|
||||
* @return the value
|
||||
*/
|
||||
U_CAPI uint32_t U_EXPORT2
|
||||
utrie2_get32(const UTrie2 *trie, UChar32 c);
|
||||
|
||||
/* enumeration callback types */
|
||||
|
||||
/**
|
||||
* Callback from utrie2_enum(), extracts a uint32_t value from a
|
||||
* trie value. This value will be passed on to the UTrie2EnumRange function.
|
||||
*
|
||||
* @param context an opaque pointer, as passed into utrie2_enum()
|
||||
* @param value a value from the trie
|
||||
* @return the value that is to be passed on to the UTrie2EnumRange function
|
||||
*/
|
||||
typedef uint32_t U_CALLCONV
|
||||
UTrie2EnumValue(const void *context, uint32_t value);
|
||||
|
||||
/**
|
||||
* Callback from utrie2_enum(), is called for each contiguous range
|
||||
* of code points with the same value as retrieved from the trie and
|
||||
* transformed by the UTrie2EnumValue function.
|
||||
*
|
||||
* The callback function can stop the enumeration by returning FALSE.
|
||||
*
|
||||
* @param context an opaque pointer, as passed into utrie2_enum()
|
||||
* @param start the first code point in a contiguous range with value
|
||||
* @param end the last code point in a contiguous range with value (inclusive)
|
||||
* @param value the value that is set for all code points in [start..end]
|
||||
* @return FALSE to stop the enumeration
|
||||
*/
|
||||
typedef UBool U_CALLCONV
|
||||
UTrie2EnumRange(const void *context, UChar32 start, UChar32 end, uint32_t value);
|
||||
|
||||
/**
|
||||
* Enumerate efficiently all values in a trie.
|
||||
* Do not modify the trie during the enumeration.
|
||||
*
|
||||
* For each entry in the trie, the value to be delivered is passed through
|
||||
* the UTrie2EnumValue function.
|
||||
* The value is unchanged if that function pointer is NULL.
|
||||
*
|
||||
* For each contiguous range of code points with a given (transformed) value,
|
||||
* the UTrie2EnumRange function is called.
|
||||
*
|
||||
* @param trie a pointer to the trie
|
||||
* @param enumValue a pointer to a function that may transform the trie entry value,
|
||||
* or NULL if the values from the trie are to be used directly
|
||||
* @param enumRange a pointer to a function that is called for each contiguous range
|
||||
* of code points with the same (transformed) value
|
||||
* @param context an opaque pointer that is passed on to the callback functions
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_enum(const UTrie2 *trie,
|
||||
UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange, const void *context);
|
||||
|
||||
/* Building a trie ---------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Open an empty, writable trie. At build time, 32-bit data values are used.
|
||||
* utrie2_freeze() takes a valueBits parameter
|
||||
* which determines the data value width in the serialized and frozen forms.
|
||||
* You must utrie2_close() the trie once you are done using it.
|
||||
*
|
||||
* @param initialValue the initial value that is set for all code points
|
||||
* @param errorValue the value for out-of-range code points and illegal UTF-8
|
||||
* @param pErrorCode an in/out ICU UErrorCode
|
||||
* @return a pointer to the allocated and initialized new trie
|
||||
*/
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
utrie2_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Clone a trie.
|
||||
* You must utrie2_close() the clone once you are done using it.
|
||||
*
|
||||
* @param other the trie to clone
|
||||
* @param pErrorCode an in/out ICU UErrorCode
|
||||
* @return a pointer to the new trie clone
|
||||
*/
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
utrie2_clone(const UTrie2 *other, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Clone a trie. The clone will be mutable/writable even if the other trie
|
||||
* is frozen. (See utrie2_freeze().)
|
||||
* You must utrie2_close() the clone once you are done using it.
|
||||
*
|
||||
* @param other the trie to clone
|
||||
* @param pErrorCode an in/out ICU UErrorCode
|
||||
* @return a pointer to the new trie clone
|
||||
*/
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Close a trie and release associated memory.
|
||||
*
|
||||
* @param trie the trie
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_close(UTrie2 *trie);
|
||||
|
||||
/**
|
||||
* Set a value for a code point.
|
||||
*
|
||||
* @param trie the unfrozen trie
|
||||
* @param c the code point
|
||||
* @param value the value
|
||||
* @param pErrorCode an in/out ICU UErrorCode; among other possible error codes:
|
||||
* - U_NO_WRITE_PERMISSION if the trie is frozen
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_set32(UTrie2 *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Set a value in a range of code points [start..end].
|
||||
* All code points c with start<=c<=end will get the value if
|
||||
* overwrite is TRUE or if the old value is the initial value.
|
||||
*
|
||||
* @param trie the unfrozen trie
|
||||
* @param start the first code point to get the value
|
||||
* @param end the last code point to get the value (inclusive)
|
||||
* @param value the value
|
||||
* @param overwrite flag for whether old non-initial values are to be overwritten
|
||||
* @param pErrorCode an in/out ICU UErrorCode; among other possible error codes:
|
||||
* - U_NO_WRITE_PERMISSION if the trie is frozen
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_setRange32(UTrie2 *trie,
|
||||
UChar32 start, UChar32 end,
|
||||
uint32_t value, UBool overwrite,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Freeze a trie. Make it immutable (read-only) and compact it,
|
||||
* ready for serialization and for use with fast macros.
|
||||
* Functions to set values will fail after serializing.
|
||||
*
|
||||
* A trie can be frozen only once. If this function is called again with different
|
||||
* valueBits then it will set a U_ILLEGAL_ARGUMENT_ERROR.
|
||||
*
|
||||
* @param trie the trie
|
||||
* @param valueBits selects the data entry size; if smaller than 32 bits, then
|
||||
* the values stored in the trie will be truncated
|
||||
* @param pErrorCode an in/out ICU UErrorCode; among other possible error codes:
|
||||
* - U_INDEX_OUTOFBOUNDS_ERROR if the compacted index or data arrays are too long
|
||||
* for serialization
|
||||
* (the trie will be immutable and usable,
|
||||
* but not frozen and not usable with the fast macros)
|
||||
*
|
||||
* @see utrie2_cloneAsThawed
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Test if the trie is frozen. (See utrie2_freeze().)
|
||||
*
|
||||
* @param trie the trie
|
||||
* @return TRUE if the trie is frozen, that is, immutable, ready for serialization
|
||||
* and for use with fast macros
|
||||
*/
|
||||
U_CAPI UBool U_EXPORT2
|
||||
utrie2_isFrozen(const UTrie2 *trie);
|
||||
|
||||
/**
|
||||
* Serialize a frozen trie into 32-bit aligned memory.
|
||||
* If the trie is not frozen, then the function returns with a U_ILLEGAL_ARGUMENT_ERROR.
|
||||
* A trie can be serialized multiple times.
|
||||
*
|
||||
* @param trie the frozen trie
|
||||
* @param data a pointer to 32-bit-aligned memory to be filled with the trie data,
|
||||
* can be NULL if capacity==0
|
||||
* @param capacity the number of bytes available at data,
|
||||
* or 0 for preflighting
|
||||
* @param pErrorCode an in/out ICU UErrorCode; among other possible error codes:
|
||||
* - U_BUFFER_OVERFLOW_ERROR if the data storage block is too small for serialization
|
||||
* - U_ILLEGAL_ARGUMENT_ERROR if the trie is not frozen or the data and capacity
|
||||
* parameters are bad
|
||||
* @return the number of bytes written or needed for the trie
|
||||
*
|
||||
* @see utrie2_openFromSerialized()
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_serialize(const UTrie2 *trie,
|
||||
void *data, int32_t capacity,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/* Public UTrie2 API: miscellaneous functions ------------------------------- */
|
||||
|
||||
/**
|
||||
* Get the UTrie version from 32-bit-aligned memory containing the serialized form
|
||||
* of either a UTrie (version 1) or a UTrie2 (version 2).
|
||||
*
|
||||
* @param data a pointer to 32-bit-aligned memory containing the serialized form
|
||||
* of a UTrie, version 1 or 2
|
||||
* @param length the number of bytes available at data;
|
||||
* can be more than necessary (see return value)
|
||||
* @param anyEndianOk If FALSE, only platform-endian serialized forms are recognized.
|
||||
* If TRUE, opposite-endian serialized forms are recognized as well.
|
||||
* @return the UTrie version of the serialized form, or 0 if it is not
|
||||
* recognized as a serialized UTrie
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_getVersion(const void *data, int32_t length, UBool anyEndianOk);
|
||||
|
||||
/**
|
||||
* Swap a serialized UTrie2.
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_swap(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Swap a serialized UTrie or UTrie2.
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
utrie2_swapAnyVersion(const UDataSwapper *ds,
|
||||
const void *inData, int32_t length, void *outData,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Build a UTrie2 (version 2) from a UTrie (version 1).
|
||||
* Enumerates all values in the UTrie and builds a UTrie2 with the same values.
|
||||
* The resulting UTrie2 will be frozen.
|
||||
*
|
||||
* @param trie1 the runtime UTrie structure to be enumerated
|
||||
* @param errorValue the value for out-of-range code points and illegal UTF-8
|
||||
* @param pErrorCode an in/out ICU UErrorCode
|
||||
* @return The frozen UTrie2 with the same values as the UTrie.
|
||||
*/
|
||||
U_CAPI UTrie2 * U_EXPORT2
|
||||
utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode);
|
||||
|
||||
/* Public UTrie2 API macros ------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* These macros provide fast data lookup from a frozen trie.
|
||||
* They will crash when used on an unfrozen trie.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return a 16-bit trie value from a code point, with range checking.
|
||||
* Returns trie->errorValue if c is not in the range 0..U+10ffff.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param c (UChar32, in) the input code point
|
||||
* @return (uint16_t) The code point's trie value.
|
||||
*/
|
||||
#define UTRIE2_GET16(trie, c) _UTRIE2_GET((trie), index, (trie)->indexLength, (c))
|
||||
|
||||
/**
|
||||
* Return a 32-bit trie value from a code point, with range checking.
|
||||
* Returns trie->errorValue if c is not in the range 0..U+10ffff.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param c (UChar32, in) the input code point
|
||||
* @return (uint32_t) The code point's trie value.
|
||||
*/
|
||||
#define UTRIE2_GET32(trie, c) _UTRIE2_GET((trie), data32, 0, (c))
|
||||
|
||||
/**
|
||||
* UTF-16: Get the next code point (UChar32 c, out), post-increment src,
|
||||
* and get a 16-bit value from the trie.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param src (const UChar *, in/out) the source text pointer
|
||||
* @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated
|
||||
* @param c (UChar32, out) variable for the code point
|
||||
* @param result (uint16_t, out) uint16_t variable for the trie lookup result
|
||||
*/
|
||||
#define UTRIE2_U16_NEXT16(trie, src, limit, c, result) _UTRIE2_U16_NEXT(trie, index, src, limit, c, result)
|
||||
|
||||
/**
|
||||
* UTF-16: Get the next code point (UChar32 c, out), post-increment src,
|
||||
* and get a 32-bit value from the trie.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param src (const UChar *, in/out) the source text pointer
|
||||
* @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated
|
||||
* @param c (UChar32, out) variable for the code point
|
||||
* @param result (uint32_t, out) uint32_t variable for the trie lookup result
|
||||
*/
|
||||
#define UTRIE2_U16_NEXT32(trie, src, limit, c, result) _UTRIE2_U16_NEXT(trie, data32, src, limit, c, result)
|
||||
|
||||
/**
|
||||
* UTF-16: Get the previous code point (UChar32 c, out), pre-decrement src,
|
||||
* and get a 16-bit value from the trie.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param start (const UChar *, in) the start pointer for the text
|
||||
* @param src (const UChar *, in/out) the source text pointer
|
||||
* @param c (UChar32, out) variable for the code point
|
||||
* @param result (uint16_t, out) uint16_t variable for the trie lookup result
|
||||
*/
|
||||
#define UTRIE2_U16_PREV16(trie, start, src, c, result) _UTRIE2_U16_PREV(trie, index, start, src, c, result)
|
||||
|
||||
/**
|
||||
* UTF-16: Get the previous code point (UChar32 c, out), pre-decrement src,
|
||||
* and get a 32-bit value from the trie.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param start (const UChar *, in) the start pointer for the text
|
||||
* @param src (const UChar *, in/out) the source text pointer
|
||||
* @param c (UChar32, out) variable for the code point
|
||||
* @param result (uint32_t, out) uint32_t variable for the trie lookup result
|
||||
*/
|
||||
#define UTRIE2_U16_PREV32(trie, start, src, c, result) _UTRIE2_U16_PREV(trie, data32, start, src, c, result)
|
||||
|
||||
/**
|
||||
* UTF-8: Post-increment src and get a 16-bit value from the trie.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param src (const char *, in/out) the source text pointer
|
||||
* @param limit (const char *, in) the limit pointer for the text (must not be NULL)
|
||||
* @param result (uint16_t, out) uint16_t variable for the trie lookup result
|
||||
*/
|
||||
#define UTRIE2_U8_NEXT16(trie, src, limit, result)\
|
||||
_UTRIE2_U8_NEXT(trie, data16, index, src, limit, result)
|
||||
|
||||
/**
|
||||
* UTF-8: Post-increment src and get a 32-bit value from the trie.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param src (const char *, in/out) the source text pointer
|
||||
* @param limit (const char *, in) the limit pointer for the text (must not be NULL)
|
||||
* @param result (uint16_t, out) uint32_t variable for the trie lookup result
|
||||
*/
|
||||
#define UTRIE2_U8_NEXT32(trie, src, limit, result) \
|
||||
_UTRIE2_U8_NEXT(trie, data32, data32, src, limit, result)
|
||||
|
||||
/**
|
||||
* UTF-8: Pre-decrement src and get a 16-bit value from the trie.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param start (const char *, in) the start pointer for the text
|
||||
* @param src (const char *, in/out) the source text pointer
|
||||
* @param result (uint16_t, out) uint16_t variable for the trie lookup result
|
||||
*/
|
||||
#define UTRIE2_U8_PREV16(trie, start, src, result) \
|
||||
_UTRIE2_U8_PREV(trie, data16, index, start, src, result)
|
||||
|
||||
/**
|
||||
* UTF-8: Pre-decrement src and get a 32-bit value from the trie.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param start (const char *, in) the start pointer for the text
|
||||
* @param src (const char *, in/out) the source text pointer
|
||||
* @param result (uint16_t, out) uint32_t variable for the trie lookup result
|
||||
*/
|
||||
#define UTRIE2_U8_PREV32(trie, start, src, result) \
|
||||
_UTRIE2_U8_PREV(trie, data32, data32, start, src, result)
|
||||
|
||||
/* Public UTrie2 API: optimized UTF-16 access ------------------------------- */
|
||||
|
||||
/*
|
||||
* The following functions and macros are used for highly optimized UTF-16
|
||||
* text processing. The UTRIE2_U16_NEXTxy() macros do not depend on these.
|
||||
*
|
||||
* A UTrie2 stores separate values for lead surrogate code _units_ vs. code _points_.
|
||||
* UTF-16 text processing can be optimized by detecting surrogate pairs and
|
||||
* assembling supplementary code points only when there is non-trivial data
|
||||
* available.
|
||||
*
|
||||
* At build-time, use utrie2_enumForLeadSurrogate() to see if there
|
||||
* is non-trivial (non-initialValue) data for any of the supplementary
|
||||
* code points associated with a lead surrogate.
|
||||
* If so, then set a special (application-specific) value for the
|
||||
* lead surrogate code _unit_, with utrie2_set32ForLeadSurrogateCodeUnit().
|
||||
*
|
||||
* At runtime, use UTRIE2_GET16_FROM_U16_SINGLE_LEAD() or
|
||||
* UTRIE2_GET32_FROM_U16_SINGLE_LEAD() per code unit. If there is non-trivial
|
||||
* data and the code unit is a lead surrogate, then check if a trail surrogate
|
||||
* follows. If so, assemble the supplementary code point with
|
||||
* U16_GET_SUPPLEMENTARY() and look up its value with UTRIE2_GET16_FROM_SUPP()
|
||||
* or UTRIE2_GET32_FROM_SUPP(); otherwise reset the lead
|
||||
* surrogate's value or do a code point lookup for it.
|
||||
*
|
||||
* If there is only trivial data for lead and trail surrogates, then processing
|
||||
* can often skip them. For example, in normalization or case mapping
|
||||
* all characters that do not have any mappings are simply copied as is.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get a value from a lead surrogate code unit as stored in the trie.
|
||||
*
|
||||
* @param trie the trie
|
||||
* @param c the code unit (U+D800..U+DBFF)
|
||||
* @return the value
|
||||
*/
|
||||
U_CAPI uint32_t U_EXPORT2
|
||||
utrie2_get32FromLeadSurrogateCodeUnit(const UTrie2 *trie, UChar32 c);
|
||||
|
||||
/**
|
||||
* Enumerate the trie values for the 1024=0x400 code points
|
||||
* corresponding to a given lead surrogate.
|
||||
* For example, for the lead surrogate U+D87E it will enumerate the values
|
||||
* for [U+2F800..U+2FC00[.
|
||||
* Used by data builder code that sets special lead surrogate code unit values
|
||||
* for optimized UTF-16 string processing.
|
||||
*
|
||||
* Do not modify the trie during the enumeration.
|
||||
*
|
||||
* Except for the limited code point range, this functions just like utrie2_enum():
|
||||
* For each entry in the trie, the value to be delivered is passed through
|
||||
* the UTrie2EnumValue function.
|
||||
* The value is unchanged if that function pointer is NULL.
|
||||
*
|
||||
* For each contiguous range of code points with a given (transformed) value,
|
||||
* the UTrie2EnumRange function is called.
|
||||
*
|
||||
* @param trie a pointer to the trie
|
||||
* @param enumValue a pointer to a function that may transform the trie entry value,
|
||||
* or NULL if the values from the trie are to be used directly
|
||||
* @param enumRange a pointer to a function that is called for each contiguous range
|
||||
* of code points with the same (transformed) value
|
||||
* @param context an opaque pointer that is passed on to the callback functions
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_enumForLeadSurrogate(const UTrie2 *trie, UChar32 lead,
|
||||
UTrie2EnumValue *enumValue, UTrie2EnumRange *enumRange,
|
||||
const void *context);
|
||||
|
||||
/**
|
||||
* Set a value for a lead surrogate code unit.
|
||||
*
|
||||
* @param trie the unfrozen trie
|
||||
* @param lead the lead surrogate code unit (U+D800..U+DBFF)
|
||||
* @param value the value
|
||||
* @param pErrorCode an in/out ICU UErrorCode; among other possible error codes:
|
||||
* - U_NO_WRITE_PERMISSION if the trie is frozen
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
utrie2_set32ForLeadSurrogateCodeUnit(UTrie2 *trie,
|
||||
UChar32 lead, uint32_t value,
|
||||
UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Return a 16-bit trie value from a UTF-16 single/lead code unit (<=U+ffff).
|
||||
* Same as UTRIE2_GET16() if c is a BMP code point except for lead surrogates,
|
||||
* but smaller and faster.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param c (UChar32, in) the input code unit, must be 0<=c<=U+ffff
|
||||
* @return (uint16_t) The code unit's trie value.
|
||||
*/
|
||||
#define UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, c) _UTRIE2_GET_FROM_U16_SINGLE_LEAD((trie), index, c)
|
||||
|
||||
/**
|
||||
* Return a 32-bit trie value from a UTF-16 single/lead code unit (<=U+ffff).
|
||||
* Same as UTRIE2_GET32() if c is a BMP code point except for lead surrogates,
|
||||
* but smaller and faster.
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param c (UChar32, in) the input code unit, must be 0<=c<=U+ffff
|
||||
* @return (uint32_t) The code unit's trie value.
|
||||
*/
|
||||
#define UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c) _UTRIE2_GET_FROM_U16_SINGLE_LEAD((trie), data32, c)
|
||||
|
||||
/**
|
||||
* Return a 16-bit trie value from a supplementary code point (U+10000..U+10ffff).
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param c (UChar32, in) the input code point, must be U+10000<=c<=U+10ffff
|
||||
* @return (uint16_t) The code point's trie value.
|
||||
*/
|
||||
#define UTRIE2_GET16_FROM_SUPP(trie, c) _UTRIE2_GET_FROM_SUPP((trie), index, c)
|
||||
|
||||
/**
|
||||
* Return a 32-bit trie value from a supplementary code point (U+10000..U+10ffff).
|
||||
*
|
||||
* @param trie (const UTrie2 *, in) a frozen trie
|
||||
* @param c (UChar32, in) the input code point, must be U+10000<=c<=U+10ffff
|
||||
* @return (uint32_t) The code point's trie value.
|
||||
*/
|
||||
#define UTRIE2_GET32_FROM_SUPP(trie, c) _UTRIE2_GET_FROM_SUPP((trie), data32, c)
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
/* C++ convenience wrappers ------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <unicode/utf.h>
|
||||
#include "mutex.h"
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
// Use the Forward/Backward subclasses below.
|
||||
class UTrie2StringIterator : public UMemory {
|
||||
public:
|
||||
UTrie2StringIterator(const UTrie2 *t, const UChar *p) :
|
||||
trie(t), codePointStart(p), codePointLimit(p), codePoint(U_SENTINEL) {}
|
||||
|
||||
const UTrie2 *trie;
|
||||
const UChar *codePointStart, *codePointLimit;
|
||||
UChar32 codePoint;
|
||||
};
|
||||
|
||||
class BackwardUTrie2StringIterator : public UTrie2StringIterator {
|
||||
public:
|
||||
BackwardUTrie2StringIterator(const UTrie2 *t, const UChar *s, const UChar *p) :
|
||||
UTrie2StringIterator(t, p), start(s) {}
|
||||
|
||||
uint16_t previous16();
|
||||
|
||||
const UChar *start;
|
||||
};
|
||||
|
||||
class ForwardUTrie2StringIterator : public UTrie2StringIterator {
|
||||
public:
|
||||
// Iteration limit l can be NULL.
|
||||
// In that case, the caller must detect c==0 and stop.
|
||||
ForwardUTrie2StringIterator(const UTrie2 *t, const UChar *p, const UChar *l) :
|
||||
UTrie2StringIterator(t, p), limit(l) {}
|
||||
|
||||
uint16_t next16();
|
||||
|
||||
const UChar *limit;
|
||||
};
|
||||
|
||||
U_NAMESPACE_END
|
||||
|
||||
#endif
|
||||
|
||||
/* Internal definitions ----------------------------------------------------- */
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
/** Build-time trie structure. */
|
||||
struct UNewTrie2;
|
||||
typedef struct UNewTrie2 UNewTrie2;
|
||||
|
||||
/*
|
||||
* Trie structure definition.
|
||||
*
|
||||
* Either the data table is 16 bits wide and accessed via the index
|
||||
* pointer, with each index item increased by indexLength;
|
||||
* in this case, data32==NULL, and data16 is used for direct ASCII access.
|
||||
*
|
||||
* Or the data table is 32 bits wide and accessed via the data32 pointer.
|
||||
*/
|
||||
struct UTrie2 {
|
||||
/* protected: used by macros and functions for reading values */
|
||||
const uint16_t *index;
|
||||
const uint16_t *data16; /* for fast UTF-8 ASCII access, if 16b data */
|
||||
const uint32_t *data32; /* NULL if 16b data is used via index */
|
||||
|
||||
int32_t indexLength, dataLength;
|
||||
uint16_t index2NullOffset; /* 0xffff if there is no dedicated index-2 null block */
|
||||
uint16_t dataNullOffset;
|
||||
uint32_t initialValue;
|
||||
/** Value returned for out-of-range code points and illegal UTF-8. */
|
||||
uint32_t errorValue;
|
||||
|
||||
/* Start of the last range which ends at U+10ffff, and its value. */
|
||||
UChar32 highStart;
|
||||
int32_t highValueIndex;
|
||||
|
||||
/* private: used by builder and unserialization functions */
|
||||
void *memory; /* serialized bytes; NULL if not frozen yet */
|
||||
int32_t length; /* number of serialized bytes at memory; 0 if not frozen yet */
|
||||
UBool isMemoryOwned; /* TRUE if the trie owns the memory */
|
||||
UBool padding1;
|
||||
int16_t padding2;
|
||||
UNewTrie2 *newTrie; /* builder object; NULL when frozen */
|
||||
};
|
||||
|
||||
/**
|
||||
* Trie constants, defining shift widths, index array lengths, etc.
|
||||
*
|
||||
* These are needed for the runtime macros but users can treat these as
|
||||
* implementation details and skip to the actual public API further below.
|
||||
*/
|
||||
enum {
|
||||
/** Shift size for getting the index-1 table offset. */
|
||||
UTRIE2_SHIFT_1=6+5,
|
||||
|
||||
/** Shift size for getting the index-2 table offset. */
|
||||
UTRIE2_SHIFT_2=5,
|
||||
|
||||
/**
|
||||
* Difference between the two shift sizes,
|
||||
* for getting an index-1 offset from an index-2 offset. 6=11-5
|
||||
*/
|
||||
UTRIE2_SHIFT_1_2=UTRIE2_SHIFT_1-UTRIE2_SHIFT_2,
|
||||
|
||||
/**
|
||||
* Number of index-1 entries for the BMP. 32=0x20
|
||||
* This part of the index-1 table is omitted from the serialized form.
|
||||
*/
|
||||
UTRIE2_OMITTED_BMP_INDEX_1_LENGTH=0x10000>>UTRIE2_SHIFT_1,
|
||||
|
||||
/** Number of code points per index-1 table entry. 2048=0x800 */
|
||||
UTRIE2_CP_PER_INDEX_1_ENTRY=1<<UTRIE2_SHIFT_1,
|
||||
|
||||
/** Number of entries in an index-2 block. 64=0x40 */
|
||||
UTRIE2_INDEX_2_BLOCK_LENGTH=1<<UTRIE2_SHIFT_1_2,
|
||||
|
||||
/** Mask for getting the lower bits for the in-index-2-block offset. */
|
||||
UTRIE2_INDEX_2_MASK=UTRIE2_INDEX_2_BLOCK_LENGTH-1,
|
||||
|
||||
/** Number of entries in a data block. 32=0x20 */
|
||||
UTRIE2_DATA_BLOCK_LENGTH=1<<UTRIE2_SHIFT_2,
|
||||
|
||||
/** Mask for getting the lower bits for the in-data-block offset. */
|
||||
UTRIE2_DATA_MASK=UTRIE2_DATA_BLOCK_LENGTH-1,
|
||||
|
||||
/**
|
||||
* Shift size for shifting left the index array values.
|
||||
* Increases possible data size with 16-bit index values at the cost
|
||||
* of compactability.
|
||||
* This requires data blocks to be aligned by UTRIE2_DATA_GRANULARITY.
|
||||
*/
|
||||
UTRIE2_INDEX_SHIFT=2,
|
||||
|
||||
/** The alignment size of a data block. Also the granularity for compaction. */
|
||||
UTRIE2_DATA_GRANULARITY=1<<UTRIE2_INDEX_SHIFT,
|
||||
|
||||
/* Fixed layout of the first part of the index array. ------------------- */
|
||||
|
||||
/**
|
||||
* The BMP part of the index-2 table is fixed and linear and starts at offset 0.
|
||||
* Length=2048=0x800=0x10000>>UTRIE2_SHIFT_2.
|
||||
*/
|
||||
UTRIE2_INDEX_2_OFFSET=0,
|
||||
|
||||
/**
|
||||
* The part of the index-2 table for U+D800..U+DBFF stores values for
|
||||
* lead surrogate code _units_ not code _points_.
|
||||
* Values for lead surrogate code _points_ are indexed with this portion of the table.
|
||||
* Length=32=0x20=0x400>>UTRIE2_SHIFT_2. (There are 1024=0x400 lead surrogates.)
|
||||
*/
|
||||
UTRIE2_LSCP_INDEX_2_OFFSET=0x10000>>UTRIE2_SHIFT_2,
|
||||
UTRIE2_LSCP_INDEX_2_LENGTH=0x400>>UTRIE2_SHIFT_2,
|
||||
|
||||
/** Count the lengths of both BMP pieces. 2080=0x820 */
|
||||
UTRIE2_INDEX_2_BMP_LENGTH=UTRIE2_LSCP_INDEX_2_OFFSET+UTRIE2_LSCP_INDEX_2_LENGTH,
|
||||
|
||||
/**
|
||||
* The 2-byte UTF-8 version of the index-2 table follows at offset 2080=0x820.
|
||||
* Length 32=0x20 for lead bytes C0..DF, regardless of UTRIE2_SHIFT_2.
|
||||
*/
|
||||
UTRIE2_UTF8_2B_INDEX_2_OFFSET=UTRIE2_INDEX_2_BMP_LENGTH,
|
||||
UTRIE2_UTF8_2B_INDEX_2_LENGTH=0x800>>6, /* U+0800 is the first code point after 2-byte UTF-8 */
|
||||
|
||||
/**
|
||||
* The index-1 table, only used for supplementary code points, at offset 2112=0x840.
|
||||
* Variable length, for code points up to highStart, where the last single-value range starts.
|
||||
* Maximum length 512=0x200=0x100000>>UTRIE2_SHIFT_1.
|
||||
* (For 0x100000 supplementary code points U+10000..U+10ffff.)
|
||||
*
|
||||
* The part of the index-2 table for supplementary code points starts
|
||||
* after this index-1 table.
|
||||
*
|
||||
* Both the index-1 table and the following part of the index-2 table
|
||||
* are omitted completely if there is only BMP data.
|
||||
*/
|
||||
UTRIE2_INDEX_1_OFFSET=UTRIE2_UTF8_2B_INDEX_2_OFFSET+UTRIE2_UTF8_2B_INDEX_2_LENGTH,
|
||||
UTRIE2_MAX_INDEX_1_LENGTH=0x100000>>UTRIE2_SHIFT_1,
|
||||
|
||||
/*
|
||||
* Fixed layout of the first part of the data array. -----------------------
|
||||
* Starts with 4 blocks (128=0x80 entries) for ASCII.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The illegal-UTF-8 data block follows the ASCII block, at offset 128=0x80.
|
||||
* Used with linear access for single bytes 0..0xbf for simple error handling.
|
||||
* Length 64=0x40, not UTRIE2_DATA_BLOCK_LENGTH.
|
||||
*/
|
||||
UTRIE2_BAD_UTF8_DATA_OFFSET=0x80,
|
||||
|
||||
/** The start of non-linear-ASCII data blocks, at offset 192=0xc0. */
|
||||
UTRIE2_DATA_START_OFFSET=0xc0
|
||||
};
|
||||
|
||||
/* Internal functions and macros -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Internal function for part of the UTRIE2_U8_NEXTxx() macro implementations.
|
||||
* Do not call directly.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL int32_t U_EXPORT2
|
||||
utrie2_internalU8NextIndex(const UTrie2 *trie, UChar32 c,
|
||||
const uint8_t *src, const uint8_t *limit);
|
||||
|
||||
/**
|
||||
* Internal function for part of the UTRIE2_U8_PREVxx() macro implementations.
|
||||
* Do not call directly.
|
||||
* @internal
|
||||
*/
|
||||
U_INTERNAL int32_t U_EXPORT2
|
||||
utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
|
||||
const uint8_t *start, const uint8_t *src);
|
||||
|
||||
|
||||
/** Internal low-level trie getter. Returns a data index. */
|
||||
#define _UTRIE2_INDEX_RAW(offset, trieIndex, c) \
|
||||
(((int32_t)((trieIndex)[(offset)+((c)>>UTRIE2_SHIFT_2)]) \
|
||||
<<UTRIE2_INDEX_SHIFT)+ \
|
||||
((c)&UTRIE2_DATA_MASK))
|
||||
|
||||
/** Internal trie getter from a UTF-16 single/lead code unit. Returns the data index. */
|
||||
#define _UTRIE2_INDEX_FROM_U16_SINGLE_LEAD(trieIndex, c) _UTRIE2_INDEX_RAW(0, trieIndex, c)
|
||||
|
||||
/** Internal trie getter from a lead surrogate code point (D800..DBFF). Returns the data index. */
|
||||
#define _UTRIE2_INDEX_FROM_LSCP(trieIndex, c) \
|
||||
_UTRIE2_INDEX_RAW(UTRIE2_LSCP_INDEX_2_OFFSET-(0xd800>>UTRIE2_SHIFT_2), trieIndex, c)
|
||||
|
||||
/** Internal trie getter from a BMP code point. Returns the data index. */
|
||||
#define _UTRIE2_INDEX_FROM_BMP(trieIndex, c) \
|
||||
_UTRIE2_INDEX_RAW(U_IS_LEAD(c) ? UTRIE2_LSCP_INDEX_2_OFFSET-(0xd800>>UTRIE2_SHIFT_2) : 0, \
|
||||
trieIndex, c)
|
||||
|
||||
/** Internal trie getter from a supplementary code point below highStart. Returns the data index. */
|
||||
#define _UTRIE2_INDEX_FROM_SUPP(trieIndex, c) \
|
||||
(((int32_t)((trieIndex)[ \
|
||||
(trieIndex)[(UTRIE2_INDEX_1_OFFSET-UTRIE2_OMITTED_BMP_INDEX_1_LENGTH)+ \
|
||||
((c)>>UTRIE2_SHIFT_1)]+ \
|
||||
(((c)>>UTRIE2_SHIFT_2)&UTRIE2_INDEX_2_MASK)]) \
|
||||
<<UTRIE2_INDEX_SHIFT)+ \
|
||||
((c)&UTRIE2_DATA_MASK))
|
||||
|
||||
/**
|
||||
* Internal trie getter from a code point, with checking that c is in 0..10FFFF.
|
||||
* Returns the data index.
|
||||
*/
|
||||
#define _UTRIE2_INDEX_FROM_CP(trie, asciiOffset, c) \
|
||||
((uint32_t)(c)<0xd800 ? \
|
||||
_UTRIE2_INDEX_RAW(0, (trie)->index, c) : \
|
||||
(uint32_t)(c)<=0xffff ? \
|
||||
_UTRIE2_INDEX_RAW( \
|
||||
(c)<=0xdbff ? UTRIE2_LSCP_INDEX_2_OFFSET-(0xd800>>UTRIE2_SHIFT_2) : 0, \
|
||||
(trie)->index, c) : \
|
||||
(uint32_t)(c)>0x10ffff ? \
|
||||
(asciiOffset)+UTRIE2_BAD_UTF8_DATA_OFFSET : \
|
||||
(c)>=(trie)->highStart ? \
|
||||
(trie)->highValueIndex : \
|
||||
_UTRIE2_INDEX_FROM_SUPP((trie)->index, c))
|
||||
|
||||
/** Internal trie getter from a UTF-16 single/lead code unit. Returns the data. */
|
||||
#define _UTRIE2_GET_FROM_U16_SINGLE_LEAD(trie, data, c) \
|
||||
(trie)->data[_UTRIE2_INDEX_FROM_U16_SINGLE_LEAD((trie)->index, c)]
|
||||
|
||||
/** Internal trie getter from a supplementary code point. Returns the data. */
|
||||
#define _UTRIE2_GET_FROM_SUPP(trie, data, c) \
|
||||
(trie)->data[(c)>=(trie)->highStart ? (trie)->highValueIndex : \
|
||||
_UTRIE2_INDEX_FROM_SUPP((trie)->index, c)]
|
||||
|
||||
/**
|
||||
* Internal trie getter from a code point, with checking that c is in 0..10FFFF.
|
||||
* Returns the data.
|
||||
*/
|
||||
#define _UTRIE2_GET(trie, data, asciiOffset, c) \
|
||||
(trie)->data[_UTRIE2_INDEX_FROM_CP(trie, asciiOffset, c)]
|
||||
|
||||
/** Internal next-post-increment: get the next code point (c) and its data. */
|
||||
#define _UTRIE2_U16_NEXT(trie, data, src, limit, c, result) { \
|
||||
{ \
|
||||
uint16_t __c2; \
|
||||
(c)=*(src)++; \
|
||||
if(!U16_IS_LEAD(c)) { \
|
||||
(result)=_UTRIE2_GET_FROM_U16_SINGLE_LEAD(trie, data, c); \
|
||||
} else if((src)==(limit) || !U16_IS_TRAIL(__c2=*(src))) { \
|
||||
(result)=(trie)->data[_UTRIE2_INDEX_FROM_LSCP((trie)->index, c)]; \
|
||||
} else { \
|
||||
++(src); \
|
||||
(c)=U16_GET_SUPPLEMENTARY((c), __c2); \
|
||||
(result)=_UTRIE2_GET_FROM_SUPP((trie), data, (c)); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/** Internal pre-decrement-previous: get the previous code point (c) and its data */
|
||||
#define _UTRIE2_U16_PREV(trie, data, start, src, c, result) { \
|
||||
{ \
|
||||
uint16_t __c2; \
|
||||
(c)=*--(src); \
|
||||
if(!U16_IS_TRAIL(c) || (src)==(start) || !U16_IS_LEAD(__c2=*((src)-1))) { \
|
||||
(result)=(trie)->data[_UTRIE2_INDEX_FROM_BMP((trie)->index, c)]; \
|
||||
} else { \
|
||||
--(src); \
|
||||
(c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
|
||||
(result)=_UTRIE2_GET_FROM_SUPP((trie), data, (c)); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/** Internal UTF-8 next-post-increment: get the next code point's data. */
|
||||
#define _UTRIE2_U8_NEXT(trie, ascii, data, src, limit, result) { \
|
||||
uint8_t __lead=(uint8_t)*(src)++; \
|
||||
if(U8_IS_SINGLE(__lead)) { \
|
||||
(result)=(trie)->ascii[__lead]; \
|
||||
} else { \
|
||||
uint8_t __t1, __t2; \
|
||||
if( /* handle U+0800..U+FFFF inline */ \
|
||||
0xe0<=__lead && __lead<0xf0 && ((src)+1)<(limit) && \
|
||||
U8_IS_VALID_LEAD3_AND_T1(__lead, __t1=(uint8_t)*(src)) && \
|
||||
(__t2=(uint8_t)(*((src)+1)-0x80))<= 0x3f \
|
||||
) { \
|
||||
(src)+=2; \
|
||||
(result)=(trie)->data[ \
|
||||
((int32_t)((trie)->index[((__lead-0xe0)<<(12-UTRIE2_SHIFT_2))+ \
|
||||
((__t1&0x3f)<<(6-UTRIE2_SHIFT_2))+(__t2>>UTRIE2_SHIFT_2)]) \
|
||||
<<UTRIE2_INDEX_SHIFT)+ \
|
||||
(__t2&UTRIE2_DATA_MASK)]; \
|
||||
} else if( /* handle U+0080..U+07FF inline */ \
|
||||
__lead<0xe0 && __lead>=0xc2 && (src)<(limit) && \
|
||||
(__t1=(uint8_t)(*(src)-0x80))<=0x3f \
|
||||
) { \
|
||||
++(src); \
|
||||
(result)=(trie)->data[ \
|
||||
(trie)->index[(UTRIE2_UTF8_2B_INDEX_2_OFFSET-0xc0)+__lead]+ \
|
||||
__t1]; \
|
||||
} else { \
|
||||
int32_t __index=utrie2_internalU8NextIndex((trie), __lead, (const uint8_t *)(src), \
|
||||
(const uint8_t *)(limit)); \
|
||||
(src)+=__index&7; \
|
||||
(result)=(trie)->data[__index>>3]; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
/** Internal UTF-8 pre-decrement-previous: get the previous code point's data. */
|
||||
#define _UTRIE2_U8_PREV(trie, ascii, data, start, src, result) { \
|
||||
uint8_t __b=(uint8_t)*--(src); \
|
||||
if(U8_IS_SINGLE(__b)) { \
|
||||
(result)=(trie)->ascii[__b]; \
|
||||
} else { \
|
||||
int32_t __index=utrie2_internalU8PrevIndex((trie), __b, (const uint8_t *)(start), \
|
||||
(const uint8_t *)(src)); \
|
||||
(src)-=__index&7; \
|
||||
(result)=(trie)->data[__index>>3]; \
|
||||
} \
|
||||
}
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
#endif
|
||||
174
vendor/icu/src/utrie2_impl.h
vendored
Normal file
174
vendor/icu/src/utrie2_impl.h
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2001-2008, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
* file name: utrie2_impl.h
|
||||
* encoding: UTF-8
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2008sep26 (split off from utrie2.c)
|
||||
* created by: Markus W. Scherer
|
||||
*
|
||||
* Definitions needed for both runtime and builder code for UTrie2,
|
||||
* used by utrie2.c and utrie2_builder.c.
|
||||
*/
|
||||
|
||||
#ifndef __UTRIE2_IMPL_H__
|
||||
#define __UTRIE2_IMPL_H__
|
||||
|
||||
#include "utrie2.h"
|
||||
|
||||
/* Public UTrie2 API implementation ----------------------------------------- */
|
||||
|
||||
/*
|
||||
* These definitions are mostly needed by utrie2.c,
|
||||
* but also by utrie2_serialize() and utrie2_swap().
|
||||
*/
|
||||
|
||||
/*
|
||||
* UTrie and UTrie2 signature values,
|
||||
* in platform endianness and opposite endianness.
|
||||
*/
|
||||
#define UTRIE_SIG 0x54726965
|
||||
#define UTRIE_OE_SIG 0x65697254
|
||||
|
||||
#define UTRIE2_SIG 0x54726932
|
||||
#define UTRIE2_OE_SIG 0x32697254
|
||||
|
||||
/**
|
||||
* Trie data structure in serialized form:
|
||||
*
|
||||
* UTrie2Header header;
|
||||
* uint16_t index[header.index2Length];
|
||||
* uint16_t data[header.shiftedDataLength<<2]; -- or uint32_t data[...]
|
||||
* @internal
|
||||
*/
|
||||
typedef struct UTrie2Header {
|
||||
/** "Tri2" in big-endian US-ASCII (0x54726932) */
|
||||
uint32_t signature;
|
||||
|
||||
/**
|
||||
* options bit field:
|
||||
* 15.. 4 reserved (0)
|
||||
* 3.. 0 UTrie2ValueBits valueBits
|
||||
*/
|
||||
uint16_t options;
|
||||
|
||||
/** UTRIE2_INDEX_1_OFFSET..UTRIE2_MAX_INDEX_LENGTH */
|
||||
uint16_t indexLength;
|
||||
|
||||
/** (UTRIE2_DATA_START_OFFSET..UTRIE2_MAX_DATA_LENGTH)>>UTRIE2_INDEX_SHIFT */
|
||||
uint16_t shiftedDataLength;
|
||||
|
||||
/** Null index and data blocks, not shifted. */
|
||||
uint16_t index2NullOffset, dataNullOffset;
|
||||
|
||||
/**
|
||||
* First code point of the single-value range ending with U+10ffff,
|
||||
* rounded up and then shifted right by UTRIE2_SHIFT_1.
|
||||
*/
|
||||
uint16_t shiftedHighStart;
|
||||
} UTrie2Header;
|
||||
|
||||
/**
|
||||
* Constants for use with UTrie2Header.options.
|
||||
* @internal
|
||||
*/
|
||||
enum {
|
||||
/** Mask to get the UTrie2ValueBits valueBits from options. */
|
||||
UTRIE2_OPTIONS_VALUE_BITS_MASK=0xf
|
||||
};
|
||||
|
||||
/* Building a trie ---------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* These definitions are mostly needed by utrie2_builder.c, but also by
|
||||
* utrie2_get32() and utrie2_enum().
|
||||
*/
|
||||
|
||||
enum {
|
||||
/**
|
||||
* At build time, leave a gap in the index-2 table,
|
||||
* at least as long as the maximum lengths of the 2-byte UTF-8 index-2 table
|
||||
* and the supplementary index-1 table.
|
||||
* Round up to UTRIE2_INDEX_2_BLOCK_LENGTH for proper compacting.
|
||||
*/
|
||||
UNEWTRIE2_INDEX_GAP_OFFSET=UTRIE2_INDEX_2_BMP_LENGTH,
|
||||
UNEWTRIE2_INDEX_GAP_LENGTH=
|
||||
((UTRIE2_UTF8_2B_INDEX_2_LENGTH+UTRIE2_MAX_INDEX_1_LENGTH)+UTRIE2_INDEX_2_MASK)&
|
||||
~UTRIE2_INDEX_2_MASK,
|
||||
|
||||
/**
|
||||
* Maximum length of the build-time index-2 array.
|
||||
* Maximum number of Unicode code points (0x110000) shifted right by UTRIE2_SHIFT_2,
|
||||
* plus the part of the index-2 table for lead surrogate code points,
|
||||
* plus the build-time index gap,
|
||||
* plus the null index-2 block.
|
||||
*/
|
||||
UNEWTRIE2_MAX_INDEX_2_LENGTH=
|
||||
(0x110000>>UTRIE2_SHIFT_2)+
|
||||
UTRIE2_LSCP_INDEX_2_LENGTH+
|
||||
UNEWTRIE2_INDEX_GAP_LENGTH+
|
||||
UTRIE2_INDEX_2_BLOCK_LENGTH,
|
||||
|
||||
UNEWTRIE2_INDEX_1_LENGTH=0x110000>>UTRIE2_SHIFT_1
|
||||
};
|
||||
|
||||
/**
|
||||
* Maximum length of the build-time data array.
|
||||
* One entry per 0x110000 code points, plus the illegal-UTF-8 block and the null block,
|
||||
* plus values for the 0x400 surrogate code units.
|
||||
*/
|
||||
#define UNEWTRIE2_MAX_DATA_LENGTH (0x110000+0x40+0x40+0x400)
|
||||
|
||||
/*
|
||||
* Build-time trie structure.
|
||||
*
|
||||
* Just using a boolean flag for "repeat use" could lead to data array overflow
|
||||
* because we would not be able to detect when a data block becomes unused.
|
||||
* It also leads to orphan data blocks that are kept through serialization.
|
||||
*
|
||||
* Need to use reference counting for data blocks,
|
||||
* and allocDataBlock() needs to look for a free block before increasing dataLength.
|
||||
*
|
||||
* This scheme seems like overkill for index-2 blocks since the whole index array is
|
||||
* preallocated anyway (unlike the growable data array).
|
||||
* Just allocating multiple index-2 blocks as needed.
|
||||
*/
|
||||
struct UNewTrie2 {
|
||||
int32_t index1[UNEWTRIE2_INDEX_1_LENGTH];
|
||||
int32_t index2[UNEWTRIE2_MAX_INDEX_2_LENGTH];
|
||||
uint32_t *data;
|
||||
|
||||
uint32_t initialValue, errorValue;
|
||||
int32_t index2Length, dataCapacity, dataLength;
|
||||
int32_t firstFreeBlock;
|
||||
int32_t index2NullOffset, dataNullOffset;
|
||||
UChar32 highStart;
|
||||
UBool isCompacted;
|
||||
|
||||
/**
|
||||
* Multi-purpose per-data-block table.
|
||||
*
|
||||
* Before compacting:
|
||||
*
|
||||
* Per-data-block reference counters/free-block list.
|
||||
* 0: unused
|
||||
* >0: reference counter (number of index-2 entries pointing here)
|
||||
* <0: next free data block in free-block list
|
||||
*
|
||||
* While compacting:
|
||||
*
|
||||
* Map of adjusted indexes, used in compactData() and compactIndex2().
|
||||
* Maps from original indexes to new ones.
|
||||
*/
|
||||
int32_t map[UNEWTRIE2_MAX_DATA_LENGTH>>UTRIE2_SHIFT_2];
|
||||
};
|
||||
|
||||
#endif
|
||||
225
vendor/icu/src/utypes.cpp
vendored
Normal file
225
vendor/icu/src/utypes.cpp
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2015, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : utypes.c (previously putil.c)
|
||||
*
|
||||
* Date Name Description
|
||||
* 10/07/2004 grhoten split from putil.c
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include <unicode/utypes.h>
|
||||
|
||||
/* u_errorName() ------------------------------------------------------------ */
|
||||
|
||||
static const char * const
|
||||
_uErrorInfoName[U_ERROR_WARNING_LIMIT-U_ERROR_WARNING_START]={
|
||||
"U_USING_FALLBACK_WARNING",
|
||||
"U_USING_DEFAULT_WARNING",
|
||||
"U_SAFECLONE_ALLOCATED_WARNING",
|
||||
"U_STATE_OLD_WARNING",
|
||||
"U_STRING_NOT_TERMINATED_WARNING",
|
||||
"U_SORT_KEY_TOO_SHORT_WARNING",
|
||||
"U_AMBIGUOUS_ALIAS_WARNING",
|
||||
"U_DIFFERENT_UCA_VERSION",
|
||||
"U_PLUGIN_CHANGED_LEVEL_WARNING",
|
||||
};
|
||||
|
||||
static const char * const
|
||||
_uTransErrorName[U_PARSE_ERROR_LIMIT - U_PARSE_ERROR_START]={
|
||||
"U_BAD_VARIABLE_DEFINITION",
|
||||
"U_MALFORMED_RULE",
|
||||
"U_MALFORMED_SET",
|
||||
"U_MALFORMED_SYMBOL_REFERENCE",
|
||||
"U_MALFORMED_UNICODE_ESCAPE",
|
||||
"U_MALFORMED_VARIABLE_DEFINITION",
|
||||
"U_MALFORMED_VARIABLE_REFERENCE",
|
||||
"U_MISMATCHED_SEGMENT_DELIMITERS",
|
||||
"U_MISPLACED_ANCHOR_START",
|
||||
"U_MISPLACED_CURSOR_OFFSET",
|
||||
"U_MISPLACED_QUANTIFIER",
|
||||
"U_MISSING_OPERATOR",
|
||||
"U_MISSING_SEGMENT_CLOSE",
|
||||
"U_MULTIPLE_ANTE_CONTEXTS",
|
||||
"U_MULTIPLE_CURSORS",
|
||||
"U_MULTIPLE_POST_CONTEXTS",
|
||||
"U_TRAILING_BACKSLASH",
|
||||
"U_UNDEFINED_SEGMENT_REFERENCE",
|
||||
"U_UNDEFINED_VARIABLE",
|
||||
"U_UNQUOTED_SPECIAL",
|
||||
"U_UNTERMINATED_QUOTE",
|
||||
"U_RULE_MASK_ERROR",
|
||||
"U_MISPLACED_COMPOUND_FILTER",
|
||||
"U_MULTIPLE_COMPOUND_FILTERS",
|
||||
"U_INVALID_RBT_SYNTAX",
|
||||
"U_INVALID_PROPERTY_PATTERN",
|
||||
"U_MALFORMED_PRAGMA",
|
||||
"U_UNCLOSED_SEGMENT",
|
||||
"U_ILLEGAL_CHAR_IN_SEGMENT",
|
||||
"U_VARIABLE_RANGE_EXHAUSTED",
|
||||
"U_VARIABLE_RANGE_OVERLAP",
|
||||
"U_ILLEGAL_CHARACTER",
|
||||
"U_INTERNAL_TRANSLITERATOR_ERROR",
|
||||
"U_INVALID_ID",
|
||||
"U_INVALID_FUNCTION"
|
||||
};
|
||||
|
||||
static const char * const
|
||||
_uErrorName[U_STANDARD_ERROR_LIMIT]={
|
||||
"U_ZERO_ERROR",
|
||||
|
||||
"U_ILLEGAL_ARGUMENT_ERROR",
|
||||
"U_MISSING_RESOURCE_ERROR",
|
||||
"U_INVALID_FORMAT_ERROR",
|
||||
"U_FILE_ACCESS_ERROR",
|
||||
"U_INTERNAL_PROGRAM_ERROR",
|
||||
"U_MESSAGE_PARSE_ERROR",
|
||||
"U_MEMORY_ALLOCATION_ERROR",
|
||||
"U_INDEX_OUTOFBOUNDS_ERROR",
|
||||
"U_PARSE_ERROR",
|
||||
"U_INVALID_CHAR_FOUND",
|
||||
"U_TRUNCATED_CHAR_FOUND",
|
||||
"U_ILLEGAL_CHAR_FOUND",
|
||||
"U_INVALID_TABLE_FORMAT",
|
||||
"U_INVALID_TABLE_FILE",
|
||||
"U_BUFFER_OVERFLOW_ERROR",
|
||||
"U_UNSUPPORTED_ERROR",
|
||||
"U_RESOURCE_TYPE_MISMATCH",
|
||||
"U_ILLEGAL_ESCAPE_SEQUENCE",
|
||||
"U_UNSUPPORTED_ESCAPE_SEQUENCE",
|
||||
"U_NO_SPACE_AVAILABLE",
|
||||
"U_CE_NOT_FOUND_ERROR",
|
||||
"U_PRIMARY_TOO_LONG_ERROR",
|
||||
"U_STATE_TOO_OLD_ERROR",
|
||||
"U_TOO_MANY_ALIASES_ERROR",
|
||||
"U_ENUM_OUT_OF_SYNC_ERROR",
|
||||
"U_INVARIANT_CONVERSION_ERROR",
|
||||
"U_INVALID_STATE_ERROR",
|
||||
"U_COLLATOR_VERSION_MISMATCH",
|
||||
"U_USELESS_COLLATOR_ERROR",
|
||||
"U_NO_WRITE_PERMISSION"
|
||||
};
|
||||
static const char * const
|
||||
_uFmtErrorName[U_FMT_PARSE_ERROR_LIMIT - U_FMT_PARSE_ERROR_START] = {
|
||||
"U_UNEXPECTED_TOKEN",
|
||||
"U_MULTIPLE_DECIMAL_SEPARATORS",
|
||||
"U_MULTIPLE_EXPONENTIAL_SYMBOLS",
|
||||
"U_MALFORMED_EXPONENTIAL_PATTERN",
|
||||
"U_MULTIPLE_PERCENT_SYMBOLS",
|
||||
"U_MULTIPLE_PERMILL_SYMBOLS",
|
||||
"U_MULTIPLE_PAD_SPECIFIERS",
|
||||
"U_PATTERN_SYNTAX_ERROR",
|
||||
"U_ILLEGAL_PAD_POSITION",
|
||||
"U_UNMATCHED_BRACES",
|
||||
"U_UNSUPPORTED_PROPERTY",
|
||||
"U_UNSUPPORTED_ATTRIBUTE",
|
||||
"U_ARGUMENT_TYPE_MISMATCH",
|
||||
"U_DUPLICATE_KEYWORD",
|
||||
"U_UNDEFINED_KEYWORD",
|
||||
"U_DEFAULT_KEYWORD_MISSING",
|
||||
"U_DECIMAL_NUMBER_SYNTAX_ERROR",
|
||||
"U_FORMAT_INEXACT_ERROR",
|
||||
"U_NUMBER_ARG_OUTOFBOUNDS_ERROR"
|
||||
};
|
||||
|
||||
static const char * const
|
||||
_uBrkErrorName[U_BRK_ERROR_LIMIT - U_BRK_ERROR_START] = {
|
||||
"U_BRK_INTERNAL_ERROR",
|
||||
"U_BRK_HEX_DIGITS_EXPECTED",
|
||||
"U_BRK_SEMICOLON_EXPECTED",
|
||||
"U_BRK_RULE_SYNTAX",
|
||||
"U_BRK_UNCLOSED_SET",
|
||||
"U_BRK_ASSIGN_ERROR",
|
||||
"U_BRK_VARIABLE_REDFINITION",
|
||||
"U_BRK_MISMATCHED_PAREN",
|
||||
"U_BRK_NEW_LINE_IN_QUOTED_STRING",
|
||||
"U_BRK_UNDEFINED_VARIABLE",
|
||||
"U_BRK_INIT_ERROR",
|
||||
"U_BRK_RULE_EMPTY_SET",
|
||||
"U_BRK_UNRECOGNIZED_OPTION",
|
||||
"U_BRK_MALFORMED_RULE_TAG"
|
||||
};
|
||||
|
||||
static const char * const
|
||||
_uRegexErrorName[U_REGEX_ERROR_LIMIT - U_REGEX_ERROR_START] = {
|
||||
"U_REGEX_INTERNAL_ERROR",
|
||||
"U_REGEX_RULE_SYNTAX",
|
||||
"U_REGEX_INVALID_STATE",
|
||||
"U_REGEX_BAD_ESCAPE_SEQUENCE",
|
||||
"U_REGEX_PROPERTY_SYNTAX",
|
||||
"U_REGEX_UNIMPLEMENTED",
|
||||
"U_REGEX_MISMATCHED_PAREN",
|
||||
"U_REGEX_NUMBER_TOO_BIG",
|
||||
"U_REGEX_BAD_INTERVAL",
|
||||
"U_REGEX_MAX_LT_MIN",
|
||||
"U_REGEX_INVALID_BACK_REF",
|
||||
"U_REGEX_INVALID_FLAG",
|
||||
"U_REGEX_LOOK_BEHIND_LIMIT",
|
||||
"U_REGEX_SET_CONTAINS_STRING",
|
||||
"U_REGEX_OCTAL_TOO_BIG",
|
||||
"U_REGEX_MISSING_CLOSE_BRACKET",
|
||||
"U_REGEX_INVALID_RANGE",
|
||||
"U_REGEX_STACK_OVERFLOW",
|
||||
"U_REGEX_TIME_OUT",
|
||||
"U_REGEX_STOPPED_BY_CALLER",
|
||||
"U_REGEX_PATTERN_TOO_BIG",
|
||||
"U_REGEX_INVALID_CAPTURE_GROUP_NAME"
|
||||
};
|
||||
|
||||
static const char * const
|
||||
_uIDNAErrorName[U_IDNA_ERROR_LIMIT - U_IDNA_ERROR_START] = {
|
||||
"U_STRINGPREP_PROHIBITED_ERROR",
|
||||
"U_STRINGPREP_UNASSIGNED_ERROR",
|
||||
"U_STRINGPREP_CHECK_BIDI_ERROR",
|
||||
"U_IDNA_STD3_ASCII_RULES_ERROR",
|
||||
"U_IDNA_ACE_PREFIX_ERROR",
|
||||
"U_IDNA_VERIFICATION_ERROR",
|
||||
"U_IDNA_LABEL_TOO_LONG_ERROR",
|
||||
"U_IDNA_ZERO_LENGTH_LABEL_ERROR",
|
||||
"U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR"
|
||||
};
|
||||
|
||||
static const char * const
|
||||
_uPluginErrorName[U_PLUGIN_ERROR_LIMIT - U_PLUGIN_ERROR_START] = {
|
||||
"U_PLUGIN_TOO_HIGH",
|
||||
"U_PLUGIN_DIDNT_SET_LEVEL",
|
||||
};
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
u_errorName(UErrorCode code) {
|
||||
if(U_ZERO_ERROR <= code && code < U_STANDARD_ERROR_LIMIT) {
|
||||
return _uErrorName[code];
|
||||
} else if(U_ERROR_WARNING_START <= code && code < U_ERROR_WARNING_LIMIT) {
|
||||
return _uErrorInfoName[code - U_ERROR_WARNING_START];
|
||||
} else if(U_PARSE_ERROR_START <= code && code < U_PARSE_ERROR_LIMIT){
|
||||
return _uTransErrorName[code - U_PARSE_ERROR_START];
|
||||
} else if(U_FMT_PARSE_ERROR_START <= code && code < U_FMT_PARSE_ERROR_LIMIT){
|
||||
return _uFmtErrorName[code - U_FMT_PARSE_ERROR_START];
|
||||
} else if (U_BRK_ERROR_START <= code && code < U_BRK_ERROR_LIMIT){
|
||||
return _uBrkErrorName[code - U_BRK_ERROR_START];
|
||||
} else if (U_REGEX_ERROR_START <= code && code < U_REGEX_ERROR_LIMIT) {
|
||||
return _uRegexErrorName[code - U_REGEX_ERROR_START];
|
||||
} else if(U_IDNA_ERROR_START <= code && code < U_IDNA_ERROR_LIMIT) {
|
||||
return _uIDNAErrorName[code - U_IDNA_ERROR_START];
|
||||
} else if(U_PLUGIN_ERROR_START <= code && code < U_PLUGIN_ERROR_LIMIT) {
|
||||
return _uPluginErrorName[code - U_PLUGIN_ERROR_START];
|
||||
} else {
|
||||
return "[BOGUS UErrorCode]";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
*
|
||||
* Local Variables:
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
*/
|
||||
Reference in New Issue
Block a user