} while (!hitEOF);
} while (!hitEOF && !gQuitting);
Process(JSContext *cx, JSObject *obj, char *filename){    JSBool ok, hitEOF;    JSScript *script;    jsval result;    JSString *str;    char buffer[4096];    char *bufp;    int lineno;    int startline;    FILE *file;    if (filename != NULL && strcmp(filename, "-") != 0) {        file = fopen(filename, "r");        if (!file) {            JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL,                                 JSSMSG_CANT_OPEN, filename, strerror(errno));            gExitCode = EXITCODE_FILE_NOT_FOUND;            return;        }    } else {        file = stdin;    }    if (!isatty(fileno(file))) {        /*         * It's not interactive - just execute it.         *         * Support the UNIX #! shell hack; gobble the first line if it starts         * with '#'.  TODO - this isn't quite compatible with sharp variables,         * as a legal js program (using sharp variables) might start with '#'.         * But that would require multi-character lookahead.         */        int ch = fgetc(file);        if (ch == '#') {            while((ch = fgetc(file)) != EOF) {                if (ch == '\n' || ch == '\r')                    break;            }        }        ungetc(ch, file);        script = JS_CompileFileHandle(cx, obj, filename, file);        if (script) {            (void)JS_ExecuteScript(cx, obj, script, &result);            JS_DestroyScript(cx, script);        }        return;    }    /* It's an interactive filehandle; drop into read-eval-print loop. */    lineno = 1;    hitEOF = JS_FALSE;    do {        bufp = buffer;        *bufp = '\0';        /*         * Accumulate lines until we get a 'compilable unit' - one that either         * generates an error (before running out of source) or that compiles         * cleanly.  This should be whenever we get a complete statement that         * coincides with the end of a line.         */        startline = lineno;        do {            if (!GetLine(cx, bufp, file, startline == lineno ? "js> " : "")) {                hitEOF = JS_TRUE;                break;            }            bufp += strlen(bufp);            lineno++;        } while (!JS_BufferIsCompilableUnit(cx, obj, buffer, strlen(buffer)));        /* Clear any pending exception from previous failed compiles.  */        JS_ClearPendingException(cx);        script = JS_CompileScript(cx, obj, buffer, strlen(buffer),#ifdef JSDEBUGGER                                  "typein",#else                                  NULL,#endif                                  startline);        if (script) {            ok = JS_ExecuteScript(cx, obj, script, &result);            if (ok && result != JSVAL_VOID) {                str = JS_ValueToString(cx, result);                if (str)                    fprintf(gOutFile, "%s\n", JS_GetStringBytes(str));                else                    ok = JS_FALSE;            }            JS_DestroyScript(cx, script);        }    } while (!hitEOF);    fprintf(gOutFile, "\n");    return;}