D Paste by downs
Description: test18
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | module test18; import std.stdio, qd, std.string, tools.threadpool, SDL_ttf; void main() { screen(640, 140); int[] field; bool done; auto colors = [White~Black, Green, Red]; print(10, 10, "Gray: Unrecognized/unsupported D3DSAMP_MI[NP]FILTER value 3"); print(10, 30, "Green: state.c / 4838"); print(10, 50, "Red: ImmGetOpenStatus"); auto fieldsync = new Object; void push(int i) { const limit = 300; synchronized(fieldsync) { field ~= i; if (field.length > 300) field = field[$-300 .. $]; } } void draw_update() { int[] drawbuf; synchronized (fieldsync) drawbuf = field; foreach (k, e; drawbuf) { line(k*2+20, 80, k*2+20, screen.h - 10, colors[e]); } flip; events; } auto tp = new Threadpool(1); tp.addTask({ scope(exit) done = true; while (true) { auto ln = readln(); if (!ln) return; if (ln.find("unsupported D3DSAMP_MINFILTER") != -1) { push(0); continue; } if (ln.find("state.c / 4838") != -1) { push(1); continue; } if (ln.find("ImmGetOpenStatus") != -1) { push(2); continue; } printf("%.*s", ln.length, ln.ptr); } }); while (!done) { draw_update(); slowyield(); } } |