Skip to content

Commit

Permalink
use more idiomatic nqp
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Jun 28, 2010
1 parent 297e2ca commit dd7abe2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Partcl/commands/control.pm
Expand Up @@ -34,9 +34,9 @@ INIT {

if +@args >= 2 {
our %GLOBALS;
%GLOBALS{'errorInfo'} := @args[1];
%GLOBALS<errorInfo> := @args[1];
my $errorCode := @args[2] // 'NONE';
%GLOBALS{'errorCode'} := $errorCode;
%GLOBALS<errorCode> := $errorCode;
}

my $exception := pir::new__ps('Exception');
Expand Down
6 changes: 3 additions & 3 deletions src/Partcl/commands/info.pm
Expand Up @@ -40,7 +40,7 @@ our sub info(*@args) {
return '';
} elsif $cmd eq 'library' {
our %GLOBALS;
return %GLOBALS{'tcl_library'};
return %GLOBALS<tcl_library>;
} elsif $cmd eq 'loaded' {
return '';
} elsif $cmd eq 'locals' {
Expand All @@ -49,7 +49,7 @@ our sub info(*@args) {
return '';
} elsif $cmd eq 'patchlevel' {
our %GLOBALS;
return %GLOBALS{'tcl_patchLevel'};
return %GLOBALS<tcl_patchLevel>;
} elsif $cmd eq 'procs' {
return '';
} elsif $cmd eq 'script' {
Expand All @@ -58,7 +58,7 @@ our sub info(*@args) {
return '';
} elsif $cmd eq 'tclversion' {
our %GLOBALS;
return %GLOBALS{'tcl_version'};
return %GLOBALS<tcl_version>;
} elsif $cmd eq 'vars' {
return '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/Partcl/commands/main.pm
Expand Up @@ -94,7 +94,7 @@ our sub cd(*@args) {
if @args == 1 {
$dir := @args[0];
} else {
$dir := pir::new__ps('Env'){'HOME'};
$dir := pir::new__ps('Env')<HOME>;
}
my $OS := pir::new__ps('OS');
$OS.chdir($dir);
Expand Down
2 changes: 1 addition & 1 deletion src/Partcl/commands/package.pm
Expand Up @@ -18,7 +18,7 @@ our sub package(*@args) {
return '';
} elsif $cmd eq 'require' {
our %GLOBALS;
my $library := %GLOBALS{'tcl_library'};
my $library := %GLOBALS<tcl_library>;
my $package := @args.shift();
if $package eq 'tcltest' {
return Partcl::Compiler.evalfiles("$library/tcltest/tcltest.tcl");
Expand Down
12 changes: 6 additions & 6 deletions src/init.pm
Expand Up @@ -2,14 +2,14 @@

INIT {
our %GLOBALS := TclLexPad.newpad();
%GLOBALS{'tcl_version'} := '8.5';
%GLOBALS{'tcl_patchLevel'} := '8.5.6';
%GLOBALS{'tcl_library'} := 'library';
%GLOBALS<tcl_version> := '8.5';
%GLOBALS<tcl_patchLevel> := '8.5.6';
%GLOBALS<tcl_library> := 'library';

our %CHANNELS := TclLexPad.newpad();
%CHANNELS{'stdout'} := pir::getstdout__p();
%CHANNELS{'stderr'} := pir::getstderr__p();
%CHANNELS{'stdin'} := pir::getstdin__p();
%CHANNELS<stdout> := pir::getstdout__p();
%CHANNELS<stderr> := pir::getstderr__p();
%CHANNELS<stdin> := pir::getstdin__p();

my @interp := pir::getinterp__p();
my %PConfig := @interp[6]; ## .IGLOBALS_CONFIG_HASH
Expand Down

0 comments on commit dd7abe2

Please sign in to comment.