Skip to content

Instantly share code, notes, and snippets.

View bacek's full-sized avatar

Vasily Chekalkin bacek

View GitHub Profile
.sub 'main' :main
$P0 = socket 2,1,0
$P1 = sockaddr "www.ibm.com", 80
$P0.'connect'($P1)
$P0.'send'("HEAD /en/us HTTP/1.0\r\nHost: www.ibm.com\r\nConnection: close\r\n\r\n")
loop:
$S0 = read $P0, 1024
unless $S0 goto done
print $S0
index ad86d0a..fce4762 100644
--- a/include/parrot/io_win32.h
+++ b/include/parrot/io_win32.h
@@ -154,6 +154,23 @@ size_t Parrot_io_write_win32(PARROT_INTERP,
#define PIO_FLUSH(interp, pmc) Parrot_io_flush_win32((interp), (pmc))
#define PIO_GETBLKSIZE(handle) Parrot_io_getblksize_win32((handle))
+#define PIO_POLL(interp, pmc, which, sec, usec) \
+ Parrot_io_poll_win32((interp), (pmc), (which), (sec), (usec))
+#define PIO_NEW_SOCKET(interp, fam, type, proto) \
bacek@icering:~/src/parrot$ git log
commit c2095ae478e03a4c5eca5072cb5190c2ec3f8dec
Author: Vasily Chekalkin <bacek@bacek.com>
Date: Thu Mar 26 22:56:34 2009 +1100
Use socket methods in examples/io/httpd.pir instead of ops.
commit f45d52ed6f1f906839bdb617ab34de30beabca03
Author: Vasily Chekalkin <bacek@bacek.com>
Date: Thu Mar 26 22:53:41 2009 +1100
bacek@icering:~/src/parrot$ cat s2.patch
diff --git a/examples/io/httpd.pir b/examples/io/httpd.pir
index fe6a1c1..01a596c 100644
--- a/examples/io/httpd.pir
+++ b/examples/io/httpd.pir
@@ -111,11 +111,13 @@ The code was heavily hacked by bernhard and leo.
port = 1234
# TODO provide sys/socket constants
- listener = socket 2, 1, 6 # PF_INET, SOCK_STREAM, tcp
bacek@illusion:~/src/parrot/languages/rakudo$ cat http.pl
try {
say "Creating socket";
my $s = Q:PIR { %r = new 'Socket' };
say "Socket created";
$s.socket(2,1,6) or die "Can't create socket";
say "..fully";
my $addr = $s.sockaddr('www.ibm.com', 80);
$s.connect($addr) and die "Can't connect";
$s.send("HEAD / HTTP/1.0\r\n\r\n");
bacek@illusion:~/src/parrot/languages/rakudo$ cat http.pl
try {
my $s = Q:PIR { %r = new 'Socket' };
$s.socket(2,1,6);
my $addr = $s.sockaddr('www.ibm.com', 80);
$s.connect($addr);
$s.send("HEAD / HTTP/1.0\r\n\r\n");
.say for $s.recv;
};
bacek@icering:~/src/parrot$ git diff
diff --git a/examples/io/httpd.pir b/examples/io/httpd.pir
index 3970d37..2def929 100644
--- a/examples/io/httpd.pir
+++ b/examples/io/httpd.pir
@@ -93,6 +93,7 @@ The code was heavily hacked by bernhard and leo.
.include "stat.pasm"
.include 'except_types.pasm'
+.include 'socket.pasm'
diff --git a/CREDITS b/CREDITS
index 2a2dfa9..fc06194 100644
--- a/CREDITS
+++ b/CREDITS
@@ -31,4 +31,25 @@ U: pmichaud
D: Perl 6 (Rakudo Perl) lead developer, pumpking
E: pmichaud@pobox.com
+N: Vasily Chekalkin
+U: bacek
diff --git a/src/NQP/Grammar.pm b/src/NQP/Grammar.pm
index 95f590a..081d58c 100644
--- a/src/NQP/Grammar.pm
+++ b/src/NQP/Grammar.pm
@@ -275,7 +275,9 @@ rule scoped($*SCOPE) {
| <routine_declarator>
}
-token variable_declarator { <variable> }
+token variable_declarator {
~/src/nqp-rx (types)$ git diff master
diff --git a/src/NQP/Grammar.pm b/src/NQP/Grammar.pm
index 95f590a..4657ddc 100644
--- a/src/NQP/Grammar.pm
+++ b/src/NQP/Grammar.pm
@@ -7,7 +7,9 @@ method TOP() {
%*LANG<Regex-actions> := NQP::RegexActions;
%*LANG<MAIN> := NQP::Grammar;
%*LANG<MAIN-actions> := NQP::Actions;
- my $*SCOPE := '';