X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=jars.git;a=blobdiff_plain;f=run-mars.scm;h=30b9e5c9e8d6a89e16599d0ffb2875ff264cb22b;hp=7919e4da86402e669eb23d1808951fb2fd945de2;hb=5df4e85a21e1577f0589e5ca2907157ec4e4e392;hpb=b6d6c8632eadb09da87707a3e911d9d59c1779e4 diff --git a/run-mars.scm b/run-mars.scm index 7919e4d..30b9e5c 100644 --- a/run-mars.scm +++ b/run-mars.scm @@ -12,11 +12,13 @@ (colors-left colors)) (if (null? progs-left) entries - (let ((this-prog (car progs-left)) - (this-col (car colors-left))) - (loop (cons (cons (prog-name this-prog) this-col) entries) - (cdr progs-left) - (cdr colors-left)))))) + (if (null? colors-left) + (error "Not enough colours in colour map!") + (let ((this-prog (car progs-left)) + (this-col (car colors-left))) + (loop (cons (cons (prog-name this-prog) this-col) entries) + (cdr progs-left) + (cdr colors-left))))))) (define (mars-runner files iters core-size visualization) (print "Iters: " iters ", core size: " core-size) @@ -24,14 +26,13 @@ (lambda (fname) (string->prog (with-input-from-file fname read-string))) files)) - (empty-instr (make-instr 'DAT 'F 'immediate 0 'immediate 0)) (core (if visualization (let* ((colors '("red" "blue" "green" "magenta" "cyan")) (color-map (make-color-map progs colors)) (vis (make-vis 640 480 core-size color-map))) - (make-core 8000 empty-instr (lambda (i n) - (vis 'update-owner i n)))) - (make-core 8000 empty-instr))) + (make-core 8000 (lambda (i n) + (vis 'update-owner i n)))) + (make-core 8000))) (queues (run-mars core (install-progs core progs) iters))) (for-each (lambda (q) (print) @@ -65,4 +66,5 @@ (loop rest iters core-size #f)) ((files ...) (mars-runner files iters core-size visualization))))) + (main)