This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages) (Learn how and when to remove this message)
|
| Open Programming Language (OPL) | |
|---|---|
| Paradigms | imperative,structured,embedded |
| Family | BASIC |
| Designed by | Colly Myers, Richard Harrison, Martin Stamp |
| Developers | Psion Ltd opl-dev project |
| First appeared | 1984; 42 years ago (1984) |
| Stable release | 1.56 / 17 June 2006; 19 years ago (2006-06-17) |
| Typing discipline | Static,strong |
| Scope | Lexical |
| OS | EPOC,Symbian OS,Psion Organiser |
| License | GNU Lesser Public License[1] |
| Website | opl-dev |
Open Programming Language (OPL) is aprogramming language forembedded systems andmobile devices that run theoperating systemsEPOC andSymbian. It was released by the British companyPsion in 1984.
Originally designed for use on their classicPsion PDAs such as theSeries 3,5/5mx,Series 7, andnetBook–netPad, and the Psion producedMC218, OPL was provided as part of the standard application suite. It can also be installed on theNokia 9200,9300 and9500 Communicator seriesmobile telephone andpersonal digital assistant (PDA) and theSony EricssonP800,P900,P910 series. OPL is also included in Psion Teklogix industrial handhelds such as the Workabout mx, and it also appeared in the lesser known Oregon 'Osaris' organiser, a broadly compatible EPOC32 device that uniquely used version 4 of the OS. OPL is aninterpreted language similar toBASIC. A fullyVisual Basic-compatible language OVAL has also been developed.
The language was originally namedOrganiser Programming Language, developed byPsion Ltd for thePsion Organiser. Designed by Colly Myers with the first iteration implemented by Richard Harrison and Martin Stamp. The first implementation (without graphics) was for the original Psion Organiser (now referred to as the Psion Organiser I, 1984), and it came bundled with the Science, Finance and Mathdata packs. It became truly accessible as built-in software in thePsion Organiser II (1986), and the language went on to be used in thePsion Series 3 and later. After Psion retired from thepersonal digital assistant market, a project aiming to bring OPL to Symbian came to fruition, when the fledgling Symbian Developer Program released it asopen-source software. The language is now available onSourceForge in a project namedopl-dev.
The language is currently unavailable for Symbian OS v8 and later. With the subsequent retirement of the Symbian OS, it seems unlikely OPL will be made available for later generations of Symbian devices. As of 2010, Nokia device developers were encouraged to usePython for S60 instead (SeePython for S60).[citation needed]
Here is the console version of a"Hello, World!" program:
PROC main: PRINT "Hello World!" PAUSE 40ENDP
(Source code taken from the PCDevPrimer in the OPL Wiki.)
And here is a GUI version for Nokia's Series 80 user interface:
CONST KKeyEnter%=13PROC hello: dINIT "Hello" dTEXT "","Hello World!" dBUTTONS "OK",KKeyEnter% DIALOGENDP
OPL is astructured programming language. OPL programs contain PROCedures, which are much like functions (subroutines) in other programming languages.
An example:
PROCtest:dINIT"Your Challenge"dTEXT"","Will your answer to this question be no?"dBUTTONS"Yes",%y,"No",%nIFDIALOG=%yPRINT"No it wasn't!"ELSEPRINT"Yes it was!"ENDIFGETENDP
In this cruel interrogative program, the Yes button is assigned the shortcut of Ctrl+y, while No has Ctrl+n, represented by %y and %n respectively. The user's input from the DIALOG is tested in the IF statement, PRINTing appropriate responses to the screen. Note that the 'GET' keyword, which gets user input without using a dialog box, is here used simply to wait for a keypress before terminating the program (otherwise it would end immediately without giving time for the user to read the text). The output from DIALOG can also be stored in a variable.
Variables specific to a procedure must be declared with the LOCAL keyword; global variables are defined with the GLOBAL keyword.
The table below uses an example variable namedvar.
| Data type | Syntax |
|---|---|
| Floating point | var |
| Integer | var% |
| Long integer | var& |
| String | var$(length) |
OPL interfaced with advanced Psion Series 3 features by means ofoperating system CALLs, but in the laterPsion Series 5mx this was changed to a so-calledOPXlibrary, stored in the systemread-only memory (ROM), termed the Z drive. 'OPX' libraries were also made available for theNokia 9210,Nokia 9300 andNokia 9500 Communicators, adding OPXs routines for handling Short Message Service (SMS) and managingBluetooth communication.
Other OPL features include those starting with a letter:g for graphical functions,m for menus, andd for dialogs.