Skip to content

Commit

Permalink
Merge branch 'main' of github.com:anderslanglands/babble
Browse files Browse the repository at this point in the history
  • Loading branch information
anderslanglands committed Jan 31, 2024
2 parents 521f718 + 84882bc commit 3b8e212
Show file tree
Hide file tree
Showing 47 changed files with 934 additions and 109 deletions.
2 changes: 1 addition & 1 deletion bbl/src/bbl-genbind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ enum Result {
ERROR_FILE_OPEN,
};

auto get_operator_rename(std::string const& name) -> std::string;
static auto get_operator_rename(std::string const& name) -> std::string;

auto get_function_cast_string(FunctionDecl const* fd,
std::string const& scope,
Expand Down
1 change: 1 addition & 0 deletions test/inheritance/inheritance.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <iostream>
#include <string.h>

namespace foo {

Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test001-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test01_Foo_t = qux::Foo;

extern "C" {
int test01_Foo_bar(test01_Foo_t* _this, float a, int* _result) {
try {
*_result = _this->bar(a);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test002-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test002_FooFloat_t = Foo<float>;
using test002_FooInt_t = FooInt;

extern "C" {
int test002_FooFloat_bar(test002_FooFloat_t* _this, float const* a, float* _result) {
try {
*_result = _this->bar(*a);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test003-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test003_FooFloat_t = Foo<float>;
using test003_FooInt_t = FooInt;
Expand All @@ -25,6 +24,7 @@ static_assert(alignof(test003_FooInt_t_bbl_size_check) == alignof(FooInt), "alig

using test003_Baz_t = Baz;

extern "C" {
int test003_FooFloat_bar(test003_FooFloat_t* _this, float const* a, float* _result) {
try {
*_result = _this->bar(*a);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test004-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test004_FooFloat_t = Foo<float>;
using test004_FooInt_t = FooInt;

extern "C" {
int test004_FooFloat_baz_int(test004_FooFloat_t* _this, size_t a) {
try {
_this->baz(a);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test005-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test005_FooFloat_t = Foo<float>;

extern "C" {
int test005_FooFloat_bar(test005_FooFloat_t* _this, float const* a, size_t* _result) {
try {
*_result = _this->bar(*a);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test006-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

static thread_local std::string _bbl_error_message;

extern "C" {
using test006a_Foo = unsigned int;
using test006b_Bar = int64_t;


extern "C" {
} // extern "C"
2 changes: 1 addition & 1 deletion test/ref/linux/test007-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test007_Bar_t = qux::Bar;
struct BBL_ALIGN(4) test007_Bar_t_bbl_size_check {
Expand All @@ -27,6 +26,7 @@ static_assert(sizeof(test007_Bar_t_bbl_size_check) == sizeof(qux::Bar), "size of
static_assert(alignof(test007_Bar_t_bbl_size_check) == alignof(qux::Bar), "align of value type does not match");


extern "C" {
int test007_Bar_bar(test007_Bar_t const* _this, int* _result) {
*_result = _this->bar();
return 0;
Expand Down
32 changes: 1 addition & 31 deletions test/ref/linux/test008-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test_std_vector_StdVectorInt_t = std::vector<std::pair<int, float>>;
using test_std_vector_StdPairIntFloat_t = std::pair<int, float>;

extern "C" {
int test_std_vector_StdVectorInt_data(test_std_vector_StdVectorInt_t* _this, test_std_vector_StdPairIntFloat_t** _result) {
*_result = _this->data();
return 0;
Expand All @@ -46,16 +46,6 @@ int test_std_vector_StdVectorInt_max_size(test_std_vector_StdVectorInt_t const*
return 0;
}

int test_std_vector_StdVectorInt_reserve(test_std_vector_StdVectorInt_t* _this, size_t __n) {
try {
_this->reserve(__n);
return 0;
} catch (std::exception& e) {
_bbl_error_message = e.what();
return 1;
}
}

int test_std_vector_StdVectorInt_capacity(test_std_vector_StdVectorInt_t const* _this, size_t* _result) {
*_result = _this->capacity();
return 0;
Expand All @@ -66,31 +56,11 @@ int test_std_vector_StdVectorInt_clear(test_std_vector_StdVectorInt_t* _this) {
return 0;
}

int test_std_vector_StdVectorInt_push_back(test_std_vector_StdVectorInt_t* _this, test_std_vector_StdPairIntFloat_t const* __x) {
try {
_this->push_back(*__x);
return 0;
} catch (std::exception& e) {
_bbl_error_message = e.what();
return 1;
}
}

int test_std_vector_StdVectorInt_pop_back(test_std_vector_StdVectorInt_t* _this) {
_this->pop_back();
return 0;
}

int test_std_vector_StdVectorInt_resize_with(test_std_vector_StdVectorInt_t* _this, size_t __new_size, test_std_vector_StdPairIntFloat_t const* __x) {
try {
_this->resize(__new_size, *__x);
return 0;
} catch (std::exception& e) {
_bbl_error_message = e.what();
return 1;
}
}

int test_std_vector_StdVectorInt_op_index(test_std_vector_StdVectorInt_t const* _this, size_t __n, test_std_vector_StdPairIntFloat_t const** _result) {
*_result = &_this->operator[](__n);
return 0;
Expand Down
6 changes: 0 additions & 6 deletions test/ref/linux/test008-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,12 @@ int test_std_vector_StdVectorInt_size(test_std_vector_StdVectorInt_t const* _thi

int test_std_vector_StdVectorInt_max_size(test_std_vector_StdVectorInt_t const* _this, size_t* _result);

int test_std_vector_StdVectorInt_reserve(test_std_vector_StdVectorInt_t* _this, size_t __n);

int test_std_vector_StdVectorInt_capacity(test_std_vector_StdVectorInt_t const* _this, size_t* _result);

int test_std_vector_StdVectorInt_clear(test_std_vector_StdVectorInt_t* _this);

int test_std_vector_StdVectorInt_push_back(test_std_vector_StdVectorInt_t* _this, test_std_vector_StdPairIntFloat_t const* __x);

int test_std_vector_StdVectorInt_pop_back(test_std_vector_StdVectorInt_t* _this);

int test_std_vector_StdVectorInt_resize_with(test_std_vector_StdVectorInt_t* _this, size_t __new_size, test_std_vector_StdPairIntFloat_t const* __x);

int test_std_vector_StdVectorInt_op_index(test_std_vector_StdVectorInt_t const* _this, size_t __n, test_std_vector_StdPairIntFloat_t const** _result);

int test_std_vector_StdVectorInt_default(test_std_vector_StdVectorInt_t** _result);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test009-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test_std_pair_StdPairIntFloat_t = std::pair<int, float>;

extern "C" {
int test_std_pair_StdPairIntFloat_dtor(test_std_pair_StdPairIntFloat_t* _this) {
delete _this;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test011-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test011_FooFloat_t = qux::Foo<float>;

extern "C" {
int test011_FooFloat_bar(test011_FooFloat_t* _this, float const* a, float* _result) {
try {
*_result = _this->bar(*a);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test012-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test012_Base_t = qux::Base;
using test012_Foo_t = qux::Foo;

extern "C" {
int test012_Base_bar(test012_Base_t* _this) {
try {
_this->bar();
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test013-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test013_Foo_t = Foo;

extern "C" {
int test013_Foo_bar(test013_Foo_t* _this, float a, int* _result) {
try {
*_result = _this->bar(a);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test014-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test014_Foo_t = Foo;

extern "C" {
int test014_Foo_bar(test014_Foo_t* _this, float a, int* _result) {
try {
*_result = _this->bar(a);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test015-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test015_Bar_t = qux::Bar;
using test015_Foo_t = qux::Foo;

extern "C" {
int test015_Bar_baz(test015_Bar_t const* _this, char const** s, float* const f, int** _result) {
try {
*_result = _this->baz(s, f);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test016-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

static thread_local std::string _bbl_error_message;

extern "C" {
using test016_Bar = int64_t;

using test016_Foo_t = qux::Foo;

extern "C" {
int test016_Foo_take_enum(test016_Foo_t const* _this, int64_t b) {
try {
_this->take_enum(static_cast<qux::Bar>(b));
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test017-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test017_Vec3f_t = qux::Vec3f;
struct BBL_ALIGN(4) test017_Vec3f_t_bbl_size_check {
Expand All @@ -28,6 +27,7 @@ static_assert(alignof(test017_Vec3f_t_bbl_size_check) == alignof(qux::Vec3f), "a
using test017_Foo_t = qux::Foo;
using test017_Bar_t = qux::Bar;

extern "C" {
int test017_Vec3f_length(test017_Vec3f_t const* _this, float* _result) {
try {
*_result = _this->length();
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test018-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test018_Foo_t = qux::Foo;

extern "C" {
int test018_Foo_do_foo(test018_Foo_t const* _this, void (*fun)(test018_Foo_t const* param00, int param01, float param02, test018_Foo_t** _result)) {
try {
std::function<qux::Foo (qux::Foo const&, int, float)> fun_wrapper = [&](qux::Foo const& param00, int param01, float param02) {
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test019-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@

static thread_local std::string _bbl_error_message;

extern "C" {
using bar_Enum = unsigned int;
using baz_Enum = unsigned int;

using bar_Foo_t = QUX_NS::BarFoo;
using baz_Foo_t = QUX_NS::BazFoo;

extern "C" {
int bar_Foo_ctor(int a, float b, bar_Foo_t** _result) {
try {
*_result = new QUX_NS::BarFoo(a, b);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test021-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test0021_Foo_t = Foo;
using test0021_BarShort_t = Bar<short>;

extern "C" {
int test0021_Foo_get_float(test0021_Foo_t const* _this, float* _result) {
try {
*_result = _this->get<float>();
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test022-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ static float custom_foo(Foo const& foo) {
}
}

extern "C" {

using test0022_Foo_t = Foo;

extern "C" {
int test0022_Foo_dtor(test0022_Foo_t* _this) {
delete _this;
return 0;
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test023-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test0023_Foo_t = qux::Foo;
struct BBL_ALIGN(4) test0023_Foo_t_bbl_size_check {
Expand All @@ -26,6 +25,7 @@ static_assert(sizeof(test0023_Foo_t_bbl_size_check) == sizeof(qux::Foo), "size o
static_assert(alignof(test0023_Foo_t_bbl_size_check) == alignof(qux::Foo), "align of value type does not match");


extern "C" {
int test0023_Foo_length(test0023_Foo_t* _this, float* _result) {
try {
*_result = _this->length();
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test024-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test0024_Bar_t = qux::Bar;
struct BBL_ALIGN(4) test0024_Bar_t_bbl_size_check {
Expand All @@ -24,6 +23,7 @@ static_assert(sizeof(test0024_Bar_t_bbl_size_check) == sizeof(qux::Bar), "size o
static_assert(alignof(test0024_Bar_t_bbl_size_check) == alignof(qux::Bar), "align of value type does not match");


extern "C" {
int test0024_Bar_set_data(test0024_Bar_t* _this, float* d) {
try {
_this->set_data(d);
Expand Down
2 changes: 1 addition & 1 deletion test/ref/linux/test026-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

static thread_local std::string _bbl_error_message;

extern "C" {

using test0021_Foo_t = Foo;
using test0021_BarShort_t = Bar<short>;

extern "C" {
int test0021_Foo_get_int(test0021_Foo_t const* _this, int const** _result) {
try {
*_result = &_this->get();
Expand Down
Loading

0 comments on commit 3b8e212

Please sign in to comment.