mirror of
https://github.com/Relintai/gdnative_python.git
synced 2024-11-12 10:25:08 +01:00
Add char types.
This commit is contained in:
parent
b9243646fe
commit
2a95c7925b
@ -89,6 +89,14 @@ ALL_TYPES = [
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="float",
|
||||
c_type="float",
|
||||
cy_type="float",
|
||||
py_type="float",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="wchar_t",
|
||||
c_type="wchar_t",
|
||||
@ -96,9 +104,30 @@ ALL_TYPES = [
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="char16_t",
|
||||
c_type="char16_t",
|
||||
cy_type="char16_t",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="char32_t",
|
||||
c_type="char32_t",
|
||||
cy_type="char32_t",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="char", c_type="char", cy_type="char", is_base_type=True, is_stack_only=True
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="pandemonium_char_type",
|
||||
c_type="pandemonium_char_type",
|
||||
cy_type="pandemonium_char_type",
|
||||
is_base_type=True,
|
||||
is_stack_only=True,
|
||||
),
|
||||
TypeSpec(
|
||||
gdapi_type="schar",
|
||||
c_type="schar",
|
||||
|
@ -13,18 +13,20 @@ from pandemonium._hazmat.gdnative_api_struct cimport (
|
||||
from pandemonium.builtins cimport GDString, NodePath
|
||||
|
||||
|
||||
# Strings are now char32_t
|
||||
# TODO remove this id everything works
|
||||
# Pandemonium string are basically a vector of wchar_t, each wchar_t representing
|
||||
# a single unicode character (i.e. there is no surrogates support).
|
||||
# The sad part is wchar_t is not portable: it is 16bits long on Windows and
|
||||
# 32bits long on Linux and MacOS...
|
||||
# So we end up with a UCS2 encoding on Windows and UCS4 everywhere else :'(
|
||||
IF UNAME_SYSNAME == "Windows":
|
||||
# Specify endianess otherwise `encode` appends a BOM at the start of the converted string
|
||||
DEF _STRING_ENCODING = "UTF-16-LE"
|
||||
DEF _STRING_CODEPOINT_LENGTH = 2
|
||||
ELSE:
|
||||
DEF _STRING_ENCODING = "UTF-32-LE"
|
||||
DEF _STRING_CODEPOINT_LENGTH = 4
|
||||
#IF UNAME_SYSNAME == "Windows":
|
||||
# # Specify endianess otherwise `encode` appends a BOM at the start of the converted string
|
||||
# DEF _STRING_ENCODING = "UTF-16-LE"
|
||||
# DEF _STRING_CODEPOINT_LENGTH = 2
|
||||
#ELSE:
|
||||
DEF _STRING_ENCODING = "UTF-32-LE"
|
||||
DEF _STRING_CODEPOINT_LENGTH = 4
|
||||
|
||||
|
||||
cdef inline str pandemonium_string_to_pyobj(const pandemonium_string *p_gdstr):
|
||||
|
Loading…
Reference in New Issue
Block a user