<?php

function fn_if_wff($aql)
{
	$list = $aql->Consume(3);

	$cnt = 0;
	
	$pass = false;
	if ($list[2]->typename == "const")
	{
		switch($list[2]->value )
		{
			case "1":
			case "t":
			case "T":
			case "true":
			case "TRUE":
			case "y":
			case "Y":
			case "yes":
			case "YES":
				$pass = true;
		}
	}
	if (count($list[2]->value) > 0)
	{
		$pass = true;
	}
	
	$indx = 0;
	
	if ($pass == true)
	{
		$indx = 1;
	}	
	
	$list[$indx]->value->stack = [];
		
	$list[$indx]->value->memory['cond'] = $list[2];
		
	$list[$indx]->value->prnt = $aql;
	$list[$indx]->value->Execute(false);	
	
	foreach($list[$indx]->value->stack as $s)
	{
		array_push($aql->stack,$s);					
	}	
}

function fn_if_wf($aql)
{
	$list = $aql->Consume(3);

	$cnt = 0;
	
	$pass = false;
	if ($list[1]->typename == "const")
	{
		switch($list[1]->value )
		{
			case "1":
			case "t":
			case "T":
			case "true":
			case "TRUE":
			case "y":
			case "Y":
			case "yes":
			case "YES":
				$pass = true;
		}
	}
	if (count($list[1]->value) > 0)
	{
		$pass = true;
	}
	
	$indx = -1;
	
	if ($pass == true)
	{
		$indx = 0;
	}	
	
	if ($indx >= 0)
	{
		$list[$indx]->value->stack = [];
			
		$list[$indx]->value->memory['cond'] = $list[2];
			
		$list[$indx]->value->prnt = $aql;
		$list[$indx]->value->Execute(false);	
		
		foreach($list[$indx]->value->stack as $s)
		{
			array_push($aql->stack,$s);					
		}	
	}
}

?>