|
of_register
|
|
Full name
|
pfc_n_cst_mru.of_register
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_register(string,integer)
|
Name
|
Datatype
|
li_cnt
|
Integer
|
li_newentry
|
Integer
|
li_openslot
|
Integer
|
li_position
|
Integer
|
li_upper
|
Integer
|
public function integer of_register (string as_id, integer ai_itemcount);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_Register
//
// Access: public
//
// Arguments:
// as_id name of the id to register with the service
// ab_itemcount number of mru items to remember for this object
//
// Returns: integer
// SUCCESS = 1
// ERROR = -1
// Already registered = 0
//
// Description: register an id with the service to store mru information
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
Integer li_cnt, li_upper, li_openslot, li_newentry
Integer li_position
// check for valid values
if IsNull(as_id) or (as_id = "") or &
IsNull(ai_itemcount) or (ai_itemcount < 1) Then
Return -1
end if
// Trim and Convert the ID to lower case.
as_id = Trim(Lower(as_id))
// do not register if already registered and no information changed
li_position = of_GetRegistered(as_id)
if li_position > 0 then
If inv_register[li_position].is_id = as_id AND &
inv_register[li_position].ii_itemcount = ai_itemcount Then
Return 0
end if
// registered but info is changing
inv_register[li_position].is_id = as_id
inv_register[li_position].ii_itemcount = ai_itemcount
Else
// not registered so find place to add it to
li_upper = upperbound(inv_register)
// Find an open slot (if any).
For li_cnt = 1 to li_upper
If inv_register[li_cnt].is_id = "" Then
// Open slot has been found.
li_openslot = li_cnt
Exit
End If
Next
// Determine the new entry slot.
If li_openslot > 0 Then
li_newentry = li_openslot
Else
li_newentry = li_upper + 1
End If
// add the entry to the location
inv_register[li_newentry].is_id = as_id
inv_register[li_newentry].ii_itemcount = ai_itemcount
end if
Return 1
end function
Name
|
Owner
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.lower |
systemfunctions
|
systemfunctions.trim |
systemfunctions
|
systemfunctions.upperbound |
systemfunctions
|
pfc_n_cst_mru.of_getregistered |
pfc_n_cst_mru
|