Added 'quit' to shell.

git-svn-id: svn://10.0.0.236/trunk@112558 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rogerl%netscape.com
2002-01-23 01:32:23 +00:00
parent 9aed1eb7d5
commit f98ea16ee1

View File

@@ -113,7 +113,7 @@ static JSValue load(Context *cx, const JSValue& /*thisValue*/, JSValue *argv, ui
return kUndefinedValue;
}
static JSValue print(Context *, const JSValue& /*thisValue*/, JSValue *argv, uint32 argc)
static JSValue print(Context * /*cx*/, const JSValue& /*thisValue*/, JSValue *argv, uint32 argc)
{
for (uint32 i = 0; i < argc; i++) {
stdOut << argv[i] << "\n";
@@ -121,7 +121,7 @@ static JSValue print(Context *, const JSValue& /*thisValue*/, JSValue *argv, uin
return kUndefinedValue;
}
static JSValue version(Context *, const JSValue& /*thisValue*/, JSValue * /*argv*/, uint32 /*argc*/)
static JSValue version(Context * /*cx*/, const JSValue& /*thisValue*/, JSValue * /*argv*/, uint32 /*argc*/)
{
return JSValue(2.0);
}
@@ -146,6 +146,12 @@ static JSValue dikdik(Context * /*cx*/, const JSValue& /*thisValue*/, JSValue *
return kUndefinedValue;
}
static JSValue quit(Context * /*cx*/, const JSValue& /*thisValue*/, JSValue * /*argv*/, uint32 /*argc*/)
{
exit(0);
return kUndefinedValue;
}
static int readEvalPrint(Context *cx, FILE *in)
{
int result = 0;
@@ -265,8 +271,8 @@ int main(int argc, char **argv)
stdOut << "Welcome to DikDik.\n";
#endif
#if DEBUG
testCollector();
#if DEBUG
testCollector();
#endif
try {
@@ -279,6 +285,7 @@ int main(int argc, char **argv)
globalObject->defineVariable(&cx, widenCString("trace"), (NamespaceList *)(NULL), Property::NoAttribute, NULL, JSValue(new JSFunction(&cx, trace, NULL)));
globalObject->defineVariable(&cx, widenCString("dikdik"), (NamespaceList *)(NULL), Property::NoAttribute, NULL, JSValue(new JSFunction(&cx, dikdik, NULL)));
globalObject->defineVariable(&cx, widenCString("version"), (NamespaceList *)(NULL), Property::NoAttribute, NULL, JSValue(new JSFunction(&cx, version, NULL)));
globalObject->defineVariable(&cx, widenCString("quit"), (NamespaceList *)(NULL), Property::NoAttribute, NULL, JSValue(new JSFunction(&cx, quit, NULL)));
bool doInteractive = true;
int result = 0;