4.35.4 Controlling the swipl-win (Epilog) console window
The SWI-Prolog package xpce
provides the SWI-Prolog GUI capabilities. Part of it is a console window
that provides a menu, called Epilog. If Prolog is started using swipl-win,
it starts as a GUI application running the Prolog REPL loop in an Epilog
window. SWI-Prolog allows opening multiple such console windows, each
running the REPL loop in a new thread. New Epilog windows can be started
from several menus in the GUI as well as using the predicate epilog/0.
- epilog
- pen a new Epilog console. SWI-Prolog creates a new thread that runs the REPL loop and has its input and output connected to the new console.
- epilog(+Options)
- Open an Epilog console with additional Options.
- title(+String)
- Set the window title.
- rows(+Integer)
- Height of the initial terminal in lines (default 25).
- cols(+Integer)
- Width of the initial terminal in characters (default 80).
- init(:Goal)
- Run Goal as initialization goal. Default calls version/0 for the first and true/0 for subsequent terminals.
- goal(:Goal)
- Run Goal as REPL loop. Default runs prolog/0.
- main(+Bool)
- If
true, act as application main window. In this case epilog/1 runs the main thread and returns after all windows have been closed.
- set_epilog(+Option)
- Modify the Epilog console attached to the calling thread. Option is one
of:
- title(+Title)
- foreground(+Color)
- background(+Color)
- selection_foreground(+Color)
- selection_background(+Color)
- menu(+Label, +Before)
- Add a new popup to the Epilog menu. The popus is added before Before. If Before is ‘-`, the new popup is added to the right.
- menu_item(+PopupName, +Item, +Before, :Goal)
-
Insert an item in the Epilog console menu. PopupName is the popup in which to insert the item. Item is the name for the new item. If Item is
--, a separator is inserted. Before is the name of the item before which to insert the new item. If this is, the item is appended.-Goal is injected into the current terminal of the Epilog window. This implies that we assume that the console is waiting for the user. Eventually, we probably want a more flexible solution.
This predicate raises
existence_error(epilog, Thread)if the (calling) thread has no attached Epilog window. Threads are started in an Epilog window have the Prolog flag console_menu set totrue.