Procházet zdrojové kódy

minor fixes for documentation

Nicolas Cannasse před 14 roky
rodič
revize
401eede0c9

+ 114 - 0
std/cpp/_std/haxe/Int32.hx

@@ -24,4 +24,118 @@
  */
 package haxe;
 
+#if doc_gen
+
+class Int32 {
+
+	public static inline function make( a : Int, b : Int ) : Int32 {
+		return cast ((a << 16) | b);
+	}
+
+	public static inline function ofInt( x : Int ) : Int32 {
+		return clamp(cast x);
+	}
+
+	static inline function clamp( x : Int32 ) : Int32 {
+		#if (js || flash8)
+		return cast ((cast x) | 0); // force to-int convertion
+		#else
+		return x;
+		#end
+	}
+
+	public static inline function toInt( x : Int32 ) : Int {
+		if( (((cast x) >> 30) & 1) != ((cast x) >>> 31) ) throw "Overflow " + x;
+		#if php
+		return (cast x) & 0xFFFFFFFF;
+		#else
+		return cast x;
+		#end
+	}
+
+	public static inline function toNativeInt( x : Int32 ) : Int {
+		return cast x;
+	}
+
+	public static inline function add( a : Int32, b : Int32 ) : Int32 {
+		return clamp(cast ((cast a) + (cast b)));
+	}
+
+	public static inline function sub( a : Int32, b : Int32 ) : Int32 {
+		return clamp(cast ((cast a) - (cast b)));
+	}
+
+	public static inline function mul( a : Int32, b : Int32 ) : Int32 {
+		return clamp(cast ((cast a) * (cast b)));
+	}
+
+	public static inline function div( a : Int32, b : Int32 ) : Int32 {
+		return cast Std.int(cast(a) / cast(b));
+	}
+
+	public static inline function mod( a : Int32, b : Int32 ) : Int32 {
+		return cast (cast(a) % cast(b));
+	}
+
+	public static inline function shl( a : Int32, b : Int ) : Int32 {
+		return cast ((cast a) << b);
+	}
+
+	public static inline function shr( a : Int32, b : Int ) : Int32 {
+		return cast ((cast a) >> b);
+	}
+
+	public static inline function ushr( a : Int32, b : Int ) : Int32 {
+		return cast ((cast a) >>> b);
+	}
+
+	public static inline function and( a : Int32, b : Int32 ) : Int32 {
+		return cast ((cast a) & (cast b));
+	}
+
+	public static inline function or( a : Int32, b : Int32 ) : Int32 {
+		return cast ((cast a) | (cast b));
+	}
+
+	public static inline function xor( a : Int32, b : Int32 ) : Int32 {
+		return cast ((cast a) ^ (cast b));
+	}
+
+	public static inline function neg( a : Int32 ) : Int32 {
+		return cast -(cast a);
+	}
+
+	public static inline function isNeg( a : Int32 ) : Bool {
+		return (cast a) < 0;
+	}
+
+	public static inline function isZero( a : Int32 ) : Bool {
+		return (cast a) == 0;
+	}
+
+	public static inline function complement( a : Int32 ) : Int32 {
+		return cast ~(cast a);
+	}
+
+	public static inline function compare( a : Int32, b : Int32 ) : Int {
+		#if neko
+		return untyped __i32__compare(a,b);
+		#else
+		return untyped a - b;
+		#end
+	}
+
+	/**
+		Compare two Int32 in unsigned mode.
+	**/
+	public static function ucompare( a : Int32, b : Int32 ) : Int {
+		if( isNeg(a) )
+			return isNeg(b) ? compare(complement(b),complement(a)) : 1;
+		return isNeg(b) ? -1 : compare(a,b);
+	}
+
+}
+
+#else
 typedef Int32 = cpp.CppInt32__;
+#end

+ 1 - 1
std/haxe/macro/Context.hx

