WSMARK (C Function)

is a WSTP type representing a mark in the expression stream.

Details

  • WSMARK is defined in the file wstp.h, which should be included in the source code for any WSTP-compatible program.

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);
}