Explorar el Código

minor fixes in hl primitives

Nicolas Cannasse hace 9 años
padre
commit
c48002ba2d
Se han modificado 3 ficheros con 5 adiciones y 9 borrados
  1. 0 4
      src/generators/genhl.ml
  2. 3 3
      std/hl/_std/EReg.hx
  3. 2 2
      std/hl/_std/Sys.hx

+ 0 - 4
src/generators/genhl.ml

@@ -5224,10 +5224,6 @@ let interp code =
 				(function
 				| [VInt max] -> VInt (if max <= 0l then 0l else Random.int32 max)
 				| _ -> assert false)
-			| _ ->
-				unresolved())
-		| "regexp" ->
-			(match name with
 			| "regexp_new_options" ->
 				(function
 				| [VBytes str; VBytes opt] ->

+ 3 - 3
std/hl/_std/EReg.hx

@@ -185,15 +185,15 @@ private typedef ERegValue = hl.types.NativeAbstract<"ereg">;
 	}
 
 
-	@:hlNative("regexp", "regexp_new_options") static function regexp_new_options( bytes : hl.types.Bytes, options : hl.types.Bytes ) : ERegValue {
+	@:hlNative("std", "regexp_new_options") static function regexp_new_options( bytes : hl.types.Bytes, options : hl.types.Bytes ) : ERegValue {
 		return null;
 	}
 
-	@:hlNative("regexp", "regexp_match") static function regexp_match( r : ERegValue, str : hl.types.Bytes, pos : Int, size : Int ) : Bool {
+	@:hlNative("std", "regexp_match") static function regexp_match( r : ERegValue, str : hl.types.Bytes, pos : Int, size : Int ) : Bool {
 		return false;
 	}
 
-	@:hlNative("regexp", "regexp_matched_pos") static function regexp_matched_pos( r : ERegValue, n : Int, size : hl.types.Ref<Int> ) : Int {
+	@:hlNative("std", "regexp_matched_pos") static function regexp_matched_pos( r : ERegValue, n : Int, size : hl.types.Ref<Int> ) : Int {
 		return 0;
 	}
 

+ 2 - 2
std/hl/_std/Sys.hx

@@ -79,7 +79,7 @@ class Sys {
 	}
 
 	public static function putEnv( s : String, v : String ) : Void {
-		put_env(getPath(s),if( v == null ) null else getPath(v));
+		if( !put_env(getPath(s), if( v == null ) null else getPath(v)) ) throw "putEnv() failure";
 	}
 
 	public static function environment() : Map<String,String> {
@@ -154,7 +154,7 @@ class Sys {
 	@:hlNative("std", "file_stderr") static function file_stderr() : sys.io.File.FileHandle { return null; }
 	@:hlNative("std", "sys_args") static function sys_args() : hl.types.NativeArray<hl.types.Bytes> { return null; }
 	@:hlNative("std", "sys_get_env") static function get_env( key : hl.types.Bytes ) : hl.types.Bytes { return null; }
-	@:hlNative("std", "sys_put_env") static function put_env( key : hl.types.Bytes, val : hl.types.Bytes ) : Void {}
+	@:hlNative("std", "sys_put_env") static function put_env( key : hl.types.Bytes, val : hl.types.Bytes ) : Bool { return false; }
 	@:hlNative("std", "sys_env") static function sys_env() : hl.types.NativeArray<hl.types.Bytes> { return null; }
 	@:hlNative("std", "sys_set_time_locale") static function set_time_locale( loc : hl.types.Bytes ) : Bool { return true; }
 	@:hlNative("std", "sys_get_cwd") static function get_cwd() : hl.types.Bytes { return null; }