Back to index

texmacs  1.0.7.15
maxima_filter.c
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : maxima_filter.c
00004 * DESCRIPTION: Glue between TeXmacs and Maxima
00005 * COPYRIGHT  : (C) 1999  Andrey Grozin
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 <stdio.h>
00013 
00014 int main()
00015 { int c,first;
00016   /* first */
00017   fputs("\2verbatim:",stdout);
00018   while (1)
00019   { c=getchar();
00020     if (c==3) break;
00021     putchar(c);
00022   }
00023   /* other */
00024   while (1)
00025   { /* prompt */
00026     fputs("\2channel:prompt\5\2latex:\\red ",stdout);
00027     while (1)
00028     { c=getchar();
00029       if (c==4) break;
00030       putchar(c);
00031     }
00032     fputs("\\black\5\5",stdout);
00033     fflush(stdout);
00034     /* main output loop */
00035     first=1;
00036     c=getchar();
00037     while (1)
00038     { if (c==EOF) break;
00039       if (first)
00040       { fputs("\2verbatim:",stdout);
00041         if (c==3) break;
00042         if (c!='\n') putchar(c);
00043         first=0;
00044       }
00045       else if (c==3) break;
00046       else if (c=='%') { putchar('\\'); putchar(c); }
00047       else putchar(c);
00048       c=getchar();
00049     }
00050     if (c==EOF) break;
00051   }
00052   if (first) fputs("\2verbatim:",stdout);
00053   fputs("\2latex:\\red The end\\black\5\5",stdout);
00054   return 0;
00055 }