MoveFromId (Stringlist subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
Line 1: Line 1:
<span style="font-size:120%"><b>Move data from $list to Stringlist</b></span>
{{Template:Stringlist:MoveFromId subtitle}}


This method moves data ($list items) from a $list to a Stringlist. MoveFromId is a subroutine that accepts one argument: the $list identifier of the $list from which data is to be moved. For more information about $list identifiers, see the ''Sirius Functions Reference Manual''.
This method moves data ($list items) from a $list to a Stringlist. MoveFromId is a subroutine that accepts one argument: the $list identifier of the $list from which data is to be moved. For more information about $list identifiers, see the ''Sirius Functions Reference Manual''.
Line 5: Line 5:
MoveFromId is a member of the [[Stringlist class]].
MoveFromId is a member of the [[Stringlist class]].


==MoveFromId Syntax==
==Syntax==
<pre>
{{Template:Stringlist:MoveFromId syntax}}
%sl:MoveFromId(listid)
===Syntax terms===
</pre>
 
===Syntax Terms===
<dl>
<dl>
<dt>%sl
<dt>%sl
Line 16: Line 13:
</dl>
</dl>


==Usage Notes==
==Usage notes==
<ul><li>All errors in MoveFromId result in request cancellation.<li>After the MovefromId method is invoked, the source $list is empty, though the $list identifier is still valid.<li>MoveFromId discards the original contents of the method Stringlist.<li>The MoveFromId method copies to the method Stringlist any image association that is set via $listimg.<li>MoveFromid simply moves the pointers to the $list data to the object Stringlist. It does '''not''' actually perform any data movement; therefore, it is extremely efficient.<li>MoveFromid is intended to facilitate migration to Stringlists of existing applications that use $lists. For example, suppose complex subroutine Summarize takes a $list identifier as its input parameter. Further suppose that the subroutine is rewritten to use Stringlists rather than $lists.  
<ul><li>All errors in MoveFromId result in request cancellation.<li>After the MovefromId method is invoked, the source $list is empty, though the $list identifier is still valid.<li>MoveFromId discards the original contents of the method Stringlist.<li>The MoveFromId method copies to the method Stringlist any image association that is set via $listimg.<li>MoveFromid simply moves the pointers to the $list data to the object Stringlist. It does '''not''' actually perform any data movement; therefore, it is extremely efficient.<li>MoveFromid is intended to facilitate migration to Stringlists of existing applications that use $lists. For example, suppose complex subroutine Summarize takes a $list identifier as its input parameter. Further suppose that the subroutine is rewritten to use Stringlists rather than $lists.  
The following code illustrates how this can be accomplished:
The following code illustrates how this can be accomplished:

Revision as of 19:50, 31 December 2010

Move data from $list to Stringlist (Stringlist class)


This method moves data ($list items) from a $list to a Stringlist. MoveFromId is a subroutine that accepts one argument: the $list identifier of the $list from which data is to be moved. For more information about $list identifiers, see the Sirius Functions Reference Manual.

MoveFromId is a member of the Stringlist class.

Syntax

sl:MoveFromId( listId)

Syntax terms

%sl
A Stringlist object.
listid
The $list identifier of the $list from which data is to be moved.

Usage notes

  • All errors in MoveFromId result in request cancellation.
  • After the MovefromId method is invoked, the source $list is empty, though the $list identifier is still valid.
  • MoveFromId discards the original contents of the method Stringlist.
  • The MoveFromId method copies to the method Stringlist any image association that is set via $listimg.
  • MoveFromid simply moves the pointers to the $list data to the object Stringlist. It does not actually perform any data movement; therefore, it is extremely efficient.
  • MoveFromid is intended to facilitate migration to Stringlists of existing applications that use $lists. For example, suppose complex subroutine Summarize takes a $list identifier as its input parameter. Further suppose that the subroutine is rewritten to use Stringlists rather than $lists. The following code illustrates how this can be accomplished:
    subroutine summarize(%listId is float)
    %list is object stringList
    %list = new
    %list:moveFromid(%listId)
    ...
    %list:moveToid(%listId)
    return
    

    Of course, if the subroutine "forgets" to restore the input $list contents with MoveToId, the input $list remains empty at the end of the subroutine. Stringlists should always be used in preference to $lists, so MoveFromId is provided only for the migration of existing $list applications to the use of Stringlists.