ScilabXloop.c

Go to the documentation of this file.
00001 /* Copyright (C) 1998 Chancelier Jean-Philippe */
00002 /*
00003  * jpc_Xloop.c : 
00004  * (1997) : Jean-Philippe Chancelier 
00005  * 
00006  */
00007 /*-----------------------------------------------------------------------------------*/
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #ifndef STRICT
00011 #define STRICT
00012 #endif
00013 #include "wresource.h"
00014 #include "wcommon.h"
00015 #include "machine.h"
00016 
00017 #include "Messages.h"
00018 #include "Warnings.h"
00019 #include "Errors.h"
00020 #include "xscion.h"
00021 
00022 #ifdef WITH_TK
00023 extern void flushTKEvents ();
00024 extern int TclEventsLoop(void);
00025 static int BasicScilab = 0;
00026 #endif
00027 
00028 extern int GetWITH_GUI(void);
00029 /*-----------------------------------------------------------------------------------*/
00030 /* used to know if we must check events 
00031  * inside the scilab interpreter (parse/*)
00032  */
00033 int C2F(checkevts)(int *i)
00034 {
00035   
00036   #ifdef WITH_TK
00037   *i= Max(getINXscilab(),1);
00038   #else
00039   *i= getINXscilab();
00040   #endif
00041   return(0);
00042 }
00043 /*-----------------------------------------------------------------------------------*/
00044 /*************************************************
00045  * Dealing with Events on the queue when computing in Scilab 
00046  * we also try to detect when CTRLC was  activated 
00047  *************************************************/
00048 extern TW textwin;
00049 
00050 void TextMessage1 (int ctrlflag)
00051 {
00052   MSG msg;
00053 #ifdef WITH_TK
00054   flushTKEvents ();
00055 #endif
00056   while (PeekMessage (&msg, 0, 0, 0, PM_NOREMOVE))
00057     {
00058 #ifdef WITH_TK
00059       /* check for a tcl/tk event */
00060      if ( TclEventsLoop() ) continue ;
00061 #endif
00062       PeekMessage (&msg, 0, 0, 0, PM_REMOVE);
00063       TranslateMessage (&msg);
00064       DispatchMessage (&msg);
00065     }
00066   if (ctrlflag == 1) 
00067     {
00068       CtrlCHit (&textwin);
00069     }
00070 }
00071 /*-----------------------------------------------------------------------------------*/
00072 int C2F (sxevents) ()
00073 {
00074   if ( GetWITH_GUI() )
00075   {
00076 #ifdef WITH_TK
00077           if (getINXscilab() == 1 || BasicScilab == 0 )
00078 #else
00079           if (getINXscilab() == 1 )
00080 #endif
00081           {
00082                   TextMessage1 (1);
00083           }
00084   }
00085   return (0);
00086 }
00087 /*-----------------------------------------------------------------------------------*/
00088 /**********************************************************************
00089  * For Fortran call 
00090  **********************************************************************/
00091 
00092 static void strip_blank (source)
00093      char *source;
00094 {
00095   char *p;
00096   p = source;
00097   /* look for end of string */
00098   while (*p != '\0')
00099     p++;
00100   while (p != source)
00101     {
00102       p--;
00103       if (*p != ' ')
00104         break;
00105       *p = '\0';
00106     }
00107 }
00108 
00109 /**********************************************************************/

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