home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 331 / gemfst14 / gemfbind.doc < prev    next >
Encoding:
Text File  |  1990-07-20  |  15.5 KB  |  313 lines

  1. ***************************************************************************
  2.                                 GEMFAST
  3.                        Public Domain GEM bindings
  4.                               by Ian Lepore
  5. ***************************************************************************
  6.  
  7. This document provides general background on the GEMFAST bindings system,
  8. installation and usage information, and documents some of the internals 
  9. applicable to the C programmer.
  10.  
  11. ---------------------------------------------------------------------------
  12.                             DOCUMENT CONTENTS
  13. ---------------------------------------------------------------------------
  14.  
  15.  1.0  -  Packing List
  16.  2.0  -  Background
  17.  3.0  -  Functions supported by the bindings
  18.  4.0  -  Installation and Usage
  19.  5.0  -  About the GEMFAST.H header file
  20.  6.0  -  Notes
  21.  7.0  -  Bugs
  22.  8.0  -  Support
  23.  9.0  -  About the (non-existant) copyright
  24.  
  25. ---------------------------------------------------------------------------
  26.  1.0                          PACKING LIST 
  27.                  (xx = version, eg '10' = version 1.0)
  28. ---------------------------------------------------------------------------
  29.  
  30.      GEMFSTxx.ARC     - The runtime system, includes the following...
  31.         AESFAST.A     - The AES bindings library.
  32.         VDIFAST.A     - The VDI bindings library.
  33.         GEMFAST.H     - The C-language header file for use with GEMFAST.
  34.         GEMF_Vxx.DOC  - Version-specific release notes and revision history.
  35.         GEMUTIL.DOC   - Documentation on non-standard utility functions.
  36.         GEMXTEND.DOC  - Documentation on GEM extensions (Atari's and mine).
  37.         GEMFBIND.DOC  - Installation and usage documentation.
  38.  
  39.      GEMFSCxx.ARC    - Source code for the package.  
  40.         AESSRCxx.ARC - Source code for the AES bindings and utilities.
  41.         VDISRCxx.ARC - Source code for the VDI bindings.
  42.  
  43.      GEMFXMxx.ARC    - Example programs.
  44.         MINICOLR.ARC - Example desk accessory, a mini color pallete control.
  45.         MEMFIND.ARC  - Example dialog-based program, displays free memory.
  46.         WINDXMPL.ARC - Example of object tree display in a window.
  47.         
  48.      GEMFUTxx.ARC    - The GEMFAST utilities in C source code format.
  49.      
  50. ---------------------------------------------------------------------------
  51. 2.0                            BACKGROUND
  52. ---------------------------------------------------------------------------
  53.  
  54. These binding libraries were written to address two needs: 1) The world 
  55. needed a good set of free GEM bindings to complement the various PD C
  56. compilers that are available, and 2) The bindings available with most 
  57. commercial compilers aren't so hot either.
  58.  
  59. These routines have been written to be faster than your typical GEM 
  60. bindings.  As a secondary consideration, I tried to make them smaller as 
  61. well.  When you recompile an application using these libararies, you 
  62. should notice a drop in program size, and the link phase of the compile 
  63. should run faster (your mileage may vary).  The design goals included 
  64. using as little bss and data memory as possible (the stack is used for
  65. temporary storage as needed), and that references requiring relocation 
  66. fixup be kept to a minimum.
  67.  
  68. These bindings are known to be compatible with Alcyon C, Sozobon C, and 
  69. Laser C.  They should be compatible with any compiler/linker system 
  70. which uses 'DRI-standard' object & library file formats.  In addition,
  71. the C source code version of the utilities should work with any C compiler.
  72. There will be support for MWC *someday*, but I will NOT commit to a date.
  73.  
  74. ---------------------------------------------------------------------------
  75. 3.0               FUNCTIONS SUPPORTED IN THESE BINDINGS
  76. ---------------------------------------------------------------------------
  77.  
  78. The VDIFAST library includes most of the functions documented in the 
  79. Digital Research publication _GEM Programmer's Guide Vol 1: VDI_.  Some 
  80. of the VDI functions are missing from the VDIFAST library, 
  81. notably the 'Polaroid Pallete' stuff, the v_cellarray() functions, and 
  82. similar rarely-used items.
  83.  
  84. The AESFAST library includes all AES functions documented in the DRI 
  85. publication _GEM Programmer's Guide Vol 2: AES_.  Also included are the 
  86. 'standard' AES utility functions (rc_intersect, etc), and a collection 
  87. of non-standard utilities of my own.  The document file GEMUTIL.DOC 
  88. describes the utility functions.  The AES functions that Atari added 
  89. beginning with TOS 1.4 are also supported.  See GEMXTEND.DOC for more
  90. information.  (As of GemFast release 1.4, a new calling standard for AES
  91. functions has been added.  These are documented in GEMXTEND.DOC).
  92.  
  93. The DRI documents cited above are the definitive reference for the 
  94. standard AES & VDI functions.  If you are using other documents (such as 
  95. Abacus books) there may be some variations between your documents and 
  96. the libraries.  Sorry, I decided it was safer to use the original DRI 
  97. docs as my source of info.  TOS 1.4 functions were built to the
  98. specs in the TOS 1.4 developer's release notes, and thus ARE SUBJECT TO
  99. CHANGE, depending on what Atari does with the final release of TOS 1.4.
  100.  
  101. ---------------------------------------------------------------------------
  102. 4.0                       INSTALLATION AND USAGE
  103. ---------------------------------------------------------------------------
  104.  
  105. Copy the VDIFAST.A and AESFAST.A files to the drive and path where your 
  106. linker will look for runtime-library files.  (EG:  \sozobon\lib). Copy 
  107. the GEMFAST.H file to the drive and path where your compiler looks for 
  108. include files (EG: \sozobon\include).
  109.  
  110. If you are using the Atari 'aln' linker, you will need to use aln's 
  111. DOINDEX program to create .NDX files for each of the libraries.  ALWAYS
  112. BE SURE TO RE-INDEX THE LIBRARY WHEN YOU INSTALL A NEW VERSION OF THE
  113. BINDINGS!
  114.  
  115. To link with the GEMFAST libraries, just enter the library names on the 
  116. command line for the linker program.  For example (using Sozobon):
  117.  
  118.   ld -o myprog.prg dstart.o myprog.o dlibs.a vdifast.a aesfast.a
  119.                          or
  120.   cc -o myprog.prg myprog.c vdifast.a aesfast.a
  121.  
  122. It should not matter where on the command line the names of the GEMFAST 
  123. libs appear:  each library is self-contained, and the linker will not 
  124. have to resolve references between libraries.  No special code is needed 
  125. in your startup object file; you may continue to use whatever startup file
  126. (dstart.o, apstart.o, etc) you currently use.  Also, unlike some GEM 
  127. bindings, you do NOT need to include the VDI bindings libarary if your 
  128. program uses only AES function calls.
  129.  
  130. (An aside:  I've seen a lot of programs that open a VDI workstation, and 
  131. then use only AES functions within the program.  If you use only AES 
  132. functions, you do NOT need to open a VDI virtual workstation.)
  133.  
  134. ---------------------------------------------------------------------------
  135. 5.0                   ABOUT THE GEMFAST HEADER FILE
  136. ---------------------------------------------------------------------------
  137.  
  138. All VDI and AES functions return an 'int' or are of type 'void' 
  139. (returning nothing).  Given the lack of ST C compilers which support 
  140. function prototyping, a header file full of 'extern int xxx()' type 
  141. declarations is a waste of compile time.  The GEMFAST.H file contains 
  142. constants and structures commonly used in GEM programming.
  143.  
  144. If your current bindings system uses OBDEFS.H and GEMDEFS.H, remove the
  145. #include statements for those files, and insert #include <gemfast.h> in
  146. your source code.  While it is possible to continue using your old header
  147. files, your code will become less compatible as future versions of GEMFAST
  148. are released, as the GEMFAST.H file now contains #defines to redirect some
  149. old utility function names to the new names.  Also, the GEMFAST.H file
  150. contains #define GEMFAST_H 1, and code is gonna hit the PD pretty soon that
  151. requires that constant to be set to correctly detect that the GEMFAST
  152. bindings are being used.
  153.  
  154. If you have a lot of existing code that #include's OBDEFS and GEMDEFS, you
  155. can painlessly upgrade all your program to GEMFAST by creating an empty
  156. OBDEFS.H file, and a new GEMDEFS.H file that contains only one line,
  157. "#include <GEMFAST.H>"; this will effectively convert all your existing code.
  158.  
  159. The GEMFAST.SH file is included for those brave (foolish?) souls like 
  160. myself who do GEM programming in assembler.  The file is essentially an 
  161. assembler version of the C file, providing names (constants) for typical 
  162. GEM things, and defining the standard GEM structures (as offsets). (As of
  163. v1.3, the GEMFAST.SH file is contained in the AESFAST source code ARC, not
  164. in the normal runtime ARC file).
  165.  
  166. ---------------------------------------------------------------------------
  167. 6.0                               NOTES
  168. ---------------------------------------------------------------------------
  169.  
  170. Stack usage:  The AES bindings use 20-50 bytes of stack space during a 
  171. function call, this should be totally transparent to your application.  
  172. The VDI bindings use about 50 bytes for most calls, but for the 
  173. graphics-text calls (v_gtext, etc), the stack usage will be 50 bytes + 
  174. 2*stringlength.  Still, given a maximum likely output string of 128 
  175. chars, the stack usage is around 300 bytes to process the call.  I 
  176. typically use a 1k stack, and have never had an overflow.
  177.  
  178. Register usage:  A call to any AES, VDI, or utility function will modify 
  179. registers d0-d2/a0-a1.  (as of v1.0:  register a2 is not touched by the 
  180. bindings or utils, to insure Laser C compatibility).  All other registers 
  181. are preserved if used by the binding.
  182.  
  183. VDI variables:  
  184.  
  185. The VDI bindings contain no global variable names which 
  186. can be used by the calling program (other than the function names 
  187. themselves).  This is because there is no fixed storage (data or bss) 
  188. used by the VDI bindings; each VDI call builds temporary arrays (vdipb, 
  189. contrl, intin, etc) on the stack at runtime.  The implication of this for
  190. the C programmer is that you do NOT have to code the contrl, intin, intout,
  191. ptsin, or ptsout arrays into your C program.
  192.  
  193. AES variables:  
  194.  
  195. The AES bindings define several of the required parameter blocks in BSS
  196. storage, since the parm blocks must hold static information between calls.
  197. As of GEMFAST v1.2, globally-visible names have been given to the parm
  198. blocks, and the variables within them, to allow access from the C source
  199. code level.  This has been done primarily to give access to the GEM version
  200. number, which can be a significant issue now that TOS 1.4 is a reality.
  201.  
  202. The following is the complete list of globally visible variable names:
  203.  
  204.     aespb          - The AES parmameter block, pointers to the other 
  205.                      parameter and control structures.   
  206.     aescontrol     - The AES 'control' structure, which holds the counts
  207.                      of items in the other structures, and the AES opcode.
  208.     global         - A name for the whole 'global' array/structure.
  209.     gl_apversion   - The AES version number.
  210.     gl_apcount     - The max # of GEM aps that can be active at once.
  211.     gl_apid        - The application ID.
  212.     gl_apprivate   - A longword of anything the ap wants it to be.
  213.     gl_aptree      - Pointer to the resource rs_trindex array.
  214.     gl_aprsvd      - Array of 4 longwords reserved for future use.
  215.                      (First longword is used by AES as a pointer to the
  216.                      rshdr structure when a resource file is loaded.  The
  217.                      word following this pointer is the resource length
  218.                      in bytes.)
  219.     
  220. You can use these in your C code by defining:
  221.    
  222.    extern int global[];                           /* this is one way. */
  223.    
  224.    extern int gl_apversion, gl_apid, /* etc */ ;  /* this is another. */
  225.    
  226.    extern struct {                                /* yet a third way. */
  227.      int  gl_apversion, 
  228.           gl_apcount, 
  229.           gl_apid;
  230.      long gl_apprivate;                     
  231.      long *gl_apprtree;
  232.      RSH  *gl_aprsvd;                       
  233.      } global;                              
  234.      
  235. If you use the structure, remember to access vars via global.gl_apid, etc.
  236.   
  237. The data in these global variables is not valid until after the 
  238. appl_init() call has been made.
  239.  
  240. The TOS 1.4 release notes say that the appl_init() call will place a
  241. value of $0130 in global[0] under TOS 1.4.  I found that my ROM TOS 1.0
  242. returns a value of $0120, whereas running the beta RAM TOS 1.4 returned
  243. $0104.  
  244.  
  245. Supervisor mode:  It doesn't work.  This is not my restriction, it's 
  246. just an undocumented fact about the ST's implementation of GEM, so I 
  247. thought I'd mention it.  There are workarounds available, by the way.  
  248. The problem is not in supervisor mode itself, but rather the fact that 
  249. GEM always saves registers onto the user stack.
  250.  
  251. There are more notes available in the source code modules AES@NOTES and 
  252. VDI@NOTES, and in the release notes document.  Release notes are cumulative,
  253. that is, the v1.2 release notes will contain the notes from v1.1.
  254.  
  255. ---------------------------------------------------------------------------
  256. 7.0                                BUGS
  257. ---------------------------------------------------------------------------
  258.  
  259. Undoubtedly there are some...especially in the VDI code and the rarer 
  260. AES functions.  I made no attempt to exhaustively test these libraries, 
  261. I just recompiled all my old GEM programs (about fifty of them) and 
  262. made sure they still worked.  The common functions (objc_draw, etc) are 
  263. sure to work.  If anybody wants to write verification suites for VDI and 
  264. AES, I'll be happy to use them to make these bindings bulletproof. Which 
  265. brings us to...
  266.  
  267. ---------------------------------------------------------------------------
  268. 8.0                              SUPPORT
  269. ---------------------------------------------------------------------------
  270.  
  271. I do intend to support these libraries, and to fix all bugs as soon as 
  272. they're reported.  When reporting a bug, please provide the following 
  273. info:
  274.  
  275.      - A description of the bug/symptoms.
  276.      - THE VERSION OF GEMFAST YOU ARE USING - this is important!
  277.      - The source code that leads to the bug (if the program is huge, 
  278.        please just send a suitable code fragment).
  279.  
  280. I can be reached on the STadel network as 'Ian @ FWBBS'.
  281. On BIX, my userid is 'ianl'.  
  282.  
  283. You can also route bug reports through your normal channel for support 
  284. on the Sozobon C compiler (on GEnie, CIS, etc), and it will get back to 
  285. me eventually.  To reach me via snail-mail, please address it to:
  286.  
  287.      Ian Lepore
  288.      c/o Computer Avenue
  289.      90 S. Wadsworth Blvd.
  290.      Suite 105-502
  291.      Lakewood CO   80226
  292.  
  293. ---------------------------------------------------------------------------
  294. 9.0                        ABOUT THE COPYRIGHT
  295. ---------------------------------------------------------------------------
  296.  
  297. There is none.  At the last minute I changed my mind about this issue, 
  298. so just ignore any copyright statements that might still exist within 
  299. the source code modules.  
  300.  
  301. You can do anything you want with this code, source or object, but be 
  302. aware that I'm not going to support umpty-hundred modified versions of 
  303. these libraries.  If you make modifications, please distribute them 
  304. under a different name (or, send me the mods for inclusion in the next 
  305. version, then I'll support them).  
  306.  
  307. I would like to ask that the entire package by distributed as a whole, 
  308. with docs included.  (Er, that is...don't break down any of the ARC files
  309. and distribute the contents separately.  I've already broken it down such
  310. that the source is a separate piece, etc).
  311.  
  312. ; end of doc
  313.