Wimp_SetIconState block

Jonathan Coxhead jonathan at doves.demon.co.uk
Tue Aug 27 01:49:59 BST 2002


On 25 Aug 2002, at 4:03, Philip Ludlam wrote:

> Hi there,
> 
> Whilst programming with OSLib I discovered that OSLib didn't define a
> block suitable for the Wimp_SetIconState SWI.
> 
> I quickly whipped up:
> typedef struct wimp_set_icon_state_block
> { wimp_w w;
>   wimp_i i;
>   wimp_icon_flags eor_bits;
>   wimp_icon_flags clear_bits;
> } wimp_set_icon_state_block;
> and have been using it without a problem.
> 
> Is there a reason why OSLib doesn't have a similar definition (does it
> expect you to use the oslib call rather than set up a block and call the
> SWI yourself) or is it just an omission?

   The latter.

   In fact, there is a generalised facility in DefMod to do this by magic: the 
SWI definition for Wimp_SetIconState is

   SWI Wimp_SetIconState =
   (  NUMBER 0x400CD "Sets a given icon's state held in its flags word",
      ENTRY
      (  R1 ->
         .Struct
         (  Wimp_W: w,
            Wimp_I: i,
            Wimp_IconFlags: eor_bits,
            Wimp_IconFlags: clear_bits
         ): state_change
      ), //_BLOCK()
      EXIT (R0?)
   )

and the C prototype that it generates is

   os_error *xwimp_set_icon_state
   (
      wimp_w w,
      wimp_i i,
      wimp_icon_flags eor_bits,
      wimp_icon_flags clear_bits
   )

   It's the *veneer* that creates the structure. For some reason, this seemed 
like a useful general-purpose pattern that might recur---but I don't think any 
other SWI has this form, so it's left as a bit of an oddity.

        /|
 o o o (_|/
        /|
       (_/



More information about the oslib-user mailing list