Hi Joep,

I was in mind that defined() required a constant, not a variable. I'll try
this !

Seb

2009/3/21 Joep Suijs <[email protected]>

>
> Hi Seb,
>
> >   2. provide a library for only one GP2D02 instance
> >   3. build a library with a fixed number of GP2D02 instances
> >
> > Whatever option 2. or 3., the API will be temporary (thus option 1.: we
> may
> > not want providing temporary API). For option 3., these would give
> something
> > like this:
> >
> > var volatile byte gp2d02_vin_0 is pin_a4
> > var volatile byte gp2d02_vout_0 is pin_a6
> > var volatile byte gp2d02_vin_1 is pin_a2
> > var volatile byte gp2d02_vout_1 is pin_a3
> > ...
> I suggest you change the sequence:
>
> var volatile byte gp2d02_0_vin is pin_a2
> var volatile byte gp2d02_0_vout is pin_a3
>
> > -- all must be defined, even if only one used (?). Not "acceptable" IMHO
> No.
>
> You could do a conditional compile for the functions required:
>
> if (defined(gp2d02_0_vin) == true) then
>   function gp2d02_0_read is
>    ...
>   end function
> end if
>
> or you could something similar within a generic read functions
>
>  case (idx) of
>
>      if (defined(gp2d02_0_vin) == true) then
>        0 :  block
>        ...
>        end block
>     end if
>     if (defined(gp2d02_1_vin) == true) then
>        1 :  block
>        ...
>        end block
>     end if
>
>     default:
>       ....
>    end case
>
>
> I think this way you should get it to work. And you get a decent api
> for the use of the lib.
>
> We should realy thank Stef for the conditional compile. I understand
> people how studied computer sciences think it is horrible, but for a
> practical guy like me it is very powerfull. If we only could have
> marco's ;)
>
>
> Joep
>
> >
>


-- 
Sébastien Lelong
http://www.sirloon.net
http://sirbot.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to