<\body> The configuration and the compilation of the plug-in is in the chapter about plug-ins. We will now study the source file . Essentially, the routine is given by <\cpp-code> int main () { \ \ \ \ while (true) { \ \ \ \ \ \ \ \ \ \ } \ \ return 0; } By default, just send a -terminated string to the application as the input. Consequently, the code for > is given by <\cpp-code> char buffer[100]; cin.getline (buffer, 100, '\\n'); The output part is more complicated, since needs to have a secure way for knowing whether the output has finished. This is accomplished by encapsulating each piece of output (in our case both the display banner and the interactive output) inside a block of the form <\quotation> :>> Here and stand for special control characters: <\cpp-code> #define DATA_BEGIN \ \ ((char) 2) #define DATA_END \ \ \ \ ((char) 5) #define DATA_ESCAPE \ ((char) 27) The is used for producing the and characters in the > using the rewriting rules <\quotation> <\framed-fragment> <\with|font-family|tt> >|>>|>>|>|>>|>>|>|>>|>>>>> The > specifies the format of the >. For instance, in our example, the code of > is given by <\cpp-code> cout \\ DATA_BEGIN \\ "verbatim:"; cout \\ "Hi there!"; cout \\ DATA_END; cout.flush (); Similarly, the code of > is given by <\cpp-code> cout \\ DATA_BEGIN \\ "verbatim:"; cout \\ "You typed " \\ buffer; cout \\ DATA_END; cout.flush (); <\remark> For synchronization purposes, will assume that the output is finished as soon as it encounters the which closes the initial . So all output has to be inside one outer - block: if you send more blocks, then will retake control before reading all your output. It possible to nest - blocks though, as we will see below. <\remark> In our example, the code for the application is included in the plug-in. In the case when you are writing a interface for an existing application >, the convention is to create a option for this program. Then it is no longer necessary to have /src> and /bin> directories for your plug-in and it suffices to configure the plug-in by putting something like the following in /progs/init-.scm>: <\scm-code> (plugin-configure \ \ (:require (url-exists-in-path? "")) \ \ (:launch " --texmacs") \ \ (:session "")) In the case when you do not have the possibility to modify the source code of >, you typically have to write an input/output filter > for performing the appropriate rewritings. By looking at the standard plug-ins distributed with in <\verbatim> \ \ \ \ $TEXMACS_PATH/plugins you can find several examples of how this can be done. <\initial> <\collection>