Changeset 30560 in webkit for trunk/JavaScriptCore/kjs/testkjs.cpp
- Timestamp:
- Feb 24, 2008, 11:11:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/testkjs.cpp
r30555 r30560 63 63 static JSValue* functionRun(ExecState*, JSObject*, const List&); 64 64 static JSValue* functionLoad(ExecState*, JSObject*, const List&); 65 static JSValue* functionReadline(ExecState*, JSObject*, const List&); 65 66 static JSValue* functionQuit(ExecState*, JSObject*, const List&); 66 67 … … 137 138 putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, "run", functionRun)); 138 139 putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 1, "load", functionLoad)); 140 putDirectFunction(new PrototypeFunction(globalExec(), functionPrototype(), 0, "readline", functionReadline)); 139 141 140 142 JSObject* array = arrayConstructor()->construct(globalExec(), globalExec()->emptyList()); … … 197 199 198 200 return jsUndefined(); 201 } 202 203 JSValue* functionReadline(ExecState*, JSObject*, const List&) 204 { 205 Vector<char, 256> line; 206 int c; 207 while ((c = getchar()) != EOF) { 208 // FIXME: Should we also break on \r? 209 if (c == '\n') 210 break; 211 line.append(c); 212 } 213 line.append('\0'); 214 return jsString(line.data()); 199 215 } 200 216
Note:
See TracChangeset
for help on using the changeset viewer.