Index: src/command.h =================================================================== RCS file: /home/cvs/root/hugs98/src/command.h,v retrieving revision 1.14 diff -u -r1.14 command.h --- src/command.h 14 Oct 2003 13:56:21 -0000 1.14 +++ src/command.h 30 Oct 2005 14:05:22 -0000 @@ -46,6 +46,7 @@ #ifdef __SYMBIAN32__ #define PRNDIR 21 #endif +#define MAIN 22 #if OBSERVATIONS /*-------------------------------------------------------------------------* Index: src/hugs.c =================================================================== RCS file: /home/cvs/root/hugs98/src/hugs.c,v retrieving revision 1.145 diff -u -r1.145 hugs.c --- src/hugs.c 16 Sep 2005 16:55:10 -0000 1.145 +++ src/hugs.c 30 Oct 2005 14:05:23 -0000 @@ -246,7 +246,7 @@ {":reload", RELOAD}, {":gc", COLLECT}, {":edit", EDIT}, {":quit", QUIT}, {":set", SET}, {":find", FIND}, {":names", NAMES}, {":info", INFO}, {":module", SETMODULE}, - {":browse", BROWSE}, + {":browse", BROWSE}, {":main", MAIN}, #if EXPLAIN_INSTANCE_RESOLUTION {":xplain", XPLAIN}, #endif @@ -276,6 +276,7 @@ Printf(":names [pat] list names currently in scope\n"); Printf(":info describe named objects\n"); Printf(":browse browse names exported by \n"); + Printf(":main run the main function with the given arguments\n"); #if EXPLAIN_INSTANCE_RESOLUTION Printf(":xplain explain instance resolution for \n"); #endif @@ -539,6 +540,25 @@ } #endif +static Void local runmain() { + String args[11]; + String s; + int argPos = 1, i; + args[0] = "Hugs"; + + while (argPos < 10 && (s = readFilename())) { + args[argPos++] = strCopy(s); + } + + setHugsArgs(argPos, args); + for (i = 1; i < argPos; i++) + free(args[i]); + + stringInput((LPSTR) "main"); + input(BREAK); + doCommand(); +} + /* -------------------------------------------------------------------------- * Enhanced help system: print current list of scripts or give information * about an object. @@ -1098,6 +1118,8 @@ cellsRecovered); break; case NOCMD : break; + case MAIN: runmain(); + break; #ifdef __SYMBIAN32__ case PRNDIR : printDir(); break;