MODULE WBDevFunctionPiecewise%s;

	IMPORT
		WBDevScalar,
		Math,
		MathFunc;
		
	TYPE
		Function = POINTER TO RECORD (WBDevScalar.Node) END;
		Factory = POINTER TO RECORD (WBDevScalar.Factory) END;
		
	VAR
		fact-: WBDevScalar.Factory;
		
	PROCEDURE (func: Function) DeclareArgTypes (OUT args: ARRAY OF CHAR);
	BEGIN
		args := "v";
	END DeclareArgTypes;
	
	PROCEDURE (func: Function) Evaluate (OUT value: REAL);
	CONST
		 
	VAR
		%s
	BEGIN
		%s
	END Evaluate;
	
	PROCEDURE (f: Factory) New (option: INTEGER): Function;
	VAR
		func: Function;
	BEGIN
		NEW(func); func.Initialize; RETURN func;
	END New;
	
	PROCEDURE Install*;
	BEGIN
		WBDevScalar.Install(fact);
	END Install;
	
	PROCEDURE Init;
	VAR
		f: Factory;
	BEGIN
		NEW(f); fact := f;
	END Init;
	
BEGIN
	Init;
END WBDevFunctionPiecewise%s.