mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Added header guard exception
This commit is contained in:
parent
2cb4a4d8f5
commit
0cd61e6ae1
|
@ -6,7 +6,9 @@ os.chdir(os.path.dirname(__file__) + "/..")
|
||||||
|
|
||||||
PATH = "src/"
|
PATH = "src/"
|
||||||
EXCEPTIONS = [
|
EXCEPTIONS = [
|
||||||
|
"src/base/unicode/confusables.h",
|
||||||
"src/base/unicode/confusables_data.h",
|
"src/base/unicode/confusables_data.h",
|
||||||
|
"src/base/unicode/tolower.h",
|
||||||
"src/base/unicode/tolower_data.h",
|
"src/base/unicode/tolower_data.h",
|
||||||
"src/tools/config_common.h"
|
"src/tools/config_common.h"
|
||||||
]
|
]
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
# - http://www.unicode.org/Public/<VERSION>/ucd/UnicodeData.txt
|
# - http://www.unicode.org/Public/<VERSION>/ucd/UnicodeData.txt
|
||||||
#
|
#
|
||||||
# If executed as a script, it will generate the contents of the files
|
# 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 header > `src/base/unicode/confusables.h`,
|
||||||
# python3 scripts/generate_unicode_confusables_data.py source > `src/base/unicode/confusables_data.h`.
|
# python3 scripts/generate_unicode_confusables_data.py data > `src/base/unicode/confusables_data.h`.
|
||||||
|
|
||||||
import unicode
|
import unicode
|
||||||
import sys
|
import sys
|
||||||
|
@ -72,7 +72,7 @@ struct DECOMP_SLICE
|
||||||
print("extern const struct DECOMP_SLICE decomp_slices[NUM_DECOMPS];")
|
print("extern const struct DECOMP_SLICE decomp_slices[NUM_DECOMPS];")
|
||||||
print("extern const int32_t decomp_data[];")
|
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("""\
|
print("""\
|
||||||
#ifndef CONFUSABLES_DATA
|
#ifndef CONFUSABLES_DATA
|
||||||
#error "This file should only be included in `confusables.cpp`"
|
#error "This file should only be included in `confusables.cpp`"
|
||||||
|
@ -123,12 +123,12 @@ def main():
|
||||||
cur_offset += len(d)
|
cur_offset += len(d)
|
||||||
|
|
||||||
header = "header" in sys.argv
|
header = "header" in sys.argv
|
||||||
source = "source" in sys.argv
|
data = "data" in sys.argv
|
||||||
|
|
||||||
if header:
|
if header:
|
||||||
gen_header(decompositions, len_set)
|
gen_header(decompositions, len_set)
|
||||||
elif source:
|
elif data:
|
||||||
gen_source(decompositions, decomposition_set, decomposition_offsets, len_set)
|
gen_data(decompositions, decomposition_set, decomposition_offsets, len_set)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
# - http://www.unicode.org/Public/<VERSION>/ucd/UnicodeData.txt
|
# - http://www.unicode.org/Public/<VERSION>/ucd/UnicodeData.txt
|
||||||
#
|
#
|
||||||
# If executed as a script, it will generate the contents of the file
|
# 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 header > `src/base/unicode/tolower.h`,
|
||||||
# python3 scripts/generate_unicode_tolower.py source > `src/base/unicode/tolower_data.c`.
|
# python3 scripts/generate_unicode_tolower.py data > `src/base/unicode/tolower_data.h`.
|
||||||
|
|
||||||
import unicode
|
import unicode
|
||||||
import sys
|
import sys
|
||||||
|
@ -31,7 +31,7 @@ enum
|
||||||
|
|
||||||
extern const struct UPPER_LOWER tolowermap[];""".format(len(cases)))
|
extern const struct UPPER_LOWER tolowermap[];""".format(len(cases)))
|
||||||
|
|
||||||
def gen_source(cases):
|
def gen_data(cases):
|
||||||
print("""\
|
print("""\
|
||||||
#ifndef TOLOWER_DATA
|
#ifndef TOLOWER_DATA
|
||||||
#error "This file must only be included in `tolower.cpp`"
|
#error "This file must only be included in `tolower.cpp`"
|
||||||
|
@ -46,12 +46,12 @@ def main():
|
||||||
cases = generate_cases()
|
cases = generate_cases()
|
||||||
|
|
||||||
header = "header" in sys.argv
|
header = "header" in sys.argv
|
||||||
source = "source" in sys.argv
|
data = "data" in sys.argv
|
||||||
|
|
||||||
if header:
|
if header:
|
||||||
gen_header(cases)
|
gen_header(cases)
|
||||||
elif source:
|
elif data:
|
||||||
gen_source(cases)
|
gen_data(cases)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue