Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basically, move code for %*ENV, @*INC, $*ARGFILES into separate file (as I feel these may become require a class of their own in the future). Move other PROCESS::<*> variables into a separate file. Adjust Makefiles accordingly. This should make it easier to adapt things in the future.
- Loading branch information
Showing
11 changed files
with
287 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
my @ARGS; | ||
my Mu $argiter := nqp::getcurhllsym('$!ARGITER'); | ||
@ARGS.push(nqp::p6box_s(nqp::shift($argiter))) while $argiter; | ||
nqp::bindkey(nqp::who(PROCESS), '@ARGS', @ARGS); | ||
PROCESS::<$ARGFILES> = IO::ArgFiles.new(:args(@ARGS)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
my %ENV; | ||
my Mu $env := nqp::getenvhash(); | ||
my Mu $enviter := nqp::iterator($env); | ||
my $envelem; | ||
my $key; | ||
while $enviter { | ||
$envelem := nqp::shift($enviter); | ||
$key = nqp::p6box_s(nqp::iterkey_s($envelem)); | ||
%ENV{$key} = nqp::p6box_s(nqp::iterval($envelem)); | ||
} | ||
PROCESS::<%ENV> := %ENV; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
my @INC; | ||
#?if jvm | ||
my $pathsep := $*VM.properties<path.separator>; | ||
#?endif | ||
#?if !jvm | ||
my $pathsep := $*VM.config<osname> eq 'MSWin32' ?? ';' !! ':'; | ||
#?endif | ||
@INC.push(%*ENV<RAKUDOLIB>.split($pathsep)) if %*ENV<RAKUDOLIB>; | ||
@INC.push(%*ENV<PERL6LIB>.split($pathsep)) if %*ENV<PERL6LIB>; | ||
|
||
#?if jvm | ||
for nqp::jvmclasspaths() -> $path { | ||
@INC.push($path) if nqp::stat($path, nqp::const::STAT_ISDIR); | ||
} | ||
#?endif | ||
|
||
my $prefix := | ||
#?if jvm | ||
$*VM.properties<perl6.prefix> | ||
#?endif | ||
#?if parrot | ||
$*VM.config<libdir> ~ $*VM.config<versiondir> | ||
#?endif | ||
#?if moar | ||
$*VM.config<prefix> | ||
#?endif | ||
~ '/languages/perl6'; | ||
|
||
# XXX Various issues with this stuff on JVM | ||
my Mu $compiler := nqp::getcurhllsym('$COMPILER_CONFIG'); # TEMPORARY | ||
my %CUSTOM_LIB; | ||
try { | ||
my $home := %*ENV<HOME> // %*ENV<HOMEDRIVE> ~ %*ENV<HOMEPATH>; | ||
my $ver := nqp::p6box_s(nqp::atkey($compiler, 'version')); | ||
%CUSTOM_LIB<home> = "$home/.perl6/$ver"; | ||
@INC.push(%CUSTOM_LIB<home> ~ '/lib'); | ||
} | ||
%CUSTOM_LIB<perl> = $prefix; | ||
%CUSTOM_LIB<vendor> = $prefix ~ '/vendor'; | ||
%CUSTOM_LIB<site> = $prefix ~ '/site'; | ||
@INC.push(%CUSTOM_LIB<site> ~ '/lib'); | ||
@INC.push(%CUSTOM_LIB<vendor> ~ '/lib'); | ||
@INC.push(%CUSTOM_LIB<perl> ~ '/lib'); | ||
PROCESS::<%CUSTOM_LIB> := %CUSTOM_LIB; | ||
|
||
my $I := nqp::atkey(nqp::atkey(%*COMPILING, '%?OPTIONS'), 'I'); | ||
if nqp::defined($I) { | ||
if nqp::islist($I) { | ||
my Mu $iter := nqp::iterator($I); | ||
@INC.unshift: nqp::p6box_s(nqp::shift($iter)) while $iter; | ||
} | ||
else { | ||
@INC.unshift: nqp::p6box_s($I); | ||
} | ||
} | ||
PROCESS::<@INC> := @INC; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
## duplicate src/core/IO.pm::cwd | ||
my $CWD = IO::Path.new(nqp::p6box_s( | ||
#?if parrot | ||
pir::trans_encoding__Ssi( | ||
nqp::cwd(), | ||
pir::find_encoding__Is('utf8')) | ||
#?endif | ||
#?if !parrot | ||
nqp::cwd(), | ||
#?endif | ||
)); | ||
PROCESS::<$CWD> = $CWD; | ||
|
||
my $PID = nqp::p6box_i(nqp::getpid()); | ||
PROCESS::<$PID> = $PID; | ||
|
||
my $EXECUTABLE = | ||
#?if parrot | ||
nqp::p6box_s(pir::interpinfo__Si(pir::const::INTERPINFO_EXECUTABLE_FULLNAME)); | ||
#?endif | ||
#?if jvm | ||
$*VM.properties<perl6.execname> | ||
or $*VM.properties<perl6.prefix> ~ '/bin/perl6-j'; | ||
#?endif | ||
#?if moar | ||
nqp::execname() | ||
or ($*VM.config<prefix> ~ '/bin/' ~ ($*VM.config<osname> eq 'MSWin32' ?? 'perl6-m.bat' !! 'perl6-m')); | ||
#?endif | ||
$EXECUTABLE := $EXECUTABLE.path.absolute; | ||
PROCESS::<$EXECUTABLE> = $EXECUTABLE; | ||
PROCESS::<$EXECUTABLE_NAME> = $EXECUTABLE.basename; | ||
|
||
my Mu $comp := nqp::getcomp('perl6'); | ||
my $PROGRAM_NAME = $comp.user-progname(); | ||
PROCESS::<$PROGRAM_NAME> = $PROGRAM_NAME; | ||
|
||
PROCESS::<$TMPDIR> = IO::Spec.tmpdir().path; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.