@@ -174,7 +174,7 @@ class Context {
 		Add or modify a resource that will be accessible with haxe.Resource api.
 	**/
 	public static function addResource( name : String, data : haxe.io.Bytes ) {
-		return load("add_resource",2)(untyped name.__s,data.getData());
+		load("add_resource",2)(untyped name.__s,data.getData());
 	}
 
 	/**

+ 1 - 1
std/haxe/macro/Expr.hx

@@ -24,7 +24,7 @@
  */
 package haxe.macro;
 
-#if neko
+#if macro
 extern enum Position {
 }
 #else

+ 10 - 1
std/haxe/rtti/XmlParser.hx

@@ -198,6 +198,7 @@ class XmlParser {
 				continue;
 			// compare params ?
 			if( tinf.path == inf.path ) {
+				var sameType = true;
 				if( tinf.module == inf.module && tinf.doc == inf.doc && tinf.isPrivate == inf.isPrivate )
 					switch( ct ) {
 					case TClassdecl(c):
@@ -206,6 +207,7 @@ class XmlParser {
 							if( mergeClasses(c,c2) )
 								return;
 						default:
+							sameType = false;
 						}
 					case TEnumdecl(e):
 						switch( t ) {
@@ -213,6 +215,7 @@ class XmlParser {
 							if( mergeEnums(e,e2) )
 								return;
 						default:
+							sameType = false;
 						}
 					case TTypedecl(td):
 						switch( t ) {
@@ -222,9 +225,15 @@ class XmlParser {
 						default:
 						}
 					case TPackage(_,_,_):
+						sameType = false;
 					}
 				// we already have a mapping, but which is incompatible
-				throw "Incompatibilities between "+tinf.path+" in "+tinf.platforms.join(",")+" and "+curplatform;
+				var msg = if( tinf.module != inf.module ) "module "+inf.module+" should be "+tinf.module;
+					else if( tinf.doc != inf.doc ) "documentation is different";
+					else if( tinf.isPrivate != inf.isPrivate ) "private flag is different";
+					else if( !sameType ) "type kind is different";
+					else "could not merge definition";
+				throw "Incompatibilities between "+tinf.path+" in "+tinf.platforms.join(",")+" and "+curplatform+" ("+msg+")";
 			}
 		}
 		cur.push(t);

+ 1 - 1
std/neko/NativeArray.hx

@@ -31,7 +31,7 @@ class NativeArray<T> implements ArrayAccess<T> {
 	}
 
 	public static inline function blit<T>( dst : NativeArray<T>, dstPos : Int, src : NativeArray<T>, srcPos : Int, length : Int ) {
-		return untyped __dollar__ablit(dst,dstPos,src,srcPos,length);
+		untyped __dollar__ablit(dst,dstPos,src,srcPos,length);
 	}
 
 	public static inline function ofArrayCopy<T>( a : Array<T> ) : NativeArray<T> {

+ 4 - 4
std/php/FileSystem.hx

@@ -51,7 +51,7 @@ class FileSystem {
 	}
 
 	public static inline function rename( path : String, newpath : String ) {
-		return untyped __call__("rename", path, newpath);
+		untyped __call__("rename", path, newpath);
 	}
 
 	public static function stat( path : String ) : FileStat {
@@ -91,15 +91,15 @@ class FileSystem {
 	}
 
 	public static inline function createDirectory( path : String ) {
-		return untyped __call__("@mkdir", path, 493); // php default is 0777, neko is 0755
+		untyped __call__("@mkdir", path, 493); // php default is 0777, neko is 0755
 	}
 
 	public static inline function deleteFile( path : String ) {
-		return untyped __call__("@unlink", path);
+		untyped __call__("@unlink", path);
 	}
 
 	public static inline function deleteDirectory( path : String ) {
-		return untyped __call__("@rmdir", path);
+		untyped __call__("@rmdir", path);
 	}
 
 	public static function readDirectory( path : String ) : Array<String> {

+ 1 - 1
std/sys/db/Object.hx

@@ -56,7 +56,7 @@ class Object {
 		untyped _manager.doDelete(this);
 	}
 
-	public function toString() {
+	public function toString() : String {
 		return untyped _manager.objectToString(this);
 	}