~registry/texmacs/trunk

« back to all changes in this revision

Viewing changes to src/TeXmacs/examples/plugins/substitute/src/substitute.cpp

  • Committer: mgubi
  • Date: 2009-06-04 15:13:41 UTC
  • Revision ID: svn-v4:64cb5145-927a-446d-8aed-2fb7b4773692:trunk:2717
Support for X11 TeXmacs.app on Mac

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/******************************************************************************
 
3
* MODULE     : substitute.cpp
 
4
* DESCRIPTION: Use plugins in an invisible way: substitute selections
 
5
*              by their evaluations (see ../progs/init-substitute.scm)
 
6
* COPYRIGHT  : (C) 2003  Joris van der Hoeven
 
7
*******************************************************************************
 
8
* This software falls under the GNU general public license version 3 or later.
 
9
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
 
10
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
 
11
******************************************************************************/
 
12
 
 
13
#include <stdio.h>
 
14
#include <iostream.h>
 
15
 
 
16
#define DATA_BEGIN   ((char) 2)
 
17
#define DATA_END     ((char) 5)
 
18
#define DATA_ESCAPE  ((char) 27)
 
19
 
 
20
int
 
21
main () {
 
22
  cout << DATA_BEGIN << "verbatim:";
 
23
  cout << "An interactive LaTeX -> TeXmacs translator\n";
 
24
  cout << "Can also be used outside sessions: select a LaTeX expression\n";
 
25
  cout << "and press C-F12\n";
 
26
  cout << DATA_END;
 
27
  fflush (stdout);
 
28
 
 
29
  while (true) {
 
30
    char buffer[100];
 
31
    cin.getline (buffer, 100, '\n');
 
32
    cout << DATA_BEGIN;
 
33
    cout << "latex:$" << buffer << "$";
 
34
    cout << DATA_END;
 
35
    fflush (stdout);
 
36
  }
 
37
  return 0;
 
38
}