Revision [248]

This is an old revision of sqImageFile made by JohnMcIntosh on 2008-10-18 01:49:30.

 

sqImageFile

In sq.h we define

#define sqImageFile FILE *
#define sqImageFileClose(f) fclose(f)
#define sqImageFileOpen(fileName, mode) fopen(fileName, mode)
#define sqImageFilePosition(f) ftell(f)
#define sqImageFileRead(ptr, sz, count, f) fread(ptr, sz, count, f)
#define sqImageFileSeek(f, pos) fseek(f, pos, SEEK_SET)
#define sqImageFileWrite(ptr, sz, count, f) fwrite(ptr, sz, count, f)
#define sqImageFileStartLocation(fileRef, fileName, size) 0

In general the imageFile I/O routines map to the ansi C read/write library class. They are self obvious in their functions.

MacIntosh
os-9/OSXCarbon
Earlier versions of the VM (pre Oct 2008) would read the image into an anonymously mmapped region,and for sqImageFileOpen
we would do character set conversion on the image name and set a buffer size (setvbuf) for better read performance. Historically pre 2000 the macintosh VM did not use the ansi C routines because of poor performance from the codewarrior library, rather it used the macintosh specific I/O routines. But when the migration to OSX was completed this was change to use the ansi call with some error checking, and use ftello etc to ensure image files > 2GB could be read (well which is not feasible but that is a different story). In OS-9 we did have the ability to embed an image in the os-9 application so sqImageFileStartLocation actually returned something else than zero.

Post Oct 2008 we mmap Copy On Write the image file into memory with an anonymous set of pages for young space trailing that mmap and do not call sqImageFileOpen

Cocoa:
TBD

iPhone
We mmap Copy On Write the image file into memory with an anonymous set of pages for young space trailing that mmap and do not
call sqImageFileOpen

Unix
Each seem to use the ansi calls

Windows
Each seem to use the ansi calls


BUGS
Disagreement about if the sqImageFileOpen has to do character set conversion on the image file name before opening.
ftello or ftell? for sqImageFilePosition, implementers might need to be careful about what the ansi calls actually are.

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki