March 2004: Volume 13 Number 1

The Internet | Dialog Resource Editor | Powerflex on Linux | Technical Tips | News and Products Update | Current Products

New Business, New Software, New Opportunities

David Bennett – MD Powerflex Corporation – Australia

Business processes the world over are changing rapidly, and will never be the same again. As recently as twenty or thirty years ago, most office procedures were manual, most business records were kept on card files or in filing cabinets, and most communications were by letter or phone.

The Internet changes everything, but not everything has yet changed. Business processes such as taking an order and getting paid used to take weeks. Now they take days or even hours. Soon it will be minutes or seconds.

Once business was only done in an office with a desk. Now the office can be a car, a hotel room, the customer's home, anywhere.

For those running businesses the way they have always been run, life is going to get much harder. If you are a software developer building systems for them, your software and your customer are going to get left behind and your market is going to shrink.

But if you are a software developer building new systems for new ways of doing business, with flexibility and vision, you and your customers are going to have great opportunities that never existed before.

Obviously this kind of software is made possible by the Internet, but two important things have been missing until now: infrastructure and tools.

The first problem is nearly fixed. Most businesses can now get access to an affordable, high-speed, always-on Internet connection.

The second has been the lack of affordable and effective tools to allow ordinary developers to create and maintain rich and complex business applications that take advantage of the Internet. This is the problem we are solving with PFXweb.

With PFXweb any developer can build full-sized, complex, richly interactive forms based business applications that work across the Internet.

Such applications offer a rich user interface, with sophisticated features like those found in typical Windows desktop software, such as tabstrips and listview based lookups.

All of the application code executes on the server, to maximise security and minimise network traffic. All of the rendering logic is done on the client computer, to minimise server load and allow user customisation.

Everything conforms to industry standard protocols and components, with just a standard browser on the client.

Our beta testers are very excited by it, with one describing it as "an amazing product".

If this sounds like exactly what you have been waiting for, contact us here and ask to be included on the PFXweb beta program.

Top of Page

Dialog Resource Editor

Gerard Nolan - Powerflex Corporation – Australia

Developers who are creating Windows applications that have the look and feel of "real" Windows, have found that the Powerflex Dialog Resource Editor (PFXDRE) is a valuable labour-saving tool.

The Dialog Resource Editor has been supplied and installed with the PFXplus development system since the release of Version 4.30. It can be used to modify the behaviour and appearance of Windows dialogs, which are the windows that enable a program or module to accept input from a user.

So, why bother?

The main advantage of using PFXDRE is that it allows you to bypass the creation of RCO and RC files for Windows programs and modules by incorporating resource information in the actual source code for the programs. Any existing Windows applications created using RCO or RC files can be easily recompiled to take advantage of the tools and features available in PFXDRE.

When you write a new PFXplus application, you can use PFXDRE directly to create new dialogs, and then write the supporting code for those dialogs in the accompanying source file. But it is more likely that you will use PFXDRE to edit the dialog images already defined in the source code of your PFXplus programs and modules.

The following code, for example, is taken from the MEMBER.PFX source code.

/S_1
Maintain Members of Club
NO              <____.>
SURNAME         <____________>
GIVEN NAMES     <________________>
DOB             [__/__/____]
SEX             [_]
RATING          <____.>
JOINED          [__/__/____]
MAILCODE        [____]
PLAYED          [___.]
WINNINGS        [_____.__]

By invoking the Windows Resource Maker, MKRES, a source code image can be turned into a Windows dialog resource that can be edited by PFXDRE. This is done by compiling with the /R and /E switches.

PFCN MEMBER /R /E

The /R switch invokes MKRES after a successful compile and the /E switch, which is specific to MKRES, tells MKRES to output the resource file as a RES file that can be edited by PFXDRE.

The resource file

Now that you have a resource (RES) file you can open it in PFXDRE and make any changes.

PFXDRE MEMBER

In this case, the screen heading has been centred and the dialog caption changed.

Saving under PFXDRE creates a DLG file that contains the changes you just made, which will be used when you recompile your application. The program must be recompiled for the changes to take effect.

PFCN MEMBER /R /E

During this recompilation, PFCN inserts a

#TEXT RCDATA.DLG ... #ENDTEXT
section at the end of your program that will contain the resource definitions for the program. This section is built using the DLG file and is the equivalent of the old RC file.

The PR3 resource file for the program is then created using the data contained within the #TEXT ... #ENDTEXT section.

Running the program now will display the new dialog, incorporating any changes.

Conclusion

Once the resource data has been added to your source code, any subsequent compilation of the program that does not require more resource editing within PFXDRE can be done using the /R switch alone. This will process the code in the #TEXT RCDATA.DLG ... #ENDTEXT section to create a PR3 file. In this case, the RES and DLG files are not required and can be deleted. In fact, compiling with the /R switch alone deletes an existing RES file.

If you want to go back to the resource editor after this, you will need to recreate the RES file by compiling again with the /R /E switches.

For more detailed information, including a development cycle for RC files, refer to the Dialog Resource Editor section of the PFXplus Version 5.0 help file.

Top of Page

Powerflex Implementation on Linux

Ian MacPherson – Hansel & Gretel's The Bakehaus


Introduction

Linux is a typical "Unix-style" operating system, i.e. it can be configured to be fast, flexible and reliable. The original source has been written from the ground up for multi-user multi-tasking resource intensive applications and is therefore an ideal platform for database applications like Powerflex.

It differs from commercial Unix's in one important area that should be understood before venturing into it, i.e. Linux is a moving target, constantly being upgraded and developed by volunteers all over the world. As such, documentation is often incomplete and out of date and what would normally be a straightforward task on an "equivalent commercial" system can turn into a voyage of discovery that traverses many a late night (such a project is the subject of this article).

So a word for the unwary, if you are expecting perfect "shrink-wrap software" that works first off every time in every situation, you will be seriously disappointed. But if you are inspired by the challenge of the occasional all-nighter to get that new bit of hardware to work with your own custom kernel, then perhaps Linux is for you.

Character Based Systems Generally

I prefer character based systems over GUI simply because on equivalent hardware, with everything else being equal, they are faster (and hence) more efficient. Most ten finger typists engaged in data-entry report increased productivity when they don't have to pause to operate the mouse. Well-written applications, like the Nexus accounting system, are a good example of character based applications that are easy on the eye, functional and fast in an intensive multi-user multi-tasking character-based environment.

As an engineer, I strongly support and recommend the use of appropriate technology for any given application. Hungry Jacks, for example, run character based counter-top serial terminals in their restaurants. You may also notice their programmable key-tablets supported by custom terminal drivers (this is the power and flexibility Unix style systems offer).

If bottom line payback on implementation is important, the reduced development cost and shorter overall time to project completion also have to be serious considerations. Tailor-made hybrid systems incorporating integration with graphical operating systems can be achieved and is sometimes the only way to get the job done. On a recent project, for example, I was able to integrate ruggedised Palm V field invoicing units and a Linux server via remote modems. The financial payback for this system was staggering, far outweighing the hardware and development cost. (If this interests, please email me). For these and other reasons, character-based systems will be around for a few years yet.

The Linux console

So much for large-scale multi-user systems, but what about a reliable, fast (and later scalable) character-based Powerflex system on a single PC running Linux? Such was the motivation for this project.

For those unfamiliar with Unix terminology, the "console" is the screen and keyboard (plus the supporting software in the kernel) attached to the "server" (i.e. the CPU and supporting hardware plus the other parts of the kernel.) The Linux kernel considers the console as just another (albeit special) terminal attached to the hardware it is running on. Unless logged in as such, a user at the console is just another user and is given no special privileges.

If you are going to operate Powerflex on a single PC running Linux, you have no choice but to work within the confines of the console, so getting it to behave itself is fundamental to setting up an effective development environment.

