mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The repo contains roughly 80 Python scripts. "snake_case" naming is used for local variables in all those scripts. This is the form recommended by the PEP 8 naming recommendations (Python Software Foundation) and typically associated with idiomatic Python code. However, in nine of the 80 scripts there were at least one instance of "camelCase" naming prior to this commit. This commit improves consistency in the Python code base by making sure that these nine remaining files follow the variable naming convention used for Python code in the project. References: * PEP 8: https://www.python.org/dev/peps/pep-0008/ * pep8-naming: https://pypi.python.org/pypi/pep8-naming
141 lines
4.5 KiB
C++
141 lines
4.5 KiB
C++
//===--- UnicodeExtendedGraphemeClusters.cpp.gyb ----------------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See http://swift.org/LICENSE.txt for license information
|
|
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "swift/Runtime/Config.h"
|
|
|
|
%{
|
|
|
|
# FIXME: this table should be moved to a Swift file in stdlib. Unfortunately,
|
|
# in Swift we don't have a way to statically initialize arrays.
|
|
|
|
from GYBUnicodeDataUtils import GraphemeClusterBreakPropertyTable, UnicodeTrieGenerator, get_extended_grapheme_cluster_rules_matrix
|
|
|
|
grapheme_cluster_break_property_table = \
|
|
GraphemeClusterBreakPropertyTable(unicodeGraphemeBreakPropertyFile)
|
|
|
|
trie_generator = UnicodeTrieGenerator()
|
|
trie_generator.create_tables()
|
|
trie_generator.fill_from_unicode_property(grapheme_cluster_break_property_table)
|
|
trie_generator.verify(grapheme_cluster_break_property_table)
|
|
|
|
}%
|
|
|
|
/// Before compression:
|
|
/// bmp_lookup: ${len(trie_generator.bmp_lookup)}
|
|
/// bmp_data: ${len(trie_generator.bmp_data)} x ${len(trie_generator.bmp_data[0])}
|
|
/// supp_lookup1: ${len(trie_generator.supp_lookup1)}
|
|
/// supp_lookup2: ${len(trie_generator.supp_lookup2)} x ${len(trie_generator.supp_lookup2[0])}
|
|
/// supp_data: ${len(trie_generator.supp_data)} x ${len(trie_generator.supp_data[0])}
|
|
|
|
%{
|
|
|
|
trie_generator.freeze()
|
|
trie_generator.verify(grapheme_cluster_break_property_table)
|
|
|
|
}%
|
|
|
|
/// After compression:
|
|
/// bmp_lookup: ${len(trie_generator.bmp_lookup)}
|
|
/// bmp_data: ${len(trie_generator.bmp_data)} x ${len(trie_generator.bmp_data[0])}
|
|
/// supp_lookup1: ${len(trie_generator.supp_lookup1)}
|
|
/// supp_lookup2: ${len(trie_generator.supp_lookup2)} x ${len(trie_generator.supp_lookup2[0])}
|
|
/// supp_data: ${len(trie_generator.supp_data)} x ${len(trie_generator.supp_data[0])}
|
|
|
|
%{
|
|
|
|
trie_generator.serialize(grapheme_cluster_break_property_table)
|
|
|
|
}%
|
|
|
|
#include <stdint.h>
|
|
|
|
SWIFT_RUNTIME_STDLIB_INTERFACE
|
|
const uint8_t _swift_stdlib_GraphemeClusterBreakPropertyTrieImpl[] = {
|
|
% for byte in trie_generator.trie_bytes:
|
|
${byte},
|
|
% end
|
|
};
|
|
|
|
SWIFT_RUNTIME_STDLIB_INTERFACE
|
|
extern "C"
|
|
const uint8_t *_swift_stdlib_GraphemeClusterBreakPropertyTrie =
|
|
_swift_stdlib_GraphemeClusterBreakPropertyTrieImpl;
|
|
|
|
struct _swift_stdlib_GraphemeClusterBreakPropertyTrieMetadataTy {
|
|
unsigned BMPFirstLevelIndexBits;
|
|
unsigned BMPDataOffsetBits;
|
|
unsigned SuppFirstLevelIndexBits;
|
|
unsigned SuppSecondLevelIndexBits;
|
|
unsigned SuppDataOffsetBits;
|
|
|
|
unsigned BMPLookupBytesPerEntry;
|
|
unsigned BMPDataBytesPerEntry;
|
|
unsigned SuppLookup1BytesPerEntry;
|
|
unsigned SuppLookup2BytesPerEntry;
|
|
unsigned SuppDataBytesPerEntry;
|
|
|
|
unsigned TrieSize;
|
|
|
|
unsigned BMPLookupBytesOffset;
|
|
unsigned BMPDataBytesOffset;
|
|
unsigned SuppLookup1BytesOffset;
|
|
unsigned SuppLookup2BytesOffset;
|
|
unsigned SuppDataBytesOffset;
|
|
};
|
|
|
|
SWIFT_RUNTIME_STDLIB_INTERFACE
|
|
extern "C" const struct _swift_stdlib_GraphemeClusterBreakPropertyTrieMetadataTy
|
|
_swift_stdlib_GraphemeClusterBreakPropertyTrieMetadata = {
|
|
${trie_generator.bmp_first_level_index_bits},
|
|
${trie_generator.bmp_data_offset_bits},
|
|
${trie_generator.supp_first_level_index_bits},
|
|
${trie_generator.supp_second_level_index_bits},
|
|
${trie_generator.supp_data_offset_bits},
|
|
|
|
${trie_generator.bmp_lookup_bytes_per_entry},
|
|
${trie_generator.bmp_data_bytes_per_entry},
|
|
${trie_generator.supp_lookup1_bytes_per_entry},
|
|
${trie_generator.supp_lookup2_bytes_per_entry},
|
|
${trie_generator.supp_data_bytes_per_entry},
|
|
|
|
${len(trie_generator.trie_bytes)},
|
|
|
|
${trie_generator.bmp_lookup_bytes_offset},
|
|
${trie_generator.bmp_data_bytes_offset},
|
|
${trie_generator.supp_lookup1_bytes_offset},
|
|
${trie_generator.supp_lookup2_bytes_offset},
|
|
${trie_generator.supp_data_bytes_offset},
|
|
};
|
|
|
|
%{
|
|
|
|
extended_grapheme_cluster_rules_matrix = \
|
|
get_extended_grapheme_cluster_rules_matrix(grapheme_cluster_break_property_table)
|
|
|
|
}%
|
|
|
|
|
|
SWIFT_RUNTIME_STDLIB_INTERFACE
|
|
const uint16_t _swift_stdlib_ExtendedGraphemeClusterNoBoundaryRulesMatrixImpl[] = {
|
|
% for row in get_extended_grapheme_cluster_rules_matrix(grapheme_cluster_break_property_table):
|
|
${row},
|
|
% end
|
|
};
|
|
|
|
SWIFT_RUNTIME_STDLIB_INTERFACE
|
|
const uint16_t *_swift_stdlib_ExtendedGraphemeClusterNoBoundaryRulesMatrix =
|
|
_swift_stdlib_ExtendedGraphemeClusterNoBoundaryRulesMatrixImpl;
|
|
|
|
// ${'Local Variables'}:
|
|
// eval: (read-only-mode 1)
|
|
// End:
|