diff options
| author | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2006-12-22 17:07:39 +0000 |
| commit | 37da2899f40661e3e9631e497da8dc59b971cbd0 (patch) | |
| tree | cbc6d4680e347d906f5fa7fca73214418741df72 /appl/cmd/irtest.b | |
| parent | 54bc8ff236ac10b3eaa928fd6bcfc0cdb2ba46ae (diff) | |
20060303a
Diffstat (limited to 'appl/cmd/irtest.b')
| -rw-r--r-- | appl/cmd/irtest.b | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/appl/cmd/irtest.b b/appl/cmd/irtest.b new file mode 100644 index 00000000..3d0260c7 --- /dev/null +++ b/appl/cmd/irtest.b @@ -0,0 +1,70 @@ +implement Irtest; + +include "sys.m"; + sys: Sys; +include "draw.m"; +include "ir.m"; + ir: Ir; + +Irtest: module +{ + init: fn(nil: ref Draw->Context, argv: list of string); +}; + +stderr: ref Sys->FD; + +init(nil: ref Draw->Context, nil: list of string) +{ + x := chan of int; + p := chan of int; + + sys = load Sys Sys->PATH; + stderr = sys->fildes(2); + + ir = load Ir Ir->PATH; + if(ir == nil) + ir = load Ir Ir->SIMPATH; + if(ir == nil) { + sys->fprint(stderr, "load ir: %r\n"); + return; + } + + if(ir->init(x,p) != 0) { + sys->fprint(stderr, "Ir->init: %r\n"); + return; + } + <-p; + + names := array[] of { + "Zero", + "One", + "Two", + "Three", + "Four", + "Five", + "Six", + "Seven", + "Eight", + "Nine", + "ChanUP", + "ChanDN", + "VolUP", + "VolDN", + "FF", + "Rew", + "Up", + "Dn", + "Select", + "Power", + }; + + while((c := <-x) != Ir->EOF){ + c = ir->translate(c); + if(c == ir->Error) + sys->print("Error\n"); + else if(c >= len names) + sys->print("unknown %d\n", c); + else + sys->print("%s\n", names[c]); + } +} |
