1
0
forked from Mirror/wren
Commit Graph

31 Commits

Author SHA1 Message Date
58e4d26648 "IO" -> "System".
Get rid of the separate opt-in IO class and replace it with a core
System class.

- Remove wren_io.c, wren_io.h, and io.wren.
- Remove the flags that disable it.
- Remove the overloads for print() with different arity. (It was an
  experiment, but I don't think it's that useful.)
- Remove IO.read(). That will reappear using libuv in the CLI at some
  point.
- Remove IO.time. Doesn't seem to have been used.
- Update all of the tests, docs, etc.

I'm sorry for all the breakage this causes, but I think "System" is a
better name for this class (it makes it natural to add things like
"System.gc()") and frees up "IO" for referring to the CLI's IO module.
2015-09-15 07:46:09 -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
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
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
ad60a7e46e Update project files to build with libuv and the timer module 2015-08-13 01:39:34 -04: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
4a6d7e0428 Integrate libuv into Wren.
- Add a script that downloads and compiles libuv.
- Hook that up to the Makefile so it pulls down libuv on build.
- Add a separate "vm" target that just builds the VM library and skips
  libuv.
- Link to libuv when compiling the CLI.
- Update the XCode project to link to libuv too.

Linux and Windows support isn't done yet, but it should be pretty
straightforward to add to the Python script.
2015-08-02 10:43:38 -07:00
ac69ae4bb8 Fixed project files for visual studio. 2015-05-23 19:15:58 +02:00
82ce1d8be9 Fix up Meta.eval(_).
- Made it use primitives instead of foreign functions.
- This fixed an issue where the interpreter loop was running re-entrantly.
- Which in turn fixed a GC bug.
- Report a runtime error if the argument isn't a string.
- Report a runtime error if the source doesn't compile.
2015-04-03 21:22:58 -07:00
a7fafce265 Pull out opcode definitions into an X-macro file. 2015-03-28 09:56:07 -07:00
c707135b9a Add wren_meta to XCode project. 2015-03-25 19:25:18 -07:00
2624d08a79 Merge branch 'master' of git://github.com/bncastle/wren into bncastle-master 2015-03-23 06:32:29 -07:00
2dfec85506 Enable clang warning on suspicious implicit conversions. 2015-03-22 10:36:08 -07:00
f732ada5ea Fix unreachable code in REPL. 2015-03-22 10:27:38 -07:00
da112dd136 Changed Visual Studio solution to output into build/vs
Changed Visual Studio solution to output into build/vs
2015-03-19 10:52:48 -04:00
7514bb9dd3 Visual Studio Project Modifications
- Visual Studio: Fixed project to work with changes made to separate
Wren's cli and file loading code
- Visual Studio: Added another project to the solution that builds Wren
as a static library, and modified the original VS project to use it.
2015-03-16 14:52:33 -04:00
eed7d406da Merge remote-tracking branch 'munificent/master' 2015-03-16 10:56:14 -04: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
75d0ce271f Fixed Visual Studio include path 2015-03-16 09:41:51 -04:00
e315ed9265 Fixed file locations for Visual Studio project
- Fixed source file locations for Visual Studio Solution
- Modified .gitignore to ignore Visual Studio cache files
2015-03-16 09:30:16 -04: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
cda727a18d Merge branch 'msvc-project-and-compatibility' of git://github.com/MarcoLizza/wren into MarcoLizza-msvc-project-and-compatibility 2015-01-23 10:12:12 -08:00
2f12ad879d Pulling the "Math" library out. 2015-01-23 10:08:34 +01:00
1464280933 Restoring original header files order and using MSVC project setting to disable non-secure CRT warnings. 2015-01-23 10:05:10 +01:00
c88e61d018 Adding "Math" lib into Wren. 2015-01-22 17:46:09 +01:00
8ce58ec3c4 Reorganize files in XCode project. 2015-01-22 07:05:32 -08:00
222c2d5bbb Adding Microsoft Visual Studio 2013 project and solution files. 2015-01-21 11:00:35 +01:00
b6443f0301 Move XCode project under project/. 2015-01-20 17:14:30 -08:00