Atari ST GFA basic : what do variable suffixes correspond to?
Asked Answered
G

3

5

I'm dusting off my Atari ST 520, and am trying to understand some semantic details of the GFA basic. The TYPE(ptr) function is documented this way :

     Determines the type of the variable at which a pointer
       is set.
       'ptr' is an integer expression (usually *var).
       TYPE(ptr) returns a code according to the type of
       variable to which 'ptr' is pointing.
           0=var  
           1=var$  
           2=var%  
           3=var!  
           4=var()  
           5=var$()
           6=var%()  
           7=var!()

The same documentation does not talk about what these suffixes mean. (It must be so obvious)

I seem to recall that $ is a string/memory block, % an integer, () an array of the same. What are ! and nothing? ! seems to be used for 0/1 variables.

Guardhouse answered 26/2, 2014 at 10:24 Comment(0)
V
7

That's correct $ string, % integer, ! boolean , and nothing (0) is double.

http://www.atari-forum.com/wiki/index.php?title=GFAvariablestutorial

Voluptuous answered 4/3, 2014 at 14:43 Comment(0)
F
1

The final version of the manual states:

Boolean  !  1 byte (1 bit in arrays)  0 or -1 (FALSE or TRUE)
Byte     |  1 byte                    0 to 255
Word     &  2 bytes                   -32768 to 32767
Long     %  4 bytes                   -2147483648 to 2147483647
Float    #  8 bytes                   2.225073858507E-308 to 3.595386269725E+308
String   $  0 to 32767 bytes          ASCII value 0 to 255 for each character

The default variable type doesn't display a suffix and can be changed.

Fret answered 25/8, 2020 at 14:47 Comment(1)
Thank you for your answer. I see that the list you provided includes # for Float. What is the documentation for TYPE(ptr), in the same version of the manual?Guardhouse
R
1

TYPE(ptr) returns a code according to
the type of variable to which 'ptr' is pointing.

GFA BASIC v2.xx

code meaning suffix bits
-1 error occured
0 real max. 1.0E+154 48
1 string $ max. 32767 characters
2 long % [-2147483648,2147483647] 32
3 boolean ! [-1,0] 16
4 real array ()
5 string array $()
6 long array %()
7 boolean array !() 1

GFA BASIC v3.xx

code meaning suffix bits
-1 error occured
0 real # max. 3.595386269725E+308 64
1 string $ max. 32767 characters
2 long % [-2147483648,2147483647] 32
3 boolean ! [-1,0] 16
4 real array ()
5 string array $()
6 long array %()
7 boolean array !() 1
8 card & [-32768,32767] 16
9 byte l [0,255] 8
10
11
12 card array &()
13 byte array l()
14
15

Without a suffix the type defaults to real but this also depends on any DEFBIT (!), DEFBYT(|), DEFFLT(#), DEFINT(%), DEFSTR($), or DEFWRD (&) that could be active.

Until I can find a solution I will represent the byte symbol "|" as "l" in the above table.

Remake answered 8/10 at 21:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.