Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 111 lines (95 sloc) 4.017 kB
4272fe4 @pmichaud Patches to convert many pir:: ops into nqp:: ops. Patch courtesy kbo…
pmichaud authored
1 sub term:<time>() { nqp::p6box_i(pir::time__I()) }
ddc0166 @pmichaud Add terms.pm .
pmichaud authored
2
fedd5b3 @pmichaud Add initial version of @*ARGS.
pmichaud authored
3 {
4 my @ARGS;
953c714 @pmichaud Clean up $*ARGFILES, .lines, .eof, and .get.
pmichaud authored
5 my Mu $argiter := pir::get_hll_global__Ps('$!ARGITER');
fedd5b3 @pmichaud Add initial version of @*ARGS.
pmichaud authored
6 @ARGS.push(nqp::p6box_s(nqp::shift($argiter))) while $argiter;
7 nqp::bindkey(pir::get_who__PP(PROCESS), '@ARGS', @ARGS);
9d489dd @moritz rename ArgFiles to IO::ArgFiles
moritz authored
8 $PROCESS::ARGFILES = IO::ArgFiles.new(:args(@ARGS));
ad8d7a6 @pmichaud Add %*ENV.
pmichaud authored
9
10 my %ENV;
11 my Mu $env := pir::new__Ps('Env');
12 my Mu $enviter := nqp::iterator($env);
13 my $key;
14 while $enviter {
15 $key = nqp::p6box_s(pir::shift__SP($enviter));
16 %ENV{$key} = nqp::p6box_s(nqp::atkey($env, nqp::unbox_s($key)));
17 }
616b622 @tadzik Fix a braino. benabik++ for noticing
tadzik authored
18 %ENV does role {
7845b8d @tadzik Implement setting env variables by modifying %*ENV
tadzik authored
19 method at_key($k) {
20 Proxy.new(
21 FETCH => {
e9d0bbb @tadzik Fix %*ENV regressions
tadzik authored
22 if nqp::p6bool(nqp::existskey($env, nqp::unbox_s($k))) {
23 nqp::p6box_s(nqp::atkey($env, nqp::unbox_s($k)))
24 }
25 else {
26 Any
27 }
7845b8d @tadzik Implement setting env variables by modifying %*ENV
tadzik authored
28 },
29 STORE => -> $, $v {
30 nqp::bindkey($env, nqp::unbox_s($k), nqp::unbox_s($v))
31 }
32 )
33 }
e9d0bbb @tadzik Fix %*ENV regressions
tadzik authored
34
35 method delete($k) {
36 my $ret = self.at_key($k);
37 pir::delete($env, nqp::unbox_s($k));
38 return $ret;
39 }
7845b8d @tadzik Implement setting env variables by modifying %*ENV
tadzik authored
40 }
ad8d7a6 @pmichaud Add %*ENV.
pmichaud authored
41 nqp::bindkey(pir::get_who__PP(PROCESS), '%ENV', %ENV);
f3d1b8f Implemented @*INC.
kboga authored
42
2708593 Implement $*VM and clean up @*INC.
kboga authored
43 my $VM = {
44 name => 'parrot', # XXX: should be made dynamical
45 config => pir::perl6ize_type__PP(
46 nqp::atpos(pir::getinterp, pir::const::IGLOBALS_CONFIG_HASH))
47 }
48 nqp::bindkey(pir::get_who__PP(PROCESS), '$VM', $VM);
49
5d7626b @pmichaud Revise $*PERL variable a bit.
pmichaud authored
50 my Mu $compiler := pir::find_caller_lex__PS('$COMPILER_CONFIG');
51 my $PERL = {
52 name => 'rakudo',
53 compiler => {
54 name => 'rakudo',
55 ver => nqp::p6box_s(nqp::atkey($compiler, 'version')),
56 release-number => nqp::p6box_s(nqp::atkey($compiler, 'release-number')),
57 build-date => nqp::p6box_s(nqp::atkey($compiler, 'build-date')),
58 codename => nqp::p6box_s(nqp::atkey($compiler, 'codename')),
59 }
60 };
c24b2f0 @moritz add $*PERL; LWP::Simple uses it
moritz authored
61 nqp::bindkey(pir::get_who__PP(PROCESS), '$PERL', $PERL);
62
0dc7d63 @moritz bring back $*CWD, run chdir.t
moritz authored
63 my $CWD = nqp::p6box_s(pir::new__PS('OS').cwd);
64 nqp::bindkey(pir::get_who__PP(PROCESS), '$CWD', $CWD);
65
f3d1b8f Implemented @*INC.
kboga authored
66 my @INC;
256e1db @moritz support RAKUDOLIB env variable in addition to PERL6LIB
moritz authored
67 @INC.push(%ENV<RAKUDOLIB>.split($VM<config><osname> eq 'MSWin32' ?? ';' !! ':')) if %ENV<RAKUDOLIB>;
10d9ee6 @moritz fix PERL6LIB separator
moritz authored
68 @INC.push(%ENV<PERL6LIB>.split($VM<config><osname> eq 'MSWin32' ?? ';' !! ':')) if %ENV<PERL6LIB>;
16a3b95 @moritz prevent startup error if %*ENV<HOME> is empty
moritz authored
69 try {
70 @INC.push((%ENV<HOME> // %ENV<HOMEDRIVE> ~ %ENV<HOMEPATH>) ~ '/.perl6/lib');
71 }
2708593 Implement $*VM and clean up @*INC.
kboga authored
72 @INC.push($VM<config><libdir> ~ $VM<config><versiondir> ~ '/languages/perl6/lib');
632b1f9 @moritz actually remove . from @*INC
moritz authored
73
4c241c8 @moritz implement -I command line option
moritz authored
74 my $I := nqp::atkey(nqp::atkey(%*COMPILING, '%?OPTIONS'), 'I');
75 if pir::defined($I) {
76 if pir::does($I, 'array') {
77 my Mu $iter := nqp::iterator($I);
78 @INC.unshift: nqp::p6box_s(nqp::shift($iter)) while $iter;
79 }
80 else {
81 @INC.unshift: nqp::p6box_s($I);
82 }
83 }
84
f3d1b8f Implemented @*INC.
kboga authored
85 nqp::bindkey(pir::get_who__PP(PROCESS), '@INC', @INC);
fedd5b3 @pmichaud Add initial version of @*ARGS.
pmichaud authored
86
496ec52 Implement $*PID.
kboga authored
87 my $PID = nqp::p6box_i(pir::getinterp.getpid());
88 nqp::bindkey(pir::get_who__PP(PROCESS), '$PID', $PID);
eba4254 Implement $*OS and $*OSVER.
kboga authored
89
90 my $OS = $VM<config><osname>; # XXX: master gets this information with the sysinfo dynop
91 nqp::bindkey(pir::get_who__PP(PROCESS), '$OS', $OS);
92
93 my $OSVER = $VM<config><osvers>; # XXX: master gets this information with the sysinfo dynop
94 nqp::bindkey(pir::get_who__PP(PROCESS), '$OSVER', $OSVER);
fde5bfd Implement $*EXECUTABLE_NAME.
kboga authored
95
96 my $EXECUTABLE_NAME =
97 nqp::p6box_s(pir::interpinfo__Si(pir::const::INTERPINFO_EXECUTABLE_FULLNAME));
98 nqp::bindkey(pir::get_who__PP(PROCESS), '$EXECUTABLE_NAME', $EXECUTABLE_NAME);
df5def8 Implement $*PROGRAM_NAME.
kboga authored
99
100 my $PROGRAM_NAME =
101 nqp::p6box_s(
102 nqp::atpos(
103 nqp::atpos(
104 pir::getinterp, pir::const::IGLOBALS_ARGV_LIST
105 ), 0
106 )
107 ) || 'interactive';
108 nqp::bindkey(pir::get_who__PP(PROCESS), '$PROGRAM_NAME', $PROGRAM_NAME);
109
496ec52 Implement $*PID.
kboga authored
110 }
Something went wrong with that request. Please try again.