[Vm-dev] primitiveVMPath

Ang BeePeng beepeng86 at yahoo.com
Tue Mar 23 16:59:36 UTC 2010


int primitiveVMPath(void) {
    int sz;
    int s;

	sz = vmPathSize();
	s = instantiateClassindexableSize(splObj(6), sz);
	vmPathGetLength(s + 4, sz);
	pop(1);
	push(s);
}
int vmPathSize(void) {
	return strlen(vmPath);
}
int vmPathGetLength(int sqVMPathIndex, int length) {
	char *stVMPath = (char *) sqVMPathIndex;
	int count, i;

	count = strlen(vmPath);
	count = (length < count) ? length : count;

	/* copy the file name into the Squeak string */
	for (i = 0; i < count; i++) {
		stVMPath[i] = vmPath[i];
	}
	return count;
}


Hi, 

I'm looking at win32 SqueakVM code. The above confuse me. 

In function vmPathGetLength(), count is strlen of vmPath, while length(or
sz) is also strlen of vmPath. vmPathGetLength() is only used in function
primitiveVMPath(). Why do we need the checking? 

Thanks.

Ang Beepeng
-- 
View this message in context: http://n4.nabble.com/primitiveVMPath-tp1679365p1679365.html
Sent from the Squeak - VM mailing list archive at Nabble.com.


More information about the Vm-dev mailing list