John M McIntosh johnmci at
Mon Mar 27 00:18:02 UTC 2006

The mpeg plugin uses it to take the file name and to open it, also  
the freetype 2 plugin where it's the path to the font file.

The api  then converts the given file name in VM platform character  
type (macroman/utf-8/latin-1) into a string that the host operating  
system can use to act upon using host operating system file calls.

Usage of it in the standard unix based VMs can be seen in the


sqInt sqFileOpen(SQFile *f, char* sqFileName, sqInt sqFileNameSize,  
sqInt writeFlag) {
	/* Opens the given file using the supplied sqFile structure
	   to record its state. Fails with no side effects if f is
	   already open. Files are always opened in binary mode;
	   Squeak must take care of any line-end character mapping.

	char cFileName[1001];

	/* don't open an already open file */
	if (sqFileValid(f)) return interpreterProxy->success(false);

	/* copy the file name into a null-terminated C string */
	if (sqFileNameSize > 1000) {
		return interpreterProxy->success(false);
(cFileName, sqFileName, sqFileNameSize, true);
	if (writeFlag) {
		/* First try to open an existing file read/write: */
		setFile(f, fopen(cFileName, "r+b"));

On 26-Mar-06, at 4:02 PM, Andreas Raab wrote:

> John M McIntosh wrote:
>> I believe fname here and length is technically the smalltalk  
>> object, and it's length. If you copy over from the fname it may  
>> not have
>> a terminating 0x00.
> So. Where. Is. This. Used??? The comment in sq.h merely states:
>   "New filename converting function; used by the interpreterProxy  
> function ioFilenamefromStringofLengthresolveAliases. Most platforms  
> can ignore the resolveAlias boolean - it seems to only be of use by  
> OSX but is crucial there."
> and unfortunately, this doesn't give much guidance about arguments  
> or return values. Without an example (which I have asked for,  
> remember?) it is *impossible* to implement that function correctly  
> based on the information I have.
> Cheers,
>   - Andreas

John M. McIntosh <johnmci at> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.

More information about the Vm-dev mailing list