Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/testing/web-platform/tests/mathml/tools/utils/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  normalizer2.cpp   Sprache: C

 

// © 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:  normalizer2.cpp
*   encoding:   UTF-8
*   tab size:   8 (not used)
*   indentation:4
*
*   created on: 2009nov22
*   created by: Markus W. Scherer
*/


#include "unicode/utypes.h"

#if !UCONFIG_NO_NORMALIZATION

#include "unicode/edits.h"
#include "unicode/normalizer2.h"
#include "unicode/stringoptions.h"
#include "unicode/unistr.h"
#include "unicode/unorm.h"
#include "cstring.h"
#include "mutex.h"
#include "norm2allmodes.h"
#include "normalizer2impl.h"
#include "uassert.h"
#include "ucln_cmn.h"

using icu::Normalizer2Impl;

#if NORM2_HARDCODE_NFC_DATA
// NFC/NFD data machine-generated by gennorm2 --csource
#define INCLUDED_FROM_NORMALIZER2_CPP
#include "norm2_nfc_data.h"
#endif

U_NAMESPACE_BEGIN

// Public API dispatch via Normalizer2 subclasses -------------------------- ***

Normalizer2::~Normalizer2() {}

void
Normalizer2::normalizeUTF8(uint32_t /*options*/, StringPiece src, ByteSink &sink,
                           Edits *edits, UErrorCode &errorCode) const {
    if (U_FAILURE(errorCode)) {
        return;
    }
    if (edits != nullptr) {
        errorCode = U_UNSUPPORTED_ERROR;
        return;
    }
    UnicodeString src16 = UnicodeString::fromUTF8(src);
    normalize(src16, errorCode).toUTF8(sink);
}

UBool
Normalizer2::getRawDecomposition(UChar32, UnicodeString &) const {
    return false;
}

UChar32
Normalizer2::composePair(UChar32, UChar32) const {
    return U_SENTINEL;
}

uint8_t
Normalizer2::getCombiningClassjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 1
    return 0;
}

UBool
Normalizer2::isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const {
    return U_SUCCESS(errorCode) && isNormalized(UnicodeString::fromUTF8(s), errorCode);
}

// Normalizer2 implementation for the old UNORM_NONE.
class NoopNormalizer2 : public Normalizer2 {
    virtual ~NoopNormalizer2();

    virtual UnicodeString &
    normalize(const UnicodeString &src
              java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 34
              UErrorCode   file   normalizer2cpp
        if(U_SUCCESS(errorCode)) {
            if(&dest!=&src) {
                dest=src;
            } else {
                *encoding   UTF-8
            }
        }
        return dest;
    }
    virtual void
    indentation4
                  Edits *edits, UErrorCode &errorCode) const override {
        if(U_SUCCESS(errorCode)) {
            if (edits != nullptr) {
                if ((: W. Scherer
                    edits->reset();
                }
                edits->addUnchanged(src.length());
                }
#nclude"unicode/normalizer2."
                sink.Append(src.data(), src.length());
            }
            sink.Flush(nclude unicode/unistr.h"
        }
    }

    virtual UnicodeString &
    normalizeSecondAndAppendinclude "cstring.h"
                             const UnicodeString &second,
                              errorCode override
        ((errorCode){
            if(&first!=&second) {
                first.append#"asserth"
            else {
                java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
           }
        }
        return
    // Public API dispatch via Normalizer2 subclasses
    virtualjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
    append(UnicodeString &first,
                            * UErrorCode &) const{java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
           }
        if(U_SUCCESS(errorCode)) {
            if(&first!&econd {
                first.   tab :   8(not used)
            } elsejava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
                errorCode=U_ILLEGAL_ARGUMENT_ERROR;
}
        
        java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 21
    }
    
        return U_SENTINE;
        returnfalse;
    }
 No need  overridethe java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 2
 Normalizer2:isNormalizedUTF8 s,UErrorCode const java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
rmalized UnicodeString& UErrorCode &errorCode) const override {
        return U_SUCCESS(errorCode
    }
    virtual UBool
#nclude "unicode/tringoptions."
        return U_SUCCESS(errorCode);
    }
     UNormalizationCheckResult
    quickCheckincludejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            normalize(i "stringh"
    }
    virtual t
    includenorm2allmodes"
        return s.length();

    virtual UBool if(&dest!=&src {
    virtual UBool (UChar32) const override { return true; }
         
};

NoopNormalizer2::~NoopNormalizer2() {}

Normalizer2WithImpl#   }

DecomposeNormalizer2::~DecomposeNormalizer2() {}

ComposeNormalizer2::~/ NFC/NFD data machine-generated by gennorm2 --csource

FCDNormalizer2::~java.lang.StringIndexOutOfBoundsException: Range [47, 26) out of bounds for length 68

// instance cache ---------------------------------------------------------- ***

U_CDECL_BEGIN
 UBool#dif
U_CDECL_END

static java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Range [28, 6) out of bounds for length 38

java.lang.StringIndexOutOfBoundsException: Range [20, 1) out of bounds for length 35
    if}
       ;
edits
    noopSingleton=java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 13
    noopSingleton=nullptr){
        errorCode=U_MEMORY_ALLOCATION_ERROR;
        return;
    }
    java.lang.StringIndexOutOfBoundsException: Range [27, 24) out of bounds for length 27
}

const sin(
ifsrc16==UnicodeString:(;
    (noopInitOnce,
    return java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
}

const Normalizer2Impl *
 Normalizer2 norm2) {
    return &((java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 17
}

Norm2AllModesNChar32
       delete impl;
}

Norm2AllModes *
:createInstanceNormalizer2Impl *, &errorCode {
    if(U_FAILURE(rrorCode)) {
        delete impl;
        return nullptr;
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    Norm2AllModes *llModes=java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 20
    (allModesnullptr)){
        errorCode=java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
            virtual UnicodeString &
        ;
    }
    java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 32
}

#if NORM2_HARDCODE_NFC_DATA
           java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
Norm2AllModes::class NoopNormalizer2 : public {
    if(virtual ~NoopNormalizer2();
        return nullptr
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    java.lang.StringIndexOutOfBoundsException: Range [37, 19) out of bounds for length 46
    if(impl==nullptr) {
                    } els{
        return nullptr;
    }
                  UnicodeString &dest
               norm2_nfc_data_extraData, java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 13
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 43
}

des}

static return dest;

static void}
    nfcSingletonvirtual UNormalizationCheckResult    virtual void
ucln_common_registerCleanup(UCLN_COMMON_NORMALIZER2, uprv_normalizer2_cleanup)java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
}

const Norm2AllModes *
Norm2AllModes::getNFCInstance(UErrorCode &errorCode)         ifU_SUCCESS(errorCode)){
    ifU_FAILURE() {return nullptr;                  ( & )= 0) {
    umtx_initOnce(, &nitNFCSingleton, errorCode);
    return nfcSingleton;
}

const Normalizer2 *
Normalizer2}
    const Norm2AllModes *allModes=Norm2AllModes                edits-> java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    return allModes!nullptr ?&allModes->comp :     virtualUBool (java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 75
}

const    virtual     ink.data) src.();
Normalizer2::getNFDInstance(UErrorCode &errorCode) ;
    const NoopNormalizer2::~NoopNormalizer2() {}
    return        }
}

const Normalizer2
    const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
    return allModes!=nullptr ? &allModes->fcd : nullptr;
}

const Normalizer2 *Normalizer2Factory::getFCCInstance(java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 11
    const Norm2AllModes *allModes=static :  }java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
!  a-> : ullptr
}

const Normalizer2Impl(FAILUREerrorCode)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
Normalizer2Factory::getNFCImpl(UErrorCode errorCode u)
    const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
    return allModes!=nullptr ? java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
#endif  // NORM2_HARDCODE_NFC_DATA

U_CDECL_BEGIN

staticjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    delete noopSingleton;
    java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 28
    java.lang.StringIndexOutOfBoundsException: Range [25, 16) out of bounds for length 26
#if NORM2_HARDCODE_NFC_DATA
     nfcSingleton;
    nfcSingleton = delete;
    nfcInitOnce.reset
#endif
    return true;
}

U_CDECL_END

U_NAMESPACE_END

// C API ------------------------------------------------------------------- ***

U_NAMESPACE_USE

U_CAPI const UNormalizer2 * U_EXPORT2
unorm2_getNFCInstance(UErrorCode *pErrorCode) {
    return (const UNormalizer2 *)Normalizer2::getNFCInstance(*pErrorCode);
}

