Open programming language
Encyclopedia
The Open Programming Language (OPL) is an embedded
Embedded system
An embedded system is a computer system designed for specific control functions within a larger system. often with real-time computing constraints. It is embedded as part of a complete device often including hardware and mechanical parts. By contrast, a general-purpose computer, such as a personal...

 programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 for portable devices that run the Symbian Operating System, which can be found on e.g. the Nokia
Nokia
Nokia Corporation is a Finnish multinational communications corporation that is headquartered in Keilaniemi, Espoo, a city neighbouring Finland's capital Helsinki...

 9200, 9300
Nokia 9300
The Nokia 9300 is a Nokia Series 80 Symbian Smartphone introduced in 2005. It is used as a normal though bulky mobile phone in closed mode, when it is flipped open it can be used like a very small notebook computer with a 640×200 screen...

 and 9500
Nokia 9500
Nokia 9500 Communicator is a smartphone produced by Nokia, introduced in 2004. It runs on the Symbian-based Series 90 platform, albeit disguised to look like the Series 80 platform....

 Communicator series mobile telephone/personal digital assistant
Personal digital assistant
A personal digital assistant , also known as a palmtop computer, or personal data assistant, is a mobile device that functions as a personal information manager. Current PDAs often have the ability to connect to the Internet...

 (PDA) and the Sony Ericsson
Sony Ericsson
Sony Ericsson Mobile Communications AB is a joint venture established on October 1, 2001 by the Japanese consumer electronics company Sony Corporation and the Swedish telecommunications company Ericsson to manufacture mobile phones....

 P800
Sony Ericsson P800
The Sony Ericsson P800 is a smartphone introduced in 2002 based upon UIQ version 2.0 from Sony Ericsson...

, P900
Sony Ericsson P900
The Sony Ericsson P900 is a Symbian OS v7.0 based smartphone from Sony Ericsson.It was introduced in 2003 and is the successor of the Sony Ericsson P800, and, like the P800 uses the UIQ platform....

, P910
Sony Ericsson P910
The Sony Ericsson P910 is a smartphone by Sony Ericsson introduced in 2004 and the successor of the Sony Ericsson P900. The P910 has a full QWERTY keyboard on the back of the flip The biggest change from the P900 to the P910 is that the P910 now supports Memory Stick PRO Duo and the phone's...

 series. On classic Psion PDAs such as the Series 3
Psion 3
The Psion Series 3 range of personal digital assistants were made by Psion PLC. The four main variants are the Psion Series 3 , the Psion Series 3a , the Psion Series 3c , and the Psion Series 3mx , all sized 165 × 85 × 22 mm...

, 5
Psion 5
The Psion Series 5 was a PDA from Psion. It came in two main variants, the Series 5 and the Series 5mx , the latter having a faster processor, clearer screen, and updated software. There was also a rare Series 5mx Pro, which differed only in having the operating system loaded into RAM and hence...

/5mx, Series 7, and netBook/netPad, as well as the MC218, OPL is part of the standard application suite. OPL is also included in Psion Teklogix industrial handhelds such as the Workabout mx. OPL is an interpreted language
Interpreted language
Interpreted language is a programming language in which programs are 'indirectly' executed by an interpreter program. This can be contrasted with a compiled language which is converted into machine code and then 'directly' executed by the host CPU...

 similar to BASIC
BASIC
BASIC is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use - the name is an acronym from Beginner's All-purpose Symbolic Instruction Code....

. A fully Visual Basic
Visual Basic
Visual Basic is the third-generation event-driven programming language and integrated development environment from Microsoft for its COM programming model...

-compatible language OVAL has been also developed.

The language was originally called Organiser Programming Language developed by Psion Ltd for the Psion Organiser
Psion Organiser
The Psion Organiser was the brand name of a range of pocket computer developed by the British company Psion in the 1980s. The Organiser I and Organiser II had a characteristic hard plastic sliding cover protecting a 6x6 keyboard with letters arranged alphabetically.Early Psions are very robust...

. The first implementation (without graphics) was for the original Psion Organiser (now referred to as the Psion Organiser I, 1984) and came bundled with the Science, Finance and Math datapaks. It became truly accessible as built in software in the Psion Organiser II (1986) and the language went on to be used in the Psion Series 3
Psion 3
The Psion Series 3 range of personal digital assistants were made by Psion PLC. The four main variants are the Psion Series 3 , the Psion Series 3a , the Psion Series 3c , and the Psion Series 3mx , all sized 165 × 85 × 22 mm...

 and later. After Psion retired from the PDA market, the project was changed to open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 and the acronym was re-interpreted. The language is now developed on SourceForge
SourceForge
SourceForge Enterprise Edition is a collaborative revision control and software development management system. It provides a front-end to a range of software development lifecycle services and integrates with a number of free software / open source software applications .While originally itself...

 in the opl-dev project.

To the grievance of the large OPL developer community, the language is not available from Symbian OS v8 and later, mainly due to lack of interest and support from major Symbian licencees Nokia and Sony Ericsson. Hence, OPL will most likely never be made available for the newer generation of Symbian OS phones such as Sony Ericsson P990
Sony Ericsson P990
Sony Ericsson P990 is a smartphone and the successor of Sony Ericsson P910. The phone uses the UIQ 3 software platform, which is based upon Symbian OS 9.1. It was released in August 2006. The P990 has a numeric keypad that flips open to reveal a full QWERTY keyboard below the display, on the phone...

, M600
Sony Ericsson M600
Sony Ericsson M600 is a 3G smartphone based upon the UIQ 3 platform...

, W950
Sony Ericsson W950
The Sony Ericsson W950i is the third UIQ 3 smartphone based on Symbian OS v9.1. It was announced on February 13, 2006, a week after the announcement of the Sony Ericsson M600.- Developing for the W950i :...

, P1i and Nokia E61i
Nokia E61
The Nokia E61 is a smartphone from the Eseries range, a Series 60 Third Edition device with a QWERTY keyboard targeting business users in the European market. As of Q4 2006 Cingular and Rogers Wireless have deployed a similar yet restricted version designated the Nokia E62 in the North American...

 and E90. As of 2010, Nokia device developers are encouraged to use Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 for S60 instead (See Python for S60
Python for S60
The Python for S60 also called PyS60 , is Nokia’s port of the general Python programming language to its S60 software platform, originally based on Python 2.2.2 from 2002....

).

Examples

Here is the console version of a Hello world program
Hello world program
A "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...

:

PROC main:
PRINT "Hello World!"
PAUSE 40
ENDP

(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%=13

PROC hello:
dINIT "Hello"
dTEXT "","Hello World!"
dBUTTONS "OK",KKeyEnter%
DIALOG
ENDP

OPL is a structured programming
Structured programming
Structured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...

 language. OPL programs contain PROCedures, which are much like functions
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

 in other programming languages.
  • The dINIT keyword in this example initializes a dialog box (intuitively enough, all dialog-box related functions begin with a letter 'd'; for clarity, this letter is in lower case, but the language is case independent). The first argument of the dialog is an optional string, which is used for the title of the dialog, displayed in the title bar.
  • The dTEXT function displays text, with two compulsory arguments: a left-aligned 'prompt' string, and a main string.
  • The dBUTTONS keyword allows you to put buttons on the dialog box - here there is a button with the text "OK". The second argument to each button is both the special notation of the shortcut key for that button and the dialog's return code, in this case the "Enter" key.
  • Finally, the DIALOG keyword is required for the previously initialized dialog box to be shown on the screen.

Testing dialog responses

An example:

PROC test:
dINIT "Your Challenge"
dTEXT "","Will your answer to this question be no?"
dBUTTONS "Yes",%y,"No",%n
IF DIALOG=%y
PRINT "No it wasn't!"
ELSE
PRINT "Yes it was!"
ENDIF
GET
ENDP

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.

Variable types

The table below uses an example variable called 'var'.
Data Type Syntax
Floating Point var
Integer var%
Long Integer var&
String var$(length)

Minutiae

OPL interfaced with advanced Psion Series 3 features by means of operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 CALLs, but in the later Psion Series 5mx
Psion 5
The Psion Series 5 was a PDA from Psion. It came in two main variants, the Series 5 and the Series 5mx , the latter having a faster processor, clearer screen, and updated software. There was also a rare Series 5mx Pro, which differed only in having the operating system loaded into RAM and hence...

 this was changed to a so-called 'OPX' library, stored in the system ROM
Read-only memory
Read-only memory is a class of storage medium used in computers and other electronic devices. Data stored in ROM cannot be modified, or can be modified only slowly or with difficulty, so it is mainly used to distribute firmware .In its strictest sense, ROM refers only...

 (the Z drive).

Other OPL features include those with a letter 'g' at the beginning, for graphical functions; those with a letter 'm', for menus; and those with a letter 'd', for dialogs.

External links

  • opl-dev project homepage
  • OPL wiki on Internet Archive
    Internet Archive
    The Internet Archive is a non-profit digital library with the stated mission of "universal access to all knowledge". It offers permanent storage and access to collections of digitized materials, including websites, music, moving images, and nearly 3 million public domain books. The Internet Archive...

     containing documents detailing OPL keywords, OPX interfaces and lots of other information
  • OPL Blog by Symbian, now dead, but old versions are available from the Internet Archive
    Internet Archive
    The Internet Archive is a non-profit digital library with the stated mission of "universal access to all knowledge". It offers permanent storage and access to collections of digitized materials, including websites, music, moving images, and nearly 3 million public domain books. The Internet Archive...

  • Russian site about OPL
  • OPL programming tutorial, newer
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK