Q L H A C K E R ' S J O U R N A L =========================================== Supporting All QL Programmers =========================================== #33 October The QL Hacker's Journal (QHJ) is published by Tim Swenson as a service to the QL Community. The QHJ is freely distributable. Past issues are available on disk, via e-mail, or via the Anon-FTP server, garbo.uwasa.fi. The QHJ is always on the look out for article submissions. QL Hacker's Journal c/o Tim Swenson 2455 Medallion Dr. Union City, CA 94587 swensont@lanset.com swensont@geocities.com http://www.geocities.com/SiliconValley/Pines/5865/index.html Editor's Forumn I don't know if I'm old enough to claim that old age is to blame for why I'm not able to get as many QHJ issues out in a year as I would like. Maybe I can blame my other distractions, such as family, house, work, and my other hobbies. I've also been a little distracted with the Q40 and Q40/Linux. So, here I sit not doing any coding on the Q40, but just thinking about coding. This issue is mostly on things to help code, but no actual code. As I putter around the house, fixing this and working on that, I keep thinking to myself; "I'll get a chance to work on that program tomorrow." Then tomorrow comes and there is more distractions. Ahh, Well..... Turbo and TurboPE In the May/June 2000 issue of QL Today, George Gwilt mentions that he has updated Turbo to work under SMSQ/E. He also mentions creating TurboPE, a Pointer Environment interface for Turbo. He does not go into any details nor give any code examples, so I can't say how easy TurboPE will be to use over other PE tools (QPTR, EasyPTR, and Qmenu). He does not even mention if these existing tools will work with Turbo. Given that Turbo will be freeware, I'm making a fair guess that TurboPE will also be freeware. As useful as QPTR, EasyPTR, and esp. Qmenu are, they are all commercial programs. It is possible to write freeware applications with these tools, but distributing a fully working program is limited. Qmenu may not be distributed with a freeware application, EasyPTR routines may be compiled into an application, but permission must be granted for each application, and QPTR does not mention if it can be compiled into an application. Granted the PE can not be freely distributed so any freeware PE programs must assume the user already has the PE, only Qmenu is distributed with other programs. So having a freeware SuperBasic compiler with a freeware toolkit for accessing the PE will give the QL programmer a little more freedom in what he can write and distribute. I look forward to the release of both Turbo and TurboPE. Recent Commercial to Freeware Released Recently a number of commercial programming tools have been released as freeware. They are ProWesS, DJToolKit, MasterBasic, and the TurboToolkit. Of the four packages, ProWesS is the biggest and most surprising to be released as freeware. It is a major piece of work, fairly complicated, and gives a lot a capability to the user (and programmer). Let me take a minute and give a quick description of ProWesS. I'll start with something most of you would already know about, the Pointer Environment. The PE is composed of two parts, the Pointer Interface (ptr_gen) and the Window Manager (wman). The PI takes care of the mouse and the WM takes care of the screen displays. The look of the PE is based upon the Window Manager (wman). ProWesS is another Window Manager for QDOS. It is used to create a whole different look for applications and provides some features (such as scalable fonts) not found in the PE Window Manager. Another way of looking at this is to view Windows 3.11 and Windows 95 as two different Window Managers. A program written for Win 3.11 will run under Win95, but it will have the look of a Win95 program. For users of Q40/Linux, they are finding out that Linux has quite a number of different Window Managers available. Unlike most Window Managers, PE and ProWesS programs can be run at the same time and be displayed on the same screen. For the programmer, what ProWesS gives is another way to create pointer driven programs. If programming for the PE is a little beyond a programmer, they might find programming for ProWesS a little easier. Plus, the various additional features that ProWesS has over the PE gives the programmer additional capabilities for the application. The DJToolKit (DJTK) is a collection of SuperBasic extensions written by Norman Dunbar. I bought DJTK a few years back and have found it useful in my programming. It contains 44 new keywords, which are broken down into 4 main areas: File handling, Font handing, Screen handling, and Heap handling. The distribution comes with the complete documentation, giving enough information to get started. I'd recommend that all SuperBasic programmers give this toolkit a look. You might just find THE extension that makes your programming easier. TurboToolKit (TTK) has been updated to fix a number of bugs and to have it work with newer versions of QDOS and SMSQ/E. Like the DJTK, TTK is a collection of extension for SuperBasic. I have never used Turbo or the TTK so I don't know any specifics about the extensions. Some of the extensions are document in the text files that come with the distribution, but they look to cover those parts of TTK that have been updated. Like DJTK, now that TTK is freeware, it's worth a look to see what it has. Maybe better documentation will be released with Turbo is released. MasterBasic by Davide Santachiara (and released by Ergon Development) is a SuperBasic tool for assisting in the creation and debugging of SuperBasic programs. This program has recently been released as freeware and is available on the Ergon Development web page ............. I must admit that I bought this program a few years ago, but have not really gotten around to trying it out. MasterBasic is a collection of routines and programs with a graphical front end. It is designed to work on a program in memory (ie. a LISTable program). It can do things like searching for a string in the program, quickly find and edit Procedures and Functions, quickly finding a variable, and so on. It also comes with some accessory utilities like a calculator, notepad, and job management tool. I guess the reason I have never tried MasterBasic is that I prefer to write SuperBasic in an editor (like MicroEmacs, ED, etc) and then LOAD and test it. With an editor I can quickly jump around putting in bits of code as I think of them. I can easily put more verbose comments in the code. Add white space for easy reading. I don't plan my code to be syntactically correct when I write it. My first draft is very similar to a rough pencil sketch. Once I've done the mental dump to the editor, I can then flesh out the code and make sure it's good SuperBasic. LibXmenu LibXmenu is a C68 library, written by Jerome Grimbert, to help write menu-based programs. When I first heard of it I was thinking that it was a library that converted X-windows routines to PE routines, but this is not what it does. Jerome described Xmenu as a collection of C routines that he wrote to assist him in writing PE programs. He found himself doing the same routines, so he just created some fairly generic routines that could easily be used from one program to the next. Looking at the routines available, it looks a lot like Qmenu for C68. Jerome did tell me that this was not his intention. A quick rundown of the routines are: Item_Select() - Choose from a list of items. Item_Select_Array() - Same as above, but using an array. Message_Report() - Display some text. String_Edit() - Get a string from the user (with edit). XDialog() - Display sprite and text. Menu_Button_Text() - Text for the Button. Menu_Button_Logo() - Use a sprite in a Button. List_Select() - Choose 1 or more from a list. List_Select_Array() - Same as above, but using an array. Check_Size() - Find size of window. Get_CharSize - Find size of characters. DefaultColourSet() - Change color set to default. DisplayXSize() - Maximum X value of current display. DisplayYSize() - Maximum Y value of current display. SetWindowColour() - Set color of the window. SetInfoColour() - Change color of the info window. These routines can be used in both Mode 4 and Mode 8. On Jeromes' web page he has a page describing libXmenu with example screen shoots showing the results of some of the commands. I'm not much of a C68 programmer (heck, I hardly have enough time to program in SuperBasic), but if I was to start, I would start playing around with libXmenu to see how easy it is to write a menu-based program. RECENT UPGRADES TO MICROEMACS MicroEmacs is becoming my favorite editor, esp. now that I have a Q40. As MicroEmacs becomes more powerful, it needs some more horsepower to run quickly. On the Q40, speed is not an issue at all. There are some new features to MicroEmacs that impact the programmer. They are: - Support for Client-Server Manager (CSM) - Syntax Highlighting - Support for CTAGS CSM is an easy way for one program to control another. The Server program handles requests from the clients, and passes back to the client an acknowledgement of the request or some data. When I first encountered CSM I was not too sure how it could be used. It was created to provide scripting for QEM. The scripts are written in SuperBasic, sending commands to QEM via CSM. Now MicroEmacs has CSM support, allowing SuperBasic programs to send MicroEmacs commands to the editor. This opens up a number of possibilities for having other program interact with MicroEmacs. How I am thinking about using the MicroEmacs-CSM link is in Structured SuperBasic (SSB). SSB is just a simple filter that converts SSB code to SuperBasic. If SSB encounters a syntax error, it just reports it and exits. With a link to MicroEmacs, SSB could connect to MicroEmacs via CSM, move the cursor to the exact line with the error, then SuperBasic can exit. The user would switch to MicroEmacs and be at the problem line, ready to edit it. This would move SSB and MicroEmacs closer to an Integrated Development Environment. Here is an Structured SuperBasic example of how easy something like this would be: ## Make sure MicroEmacs is running as a server IF FINDSERVER("emacs") THEN ## Connect to MicroEmacs CLIENT "emacs" ## Add line count to goto-line command command$ = "goto-line "&var ## Send a request to MicroEmacs REQUEST "emacs",command$,return$ IF return$ = "KO" THEN ## There was an error END IF END IF Syntax Highlighting is a way for MicroEmacs to show the syntactical elements of a program by showing the different words in different colors and italics. Syntax Highlighting supports C (_c and _h files), SuperBasic (_bas, _sbas, _ssb files), and assembler (_asm, _s, _cmd, and _rc files). I've only used Syntax Highlighting with Structured SuperBasic and it does make the code a little clearer. Comment lines (##) are shown in white and italics. There is a slight problem here as SSB defines comment lines as any line starting with ##, excluding any spaces in front of the ## (this allows for indented comments). MicroEmacs only supports lines that begin with ## in column 1. SuperBasic control commands (DEFine, FOR, TO, NEXT, RETURN, IF, THEN, ELSE, etc.) are shown in white. The SuperBasic short cuts (such as DEF for DEFine) are not supported. The case of the words are ignored. DEFine, DEFINE, and define are all understood to be the same. The rest of the code is shown in the normal green. The color used to highlight the different elements can be changes by using 4 different MicroEmacs variables. So, if you prefer comments to be in red, you can do that. Ctags come from Unix and were originally created for the Unix editor, vi. A tag file is created by using the program ctag. The editor then reads this file to understand the tags. Ctags is designed to be used on a collection of source files in a directory. The tag file is sort of like an index file showing what procedures are defined and used in what source files. Ctags is not very useful with source code residing only one file. MicroEmacs understands how to read a tag file and can be used to navigate through the source code files, by moving to a procedure and executing the 'tag-word' command. Moving forward is accomplished with the 're-tag-word' command and moving back is done with the 'back-from-tag-word' command. Ctags understands C, C++, Eifiel, Java, Fortran, and SuperBasic. This means that MicroEmacs also supports these languages with tag files.