* included in the distribution.
*
* $RCSfile: hugs.c,v $
- * $Revision: 1.35 $
- * $Date: 2000/01/11 14:21:43 $
+ * $Revision: 1.38 $
+ * $Date: 2000/02/08 15:32:29 $
* ------------------------------------------------------------------------*/
#include <setjmp.h>
Bool multiInstRes = FALSE;
#endif
+#define N_PRELUDE_SCRIPTS (combined ? 30 : 1)
+
/* --------------------------------------------------------------------------
* Local function prototypes:
* ------------------------------------------------------------------------*/
currProject = s;
projInput(currProject);
scriptFile = currProject;
- forgetScriptsFrom(1);
+ forgetScriptsFrom(N_PRELUDE_SCRIPTS);
while ((s=readFilename())!=0)
addStackEntry(s);
if (namesUpto<=1) {
/* to be read */
while ((s=readFilename())!=0)
addStackEntry(s);
- readScripts(1);
+ readScripts(N_PRELUDE_SCRIPTS);
}
static Void local project() { /* read list of script names from */
EEND;
}
loadProject(s);
- readScripts(1);
+ readScripts(N_PRELUDE_SCRIPTS);
}
static Void local readScripts(n) /* Reread current list of scripts, */
{ Int m = namesUpto-1;
Text mtext = findText(scriptInfo[m].modName);
+
+ /* Hack to avoid starting up in PrelHugs */
+ if (mtext == findText("PrelHugs")) mtext = findText("Prelude");
+
+
/* Commented out till we understand what
* this is trying to do.
* Problem, you cant find a module till later.
startNewScript(0);
if (nonNull(c=findTycon(t=findText(nm)))) {
if (startEdit(tycon(c).line,scriptName[scriptThisTycon(c)])) {
- readScripts(1);
+ readScripts(N_PRELUDE_SCRIPTS);
}
} else if (nonNull(c=findName(t))) {
if (startEdit(name(c).line,scriptName[scriptThisName(c)])) {
- readScripts(1);
+ readScripts(N_PRELUDE_SCRIPTS);
}
} else {
ERRMSG(0) "No current definition for name \"%s\"", nm
static Void local runEditor() { /* run editor on script lastEdit */
if (startEdit(lastEdLine,lastEdit)) /* at line lastEdLine */
- readScripts(1);
+ readScripts(N_PRELUDE_SCRIPTS);
}
static Void local setLastEdit(fname,line)/* keep name of last file to edit */
/* allocated during evaluation */
parseExp();
checkExp();
- defaultDefns = evalDefaults;
+ defaultDefns = combined ? stdDefaults : evalDefaults;
type = typeCheckExp(TRUE);
if (isPolyType(type)) {
extern Name nameHw;
+static Void dumpStg ( void )
+{
+ String s;
+ Int i;
+ setCurrModule(findEvalModule());
+ startNewScript(0);
+ s = readFilename();
+
+ /* request to locate a symbol by name */
+ if (s && (*s == '?')) {
+ Text t = findText(s+1);
+ locateSymbolByName(t);
+ return;
+ }
+
+ /* request to dump a bit of the heap */
+ if (s && (*s == '-' || isdigit(*s))) {
+ int i = atoi(s);
+ print(i,100);
+ printf("\n");
+ return;
+ }
+
+ /* request to dump a symbol table entry */
+ if (!s
+ || !(*s == 't' || *s == 'n' || *s == 'c' || *s == 'i')
+ || !isdigit(s[1])) {
+ fprintf(stderr, ":d -- bad request `%s'\n", s );
+ return;
+ }
+ i = atoi(s+1);
+ switch (*s) {
+ case 't': dumpTycon(i); break;
+ case 'n': dumpName(i); break;
+ case 'c': dumpClass(i); break;
+ case 'i': dumpInst(i); break;
+ default: fprintf(stderr, ":d -- `%c' not implemented\n", *s );
+ }
+}
+
+
+#if 0
static Void local dumpStg( void ) { /* print STG stuff */
String s;
Text t;
}
}
}
+#endif
static Void local info() { /* describe objects */
Int count = 0; /* or give menu of commands */
case FIND : find();
break;
case LOAD : clearProject();
- forgetScriptsFrom(1);
+ forgetScriptsFrom(N_PRELUDE_SCRIPTS);
load();
break;
case ALSO : clearProject();
forgetScriptsFrom(numScripts);
load();
break;
- case RELOAD : readScripts(1);
+ case RELOAD : readScripts(N_PRELUDE_SCRIPTS);
break;
case PROJECT: project();
break;