]> granicus.if.org Git - icu/commitdiff
ICU-21117 Use Bazel to automate generation of Unicode data files
authorElango Cheran <elango@unicode.org>
Sun, 6 Dec 2020 20:24:03 +0000 (12:24 -0800)
committerElango <elango@google.com>
Wed, 24 Mar 2021 17:39:38 +0000 (10:39 -0700)
18 files changed:
.bazeliskrc [new file with mode: 0644]
.gitignore
WORKSPACE [new file with mode: 0644]
icu4c/source/common/BUILD [new file with mode: 0644]
icu4c/source/data/unidata/changes.txt
icu4c/source/data/unidata/clean.sh [new file with mode: 0644]
icu4c/source/data/unidata/generate.sh [new file with mode: 0644]
icu4c/source/data/unidata/norm2/BUILD [new file with mode: 0644]
icu4c/source/tools/gennorm2/BUILD [new file with mode: 0644]
icu4c/source/tools/toolutil/BUILD [new file with mode: 0644]
icu4c/source/tools/toolutil/toolutil.cpp
tools/unicode/c/genprops/BUILD [new file with mode: 0644]
tools/unicode/c/genprops/bidipropsbuilder.cpp
tools/unicode/c/genprops/casepropsbuilder.cpp
tools/unicode/c/genprops/corepropsbuilder.cpp
tools/unicode/c/genprops/genprops.cpp
tools/unicode/c/genprops/namespropsbuilder.cpp
tools/unicode/c/genprops/pnamesbuilder.cpp

diff --git a/.bazeliskrc b/.bazeliskrc
new file mode 100644 (file)
index 0000000..7f64ba6
--- /dev/null
@@ -0,0 +1,9 @@
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# .bazeliskrc is the configuration file for the wrapper program for the Bazel
+# build system, called Bazelisk. Bazelisk can be used as a drop-in replacement
+# for running Bazel commands while ensuring, through configuration, that only a
+# specific version of Bazel is executed.
+
+USE_BAZEL_VERSION=3.7.1
index 4efac556dfef66d84073fbdc8809882a6f1f3d53..626facc5f0ec85e2319f7eaf2d7c7650eb478ee5 100644 (file)
@@ -32,6 +32,7 @@
 *.vcxproj.user
 *_debug
 *_release
