Re: Strange problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

Lewis Townsend wrote:

>include misc.e
>
>global constant
>  POSITION =      4,
>    LEFT =          4.1,
>    TOP =           4.2,
>  DEMINSIONS =    5,
>    WIDTH =         5.1,
>    HEIGHT =        5.2,
>    objects = {
>                {1,0,{},{ 0, 0},{639,479}, 1,1,1},
>                {1,0,{},{10,10},{459,459},-1,1,1}
>              }
>
>global function Get (integer obj, atom att)
>  if length (objects) < obj or obj = 0 then
>    puts (1, "Error: " & sprint (obj) & " is an invalid object handle!\n")
>  elsif length (objects [obj]) < att then
>    puts (1, "Error: " & sprint (att) & " is an invalid object handle!\n")
>  elsif not integer (att) then
>    return objects [obj] [floor (att)] [((att - floor (att)) * 10)] -->ERROR
>  else
>    return objects [obj] [att]
>  end if
>end function
>
>object view
>view = 2
>constant vp = {Get (view,WIDTH),Get (view, HEIGHT)}
>? {Get(view,LEFT), Get(view,TOP)})


Neither WIDTH nor HEIGHT are either integers or atoms, but floats because
they are declared with a decimal. I am not sure what that means for their
use as atoms in the function Get(), but it can't be nice. In this particular
case,
it doesn't matter, because (att-floor(att)) will always be 0 if att has already
been rounded to an integer by being stuffed into an atom. I think that is
your problem.

Everett L.(Rett) Williams
rett at gvtc.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu