MLNextPacket (C Function)
MLNextPacket has been replaced by WSNextPacket.
int MLNextPacket(MLINK link)
goes to the next packet on link and returns a constant to indicate its head.
Details
- The following packets can be returned:
-
BEGINDLGPKT BeginDialogPacket[integer] start a dialog subsession referenced by integer CALLPKT CallPacket[integer,list] request to invoke the external function numbered integer with arguments list DISPLAYENDPKT DisplayEndPacket[] obsolete PostScript graphics-related packet DISPLAYPKT DisplayPacket[] obsolete PostScript graphics-related packet ENDDLGPKT EndDialogPacket[integer] end the dialog subsession referenced by integer ENTEREXPRPKT EnterExpressionPacket[expr] evaluate expr ENTERTEXTPKT EnterTextPacket[string] parse string and evaluate as an expression EVALUATEPKT EvaluatePacket[expr] evaluate expr while avoiding the kernel main loop INPUTNAMEPKT InputNamePacket[string] name to be assigned to the next input (usually In[n]:=) INPUTPKT InputPacket[] prompt for input, as generated by the Wolfram Language's Input[] function INPUTSTRPKT InputStringPacket[] request input as a string MENUPKT MenuPacket[integer,string] menu request with title string MESSAGEPKT MessagePacket[symbol,string] Wolfram Language message identifier (symbol::string) OUTPUTNAMEPKT OutputNamePacket[string] name to be assigned to the next output (usually Out[n]=) RESUMEPKT ResumePacket[] obsolete packet RETURNEXPRPKT ReturnExpressionPacket[expr] result of EnterExpressionPacket[] evaluation RETURNPKT ReturnPacket[expr] result of a calculation RETURNTEXTPKT ReturnTextPacket[string] formatted text representation of a result SUSPENDPKT SuspendPacket[] obsolete packet SYNTAXPKT SyntaxPacket[integer] position at which a syntax error was detected in the input line TEXTPKT TextPacket[string] text output from the Wolfram Language, as produced by Print[] - MLNextPacket() returns ILLEGALPKT in the event of an error. mathlink.h defines ILLEGALPKT as 0.
- MLNextPacket() is declared in the MathLink header file mathlink.h.
Examples
Basic Examples (1)
#include "mathlink.h"
/* read the type of the incoming packet on a link */
void f(MLINK lp)
{
switch(MLNextPacket(lp))
{
case CALLPKT:
/* read the CallPacket[] */
break;
case EVALUATEPKT:
/* read the EvaluatePacket[] */
break;
case RETURNPKT:
/* read the EvaluatePacket[] */
/* ... */
case ILLEGALPKT:
/* unable to read the next packet from lp */
}
}