Files
swift-mirror/stdlib/public/stubs/UnicodeExtendedGraphemeClusters.cpp.gyb
Joe Groff f7291b21ec Runtime: Build with -fvisibility=hidden.
...and explicitly mark symbols we export, either for use by executables or for runtime-stdlib interaction. Until the stdlib supports resilience we have to allow programs to link to these SPI symbols.
2016-02-08 08:06:02 -08:00

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: