primitiveDropRequestFileName(void) { sqInt dropIndex; char *dropName; sqInt i; sqInt nameLength; sqInt nameOop; char *namePtr; if (!((methodArgumentCount()) == 1)) { return primitiveFail(); } dropIndex = stackIntegerValue(0); /* dropRequestFileName returns name or NULL on error */ dropName = dropRequestFileName(dropIndex); if (dropName == null) { return primitiveFail(); } nameLength = strlen(dropName); nameOop = instantiateClassindexableSize(classString(), nameLength); namePtr = firstIndexableField(nameOop); for (i = 0; i < nameLength; i += 1) { namePtr[i] = (dropName[i]); } pop(2); push(nameOop); return 0; }
int dropRequestFileHandle(int dropIndex) { int fileHandle, wasBrowserMode; char *dropName = dropRequestFileName(dropIndex); if(!dropName) return interpreterProxy->nilObject(); fileHandle = instantiateClassindexableSize(classByteArray(), fileRecordSize()); wasBrowserMode = fBrowserMode; fBrowserMode = false; sqFileOpen(fileValueOf(fileHandle),(int)dropName, strlen(dropName), 0); fBrowserMode = wasBrowserMode; return fileHandle; }
int dropRequestFileHandle(int dropIndex) { char *path= dropRequestFileName(dropIndex); if (path) { // you cannot be serious? int handle= instantiateClassindexableSize(classByteArray(), fileRecordSize()); sqFileOpen((SQFile *)fileValueOf(handle), path, strlen(path), 0); return handle; } return interpreterProxy->nilObject(); }