Example #1
0
primitiveAioSuspend(void)
{
    sqInt exceptionWatch;
    sqInt fd;
    sqInt flags;
    sqInt readWatch;
    sqInt writeWatch;

	if ((nilObject()) == (stackValue(3))) {
		return primitiveFail();
	}
	fd = stackIntegerValue(3);
	if (fd < 0) {
		return primitiveFail();
	}
	exceptionWatch = stackObjectValue(2);
	readWatch = stackObjectValue(1);
	writeWatch = stackObjectValue(0);
	flags = 0;
	if (exceptionWatch == (trueObject())) {
		flags = flags | (AIO_X);
	}
	if (readWatch == (trueObject())) {
		flags = flags | (AIO_R);
	}
	if (writeWatch == (trueObject())) {
		flags = flags | (AIO_W);
	}
	aioSuspend(fd, flags);
	pop(5);
	pushInteger(flags);
	return 0;
}
static sqInt
makeDirEntryNamesizecreateDatemodDateisDirfileSizeposixPermissionsisSymlink(char *entryName, sqInt entryNameSize, sqInt createDate, sqInt modifiedDate, sqInt dirFlag, squeakFileOffsetType  fileSize, sqInt posixPermissions, sqInt symlinkFlag)
{
	// FilePlugin>>#makeDirEntryName:size:createDate:modDate:isDir:fileSize:posixPermissions:isSymlink:
    sqInt createDateOop;
    sqInt fileSizeOop;
    sqInt i;
    sqInt modDateOop;
    sqInt nameString;
    sqInt posixPermissionsOop;
    sqInt results;
    char *stringPtr;


	/* allocate storage for results, remapping newly allocated
	   oops in case GC happens during allocation */

	pushRemappableOop(instantiateClassindexableSize(classArray(), 7));
	pushRemappableOop(instantiateClassindexableSize(classString(), entryNameSize));
	pushRemappableOop(positive32BitIntegerFor(createDate));
	pushRemappableOop(positive32BitIntegerFor(modifiedDate));
	pushRemappableOop(positive64BitIntegerFor(fileSize));
	pushRemappableOop(positive32BitIntegerFor(posixPermissions));
	posixPermissionsOop = popRemappableOop();
	fileSizeOop = popRemappableOop();
	modDateOop = popRemappableOop();
	createDateOop = popRemappableOop();
	nameString = popRemappableOop();

	/* copy name into Smalltalk string */

results = popRemappableOop();
	stringPtr = firstIndexableField(nameString);
	for (i = 0; i < entryNameSize; i += 1) {
stringPtr[i] = (entryName[i]);
	}
	storePointerofObjectwithValue(0, results, nameString);
	storePointerofObjectwithValue(1, results, createDateOop);
	storePointerofObjectwithValue(2, results, modDateOop);
	if (dirFlag) {
storePointerofObjectwithValue(3, results, trueObject());
	}
	else {
storePointerofObjectwithValue(3, results, falseObject());
	}
	storePointerofObjectwithValue(4, results, fileSizeOop);
	storePointerofObjectwithValue(5, results, posixPermissionsOop);
	if (symlinkFlag) {
storePointerofObjectwithValue(6, results, trueObject());
	}
	else {
storePointerofObjectwithValue(6, results, falseObject());
	}
	return results;
}
Example #3
0
primitiveAioEnable(void)
{
    static int eventSemaphoreIndices[FD_SETSIZE];
    sqInt externalObject;
    sqInt fd;
    sqInt flags;
    sqInt semaIndex;

	if ((nilObject()) == (stackValue(2))) {
		return primitiveFail();
	}
	fd = stackIntegerValue(2);
	if (fd < 0) {
		return primitiveFail();
	}
	semaIndex = stackIntegerValue(1);
	eventSemaphoreIndices[semaIndex] = semaIndex;
	externalObject = stackObjectValue(0);
	if (externalObject == (trueObject())) {
		flags = AIO_EXT;
	}
	else {
		flags = 0;
	}
	aioEnable(fd, &(eventSemaphoreIndices[semaIndex]), flags);
	pop(4);
	pushInteger(semaIndex);
	return 0;
}
Example #4
0
primitiveMeasurementMetric(void)
{
	sqInt _return_value;

	_return_value = (((sqLocMeasurementMetric())) ? trueObject() : falseObject());
	if (failed()) {
		return null;
	}
	popthenPush(1, _return_value);
	return null;
}
Example #5
0
primitiveDaylightSavings(void)
{
	sqInt _return_value;

	_return_value = (((sqLocDaylightSavings())) ? trueObject() : falseObject());
	if (failed()) {
		return null;
	}
	popthenPush(1, _return_value);
	return null;
}
Example #6
0
primitiveCurrencyNotation(void)
{
	sqInt _return_value;

	_return_value = (((sqLocCurrencyNotation())) ? trueObject() : falseObject());
	if (failed()) {
		return null;
	}
	popthenPush(1, _return_value);
	return null;
}