redshift 1.3.24 → 1.3.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +49 -0
- data/RELEASE-NOTES +34 -3
- data/Rakefile +81 -0
- data/bench/bench +1 -1
- data/bench/formula.rb +2 -3
- data/examples/pid.rb +6 -6
- data/examples/robots/lib/shell-world.rb +1 -1
- data/examples/scheduler.rb +6 -1
- data/ext/redshift/dvector-float/dvector-float.c +184 -0
- data/ext/redshift/dvector-float/dvector-float.h +36 -0
- data/ext/redshift/dvector-float/dvector-float.rb +33 -0
- data/ext/redshift/dvector-float/extconf.rb +2 -0
- data/lib/redshift/redshift.rb +5 -5
- data/lib/redshift/target/c/component-gen.rb +1 -1
- data/lib/redshift/target/c/flow-gen.rb +1 -1
- data/lib/redshift/target/c/flow/delay.rb +1 -1
- data/lib/redshift/target/c/world-gen.rb +101 -101
- data/lib/redshift/util/isaac.rb +2 -2
- data/lib/redshift/util/tkar-driver.rb +1 -1
- data/test/test.rb +1 -1
- data/test/test_buffer.rb +2 -2
- data/test/test_connect.rb +2 -2
- data/test/test_connect_parallel.rb +2 -2
- data/test/test_connect_strict.rb +4 -5
- data/test/test_constant.rb +2 -4
- data/test/test_delay.rb +2 -2
- data/test/test_derivative.rb +2 -2
- data/test/test_discrete.rb +2 -4
- data/test/test_discrete_isolated.rb +2 -4
- data/test/test_dvector-float.rb +110 -0
- data/test/test_dvector.rb +15 -17
- data/test/test_exit.rb +2 -4
- data/test/test_flow.rb +2 -4
- data/test/test_flow_link.rb +2 -4
- data/test/test_flow_sub.rb +2 -4
- data/test/test_flow_trans.rb +23 -25
- data/test/test_inherit.rb +2 -4
- data/test/test_inherit_event.rb +2 -4
- data/test/test_inherit_flow.rb +2 -4
- data/test/test_inherit_link.rb +2 -4
- data/test/test_inherit_setup.rb +2 -4
- data/test/test_inherit_state.rb +2 -4
- data/test/test_inherit_transition.rb +2 -4
- data/test/test_numerics.rb +2 -4
- data/test/test_queue.rb +3 -3
- data/test/test_queue_alone.rb +2 -2
- data/test/test_reset.rb +2 -4
- data/test/test_setup.rb +2 -4
- data/test/test_strict_continuity.rb +2 -4
- data/test/test_strict_reset_error.rb +2 -4
- data/test/test_strictness_error.rb +2 -4
- data/test/test_sync.rb +2 -2
- data/test/test_world.rb +2 -4
- metadata +80 -106
- data/.bnsignore +0 -27
- data/.gitignore +0 -9
- data/README +0 -25
- data/TODO +0 -431
- data/bench/aug17-ruby19.bench +0 -86
- data/bench/aug17.bench +0 -86
- data/bench/aug7.bench +0 -86
- data/bench/prof.html +0 -0
- data/examples/robots/README +0 -49
- data/ext/redshift/util/isaac/extconf.rb +0 -2
- data/ext/redshift/util/isaac/isaac.c +0 -129
- data/ext/redshift/util/isaac/rand.c +0 -140
- data/ext/redshift/util/isaac/rand.h +0 -61
- data/rakefile +0 -50
@@ -1,140 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
------------------------------------------------------------------------------
|
3
|
-
rand.c: By Bob Jenkins. My random number generator, ISAAC. Public Domain.
|
4
|
-
MODIFIED:
|
5
|
-
960327: Creation (addition of randinit, really)
|
6
|
-
970719: use context, not global variables, for internal state
|
7
|
-
980324: added main (ifdef'ed out), also rearranged randinit()
|
8
|
-
010626: Note that this is public domain
|
9
|
-
|
10
|
-
ADAPTED Aug2004 for use in Ruby by Joel VanderWerf
|
11
|
-
ADAPTED Jan2010 for 64 bit systems (same algorithm and results as 32 bit)
|
12
|
-
ADAPTED Jun2010 for use within the redshift project
|
13
|
-
------------------------------------------------------------------------------
|
14
|
-
*/
|
15
|
-
#ifndef RAND
|
16
|
-
#include "rand.h"
|
17
|
-
#endif
|
18
|
-
|
19
|
-
|
20
|
-
#define ind(mm,x) ((mm)[(x>>2)&(RANDSIZ-1)])
|
21
|
-
#define rngstep(mix,a,b,mm,m,m2,r,x) \
|
22
|
-
{ \
|
23
|
-
x = *m; \
|
24
|
-
a = ((a^(mix)) + *(m2++)); \
|
25
|
-
*(m++) = y = (ind(mm,x) + a + b); \
|
26
|
-
*(r++) = b = (ind(mm,y>>RANDSIZL) + x); \
|
27
|
-
}
|
28
|
-
|
29
|
-
void rs_isaac_rand(ctx)
|
30
|
-
randctx *ctx;
|
31
|
-
{
|
32
|
-
register ub4 a,b,x,y,*m,*mm,*m2,*r,*mend;
|
33
|
-
mm=ctx->randmem; r=ctx->randrsl;
|
34
|
-
a = ctx->randa; b = (ctx->randb + (++ctx->randc));
|
35
|
-
for (m = mm, mend = m2 = m+(RANDSIZ/2); m<mend; )
|
36
|
-
{
|
37
|
-
rngstep( a<<13, a, b, mm, m, m2, r, x);
|
38
|
-
rngstep( a>>6 , a, b, mm, m, m2, r, x);
|
39
|
-
rngstep( a<<2 , a, b, mm, m, m2, r, x);
|
40
|
-
rngstep( a>>16, a, b, mm, m, m2, r, x);
|
41
|
-
}
|
42
|
-
for (m2 = mm; m2<mend; )
|
43
|
-
{
|
44
|
-
rngstep( a<<13, a, b, mm, m, m2, r, x);
|
45
|
-
rngstep( a>>6 , a, b, mm, m, m2, r, x);
|
46
|
-
rngstep( a<<2 , a, b, mm, m, m2, r, x);
|
47
|
-
rngstep( a>>16, a, b, mm, m, m2, r, x);
|
48
|
-
}
|
49
|
-
ctx->randb = b; ctx->randa = a;
|
50
|
-
}
|
51
|
-
|
52
|
-
|
53
|
-
#define mix(a,b,c,d,e,f,g,h) \
|
54
|
-
{ \
|
55
|
-
a^=b<<11; d+=a; b+=c; \
|
56
|
-
b^=c>>2; e+=b; c+=d; \
|
57
|
-
c^=d<<8; f+=c; d+=e; \
|
58
|
-
d^=e>>16; g+=d; e+=f; \
|
59
|
-
e^=f<<10; h+=e; f+=g; \
|
60
|
-
f^=g>>4; a+=f; g+=h; \
|
61
|
-
g^=h<<8; b+=g; h+=a; \
|
62
|
-
h^=a>>9; c+=h; a+=b; \
|
63
|
-
}
|
64
|
-
|
65
|
-
/* if (flag==TRUE), then use the contents of randrsl[] to initialize mm[]. */
|
66
|
-
void rs_isaac_init(ctx, flag)
|
67
|
-
randctx *ctx;
|
68
|
-
int flag;
|
69
|
-
{
|
70
|
-
int i;
|
71
|
-
ub4 a,b,c,d,e,f,g,h;
|
72
|
-
ub4 *m,*r;
|
73
|
-
ctx->randa = ctx->randb = ctx->randc = 0;
|
74
|
-
m=ctx->randmem;
|
75
|
-
r=ctx->randrsl;
|
76
|
-
a=b=c=d=e=f=g=h=0x9e3779b9; /* the golden ratio */
|
77
|
-
|
78
|
-
for (i=0; i<4; ++i) /* scramble it */
|
79
|
-
{
|
80
|
-
mix(a,b,c,d,e,f,g,h);
|
81
|
-
}
|
82
|
-
|
83
|
-
if (flag)
|
84
|
-
{
|
85
|
-
/* initialize using the contents of r[] as the seed */
|
86
|
-
for (i=0; i<RANDSIZ; i+=8)
|
87
|
-
{
|
88
|
-
a+=r[i ]; b+=r[i+1]; c+=r[i+2]; d+=r[i+3];
|
89
|
-
e+=r[i+4]; f+=r[i+5]; g+=r[i+6]; h+=r[i+7];
|
90
|
-
mix(a,b,c,d,e,f,g,h);
|
91
|
-
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
|
92
|
-
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
|
93
|
-
}
|
94
|
-
/* do a second pass to make all of the seed affect all of m */
|
95
|
-
for (i=0; i<RANDSIZ; i+=8)
|
96
|
-
{
|
97
|
-
a+=m[i ]; b+=m[i+1]; c+=m[i+2]; d+=m[i+3];
|
98
|
-
e+=m[i+4]; f+=m[i+5]; g+=m[i+6]; h+=m[i+7];
|
99
|
-
mix(a,b,c,d,e,f,g,h);
|
100
|
-
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
|
101
|
-
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
|
102
|
-
}
|
103
|
-
}
|
104
|
-
else
|
105
|
-
{
|
106
|
-
/* fill in mm[] with messy stuff */
|
107
|
-
for (i=0; i<RANDSIZ; i+=8)
|
108
|
-
{
|
109
|
-
mix(a,b,c,d,e,f,g,h);
|
110
|
-
m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
|
111
|
-
m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
|
-
rs_isaac_rand(ctx); /* fill in the first set of results */
|
116
|
-
ctx->randcnt=RANDSIZ; /* prepare to use the first set of results */
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
#ifdef NEVER
|
121
|
-
#include <stdio.h>
|
122
|
-
|
123
|
-
int main()
|
124
|
-
{
|
125
|
-
ub4 i,j;
|
126
|
-
randctx ctx;
|
127
|
-
ctx.randa=ctx.randb=ctx.randc=(ub4)0;
|
128
|
-
for (i=0; i<RANDSIZ; ++i) ctx.randrsl[i]=(ub4)0;
|
129
|
-
rs_isaac_init(&ctx, 1);
|
130
|
-
for (i=0; i<2; ++i)
|
131
|
-
{
|
132
|
-
rs_isaac_rand(&ctx);
|
133
|
-
for (j=0; j<RANDSIZ; ++j)
|
134
|
-
{
|
135
|
-
printf("%.8lx",(long unsigned int)ctx.randrsl[j]);
|
136
|
-
if ((j&7)==7) printf("\n");
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
#endif
|
@@ -1,61 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
------------------------------------------------------------------------------
|
3
|
-
rand.h: definitions for a random number generator
|
4
|
-
By Bob Jenkins, 1996, Public Domain
|
5
|
-
MODIFIED:
|
6
|
-
960327: Creation (addition of randinit, really)
|
7
|
-
970719: use context, not global variables, for internal state
|
8
|
-
980324: renamed seed to flag
|
9
|
-
980605: recommend RANDSIZL=4 for noncryptography.
|
10
|
-
010626: note this is public domain
|
11
|
-
|
12
|
-
ADAPTED Aug2004 for use in Ruby by Joel VanderWerf
|
13
|
-
ADAPTED Jan2010 for 64 bit systems (same algorithm and results as 32 bit)
|
14
|
-
ADAPTED Jun2010 for use within the redshift project
|
15
|
-
------------------------------------------------------------------------------
|
16
|
-
*/
|
17
|
-
|
18
|
-
#include <stdint.h>
|
19
|
-
|
20
|
-
typedef uint32_t ub4;
|
21
|
-
|
22
|
-
#ifndef RAND
|
23
|
-
#define RAND
|
24
|
-
#define RANDSIZL (8) /* I recommend 8 for crypto, 4 for simulations */
|
25
|
-
#define RANDSIZ (1<<RANDSIZL)
|
26
|
-
|
27
|
-
/* context of random number generator */
|
28
|
-
struct randctx
|
29
|
-
{
|
30
|
-
ub4 randcnt;
|
31
|
-
ub4 randrsl[RANDSIZ];
|
32
|
-
ub4 randmem[RANDSIZ];
|
33
|
-
ub4 randa;
|
34
|
-
ub4 randb;
|
35
|
-
ub4 randc;
|
36
|
-
};
|
37
|
-
typedef struct randctx randctx;
|
38
|
-
|
39
|
-
/*
|
40
|
-
------------------------------------------------------------------------------
|
41
|
-
If (flag==TRUE), then use the contents of randrsl[0..RANDSIZ-1] as the seed.
|
42
|
-
------------------------------------------------------------------------------
|
43
|
-
*/
|
44
|
-
void rs_isaac_init(randctx *r, int flag);
|
45
|
-
|
46
|
-
void rs_isaac_rand(randctx *r);
|
47
|
-
|
48
|
-
|
49
|
-
/*
|
50
|
-
------------------------------------------------------------------------------
|
51
|
-
Call rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value
|
52
|
-
------------------------------------------------------------------------------
|
53
|
-
*/
|
54
|
-
#define rand(r) \
|
55
|
-
(!(r)->randcnt-- ? \
|
56
|
-
(rs_isaac_rand(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->randcnt]) : \
|
57
|
-
(r)->randrsl[(r)->randcnt])
|
58
|
-
|
59
|
-
#endif /* RAND */
|
60
|
-
|
61
|
-
|
data/rakefile
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'bones'
|
3
|
-
rescue LoadError
|
4
|
-
abort '### please install the bones gem ###'
|
5
|
-
end
|
6
|
-
|
7
|
-
ensure_in_path 'lib'
|
8
|
-
require 'redshift'
|
9
|
-
|
10
|
-
Bones {
|
11
|
-
name 'redshift'
|
12
|
-
authors 'Joel VanderWerf'
|
13
|
-
email 'vjoel@users.sourceforge.net'
|
14
|
-
url 'http://rubyforge.org/projects/redshift'
|
15
|
-
rubyforge.name 'redshift'
|
16
|
-
version RedShift::VERSION
|
17
|
-
readme_file 'README'
|
18
|
-
|
19
|
-
summary 'Simulation of hybrid automata'
|
20
|
-
description <<END
|
21
|
-
A framework for simulation of networks of hybrid automata, similar to SHIFT and Lambda-SHIFT. Includes ruby-based DSL for defining simulation components, and ruby/C code generation and runtime.
|
22
|
-
END
|
23
|
-
|
24
|
-
depend_on 'cgen'
|
25
|
-
depend_on 'tkar'
|
26
|
-
|
27
|
-
history_file 'RELEASE-NOTES'
|
28
|
-
changes File.read(history_file)[/^\w.*?(?=^\w)/m]
|
29
|
-
rdoc.dir "rdoc" ## Note: doc dir has original content files
|
30
|
-
rdoc.include ["README", "RELEASE-NOTES", "ext", "lib"]
|
31
|
-
rdoc.exclude ["examples", "test", "bench"]
|
32
|
-
|
33
|
-
spec.opts << '--color'
|
34
|
-
test.files = [] ## Dir["test/test_*.rb"]
|
35
|
-
}
|
36
|
-
|
37
|
-
task 'test' do
|
38
|
-
Dir.chdir 'test' do
|
39
|
-
system "./test.rb"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
ENV["VERSION"] = RedShift::VERSION ## why isn't this automatic?
|
44
|
-
|
45
|
-
task 'gem:release' => 'rubyforge:release' # to release to rubyforge as well
|
46
|
-
|
47
|
-
task :release => ["rubyforge:release", "rubyforge:doc_release"]
|
48
|
-
|
49
|
-
# EOF
|
50
|
-
|