Skip to content

Commit

Permalink
Fixed subroutine and method definitions so that they don't violate co…
Browse files Browse the repository at this point in the history
…dingstd.
  • Loading branch information
soh-cah-toa committed Oct 16, 2011
1 parent 288b6bd commit 8ed312e
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 106 deletions.
10 changes: 5 additions & 5 deletions src/lib/Plumage/Dependencies.nqp
Expand Up @@ -17,7 +17,7 @@ Plumage::Dependencies - Resolve dependency relationships

class Plumage::Dependencies;

method resolve_dependencies (@projects) {
method resolve_dependencies(@projects) {
my @known_projects := Plumage::Metadata.get_project_list();
my @all_deps := self.all_dependencies(@projects);
my @installed := self.get_installed_projects;
Expand Down Expand Up @@ -60,7 +60,7 @@ method resolve_dependencies (@projects) {
return %resolutions;
}

method all_dependencies (@projects) {
method all_dependencies(@projects) {
my @dep_stack;
my @deps;
my %seen;
Expand Down Expand Up @@ -97,7 +97,7 @@ method all_dependencies (@projects) {
return @deps;
}

method get_installed_projects () {
method get_installed_projects() {
my $inst_file := replace_config_strings(%*CONF<installed_list_file>);
my $contents := slurp($inst_file);
my @projects := grep(-> $_ { ?$_ }, pir::split("\n", $contents));
Expand All @@ -109,14 +109,14 @@ method get_installed_projects () {
}
}

method mark_projects_installed (@projects) {
method mark_projects_installed(@projects) {
my $lines := pir::join("\n", @projects) ~ "\n";
my $inst_file := replace_config_strings(%*CONF<installed_list_file>);

append($inst_file, $lines);
}

method mark_projects_uninstalled (@projects) {
method mark_projects_uninstalled(@projects) {
my %uninst := set_from_array(@projects);
my $inst_file := replace_config_strings(%*CONF<installed_list_file>);
my $contents := slurp($inst_file);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Plumage/Metadata.nqp
Expand Up @@ -325,7 +325,7 @@ method saved_copy_path () {
return $copy_path;
}

sub _saved_copy_root () {
sub _saved_copy_root() {
return replace_config_strings(%*CONF<saved_metadata_root>);
}

Expand Down
44 changes: 22 additions & 22 deletions src/lib/Plumage/NQPUtil.nqp
Expand Up @@ -91,7 +91,7 @@ Return a true value if C<$key> exists in C<%hash>, or a false value otherwise.

=end

method exists ($key) {
method exists($key) {
return Q:PIR{
$P1 = find_lex '$key'
$I0 = exists self[$P1]
Expand All @@ -107,7 +107,7 @@ Return all the C<@keys> in the C<%hash> as an unordered array.

=end

method keys () {
method keys() {
my @keys;
for self { @keys.push($_.key); }
@keys;
Expand All @@ -121,7 +121,7 @@ Return all the C<@values> in the C<%hash> as an unordered array.

=end

method values () {
method values() {
my @values;
for self { @values.push($_.value); }
@values;
Expand All @@ -138,7 +138,7 @@ when iterating over key and value simultaneously:

=end

method kv () {
method kv() {
my @kv;
for self { @kv.push($_.key); @kv.push($_.value); }
@kv;
Expand Down Expand Up @@ -173,7 +173,7 @@ Return a C<@reversed> copy of the C<@array>.

=end

method reverse () {
method reverse() {
my @reversed;
for self { @reversed.unshift($_); }
@reversed;
Expand Down Expand Up @@ -205,7 +205,7 @@ one entry in the C<@mapped> output.

=end

sub map (&code, @originals) {
sub map(&code, @originals) {
my @mapped;

for @originals {
Expand All @@ -224,7 +224,7 @@ Order is retained, and duplicates are handled independently.

=end

sub grep (&code, @all) {
sub grep(&code, @all) {
my @matches;

for @all {
Expand Down Expand Up @@ -255,7 +255,7 @@ C<$result> is an undefined value.

=end

sub reduce (&code, @array, *@initial) {
sub reduce(&code, @array, *@initial) {
my $init_elems := pir::elements(@initial);
if $init_elems > 1 {
pir::die('Only one initial value allowed in reduce()');
Expand Down Expand Up @@ -310,7 +310,7 @@ Coerce a list of pairs into a hash.

=end

sub hash (*%h) { return %h }
sub hash(*%h) { return %h }

=begin

Expand All @@ -322,7 +322,7 @@ checks.

=end

sub set_from_array (@array) {
sub set_from_array(@array) {
my %set;

for @array {
Expand Down Expand Up @@ -420,7 +420,7 @@ Print a list of strings to standard output.

=end

sub print (*@strings) {
sub print(*@strings) {
for @strings {
pir::print($_);
}
Expand All @@ -434,7 +434,7 @@ Print a list of strings to standard output, followed by a newline.

=end

sub say (*@strings) {
sub say(*@strings) {
print(|@strings, "\n");
}

Expand All @@ -446,7 +446,7 @@ Read the C<$contents> of a file as a single string.

=end

sub slurp ($filename) {
sub slurp($filename) {
my $fh := pir::new__Ps('FileHandle');
$fh.open($filename, 'r');
my $contents := $fh.readall;
Expand All @@ -463,7 +463,7 @@ Write the string C<$contents> to a file.

=end

sub spew ($filename, $contents) {
sub spew($filename, $contents) {
my $fh := pir::new__Ps('FileHandle');
$fh.open($filename, 'w');
$fh.print($contents);
Expand All @@ -478,7 +478,7 @@ Append the string C<$contents> to a file.

=end

sub append ($filename, $contents) {
sub append($filename, $contents) {
my $fh := pir::new__Ps('FileHandle');
$fh.open($filename, 'a');
$fh.print($contents);
Expand Down Expand Up @@ -538,7 +538,7 @@ value if not.

=end

sub path_exists ($path) {
sub path_exists($path) {
my @stat := pir::root_new__PP(< parrot OS >).stat($path);
return 1;

Expand Down Expand Up @@ -620,7 +620,7 @@ following way:

=end

sub find_program ($program) {
sub find_program($program) {
my $path_sep := %*VM<config><osname> eq 'MSWin32' ?? ';' !! ':';
my %env := pir::root_new__PP(< parrot Env >);
my @paths := pir::split($path_sep, %env<PATH>);
Expand Down Expand Up @@ -649,7 +649,7 @@ top making directories as needed until an entire path has been created.

=end

sub mkpath ($path) {
sub mkpath($path) {
my @path := pir::split('/', $path);
my $cur := @path.shift;

Expand Down Expand Up @@ -682,7 +682,7 @@ if the process could not be spawned at all.

=end

sub run (*@command_and_args) {
sub run(*@command_and_args) {
my $aux := pir::spawnw__iP(@command_and_args);
my $ret := Q:PIR<
$P0 = find_lex '$aux'
Expand All @@ -706,7 +706,7 @@ successfully but itself exited with failure.

=end

sub do_run (*@command_and_args) {
sub do_run(*@command_and_args) {
say(pir::join(' ', @command_and_args));

return pir::spawnw__iP(@command_and_args) ?? 0 !! 1;
Expand All @@ -729,7 +729,7 @@ B<WARNING>: Parrot currently implements the pipe open B<INSECURELY>!

=end

sub qx (*@command_and_args) {
sub qx(*@command_and_args) {
my $cmd := pir::join(' ', @command_and_args);
my $pipe := pir::new__Ps('FileHandle');
$pipe.open($cmd, 'rp');
Expand Down Expand Up @@ -762,7 +762,7 @@ returning the C<$result> of executing the compiled code.

=end

sub eval ($source_code, $language) {
sub eval($source_code, $language) {
$language := pir::downcase($language);

pir::load_language($language);
Expand Down

0 comments on commit 8ed312e

Please sign in to comment.