Datatypes in the .swi files
Jan-Jaap van der Geer
jjvdgeer at inbox.com
Mon Jul 6 19:40:47 BST 2009
Hello,
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?
Same here:
SWI Wimp_LoadTemplate =
( NUMBER 0x400DB "Loads a template",
ENTRY
( R1 = .Ref Wimp_Window: window "pointer to buffer for
template, or Wimp_GetSize to return required buffer size",
R2 = .Ref .String: data,
R3 -> .Char: end,
R4 = .Ref Byte: font_ref,
^^^^
R5 = .Ref .String: name "pointer to a (wildcarded) name
to match (must be 12 bytes word-aligned)",
R6 = .Int: context
),
EXIT
( R0?,
R1 = .Int: used,
R2 = .Int: data_used,
R6! = .Int: context_out
) );
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?)
As far as I understand, datatypes that do not start with a dot are
datatypes that should be defined elsewhere. Byte and Void are not.
Naming standards within C mean that they get converted to lowercase
and therefore they work just fine.
At this moment I am not doing that for Vala (maybe I should but I
am so far being pigheaded so I'm not doing that just yet). The
result is that I end up with unknown datatypes (Byte and Void).
I tried exchanging the .Ref Byte with .Ref .Byte above, and the
generated .h code remains the same (haven't checked the others).
The same is true when I change it to .Ref .Data (which I feel is
even better).
Does this make sense? Or am I missing something?
Cheers,
Jan-Jaap
More information about the oslib-user
mailing list