I am evaluating expression by using KernelLink
.
But the kernel will be suspended endless when meets a invalid escape character. a\abc
, \[badEscape]
for example.
So I have to filter all the invalid escape characters programmingly.
Is there a way to get all valid escape characters in Mathematica? \[Beta]
,\[Alpha]
and so forth.
This is possibly caused by not all packets are read off properly
I will show the Mathematica code bellowd that you could test easily.
I'm using EnterTextPacket
function(which communicates through WSTP) to talk with KernelLink. You could find refercence here
The first case evaluates 10!
, and works well
link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["10!"]]
LinkRead[link]
LinkRead[link]
LinkRead[link](*the last package*)
LinkClose[link]
we could see the last LinkRead[link]
returned In[2]:=
indicates all packages read off.
The next case evaluates \[BadEscape]
causes packages returned with endless. LinkRead[link]
returned Syntax Err
continuously.
link = LinkLaunch[First[$CommandLine] <> " -wstp"]
LinkRead[link]
LinkWrite[link, EnterTextPacket["\[BadEscape]"]]
LinkRead[link]
LinkRead[link]
LinkRead[link]
....
(*endless*)
So I think this must be the problem. Does this make sense ?