func put(n string, x, y, w, h uint) { // if str.Empty(n) { return } str.RemSpaces(&n) filename := n + suffix if scr.UnderX() { errh.Hint("bitte etwas Geduld ...") } buf := scr.P6Encode(x, y, w, h) if scr.UnderX() { errh.DelHint() } file := pseq.New(buf) file.Name(filename) file.Clr() file.Put(buf) file.Terminate() if !toPrint { exec.Command("pnmtopng", filename+suffix, ">", n, ".png").Run() ker.Msleep(100) exec.Command("rm", filename) } }
func doodle(c col.Colour, n int) { col.ScreenB = c scr.Cls() ker.Msleep(50) col.ScreenB = col.Black scr.Cls() scr.Colour(col.LightGreen) scr.Write("The murus-tool to remove \" \" is going to be executed, i.e.", y0, x0) scr.Write("your disk will be completely reformatted, one moment please ... ", y0+1, x0) doof(y0, 26) const m = 1 << 16 x := str.Clr(m) ok = false for i := 0; i < 10*n; i++ { if i == 0 { go rot(n) } file := pseq.New(x) file.Name(f + strconv.Itoa(i) + ".tmp") file.Clr() file.Ins(x) file.Terminate() } ok = true }
func NewCh(n uint, c CondSpectrum, e, l OpSpectrum) *ImpCh { // if n == 0 { return nil } x := new(ImpCh) x.nP = n x.ci, x.co = make([]chan Any, x.nP), make([]chan Any, x.nP) for i := uint(0); i < x.nP; i++ { x.ci[i], x.co[i] = make(chan Any), make(chan Any) } go func() { for { for k := uint(0); k < x.nP; k++ { select { case a := <-When(c(k), x.ci[k]): e(a, k) case a := <-x.co[k]: l(a, k) default: } } ker.Msleep(10) } }() return x }
func terminateX() { // // TODO wait (blink ()) // TODO terminate (blink ()) terminated = true ker.Msleep(250) // provisorial }
func terminateConsole() { // // TODO wait (blink()) // TODO terminate (blink()) terminated = true ker.Msleep(250) // provisorial cursorShape = Off print(esc1 + "H" + esc1 + "J") print(esc1 + "?25h" + esc1 + "?0c") }
// Pre: xker.x.initialized == true func catchX() { // for xker.Eventpipe == nil { ker.Msleep(10) } // println ("keyboard.catchX: Eventpipe != nil") for p := range xker.Eventpipe { xpipe <- p } close(xpipe) }
func soundfile() *os.File { // dev := env.Par(1) if dev == "" { dev = "cdrom" } var e error cdfile, e = os.OpenFile("/dev/"+dev, syscall.O_RDONLY|syscall.O_NONBLOCK, 0440) if e != nil { return nil } cdd = int(cdfile.Fd()) C.closeTray(C.int(cdd)) counter := 0 for { // anfangs dauert's manchmal 'ne Weile ... counter++ if counter > 30 { return nil } _, status = cstatus(cdd) if status == invalid { ker.Msleep(250 * 1000) } else { break } } nTracks = uint8(C.nTracks(C.int(cdd))) n1 := nTracks + 1 startFrame = make([]uint, n1) StartTime = make([]*clk.Imp, nTracks) Length = make([]*clk.Imp, nTracks) for t := uint8(0); t <= nTracks; t++ { startFrame[t] = uint(C.startFrame(C.int(cdd), C.uchar(t))) if t < nTracks { StartTime[t] = clk.New() Length[t] = clk.New() m, s := ms(startFrame[t] - offset) StartTime[t].Set(m/60, m%60, s) } if t > 0 { m, s := ms(startFrame[t] - startFrame[t-1] - offset) Length[t-1].Set(m/60, m%60, s) } } m, s := ms(startFrame[nTracks] - 2*offset) TotalTime.Set(m/60, m%60, s) var l, r C.uchar C.volRead(C.int(cdd), &l, &r) volume_left, volume_right = uint8(l), uint8(r) // C.lockDoor (C.int(cdd)) Ctrl(All, MaxVol/3) return cdfile }
func moon(x0 int) { // const r = 40 x, y, y1, ny := x0, r, 0, int(scr.NY()) for y < ny-r { scr.SaveGr(uint(x-r), uint(y-r), uint(x+r), uint(y+r)) scr.Colour(col.Sandgelb) scr.CircleFull(x, y, r) ker.Msleep(33) scr.RestoreGr(uint(x-r), uint(y-r), uint(x+r), uint(y+r)) y1++ y += y1 } }
func rot(n int) { var b byte for i := 0; !ok; i++ { switch i % 4 { case 0: b = '|' case 1: b = '/' case 2: b = '-' case 3: b = '\\' } scr.Write1(b, y0+1, 71) ker.Msleep(50) } }
func blink() { // var shape Shape for { blinking.Lock() if cursorShape == Off { shape = blinkShape } else { shape = Off } switchCursor(blinkX, blinkY, shape) blinking.Unlock() if terminated { break } ker.Msleep(250) } runtime.Goexit() }
func dr(x0, x1, y int, c col.Colour, f bool) { // const dx = 2 nx1, ny, y1 := int(scr.NX1()), int(scr.NY()), 0 for x := x0; x < x1; x += dx { if !f { scr.SaveGr(uint(x), uint(y), uint(x)+car.W, uint(y)+car.H) } car.Draw(true, c, x, y) ker.Msleep(10) car.Draw(true, col.ScreenB, x, y) if f && x > x0+26*nx1 && x%8 == 0 && y+car.H < ny { y1++ y += y1 } if !f { scr.RestoreGr(uint(x), uint(y), uint(x)+car.W, uint(y)+car.H) } } }
func showMarked() { // figures.Trav(im) ker.Msleep(250) figures.Trav(im) }