The problem

When I first started exploring Powerflex, I was intrigued by one feature more than any other, i.e. the image section. After years of laying out screens using cryptic framing commands (i.e. Progress 4GL) this concept of "painting the screen" was truly a blessing. At last it was possible to just write out the screen the way you wanted it to look (not to mention the ease of a later change).

That seemed like a great idea until I tried to draw a line or a box on my Linux console and found a whole bunch of weird looking letters and symbols!

On my old DOS systems (or even DOS under Windows) line and box drawing was easily achieved using the Alt <ASCII code> to produce graphics characters from the IBM 437 Code Page character set. As long as you only ever want to use one of 256 characters (the maximum available with 8-bits) everything worked out ok.
That's because PC hardware and DOS are both based on standardised 8 bit character representations and everything between the keyboard and the screen talk the same "language". It is possible to load other code pages but you can only ever use one character set at a time and any change requires a re-boot. The system just assumes you are only going to operate the system in one language/graphics set environment at any one time.

Linux does not make such assumptions. Being an internationally developed system it is designed to support 32-bit Unicode character definitions, which are much more versatile than the old 8-bit character representations of the past. The long-term implications of Unicode are mind-boggling but in the whole scheme of things, hardly surprising. Unicode is the result of a concerted effort to bring about the seamless computerised integration of every written language on the planet. With a 32 bit character set it is possible to have a unique definition for every known letter (known as a "glyph") for every written language on earth.

Powerflex for Linux as shipped gets around this problem of character translation by use of tCharMap statements in the pfx.ini file. Once outside the Powerflex environment however your system will revert straight back to the Latin-1 characters. Since Powerflex does not ship with its own editor there is no way to create and edit text files incorporating line and box graphics which display correctly. So if you want to develop an attractive character based application on the Linux console you need an environment which will enable you to correctly select and display the extended ASCII graphics which will then appear accurately when compiled and run under Powerflex.

Preliminaries

The prototype for this project was a stock ASUS PIII mainboard with a Trident 3D 9750 AGP video card. The operating system was Linux Red Hat 7.2 kernel version 2.4.7-10(enterprise) compiled on install for standard VGA support. Similar hardware and other distributions of Linux should give equivalent results to those described below. The tools used here are working at a very low level in the kernel and unless you are using something pretty non-standard on the console your hardware should default to the IBM cp437 character set.

NB. You must do all of the following from the command line at the console, not from within X or any other GUI environment, nor from a networked or serial terminal.

As a first test you should check what default font has been loaded on startup. Assuming you have enabled boot logging you can find this in the boot message log (on my system this is in /var/log/messages which tells me that the lat0-sun16 (Latin-1) font has been loaded). If you are quick you may catch the boot message as it is loaded during startup.

You should now check the display style of the font from the command line using the commands:

Ctl - l    	(to clear the screen)
showcfont    (show current font) 

The showcfont command dumps the currently loaded font from the lowest level of the kernel console driver directly to the screen in a convenient hex table. Look at the lines 0xb0 to 0xd0. If you have a 437 code page table handy (I knew that old dos book would be good for something) then you can compare them and see the difference. It is pretty close to the 850 Latin-1 table but not close enough for what we are trying to do. What we want is to get rid of those capital A's and Y's amongst the line drawing characters in the upper ASCII range.

While the table of characters is on the screen watch the characters as you key the following command which loads the default font:

consolechars  -d 

I have yet to find a way to reverse this action without re-booting. If anyone figures this out, please email me.

You should have just seen the characters on the screen change from 850 representation to 437 giving all the single and double line and box drawing characters in the original IBM character set. So far so good but nothing is ever that simple! Whilst the characters at the command line may now appear correct that is only because the command shell is an application running its own console and keyboard drivers. To get the same result from within an editor environment you have to now tell the kernel what characters to use when running applications called from within the shell (incidentally I use "bash" or the Bourne Again Shell, I have no idea what will happen with other command interpreters.)

