Superbase 3.02 - Application Generator v1.0 INTRODUCTION During my economics study, I had to learn how to use dBase III+. During those lessons the teacher proudly showed the application generator for dBase. Although dBase is a ridiculous package, compared to Superbase, at that time I did not have an application generator for Superbase! Having the application generator in mind, I remembered packages like PowerWindows for the Amiga, and I decided to write an application generator for Superbase. At the time I started developing this program, I used an Amiga 500, an 20MB A590, one and a half megabytes of memory, and a 1084s. Not really a setup for using huge systems like SBpro4. That is why I decided to use Superbase III, even while I had Superbase 4. By now I bought an A500+ with enough harddisk space and memory to run SBpro4. Still, I have that 1084s, and I just cannot see the cursor in SBpro4's editor! So, still SBpro3. As usual with PD software like this, if I find out that people actually use my program, I'll try to make a version for Superbase IV. Enjoy! -Ivo TO CONTACT use E-Mail or: Ivo Kroone Drieboomlaan 223 1624 BH Hoorn The Netherlands (Europe) phone: HOLLAND-02290-10170 FILES INCLUDED WITH APPLIGEN: It is advised to have the AppliGen in the working directory of Superbase. Superbase III has still got major problems switching directories, so it is best to put all files in the same directory. AppliGen uses: AppliGen.sbp ; The program AppliGen.sbv ; AppliGen's form-file AppliGen.doc ; This text file UserMenus.sbd; The structure-file of your future data-file UserMenus.131; The index of your future data-file UserMenus.sbf; Your future data-file besides these file you'll need Superbase III. I used version 3.02, so I'm sure that one will not show any problems (not even using Kick 2.04). At the moment you start Superbase, it will search for a file called "Start.sbp", if found it will be loaded and started. So, renaming "AppliGen.sbp" to "Start.sbp" will auto-start the program. Otherwise AppliGen should be started by selecting "run" from the "program"-menu (the right most). AppliGen will load the other files it needs by itself. On starting AppliGen, you will first be confronted with a title-bar telling you to wait for a while. On an A3000 this 'while' is so short that one cannot even read it. On a standard Amiga it should take about a second and a half for the system to initialize (building menu's, reading some data for internal use). When no application is loaded, most menus will be ghosted. The first thing you should do I create a new application, or open one. When the main-menu is present, you can select an item, or you can edit your user-menus. Just by clicking in the screen, the cursor will pop-up in the upper left corner, and you can start editing. Use the [STOP] button in the VCR panel below to stop editing ([CTRL] + [C] will have the same effect). On editing the following key-combinations can be used: [Shift] + [arrow-key], all the way LEFT or RIGHT [CTRL] + [X], clear the current field [return], next field [CTRL] + [return], return to the previous field The field above the horizontal line, are the names of your menus. You have five menus available, each menu can hold up to 12 items (the limit of 12 items is Superbase's limit, the 5 menus are my limit). Next to every item, you can enter a single character to be used as an Amiga-key short-cut. This character will be printed in upper case italics. The name of the menu will be printed in a bold type face. If you are out of space for the menu-name, the field will scroll so you can edit more text. Each item can hold up to 23 characters (Superbase's limit). New application This option clears all user-menus, so you can start defining your own menu- structure. The system will ask for a project-name first. This is the name the system will use to SAVE the project, also this name will be stated in the REMarks in your source code. As I used the program for some try-outs, I found out that part of the structure is frequently the same. Every good program has a "Project" menu on the left with options like "Save", "Save as", "Open", etc. This is why AppliGen will ask you "Pre-enter a standard-menu?". This will add the standard menus, like Commodore suggests in the official "Amiga Intuition Reference Manual". Although that's a KickStart 1.2 book, the global structure should still be the same as in 2.04. For your information, the standard menu looks like: Project New N Open O Save S Save as Print Print as Quit Q Edit Undo U Cut X Copy C Paste P Erase E Not all Amiga-key short cuts are official, some have been copied from TxEd and CygnusEd. After you've entered the project name, and perhaps included the standard menus, AppliGen will return to the main menu. Now you can select another menu-item, or alter the menus (by simply clicking in the edit window, and type your text). Open user menus Saved menus are all stored in just one Superbase file (UserMenus.sbf). With the open function one can load a menu-structure in memory. In an attempt to be smart, the load-option automatically loads the only existing structure-file if there's only one available. So it is likely that you won't see a request asking you to pick a menu, if there's only one possibility. Write user menus To store your menus on disk. If you managed, somehow, not to enter a project name, you will be prompted to enter one. The version-number of the project will be increased by one, and the date will be replaced by the current date. Delete user menus To remove a user-menu. The standard pick-a-menu request will pop-up, allowing you to select a menu. The usual "Are you sure?"-alike request will ask for a confirmation. If confirmed the menu will be deleted. Although the "Reorganize" option will really delete the data (according to the Superbase manual), as far as I know it is not possible within Superbase to recover a record, so be careful! Info on user menus This shows some information on the current user-menu. On second thought this option really came in handy on writing AppliGen (so I could check if indexes, files and other peripherals were really attached). The information screen looks like this (pressing any key, or the left mouse-button will return to the main menu): Project : ProjectName, version version Date : Date Author : Author (if present:) Form : Form file-name.sbv Keys : F-Key file-name.sbk Query : SB-Query file-name.sbq "No menu-reader will be added" or "Menu-reader will be added" "Credits will not be added" or "Credits will be added" "No error-handler will be added" or "Error-handler will be added" Files and indexes to be opened: (note that up to ten files and indexes can be opened, and will be mentioned here, sequentially) FILE: filename.sbf, INDEX: field-name of the index Subroutines to be included: (up to ten sub-routines) filename of the subroutine (plain ASCII file) Save appli SBpro3 The main event. This creates a source file for Superbase III. Depending on all kinds of preferences, this will include sub-routines, REMarks, etc. To speed up creating (and to make writing of the create-routine a lot easier) your user-menus will first be checked. The syntax-checked does the following (ANY error will result in a message telling what's the matter. No further creating will be done): 1. Stores your application on disk. Sorry if you think this makes things less comfortable. But creating a temporary backup would've made thing needlessly complicated. 2. Checks if menu-name 1 and menu-item 1 have some contents. If not it assumes you did not make any menus. 3. Checks the Amiga-key short cuts. A key should appear once. One short-cut for more than one item would not make any sense (although Superbase and Intuition accept it both). Thanks to Raymond for helping me getting a smart a FAST way of checking this! 4. Checks for the existence of all included sub-routines. 5. Checks for the existence of all included .sbf and .sbd files. If your application is valid you will be asked for a file-name. AppliGen will append ".sbp" to the filename, if necessary. During the creation some text might be stripped from spaces, as program labels and such thing may not contain spaces. The application will now actually be build. AppliGen does the following, considering all possible includes have been selected (if not, some will not appear in your source) (Boolean like ON/OFF statements will be mentioned with ON/OFF): 1. REM ProjectName, version 0.version REM Date : ProjectDate REM Author: Author (if allowed) 2. ON ERROR GOTO ErrorHandler 3. Start: SET HEADING "Initializing, please wait ..." 4. SET BUFFERS Buffers BREAK ON/OFF DEBUG ON/OFF SET EDIT ON/OFF SET PAGING ON/OFF PANEL ON/OFF 5. OPEN FILE "SBpro-file" 0 to 9, INDEX "SBpro-index" 0 to 9 6. OPEN FORM "FileName" LOAD KEY "FileName" LOAD QUERY "FileName" 7. MENU CLEAR 8. MENU X,0,1,MenuName-X MENU X,Y,Z,MenuItem-X-Y (note that an item with three leading "-"s will be ghosted (the ugly Kick 2.04 "~"s have not been adapted yet) 9. SET HEADING "ProjectName CurrentYear by Author" 10. REM Menu reader (uses a% for menu, b% for item) MainMenu: MENU ON a%,b%:WAIT MENU IF a%=1 t/m 5 THEN ON b% GOTO MenuName 1 t/m 12 11. (creation of program labels, each label consists of the name of the corresponding menu plus the number of the item. Ghosted items will not get a label or REMark) 12. REM *** menu + item-number *** (with each label) 13. SET HEADING Item (with each label) 14. ErrorHandler: REM Error handler IF ERRNO = 11 THEN GOTO MainMenu CLS :DISPLAY BF ON "An error has occurred:" DISPLAY :DISPLAY "Error #"; LTRIM$ ( STR$ ( ERRNO ,"999.")); ? " (that is: "ERR$ ( ERRNO )) WAIT KEY OR MOUSE :RUN 15. REM ***************************************************************** REM *** THE SUBROUTINES *** REM ***************************************************************** 16. (include zero to ten subroutines) On syntax checking the application has been stored, so exiting is permitted. Eagerly awaiting the creation, I included an option to run the application at once. In that case AppliGen will close all files, input/output channels and its form. The menu title will be re-controlled by Superbase, and the application will be started. Save appli SBpro4 Currently disabled. No need to fool-around until it isn't ghosted anymore, it's always disabled, in AppliGen 1.0. About ... Shows a little request, informing you about my Internet address (which is a very unreliable site, I regard it as a send-only account). Quit Returns to AmigaDOS. First pops-up a required "Are you sure?" request. Show application ASCII Much like generating an SBpro3 source for real. The major difference is the fact the all output is redirected to the screen. In this way you can see what an AppliGen generated source looks like (also very handy while writing the package). Clear all user menus "Are you sure?", if so all user-menus will be blanked. The author's name and the project name will remain the same. Show Intuition menus Shows the user-menus as real Intuition menus. Should come in handy, to see what your work really looks like. Just like the routine which creates the source, a leading triple "-" will be ghosted. Note that rendering the menus takes a while (that is: on a standard A500+). To wake you up, a request appears telling you the work has been done. This is an auto self-removing request, so even if the "OK" gadget has not been used, it will vanish in about 3 seconds. Selecting any item, will instruct AppliGen to return to the main-menu. Capitalize menu-items Your average useless chit-chat menu-bar filing option. To capitalize all menu- names and items, in the stupid (one of the few stupid things about Superbase) Superbase way. This routine uses the FCASE$ option, meaning that only the first character will be upper-case, all others will be lower-case (even if they were upper-case before). There's no "Are you sure?"-request, so proceed with caution! Check application This performs a syntax check, the same as in "Create application for Superbase III" and "View application as ASCII text". Might be useful to check your work. This option will also draw a conclusion, it will inform you if the application is valid, or not. Open SBpro 3.02 file "3.02" shouldn't really be that precise, just as long as it is a file accepted by Superbase III. AppliGen allows you to open up to ten files (just a limit I thought that would be enough, no limit of Superbase for that matter). As this version of AppliGen uses SBpro III, the files must all be in the same directory. AppliGen will check for reoccurrences of the file you tried to open, if found the selected file will not be included again. As Superbase III uses at least one index per file, it was possible to include an index selection with the OPEN FILE selection. After selecting a file, thing file will be opened, and you will be asked to pick an index. This will be the file's default index in your application. Open dBase III+ file Yet another ghosted item. Who wants to use dBase anyway? It's great SBpro has the possibility to use dBase files, but who wants to? dBase is a real MS/dos like package; developed by some all-I-know-is-IBM suckers who kept on improving the package without thinking about the real world. Just forget it, or to put it less friendly "dBase sucks!". Open form / keys / query All alike. You can include one form, key and query per application. AppliGen will present a request containing all forms/keys/queries in the current directory. Select one, and it will be included. Add menu-reader This is a toggle menu. Perhaps a standard Intuition check-mark would've been better. This will decide to include a small DML routine which read the menu. It's MY reader, Precision software's own menu-reader (from the examples disk) is different. Add credits Lets you decide wether to include credits in the source, or not. Credits could look like this: REM MusicDatabase, version 0.3 REM Date : March 3, 1992 REM Author: Ivo Kroone the CREDIT is the author's name. Add error-handler Includes a standard error handler, or not. The error-handler returns to the main-menu on error 11 ([STOP] from the VCR panel, or [CTRL] + [C]). Otherwise the number and description of the error will be displayed. After pressing a mouse button, or any key, the program will be started again (RUN). Subroutines add / delete Subroutines must be plain ASCII files. In case one forgot, an DML source can be saved as ASCII using 'SAVE "filename",TEXT'. Up to ten subroutines can be included in the application. AppliGen will check for duplicate routines, and remove one of both. A subroutine can be included by picking a file from the request. AppliGen does not check, anywhere, if the file is really an ASCII file. SBpro however, might crash on running the application if a subroutine is a binary. Deleting a subroutine requires some disk activity. Anyone using a diskdrive, has been warned! A request will show, containing the names of all included subroutines. A selected routine (double-click or click-[OK]) will be deleted at once, no warning! Preferences A bunch of toggle menus, using check-marks. Please use the SBpro manual to find out the meaning of each command (if unknown). The "SET BUFFERS" is not a toggle menu. The "Enter number of cache buffers to use:" wishes a number between 1 and 99. The default buffer is 99.