This is ref_demo.m in view mode; [Download] [Up]
// // Xanthus // Copyright (c) 1992, 1993, 1994 Xanthus International AB. // All rights reserved. // #import <math.h> #import "XQ_UserFunction.h" @interface ref_demo:XQ_UserFunction @end @implementation ref_demo + (const char *)functionName; { return "ref_demo"; } + (const char *)categoryName; { return "external_demos"; } - (const char *)argumentNameNo:(int)anIndex; { switch(anIndex) { case 0 : return "ref"; } return "<should never be seen>"; } - (int)minArg; { return 1; } - (int)maxArg; { return 1; } - (int)formalCount; { return 1; } - (int)argType:(int)index; { switch(index) { case 0 : return XQ_DONT_EVAL; // NOTE! // This causes the reference // to be passed to the function // Otherwise, the Questor // runtime passes the value // in the referenced cell } return XQ_EVAL; } - (void *)runFunction: (void *)frame; { int row = 0, col = 0; int xType; // Get arg type xType = XQ_ArgType(frame, 0); if(xType != XQ_REF_ARG) { XQ_RaiseArgTypeError(frame, 0, XQ_REF_ARG); } // Get ref vales XQ_GetRangeValues(frame, 0, &row, &col, &row, &col); // If the row and the col are even, return TRUE // otherwise return FALSE // Since Questor uses 0-based references // we add 1 to the row and the col row++; col++; if(((row % 2) == 0) && ((col % 2) == 0)) return XQ_TrueValue(); return XQ_FalseValue(); } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.