WSSeekToMark (C Function)

WSMARK WSSeekToMark(WSLINK link,WSMARK mark,int n)

goes to the position n expressions after the specified mark on a link.

Details

  • WSSeekToMark() returns (WSMARK)0 in the event of an error and mark otherwise.
  • WSSeekToMark() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* look ahead in the expression stream on a link and reset */

void f(WSLINK lp)
{
    WSMARK mark;
    
    mark = WSCreateMark(lp);
    if(mark == (WSMARK)0)
        { /* unable to create mark in the stream on lp */ }

    /* now peek ahead and see what is coming */
    switch(WSGetNext(lp))
    {
        case WSTKINT:
            /* integer data */
        case WSTKREAL:
            /* floating-point data */
    }

    /* now restore to the original point */
    mark = WSSeekToMark(lp, mark, 0);
    if(mark == (WSMARK)0)
        { /* unable to seek to the mark position in lp */ }

    WSDestroyMark(lp, mark);
}