Chapter 5-4 The Command Set DEFDBL - FIX

 DEFDBL Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

 DEFINT Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

 DEFINTL Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

 DEFSNG Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

 DEFSTR Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

 DEG Type: Command Syntax: DEG Explanation: Switches trigonometric functions to calculation by degree (0 to 360). Default setting is radian (0 to 2PI), see RAD. Example: DEG: PRINT SIN(45) RAD: PRINT SIN(45) Result: 0.707106781186548 0.850903524534119 See also: RAD

 DET Type: Function Syntax: DET(([],[])) Explanation: This function calculates the determinant of a quadratic matrix. The matrix must be available in the form of a two-dimensional floating point field. The size of the matrix must be specified for both dimensions. If the size specification is omitted, the maximum values used while dimensioning are applied automatically. Example: DATA 1.,2.,3.,4.,5.,6.,7.,8.,9. DIM Matrix!(2,2) FOR I=0 TO 2  FOR J=0 TO 2   READ Matrix!(I,J)  NEXT J NEXT I PRINT DET(Matrix!(,)) Result: 0

 DIM Type: Command Syntax: DIM ([[,([[,

 DMA_SOUND Explanation: Allocated for future applications! Please, do not use this word!!
 DPEEK Type: Function Syntax: DPEEK()  DPEEK(
) Explanation: Reads a floating point number with double precision at the address resulting from the numerical expression. This command might be used, e.g., to import non-Omikron-Basic data structures into Omikron Basic floating point numbers.
should be a number divisible by 8; otherwise, the function will be executed significantly slower. Example: Memory=MEMORY(10)  DPOKE Memory,-PI Minus_Pi# = DPEEK(Memory) PRINT Minus_Pi# Result: -3.14159265358979 See also: PEEK   WPEEK   LPEEK   SPEEK   POKE   WPOKE     LPOKE    SPOKE   DPOKE
 DPOKE Type: Command Syntax: DPOKE ,  DPOKE
, Explanation: Posts the value at the indicated address in the form of a double float number. This means you can write floating point numbers directly to memory. This command is quite useful for the construction of one's own data structures with floating point numbers.
should be a number divisible by 8; otherwise, the function will be carried out significantly slower. See also: PEEK   WPEEK   LPEEK   SPEEK   DPEEK   POKE   WPOKE    LPOKE    SPOKE

 DRAW Type: Command Syntax: DRAW [TO] ,[[ TO ,]] DRAW [TO] ,[[ TO ,]] Explanation: Draws a quadratic point at the coordinate given by X and Y. A line is drawn starting at the current position of the graphics pencil if TO has been indicated before this coordinate. Further coordinates separated by TO can be indicated optionally and then connected with lines. Caution: The graphics pencil is changed by other drawing commands as well as by TEXT and PRINT. For this reason, DRAW TO X,Y commands must follow each other immediately. Under no circumstances may other graphics commands be inserted between them. Color, line style, and line width can be indicated using LINE COLOR, LINE STYLE, and LINE WIDTH respectively. If a window is defined by means of CLIP, nothing is drawn outside of this area. Instead of the square pen you can also use a rectangular one. Width and height of this drawing pen can be set with the procedure Set_Pen_Size from the Extension Library. Note: DRAW X,Y draws only one individual pixel, even if the set line width is larger than 1. Other line attributes are also not considered in this case. If larger points are to be drawn, which also take the set MODE into consideration, DRAW X,Y TO X,Y can be used. This behavior was introduced in order to be able to draw individual pixels with a simplified function as fast as possible. Example: DRAW 100,100 DRAW 150,100 DRAW TO 100,150 DRAW 70,70 TO 20,30 TO 60,40 Result: Various points and lines are drawn onto the screen. See also: POLYGON

 DUMP Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

 EDIT Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use.

 ELLIPSE Type: Command Syntax: ELLIPSE ,,, [,,] ELLIPSE ,,,[,,] Explanation: Draws an ellipse around the center X,Y with the specified radii. Start and end angles can be indicated optionally in one-tenth of a degree. Angle=0 is to the right of the center, angle=900 is above the center, etc. Color, line style, and line width can be determined using LINE COLOR, LINE STYLE, and LINE WIDTH respectively. If a window is defined by means of CLIP, nothing is drawn outside of this area. See also: CIRCLE   PELLIPSE   PCIRCLE

 ELSE Type: Command Syntax: ELSE Explanation: This command is placed after an IF ... THEN ... structure and is executed exactly when the last IF ... THEN ...  condition is not true, that is, if the last condition is false. Example: IF 0=1   THEN PRINT "0 is equal to 1"   PRINT "Hamlet questioning his existence!" ELSE PRINT "0 is not equal 1"   PRINT "To be or not to be - that is the question!" ENDIF Result: 0 is not equal 1 To be or not to be - that is the question! See also: IF   THEN   ENDIF

 END Type: Command Syntax: END Explanation: Concludes program execution and closes all files. See also: CLEAR

 ENDIF Type: Command Syntax: ENDIF Explanation: ENDIF concludes the program branch that has been initiated with an IF statement. In the case of single-line structures such as IF ... THEN ... ELSE ... ENDIF, the ENDIF can also be omitted if no subsequent commands occur. Example: IF Count>Maximum THEN  Count=0  Max_Count+=1 ENDIF IF Day%=Monday% THEN PRINT "Today is Monday" ENDIF Day%+=1 'In this case, Day% is always incremented by 1, 'since the IF statement was previously concluded by ENDIF. Result: See also: IF

 END_FN Type: Command Syntax: END_FN Explanation: END_FN is used to conclude a multi-line function definition. END_FN has precisely the same effect as RETURN; however, it cannot return any values. Nevertheless, END_FN should always be used at the end of a function. This clearly determines the location at which the function is concluded, especially if several RETURN statements are present. Example: PRINT FN Factorial(10) END 'The function calls itself for as long as it takes 'to calculate the factorial (recursive programming). DEF FN Factorial(N)  IF N=1   THEN RETURN 1   ELSE RETURN FN Factorial(N-1)*N  ENDIF END_FN Result: 3628800 See also: DEF FN    END_PROC     RETURN

 END_PROC Type: Command Syntax: END_PROC Explanation: END_PROC is used to conclude a procedure definition. END_PROC approximately corresponds to the command RETURN, however, may be used exactly only once (namely at the end of the procedure). This clearly determines the location at which the procedure is concluded, especially if several RETURN statements are present. Example: DEF PROC Center(Text\$)  PRINT TAB((W_CHAR-LEN(Text\$))/2);Text\$; END_PROC Result: Text\$ is displayed centered on the screen. See also: DEF PROC    END_FN    RETURN

 END_SELECT Type: Command Syntax: END_SELECT Explanation: Concludes a SELECT ... CASE statement. If all possible alternatives are listed, the SELECT statement is concluded with END_SELECT. Example: INPUT "Value 1-3: ";Value SELECT Value  CASE 1 : PRINT "The value was one"  CASE 2 : PRINT "The value was two"  CASE 3 : PRINT "The value was three"  DEFAULT : PRINT "Only values between 1 and 3 are permitted" END_SELECT END Result: Depending on the entered value, the corresponding text is displayed.

 EOF Type: Function Syntax: EOF() EOF() Explanation: Returns -1 (=true), if the end of the file is reached, otherwise 0 (=false). The file must be opened first with OPEN. Example: OPEN "I",1,FN Get_Fsspec\$(0,0,"NEWOMBAS.INF") WHILE NOT EOF(1)  In\$=INPUT\$(1,1)  PRINT In\$; WEND CLOSE 1 Result: Outputs the content of NEWOMBAS.INF as a character string. See also: LOC   LOF   OPEN

 EQV Type: Operator Syntax: EQV Explanation: Links the two expressions with a logical operator bit-wise equivalently. Example: PRINT BIN\$((%1010 EQV %1100)+%10000) Result: 1001

 ERL Type: Function Syntax: ERL Explanation: Always returns the number of the line in which the last error occurred. This function can be used after e.g., ON ERROR GOTO in order to determine the error line. See also: ERR   ERR\$   ERROR

 ERR Type: Function Syntax: ERR Explanation: If an error occurs during the execution of the program, its number can be queried with ERR. Should an attempt be made to e.g., open a file for reading that does not exist, this circumstance can be determined by querying the function ERR immediately after the OPEN command. Note: Many BASIC commands reset ERR to 0. In order to catch a possible error, the query should be executed directly after the critical location and the error number saved into a variable for later use. Example: OPEN "I",1,FN Get_Fsspec\$(0,0,"nonexistent") Error%=ERR If Error% THEN PRINT "File does not exist!" END Result: File does not exist! See also: ERL   ERR\$   ERROR

 ERR\$ Type: Function Syntax: ERR\$ Explanation: The function of ERR\$ is identical to ERR, the only difference is that an error text is returned instead of a number. See also: ERL   ERR   ERROR

 ERROR Type: Command Syntax: ERROR() ERROR() Explanation: Creates the error specified by the numerical expression. This command can be used to pass on those errors within an error-handling routine to BASIC, which the programmer does not want to handle him- or herself. This results in a corresponding error message issued by Omikron Basic. Example: ERROR 5 Result: Illegal function call in line no. 0 See also: ERL   ERR   ERR\$   Error Messages of Omikron Basic

 EXEC Type: Command Syntax: EXEC [,] EXEC [,] Explanation: Starts any executable program as a child process. must contain a FileSpecificationRecord. It is possible to pass a HighLevelEvent to the child process in the second string expression. As a result, you can immediately name this file, which means that the file will be opened immediately after the start of the child program. Further detailed information about the different event types can be found in "Inside Macintosh, Toolbox Essentials" and "Inside Macintosh, Interapplication Communication". Example: PRINT "Which program should be started?" R=0:FILESELECT(P\$,F\$,R) If R THEN EXEC F\$ END Result: If the FILESELECT box was exited with 'Open', the selected program is started as a child process.

 EXIT Type: Command Syntax: EXIT {[]|TO

 EXP Type: Function Syntax: EXP() Explanation: Returns the value of the power of e (Euler's number) and the numerical expression. The reverse function is LN. Example: PRINT EXP(0) PRINT "Euler's number:"; EXP(1) Result: 1 Euler's number: 2.71828182845905 See also: SQR    LN   LOG

 EXPORT Type: Command Syntax: EXPORT [[<,statement>]] Explanation: This command may be used to determine which variables and functions are to be exported. The names of the statements to be exported are just separated by commas and listed behind the command. The command EXPORT is mainly required for the programming of shared libraries and plugins. Example: COMPILER "shlb" A=3 B#=1.2345 C\$="Sample String" EXPORT A,B#,C\$,FNEX Square#() DEF FNEX Square#(X#)=X#*X# Result: Various symbols are exported, which then can be imported by another program. See also: COMPILER "shlb"   MAC_OS   EXPORT_EXIT   EXPORT_INIT   EXPORT_MAIN   DEF FNEX  Sample program "SharedLib.BAS" in the DEMO folder.

 EXPORT_EXIT Type: Command Syntax: EXPORT_EXIT Explanation: This command may be used to determine which function is supposed to serve as termination routine. This function is called automatically before the program ends. This command is especially important for the programming of shared libraries and plugins since in these cases one has no control over when the library ends. If the user ends the main program which uses your library, then the Code Fragment Manager will also remove all other libraries from memory, which are no longer required. However, first the termination function defined by EXPORT_EXIT is called so that your program has the opportunity to finish any still outstanding tasks (e.g., saving modified data). Example: COMPILER "shlb" EXPORT_EXIT FNEX Library_Exit ... 'Your Library Program ... DEF FNEX Library_Exit  'Your Termination Program Code END_FN Result: After the user has ended the main program, the function 'FNEX Library_Exit' is still called before the Library ends. See also: COMPILER "shlb"   MAC_OS   EXPORT    EXPORT_INIT   EXPORT_MAIN   DEF FNEX Sample prorgam "SharedLib.BAS" in the DEMO folder.

 EXPORT_INIT Type: Command Syntax: EXPORT_INIT Explanation: This command may be used to determine which function is supposed to serve as the initialization routine. This function is called automatically before the program is used for the first time. This command is especially important for the programming of shared libraries and plugins since in these cases one has no control over when the library is being used. If the user starts the main program, which also uses your Library, then the Code Fragment Manager also loads into memory all other Libraries needed by the main program. This is followed by the immediate call of the initialization function defined by EXPORT_INIT so that your program has the opportunity to execute all required initializations (e.g., dimensioning fields, initializing global variables, load files). Example: COMPILER "shlb" EXPORT_EXIT FNEX Library_Init ... 'Your Library Program ... DEF FNEX Library_Init  'Your Initialization Program Code END_FN Result: After the user has started the main program the Library is also loaded into memory and the function 'FNEX Library_Init' will be called. See also: COMPILER "shlb"   MAC_OS   EXPORT    EXPORT_EXIT   EXPORT_MAIN   DEF FNEX Sample program "SharedLib.BAS" in the DEMO folder.

 EXPORT_MAIN Type: Command Syntax: EXPORT_MAIN Explanation: This command may be used to define a so-called main symbol. This command has no effect with normal applications because in these cases the main symbol is always the entry point (transition vector to the beginning of the program code). This command is significant for plugins because here information that is important for the main program has to be placed into the main symbol (e.g., name of plugin, version number, etc.). The type of information to be included in the main symbol can be requested from the creator of the main program for which you would like to write a plugin. Note: The main symbol has to be a constant string because the information has to be already known at compilation time. Example: COMPILER "shlb" EXPORT_MAIN "SampleLibrary, Version 1.23" ... 'Your Library Program ... Result: After the user has started the main program it will query information about your plugin via the main symbol. See also: COMPILER "shlb"   MAC_OS   EXPORT    EXPORT_EXIT   EXPORT_INIT   DEF FNEX

 FACT Type: Function Syntax: FACT() Explanation: Calculates the factorial of the numerical expression. Since calculation occurs via the gamma function (constant continuation of the factorial), floating point numbers may be specified as arguments as well. Negative integers return a NAN (Not A Number) as a result (pole). Positive numbers >170 return INF (+infinite). Example: PRINT FACT(10) PRINT FACT(171) PRINT FACT(-1) Result: 3628800 INF NAN

 FIELD Type: Command Syntax: FIELD [#], [AS ] [[, [AS ]]] FIELD [#], [AS ] [[, AS ]] Explanation: Defines the data structure for the random access file indicated by the file number. The file must have been opened previously using OPEN_"R." The length of the data set has to correspond to the total sentence lengths of the FIELD commands. If the data structure is too extensive to be defined in one line, then it is possible to divide it into two lines. A second FIELD statement can be used for this purpose, whereby the first amount without buffer variable represents the sum of all already listed commands. After a read cycle using GET, the buffer variables receive the read data set. During a write cycle using PUT, the contents of the buffer variables are saved as a data set. Care has to be taken to ensure that the length of the buffer variables remains unchanged at all times. To achieve this goal, the field contents can be passed using LSET or RSET. Furthermore, only single strings are permitted as buffer variables; field elements are not permitted. Buffer variables for FIELD statements must never be used locally (LOCAL). They should really remain reserved exclusively for use as file buffers. Example: OPEN "R",1,FN Get_Fsspec\$(0,0,"Addresses") FIELD 1,130,40 AS Name\$,40 AS Street\$,10 AS Zip\$,40 AS City\$ WHILE NOT EOF(1)  GET 1,0  LPRINT Name\$:LPRINT Street\$:LPRINT Zip\$;City\$ WEND CLOSE 1 Result: An address list is output to the printer. Of course, a file with the addresses has to have been created previously. See also: OPEN    GET    PUT

 FILES Explanation: Has no application purpose in Omikron Basic Mac and is ignored by the compiler. Please, do not use. FILES: Note: If you want to extract directories you may use OPEN "F".