Re: [9fans] curiosity ...

2009-10-30 Thread Graham Gallagher
i didn't think squid boy had a chance On Sat, Oct 31, 2009 at 12:43 PM, Bruce Ellis wrote: > try this ... > > #include > #include > > void > main(void) > { >        memmove(nil, nil, 100); >        print("hello squid boy\n"); > } > > who would have thunk it? > > brucee > >

[9fans] curiosity ...

2009-10-30 Thread Bruce Ellis
try this ... #include #include void main(void) { memmove(nil, nil, 100); print("hello squid boy\n"); } who would have thunk it? brucee

Re: [9fans] sed question (OT)

2009-10-30 Thread Noah Evans
This kind of problem is character processing, which I would argue is C's domain. You can massage awk and sed to do the job for you, but at least for me it's conceptually simpler to just bang out the following C program: #include #include #include #define isupper(r) (L'A' <= (r) && (r) <=

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread Rudolf Sykora
2009/10/30 erik quanstrom : >> Python handles correctly e.g. 2-7, 2+-+-7, 2+++-7,... >> C-compiler that I use in my linux, gcc, is ok for a+-b and a-+b, also >> for a+-+-b, but not for a++b or a--b or any alike. > > you're confusing tokens and productions.  the c tokenizer > has the following r

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread matt
i'll leave as an excersize why k&r thought that making -- and ++ tokens was worth while. did DEC make them do it so they could issue trademark infringement lawsuits for copying the instruction mnemonic?

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread erik quanstrom
> Python handles correctly e.g. 2-7, 2+-+-7, 2+++-7,... > C-compiler that I use in my linux, gcc, is ok for a+-b and a-+b, also > for a+-+-b, but not for a++b or a--b or any alike. you're confusing tokens and productions. the c tokenizer has the following rules -- -> DEC ++ ->

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread Rudolf Sykora
2009/10/30 Martin Neubauer : > * Rudolf Sykora (rudolf.syk...@gmail.com) wrote: >> (a-- b wouldn't make sense) it probably can't (can it?) be parsed >> simply with yacc... > I don't see why it would be impossible. Just introduce a binary -- > operator (cf. -1 vs. 1-2). Whether it's worth it... Yes

Re: [9fans] sed question (OT) (OT) (OT) (OT) (OT)(OT)(OT)(OT)(OT)(OT)(OT)(OT)(OT)(OT)

2009-10-30 Thread W B Hacker
Tim Newsham wrote: Call me a Dinosaur, but - so long as it is ASCII or EBCDIC it is relatively trivial to implement that in hardware AND NOT have the issue of altering any but the first two words AND NOT have issues where there is only one word or a numeral or punctuation or hidden/control cha

Re: [9fans] sed question (OT) (OT) (OT)

2009-10-30 Thread Tim Newsham
Call me a Dinosaur, but - so long as it is ASCII or EBCDIC it is relatively trivial to implement that in hardware AND NOT have the issue of altering any but the first two words AND NOT have issues where there is only one word or a numeral or punctuation or hidden/control character rather than al

Re: [9fans] sed question (OT)

2009-10-30 Thread W B Hacker
Eris Discordia wrote: The script has a small "bug" one might say: it capitalizes the first two words on a line that are _not_ already capitalized. If one of the first two words is capitalized then the third will get capitalized. Call me a Dinosaur, but - so long as it is ASCII or EBCDIC it is

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread Martin Neubauer
* Rudolf Sykora (rudolf.syk...@gmail.com) wrote: > (a-- b wouldn't make sense) it probably can't (can it?) be parsed > simply with yacc... I don't see why it would be impossible. Just introduce a binary -- operator (cf. -1 vs. 1-2). Whether it's worth it...

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread Martin Neubauer
* Jorden Mauro (jrm8...@gmail.com) wrote: > The -- with no space may be harder to fix. More importantly, it actually is a syntax error. Consider: 1-(-2) //Add 2 to 1 1-- //Decrement 1, how? --2 //Decrement 2, how? 1--2//Decrement 1? Decrement 2? How?

Re: [9fans] sed question (OT)

2009-10-30 Thread erik quanstrom
On Fri Oct 30 11:31:24 EDT 2009, dav...@mac.com wrote: > You can do it, definitely. > well played! - erik

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread Rudolf Sykora
2009/10/30 Jorden Mauro : > Look under the production for expr in /sys/src/cmd/hoc/hoc.y > > Looks like the unary plus problem would be a one-line fix. The -- with no > space > may be harder to fix. Thanks, I will. Nonetheless, the problem, as I am thinking about it now, could possibly (also) be

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread Jorden Mauro
Look under the production for expr in /sys/src/cmd/hoc/hoc.y Looks like the unary plus problem would be a one-line fix. The -- with no space may be harder to fix. On Fri, Oct 30, 2009 at 11:44 AM, Rudolf Sykora wrote: > PS.: While 'bc' is not any better in this, 'maxima' gets it wright. > (Both

Re: [9fans] hoc's behaviour, unary operators

2009-10-30 Thread Rudolf Sykora
PS.: While 'bc' is not any better in this, 'maxima' gets it wright. (Both in linux.)

Re: [9fans] sed question (OT)

2009-10-30 Thread dave . l
You can do it, definitely. Caveat: I'm in bed with a virus and the brain's on impulse power so these are untested and may be highly suboptimal. Is the input guaranteed to have 2 words on each line? What are your definitions of words and blanks? I know from your snippet that there's no leading b

[9fans] hoc's behaviour, unary operators

2009-10-30 Thread Rudolf Sykora
Hello why 1+-2 is ok for the 'hoc' command, while both 1--2 1-+2 produce a syntax error? (If spaces are added as in 1- -2 1- +2, hoc is fine with the former but still rejects the latter...) Thanks Ruda

Re: [9fans] double wakeup disallowed

2009-10-30 Thread erik quanstrom
On Fri Oct 30 01:47:06 EDT 2009, r...@swtch.com wrote: > > btw, isn't the lockstats.locks++ in taslock:/^lock > > broken since >1 loads can happen simultaneously > > leading to undercounting? > > sure but does it need to be 100% accurate? probablly not. but it will be most inaccurate and cause t

Re: [9fans] automatic page sharing

2009-10-30 Thread erik quanstrom
> > Pardon if this has come up before, but what about the greatly > > increased time taken to launch a shared-lib program?  That's quite > > Not that much if your loaded caches the binaries of the programs (as > we do) and they > are small and for really shared state you have filesystems which > s

Re: [9fans] sed question (OT)

2009-10-30 Thread Eris Discordia
Listing of file 'sedscr:' s/^/ /; s/$/aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ/; s/ \([a-z]\)\(.*\1\)\(.\)/ \3\2\3/; s/ \([a-z]\)\(.*\1\)\(.\)/ \3\2\3/; s/.\{52\}$//; s/ //; $ echo This is a test | sed -f sedscr This Is a test $ echo someone forgot to capitalize | sed -f sedscr Som

Re: [9fans] sed question (OT)

2009-10-30 Thread Eris Discordia
The script has a small "bug" one might say: it capitalizes the first two words on a line that are _not_ already capitalized. If one of the first two words is capitalized then the third will get capitalized. --On Thursday, October 29, 2009 15:41 + Steve Simon wrote: Sorry, not really th

Re: [9fans] automatic page sharing

2009-10-30 Thread Richard Miller
> #include > #include > int main(void){exits(nil);} > > is 3317 bytes on my atom box. Bloatware! A quick visit to 6th edition Unix (on 32-bit Interdata) via the SIMH time machine produces this: # cat >t.c int main() {exit(0);} # cc t.c # ls -l a.out -rwxrwxrwx 1 root 164 Jun 4 15:53 a.o

Re: [9fans] automatic page sharing

2009-10-30 Thread Gorka Guardiola
On Fri, Oct 30, 2009 at 12:25 AM, Ethan Grammatikidis wrote: > On Thu, 29 Oct 2009 21:25:59 +0100 > Enrico Weigelt wrote: > Pardon if this has come up before, but what about the greatly > increased time taken to launch a shared-lib program?  That's quite Not that much if your loaded caches the