[project @ 2000-05-10 09:00:20 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / connect.h
index ffd736a..430e130 100644 (file)
@@ -9,8 +9,8 @@
  * included in the distribution.
  *
  * $RCSfile: connect.h,v $
- * $Revision: 1.32 $
- * $Date: 2000/03/22 18:14:22 $
+ * $Revision: 1.41 $
+ * $Date: 2000/05/10 09:00:20 $
  * ------------------------------------------------------------------------*/
 
 /* --------------------------------------------------------------------------
@@ -18,6 +18,7 @@
  * Texts, Names, Instances, Classes, Types, Kinds and Modules
  * ------------------------------------------------------------------------*/
 
+extern Text  textPrelPrim;
 extern Text  textPrelude;
 extern Text  textNum;                   /* used to process default decls   */
 extern Text  textCcall;                 /* used to process foreign import  */
@@ -220,10 +221,9 @@ extern Type typeST;
 extern Type typeIO;
 extern Type typeException;
 
-
+extern Module modulePrelPrim;
 extern Module modulePrelude;
 
-
 extern Kind   starToStar;                /* Type -> Type                    */
 
 
@@ -312,7 +312,7 @@ extern Int    whnfInt;                  /* integer value of term in whnf   */
 extern Float  whnfFloat;                /* float value of term in whnf     */
 extern Long   numCells;                 /* number of cells allocated       */
 extern Int    numGcs;                   /* number of garbage collections   */
-extern Bool   broken;                   /* indicates interrupt received    */
+extern int    numEnters;               /* number of enters                */
 extern Bool   preludeLoaded;            /* TRUE => prelude has been loaded */
 extern Bool   flagAssert;               /* TRUE => assert False <e> causes
                                                    an assertion failure    */
@@ -328,6 +328,9 @@ extern List   diVars;                   /* deriving: cache of names        */
 extern Int    diNum;                    /* also for deriving               */
 extern List   cfunSfuns;                /* List of (Cfun,[SelectorVar])    */
 
+extern Module moduleBeingParsed;        /* so the parser (topModule) knows */
+
+
 #if USE_PREPROCESSOR
 extern String preprocessor;             /* preprocessor command            */
 #endif
@@ -523,20 +526,6 @@ extern FILE *outputStream;             /* current output stream            */
 extern Int  outColumn;                 /* current output column number     */
 
 
-
-/*---------------------------------------------------------------------------
- * Crude profiling (probably doesn't work)
- *-------------------------------------------------------------------------*/
-
-#ifdef CRUDE_PROFILING
-extern void cp_init             ( void );
-extern void cp_enter            ( Cell /*StgVar*/ );
-extern void cp_bill_words       ( int );
-extern void cp_bill_insns       ( int );
-extern void cp_show             ( void );
-#endif
-
-
 /*---------------------------------------------------------------------------
  * For dynamic.c and general object-related stuff
  *-------------------------------------------------------------------------*/
@@ -557,57 +546,37 @@ extern Bool      stdcallAllowed ( void );
  * Interrupting execution (signals, allowBreak):
  *-------------------------------------------------------------------------*/
 
-extern Bool breakOn             ( Bool );
-extern Bool broken;                     /* indicates interrupt received    */
+typedef
+   enum { HugsIgnoreBreak, HugsLongjmpOnBreak, HugsRtsInterrupt }
+   HugsBreakAction;
+
+extern HugsBreakAction currentBreakAction;
+extern HugsBreakAction setBreakAction ( HugsBreakAction );
+
 
 #ifndef SIGBREAK /* Sigh, not defined in cygwin32 beta release 16 */
 # define SIGBREAK 21
 #endif
 
-/* allowBreak: call to allow user to interrupt computation
- * ctrlbrk:    set control break handler
- */
-
-#if HAVE_SIGPROCMASK
+/* ctrlbrk: set the interrupt handler.
+   Hugs relies on being able to do sigprocmask, since some of
+   the signal handlers do longjmps, and this zaps the previous
+   signal mask.  So setHandler needs to do sigprocmask in order
+   to get the signal mask to a sane state each time.
+*/
 #include <signal.h>
-#define ctrlbrk(bh)    { sigset_t mask; \
-                         signal(SIGINT,bh); \
-                         sigemptyset(&mask); \
-                         sigaddset(&mask, SIGINT); \
-                         sigprocmask(SIG_UNBLOCK, &mask, NULL); \
-                       }
-#else
-#  define ctrlbrk(bh)  signal(SIGINT,bh)
-#endif
-
-#if SYMANTEC_C
-extern int time_release;
-extern int allow_break_count;
-# define allowBreak()  if (time_release !=0 && \
-                           (++allow_break_count % time_release) == 0) \
-                           ProcessEvent();
-#else
-# define allowBreak()  if (broken) { broken=FALSE; sigRaise(breakHandler); }
-#endif
+#define setHandler(bh)          { sigset_t mask; \
+                          signal(SIGINT,bh); \
+                          sigemptyset(&mask); \
+                          sigaddset(&mask, SIGINT); \
+                          sigprocmask(SIG_UNBLOCK, &mask, NULL); \
+                        }
 
 
 /*---------------------------------------------------------------------------
  * Environment variables and the registry
  *-------------------------------------------------------------------------*/
 
-/* On Win32 we can use the registry to supplement info in environment 
- * variables.
- */
-/* AJG: Commented out for now for development */
-/* #define USE_REGISTRY (HAVE_WINDOWS_H && !__MSDOS__) */
-
-#ifdef USE_REGISTRY
-Bool   writeRegString          ( String var, String val );
-String         readRegString           ( String var, String def );
-Int    readRegInt              ( String var, Int def );
-Bool   writeRegInt             ( String var, Int val );
-#endif
-
 #define N_INSTALLDIR 200
 extern char installDir[N_INSTALLDIR];
 
@@ -661,6 +630,8 @@ extern void     exit            ( int );
 # define filenamecmp(s1,s2) strcmp(s1,s2)
 #endif
 
+#define HI_ENDING ".u_hi"
+
 
 /*---------------------------------------------------------------------------
  * Pipe-related operations:
@@ -803,7 +774,6 @@ extern Command readCommand      ( struct cmd *, Char, Char );
  * Freevar analysis: list of free vars after
  * Lambda lifting:   freevar list or UNIT on input, discarded after
  * Code generation:  unused
- * Optimisation:     number of uses (sort-of) of let-bound variable
  * ------------------------------------------------------------------------*/
 
 typedef Cell   StgRhs;
@@ -901,16 +871,12 @@ extern  Name  implementRecShw        ( Text );
 extern  Name  implementRecEq         ( Text );
 #endif
 
-/* Association list storing globals assigned to dictionaries, tuples, etc */
-extern List stgGlobals;
-
-extern List    liftBinds        ( List binds );
+extern void    liftModule       ( Module );
 extern StgExpr substExpr        ( List sub, StgExpr e );
 extern List    freeVarsBind     ( List, StgVar );
 
 
-extern Void    cgBinds          ( StgRhs );
-extern void*   closureOfVar     ( StgVar );
+extern Void    cgModule         ( Module );
 extern char*   lookupHugsName   ( void* );