Added November 2014
DEFTYPE <typename> = <standard type>{,<size>}
DEFTYPE <typename> = <defstruct type>
DEFTYPE may be used to define an alias for a data type, with optional size, that can then be used in MAP statements and in Function and Procedure declarations. This can be useful in assuring consistency of logical data types through an application. For example:
DEFTYPE Boolean = I,2
deftype PRICE = F,8
deftype phone = ST_PHONE
map1 ready,Boolean ! equivalent to map1 ready,I,2
dimx total(10),PRICE ! equivalent to dimx total(10),F,8
map1 cellnum,phone ! equivalent to m1p cellnum,ST_PHONE
Function Fn'PiePrice(ala'mode as Boolean) as PRICE
! equivalent to: Function Fn'PiePrice(ala'mode as I,2) as F,8
Note that while DEFTYPE itself is case INsensitive, following the normal rule for keywords, the defined macro symbols are case sensitive—i.e., are the same as those created by DEFINE or DEFSTRUCT. You can compile with the case-insensitive option (/CI or -ci) if you prefer case insensitivity throughout.
History
2014 October, A-Shell 6.1.1391: Function added to A-Shell