of_addhead


pfcapsrv.pbl   >   pfc_n_cst_linkedlistbase   >   of_addhead   

Full name pfc_n_cst_linkedlistbase.of_addhead
Access protected
Extend of integer
Return value integer
Prototype protected function integer of_addhead(n_cst_linkedlistnode)

Name Datatype
No Data

Name Datatype
No Data

protected function integer of_addhead (n_cst_linkedlistnode anv_newheadnode);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_AddHead
//
//	Access:  protected
//
//	Arguments : 
//	anv_newheadnode  The node to be added to the list as the new Head node.
//
//	Returns:  integer
//	1 = success
//	-1 = failure
//
//	Description:  
//	Adds a new node to the Head of the linked list.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

// Validate arguments.
if isnull(anv_newheadnode) or not isvalid(anv_newheadnode) then 
	return -1
end if

// See if this is the first node.
if isnull(inv_head) or not isvalid(inv_head) then
	// This is the first node, so there is no previous or next pointers.
	anv_newheadnode.of_setnext(inv_nil)
	anv_newheadnode.of_setprev(inv_nil)  
	// Point the head and tail pointers.
	inv_head = anv_newheadnode
	inv_tail = inv_head
	return 1
end if

// -- Add as the new Head Node. -- 

// Set the About to be New Head Next pointer to point to the Current Head.
anv_newheadnode.of_setnext(inv_head)

// Head nodes never have a previous pointer.
anv_newheadnode.of_setprev(inv_nil) 

// Set the current Head previous pointer to the About to be New Head node.
inv_head.of_setprev(anv_newheadnode)

// Replace the current Head reference with the New Head node.
inv_head = anv_newheadnode
		
return 1
end function

     
Name Owner
pfc_n_cst_stack.of_push pfc_n_cst_stack
pfc_n_cst_linkedlistbase.of_addtail pfc_n_cst_linkedlistbase
pfc_n_cst_list.of_addhead pfc_n_cst_list
pfc_n_cst_list.of_add pfc_n_cst_list

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
pfc_n_cst_nodebase.of_setprev pfc_n_cst_nodebase
pfc_n_cst_nodebase.of_setnext pfc_n_cst_nodebase

     
Full name
No Data

     
Name Scope
No Data