Current Cover (3068 bytes)
Current Cover

Navigation Bar (3057 bytes)
Homepage (723 bytes)


Pen Computing Magazine Masthead (5407 bytes)

Psion PSection

OPL: What every user should know


By Mark Esposito
June 1998, issue 22

This month there are some great new software products available for the Psion Series 5 and Geofox-One. You’ll find reviews for two commercial products that I thought you should know about. Keep an eye on the shareware sightings too. I thought that it was about time we looked at OPL, which comes in every Psion and Geofox computer.

OPL: What’s it all about?
Every EPOC32 based computer to date includes Psion’s built-in programming language called OPL (organizer programming language). To Psion’s credit, all of their computers have included OPL, even though Psion doesn’t use the language itself to develop the software in the ROM. Why, you might ask? There are a few reasons that I know of, being an OPL programmer myself. First, and probably most importantly, OPL is an interpreted language, which means that it doesn’t get compiled into a self running executable program. Instead, it gets translated into what Psion calls Qcode. This Qcode is run by the OPL runtime application, which is itself written in assembly language and C++. This makes an OPL program slightly slower than a program written in the language that Psion programs in, C++, although not slow enough for the end user to notice in most cases. Of course I am assuming that things are done correctly. Bad programs can be written in any language. If you are familiar with Visual Basic runtime libraries, like VBRUN300.DLL, it is a similar concept.

If you are not interested in programming issues, don’t worry; there is more here than meets the eye. It is still amazing to me that Psion users have the ability to write professional applications directly on the Psion itself. I know this to be true, because I wrote Pelican Software’s first commercial application (Banker) for the Psion Series 3 directly on the Psion. Many shareware programmers today are writing small to large programs on their Psion. Since they do this on the side, it is ideal that the language is built into the machine. I always got a blast from telling people that I was compiling some software in my pocket while we were having lunch. After all, how many platforms could boast this kind of portability even for its programmers? I now use a text editor in WinNT and the Psion emulator, but it is still OPL.

There is a tendency these days to think that nothing good can be done without C or C++, and many times it is people that know nothing about programming that I hear saying things like this. What users need to know is that the program does what they need it to do, and not what language a program was written in. What future palmtop programmers need to know is that programming in OPL in essence gives you access to a ROM full of tools written in C++. You get access to these tools, but in a much easier language to write in. OPL has opened the door for a huge number of all kinds of shareware and commercial programs that would never have been written. As I have mentioned before, there are a number of programs out there that began as shareware. My own Notepad Deluxe, written in OPL, sold as shareware for three years before I released it as a commercial application in the US, UK, and Germany. People use OPL for the exact same reason they use Visual Basic. It is an easier programming language to learn, and it offers easier access to the user interface tools (menus, dialogs, scrollbars, etc.)

Much of the shareware out there is done in OPL. I bring this to PCM reader’s attentions to say that it is worth your while to keep your eyes open for software that is available from many online sources, some at a low price, and some for free. The Psion community has a huge online presence. My former sysop job at CompuServe, to start with, has a very active forum called the Psion forum (Go Psion). The Usenet newsgroups have at least eight different news/discussion groups dedicated to Psion, comp.sys.psion.misc being the largest. Finally, Ron Luks, the original founder of the Psion forum on CompuServe, is now managing the palmtop forum on Computing Central, sponsored by Microsoft. I take care of the Psion area on this forum, so come and visit me when you get time. This is a free forum like the Usenet groups, and can be accessed at http://computingcentral.msn.com/forums/palmtop.

Let’s write a program!
Lastly, I thought that some of you might like to try your luck at writing your own program on the Psion. So, I have written a small application that you can type in and run. The applet will calculate the tip when you eat out. From the Extras bar, choose the item called Program. It says OPL in its icon. The program editor opens with the lines PROC: and ENDP. Erase these so that you have a blank page, and type in the program as listed below. When you are done, choose Translate from the menu. A dialog will come up that says Translating…, and if you typed it in correctly, you will be asked if you want to run the program. If you get errors then you’ll need to go over it again to make sure that it has been entered correctly. Go ahead and run it to try it out. The resulting program if you want to use it in the future will be called program.opo. This can be named to something more appropriate.

PROC Tips:
LOCAL m%,result%,perc&,amount
perc&=15 REM Initial default tip of 15%
top::
MINIT
MCard "Edit","Figure Tip",%t,"Close",%e
m%=MENU
IF m%=0 or m%=%e
return
else
DINIT "Food and Beverage Tip Calculator"
DFLOAT amount,"Total Amount",0,1000000
DLONG perc&,"Percentage",0,100
result%=DIALOG
IF result%
DINIT "The Tip should be..."
DTEXT "Amount",fix$(amount,2,12)
DTEXT "Tip at "+fix$(perc&,0,3)+"%",fix$(amount*(perc&*.01),2,12)
DIALOG
GOTO top
ENDIF
ENDIF
ENDP

Mark Esposito can be reached via e-mail at mesposito@pencomputing.com.


[Homepage]
[Features] [Showcase] [Developer] [Members] [Subscribe] [Resources] [Contacts] [Guidelines]

All contents ©1995-2000 Pen Computing Magazine, Inc. All rights reserved.
Unauthorized reproduction in any form is strictly prohibited.
Contact the Pen Computing Publishing Office for reprint information
.