home *** CD-ROM | disk | FTP | other *** search
- The HASWIN window library.
- ===========================
- Copyright H.A. Shaw 1990.
- ===========================
-
- Initialising the HASWIN Library system.
- ----------------------------------------
-
- In order to start the HASWIN library system certain routines must
- be called at the begining of a user program. There is a routine for each
- of the main parts of the HASWIN system. These initialisation routines
- MUST be called BEFORE any of the facilities of their part of HASWIN are used.
- HASWIN routines check that they have been initialised before use.
-
- int haswin_initialise(char *name, int flags, int memory)
- - This routine starts up the HASWIN library and registers the user
- program as a task under the WIMP called "name". The routine
- loads the sprites and templates used by HASWIN and starts the error
- handler and memorymanager by calling their initialisation routines.
- Under normal conditions haswin_initialise() is all that is required
- to get a program running sucessfully under the WIMP.
- - "flags" is the logical OR of the following #defined constants:
- HASWIN_FLAGS_FASTPOLL
- - Normally haswin_poll() delays by a fixed time
- before returning a "Nothing" reason code.
- If this flag is set the haswin_poll() does not
- delay. This makes response inside Poll loops
- faster, but uses more CPU time.
- HASWIN_FLAGS_HELPFUL
- - Respond automatically to HelpRequest messages from
- external programs (usually "!Help"). If set HASWIN
- will send the "helpmsg" string for the requested
- window or icon as a reply. If clear the message is
- passed to the user poll routine.
- HASWIN_FLAGS_PROFILE
- - Produce profiling information. Not implemented in
- this release.
- HASWIN_FLAGS_ONEPROG
- - If set check the full pathname of the user program
- and prevent the Filer from launching further copies
- of the program. The user "autoload" routine is run
- instead. Not implemented in this release.
- HASWIN_FLAGS_SETSLOT
- - If set respond to SetSlot messages by automatically
- altering the application memory slot size while
- running. HASWINs memory allocator will correctly
- reduce the slot size until it reaches a point
- where data would be corrupted.
- HASWIN_FLAGS_SINGLE
- - If set do not multitask, but take over the entire
- CPU. Not implemented in this release.
- HASWIN_FLAGS_VERBOSE
- - If set display internal error messages from within
- HASWIN. These include unknown mouse operations
- and failures to find templates, sprites, windows or
- icons in internal tables.
- - If "memory" is non zero then the slot size is altered to the size
- given (must be greater than the slot used to start the program in)
- If the "HASWIN_FLAGS_SETSLOT" flag is set HASWIN will not allow
- SetSlot messages to reduce the slot size below "memory". The
- memory space from the top of the slot used to start the program in
- to the limit "memory" is given to the user heap as its initial
- working space (though this may be altered later).
- - After calling haswin_initialise() a user program may access the
- following parts of the HASWIN system.
- - Windows, Icons, Menus, Pointers, Carets.
- - Window templates.
- - HASWIN, WIMP or system Sprites. (but not any user sprite areas)
- - The main Polling routine haswin_poll().
- - Returns HASWIN_TRUE if successful or HASWIN_FALSE on any error.
-
- int haswin_fileinitialise()
- - This routine initialises the file load/save/autoload system. After
- calling this routine the routines haswin_setloadfileroutine(),
- haswin_setsavefileroutine(), haswin_setautoloadroutine(),
- haswin_pushloadfileroutine(), haswin_pushsavefileroutine() and
- haswin_pushautoloadroutine() may be used to inform HASWIN of the
- presence of load, save and autoload routines and then File and
- Save items will be automatically added to icons on the iconbar.
- After calling this routine the windows "file_load" and "file_save"
- may be accessed. These are the file load and save windows.
- Returns HASWIN_TRUE if successful or HASWIN_FALSE on any error.
-
- int haswin_initmemorymanager()
- - This routine sets up the memory manager. This is called by the
- routine haswin_initialise() and therefore there should be no
- reason for the user to call this routine directly. Returns
- HASWIN_TRUE if successful or HASWIN_FALSE on any error.
-
- int haswin_initialiseuserheap(int size)
- - This routine initialises the user heap above the program space.
- The "size" given in bytes is rounded up to the next page and a
- WIMP_SetSlot call used to move the memory space. The user
- heap must have enough free space at its end if the heap is to
- be reduced in size. This call may be used at any time to alter
- the total amount of memory used by the user program and will
- succeed if there is enough memory (memory size increasing) or if
- the user heap has enough free space (memory size decreasing).
- It returns the new total size of the user heap, or HASWIN_FALSE
- on an error.
-
-
- Terminating the HASWIN Library system.
- ---------------------------------------
-
- It is possible that a user program might wish to release memory
- or other resorces at some time by shuting down the HASWIN library, either
- completly or partly. HASWIN provides routines for this purpose. After
- shuting down HASWIN can be restarted by calling the initialisation routines.
-
- int haswin_killmemorymanager()
- - This routine removes the memory manager system from HASWIN. After
- this call none of the memory management routines will be allowed.
- The routine haswin_exit() calls this routine and therefore there
- should be no need for a user program to call this routine directly.
- Some of HASWINs own internal routines will fail if the memory
- manager is removed.
-
- void haswin_taskclosedown()
- - This routine tells the WIMP that the task is closing down. It is
- removed from the WIMPs tables. This is called by the routine
- haswin_exit() and therefore there should be no need for the user
- program to call this routine directly. HASWIN does allow this to
- be called without the user program then exiting, but what happens
- if, for example, the user program then continues, and writes to
- the screen, is unknown.
-
- void haswin_exit(int code)
- - This is the standard way of terminating a user program that has
- run under the HASWIN library. When called the following happens.
- 1) If an exit trap routine is defined it is called. This allows
- the user part of the program to terminate cleanly.
- 2) All stacked templates are unstacked and closed.
- 3) All stacked carets are unstacked and the caret is returned
- to its owner when the program started (if possible).
- 4) All stacked pointers are unstacked and the pointer reset to
- "ptr_default", the default arrow pointer. (This is WRONG,
- the pointer should be returned to WHATEVER it was, but how?)
- 5) All currently used fonts are finished with.
- 6) The WIMP is shutdown by a call to haswin_taskclosedown()
- 7) The memory manager is shutdown by a call to
- haswin_killmemorymanager().
- 8) The program is terminated by a call to the C builtin function
- "exit()". "code" is passed to exit as the return code for the
- program.
-
-