Commit Graph

36 Commits

Author SHA1 Message Date
79558d95e5 Move File.stat() -> Stat.path().
Thanks, Michel!
2016-02-07 09:56:16 -08:00
71e2458a6c Add API for accessing command-line arguments.
- Add process module with Process class.
- Add "arguments" and "allArguments" methods.
- Docs for same.
- Support passing additional arguments to command line.
- Add "--help" support to command line.
2016-01-22 07:57:26 -08:00
5cd8a06fa0 File.stat(). 2016-01-01 09:58:44 -08:00
b054526df8 Add an optional offset to File.readBytes(). 2015-12-30 08:13:19 -08:00
678251a00c Fix type for fileFinalizer(). 2015-12-29 21:07:26 -08:00
ed6fad6153 Get rid of fiber for finalizers.
Instead, finalizers just get access to the foreign object's raw bytes.
This is deliberately limiting, since it discourages the user from
interacting with the VM in the middle of a GC.
2015-12-28 08:06:29 -08:00
0ac793d4f8 Add Directory.list() to io. 2015-12-24 10:12:12 -08:00
69a5c1d017 Avoid empty array initializer which seems to be problematic on VC++. 2015-11-25 08:36:42 -08:00
aaab14959f Get rid of extraneous "," in module macros.
Thanks, Michel!
2015-11-10 07:13:19 -08:00
e5176607d9 Move meta and random to "aux" modules.
Wren now has three classes of modules:

- The one magic "core" module that's built in and always needed.
- Auxiliary libraries like "meta" and "random". These do not have any
  dependencies, so can be used even when you embed Wren inside an
  application. But they're also optional and can be disabled if you
  don't need them.
- CLI modules. These ones need libuv and are tied to the CLI wrapper
  around the VM.
2015-10-17 22:09:48 -07:00
8436ce1934 Add a random module. 2015-10-17 11:03:15 -07:00
d431c2eaa8 Start sketching in support for reading from stdin. 2015-10-16 21:05:24 -07:00
3b09b35b59 Get rid of source path in module.
It wasn't useful anyway since it always had the module name for all but
the main script.
2015-10-15 18:17:42 -07:00
b7ed774da3 Reading files!
- File.close()
- File.open()
- File.read()
- file.readBytes()

And a few other little methods. Still lots more work to do, but it's a
start.
2015-09-30 21:13:36 -07:00
79354f5a97 Do some work on wrenCall().
- Add an explicit va_list version. That lets variadic functions
  forward to it.
- Fix a GC bug in wrenCall() with return values.
- Make the call API test not re-enter the VM.
2015-09-29 19:29:10 -07:00
f757c9efac Better embedding API support (and tests!) for strings with null bytes.
- Test that a foreign method can return strings.
- Test that a foreign method can return a string with null bytes.
- Test wrenCall().
- Allow passing NULL for "v" to wrenCall().
- Allow "a" for passing an explicit length byte array to wrenCall().
2015-09-24 08:02:31 -07:00
f6083b1756 Simplify how built-in foreign methods and classes are wired up. 2015-09-21 07:58:39 -07:00
dc527c8d86 Add "io" module with beginnings of a File class. 2015-09-16 07:34:49 -07:00
efceee4320 Let the host application control how System prints text. 2015-09-15 23:01:43 -07:00
66b89a493f Combine io.c and vm.c.
(This is mainly to free up io.c as a built in module.)
2015-09-13 22:29:47 -07:00
ea5c3b01eb Add module for Scheduler.
Also reorganizes some code to make it easier to add more modules.
2015-09-13 11:32:39 -07:00
91af02ac81 Merge branch 'master' into libuv
# Conflicts:
#	project/xcode/wren.xcodeproj/project.pbxproj
#	script/wren.mk
#	src/cli/main.c
#	src/cli/vm.c
#	src/cli/vm.h
#	test/api/main.c
2015-08-28 23:13:56 -07:00
48bdbc7745 First pass at implementing foreign classes.
Most of the pieces are there:

- You can declare a foreign class.
- It will call your C function to provide an allocator function.
- Whenever a foreign object is created, it calls the allocator.
- Foreign methods can access the foreign bytes of an object.
- Most of the runtime checking is in place for things like subclassing
  foreign classes.

There is still some loose ends to tie up:

- Finalizers are not called.
- Some of the error-handling could be better.
- The GC doesn't track how much memory a marked foreign object uses.
2015-08-15 12:07:53 -07:00
d4acbe8a70 A vertical slice of real libuv integration.
This adds a "timer" module to the CLI that provides a Timer class with
a static sleep() method. Not the most exciting functionality in the
world, but it requires the full hunk of libuv integration:

- The CLI sets up libuv and runs the event loop.
- Added a new directory src/module for CLI modules.
- Updated all the make scripts to handle it.
- Reorganized some other CLI code.
2015-08-07 08:10:55 -07:00
7baef81a4e Clean up a bit. 2015-06-26 23:01:07 -07:00
01fe9c3976 Fix memory leak for rootDirectory variable
The memory for the root directory path is not freed.
2015-06-03 21:48:26 +02:00
7084d6bfd5 Add infrastructure to test embedding API. 2015-05-24 09:23:30 -07:00
0bd19da392 Bind C methods to Wren using foreign declarations. 2015-03-24 07:58:15 -07:00
89ebffb582 Rearrange a bit. 2015-03-23 06:48:08 -07:00
0484accb2d Merge branch 'module-index' of git://github.com/gsmaverick/wren into gsmaverick-module-index 2015-03-23 06:42:03 -07:00
f732ada5ea Fix unreachable code in REPL. 2015-03-22 10:27:38 -07:00
91c69ccbf0 If module name does not specify a file try to load it as a module package instead. 2015-03-21 16:05:02 -07:00
91a23da5b0 Move CLI script running to a separate file.
(This is set up to reuse this code for API tests.)
2015-03-16 07:42:45 -07:00
aedf9a8571 Move CLI file loading code to separate file. 2015-03-16 07:22:52 -07:00
1616df63d2 Clean up file loading code. 2015-03-15 10:09:22 -07:00
92c17e81f6 Reorganize source files.
This makes it clear which files are part of the VM (i.e. the Wren library)
and which are part of the CLI. Makes a directory for the latter so it has
some room to grow.

This probably totally broke the VS project. If you can fix that, send me
a PR!
2015-03-14 15:00:50 -07:00