<?php

function fn_div_cc($aql)
{	
	$list = $aql->Consume(2);

	$a = new AQLStackElement();
	$a->typename = "const";
	$a->islist = true;
	$a->value = (0+$list[1]->value) / (0+$list[0]->value);
	array_push($aql->stack,$a);	
}


function fn_div_tc($aql)
{	
	$list = $aql->Consume(2);
	$mod = 0;
	if (!is_array($list[0]->value))
		$mod = $list[0]->value;
	else
		$mod = $list[0]->value[0];
	
	$mod = $mod + 0;
	for($x=0;$x<count($list[1]->value);$x++)
	{
		$list[1]->value[$x]->rawvalue /= $mod;
		$list[1]->value[$x]->value /= $mod;
		
		if ($list[1]->value[$x]->history !== FALSE)
		{
			for($y=0;$y<count($list[1]->value[$x]->history);$y++)
			{
				$list[1]->value[$x]->history[$y][1] /= $mod;
			}
		}
	}
	
	array_push($aql->stack,$list[1]);	
}
?>