Make the Unicode database version used available
This commit is contained in:
parent
38547c9e7a
commit
e5e8cc72c6
@ -45,6 +45,14 @@ def get_data(fname: str, folder: str = 'UCD') -> Iterable[str]:
|
|||||||
yield line
|
yield line
|
||||||
|
|
||||||
|
|
||||||
|
def unicode_version():
|
||||||
|
for line in get_data("ReadMe.txt"):
|
||||||
|
m = re.search(r'Version\s+(\d+)\.(\d+)\.(\d+)', line)
|
||||||
|
if m is not None:
|
||||||
|
return int(m.group(1)), int(m.group(2)), int(m.group(3))
|
||||||
|
raise ValueError('Could not find Unicode Version')
|
||||||
|
|
||||||
|
|
||||||
# Map of class names to set of codepoints in class
|
# Map of class names to set of codepoints in class
|
||||||
class_maps: Dict[str, Set[int]] = {}
|
class_maps: Dict[str, Set[int]] = {}
|
||||||
all_symbols: Set[int] = set()
|
all_symbols: Set[int] = set()
|
||||||
@ -586,6 +594,11 @@ def gen_wcwidth() -> None:
|
|||||||
gop('\t}')
|
gop('\t}')
|
||||||
p('\treturn true;\n}')
|
p('\treturn true;\n}')
|
||||||
gop('\n}')
|
gop('\n}')
|
||||||
|
uv = unicode_version()
|
||||||
|
p(f'#define UNICODE_MAJOR_VERSION {uv[0]}')
|
||||||
|
p(f'#define UNICODE_MINOR_VERSION {uv[1]}')
|
||||||
|
p(f'#define UNICODE_PATCH_VERSION {uv[2]}')
|
||||||
|
gop('var UnicodeDatabaseVersion [3]int = [3]int{' f'{uv[0]}, {uv[1]}, {uv[2]}' + '}')
|
||||||
subprocess.check_call(['gofmt', '-w', '-s', gof.name])
|
subprocess.check_call(['gofmt', '-w', '-s', gof.name])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
kittens/unicode_input/names.h
generated
2
kittens/unicode_input/names.h
generated
@ -1,4 +1,4 @@
|
|||||||
// unicode data, built from the unicode standard on: 2022-09-30
|
// unicode data, built from the unicode standard on: 2022-11-17
|
||||||
// see gen-wcwidth.py
|
// see gen-wcwidth.py
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "data-types.h"
|
#include "data-types.h"
|
||||||
|
|||||||
@ -221,6 +221,7 @@ static PyMethodDef module_methods[] = {
|
|||||||
{"get_docs_ref_map", (PyCFunction)get_docs_ref_map, METH_NOARGS, ""},
|
{"get_docs_ref_map", (PyCFunction)get_docs_ref_map, METH_NOARGS, ""},
|
||||||
{"getpeereid", (PyCFunction)py_getpeereid, METH_VARARGS, ""},
|
{"getpeereid", (PyCFunction)py_getpeereid, METH_VARARGS, ""},
|
||||||
{"wcswidth", (PyCFunction)wcswidth_std, METH_O, ""},
|
{"wcswidth", (PyCFunction)wcswidth_std, METH_O, ""},
|
||||||
|
{"unicode_database_version", (PyCFunction)unicode_database_version, METH_NOARGS, ""},
|
||||||
{"open_tty", open_tty, METH_VARARGS, ""},
|
{"open_tty", open_tty, METH_VARARGS, ""},
|
||||||
{"normal_tty", normal_tty, METH_VARARGS, ""},
|
{"normal_tty", normal_tty, METH_VARARGS, ""},
|
||||||
{"raw_tty", raw_tty, METH_VARARGS, ""},
|
{"raw_tty", raw_tty, METH_VARARGS, ""},
|
||||||
|
|||||||
2
kitty/emoji.h
generated
2
kitty/emoji.h
generated
@ -1,4 +1,4 @@
|
|||||||
// unicode data, built from the unicode standard on: 2022-09-30
|
// unicode data, built from the unicode standard on: 2022-11-17
|
||||||
// see gen-wcwidth.py
|
// see gen-wcwidth.py
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "data-types.h"
|
#include "data-types.h"
|
||||||
|
|||||||
@ -1492,3 +1492,4 @@ def set_clipboard_data_types(ct: int, mime_types: Tuple[str, ...]) -> None: ...
|
|||||||
def get_clipboard_mime(ct: int, mime: Optional[str], callback: Callable[[bytes], None]) -> None: ...
|
def get_clipboard_mime(ct: int, mime: Optional[str], callback: Callable[[bytes], None]) -> None: ...
|
||||||
def run_with_activation_token(func: Callable[[str], None]) -> None: ...
|
def run_with_activation_token(func: Callable[[str], None]) -> None: ...
|
||||||
def make_x11_window_a_dock_window(x11_window_id: int, strut: Tuple[int, int, int, int, int, int, int, int, int, int, int, int]) -> None: ...
|
def make_x11_window_a_dock_window(x11_window_id: int, strut: Tuple[int, int, int, int, int, int, int, int, int, int, int, int]) -> None: ...
|
||||||
|
def unicode_database_version() -> Tuple[int, int, int]: ...
|
||||||
|
|||||||
2
kitty/unicode-data.c
generated
2
kitty/unicode-data.c
generated
@ -1,4 +1,4 @@
|
|||||||
// unicode data, built from the unicode standard on: 2022-09-30
|
// unicode data, built from the unicode standard on: 2022-11-17
|
||||||
// see gen-wcwidth.py
|
// see gen-wcwidth.py
|
||||||
#include "data-types.h"
|
#include "data-types.h"
|
||||||
|
|
||||||
|
|||||||
@ -142,3 +142,8 @@ wcswidth_std(PyObject UNUSED *self, PyObject *str) {
|
|||||||
}
|
}
|
||||||
return PyLong_FromSize_t(ans);
|
return PyLong_FromSize_t(ans);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PyObject*
|
||||||
|
unicode_database_version(PyObject *self UNUSED, PyObject *args UNUSED) {
|
||||||
|
return Py_BuildValue("iii", UNICODE_MAJOR_VERSION, UNICODE_MINOR_VERSION, UNICODE_PATCH_VERSION);
|
||||||
|
}
|
||||||
|
|||||||
@ -20,4 +20,5 @@ typedef struct {
|
|||||||
void initialize_wcs_state(WCSState *state);
|
void initialize_wcs_state(WCSState *state);
|
||||||
int wcswidth_step(WCSState *state, const char_type ch);
|
int wcswidth_step(WCSState *state, const char_type ch);
|
||||||
PyObject * wcswidth_std(PyObject UNUSED *self, PyObject *str);
|
PyObject * wcswidth_std(PyObject UNUSED *self, PyObject *str);
|
||||||
|
PyObject * unicode_database_version(PyObject UNUSED *self, PyObject *str);
|
||||||
size_t wcswidth_string(const char_type *s);
|
size_t wcswidth_string(const char_type *s);
|
||||||
|
|||||||
5
kitty/wcwidth-std.h
generated
5
kitty/wcwidth-std.h
generated
@ -1,4 +1,4 @@
|
|||||||
// unicode data, built from the unicode standard on: 2022-09-30
|
// unicode data, built from the unicode standard on: 2022-11-17
|
||||||
// see gen-wcwidth.py
|
// see gen-wcwidth.py
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "data-types.h"
|
#include "data-types.h"
|
||||||
@ -3250,5 +3250,8 @@ is_emoji_presentation_base(uint32_t code) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#define UNICODE_MAJOR_VERSION 15
|
||||||
|
#define UNICODE_MINOR_VERSION 0
|
||||||
|
#define UNICODE_PATCH_VERSION 0
|
||||||
|
|
||||||
END_ALLOW_CASE_RANGE
|
END_ALLOW_CASE_RANGE
|
||||||
|
|||||||
2
tools/wcswidth/std.go
generated
2
tools/wcswidth/std.go
generated
@ -3242,3 +3242,5 @@ func IsEmojiPresentationBase(code rune) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var UnicodeDatabaseVersion [3]int = [3]int{15, 0, 0}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user