Mercurial > repos > rhope
comparison kernel.rhope @ 147:f3686f60985d
Sort of working port of framework. Transaction bug seems to be getting in the way. Going to work around, but want the old version in the repo so I can test later.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 22 Nov 2010 01:15:02 -0500 |
parents | 7bbdc034e347 |
children | f582fd6c75ee |
comparison
equal
deleted
inserted
replaced
146:1f39e69446f9 | 147:f3686f60985d |
---|---|
300 Yield[:out] | 300 Yield[:out] |
301 { | 301 { |
302 out <- Pause[Resume[?,Yes]] | 302 out <- Pause[Resume[?,Yes]] |
303 } | 303 } |
304 | 304 |
305 Foreign C:libc | |
306 { | |
307 rand[:out(Int32,Naked)] | |
308 srand[seed(Int32,Naked)] | |
309 time[storage(Int64,Raw Pointer,Mutable):storage] | |
310 } | |
311 | |
312 Globals _rand | |
313 { | |
314 seeded <- No | |
315 } | |
316 | |
317 _Seeded?[:yep,nope] uses _rand | |
318 { | |
319 Print["Seeded"] | |
320 yep,nope <- If[_rand::seeded] {} | |
321 { | |
322 _rand::seeded <- Yes | |
323 } | |
324 } | |
325 | |
326 _srand[val:out] | |
327 { | |
328 srand[] | |
329 out <- Yes | |
330 } | |
331 | |
332 Random[:out] | |
333 { | |
334 Print["Random"] | |
335 yep,nope <- _Seeded?[] | |
336 Val[yep] | |
337 { | |
338 _srand[Trunc Int32[time[0i64]]] | |
339 { out <- rand[] } | |
340 } | |
341 Val[nope] | |
342 { | |
343 out <- rand[] | |
344 } | |
345 } | |
346 | |
347 |