version 1.74, 2001/12/08 04:24:32
|
version 1.91, 2002/12/04 20:59:07
|
Line 1
|
Line 1
|
<? |
<?php |
if(!defined("METAL_CLASS_INCLUDED")) |
if(!defined("METAL_CLASS_INCLUDED")) |
{ |
{ |
define("METAL_CLASS_INCLUDED",1); |
define("METAL_CLASS_INCLUDED",1); |
Line 20 class metal_class_class extends metal_ba
|
Line 20 class metal_class_class extends metal_ba
|
var $current_argument_number=0; |
var $current_argument_number=0; |
var $current_variable=""; |
var $current_variable=""; |
var $current_subclass=0; |
var $current_subclass=0; |
|
var $generate_function=array(); |
|
|
Function GetDocumentation(&$scope,&$compiler,&$code,&$attributes,$element_path) |
Function GetDocumentation(&$scope,&$compiler,&$code,&$attributes,$element_path) |
{ |
{ |
Line 40 class metal_class_class extends metal_ba
|
Line 41 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$documentation_element_path,"it was defined the documentation idiom more than once"); |
$compiler->SetElementError($attributes->file,$documentation_element_path,"it was defined the documentation idiom more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($attributes->file,$documentation_element_path,&$idiom,"it was not specified a valid class documentation idiom option")) |
if(!$compiler->GetValidName($attributes->file,$documentation_element_path,$idiom,"it was not specified a valid class documentation idiom option")) |
return(0); |
return(0); |
if(IsSet($scope["documentation"][$idiom])) |
if(IsSet($scope["documentation"][$idiom])) |
{ |
{ |
Line 54 class metal_class_class extends metal_ba
|
Line 55 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$documentation_element_path,"it was specified the documentation tag ".$data["Tag"]." more than once"); |
$compiler->SetElementError($attributes->file,$documentation_element_path,"it was specified the documentation tag ".$data["Tag"]." more than once"); |
return(0); |
return(0); |
} |
} |
$compiler->CopyEmptyContext(&$attributes,&$documentation[$data["Tag"]]); |
$compiler->CopyEmptyContext($attributes,$documentation[$data["Tag"]]); |
$documentation[$data["Tag"]]->path=$documentation_element_path; |
$documentation[$data["Tag"]]->path=$documentation_element_path; |
break; |
break; |
} |
} |
Line 81 class metal_class_class extends metal_ba
|
Line 82 class metal_class_class extends metal_ba
|
$this->classes[$index]["return_type"]=""; |
$this->classes[$index]["return_type"]=""; |
$this->classes[$index]["return_value_set"]=0; |
$this->classes[$index]["return_value_set"]=0; |
$this->classes[$index]["staticload"]=0; |
$this->classes[$index]["staticload"]=0; |
$this->classes[$index]["types"]=array(); |
|
$this->classes[$index]["functions"]=array(); |
$this->classes[$index]["functions"]=array(); |
$this->classes[$index]["variables"]=array(); |
$this->classes[$index]["variables"]=array(); |
$this->classes[$index]["declarationfile"]=$attributes->file; |
$this->classes[$index]["declarationfile"]=$attributes->file; |
Line 97 class metal_class_class extends metal_ba
|
Line 97 class metal_class_class extends metal_ba
|
switch($data["Tag"]) |
switch($data["Tag"]) |
{ |
{ |
case "parent": |
case "parent": |
if(!$compiler->GetValidName($attributes->file,$element_path,&$parent_name,"it was not specified a valid class parent name argument")) |
if(!$compiler->GetValidName($attributes->file,$element_path,$parent_name,"it was not specified a valid class parent name argument")) |
return(0); |
return(0); |
if(count($this->classes[$index]["functions"])) |
if(count($this->classes[$index]["functions"])) |
{ |
{ |
Line 127 class metal_class_class extends metal_ba
|
Line 127 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$element_path,"it was defined the class name more than once"); |
$compiler->SetElementError($attributes->file,$element_path,"it was defined the class name more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($attributes->file,$element_path,&$class_name,"it was not specified a valid class name argument")) |
if(!$compiler->GetValidName($attributes->file,$element_path,$class_name,"it was not specified a valid class name argument")) |
return(0); |
return(0); |
if(IsSet($this->subclasses[$class_name])) |
if(IsSet($this->subclasses[$class_name])) |
{ |
{ |
Line 161 class metal_class_class extends metal_ba
|
Line 161 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$function_element_path,"it was defined the class function name more than once"); |
$compiler->SetElementError($attributes->file,$function_element_path,"it was defined the class function name more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($attributes->file,$function_element_path,&$name,"it was not specified a valid class function name option")) |
if(!$compiler->GetValidName($attributes->file,$function_element_path,$name,"it was not specified a valid class function name option")) |
return(0); |
return(0); |
if(IsSet($this->classes[$index]["functions"][$name])) |
if(IsSet($this->classes[$index]["functions"][$name])) |
{ |
{ |
Line 208 class metal_class_class extends metal_ba
|
Line 208 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$function_element_path,"it was defined the class function type more than once"); |
$compiler->SetElementError($attributes->file,$function_element_path,"it was defined the class function type more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidData($attributes->file,$function_element_path,&$function["type"],"it was not specified a valid class function type option")) |
if(!$compiler->GetValidData($attributes->file,$function_element_path,$function["type"],"it was not specified a valid class function type option")) |
return(0); |
return(0); |
switch($function["type"]) |
switch(strtok($function["type"],":")) |
{ |
{ |
case "VOID": |
case "VOID": |
case "STRING": |
case "STRING": |
Line 274 class metal_class_class extends metal_ba
|
Line 274 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$argument_element_path,"it was defined the class function argument name more than once"); |
$compiler->SetElementError($attributes->file,$argument_element_path,"it was defined the class function argument name more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($attributes->file,$argument_element_path,&$argument_name,"it was not specified a valid class function argument name option")) |
if(!$compiler->GetValidName($attributes->file,$argument_element_path,$argument_name,"it was not specified a valid class function argument name option")) |
return(0); |
return(0); |
if(IsSet($function["Arguments"][$argument_name])) |
if(IsSet($function["Arguments"][$argument_name])) |
{ |
{ |
Line 288 class metal_class_class extends metal_ba
|
Line 288 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$argument_element_path,"it was defined the class function argument type more than once"); |
$compiler->SetElementError($attributes->file,$argument_element_path,"it was defined the class function argument type more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidData($attributes->file,$argument_element_path,&$argument["type"],"it was not specified a valid class function type option")) |
if(!$compiler->GetValidData($attributes->file,$argument_element_path,$argument["type"],"it was not specified a valid class function type option")) |
return(0); |
return(0); |
switch($argument["type"]) |
switch(strtok($argument["type"],":")) |
{ |
{ |
case "STRING": |
case "STRING": |
case "INTEGER": |
case "INTEGER": |
Line 326 class metal_class_class extends metal_ba
|
Line 326 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$argument_element_path,"it was not defined the class function argument type before defining the defaultvalue"); |
$compiler->SetElementError($attributes->file,$argument_element_path,"it was not defined the class function argument type before defining the defaultvalue"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidData($attributes->file,$argument_element_path,&$argument["defaultvalue"],"it was not specified a valid class argument defaultvalue option") |
if(!$compiler->GetValidData($attributes->file,$argument_element_path,$argument["defaultvalue"],"it was not specified a valid class argument defaultvalue option") |
|| !$compiler->ConvertData(&$attributes,$argument["type"],$argument["defaultvalue"],&$argument["converteddefaultvalue"])) |
|| !$compiler->ConvertData($attributes,$argument["type"],$argument["defaultvalue"],$argument["converteddefaultvalue"])) |
return(0); |
return(0); |
break; |
break; |
case "in": |
case "in": |
Line 352 class metal_class_class extends metal_ba
|
Line 352 class metal_class_class extends metal_ba
|
$argument["parameter"]=$data["Tag"]; |
$argument["parameter"]=$data["Tag"]; |
break; |
break; |
case "documentation": |
case "documentation": |
if(!$this->GetDocumentation(&$argument,&$compiler,&$code,&$attributes,$argument_element_path)) |
if(!$this->GetDocumentation($argument,$compiler,$code,$attributes,$argument_element_path)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 376 class metal_class_class extends metal_ba
|
Line 376 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$function_element_path,"it was not defined the class function argument type"); |
$compiler->SetElementError($attributes->file,$function_element_path,"it was not defined the class function argument type"); |
return(0); |
return(0); |
} |
} |
|
if(GetType($colon=strpos($type=$argument["type"],":"))=="integer") |
|
{ |
|
$class=substr($argument["type"],$colon); |
|
$type=substr($argument["type"],0,$colon); |
|
} |
|
else |
|
$class=""; |
if(!IsSet($argument["parameter"])) |
if(!IsSet($argument["parameter"])) |
$argument["parameter"]="in"; |
{ |
|
switch($type) |
|
{ |
|
case "ARRAY": |
|
case "HASH": |
|
case "OBJECT": |
|
$argument["parameter"]="inout"; |
|
break; |
|
default: |
|
$argument["parameter"]="in"; |
|
break; |
|
} |
|
} |
|
switch($argument["parameter"]) |
|
{ |
|
case "out": |
|
case "inout": |
|
switch($type) |
|
{ |
|
case "ARRAY": |
|
case "HASH": |
|
case "OBJECT": |
|
$buffer=""; |
|
break; |
|
default: |
|
$buffer="BUFFER"; |
|
} |
|
$argument["type"]=$type.$buffer.$class; |
|
break; |
|
default: |
|
switch($type) |
|
{ |
|
case "ARRAY": |
|
case "HASH": |
|
case "OBJECT": |
|
$compiler->SetElementError($attributes->file,$function_element_path,"arguments of type \"$type\" may only be \"out\" or \"inout\" parameters"); |
|
return(0); |
|
} |
|
break; |
|
} |
$function["Arguments"][$argument_name]=$argument; |
$function["Arguments"][$argument_name]=$argument; |
break; |
break; |
case "do": |
case "do": |
Line 393 class metal_class_class extends metal_ba
|
Line 439 class metal_class_class extends metal_ba
|
$this->classes[$index]["functions"][$name]=$function; |
$this->classes[$index]["functions"][$name]=$function; |
break; |
break; |
case "documentation": |
case "documentation": |
if(!$this->GetDocumentation(&$function,&$compiler,&$code,&$attributes,$function_element_path)) |
if(!$this->GetDocumentation($function,$compiler,$code,$attributes,$function_element_path)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 446 class metal_class_class extends metal_ba
|
Line 492 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$variable_element_path,"it was defined the class variable name more than once"); |
$compiler->SetElementError($attributes->file,$variable_element_path,"it was defined the class variable name more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($attributes->file,$variable_element_path,&$name,"it was not specified a valid class variable name option")) |
if(!$compiler->GetValidName($attributes->file,$variable_element_path,$name,"it was not specified a valid class variable name option")) |
return(0); |
return(0); |
if(IsSet($this->classes[$index]["variables"][$name])) |
if(IsSet($this->classes[$index]["variables"][$name])) |
{ |
{ |
Line 468 class metal_class_class extends metal_ba
|
Line 514 class metal_class_class extends metal_ba
|
return(0); |
return(0); |
} |
} |
$class=$parent; |
$class=$parent; |
if($this->InheritedVariableClass(&$class,$name)) |
if($this->InheritedVariableClass($class,$name)) |
{ |
{ |
$compiler->SetElementError($attributes->file,$variable_element_path,"it was attempted to redefine the type of a inherited subclass variable"); |
$compiler->SetElementError($attributes->file,$variable_element_path,"it was attempted to redefine the type of a inherited subclass variable"); |
return(0); |
return(0); |
Line 478 class metal_class_class extends metal_ba
|
Line 524 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$variable_element_path,"it was defined the class variable type more than once"); |
$compiler->SetElementError($attributes->file,$variable_element_path,"it was defined the class variable type more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidData($attributes->file,$variable_element_path,&$variable["type"],"it was not specified a valid class variable type option")) |
if(!$compiler->GetValidData($attributes->file,$variable_element_path,$variable["type"],"it was not specified a valid class variable type option")) |
return(0); |
return(0); |
switch($variable["type"]) |
switch(strtok($variable["type"],":")) |
{ |
{ |
case "STRING": |
case "STRING": |
case "INTEGER": |
case "INTEGER": |
Line 502 class metal_class_class extends metal_ba
|
Line 548 class metal_class_class extends metal_ba
|
return(0); |
return(0); |
} |
} |
$class=$parent; |
$class=$parent; |
if($this->InheritedVariableClass(&$class,$name)) |
if($this->InheritedVariableClass($class,$name)) |
{ |
{ |
$compiler->SetElementError($attributes->file,$variable_element_path,"it was attempted to redefine the protected status of a inherited subclass variable"); |
$compiler->SetElementError($attributes->file,$variable_element_path,"it was attempted to redefine the protected status of a inherited subclass variable"); |
return(0); |
return(0); |
Line 514 class metal_class_class extends metal_ba
|
Line 560 class metal_class_class extends metal_ba
|
} |
} |
$variable["protected"]=1; |
$variable["protected"]=1; |
break; |
break; |
|
case "notnull": |
|
if(!IsSet($name)) |
|
{ |
|
$compiler->SetElementError($attributes->file,$variable_element_path,"it was defined the class variable notnull status before specifying its name"); |
|
return(0); |
|
} |
|
$class=$parent; |
|
if($this->InheritedVariableClass($class,$name)) |
|
{ |
|
$compiler->SetElementError($attributes->file,$variable_element_path,"it was attempted to redefine the notnull status of a inherited subclass variable"); |
|
return(0); |
|
} |
|
if(IsSet($variable["notnull"])) |
|
{ |
|
$compiler->SetElementError($attributes->file,$variable_element_path,"it was defined the class variable notnull status more than once"); |
|
return(0); |
|
} |
|
$variable["notnull"]=1; |
|
break; |
case "value": |
case "value": |
$class=$parent; |
$class=$parent; |
if($this->InheritedVariableClass(&$class,$name)) |
if($this->InheritedVariableClass($class,$name)) |
$type=$this->classes[$class]["variables"][$name]["type"]; |
$type=$this->classes[$class]["variables"][$name]["type"]; |
else |
else |
{ |
{ |
Line 532 class metal_class_class extends metal_ba
|
Line 597 class metal_class_class extends metal_ba
|
$compiler->SetElementError($attributes->file,$variable_element_path,"it was defined the class variable initial value more than once"); |
$compiler->SetElementError($attributes->file,$variable_element_path,"it was defined the class variable initial value more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidData($attributes->file,$variable_element_path,&$variable["value"],"it was not specified a valid class variable value option") |
if(!$compiler->GetValidData($attributes->file,$variable_element_path,$variable["value"],"it was not specified a valid class variable value option") |
|| !$compiler->ConvertData(&$attributes,$type,$variable["value"],&$variable["convertedvalue"])) |
|| !$compiler->ConvertData($attributes,$type,$variable["value"],$variable["convertedvalue"])) |
return(0); |
return(0); |
break; |
break; |
case "documentation"; |
case "documentation"; |
if(!$this->GetDocumentation(&$variable,&$compiler,&$code,&$attributes,$variable_element_path)) |
if(!$this->GetDocumentation($variable,$compiler,$code,$attributes,$variable_element_path)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 557 class metal_class_class extends metal_ba
|
Line 622 class metal_class_class extends metal_ba
|
return(0); |
return(0); |
} |
} |
$class=$parent; |
$class=$parent; |
if(!$this->InheritedVariableClass(&$class,$name) |
if(!$this->InheritedVariableClass($class,$name) |
&& !IsSet($variable["type"])) |
&& !IsSet($variable["type"])) |
{ |
{ |
$compiler->SetElementError($attributes->file,$element_path,"it was not defined the class variable type"); |
$compiler->SetElementError($attributes->file,$element_path,"it was not defined the class variable type"); |
return(0); |
return(0); |
} |
} |
|
if(IsSet($variable["notnull"]) |
|
&& !IsSet($variable["value"])) |
|
return($compiler->SetElementError($attributes->file,$element_path,"it was not defined the default value of a notnull class variable")); |
$this->classes[$index]["variables"][$name]=$variable; |
$this->classes[$index]["variables"][$name]=$variable; |
break; |
break; |
case "abstract": |
case "abstract": |
Line 576 class metal_class_class extends metal_ba
|
Line 644 class metal_class_class extends metal_ba
|
case "title": |
case "title": |
case "author": |
case "author": |
case "authoraddress": |
case "authoraddress": |
if(!$compiler->GetValidData($attributes->file,$element_path,&$this->classes[$index][$data["Tag"]],"it was not specified a valid class ".$data["Tag"]." property")) |
if(!$compiler->GetValidData($attributes->file,$element_path,$this->classes[$index][$data["Tag"]],"it was not specified a valid class ".$data["Tag"]." property")) |
return(0); |
return(0); |
|
if(strlen($this->classes[$index][$data["Tag"]])==0) |
|
return($compiler->SetElementError($attributes->file,$element_path,"it was specified an empty class ".$data["Tag"]." property")); |
break; |
break; |
case "documentation": |
case "documentation": |
if(!$this->GetDocumentation(&$this->classes[$index],&$compiler,&$code,&$attributes,$element_path)) |
if(!$this->GetDocumentation($this->classes[$index],$compiler,$code,$attributes,$element_path)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 613 class metal_class_class extends metal_ba
|
Line 683 class metal_class_class extends metal_ba
|
&& !IsSet($this->classes[$parent]["abstract"])) |
&& !IsSet($this->classes[$parent]["abstract"])) |
{ |
{ |
$compiler->SetElementError($attributes->file,$attributes->path,"it was defined the abstract attribute for a subclass of a class that is not abstract"); |
$compiler->SetElementError($attributes->file,$attributes->path,"it was defined the abstract attribute for a subclass of a class that is not abstract"); |
return(0); |
return(0); |
} |
} |
$this->classes[$index]["parent"]=$parent; |
$this->classes[$index]["parent"]=$parent; |
} |
} |
if(!IsSet($this->classes[$index]["tag"])) |
if(!IsSet($this->classes[$index]["abstract"])) |
$this->classes[$index]["tag"]="CLASS_".strtoupper(ereg_replace("[^A-Za-z0-9]","_",$this->classes[$index]["file"])); |
{ |
|
if(!IsSet($this->classes[$index]["file"]) |
|
|| strlen($this->classes[$index]["file"])==0) |
|
return($compiler->SetElementError($attributes->file,$attributes->path,"it was not specified the class output file")); |
|
if(!IsSet($this->classes[$index]["tag"])) |
|
$this->classes[$index]["tag"]="CLASS_".strtoupper(ereg_replace("[^A-Za-z0-9]","_",$this->classes[$index]["file"])); |
|
} |
return(1); |
return(1); |
} |
} |
|
|
Function Setup(&$compiler,&$code,&$attributes) |
Function Setup(&$compiler,&$code,&$attributes) |
{ |
{ |
|
global $metal_xml_parsers; |
|
|
$elements=$code->structure[$attributes->path]["Elements"]; |
$elements=$code->structure[$attributes->path]["Elements"]; |
for($element=0;$element<$elements;$element++) |
for($element=0;$element<$elements;$element++) |
{ |
{ |
Line 641 class metal_class_class extends metal_ba
|
Line 719 class metal_class_class extends metal_ba
|
} |
} |
$class_attributes=$attributes; |
$class_attributes=$attributes; |
$class_attributes->path=$element_path; |
$class_attributes->path=$element_path; |
if(!$this->SetupClass(&$compiler,&$code,&$class_attributes)) |
if(!$this->SetupClass($compiler,$code,$class_attributes)) |
|
return(0); |
|
break; |
|
case "definition": |
|
if(!$compiler->GetValidData($attributes->file,$element_path,$file,"it was not specified a valid class definition file")) |
|
return(0); |
|
if(!$compiler->ParseDefinitionFile($file)) |
|
return(0); |
|
$compiler->CreateFileContext($class_attributes,$file); |
|
if(!$this->SetupClass($compiler,$metal_xml_parsers[$file],$class_attributes)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 662 class metal_class_class extends metal_ba
|
Line 749 class metal_class_class extends metal_ba
|
{ |
{ |
if(!IsSet($this->classes[$class]["functions"][$name]["do"]["code"])) |
if(!IsSet($this->classes[$class]["functions"][$name]["do"]["code"])) |
{ |
{ |
|
if(IsSet($this->generate_function[$class][$name])) |
|
{ |
|
$compiler->SetElementError($this->classes[$class]["functions"][$name]["do"]["file"],$this->classes[$class]["functions"][$name]["do"]["path"],"Generate function is being called recursively for class function \"$name\""); |
|
return(0); |
|
} |
|
$this->generate_function[$class][$name]=1; |
$this->classes[$class]["functions"][$name]["do"]["code"]=array(); |
$this->classes[$class]["functions"][$name]["do"]["code"]=array(); |
$function_name=$this->classes[$class]["function_name"]; |
$function_name=$this->classes[$class]["function_name"]; |
$return_type=$this->classes[$class]["return_type"]; |
$return_type=$this->classes[$class]["return_type"]; |
Line 674 class metal_class_class extends metal_ba
|
Line 767 class metal_class_class extends metal_ba
|
$action_context->path=$this->classes[$class]["functions"][$name]["do"]["path"]; |
$action_context->path=$this->classes[$class]["functions"][$name]["do"]["path"]; |
$action_context->result=array(); |
$action_context->result=array(); |
$functions=array( |
$functions=array( |
|
"instance", |
"instancevariable", |
"instancevariable", |
|
"instancevariableisnotnull", |
"instancecall", |
"instancecall", |
"functionargument", |
"functionargument", |
|
"setinstancevariablenull", |
"return" |
"return" |
); |
); |
if(!$compiler->AddContextFunctions(&$action_context,$this->object_name,&$functions,&$level) |
if(!$compiler->AddContextFunctions($action_context,$this->object_name,$functions,$level) |
|| !$compiler->StartScope(&$action_context,&$scope,"method")) |
|| !$compiler->StartScope($action_context,$scope,"method")) |
return(0); |
return(0); |
|
if(IsSet($this->classes[$class]["functions"][$name]["Arguments"])) |
|
{ |
|
$arguments=$this->classes[$class]["functions"][$name]["Arguments"]; |
|
for(Reset($arguments),$argument=0;$argument<count($arguments);Next($arguments),$argument++) |
|
{ |
|
$argument_name=Key($arguments); |
|
$variable=array( |
|
"Name"=>$argument_name, |
|
"Type"=>$arguments[$argument_name]["type"], |
|
"Argument"=>1 |
|
); |
|
if(!$compiler->DeclareVariable($action_context,$variable)) |
|
return(0); |
|
} |
|
} |
$current_subclass=$this->current_subclass; |
$current_subclass=$this->current_subclass; |
$this->current_subclass=$class; |
$this->current_subclass=$class; |
if(!$compiler->GetOutputData($this->classes[$class]["functions"][$name]["do"]["file"],$this->classes[$class]["functions"][$name]["do"]["path"],&$this->classes[$class]["functions"][$name]["do"]["code"],"it were not defined valid class function do statements",1) |
if(!$compiler->GetOutputData($this->classes[$class]["functions"][$name]["do"]["file"],$this->classes[$class]["functions"][$name]["do"]["path"],$this->classes[$class]["functions"][$name]["do"]["code"],"it were not defined valid class function do statements",1) |
|| !$compiler->GetScopeVariables(&$context,$scope,&$this->classes[$class]["functions"][$name]["variables"])) |
|| !$compiler->GetScopeVariables($context,$scope,$this->classes[$class]["functions"][$name]["variables"]) |
|
|| !$compiler->GetScopeExceptions($context,$scope,$this->classes[$class]["functions"][$name]["exceptions"])) |
return(0); |
return(0); |
$this->current_subclass=$current_subclass; |
$this->current_subclass=$current_subclass; |
$success=$compiler->EndScope(&$action_context,$scope); |
$success=$compiler->EndScope($action_context,$scope); |
if(!$compiler->RemoveContextFunctions(&$action_context,$this->object_name,$level) |
if(!$compiler->RemoveContextFunctions($action_context,$this->object_name,$level) |
|| !$success) |
|| !$success) |
return(0); |
return(0); |
if(strcmp($this->classes[$class]["functions"][$name]["type"],"VOID") |
if(strcmp($this->classes[$class]["functions"][$name]["type"],"VOID") |
Line 701 class metal_class_class extends metal_ba
|
Line 813 class metal_class_class extends metal_ba
|
$this->classes[$class]["function_name"]=$function_name; |
$this->classes[$class]["function_name"]=$function_name; |
$this->classes[$class]["return_type"]=$return_type; |
$this->classes[$class]["return_type"]=$return_type; |
$this->classes[$class]["return_value_set"]=$return_value_set; |
$this->classes[$class]["return_value_set"]=$return_value_set; |
|
Unset($this->generate_function[$class][$name]); |
} |
} |
return(1); |
return(1); |
} |
} |
Line 745 class metal_class_class extends metal_ba
|
Line 858 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$element_path,"it was specified the class $function subclass argument after having specified other arguments"); |
$compiler->SetElementError($context->file,$element_path,"it was specified the class $function subclass argument after having specified other arguments"); |
return(0); |
return(0); |
} |
} |
if(!$this->GetSubclassArgument(&$compiler,$context->file,$element_path,&$call)) |
if(!$this->GetSubclassArgument($compiler,$context->file,$element_path,$call)) |
return(0); |
return(0); |
$subclass=$call["subclass"]; |
$subclass=$call["subclass"]; |
break; |
break; |
Line 756 class metal_class_class extends metal_ba
|
Line 869 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$element_path,"it was specified the class $function $argument argument more than once"); |
$compiler->SetElementError($context->file,$element_path,"it was specified the class $function $argument argument more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidData($context->file,$element_path,&$call["function"],"it was not specified a valid class $function function argument")) |
if(!$compiler->GetValidData($context->file,$element_path,$call["function"],"it was not specified a valid class $function function argument")) |
return(0); |
return(0); |
$class=$subclass; |
$class=$subclass; |
if(!$this->InheritedFunctionClass(&$class,$call["function"])) |
if(!$this->InheritedFunctionClass($class,$call["function"])) |
{ |
{ |
$compiler->SetElementError($context->file,$element_path,"it was requested to $function a class function (\"".$call["function"]."\") that was not defined"); |
$compiler->SetElementError($context->file,$element_path,"it was requested to $function a class function (\"".$call["function"]."\") that was not defined"); |
return(0); |
return(0); |
Line 771 class metal_class_class extends metal_ba
|
Line 884 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$element_path,"it was not defined the function to call before specifying the $function arguments"); |
$compiler->SetElementError($context->file,$element_path,"it was not defined the function to call before specifying the $function arguments"); |
return(0); |
return(0); |
} |
} |
|
$class=$subclass; |
|
if(!$this->InheritedFunctionClass($class,$call["function"])) |
|
{ |
|
$compiler->SetElementError($context->file,$element_path,"it was requested to $function a class function (\"".$call["function"]."\") that was not defined"); |
|
return(0); |
|
} |
if(!IsSet($this->classes[$class]["functions"][$call["function"]]["Arguments"])) |
if(!IsSet($this->classes[$class]["functions"][$call["function"]]["Arguments"])) |
{ |
{ |
$compiler->SetElementError($context->file,$element_path,"the specified function to $function does not take any arguments"); |
$compiler->SetElementError($context->file,$element_path,"the specified function to $function does not take any arguments"); |
Line 818 class metal_class_class extends metal_ba
|
Line 937 class metal_class_class extends metal_ba
|
} |
} |
$evaluate_context=$context; |
$evaluate_context=$context; |
$evaluate_context->path=$element_path; |
$evaluate_context->path=$element_path; |
if(!$compiler->GetValidExpression(&$evaluate_context,"OBJECT","NOTRIGHT","it was not specified a valid class object expression",1) |
if(!$compiler->GetValidExpression($evaluate_context,"OBJECT","NOTRIGHT","it was not specified a valid class object expression",1) |
|| !$compiler->GetExpressionValue(&$context,&$evaluate_context->result,&$call["object"],&$expression_type)) |
|| !$compiler->GetExpressionValue($context,$evaluate_context->result,$call["object"],$expression_type)) |
return(0); |
return(0); |
break; |
break; |
} |
} |
Line 844 class metal_class_class extends metal_ba
|
Line 963 class metal_class_class extends metal_ba
|
$compiler->SetElementError($file,$path,"it was specified the class object subclass argument more than once"); |
$compiler->SetElementError($file,$path,"it was specified the class object subclass argument more than once"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidData($file,$path,&$subclass,"it was not specified a valid class subclass argument")) |
if(!$compiler->GetValidData($file,$path,$subclass,"it was not specified a valid class subclass argument")) |
return(0); |
return(0); |
if(!IsSet($this->subclasses[$subclass])) |
if(!IsSet($this->subclasses[$subclass])) |
{ |
{ |
Line 868 class metal_class_class extends metal_ba
|
Line 987 class metal_class_class extends metal_ba
|
switch($data["Tag"]) |
switch($data["Tag"]) |
{ |
{ |
case "subclass": |
case "subclass": |
if(!$this->GetSubclassArgument(&$compiler,$arguments->file,$element_path,&$output)) |
if(!$this->GetSubclassArgument($compiler,$arguments->file,$element_path,$output)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 882 class metal_class_class extends metal_ba
|
Line 1001 class metal_class_class extends metal_ba
|
$compiler->SetElementError($arguments->file,$element_path,"it was specified the class scope tag ".$data["Tag"]." more than once"); |
$compiler->SetElementError($arguments->file,$element_path,"it was specified the class scope tag ".$data["Tag"]." more than once"); |
return(0); |
return(0); |
} |
} |
$compiler->CopyEmptyContext(&$arguments,&$tags[$data["Tag"]]); |
$compiler->CopyEmptyContext($arguments,$tags[$data["Tag"]]); |
$tags[$data["Tag"]]->path=$element_path; |
$tags[$data["Tag"]]->path=$element_path; |
break; |
break; |
} |
} |
Line 899 class metal_class_class extends metal_ba
|
Line 1018 class metal_class_class extends metal_ba
|
|
|
Function IterateVariables(&$compiler,&$context,$class,&$variables,$protected,$public,$inherited) |
Function IterateVariables(&$compiler,&$context,$class,&$variables,$protected,$public,$inherited) |
{ |
{ |
|
if(IsSet($this->classes[$class]["parent"])) |
|
{ |
|
$parent=$this->classes[$class]["parent"]; |
|
switch($inherited) |
|
{ |
|
case "0": |
|
$inherit=0; |
|
$current=1; |
|
break; |
|
case "1": |
|
$inherit=1; |
|
$current=0; |
|
break; |
|
case "all": |
|
$inherit=1; |
|
$current=1; |
|
break; |
|
default: |
|
$compiler->SetElementError($context->file,$context->path,"$inherited is not a supported inherited variable type"); |
|
return(0); |
|
} |
|
} |
|
else |
|
{ |
|
$inherit=0; |
|
$current=1; |
|
} |
for($class_variable=0,Reset($this->classes[$class]["variables"]);$class_variable<count($this->classes[$class]["variables"]);Next($this->classes[$class]["variables"]),$class_variable++) |
for($class_variable=0,Reset($this->classes[$class]["variables"]);$class_variable<count($this->classes[$class]["variables"]);Next($this->classes[$class]["variables"]),$class_variable++) |
{ |
{ |
$this->current_class=$class; |
$this->current_class=$class; |
Line 909 class metal_class_class extends metal_ba
|
Line 1055 class metal_class_class extends metal_ba
|
|| ($protected |
|| ($protected |
&& IsSet($this->classes[$class]["variables"][$this->current_variable]["protected"])))) |
&& IsSet($this->classes[$class]["variables"][$this->current_variable]["protected"])))) |
{ |
{ |
if(!$compiler->GetOutputData($context->file,$context->path,&$context->result,"it was not defined valid action for the class variables",1)) |
if($current |
|
&& !$compiler->GetOutputData($context->file,$context->path,$context->result,"it was not defined valid action for the class variables",1)) |
return(0); |
return(0); |
$variables[$this->current_variable]=$class; |
$variables[$this->current_variable]=$class; |
} |
} |
} |
} |
if($inherited |
if($inherit) |
&& IsSet($this->classes[$class]["parent"])) |
return($this->IterateVariables($compiler,$context,$parent,$variables,$protected,$public,$inherited)); |
return($this->IterateVariables($compiler,$context,$this->classes[$class]["parent"],&$variables,$protected,$public,$inherited)); |
|
return(1); |
return(1); |
} |
} |
|
|
Function IterateFunctions(&$compiler,&$context,$class,&$functions,$protected,$public,$inherited) |
Function IterateFunctions(&$compiler,&$context,$class,&$functions,$protected,$public,$inherited) |
{ |
{ |
|
if(IsSet($this->classes[$class]["parent"])) |
|
{ |
|
$parent=$this->classes[$class]["parent"]; |
|
switch($inherited) |
|
{ |
|
case "0": |
|
$inherit=0; |
|
$current=1; |
|
break; |
|
case "1": |
|
$inherit=1; |
|
$current=0; |
|
break; |
|
case "all": |
|
$inherit=1; |
|
$current=1; |
|
break; |
|
default: |
|
$compiler->SetElementError($context->file,$context->path,"$inherited is not a supported inherited function type"); |
|
return(0); |
|
} |
|
if($inherit) |
|
return($this->IterateFunctions($compiler,$context,$parent,$functions,$protected,$public,$inherited)); |
|
} |
|
else |
|
{ |
|
$inherit=0; |
|
$current=1; |
|
} |
for($class_function=0,Reset($this->classes[$class]["functions"]);$class_function<count($this->classes[$class]["functions"]);Next($this->classes[$class]["functions"]),$class_function++) |
for($class_function=0,Reset($this->classes[$class]["functions"]);$class_function<count($this->classes[$class]["functions"]);Next($this->classes[$class]["functions"]),$class_function++) |
{ |
{ |
$this->current_class=$class; |
$this->current_class=$class; |
Line 932 class metal_class_class extends metal_ba
|
Line 1107 class metal_class_class extends metal_ba
|
|| ($protected |
|| ($protected |
&& IsSet($this->classes[$class]["functions"][$this->current_function]["protected"])))) |
&& IsSet($this->classes[$class]["functions"][$this->current_function]["protected"])))) |
{ |
{ |
if(!$compiler->GetOutputData($context->file,$context->path,&$context->result,"it was not defined valid action for the class functions",1)) |
if($current |
|
&& !$compiler->GetOutputData($context->file,$context->path,$context->result,"it was not defined valid action for the class functions",1)) |
return(0); |
return(0); |
$functions[$this->current_function]=$class; |
$functions[$this->current_function]=$class; |
} |
} |
} |
} |
if($inherited |
if($inherit) |
&& IsSet($this->classes[$class]["parent"])) |
return($this->IterateFunctions($compiler,$context,$parent,$functions,$protected,$public,$inherited)); |
return($this->IterateFunctions($compiler,$context,$this->classes[$class]["parent"],&$functions,$protected,$public,$inherited)); |
|
return(1); |
return(1); |
} |
} |
|
|
Line 956 class metal_class_class extends metal_ba
|
Line 1131 class metal_class_class extends metal_ba
|
case "instancevariable": |
case "instancevariable": |
case "instancecall": |
case "instancecall": |
case "call": |
case "call": |
|
case "getproperty": |
|
case "definedproperty": |
|
case "getdocumentation": |
|
case "defineddocumentation": |
|
case "examplecode": |
|
case "new": |
|
case "objectvariable": |
|
case "forallvariables": |
|
case "forallfunctions": |
|
case "variablename": |
|
case "variabletype": |
|
case "variabletypename": |
|
case "definedvariabledefaultvalue": |
|
case "variabledefaultvalue": |
|
case "variableconvertedvalue": |
|
case "functionname": |
|
case "functiontype": |
|
case "functiontypename": |
|
case "functionistype": |
|
case "functionhasarguments": |
|
case "forallarguments": |
|
case "argumentname": |
|
case "argumenttype": |
|
case "argumenttypename": |
|
case "argumentparameter": |
|
case "inargument": |
|
case "outargument": |
|
case "inoutargument": |
|
case "lastargument": |
break; |
break; |
default: |
default: |
$compiler->SetElementError($context->file,$context->path,"$function function of the class class is not implemented for the language ".$compiler->language["name"]); |
$compiler->SetElementError($context->file,$context->path,"$function function of the class class is not implemented for the language ".$compiler->language["name"]); |
Line 982 class metal_class_class extends metal_ba
|
Line 1186 class metal_class_class extends metal_ba
|
switch($data["Tag"]) |
switch($data["Tag"]) |
{ |
{ |
case "subclass": |
case "subclass": |
if(!$this->GetSubclassArgument(&$compiler,$arguments->file,$element_path,&$load)) |
if(!$this->GetSubclassArgument($compiler,$arguments->file,$element_path,$load)) |
return(0); |
return(0); |
break; |
break; |
case "classpointer": |
case "classpointer": |
Line 994 class metal_class_class extends metal_ba
|
Line 1198 class metal_class_class extends metal_ba
|
} |
} |
$evaluate_context=$arguments; |
$evaluate_context=$arguments; |
$evaluate_context->path=$element_path; |
$evaluate_context->path=$element_path; |
if(!$compiler->GetValidExpression(&$evaluate_context,"STRING","NOTRIGHT","it was not specified a valid class load ".$data["Tag"]." variable",1) |
if(!$compiler->GetValidExpression($evaluate_context,"STRING","NOTRIGHT","it was not specified a valid class load ".$data["Tag"]." variable",1) |
|| !$compiler->GetExpressionValue(&$context,&$evaluate_context->result,&$load[$data["Tag"]],&$expression_type)) |
|| !$compiler->GetExpressionValue($context,$evaluate_context->result,$load[$data["Tag"]],$expression_type)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 1086 class metal_class_class extends metal_ba
|
Line 1290 class metal_class_class extends metal_ba
|
} |
} |
break; |
break; |
case "new": |
case "new": |
$new=array(); |
$message=array(); |
$elements=$arguments_code->structure[$arguments->path]["Elements"]; |
$elements=$arguments_code->structure[$arguments->path]["Elements"]; |
for($element=0;$element<$elements;$element++) |
for($element=0;$element<$elements;$element++) |
{ |
{ |
Line 1097 class metal_class_class extends metal_ba
|
Line 1301 class metal_class_class extends metal_ba
|
switch($data["Tag"]) |
switch($data["Tag"]) |
{ |
{ |
case "subclass": |
case "subclass": |
if(!$this->GetSubclassArgument(&$compiler,$arguments->file,$element_path,&$new)) |
if(!$this->GetSubclassArgument($compiler,$arguments->file,$element_path,$message)) |
return(0); |
return(0); |
break; |
break; |
case "classpointer": |
case "classpointer": |
if(IsSet($new[$data["Tag"]])) |
if(IsSet($message[$data["Tag"]])) |
{ |
{ |
$compiler->SetElementError($arguments->file,$element_path,"it was specified the class new ".$data["Tag"]." argument more than once"); |
$compiler->SetElementError($arguments->file,$element_path,"it was specified the class new ".$data["Tag"]." argument more than once"); |
return(0); |
return(0); |
} |
} |
$evaluate_context=$arguments; |
$evaluate_context=$arguments; |
$evaluate_context->path=$element_path; |
$evaluate_context->path=$element_path; |
if(!$compiler->GetValidExpression(&$evaluate_context,"STRING","NOTLEFT","it was not specified a valid class new ".$data["Tag"]." argument",1) |
if(!$compiler->GetValidExpression($evaluate_context,"STRING","NOTLEFT","it was not specified a valid class new ".$data["Tag"]." argument",1) |
|| !$compiler->GetExpressionValue(&$context,&$evaluate_context->result,&$new[$data["Tag"]],&$expression_type)) |
|| !$compiler->GetExpressionValue($context,$evaluate_context->result,$message[$data["Tag"]],$expression_type)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 1123 class metal_class_class extends metal_ba
|
Line 1327 class metal_class_class extends metal_ba
|
return(0); |
return(0); |
} |
} |
} |
} |
$subclass=(IsSet($new["subclass"]) ? $new["subclass"] : 0); |
if(!IsSet($message["subclass"])) |
|
$message["subclass"]=0; |
|
$subclass=$message["subclass"]; |
if(IsSet($this->classes[$subclass]["abstract"])) |
if(IsSet($this->classes[$subclass]["abstract"])) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"an abstract class can not be instanciated"); |
$compiler->SetElementError($context->file,$context->path,"an abstract class can not be instanciated"); |
return(0); |
return(0); |
} |
} |
$context->result[]=array( |
if(!$this->language_bindings->Execute($compiler,$context,$this,$function,$message)) |
"Data"=>array( |
return(0); |
"Object"=>$this->object_name, |
|
"Context"=>$this->classes[$subclass]["name"] |
|
), |
|
"Type"=>"INITIALIZATION" |
|
); |
|
if(IsSet($new["classpointer"])) |
|
$class_name=$new["classpointer"]; |
|
else |
|
{ |
|
$class_name=$this->classes[$subclass]["name"]; |
|
for($class=$subclass;;$class=$this->classes[$class]["parent"]) |
|
{ |
|
$this->classes[$class]["staticload"]=1; |
|
if(!$class) |
|
break; |
|
} |
|
} |
|
$context->result[]=array( |
|
"Data"=>array( |
|
"Value"=>"new $class_name", |
|
"Type"=>"OBJECT", |
|
"Class"=>$this->classes[$subclass]["name"], |
|
"Side"=>"RIGHT" |
|
), |
|
"Type"=>"EXPRESSION" |
|
); |
|
break; |
break; |
case "instancecall": |
case "instancecall": |
case "call": |
case "call": |
$message=array(); |
$message=array(); |
if(!$this->Call(&$compiler,&$arguments_code,&$arguments,&$message,$function) |
if(!$this->Call($compiler,$arguments_code,$arguments,$message,$function) |
|| !$this->Call(&$compiler,&$code,&$context,&$message,$function)) |
|| !$this->Call($compiler,$code,$context,$message,$function)) |
return(0); |
return(0); |
if((strcmp($function,"instancecall") |
if((strcmp($function,"instancecall") |
&& !IsSet($message[$argument="object"])) |
&& !IsSet($message[$argument="object"])) |
Line 1178 class metal_class_class extends metal_ba
|
Line 1358 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$context->path,"an abstract class can not be called"); |
$compiler->SetElementError($context->file,$context->path,"an abstract class can not be called"); |
return(0); |
return(0); |
} |
} |
$this->InheritedFunctionClass(&$message["class"],$message["function"]); |
$this->InheritedFunctionClass($message["class"],$message["function"]); |
$message["argumentlist"]=array(); |
$message["argumentlist"]=array(); |
if(IsSet($this->classes[$message["class"]]["functions"][$message["function"]]["Arguments"])) |
if(IsSet($this->classes[$message["class"]]["functions"][$message["function"]]["Arguments"])) |
{ |
{ |
Line 1207 class metal_class_class extends metal_ba
|
Line 1387 class metal_class_class extends metal_ba
|
$error="it was not specified a valid class function $function argument ".$argument_context["type"]." input/output expression"; |
$error="it was not specified a valid class function $function argument ".$argument_context["type"]." input/output expression"; |
break; |
break; |
} |
} |
if(!$compiler->GetValidExpression(&$evaluate_context,"ANY",$side,$error,0) |
if(!$compiler->GetValidExpression($evaluate_context,"ANY",$side,$error,0) |
|| !$compiler->GetExpressionValue(&$context,&$evaluate_context->result,&$argument_value,&$expression_type)) |
|| !$compiler->GetExpressionValue($context,$evaluate_context->result,$argument_value,$expression_type)) |
return(0); |
return(0); |
if($expression_type=="UNDEFINED" |
if($expression_type=="UNDEFINED" |
&& $side=="NOTRIGHT") |
&& $side=="NOTRIGHT") |
Line 1217 class metal_class_class extends metal_ba
|
Line 1397 class metal_class_class extends metal_ba
|
"DeclarationFile"=>$evaluate_context->file, |
"DeclarationFile"=>$evaluate_context->file, |
"DeclarationPath"=>$evaluate_context->path.",0" |
"DeclarationPath"=>$evaluate_context->path.",0" |
); |
); |
if(!$compiler->QueryVariable(&$context,&$variable)) |
if(!$compiler->QueryVariable($context,$variable)) |
return(0); |
return(0); |
if($variable["Declared"]) |
if($variable["Declared"]) |
{ |
{ |
$variable["Type"]=$argument_context["type"]; |
$variable["Type"]=$argument_context["type"]; |
if(!$compiler->DeclareVariable(&$context,&$variable)) |
$variable["Initialized"]=0; |
|
if(!$compiler->DeclareVariable($context,$variable)) |
return(0); |
return(0); |
if(!$compiler->GetValidExpression(&$evaluate_context,$argument_context["type"],$side,$error,0) |
if(!$compiler->GetValidExpression($evaluate_context,$argument_context["type"],$side,$error,0) |
|| !$compiler->GetExpressionValue(&$context,&$evaluate_context->result,&$argument_value,&$expression_type)) |
|| !$compiler->GetExpressionValue($context,$evaluate_context->result,$argument_value,$expression_type)) |
return(0); |
return(0); |
} |
} |
} |
} |
Line 1247 class metal_class_class extends metal_ba
|
Line 1428 class metal_class_class extends metal_ba
|
$message["argumentlist"][]=$argument_value; |
$message["argumentlist"][]=$argument_value; |
} |
} |
} |
} |
if(!$this->language_bindings->Execute(&$compiler,&$context,&$this,$function,&$message)) |
if(!$this->language_bindings->Execute($compiler,$context,$this,$function,$message)) |
return(0); |
return(0); |
break; |
break; |
case "return": |
case "return": |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,0,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$class,0,$tags)) |
return(0); |
return(0); |
if(!strcmp($this->classes[$class]["return_type"],"")) |
if(!strcmp($this->classes[$class]["return_type"],"")) |
{ |
{ |
Line 1264 class metal_class_class extends metal_ba
|
Line 1445 class metal_class_class extends metal_ba
|
return(0); |
return(0); |
} |
} |
$evaluate_context=$context; |
$evaluate_context=$context; |
if(!$compiler->GetValidExpression(&$evaluate_context,$this->classes[$class]["return_type"],"NOTLEFT","it was not specified a valid class function return ".$this->classes[$class]["return_type"]." expression",1) |
if(!$compiler->GetValidExpression($evaluate_context,$this->classes[$class]["return_type"],"NOTLEFT","it was not specified a valid class function return ".$this->classes[$class]["return_type"]." expression",1) |
|| !$compiler->GetExpressionValue(&$context,&$evaluate_context->result,&$return_value,&$expression_type)) |
|| !$compiler->GetExpressionValue($context,$evaluate_context->result,$return_value,$expression_type)) |
return(0); |
return(0); |
$message=array( |
$message=array( |
"value"=>$return_value |
"value"=>$return_value |
); |
); |
if(!$this->language_bindings->Execute(&$compiler,&$context,&$this,"return",&$message)) |
if(!$this->language_bindings->Execute($compiler,$context,$this,"return",$message)) |
return(0); |
return(0); |
$this->classes[$class]["return_value_set"]=1; |
$this->classes[$class]["return_value_set"]=1; |
break; |
break; |
|
case "instance": |
|
$message=array(); |
|
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$message["class"],0,$tags)) |
|
return(0); |
|
if(!strcmp($this->classes[$message["class"]]["return_type"],"")) |
|
{ |
|
$compiler->SetElementError($context->file,$context->path,"the instance variable is being accessed from outside a class function"); |
|
return(0); |
|
} |
|
if(!$this->language_bindings->Execute($compiler,$context,$this,"instance",$message)) |
|
return(0); |
|
break; |
case "instancevariable": |
case "instancevariable": |
|
case "instancevariableisnotnull": |
|
case "setinstancevariablenull": |
$message=array(); |
$message=array(); |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$message["class"],0,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$message["class"],0,$tags)) |
return(0); |
return(0); |
if(!strcmp($this->classes[$message["class"]]["return_type"],"")) |
if(!strcmp($this->classes[$message["class"]]["return_type"],"")) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"the instance variable is being accessed from outside a class function"); |
$compiler->SetElementError($context->file,$context->path,"the instance variable is being accessed from outside a class function"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($context->file,$context->path,&$message["name"],"it was not specified a valid class variable name")) |
if(!$compiler->GetValidName($context->file,$context->path,$message["name"],"it was not specified a valid class variable name")) |
return(0); |
return(0); |
if(!$this->InheritedVariableClass(&$message["class"],$message["name"])) |
if(!$this->InheritedVariableClass($message["class"],$message["name"])) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"it was not specified a defined class variable name (\"".$message["name"]."\")"); |
$compiler->SetElementError($context->file,$context->path,"it was not specified a defined class variable name (\"".$message["name"]."\")"); |
return(0); |
return(0); |
} |
} |
if(!$this->language_bindings->Execute(&$compiler,&$context,&$this,"instancevariable",&$message)) |
switch($function) |
|
{ |
|
case "instancevariableisnotnull": |
|
case "setinstancevariablenull": |
|
if(IsSet($this->classes[$message["class"]]["variables"][$message["name"]]["notnull"])) |
|
return($compiler->SetElementError($context->file,$context->path,"it was specified a class variable name (\"".$message["name"]."\") that is notnull")); |
|
} |
|
if(!$this->language_bindings->Execute($compiler,$context,$this,$function,$message)) |
return(0); |
return(0); |
break; |
break; |
case "objectvariable": |
case "objectvariable": |
$object_variable=array(); |
$message=array(); |
$elements=$arguments_code->structure[$arguments->path]["Elements"]; |
$elements=$arguments_code->structure[$arguments->path]["Elements"]; |
for($element=0;$element<$elements;$element++) |
for($element=0;$element<$elements;$element++) |
{ |
{ |
Line 1305 class metal_class_class extends metal_ba
|
Line 1507 class metal_class_class extends metal_ba
|
switch($data["Tag"]) |
switch($data["Tag"]) |
{ |
{ |
case "subclass": |
case "subclass": |
if(!$this->GetSubclassArgument(&$compiler,$arguments->file,$element_path,&$object_variable)) |
if(!$this->GetSubclassArgument($compiler,$arguments->file,$element_path,$message)) |
return(0); |
return(0); |
break; |
break; |
case "object": |
case "object": |
if(IsSet($object_variable["object"])) |
if(IsSet($message["object"])) |
{ |
{ |
$compiler->SetElementError($arguments->file,$element_path,"it was specified the class object variable object argument more than once"); |
$compiler->SetElementError($arguments->file,$element_path,"it was specified the class object variable object argument more than once"); |
return(0); |
return(0); |
} |
} |
$evaluate_context=$arguments; |
$evaluate_context=$arguments; |
$evaluate_context->path=$element_path; |
$evaluate_context->path=$element_path; |
if(!$compiler->GetValidExpression(&$evaluate_context,"OBJECT","NOTLEFT","it was not specified a valid class object variable object expression",1) |
if(!$compiler->GetValidExpression($evaluate_context,"OBJECT","NOTLEFT","it was not specified a valid class object variable object expression",1) |
|| !$compiler->GetExpressionValue(&$context,&$evaluate_context->result,&$object_variable["object"],&$expression_type)) |
|| !$compiler->GetExpressionValue($context,$evaluate_context->result,$message["object"],$expression_type)) |
return(0); |
return(0); |
break; |
break; |
default: |
default: |
Line 1331 class metal_class_class extends metal_ba
|
Line 1533 class metal_class_class extends metal_ba
|
return(0); |
return(0); |
} |
} |
} |
} |
if(!IsSet($object_variable["object"])) |
if(IsSet($message["object"])) |
{ |
{ |
$compiler->SetElementError($arguments->file,$arguments->path,"it was not specified the class object variable object argument"); |
if(!$compiler->GetValidName($context->file,$context->path,$name,"it was not specified a valid class variable name")) |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($context->file,$context->path,&$name,"it was not specified a valid class variable name")) |
else |
return(0); |
{ |
$subclass=(IsSet($object_variable["subclass"]) ? $object_variable["subclass"] : 0); |
$values=array(); |
|
$required_types=array( |
|
"object"=>"OBJECT", |
|
"variable"=>"NAME" |
|
); |
|
$optional_types=array(); |
|
if(!$compiler->GetOptionalArgumentValues($context,$values,$required_types,$optional_types,"class",$function,1)) |
|
return(0); |
|
$message["object"]=$values["object"]; |
|
$name=$values["variable"]; |
|
} |
|
if(!IsSet($message["subclass"])) |
|
$message["subclass"]=0; |
|
$subclass=$message["subclass"]; |
if(IsSet($this->classes[$subclass]["abstract"])) |
if(IsSet($this->classes[$subclass]["abstract"])) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"abstract class variables can not be accessed"); |
$compiler->SetElementError($context->file,$context->path,"abstract class variables can not be accessed"); |
return(0); |
return(0); |
} |
} |
if(!$this->InheritedVariableClass(&$subclass,$name)) |
if(!$this->InheritedVariableClass($subclass,$name)) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"it was not specified a defined class variable name (\"$name\")"); |
$compiler->SetElementError($context->file,$context->path,"it was not specified a defined class variable name (\"$name\")"); |
return(0); |
return(0); |
Line 1354 class metal_class_class extends metal_ba
|
Line 1569 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$context->path,"it was attempted to access an object protected variable (\"$name\") from outside the class scope"); |
$compiler->SetElementError($context->file,$context->path,"it was attempted to access an object protected variable (\"$name\") from outside the class scope"); |
return(0); |
return(0); |
} |
} |
$context->result[]=array( |
$message["subclass"]=$subclass; |
"Data"=>array( |
$message["name"]=$name; |
"Value"=>$object_variable["object"]."->$name", |
if(!$this->language_bindings->Execute($compiler,$context,$this,$function,$message)) |
"Type"=>$this->classes[$subclass]["variables"][$name]["type"], |
return(0); |
"Side"=>"BOTH" |
|
), |
|
"Type"=>"EXPRESSION" |
|
); |
|
break; |
break; |
case "functionargument": |
case "functionargument": |
$message=array(); |
$message=array(); |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$message["class"],0,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$message["class"],0,$tags)) |
return(0); |
return(0); |
if(!strcmp($this->classes[$message["class"]]["function_name"],"")) |
if(!strcmp($this->classes[$message["class"]]["function_name"],"")) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"the function argument function is being from called outside a class function"); |
$compiler->SetElementError($context->file,$context->path,"the function argument function is being from called outside a class function"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($context->file,$context->path,&$message["name"],"it was not specified a valid class function argument name")) |
if(!$compiler->GetValidName($context->file,$context->path,$message["name"],"it was not specified a valid class function argument name")) |
return(0); |
return(0); |
if(!IsSet($this->classes[$message["class"]]["functions"][$this->classes[$message["class"]]["function_name"]]["Arguments"][$message["name"]])) |
if(!IsSet($this->classes[$message["class"]]["functions"][$this->classes[$message["class"]]["function_name"]]["Arguments"][$message["name"]])) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"it was specified an unknown class function argument (\"".$message["name"]."\")"); |
$compiler->SetElementError($context->file,$context->path,"it was specified an unknown class function argument (\"".$message["name"]."\")"); |
return(0); |
return(0); |
} |
} |
if(!$this->language_bindings->Execute(&$compiler,&$context,&$this,"functionargument",&$message)) |
if(!$this->language_bindings->Execute($compiler,$context,$this,"functionargument",$message)) |
return(0); |
return(0); |
break; |
break; |
case "output": |
case "output": |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,0,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$class,0,$tags)) |
return(0); |
return(0); |
if(IsSet($this->classes[$class]["abstract"])) |
if(IsSet($this->classes[$class]["abstract"])) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"abstract classes can not be generated"); |
$compiler->SetElementError($context->file,$context->path,"abstract classes can not be generated"); |
return(0); |
return(0); |
} |
} |
if(!strcmp($this->classes[$class]["file"],"")) |
|
{ |
|
$compiler->SetElementError($context->file,$context->path,"it was not specified the class output file"); |
|
return(0); |
|
} |
|
$message=array( |
$message=array( |
"class"=>$class, |
"class"=>$class, |
"result"=>array(), |
"result"=>array(), |
"initialization"=>array() |
"initialization"=>array() |
); |
); |
if(!$this->language_bindings->Execute(&$compiler,&$context,&$this,"output",&$message) |
if(!$this->language_bindings->Execute($compiler,$context,$this,"output",$message) |
|| !$compiler->GenerateOutput(&$context,&$message["result"],&$output,"",0) |
|| !$compiler->GenerateOutput($context,$message["result"],$output,"",0) |
|| !$compiler->CreateContextOutputDirectory(dirname($this->classes[$class]["file"]),&$context,"it was not possible to create the directory for the class output file \"".dirname($this->classes[$class]["file"])."\"")) |
|| !$compiler->CreateContextOutputDirectory(dirname($this->classes[$class]["file"]),$context,"it was not possible to create the directory for the class output file \"".dirname($this->classes[$class]["file"])."\"")) |
return(0); |
return(0); |
if(!($output_file=@fopen($this->classes[$class]["file"],"w"))) |
if(!($output_file=@fopen($this->classes[$class]["file"],"w"))) |
{ |
{ |
Line 1426 class metal_class_class extends metal_ba
|
Line 1632 class metal_class_class extends metal_ba
|
); |
); |
break; |
break; |
case "subclass": |
case "subclass": |
if(!$this->SetupClass(&$compiler,&$arguments_code,&$arguments)) |
if(!$this->SetupClass($compiler,$arguments_code,$arguments)) |
return(0); |
return(0); |
break; |
break; |
case "getproperty": |
case "getproperty": |
case "definedproperty": |
case "definedproperty": |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,0,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$class,0,$tags)) |
return(0); |
return(0); |
if(!$compiler->GetValidName($context->file,$context->path,&$property,"it was not specified a valid class property name")) |
if(!$compiler->GetValidName($context->file,$context->path,$property,"it was not specified a valid class property name")) |
return(0); |
return(0); |
switch($property) |
switch($property) |
{ |
{ |
Line 1482 class metal_class_class extends metal_ba
|
Line 1688 class metal_class_class extends metal_ba
|
return(0); |
return(0); |
} |
} |
break; |
break; |
case "definetypes": |
|
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,0,$tags)) |
|
return(0); |
|
$elements=$code->structure[$context->path]["Elements"]; |
|
for($element=0;$element<$elements;$element++) |
|
{ |
|
$element_path=$context->path.",$element"; |
|
$data=$code->structure[$element_path]; |
|
if(GetType($data)=="array") |
|
{ |
|
switch($data["Tag"]) |
|
{ |
|
case "VOID": |
|
case "STRING": |
|
case "INTEGER": |
|
case "FLOAT": |
|
case "BOOLEAN": |
|
case "OBJECT": |
|
case "ARRAY": |
|
case "HASH": |
|
if(IsSet($this->classes[$class]["types"][$data["Tag"]])) |
|
{ |
|
$compiler->SetElementError($context->file,$element_path,"it was defined the class data type \"".$data["Tag"]."\" more than once"); |
|
return(0); |
|
} |
|
if(!$compiler->GetValidData($context->file,$element_path,&$type,"it was not specified a valid class data type option")) |
|
return(0); |
|
$type_name=$data["Tag"]; |
|
$this->classes[$class]["types"][$type_name]=$type; |
|
$parent=$class; |
|
while(IsSet($this->classes[$parent]["parent"])) |
|
{ |
|
$parent=$this->classes[$parent]["parent"]; |
|
$this->classes[$parent]["types"][$type_name]=$type; |
|
} |
|
break; |
|
default: |
|
$compiler->SetElementError($context->file,$element_path,"it was not defined a valid class data type"); |
|
return(0); |
|
} |
|
} |
|
else |
|
{ |
|
if(!$compiler->CheckWhiteSpace($context->file,$data,$element_path)) |
|
return(0); |
|
} |
|
} |
|
break; |
|
case "forallfunctions": |
case "forallfunctions": |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,1,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$class,1,$tags)) |
return(0); |
return(0); |
if(IsSet($tags["idiom"]) |
if(IsSet($tags["idiom"]) |
&& !$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,&$idiom,"it was not specified a valid class documentation idiom tag")) |
&& !$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,$idiom,"it was not specified a valid class documentation idiom tag")) |
return(0); |
return(0); |
$protected=$public=1; |
$protected=$public=1; |
$inherited=0; |
$inherited=0; |
if(IsSet($tags["protected"])) |
if(IsSet($tags["protected"])) |
{ |
{ |
if(!$compiler->GetValidData($tags["protected"]->file,$tags["protected"]->path,&$value,"it was not specified a valid class function public value")) |
if(!$compiler->GetValidData($tags["protected"]->file,$tags["protected"]->path,$value,"it was not specified a valid class function public value")) |
return(0); |
return(0); |
switch($value) |
switch($value) |
{ |
{ |
Line 1558 class metal_class_class extends metal_ba
|
Line 1716 class metal_class_class extends metal_ba
|
} |
} |
if(IsSet($tags["public"])) |
if(IsSet($tags["public"])) |
{ |
{ |
if(!$compiler->GetValidData($tags["public"]->file,$tags["public"]->path,&$value,"it was not specified a valid class function public value")) |
if(!$compiler->GetValidData($tags["public"]->file,$tags["public"]->path,$value,"it was not specified a valid class function public value")) |
return(0); |
return(0); |
switch($value) |
switch($value) |
{ |
{ |
Line 1576 class metal_class_class extends metal_ba
|
Line 1734 class metal_class_class extends metal_ba
|
} |
} |
if(IsSet($tags["inherited"])) |
if(IsSet($tags["inherited"])) |
{ |
{ |
if(!$compiler->GetValidData($tags["inherited"]->file,$tags["inherited"]->path,&$value,"it was not specified a valid class function inherited value")) |
if(!$compiler->GetValidData($tags["inherited"]->file,$tags["inherited"]->path,$value,"it was not specified a valid class function inherited value")) |
return(0); |
return(0); |
switch($value) |
switch($value) |
{ |
{ |
case "1": |
case "1": |
case "": |
case "": |
$inherited=1; |
$inherited="1"; |
break; |
break; |
case "0": |
case "0": |
$inherited=0; |
$inherited="0"; |
|
break; |
|
case "all": |
|
$inherited="all"; |
break; |
break; |
default: |
default: |
$compiler->SetElementError($tags["inherited"]->file,$tags["inherited"]->path,"it was not specified a valid class function inherited value"); |
$compiler->SetElementError($tags["inherited"]->file,$tags["inherited"]->path,"it was not specified a valid class function inherited value"); |
Line 1600 class metal_class_class extends metal_ba
|
Line 1761 class metal_class_class extends metal_ba
|
"functionhasarguments", |
"functionhasarguments", |
"forallarguments" |
"forallarguments" |
); |
); |
if(!$compiler->AddContextFunctions(&$context,$this->object_name,&$functions,&$level)) |
if(!$compiler->AddContextFunctions($context,$this->object_name,$functions,$level)) |
return(0); |
return(0); |
$current_class=$this->current_class; |
$current_class=$this->current_class; |
$current_function=$this->current_function; |
$current_function=$this->current_function; |
Line 1608 class metal_class_class extends metal_ba
|
Line 1769 class metal_class_class extends metal_ba
|
$success=$this->IterateFunctions($compiler,$context,$class,$functions,$protected,$public,$inherited); |
$success=$this->IterateFunctions($compiler,$context,$class,$functions,$protected,$public,$inherited); |
$this->current_class=$current_class; |
$this->current_class=$current_class; |
$this->current_function=$current_function; |
$this->current_function=$current_function; |
if(!$compiler->RemoveContextFunctions(&$context,$this->object_name,$level) |
if(!$success |
|| !$success) |
|| !$compiler->RemoveContextFunctions($context,$this->object_name,$level)) |
return(0); |
return(0); |
break; |
break; |
case "forallvariables": |
case "forallvariables": |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,1,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$class,1,$tags)) |
return(0); |
return(0); |
if(IsSet($tags["idiom"]) |
if(IsSet($tags["idiom"]) |
&& !$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,&$idiom,"it was not specified a valid class documentation idiom tag")) |
&& !$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,$idiom,"it was not specified a valid class documentation idiom tag")) |
return(0); |
return(0); |
$protected=$public=1; |
$protected=$public=1; |
$inherited=0; |
$inherited=0; |
if(IsSet($tags["protected"])) |
if(IsSet($tags["protected"])) |
{ |
{ |
if(!$compiler->GetValidData($tags["protected"]->file,$tags["protected"]->path,&$value,"it was not specified a valid class variable public value")) |
if(!$compiler->GetValidData($tags["protected"]->file,$tags["protected"]->path,$value,"it was not specified a valid class variable public value")) |
return(0); |
return(0); |
switch($value) |
switch($value) |
{ |
{ |
Line 1640 class metal_class_class extends metal_ba
|
Line 1801 class metal_class_class extends metal_ba
|
} |
} |
if(IsSet($tags["public"])) |
if(IsSet($tags["public"])) |
{ |
{ |
if(!$compiler->GetValidData($tags["public"]->file,$tags["public"]->path,&$value,"it was not specified a valid class variable public value")) |
if(!$compiler->GetValidData($tags["public"]->file,$tags["public"]->path,$value,"it was not specified a valid class variable public value")) |
return(0); |
return(0); |
switch($value) |
switch($value) |
{ |
{ |
Line 1658 class metal_class_class extends metal_ba
|
Line 1819 class metal_class_class extends metal_ba
|
} |
} |
if(IsSet($tags["inherited"])) |
if(IsSet($tags["inherited"])) |
{ |
{ |
if(!$compiler->GetValidData($tags["inherited"]->file,$tags["inherited"]->path,&$value,"it was not specified a valid class variable inherited value")) |
if(!$compiler->GetValidData($tags["inherited"]->file,$tags["inherited"]->path,$value,"it was not specified a valid class variable inherited value")) |
return(0); |
return(0); |
switch($value) |
switch($value) |
{ |
{ |
case "1": |
case "1": |
case "": |
case "": |
$inherited=1; |
$inherited="1"; |
break; |
break; |
case "0": |
case "0": |
$inherited=0; |
$inherited="0"; |
|
break; |
|
case "all": |
|
$inherited="all"; |
break; |
break; |
default: |
default: |
$compiler->SetElementError($tags["inherited"]->file,$tags["inherited"]->path,"it was not specified a valid class variable inherited value"); |
$compiler->SetElementError($tags["inherited"]->file,$tags["inherited"]->path,"it was not specified a valid class variable inherited value"); |
Line 1682 class metal_class_class extends metal_ba
|
Line 1846 class metal_class_class extends metal_ba
|
"variabledefaultvalue", |
"variabledefaultvalue", |
"variableconvertedvalue" |
"variableconvertedvalue" |
); |
); |
if(!$compiler->AddContextFunctions(&$context,$this->object_name,&$functions,&$level)) |
if(!$compiler->AddContextFunctions($context,$this->object_name,$functions,$level)) |
return(0); |
return(0); |
$current_class=$this->current_class; |
$current_class=$this->current_class; |
$current_variable=$this->current_variable; |
$current_variable=$this->current_variable; |
Line 1690 class metal_class_class extends metal_ba
|
Line 1854 class metal_class_class extends metal_ba
|
$success=$this->IterateVariables($compiler,$context,$class,$variables,$protected,$public,$inherited); |
$success=$this->IterateVariables($compiler,$context,$class,$variables,$protected,$public,$inherited); |
$this->current_class=$current_class; |
$this->current_class=$current_class; |
$this->current_variable=$current_variable; |
$this->current_variable=$current_variable; |
if(!$compiler->RemoveContextFunctions(&$context,$this->object_name,$level) |
if(!$success |
|| !$success) |
|| !$compiler->RemoveContextFunctions($context,$this->object_name,$level)) |
return(0); |
return(0); |
break; |
break; |
case "forallarguments": |
case "forallarguments": |
Line 1701 class metal_class_class extends metal_ba
|
Line 1865 class metal_class_class extends metal_ba
|
return(0); |
return(0); |
} |
} |
if(IsSet($tags["idiom"]) |
if(IsSet($tags["idiom"]) |
&& !$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,&$idiom,"it was not specified a valid class documentation idiom tag")) |
&& !$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,$idiom,"it was not specified a valid class documentation idiom tag")) |
return(0); |
return(0); |
$current_class=$this->current_class; |
$current_class=$this->current_class; |
$current_function=$this->current_function; |
$current_function=$this->current_function; |
Line 1713 class metal_class_class extends metal_ba
|
Line 1877 class metal_class_class extends metal_ba
|
"argumenttype", |
"argumenttype", |
"argumenttypename", |
"argumenttypename", |
"argumentparameter", |
"argumentparameter", |
|
"inargument", |
|
"outargument", |
|
"inoutargument", |
"lastargument" |
"lastargument" |
); |
); |
if(!$compiler->AddContextFunctions(&$context,$this->object_name,&$functions,&$level)) |
if(!$compiler->AddContextFunctions($context,$this->object_name,$functions,$level)) |
return(0); |
return(0); |
for($this->current_argument_number=0,Reset($this->classes[$current_class]["functions"][$current_function]["Arguments"]);$this->current_argument_number<count($this->classes[$current_class]["functions"][$current_function]["Arguments"]);Next($this->classes[$current_class]["functions"][$current_function]["Arguments"]),$this->current_argument_number++) |
for($this->current_argument_number=0,Reset($this->classes[$current_class]["functions"][$current_function]["Arguments"]);$this->current_argument_number<count($this->classes[$current_class]["functions"][$current_function]["Arguments"]);Next($this->classes[$current_class]["functions"][$current_function]["Arguments"]),$this->current_argument_number++) |
{ |
{ |
$this->current_class=$current_class; |
$this->current_class=$current_class; |
$this->current_function=$current_function; |
$this->current_function=$current_function; |
$this->current_argument=Key($this->classes[$current_class]["functions"][$current_function]["Arguments"]); |
$this->current_argument=Key($this->classes[$current_class]["functions"][$current_function]["Arguments"]); |
if(!$compiler->GetOutputData($context->file,$context->path,&$context->result,"it was not defined valid action for the class function arguments",0)) |
if(!$compiler->GetOutputData($context->file,$context->path,$context->result,"it was not defined valid action for the class function arguments",0)) |
{ |
{ |
$this->current_class=$current_class; |
$this->current_class=$current_class; |
$this->current_function=$current_function; |
$this->current_function=$current_function; |
Line 1733 class metal_class_class extends metal_ba
|
Line 1900 class metal_class_class extends metal_ba
|
$this->current_class=$current_class; |
$this->current_class=$current_class; |
$this->current_function=$current_function; |
$this->current_function=$current_function; |
$this->current_argument=$current_argument; |
$this->current_argument=$current_argument; |
if(!$compiler->RemoveContextFunctions(&$context,$this->object_name,$level)) |
if(!$compiler->RemoveContextFunctions($context,$this->object_name,$level)) |
return(0); |
return(0); |
break; |
break; |
case "forallparentclasses": |
case "forallparentclasses": |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,1,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$class,1,$tags)) |
return(0); |
return(0); |
if(IsSet($tags["idiom"]) |
if(IsSet($tags["idiom"]) |
&& !$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,&$idiom,"it was not specified a valid class documentation idiom tag")) |
&& !$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,$idiom,"it was not specified a valid class documentation idiom tag")) |
return(0); |
return(0); |
$functions=array(); |
$functions=array(); |
if(!$compiler->AddContextFunctions(&$context,$this->object_name,&$functions,&$level)) |
if(!$compiler->AddContextFunctions($context,$this->object_name,$functions,$level)) |
return(0); |
return(0); |
$current_class=$this->current_class; |
$current_class=$this->current_class; |
$this->current_class=$class; |
$this->current_class=$class; |
Line 1751 class metal_class_class extends metal_ba
|
Line 1918 class metal_class_class extends metal_ba
|
while(IsSet($this->classes[$this->current_class]["parent"])) |
while(IsSet($this->classes[$this->current_class]["parent"])) |
{ |
{ |
$this->current_class=$this->classes[$this->current_class]["parent"]; |
$this->current_class=$this->classes[$this->current_class]["parent"]; |
if(!($success=$compiler->GetOutputData($context->file,$context->path,&$context->result,"it was not defined valid action for the class parentclasses",0))) |
if(!($success=$compiler->GetOutputData($context->file,$context->path,$context->result,"it was not defined valid action for the class parentclasses",0))) |
break; |
break; |
} |
} |
$this->current_class=$current_class; |
$this->current_class=$current_class; |
if(!$compiler->RemoveContextFunctions(&$context,$this->object_name,$level) |
if(!$success |
|| !$success) |
|| !$compiler->RemoveContextFunctions($context,$this->object_name,$level)) |
return(0); |
return(0); |
break; |
break; |
case "getdocumentation": |
case "getdocumentation": |
case "defineddocumentation": |
case "defineddocumentation": |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,1,$tags)) |
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$class,1,$tags)) |
return(0); |
return(0); |
if(!IsSet($tags["idiom"])) |
if(!IsSet($tags["idiom"])) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"it was not specified the class documentation idiom"); |
$compiler->SetElementError($context->file,$context->path,"it was not specified the class documentation idiom"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,&$idiom,"it was not specified a valid class documentation idiom tag")) |
if(!$compiler->GetValidName($tags["idiom"]->file,$tags["idiom"]->path,$idiom,"it was not specified a valid class documentation idiom tag")) |
return(0); |
return(0); |
if(!$compiler->GetValidName($context->file,$context->path,&$tag,"it was not specified a valid class documentation tag")) |
if(!$compiler->GetValidName($context->file,$context->path,$tag,"it was not specified a valid class documentation tag")) |
return(0); |
return(0); |
$inherited=0; |
$inherited=0; |
if(IsSet($tags["inherited"])) |
if(IsSet($tags["inherited"])) |
{ |
{ |
if(!$compiler->GetValidData($tags["inherited"]->file,$tags["inherited"]->path,&$value,"it was not specified a valid class function inherited value")) |
if(!$compiler->GetValidData($tags["inherited"]->file,$tags["inherited"]->path,$value,"it was not specified a valid class function inherited value")) |
return(0); |
return(0); |
switch($value) |
switch($value) |
{ |
{ |
Line 1806 class metal_class_class extends metal_ba
|
Line 1973 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$context->path,"it was requested the value of a documentation tag (\"$tag\") that is not defined for the specified class function argument"); |
$compiler->SetElementError($context->file,$context->path,"it was requested the value of a documentation tag (\"$tag\") that is not defined for the specified class function argument"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetOutputData($this->classes[$class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["documentation"][$idiom][$tag]->file,$this->classes[$class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["documentation"][$idiom][$tag]->path,&$context->result,"it was not defined valid class function argument documentation tag",0)) |
if(!$compiler->GetOutputData($this->classes[$class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["documentation"][$idiom][$tag]->file,$this->classes[$class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["documentation"][$idiom][$tag]->path,$context->result,"it was not defined valid class function argument documentation tag",0)) |
return(0); |
return(0); |
} |
} |
else |
else |
Line 1834 class metal_class_class extends metal_ba
|
Line 2001 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$context->path,"it was requested the value of a documentation tag (\"$tag\") that is not defined for the specified class function"); |
$compiler->SetElementError($context->file,$context->path,"it was requested the value of a documentation tag (\"$tag\") that is not defined for the specified class function"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetOutputData($this->classes[$class]["functions"][$this->current_function]["documentation"][$idiom][$tag]->file,$this->classes[$class]["functions"][$this->current_function]["documentation"][$idiom][$tag]->path,&$context->result,"it was not defined valid class function argument documentation tag",0)) |
if(!$compiler->GetOutputData($this->classes[$class]["functions"][$this->current_function]["documentation"][$idiom][$tag]->file,$this->classes[$class]["functions"][$this->current_function]["documentation"][$idiom][$tag]->path,$context->result,"it was not defined valid class function argument documentation tag",0)) |
return(0); |
return(0); |
} |
} |
else |
else |
Line 1862 class metal_class_class extends metal_ba
|
Line 2029 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$context->path,"it was requested the value of a documentation tag (\"$tag\") that is not defined for the specified class variable"); |
$compiler->SetElementError($context->file,$context->path,"it was requested the value of a documentation tag (\"$tag\") that is not defined for the specified class variable"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetOutputData($this->classes[$class]["variables"][$this->current_variable]["documentation"][$idiom][$tag]->file,$this->classes[$class]["variables"][$this->current_variable]["documentation"][$idiom][$tag]->path,&$context->result,"it was not defined valid class variable argument documentation tag",0)) |
if(!$compiler->GetOutputData($this->classes[$class]["variables"][$this->current_variable]["documentation"][$idiom][$tag]->file,$this->classes[$class]["variables"][$this->current_variable]["documentation"][$idiom][$tag]->path,$context->result,"it was not defined valid class variable argument documentation tag",0)) |
return(0); |
return(0); |
} |
} |
else |
else |
Line 1882 class metal_class_class extends metal_ba
|
Line 2049 class metal_class_class extends metal_ba
|
$compiler->SetElementError($context->file,$context->path,"it was requested the value of a documentation tag (\"$tag\") that is not defined for the specified class"); |
$compiler->SetElementError($context->file,$context->path,"it was requested the value of a documentation tag (\"$tag\") that is not defined for the specified class"); |
return(0); |
return(0); |
} |
} |
if(!$compiler->GetOutputData($this->classes[$class]["documentation"][$idiom][$tag]->file,$this->classes[$class]["documentation"][$idiom][$tag]->path,&$context->result,"it was not defined valid class documentation tag",0)) |
if(!$compiler->GetOutputData($this->classes[$class]["documentation"][$idiom][$tag]->file,$this->classes[$class]["documentation"][$idiom][$tag]->path,$context->result,"it was not defined valid class documentation tag",0)) |
return(0); |
return(0); |
} |
} |
else |
else |
Line 1915 class metal_class_class extends metal_ba
|
Line 2082 class metal_class_class extends metal_ba
|
$value=$this->classes[$this->current_class]["functions"][$this->current_function]["type"]; |
$value=$this->classes[$this->current_class]["functions"][$this->current_function]["type"]; |
break; |
break; |
case "functiontypename": |
case "functiontypename": |
$value=$this->classes[$this->current_class]["functions"][$this->current_function]["type"]; |
$message=array("type"=>$this->classes[$this->current_class]["functions"][$this->current_function]["type"]); |
if(IsSet($this->classes[$this->current_class]["types"][$value])) |
if(!$this->language_bindings->Execute($compiler,$context,$this,"typename",$message)) |
$value=$this->classes[$this->current_class]["types"][$value]; |
return(0); |
|
$value=$message["name"]; |
break; |
break; |
case "functionistype": |
case "functionistype": |
if(!$compiler->GetValidData($context->file,$context->path,&$type,"it was not specified a valid class function return type")) |
if(!$compiler->GetValidData($context->file,$context->path,$type,"it was not specified a valid class function return type")) |
return(0); |
return(0); |
switch($type) |
switch(strtok($type,":")) |
{ |
{ |
case "VOID": |
case "VOID": |
case "STRING": |
case "STRING": |
Line 1952 class metal_class_class extends metal_ba
|
Line 2120 class metal_class_class extends metal_ba
|
case "argumenttype": |
case "argumenttype": |
case "argumenttypename": |
case "argumenttypename": |
case "argumentparameter": |
case "argumentparameter": |
|
case "inargument": |
|
case "outargument": |
|
case "inoutargument": |
case "lastargument": |
case "lastargument": |
if(!strcmp($this->current_argument,"")) |
if(!strcmp($this->current_argument,"")) |
{ |
{ |
Line 1967 class metal_class_class extends metal_ba
|
Line 2138 class metal_class_class extends metal_ba
|
$value=$this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["type"]; |
$value=$this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["type"]; |
break; |
break; |
case "argumenttypename": |
case "argumenttypename": |
$value=$this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["type"]; |
$message=array("type"=>$this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["type"]); |
if(IsSet($this->classes[$this->current_class]["types"][$value])) |
if(!$this->language_bindings->Execute($compiler,$context,$this,"typename",$message)) |
$value=$this->classes[$this->current_class]["types"][$value]; |
return(0); |
|
$value=$message["name"]; |
break; |
break; |
case "argumentparameter": |
case "argumentparameter": |
$value=$this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["parameter"]; |
$value=$this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["parameter"]; |
break; |
break; |
|
case "inargument": |
|
$value=($this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["parameter"]=="in" ? "1" : "0"); |
|
break; |
|
case "outargument": |
|
$value=($this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["parameter"]=="out" ? "1" : "0"); |
|
break; |
|
case "inoutargument": |
|
$value=($this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"][$this->current_argument]["parameter"]=="inout" ? "1" : "0"); |
|
break; |
case "lastargument": |
case "lastargument": |
$value=($this->current_argument_number+1==count($this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"]) ? "1" : "0"); |
$value=($this->current_argument_number+1==count($this->classes[$this->current_class]["functions"][$this->current_function]["Arguments"]) ? "1" : "0"); |
break; |
break; |
Line 2003 class metal_class_class extends metal_ba
|
Line 2184 class metal_class_class extends metal_ba
|
$value=$this->classes[$this->current_class]["variables"][$this->current_variable]["type"]; |
$value=$this->classes[$this->current_class]["variables"][$this->current_variable]["type"]; |
break; |
break; |
case "variabletypename": |
case "variabletypename": |
$value=$this->classes[$this->current_class]["variables"][$this->current_variable]["type"]; |
$message=array("type"=>$this->classes[$this->current_class]["variables"][$this->current_variable]["type"]); |
if(IsSet($this->classes[$this->current_class]["types"][$value])) |
if(!$this->language_bindings->Execute($compiler,$context,$this,"typename",$message)) |
$value=$this->classes[$this->current_class]["types"][$value]; |
return(0); |
|
$value=$message["name"]; |
break; |
break; |
case "definedvariabledefaultvalue": |
case "definedvariabledefaultvalue": |
$value=(IsSet($this->classes[$this->current_class]["variables"][$this->current_variable]["value"]) ? "1" : "0"); |
$value=(IsSet($this->classes[$this->current_class]["variables"][$this->current_variable]["value"]) ? "1" : "0"); |
Line 2033 class metal_class_class extends metal_ba
|
Line 2215 class metal_class_class extends metal_ba
|
); |
); |
break; |
break; |
case "examplecode": |
case "examplecode": |
if(!$this->GetClassScope(&$compiler,&$arguments_code,&$arguments,&$class,1,$tags)) |
$message=array(); |
|
if(!$this->GetClassScope($compiler,$arguments_code,$arguments,$class,1,$tags)) |
return(0); |
return(0); |
$result=array(); |
$result=array(); |
if(!$compiler->GetOutputData($context->file,$context->path,&$result,"invalid example code",1)) |
if(!$compiler->StartScope($context,$scope,"global") |
|
|| !$compiler->GetOutputData($context->file,$context->path,$message["result"],"invalid example code",1) |
|
|| !$compiler->GetScopeVariables($context,$scope,$message["variables"]) |
|
|| !$compiler->GetScopeExceptions($context,$scope,$message["exceptions"]) |
|
|| !$compiler->EndScope($context,$scope)) |
return(0); |
return(0); |
$initialization=1; |
$initialization=1; |
if(IsSet($tags["initialization"])) |
if(IsSet($tags["initialization"])) |
{ |
{ |
if(!$compiler->GetValidData($tags["initialization"]->file,$tags["initialization"]->path,&$value,"it was not specified a valid class example code initialization value")) |
if(!$compiler->GetValidData($tags["initialization"]->file,$tags["initialization"]->path,$value,"it was not specified a valid class example code initialization value")) |
return(0); |
return(0); |
switch($value) |
switch($value) |
{ |
{ |
case "1": |
case "1": |
case "": |
case "": |
$initialization=1; |
$message["initialization"]=1; |
break; |
break; |
case "0": |
case "0": |
$initialization=0; |
$message["initialization"]=0; |
break; |
break; |
default: |
default: |
$compiler->SetElementError($tags["initialization"]->file,$tags["initialization"]->path,"it was not specified a valid class example code initialization value"); |
$compiler->SetElementError($tags["initialization"]->file,$tags["initialization"]->path,"it was not specified a valid class example code initialization value"); |
return(0); |
return(0); |
} |
} |
} |
} |
if($initialization) |
if(!$this->language_bindings->Execute($compiler,$context,$this,$function,$message)) |
{ |
return(0); |
if(!$compiler->GenerateOutput(&$context,&$result,&$output,"",0)) |
|
return(0); |
|
} |
|
else |
|
{ |
|
for($stripped=array(),$part=0;$part<count($result);$part++) |
|
{ |
|
switch($result[$part]["Type"]) |
|
{ |
|
case "INITIALIZATION": |
|
break; |
|
default: |
|
$stripped[]=$result[$part]; |
|
break; |
|
} |
|
} |
|
if(!$compiler->GenerateOutput(&$context,&$stripped,&$output,"",0)) |
|
return(0); |
|
} |
|
$context->result[]=array( |
|
"Data"=>$output, |
|
"Type"=>"DATA" |
|
); |
|
break; |
break; |
default: |
default: |
$compiler->SetElementError($context->file,$context->path,$function." is not a supported class object function"); |
$compiler->SetElementError($context->file,$context->path,$function." is not a supported class object function"); |
Line 2101 class metal_class_class extends metal_ba
|
Line 2265 class metal_class_class extends metal_ba
|
if(IsSet($this->classes[$class]["abstract"])) |
if(IsSet($this->classes[$class]["abstract"])) |
{ |
{ |
$compiler->SetElementError($context->file,$context->path,"abstract class functions arguments can not be accessed"); |
$compiler->SetElementError($context->file,$context->path,"abstract class functions arguments can not be accessed"); |
return(0); |
return(0); |
} |
} |
for($parent=$class;$parent!=0 && !IsSet($this->classes[$parent=$this->classes[$parent]["parent"]]["abstract"]);) |
for($parent=$class;$parent!=0 && !IsSet($this->classes[$parent=$this->classes[$parent]["parent"]]["abstract"]);) |
{ |
{ |
Line 2118 class metal_class_class extends metal_ba
|
Line 2282 class metal_class_class extends metal_ba
|
for(Reset($this->classes[$class]["functions"]),$function=0;$function<count($this->classes[$class]["functions"]);$function++,Next($this->classes[$class]["functions"])) |
for(Reset($this->classes[$class]["functions"]),$function=0;$function<count($this->classes[$class]["functions"]);$function++,Next($this->classes[$class]["functions"])) |
{ |
{ |
$name=Key($this->classes[$class]["functions"]); |
$name=Key($this->classes[$class]["functions"]); |
if(!$this->GenerateFunction(&$compiler,$class,$name)) |
if(!$this->GenerateFunction($compiler,$class,$name)) |
return(0); |
return(0); |
for($part=0;$part<count($this->classes[$class]["functions"][$name]["do"]["code"]);$part++) |
for($part=0;$part<count($this->classes[$class]["functions"][$name]["do"]["code"]);$part++) |
{ |
{ |
Line 2131 class metal_class_class extends metal_ba
|
Line 2295 class metal_class_class extends metal_ba
|
} |
} |
} |
} |
} |
} |
$relative_path=$compiler->RelativePath($this->classes[$class]["basepath"],$this->classes[$class]["file"]); |
$relative_path=(IsSet($this->classes[$class]["basepath"]) ? $compiler->RelativePath($this->classes[$class]["basepath"],$this->classes[$class]["file"]) : $this->classes[$class]["file"]); |
$context->result[]=array( |
$context->result[]=array( |
"Data"=>array( |
"Data"=>array( |
"Name"=>$this->classes[$class]["file"], |
"Name"=>$this->classes[$class]["file"], |
Line 2154 class metal_class_class extends metal_ba
|
Line 2318 class metal_class_class extends metal_ba
|
"result"=>array(), |
"result"=>array(), |
"initialization"=>array() |
"initialization"=>array() |
); |
); |
if(!$this->language_bindings->Execute(&$compiler,&$context,&$this,"output",&$message)) |
if(!$this->language_bindings->Execute($compiler,$context,$this,"output",$message)) |
return(0); |
return(0); |
for($part=0;$part<count($message["initialization"]);$part++) |
for($part=0;$part<count($message["initialization"]);$part++) |
$context->result[]=$message["initialization"][$part]; |
$context->result[]=$message["initialization"][$part]; |