Skip to content

Instantly share code, notes, and snippets.

@vrotaru
Last active December 24, 2018 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vrotaru/f10f1ef272652ed8c321de761b34a245 to your computer and use it in GitHub Desktop.
Save vrotaru/f10f1ef272652ed8c321de761b34a245 to your computer and use it in GitHub Desktop.
diff --git a/Makefile b/Makefile
index e6d99d2..6307f03 100644
--- a/Makefile
+++ b/Makefile
@@ -40,9 +40,16 @@ clean:
$(MAKE) -C wxWidgets_cpp clean
ocp-build clean
-distclean: clean ocp-distclean
+distclean: clean
+ rm -rf config/autom4te.cache config/config.status config/config.log
+ rm -f config.ocp config/Makefile
rm -f ocp-build.root*
+configure: config/configure.ac config/m4/*
+ cd config; \
+ aclocal -I m4; \
+ autoconf
+
ML_CFG=wxConfig
ML_SRC=wxWidgets_cpp
diff --git a/examples/drawing/drawing.ml b/examples/drawing/drawing.ml
index 7788195..acc3fc1 100644
--- a/examples/drawing/drawing.ml
+++ b/examples/drawing/drawing.ml
@@ -552,27 +552,27 @@ let myCanvas_DrawTestLines frame (x, y, width, dc) =
WxDC.drawText dc ("User dash") ( x + 150) ( y + 140);
let ud = wxPen black width wxUSER_DASH in
- let dash1 = String.create 6 in
- dash1.[0] <- Char.chr 8; (* Long dash <---------+ *)
- dash1.[1] <- Char.chr 2; (* Short gap | *)
- dash1.[2] <- Char.chr 3; (* Short dash | *)
- dash1.[3] <- Char.chr 2; (* Short gap | *)
- dash1.[4] <- Char.chr 3; (* Short dash | *)
- dash1.[5] <- Char.chr 2; (* Short gap and repeat + *)
- WxPen.setDashes ud dash1 ;
+ let dash1_bytes = Bytes.create 6 in
+ Bytes.set dash1_bytes 0 (Char.chr 8);
+ Bytes.set dash1_bytes 1 (Char.chr 2);
+ Bytes.set dash1_bytes 2 (Char.chr 3);
+ Bytes.set dash1_bytes 3 (Char.chr 2);
+ Bytes.set dash1_bytes 4 (Char.chr 2);
+ Bytes.set dash1_bytes 5 (Char.chr 2);
+ WxPen.setDashes ud Bytes.(to_string dash1_bytes) ;
WxDC.setPen dc ud ;
WxDC.drawLine dc ( x+20) ( y+140) 100 ( y+140 );
- dash1.[0] <- Char.chr 5; (* Make first dash shorter *)
- WxPen.setDashes ud dash1 ;
+ dash1_bytes.[0] <- Char.chr 5; (* Make first dash shorter *)
+ WxPen.setDashes ud Bytes.(to_string dash1_bytes) ;
WxDC.setPen dc ud ;
WxDC.drawLine dc ( x+20) ( y+150) 100 ( y+150 );
- dash1.[2] <- Char.chr 5; (* Make second dash longer *)
- WxPen.setDashes ud dash1 ;
+ dash1_bytes.[2] <- Char.chr 5; (* Make second dash longer *)
+ WxPen.setDashes ud Bytes.(to_string dash1_bytes) ;
WxDC.setPen dc ud ;
WxDC.drawLine dc ( x+20) ( y+160) 100 ( y+160 );
- dash1.[4] <- Char.chr 5; (* Make third dash longer *)
- WxPen.setDashes ud dash1 ;
+ dash1_bytes.[4] <- Char.chr 5; (* Make third dash longer *)
+ WxPen.setDashes ud Bytes.(to_string dash1_bytes) ;
WxDC.setPen dc ud ;
WxDC.drawLine dc ( x+20) ( y+170) 100 ( y+170 );
()
diff --git a/wxStubsGen/genCplusplus.ml b/wxStubsGen/genCplusplus.ml
index 68d0a34..e9b25d1 100644
--- a/wxStubsGen/genCplusplus.ml
+++ b/wxStubsGen/genCplusplus.ml
@@ -126,7 +126,10 @@ let generate_method_stub_body oc cl p out_nargs =
let wxClass_equiv = find_cpp_equiv wxClass in
if List.mem wxClass_equiv direct_return_types then
- fprintf oc " %s %s_c;\n" wxClass arg_name
+ if wxClass = "int32" || wxClass = "int64" then
+ fprintf oc " %s_t %s_c;\n" wxClass arg_name
+ else
+ fprintf oc " %s %s_c;\n" wxClass arg_name
else
fprintf oc " %s* %s_c = new %s();\n" wxClass arg_name wxClass;
| Out, _ -> assert false
@@ -216,7 +219,10 @@ let generate_method_stub_body oc cl p out_nargs =
let wxClass_equiv = find_cpp_equiv wxClass in
if List.mem wxClass_equiv direct_return_types then
- fprintf oc "%s ret_c = " wxClass
+ if wxClass = "int32" || wxClass = "int64" then
+ fprintf oc "%s_t ret_c = " wxClass
+ else
+ fprintf oc "%s ret_c = " wxClass
else begin
fprintf oc "%s *ret_c = new %s();\n" wxClass wxClass;
fprintf oc " *ret_c = ";
diff --git a/wxStubsGen/genMisc.ml b/wxStubsGen/genMisc.ml
index f62b70e..f1d6164 100644
--- a/wxStubsGen/genMisc.ml
+++ b/wxStubsGen/genMisc.ml
@@ -53,18 +53,18 @@ let close_out maybe =
let fprintf oc = Printf.fprintf oc.oc
-let s = String.create 32768
+let bytes = Bytes.create 32768
let string_of_channel ic =
let b = Buffer.create 1000 in
- let rec iter ic b s =
- let nread = input ic s 0 32768 in
+ let rec iter ic b bytes =
+ let nread = input ic bytes 0 32768 in
if nread > 0 then begin
- Buffer.add_substring b s 0 nread;
- iter ic b s
+ Buffer.add_bytes b bytes;
+ iter ic b bytes
end
in
- iter ic b s;
+ iter ic b bytes;
Buffer.contents b
let string_of_file filename =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment