lib: move "environ" from Symbol to String
authorJean Privat <jean@pryen.org>
Thu, 26 Apr 2012 18:01:55 +0000 (14:01 -0400)
committerJean Privat <jean@pryen.org>
Thu, 26 Apr 2012 18:01:55 +0000 (14:01 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

lib/standard/environ.nit
src/mmloader.nit
src/modelbuilder.nit
src/naive_interpreter.nit
src/nitc.nit
src/nitdoc.nit

index 2617852..f24d7bf 100644 (file)
 # Access to the environment variables of the process
 module environ
 
-import symbol
+import string
 
 # TODO prevoir une structure pour recup tout un environ, le modifier et le passer a process
 
-redef class Symbol
+redef class String
        # Return environment value for this symbol
        # If there is no such environment value, then return ""
        fun environ: String
        do
-               var res = to_s.to_cstring.get_environ
+               var res = self.to_cstring.get_environ
                # FIXME: There is no proper way to handle NULL C string yet. What a pitty.
                var nulstr = once ("".to_cstring.get_environ)
                if res != nulstr then
index 189a46b..c59b30c 100644 (file)
@@ -55,12 +55,12 @@ redef class ToolContext
                # Setup the paths value
                paths.append(opt_path.value)
 
-               var path_env = once ("NIT_PATH".to_symbol).environ
+               var path_env = "NIT_PATH".environ
                if not path_env.is_empty then
                        paths.append(path_env.split_with(':'))
                end
 
-               path_env = once ("NIT_DIR".to_symbol).environ
+               path_env = "NIT_DIR".environ
                if not path_env.is_empty then
                        var libname = "{path_env}/lib"
                        if libname.file_exists then paths.add(libname)
index 7d00c2a..a6efbe2 100644 (file)
@@ -67,12 +67,12 @@ class ModelBuilder
                # Setup the paths value
                paths.append(toolcontext.opt_path.value)
 
-               var path_env = once ("NIT_PATH".to_symbol).environ
+               var path_env = "NIT_PATH".environ
                if not path_env.is_empty then
                        paths.append(path_env.split_with(':'))
                end
 
-               path_env = once ("NIT_DIR".to_symbol).environ
+               path_env = "NIT_DIR".environ
                if not path_env.is_empty then
                        var libname = "{path_env}/lib"
                        if libname.file_exists then paths.add(libname)
index 9cda9a4..abb0189 100644 (file)
@@ -720,7 +720,7 @@ redef class AExternMethPropdef
                                recvval.to_s.mkdir
                                return null
                        else if pname == "get_environ" then
-                               var txt = args.first.val.as(Buffer).to_s.to_symbol.environ
+                               var txt = args.first.val.as(Buffer).to_s.environ
                                return v.native_string_instance(txt)
                        end
                else if pname == "native_argc" then
index e8f7d80..803f637 100644 (file)
@@ -59,7 +59,7 @@ class NitCompiler
                if ext != null then ext_prefix = ext else ext_prefix = ""
                compdir = opt_compdir.value
                if compdir == null then
-                       var dir = once ("NIT_COMPDIR".to_symbol).environ
+                       var dir = "NIT_COMPDIR".environ
                        if not dir.is_empty then
                                compdir = dir
                        end
@@ -72,7 +72,7 @@ class NitCompiler
 
                clibdir = opt_clibdir.value
                if clibdir == null then
-                       var dir = once ("NIT_DIR".to_symbol).environ
+                       var dir = "NIT_DIR".environ
                        if dir.is_empty then
                                dir = "{sys.program_name.dirname}/../clib"
                                if dir.file_exists then clibdir = dir
@@ -88,7 +88,7 @@ class NitCompiler
 
                bindir = opt_bindir.value
                if bindir == null then
-                       var dir = once ("NIT_DIR".to_symbol).environ
+                       var dir = "NIT_DIR".environ
                        if dir.is_empty then
                                dir = "{sys.program_name.dirname}/../bin"
                                if dir.file_exists then bindir = dir
index edf64f2..07227ab 100644 (file)
@@ -334,7 +334,7 @@ class DocContext
                
                sharedir = opt_sharedir.value
                if sharedir == null then
-                       var dir = once ("NIT_DIR".to_symbol).environ
+                       var dir = "NIT_DIR".environ
                        if dir.is_empty then
                                dir = "{sys.program_name.dirname}/../share/nitdoc"
                                if dir.file_exists then sharedir = dir