Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>savetoken()</b> http://www.X-Hacker.org [<<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()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson