瀏覽代碼

added neko.vm.Deque

Nicolas Cannasse 17 年之前
父節點
當前提交
98c1d3f872
共有 3 個文件被更改,包括 48 次插入2 次删除
  1. 2 2
      doc/CHANGES.txt
  2. 1 0
      std/haxe/ImportAll.hx
  3. 45 0
      std/neko/vm/Deque.hx

+ 2 - 2
doc/CHANGES.txt

@@ -6,7 +6,7 @@ TODO optimizer : move multiple statics access into local variables
 TODO inlining : allow inlined getter/setter
 TODO inlining : substitute class+function type parameters in order to have fully typed expressions
 
-2008-??-??: 2.0
+2008-07-28: 2.0
 	fixed current package bug in inherited constructor type
 	delayed type-parameter constraints check (allow mutual rec extends for SPOD)
 	improved unclosed macro error reporting
@@ -18,7 +18,7 @@ TODO inlining : substitute class+function type parameters in order to have fully
 	flash9 : use findprop instead of findpropstrict for 'this' access (allow dynamic)
 	don't allow nullness changes in overrided/implemented
 	prevent typing hole with overriden polymorphic methods
-	added neko.vm.Mutex (included in neko 1.7.1)
+	added neko.vm.Mutex and neko.vm.Deque (included in neko 1.7.1)
 	added package remapping using --remap
 
 2008-07-17: 2.0-RC1

+ 1 - 0
std/haxe/ImportAll.hx

@@ -413,6 +413,7 @@ import neko.net.SocketOutput;
 import neko.net.ThreadRemotingServer;
 import neko.net.ThreadServer;
 
+import neko.vm.Deque;
 import neko.vm.Loader;
 import neko.vm.Module;
 import neko.vm.Mutex;

+ 45 - 0
std/neko/vm/Deque.hx

@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2005, The haXe Project Contributors
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE HAXE PROJECT CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE HAXE PROJECT CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ */
+package neko.vm;
+
+class Deque<T> {
+	var q : Void;
+	public function new() {
+		q = deque_create();
+	}
+	public function add( i : T ) {
+		deque_add(q,i);
+	}
+	public function push( i : T ) {
+		deque_push(q,i);
+	}
+	public function pop( block : Bool ) : T {
+		return deque_pop(q,block);
+	}
+	static var deque_create = neko.Lib.loadLazy("std","deque_create",0);
+	static var deque_add = neko.Lib.loadLazy("std","deque_add",2);
+	static var deque_push = neko.Lib.loadLazy("std","deque_push",2);
+	static var deque_pop = neko.Lib.loadLazy("std","deque_pop",2);
+}