+bazel-*
 cygicudata*
 libicu*
 libicutest*
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644 (file)
index 0000000..dbaa177
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,5 @@
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This file tells Bazel where the root directory of the project is.
+# "Target" and file paths in Bazel BUILD files are relative to this root directory.
diff --git a/icu4c/source/common/BUILD b/icu4c/source/common/BUILD
new file mode 100644 (file)
index 0000000..51c0ad4
--- /dev/null
@@ -0,0 +1,356 @@
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This file defines Bazel targets for a subset of ICU4C "common" library header and source files.
+# The configuration of dependencies among targets is strongly assisted by the
+# file in depstest that maintains such information, at
+# icu4c/source/test/depstest/dependencies.txt .
+
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+# When compiling code in the `common` dir, the constant
+# `U_COMMON_IMPLEMENTATION` needs to be defined. See 
+# https://unicode-org.github.io/icu/userguide/howtouseicu#c-with-your-own-build-system .
+
+# If linker errors occur, then this may be a sign that the dependencies were 
+# not specified correctly. Use dependencies.txt in depstest for assistance. See
+# https://stackoverflow.com/q/66111709/2077918 .
+
+cc_library(
+    name = "headers",
+    hdrs = glob([
+        "unicode/*.h", # public
+        "*.h",         # internal
+        ],
+        # Instead of using this checked-in file, our Bazel build process
+        # regenerates this file and then uses the new version.
+        exclude = ["norm2_nfc_data.h"],
+    ),
+    # We need to add includes in order to preserve existing source files'
+    # include directives that use traditional paths, not paths relative to
+    # Bazel workspace:
+    # https://stackoverflow.com/a/65635893/2077918
+    includes = ["."],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "platform",
+    srcs = [
+        "cmemory.cpp", 
+        "uobject.cpp",
+        "cstring.cpp",
+        "cwchar.cpp",
+        "uinvchar.cpp",
+        "charstr.cpp",
+        "unistr.cpp",
+        "appendable.cpp",
+        "stringpiece.cpp",
+        "ustrtrns.cpp",
+        "ustring.cpp",  
+        "ustrfmt.cpp",  
+        "utf_impl.cpp",
+        "putil.cpp",
+        "ucln_cmn.cpp",  
+        "udataswp.cpp",  
+        "umath.cpp",
+        "umutex.cpp",
+        "sharedobject.cpp",
+        "utrace.cpp",
+    ],
+    deps = [
+        ":headers",
+        # omit other deps b/c they are sys symbols
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+    linkopts = ["-ldl"],
+)
+
+cc_library(
+    name = "utrie",
+    srcs = ["utrie.cpp"],
+    deps = [":platform"],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "utrie2",
+    srcs = ["utrie2.cpp"],
+    deps = [":platform"],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "utrie2_builder",
+    srcs = ["utrie2_builder.cpp"],
+    deps = [
+        ":utrie",
+        ":utrie2",
+        ":platform",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "ucptrie",
+    srcs = ["ucptrie.cpp"],
+    deps = [":platform"],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "umutablecptrie",
+    srcs = ["umutablecptrie.cpp"],
+    deps = [":ucptrie"],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "bytestrie",
+    srcs = ["bytestrie.cpp"],
+    deps = [":platform"],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "bytestriebuilder",
+    srcs = ["bytestriebuilder.cpp"],
+    deps = [
+        ":bytestrie",
+        ":stringtriebuilder",
+        ":sort",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "stringtriebuilder",
+    srcs = ["stringtriebuilder.cpp"],
+    deps = [
+        ":uhash",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "uhash",
+    hdrs = [
+        "uhash.h",
+    ],
+    srcs = [
+        "uhash.cpp",
+    ],
+    deps = [
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "errorcode",
+    hdrs = [
+    ],
+    srcs = [
+        "errorcode.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":platform",
+        ":utypes",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "utypes",
+    srcs = [
+        "utypes.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "uniset",
+    srcs = [
+        "uniset.cpp",
+        "unifilt.cpp",
+        "unisetspan.cpp",
+        "bmpset.cpp",
+        "util.cpp",
+        "unifunct.cpp",
+        "usetiter.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":patternprops",
+        ":uvector",
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "patternprops",
+    srcs = [
+        "patternprops.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "propsvec",
+    srcs = [
+        "propsvec.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":sort",
+        ":utrie2_builder",
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "propname",
+    srcs = [
+        "propname.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":bytestrie",
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+# Note: cc_library target name "uvector32" matches dependencies.txt group name,
+# but filename "uvectr32.*" differs in spelling.
+cc_library(
+    name = "uvector32",
+    srcs = [
+        "uvectr32.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":platform",
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "sort",
+    srcs = [
+        "uarrsort.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+cc_library(
+    name = "uvector",
+    srcs = [
+        "uvector.cpp",
+    ],
+    includes = ["."],
+    deps = [
+        ":platform",
+        ":sort",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",
+    ],
+)
+
+
+# Building this target will indirectly cause the creation of a header file that
+# integrates normalization data. This header file is generated by a genrule
+# target that invokes the gennorm2 binary.
+cc_library(
+    name = "normalizer2",
+    srcs = [
+        "normalizer2.cpp",
+        "normalizer2impl.cpp",
+    ],
+    includes = ["."],
+    hdrs = [
+        "normalizer2impl.h",
+        "norm2_nfc_data.h",  # generated by gennorm2
+    ],
+    deps = [
+        ":headers",
+    ],
+    local_defines = [
+        "U_COMMON_IMPLEMENTATION",  
+    ],
+)
+
+
+
+# Note: Bazel has chosen specifically to disallow any official support for breaking
+# through constraints that would allow copying to or generating to source
+# directories: https://stackoverflow.com/questions/51283183/how-to-generate-files-in-source-folder-using-bazel
+
+genrule(
+    name = "gen_norm2_nfc_data_h",
+    srcs = [
+        "//icu4c/source/data/unidata/norm2:nfc.txt",
+    ],
+    outs = ["norm2_nfc_data.h"],
+    cmd = "./$(location //icu4c/source/tools/gennorm2) -o $@ $(location //icu4c/source/data/unidata/norm2:nfc.txt) --csource && cp $@ /tmp",
+    tools = ["//icu4c/source/tools/gennorm2"],
+)
index 9e7bd1ebc1b42c4b1b66b383e5be17309cd58c39..7336b8d012a90b16b993edd75e6f23725b28e917 100644 (file)
@@ -49,6 +49,12 @@ For new script codes see http://www.unicode.org/iso15924/codechanges.html
 
 ---------------------------------------------------------------------------- ***
 
+Unicode 14.0 update for ICU 70
+
+Note: running `bazelisk clean` is optional but not necessary along with running `clean.sh`.
+
+---------------------------------------------------------------------------- ***
+
 Unicode 13.0 update for ICU 66
 
 https://www.unicode.org/versions/Unicode13.0.0/
diff --git a/icu4c/source/data/unidata/clean.sh b/icu4c/source/data/unidata/clean.sh
new file mode 100644 (file)
index 0000000..b71b3e8
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This script deletes files that generate.sh tries to regenerate.
+
+# Required environment variables:
+#   - ICU_SRC - the root directory of ICU source. This directory contains the
+#               `icu4c` directory.
+
+
+rm $ICU_SRC/icu4c/source/common/norm2_nfc_data.h
+
+rm $ICU_SRC/icu4c/source/common/uchar_props_data.h
+rm $ICU_SRC/icu4c/source/data/in/uprops.icu
+
diff --git a/icu4c/source/data/unidata/generate.sh b/icu4c/source/data/unidata/generate.sh
new file mode 100644 (file)
index 0000000..11a4271
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This script runs Bazel to create (generate) header files from data that are
+# needed for bootstrapping the ICU4C build to integrate the data.
+
+# Required environment variables:
+#   - ICU_SRC - the root directory of ICU source. This directory contains the
+#               `icu4c` directory.
+
+
+bazelisk build //icu4c/source/common:normalizer2
+cp $ICU_SRC/bazel-bin/icu4c/source/common/norm2_nfc_data.h $ICU_SRC/icu4c/source/common/norm2_nfc_data.h
+
+bazelisk run //tools/unicode/c/genprops $ICU_SRC/icu4c/
diff --git a/icu4c/source/data/unidata/norm2/BUILD b/icu4c/source/data/unidata/norm2/BUILD
new file mode 100644 (file)
index 0000000..f5fb9b1
--- /dev/null
@@ -0,0 +1,13 @@
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This Bazel build file is needed to declare targets for the files used as
+# inputs to binary executables that are a part of other Bazel genrule targets.
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+exports_files([
+    "nfc.txt",
+])
\ No newline at end of file
diff --git a/icu4c/source/tools/gennorm2/BUILD b/icu4c/source/tools/gennorm2/BUILD
new file mode 100644 (file)
index 0000000..700a950
--- /dev/null
@@ -0,0 +1,38 @@
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This Bazel build file defines a target for the gennorm2 binary that generates
+# headers needed for bootstrapping the ICU4C build process in a way that
+# integrates the normalization data.
+
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+cc_binary(
+    name = "gennorm2",
+    srcs = glob([
+        "*.c",
+        "*.cpp",
+        "*.h",   # cannot have hdrs section in cc_binary
+    ]),
+    deps = [
+        "//icu4c/source/common:uhash",
+        "//icu4c/source/common:umutablecptrie",
+        "//icu4c/source/common:ucptrie",
+        "//icu4c/source/common:errorcode",
+        "//icu4c/source/common:uniset",
+        "//icu4c/source/common:uvector32",
+
+        "//icu4c/source/common:platform",
+        "//icu4c/source/common:headers",
+        
+        "//icu4c/source/tools/toolutil:toolutil",
+        "//icu4c/source/tools/toolutil:unewdata",
+        "//icu4c/source/tools/toolutil:writesrc",
+        "//icu4c/source/tools/toolutil:uoptions",
+        "//icu4c/source/tools/toolutil:uparse",
+    ],
+)
diff --git a/icu4c/source/tools/toolutil/BUILD b/icu4c/source/tools/toolutil/BUILD
new file mode 100644 (file)
index 0000000..69571c4
--- /dev/null
@@ -0,0 +1,111 @@
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This Bazel build file defines targets that are dependencies for building
+# the gennorm2 and genprops binaries.
+
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+
+cc_library(
+    name = "toolutil",
+    includes = ["."],
+    hdrs = ["toolutil.h"],
+    srcs = ["toolutil.cpp"],
+    local_defines = [
+        "U_TOOLUTIL_IMPLEMENTATION",
+    ],
+    deps = ["//icu4c/source/common:platform"],
+)
+
+cc_library(
+    name = "unewdata",
+    includes = ["."],
+    hdrs = ["unewdata.h"],
+    srcs = ["unewdata.cpp"],
+    local_defines = [
+        "U_TOOLUTIL_IMPLEMENTATION",
+    ],
+    deps = [
+        ":filestrm",
+        "//icu4c/source/common:platform",
+    ],
+)
+
+cc_library(
+    name = "uoptions",
+    includes = ["."],
+    hdrs = ["uoptions.h"],
+    srcs = ["uoptions.cpp"],
+    local_defines = [
+        "U_TOOLUTIL_IMPLEMENTATION",
+    ],
+    deps = ["//icu4c/source/common:platform"],
+)
+
+cc_library(
+    name = "writesrc",
+    includes = ["."],
+    hdrs = ["writesrc.h"],
+    srcs = ["writesrc.cpp"],
+    local_defines = [
+        "U_TOOLUTIL_IMPLEMENTATION",
+    ],
+    deps = ["//icu4c/source/common:platform"],
+)
+
+cc_library(
+    name = "uparse",
+    includes = ["."],
+    hdrs = ["uparse.h"],
+    srcs = ["uparse.cpp"],
+    local_defines = [
+        "U_TOOLUTIL_IMPLEMENTATION",
+    ],
+    deps = [
+        ":filestrm",
+        "//icu4c/source/common:platform",
+        ],
+)
+
+cc_library(
+    name = "filestrm",
+    includes = ["."],
+    hdrs = ["filestrm.h"],
+    srcs = ["filestrm.cpp"],
+    local_defines = [
+        "U_TOOLUTIL_IMPLEMENTATION",
+    ],
+    deps = ["//icu4c/source/common:platform"],
+)
+
+cc_library(
+    name = "ppucd",
+    includes = ["."],
+    hdrs = ["ppucd.h"],
+    srcs = ["ppucd.cpp"],
+    local_defines = [
+        "U_TOOLUTIL_IMPLEMENTATION",
+    ],
+    deps = [
+        ":uparse",
+        "//icu4c/source/common:propname",
+        "//icu4c/source/common:platform",
+    ],
+)
+
+cc_library(
+    name = "denseranges",
+    includes = ["."],
+    hdrs = ["denseranges.h"],
+    srcs = ["denseranges.cpp"],
+    local_defines = [
+        "U_TOOLUTIL_IMPLEMENTATION",
+    ],
+    deps = ["//icu4c/source/common:platform"],
+)
+
index 7a574f41bb6d5fffddb20e9d52b23ca360a6b8f3..6ca7a8c3cf98b2be3ecb98ffae20303d7e46cd2e 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <stdio.h>
 #include <sys/stat.h>
+#include <time.h>
 #include "unicode/utypes.h"
 
 #ifndef U_TOOLUTIL_IMPLEMENTATION
@@ -67,7 +68,6 @@
 #include "cmemory.h"
 #include "cstring.h"
 #include "toolutil.h"
-#include "unicode/ucal.h"
 
 U_NAMESPACE_BEGIN
 
@@ -86,19 +86,11 @@ U_NAMESPACE_END
 static int32_t currentYear = -1;
 
 U_CAPI int32_t U_EXPORT2 getCurrentYear() {
-#if !UCONFIG_NO_FORMATTING
-    UErrorCode status=U_ZERO_ERROR;    
-    UCalendar *cal = NULL;
-
     if(currentYear == -1) {
-        cal = ucal_open(NULL, -1, NULL, UCAL_TRADITIONAL, &status);
-        ucal_setMillis(cal, ucal_getNow(), &status);
-        currentYear = ucal_get(cal, UCAL_YEAR, &status);
-        ucal_close(cal);
+        time_t now = time(nullptr);
+        tm *fields = gmtime(&now);
+        currentYear = 1900 + fields->tm_year;
     }
-#else
-    /* No formatting- no way to set the current year. */
-#endif
     return currentYear;
 }
 
diff --git a/tools/unicode/c/genprops/BUILD b/tools/unicode/c/genprops/BUILD
new file mode 100644 (file)
index 0000000..b0f2117
--- /dev/null
@@ -0,0 +1,49 @@
+# © 2021 and later: Unicode, Inc. and others.
+# License & terms of use: http://www.unicode.org/copyright.html
+
+# This Bazel build file defines a target representing the binary executable,
+# `genprops`, which is used for generating headers needing for bootstrapping
+# the ICU4C build process in a way that integrates core properties data.
+
+# Defining a binary executable (done in Bazel using `cc_binary`)
+# enables the use of the output file from executing the binary as a part of
+# other Bazel targets defined using `genrule`.
+
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
+
+package(
+    default_visibility = ["//visibility:public"],
+)
+
+cc_binary(
+    name = "genprops",
+    srcs = glob([
+        "*.c",
+        "*.cpp",
+        "*.h",   # cannot have hdrs section in cc_binary
+    ]),
+    deps = [
+        "//icu4c/source/common:uhash",
+        "//icu4c/source/common:umutablecptrie",
+        "//icu4c/source/common:ucptrie",
+        "//icu4c/source/common:utrie2",
+        "//icu4c/source/common:utrie2_builder",
+        "//icu4c/source/common:bytestrie",
+        "//icu4c/source/common:bytestriebuilder",
+        "//icu4c/source/common:propsvec",
+        "//icu4c/source/common:errorcode",
+        "//icu4c/source/common:uniset",
+        "//icu4c/source/common:uvector32",
+
+        "//icu4c/source/common:platform",
+        "//icu4c/source/common:headers",
+        
+        "//icu4c/source/tools/toolutil:ppucd",
+        "//icu4c/source/tools/toolutil:unewdata",
+        "//icu4c/source/tools/toolutil:writesrc",
+        "//icu4c/source/tools/toolutil:uoptions",
+        "//icu4c/source/tools/toolutil:uparse",
+        "//icu4c/source/tools/toolutil:toolutil",
+        "//icu4c/source/tools/toolutil:denseranges",
+    ],
+)
index 703ed7fd6ca98090ea445db042b857e0c1d3f35b..e4f737bf1f0678a0425962ffc5a1b8b0b75527f5 100644 (file)
@@ -298,7 +298,7 @@ BiDiPropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
     value|=(uint32_t)bpt<<UBIDI_BPT_SHIFT;
     value|=(uint32_t)props.getIntProp(UCHAR_JOINING_TYPE)<<UBIDI_JT_SHIFT;
     value|=(uint32_t)props.getIntProp(UCHAR_BIDI_CLASS);
-    utrie2_setRange32(pTrie, start, end, value, TRUE, &errorCode);
+    utrie2_setRange32(pTrie, start, end, value, true, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "genprops error: BiDiPropsBuilder utrie2_setRange32() failed - %s\n",
                 u_errorName(errorCode));
@@ -337,7 +337,7 @@ void
 BiDiPropsBuilder::makeMirror(UErrorCode &errorCode) {
     /* sort the mirroring table by source code points */
     uprv_sortArray(mirrors, mirrorTop, 8,
-                   compareMirror, NULL, FALSE, &errorCode);
+                   compareMirror, NULL, false, &errorCode);
     if(U_FAILURE(errorCode)) { return; }
 
     /*
index 648868c3ac4df22a8c7779601780315936dfa5e1..2405d57ca094625278fd2372386993708962ae02 100644 (file)
@@ -237,12 +237,12 @@ enum {
 
 struct ExcProps {
     ExcProps() :
-            delta(0), hasConditionalCaseMappings(FALSE), hasTurkicCaseFolding(FALSE),
-            hasNoSimpleCaseFolding(FALSE) {}
+            delta(0), hasConditionalCaseMappings(false), hasTurkicCaseFolding(false),
+            hasNoSimpleCaseFolding(false) {}
     ExcProps(const UniProps &otherProps) :
             props(otherProps),
-            delta(0), hasConditionalCaseMappings(FALSE), hasTurkicCaseFolding(FALSE),
-            hasNoSimpleCaseFolding(FALSE) {}
+            delta(0), hasConditionalCaseMappings(false), hasTurkicCaseFolding(false),
+            hasNoSimpleCaseFolding(false) {}
 
     UniProps props;
     UnicodeSet closure;
@@ -399,7 +399,7 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
 
     /* default: map to self */
     int32_t delta=0;
-    UBool noDelta=FALSE;
+    UBool noDelta=false;
 
     uint32_t type;
     if(props.binProps[UCHAR_LOWERCASE]) {
@@ -414,32 +414,32 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
     uint32_t value=type;
 
     // Examine simple case mappings.
-    UBool hasMapping=FALSE;
+    UBool hasMapping=false;
     if(props.suc>=0) {
         /* uppercase mapping as delta if the character is lowercase */
-        hasMapping=TRUE;
+        hasMapping=true;
         if(type==UCASE_LOWER) {
             delta=props.suc-start;
         } else {
-            noDelta=TRUE;
+            noDelta=true;
             value|=UCASE_EXCEPTION;
         }
     }
     if(props.slc>=0) {
         /* lowercase mapping as delta if the character is uppercase or titlecase */
-        hasMapping=TRUE;
+        hasMapping=true;
         if(type>=UCASE_UPPER) {
             delta=props.slc-start;
         } else {
-            noDelta=TRUE;
+            noDelta=true;
             value|=UCASE_EXCEPTION;
         }
     }
     if(props.stc>=0) {
-        hasMapping=TRUE;
+        hasMapping=true;
     }
     if(props.suc!=props.stc) {
-        noDelta=TRUE;
+        noDelta=true;
         value|=UCASE_EXCEPTION;
     }
 
@@ -447,7 +447,7 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
     // If they differ, then store them separately.
     UChar32 scf=props.scf;
     if(scf>=0 && scf!=props.slc) {
-        hasMapping=noDelta=TRUE;
+        hasMapping=noDelta=true;
         value|=UCASE_EXCEPTION;
     }
 
@@ -457,9 +457,9 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
     // (Full case folding falls back to simple case folding,
     // not to full lowercasing, so we need not also handle it specially
     // for such cases.)
-    UBool hasNoSimpleCaseFolding=FALSE;
+    UBool hasNoSimpleCaseFolding=false;
     if(scf<0 && props.slc>=0) {
-        hasNoSimpleCaseFolding=TRUE;
+        hasNoSimpleCaseFolding=true;
         value|=UCASE_EXCEPTION;
     }
 
@@ -475,13 +475,13 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
     if(!props.lc.isEmpty() || !props.uc.isEmpty() || !props.tc.isEmpty() ||
         newValues.contains(PPUCD_CONDITIONAL_CASE_MAPPINGS)
     ) {
-        hasMapping=TRUE;
+        hasMapping=true;
         value|=UCASE_EXCEPTION;
     }
     if( (!props.cf.isEmpty() && props.cf!=UnicodeString(props.scf)) ||
         newValues.contains(PPUCD_TURKIC_CASE_FOLDING)
     ) {
-        hasMapping=TRUE;
+        hasMapping=true;
         value|=UCASE_EXCEPTION;
     }
 
@@ -547,7 +547,7 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
         value|=((uint32_t)delta<<UCASE_DELTA_SHIFT)&UCASE_DELTA_MASK;
     }
 
-    utrie2_setRange32(pTrie, start, end, value, TRUE, &errorCode);
+    utrie2_setRange32(pTrie, start, end, value, true, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "genprops error: unable to set case mapping values: %s\n",
                 u_errorName(errorCode));
@@ -635,7 +635,7 @@ CasePropsBuilder::makeUnfoldData(UErrorCode &errorCode) {
     int32_t unfoldRows=unfoldLength/UGENCASE_UNFOLD_WIDTH-1;
     UChar *unfoldBuffer=unfold.getBuffer(-1);
     uprv_sortArray(unfoldBuffer+UGENCASE_UNFOLD_WIDTH, unfoldRows, UGENCASE_UNFOLD_WIDTH*2,
-                   compareUnfold, NULL, FALSE, &errorCode);
+                   compareUnfold, NULL, false, &errorCode);
 
     /* make unique-string rows by merging adjacent ones' code point columns */
 
@@ -753,15 +753,15 @@ CasePropsBuilder::addClosureMapping(UChar32 src, UChar32 dest, UErrorCode &error
  * each code point will in the end have some mapping to each other
  * code point in the group.
  *
- * @return TRUE if a closure mapping was added
+ * @return true if a closure mapping was added
  */
 UBool
 CasePropsBuilder::addClosure(UChar32 orig, UChar32 prev2, UChar32 prev, UChar32 c, uint32_t value,
                              UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return FALSE; }
+    if(U_FAILURE(errorCode)) { return false; }
 
     UChar32 next;
-    UBool someMappingsAdded=FALSE;
+    UBool someMappingsAdded=false;
 
     if(c!=orig) {
         /* get the properties for c */
@@ -804,7 +804,7 @@ CasePropsBuilder::addClosure(UChar32 orig, UChar32 prev2, UChar32 prev, UChar32
             next=iter.getCodepoint(); /* next!=c */
 
             if(next==orig) {
-                mapsToOrig=TRUE; /* remember that we map to orig */
+                mapsToOrig=true; /* remember that we map to orig */
             } else if(prev2<0 && next!=prev) {
                 /*
                  * recurse unless
@@ -817,7 +817,7 @@ CasePropsBuilder::addClosure(UChar32 orig, UChar32 prev2, UChar32 prev, UChar32
 
         if(!mapsToOrig) {
             addClosureMapping(c, orig, errorCode);
-            return TRUE;
+            return true;
         }
     } else {
         if((value&UCASE_TYPE_MASK)>UCASE_NONE) {
@@ -836,7 +836,7 @@ CasePropsBuilder::addClosure(UChar32 orig, UChar32 prev2, UChar32 prev, UChar32
                 if(c!=orig && next!=orig) {
                     /* c does not map to orig, add a closure mapping c->orig */
                     addClosureMapping(c, orig, errorCode);
-                    return TRUE;
+                    return true;
                 }
             }
         }
@@ -880,7 +880,7 @@ CasePropsBuilder::makeCaseClosure(UErrorCode &errorCode) {
     /* add further closure mappings from analyzing simple mappings */
     UBool someMappingsAdded;
     do {
-        someMappingsAdded=FALSE;
+        someMappingsAdded=false;
 
         for(UChar32 c=0; c<=0x10ffff; ++c) {
             uint32_t value=utrie2_get32(pTrie, c);
index af7aadea148a347e1cc165b542b9f471696f9c4c..30a91524bb4aeaa47192b8429c5520e361d28d95 100644 (file)
@@ -407,10 +407,10 @@ encodeNumericValue(UChar32 start, const char *s, UErrorCode &errorCode) {
     /* get a possible minus sign */
     UBool isNegative;
     if(*s=='-') {
-        isNegative=TRUE;
+        isNegative=true;
         ++s;
     } else {
-        isNegative=FALSE;
+        isNegative=false;
     }
 
     int32_t value=0, den=0, exp=0, ntv=0;
@@ -568,7 +568,7 @@ CorePropsBuilder::setGcAndNumeric(const UniProps &props, const UnicodeSet &newVa
     if(start==end) {
         utrie2_set32(pTrie, start, value, &errorCode);
     } else {
-        utrie2_setRange32(pTrie, start, end, value, TRUE, &errorCode);
+        utrie2_setRange32(pTrie, start, end, value, true, &errorCode);
     }
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "error: utrie2_setRange32(properties trie %04lX..%04lX) failed - %s\n",
index 39e06b72cf64e5d8f42e8d5d706d228fe815001a..e88c790555351a933babcd4ab696b2a43b1ac54e 100644 (file)
@@ -33,8 +33,8 @@
 
 U_NAMESPACE_USE
 
-UBool beVerbose=FALSE;
-UBool beQuiet=FALSE;
+UBool beVerbose=false;
+UBool beQuiet=false;
 
 PropsBuilder::PropsBuilder() {}
 PropsBuilder::~PropsBuilder() {}
index 0684e0183a75f3676342b9c6bfe8514f660ea3c7..e8a6e72165efeedf55270e17d70ef15ef586566f 100644 (file)
@@ -495,7 +495,7 @@ compress(UErrorCode &errorCode) {
 
     /* sort the words in reverse order by weight */
     uprv_sortArray(words, wordCount, sizeof(Word),
-                   compareWords, NULL, FALSE, &errorCode);
+                   compareWords, NULL, false, &errorCode);
 
     /* remove the words that do not save anything */
     while(wordCount>0 && words[wordCount-1].weight<1) {
@@ -543,7 +543,7 @@ compress(UErrorCode &errorCode) {
         /* sort these words in reverse order by weight */
         errorCode=U_ZERO_ERROR;
         uprv_sortArray(words+tokenCount, wordCount-tokenCount, sizeof(Word),
-                        compareWords, NULL, FALSE, &errorCode);
+                        compareWords, NULL, false, &errorCode);
 
         /* remove the words that do not save anything */
         while(wordCount>0 && words[wordCount-1].weight<1) {
index b38ed734fd12fbde6e6d88b427fd60727de85cec..e1142e0ece87ffde163ceef296b64829b1fe717c 100644 (file)
@@ -552,7 +552,7 @@ int32_t PNamesPropertyNames::findProperty(int32_t property) const {
 
 UBool PNamesPropertyNames::containsName(BytesTrie &trie, const char *name) const {
     if(name==NULL) {
-        return FALSE;
+        return false;
     }
     UStringTrieResult result=USTRINGTRIE_NO_VALUE;
     char c;
@@ -563,7 +563,7 @@ UBool PNamesPropertyNames::containsName(BytesTrie &trie, const char *name) const
             continue;
         }
         if(!USTRINGTRIE_HAS_NEXT(result)) {
-            return FALSE;
+            return false;
         }
         result=trie.next((uint8_t)c);
     }