You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 1517 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: -for CamlIDL use https://github.com/xavierleroy/camlidl/issues
The conversion function from C to ocaml of structs with fields of floats only
seems to be badly generated by camlidl. To give the simplest example, the
following idl declaration :
Which has the annoying property of generating points in ocaml whose second
coordinate is projected on the x axis.
The following change in the function `convert_fields' defined for the special
case of structures of floats only seems to give me more expectable results.
*** camlidl-1.04/compiler/struct.ml Sun Jan 12 23:13:17 2003
--- camlidl-1.04/compiler/struct.ml.bug Mon Jan 6 00:46:57 2003
*** 101,107 ****
let rec convert_fields pos = function
[] -> ()
| f :: rem ->
! iprintf oc "Store_double_field(%s, %d, %s.%s);\n" v pos c
f.field_name;
convert_fields (pos + 1) rem in
convert_fields 0 sd.sd_fields
end else begin
--- 101,107 ----
let rec convert_fields pos = function
[] -> ()
| f :: rem ->
! iprintf oc "Store_double_val(%s, %s.%s);\n" v c f.field_name;
convert_fields (pos + 1) rem in
convert_fields 0 sd.sd_fields
end else begin
Double check this, given my poor understanding of the ocaml/c interface.
Best regards,
Daniel
The text was updated successfully, but these errors were encountered:
Original bug ID: 1517
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: -for CamlIDL use https://github.com/xavierleroy/camlidl/issues
Bug description
Full_Name: Daniel Bünzli
Version: ocaml 3.06/ camlidl 1.04
OS: macos 10.2.3
Submission from: dialin-client-62-2-142-120.hispeed.ch (62.2.142.120)
Dear Bugmaster,
The conversion function from C to ocaml of structs with fields of floats only
seems to be badly generated by camlidl. To give the simplest example, the
following idl declaration :
typedef struct {
float x;
float y;
} point;
generates this C code :
value camlidl_c2ml_struc_point(point * _c2, camlidl_ctx _ctx)
{
value _v1;
_v1 = camlidl_alloc_small(2 * Double_wosize, Double_tag);
Store_double_val(_v1, (_c2).x);
Store_double_val(_v1, (_c2).y);
return _v1;
}
Which has the annoying property of generating points in ocaml whose second
coordinate is projected on the x axis.
The following change in the function `convert_fields' defined for the special
case of structures of floats only seems to give me more expectable results.
*** camlidl-1.04/compiler/struct.ml Sun Jan 12 23:13:17 2003
--- camlidl-1.04/compiler/struct.ml.bug Mon Jan 6 00:46:57 2003
*** 101,107 ****
let rec convert_fields pos = function
[] -> ()
| f :: rem ->
! iprintf oc "Store_double_field(%s, %d, %s.%s);\n" v pos c
f.field_name;
convert_fields (pos + 1) rem in
convert_fields 0 sd.sd_fields
end else begin
--- 101,107 ----
let rec convert_fields pos = function
[] -> ()
| f :: rem ->
! iprintf oc "Store_double_val(%s, %s.%s);\n" v c f.field_name;
convert_fields (pos + 1) rem in
convert_fields 0 sd.sd_fields
end else begin
Double check this, given my poor understanding of the ocaml/c interface.
Best regards,
Daniel
The text was updated successfully, but these errors were encountered: