Mercurial > repos > rhope
annotate range.rhope @ 142:7bbdc034e347
Fix some bugs. Get basic network code working (epoll listener + accept connections). Start porting webserver.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 21 Nov 2010 16:33:17 -0500 |
parents | a34a982ecd32 |
children |
rev | line source |
---|---|
94
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 Blueprint Range |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 Start |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 End |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 Range[start,end:out] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 out <- [[Build[Range()]]Start <<[start]]End <<[end] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 First@Range[range:out,none] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 If[[[range]Start >>] < [[range]End >>]] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 out <- [range]Start >> |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 }{ |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 none <- range |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 Next@Range[range,val:out,done] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 next <- [val]+[1] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 If[[next] < [[range]End >>]] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
28 out <- Val[next] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 }{ |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 done <- range |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 Index@Range[range,index:out,notfound] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 If[[index] < [[range]End >>]] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 If[[index] < [[range]Start >>]] |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 { |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 notfound <- index |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 }{ |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 out <- index |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 }{ |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 notfound <- index |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 } |
05c22ff4b4ed
Forgot to add this with a prior commit
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 |
98
a34a982ecd32
Broken port of nworker to compiler
Mike Pavone <pavone@retrodev.com>
parents:
94
diff
changeset
|
49 Set@Range[range,index,val:out] |
a34a982ecd32
Broken port of nworker to compiler
Mike Pavone <pavone@retrodev.com>
parents:
94
diff
changeset
|
50 { |
a34a982ecd32
Broken port of nworker to compiler
Mike Pavone <pavone@retrodev.com>
parents:
94
diff
changeset
|
51 out <- [[()]Concatenate[range] |
a34a982ecd32
Broken port of nworker to compiler
Mike Pavone <pavone@retrodev.com>
parents:
94
diff
changeset
|
52 ]Set[index,val] |
a34a982ecd32
Broken port of nworker to compiler
Mike Pavone <pavone@retrodev.com>
parents:
94
diff
changeset
|
53 } |
a34a982ecd32
Broken port of nworker to compiler
Mike Pavone <pavone@retrodev.com>
parents:
94
diff
changeset
|
54 |