mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-10 05:09:03 +00:00
* simv2: wip * simulation: exec adapter start/stop * simulation: add node status to exec adapter * simulation: initial simulation code * simulation: exec adapter, configure path to executable * simulation: initial docker adapter * simulation: wip kubernetes adapter * simulation: kubernetes adapter proxy * simulation: implement GetAll/StartAll/StopAll * simulation: kuberentes adapter - set env vars and resource limits * simulation: discovery test * simulation: remove port definitions within docker adapter * simulation: simplify wait for healthy loop * simulation: get nat ip addr from interface * simulation: pull docker images automatically * simulation: NodeStatus -> NodeInfo * simulation: move discovery test to example dir * simulation: example snapshot usage * simulation: add goclient specific simulation * simulation: add peer connections to snapshot * simulation: close rpc client * simulation: don't export kubernetes proxy server * simulation: merge simulation code * simulation: don't export nodemap * simulation: rename SimulationSnapshot -> Snapshot * simulation: linting fixes * simulation: add k8s available helper func * simulation: vendor * simulation: fix 'no non-test Go files' when building * simulation: remove errors from interface methods where non were returned * simulation: run getHealthInfo check in parallel
119 lines
3 KiB
Go
119 lines
3 KiB
Go
package ansiterm
|
|
|
|
func (ap *AnsiParser) collectParam() error {
|
|
currChar := ap.context.currentChar
|
|
ap.logf("collectParam %#x", currChar)
|
|
ap.context.paramBuffer = append(ap.context.paramBuffer, currChar)
|
|
return nil
|
|
}
|
|
|
|
func (ap *AnsiParser) collectInter() error {
|
|
currChar := ap.context.currentChar
|
|
ap.logf("collectInter %#x", currChar)
|
|
ap.context.paramBuffer = append(ap.context.interBuffer, currChar)
|
|
return nil
|
|
}
|
|
|
|
func (ap *AnsiParser) escDispatch() error {
|
|
cmd, _ := parseCmd(*ap.context)
|
|
intermeds := ap.context.interBuffer
|
|
ap.logf("escDispatch currentChar: %#x", ap.context.currentChar)
|
|
ap.logf("escDispatch: %v(%v)", cmd, intermeds)
|
|
|
|
switch cmd {
|
|
case "D": // IND
|
|
return ap.eventHandler.IND()
|
|
case "E": // NEL, equivalent to CRLF
|
|
err := ap.eventHandler.Execute(ANSI_CARRIAGE_RETURN)
|
|
if err == nil {
|
|
err = ap.eventHandler.Execute(ANSI_LINE_FEED)
|
|
}
|
|
return err
|
|
case "M": // RI
|
|
return ap.eventHandler.RI()
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (ap *AnsiParser) csiDispatch() error {
|
|
cmd, _ := parseCmd(*ap.context)
|
|
params, _ := parseParams(ap.context.paramBuffer)
|
|
ap.logf("Parsed params: %v with length: %d", params, len(params))
|
|
|
|
ap.logf("csiDispatch: %v(%v)", cmd, params)
|
|
|
|
switch cmd {
|
|
case "@":
|
|
return ap.eventHandler.ICH(getInt(params, 1))
|
|
case "A":
|
|
return ap.eventHandler.CUU(getInt(params, 1))
|
|
case "B":
|
|
return ap.eventHandler.CUD(getInt(params, 1))
|
|
case "C":
|
|
return ap.eventHandler.CUF(getInt(params, 1))
|
|
case "D":
|
|
return ap.eventHandler.CUB(getInt(params, 1))
|
|
case "E":
|
|
return ap.eventHandler.CNL(getInt(params, 1))
|
|
case "F":
|
|
return ap.eventHandler.CPL(getInt(params, 1))
|
|
case "G":
|
|
return ap.eventHandler.CHA(getInt(params, 1))
|
|
case "H":
|
|
ints := getInts(params, 2, 1)
|
|
x, y := ints[0], ints[1]
|
|
return ap.eventHandler.CUP(x, y)
|
|
case "J":
|
|
param := getEraseParam(params)
|
|
return ap.eventHandler.ED(param)
|
|
case "K":
|
|
param := getEraseParam(params)
|
|
return ap.eventHandler.EL(param)
|
|
case "L":
|
|
return ap.eventHandler.IL(getInt(params, 1))
|
|
case "M":
|
|
return ap.eventHandler.DL(getInt(params, 1))
|
|
case "P":
|
|
return ap.eventHandler.DCH(getInt(params, 1))
|
|
case "S":
|
|
return ap.eventHandler.SU(getInt(params, 1))
|
|
case "T":
|
|
return ap.eventHandler.SD(getInt(params, 1))
|
|
case "c":
|
|
return ap.eventHandler.DA(params)
|
|
case "d":
|
|
return ap.eventHandler.VPA(getInt(params, 1))
|
|
case "f":
|
|
ints := getInts(params, 2, 1)
|
|
x, y := ints[0], ints[1]
|
|
return ap.eventHandler.HVP(x, y)
|
|
case "h":
|
|
return ap.hDispatch(params)
|
|
case "l":
|
|
return ap.lDispatch(params)
|
|
case "m":
|
|
return ap.eventHandler.SGR(getInts(params, 1, 0))
|
|
case "r":
|
|
ints := getInts(params, 2, 1)
|
|
top, bottom := ints[0], ints[1]
|
|
return ap.eventHandler.DECSTBM(top, bottom)
|
|
default:
|
|
ap.logf("ERROR: Unsupported CSI command: '%s', with full context: %v", cmd, ap.context)
|
|
return nil
|
|
}
|
|
|
|
}
|
|
|
|
func (ap *AnsiParser) print() error {
|
|
return ap.eventHandler.Print(ap.context.currentChar)
|
|
}
|
|
|
|
func (ap *AnsiParser) clear() error {
|
|
ap.context = &ansiContext{}
|
|
return nil
|
|
}
|
|
|
|
func (ap *AnsiParser) execute() error {
|
|
return ap.eventHandler.Execute(ap.context.currentChar)
|
|
}
|