User Tools

Site Tools


next_copy_next_constant_item_to_targets_.htm
Navigation:  ABC Library Reference > ConstantClass > ConstantClass Methods >====== Next (copy next constant item to targets) C6H0009.jpg ====== Previous pageReturn to chapter overviewNext page

Next( ), PROC

blk2blue.jpg

The Next method copies the next constant item to its respective targets (as defined by the AddItem method) and returns a value indicating whether the item was copied. A return value of Level:Benign indicates the item was copied successfully; a return value of Level:Notify indicates the item was not copied because the end of the constant data, as defined by the Init method, was reached.

Prior calls to the AddItem method determine the makeup of the item as well as the target variables that receive the item.

Implementation:

The Next method parses a single item in the constant data, performing any required datatype conversions, and increments appropriate internal counters.

Return Data Type:     BYTE

Example:

Spanish   GROUP        !declare constant data

Items     BYTE(50)     !item count

      PSTRING('One')  !begin first item

      PSTRING('Uno')

      PSTRING('Two')  !begin second item

      PSTRING('Dos')

      !48 more PSTRING pairs

     END

Const  ConstantClass      !declare & instantiate Const object

Text  CSTRING(255),AUTO   !a variable to receive a constant value

Repl  CSTRING(255),AUTO   !a variable to receive a constant value

CODE

!process items one-at-a-time

Const.Init(Term:BYTE)    !initialize the Const object,

                         ! the first BYTE contains item count

Const.AddItem(ConstType:PString, Text)!Describe constant structure and

Const.AddItem(ConstType:PString, Repl)! variables to accept the values

Const.Set(Spanish)                    !pass the constant data to Const object

LOOP WHILE Const.Next()=Level:Benign  !copy constant data one item at a time

 !do something with Text and Repl     ! to respective AddItem target variables

END

Const.Kill                            !shut down Const object

See Also:     AddItem, Init, Next

next_copy_next_constant_item_to_targets_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1