of_findmatchingvariable


pfcapsrv.pbl   >   pfc_n_cst_metaclass   >   of_findmatchingvariable   

Full name pfc_n_cst_metaclass.of_findmatchingvariable
Access public
Extend of variabledefinition
Return value variabledefinition
Prototype public function variabledefinition of_findmatchingvariable(scriptdefinition,string)

Name Datatype
No Data

Name Datatype
lb_found boolean
li_cnt int
li_variables int
lvrd_arg variabledefinition[]
lvrd_local variabledefinition[]
lvrd_object variabledefinition

public function variabledefinition of_findmatchingvariable (scriptdefinition ascrd_object, string as_varname);//////////////////////////////////////////////////////////////////////////////
//
//	Function:
//	of_findMatchingVariable
//
//	Access:
//	public
//
//	Arguments:
//	ascrd_object	scriptdefinition reference for variables that are to be found
//	as_varname		variable name to find definition for
//
//	Returns:
//	variabledefinition
//	If varname is not found for ascrd_object or ascrd_object is invalid, returns NULL
//
//	Description:
//	Returns a variabledefinition for the passed in variable name and scriptdefinition reference.
//	This function will look for the variable in both local variables and arguments.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	6.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

boolean	lb_found
int		li_variables
int		li_cnt = 1
variabledefinition	lvrd_object
variabledefinition	lvrd_local[]
variabledefinition	lvrd_arg[]

setNull (lvrd_object)

// Verify script definition
if not isValid (ascrd_object) or isNull (ascrd_object) then
	return lvrd_object
end if

// Check for matching variable in arguments
lvrd_arg[] = ascrd_object.argumentList[]
li_variables = upperBound (lvrd_arg[])
do while li_cnt <= li_variables and not lb_found
	if ascrd_object.argumentList[li_cnt].name = as_varname then
		lb_found = true
	else
		li_cnt++
	end if
loop
if lb_found then
	return ascrd_object.argumentList[li_cnt]
else
	li_cnt = 1
end if

// Check for matching variable in local variables
lvrd_local[] = ascrd_object.localVariableList[]
li_variables = upperBound (lvrd_local[])
do while li_cnt <= li_variables and not lb_found
	if ascrd_object.localVariableList[li_cnt].name = as_varname then
		lb_found = true
	else
		li_cnt++
	end if
loop
if lb_found then
	lvrd_object = ascrd_object.localVariableList[li_cnt]
end if

return lvrd_object
end function

     
Name Owner
No Data

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.setnull systemfunctions
systemfunctions.upperbound systemfunctions

     
Full name
No Data

     
Name Scope
No Data