WSCreateMark (C Function)

WSMARK WSCreateMark(WSLINK link)

creates a mark at the current position in a sequence of expressions on a link.

Details

  • Calling WSCreateMark()creates a bookmark in the expression stream on the link. This mark allows you to return to the marked point in the expression stream at a later time. WSCreateMark() effectively starts recording the expressions on the link.
  • WSCreateMark() returns (WSMARK)0 in the event of an error.
  • WSCreateMark() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* check for a ReturnPacket and go back in the expression stream if necessary */

void f(WSLINK lp)
{
    WSMARK mark;
    int args;

    mark = WSCreateMark(lp);
    if(mark == (WSMARK)0)
        { /* mark creation failed */ }

    if(! WSTestHead(lp, "ReturnPacket", args))
        {
            WSSeekToMark(lp, mark, 0);
            WSDestroyMark(lp, mark);
        }
    else
        { /* read the ReturnPacket[] */ }
}