func catch() { // shift, ctrl, alt, altGr, fn = false, false, false, false, false var b byte defer ker.Terminate() // Hilft nix. Warum nicht ??? for { ker.ReadTerminal(&b) switch b { // case 0: // ker.Stop (pack, 1) // Fn-key combination ! case shiftL, shiftR, shiftLock: shift = true case ctrlL, doofL, ctrlR: ctrl = true case altL, doofM: alt = true case altR, doofR: altGr = true case shiftLoff, shiftRoff, shiftLockoff: shift = false case ctrlLoff, doofLoff, ctrlRoff: ctrl = false case altLoff, doofMoff: alt = false case altRoff, doofRoff: altGr = false case function: // println ("Fn-Key") fn = true default: if ctrl && // (alt || altGr) && b == pause || b == 46 { // 'C' ker.Terminate() os.Exit(1) } else if b < off && ctrl && (alt || altGr) { switch b { case left, right: ker.Console1(b == right) case f1, f2, f3, f4, f5, f6, f7, f8, f9, f10: ker.Console(b - f1 + 1) case f11, f12: ker.Console(b - f11 + 11) case escape, backspace, tab, enter, roll, numEnter, pos1, up, pageUp, end, down, pageDown, insert, delete: keypipe <- b } } else { keypipe <- b } } } }
func (x *Imp) Exec() { // l, c := uint(0), uint(0) depth++ if x.isMenu { for { if x.selected(l, c) { x.next.Exec() } else { break } } } else { if x.withTitle { bx.Wd(scr.NColumns()) bx.Colours(menuheadF, menuheadB) bx.Write(x.text, l, c) } else { scr.Clr(l, c, scr.NColumns(), 1) } x.execute() scr.Cls() } depth-- if depth == 0 { ker.Terminate() } }
func gewählt() bool { // loop: for { errh.Hint("Start auswählen (Klick mit linker Maustaste)") if gew() { // Start aktuell netz.Get().(*bahnhof.Imp).Write(true) netz.Position(true) // Start postaktuell write(false) } else { break } errh.Hint("Ziel auswählen (Klick mit linker Maustaste)") for { if gew() { // Ziel aktuell if !netz.Positioned() { netz.Get().(*bahnhof.Imp).Write(true) errh.DelHint() return true } } else { break loop } } } write(false) defer ker.Terminate() return false }
func main() { // cF, cB := col.Black, col.LightWhite col.ScreenF, col.ScreenB = cF, cB scr.Switch(scr.TXT) /* if scr.Switchable (scr.WXGA) { scr.Switch (scr.WXGA) scr.SwitchFontsize (font.Huge) } else if scr.Switchable (scr.WSVGA) { scr.Switch (scr.WSVGA) scr.SwitchFontsize (font.Big) } else { scr.Cls () } */ help = make([]string, 1) help[0] = "Bedienungsanleitung siehe Handbuch S. 18 - 23" actualDay = day.New() actualDay.Actualize() period = day.Yearly day.WeekdayF, day.WeekdayB = cF, cB day.HolidayB = cB day.WeekdayNameF, day.WeekdayNameB = col.Magenta, cB // errh.DocAvail = true scr.MouseCursor(true) for !editiert() { } cal.Terminate() ker.Terminate() }
func stop(a rob.Aktion) { // if !amEditieren { errh.Error2("Programmstop: Verletzung der Vor. in Methode", 0, "rob."+rob.Aktionstext[a]+"()", 0) ker.Terminate() } }
func main() { // scr.Switch(scr.TXT) var today, birthday *Imp today = New() today.Actualize() birthday = New() birthday.SetColours(col.LightWhite, col.Blue) scr.Colour(col.Yellow) scr.Write("Ihr Geburtsdatum:", 12, 0) birthday.Edit(12, 18) if birthday.Empty() { birthday.Actualize() } else { scr.Write(" war ein ", 12, 26) birthday.SetFormat(WD) birthday.Write(12, 35) errh.Error2("Sie sind heute", birthday.Distance(today), "Tage alt.", 0) } scr.Colours(col.ScreenF, col.ScreenB) scr.Cls() errh.Hint(" vor-/rückwärts: Pfeiltasten fertig: Esc ") var ( c kbd.Comm t uint ) neu := true loop: for { if neu { birthday.WriteYear(0, 0) neu = false } switch c, t = kbd.Command(); c { case kbd.Esc: break loop case kbd.Down: if t == 0 { birthday.Inc(Yearly) } else { birthday.Inc(Decadic) } neu = true case kbd.Up: if t == 0 { birthday.Dec(Yearly) } else { birthday.Dec(Decadic) } neu = true case kbd.PrintScr: birthday.PrintYear(0, 0) prt.GoPrint() } } ker.Terminate() }
func init() { // // var x World = New(); if x == nil {} // ok if !scr.Switchable(scr.WVGApp) { errh.Error("Bildschirmauflösung kleiner als 1024 x 576", 0) ker.Terminate() os.Exit(0) } else { scr.Switch(scr.WVGApp) } help[0] = "Hilfe ist noch nicht implementiert" // TODO files.Cd0() }
func main() { const a = 100 var p []string = []string{"Anaxagoras", "Aristoteles", "Cicero", "Jemand", "Demokrit", "Diogenes", "Epikur", "Heraklit", "Platon", "Protagoras", "Pythagoras", "Sokrates", "Thales", "Niemand"} var x, y uint for _, s := range p { img.Get(s, x, y) errh.Error(s, 0) if x+2*a < scr.NX() { x += a } else { x = 0 y = a } } errh.Error2("", uint(len(p)), "Philosophen", 0) ker.Terminate() }
func schreiten() { // if !schrittweise { return } errh.Hint(errh.ToContinueOrNot) loop: for { c, _ := kbd.Command() switch c { case kbd.Enter: break loop case kbd.Esc: ker.Terminate() } } }
func Editieren() { // // rob.RoboterweltDefinieren() amEditieren = true // errh.WriteHelp1 () Robo.Editieren() // errh.DelHint () amEditieren = false if sollProtokolliertWerden { Robo.programmErzeugen() // rob.Roboterwelt.Clr () } if sollProtokolliertWerden { // ZurueckInLinkeObereEcke() // TODO } Robo.Terminieren() ker.Terminate() }
func main() { // just to get all stuff compiled // var _ chanm.ChannelModel = chanm.New(nil) t := integ.String(0) _ = real.String(0.0) var _ lint.LongInteger = lint.New(0) var _ brat.Rational = brat.New() var _ Object = date.New() var _ buf.Buffer = bpqu.New(0, 1) var _ pset.PersistentSet = pset.New(persaddr.New()) var _ acc.Account = acc.New() var _ schol.Scholar = schol.New() eye.Touch() fuday.Touch() gra1.Touch() fig.Touch() var _ asem.AddSemaphore = asem.New(2) var _ barr.Barrier = barr.New(2) var _ rw.ReaderWriter = rw.New() var _ lr.LeftRight = lr.New() var _ lock2.Locker2 = lock2.NewPeterson() var _ lockp.LockerP = phil.NewLockNaiv() var _ barb.Barber = barb.NewSem() var _ smok.Smokers = smok.NewNaiv() var _ lock.Locker = dlock.New(nil) puls.Touch() var _ conn.Connection = conn.New() rob.Touch() var _ Indexer = audio.New() scr.Switch(scr.MaxMode()) // >= scr.PAL xx, yy := scr.NColumns(), scr.NLines() cf, cl, cb := v.Colours() circ(cb, xx/2, yy) circ(cl, xx-yy, yy) circ(cf, yy, yy) t = "" errh.MurusLicense("murus", v.String(), "1986-2013 Christian Maurer http://murus.org", cf, cl, cb, &t) col.ScreenB = cb done := make(chan bool) go drive(cf, cl, cb, done) <-done ker.Terminate() }
func April1st() { col.ScreenF, col.ScreenB = col.White, col.Black scr.Cls() scr.MouseCursor(false) scr.Colour(col.White) scr.Write("Found evil software: \" \"", 7, x0) doof(7, 22) scr.Colour(col.White) scr.Write("Remove (yes/no) ?", y0, x0) b := box.New() b.Wd(3) t := "yes" b.Edit(&t, y0, 23) scr.WarpMouseGr(2*int(scr.NX()), 2*int(scr.NY())) b.Colours(col.LightOrange, col.Black) b.Write("yes", y0, 23) doodle(col.LightWhite, 2) doodle(col.LightWhite, 2) doodle(col.LightYellow, 5) doodle(col.Yellow, 3) doodle(col.LightOrange, 5) doodle(col.Orange, 8) doodle(col.LightRed, 3) // TODO erase all (f + "*.tmp") t = str.Clr(70) scr.Write(t, y0, x0) scr.Write(t, y0+1, x0) col.ScreenF, col.ScreenB = col.LightGreen, col.DarkBlue scr.Cls() scr.Write("The murus-tool has removed \" \" - your disk is reformatted :-)", y0, x0) doof(y0, 28) scr.Colour(col.LightWhite) scr.Write("Please install Linux, TeX, mercurial, Go and murus completely new !", y0+2, x0) ker.Sleep(20) ker.Terminate() }
func main() { // if !scr.MouseEx() { return } var symbol [Nfigure]byte symbol[line] = 'S' // "Strecke" symbol[rectangle] = 'R' // "Rechteck" symbol[circle] = 'K' // "Kreis" symbol[ellipse] = 'E' // "Ellipse" X, Y := 0, 0 X1, Y1 := scr.NX(), scr.NY() // Farbe, Papier:= col.LightWhite, col.Black Farbe, Papier := col.Black, col.LightWhite col.ScreenF, col.ScreenB = Farbe, Papier scr.Cls() paintColour := Farbe scr.Colour(paintColour) // Staerke = 3 bx := box.New() bx.Wd(20) bx.Colours(Papier, Farbe) Name := env.Par(1) if str.Empty(Name) { Name = "temp" } scr.Save(0, 0, 20, 1) for { bx.Edit(&Name, 0, 0) if !str.Empty(Name) { str.RemSpaces(&Name) break } } scr.Restore(0, 0, 20, 1) img.Get(Name, uint(X), uint(Y)) scr.MouseCursor(true) Figur := figure(rectangle) var x, y, x0, y0 int loop: for { scr.Colour(paintColour) Zeichen, Kommando, T := kbd.Read() switch Kommando { case kbd.None: x, y = scr.MousePosGr() scr.SwitchTransparence(true) scr.Write1Gr(Zeichen, x, y-int(scr.NY1())) // scr.WarpMouse (x + scr.NX1(), y) case kbd.Esc: break loop case kbd.Back: switch T { case 0: x, y = scr.MousePosGr() x -= int(scr.NX1()) scr.Colour(Papier) scr.Write1Gr(' ', x, y-int(scr.NY1())) // scr.RectangleFull (x, y - scr.NY1(), x + scr.NX1(), y) // scr.WarpMouseGr (x, y) scr.Colour(paintColour) default: scr.Cls() } /* case kbd.Ins: img.Write (X, Y, X1, Y1 - 16, Name) box.Edit (Feld, Name, scr.Zeilenzahl () - 1, 0) img.Get (X, Y, Name) */ case kbd.Help: paintColour = sel.Colour() // case kbd.LookFor: // Staerke = Strichstaerken.Staerke() case kbd.Enter: if T > 0 { x0, y0 = scr.MousePosGr() // scr.Fill1 (x0, y0) } case kbd.PrintScr: img.Print(uint(X), uint(Y), X1, Y1-16) case kbd.Tab: if T == 0 { if Figur+1 < Nfigure { Figur++ } else { Figur = figure(0) } } else { if Figur > 0 { Figur-- } else { Figur = figure(Nfigure - 1) } } scr.Colours(col.White, Papier) scr.Write1(symbol[Figur], scr.NY()-1, 0) case kbd.Here: x0, y0 = scr.MousePosGr() scr.CircleFull(x0, y0, 3/2) case kbd.Pull: x, y = scr.MousePosGr() scr.Line(x0, y0, x, y) x0, y0 = x, y case kbd.Hither: x, y = scr.MousePosGr() scr.Line(x0, y0, x, y) case kbd.There: x0, y0 = scr.MousePosGr() x, y = x0, y0 case kbd.Push: paint(Figur, inv, x0, y0, x, y) x, y = scr.MousePosGr() paint(Figur, inv, x0, y0, x, y) case kbd.Thither: paint(Figur, inv, x0, y0, x, y) // scr.Colour (paintColour) x, y = scr.MousePosGr() paint(Figur, border, x0, y0, x, y) x0, y0 = x, y case kbd.This: x0, y0 = scr.MousePosGr() x, y = x0, y0 case kbd.Move: scr.LineInv(x0, y0, x, y) x, y = scr.MousePosGr() scr.LineInv(x0, y0, x, y) case kbd.Thus: scr.LineInv(x0, y0, x, y) x, y = scr.MousePosGr() scr.Line(x0, y0, x, y) x0, y0 = x, y } } scr.Save(0, 0, 20, 1) for { bx.Edit(&Name, 0, 0) // TODO make sure, that "Name" is x{x|y} where x is letter, y is digit if !str.Empty(Name) { str.RemSpaces(&Name) break } } scr.Restore(0, 0, 20, 1) img.Put(Name, uint(X), uint(Y), X1, Y1) ker.Terminate() }
func Fertig() { // Robo.FehlerMelden("Programm beendet", 0) ker.Terminate() }
func main() { // /* h:= [...]string { " < Rücktaste <-- ", " << >> Pfeiltaste auf-/abwärts ", "|<< >>| Pos1-Taste/Endetaste ", " 2 .. 12 F2 .. F12-Taste ", " 13 .. 24 Umschalt- + F1 .. F12-Taste ", " oder Mausklick auf entsprechende Zeile ", " Zufallsstück Rollen-Taste ", " ", " < 1 sek > Bildtaste auf-/abwärts ", " << 10 sek >> Umschalt- + Bildtaste auf-/abwärts ", "<<< 1 min >>> Alt- + Bildtaste auf-/abwärts ", " ", " Lautstärke Pfeiltaste Links/Rechts und ", " Umschalt- + Pfeiltaste Links/Rechts", " oder mit Maus auf entsprechende Anzeige ", " Balance Alt- + Pfeiltaste Links/Rechts ", " oder mit Maus auf entsprechende Anzeige ", " ", " Pause/weiter Pause-Taste ", " Ende/CD raus Abbruch-/Entfernungstaste " } Help:= make ([]string, len(h)) for i:= 0; i < len(h); i++ { str.Set (&Help[i], h[i]) } */ errh.WriteHeadline(program, version, author, col.LightWhite, col.DarkBlue) f := model.Soundfile() if f == nil { model.Term1() errh.Error("kein Zugriff auf CD", 0) ker.Terminate() return } view.WriteMask() var ( help, stop bool ) quit := make(chan bool) go func() { for !stop { ker.Sleep(1) if !help { view.Write() } } quit <- true }() model.PlayTrack(0) loop: for { c, t := kbd.Command() help = false scr.MouseCursor(true) switch c { case kbd.Esc: if t == 0 { model.Term() } else { model.Term1() } stop = true break loop case kbd.Enter: if t == 0 { model.PlayTrack1(true) } else { model.PlayTrack(model.NTracks() - 1) } case kbd.Back: switch t { case 0: model.PlayTrack0() case 1: model.PlayTrack1(false) default: model.PlayTrack(0) } case kbd.Left, kbd.Right: switch t { case 0: model.Ctrl1(model.All, c == kbd.Right) case 1: _ = uint(model.Volume(model.All)) for j := 0; j < 8; j++ { model.Ctrl1(model.All, c == kbd.Right) } default: model.Ctrl1(model.Balance, c == kbd.Left) } case kbd.Pos1: model.PlayTrack(0) case kbd.End: model.PlayTrack(model.NTracks() - 1) case kbd.Up, kbd.Down: switch t { case 0, 1: model.PlayTrack1(c == kbd.Down) case 2: model.PosTime1(c == kbd.Down, 1) case 3: model.PosTime1(c == kbd.Down, 10) default: model.PosTime1(c == kbd.Down, 60) } case kbd.Tab: model.PlayTrack1(t == 0) case kbd.Del: model.Term1() return case kbd.Help, kbd.LookFor, kbd.Act, kbd.Cfg, kbd.Mark, kbd.Demark, kbd.Deposit, kbd.Paste, kbd.Black, kbd.Red, kbd.Green, kbd.Blue: if t == 0 { if c == kbd.Help { // help = true // errh.WriteHelp (Help) } else { model.PlayTrack(uint8(c - kbd.Help)) } } else { model.PlayTrack(10 + uint8(c-kbd.Help)) } case kbd.Roll: model.PlayTrack(uint8(rand.Natural(uint(model.NTracks())))) case kbd.Pause: model.Switch() case kbd.Here, kbd.Pull: var ctrl model.Controller if track, b := view.TrackUnderMouse(); b { if c == kbd.Here { model.PlayTrack(track) } } else if ls, c := view.ControlUnderMouse(&ctrl); c { model.Ctrl(ctrl, uint8(ls)) } else if b, sek, c := view.TimeUnderMouse(); c { model.PosTime(b, sek) } case kbd.Navigate: /* var mov, rot space.Gridcoordinate &mov, &rot = mouse3d.Read() model.Ctrl1 (model.All, mov [space.Top] < 0) model.Ctrl1 (model.All, rot [space.Right] < 0) model.Ctrl1 (model.Balance, rot [space.Front] < 0) */ } } <-quit _ = f.Close() ker.Terminate() }
func main() { // h := [...]string{ // 0 1 2 3 4 5 6 7 // 012345678901234567890123456789012345678901234567890123456789012345678901234567 " Art (Farbe) für neue Figur auswählen: (Umschalt- +) Leer- oder Rolltaste ", // " Schriftgröße auswählen: Alt- + Leer- oder Rolltaste ", " neue Figur erzeugen: linke Maustaste, ", " Streckenzüge, Polygone und Kurven ", " mit rechter Maustaste abschließen, ", " Texteingabe mit Eingabetaste beenden ", " Figur ändern: Alt- + linke Maustaste, die 'Punkte' ", " mit rechter Maustaste verschieben, ", " mit linker Maustaste abschließen ", " Figur färben: Umschalt-, Alt- + linke Maustaste ", " (alle) Figur(en) markieren: (Umschalt- +) F5-Taste oder ", " (Alt- +) mittlere Maustaste ", " (alle) Figur(en) entmarkieren: (Umschalt- +) F6-Taste oder ", " Umschalt- + (Alt- +) mittl. Maustaste", " markierte Figur(en) kopieren: Umschalt- + linke Maustaste ", " (markierte) Figur(en) verschieben: (Umschalt- +) rechte Maustaste ", " (markierte) Figur(en) löschen: (Umschalt- +) Entfernungtaste oder ", " (Umschalt-,) Alt- + rechte Maustaste ", " letzte gelöschte Figur zurückholen: Rücktaste (<-) ", " letzte erzeugte Figur löschen: Umschalt- + Rücktaste (<-) ", "letzte gelöschte mark. Fig. zurückholen: Alt- + Rücktaste (<-) ", "Hintergrundfarbe umschalten (auswählen): (Umschalt- +) F4-Taste ", " Figuren aus eBoard holen und markieren: F7-Taste ", " markierte Figuren in eBoard ablegen: F8-Taste ", " eBoard ausdrucken: Drucktaste ", " ePen beenden: Abbruchtaste (Esc) ", " ", " Steuerungstaste (Strg) wirkt wie Umschalttaste "} help := make([]string, len(h)) for i := 0; i < len(h); i++ { str.Set(&help[i], h[i]) } scr.Switch(scr.SXGA) actColour = col.ScreenF paperColour = col.ScreenB // fo = scr.Normal figure = fig2.New() newFigure := fig2.New() newFigure.SetColour(actColour) figures, copiedFigures, image = seq.New(newFigure), seq.New(newFigure), seq.New(newFigure) cuttedFigures, depot = seq.New(newFigure), seq.New(newFigure) stack = stk.New(newFigure) name, filename := names() if filename == "" { return } origname := filename load(figures, filename) // extract (paperColour) write() var x0, y0 int // kbd.Push var movable bool var Schub int loop: for { scr.MouseCursor(true) // control(); write() c, cmd, d := kbd.Read() if cmd == kbd.None { switch c { case ' ': cmd = kbd.Roll } } xm, ym := scr.MousePosGr() switch d { case 0: Schub = 8 case 1: Schub = int(scr.NY() / 40) default: Schub = int(scr.NX() / 8) } switch cmd { case kbd.Esc: break loop case kbd.Enter: // actualize ? case kbd.Back: switch d { case 0: ins(top()) case 1: delLast() default: getMarked() } case kbd.Left: kick(spc.Right, Schub) case kbd.Right: Schub = -Schub kick(spc.Right, Schub) case kbd.Up: kick(spc.Top, Schub) case kbd.Down: Schub = -Schub kick(spc.Top, Schub) case kbd.Del: switch d { case 0: if deleted(xm, ym) { push() } default: delMarked() } case kbd.Tab: // free for use case kbd.Help: scr.SwitchFontsize(font.Normal) errh.WriteHelp(help) case kbd.LookFor: // wird für die Auswahl des eBoards verwendet - NEIN, sondern: load(figures, filename) write() case kbd.Act: // inject (paperColour) store(figures, filename) case kbd.Cfg: paperColour = sel.Colour() bgColour(paperColour) case kbd.Mark: switch d { case 0: mark(xm, ym, true) case 1: markAll(true) default: showMarked() } case kbd.Demark: switch d { case 0: mark(xm, ym, false) case 1: markAll(false) default: showMarked() } case kbd.Deposit: writeMarked() case kbd.Paste: readMarked() case kbd.PrintScr: print(name) case kbd.Roll: switch d { case 0: newFigure.Select() case 1: actColour = sel.Colour() newFigure.SetColour(actColour) case 2: scr.SwitchFontsize(font.Normal) // fo = sel.Size (actColour) // newFigure.SetFont (fo) } case kbd.Here: switch d { case 0: generate(newFigure) case 1: copyMarked() case 2: change(xm, ym) case 3: setColours(xm, ym, actColour) } case kbd.There: movable = underMouse(uint(xm), uint(ym)) && d <= 1 x0, y0 = xm, ym // kbd.Push switch d { case 0: if movable { cut(xm, ym) } case 1: if movable { cutMarked() } case 2: if deleted(xm, ym) { push() } default: delMarked() write() } case kbd.Push: if movable { switch d { case 0: move(xm-x0, ym-y0) case 1: moveMarked(xm-x0, ym-y0) } x0, y0 = scr.MousePosGr() } case kbd.Thither: if movable { switch d { case 0: join() case 1: joinMarked() } } case kbd.This: switch d { case 0: mark(xm, ym, true) case 1: mark(xm, ym, false) case 2: markAll(true) case 3: markAll(false) } invMarked() case kbd.Thus: invMarked() } } markAll(false) _, filename = names() if filename == "" { filename = origname } // inject (paperColour) store(figures, filename) // -> Terminieren ker.Terminate() }