News:

;) This forum is the property of Proton software developers

Main Menu

Compile-time variable type information

Started by LeonJ, Today at 04:53 PM

Previous topic - Next topic

LeonJ

Question regarding compile-time variable type information

Hi Les / everyone,

While developing a command-driven object interface for Trastikata's TFT graphics library, I have been looking at ways to make the Object Interface (OI) wrappers (which call the library procedures) more generic.

Positron obviously knows a variable's type during compilation, since it can handle things like:

MyVar = MyDword.Float

and:

SizeOf(MyVar)

My requirement is not runtime type discovery (I understand that the PIC does not store type information with variables once the code is compiled).

What I would like to know is whether Positron exposes any compile-time intrinsic that can return a variable's declared type, something along the lines of:

If VarType(MyVar) = _Word Then
    ...
ElseIf VarType(MyVar) = _Float Then
    ...
EndIf

or perhaps:

Select VarType(MyVar)

Case _Byte
Case _Word
Case _DWord
Case _Float

EndSelect

The purpose would be to allow generic procedures/macros to generate the correct code depending on the destination variable type for a procedure call.

For example, my OI layer currently has to manually know that:

ArcRL: (draw an Arc)

    parameter 6  = Bit
    parameter 8  = SWord
    parameter 9  = SWord
    parameter 10 = Float

and then load temporary variables of the correct type before calling the library procedure.

A compile-time VarType() (if possible) would allow this type mapping to become much more automatic.

Does Positron have such a feature already, or is there another recommended method for obtaining a variable's declared type during compilation?

Thanks.

RGV250

Hi,
It looks like you want structures which Positron does not support.

Regards,
Bob