WSSeekToMark (C 函数)

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

进入链接中在指定标记之后位置 n 的表达式.

更多信息

  • 若发生错误,则 WSSeekToMark() 返回 (WSMARK)0,否则为 mark.
  • WSTP 的标头文件 wstp.h 已对 WSSeekToMark() 作出声明.

范例

基本范例  (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);
}