Back to index

texmacs  1.0.7.15
prompt.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : prompt.cpp
00004 * DESCRIPTION: Shows how to produce prompts
00005 * COPYRIGHT  : (C) 2003  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #include <iostream>
00013 using namespace std;
00014 
00015 #define DATA_BEGIN   ((char) 2)
00016 #define DATA_END     ((char) 5)
00017 #define DATA_ESCAPE  ((char) 27)
00018 
00019 static int counter= 0;
00020 
00021 void
00022 next_input () {
00023   counter++;
00024   cout << DATA_BEGIN << "prompt#";
00025   cout << "Input " << counter << "] ";
00026   cout << DATA_END;
00027 }
00028 
00029 int
00030 main () {
00031   cout << DATA_BEGIN << "verbatim:";
00032   cout << "A LaTeX -> TeXmacs converter";
00033   next_input ();
00034   cout << DATA_END;
00035   cout.flush ();
00036 
00037   while (true) {
00038     char buffer[100];
00039     cin.getline (buffer, 100, '\n');
00040     cout << DATA_BEGIN << "verbatim:";
00041     cout << DATA_BEGIN;
00042     cout << "latex:$" << buffer << "$";
00043     cout << DATA_END;
00044     next_input ();
00045     cout << DATA_END;
00046     cout.flush ();
00047   }
00048   return 0;
00049 }