(The consolechars command comes as part of the console-tools-0.3.3 package, which supersedes the earlier kbd package. To find whether or not you have it available type the following at the command line:

locate consolechars 

If the package has been installed then it should report /usr/bin/consolechars or similar. If not you will have to install the package or re-install your operating system selecting this rpm as an option. If you need assistance with this step, please email me.

Application character map

Once the default system font is displaying in 437 mode you can then load an "application character map" which can be found in /lib/kbd/consoletrans as a gzipped file called cp437.acm.gz. To load this file proceed as follows:

This file will be loaded into memory and used to translate every call from the application to the console driver to display a character. In other words whenever you type a character from within an application (like an editor) it will display according to this character map. If you are interested in how this step is performed you can open and look at the cp437.acm file as it is just in text format. It is even possible to create, edit and load your own glyphs and character maps for custom applications. This is how the Linux hackers worldwide have created systems which run in over 100 languages including very complex letter representations like the Thai alphabet. (All I wanted to do was draw a box!)

Testing

If everything has gone well so far, you can test the system by opening the Joe editor from the command line (assuming you have it installed) and typing the characters from the extended character set. In Joe these are called "meta" characters and are accessed by preceding each with Ctrl-backslash.

For example typing a Ctrl-\ then a capital D produces a single horizontal line, Ctrl-\ Z produces a top left single line corner, etc. Some experimentation is necessary to find the characters you wish to use. If you have one handy an old DOS book with the full cp437 code set will be very useful. The lower and upper ASCII characters have a one to one relationship, just add 128 to the code of the lower to get its equivalent upper character. Depending on how your code tables are laid out you should be able to devise a paper template for easily looking up the character you need to press to get the graphic character you want.

Once you have produced a box, line, etc. and saved the file, open the pfx.ini file and comment out all the tCharMap statements and the

iSelectCharMap=4 

line as well. Now start Powerflex and display the test file on screen using the Program Development Menu. All the characters should display exactly as they appeared in the Joe editor. That's all there is to it. You can now create any sort of source file using the full extended characters and once compiled and run they will display properly at the console.

Just remember to do the following each time you start the system before running Powerflex (or add appropriate lines to your start-up scripts):

showcfont
consolechars -d
consolechars -v -m  /<somewhere convenient>/cp437.acm 

In the end I was surprised that the solution was this easy, but that is typical of Linux, you spend many hours searching for clues and in the process learn a whole lot more than you expected.

Further reading

There is very little written about the console tools. An exhaustive Internet search produced only one document at http://lct.sourceforge.net/lct/x120.htm, which was out of date and mostly refers to earlier kernel versions. If you find anything later, please email me.

If you are interested in Unicode, there are some very good documents on it and the Unicode consortium runs its own web site at http://www.unicode.org. There is also a man page for Unicode you can access using man Unicode. Follow the clues from there.

The consolechars man page is good but very cryptic. The best place to find more information is in the source package of the console-tools package. The source also has extensive commenting but much of it relates to how the tools actually work and is pretty low level stuff.

As far as I can make out the developers of the console-tools gave up on the project back in 2000 before it was fully implemented, and so it still has some minor bugs and the documentation got the short straw. My tests so far have proven that it works well enough to solve the problem with character display. If you are really keen you can put the console-tools package back on the active development list and see if it gets any interest but I have more pressing problems to solve. If you need assistance with any of the above, please email me on ianmacp@bigpond.com

Top of Page

Technical Tips


Technical Tip No 43

Powerflex Corporation – Australia

Ever wondered how to put custom tracing messages to your PFXplus program so that they will appear in the same log file as the standard PFX tracing?
1. Simply insert the following code into your program:

#replace TRACECHANNEL 19
#ifdef TRACE append_output channel TRACECHANNEL "TRACE:"
#endif
#command TRWRITE
#ifdef TRACE write channel TRACECHANNEL !1 !2 !3 !4 !5 !6 !7 !8 !9
#endif
#endcommand
#command TRWRITELN
#ifdef TRACE writeln channel TRACECHANNEL !1 !2 !3 !4 !5 !6 !7 !8 !9
#endif
#endcommand 

Now write your own meaningful messages that will be written into the pfxtrace.log


TRWRITELN "***About to open non-existing file:"
open "xyz" as member 

2. Compile the program

PFCN /spfx.ini program_name /dTrace

3. And run with the relevant configuration item in the runtime section of your pfx.ini

[PFL ] iTraceFlushLevel=1

Top of Page

Technical Tip No 44

Powerflex Corporation – Australia

Do you know how to get the full path-name of a file residing in a current directory?

STRING s fil
GET_CWD TO s
SHOWLN "current directory:" s
DIRECTORY "filename.dat" to fil
SHOWLN "full path with filename:" ;
          (s + "\" + fil)
INKEY 

Top of Page

Powerflex News and Product Update

This year promises to be a very exciting year for Powerflex with the long awaited release of PFXplus for the Web and ongoing development of existing products. The major highlights are detailed below.

New staff

Since the last issue of POWERlines we have been joined by Yu Qing Zhu in new product development. Yu Qing has been busy working on PFXplus for the Web and we welcome him to the team

PFXplus for the Web update

Development is continuing on our innovative new internet product PFXplus for the Web. The latest beta version has just been released to an increasing number of testers. Feedback on the software has been very positive so far with many of the beta testers keen to get their hands on the final production version. We expect to release the production version sometime during the first quarter of 2004. If you are interested in becoming a beta tester for PFXplus for the Web, just contact us by phone (+61 3 9888 5833) or email (pfxsales@pfxcorp.com).

Service Pack 2 for Version 5.0

Service Pack 2 for Windows 32 bit is now available. This Service Pack contains minor fixes and enhancements to PFXplus (Developer and End User Runtimes), PFXcrystal, PFX C- lib, and PFXbrowse version 5.0. Service Pack 2 for Powerflex version 5.0 products with SQL support has also been released. For details on how to download these service packs email us at pfxsales@pfxcorp.com. These service packs replace all previous service packs and require that a licenced copy of any of the above products is installed.

Keep up to Date

Join our online mailing list and receive regular updates about Powerflex product upgrades and new product releases and other significant news. We will also be offering regular specials on our products to those who join our POWERflash mailing list. All you have to do is send your details to powerflash@pfxcorp.com.

Top of Page

Current Versions of Powerflex Release Software

PFXplus Developer's Kit 16/32-bit 4.23
PFXplus Developer's Kit 32-bit/SQL 5.0
PFXplus Runtimes 2.63 to 5.0
PFXplus Unixware 5.0
Service pack 1 for Unixware 7 5.0
Service pack 2 for Unixware 7.1.3 5.0
PFXplus Open Unix 5.0
PFXplus AIX incl. SP1 5.0
Service pack 2 for AIX 5.0
PFXplus SCO 5.0
PFXplus Linux 5.0
PFX C-lib MSDOS—DOS-386 4.20
PFX C-lib for Windows 5.0
PFX C-lib for Windows with MS SQL 5.0
PFX C-lib for SCO Unix/Linux 4.41
PFXsort for DOS-386, Win32/SQL 5.0
PFXsort for Unixware 5.0
PFXsort SCO Unix/Linux 4.41
PFXbrowse 32-bit SQL Developer/User 5.0
PFXbrowse 32-bit Developer/User 5.0
PFXbrowse Linux 4.41
PFXbrowse SCO Unix 2.10
PFXodbc 32-bit for Windows 5.0
PFXcrystal 32-bit for Windows 5.0
Service pack 2 for Windows 32 bit 5.0
PFXplus (Developer and Runtime),
PFXcrystal, PFXC-lib and PFXodbc
Service pack 2(SQL) for Windows 32 bit 5.0
PFXplus (Developer and Runtime) and PFXC-lib
PFXplus HTML Help 5.0

Top of Page