* included in the distribution.
*
* $RCSfile: connect.h,v $
- * $Revision: 1.30 $
- * $Date: 2000/03/15 23:27:16 $
+ * $Revision: 1.41 $
+ * $Date: 2000/05/10 09:00:20 $
* ------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------
* 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 */
extern Type typeIO;
extern Type typeException;
-
+extern Module modulePrelPrim;
extern Module modulePrelude;
-
extern Kind starToStar; /* Type -> Type */
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 */
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
extern Void consoleInput ( String );
extern Void projInput ( String );
extern Void stringInput ( String );
-extern Void parseScript ( String,Long );
+extern Cell parseModule ( String,Long );
extern Void parseExp ( Void );
#if EXPLAIN_INSTANCE_RESOLUTION
extern Void parseContext ( Void );
extern Void staticAnalysis ( Int );
-extern Void startModule ( Cell );
+extern Void startModule ( Module );
extern Void setExportList ( List );
extern Void setExports ( List );
extern Void addQualImport ( Text,Text );
#if EXPLAIN_INSTANCE_RESOLUTION
extern Void checkContext ( Void );
#endif
-extern Void checkDefns ( Void );
+extern Void checkDefns ( Module );
extern Bool h98Pred ( Bool,Cell );
extern Cell h98Context ( Bool,List );
extern Void h98CheckCtxt ( Int,String,Bool,List,Inst );
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
*-------------------------------------------------------------------------*/
* 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 HUGS_FOR_WINDOWS
-# define ctrlbrk(bh)
-# define allowBreak() kbhit()
-#else /* !HUGS_FOR_WINDOWS */
-# if HAVE_SIGPROCMASK
-# 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
-#endif /* !HUGS_FOR_WINDOWS */
+/* 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 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];
#if HAVE_UNISTD_H
# include <sys/types.h>
# include <unistd.h>
-#elif !HUGS_FOR_WINDOWS
-extern int chdir ( const char* );
#endif
+extern int chdir ( const char* );
+
#if HAVE_STDLIB_H
# include <stdlib.h>
#else
# define filenamecmp(s1,s2) strcmp(s1,s2)
#endif
+#define HI_ENDING ".u_hi"
+
/*---------------------------------------------------------------------------
* Pipe-related operations:
*-------------------------------------------------------------------------*/
extern Cell parseInterface ( String,Long );
-extern ZPair readInterface ( String,Long );
-extern Bool processInterfaces ( Void );
+extern List getInterfaceImports ( Cell );
+extern void processInterfaces ( List );
extern Void getFileSize ( String, Long * );
extern Void ifLinkConstrItbl ( Name n );
extern Void hi_o_namesFromSrcName ( String,String*,String* oName );
* 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;
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* );
Kind kind; /* kind annotation */
} Tyvar;
-#if FIXED_SUBST /* storage for type variables */
-extern Tyvar tyvars[];
-#else
extern Tyvar *tyvars; /* storage for type variables */
-#endif
extern Int typeOff; /* offset of result type */
extern Type typeIs; /* skeleton of result type */
extern Int typeFree; /* freedom in instantiated type */
extern Bool matchType ( Type,Int,Type,Int );
extern Bool typeMatches ( Type,Type );
+#ifdef DEBUG
+extern Void checkBytecodeCount ( Void );
+#endif
/*-------------------------------------------------------------------------*/