Datatypes in the .swi files

Jan-Jaap van der Geer jjvdgeer at inbox.com
Mon Aug 17 21:43:24 BST 2009


Sorry for the late reply. Holidays and other things...

John Tytgat <John.Tytgat at aaug.net> wrote:

> In message <6b70bc7650.Jan-Jaap at iyonix.c2i.net>
>           Jan-Jaap van der Geer <jjvdgeer at inbox.com> wrote:

> > I am modifying DefMod to generate bindings for the Vala
> > programming language. While doing that I found some entries
> > that I find surprising. Does anyone have an idea about if these
> > are actually correct?

> > CONST
> >    Wimp_NoFonts = .Ref Byte: -1,             //for Wimp_LoadTemplate

> > Shouldn't that be .Ref .Byte or even .Ref .Data?

> One of the two yes.  Although I don't think it will make a
> difference in the produced header or object files.  Nevertheless,
> I've updated DefMod2 so that it now issues a warning when a type
> gets used which is one of the built-in types but without leading
> dot.

Thanks! This helps a lot, as the Vala/Vapi files I generate do not
get lowercased, they remained "Byte" which did not make sense. Now
it works fine.

> And I fixed all cases where that new warning was triggered.

Great work!

> Whether .Data would be better than .Byte, I really don't know as
> I don't understand the relevant difference between those. Could
> someone enlighten us ? Otherwise it is better to get rid of one
> of those types for clarity reasons.

> > [...]
> > This one I find strange as well:

> > SWI WimpClaimFreeMemory_Alloc =
> >    (  NUMBER 0x400EE,
> >       ENTRY
> >       (  R0 # 1  "Claims the whole of the Wimp's free memory pool for the
> >                	  calling task - Deprecated under Risc OS 3.7+",
> >          R1 = .Int: size
> >       ),
> >       EXIT
> >       (  R0?,
> >          R1 = .Int: size_out,
> >          R2! = .Ref Void: blk
> >                     ^^^^
> >    )  );

> > I would have changed the .Ref Void there to .Ref .Byte but of
> > course that would change the datatype for
> > WimpClaimFreeMemory_Alloc (may not a big problem for a
> > deprecated SWI?)

> ".Ref Void" is used at several places in the OSLib .swi files and
> it is not clear to me why that gets choosen instead of ".Ref
> .Byte" or ".Ref .Data".

> Actually it is a bit confusing because in defmod.y we have a rule
> for ".void" lex word so one would think this should be ".Ref
> .Void", i.e. "void" being one of the built-in types as well but
> that's not working (well) nor even intended as far as I can see
> (my Yacc powers are not that great so I might have missed
> something obvious).

Hm. I am confused :)

Anyway, I have special-cased the "Void" datatype. Don't like it,
but it works.

> > Byte and Void are not.

> The type names get lowercased and 'byte' is defined in
> oslib/types.h and 'void' is a native C type.

This is true for the .h yes, but not necessarily for all languages
:-)

> Hope this helps a bit,

Most definetely! Thanks!

I think I spotted an error in the Wimp.swi file:

TYPE Wimp_ReleaseFlags = .Bits; CONST
   Wimp_ReleaseClipboard = Wimp_ClaimFlags: 0b100
      "clipboard being released";

I think this should read:

TYPE Wimp_ReleaseFlags = .Bits; CONST
   Wimp_ReleaseClipboard = Wimp_ReleaseFlags: 0b100
      "clipboard being released";

Cheers,
Jan-Jaap



More information about the oslib-user mailing list