texmacs.c

Go to the documentation of this file.
00001 #include <stdio.h> 
00002 #include "machine.h" /* for C2F */
00003 #include "stack-def.h" /* for paus */
00004 #include "texmacs.h"
00005 #include "prompt.h"
00006 
00007 #if 0 /* to debug TeXmacs interface */
00008 #define DATA_BEGIN  ((char) 'B')
00009 #define DATA_END    ((char) 'E')
00010 #else
00011 #define DATA_BEGIN  ((char) 2)
00012 #define DATA_END    ((char) 5)
00013 #endif
00014 #define DATA_ESCAPE  ((char) 27)
00015 
00016 
00017 #define Pause C2F(recu).paus
00018 static int first=1;
00019 static int texmacs_mode=0;
00020 
00021 
00022 extern int LineRead();
00023 
00024 void settexmacs() {
00025   texmacs_mode=1;
00026 }
00027 
00028 
00029 int  C2F(intexmacs)() {
00030   return texmacs_mode;
00031 }
00032 
00033 void next_input () {
00034   fprintf(stdout,"%cchannel:prompt%c",DATA_BEGIN,DATA_END);
00035   if (Pause==0)
00036     fprintf(stdout,SCIPROMPT);
00037   else
00038     fprintf(stdout,SCIPROMPT_INTERRUPT,Pause);
00039   
00040   fprintf(stdout,"%c",DATA_END);fflush (stdout);
00041 }
00042 
00043 extern void
00044 C2F(texmacsin)(char buffer[],int *buf_size, int *len_line,int *eof,long int dummy1)
00045 {
00046 
00047   int nr,info;
00048   if (first==1) {
00049     fprintf(stdout,"%cverbatim:",DATA_BEGIN);
00050   }
00051   next_input ();
00052   
00053   first=0;
00054   
00055   *eof=0;
00056 
00057   info=LineRead(stdin,buffer,*buf_size,len_line,&nr);
00058   fprintf(stdout,"%cverbatim:",DATA_BEGIN);
00059   *len_line=*len_line-1;
00060 }
00061 

Generated on Sun Mar 4 15:03:48 2007 for Scilab [trunk] by  doxygen 1.5.1