Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Problem with float parameters with CECIL.
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 2nd July 13:12
mathieu cuny
External User
 
Posts: 1
Default Problem with float parameters with CECIL.



Hello everybody !

I just encountered a problem while trying to use CECIL with ISE compiler
on Linux, and I was wondering whether anybody here might have already
seen it. It's my first try with CECIL, so i may not know everything which
is required...

I'm trying to call this Eiffel method from C.

set_values(px, py : REAL) is
...

So, i do something like

c_function(EIF_OBJECT e_object)
{
float value1, value2;

...values computations...

EIF_PROCEDURE proc;
proc = eif_procedure("set_angular_position", solar_system_type);
(proc)(eif_access(e_object), value1, value2);
}

in a function called by Eiffel, with e_objet set to current.
Actually, i followed CECIL array example, using floats instead of ints.
However, it did not seem to work with REAL. While the procedure is called
correctly, the values I get on C side are irrelevant, though they change
along C values.

I tried this code with INTEGER and int, and it worked flawlessly, like in
CECIL example. Is there someting special to do before using REAL and
floats ? I wouldn't have to revert to old style fixed decimal numbers.


By the way, i do that in order to do some calculations on C side, and get
the result back in Eiffel. Is there another way than using a set_values
procedure ? I haven't found a way to set a class attribute, since values
are copied when using eif_attribute.

Thanks,
Mathieu
  Reply With Quote


 


2 2nd July 13:12
emmanuel stapf [es]
External User
 
Posts: 1
Default Problem with float parameters with CECIL.



Instead try

((FUNCTION_CAST(void, (EIF_REFERENCE, EIF_REAL, EIF_REAL)) proc)
(eif_access (e_object), value1, value2);

and let us know if it works better.

Manu
  Reply With Quote


 


3 2nd July 13:12
mathieu cuny
External User
 
Posts: 1
Default Problem with float parameters with CECIL.


It works fine ! Thank you !
I guess i should have declared my Eiffel function in a .h file. Surely,
gcc used a default int type ?
  Reply With Quote
Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666