home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / System / JPartial Resources / JPartialResources.abs next >
Encoding:
Text File  |  1994-03-31  |  2.1 KB  |  46 lines  |  [TEXT/R*ch]

  1. "Jamie's Partial Resources."  Implements the partial resource
  2. calls, which are built into system 7, in system 6 as well.
  3. Just call jReadPartialResource and jWritePartialResource
  4. instead of ReadPartialResource and WritePartialResource.
  5.  
  6. Note that you can read or write any section of a resource
  7. without loading the resource itself into memory;  the code
  8. finds the location of the resource on disk, and reads directly
  9. from the resource fork.  So you can, for example, access the
  10. middle ten bytes of a 10-meg resource in a 10K heap.
  11.  
  12. Changing the size of a resource is not supported;  attemping
  13. to do so will drop you into the debugger (under system 6).
  14. It's another case of "I don't need it, so I didn't bother
  15. writing it."  Implementing this is another order of magnitude
  16. harder than reading or writing, and implementing it efficiently
  17. is another order of magnitude harder than that.  Don't count
  18. on it any time soon, sorry.
  19.  
  20. (c) Copyright 1992 by Jamie R. McCarthy.  All rights reserved.
  21. This code can be both distributed and used freely.
  22. Internet: k044477@kzoo.edu       AppleLink: j.mccarthy
  23.  
  24. [new info for version 1.0.1]
  25.  
  26. This archive contains the .c and .h files for JPartialResources 1.0.1.
  27. The code extends the partial-resource calls into system 6--and yes it
  28. does read in only the section requested, not the whole resource.
  29. CFlexiDataFile uses JPartialResources;  if you're using that class,
  30. this new version just drops right in.
  31.  
  32. 1.0.1 is a little better about error-handling--it sets ResErr instead of
  33. dropping into the debugger--and it is a little more fastidious about
  34. using Gestalt, though it probably won't ever make any difference.
  35.  
  36. But the main new feature is that it doesn't go to disk twice when once
  37. is enough.  Marco Piovanelli was kind enough to point out that some of
  38. the information I needed is resident in RAM.  So this version should be
  39. quite a bit faster than 1.0, especially if you're making many accesses
  40. to small amounts of data.
  41.  
  42. This code shipped in our latest game, which depends on it quite
  43. heavily.  So I'd give it very high reliability marks.
  44.  
  45. It's freeware--if you like it, drop me a line.
  46.