John.Wiley.and.Sons.Rapid.Mobile.Enterprise.Development.for.Symbian.OS.An.Introduction.to.OPL.Application.Design.and.Programming.May.2005.eBook-LinG (779881), страница 2
Текст из файла (страница 2)
OPL was based on BASIC, but tailored forthe Psion Organizer II. Users were able to write simple programs evenif they didn’t have the in-depth knowledge that Assembler programming required.OPL was originally designed as a database language to access or createdatabases shared with the Psion Organizer II’s built-in Data application,but it has evolved with each new hardware device, always aimingto maintain good backward compatibility with previous versions. Thishelped developers to port existing OPL applications to a new device withthe minimum of effort, while at the same time giving OPL applicationsthe ability to have the same look and feel as the built-in applications. Akey requirement for OPL was to make it possible to develop applicationsfully on the device itself.The power of OPL has arisen from its extensibility.
OPL has supportedlanguage extensions from the beginning, via 6301 Assembler procedureson the Psion Organizer II, and now via C++ OPX procedures on phonesrunning Symbian OS.On the Psion Organizer II, the OPL Runtime was written in 6301Assembler. The main functionality included loops, conditionals, onedimensional menus, database keywords, error handling, arithmetic operators, mathematical functions, language extensions written in Assembler,and procedure files in a flat filing system. At this time, most of theapplications were written for the corporate environment.In the late 1980s, Psion launched the MC series of (laptop sized)devices. OPL was ported over to the 8086 CPU and had broadly thesame functionality as the Organizer – without menus, but with dynamically loadable modules, keywords to call OS services, and input/outputkeywords (both synchronous and asynchronous forms).The Psion HC was again built around the 8086 chip, but made greateruse of graphical elements.
In addition to the keywords added for theMC series, there were graphics keywords, the ability to call proceduresby indirection, the concept of OPL applications that looked like built-inapplications, event handling (for handling messages from the operatingsystem such as switch files, close, etc.), and command line support.ABOUT THIS BOOKxiiiThe Psion Series 3 (with the advent of the ‘SIBO’ operating system)was released in 1991, and along with it came the first OPL SoftwareDevelopment Kit (SDK), giving many utilities and macros for nearlyfull access to the SIBO operating system services.
Series 3 OPL addedmenus, dialogs, and the expression evaluator (used by the Calculatorapplication).When the Psion Series 3a came out a few years later, OPL was againupgraded and remained almost unchanged for the rest of the SIBO range(Psion Series 3a, 3c, 3mx, Siena, and the Workabout range). It addedallocator keywords, a cache with least recently used procedures flushedwhen necessary (for up to seven times speed improvement), and digitalsound support.In 1997, OPL was ported to C++ for Symbian OS, adding pen eventhandling, cascaded menus, popup menus, language extensions (usingOPXs), constants, and header files. Other enhancements included toolbarsupport and extremely powerful access to the new Symbian OS DBMSdatabase implementation.
The first Symbian OS OPL SDK was releasedshortly afterwards, allowing developers to develop OPL applications ona PC with the addition of a number of tools.Symbian OS v5 in 1999 added improved color support and filerecognition thanks to MIME support, amongst many other minor improvements.When Symbian OS v6 debuted, powering the Nokia 9210 Communicator, the OPL Runtime was no longer included in the ROM of themachine, and it appeared that OPL would not be part of the Smartphone revolution. Luckily, OPL appeared as a downloadable componenton the Symbian website, so OPL authors could move onto the newplatforms.OPL is now available over three major Symbian OS platforms, theCommunicator range (sometimes called Series 80), Series 60, and UIQ.
Ithas become an Open Source project, which means anyone can downloadthe code that is used to create the runtime, the tools, and the developerenvironment. It is also free to use, there are no licensing costs involvedto use OPL – it is truly a totally free development option.Who is This Book For?If you’ve programmed, at any level and in any language, then you’ll findthis book is an excellent primer for the OPL language, and you should beable to understand OPL in under a week. You should be able to start atChapter 3, which details the tools and utilities available for OPL.This book is primarily aimed at non-professional programmers, the ITManager in a company that needs an application for their staff, the ‘poweruser’ who wants to do more with his phone, and anyone interested instarting programming Symbian OS phones, but wary of spending monthslearning the ins and outs of Symbian OS C++.xivABOUT THIS BOOKHow the Book is StructuredPart 1• Chapter 1: Programming PrinciplesHere we look at how a computer is made up, the parts of a computerand what they do, how programming languages work, and some ofthe core structures of the OPL language.• Chapter 2: Introducing the Tools of OPLHere we install the relevant SDKs, and point out the tools that areprovided, and those you need to download to help you get startedin OPL.• Chapter 3: Event CoreEvent Core will be your first full program for OPL – in this chapter welook at the design and coding process in great detail, explaining atevery step of the way what we are doing and why it is important.
Ifyou’re new to programming, this will probably be the hardest chapterto comprehend, as it steps through every stage of OPL development.Once you understand this chapter, programming in OPL should be aneasy experience.• Chapter 4: A Conversion Program: Event Core in PracticeEvent Core is a building block for the rest of your OPL programs,but how do you expand Event Core into a new program? Here wetake the core and build a real-life program; a conversion program formeasurements, weights, and lengths.• Chapter 5: Using Graphics in an Othello GameWhile it is possible to create a program using just menus and dialogboxes, you will want to be able to display graphics for many applications, respond to pen taps on the screen, and present a ‘nice’ userinterface on screen. By writing an Othello program, we cover all theseareas, and take a brief look at how Computer Artificial Intelligence(‘A.I.’) works, and how to apply this to your own games programming.• Chapter 6: Database and a Notepad ProgramThe final example program in the book looks at using databases tostore information for your program, so it is available whenever yourun your program.• Chapter 7: Publishing your OPL ApplicationIn this chapter, we look at how to go about putting your programs onthe Internet, and offer some advice if you decide to try and sell yourprograms online, including what you should do and where you cango to achieve this.ABOUT THIS BOOKxv• Chapter 8: Creating Applications and InstallersWhile developing these first programs, the files have been moved byhand onto the phone.
This is not something you can ask an end-userto do when releasing your programs. This chapter looks at making anOPL program into a full Symbian OS application, and using SymbianOS SIS files to allow for easy installation.• Chapter 9: Where Now For OPL?Finally we see what OPL can do in the real world, by looking at threeOPL authors and what they’ve achieved. Al Richey, Steve Litchfield,and Malcolm Bryant all have well-respected OPL applications thatthey have released on the Internet.Part 2Part 2 contains all the reference material for OPL that you will need asyou program in OPL.• Command ListingAn alphabetical list of all the standard OPL commands, their syntax,and how to use them.
Includes code examples where appropriate.• Const.oph ListingThe library of constants (names that replace long numbers or stringsto help make your code easier to read – these are explained in detaillater) is listed in its entirety.Author BiographyEwan Spence studied Computing and Artificial Intelligence at EdinburghUniversity before discovering his first Psion PDA. Since then he hasactively followed the development of mobile computing technology,and become one of the leading authorities on the OPL language ofSymbian OS.He has produced software in OPL since 1994, including the everpopular and addictive ‘Vexed’ game for Symbian OS mobile phones.Since providing support for and fostering a vibrant Open Source andFreeware community for programmers through the FreEPOC SoftwareHouse, Ewan has continued to help the wider Symbian communitythrough the All About Symbian family of websites.
He strongly believesthat programming computers should be something that is easy, accessible,and simple to understand for every user. It shouldn’t require a universitydegree and months of studying.He currently lives in Edinburgh with his wife, Vikki, his two daughters,Eilidh and Mairi, and Crow, the puppet.Author AcknowledgmentsA huge amount of thanks have to go to Rick Andrews and Phil Spencer forkeeping OPL alive. More thanks go to Ian Weston, Phil Northam, EdwardKay, David Mery, Colin Turfus, Martin de Jode, Lars Persson, and PeterWikström for believing in OPL, and suggesting that an ‘Introduction’ bookwould be ‘‘a rather good idea’’.Thanks should also be directed to Rafe Blandford, Jim Hughes, Russell Beattie, Matt Croydon, Monty, Mobibot, Robin Talboom, JordanHolt, Andy Langdon, Hayden Smith, Craig Setera, Matthew Langham,Frank Koehntopp, and everyone else involved in All About Symbian andMobitopia who’ve had to put up with my promotion of OPL (and myspelling) for several years.Steve Litchfield, Al Richey, Jon Read, Martin Harnevie, Andy Harsent,Martin Dehler, Domi Hugo, as well as Malcolm Bryant, Adrian Pemsel,Martin Guthrie, and all the other guys at FreEPOC must be mentionedfor not only being better programmers than me, but for letting me look attheir source code and learn from it.And a series of special mentions go to.
. . Rael Dornfest, for providinga shot in the arm that showed me OPL was actually going somewhere.Jerry Sadowitz, for being the second greatest card magician alive. SuwCharman and Jeannie Cool, just for being around. Kenton Douglas,for an inordinate amount of time off work. Danny O’Brien and DaveGreen, because they get thanked in everything and I don’t want to breakthe chain. Janne Jalkanen, for the Go lesson and the subsequent alphaapplication in OPL.