// globals

function preprocess () { 
echo ('require(vcd)\n');
}


function printout () {
	doPrintout (true);
}

function preview () {
	preprocess ();
	calculate ();
	doPrintout (false);
}

function doPrintout (final) {
	vars = getValue ("x");
	shade = getValue ("shade");
	sievetype = getValue ("sievetype");
{ 
echo ('x <- ' + vars);
} 
echo ('\n');
	if (final) { 
echo ('rk.header ("Extended Sieve Plot", parameters=list ("Variable", rk.get.description (' + vars + '), "shade", ' + shade + '))\n');
echo ('\n');
echo ('rk.graph.on ()\n');
	}

echo ('try ({\n');
	if (!empty (plotpre)) printIndented ("\t", plotpre);
	

echo ('	sieve(x, shade = ' + shade + ', sievetype = "' + sievetype + '" ' + getValue ("plotoptions.code.printout") + ')\n');
	if (!empty (plotpost)) printIndented ("\t", plotpost); 
echo ('})\n');
	if (final) { 
echo ('rk.graph.off ()\n');
}
}

