WSTestSymbol (C Function)

int WSTestSymbol(WSLINK l, const char *s)

tests that the next expression on the WSTP connection specified by l is a symbol with the value s.

Details

  • WSTestSymbol() fails if the current expression on the link l is not a symbol, or if the value of the symbol does not match s.
  • WSTestSymbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSTestSymbol() fails.
  • WSTestSymbol() will reset the stream pointer to the expression on the link just prior to calling WSTestSymbol()if the function fails. This operation behaves as if the programmer called WSCreateMark(link); MSTestSymbol(); MSSeekToMark().
  • WSTestSymbol() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* A function for testing the next expression on the link for a symbol */

void f(WSLINK l)
{
    if(! WSTestSymbol(l, "List"))
    { /* The next expression on the link is not List */ }
    else
    { /* The next expression on the link is List */ }
}