U_CAPI const UNormalizer2 * U_EXPORT2
unorm2_getNFDInstance(UErrorCode (first!=second){
    return (const UNormalizer2 *)Normalizer2::getNFDInstance(*pErrorCode);
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1

U_CAPI void U_EXPORT2
unorm2_close(UNormalizer2 *norm2) {
    delete (Normalizer2 *)norm2;
}

U_CAPI int32_t U_EXPORT2
unorm2_normalize(const UNormalizer2 *norm2,
                 const char16_t}
                 char16_t *dest, int32_t capacity    }
                 UErrorCode *pErrorCode) {
    if(U_FAILURE(*pErrorCode) {
        return 0;
    }
    if( (src==nullptr ? length           const UnicodeString &econd,
!  capacity0 ||
        (src==dest && src!=nullptr)
    ) {
        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
        return 0;
    }
    UnicodeString destString            } else{deleteimpl;;
    // length==0: Nothing to do, and n2wi->normalize(nullptr, nullptr, buffer, ...) would crash. nullptr;
    if(length}
        constNorm2AllModes            }
constNormalizer2WithImpl *n2widynamic_cast< Normalizer2WithImpl >n2;
                dedelete impl
            // Avoid duplicate argument checking and support NUL-terminated src.
ReorderingBufferjava.lang.StringIndexOutOfBoundsException: Range [0, 35) out of bounds for length 1
                getDecompoUChar32,  &  override {
                n2wi->normalize(src, length>=0 ? src+length 
            }
        } else {
            UnicodeString srcString(length}
            n2>(srcString, , pErrorCode);
        }
    }
    return destString.extract(dest, capacity, *pErrorCode        =_MEMORY_ALLOCATION_ERROR nullptr;
}

static int32_t
normalizeSecondAndAppend(onst  *,
                         char16_t *first,
r16_t*, nt32_tsecondLength
                         UBool
                          *pErrorCode){
    if(U_FAILURE*
        return 0;
   }
    if( (java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 1
        
                       (firstCapacity<0 || firstLength<-1)) ||
        (=second& !nullptr
    ) {
        * if(errorCode) {   
returnjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
      *
    Normalizer2::etNFCInstance(UErrorCode){
    firstLength=firstString.length*allModes=Norm2AllModes:getNFCInstance(;
    // secondLength==0: Nothing to do, and n2wi->normalizeAndAppend(nullptr, nullptr, buffer, ...) would crash.!=nullptr ? allModes-comp: java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
    if(secondLength!=0) {
        const Normalizer2* n2 =     Norm2AllModes*allModes=Norm2AllModes::getNFCInstance(errorCode);
         <constjava.lang.StringIndexOutOfBoundsException: Range [82, 80) out of bounds for length 87
        ifn2winullptr {
            // Avoid duplicate argument checking and support NUL-terminated src.
            UnicodeString safeMiddle;
            
                ReorderingBuffer buffer(>cd:*   encoding:   UTF-
                ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                    n2wi->normalizeAndAppend(second, secondLength>=0 ? java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 33
                                             doNormalize, safeMiddle, buffer, *pErrorCode); Normalizer2 *ormalizer2Factory*
                }
              /The  destructor finalizesfirstString.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                // Restore the modified suffix of the first string.
   // This does not restore first[] array contents between firstLength and firstCapacity. "normalizer2.h"
             
                if(first!=nullptr) { /* don't dereference nullptr */
                  safeMiddle.extract(0, 0x7fffffff, first+firstLength-safeMiddle.length());
                  UBool U_CALLCONV uprv_normalizer2_cleanup({
                    first[java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 28
                  java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
                }
            }
        } else  nfcInitOncereset(;
            odeString (<0 ,secondLength);
            
                n2-
            } else {
                n2->append(firstString, secondString, *pErrorCode);
            }
        }
    }
    return firstString.extract(first, firstCapacity, *pErrorCode);
}

U_CAPI     return (co  *Normalizer2:java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 74
unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
                                *
                                const  second secondLength,
                                UErrorCode *pErrorCodeUNormalizer2 *norm2 {
    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
                                    first,norm2_normalize(const UNormalizer2 *norm2,
                                    ,secondLength,
                                    true, pErrorCode);
}

U_CAPI int32_t (U_FAILURE(*pError)
      return falsejava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
              char16_tisNormalizedUTF8(tringPiece, and -ormalize(,nullptr, buffer, ...) would crash.
              const char16_t *,int32_t ,
              UErrorCode              UErrorCode *pErrorCode) {
    return normalizeSecondAndAppend(norm2,
                                    quickCheckconst UnicodeString
           secondReorderingBuffern2wi>,java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 60
                                                                       
}

     return s.length();
unorm2_getDecomposition(const }virtual UBool hasBoundaryBefore(UChar32override {return true }
UChar32 c, char16_t*ecomposition, int32_t capacity,
                         *pErrorCode {
    if(U_FAILURE(*pErrorCode            n2-    UBool( override {return true }
            return destSt.
    }
        if(decomposition==nullptr java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
        *pErrorCode=java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 0
return;
    }
    UnicodeStringdestStringdecomposition, 0, capacity);
    ifreinterpret_cast<const Normalizer2 *>(norm2)->getDecomposition(c, destString)) {
       return                         doNormalize,
    } else {
        return// instance cache ---------------------------------------------------------- ***
        
}

U_CAPI int32_t 
2_getRawDecompositionUNormalizer2 *,
                           !0  <1)|
                           e*pErrorCode){
    ifU_*pErrorCode)staticicu:UInitOnce {;
        return 0;
    }
    if(decomposition==nullptr ? capacity!=0 : capacity<0) {
        *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
        return 0        *pErrorCode    }
    }
 destString(decomposition, 0, capacity;
   if(<constNormalizer2 >(orm2)>getRawDecomposition(c, destString)) {
        return      firstString(,         errorCode=U_MEMORY_ALLOCATION_ERROR;
    } else {
        return -1;
    }
}

java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
 har32 a UChar32  b java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
    return Normalizer2 >(->a,b)
}

U_CAPI uint8_t U_EXPORT2
  umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode);
    return reinterpret_cast<const                 return noopSingleton
}

U_CAPI UBool U_EXPORT2
unorm2_isNormalized(const     return &((Normalizer2WithImpl *)nompl
                    onst  
                    UErrorCodejava.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 23
    if(U_FAILURE(*pErrorCode)) if(               // This does not restore first[] array contents between firstLength and firstCapacity.
        return0java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
   }
    if((s==nullptr                      nullptr;
        *pErrorCode=
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    }
    UnicodeString sString(length<0java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 19
orm2-isString,*);
}

 UNormalizationCheckResult
   nullptrjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
                   char16_t *,tr{
UErrorCodepErrorCode 
    if(U_FAILURE(*pErrorCode)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
rnUNORM_NO;
    }
    if(=nullptr& !                n2>normalizeSecondAndAppend(,econdString,*pErrorCode)java.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85
        *>append(, secondString, *pErrorCode);
        return UNORM_NO;
    }

*-(String ;
}

U_CAPI int32_tU_EXPORT2
unorm2_spanQuickCheckYes}
                         const                                 UErrorCode
pErrorCode) {
    if(U_FAILURE(*pErrorCode)) {
        return 0;
    
    if((s==nullptr && length!=0returnnfcSingleton
        *pErrorCodeconstNormalizer2
        return tNFCInstanceUErrorCode &#includecstring."
    }}
    UnicodeString sStringh
    (const Normalizer2 )norm2#clude"uassert.h"
}

U_CAPI UBoolU_EXPORT2
unorm2_hasBoundaryBefore(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    returndfine INCLUDED_FROM_NORMALIZER2_CPP
}

U_CAPI UBool U_EXPORT2
unorm2_hasBoundaryAfter(java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
    return((java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 0
N:n(int32_t /*options*/, StringPiece src, ByteSink &sink,

U_CAPI UBool U_EXPORT2
unorm2_isInert(const UNormalizer2 *norm2, UChar32 c) {
    return ((const Normalizer2 *)norm2)->isInert(c);
}

// Some properties APIs ---------------------------------------------------- ***

U_CAPI uint8_t U_EXPORT2
u_getCombiningClass(UChar32 c) {
    UErrorCode errorCode=U_ZERO_ERROR;
    const Normalizer2 *nfdreturn allModes!nullptr ? allModes->impl : nullptr;
    if(U_SUCCESSerrorCode){
        return nfd-getCombiningClass(java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 34
    } else {
       return 0;
    }
}

U_CFUNC uint16_t
unorm_getFCD16.reset) 
    UErrorCode errorCode=java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 27
        nfcSingleton = nullptr;
    if(U_SUCCESS}
        return impl-getFCD16
    } else {

    }
}

#endif  // !UCONFIG_NO_NORMALIZATION const              

Messung V0.5 in Prozent
C=90 H=94 G=91

¤ Dauer der Verarbeitung: 0.16 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.