From: ijp@doc.ic.ac.uk (Ian Palmer)
Newsgroups: comp.sys.acorn
Subject: BlibII
Date: 27 Jan 1993 10:54:05 -0000
Organization: Department of Computing, Imperial College, University of London, UK.
NNTP-Posting-Host: oak46.doc.ic.ac.uk

I've just sent something to Albert at the Newcastle server which
probably needs a bit of explanation. I hope that it will grow into
something very useful, hopefully with the help of others. I guess it
will become available there in a few days.

It is basically in two parts, a Basic linker and a Basic library,
descriptions follow :

BlibII - The Linker - allows you to 'link' Basic programs with
libraries of procedures and functions. This has several advantages :
  
   1) A single Basic file can be compressed using Basic compression
      programs which reduce procedure names, etc.

   2) A single Basic file can be passed to Basic compilers.

   3) I suppose it must be a bit faster.

   4) BlibII only extracts the procedures/functions that are needed,
      thus you don't need to have lots of extra bits that a program
      doesn't need.

The linker works from special library files, which are basically
normal library files (Basic programs) with extra bits. These extra
bits define the start and end of a procedure block (your going to say
this isn't necessary arn't you), allows a description to be included
with the procedures, but which is not extracted with it, and also
allows conditional extraction (in similar way to #ifdef, etc. in C).

When the linker is installed on the iconbar it also traps help
messaged from StongEdII (v1.20) and will provide (in a window) the
descriptions for procedures (or fuinctions) at will. You can also get
access to these help descriptions directly from BlibII (using menus).


Right, that's the first part, now the library (the bit I'd like to see
grow). At the moment the supplied library contains quite a collection
of routines to provide the following :

  -  Dynamic memory allocation (similar to malloc, free, realloc, etc.
     in C). This library can work either on top of Basic's own DIM
     allocation (ie. allocating between LOMEM and HIMEM), or (more
     usefully) by extending the WimpSlot as required. With the latter
     method the WimpSlot will also reduce in size as memory becomes
     available again. This library isn't as fast as using, say,
     OS_HEAP, but I haven't worked out a way of getting OS_HEAP to
     allow reduction in WimpSlot size.

  -  Menu construction. Two methods supplied, on where you build up
     an array and say 'make it', the other where you build up entries
     one at a time. Full support for sub-menus, sub-windows, greying
     out, ticking, etc.

  -  Template file support. Allows reading of one, or more, template
     files into memory, getting pointers to definitions and also
     making copies of definitions. The only think not supported as
     yet (due to a slight lack of documentation, blame Acorn) is
     fonts.

  -  Windows. I have defined my own window structure which allows
     windows to have a 'type' and also data associated with it.
     This allows, for example, a redraw window event handler to
     say 'this is a window of type X, pass it to procedure X which
     then redraws it using it's local data'. There is currently
     only one defined window type (other than plain) which is a
     'Simple Text Window' (or STW) which allows basically text
     in a window (with colours). The STW library contains all
     you need to add text and redraw the windows (it doesn't use
     icons to store the text), but building the text is a bit of
     a bind at the moment.

  -  Events. Limited support for POLL events supplied (basically
     default open and close window and task quit. However there is
     a generic Wimp_Poll procedure which performs a wimp poll and then
     calls a different procedure for each reason (event). This
     generic routines uses the BlibII conditional extraction method
     which means that the contents of the Wimp_Poll procedure depend
     upon what handlers you supply (ie. code to call PROCevent_redraw
     is only placied in the linked version if you have defined a
     PROCevent_redraw), etc.

  -  Icons. Limited support so far, basically selecting, deselecting,
     deselecting a group, finding which in a group selected, etc.
     Now creating or deleting as yet.

  -  General OS stuff like, find the size of the current screen, etc.

As I say, I'd like to see this library grow into something really
good, a sort of Basic equivalent of DeskLib. But this will only happen
if other people contribute. Thus I would be happy for anyone to take a
look at what's there and add to, possibly totally re-write bits, etc.
(I don't give any warranty for what's supplied, something might not
even work, but I've tested most of it (the memory allocation has been
very heavily tested and currently has no known bugs or problems)).

So if you have any Basic library routines you think would fit in with
the above, and would like them to be freely usable by anyone, send
them to me and I'll try to coordinate a really useful Basic Library.

Ian

-- 
                            E-mail : ijp@doc.ic.ac.uk
 ___           __       Snail mail : Department of Computing, Huxley Building,
  /  _   _    /_/ _   / _ _   _  _   Imperial College, 180 Queens Gate,
_/_ (_|_| )  /   (_|_(_| ) )_|/_)    London. SW7 2BZ. England.
Xref: sparky comp.sys.acorn:10526 comp.sys.acorn.tech:1406