Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor $*IN, $*OUT, $*ERR. Add $*PERL. Add --version option.
- Loading branch information
Showing
5 changed files
with
85 additions
and
51 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 @@ | ||
2010.06 |
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,27 @@ | ||
#! perl | ||
|
||
=head1 TITLE | ||
gen_version.pl - script to generate Rakudo version information | ||
=cut | ||
|
||
use POSIX 'strftime'; | ||
|
||
print "# generated by build/gen_version.pl\n"; | ||
|
||
open(my $fh, "<", "VERSION") or die $!; | ||
my $VERSION = <$fh>; | ||
close $fh; | ||
|
||
if (-d '.git' && open(my $GIT, '-|', "git describe")) { | ||
$VERSION = <$GIT>; | ||
close $GIT; | ||
} | ||
|
||
chomp $VERSION; | ||
print ".macro_const RAKUDO_VERSION '$VERSION'\n"; | ||
|
||
|
||
my $date = strftime('%Y-%m-%dT%H:%M:%SZ', gmtime); | ||
print ".macro_const RAKUDO_BUILD_DATE '$date'\n"; |
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 |
---|---|---|
@@ -1,57 +1,50 @@ | ||
# Really we should be able to write $PROCESS::IN := ... | ||
|
||
INIT { | ||
Q:PIR { | ||
.local pmc IO | ||
IO = get_hll_global 'IO' | ||
package PROCESS { | ||
INIT { | ||
our $IN = IO.new(:PIO(pir::getstdin__P)); | ||
our $OUT = IO.new(:PIO(pir::getstdout__P)); | ||
our $ERR = IO.new(:PIO(pir::getstderr__P)); | ||
|
||
$P0 = getstdin | ||
$P0.'encoding'('utf8') | ||
$P0 = IO.'new'('PIO'=>$P0) | ||
set_hll_global ['PROCESS'], '$IN', $P0 | ||
our $PERL = { | ||
name => 'Rakudo', | ||
version => Q:PIR { %r = box .RAKUDO_VERSION } | ||
}; | ||
|
||
$P0 = getstdout | ||
$P0.'encoding'('utf8') | ||
$P0 = IO.'new'('PIO'=>$P0) | ||
set_hll_global ['PROCESS'], '$OUT', $P0 | ||
|
||
$P0 = getstderr | ||
$P0.'encoding'('utf8') | ||
$P0 = IO.'new'('PIO'=>$P0) | ||
set_hll_global ['PROCESS'], '$ERR', $P0 | ||
|
||
## set up $*OS, $*OSVER $*EXECUTABLE_NAME | ||
.include 'sysinfo.pasm' | ||
.local string info | ||
info = sysinfo .SYSINFO_PARROT_OS_VERSION | ||
$P0 = new ['Str'] | ||
$P0 = info | ||
set_hll_global ['PROCESS'], '$OSVER', $P0 | ||
## do the OS last so that the PID workaround can use info | ||
info = sysinfo .SYSINFO_PARROT_OS | ||
$P0 = new ['Str'] | ||
$P0 = info | ||
set_hll_global ['PROCESS'], '$OS', $P0 | ||
|
||
## Set up $*PID. Parrot doesn't give us the PID for now. | ||
## idea: http://irclog.perlgeek.de/parrot/2010-04-19#i_2242900 | ||
## Well, this file *is* in the cheats directory... :-) | ||
.local pmc library | ||
.local string getpid_func | ||
null library | ||
getpid_func = 'getpid' | ||
if info != 'MSWin32' goto setup_io_non_MSWin32 | ||
## Do it differently on Windows | ||
library = loadlib 'kernel32' | ||
getpid_func = 'GetCurrentProcessId' | ||
setup_io_non_MSWin32: | ||
$P0 = dlfunc library, getpid_func, 'i' | ||
$I0 = 0 | ||
unless $P0 goto setup_io_no_getpid_func | ||
$I0 = $P0() | ||
setup_io_no_getpid_func: | ||
$P0 = box $I0 | ||
set_hll_global ['PROCESS'], '$PID', $P0 | ||
## Parrot request: http://trac.parrot.org/parrot/ticket/1564 | ||
Q:PIR { | ||
## set up $*OS, $*OSVER $*EXECUTABLE_NAME | ||
.include 'sysinfo.pasm' | ||
.local string info | ||
info = sysinfo .SYSINFO_PARROT_OS_VERSION | ||
$P0 = new ['Str'] | ||
$P0 = info | ||
set_hll_global ['PROCESS'], '$OSVER', $P0 | ||
## do the OS last so that the PID workaround can use info | ||
info = sysinfo .SYSINFO_PARROT_OS | ||
$P0 = new ['Str'] | ||
$P0 = info | ||
set_hll_global ['PROCESS'], '$OS', $P0 | ||
|
||
## Set up $*PID. Parrot doesn't give us the PID for now. | ||
## idea: http://irclog.perlgeek.de/parrot/2010-04-19#i_2242900 | ||
## Well, this file *is* in the cheats directory... :-) | ||
.local pmc library | ||
.local string getpid_func | ||
null library | ||
getpid_func = 'getpid' | ||
if info != 'MSWin32' goto setup_io_non_MSWin32 | ||
## Do it differently on Windows | ||
library = loadlib 'kernel32' | ||
getpid_func = 'GetCurrentProcessId' | ||
setup_io_non_MSWin32: | ||
$P0 = dlfunc library, getpid_func, 'i' | ||
$I0 = 0 | ||
unless $P0 goto setup_io_no_getpid_func | ||
$I0 = $P0() | ||
setup_io_no_getpid_func: | ||
$P0 = box $I0 | ||
set_hll_global ['PROCESS'], '$PID', $P0 | ||
## Parrot request: http://trac.parrot.org/parrot/ticket/1564 | ||
} | ||
} | ||
} |