Lines Matching refs:link
11 static PetscErroCode setupConnection(MLENV *env, MLINK *link, const char *linkhost, LinkMode linkmo… in setupConnection() argument
46 *link = MLOpenInEnv(*env, argc, argv, &lerr); in setupConnection()
60 static PetscErrorCode processPacket(MLINK link, int indent, int *result) in processPacket() argument
63 int tokenType = MLGetNext(link); in processPacket()
74 MLGetArgCount(link, &numArguments); in processPacket()
78 PetscCall(processPacket(link, indent + 4, result)); in processPacket()
83 for (arg = 0; arg < numArguments; arg++) PetscCall(processPacket(link, indent + 4)); in processPacket()
88 MLGetSymbol(link, &symbol); in processPacket()
91 MLDisownSymbol(link, symbol); in processPacket()
95 MLDisownSymbol(link, symbol); in processPacket()
100 MLGetInteger(link, &i); in processPacket()
106 MLGetReal(link, &r); in processPacket()
112 MLGetString(link, &string); in processPacket()
114 MLDisownString(link, string); in processPacket()
118 MLClearError(link); in processPacket()
119 fprintf(stderr, "ERROR: %s\n", (char *)MLErrorMessage(link)); in processPacket()
126 static PetscErrorCode processPackets(MLINK link) in processPackets() argument
135 while ((packetType = MLNextPacket(link)) && (packetType != RETURNPKT)) { in processPackets()
198 MLNewPacket(link); in processPackets()
203 MLClearError(link); in processPackets()
204 printf("ERROR: %s\n", (char *)MLErrorMessage(link)); in processPackets()
207 PetscCall(processPacket(link, result)); in processPackets()
218 static PetscErrorCode cleanupConnection(MLENV env, MLINK link) in cleanupConnection() argument
221 MLClose(link); in cleanupConnection()
229 MLINK link; in main() local
232 PetscCall(setupConnection(&env, &link, "192.168.119.1", MATHEMATICA_LINK_CONNECT)); in main()
233 PetscCall(processPackets(link)); in main()
234 PetscCall(cleanupConnection(env, link)); in main()