Omikron BASIC for Apple Power Mac

7-13. List of Standard File Types Contents | 8. Extension Library

 

Chapter 7-14

The Most Important Data Structures of the MacOS


Many functions of the MacOS require so-called records or structures. These data structures are used either to pass parameters to the function or to return information in them. Therefore, Omikron Basic commands, which call on the MacOS directly, also use these structures. If these records are stored in strings (e.g., FILESELECT), it is very important to remember that the first element of a string is located in the first (1) position and not in position zero (0). In order to access the individual elements of a structure, one (1) has to be added in this case to the offsets in the subsequent tables.
The original terminology for the individual elements was retained to enable any user to refer to the original texts from the "Inside Macintosh" manual instantly. Unless otherwise indicated, strings are always intended as so-called PASCAL strings (1 byte of length followed by up to 255 characters).

File System Specification Record (FSSpec) (see also "Inside Macintosh, Files")
Every file used under the MacOS is clearly identified via a FSSpec. For example, such a record is returned from FILESELECT in the second parameter or the function 'GetFsspec$' from the Extension Library. The FSSpec must be indicated whenever a file is accessed (e.g., OPEN, NAME ...).
Offset

Name

Length Explanation

0

vRefNum

2

The VolumeReferenceNumber of the volume containing the specified file or the specified folder (fixed disk, diskette, CD-ROM).

2

parID

4

The DirectoryIdentificationNumber of the directory (folder) containing the specified file or specified sub-folder.

6

name

64

The name of the file or the folder.


New Standard File Reply Record (StandardFileReply) (see also "Inside Macintosh, Files")
The FileReplyRecord is returned in the first parameter by FILESELECT. It contains supplementary information.
Offset

Name

Length Explanation

0

sfGood

1

This byte is zero if the user clicked on 'Cancel'. This value is also returned by FILESELECT in the third parameter.

1

sfReplacing

1

This byte is not equal to zero if a file with the same name was replaced.

2

sfType

4

These 4 bytes describe the file type (e.g., "TEXT" or "APPL")

6

sfFile

70

This is the previously explained FileSpecificationRecord, which is also returned separately by FILESELECT in the second parameter.

76

sfScript

2

The used ScriptCode (e.g., Roman, Arabian, Japanese, ...)

78

sfFlags

2

The FinderFlags of the selected object. Further information about the selected file can be found here (e.g., file is invisible or write-protected).

80

sfIsFolder

1

This byte is not equal to zero if it concerns a folder.

81

sfIsVolume

1

This byte is not equal to zero if it concerns a volume.

82

sfReserved1

4

reserved

86

sfReserved2

2

reserved


RGB Color Data Structure (RGBColor) (see also "Inside Macintosh, Imaging with QuickDraw")
For example, the function POINT(X,Y) returns a pointer to a RGB color record.
Offset

Name

Length Explanation

0

red

2

Red component of the color as an unsigned integer number (0 - 65535)

2

green

2

Green component of the color as an unsigned integer number (0 - 65535)

4

blue

2

Blue component of the color as an unsigned integer number (0 - 65535)

7-13. List of Standard File Types Contents | 8. Extension Library

Tech-Support | Order | Start | Home: http://www.berkhan.com


© 1997-2001 Berkhan-Software