fix bindgen
This commit is contained in:
parent
a110f2d3de
commit
a1f7444342
4 changed files with 14 additions and 10 deletions
2
Makefile
2
Makefile
|
|
@ -19,8 +19,6 @@ format:
|
||||||
OBJS = src/core.o src/widget/base.o
|
OBJS = src/core.o src/widget/base.o
|
||||||
include objs.mk
|
include objs.mk
|
||||||
|
|
||||||
src/widget/base.o: src/widget/base.cc src/widget/baseauto.cc
|
|
||||||
|
|
||||||
test$(EXEC): test.o
|
test$(EXEC): test.o
|
||||||
$(CXX) -L. -Wl,-R$(MILSKO)/src -Wl,-R$(MILSKO)/lib -Wl,-R. -o $@ test.o -lMwCXX
|
$(CXX) -L. -Wl,-R$(MILSKO)/src -Wl,-R$(MILSKO)/lib -Wl,-R. -o $@ test.o -lMwCXX
|
||||||
|
|
||||||
|
|
|
||||||
16
bindgen.cc
16
bindgen.cc
|
|
@ -13,6 +13,7 @@ struct typeinfo {
|
||||||
std::string struct_name;
|
std::string struct_name;
|
||||||
std::string widget_type;
|
std::string widget_type;
|
||||||
int pointer;
|
int pointer;
|
||||||
|
int unsigned_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct property {
|
struct property {
|
||||||
|
|
@ -38,6 +39,8 @@ static std::string get_ctype(typeinfo type, int name = 1, int do_ptr = 1) {
|
||||||
|
|
||||||
if(type.type == "integer") {
|
if(type.type == "integer") {
|
||||||
ret += "int";
|
ret += "int";
|
||||||
|
} else if(type.type == "short") {
|
||||||
|
ret += "short";
|
||||||
} else if(type.type == "string") {
|
} else if(type.type == "string") {
|
||||||
ret += "MwCXX::String";
|
ret += "MwCXX::String";
|
||||||
} else if(type.type == "pixmap") {
|
} else if(type.type == "pixmap") {
|
||||||
|
|
@ -54,6 +57,8 @@ static std::string get_ctype(typeinfo type, int name = 1, int do_ptr = 1) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(type.unsigned_num) ret = "unsigned " + ret;
|
||||||
|
|
||||||
if(do_ptr && type.pointer) ret += "*";
|
if(do_ptr && type.pointer) ret += "*";
|
||||||
|
|
||||||
if(name && type.name != "") {
|
if(name && type.name != "") {
|
||||||
|
|
@ -99,11 +104,12 @@ static typeinfo xml_to_type(xl_node_t* node) {
|
||||||
char* s;
|
char* s;
|
||||||
typeinfo ret;
|
typeinfo ret;
|
||||||
|
|
||||||
ret.type = node->name;
|
ret.type = node->name;
|
||||||
ret.name = ((s = xl_get_attribute(node, "name")) != NULL) ? s : "";
|
ret.name = ((s = xl_get_attribute(node, "name")) != NULL) ? s : "";
|
||||||
ret.struct_name = ((s = xl_get_attribute(node, "defname")) != NULL) ? s : "";
|
ret.struct_name = ((s = xl_get_attribute(node, "defname")) != NULL) ? s : "";
|
||||||
ret.widget_type = ((s = xl_get_attribute(node, "type")) != NULL) ? s : "";
|
ret.widget_type = ((s = xl_get_attribute(node, "type")) != NULL) ? s : "";
|
||||||
ret.pointer = ATTR_TO_BOOL(node, "pointer");
|
ret.pointer = ATTR_TO_BOOL(node, "pointer");
|
||||||
|
ret.unsigned_num = ATTR_TO_BOOL(node, "unsigned");
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <MwCXX/Widget/All.h>
|
#include <MwCXX/Widget/All.h>
|
||||||
|
|
||||||
namespace MwCXX {
|
namespace MwCXX {
|
||||||
MwCXX::Window* MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, int flag);
|
MwCXX::Window* MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, unsigned int flag);
|
||||||
MwCXX::Button* MessageBoxGetChild(MwCXX::Window* handle, int child);
|
MwCXX::Button* MessageBoxGetChild(MwCXX::Window* handle, int child);
|
||||||
void MessageBoxDestroy(MwCXX::Window* handle);
|
void MessageBoxDestroy(MwCXX::Window* handle);
|
||||||
}; // namespace MwCXX
|
}; // namespace MwCXX
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <MwCXX/Dialog/MessageBox.h>
|
#include <MwCXX/Dialog/MessageBox.h>
|
||||||
|
|
||||||
MwCXX::Window* MwCXX::MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, int flag) {
|
MwCXX::Window* MwCXX::MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX::String title, unsigned int flag) {
|
||||||
return new MwCXX::Window(MwMessageBox(handle->GetWidget(),
|
return new MwCXX::Window(MwMessageBox(handle->GetWidget(),
|
||||||
#ifdef MWCXX_USE_C_STRING
|
#ifdef MWCXX_USE_C_STRING
|
||||||
text
|
text
|
||||||
|
|
@ -14,7 +14,7 @@ MwCXX::Window* MwCXX::MessageBox(MwCXX::Base* handle, MwCXX::String text, MwCXX:
|
||||||
title.c_str()
|
title.c_str()
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
(int)flag),
|
(unsigned int)flag),
|
||||||
handle);
|
handle);
|
||||||
}
|
}
|
||||||
MwCXX::Button* MwCXX::MessageBoxGetChild(MwCXX::Window* handle, int child) {
|
MwCXX::Button* MwCXX::MessageBoxGetChild(MwCXX::Window* handle, int child) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue