Add support for VaList functions

This commit is contained in:
Dan Robertson
2018-11-27 00:13:34 +00:00
committed by Ryan Hunt
parent f974d7baec
commit 304f752c06
223 changed files with 421 additions and 164 deletions
+6 -2
View File
@@ -95,13 +95,17 @@ impl Bindings {
out.new_line_if_not_start();
if self.config.language == Language::C {
out.write("#include <stdarg.h>");
out.new_line();
out.write("#include <stdbool.h>");
out.new_line();
out.write("#include <stdint.h>");
out.new_line();
out.write("#include <stdlib.h>");
out.new_line();
out.write("#include <stdbool.h>");
out.new_line();
} else {
out.write("#include <cstdarg>");
out.new_line();
out.write("#include <cstdint>");
out.new_line();
out.write("#include <cstdlib>");
+4
View File
@@ -47,6 +47,7 @@ pub enum PrimitiveType {
Double,
SizeT,
PtrDiffT,
VaList,
}
impl PrimitiveType {
@@ -82,6 +83,7 @@ impl PrimitiveType {
"f64" => Some(PrimitiveType::Double),
"size_t" => Some(PrimitiveType::SizeT),
"ptrdiff_t" => Some(PrimitiveType::PtrDiffT),
"VaList" => Some(PrimitiveType::VaList),
_ => None,
}
}
@@ -116,6 +118,7 @@ impl PrimitiveType {
&PrimitiveType::Double => "f64",
&PrimitiveType::SizeT => "size_t",
&PrimitiveType::PtrDiffT => "ptrdiff_t",
&PrimitiveType::VaList => "va_list",
}
}
@@ -149,6 +152,7 @@ impl PrimitiveType {
&PrimitiveType::Double => "double",
&PrimitiveType::SizeT => "size_t",
&PrimitiveType::PtrDiffT => "ptrdiff_t",
&PrimitiveType::VaList => "va_list",
}
}
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum Status {
Ok,
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum C {
X = 2,
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,5 +1,6 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define Foo_FOO 42
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define Foo_GA 10
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum Status {
Ok,
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum C {
X = 2,
@@ -1,5 +1,6 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define Foo_FOO 42
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define Foo_GA 10
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef void (*A)();
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#if defined(NOT_DEFINED)
#define DEFAULT_X 8
+2 -1
View File
@@ -1,3 +1,4 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
+2 -1
View File
@@ -1,5 +1,6 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define Foo_FOO 0
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define FOO 10
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo {
bool a;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Rect {
float x;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum A {
a1 = 0,
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct TypedLength_f32__UnknownUnit {
float _0;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo {
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo {
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo {
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo {
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
void first(void);
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Normal {
int32_t x;
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct ExtType {
uint32_t data;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Fns {
void (*noArgs)();
+2 -1
View File
@@ -1,3 +1,4 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
+2 -1
View File
@@ -1,4 +1,5 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct A {
int32_t x;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo {
float x;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum OnlyThisShouldBeGenerated {
Foo,
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum StyleOnlyThisShouldBeGenerated {
Foo,
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct A {
const int32_t *data;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#if defined(BAR)
#define BAR 2
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define EXPORT_ME_TOO 42
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Bar_Bar_f32 Bar_Bar_f32;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct A A;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Bar_Bar_f32 Bar_Bar_f32;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define FOO 10
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define FOO 10
+2 -1
View File
@@ -1,3 +1,4 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Opaque Opaque;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define PREFIX_LEN 42
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct PREFIXFoo {
int32_t a;
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct PREFIXBar {
int32_t a;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo {
int32_t x;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define C_H 10
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct A {
int32_t namespace_;
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Opaque Opaque;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Bar Bar;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Option_i32 Option_i32;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Opaque Opaque;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo {
int32_t a;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct StylePoint_i32 {
int32_t x;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct DummyStruct DummyStruct;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Foo_i32__i32 {
int32_t x;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Opaque Opaque;
+6
View File
@@ -0,0 +1,6 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
int32_t va_list_test(va_list ap);
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct ExtType {
uint32_t data;
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef void (*A)();
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#if defined(NOT_DEFINED)
#define DEFAULT_X 8
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,3 +1,4 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
+1
View File
@@ -1,2 +1,3 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#if (defined(PLATFORM_WIN) || defined(M_32))
enum BarType {
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,5 +1,6 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define Foo_FOO 0
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#define FOO 10
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
bool a;
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
float x;
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
enum A {
a1 = 0,
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
float _0;
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
void first(void);
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
int32_t x;
+1
View File
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
uint32_t data;
@@ -1,3 +1,4 @@
#include <cstdarg>
#include <cstdint>
#include <cstdlib>
+2 -1
View File
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
void (*noArgs)();

Some files were not shown because too many files have changed in this diff Show More