Commit Graph
27 Commits
Author SHA1 Message Date
Bob Nystrom 9512ce74c3 Merge branch 'master' into api
# Conflicts:
#	src/module/io.c
2015-12-26 20:42:53 -08:00
Bob Nystrom fbc76cdc05 Fix C++ compile error in Directory.list(). 2015-12-26 20:26:05 -08:00
Bob Nystrom 0ac793d4f8 Add Directory.list() to io. 2015-12-24 10:12:12 -08:00
Bob Nystrom 7fcdcf2f1a wrenReturn___() -> wrenSlotSet___().
This turns those functions into general-purpose functions for writing
raw C values into slots on the foreign call stack.

Writing a return just means writing a value to slot 0.
2015-12-16 13:00:13 -08:00
Bob Nystrom 4b3c818ec5 Start moving embedding API towards "slot" register-API.
- wrenGetArgumentCount() -> wrenGetSlotCount()
- wrenGetArgument___() -> wrenGetSlot___()

Also, the get functions assert that the value is the right type instead
of checking at runtime. This puts the onus on the caller to be safe,
but maximizes performance.
2015-12-16 10:22:42 -08:00
Rohan Singh 2125471132 Addressing feedback
* Always include fcntl.h in io.c
* FileReqData -> FileRequestData
* Don't combine allocations
* Make output paths more consistent with the docs
2015-11-25 19:47:13 -05:00
Rohan Singh 2708b0c7ae Fix handleRequestError casting uv_fs_t::data to the wrong type 2015-11-25 12:43:50 -05:00
Rohan Singh 8d63667ce2 Store buffer info in uv_fs_t::data so we don't depend on a private libuv field for it 2015-11-25 12:43:50 -05:00
Rohan Singh f09e75c6e8 Update Visual Studio projects so we can build again 2015-11-25 12:43:19 -05:00
Bob Nystrom 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
Bob Nystrom 5d6ed0958c Use explicit constant for 2**53. 2015-10-17 11:07:13 -07:00
Bob Nystrom 8436ce1934 Add a random module. 2015-10-17 11:03:15 -07:00
Bob Nystrom 49601e67c5 Don't require nonstandard __builtin_unreachable() in UNREACHABLE().
Fix #304 (I hope).
2015-10-16 21:51:30 -07:00
Bob Nystrom d431c2eaa8 Start sketching in support for reading from stdin. 2015-10-16 21:05:24 -07:00
Bob Nystrom 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
Bob Nystrom f6083b1756 Simplify how built-in foreign methods and classes are wired up. 2015-09-21 07:58:39 -07:00
Bob Nystrom dc527c8d86 Add "io" module with beginnings of a File class. 2015-09-16 07:34:49 -07:00
Bob Nystrom 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
Bob Nystrom f36a795534 Automatically update the string constants when a builtin module changes. 2015-09-13 10:03:02 -07:00
Bob Nystrom 1e0a2e6036 Get rid of WrenMethod and just use WrenValue for both.
Thanks, Michel!
2015-08-31 07:57:48 -07:00
Bob Nystrom 556af50f83 Revise low level fiber semantics to play nicer with schedulers.
Now that I'm starting to write a real async scheduler on top of Wren's
basic fiber API, I have a better feel for what it needs. It turns out
run() is not it.

- Remove run() methods.
- Add transfer() which leaves the caller of the invoked fiber alone.
- Add suspend() to return control to the host application.
- Add Timer.schedule() to start a new independently scheduled fiber.
- Change Timer.sleep() so that it only transfers control to explicitly
  scheduled fibers, not any one.
2015-08-30 22:15:37 -07:00
Rohan Singh 513f272244 Copy the null terminator with the string instead of setting it 2015-08-16 14:00:50 -04:00
Rohan Singh cb603f44c2 Properly dispose of libuv timers when we finish using them 2015-08-16 13:58:24 -04:00
Rohan Singh 0efb943173 Fix timerGetSource() returning a string without a null terminator 2015-08-16 13:58:23 -04:00
Bob Nystrom cd5087d222 Get 32-bit and C++ Mac builds happy with libuv. 2015-08-16 10:28:55 -07:00
Bob Nystrom 9845ed5126 Tests for Timer.sleep(). 2015-08-08 07:17:30 -07:00
Bob Nystrom 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