[comp.lang.eiffel] copy_structure and integers

breissinger-marc@CS.Yale.EDU (Marc Breissinger) (04/17/89)

I am attempting to use copy_structure and the INTERNAL class to allow
the passing of structures to C and back.  I first have a simple question:
what is the parameter n for.  All the docs say is that it is an
integer -- but what is it.  I have been using random numbers and
seeing what comes out the best.

I am also having larger problem with copy_structure.  The eiffel object
which I am copying onto consists of two features: numb1: INTEGER and
numb2: INTEGER (The class is called TEST_STRUCT).  The C structure looks
like this:

struct test_struct {
	int numb1;
	int numb2;
};

The C routine that I call sets the values in the structure and returns
a pointer to the structure.  When I call copy_structure with the params
of: a TEST_STRUCT object (inherits from INTERNAL), the returned pointer (an
INTEGER), and 2, all goes well except for one problem.  If numb1 was set
to an odd number in the C routine it becomes numb1 - 1 after the copy
structure.  numb2 is correct.  It seems that Eiffel is ignoring the first
(least significant) bit of numb1.

Does this happen because I don't have n set correctly?  Is this a problem
with Eiffel that must be worked around (how I don't know)?

Thanks for your help,
--Marc Breissinger