Commit 83a1da99 authored by Kirill Smelkov's avatar Kirill Smelkov

golang, libgolang: Add byte / rune types

Those types are the base when working with byte- and unicode strings.
It will be clearer to use them explicitly instead of uint8_t and int32_t
when processing string.
parent 90f0e0ff
# cython: language_level=2 # cython: language_level=2
# Copyright (C) 2019-2022 Nexedi SA and Contributors. # Copyright (C) 2019-2023 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -65,6 +65,9 @@ cdef extern from *: ...@@ -65,6 +65,9 @@ cdef extern from *:
# on the edge of Python/nogil world. # on the edge of Python/nogil world.
from libcpp.string cimport string # golang::string = std::string from libcpp.string cimport string # golang::string = std::string
cdef extern from "golang/libgolang.h" namespace "golang" nogil: cdef extern from "golang/libgolang.h" namespace "golang" nogil:
ctypedef unsigned char byte
ctypedef signed int rune # = int32
void panic(const char *) void panic(const char *)
const char *recover() const char *recover()
......
...@@ -433,6 +433,10 @@ constexpr Nil nil = nullptr; ...@@ -433,6 +433,10 @@ constexpr Nil nil = nullptr;
// string is alias for std::string. // string is alias for std::string.
using string = std::string; using string = std::string;
// byte/rune types related to string.
using byte = uint8_t;
using rune = int32_t;
// func is alias for std::function. // func is alias for std::function.
template<typename F> template<typename F>
using func = std::function<F>; using func = std::function<F>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment