Commit 0d2aee5f authored by sewardj's avatar sewardj
Browse files

[project @ 2000-03-10 19:50:44 by sewardj]

Major cleanup of header files.  Merge the 5 deleted files into connect.h.
Organise connect.h to gather declarations into roughtly related
categories.
parent 37fe8f8c
/* --------------------------------------------------------------------------
* Interpreter command structure
*
* The Hugs 98 system is Copyright (c) Mark P Jones, Alastair Reid, the
* Yale Haskell Group, and the Oregon Graduate Institute of Science and
* Technology, 1994-1999, All rights reserved. It is distributed as
* free software under the license in the file "License", which is
* included in the distribution.
*
* $RCSfile: command.h,v $
* $Revision: 1.6 $
* $Date: 1999/10/15 22:35:05 $
* ------------------------------------------------------------------------*/
typedef Int Command;
struct cmd {
String cmdString;
Command cmdCode;
};
extern Command readCommand Args((struct cmd *, Char, Char));
#define EDIT 0
#define FIND 1
#define LOAD 2
#define ALSO 3
#define PROJECT 4
#define RELOAD 5
#define EVAL 6
#define TYPEOF 7
#define HELP 8
#define NAMES 9
#define BADCMD 10
#define SET 11
#define QUIT 12
#define SYSTEM 13
#define CHGDIR 14
#define INFO 15
#define COLLECT 16
#define SETMODULE 17
#define DUMP 18
#define STATS 19
#define BROWSE 20
#define XPLAIN 21
#define PNTVER 22
#define NOCMD 23
/*-------------------------------------------------------------------------*/
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
* Connections between components of the Hugs system * Connections between components of the Hugs system
* *
...@@ -8,28 +9,27 @@ ...@@ -8,28 +9,27 @@
* included in the distribution. * included in the distribution.
* *
* $RCSfile: connect.h,v $ * $RCSfile: connect.h,v $
* $Revision: 1.26 $ * $Revision: 1.27 $
* $Date: 2000/03/10 17:30:36 $ * $Date: 2000/03/10 19:50:45 $
* ------------------------------------------------------------------------*/ * ------------------------------------------------------------------------*/
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
* Standard data: * Connections to Prelude entities:
* Texts, Names, Instances, Classes, Types, Kinds and Modules
* ------------------------------------------------------------------------*/ * ------------------------------------------------------------------------*/
extern Bool haskell98; /* TRUE => Haskell 98 compatibility*/ extern Text textPrelude;
extern Bool combined; /* TRUE => combined operation */ extern Text textNum; /* used to process default decls */
extern Module modulePrelude; extern Text textCcall; /* used to process foreign import */
extern Text textStdcall; /* ... and foreign export */
extern Text textPlus; /* Used to recognise n+k patterns */
/* --------------------------------------------------------------------------
* Primitive constructor functions
* ------------------------------------------------------------------------*/
extern Name nameFalse, nameTrue; extern Name nameFalse, nameTrue;
extern Name nameNil, nameCons; extern Name nameNil, nameCons;
extern Name nameJust, nameNothing; extern Name nameJust, nameNothing;
extern Name nameLeft, nameRight; extern Name nameLeft, nameRight;
extern Name nameUnit; extern Name nameUnit;
extern Name nameLT, nameEQ; extern Name nameLT, nameEQ;
extern Name nameGT; extern Name nameGT;
extern Name nameFst, nameSnd; /* standard combinators */ extern Name nameFst, nameSnd; /* standard combinators */
...@@ -64,23 +64,162 @@ extern Name nameReadField; /* read single field */ ...@@ -64,23 +64,162 @@ extern Name nameReadField; /* read single field */
extern Name nameReadParen; /* unwrap from parens */ extern Name nameReadParen; /* unwrap from parens */
extern Name nameLex; /* lexer */ extern Name nameLex; /* lexer */
extern Name nameRangeSize; /* calculate size of index range */ extern Name nameRangeSize; /* calculate size of index range */
extern Class classMonad; /* Monads */
extern Name nameReturn, nameBind; /* for translating monad comps */ extern Name nameReturn, nameBind; /* for translating monad comps */
extern Name nameMFail; extern Name nameMFail;
extern Name nameListMonad; /* builder function for List Monad */ extern Name nameListMonad; /* builder function for List Monad */
extern Name namePrint; /* printing primitive */ extern Name namePrint; /* printing primitive */
extern Name nameCreateAdjThunk; /* f-x-dyn: create adjustor thunk */ extern Name nameCreateAdjThunk; /* f-x-dyn: create adjustor thunk */
extern Text textPrelude; extern Name nameShow;
extern Text textNum; /* used to process default decls */ extern Name namePutStr;
extern Text textCcall; /* used to process foreign import */ extern Name nameRunIO_toplevel;
extern Text textStdcall; /* ... and foreign export */
extern Text textPlus; /* Used to recognise n+k patterns */ /* The following data constructors are used to make boxed but
* unpointed values pointed and require no special treatment
* by the code generator. */
extern Name nameMkInteger;
extern Name nameMkPrimArray;
extern Name nameMkPrimByteArray;
extern Name nameMkRef;
extern Name nameMkPrimMutableArray;
extern Name nameMkPrimMutableByteArray;
extern Name nameMkThreadId;
extern Name nameMkPrimMVar;
#ifdef PROVIDE_FOREIGN
extern Name nameMkForeign;
#endif
#ifdef PROVIDE_WEAK
extern Name nameMkWeak;
#endif
/* The following data constructors are used to box unboxed
* arguments and are treated differently by the code generator.
* That is, they have primop `elem` {INT_REP,FLOAT_REP,...}. */
#define boxingConRep(con) ((AsmRep)(name(con).primop))
#define isBoxingCon(con) (isName(con) && boxingConRep(con) != 0)
extern Name nameMkC;
extern Name nameMkI;
extern Name nameMkW;
extern Name nameMkA;
extern Name nameMkF;
extern Name nameMkD;
extern Name nameMkStable;
/* used while desugaring */
extern Name nameId;
extern Name nameOtherwise;
extern Name nameUndefined; /* generic undefined value */
/* used in pattern match */
extern Name namePmSub;
extern Name nameSel;
/* used in translation */
extern Name nameEq;
extern Name namePMFail;
extern Name nameEqChar;
extern Name nameEqInteger;
extern Name namePmInt;
extern Name namePmInteger;
extern Name namePmDouble;
extern Name namePmLe;
extern Name namePmSubtract;
extern Name namePmFromInteger;
extern Name nameMkIO;
extern Name nameUnpackString;
extern Name namePrimSeq;
extern Name nameMap;
extern Name nameMinus;
extern Class classMonad; /* Monads */
extern Class classEq; /* `standard' classes */
extern Class classOrd;
extern Class classShow;
extern Class classRead;
extern Class classIx;
extern Class classEnum;
extern Class classBounded;
extern Class classReal; /* `numeric' classes */
extern Class classIntegral;
extern Class classRealFrac;
extern Class classRealFloat;
extern Class classFractional;
extern Class classFloating;
extern Class classNum;
extern Type typeProgIO; /* For the IO monad, IO a */
extern Type typeArrow; /* Builtin type constructors */
extern Type typeList;
extern Type typeUnit;
extern Type typeInt64;
extern Type typeWord;
extern Type typeFloat;
extern Type typePrimArray;
extern Type typePrimByteArray;
extern Type typeRef;
extern Type typePrimMutableArray;
extern Type typePrimMutableByteArray;
extern Type typeStable;
extern Type typeWeak;
extern Type typeIO;
extern Type typeForeign;
extern Type typeMVar;
extern Type typeThreadId;
extern Type typeException;
extern Type typeIO;
extern Type typeST;
extern Type typeOrdering;
extern List stdDefaults; /* List of standard default types */
/* For every primitive type provided by the runtime system,
* we construct a Haskell type using a declaration of the form:
*
* data Int -- no constructors given
*/
extern Type typeChar;
extern Type typeInt;
extern Type typeInteger;
extern Type typeWord;
extern Type typeAddr;
extern Type typePrimArray;
extern Type typePrimByteArray;
extern Type typeRef;
extern Type typePrimMutableArray;
extern Type typePrimMutableByteArray;
extern Type typeFloat;
extern Type typeDouble;
extern Type typeStable;
extern Type typeThreadId;
extern Type typeMVar;
#ifdef PROVIDE_WEAK
extern Type typeWeak;
#endif
#ifdef PROVIDE_FOREIGN
extern Type typeForeign;
#endif
/* And a smaller number of types defined in plain Haskell */
extern Type typeList;
extern Type typeUnit;
extern Type typeString;
extern Type typeBool;
extern Type typeST;
extern Type typeIO;
extern Type typeException;
extern Module modulePrelude;
extern Kind starToStar; /* Type -> Type */
#if TREX #if TREX
extern Name nameNoRec; /* The empty record */
extern Type typeNoRow; /* The empty row */
extern Type typeRec; /* Record formation */
extern Kind extKind; /* Kind of extension, *->row->row */
extern Name nameRecExt; /* Extend a record */ extern Name nameRecExt; /* Extend a record */
extern Name nameRecBrk; /* Break a record */ extern Name nameRecBrk; /* Break a record */
extern Name nameAddEv; /* Addition of evidence values */ extern Name nameAddEv; /* Addition of evidence values */
...@@ -90,37 +229,59 @@ extern Name nameShowRecRow; /* Used to output rows */ ...@@ -90,37 +229,59 @@ extern Name nameShowRecRow; /* Used to output rows */
extern Name nameRecEq; /* Compare records */ extern Name nameRecEq; /* Compare records */
extern Name nameEqRecRow; /* Used to compare rows */ extern Name nameEqRecRow; /* Used to compare rows */
extern Name nameInsFld; /* Field insertion routine */ extern Name nameInsFld; /* Field insertion routine */
extern Name nameNoRec; /* The empty record */
extern Type typeNoRow; /* The empty row */
extern Type typeRec; /* Record formation */
extern Kind extKind; /* Kind of extension, *->row->row */
#endif #endif
extern String repeatStr; /* Repeat last command string */
extern String hugsEdit; /* String for editor command */
extern String hugsPath; /* String for file search path */
extern String projectPath; /* String for project search path */
extern Type typeProgIO; /* For the IO monad, IO a */ /* --------------------------------------------------------------------------
extern Type typeArrow; /* Builtin type constructors */ * Constructions from the above names, types, etc.
extern Type typeList; * ------------------------------------------------------------------------*/
extern Type typeUnit;
extern Type arrow; /* mkOffset(0) -> mkOffset(1) */
extern Type listof; /* [ mkOffset(0) ] */
extern Cell predNum; /* Num (mkOffset(0)) */
extern Cell predFractional; /* Fractional (mkOffset(0)) */
extern Cell predIntegral; /* Integral (mkOffset(0)) */
extern Cell predMonad; /* Monad (mkOffset(0)) */
extern Type arrow; /* mkOffset(0) -> mkOffset(1) */
extern Type boundPair;; /* (mkOffset(0),mkOffset(0)) */
extern Type listof;; /* [ mkOffset(0) ] */
extern Type typeVarToVar;; /* mkOffset(0) -> mkOffset(0) */
extern Cell predNum;; /* Num (mkOffset(0)) */
extern Cell predFractional;; /* Fractional (mkOffset(0)) */
extern Cell predIntegral;; /* Integral (mkOffset(0)) */
extern Kind starToStar;; /* Type -> Type */
extern Cell predMonad;; /* Monad (mkOffset(0)) */
#define fn(from,to) ap(ap(typeArrow,from),to) /* make type: from -> to */ #define fn(from,to) ap(ap(typeArrow,from),to) /* make type: from -> to */
extern List stdDefaults; /* List of standard default types */ #define aVar mkOffset(0) /* Simple skeleton for type var */
extern Type boundPair; /* (mkOffset(0),mkOffset(0)) */
extern Class classEq; /* `standard' classes */ #define consChar(c) ap(nameCons,mkChar(c))
extern Class classOrd;
extern Class classShow;
extern Class classRead;
extern Class classIx;
extern Class classEnum;
extern Class classBounded;
extern Class classReal; /* `numeric' classes */ /* --------------------------------------------------------------------------
extern Class classIntegral; * Umm ....
extern Class classRealFrac; * ------------------------------------------------------------------------*/
extern Class classRealFloat;
extern Class classFractional; extern Bool haskell98; /* TRUE => Haskell 98 compatibility*/
extern Class classFloating; extern Bool combined; /* TRUE => combined operation */
extern Class classNum; extern Bool debugSC; /* TRUE => print SC to screen */
extern Bool kindExpert; /* TRUE => display kind errors in */
/* full detail */
extern Bool allowOverlap; /* TRUE => allow overlapping insts */
extern String repeatStr; /* Repeat last command string */
extern String hugsEdit; /* String for editor command */
extern String hugsPath; /* String for file search path */
extern String projectPath; /* String for project search path */
extern Cell *CStackBase; /* pointer to base of C stack */ extern Cell *CStackBase; /* pointer to base of C stack */
...@@ -138,9 +299,7 @@ extern Int defaultLine; /* line in which default defs occur*/ ...@@ -138,9 +299,7 @@ extern Int defaultLine; /* line in which default defs occur*/
extern List evalDefaults; /* defaults for evaluator */ extern List evalDefaults; /* defaults for evaluator */
extern Cell inputExpr; /* evaluator input expression */ extern Cell inputExpr; /* evaluator input expression */
extern Cell inputContext; /* evaluator input expression */ extern Cell inputContext; /* evaluator input expression */
extern Addr inputCode; /* Code for compiled input expr */
extern Int whnfArgs; /* number of args of term in whnf */
extern Cell whnfHead; /* head of term in whnf */ extern Cell whnfHead; /* head of term in whnf */
extern Int whnfInt; /* integer value of term in whnf */ extern Int whnfInt; /* integer value of term in whnf */
extern Float whnfFloat; /* float value of term in whnf */ extern Float whnfFloat; /* float value of term in whnf */
...@@ -152,27 +311,23 @@ extern Bool preludeLoaded; /* TRUE => prelude has been loaded */ ...@@ -152,27 +311,23 @@ extern Bool preludeLoaded; /* TRUE => prelude has been loaded */
extern Bool gcMessages; /* TRUE => print GC messages */ extern Bool gcMessages; /* TRUE => print GC messages */
extern Bool literateScripts; /* TRUE => default lit scripts */ extern Bool literateScripts; /* TRUE => default lit scripts */
extern Bool literateErrors; /* TRUE => report errs in lit scrs */ extern Bool literateErrors; /* TRUE => report errs in lit scrs */
extern Bool showInstRes; /* TRUE => show instance resolution */ extern Bool showInstRes; /*TRUE => show instance resolution */
extern Int cutoff; /* Constraint Cutoff depth */ extern Int cutoff; /* Constraint Cutoff depth */
extern List diVars; /* deriving: cache of names */
extern Int diNum; /* also for deriving */
extern List cfunSfuns; /* List of (Cfun,[SelectorVar]) */
#if USE_PREPROCESSOR #if USE_PREPROCESSOR
extern String preprocessor; /* preprocessor command */ extern String preprocessor; /* preprocessor command */
#endif #endif
#if DEBUG_CODE
extern Bool debugCode; /* TRUE => print G-code to screen */
#endif
extern Bool debugSC; /* TRUE => print SC to screen */
extern Bool kindExpert; /* TRUE => display kind errors in */
/* full detail */
extern Bool allowOverlap; /* TRUE => allow overlapping insts */
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
* Function prototypes etc... * Function prototypes etc...
* ------------------------------------------------------------------------*/ * ------------------------------------------------------------------------*/
extern Void everybody Args((Int));
#define RESET 1 /* reset subsystem */ #define RESET 1 /* reset subsystem */
...@@ -181,11 +336,22 @@ extern Void everybody Args((Int)); ...@@ -181,11 +336,22 @@ extern Void everybody Args((Int));
#define POSTPREL 4 /* do startup actions after Prelude loading */ #define POSTPREL 4 /* do startup actions after Prelude loading */
#define EXIT 5 /* Take action immediately before exit() */ #define EXIT 5 /* Take action immediately before exit() */
#define BREAK 6 /* Take action after program break */ #define BREAK 6 /* Take action after program break */
#define GCDONE 7 /* Restore subsystem invariantss after GC */ #define GCDONE 7 /* Restore subsystem invariants after GC */
/* PREPREL was formerly called INSTALL. POSTPREL doesn't have an analogy /* PREPREL was formerly called INSTALL. POSTPREL doesn't have an analogy
in the old Hugs. in the old Hugs.
*/ */
extern Void everybody Args((Int));
extern Void linkControl Args((Int));
extern Void deriveControl Args((Int));
extern Void translateControl Args((Int));
extern Void codegen Args((Int));
extern Void machdep Args((Int));
extern Void liftControl ( Int what );
extern Void substitution Args((Int));
extern Void typeChecker Args((Int));
extern Void interface Args((Int));
typedef long Target; typedef long Target;
...@@ -213,8 +379,6 @@ extern Syntax syntaxOf Args((Name)); ...@@ -213,8 +379,6 @@ extern Syntax syntaxOf Args((Name));
extern String unlexChar Args((Char,Char)); extern String unlexChar Args((Char,Char));
extern Void printString Args((String)); extern Void printString Args((String));
extern Void substitution Args((Int));
extern Void optimiser Args((Int));
extern Void staticAnalysis Args((Int)); extern Void staticAnalysis Args((Int));
extern Void startModule Args((Cell)); extern Void startModule Args((Cell));
...@@ -232,10 +396,14 @@ extern Void ambigError Args((Int,String,Cell,Type)); ...@@ -232,10 +396,14 @@ extern Void ambigError Args((Int,String,Cell,Type));
extern Void classDefn Args((Int,Cell,List,List)); extern Void classDefn Args((Int,Cell,List,List));
extern Void instDefn Args((Int,Cell,Cell)); extern Void instDefn Args((Int,Cell,Cell));
extern Void addTupInst Args((Class,Int)); extern Void addTupInst Args((Class,Int));
extern Name newDSel Args((Class,Int));
#if TREX #if TREX
extern Inst addRecShowInst Args((Class,Ext)); extern Inst addRecShowInst Args((Class,Ext));
extern Inst addRecEqInst Args((Class,Ext)); extern Inst addRecEqInst Args((Class,Ext));
#endif #endif
extern List offsetTyvarsIn Args((Type,List));
extern List typeVarsIn Args((Cell,List,List,List)); extern List typeVarsIn Args((Cell,List,List,List));
extern List oclose Args((List,List)); extern List oclose Args((List,List));
extern List zonkTyvarsIn Args((Type,List)); extern List zonkTyvarsIn Args((Type,List));
...@@ -244,6 +412,10 @@ extern Type zonkType Args((Type,Int)); ...@@ -244,6 +412,10 @@ extern Type zonkType Args((Type,Int));
extern Void primDefn Args((Cell,List,Cell)); extern Void primDefn Args((Cell,List,Cell));
extern Void defaultDefn Args((Int,List)); extern Void defaultDefn Args((Int,List));
extern Void checkExp Args((Void)); extern Void checkExp Args((Void));
extern Type conToTagType Args((Tycon));
extern Type tagToConType Args((Tycon));
extern Int visitClass Args((Class));
#if EXPLAIN_INSTANCE_RESOLUTION #if EXPLAIN_INSTANCE_RESOLUTION
extern Void checkContext Args((Void)); extern Void checkContext Args((Void));
#endif #endif
...@@ -254,7 +426,25 @@ extern Void h98CheckCtxt Args((Int,String,Bool,List,Inst)); ...@@ -254,7 +426,25 @@ extern Void h98CheckCtxt Args((Int,String,Bool,List,Inst));
extern Void h98CheckType Args((Int,String,Cell,Type)); extern Void h98CheckType Args((Int,String,Cell,Type));
extern Void h98DoesntSupport Args((Int,String)); extern Void h98DoesntSupport Args((Int,String));
extern Void typeChecker Args((Int)); extern Int userArity Args((Name));
extern List deriveEq Args((Tycon));
extern List deriveOrd Args((Tycon));
extern List deriveEnum Args((Tycon));
extern List deriveIx Args((Tycon));
extern List deriveShow Args((Tycon));
extern List deriveRead Args((Cell));
extern List deriveBounded Args((Tycon));
extern List checkPrimDefn Args((Triple));
extern Void foreignImport Args((Cell,Text,Pair,Cell,Cell));
extern List foreignImports; /* foreign import declarations */
extern Void implementForeignImport Args((Name));
extern Void foreignExport Args((Cell,Text,Cell,Cell,Cell));
extern List foreignExports; /* foreign export declarations */
extern Void implementForeignExport Args((Name));
extern Type primType( Int /*AsmMonad*/ monad, String a_kinds, String r_kinds );
extern Type typeCheckExp Args((Bool)); extern Type typeCheckExp Args((Bool));
extern Void typeCheckDefns Args((Void)); extern Void typeCheckDefns Args((Void));
extern Cell provePred Args((Kinds,List,Cell)); extern Cell provePred Args((Kinds,List,Cell));
...@@ -265,6 +455,7 @@ extern Bool isProgType Args((List,Type)); ...@@ -265,6 +455,7 @@ extern Bool isProgType Args((List,Type));
extern Cell superEvid Args((Cell,Class,Class)); extern Cell superEvid Args((Cell,Class,Class));
extern Void linkPreludeTC Args((Void)); extern Void linkPreludeTC Args((Void));
extern Void linkPreludeCM Args((Void)); extern Void linkPreludeCM Args((Void));
extern Void linkPrimitiveNames(void);
extern Void compiler Args((Int)); extern Void compiler Args((Int));
extern Void compileDefns Args((Void)); extern Void compileDefns Args((Void));
...@@ -273,23 +464,6 @@ extern Bool failFree Args((Cell)); ...@@ -273,23 +464,6 @@ extern Bool failFree Args((Cell));
extern Int discrArity Args((Cell)); extern Int discrArity Args((Cell));
extern Addr codeGen Args((Name,Int,Cell)); extern Addr codeGen Args((Name,Int,Cell));
extern Void implementCfun Args((Name,List));
extern Void addCfunTable Args((Tycon));
extern Name succCfun Args((Name));
extern Name nextCfun Args((Name,Name));
extern Name cfunByNum Args((Name,Int));
extern Void unwind Args((Cell));
extern Void run Args((Addr,StackPtr));
extern Void eval Args((Cell));
extern Cell evalWithNoError Args((Cell));
extern Void evalFails Args((StackPtr));
extern Void abandon Args((String,Cell));
extern Void outputString Args((FILE *));
extern Void dialogue Args((Cell));
#define consChar(c) ap(nameCons,mkChar(c))
extern Int shellEsc Args((String)); extern Int shellEsc Args((String));
extern Int getTerminalWidth Args((Void)); extern Int getTerminalWidth Args((Void));
extern Void normalTerminal Args((Void)); extern Void normalTerminal Args((Void));
...@@ -306,21 +480,72 @@ extern Inst findInstFor Args((Cell,Int)); ...@@ -306,21 +480,72 @@ extern Inst findInstFor Args((Cell,Int));
extern List findInstsFor Args((Cell,Int)); extern List findInstsFor Args((Cell,Int));
#endif #endif
/*---------------------------------------------------------------------------
* Debugging printers, and output-ery
*-------------------------------------------------------------------------*/
extern Void ppScripts ( Void ); extern Void ppScripts ( Void );
extern Void ppModules ( Void ); extern Void ppModules ( Void );
extern Type primType( Int /*AsmMonad*/ monad, String a_kinds, String r_kinds ); extern Void printStg( FILE *fp, Cell /*StgVar*/ b);
#define aVar mkOffset(0) /* Simple skeleton for type var */
extern Void ppStg ( Cell /*StgVar*/ v );
extern Void ppStgExpr ( Cell /*StgExpr*/ e );
extern Void ppStgRhs ( Cell /*StgRhs*/ rhs );
extern Void ppStgAlts ( List alts );
extern Void ppStgPrimAlts( List alts );
extern Void ppStgVars ( List vs );