MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Mathlink problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16758] Mathlink problem
  • From: tobiasoed at my-dejanews.com
  • Date: Wed, 24 Mar 1999 02:24:01 -0500
  • Organization: Deja News - The Leader in Internet Discussion
  • Sender: owner-wri-mathgroup at wolfram.com

Hi all ! I am still working on a terminal like interface for mathematica, and
still having problems. At this point in order to understand what is going on
on the link my programm does the following: Whenever there is something on
the link if(MLFlush(link) && MLReady(link)){..}, I retrieve what there is
using MLGetNext, MLGetInteger, etc. and print it to the screen. (I purposly
do not use MLNewPacket, and MLNextPacket). Also when a line is ready, I send
it wrapped in TextPacket or EnterTextPacket. The main trouble are interrupts:
When my prog gets a SIGINT, I use MLPutMessage(link,InterruptMessage).
Unfortunately MLPutMessage is not documented, but seems to have the same
effect as sending an Interrupt message to the kernel process (using kill-s
SIGINT). Two situations occur: -The kernel is not evaluating (waiting for
input): nothing happens until I send something to which the kernel answers
with two MENUPKTs and a TEXTPKT containing the options of the interrupt menu.
I'd rather have a single MENUPKT as answer. -The kernel is evaluating (or
sending stuff back to me): I immediatly get a single MENUPKT (which is fine).
If I answer something different that what the kernel expects, I get a new
MENUPKT followed by a TEXTPKT containg the different options (which is fine
too). If I answer abort, continue or inspect, everyting works OK (except for
a missing newline characters in a TEXTPKT following a MESSAGEPKT). But if I
try to trace or show, nothing works anymore: I get 3 TEXTPACKETS followed by
a MLTKERROR. Here is an example

InputNamePacket[In[1]:= ]
FactorInteger[2^177-1]
Got an interrupt
MenuPacket[1, Interrupt> ]
s
TextPacket[factoring (Pollard rho method)
]
TextPacket[long multiplication
]
TextPacket[long multiplication
]

Got an error while draining the expression
Got an error on the link: Error 999

Got an error while draining the expression
Got an error on the link: link died
Unable to clear the error

What the hell am I supposed to do to avoid this problem ?

Thanks Tobias

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


  • Prev by Date: Plotting multiple outputs from cpu intensive function
  • Next by Date: Re: Re: Commutators and Operator Powers in Mathematica
  • Previous by thread: Re: Plotting multiple outputs from cpu intensive function
  • Next by thread: All digits of Fibonacci number using implicit calculation method