Added header guard exception

This commit is contained in:
Chairn 2022-05-07 01:08:51 +02:00
parent 2cb4a4d8f5
commit 0cd61e6ae1
3 changed files with 14 additions and 12 deletions

View file

@ -6,7 +6,9 @@ os.chdir(os.path.dirname(__file__) + "/..")
PATH = "src/"
EXCEPTIONS = [
"src/base/unicode/confusables.h",
"src/base/unicode/confusables_data.h",
"src/base/unicode/tolower.h",
"src/base/unicode/tolower_data.h",
"src/tools/config_common.h"
]

View file

@ -5,8 +5,8 @@
# - http://www.unicode.org/Public/<VERSION>/ucd/UnicodeData.txt
#
# If executed as a script, it will generate the contents of the files
# python3 scripts/generate_unicode_confusables_data.py header > `src/base/unicode/confusables_data.h`,
# python3 scripts/generate_unicode_confusables_data.py source > `src/base/unicode/confusables_data.h`.
# python3 scripts/generate_unicode_confusables_data.py header > `src/base/unicode/confusables.h`,
# python3 scripts/generate_unicode_confusables_data.py data > `src/base/unicode/confusables_data.h`.
import unicode
import sys
@ -72,7 +72,7 @@ struct DECOMP_SLICE
print("extern const struct DECOMP_SLICE decomp_slices[NUM_DECOMPS];")
print("extern const int32_t decomp_data[];")
def gen_source(decompositions, decomposition_set, decomposition_offsets, len_set):
def gen_data(decompositions, decomposition_set, decomposition_offsets, len_set):
print("""\
#ifndef CONFUSABLES_DATA
#error "This file should only be included in `confusables.cpp`"
@ -123,12 +123,12 @@ def main():
cur_offset += len(d)
header = "header" in sys.argv
source = "source" in sys.argv
data = "data" in sys.argv
if header:
gen_header(decompositions, len_set)
elif source:
gen_source(decompositions, decomposition_set, decomposition_offsets, len_set)
elif data:
gen_data(decompositions, decomposition_set, decomposition_offsets, len_set)
if __name__ == '__main__':
main()

View file

@ -4,8 +4,8 @@
# - http://www.unicode.org/Public/<VERSION>/ucd/UnicodeData.txt
#
# If executed as a script, it will generate the contents of the file
# python3 scripts/generate_unicode_tolower.py header > `src/base/unicode/tolower_data.h`,
# python3 scripts/generate_unicode_tolower.py source > `src/base/unicode/tolower_data.c`.
# python3 scripts/generate_unicode_tolower.py header > `src/base/unicode/tolower.h`,
# python3 scripts/generate_unicode_tolower.py data > `src/base/unicode/tolower_data.h`.
import unicode
import sys
@ -31,7 +31,7 @@ enum
extern const struct UPPER_LOWER tolowermap[];""".format(len(cases)))
def gen_source(cases):
def gen_data(cases):
print("""\
#ifndef TOLOWER_DATA
#error "This file must only be included in `tolower.cpp`"
@ -46,12 +46,12 @@ def main():
cases = generate_cases()
header = "header" in sys.argv
source = "source" in sys.argv
data = "data" in sys.argv
if header:
gen_header(cases)
elif source:
gen_source(cases)
elif data:
gen_data(cases)
if __name__ == '__main__':
main()