mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-11 04:06:20 +00:00
![Jonas Devlieghere](/assets/img/avatar_default.png)
All the code required to generate the language bindings for Python and Lua lives under scripts, even though the majority of this code aren't scripts at all, and surrounded by scripts that are totally unrelated. I've reorganized these files and moved everything related to the language bindings into a new top-level directory named bindings. This makes the corresponding files self contained and much more discoverable. Differential revision: https://reviews.llvm.org/D72437
34 lines
887 B
Plaintext
34 lines
887 B
Plaintext
%define STRING_EXTENSION_LEVEL(Class, Level)
|
|
%extend {
|
|
%nothreadallow;
|
|
std::string lldb:: ## Class ## ::__str__(){
|
|
lldb::SBStream stream;
|
|
$self->GetDescription (stream, Level);
|
|
const char *desc = stream.GetData();
|
|
size_t desc_len = stream.GetSize();
|
|
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) {
|
|
--desc_len;
|
|
}
|
|
return std::string(desc, desc_len);
|
|
}
|
|
%clearnothreadallow;
|
|
}
|
|
%enddef
|
|
|
|
%define STRING_EXTENSION(Class)
|
|
%extend {
|
|
%nothreadallow;
|
|
std::string lldb:: ## Class ## ::__str__(){
|
|
lldb::SBStream stream;
|
|
$self->GetDescription (stream);
|
|
const char *desc = stream.GetData();
|
|
size_t desc_len = stream.GetSize();
|
|
if (desc_len > 0 && (desc[desc_len-1] == '\n' || desc[desc_len-1] == '\r')) {
|
|
--desc_len;
|
|
}
|
|
return std::string(desc, desc_len);
|
|
}
|
|
%clearnothreadallow;
|
|
}
|
|
%enddef
|