Open Programming Language

Open Programming Language
Open Programming Language (OPL)
Paradigm(s) imperative, structured, embedded
Appeared in 1984
Designed by Psion Ltd
Developer opl-dev project
Stable release 1.56 / June 17, 2006; 5 years ago (2006-06-17) (June 17, 2006; 5 years ago (2006-06-17))
OS Symbian OS, Psion Organiser
Website opl-dev.sourceforge.net

The Open Programming Language (OPL) is an embedded programming language for portable devices that run the Symbian Operating System, which can be found on e.g. the Nokia 9200, 9300 and 9500 Communicator series mobile telephone/personal digital assistant (PDA) and the Sony Ericsson P800, P900, P910 series. On classic Psion PDAs such as the Series 3, 5/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 similar to BASIC. A fully Visual Basic-compatible language OVAL has been also developed.

The language was originally called Organiser Programming Language developed by Psion Ltd for the Psion Organiser. 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 and later. After Psion retired from the PDA market, the project was changed to open source and the acronym was re-interpreted. The language is now developed on SourceForge 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, M600, W950, P1i and Nokia E61i and E90. As of 2010, Nokia device developers are encouraged to use Python for S60 instead (See Python for S60).

Contents

Examples

Here is the console version of a Hello world program:

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 language. OPL programs contain PROCedures, which are much like functions 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 CALLs, but in the later Psion Series 5mx this was changed to a so-called 'OPX' library, stored in the system ROM (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.

See also

External links


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Open (programming language) — The Open Programming Language (OPL) is an embedded programming language for portable devices that run the Symbian Operating System, which can be found on e.g. the Nokia 9200, 9300 and 9500 Communicator series mobile telephone/PDA and the Sony… …   Wikipedia

  • Open Programming Language — Die Open Programming Language (OPL, früher Organiser Programming Language) ist eine Programmiersprache für das Betriebssystem Symbian OS, wie es auf dem Nokia Communicator und anderen Mobiltelefonen zu finden ist. Die Sprache wurde ursprünglich… …   Deutsch Wikipedia

  • Programming language — lists Alphabetical Categorical Chronological Generational 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… …   Wikipedia

  • Organiser Programming Language — Die Open Programming Language (OPL, früher Organiser Programming Language) ist eine Programmiersprache für das Betriebssystem Symbian OS, wie es auf dem Nokia Communicator und anderen Mobiltelefonen zu finden ist. Die Sprache wurde ursprünglich… …   Deutsch Wikipedia

  • Programming language specification — A programming language specification is an artifact that defines a programming language so that users and implementors can agree on what programs in that language mean.A programming language specification can take several forms, including the… …   Wikipedia

  • Eiffel (programming language) — Infobox programming language name = Eiffel paradigm = object oriented year = 1986 designer = Bertrand Meyer developer = Bertrand Meyer Eiffel Software latest release version = 4.2 latest release date = Feb 6, 1998 typing = static typing, strong… …   Wikipedia

  • D (programming language) — For other programming languages named D, see D (disambiguation)#Computing. D programming language Paradigm(s) multi paradigm: imperative, object oriented, functional, meta Appeared in 1999 (1999) Designed by …   Wikipedia

  • Erlang (programming language) — Erlang Paradigm(s) multi paradigm: concurrent, functional Appeared in 1986 Designed by Ericsson …   Wikipedia

  • C (programming language) — C The C Programming Language[1] (aka K R ) is the seminal book on C …   Wikipedia

  • Haskell (programming language) — Haskell Paradigm(s) functional, lazy/non strict, modular Appeared in 1990 Designed by Simon Peyton Jones, Lennart Aug …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”