ftp.nice.ch/pub/next/developer/objc/api/QuestorAPI.3.2.s.tar.gz#/Questor_API/ExternalFunctions/Source/Demo4/demo4.m

This is demo4.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 demo4:XQ_UserFunction
@end




@implementation demo4

+ (const char *)functionName;
{
	return "demo4";
}

+ (const char *)categoryName;
{
	return "external_demos";
}

- (const char *)argumentNameNo:(int)index;
{
	switch(index) {
	case 0 : 
		return "x";
	}
	
	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_EVAL;
	}
	return XQ_EVAL;
}

- (void *)runFunction: (void *)frame;
{
	double x;
	int xType;
	
    // Get arg type
    
	xType = XQ_ArgType(frame, 0);
	
	if(xType != XQ_DOUBLE_ARG) {
		XQ_RaiseArgTypeError(frame, 0, XQ_DOUBLE_ARG);
	}
	
    // Get arg
    
	x = XQ_GetDoubleValue(frame, 0);
	
    // Check arg
    
    	if(x > 100) {
		
		XQ_AddErrorMessage(frame, 
		
				"\\b Error: \\b0 The argument %.2f is"
				" not below 100! \\par ",
				
				x);
				
		XQ_RaiseError(frame);
	}
	
    // Return
    
	return XQ_CreateDoubleValue(frame, x);
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.