|
From: Martin S. <kv...@us...> - 2018-05-05 13:18:59
|
Hi, I have only tested this stuff (for CCL, CLISP, SBCL) under ReactOS, that is open-source Win-alike. It works for me according to MS spec though. I implemented it for TGM Minima; it should be similar for any other GUI. I had to do some stuff for that: 1) open console in GUI, since console is shared/inherited on process spawning; and the targeted process has to have a console for these events. 2) hide the console in GUI (not necessary but it looks strange otherwise) 3) start Maxima directly (that is via its Lisp, not via batch!), otherwise cmd.exe (that interprets the batch) intercepts the CTRL-C event. 4) call SetConsoleCtrlHandler in GUI to prevent the GUI to end on the events. 5) now GUI can issue GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0) It works for me without any threading in Lisp, and without use of winkill.exe either. YMMV. Best, M. PS Since TGM Minima is coded in Tcl/Tk, I use TWAPI for it, and generally for MS-Win-related stuff, like checking CPU usage of Maxima. TWAPI has a good documentation: http://twapi.magicsplat.com/ > Dear all, > > td;lr: If we could make a clisp-compiled maxima react to the > CTRL_C_EVENT window sends on encountering a Ctrl+C press we could tell > wxMaxima to interrupt the current command on a Ctrl+G press. > > I would need help in creating a Ctrl+C handler, though. > > > The long version of the story: > > If on a Linux system the user presses Ctrl+G wxMaxima and Xmaxima send a > SIGINT signal to maxima - and maxima aborts the current command. > > On Windows there is no such signal. But maxima comes with a utility > named winkill.exe that writes to a shared memory location maxima offers. > The sbcl and the gcl flavour of maxima by setting an environment > variable can be instructed to create a 2nd thread that polls this memory > location and interrupts the current calculation on incoming signals. > > As the lisps evolve that might no more be necessary: If winkill.exe > would issue an > > GenerateConsoleCtrlEvent(CTRL_C_EVENT, m_pid) > > an sbcl-based maxima would receive a keyboard interrupt and interrupt > the current program. Unfortunately I cannot test if the same is true > with maxima-gcl. > > If maxima is compiled with clisp on linux it reacts to a SIGINT caused > by a Ctrl+C press. On windows it currently doesn't, though. If I issue a > CTRL_BREAK_EVENT instead clisp crashes. Which might be feature that > falls back to an eventual debugger. > > > Does any of you know if there is a way to make clisp react to the > CTRL_C_EVENT on Windows? > > Thanks a lot, > and kind regards, > > Gunter. > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Maxima-discuss mailing list > Max...@li... > https://lists.sourceforge.net/lists/listinfo/maxima-discuss > |