home *** CD-ROM | disk | FTP | other *** search
-
-
- Blib II User Guide © Ian Palmer, 1992
- -------------------
-
-
- Introduction
- ------------
-
- The Blib application is an application designed to allow simple management
- of Basic libraries, allowing the user all the advantages of the Basic
- Library system, but with fewer of the disadvantages.
-
- Blib also comes with a set of libraries which are described in detail in
- other files within the 'Docs' directory.
-
- What Blib offers the user is a sort of Basic linker, which takes a Basic
- program and a set of libraries, and produces a single Basic program which
- contains the initial program plus all the library routines needed by that
- program (but not any library routines not required).
-
-
- Starting up
- -----------
-
- When you run Blib II it will install itself on the iconbar. There may be a
- slight pause before it appears on the iconbar, this is quite normal and is
- just Blib II initialising itself, and setting up all it's data structures.
-
-
- The main menu
- -------------
-
- The main menu contains four entries, the usual 'Info' and 'Quit' options, as
- well as an 'Install' entry and a 'Help' submenu. These two entries are
- explained in detail later on.
-
-
- Installing Libraries
- --------------------
-
- So that the Blib linker can locate procedures and functions you need to
- install all the libraries. Before a library can be installed it needs to be
- formatted as described later on.
-
- Once a library is correctly formatted, you first need to check that the
- install option on the main menu is selected (ticked), and then you need to
- simply drag the library to Blib II's icon. The library file will then be
- scanned, and the library will be installed.
-
-
- Removing libraries
- ------------------
-
- Once you have installed a library BlibII remembers the contents of that
- library until you install it again, where it removes all it knows about that
- library then installs it again. But what if you want to remove a library
- for good?
-
- The answer is to place BlibII into 'Install' mode and then bring up the main
- menu, and locate the library you wish to remove on the 'Help' submenu. Then
- select that menu option whilst holding down 'Ctrl'. BlibII will then remove
- that library from it's lists.
-
- Note: To avoid accidental removal, this can only be performed while in
- 'Install' mode.
-
-
- Viewing 'Help' entries
- ----------------------
-
- Blib libraries contain a facility for allowing descriptions of the
- procedures and functions to be read quickly, and easily. The 'Help' entry in
- the main menu leads to a list of all known libraries (listed in alphabetical
- order), each entry leading to a further submenu which contains a list of all
- the library entries known to Blib.
-
- Selecting any library entry will bring up a window which contains the
- description of that library entry (usually a procedure or function).
-
- BlibII also supports the StrongEdII help mechanism (at least at version 1.20
- of StrongEdII). Thus pressing F1 inside StrongEdII when the cursor is over
- a procedure or function known by BlibII, it will bring up a help window for
- that function.
-
-
- Performing Linking
- ------------------
-
- Before linking can take place, you need to check that all the required
- libraries are installed, and are located in directories pointed to be the
- BlibII$Path variable.
-
- Then to link a Basic program, first checking the 'Install' option of the
- main menu is NOT selected, simply drag the file to Blib II's iconbar icon. A
- standard 'Save' window will then appear and you should then drag the save
- icon to where you wish to store the linked program. Note if you try to make
- the destination file the same as the source file, BlibII will first rename
- the source file 'BlibImage' (overwriting any file with this name).
-
- Once you have dragged the save icon (or typed in the save path) linking will
- take place. Once linking is complete a window will appear giving details of
- the linking that was just taken place.
-
- This window contains a list of all procedures and functions in the linked
- program, split into three areas :
-
- 1) Called & Defined routines
-
- This section contains a list of all routines (procedures and functions)
- which are both called and defined in the linked program. Those in red
- are the ones which were extracted from libraries during the linking
- process.
-
- 2) Defined routines which are not called
-
- This section lists routines which are defined, but not called. In a
- finished program there should be no entries in this section, as anything
- listed here is redundant code.
-
- 3) Routines which are still undefined
-
- This section lists all routines which are called but not defined. As with
- the above section a finished program should contain no entries in this
- section.
-
-
- Blib libraries
- --------------
-
- Blib libraries are basically Basic libraries with extra bits. These extra
- bits will not interfere with the libraries functionality, and Blib libraries
- can also be used as normal Basic libraries.
-
- All extra Blib 'commands' are placed on lines of their own, and start with
- the two characters '*|'. This sequence was chosen as it will not interfere
- with the Basic library, and it also is independent of Basic's own REMark
- system.
-
- Blib II commands are :
-
- *|start <Routine>
- *|stop <Routine>
- *|extract <Routine>
- *|! <string>
- *|define <Blib-variable>
- *|undefine <Blib-variable>
- *|ifdef <Blib-variable>
- *|ifndef <Blib-variable>
- *|else
- *|endif
- *|update
- *|downdate
- *|copy
-
- These commands are also valid inside the program which is being linked,
- although in some cases the effect is slightly different.
-
-
- Routines :
-
- Every routine (procedure or function) in a library which is to be considered
- as an exportable routine (ie. called from outside the library) must be
- contained between a '*|start' and '*|stop' combination.
-
- You can fake a call to a routine by using the '*|extract' command. This will
- ensure that a routine is linked, even if there are no actual calls to it.
-
- Descriptions of routines should be placed on lines starting with the '*|!'
- command, and must be between the '*|start' and '*|stop' for that routine.
-
-
- Blib-variables :
-
- Blib-variables are available to give more power to Blib linking. When ever a
- routine is encountered by Blib (either a call to it, or the definiton of it)
- a Blib-variable is defined with it's name (including the PROC of FN part).
-
- The user can define further variables at will using the '*|define' command,
- and also undefine variables with the '*|undefine' command.
-
- These variables can then be used with the '*|ifdef' and '*|ifndef' commands
- to perform 'conditional linking'. These commands (used with '*|else' and
- '*|endif') form Blib 'conditional' blocks of Basic. A '*|ifdef' block is
- TRUE if the variable placed after the command is defined, and the '*|ifndef'
- is TRUE if the variable is not defined. These conditional blocks are handled
- as follows :
-
- 1) In the Basic program being linked, the whole input program is copied to
- the output file regardless of '*|ifdef' and '*|ifndef' commands. However
- lines are only 'scanned' if within a TRUE block.
-
- 2) In a Blib library only the parts of a routine within a TRUE block are
- copied to the output file.
-
- This means that you could write very complex routines where only relevant
- parts are linked. An example of this is used in the WIMP library in
- PROCwimp_poll. This procedure has the ability to call specific event
- procedures upon most standard poll reasons (eg. idle, redraw, message,
- etc.). However not all programs need to respond to all poll reasons, and
- thus only the parts needed by your program are linked in by Blib
- automatically.
-
- As an example here is a portion of the main CASE statement in PROCwimp_poll
- which shows conditional linking :
-
- *|ifdef PROCevent_idle
- WHEN 0 : PROCevent_idle(I%)
- *|endif
-
- This means that if you have defined a procedure for handling idle polling
- events (as PROCevent_idle) then that line will be linked, otherwise that
- line will not be linked into your program.
-
- Now imagine your program development follows a path similar to :
-
- 1) You start your program which has a call to PROCwimp_poll, but there
- is no PROCevent_idle defined.
-
- 2) You link your program using Blib - thus PROCwimp_poll is linked in
- without any reference to PROCevent_idle.
-
- 3) You now create a definition for PROCevent_idle in your program...
-
- This will cause a problem as PROCwimp_poll will not be able to call your
- PROCevent_idle. To get around this there is a special set of commands that
- can define an 'update' block. An update block is a block of code in a main
- program (the unlinked program) which is NOT copied to the destination program
- (the linked program). This is done by including the block between two lines :
-
- *|update
- *|downdate
-
- As this block will not be copied, it will be relinked during the linking
- process. Now the only problem is getting the *|update and *|downdate commands
- into your program, as commands are not normally copied from library to linked
- program. To get around this there is a special command called '*|copy' which
- makes the linker copy the next line to the linked program no matter what that
- line is, eg.
-
- *|copy
- *|update
-
- will copy the '*|update' line to the output program.
-
- Some care needs to be taken when using update blocks. An update block should be
- defined over a complete body of a BlibII routine, ie. an update block should
- be placed directly after a '*|start' (excepting the description part can be
- before the update) and the corresponding 'downdate' should be directly before
- the corresponding '*|stop'.
-
-
-