Index: lib/dartino/dartino.dart |
diff --git a/lib/fletch/fletch.dart b/lib/dartino/dartino.dart |
similarity index 86% |
rename from lib/fletch/fletch.dart |
rename to lib/dartino/dartino.dart |
index f1ddafb223d44308083f31b6e056cb0bddbbd6a6..789d9f252598411c7df7ed6db5d75ea732cdd3ad 100644 |
--- a/lib/fletch/fletch.dart |
+++ b/lib/dartino/dartino.dart |
@@ -2,9 +2,9 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE.md file. |
-library dart.fletch; |
+library dart.dartino; |
-import 'dart:fletch._system' as fletch; |
+import 'dart:dartino._system' as dartino; |
/// Fibers are lightweight co-operative multitask units of execution. They |
/// are scheduled on top of OS-level threads, but they are cheap to create |
@@ -40,7 +40,7 @@ class Fiber { |
Fiber._forked(entry) { |
current; // Force initialization of fiber sub-system. |
_coroutine = new Coroutine((ignore) { |
- fletch.runToEnd(entry); |
+ dartino.runToEnd(entry); |
}); |
} |
@@ -66,7 +66,7 @@ class Fiber { |
static void exit([value]) { |
// If we never created a fiber, we can just go ahead and halt now. |
- if (_current == null) fletch.halt(); |
+ if (_current == null) dartino.halt(); |
_current._exit(value); |
} |
@@ -159,7 +159,7 @@ class Fiber { |
if (current != null) return current; |
// If we don't have any idle fibers, halt. |
- if (exiting && _idleFibers == null) fletch.halt(); |
+ if (exiting && _idleFibers == null) dartino.halt(); |
while (true) { |
Process._handleMessages(); |
@@ -168,7 +168,7 @@ class Fiber { |
// set, simply yield again. |
current = _current; |
if (current != null) return current; |
- fletch.yield(fletch.InterruptKind.yield.index); |
+ dartino.yield(dartino.InterruptKind.yield.index); |
} |
} |
@@ -186,7 +186,7 @@ class Fiber { |
static void _schedule(Fiber to) { |
_current = to; |
- fletch.coroutineChange(to._coroutine, null); |
+ dartino.coroutineChange(to._coroutine, null); |
} |
} |
@@ -209,7 +209,7 @@ class Coroutine { |
call(argument) { |
if (!isSuspended) throw "Cannot call non-suspended coroutine"; |
_caller = _coroutineCurrent(); |
- var result = fletch.coroutineChange(this, argument); |
+ var result = dartino.coroutineChange(this, argument); |
// If the called coroutine is done now, we clear the |
// stack reference in it so the memory can be reclaimed. |
@@ -224,24 +224,24 @@ class Coroutine { |
static yield(value) { |
Coroutine caller = _coroutineCurrent()._caller; |
if (caller == null) throw "Cannot yield outside coroutine"; |
- return fletch.coroutineChange(caller, value); |
+ return dartino.coroutineChange(caller, value); |
} |
_coroutineStart(entry) { |
// The first call to changeStack is actually skipped but we need |
// it to make sure the newly started coroutine is suspended in |
// exactly the same way as we do when yielding. |
- var argument = fletch.coroutineChange(0, 0); |
+ var argument = dartino.coroutineChange(0, 0); |
var result = entry(argument); |
// Mark this coroutine as done and change back to the caller. |
Coroutine caller = _caller; |
_caller = this; |
- fletch.coroutineChange(caller, result); |
+ dartino.coroutineChange(caller, result); |
} |
- @fletch.native external static _coroutineCurrent(); |
- @fletch.native external static _coroutineNewStack(coroutine, entry); |
+ @dartino.native external static _coroutineCurrent(); |
+ @dartino.native external static _coroutineNewStack(coroutine, entry); |
} |
class ProcessDeath { |
@@ -274,40 +274,40 @@ class Process { |
int get hashCode => _nativeProcessHandle.hashCode; |
- @fletch.native bool link() { |
- throw fletch.nativeError; |
+ @dartino.native bool link() { |
+ throw dartino.nativeError; |
} |
- @fletch.native void unlink() { |
- switch (fletch.nativeError) { |
- case fletch.wrongArgumentType: |
+ @dartino.native void unlink() { |
+ switch (dartino.nativeError) { |
+ case dartino.wrongArgumentType: |
throw new StateError("Cannot unlink from parent process."); |
default: |
- throw fletch.nativeError; |
+ throw dartino.nativeError; |
} |
} |
- @fletch.native bool monitor(Port port) { |
- switch (fletch.nativeError) { |
- case fletch.wrongArgumentType: |
+ @dartino.native bool monitor(Port port) { |
+ switch (dartino.nativeError) { |
+ case dartino.wrongArgumentType: |
throw new StateError("The argument to monitor must be a Port object."); |
default: |
- throw fletch.nativeError; |
+ throw dartino.nativeError; |
} |
} |
- @fletch.native void unmonitor(Port port) { |
- switch (fletch.nativeError) { |
- case fletch.wrongArgumentType: |
+ @dartino.native void unmonitor(Port port) { |
+ switch (dartino.nativeError) { |
+ case dartino.wrongArgumentType: |
throw new StateError( |
"The argument to unmonitor must be a Port object."); |
default: |
- throw fletch.nativeError; |
+ throw dartino.nativeError; |
} |
} |
- @fletch.native void kill() { |
- throw fletch.nativeError; |
+ @dartino.native void kill() { |
+ throw dartino.nativeError; |
} |
static Process spawn(Function fn, [argument]) { |
@@ -395,21 +395,21 @@ class Process { |
try { |
if (to != null) to._sendExit(value); |
} finally { |
- fletch.yield(fletch.InterruptKind.terminate.index); |
+ dartino.yield(dartino.InterruptKind.terminate.index); |
} |
} |
// Low-level entry for spawned processes. |
static void _entry(fn, argument) { |
if (argument == null) { |
- fletch.runToEnd(fn); |
+ dartino.runToEnd(fn); |
} else { |
- fletch.runToEnd(() => fn(argument)); |
+ dartino.runToEnd(() => fn(argument)); |
} |
} |
// Low-level helper function for spawning. |
- @fletch.native static Process _spawn(Function entry, |
+ @dartino.native static Process _spawn(Function entry, |
Function fn, |
argument, |
bool linkToChild, |
@@ -429,10 +429,10 @@ class Process { |
} |
} |
- @fletch.native external static Process get current; |
- @fletch.native external static _queueGetMessage(); |
- @fletch.native external static _queueSetupProcessDeath(ProcessDeath message); |
- @fletch.native external static Channel _queueGetChannel(); |
+ @dartino.native external static Process get current; |
+ @dartino.native external static _queueGetMessage(); |
+ @dartino.native external static _queueSetupProcessDeath(ProcessDeath message); |
+ @dartino.native external static Channel _queueGetChannel(); |
} |
// Ports allow you to send messages to a channel. Ports are |
@@ -449,22 +449,22 @@ class Port { |
int get id => _port; |
// Send a message to the channel. Not blocking. |
- @fletch.native void send(message) { |
- switch (fletch.nativeError) { |
- case fletch.wrongArgumentType: |
+ @dartino.native void send(message) { |
+ switch (dartino.nativeError) { |
+ case dartino.wrongArgumentType: |
throw new ArgumentError(); |
- case fletch.illegalState: |
+ case dartino.illegalState: |
throw new StateError("Port is closed."); |
default: |
- throw fletch.nativeError; |
+ throw dartino.nativeError; |
} |
} |
- @fletch.native void _sendExit(value) { |
+ @dartino.native void _sendExit(value) { |
throw new StateError("Port is closed."); |
} |
- @fletch.native external static Port _create(Channel channel); |
+ @dartino.native external static Port _create(Channel channel); |
} |
class Channel { |
@@ -543,7 +543,7 @@ class _ChannelEntry { |
bool isImmutable(Object object) => _isImmutable(object); |
-@fletch.native external bool _isImmutable(String string); |
+@dartino.native external bool _isImmutable(String string); |
/// Returns a channel that will receive a message in [milliseconds] |
/// milliseconds. |
@@ -556,4 +556,4 @@ Channel sleep(int milliseconds) { |
return channel; |
} |
-@fletch.native external void _sleep(int milliseconds, Port port); |
+@dartino.native external void _sleep(int milliseconds, Port port); |