primitiveVMPath

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

primitiveVMPath

Ang BeePeng
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