[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 SAVETOKEN()
 Saves the incremental tokenizer environment to a variable
------------------------------------------------------------------------------
 Syntax

     SAVETOKEN() --> cTokenEnvironment

 Returns

     The character string returned contains the internal environment for the
     incremental tokenizer.

 Description

     By saving and later restoring the internal tokenizer environment, an
     interlocking implementation of the incremental tokenizer is made simple.
     The complete, previously initialized string is saved, as are the
     internal pointers and the corresponding file areas.  This string serves
     as a return value for SAVETOKEN(), regardless of the later restoration
     of the tokenizer environment using RESTTOKEN().

 Note

     .  The returned value is only valid for the currently running
        program because it is concerned with internal pointers.

 Examples

     .  Here is an incremental tokenizer.  Text is broken into
        individual lines, and each line is broken into words:

        TOKENINIT(@cTextString, CHR(13) + CHR(10), 2)

        DO WHILE .NOT. TOKENEND()
           cLine   :=  TOKENNEXT(cTextString)
           WORD(cLine)
        ENDDO

     .  The function then breaks the lines into words:

        FUNCTION WORD(cLine)
              cOldEnv  := SAVETOKEN()
              TOKENINIT(@cLine, " .,-:;")
              cWord  := TOKENNEXT()

              DO WHILE .NOT. TOKENEND()
                 cWord := TOKENNEXT(cLine)
                 ? cWord
              ENDDO
              RESTTOKEN(cOldEnv)

              RETURN("")


See Also: RESTTOKEN() TOKENINIT() TOKENNEXT()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson