* included in the distribution.
*
* $RCSfile: hugs.c,v $
- * $Revision: 1.27 $
- * $Date: 1999/12/03 14:38:39 $
+ * $Revision: 1.31 $
+ * $Date: 2000/01/05 18:05:33 $
* ------------------------------------------------------------------------*/
#include <setjmp.h>
* Machine dependent code for Hugs interpreter:
* ------------------------------------------------------------------------*/
- Bool combined = FALSE;
+ Bool combined = TRUE;
#include "machdep.c"
#ifdef WANT_TIMER
String hugsEdit = 0; /* String for editor command */
String hugsPath = 0; /* String for file search path */
+ List ifaces_outstanding = NIL;
+
#if REDIRECT_OUTPUT
static Bool disableOutput = FALSE; /* redirect output to buffer? */
#endif
namesUpto = numScripts = 0;
- for (i=1; i<argc; ++i) { /* process command line arguments */
+ /* Pre-scan flags to see if -c or +c is present. This needs to
+ precede adding the stack entry for Prelude. On the other hand,
+ that stack entry needs to be made before the cmd line args are
+ properly examined. Hence the following pre-scan of them.
+ */
+ for (i=1; i < argc; ++i) {
+ if (strcmp(argv[i], "--")==0) break;
+ if (strcmp(argv[i], "-c")==0) combined = FALSE;
+ if (strcmp(argv[i], "+c")==0) combined = TRUE;
+ }
+
+ addStackEntry("Prelude");
+
+ for (i=1; i < argc; ++i) { /* process command line arguments */
if (strcmp(argv[i], "--")==0) break;
if (strcmp(argv[i],"+")==0 && i+1<argc) {
if (proj) {
}
}
- addStackEntry("Prelude");
-
#if DEBUG
{
char exe_name[N_INSTALLDIR + 6];
Printf("Standalone mode: Restart with command line +c for combined mode\n\n" );
}
- everybody(INSTALL);
+ everybody(PREPREL);
+
evalModule = findText(""); /* evaluate wrt last module by default */
if (proj) {
if (namesUpto>1) {
"You can't enable/disable combined"
" operation inside Hugs\n" );
} else {
- combined = state;
+ /* don't do anything, since pre-scan of args
+ will have got it already */
}
return TRUE;
// setLastEdit(name,0);
- nameObj[0] = 0;
strcpy(name, scriptInfo[stacknum].path);
strcat(name, scriptInfo[stacknum].modName);
if (scriptInfo[stacknum].fromSource)
scriptFile = name;
if (scriptInfo[stacknum].fromSource) {
- if (lastWasObject) finishInterfaces();
+ if (lastWasObject) processInterfaces();
lastWasObject = FALSE;
Printf("Reading script \"%s\":\n",name);
needsImports = FALSE;
typeCheckDefns();
compileDefns();
} else {
+ Cell iface;
+ List imports;
+ ZTriple iface_info;
+ char nameObj[FILENAME_MAX+1];
+ Int sizeObj;
+
Printf("Reading iface \"%s\":\n", name);
scriptFile = name;
needsImports = FALSE;
strcat(nameObj, DLL_ENDING);
sizeObj = scriptInfo[stacknum].oSize;
- loadInterface(name,len);
+ iface = readInterface(name,len);
+ imports = zsnd(iface); iface = zfst(iface);
+
+ if (nonNull(imports)) chase(imports);
scriptFile = 0;
lastWasObject = TRUE;
+
+ iface_info = ztriple(iface, findText(nameObj), mkInt(sizeObj) );
+ ifaces_outstanding = cons(iface_info,ifaces_outstanding);
+
if (needsImports) return FALSE;
}
scriptFile = 0;
- preludeLoaded = TRUE;
+
+ if (strcmp(scriptInfo[stacknum].modName, "Prelude")==0) {
+ preludeLoaded = TRUE;
+ everybody(POSTPREL);
+ }
return TRUE;
}
//numScripts = 0;
while (numScripts < namesUpto) {
-ppSmStack ( "readscripts-loop2" );
+ ppSmStack ( "readscripts-loop2" );
if (scriptInfo[numScripts].fromSource) {
nextNumScripts = NUM_SCRIPTS; //bogus initialisation
if (addScript(numScripts)) {
numScripts++;
-assert(nextNumScripts==NUM_SCRIPTS);
+ assert(nextNumScripts==NUM_SCRIPTS);
}
else
dropScriptsFrom(numScripts-1);
nextNumScripts = NUM_SCRIPTS;
if (addScript(numScripts)) {
numScripts++;
-assert(nextNumScripts==NUM_SCRIPTS);
+ assert(nextNumScripts==NUM_SCRIPTS);
} else {
//while (!scriptInfo[numScripts].fromSource && numScripts > 0)
// numScripts--;
//if (scriptInfo[numScripts].fromSource)
// numScripts++;
numScripts = nextNumScripts;
-assert(nextNumScripts<NUM_SCRIPTS);
+ assert(nextNumScripts<NUM_SCRIPTS);
}
}
}
-if (numScripts==namesUpto) ppSmStack( "readscripts-final") ;
+ if (numScripts==namesUpto) ppSmStack( "readscripts-final") ;
}
- finishInterfaces();
+ processInterfaces();
{ Int m = namesUpto-1;
Text mtext = findText(scriptInfo[m].modName);
} else {
Printf("<unknown type>");
}
-
+printf("\n");print(name(nm).type,10);printf("\n");
if (isCfun(nm)) {
Printf(" -- data constructor");
} else if (isMfun(nm)) {
Void everybody(what) /* send command `what' to each component of*/
Int what; { /* system to respond as appropriate ... */
+fprintf ( stderr, "EVERYBODY %d\n", what );
machdep(what); /* The order of calling each component is */
- storage(what); /* important for the INSTALL command */
+ storage(what); /* important for the PREPREL command */
substitution(what);
input(what);
translateControl(what);