home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 624a.lha / DynIFFRoutines_v1.1 / readme < prev   
Encoding:
Text File  |  1992-03-20  |  4.8 KB  |  106 lines

  1. DYNAMIC IFF ROUTINES FOR THE AMIGA
  2.  
  3. Version 1.1, 19-Mar-92
  4.  
  5. Contents:
  6.    readme               this file
  7.    copywrite            the necessary stuff
  8.    newiff.c
  9.    newiff.h             the good stuff
  10.    demo.doc             excerpts from code for examples of how to use this 
  11.    split.c
  12.    split                a stupid little program that does the opposite of join
  13.                         I needed to put some lha files on floppies
  14.  
  15. Overview:
  16.    I am working on a project where I felt it would be best modifying files in
  17.    their iff structure directly, as internal structures were so close to the
  18.    iff structure that translation back and forth would be a waste of time.
  19.    After experimenting with iffparse.library commands and the clipboard, I
  20.    quickly found that using these would be far too slow to be acceptable.
  21.    (something like 2 seconds to make a change in a 25K file!)  So I developed
  22.    my own set of routines, similar in some ways to iffparse.library routines.
  23.  
  24.    This is yet another batch of commands to use to play with iff files.  Only
  25.    this batch has a twist - you can dynamically insert, delete, and resize
  26.    chunks from the iff file, and search for chunks in either direction.
  27.    Performance is decent, and just peering into and scanning files is amazingly
  28.    easy.
  29.  
  30.    Being a lowly university student, money is never turned down, but certainly
  31.    not necessary.  However, if you find any use for these, I would appreciate
  32.    a postcard from you.  Lets me know where my code is going.  My address is
  33.    at the end of this file.
  34.    
  35.    These were developed on WB2.04, using Lattice C 5.10a, and V37 includes.
  36.    This needs to open dos.library and iffparse.library.
  37.    
  38. Programming:
  39.    Overhead is as follows:
  40.       Regular property chunk:             24 bytes
  41.       Non-property chunk (FORM, etc):     48 bytes
  42.       IFF file:                           24 bytes
  43.    
  44.    When running through the IFF file, you will discover chunks where the
  45.    ID of the chunk = 0.  These are special, marker chunks to mark the end
  46.    of the present FORM, LIST, or CAT.  Do not delete these!  If desired, you 
  47.    can use them to hold data.  I don't.  Just use the appropriate commands 
  48.    available, again do NOT write directly to any fields.  The chunks 
  49.    identifying the start of a FORM, LIST, or CAT must be left to size 
  50.    IFFSIZE_UNKNOWN.
  51.    
  52.    Make sure that the very first insert into an IFFHeader is that of a
  53.    FORM, CAT, etc.  All routines may still work, but no guarantees.  
  54.    Just follow iff rules, and they should work.  No guarantees especially if
  55.    the file you're creating is not proper IFF.
  56.    
  57.    It may be possible to create an IFF file from these routines that does
  58.    not satisfy the IFF rules.  The routines will not tell you this, but
  59.    when you go to save the file, an error message will likely result.
  60.    
  61.    These routines check for most of the obvious invalid parameters before
  62.    doing anything.  ie.  they should catch most invalid calls.  But there
  63.    is always the possibility that a call will be made that will be invalid,
  64.    and that will not be caught.  Rule of thumb:  check everything before
  65.    calling the function.  To optimize the code a bit, just remove all this
  66.    error checking.
  67.    
  68.    It is possible to create a chunk of size n bytes, but not immediately
  69.    give it any data.  eg.  InsertChunk(file, 0, ID_CHRS, 100, NULL);
  70.    is valid.  I see no use for it, but it is valid.
  71.    
  72.    This does not yet invisibly handle, detect, and account for PROP chunks
  73.    in LIST iff's.  Maybe someday when I get the energy...besides, this could 
  74.    easily be done using the routines here, and I have left provision in the 
  75.    IFFHeader structure for this - ie. the CurPropChunk field.
  76.    
  77.    Besides checking to see if the ID for a chunk to be inserted is good, the
  78.    only place where these calls use iffparse library or dos library routines
  79.    is to load and save iff files to/from a drive.
  80.    
  81.    Who knows, if someone flames loud enough, I may add the PROP handling
  82.    routines, loading/saving to/from the clipboard and/or paging to the disk.
  83.    (In my dreams!)
  84.  
  85.    Iffparse.library is used only to load and save the iff file, and to test
  86.    for the validity of the type and id identifications of new chunks inserted
  87.    into a given file.
  88.    
  89.    These functions have been tested to a degree, and work error-free for my
  90.    purposes, but no guarantees on them working successfully.  No attempt has
  91.    been made to optimize the code in any way whatsoever.  Since the complete
  92.    iff file is not kept in contiguous memory, memory fragmentation may occur
  93.    if many insertions or deletions are made.  Have fun!  And please give
  94.    credit where it is due.
  95.    
  96.    If you have any questions or find any bugs/errors please flame me at:
  97.    INTERNET:
  98.       brycerw@brandonu.ca
  99.       $brycerw@brandonu.ca
  100.    ADDRESS:
  101.       Robert Bryce
  102.       Box 333
  103.       Austin, Mb, Canada
  104.       ROH OCO
  105.  
  106.