WSMARK (C 函数)

是一个表示在表达式流中的标记的 WSTP 类型.

更多信息

  • wstp.h 文件定义了 WSMARK,它应该被包含在任何 WSTP 兼容程序的源代码中.

范例

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