[stupid-crypto] push by ben@links.org - Switch ostreams to being outputs. This will break Haskell, sorry. on 2010-03-07 23:56 GMT

0 views
Skip to first unread message

stupid...@googlecode.com

unread,
Mar 7, 2010, 6:56:49 PM3/7/10
to stupi...@googlegroups.com
Revision: 7d672fcea3
Author: Ben Laurie <be...@google.com>
Date: Sun Mar 7 15:55:58 2010
Log: Switch ostreams to being outputs. This will break Haskell, sorry.
http://code.google.com/p/stupid-crypto/source/detail?r=7d672fcea3

Added:
/test/bug-ostream-input.stupid
Modified:
/src/Stupid/C.pm
/src/stupid.pl
/test/ostream.stupid
/test/test.pl

=======================================
--- /dev/null
+++ /test/bug-ostream-input.stupid Sun Mar 7 15:55:58 2010
@@ -0,0 +1,11 @@
+"EXPECT-BUILD-FAIL:";
+
+function() test(ostream out) {
+ array(uint8, 13) hello = ( "Hello, world!" );
+ uint32 n = 0;
+
+ while(n ne32 13) {
+ out.put(hello[n]);
+ n = n plus32 1;
+ }
+}
=======================================
--- /src/Stupid/C.pm Fri Feb 26 04:53:07 2010
+++ /src/Stupid/C.pm Sun Mar 7 15:55:58 2010
@@ -2,6 +2,8 @@

use strict;

+use Carp;
+
sub Stupid::LanguageWrapper::emitCode {
my $self = shift;

@@ -266,11 +268,15 @@
print "uint8 *$name";
}

-sub Stupid::Type::OStream::emitArg {
+sub Stupid::Type::OStream::emitReturnDecl {
my $self = shift;
my $name = shift;

print "stupid_ostream *$name";
+}
+
+sub Stupid::Type::OStream::emitArg {
+ croak "ostreams must be outputs";
}

sub Stupid::Type::Array::emitReturnDecl {
=======================================
--- /src/stupid.pl Sun Feb 28 06:54:07 2010
+++ /src/stupid.pl Sun Mar 7 15:55:58 2010
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w

use strict;

=======================================
--- /test/ostream.stupid Sun Feb 14 05:11:24 2010
+++ /test/ostream.stupid Sun Mar 7 15:55:58 2010
@@ -1,6 +1,6 @@
"EXPECT:Hello, world!";

-function() test(ostream out) {
+function(ostream out) test() {
array(uint8, 13) hello = ( "Hello, world!" );
uint32 n = 0;

=======================================
--- /test/test.pl Tue Mar 2 07:29:31 2010
+++ /test/test.pl Sun Mar 7 15:55:58 2010
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/env perl -w

use strict;

Ben Clifford

unread,
Mar 8, 2010, 3:13:21 AM3/8/10
to stupi...@googlegroups.com

> This will break Haskell, sorry.

Turns out it didn't, although it did break Java.

I guess for Haskell I wrote dead code that your change suddenly made
live...

--

Ben Clifford

unread,
Mar 8, 2010, 3:47:17 AM3/8/10
to stupi...@googlegroups.com

I noticed I had to:

sudo port install p5-file-slurp

for this to work... what's the best place to build a human-readable list
of dependencies? a README?

--
http://www.hawaga.org.uk/ben/

Ben Laurie

unread,
Mar 19, 2010, 8:39:24 AM3/19/10
to stupi...@googlegroups.com
On 08/03/2010 08:47, Ben Clifford wrote:
>
> I noticed I had to:
>
> sudo port install p5-file-slurp
>
> for this to work... what's the best place to build a human-readable list
> of dependencies? a README?

Catching up slowly after travel - this looks easy enough to deal with
jetlagged :-)

README is one obvious place, works for me. Presumably in the top
directory...

--
http://www.apache-ssl.org/ben.html http://www.links.org/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Reply all
Reply to author
Forward
0 new messages