Changeset 75
- Timestamp:
- 07/13/07 07:25:41 (1 year ago)
- Files:
-
- branches/1.9/source/main.d (modified) (2 diffs)
- branches/1.9/source/methods.d (modified) (2 diffs)
- branches/1.9/walnut.exe (modified) (previous)
- branches/1.9/walnut.lib (modified) (previous)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.9/source/main.d
r56 r75 11 11 import 12 12 std.c.stdio, 13 std.path, 14 std.file, 13 15 value, 14 16 methods, … … 22 24 int main(char[][] arguments) { 23 25 26 /// Fail hard if there's no script. 27 if(!arguments.length) { 28 return EXIT.FAILURE; 29 } 30 24 31 /// Initialize the program state 25 32 Value global = Global_init(); 33 char[] path, source; 34 35 /// Grab the files and collect the source 36 for(size_t i = 1; i < arguments.length; i++) { 37 path = std.path.defaultExt(arguments[i],"nut"); 38 source ~= cast(char[]) std.file.read(path); 39 } 40 source ~= 0x0A; 41 42 /// evaluate the source code. 43 Global_eval(global,global,cast(Value) source); 26 44 27 45 /// all done. branches/1.9/source/methods.d
r74 r75 37 37 */ 38 38 static Value Global_eval(inout Value self, inout Value cc, Value[] arguments ...) { 39 39 if(!arguments.length || arguments[0].type != TYPE.STRING) 40 return UNDEFINED; 41 printf("%.*s\n",arguments[0].toString()); 40 42 return UNDEFINED; 41 43 } … … 174 176 static Value Object_prototype_constructor(inout Value self, inout Value cc, Value[] arguments ...) { 175 177 Value v; 178 v.keys = []; 179 v.values = []; 180 v.type = TYPE.OBJECT; 176 181 return v; 177 182 }
