MLGetUTF8Function (C 函数)

MLGetUTF8Function 已经被 WSGetUTF8Function 所取代.

int WLGetUTF8Function( MLINK l , const unsigned char ** s , int * v , int * n )

gets a function with a symbol as a head encoded in the UTF-8 encoding form from the MathLink connection specified by l, storing the name of the symbol in s, the length of the UTF-8 codes in v, and the number of arguments of the function in n.

更多信息

  • MLGetUTF8Function() allocates memory for the character string corresponding to the name of the head of the function. You must call MLReleaseUTF8Symbol() to disown this memory. If MLGetUTF8Function() fails and the function's return value indicates an error, do not call MLReleaseUTF8Symbol() on the contents of s.
  • Programs should not modify the contents of the character string s.
  • WLGetUTF8Function(l, &s, &v, &n) has the same effect as WLGetNext(l); MLGetArgCount(l, &n); MLGetUTF8Symbol(l, &s, &v, &c), where c is the number of characters encoded in s.
  • MLGetUTF8Function() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetUTF8Function() fails.
  • MLGetUTF8Function() is declared in the MathLink header file mathlink.h.

范例

基本范例  (1)

#include "mathlink.h"

/* A function for reading a Mathematica function from a link */

void f(MLINK l)
{
    unsigned char *s;
    int length;
    int n;

    if(! MLGetUTF8Function(l, &s, &length, &n))
    { /* Unable to read the function from the link */ }

    /* ... */

    MLReleaseUTF8Symbol(l, s, length);
}