7:d:  :! "Times New Roman$(Plain Text%! "Courier New$ .Ak ABS )Usage: a=ABS(x) )Returns the absolute value of a floating-point number that is, without any +/- sign for example ABS(-10.099) is 10.099@If x is an integer, you wont get an error, but the result will be converted to floating-point for example ABS(-6) is 6.0. Use IABS to return the absolute value as a long integer.ACOSUsage: a=ACOS(x)Returns the arc cosine, or inverse cosine (COS-1) of x. x must be in the range -1 to +1. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.ADDRUsage: a&=ADDR(variable)Returns the address at which variable is stored in memory. The values of different types of variables are stored in bytes starting at ADDR(variable). See PEEK for details.The maximum address is guaranteed to be less than 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.(3) See SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, a& is guaranteed to fit into an integer.See UADD, USUB.ADJUSTALLOCpcelln&=ADJUSTALLOC(pcell&,off&,am&)Opens or closes a gap at off& (off%) within the allocated cell pcell& (pcell%), returning the new cell address or zero if out of memory. off& (off%) is 0 for the first byte in the cell. Opens a gap if the amount am& (am%) is positive, and closes it if negative.The number of bytes allocated is restricted to 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.Cells are allocated lengths that are the smallest multiple of four greater than the size requested. An error will be raised if the cell address argument is not in the range known by the heap.See also SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, pcelln& is guaranteed to fit into an integer.See ALLOC. See also the Advanced Topics chapter.ALERTr%=ALERT(m1$,m2$,b1$,b2$,b3$)r%=ALERT(m1$,m2$,b1$,b2$)r%=ALERT(m1$,m2$,b1$)r%=ALERT(m1$,m2$)r%=ALERT(m1$)Presents an alert - a simple dialog - with the messages and keys specified, and waits for a response. m1$ is the message to be displayed on the first line, and m2$ on the second line. If m2$ is not supplied or if it is a null string, the second message line is left blank.Up to three keys may be used. b1$, b2$ and b3$ are the strings (usually words) to use over the keys. b1$ appears over an Esc key, b2$ over Enter, and b3$ over Space. This means you can have Esc, or Esc and Enter, or Esc, Enter and Space keys. If no key strings are supplied, the word CONTINUE is used above an Esc key.The key number 1 for Esc, 2 for Enter or 3 for Space is returned.Constants for these return values are supplied in Const.oph.ALLOCpcell&=ALLOC(size&)Allocates a cell on the heap of the specified size, returning the pointer to the cell or zero if there is not enough memory.The number of bytes allocated is restricted to 64K on the Series 3c, while it is not on the Series 5. The return type therefore must be a long integer on the Series 5, but may be an integer on the Series 3c.Cells are allocated lengths that are the smallest multiple of four greater than the size requested. An error will be raised if the cell address argument is not in the range known by the heap.See also SETFLAGS if you require the 64K limit to be enforced. If the flag is set to restrict the limit, pcelln& is guaranteed to fit into an integer.See ADJUSTALLOC, REALLOC, FREEALLOC.APPAPP caption,uid&Begins definition of an OPL application. caption is the applications name (or caption) in the machines default language. Note that although caption is a string, it is not enclosed in quotes.uid& is the applications UID. For distributed applications, official reserved UIDs must be used. These can be obtained by contacting Psion Software plc (see the OPL applications section in the Advanced Topics chapter for details of how to do this).All information included in the APP...ENDA structure will be used to generate an AIF file which specifies the applications caption in various languages, its icons for use on the System screen and its setting of FLAGS. See the Advanced Topics chapter for further details of this.See CAPTION, ICON, FLAGS.APPENDAPPENDAdds a new record to the end of the current data file. The record which was current is unaffected. The new record, the last in the file, becomes the current record.The record added is made from the current values of the field variables A.field1$, A.field2$, and so on, of the current data file. If a field has not been assigned a value, zero will be assigned to it if it is a numeric field, or a null string if it is a string field.Example:PROC add: OPEN address,A,f1$,f2$,f3$ PRINT ADD NEW RECORD PRINT Enter name:, INPUT A.f1$ PRINT Enter street:, INPUT A.f2$ PRINT Enter town:, INPUT A.f3$ APPEND CLOSEENDPTo overwrite the current record with new field values, use UPDATE. On the Series 5, INSERT, PUT and CANCEL should be used in preference to APPEND and UPDATE, although APPEND and UPDATE are still supported for Series 3c compatibility. However, note that APPEND can generate a lot of extra (intermediate) erased records. COMPACT should be used to remove them, or alternatively use SETFLAGS to set auto-compaction on. See the Series 5 Database Handling chapter for more details. See also INSERT, MODIFY, PUT, CANCEL, SETFLAGSASCa%=ASC(a$)Returns the character code of the first character of a$. For the Series 5, see Appendix D for the character set and for the Series 3c, see the character set in the back of the User Guide for the character codes. Alternatively, use A%=%char to find the code for char - e.g. %X for X.If a$ is a null string () ASC returns the value 0.Example: A%=ASC(hello) returns 104, the code for h.ASINa=ASIN(x)Returns the arc sine, or inverse sine (SIN-1) of x. x must be in the range -1 to +1. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.ATAT x%,y%Positions the cursor at x% characters across the text window and y% rows down. AT 1,1 always moves to the top left corner of the window. Initially, the window is the full size of the screen, but you can change its size and position with the SCREEN command.A common use of AT is to display strings at particular positions in the text window. For example:AT 5,2 :PRINT message. PRINT statements without an AT display at the left edge of the window on the line below the last PRINT statement (unless you use , or ;) and strings displayed at the top of the window eventually scroll off as more strings are displayed at the bottom of the window. Displayed strings always overwrite anything that is on the screen - they do not cause things below them on the screen to scroll down. Example:PROC records: LOCAL k% OPEN clients,A,name$,tel$ DO CLS AT 1,7 PRINT Press a key to PRINT step to next record PRINT or Q to quit AT 2,3 :PRINT A.name$ AT 2,4 :PRINT A.tel$ NEXT IF EOF AT 1,6 :PRINT EndOfFile FIRST ENDIF k%=GET UNTIL k%=%Q OR k%=%q CLOSEENDPATANa=ATAN(x)Returns the arc tangent, or inverse tangent (TAN-1) of x. The number returned will be an angle in radians. To convert the angle to degrees, use the DEG function.BACKBACKMakes the previous record in the current data file the current record.If the current record is the first record in the file, then the current record does not change.BEEPBEEP time%,pitch%Sounds the buzzer. The beep lasts for time%/32 seconds so for a beep a second long make time%=32, etc. The maximum is 3840 (2 minutes).The pitch (frequency) of the beep is 512/(pitch%+1) KHz.BEEP 5,300 gives a comfortably pitched beep.If you make time% negative, BEEP first checks whether the sound system is in use (perhaps by another OPL program), and returns if it is. Otherwise, BEEP waits until the sound system is free.Example a scale from middle C:PROC scale: LOCAL freq,n% REM n% relative to middle A n%=3 REM start at middle C WHILE n%<16 freq=440*2**(n%/12.0) REM middle A = freq 440Hz BEEP 8,512000/freq-1.0 n%=n%+1 IF n%=4 OR n%=6 OR n%=9 OR n%=11 OR n%=13 n%=n%+1 ENDIF ENDWHENDP Alternatively, sound the buzzer with this statement: PRINT CHR$(7). This produces a click sound.Note that on the Series 5 if your batteries are low BEEP may not produce the desired effect: the buzzer will be used instead to produce the beep. The buzzer produces a higher pitched sound.BEGINTRANSBEGINTRANSBegins a transaction on the current database. The purpose of this is to allow changes to a database to be committed in stages. Once a transaction has been started on a view (or table) then all database keywords will function as usual, but the changes to that view will not be made until COMMITTRANS is used. See also COMMITTRANS, ROLLBACK, INTRANS.BOOKMARKb%=BOOKMARKPuts a bookmark at the current record of the current database view. The value returned can be used in GOTOMARK to make the record current again. Use KILLMARK to delete the bookmark.BREAKBREAKMakes a program performing a DO...UNTIL or WHILE...ENDWH loop exit the loop and immediately execute the line following the UNTIL or ENDWH statement.BUSYBUSY str$,c%,delay%BUSY str$,c%BUSY str$BUSY OFFBUSY str$ displays str$ in the bottom left of the screen, until BUSY OFF is called. Use this to indicate Busy messages, usually when an OPL program is going to be unresponsive to keypresses for a while.If c% is given, it controls the corner in which the message appears:c%corner0top left1bottom left (default)2top right3bottom rightConstants for these corner values are supplied in Const.oph.delay% specifies a delay time (in half seconds) before the message should be shown. Use this to prevent Busy messages from continually appearing very briefly on the screen.Only one message can be shown at a time. The maximum string length of a BUSY message is 80 characters on the Series 5, and an Invalid argument error is returned for any value in excess of this. On the Series 3c, the maximum length is 19 characters.BYREFBYREF variablePasses variable by reference to an OPX procedure when used in a procedure argument list. This means that the value of the variable may be changed by the procedure.See the Using OPXs on the Series 5 chapter for more details.CANCELCANCELMarks the end of a databases INSERT or MODIFY phase and discards the changes made during that phaseCAPTIONCAPTION caption$,languageCode%Specifies an OPAs public name (or caption) for a particular language, which will appear below its icon on the Extras bar and in the list of Programs in the New File dialog (assuming the setting of FLAGS allows these) when the language is that used by the machine. CAPTION may only be used inside an APP...ENDA construct. The language code specifies for which language variant the caption should be used, so that the caption need not be changed when used on a different language machine. If used, for whatever language, CAPTION causes the default caption given in the APP declaration to be discarded. Therefore CAPTION statements must be supplied for every language in which the application is liable to be used, including the language of the machine on which the application is originally developed.The values of the language code should be one of the following:English 1French 2 German 3Spanish 4Italian 5Swedish 6Danish 7Norwegian 8Finnish 9American 10Swiss-French 11Swiss-German 12Portuguese 13Turkish 14Icelandic 15Russian 16Hungarian 17Dutch 18Belgian-Flemish 19Australian 20Belgian-French 21Austrian 22New Zealand 23International French 24Constants for the language codes are supplied in Const.oph.The maximum length of caption$ is 255 characters. However, you should bear in mind that a caption longer than around 8 characters will not fit neatly below the applications icon on the Extras bar.See APP.CHR$a$=CHR$(x%)Returns the character with character code x%. You can use it to display characters not easily available from the keyboard. For example, the instruction PRINT CHR$(133) displays an ellipsis (...).CLEARFLAGSCLEARFLAGS flags&Clears the flags given in flags& if they have previously been set by SETFLAGS, returning to the default.See SETFLAGS.CLOSECLOSECloses the current view on a database. If there are no other views open on the database then the database itself will be closed. See SETFLAGS for details of how to set auto-compaction on closing files.If youve used ERASE to remove some records, CLOSE recovers the memory used by the deleted records, provided it is held either in the internal memory, on a memory disk.CLSCLSClears the contents of the text window.The cursor then goes to the beginning of the top line. If you have used CURSOR OFF the cursor is still positioned there, but is not displayed.CMD$c$=CMD$(x%)Returns the command-line arguments passed when starting a program. Null strings may be returned. x% should be from 1 to 3 for the Series 5 and may be up to 5 on the Series 3c. CMD$(2) to CMD$(5) are only for OPL applications.CMD$(1) returns the full path name used to start the running program.CMD$(2) returns the full path name of the file to be used by an OPL application. On the Series 5, if the CMD$(3)=R (see below), a default filename, including path, is passed in CMD$(2).CMD$(3) returns C for Create file or O for Open file and may also return R on the Series 5. If the OPL application is being run with a new filename, this will return C. This happens the very first time the OPL application is used, and whenever a new filename is used to run it. Otherwise, the OPA is being run with the name of an existing file, and CMD$(3) will return O if it is selected directly from the system screen. R (Series 5 only) is returned if your application has been run from the Program editor or has been selected via the Applications icon on the Extras bar, and not by the selection or creation of one of your documents from the system screen. Constants for the array elements (1-3) and for the return values of CMD$(3) are supplied in Const.oph.See also GETCMD$.COMMITTRANSCOMMITTRANSCommits the transaction on the current view.See also BEGINTRANS, ROLLBACK, INTRANS.COMPACTCOMPACT file$Compacts the database file$, rewriting the file in place. All views on the database and the hence the file itself should be closed before calling this command. This should not be done to often since it uses considerable processor power.Compaction can also be done automatically on closing a file by setting the appropriate flag using SETFLAGS.CONSTCONST KConstantName=constantValueDeclares constants which are treated as literals, not stored as data. The declarations must be made outside any procedure, usually at the beginning of the module. KConstantName has the normal type-specification indicators (%, &, $ or nothing for floating-point numbers). CONST values have global scope, and are not overridden by locals or globals with the same name: in fact the translator will not allow the declaration of locals or globals of the same name. By convention, all constants should be named with a leading K to distinguish them from variables.It should be noted that it is not possible to define constants with values -32768 (for integers) and -214748648 (for long integers) in decimals, but hexadecimal notation may be used instead (i.e. values of $8000 and &80000000 respectively).CONTINUECONTINUEMakes a program immediately go to the UNTIL... line of a DO...UNTIL loop or the WHILE... line of a WHILE...ENDWH loop i.e. to the test condition.See also BREAK.COPYCOPY src$,dest$Copies the file src$, which may be of any type, to the file dest$. Any existing file with the name dest$ is deleted. You can copy across devices. On the Series 3c you can use the appropriate file extensions to indicate the type of file, and on all machines use wildcards if you wish to copy more than one file at a time. If src$ contains wildcards, dest$ must not specify a filename, just the device and directory to which the files are to be copied under their original names. You must specify either an extension or .* on the first filename. The file type extensions are listed in the User Guide.Example: To copy all the OPL files from internal memory (in \OPL) to B:\ME\:COPY M:\OPL\*.OPL,B:\ME\(Remember the final backslash on the directory name.)See COMPRESS for more control over copying data files. If you use COPY to copy a data file, deleted records are copied and you cannot append to another data file.There are more details of full file specifications in the Advanced topics chapter.COSc=COS(x)Returns the cosine of x, where x is an angle in radians. To convert from degrees to radians, use the RAD function.COUNTc%=COUNTReturns the number of records in the current data file. This number will be 0 if the file is empty.If you try to count the number of records in a view while updating the view an Incompatible update mode error will be raised (This will occur between assignment and APPEND / UPDATE or between MODIFY / INSERT and PUT).CREATECREATE tableSpec$,log,f1,f2,...Creates a table in a database. The database is also created if necessary. Immediately after calling CREATE, the file and view (or table) is open and ready for access.tableSpec$ contains the database filename and optionally a table name and the field names to be created within that table. For example:CREATE clients FIELDS name(40), tel TO phone, D, n$, t$The filename is clients. The table to be created within the file is phone. The comma-separated list, between the keywords FIELDS and TO, specifies the field names whose types are specified by the field handles (i.e. n$, t$). The name field has a length of 40 bytes, as specified within the brackets that follow it. The tel field has the default length of 255 bytes. This mechanism is necessary for creating some indexes. See the Using OPXs on the Series 5 chapter for more details on index creation.The filename may be a full file specification of up to 255 characters. A field name may be up to a maximum of 64 characters long. Text fields have a default length of 255 bytes.log specifies the logical file name A to Z. This is used as an abbreviation for the file name when you use other data file commands such as USE. Compatibility with the Series 3cAs on the Series 3c, the table specification may contain just the filename. In this case the table name will default to Table1 and the field names will be derived from the handles: $ replaced by s, % by i, and & by a. E.g. n$ becomes ns. Knowing this allow views to be opened on tables (called Table1) that were created with the OPL16 method. However, it would be better to create the fields with proper names in the first place.For example:CREATE clients,A,n$,t%,d&is a short version ofCREATE clients FIELDS ns,ti,da TO Table1,A,n$,t%,d&both creating Table1. Database clients is also created if it does not yet exist.CURSORCURSOR ONCURSOR OFFCURSOR id%,asc%,w%,h%CURSOR id%,asc%,w%,h%,type%CURSOR id%CURSOR ON switches the text cursor on at the current cursor position. Initially, no cursor is displayed.You can switch on a graphics cursor in a window by following CURSOR with the ID of the window. This replaces any text cursor. At the same time, you can also specify the cursors shape, and its position relative to the baseline of text.asc% is the ascent - the number of pixels (-128 to 127) by which the top of the cursor should be above the baseline of the current font. h% and w% (both from 0 to 255) are the cursors height and width.If you do not specify them, the following default values are used:asc%font ascent h%font heightw%2If type% is given, it can have these effects:2 not flashing 4greyYou can add these values together to combine effects - if type% is 6 a grey non-flashing cursor is drawn. The Series 3c also supports an obloid cursor by specifying a type% of 1. Using type%=1 on the Series 5 just displays a default graphics cursor, as though no type had been specified.Constants for these types are supplied in Const.oph.An error is raised if id% specifies a bitmap rather than a window.CURSOR OFF switches off any cursor.DATETOSECSs&=DATETOSECS(yr%,mo%,dy%,hr%,mn%,sc%)Returns the number of seconds since 00:00 on 1/1/1970 at the date/time specified.Raises an error for dates before 1/1/1970.The value returned is an unsigned long integer. (Values up to +2147483647, which is 03:14:07 on 19/1/2038, are returned as expected. Those from +2147483648 upwards are returned as negative numbers, starting from -2147483648 and increasing towards zero.)See also SECSTODATE, HOUR, MINUTE, SECOND.DATIM$d$=DATIM$Returns the current date and time from the system clock as a string - for example: Fri 16 Oct 1992 16:25:30. The string returned always has this format - 3 mixed-case characters for the day, then a space, then 2 digits for the day of the month, and so on.(Constants for offsets of each elements within the string (to be used with MID$, for example) are supplied in Const.oph. The Date OPX provides a large set of procedures for manipulating dates and for accurate timing.DAYd%=DAYReturns the current day of the month (1 to 31) from the system clock.DAYNAME$d$=DAYNAME$(x%)Converts x%, a number from 1 to 7, to the day of the week, expressed as a three letter string. E.g. d$=DAYNAME$(1) returns MON.Example:PROC Birthday:LOCAL d&,m&,y&,dWk% DO dINIT dTEXT ,Date of birth,2 dTEXT ,eg 23 12 1963,$202 dLONG d&,Day,1,31 dLONG m&,Month,1,12 dLONG y&,Year,1900,2155 IF DIALOG=0 :BREAK :ENDIF dWk%=DOW(d&,m&,y&) CLS :PRINT DAYNAME$(dWk%), PRINT d&,m&,y& dINIT dTEXT ,Again?,$202 dBUTTONS No,%N,Yes,%Y UNTIL DIALOG<>%yENDP See also DOW.DAYSUsage:d&=DAYS(day%,month%,year%)Returns the number of days since 1/1/1900. Use this to find out the number of days between two dates.Example:PROC deadline:LOCAL a%,b%,c%,deadlin&LOCAL today&,togo%PRINT What day? (1-31)INPUT a%PRINT What month? (1-12)INPUT b%PRINT What year? (19??)INPUT c%deadlin&=DAYS(a%,b%,1900+c%)today&=DAYS(DAY,MONTH,YEAR)togo%=deadlin&-today&PRINT togo%,days to goGETENDPSee also dDATE, SECSTODATE.(The Date OPX provides a large set of procedures for manipulating dates and for accurate timing.DAYSTODATEDAYSTODATE days&,year%,month%,day%This converts days&, the number of days since 1/1/1900, to the corresponding date, returning the day of the month to day%, the month to month% and the year to year%. This is useful for converting the value set by dDATE, which also gives days since 1/1/1900.DBUTTONSdBUTTONS p1$,k1%...Defines exit keys to go at the bottom or the side (see dINIT) of a dialog.Each pair of p$ and k% specifies an exit key; p$ is the text to be displayed on it, while k% is the keycode of the shortcut key. DIALOG returns the keycode of the key pressed (in lower case for letters).For alphabetic keys, use the % sign - %A means the code of A, and so on. The shortcut key is then Ctrl+alphabetic key on the Series 5. An appendix lists the codes for keys (such as Tab) which are not part of the character set. If you use the code for one of these keys, its name (e.g. Tab, or Enter) will be shown in the key.The following effects may be obtained by adding the appropriate constants to the shortcut key keycode:effect -- constant valuedisplay a button with no shortcut key label underneath it -- 256 ($100)use the key alone (without the Ctrl modification) as the shortcut key -- 512 ($200)Constants for these flags and keycodes for Esc and other keys are supplied in Const.oph.If you use a negative value for a k% argument, that key is a Cancel key. The corresponding positive value is used for the key to display and the value for DIALOG to return, but if you do press this key to exit, the var variables used in the commands like dEDIT, dTIME etc. will not be set. When using a negative shortcut to specify the cancel button, you must negate the shortcut together with any added flags.The Esc key will always cancel a dialog box, with DIALOG returning 0. If you want to show the Esc key as one of the exit keys, use -27 as the k% argument (its keycode is 27) so that the var variables will not be set if Esc is pressed.There can be only one dBUTTONS item per dialog.(The buttons take up two lines on the screen. dBUTTONS may be used anywhere between dINIT and DIALOG; the postion of its use does not affect the position of the buttons in the dialog.Some keypresses cannot be specified.This example presents a simple query, returning False for No, or True for Yes, providing shortcut keys of N and Y respectively and without labels beneath the keys.PROC query: dINIT dTEXT ,FORGET CHANGES,2 dTEXT ,Sure?,$202 dBUTTONS No,-(%N OR $100 OR $200),Yes,%Y OR $100 OR $200 RETURN DIALOG=%yENDPSee also dINIT.DCHECKBOXdCHECKBOX chk%,prompt$Creates a dialog checkbox entry. This is similar to a choice list with two items, except that the list is replaced by a checkbox with the tick either on or off. The state of the checkbox is maintained across calls to the dialog.Initially you should set the live variable chk% to 0 to set the tick symbol off and to any other value to set it on. chk% is then automatically set to 0 if the box is unchecked or -1 if it is checked when the dialog is closed.See also dINIT.DCHOICEdCHOICE var choice%,p$,list$ or dCHOICE var choice%,p$,list1$+"..."dCHOICE var choice%,"",list2$+"..."...dCHOICE var choice%,"",listN$Defines a choice list to go in a dialog.p$ will be displayed on the left side of the line. list$ should contain the possible choices, separated by commas - for example, No,Yes. One of these will be displayed on the right side of the line, and arrow keys can be used to move between the choices.choice% must be a LOCAL or a GLOBAL variable. It specifies which choice should initially be shown - 1 for the first choice, 2 for the second, and so on. When you finish using the dialog, choice% is given a value indicating which choice was selected - again, 1 for the first choice, and so on.(On the Series 5, dCHOICE supports an unrestricted number of items (up to memory limits). To extend a dCHOICE list, add a comma after the last item on the line followed by ... (three full-stops), as shown in the usage above. choice% must be the same on all the lines, otherwise an error is raised. For example, the following specifies items i1, i2, i3, i4, i5, i6:dCHOICE ch%,prompt$,i1,i2,...dCHOICE ch%,,i3,14,...dCHOICE ch%,,i5,i6See also dINIT.DDATEdDATE var lg&,p$,min&,max&Defines an edit box for a date, to go in a dialog.p$ will be displayed on the left side of the line.lg&, which must be a LOCAL or a GLOBAL variable, specifies the date to be shown initially. Although it will appear on the screen like a normal date, for example 15/03/92, lg& must be specified as days since 1/1/1900.min& and max& give the minimum and maximum values which are to be allowed. Again, these are in days since 1/1/1900. An error is raised if min& is higher than max&. When you finish using the dialog, the date you entered is returned in lg&, in days since 1/1/1900.The system setting determines whether years, months or days are displayed first.See also DAYS, SECSTODATE,DAYSTODATE, dINIT.DECLARE EXTERNALDECLARE EXTERNALCauses the translator to report an error if any variables or procedures are used before they are declared. It should be used at the beginning of the module to which it applies, before the first procedure. It is useful for detecting Undefined externals errors at translate-time rather than at runtime.For example, with DECLARE EXTERNAL commented out, the following translates and raises the error, Undefined externals, i at runtime. Adding the declaration causes the error to be detected at translate-time instead.REM DECLARE EXTERNALPROC main: LOCAL i% i%=10 PRINT i GETENDPIf you use this declaration, you will need to declare all subsequent variables and procedures used in the module, using EXTERNAL.See also EXTERNAL.DECLARE OPXDECLARE OPXopxname,opxUid&,opxVersion&...END DECLAREDeclares an OPX. opxname is the name of the OPX, opxUid& its UID and opxVersion& its version number.Declarations of the OPXs preocedures should be made inside this structure.See the Using OPXs on the Series 5 chapter for more details.DEDITdEDIT var str$,p$,len%ordEDIT var str$,p$Defines a string edit box, to go in a dialog.p$ will be displayed on the left side of the line.str$ is the string variable to edit. Its initial contents will appear in the dialog. The length used when str$ was defined is the maximum length you can type in.len%, if supplied, gives the width of the edit box (allowing for widest possible character in the font). The string will scroll inside the edit box, if necessary. If len% is not supplied, the edit box is made wide enough for the maximum width str$ could possibly be.See also dTEXT.DEDITMULTIdEDITMULTI var ptrData&,p$,widthInChars%,numberLines%,maxLength%Defines a multi-line edit box to go into a dialog. Normally the resulting text would be used in a subsequent dialog, saved to file or printed using the Printer OPX (see the Using OPXs on the Series 5 chapter). It is also possible to paste text into the buffer from other applications and vice versa, although any formatting or embedded objects contained in text pasted in will be removed.ptrData& is the address of a buffer to take the edited data. It could be the address of an array as returned by ADDR, or of a heap cell, as returned by ALLOC (see ADDR and ALLOC). The buffer may not be specified directly as a string and may not be read as such. Instead it should be peeked, byte by byte (see PEEK). The leading 4 bytes at ptrData& contain the initial number of bytes of data following. These bytes are also set by dEDITMULTI to the actual number of bytes edited. For this reason it is convenient to use a long integer array as the buffer, with at least 1+(maxLength%+3)/4 elements. The first element of the array then specifies the initial length.If an allocated cell is used (probably because more than 64K is required), the first 4 bytes of the cell must be set to the initial length of the data. If this length is not set then an error will be raised. For example if a cell of 100000 bytes is allocated, you would need to poke a zero long integer in the start to specify that there is initially no text in the cell. For example:p&=ALLOC(100000)POKEL p&,0REM Text starts at p&+4Special characters such as line breaks and tab characters may appear in the buffer. Constants for the codes of these are supplied in Const.oph.The prompt, p$ will be displayed on the left side of the edit box. widthInChars% specifies the width of the edit box within which the text is wrapped, using a notional average character width. The actual number of characters that will fit depends on the character widths, with e.g. more is fitting than ws. numberLines% specifies the number of full lines displayed. Any more lines will be scrolled. maxLength% specifies the length in bytes of the buffer provided (excluding the bytes used to store the length).The Enter key is used by a multi-line edit box which has the focus before being offered to any buttons. This means that Enter cant be used to exit the dialog, unless another item is provided that can take the focus without using the Enter key. Normal practice is to provide a button that does not use the Enter key to exit a dialog whenever it contains a multi-line edit box. The Esc key will always cancel a dialog however, even when it contains a multi-line edit box.The following example presents a three-line edit box which is about 10 characters wide and allows up to 399 characters:CONST KLenBuffer%=399PROC dEditM: LOCAL buffer&(101) REM 101=1+(399+3)/4 in integer arithmetic LOCAL pLen&,pText& LOCAL i% LOCAL c% pLen&=ADDR(buffer&(1)) pText&=ADDR(buffer&(2)) WHILE 1 dINIT Try dEditMulti dEDITMULTI pLen&,Prompt,10,3,KLenBuffer%dBUTTONS Done,%d REM button needed to exit dialog IF DIALOG=0 :BREAK :ENDIF PRINT Length:;buffer&(1) PRINT Text: i%=0 WHILE i%=32 PRINT CHR$(c%); ELSE PRINT .;REM just print a dot for special characters ENDIF i%=i%+1 ENDWH ENDWHENDPSee also dINIT.DEFAULTWINDEFAULTWIN mode%Change the default window (ID=1) to change the colour mode.The default window uses 4-colour mode initially.mode%=1 just clears the screen, leaving the window in 4-colour mode. Clearing of the screen ensures compatibility with Series 3c. mode%=0 changes the screen to 2-colour mode (actually results in a mapping of greys to white or black).mode%=2 changes to 16-colour mode, as expected.Using DEFAULTWIN with either of these values also clears the screen.Using 4-colour mode uses more power than using 2-colour mode and using 16-colour mode uses more power that either of these.Constants for the modes of DEFAULTWIN are supplied in Const.oph. You are advised to call DEFAULTWIN once and for all near the start of your program if you need to change the colour mode of the default window on the Series 5 or use grey on the Series 3c. If it fails with Out of memory error, the program can then exit cleanly without losing vital information.See also gGREY, gCOLOR, gCREATE.DEGd=DEG(x)Converts from radians to degrees. Returns x, an angle in radians, as a number of degrees. The formula used is: 180*x/PIAll the trigonometric functions (SIN,COS etc.) work in radians, not degrees. You can use DEG to convert an angle returned by a trigonometric function back to degrees:Example:PROC xarctan: LOCAL arg,angle PRINT Enter argument:; INPUT arg PRINT ARCTAN of,arg,is angle=ATAN(arg) PRINT angle,radians PRINT DEG(angle),degrees GETENDPTo convert from degrees to radians, use RAD.DELETEDELETE filename$Deletes any type of file.(You can use wildcards for example, to delete all the files in D:\OPLDELETE D:\OPL\*(You can use wildcards for example, to delete all the OPL files in B:\OPLDELETE B:\OPL\*.OPLThe file type extensions are listed in the User Guide.See also RMDIR.DELETEDELETE dbase$,table$This deletes the table, table$, from the database, dbase$. To do this all views of the database, and hence the database itself, must be closed.DFILEUsage:dFILE var file$,p$,f%or dFILE var file$,p$,f%,uid1&,uid2&,uid3&Defines a filename edit box or selector, to go in a dialog. A Folder and Disk selector are automatically added on the following lines.By default no prompts are displayed for the file, folder and disk selectors. A comma-separated prompt list should be supplied. For example, for a filename editor with the standard prompts use:dFILE f$,File,Folder,Disk,1f% controls the type of file editor or selector, and the kind of input allowed. You can add together any of the following values: valuemeaning0 use a selector1 use an edit box2 allow directory names4 directory names only8 disallow existing files16 query existing files32 allow null string input64 invalid on Series 5128 obey/allow wildcards256 allow ROM files to be selected512 allow files in the System folder to be selectedThe first of the list is the most crucial. If you add 1 into f%, you will see a file edit box, as when creating a new file. If you do not add 1, you will see the matching file selector, used when choosing an existing file.The value 64 (to omit file extensions) is not valid on the Series 5 since file extensions are no longer treated as special components of the filename.If performing a copy to operation, you might use 1+2+16, to specify a file edit box, in which you can type the name of a directory to copy to, and which will produce a query if you type the name of an existing file.If asking for the name of a directory to remove, you might use 4, to allow an existing directory name only.Query existing is ignored if disallow existing is set. These two, as well as allow null string input, only work with file edit boxes, not matching file selectors.For file selectors, dFILE supports file restriction by UID, or by type from the users point of view. Documents are identified by three UIDs which identify which application created the document and what kind of file it is. Specifying all three UIDs will restrict the files as much as is possible, and specifying fewer will provide less restriction. You can supply 0 for uid1& and uid2& if you only want to restrict the list to uid3&. This may be useful when dealing with documents from one of your own applications: you can easily find out the third UID as it will be the UID you specified in the APP statement. Note that UIDs are ignored for editors. For example, if your application has UID KUidMyApp&, then the following will list only your application-specific documents:dFILE f$,p$,f%,0,KUidOplDoc&,KUidMyApp&REM KUidOplDoc& for OPL docsSome OPL-related UIDs are given in Const.oph. See the Calling Procedures for details of how to use this file and Appendix E for a listing of it.file$ is the string variable to edit. Its initial contents always control the initial drive and directory used. Any filename part of file$ is shown initially in the filename box. For a matching file selector, you can use wildcards in the filename part (such as *.tmp) to control which filenames are matched. To do this, you must add 128 to f%. 128 also allows wildcard specifications to be entered (returned in str$), for both matching and new file selectors.With a matching file selector (as opposed to an edit box) the value 8 restricts the selection to files which match the filename/extension in file$.You can always press Tab to produce the full file selector with a dFILE item.file$ must be declared to be 255 bytes long, since file names may be up to this length, and if it is shorter an error will be raised. On the Series 3c, it must be at least 128 bytes long.Constants for the flags used by dFILE and for some OPL-related UIDs are supplied in Const.oph.See also dINIT.DFLOATdFLOAT var fp,p$,min,maxDefines an edit box for a floating-point number, to go in a dialog.p$ will be displayed on the left side of the line.min and max give the minimum and maximum values which are to be allowed. An error is raised if min is higher than max.fp must be a LOCAL or a GLOBAL variable. It specifies the value to be shown initially. When you finish using the dialog, the value you entered is returned in fp.See also dINIT.DIALOGn%=DIALOGPresents the dialog prepared by dINIT and commands such as dTEXT and dCHOICE. If you complete the dialog by pressing Enter, your settings are stored in the variables specified in dLONG, dCHOICE etc., although you can prevent this with dBUTTONS.If you used dBUTTONS when preparing the dialog, the keycode which ended the dialog is returned. Otherwise, DIALOG returns the line number of the item which was current when Enter was pressed. The top item (or the title line, if present), has line number 1.If you cancel the dialog by pressing Esc, the variables are not changed, and 0 is returned.See also dINIT.DINITdINITdINIT title$dINIT title$,flags%Prepares for definition of a dialog, cancelling any existing one. Use dTEXT, dCHOICE etc. to define each item in the dialog, then DIALOG to display the dialog.If title$ is supplied, it will be displayed at the top of the dialog.Any supplied title$ will be positioned in a grey box at the top of the dialog.flags% can be any added combination of the following constants to achieve the following effects,effectvaluebuttons on the right rather than at the bottom1no title bar (any title in dINIT is ignored)2use the full screen4dont allow the dialog box to be dragged8pack the dialog densely (not buttons though)16Constants for these flags are supplied in Const.oph.It should be noted that dialogs without titles cannot be dragged regardless of the No drag setting. Dense packing enables more lines to fit on the screen for larger dialogs. On the Series 5, if an error occurs when adding an item to a dialog, the dialog is deleted and dINIT needs calling again. This is necessary to avoid having partially specified dialog lines.In practical terms, this means that the following artificial example will raise a Structure fault error.dINITONERR e1 REM bad arg list gives argument errordCHOICE ch%,ChList,a,b,,,,c e1::ONERR OFFdLONG l&,Long,0,12345DIALOGDIR$Usage:d$=DIR$(filespec$)then d$=DIR$()Lists filenames, including subdirectory names, matching a file specification. You can include wildcards in the file specification. If filespec$ is just a directory name, include the final backslash on the end for example, \TEMP\ . Use the function like this:DIR$(filespec$) returns the name of the first file matching the file specification. DIR$() then returns the name of the second file in the directory.DIR$() again returns the third, and so on.When there are no more matching files in the directory, DIR$() returns a null string.Example, listing all the files whose names begin with A in C:\ME\PROC dir: LOCAL d$(255) d$=DIR$(C:\ME\A*) WHILE d$<> PRINT d$ d$=DIR$() ENDWH GETENDPDLONGdLONG var lg&,p$,min&,max&Defines an edit box for a long integer, to go in a dialog.p$ will be displayed on the left side of the line.min& and max& give the minimum and maximum values which are to be allowed. An error is raised if min& is higher than max&.lg& must be a LOCAL or a GLOBAL variable. It specifies the value to be shown initially. When you finish using the dialog, the value you entered is returned in lg&.See also dINIT.DO...UNTILUsage:DOstatement...UNTIL conditionDO forces the set of statements which follow it to execute repeatedly until the condition specified by UNTIL is met.This is the easiest way to repeat an operation a certain number of times.Every DO must have its matching UNTIL to end the loop.If you set a condition which is never met, the program will go round and round, locked in the loop forever.You can escape by pressing Ctrl+Esc, provided you havent set ESCAPE OFF. If you have set ESCAPE OFF, you will have to return to go to the Task list, select your program in the list and click the Close file option.DOWd%=DOW(day%,month%,year%)Returns the day of the week from 1 (Monday) to 7 (Sunday) given the date. day% must be between 1 and 31, month% from 1 to 12 and year% from 1900 to 2155.For example, D%=DOW(4,7,1992) returns 6, meaning Saturday.Constants for the numeric values assigned to the days of the week are supplied in Const.oph.DPOSITIONdPOSITION x%,y%Positions a dialog. Use dPOSITION at any time between dINIT and DIALOG.dPOSITION uses two integer values. The first specifies the horizontal position, and the second, the vertical. dPOSITION -1,-1 positions to the top left of the screen; dPOSITION 1,1 to the bottom right; dPOSITION 0,0 to the centre, the usual position for dialogs.dPOSITION 1,0, for example, positions to the right-hand edge of the screen, and centres the dialog half way up the screen.Constants for the positions are supplied in Const.oph.See also dINIT.DTEXTdTEXT p$,body$,t%or dTEXT p$,body$Defines a line of text to be displayed in a dialog.p$ will be displayed on the left side of the line, and body$ on the right side. If you only want to display a single string, use a null string () for p$, and pass the desired string in body$. It will then have the whole width of the dialog to itself. An error is raised if body$ is a null string.body$ is normally displayed left aligned (although usually in the right column). You can override this by specifying t%:t% effect0 left align body$1 right align body$2 centre body$However, note that on the Series 5, alignment of body$ is only supported when p$ is null, with the body being left aligned otherwise. In addition, you can add any or all of the following three values to t%, for these effects:$200 draw a line below this item$400 allow this item to be selected$800 specify this item as a text separatorYou can display a line separator between any dialog items by setting the flag $800 on an item which has null p$ and body$. (If p$ and/or body$ are not null, then the flag is ignored and no separator is drawn.) The separator counts as an item in the value returned by DIALOG. The flag $400 only allows the prompt, and not the body, to be selected. Constants for the text types are supplied in Const.oph.See also dEDIT, dINITDTIMEdTIME var lg&,p$,t%,min&,max&Defines an edit box for a time, to go in a dialog.p$ will be displayed on the left side of the line.lg&, which must be a LOCAL or a GLOBAL variable, specifies the time to be shown initially. Although it will appear on the screen like a normal time, for example 18:27, lg& must be specified as seconds after 00:00. A value of 60 means one minute past midnight; 3600 means one oclock, and so on.min& and max& give the minimum and maximum values which are to be allowed. Again, these are in seconds after 00:00. An error is raised if min& is higher than max&. When you finish using the dialog, the time you entered is returned in lg&, in seconds after 00:00.t% specifies the type of display required, as follows:t% time display0 absolute time no seconds1 absolute time with seconds2 duration no seconds3 duration with seconds4 time without hours8 absolute time in 24 hour clockConstants for dTIME types are supplied in Const.oph.For example, 03:45 represents an absolute time while 3 hours 45 minutes represents a duration.Absolute times are displayed in 24-hour or am/pm format according to the current system setting. 8 displays the time in 24 hour clock, regardless of the system setting.Absolute times always display am or pm as appropriate, unless 24 hour clock is being used. Durations never display am or pm. Note, however, that if you use the flag 4 (no hours) then the am/pm symbol will be displayed and the flag 2 must be added if you wish to hide it.See also dINIT.DXINPUTdXINPUT var str$,p$Defines a secret string edit box, such as for a password, to go in a dialog.p$ will be displayed on the left side of the line.str$ is the string variable to take the string you type.str$ must be less than 16 characters long.Initially the dialog does not show any characters for the string; the initial contents of str$ are ignored. A special symbol will be displayed for each character you type, to preserve the secrecy of the string.See also dINIT.EDITEDIT a$Displays a string variable which you can edit directly on the screen. All the usual editing keys are available the arrow keys move along the line, Esc clears the line, and so on.When you have finished editing, press Enter to confirm the changes. If you press Enter before you have made any changes, then the string will be unaltered.If you use EDIT in conjunction with a PRINT statement, use a comma at the end of the PRINT statement, so that the string to be edited appears on the same line as the displayed string:...PRINT Edit address:,EDIT A.address$UPDATE....TRAP EDIT If the Esc key is pressed while no text is on the input line, the Escape key pressed error (number -114) will be returned by ERR provided that the EDIT has been trapped. You can use this feature to enable the user to press the Esc key to escape from inputting a string.See also INPUT, dEDIT.EOFe%=EOFFinds out whether youre at the end of a file yet. Returns -1 (true) if the end of the file has been reached, or 0 (false) if it hasnt. When reading records from a file, you should test whether there are still records left to read, otherwise you may get an error.Example:PROC eoftest: OPEN myfile,A,a$,b% DO PRINT A.a$ PRINT A.b% NEXT PAUSE -40 UNTIL EOF PRINT The last record GET RETURNENDPERASEERASEErases the current record in the current file.The next record is then current. If the erased record was the last record in a file, then following this command the current record will be null and EOF will return true.ERRe%=ERRReturns the number of the last error which occurred, or 0 if there has been no error.Example:...PRINT Enter age in yearsage::TRAP INPUT age%IF ERR=-1 PRINT Number please: GOTO ageENDIF...You can set the value returned by ERR to 0 (or any other value) by using TRAP RAISE 0. This is useful for clearing ERR.See also ERR$,ERRX$. See the Error Handling chapter for full details, including the list of error numbers and messages.ERR$e$=ERR$(x%)Returns the error message for the specified error code x%. ERR$(ERR) gives the message for the last error which occurred. Example:TRAP OPEN \FILE,A,field1$IF ERR PRINT ERR$(ERR) RETURNENDIFSee also ERR, ERRX$. See the Error Handling chapter for full details, including the list of error numbers and messages.ERRX$x$=ERRX$Returns the current extended error message (when an error has been trapped), e.g.Error in MODULE\PROCEDURE,EXTERN1,EXTERN2,...which would have been presented as an alert if the error had not been trapped. This allows the list of missing externals, missing procedure names, etc. to be found when an error has been trapped by a handler.See ERR, ERR$.ESCAPE OFFESCAPE OFFESCAPE OFF stops Ctrl+Esc on the Series 5 or Psion-Esc on the Series 3c being used to break out of the program when it is running. ESCAPE ON enables this feature again.ESCAPE OFF takes effect only in the procedure in which it occurs, and in any sub-procedures that are called. Ctrl+Esc is always enabled when a program begins running.If your program enters a loop which has no logical exit, and ESCAPE OFF has been used, you will have to return to the System screen, move to the program name and select the "Close file" option.EVALd=EVAL(s$)Evaluates the mathematical string expression s$ and returns the floating-point result. s$ may include any mathematical function or operator. Note that floating-point arithmetic is always performed.On the Series 5, EVAL runs in the context of the current procedure, so globals and externals can be used in s$, procedures in loaded modules can be called and the current values of gX and gY, can be used etc. LOCAL variables cannot be used in s$ (because the translator cannot reference them).For example:DO AT 10,5 :PRINT Calc:, TRAP INPUT n$ IF n$= :CONTINUE :ENDIF IF ERR=-114 :BREAK :ENDIF CLS :AT 10,4 PRINT n$;=;EVAL(n$)UNTIL 0See also VAL.EXISTEXISTChecks to see that a file exists.Returns -1 (True) if the file exists and 0 (False) if it doesnt.Use this function when creating a file to check that a file of the same name does not already exist, or when opening a file to check that it has already been created:IF NOT EXIST(CLIENTS) CREATE CLIENTS,A,names$ELSE OPEN CLIENTS,A,names$ENDIF...EXPe=EXP(x)Returns ex - that is, the value of the arithmetic constant e (2.71828...) raised to the power of x.EXTERNALEXTERNAL variableorEXTERNAL prototypeRequired if DECLARE EXTERNAL is specified in the module.The first usage declares a variable as external. For example, EXTERNAL screenHeight%The second usage declares the prototype of a procedure (prototype includes the final : and the argument list). The procedure may then be referred to before it is defined. This allows parameter type-checking to be performed at translate-time rather than at runtime and also provides the necessary information for the translator to coerce numeric argument types. This is reasonable because OPL does not support argument overloading. The same coercion occurs as when calling the built-in keywords.Following the example of C and C++, you would normally provide a header file declaring prototypes of all the procedures and INCLUDE this header file at the beginning of the module which defines the declared procedures to ensure consistency. The header file would also be INCLUDEd in any other modules which call these procedures. Then you should use DECLARE EXTERNAL at the beginning of modules which include the header file so that the translator can ensure that these procedures are called with correct parameter types or types which can be coerced. The following is an example of usage of DECLARE EXTERNAL and EXTERNAL:DECLARE EXTERNALEXTERNAL myProc%:(i%,l&)REM or INCLUDE myproc.oph that defines all your proceduresPROC test:LOCAL i%,j%,s$(10)REM j% is coerced to a long integer as specified by the prototype. myProc%:(i%,j%)REM translator Type mismatch error:REM string cant be coerced to numeric typemyProc%:(i%,s$)REM wrong argument count gives translator errormyProc%:(i%)ENDPPROC myProc%:(i%,l&)REM Translator checks consistency with prototype above...ENDPSee DECLARE EXTERNAL.FINDf%=FIND(a$)Searches the current data file (or view on the Series 5) for fields matching a$. The search starts from the current record, so use NEXT to progress to subsequent records. FIND makes the next record containing a$ the current record and returns the number of the record found. Capitals and lower-case letters match.You can use wildcards:? matches any single charactermatches any group of characters.To find a record with a field containing Dr and either BROWN or BRAUN, use:F%=FIND(*DR*BR??N*)FIND(BROWN) will find only those records with a field consisting solely of the string BROWN.You can only search string fields.See also FINDFIELD.FINDFIELDf%=FINDFIELD(a$,start%,no%,flags%)Like FIND, finds a string, makes the record with this string the current record, and returns the number of this record.a$ is the string for which to search: the search will be carried out in no% fields in each record, starting at the field with number start% (1 is the number of the first field). start% and no% may refer to string fields only and other types will be ignored. The flag% argument specifies the type of search as explained below. If you want to search in all fields, use start%=1 and for no% use the number of fields you used in the OPEN/CREATE command.flags% should be specified as follows:search directionflags%backwards from current record 0forwards from current record 1backwards from end of file 2forwards from start of file 3Constants for these flags are supplied in Const.oph.Add 16 to the value of flag% given above to make the search case-dependent, where case-dependent means that the record will exactly match the search string in case as well as characters. Other wise the search will case-independent which means that upper case and lower case characters will match.FIRSTFIRSTPositions to the first record in the current view on the Series 5.FIXf$=FIX$(x,y%,z%)Returns a string representation of the number x, to y% decimal places. The string will be up to z% characters long.Example: FIX$(123.456,2,7) returns 123.46.If z% is negative then the string is right-justified for example FIX$(1,2,-6) returns 1.00 where there are two spaces to the left of the 1.If z% is positive then no spaces are added for example FIX$(1,2,6) returns 1.00.If the number x will not fit in the width specified by z%, then the string will just be asterisks, for example FIX$(256.99,2,4) returns ****.See also GEN$, NUM$, SCI$.FLAGSFLAGS flags%Replaces TYPE on the Series 5. flags% values as follows:1 specifies an application which can create files. It will then be included in the list of applications offered when the user creates a new file from the System screen.2 prevents the application from appearing in the Extras bar. It is very unusual to have this flag set.Constants for these flags are supplied in Const.oph.FLAGS may only be used within the APP...ENDA construct.FLTf=FLT(x&)Converts an integer expression (either integer or long integer) into a floating-point number. Example:PROC gamma:(v)LOCAL c c=3E8 RETURN 1/SQR(1-(v*v)/(c*c))ENDPYou could call this procedure like this: gamma:(FLT(a%)) if you wanted to pass it the value of an integer variable without having first to assign the integer value to a floating-point variable.See also INT and INTF.FONTFONT id&,style%Sets the text window font and style.Constants for the font UIDs are supplied in Const.oph.FREEALLOCFREEALLOC pcell&Frees a previously allocated cell at pcell&.GATgAT x%,y%Sets the current position using absolute co-ordinates. gAT 0,0 moves to the top left of the current drawable.See also gMOVE.GBORDERgBORDER flags%,width%,height%or gBORDER flags%Draws a one-pixel wide, black border around the edge of the current drawable. If width% and height% are supplied, a border shape of this size is drawn with the top left corner at the current position. If they are not supplied, the border is drawn around the whole of the current drawable.flags% controls three attributes of the border a shadow to the right and beneath, a one-pixel gap all around, and the type of corners used:flags% effect 1 single pixel shadow2 removes a single pixel shadow3 double pixel shadow4 removes a double pixel shadow (leaves a gap for double pixel shadow on Series 3c)$100 one-pixel gap all round$200 more rounded cornersConstants for the values of these flags are supplied in Const.oph.The shadows on the Series 5 will not appear in the same way as shadows on other objects such as dialogs and menu panes appear. To display such shadows on a window, you must specify them when using gCREATE. Hence you should use gCREATE (and gXBORDER) in preference to gBORDER on the Series 5.You can combine the values to control the three different effects. (1, 2, 3 and 4 are mutually exclusive you cannot use more than one of them.) For example, for rounded corners and a double pixel shadow, use flags%=$203.Set flags%=0 for no shadow, no gap, and sharper corners.For example, to de-emphasise a previously emphasised border, use gBORDER with the shadow turned off:gBORDER 3 REM show borderGETgBORDER 4 REM border off...See also gXBORDER.GBOXgBOX width%,height%Draws a box from the current position, width% to the right and height% down. The current position is unaffected.GBUTTONgBUTTON text$,type%,w%,h%,st%gBUTTON text$,type%,w%,h%,st%,bitmapId&gBUTTON text$,type%,w%,h%,st%,bitmapId&,maskId&gBUTTON text$,type%,w%,h%,st%,bitmapId&,maskId&,layout%Draws a 3-D black and grey button at the current position in a rectangle of the supplied width w% and height h%, which fully encloses the button in all its states. text$ specifies up to 64 characters to be drawn in the button in the current font and style. You must ensure that the text will fit in the button.type%=1 draws a Series 3c button; type%=2 specifies Series 5.state%=0 draws a raised button, state%=1 a semi-depressed (flat) button and state%=2 a fully-depressed (sunken) button.Bitmaps may be used on buttons. Three extra optional arguments can be passed which give the bitmap ID, the mask ID and the layout for the button respectively. maskId% can be 0 to specify no mask.The following constants should be used for layout% to specify relative positions of the text and icon on a button,position of text layout%right 0bottom 1top 2left 3The following constants can be added to the values above to specify how a buttons excess space is to be allocated,share 0to text $10to picture $20Constants for all these layout types and for the button states are supplied in Const.oph.When the layout is such that the text is at the top or the bottom, then text and picture are centred vertically and horizontally in the space allotted to them. If the layout has text to the left or right, then the text is left aligned in the space allotted to it and the picture is right or left aligned respectively. Both text and picture are centred vertically in this case.Examples: layout% description$13 creates a button with text on the left and left aligned in any excess space.$20 creates a button with text on the right and the picture left aligned in any excess space.$10 creates a standard toolbar button, putting the text on the right.For a picture only with no text use text$=.Invalid arguments error is raised if you use OPL windows for gBUTTON. Read-only bitmaps may also be loaded using the Bitmap OPX.GCIRCLEgCIRCLE radius%or gCIRCLE radius%,fill%Draws a circle with the centre at the current position in the current drawable. If the value of radius% is negative then no circle is drawn.If fill% is supplied and if fill%<>0 then the circle is filled with the current pen colour.See gELLIPSE, gCOLOR.GCLOCKgCLOCK ON/OFFgCLOCK ON,mode%gCLOCK ON,mode%,offset&gCLOCK ON,mode%,offset&,format$gCLOCK ON,mode%,offset&,format$,font%gCLOCK ON,mode%,offset&,format$,font%,style%Displays or removes a clock showing the system time. The current position in the current window is used. Only one clock may be displayed in each window.mode% controls the type of clock.Values are:6 black and grey medium, system setting7 black and grey medium, analog 8 second type medium, digital 9 black and grey extra large 11 formatted digital (described below)Constants for the modes are supplied in Const.oph. There are additional features on the basic clocks which partially replace these effects. The digital clock (mode%=8) automatically displays the day of the week and day of the month below the time. The extra large analog clock (mode%=9) automatically displays a second hand.>> Do not use gSCROLL to scroll the region containing a clock. When the time is updated, the old position would be used. The whole window may, however, be moved using gSETWIN.Digital clocks display in 24-hour or 12-hour mode according to the system-wide setting. offset& specifies an offset in minutes from the system time to the time displayed. This allows you to display a clock showing a time other than the system time.A flag, which has the value $100, may be ORed with mode% so that offset& may be specified in seconds rather than minutes. The offset is a long integer to enable a whole day to be specified when the offset is in seconds.If these arguments are not supplied, mode% is taken as 1, and offset& as 0.The system setting for the clock type (i.e. digital or analog) can be changed by an OPL program using the procedure LCSETCLOCKFORMAT: in Date OPX This is function should be used to implement, for example, tapping a toolbar clock to change its type as in the built-in Series 5 applications. See the Using OPXs on the Series 5 section for full details of this procedure.format$, font% and style% are used only for formatted digital clocks (mode% 10 on the Series 3c and 11 on the Series 5). The values for font& and style% are as for gFONT and gSTYLE. The default font for gCLOCK is the system font. The default style is normal (0).For the formatted digital clock, a format string (up to 255 characters long) specifies how the clock is to be displayed. The format string contains a number of format specifiers in the form of a % followed by a letter. (Upper or lower case may be used.)The format string may contain the following symbols to obtain the required effects:%%Insert a single % character in the string %*Abbreviate following item. (The asterisk should be inserted between the % and the number or letter, e.g. %*1). In most cases this amounts to omitting any leading zeros, for example if it is the first of the month %F %*M will display as 1 rather than 01.%:nInsert a system time separator character. n is an integer between zero and three inclusive which indicates which time separator character is to be used. For European time settings, only n=1 and n=2 are used, giving the hours/minutes separator and minutes/seconds separator respectively.%/nInsert a system date separator character. n is an integer between zero and three inclusive which indicates which date separator character is to be used. For European time settings, only n=1 and n=2 are used, giving the day/month separator and month/year separator respectively.%1Insert the first component of a three component date (i.e. a date including day, month and year) where the order of the components is determined by the system settings. The possibilities are: dd/mm/yyyy, (European), mm/dd/yyyy (American), yyyy/mm/dd (Japanese).%2Insert the second component of a three component date where the order has been determined by the system settings. See %1.%3Insert the third component of a three component date where the order has been determined by the system settings. See %1.%4Insert the first component of a two component date (i.e. a date including day and month only) where the order has been determined by system settings. The possibilities are: dd/mm, (European), mm/dd (American), mm/dd (Japanese).%5Insert the second component of a two component date where the order has been determined by the system settings. See %4.%AInsert am or pm according to the current language and time of day. Text is printed even if 24 hour clock is in use. Text may be specified to be printed before or after the time, and a trailing or leading space as appropriate will be added. The abbreviated version (%*A) removes this space.Optionally, a minus or plus sign may be inserted between the % and the A. This operates as follows: %-A causes am/pm text to be inserted only if the system setting of the am/pm symbol position is set to display before the time. Similarly, %+A causes am/pm text to be inserted only if the system setting of the am/pm symbol is set to display after the time. No am/pm text will be inserted before the time if a + is inserted in the string. For example you could use, %-A%H%:1%T%+A to insert the am/pm symbol either before or after the time, according to the system setting. %+A and %-A cannot be abbreviated.%BAs %A, except that the am/pm text is only inserted if the system clock setting is 12 hour. (This should be used in conjunction with %J. )%DInsert the two-digit day number in month (in conjunction with %1 etc.).%EInsert the day name. Abbreviation is language specific (3 letters in English).%FUse this at the beginning of a format string to make the date/time formatting independent of the system setting. This fixes the order of the following day/month/year component(s) in their given order, removing the need to use %1 to %5, allowing individual components of the date to be printed. (No abbreviation.)%HInsert the two-digit hour component of the time in 24 hour clock format.%IInsert the two-digit hour component of the time in 12 hour clock format. Any leading zero is automatically suppressed, regardless of whether an asterisk is inserted or not.%JInsert the two-digit hour component of time in either 12 or 24 hour clock format depending on the corresponding system setting. When the clock has been set to 12 hour format, the hours leading zero is automatically suppressed regardless of whether an asterisk has been inserted between the % and J.%MInsert the two-digit month number (in conjunction with %1 etc.).%NInsert the month name (in conjunction with %1 etc.). When using system settings (i.e. not using %F) this causes all months following %N in the string to be written in words. When using fixed format (i.e. when using %F) %N may be used alone to insert a month name. Abbreviation is language specific (3 letters in English).%SInsert the two-digit second component of the time.%TInsert the two-digit minute component of the time.%WInsert the two-digit week number in year, counting the first (part) week as week 1.%XInsert the date suffix. When using system settings (i.e. not using %F), this causes a suffix to be put on any date following %X in the string. When using fixed format (i.e. using %F), %X following any date appends a suffix for that particular date. Cannot be abbreviated.%YInsert the four digit year number (in conjunction with %1 etc.). The abbreviation is the last two digits of the year.%ZInsert the three digit day number in year.Some examples of the use of these format strings are as follows. The example use is 1:30:05 pm on Wednesday, 1st January 1997, with the system setting of European dates and with am/pm after the time:1. %-A%I:%T:%S%+A will print the time in 12 hour clock, including seconds, with the am/pm either inserted before or after the time, depending on the system setting. So the example time would appear as, 1:30:05 pm.2. %F%E %*D%X %N %Y will print the day of the week followed by the date with suffix, the month as a word and the year. For example, Wednesday 1st January 1997.3. %E %D%X%N%Y %1 %2 %3 will use the locale setting for ordering the elements of the date, but will use a suffix on the day and the month in words. For example, Wednesday 01st January 1997.4. %*E %*D%X%*N%*Y %1 %2 %3 will be similar to 3., but will abbreviate the day of the week, the day, the month and the year, so the example becomes Wed 1st Jan 97.5. %M%Y%D%1%/0%2%/0%3 will appear as 01/01/1997. This demonstrates that the ordering of the %D, %M and %Y is irrelevant when using locale-dependent formatting. Instead the ordering of the date components is determined by the order of the %1, %2, and %3 formatting commands.style% may take any of the values used to specify gSTYLE, other than 2 (underlined).A note should also be made that a General Failure error will result if you attempt to use an invalid format. Invalid formats include using %: and %/ followed by 0 or 3 when in European locale setting (when these separators are without meaning) and using %+ and %- followed by characters other than A or B.As a final example, assuming that the settings in the Time application are for day/month/year date format, am-pm time format and : time separator and that the time is 11:30:05 pm on 9th March 1993, %G%L%P%O%*E, %1 %2 %3 %6%:%T:%S% generates Tue, 9th Mar 1993 11:30:05pm. With the same setup except for month/day/year date format in 24-hour mode, the same string generates Tue, Mar 9th 1993 23:30:05.GCLOSEgCLOSE id%Closes the specified drawable that was previously opened by gCREATE, gCREATEBIT or gLOADBIT.If the drawable closed was the current drawable, the default window (ID=1) becomes current.An error is raised if you try to close the default window.GCLSgCLSClears the whole of the current drawable and sets the current position to 0,0, its top left corner.GCOLORgCOLOR red%,green%,blue%Sets the pen colour of the current window. The red%,green%,blue% values specify a colour which will be mapped to white, black or one of the greys on non-colour screens. Note that if the values of red%, green% and blue% are equal, then a pure grey results, ranging from black (0) to white (255).GCOPYgCOPY id%,x%,y%,w%,h%,mode%Copies a rectangle of the specified size (width w%, height h%) from the point x%,y% in drawable id%, to the current position in the current drawable.It is unadvisable to use gCOPY to copy from windows as it is very slow. It should only be used for copying from bitmaps to windows or other bitmaps.As this command can copy both set and clear pixels, the same modes are available as when displaying text. Set mode% = 0 for set, 1 for clear, 2 for invert or 3 for replace. 0, 1 and 2 act only on set pixels in the pattern; 3 copies the entire rectangle, with set and clear pixels.The current position is not affected in either window.GCREATEid%=gCREATE(x%,y%,w%,h%,v%)id%=gCREATE(x%,y%,w%,h%,v%,flags%)Creates a window with specified position and size (width w%, height h%), and makes it both current and foreground. Sets the current position to 0,0, its top left corner. If v% is 1, the window will immediately be visible; if 0, it will be invisible.Returns id% which identifies this window for other keywords.flags% specifies the graphics mode to use and shadowing on the window. By default the graphics mode is 2-colour and there is no shadow.The least significant 4 bits of flags% gives the colour-mode as before 0 (2 colour-mode), 1 (4 colour-mode), 2 (16 colour-mode). The next 4 bits may be set to specify the shadowing on the window. If 0, the window has no shadow. The next 4 bits give the shadow height relative to the window behind it (a height of N units gives a shadow of N(2 pixels).The flags% argument is most easily specified in hexadecimal:flags% description$412 16 colour-mode ($2), shadowed window ($1), with height 4 units ($4) above the previous window with a shadow of 8 pixels.$010 2 colour-mode (black and white) shadowed window at the same height as the previous window.$101 4 colour mode window with no shadow (height ignored if shadow disabled).$111 4 colour mode window with shadow of 1 unit above window behind, i.e. 2 pixel shadow.Constants for specifying various of the arguments taken by gCREATE are given in Const.oph.Note that 63 windows may be open at any time and it is recommended that you use many small windows rather than a few large ones.See also gCLOSE, gGREY, DEFAULTWIN.GCREATEBITid%=gCREATEBIT(w%,h%,mode%)Creates a bitmap with the specified width and height, and makes it the current drawable. Sets the current position to 0,0, its top left corner.Returns id% which identifies this bitmap for other keywords.gCREATEBIT may be used with an optional third parameter which specifies the graphics mode of the bitmap to be created. The values of these are as given in gCREATE. By default the graphics mode of a bitmap is 2-colour.See also gCLOSE,gCREATEGELLIPSEgELLIPSE hRadius%,vRadius% or gELLIPSE hRadius%,vRadius%,fill%Draws an ellipse with the centre at the current position in the current drawable. hRadius% is the horizontal distance in pixels from the centre of the ellipse to the left (and right) of the ellipse. vRadius% is the vertical distance from the centre of the ellipse to the top (and bottom). If the length of either radius is less than zero, then no ellipse is drawn.If fill% is supplied and if fill%<>0 then the ellipse is filled with the current pen colour.See gCIRCLE, gCOLOR.GEN$g$=gen$(x,y%)Returns a string representation of the number x. The string will be up to y% characters long.Example GEN$(123.456,7) returns 123.456 and GEN$(243,5) returns 243.If y% is negative then the string is right-justified - for example GEN$(1,-6) returns 1 where there are five spaces to the left of the 1.If y% is positive then no spaces are added for example GEN$(1,6) returns 1.If the number x will not fit in the width specified by y%, then the string will just be asterisks, for example GEN$(256.99,4) returns ****.See also FIX$, NUM$, SCI$.GETg%=GETWaits for a key to be pressed and returns the character code for that key. For example, if the A key is pressed with Caps Lock off, the integer returned is 97 (a), or 65 (A) if A was pressed with the Shift key down. The character codes of special keys, such as Pg Dn, are given in Appendix D.You can use KMOD to check whether modifier keys (Shift, Control, Fn and Caps Lock) were used.See also KEY.GET$g$=GET$Waits until a key is pressed and then returns which key was pressed, as a string. For example, if the A key is pressed in lower case mode, the string returned is a.You can use KMOD to check whether any modifier keys (Shift, Control, Fn and Caps Lock) were used.See also KEY$.GETCMD$w$=GETCMD$Returns new command-line arguments to an OPA, after a change files or quit event has occurred. The first character of the returned string is C, O or X. If the return is C or O, the rest of the string is a filename.The first character has the following meaning:C - close down the current file, and create the specified new file,O - close down the current file, and open the specified existing file,X - close down the current file (if any) and quit the OPA.Constants for these return values are supplied in Const.oph.You can only call GETCMD$ once for each system message.See also CMD$.GETDOC$docname$=GETDOC$Returns the name of the current document.See also SETDOC.GETEVENTGETEVENT var a%()Use GETEVENT32GETEVENT32GETEVENT32 ev&()Gets all event types handled by GETEVENT ev%() and additionally pointer (pen) events. The latter are too large to fit into the array of integers provided for GETEVENT ev%(). ev&() must have at least 16 elements.All events return a 32-bit time stamp. The window ID mentioned below refers to the value returned by the gCREATE keyword. The modifier values and scancode values for a keypress (which specify a location on the keyboard) are given in the Advanced Topics chapter and Appendix D. GETEVENT32 returns more information than GETEVENT, as listed below:If a key has been pressed: (ev&(1) AND &400)=0 ev&(1) keycode ev&(2) time stamp ev&(3) scan code ev&(4) modifier ev&(5) repeatNote that unlike the repeat for GETEVENT, the repeat for GETEVENT32 is strictly a repeat, i.e. if there is only one keypress, then the value of ev&(5) is 0.For all the other event types, ev&(1) is greater than &400:If the program has moved toforeground: ev&(1)=&401 ev&(2) time stampIf the program has moved tobackground: ev&(1)=&402 ev&(2) time stampIf the machine is switched on:. ev&(1)=&403 ev&(2) time stampNote that this event is not enabled unless the appropriate flag is set (by default it is not): see SETFLAGS.If the Series 5 wants the OPLapplication to switch files or exit: ev&(1)=&404If this event is received, GETCMD$ should be called to find out what action should be taken: see GETCMD$.If a key is pressed down: ev&(1)=&406 ev&(2) time stamp ev&(3) scan code ev&(4) modifiersIf a key is released: ev&(1)=&407 ev&(2) time stamp ev&(3) scan code ev&(4) modifiersIf a pen event occurs: ev&(1)=&408 ev&(2) time stamp ev&(3) window ID ev&(4) pointer type (see below) ev&(5) modifiers ev&(6) x-co-ordinate ev&(7) y-co-ordinate ev&(8) x-co-ordinate relative to parent window ev&(9) y-co-ordinate relative to parent windowFor pen events, ev&(4) has one of the following values: 0 - pen down1 - pen up6 - dragIf a pen enters contact with thescreen: ev&(1)=&409 ev&(2) time stamp ev&(3) window IDIf a pen exits contact with the screen: ev&(1)=&40A ev&(2) time stamp ev&(3) window IDConstants for the array subscripts and the return values are supplied in Const.oph.Some pointer events, and pointer enters and exits, can be filtered out to avoid being swamped by unwanted event types. See POINTERFILTER.Note that for other unknown events, ev&(1) contains &1400 added to the code returned by the window server. ev&(2) is the timestamp and ev&(3)is the window ID, and the rest of the data returned by the window server is put into ev&(4), ev&(5), etc.If a non-key event such as foreground occurs while a keyboard keyword such as GET, INPUT, MENU or DIALOG is being used, the event is discarded. So GETEVENT must be used if non-key events are to be monitored. If you need to use these keywords in OPAs, use LOCK ON / LOCK OFF around them, so that the System screen wont send messages to switch files or shutdown while the application cannot respond.See also GETEVENT, GETEVENTA32.GETEVENTA32GETEVENTA32 status%,ev&()Asynchronous version of GETEVENT32. GETEVENTA32 returns the same codes to the array ev&() as GETEVENT32.See GETEVENTC, GETEVENT32, GETEVENT.GETEVENTCGETEVENTC(var stat%)Cancels the previously called GETEVENTA32 function with status stat%. Note that GETEVENTC consumes the signal (unlike IOCANCEL), so IOWAITSTAT should not be used after GETEVENTC.GFILLgFILL width%,height%,gMode%Fills a rectangle of the specified size from the current position, according to the graphics mode specified.The current position is unaffected.GFONTgFONT fontUid&Sets the font for current drawable to fontId%. The font may be one of the predefined fonts in the ROM or a user-defined font. See the Graphics chapter for more details of fonts.Constants for the font UIDs are supplied in Const.oph. User-defined fonts must first be loaded by gLOADFONT, then the font UIDs of the loaded fonts may be used with gFONT. Note that this is not the ID returned by gLOADFONT (which is the font file ID), but the UID defined in the font file itself.See also gLOADFONT, FONT.GGMODEgGMODE mode%Sets the effect of all subsequent drawing commands gLINEBY, gBOX etc. on the current drawable.mode% pixels will be: 0 set1 cleared2 invertedConstants for the mode are supplied in Const.oph. When you first use drawing commands on a drawable, they set pixels in the drawable. Use gGMODE to change this. For example, if you have drawn a black background, you can draw a white box outline inside it with either gGMODE 1 or gGMODE 2, followed by gBOX.GGREYgGREY mode%Changes the pen colour between black and grey. mode% has the following effects:mode%=1 sets the foreground colour of the current drawable to light grey. This is the same colour as would be achieved by using gCOLOR $aa,$aa,$aa.mode% of any other value sets the foreground colour to black (the default).See also DEFAULTWIN and gCREATE.GHEIGHTheight%=gHEIGHTReturns the height of the current drawable.GIDENTITYid%=gIDENTITYReturns the ID of the current drawable.The default window has ID=1.GINFO32gINFO32 var i&()Gets general information about the current drawable and about the graphics cursor (whichever window it is in). This replaces gINFO because the information available has changed. i&() must have 48 elements (although elements 37 to 48 are currently unused). The same information is returned to the array elements as for gINFO except for the following,i&(1) reservedi&(2) reservedi&(9) the font UID as used in gFONTi&(10-17) unusedi&(30) graphics colour-mode of current windowi&(31) gCOLOR red% of foregroundi&(32) gCOLOR green% of foreground i&(33) gCOLOR blue% of foregroundi&(34) gCOLOR red% of backgroundi&(35) gCOLOR green% of background i&(36) gCOLOR blue% of backgroundAdditionally note that on the Series 5, i&(8)=2 means that Code Page 1252 is used (rather than Code Page 850) and also that there is no obloid cursor, so bit 0 will never be set in i&(29).See also gINFO, gFONT, gCOLOR, gCREATE.GINVERTgINVERT width%,height%Inverts the rectangle width% to the right and height% down from the cursor position, except for the four corner pixels.GIPRINTgIPRINT str$,c%or gIPRINT str$Displays an information message for about two seconds, in the bottom right corner of the screen. For example, GIPRINT Not Found displays Not Found. If a string is too long for the screen, it will be clipped.If c% is given, it controls the corner in which the message appears:c% corner0 top left1 bottom left2 top right3 bottom right (default)Constants for these corner values are supplied in Const.oph.Only one message can be shown at a time. You can make the message go away - for example, if a key has been pressed - with GIPRINT .GLINEBYgLINEBY dx%,dy%Draws a line from the current position to a point dx% to the right and dy% down. Negative dx% and dy% mean left and up respectively.The Series 5 never draws the end point, so for gLINEBY dx%,dy%, point gX+dx%,gY+dy% is not drawn.Note, however, that OPL specially plots the point when the start and end-point coincide.The current position moves to the end of the line drawn.gLINEBY 0,0 sets the pixel at the current position.See also gLINETO, gPOLY.GLINETOgLINETO x%,y%Draws a line from the current position to the point x%,y%. The current position moves to x%,y%.The Series 5 never draws the end point, so for gLINETO x%,y%, point x%,y% is not drawnNote, however, that OPL specially plots the point when the start and end-point coincide.To plot a single point on all machines, use gLINETO to the current position (or gLINEBY 0,0).See also gLINEBY, gPOLY.GLOADBITid%=gLOADBIT(name$,write%,index%)id%=gLOADBIT(name$,write%)id%=gLOADBIT(name$)Loads a bitmap from the named bitmap file and makes it the current drawable. Sets the current position to 0,0, its top left corner.(gLOADBIT does not add a default filename extension to the input argument name.Note that on the Series 5, gLOADBIT loads EPOC Picture files, which are naturally in the same file format that is saved by gSAVEBIT. EPOC Picture files can also be generated by exporting files created by the Sketch application. These are called multi-bitmap files (MBMs), though often containing just one bitmap as in the case of gSAVEBIT or Sketch files, and are often given an extension .MBM.The bitmap is kept as a local copy in memory.Returns id% which identifies this bitmap for other keywords.write%=0 sets read-only access. Attempts to write to the bitmap in memory will be ignored, but the bitmap can be used by other programs without using more memory. write%=1 allows you to write to and re-save the bitmap. This is the default case.Constants for the values of write% are supplied in Const.oph.For bitmap files which contain more than one bitmap, index% specifies which one to load. For the first bitmap, use index%=0, which is also the default value.See also gCLOSE.GLOADFONTfileId%=gLOADFONT(file$)Loads the user-defined fonts specified in the file file$ and returns the file ID of the font file, which can be used only with gUNLOADFONT. The maximum number of font files which may be loaded at any one time is 16.To use the fonts in a loaded font file you need to use their published UIDs which will be defined in the font file itself, for example:fileId%=gLOADFONT(Music1)gFONT KMusic1Font1&...gUNLOADFONT fileId%gFONT itself is very efficient, so you should normally load all required fonts at the start of a program.Note that the built-in fonts are automatically available, and do not need loading.See gUNLOADFONT.GLOBALGLOBAL variablesDeclares variables to be used in the current procedure (as does the LOCAL command) and (unlike LOCAL) in any procedures called by the current procedure, or procedures called by them.The variables may be of 4 types, depending on the symbol they end with:Variable names not ending with $, %, & or () are floating-point variables, for example price, xThose ending with a % are integer variables, for example x%, sales92%Those ending with an & are long integer variables, for example x&, sales92&.Those ending with a $ are string variables. String variable names must be followed by the maximum length of the string in brackets for example names$(12), a$(3)Array variables have a number immediately following them in brackets which specifies the number of elements in the array. Array variables may be of any type, for example: x(6),y%(5),f$(5,12),z&(3).When declaring string arrays, you must give two numbers in the brackets. The first declares the number of elements, the second declares their maximum length. For example surname$(5,8) declares five elements, each up to 8 characters long.Variable names may be any combination of up to 32 numbers and alphabetic characters and the underscore character. They must start with a alphabetic character or an underscore. The length of a variable name includes the %, & or $ sign, but not the () in string and array variables.More than one GLOBAL or LOCAL statement may be used, but they must be on separate lines, immediately after the procedure name. See also LOCAL.GMOVEgMOVE dx%,dy%Moves the current position dx% to the right and dy% downwards, in the current drawable.A negative dx% causes movement to the left; a negative dy% causes upward movement.See also gAT.GORDERgORDER id%,position%Sets the window specified by id% to the selected foreground/background position, and redraws the screen. Position 1 is the foreground window, position 2 is next, and so on. Any position greater than the number of windows is interpreted as the end of the list.On creation, a window is at position 1 in the list.Raises an error if id% is a bitmap.See also gRANK.GORIGINXx%=gORIGINXReturns the gap between the left side of the screen and the left side of the current window.Raises an error if the current drawable is a bitmap.GORIGINYy%=gORIGINYReturns the gap between the top of the screen and the top of the current window.Raises an error if the current drawable is a bitmap.GOTOGOTO label or GOTO label::Goes to the line following the label:: and continues from there. The label Must be in the current procedureMust start with a letter and end with a double colon, although the double colon is not necessary in the GOTO statementMay be up to 32 characters longGOTOMARKGOTOMARK b%Makes the record with bookmark b%, as returned by BOOKMARK, the current record. b% must be a bookmark in the current view.GPATTgPATT id%,width%,height%,mode%ills a rectangle of the specified size from the current position with repetitions of the drawable id%.As with gCOPY, this command can copy both set and clear pixels, so the same modes are available as when displaying text. Set mode%=0 for set, 1 for clear, 2 for invert or 3 for replace. 0, 1 and 2 act only on set pixels in the pattern; 3 copies the entire rectangle, with set and clear pixels.If you set id%=-1 a pre-defined grey pattern is used.The current position is unaffected.GPEEKLINEgPEEKLINE id%,x%,y%,d%(),ln%,mode%Reads a horizontal line from the black plane of the drawable id%, length ln%, starting at x%,y%. The leftmost 16 pixels are read into d%(1), with the first pixel read into the least significant bit.gPEEKLINE has an extra optional parameter mode% to specify the colour mode:mode% colour mode colour of pixel which sets bits1 black and white black0 black and white white1 4-colour mode white2 16-colour mode whiteThe default mode% is -1. For 4 and 16-colour modes, 2 and 4 bits per pixel respectively are used. This is to enable the colour of the pixel to be ascertained from the bits which are set. White results in all 2 or 4 bits being set, while black sets none of them. For example, in a 4-colour window, with the colour set bygCOLOR 16,16,16a pixel of a line would peek as 0001 in binary. Similarly, a pixel of a line with the colour set togCOLOR 80,80,80would result in the value 0101 in binary when peeked.The array d%() must be long enough to hold the data. You can work out the number of integers required with ((ln%+15)/16) (using whole-number division).Note that if the optional parameter mode% is used on the Series 5, the array size allowed must be adjusted accordingly: it must be at least twice as long as the array needed for black and white if the line you wish to peek in 4-colour mode and four times as long in 16-colour mode.GPOLYgPOLY a%()raws a sequence of lines, as if by gLINEBY and gMOVE commands.The array is set up as follows:a%(1) starting x positiona%(2) starting y position a%(3) number of pairs of offsets a%(4) dx1%a%(5) dy1%a%(6) dx2%a%(7) dy2% etc.Constants for the first five array subscripts are supplied in Const.oph.Each pair of numbers dx1%,dy1%, for example specifies a line or a movement. To draw a line, dy% is the amount to move down, while dx% is the amount to move to the right multiplied by two.To specify a movement (i.e. without drawing a line) work out the dx%,dy% as for a line, then add 1 to dx%.(For drawing/movement up or left, use negative numbers.)gPOLY is quicker than combinations of gAT, gLINEBY and gMOVE.Example, to draw three horizontal lines 50 pixels long at positions 20,10, 20,30 and 20,50:a%(1)=20 :a%(2)=10 REM 20,10a%(3)=5 REM 5 operationsa%(4)=50*2 :a%(5)=0 REM draw right 50a%(6)=0*2+1 :a%(7)=20 REM move down 20a%(8)=-50*2 :a%(9)=0REM draw left 50a%(10)=0*2+1 :a%(11)=20REM draw left 50a%(12)=50*2 :a%(13)=0REM draw right 50gPOLY a%()GPRINTgPRINT list of expressionsDisplays a list of expressions at the current position in the current drawable. All variable types are formatted as for PRINT.Unlike PRINT, gPRINT does not end by moving to a new line. A comma between expressions is still displayed as a space, but a semicolon has no effect. gPRINT without a list of expressions does nothing.See also gPRINTB, gPRINTCLIP, gTWIDTH, gXPRINT, gTMODE.GPRINTBgPRINTB t$,w%,al%,tp%,bt%,m%gPRINTB t$,w%,al%,tp%,bt%gPRINTB t$,w%,al%,tp%gPRINTB t$,w%,al%gPRINTB t$,w%Displays text t$ in a cleared box of width w% pixels. The current position is used for the left side of the box and for the baseline of the text.al% controls the alignment of the text in the box 1 for right aligned, 2 for left aligned, or 3 for centred.tp% and bt% are the clearances between the text and the top/bottom of the box. Together with the current font size, they control the height of the box. An error is raised if tp% plus the font ascent is greater than 255.m% controls the margins. For left alignment, m% is an offset from the left of the box to the start of the text. For right alignment, m% is an offset from the right of the box to the end of the text. For centring, m% is an offset from the left or right of the box to the region in which to centre, with positive m% meaning left and negative meaning right.If values are not supplied for some arguments, these defaults are used:al% lefttp% 0bt% 0 m% 0Constants for the layout features and the defaults are supplied in Const.oph.See also gPRINT, gPRINTCLIP, gTWIDTH, gXPRINT.GPRINTCLIPw%=gPRINTCLIP(text$,width%)Displays text$ at the current position, displaying only as many characters as will fit inside width% pixels. Returns the number of characters displayed.See also gPRINT, gPRINTB, gTWIDTH, gXPRINT, gTMODE.GRANKrank%=gRANKReturns the foreground/background position, from 1 to 64 on the Series 5, and 1 to 8 on the Series 3c, of the current window.Raises an error if the current drawable is a bitmap.See also gORDER.GSAVEBITgSAVEBIT name$,width%,height%or gSAVEBIT name$Saves the current drawable as the named bitmap file. If width% and height% are given, then only the rectangle of that size from the current position is copied.gSAVEBIT does not add a default filename extension to the input argument name if none is provided on the Series 5, while on the Series 3c, if name$ has no file extension .PIC is used.GSCROLLgSCROLL dx%,dy%,x%,y%,wd%,ht%or gSCROLL dx%,dy%Scrolls pixels in the current drawable by offset dx%,dy%. Positive dx% means to the right, and positive dy% means down. The drawable itself does not change its position.If you specify a rectangle in the current drawable, at x%,y% and of size wd%,ht%, only this rectangle is scrolled.The areas dx% wide and dy% deep which are left behind by the scroll are cleared.The current position is not affected.GSETPENWIDTHgSETPENWIDTH width%Sets the pen width in the current drawable to width% pixels.GSETWINgSETWIN x%,y%,width%,height%or gSETWIN x%,y%Changes position and, optionally, the size of the current window.An error is raised if the current drawable is a bitmap.The current position is unaffected.If you use this command on the default window, you must also use the SCREEN command to ensure that the area for PRINT commands to use is wholly contained within the default window.GSTYLEgSTYLE style%Sets the style of text displayed in subsequent gPRINT, gPRINTB and gPRINTCLIP commands on the current drawable.style% text style 0 normal1 bold2 underlined4 inverse8 double height16 mono-spaced32 italicYou can combine these styles by adding their values for example, to set bold, underlined and double height, use gSTYLE 11, as 11=1+2+8.This command does not affect non-graphics commands, like PRINT.Constants for the styles are supplied in Const.oph.GTMODEgTMODE mode%Sets the way characters are displayed by subsequent gPRINT and gPRINTCLIP commands on the current drawable.mode% pixels will be 0 set1 cleared2 inverted3 replacedWhen you first use graphics text commands on a drawable, each dot in a letter causes a pixel to be set in the drawable. This is mode%=0.When mode% is 1 or 2, graphics text commands work in a similar way, but the pixels are cleared or inverted. When mode% is 3, entire character boxes are drawn on the screen - pixels are set in the letter and cleared in the background box.This command does not affect other text display commands.Constants for the modes are supplied in Const.oph.GTWIDTHwidth%=gTWIDTH(text$)Returns the width of text$ in the current font and style.See also gPRINT, gPRINTB, gPRINTCLIP, gXPRINT.GUNLOADFONTgULOADFONT fileId%Unloads a user-defined font that was previously loaded using gLOADFONT. Raises an error if the font has not been loaded.The built-in fonts are not held in memory and cannot be unloaded.See also gLOADFONT.GUPDATEgUPDATE ONgUPDATE OFFgUPDATEThe Psions screen is usually updated whenever you display anything on it. gUPDATE OFF switches off this feature. The screen will then be updated as few times as possible (though note that some keywords will always cause an update.) You can still force an update by using the gUPDATE command on its own.This can result in a considerable speed improvement in some cases. You might, for example, use gUPDATE OFF, then a sequence of graphics commands, followed by gUPDATE. You should certainly use gUPDATE OFF if you are about to write exclusively to bitmaps.gUPDATE ON returns to normal screen updating.gUPDATE affects anything that displays on the screen. If you are using a lot of PRINT commands, gUPDATE OFF may make a noticeable difference in speed.Note that with gUPDATE OFF, the location of errors which occur while the procedure is running may be incorrectly reported. For this reason, gUPDATE OFF is best used in the final stages of program development, and even then you may have to remove it to locate some errors.GUSEgUSE id%Makes the drawable id% current. Graphics drawing commands will now go to this drawable. gUSE does not bring a drawable to the foreground (see gORDER).GVISIBLEgVISIBLE ONMakes the current window visible or invisible.Raises an error if the current drawable is a bitmap.GWIDTHwidth%=gWIDTHReturns the width of the current drawable.GXx%=gXReturns the x current position (in from the left) in the current drawable.GXBORDERgXBORDER type%,flags%,w%,h%or gXBORDER type%,flags%Draws a border in the current drawable of a specified type, fitting inside a rectangle of the specified size or with the size of the current drawable if no size is specified.type%=1 for drawing the Series 3c 3-D grey and black border. A shadow or a gap for a shadow is always assumed. type%=2 for drawing the Series 5 borders.Values for flags% and their effects on the Series 5 are as follows,border type flags%none $00single black $01shallow sunken $42deep sunken $44deep sunken with outline $54shallow raised $82deep raised $84deep raised with outline $94vertical bar $22horizontal bar $2aConstants for these flags and types are supplied in Const.oph.The following values of flags% apply to all border types:0 for normal cornersAdding $100 leaves 1 pixel gap around the border.Adding $200 for more rounded cornersAdding $400 for losing a single pixel.If both $400 and $200 are mistakenly supplied, $200 has priority.See also gBORDER.GXPRINTgXPRINT string$,flags%Displays string$ at the current position, with precise highlighting or underlining. The current font and style are still used, even if the style itself is inverse or underlined. If text mode 3 (replace) is used both set and cleared pixels in the text are drawn.flags% has the following effect:flags% effect 0 normal, as with gPRINT1 inverse2 inverse, except corner pixels3 thin inverse4 thin inverse, except corner pixels5 underlined6 thin underlinedConstants for these flags are supplied in Const.oph.Where lines of text are separated by a single pixel, the thin options maintain the separation between lines.gXPRINT does not support the display of a list of expressions of various types.GYy%=gYReturns the y current position (down from the top) in the current drawable.HEX$h$=HEX$(x&)Returns a string containing the hexadecimal (base 16) representation of integer or long integer x&. For example HEX$(255) returns the string FF. Notes To enter integer hexadecimal constants (16 bit) put a $ in front of them. For example $FF is 255 in decimal. (Dont confuse this use of $ with string variable names.)To enter long integer hexadecimal constants (32 bit) put a & in front of them. For example &FFFFF is 1048575 in decimal.Counting in hexadecimal is done like this: 0 1 2 3 4 5 6 7 8 9 A B C D E F 10... where A stands for decimal 10, B for decimal 11, C for decimal 12 ... up to F for decimal 15. After F comes 10, which is equivalent to decimal 16. To understand numbers greater than hexadecimal 10, again compare hexadecimals with decimals. In these examples, 102 means 10(10, 103 means 10(10(10 and so on.253 in decimal is:(2(102)+(5(101)+(3(100) = (2(100)+(5(10)+(3(1) = 200+50+3By analogy, &253 in hexadecimal is:(&2(162)+(&5(161)+(&3(160) =(2(256)+(5(16)+(3(1) =512+80+3 = 595 in decimal.Similarly, &A6B in hexadecimal is:(&A(162)+(&6(161)+(&B(160) =(10(256)+(6(16)+(11(1) =2560+96+11 = 2667 in decimal.You may also find this table useful for converting between hex and decimal:hex decimal&1 1=160 &10 16=161&100 256=162&10004096=163For example, &20F9 is(2(&1000)+(0(&100)+(15(&10)+9 which in decimal is: (2(4096)+(0(256)+(15(16)+9 = 8441.All hexadecimal constants are integers ($) or long integers (&). So arithmetic operations involving hexadecimal numbers behave in the usual way. For example, &3/&2 returns 1, &3/2.0 returns 1.5, 3/$2 returns 1.HOURh%=HOURReturns the number of the current hour from the system clock as an integer between 0 and 23.I/O FUNCTIONSr%=IOA(h%,f%,var status%,var a1,var a2)This has the same form as IOC, but it returns an error value of the request is not completed successfully. IOC should be used in preference to IOA.IOC(h%,f%,var status%,var a1,var a2)Make an I/O request with guaranteed completion. The device driver opened with handle h% performs the asynchronous I/O function f% with two further arguments, a1 and a2. The argument status% is set by the device driver. If an error occurs while making a request, status% is set to an appropriate values, but IOC always returns zero, not an error value. .An IOWAIT or IOWAITSTAT must be performed for each IOC. IOC should be used in preference to IOA.r%=IOCANCEL(h%)Cancels any outstanding asynchronous I/O request (IOC or IOA). Note, however, that the request will still complete, so the signal must be consumed using IOWAITSTAT.r%=IOCLOSE(h%)Closes a file with the handle h%.r%=IOOPEN(var h%,name$,mode%)Creates or opens a file called name$. Defines h% for use by other I/O functions. mode% specifies how to open the file. For unique file creation, use IOOPEN(var h%,addr%,mode%)(r%=IOREAD(h%,addr&,maxLen%)(r%=IOREAD(h%,addr%,maxLen%)Reads from the file with the handle h%. address% is the address of a buffer large enough to hold a maximum of maxLen% bytes. The value returned to r% is the actual number of bytes read or, if negative, is an error value.r%=IOSEEK(h%,mode%,var off&)Seeks to a position in a file that has been opened for random access. mode% specifies how the offset argument off& is to be used. Values for mode% may be found in the Advanced topics chapter. off& may be positive to move forwards or negative to move backwards. IOSEEK sets the variable off& to the absolute position set.IOSIGNALSignals an asynchronous I/O functions completion.r%=IOW(h%,func%,var a1,var a2)The device driver opened with handle h% performs the synchronous I/O function func% with the two further arguments.IOWAITWaits for an asynchronous I/O function to signal completion.IOWAITSTAT var stat%Waits for an asynchronous function, called with IOC or IOA, to complete.(IOWAITSTAT32 var stat& Takes a 32-bit status word. IOWAITSTAT32 should be called only when you need to wait for completion of a request made using a 32-bit status word when calling an asynchronous OPX procedure.The initial value of a 32-bit status word while it is still pending (i.e. waiting to complete) is &80000001 (KStatusPending32& in Const.oph: see the Calling Procedures chapter for details of how to use this file). For a 16-bit status word the pending value is -46 (KErrFilePending%).(r%=IOWRITE(h%,addr&,length%)(r%=IOWRITE(h%,addr%,length%)Writes length% bytes in a buffer at address% to the file with the handle h%.IOYIELDEnsures that any asynchronous handler set up with IOC or IOA is given a chance to run. IOYIELD must always be called before polling status words on the Series 5, i.e. before reading a 16-bit status word if IOWAIT or IOWAITSTAT have not been used first.Note the following example when you use #:On the Series 3c you would call IOSEEK using,ret%=IOSEEK(h%,mode%,#ptrOff%)but on the Series 5 you would use,ret%=IOSEEK(h%,mode%,#ptrOff&)passing the long integer ptrOff&.IABSi&=IABS(x&)Returns the absolute value, i.e. without any sign, of the integer or long integer expression x&. For example IABS(-10) is 10. See also ABS, which returns the absolute value as a floating-point value.ICONICON mbm$Gives the name of the bitmap file mbm$ (also known as an EPOC Picture file) to use as the icon for an OPL Application.If the ICON command is not used inside the APP...ENDA structure, then a default icon is used, but the rest of the information in the APP..ENDA construct is still used to specify the other features of the OPL application.On the Series 5, mbm$ is a multi-bitmap file which can contain up to three bitmap/mask pairs - the sizes are 24, 32 and 48 squares. These different sizes are used for the different zoom levels in the system screen. The sizes are read from the MBM and the most suitable size is zoomed if the exact sizes required are not provided or if some are missing.In fact, you can use ICON more than once within the APP...ENDA construct on the Series 5. The translator only insists that all icons are paired with a mask of the same size in the final ICON list. This allows you to use pairs of MBMs containing just one bitmap as produced by the Sketch application. For example, you could specify them individually:APP ... ICON icon24.mbm ICON mask24.mbm ICON icon32.mbm ICON mask32.mbm ICON icon48.mbm ICON mask48.mbmENDAor with pairs in each MBM:APP ... ICON iconMask24 ICON iconMask32 ICON iconMask48ENDAor with all the bitmaps as just one MBM, as would normally be the case if prepared on the PC using the BMCONV tool and the AIFTOOL (description of these tools is beyond the scope of this manual and you should refer to the EPOC32 C++ Software Development Kit (SDK), which is available from Psion Software plc, for more details).This command can only be used between APP and ENDA.IF...ENDIFIF condition1...ELSEIF condition2...ELSE...ENDIFDoes either the statements following the IF conditionorthe statements following one of the ELSEIF conditions (there may be as many ELSEIF statements as you like none at all if you want)orthe statements following ELSE (or, if there is no ELSE, nothing at all). There may be either one ELSE statement or none.After the ENDIF statement, the lines following ENDIF carry on as normal.IF, ELSEIF, ELSE and ENDIF must be in that order.Every IF must be matched with a closing ENDIF.You can also have an IF...ENDIF structure within another, for example:IF condition1...ELSE...IF condition2....ENDIF...ENDIFcondition is an expression returning a logical value for example a,16,Exit,%eThe trailing > character specifies that a previously defined cascade item is to be used in the menu at this point: it is not displayed in the menu item. A cascade has a filled arrow head displayed along side it in the menu. The cascade title in mCASC is also used only for identification purposes and is not displayed in the cascade itself. This title needs to be identical to the menu item text apart from the >. For efficiency, OPL doesnt check that a defined cascade has been used in a menu and an unused cascade will simply be ignored. To display a > in a cascaded menu item, you can use >>.Shortcut keys used in cascades may be added to the appropriate constant values as for mCARD to enable checkboxes, option buttons and dimming of cascade items.As is typical for cascade titles, a shortcut value of 16 is used in the example above. This prevents the display or specification of any shortcut key. However, it is possible to define a shortcut key for a cascade title if required, for example to cycle through the options available in a cascade.See mCARD, MENU, mINIT.MEANm=MEAN(list)or m=MEAN(array(),element)Returns the arithmetic mean (average) of a list of numeric items. The list can be either:A list of variables, values and expressions, separated by commas orThe elements of a floating-point array. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=MEAN(arr(),3) would return the average of elements arr(1), arr(2) and arr(3).This example displays 15.0:a(1)=10a(2)=15a(3)=20PRINT MEAN(a(),3)MENUval%=MENUor val%=MENU(var init%)Displays the menus defined by mINIT, mCARD and mCASC, and waits for you to select an item. Returns the shortcut key keycode of the item selected, as defined in mCARD, in lower case.If you cancel the menu by pressing Esc, MENU returns 0.If the name of a variable is passed, it sets the initial menu pane and item to be highlighted. init% should be 256*(menu%)+item%; for both menu% and item%, 0 specifies the first, 1 the second and so on. If init% is 517 (=256*2+5), for example, this specifies the 6th item on the third menu.If init% was passed, MENU writes back to init% the value for the item which was last highlighted on the menu. You can then use this value when calling the menu again.It is necessary to use MENU(init%), passing back the same variable each time the menu is opened if you wish the menu to reopen with the highlight set on the last selected item.It is incorrect to ignore mCARD and mCASC errors by having an ONERR label around an mCARD or mCASC call. If you do, the menu is discarded and a Structure fault will be raised on using mCARD, mCASC or MENU without first using mINIT again.The following bad code will not display the menu:mINITONERR errIgnore1mCARD Xxx,ItemA,0REM bad shortcuterrIgnore1::ONERR errIgnore2mCARD Yyy,REM Structure fault error (mINIT discarded)errIgnore2::ONERR OFFMENUREM Structure fault againMID$m$=MID$(a$,x%,y%)Returns a string comprising y% characters of a$, starting at the character at position x%.E.g. if name$=McConnell then MID$(name$,3,4) would return the string Conn.MINITmINITPrepares for definition of menus, cancelling any existing menus. Use mCARD and mCASC to define each menu, then MENU to display them.On the Series 5, it is incorrect to ignore mCARD or mCASC errors by having an ONERR label around an mCARD or mCASC call. If you do, the menu is discarded and a Structure fault will be raised if there is an occurrence of mCARD, mCASC or MENU without first using mINIT again. See also MENU for an example of this.MINUTEm%=MINUTEReturns the current minute number from the system clock (0 to 59). E.g. at 8.54am MINUTE returns 54.MKDIRMKDIR name$Creates a new folder/directory.For example, MKDIR C:\MINE\TEMP creates a C:\MINE\TEMP folder, also creating C:\MINE if it is not already there.MODIFYMODIFYAllows the current record of a view to be modified without moving the record. The fields can then be assigned to before using PUT or CANCEL.MONTHm%=MONTHReturns the current month from the system clock as an integer between 1 and 12. E.g. on 12th March 1992 m%=MONTH returns 3 to m%.Constants for the month numbers are given in Const.oph.MONTH$m$=MONTH$(x%)Converts x%, a number from 1 to 12, to the month name, expressed as a three-letter mixed case string.E.g. MONTH$(1) returns the string Jan.Constants for the month numbers are given in Const.ophMPOPUPmPOPUP(x%,y%,posType%,item1$,key1%,item2$,key2%,...)Presents a popup menu. mPOPUP returns the value of the keypress used to exit the popup menu, this being 0 if Esc is pressed.Note that mPOPUP defines and presents the menu itself, and should not and need not be called from inside the mINIT...MENU structure.posType% is the position type controlling which corner of the popup menu x%,y% specifies and can take the values,posType% corner0 top left1 top right2 bottom left3 bottom rightConstants for these corner values are supplied in Const.oph.item$ and key% can take the same values as for mCARD, with key% taking the same constant values to specify checkboxes, option buttons and dimmed items. However, cascades in popup menus are not supported.For examplemPOPUP (0,0,0,Continue,%c,Exit,%e)specifies a popup menu with 0,0 as its top left-hand corner with the items Continue and Exit, with the shortcut keys Ctrl+C and Ctrl+E respectively.See also mCARD.NEXTNEXTPositions to the next record in the current data file.If NEXT is used after the end of a file has been reached, no error is reported but the current record is null and the EOF function returns trueNUM$n$=NUM$(x,y%)Returns a string representation of the integer part of the floating-point number x, rounded to the nearest whole number. The string will be up to y% characters wide. If y% is negative then the string is right-justified for example NUM$(1.9,3) returns 2 where there are two spaces to the left of the 2.If y% is positive no spaces are added: e.g. NUM$(-3.7,3) returns -4.If the string returned to n$ will not fit in the width y%, then the string will just be asterisks; for example NUM$(256.99,2) returns **.See also FIX$, GEN$, SCI$.OFFOFFor OFF x%Switches the Psion off.When you switch back on, the statement following the OFF command is executed, for example:OFF :PRINT Hello again If you specify an integer, x%, greater than 2 (between 2 and 16383 on the Series 3c; 16383 is about 4.5 hours), the machine switches off for that number of seconds and then automatically turns back on and continues with the next line of the program. However, during this time the machine may be switched on by an alarm, and of course you can turn it on as usual.(The minimum time to switch off is 5 seconds on the Series 5. EPOC32 also prevents switch off if theres an absolute timer outstanding and due to go off in less than 5 seconds. Be careful how you use this command. If, due to a programming mistake, a program uses OFF in a loop, you may find it impossible to switch the Psion back on, and may have to reset the computer.ONERRONERR label or ONERR label::...ONERR OFFNERR label:: establishes an error handler in a procedure. When an error is raised, the program jumps to the label:: instead of the program stopping and an error message being displayed.(The label may be up to 32 characters long starting with a letter or an underscore.It ends with a double colon (::), although you dont need to use this in the ONERR statement.ONERR OFF disables the ONERR command, so that any errors occurring after the ONERR OFF statement no longer jump to the label. It is advisable to use the command ONERR OFF immediately after the label:: which starts the error handling code.See the Error Handling chapter for full details.OPENOPEN query$,log,f1,f2,...Opens an existing table (or a view of a table) from an existing database, giving it the logical view name log and handles for the fields f1, f2. log can be any letter in the range A to Z.query$ specifies the database file, the required table and fields to be selected.For example:OPEN clients SELECT name, tel FROM phone,D,n$,t$The database name here is clients and the table name is phone. The field names are enclosed by the keywords SELECT and FROM and their types should correspond with the list of handles (i.e. n$ indicates that the name field is a string).Replacing the list of field names with * selects all the fields from the table.query$ is also used to specify an ordered view and if a suitable index has been created, then it will be used. See the Database OPX section in the Using OPXs on the Series 5 chapter. For example,OPEN people SELECT name,number FROM phoneBook ORDER BY name ASC, number DESC,G,n$,num%would open a view with name fields in ascending alphabetical order and if any names were the same then the number field would be used to order these records in descending numerical order.Compatibility with the Series 3cAs on the Series 3c (see below), query$ may contain just the filename. In this case a table with the default name Table1 would be opened if it exists. The field names would then be unimportant as access will be given to as many fields as there are supplied handles. The type indicators on the field handles must match the types of the fields. See also the Data File Handling chapter and the Series 5 Database Handling chapter.See also CREATE, USE and OPENR.OPENROPENR query$,log,f1,f2,...This command works exactly like OPEN except that the opened file is read-only - in other words, you cannot APPEND, UPDATE or PUT the records it contains.This means that you can run two separate programs at the same time, both sharing the same file.PARSE$p$=PARSE$(f$,rel$,var off%())Returns a full file specification from the filename f$, filling in any missing information from rel$.The offsets to the filename components in the returned string is returned in off%() which must be declared with at least 6 integers:off%(1) filing system offset (1 always)off%(2) device offset (1 always on Series 5 since filing system is not a component of filenames on the Series 5)off%(3) path offsetoff%(4) filename offset off%(5) file extension offset off%(6) flags for wildcards in returned stringThe flag values in offset%(6) are:0 no wildcards1 wildcard in filename2 wildcard in file extension3 wildcard in bothConstants for the array subscripts and the flags are supplied in Const.oph.If rel$ is not itself a complete file specification, the current filing system, device and/or path are used as necessary to fill in the missing parts.f$ and rel$ should be separate strings.Example:p$=PARSE$(NEW,C:\Documents\*.MBM,x%())sets p$ to C:\Documents\NEW.MBM and x%() to (1,1,3,14,17,0).PAUSEPAUSE x%Pauses the program for a certain time, depending on the value of x%:x% result0 waits for a key to be pressed.+ve pauses for x% twentieths of a second.-ve pauses for x% twentieths of a second or until a key is pressed.So PAUSE 100 would make the program pause for 100/20 = 5 seconds, and PAUSE -100 would make the program pause for 5 seconds or until a key is pressed.If x% is less than or equal to 0, a GET, GET$, KEY or KEY$ will return the key press which terminated the pause. If you are not interested in this keypress, but in the one which follows it, clear the buffer after the PAUSE with a single KEY function: PAUSE -10 :KEYYou should be especially careful about this if x% is negative, since then you cannot tell whether the pause was terminated by a keypress or by the time running out.PAUSE should not be used in conjunction with GETEVENT or GETEVENT32 because events are discarded by PAUSE.PEEK FUNCTIONSThe PEEK functions find the values stored in specific bytes.p%=PEEKB(x&)Returns the integer value of the byte at address x& (x%)p%=PEEKW(x&)Returns the integer at address x& (x%)p&=PEEKL(x&)Returns the long integer value at address x& (x%)p=PEEKF(x&)Returns the floating-point value at address x& (x%)p$=PEEK$(x&)Returns the string at address x& (x%)Usually you would find out the byte address with the ADDR function. For example, if var% has the value 7, PEEKW(ADDR(var%)) returns 7.The different types are stored in different ways across bytes:Integers are stored in two bytes. The first byte is the least significant byte,for example: 1 0 = 10 1= 256ADDR returns the address of the first (least significant) byte.Long integers are stored in four bytes, the least significant first and the most significant last, for example: 0 0 1 0= 65536ADDR returns the address of the first (least significant) byte.Strings are stored with one character per byte, with a leading byte containing the string length, e.g.: 3 65 66 67= ABCEach letter is stored as its character code - for example, A as 65. For example, if var$=ABC, PEEK$(ADDR(var$)) will return the string ABC. ADDR returns the address of the length byte.Floating-point numbers are stored under IEEE format, across eight bytes. PEEKF automatically reads all eight bytes and returns the number as a floating-point. For example if var=1.3 then PEEKF(ADDR(var)) returns 1.3.You can use ADDR to find the address of the first element in an array, for example ADDR(x%(), you can also specify individual elements of the array, for example ADDR(x%(2)).See also the POKE commands and ADDR. See also the Series 5 32-bit addressing section in the Advanced Topics chapter.PIp=PIReturns the value of ( (3.14... ).POINTERFILTERPOINTERFILTER filter%,mask%Filters pointer events in the current window out or back in. Add the following flags together to achieve the desired filter% and mask%:event valuenone 0enter/exit 1drag 4Constants for these values are supplied in Const.oph.The bits set in filter% specify the settings to be used, 1 to filter out the event and 0 to remove the filter. Only those bits set in mask% will be used for filtering. This allows the current setting of a particular bit to be left unchanged if that bit is zero in the mask. (i.e. mask% dictates what to change and filter% specifies the setting to which it should be changed). For example,mask%=5REM =1+4 - allows enter/exit and drag settings to be changedPOINTERFILTER 1,mask% REM filters out enter/exit, but not dragging...POINTERFILTER 4,mask% REM filters out drag and reinstates enter/exitInitially the events are not filtered out.See also GETEVENT32, GETEVENTA32.POKE COMMANDSThe POKE commands store values in specific bytes.POKEB x&,y%Stores the integer value y% (less than 256) in the single byte at address x& (x%)POKEW x&,y%Stores the integer y% across two consecutive bytes, with the least significant byte in the lower address, that is x& (x%)POKEL x&,y&Stores the long-integer y& in bytes starting at address x& (x%)POKEF x&,yStores the floating-point value y in bytes starting at address x& (x%)POKE$ x&,y$Stores the string y$ in bytes starting at address x& (x%)Use ADDR to find out the address of your declared variables. Casual use of these commands can result in the loss of data in the Series 3c.See PEEK for more details of how the different types are stored across bytes.POSp%=POSReturns the number of the current record in the current view. You are advised to use bookmarks instead of POS on the Series 5.See BOOKMARK, GOTOMARK, KILLMARK.POSITIONPOSITION x%Makes record number x% the current record in the current view. By using bookmarks and editing the same table via different views, positional accuracy can be lost and POSITION x% could access the wrong record. Accuracy can be restored by using FIRST or LAST on the current view.POS and POSITION still exist mainly for reasons of compatibility with the Series 3c and you are advised to use bookmarks instead on the Series 5.See BOOKMARK, GOTOMARK, KILLMARK.Makes record number x% the current record in the current data file.If x% is greater than the number of records in the file then the EOF function will return true.PRINTPRINT list of expressionsDisplays a list of expressions on the screen. The list can be punctuated in one of these ways:If items to be displayed are separated by commas, there is a space between them when displayed.If they are separated by semicolons, there are no spaces.Each PRINT statement starts a new line, unless the preceding PRINT ended with a semicolon or comma.There can be as many items as you like in this list. A single PRINT on its own just moves to the next line.Examples: On 1st January 1993,codedisplayPRINT TODAY is,PRINT DAY;.;MONTH;.;YEARTODAY is 1.1.1993PRINT 1 1PRINT Hello HelloPRINT Number,1 Number 1See also LPRINT, gUPDATE, gPRINT, gPRINTB, gPRINTCLIP, gXPRINT.PUTPUTMarks the end of a databases INSERT or MODIFY phase and makes the changes permanent.See INSERT, MODIFY, CANCEL.RADr=RAD(x)Converts x from degrees to radians.All the trigonometric functions assume angles are specified in radians, but it may be easier for you to enter angles in degrees and then convert with RAD. Example:PROC xcosine:LOCAL angle PRINT Angle (degrees)?:; INPUT angle PRINT COS of,angle,is, angle=RAD(angle) PRINT COS(angle) GETENDP(The formula used is (PI*x)/180).To convert from radians to degrees use DEG.RAISERAISE x%Raises an error. The error raised is error number x%. This may be one of the errors listed in the Error Handling chapter, or a new error number defined by you.The error is handled by the error processing mechanism currently in use - either OPLs own, which stops the program and displays an error message, or the ONERR handler if you have ONERR on.RANDOMIZERANDOMIZE x&Gives a seed (start-value) for RND.Successive calls of the RND function produce a sequence of random numbers. If you use RANDOMIZE to set the seed back to what it was at the beginning of the sequence, the same sequence will be repeated.For example, you might want to use the same random values to test new versions of a procedure. To do this, precede the RND statement with the statement RANDOMIZE value. Then to repeat the sequence, use RANDOMIZE value again.Example:PROC SEQ:LOCAL g$(1) WHILE 1 PRINT S: set seed to 1 PRINT Q: quit PRINT other key: continue g$=UPPER$(GET$) IF g$=Q BREAK ELSEIF g$=S PRINT Setting seed to 1 RANDOMIZE 1 PRINT First random no: ELSE PRINT Next random no: ENDIF PRINT RND ENDWHENDPREALLOCpcelln&=REALLOC(pcell&,size&)Change the size of a previously allocated cell at pcell& (pcell%) to size& (size%), returning the new cell address or zero if there is not enough memory.Cells are allocated lengths that are the smallest multiple of four greater than the size requested. An error will be raised if the cell address argument is not in the range known by the heap.See also SETFLAGS if you require the 64K limit to be enforced on the Series 5. If the flag is set to restrict the limit, pcelln& is guaranteed to fit into an integer.REMREM TextPrecedes a remark you include to explain how a program works. All text after the REM up to the end of the line is ignored.When you use REM at the end of a line you need only precede it with a space, not a space and a colon.Examples:INPUT a :b=a*.175 REM b=TAXINPUT a :b=a*.175 :REM b=TAXRENAMERENAME file1$,file2$Renames file1$ as file2$. You can rename any type of file.You cannot use wildcards.You can rename across directories RENAME \dat\xyz.abc,\xyz.abc is OK. If you do this, you can choose whether or not to change the name of the file.Example:PRINT Old name: :INPUT a$PRINT New name: :INPUT b$RENAME a$,b$REPT$r$=REPT$(a$,x%)Returns a string comprising x% repetitions of a$.For example, if a$=ex, r$=REPT$(a$,5) returns exexexexex.RETURNRETURNor RETURN variableTerminates the execution of a procedure and returns control to the point where that procedure was called (ENDP does this automatically).RETURN variable does this as well, but also passes the value of variable back to the calling procedure. The variable may be of any type. You can return the value of any single array element - for example RETURN x%(3). You can only return one variable.RETURN on its own, and the default return through ENDP, causes the procedure to return the value 0 or a null string.RIGHT$r$=RIGHT$(a$,x%)Returns the rightmost x% characters of a$. Example:PRINT Enter name/ref,INPUT c$ref$=RIGHT$(c$,4)name$=LEFT$(c$,LEN(c$)-4)RMDIRRMDIR str$Removes the directory given by str$. You can only remove empty directories.RNDr=RNDReturns a random floating-point number in the range 0 (inclusive) to 1 (exclusive).To produce random numbers between 1 and n e.g. between 1 and 6 for a dice use the following statement: f%=1+INT(RND*n)RND produces a different number every time it is called within a program. A fixed sequence can be generated by using RANDOMIZE. You might begin by using RANDOMIZE with an argument generated from MINUTE and SECOND (or similar), to seed the sequence differently each time.Example:PROC rndvals:LOCAL i% PRINT Random test values: DO PRINT RND i%=i%+1 GET UNTIL i%=10ENDPROLLBACKROLLBACKCancels the current transaction on the current view. Changes made to the database with respect to this particular view since BEGINTRANS was called will be discarded.See also BEGINTRANS, COMMITTRANS.SCI$s$=SCI$(x,y%,z%)Returns a string representation of x in scientific format, to y% decimal places and up to z% characters wide.Examples:SCI$(123456,2,8)=1.23E+05SCI$(1,2,8)=1.00E+00SCI$(1234567,1,-8)= 1.2E+06If the number does not fit in the width specified then the returned string contains asterisks.If z% is negative then the string is right-justified.See also FIX$, GEN$, NUM$.SCREENSCREEN width%,height%or SCREEN width%,height%,x%,y%Changes the size of the window in which text is displayed. x%,y% specify the character position of the top left corner; if they are not given, the text window is centred in the screen.An OPL program can initially display text to the whole screen.See SCREENINFO.SCREENINFOSCREENINFO var info%()Gets information on the text screen (as used by PRINT, SCREEN etc.)This keyword allows you to mix text and graphics. It is required because while the default window is the same size as the physical screen, the text screen is slightly smaller and is centred in the default window. The few pixels gaps around the text screen, referred to as the left and top margins, depend on the font in use.On return, the array info%(), which must have at least 10 elements, contains this information:info%(1) left margin in pixelsinfo%(2) top margin in pixels info%(3) text screen width in character unitsinfo%(4) text screen height in character unitsinfo%(5) reserved (window server id for default window)The font ID is a 32-bit integer on the Series 5 and therefore would not fit into a single element of info%(). Hence, the least significant 16 bits of the font ID are returned to info%(9) and the most significant 16 bits to info%(10).info%(6) unusedinfo%(7) pixel width of text window character cellinfo%(8) pixel height of text window lineinfo%(9) least significant 16 bits of the font IDinfo%(10) most significant 16 bits of the font IDConstants for these array subscripts are supplied in Const.oph.Initially SCREENINFO returns the values for the initial text screen. Subsequently any keyword which changes the size of the text screen font, such as FONT or SCREEN, will change some of these values and SCREENINFO should therefore be called again.See also FONT, SCREEN.SECONDs%=SECONDReturns the current time in seconds from the system clock (0 to 59). E.g. at 6:00:33 SECOND returns 33.SECSTODATESECSTODATE s&,var yr%,var mo%,var dy%,var hr%,var mn%,var sc%,var yrday%Sets the variables passed by reference to the date corresponding to s&, the number of seconds since 00:00 on 1/1/1970. yrday% is set to the day in the year (1-366).s& is an unsigned long integer. To use values greater than +2147483647, subtract 4294967296 from the value.See also DATETOSECS, HOUR, MINUTE, SECOND, dDATE, DAYS.SETDOCSETDOC file$Sets the file file$ to be a document. This command should be called immediately before the creation of file$ if it is to be recognised as a document. SETDOC may be used with the commands CREATE, gSAVEBIT and IOOPEN.The string passed to SETDOC must be identical to the name passed to the following CREATE or gSAVEBIT otherwise a non-document file will be created. Example of document creation:SETDOC myfile CREATE myfile,a,a$,b$ SETDOC should also be called after successfully opening a document to allow the System screen to display the correct document name in its task list.In case of failure in creating or opening the required file, you should take the following action:Creating - try to re-open the last file and if this fails display an appropriate error dialog and exit. On reopening, call SETDOC back to the original file so the Task list is correct.Opening - as for creating, but calling SETDOC again is not strictly required.Database documents, created using CREATE, and multi-bitmap documents, created using gSAVEBIT, will automatically contain your application UID in the file header. For binary and text file documents created using IOOPEN and LOPEN, it is the programmers responsibility to save the appropriate header in the file. This is a fairly straight-forward process and the following suggests one way of finding out what the header should be:1.Create a database or bitmap document in a test run of you application using SETDOC as shown above2.Use a hex editor or hex dump program to find the 1st 16 bytes, or run the program below which reads the four long integer UIDs from the test document.3.Write these four long integers to the start of the file you create using IOOPEN.Creating text file documents using IOOPEN or LOPEN has two special requirements:You will need to save the required header as the first text record. This will insert the standard text file line delimiters CR LF (hex 0D 0A) at the end of the record.The specific 16 bytes required for your application may itself however contain CR LF. Since you should know when this is the case, you will need to read records until you have reached byte 16 in the document. This is clearly not a desirable state of affairs but is inescapable given that text files were not designed to have headers. It is recommended that you request a new UID for your application if it contains CR LF.See the Advanced Topics chapter.See also GETDOC$.SETFLAGSSETFLAGS flags&Sets flags to produce various effects when running programs. Use CLEARFLAGS to clear any flags which have been set. The effects which can be achieved are as follows:flags& effect1 restricts the memory available to your application to 64K, emulating the Series 3c. This setting should be used at the beginning of your program only, if required. Changing this setting repeatedly will have unpredictable effects.2 enables auto-compaction on closing databases. This can be slow, but it is advisable to use this setting when lots of changes have been made to a database. 4 enables raising of overflow errors when floating-point values are greater than or equal to 1.0E+100 in magnitude, instead of allowing 3-digit exponents (for backwards compatibility).$10000 enables GETEVENT, GETEVENT32 and GETEVENT32A to return the event code $403 to ev&(1) when the machine switches onConstants for these flags are supplied in Const.oph.By default these flags are cleared.See also GETEVENT32, CLEARFLAGS.SETPATHSETPATH name$Sets the current path for file access for example, SETPATH C:\docs.LOADM continues to use the path of the initial program, but all other file access will use the new path.SINs=SIN(angle)Returns the sine of angle, an angle expressed in radians.To convert from degrees to radians, use the RAD function.SPACEs&=SPACEReturns the number of free bytes on the device on which the current (open) data file is held.Example:PROC stock: OPEN c:\stock\stock,A,a$,b% PRINT SPACE,bytes free on C:ENDPPROC stock: OPEN a:\stock,A,a$,b% WHILE 1 PRINT Item name:; INPUT A.a$ PRINT Number:; INPUT A.b% IF RECSIZE>SPACE PRINT Disk full CLOSE BREAK ELSE APPEND ENDIF ENDWHENDPSQRs=SQR(x)Returns the square root of x.STDs=STD(list)or s=STD(array(),element)Returns the standard deviation of a list of numeric items. The list can be either:A list of variables, values and expressions, separated by commas orThe elements of a floating-point array. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=STD(arr(),3) would return the standard deviation of elements arr(1), arr(2) and arr(3).STOPSTOPSTOPUsage:STOPEnds the running program.Note that STOP may not be used during an OPX callback and will raise the Series 5 error, STOP used in callback if it is. See the Using OPXs on the Series 5 chapter.STYLESTYLE style%Sets the text window character style. style% can be 2 for underlined, or 4 for inverse.See The text and graphics windows section at the end of the Graphics chapter for more details.SUMs=SUM(list)or s=SUM(array(),element)Returns the sum of a list of numeric items. The list can be either:A list of variables, values and expressions, separated by commas orThe elements of a floating-point array. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=SUM(arr(),3) would return the sum of elements arr(1), arr(2) and arr(3).TANt=TAN(angle)Returns the tangent of angle, an angle expressed in radians.To convert from radians to degrees, use the DEG function.TESTEVENTt%=TESTEVENTReturns True if an event has occurred, otherwise returns False. The event is not read by TESTEVENT - it may be read with GETEVENT, or GETEVENT32 or GETEVENTA32 on the Series 5.On the Series 5, it is recommended that you use either GETEVENT32 or GETEVENTA32 without TESTEVENT as TESTEVENT may use a lot of power, especially when used in a loop as will often be the case.TRAPTRAP commandTRAP is an error handling command. It may precede any of these commands:Data file commandsAPPEND, UPDATE, BACK, NEXT, LAST, FIRST, POSITION, USE, CREATE, OPEN, OPENR, CLOSE, DELETEMODIFY, INSERT, PUT, CANCELFile commandsCOPY, ERASE, RENAME, LOPEN, LCLOSE, LOADM, UNLOADMDirectory commandsMKDIR, RMDIRData entry commandsEDIT, INPUTGraphics commandsgSAVEBIT, gCLOSE, gUSE, gUNLOADFONT, gFONT, gPATT, gCOPYFor example, TRAP FIRST. Any error resulting from the execution of the command will be trapped. Program execution will continue at the statement after the TRAP statement, but ERR will be set to the error code.TRAP overrides any ONERR.TRAP RAISETRAP RAISE x%Sets the value of ERR to x% and clears the trap flag.TRAP RAISETRAP RAISE x%Sets the value of ERR to x% and clears the trap flag.See the Error Handling chapter for further details of TRAP usage.UADDi%=UADD(val1%, val2%)Add val1% and val2%, as if both were unsigned integers with values from 0 to 65535. Prevents integer overflow for pointer arithmetic on the Series 3c e.g. UADD(ADDR(text$),1) should be used instead of ADDR(text$)+1.One argument would normally be a pointer and the other an offset expression.Note that UADD and USUB should not be used on the Series 5 for pointer arithmetic unless SETFLAGS has been used to enforce the 64K memory limit. In general, long intger arithmetic should be used for pointer arithmetic on the Series 5.See also USUB.UNLOADMUNLOADM module$Removes from memory the module module$ loaded with LOADM.module$ is a string containing the name of the translated module.The procedures in an unloaded module cannot then be called by another procedure.UNLOADM causes any procedures in the module that are not still running to be unloaded from memory too. Running procedures are unloaded on return. It is considered bad practice, however, to use UNLOADM on a module with procedures that are still running. On the Series 3c, the module name and procedure name will not be available for any untrapped error message.Once LOADM has been called, procedures loaded stay in memory until the module is unloaded, so significantly more memory can be used than on the Series 3c, where procedures are unloaded when the cache is full (or on return if caching is not used).UNTILSee DO.UPDATEUPDATEDeletes the current record in the current data file and saves the current field values as a new record at the end of the file.This record, now the last in the file, remains the current record.Example:A.count=129A.name$=BrownUPDATEUse APPEND to save the current field values as a new record. MODIFY, PUT and CANCEL should normally be used instead of UPDATE on the Series 5.UPPER$u$=UPPER$(a$)Converts any lower case characters in a$ to upper case, and returns the completely upper case string.Example:...CLS :PRINT Y to continuePRINT or N to stop.g$=UPPER$(GET$)IF g$=Y nextproc:ELSEIF g$=N RETURNENDIF...Use LOWER$ to convert to lower case.USEUSE logical nameSelects the data file with the given logical name (A-Z for the Series 5, A, B, C or D for the Series 3c). The file must previously have been opened with OPEN, OPENR or CREATE and not yet be closed.All the record handling commands (such as POSITION and UPDATE, and GOTOMARK, INSERT, MODIFY, CANCEL and PUT on the Series 5) then operate on this file.USUBi%=USUB(val1%,val2%)Subtract val2% from val1%, as if both were unsigned integers with values from 0 to 65535. Prevents integer overflow for pointer arithmetic on the Series 3c.Note that UADD and USUB should not be used for pointer arithmetic on the Series 5 unless SETFLAGS has been used to enforce the 64K memory limit. In general long integer arithmetic should be used.See also UADD.VALv=VAL(numeric string)Returns the floating-point number corresponding to a numeric string.The string must be a valid number e.g. not 5.6.7 or 196f. Expressions, such as 45.6*3.1, are not allowed. Scientific notation such as 1.3E10, is OK.E.g. VAL(470.0) returns 470See also EVAL.VARv=VAR(list)orv=VAR(array(),element)Returns the variance of a list of numeric items. The list can be either:A list of variables, values and expressions, separated by commas orThe elements of a floating-point array. When operating on an array, the first argument must be the array name followed by (). The second argument, separated from the first by a comma, is the number of array elements you wish to operate on for example m=VAR(arr(),3) would return the variance of elements arr(1), arr(2) and arr(3).This function gives the sample variance, using the formula:where means . To convert to population variance, multiply the result by (n-1)/nVECTORVECTOR i%label1,label2,...,labelNENDVVECTOR i% jumps to label number i% in the list. If i% is 1 this will be the first label, and so on. The list is terminated by the ENDV statement. The list may spread over several lines, with a comma separating labels in any one line but no comma at the end of each line.If i% is not in the range 1 to N, where N is the number of labels, the program continues with the statement after the ENDV statement.See also GOTO.WEEKw%=WEEK(day%,month%,year%)Returns the week number in which the specified day falls, as an integer between 1 and 53.day% must be between 1 and 31, month% between 1 and 12, year% between 0 and 9999 (1900 and 2155 on the Series 3c).Each week is taken to begin on the Start of week day, as specified in the Control Panel on the Series 5 or the Time application on the Series 3c. When a year begins on a different day to the start of the week, it counts as week 1 if there are four or more days before the next week starts.The System setting of the Start of week may be checked from inside OPL by using the LCSTARTOFWEEK&: procedure in the Date OPX. The week number in the year may also be calculated by different rules and also with your own choice of the start of year by using the procedure DTWEEKNOINYEAR&: in Date OPX. See the Using OPXs on the Series 5 for more details.WHILE...ENDWHWHILE expression...ENDWHRepeatedly performs the set of instructions between the WHILE and the ENDWH statement, so long as expression returns logical true non-zero.If expression is not true, the program jumps to the line after the ENDWH statement.Every WHILE must be closed with a matching ENDWH.See also DO...UNTIL.YEARy%=YEARReturns the current year as an integer from the system clock. For example, on 5th May 1997 YEAR returns 1997.Bw9<q %3?B=}%     D]o :56 5 b     ;hG`9- .# 4 + a  5)     E   =?eG@$&3.4B<  / i( Fg  -(l".  ByM6U :: 9, :! 6Q   iC."5C$ 'R++ F   !,;    a # KLgHTY0% > '$)%q 33cQ-/      eL?.3  A"x >   -4 :   <1h0E|B)! #V  -FJ7+#4l (N_D3w \ FOa 0.*/5k/! UD-XB  ;3{   uJ7lKP;] H{74+y !$+^833'c7!5_M39+ 4W     /V   xz <Hz R0   ( "F d 9U)G= T&,0 7 :!L_# #x'   5)Dt-S 9g58 g%7 - n!"UC%9eq(087?xs    t Z{ S`H.\ &-" (!'4YLsT* zyx"cHO:I,AD33Tv+U5 ]\;d'7#==~`NZ[$ = !m]^INLM_SUc /FI==8*  D/< m%j#229   !  T  j% m$8 _  3 PL!, (`%/"%#"%#(xE   =bY94`XY^ "P.=> jSH`FMiXS4$  ]5  Q5L!w   {g&6$ #L3Ce6 ? "   Ik9>\''%(' 8mcH N/ 4 ~5 sS& =B8$p   @4 l   :3:/ yB  0.   /5+K p*D ?:2%'B! !&5mPL e0y:$M#RL    V](%"C 3t=I M+.#" bJ wa^H4  *yI2/GhevR=       M p/@=A!0/  n5<  +,-d7P (Fc > 2D)"./hnH`FM @ $)2B#$Np<.~?(+ 1D)/%R}.m`)*'*25OfR#-$AU* CD)# 8#2& <   [M< D"  s Q28f'75}r = '7G [k T^q3R 3PY!XX `f)r 0#L( += E "+E k= 9 ' 2 4 &?]  @q@jEwy#  6>CE+"2 R z @ G :>NN"  "D`_`:dl .@V $   ",   &        {f ;  2<u,   LTw       "n _6? DE_./83*22@ F# Il8 cNdSQ# y5$!4i :: ^           <D)-  Xc -D) =:   I[3  9 6 6DM:BQiC  >Rf   %E 2D)#<Q Zs$fU2?0d:$Cword.app C#:"$:C 4: