anchor dict | positive dict | negative dict |
|---|---|---|
{
"audio": "",
"image": "",
"text": "func FileLabel(fpath string) (string, error) {\n\tif fpath == \"\" {\n\t\treturn \"\", ErrEmptyPath\n\t}\n\n\tlabel, err := lgetxattr(fpath, xattrNameSelinux)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// Trim the NUL byte",
"video": ""
} | {
"audio": "",
"image": "",
"text": " at the end of the byte buffer, if present.\n\tif len(label) > 0 && label[len(label)-1] == '\\x00' {\n\t\tlabel = label[:len(label)-1]\n\t}\n\treturn string(label), nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif err == redis.ErrNil {\n\t\treturn \"\", 0, nil\n\t} else if err != nil {\n\t\treturn \"\", 0, err\n\t}\n\treturn id, numImported, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func SetKeyLabel(label string) error {\n\terr := writeCon(\"/proc/self/attr/keycreate\", label)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif os.IsNotExist(err) {\n\t\treturn nil\n\t}\n\tif label == \"\" && os.IsPermission(err) && !GetEnabled() {\n\t\treturn nil\n\t}\n\treturn err\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tb.label = label\n\treturn b\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c Context) Get() string {\n\tif c[\"level\"] != \"\" {\n\t\treturn fmt.Sprintf(\"%s:%s:%s:%s\",",
"video": ""
} | {
"audio": "",
"image": "",
"text": " c[\"user\"], c[\"role\"], c[\"type\"], c[\"level\"])\n\t}\n\treturn fmt.Sprintf(\"%s:%s:%s\", c[\"user\"], c[\"role\"], c[\"type\"])\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " c.get(fmt.Sprintf(`regions/availability?DCID=%v`, id), &bareMetalPlanIDs); err != nil {\n\t\treturn nil, err\n\t}\n\treturn bareMetalPlanIDs, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func ClearLabels() {\n\tstate.Lock()\n\tstate.mcsList",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = make(map[string]bool)\n\tstate.Unlock()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " nil; {\n\t\tl.state = l.state(l)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func EnforceMode() int {\n\tvar enforce int\n\n\tenforceS, err := readCon(selinuxEnforcePath())\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif err != nil {\n\t\treturn -1\n\t}\n\n\tenforce, err = strconv.Atoi(string(enforceS))\n\tif err != nil {\n\t\treturn -1\n\t}\n\treturn enforce\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tif level < int(logLevelDebug) {\n\t\tlevel = int(logLevelDebug)\n\t} else if level > int(logLevelWarning) {\n\t\tlevel = int(logLevelWarning)\n\t}\n\tl.level = logLevel(level)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func badPrefix(fpath string) error {\n\tif fpath == \"\" {\n\t\treturn ErrEmptyPath\n\t}\n\n\tbadPrefixes := []string{\"/usr\"}\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tfor _, prefix := range badPrefixes {\n\t\tif strings.HasPrefix(fpath, prefix) {\n\t\t\treturn fmt.Errorf(\"relabeling content in %s is not allowed\", prefix)\n\t\t}\n\t}\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t}\n\tfpath := path.Join(name...)\n\tbasepath := filepath.Dir(fpath)\n\n\tif err = ssh.remoteSafeMkdirAll(basepath); err == nil {\n\t\tfile, err = client.Create(fpath)\n\t}\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Chcon(fpath string, label string, recurse bool) error {\n\tif fpath == \"\" {\n\t\treturn ErrEmptyPath\n\t}\n\tif label == \"\" {\n\t\treturn nil\n\t}\n\tif err := badPrefix(fpath); err != nil {\n\t\treturn err\n\t}\n\tcallback := func(p string, info os.FileInfo, err erro... | {
"audio": "",
"image": "",
"text": "\n\t\te := SetFileLabel(p, label)\n\t\tif os.IsNotExist(e) {\n\t\t\treturn nil\n\t\t}\n\t\treturn e\n\t}\n\n\tif recurse {\n\t\treturn filepath.Walk(fpath, callback)\n\t}\n\n\treturn SetFileLabel(fpath, label)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tfilepath.Walk(rootPath, func(path string, info os.FileInfo, err error) error {\n\t\t\t\tmatched, err := filepath.Match(\"*.json\", info.Name())\n\t\t\t\tif err != nil {\n\t\t\t\t\twarn(err)\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tif matched {\n\t\t\t\t\tc <- path\n\t\t\t... |
{
"audio": "",
"image": "",
"text": "func DupSecOpt(src string) ([]string, error) {\n\tif src == \"\" {\n\t\treturn nil, nil\n\t}\n\tcon, err := NewContext(src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif con[\"user\"] == \"\" ||\n\t\tcon[\"role\"] == \"\" ||\n\t\tcon[\"type\"] == \"\" {\n\t\treturn nil, n... | {
"audio": "",
"image": "",
"text": "\n\t}\n\tdup := []string{\"user:\" + con[\"user\"],\n\t\t\"role:\" + con[\"role\"],\n\t\t\"type:\" + con[\"type\"],\n\t}\n\n\tif con[\"level\"] != \"\" {\n\t\tdup = append(dup, \"level:\"+con[\"level\"])\n\t}\n\n\treturn dup, nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\treturn \"\"\n\t}\n\n\tif lang == \"\" || (lang == p.DefaultContentLanguage && !p.defaultContentLanguageInSubdir) {\n\t\treturn \"\"\n\t}\n\n\treturn lang\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func addToPathMap(info *descriptor.SourceCodeInfo, i interface{}, path []int32) {\n\tloc := findLoc(info, path)\n\tif loc != nil {\n\t\tpathMap[i] = loc\n\t}\n\tswitch d := i.(type) {\n\tcase *descriptor.FileDescriptorProto:\n\t\tfor index, descriptor := range d.MessageType {\... | {
"audio": "",
"image": "",
"text": " := range d.NestedType {\n\t\t\taddToPathMap(info, descriptor, newPath(path, 3, index))\n\t\t}\n\t\tfor index, descriptor := range d.EnumType {\n\t\t\taddToPathMap(info, descriptor, newPath(path, 4, index))\n\t\t}\n\tcase *descriptor.EnumDescriptorProto:\n\t\tfor index, descri... | {
"audio": "",
"image": "",
"text": "\n\tfor name, index := range indexes {\n\t\terr := indexUpdate(storer.Type(), name, index, tx, key, originalData, true)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func goTypeWithPackage(f *descriptor.FieldDescriptorProto) string {\n\tpkg := \"\"\n\tif *f.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE || *f.Type == descriptor.FieldDescriptorProto_TYPE_ENUM {\n\t\tif isTimestampPackage(*f.TypeName)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\t\tpkg = \"timestamp\"\n\t\t} else {\n\t\t\tpkg = getPackageTypeName(*f.TypeName)\n\t\t}\n\t}\n\treturn goType(pkg, f)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif f == nil {\n\t\treturn -1\n\t}\n\treturn *f.Value.(*int)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func goType(pkg string, f *descriptor.FieldDescriptorProto) string {\n\tif pkg != \"\" {\n\t\tpkg = pkg + \".\"\n\t}\n\tswitch *f.Type {\n\tcase descriptor.FieldDescriptorProto_TYPE_DOUBLE:\n\t\tif *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {\n\t\t\treturn \"[]... | {
"audio": "",
"image": "",
"text": "\n\t\t\treturn \"[]string\"\n\t\t}\n\t\treturn \"string\"\n\tcase descriptor.FieldDescriptorProto_TYPE_MESSAGE:\n\t\tif *f.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED {\n\t\t\treturn fmt.Sprintf(\"[]*%s%s\", pkg, shortType(*f.TypeName))\n\t\t}\n\t\treturn fmt.Sprin... | {
"audio": "",
"image": "",
"text": "\n\tif f.Label != other.Label {\n\t\treturn false\n\t}\n\tif f.Description != other.Description {\n\t\treturn false\n\t}\n\treturn convert.CascadeEqual(f.Type, other.Type)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func lowerGoNormalize(s string) string {\n\tfmtd := xstrings.ToCamelCase(s)",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfmtd = xstrings.FirstRuneToLower(fmtd)\n\treturn formatID(s, fmtd)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tverStr = v.String()\n\t\t\t}\n\t\t\ts.goAttach(func() { s.updateClusterVersion(verStr) })\n\t\t\tcontinue\n\t\t}\n\n\t\t// update cluster version only if the decided version is greater than\n\t\t// the current cluster version\n\t\tif v != nil && s.cluster.Version().LessTha... |
{
"audio": "",
"image": "",
"text": "func goNormalize(s string) string {\n\tfmtd",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := xstrings.ToCamelCase(s)\n\treturn formatID(s, fmtd)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tverStr = v.String()\n\t\t\t}\n\t\t\ts.goAttach(func() { s.updateClusterVersion(verStr) })\n\t\t\tcontinue\n\t\t}\n\n\t\t// update cluster version only if the decided version is greater than\n\t\t// the current cluster version\n\t\tif v != nil && s.cluster.Version().LessTha... |
{
"audio": "",
"image": "",
"text": "func formatID(base string, formatted string) string {\n\tif formatted == \"\" {\n\t\treturn formatted\n\t}\n\tswitch {\n\tcase base == \"id\":\n\t\t// id -> ID\n\t\treturn \"ID\"\n\tcase strings.HasPrefix(base, \"id_\"):\n\t\t// id_some -> IDSome\n\t\treturn \"ID\" + formatted... | {
"audio": "",
"image": "",
"text": " some_id -> SomeID\n\t\treturn formatted[:len(formatted)-2] + \"ID\"\n\tcase strings.HasSuffix(base, \"_ids\"):\n\t\t// some_ids -> SomeIDs\n\t\treturn formatted[:len(formatted)-3] + \"IDs\"\n\t}\n\treturn formatted\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " \"true\"\n\n\t//some error checking ...\n\tswitch {\n\tcase len(token.token) == 0 : return nil, errors.New(str)\n\tcase len(token.secret) == 0 : return nil, errors.New(str)\n\t}\n\n\treturn &token, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (w *WidgetBase) SetSizePolicy(h, v SizePolicy) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tw.sizePolicyX = h\n\tw.sizePolicyY = v\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " func(w *worker) {\n\t\t\tw.drain()\n\t\t\twg.Done()\n\t\t}(w)\n\t}\n\twg.Wait()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Progress) Draw(painter *Painter) {\n\tpainter.DrawRune(0, 0, '[')\n\tpainter.DrawRune(p.Size().X-1, 0, ']')\n\n\tstart := 1\n\tend := p.Size().X - 1\n\tcurr := int((float64(p.current) / float64(p.max)) * float64(end-start))\n\n\tfor i := start; i < curr; i++ {\n\t",
... | {
"audio": "",
"image": "",
"text": "\tpainter.DrawRune(i, 0, '=')\n\t}\n\tfor i := curr + start; i < end; i++ {\n\t\tpainter.DrawRune(i, 0, '-')\n\t}\n\tpainter.DrawRune(curr, 0, '>')\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " x == 0 {\n\t\t\t\tp.Svg.Circle(6*ringSize, float64(y)*ringSize, ringSize-(strokeWidth/2), styles)\n\t\t\t}\n\n\t\t\tif y == 0 {\n\t\t\t\tp.Svg.Circle(float64(x)*ringSize, 6*ringSize, ringSize-(strokeWidth/2), styles)\n\t\t\t}\n\n\t\t\tif x == 0 && y == 0 {\n\t\t\t\tp.Svg.Circ... |
{
"audio": "",
"image": "",
"text": "func NewPainter(s Surface, p *Theme) *Painter {\n\treturn &Painter{\n\t\ttheme: p,\n\t\tsurface: s,\n\t\tstyle: ",
"video": ""
} | {
"audio": "",
"image": "",
"text": " p.Style(\"normal\"),\n\t\tmask: image.Rectangle{\n\t\t\tMin: image.ZP,\n\t\t\tMax: s.Size(),\n\t\t},\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn func(p *ProgressBar) {\n\t\tp.config.width = s\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) Translate(x, y int) {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tp.transforms = append(p.transforms, image.Point{x, y})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) Restore() {\n\tif len(p.transforms)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " > 0 {\n\t\tp.transforms = p.transforms[:len(p.transforms)-1]\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " if len(comment) == 3 {\n\t\t\t_ = p.googleBot()\n\t\t}\n\t} else if len(comment) > 0 {\n\t\tif len(comment) > 3 {\n\t\t\tp.localization = comment[3]\n\t\t}\n\t\tif strings.HasPrefix(comment[0], \"Windows NT\") {\n\t\t\tp.os = normalizeOS(comment[0])\n\t\t} else if len(comment... |
{
"audio": "",
"image": "",
"text": "func (p *Painter) Repaint(w Widget) {\n\tp.mask = image.Rectangle{\n\t\tMin: image.ZP,\n\t\tMax: p.surface.Size(),\n\t}\n\n\tp.surface.HideCursor()",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\n\tw.Resize(p.surface.Size())\n\n\tp.Begin()\n\tw.Draw(p)\n\tp.End()\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " p.size\n\t\tp.updateProgress(false)\n\t}\n\treturn p.in.Close()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) DrawCursor(x, y int) {\n\twp :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " p.mapLocalToWorld(image.Point{x, y})\n\tp.surface.SetCursor(wp.X, wp.Y)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) DrawRune(x, y int, r rune) {\n\twp := p.mapLocalToWorld(image.Point{x, y})\n\tif (p.mask.Min.X <= wp.X) && (wp.X < p.mask.Max.X) && (p.mask.Min.Y <=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " wp.Y) && (wp.Y < p.mask.Max.Y) {\n\t\tp.surface.SetCell(wp.X, wp.Y, r, p.style)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) DrawText(x, y int, text string) {\n\tfor _, r := range text {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tp.DrawRune(x, y, r)\n\t\tx += runeWidth(r)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " text := range texts {\n\t\tif text == \"req\" {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) DrawHorizontalLine(x1, x2, y int) {\n\tfor x := x1; x",
"video": ""
} | {
"audio": "",
"image": "",
"text": " < x2; x++ {\n\t\tp.DrawRune(x, y, '─')\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) DrawVerticalLine(x, y1, y2 int) {\n\tfor y := y1; y <",
"video": ""
} | {
"audio": "",
"image": "",
"text": " y2; y++ {\n\t\tp.DrawRune(x, y, '│')\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) DrawRect(x, y, w, h int) {\n\tfor j := 0; j < h; j++ {\n\t\tfor i := 0; i < w; i++ {\n\t\t\tm := i + x\n\t\t\tn := j + y\n\n\t\t\tswitch {\n\t\t\tcase i == 0 && j == 0:\n\t\t\t\tp.DrawRune(m, n, '┌')\n\t\t\tcase i == w-1 && j == 0:\n\t\t\t\tp.DrawRune(m, n, '... | {
"audio": "",
"image": "",
"text": "\n\t\t\tcase i == w-1 && j == h-1:\n\t\t\t\tp.DrawRune(m, n, '┘')\n\t\t\tcase i == 0 || i == w-1:\n\t\t\t\tp.DrawRune(m, n, '│')\n\t\t\tcase j == 0 || j == h-1:\n\t\t\t\tp.DrawRune(m, n, '─')\n\t\t\t}\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tend = max\n\t}\n\n\tactive := NotFound\n\n\tfor i, j := l.start, 0; i < end; i, j = i+1, j+1 {\n\t\tif l.cursor == i {\n\t\t\tactive = j\n\t\t}\n\n\t\tresult = append(result, *l.scope[i])\n\t}\n\n\treturn result, active\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) FillRect(x, y, w, h int) {\n\tfor j := 0;",
"video": ""
} | {
"audio": "",
"image": "",
"text": " j < h; j++ {\n\t\tfor i := 0; i < w; i++ {\n\t\t\tp.DrawRune(i+x, j+y, ' ')\n\t\t}\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " x, y, w, h int) {\n\tc.Call(\"copyTexSubImage2D\", target, level, xoffset, yoffset, x, y, w, h)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) WithStyle(n string, fn func(*Painter)) {\n\tprev := p.style\n\tnew",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := prev.mergeIn(p.theme.Style(n))\n\tp.SetStyle(new)\n\tfn(p)\n\tp.SetStyle(prev)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn func(p *ProgressBar) {\n\t\tp.config.width = s\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Painter) WithMask(r image.Rectangle, fn func(*Painter)) {\n\ttmp := p.mask\n\tdefer func() { p.mask = tmp }()\n\n\tp.mask =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " p.mask.Intersect(image.Rectangle{\n\t\tMin: p.mapLocalToWorld(r.Min),\n\t\tMax: p.mapLocalToWorld(r.Max),\n\t})\n\n\tfn(p)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn func(p *ProgressBar) {\n\t\tp.config.width = s\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (r *RuneBuffer) CursorPos() image.Point {\n\tif r.width == 0 {\n\t\treturn image.ZP\n\t}\n\n\tsp := r.SplitByLine()\n\tvar x, y int\n\tremaining := r.idx\n\tfor _, l := range sp {\n\t\tif utf8.RuneCountInString(l) < remaining {\n\t\t\ty++",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\t\tremaining -= utf8.RuneCountInString(l) + 1\n\t\t} else {\n\t\t\tx = remaining\n\t\t\tbreak\n\t\t}\n\t}\n\treturn image.Pt(stringWidth(string(r.buf[:x])), y)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\treturn err\n\t}\n\tr := ir.(*linutil.AMD64Registers)\n\tr.Regs.Rsp = sp\n\tthread.dbp.execPtraceFunc(func() { err = sys.PtraceSetRegs(thread.ID, (*sys.PtraceRegs)(r.Regs)) })\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (r *RuneBuffer) MoveForward() {\n\tif r.idx",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == len(r.buf) {\n\t\treturn\n\t}\n\tr.idx++\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " r.idx\n\tr.channels[id] = &reactor_channel{ch: ch, f: handler, limit: limit}\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (r *RuneBuffer) MoveToLineStart() {\n\tfor i := r.idx; i > 0; i-- {\n\t\tif r.buf[i-1]",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == '\\n' {\n\t\t\tr.idx = i\n\t\t\treturn\n\t\t}\n\t}\n\tr.idx = 0\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tfiles <- jobs[i]\n\t}\n\tclose(files)\n\n\tfor i := 0; i < workload; i++ {\n\t\tr := <-results\n\t\tif r == nil {\n\t\t\toffset++\n\t\t\tcontinue\n\t\t} else {\n\t\t\tset[i-offset] = *r\n\t\t}\n\t}\n\n\treturn set[:(workload - offset)], nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (r *RuneBuffer) MoveToLineEnd() {\n\tfor i := r.idx; i < len(r.buf)-1; i++ {\n\t\tif r.buf[i] == '\\n' {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\t\tr.idx = i\n\t\t\treturn\n\t\t}\n\t}\n\tr.idx = len(r.buf)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tfiles <- jobs[i]\n\t}\n\tclose(files)\n\n\tfor i := 0; i < workload; i++ {\n\t\tr := <-results\n\t\tif r == nil {\n\t\t\toffset++\n\t\t\tcontinue\n\t\t} else {\n\t\t\tset[i-offset] = *r\n\t\t}\n\t}\n\n\treturn set[:(workload - offset)], nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (r *RuneBuffer) Backspace() {\n\tif r.idx == 0 {\n\t\treturn\n\t}\n\tr.idx--\n\tr.buf",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = append(r.buf[:r.idx], r.buf[r.idx+1:]...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == tc {\n\t\t\treturn r\n\t\t}\n\tcase versionPair:\n\t\tif r == tc.r {\n\t\t\treturn r\n\t\t}\n\t}\n\n\treturn none\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (r *RuneBuffer) Delete() {\n\tif r.idx == len(r.buf) {\n\t\treturn\n\t}\n\tr.buf =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(r.buf[:r.idx], r.buf[r.idx+1:]...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\treturn p\n\t\t}\n\t\tr.lhpos++\n\t\treturn head.encode(r.buf.sizebuf)\n\n\tcase r.strpos < len(r.buf.str):\n\t\t// String data at the end, after all list headers.\n\t\tp := r.buf.str[r.strpos:]\n\t\tr.strpos = len(r.buf.str)\n\t\treturn p\n\n\tdefault:\n\t\treturn nil\n\t}... |
{
"audio": "",
"image": "",
"text": "func (r *RuneBuffer) Kill() {\n\tnewlineIdx := strings.IndexRune(string(r.buf[r.idx:]), '\\n')\n\tif newlineIdx < 0 {\n\t\tr.buf = r.buf[:r.idx]\n\t} else {\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tr.buf = append(r.buf[:r.idx], r.buf[r.idx+newlineIdx+1:]...)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\treturn 0, io.EOF\n\t}\n\tn = copy(b, r.buf[r.pos:])\n\tr.pos += n\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func WrapString(s string, width int) string {\n\tif len(s) <= 1 {\n\t\treturn s\n\t}\n\n\t// Output buffer. Does not include the most recent word.\n\tvar buf bytes.Buffer\n\t// Trailing word.\n\tvar word bytes.Buffer\n\tvar wordLen int\n\n\tspaceLeft := width\n\tvar prev rune\... | {
"audio": "",
"image": "",
"text": " {\n\t\t\t\tspaceLeft -= wordLen\n\t\t\t}\n\t\t\t// fmt.Printf(\"42: writing %q with %d spaces remaining out of %d\\n\", word.String(), spaceLeft, width)\n\t\t\tword.WriteTo(&buf)\n\t\t\twordLen = 0\n\t\t}\n\t\tword.WriteRune(curr)\n\t\twordLen += runewidth.RuneWidth(curr)\n\n... | {
"audio": "",
"image": "",
"text": "\n\t\tif rule.exact {\n\t\t\tif word == rule.suffix {\n\t\t\t\treturn rule.replacement\n\t\t\t}\n\t\t} else {\n\t\t\tif strings.HasSuffix(word, rule.suffix) {\n\t\t\t\treturn replaceLast(word, rule.suffix, rule.replacement)\n\t\t\t}\n\t\t}\n\t}\n\treturn word\n}",
"video": "... |
{
"audio": "",
"image": "",
"text": "func (s *ScrollArea) Scroll(dx, dy int) {\n\ts.topLeft.X",
"video": ""
} | {
"audio": "",
"image": "",
"text": " += dx\n\ts.topLeft.Y += dy\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " NewArithmeticConstraint(FUNC_OP, []Attribute{a1, a2},\n\t\t\tfunc(x []int) int {\n\t\t\t\treturn fn(x[0], x[1])\n\t\t\t})\n\t} else {\n\t\treturn NewArithmeticConstraint(SUB_OP, []Attribute{a1, a2}, nil)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *ScrollArea) ScrollToBottom() {\n\ts.topLeft.Y =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " s.Widget.SizeHint().Y - s.Size().Y\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " int) bool {\n\t\treturn y.CompareKeys(kr.left, s.tables[i].Biggest()) <= 0\n\t})\n\tright := sort.Search(len(s.tables), func(i int) bool {\n\t\treturn y.CompareKeys(kr.right, s.tables[i].Smallest()) < 0\n\t})\n\treturn left, right\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *ScrollArea) Draw(p *Painter) {\n\tp.Translate(-s.topLeft.X, -s.topLeft.Y)\n\tdefer p.Restore()\n\n\toff := image.Point{s.topLeft.X, s.topLeft.Y}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tp.WithMask(image.Rectangle{Min: off, Max: s.Size().Add(off)}, func(p *Painter) {\n\t\ts.Widget.Draw(p)\n\t})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *ScrollArea) Resize(size image.Point) {\n\ts.Widget.Resize(s.Widget.SizeHint())",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\ts.WidgetBase.Resize(size)\n\n\tif s.autoscroll {\n\t\ts.ScrollToBottom()\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor _, widget := range w.widgets {\n\t\twidget.Resize()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c *SimpleFocusChain) FocusNext(current Widget) Widget {\n\tfor i, w := range c.widgets {\n\t\tif w != current {\n\t\t\tcontinue\n\t\t}\n\t\tif",
"video": ""
} | {
"audio": "",
"image": "",
"text": " i < len(c.widgets)-1 {\n\t\t\treturn c.widgets[i+1]\n\t\t}\n\t\treturn c.widgets[0]\n\t}\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor _, widget := range w.widgets {\n\t\twidget.Resize()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (c *SimpleFocusChain) FocusDefault() Widget {\n\tif len(c.widgets) == 0 {\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn nil\n\t}\n\treturn c.widgets[0]\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor _, widget := range w.widgets {\n\t\twidget.Resize()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *Label) Resize(size image.Point) {\n\tif l.Size() != size {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tl.cacheSizeHint = nil\n\t}\n\tl.WidgetBase.Resize(size)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error) {\n\tvar v RuntimeSetMaxCallStackSizeToCaptureParams\n\tv.Size = size\n\treturn c.SetMaxCallStackSizeToCaptureWithParams(&v)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *Label) Draw(p *Painter) {\n\tlines := l.lines()\n\n\tstyle := \"label\"\n\tif l.styleName != \"\" {\n\t\tstyle += \".\" + l.styleName\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t}\n\n\tp.WithStyle(style, func(p *Painter) {\n\t\tfor i, line := range lines {\n\t\t\tp.DrawText(0, i, line)\n\t\t}\n\t})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " -1 {\n\t\t// Reached the end of data.\n\t\tl.pos = len(l.data)\n\t} else {\n\t\tl.pos += i + 1\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *Label) SizeHint() image.Point {\n\tif l.cacheSizeHint != nil {\n\t\treturn *l.cacheSizeHint\n\t}\n\tvar max int\n\tlines := l.lines()\n\tfor _, line := range lines {\n\t\tif w := stringWidth(line); w > max {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\t\tmax = w\n\t\t}\n\t}\n\tsizeHint := image.Point{max, len(lines)}\n\tl.cacheSizeHint = &sizeHint\n\treturn sizeHint\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\t\t\ttabs = n\n\t\t\t}\n\t\t}\n\t}\n\tfor i, line := range lines {\n\t\tif line != \"\" {\n\t\t\tline := line[tabs:]\n\t\t\tlines[i] = line // remove leading tabs\n\t\t}\n\t}\n\n\t// remove leading blank lines\n\tfor len(lines) > 0 && lines[0] == \"\" {\n\t\tlines = lines... |
{
"audio": "",
"image": "",
"text": "func (l *Label) SetText(text string) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tl.cacheSizeHint = nil\n\tl.text = text\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " the text to be logged\n\tline, err := json.Marshal(fields)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\t// log it to the main log file:\n\tif l.file != nil {\n\t\tfmt.Fprintln(l.file, string(line))\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) Append(w Widget) {\n\tb.children =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(b.children, w)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor _, widget := range w.widgets {\n\t\twidget.Resize()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) Prepend(w Widget) {",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tb.children = append([]Widget{w}, b.children...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor _, widget := range w.widgets {\n\t\twidget.Resize()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) Insert(i int, w Widget) {\n\tif len(b.children) < i || i < 0 {\n\t\treturn\n\t}\n\n\tb.children =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(b.children, nil)\n\tcopy(b.children[i+1:], b.children[i:])\n\tb.children[i] = w\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " b.w >= len(b.s) {\n\t\treturn 0\n\t}\n\treturn len(b.s) - b.w\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) Remove(i int) {\n\tif len(b.children) <= i || i < 0 {\n\t\treturn\n\t}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\n\tb.children = append(b.children[:i], b.children[i+1:]...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " state.Buffer[i]\n\t\tif f(c) {\n\t\t\tif !first {\n\t\t\t\ti++\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tfirst = notfirst\n\t}\n\tif i < 0 {\n\t\ti = 0\n\t}\n\treturn i\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) IsFocused() bool {\n\tfor _, w := range",
"video": ""
} | {
"audio": "",
"image": "",
"text": " b.children {\n\t\tif w.IsFocused() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor _, widget := range w.widgets {\n\t\twidget.Resize()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) Draw(p *Painter) {\n\tstyle := \"box\"\n\tif b.IsFocused() {\n\t\tstyle += \".focused\"\n\t}\n\n\tp.WithStyle(style, func(p *Painter) {\n\n\t\tsz := b.Size()\n\n\t\tif b.border {\n\t\t\tp.WithStyle(style+\".border\", func(p *Painter) {\n\t\t\t\tp.DrawRect(0, 0, s... | {
"audio": "",
"image": "",
"text": "\t\tcase Horizontal:\n\t\t\t\tp.Translate(off.X, 0)\n\t\t\tcase Vertical:\n\t\t\t\tp.Translate(0, off.Y)\n\t\t\t}\n\n\t\t\tp.WithMask(image.Rectangle{\n\t\t\t\tMin: image.ZP,\n\t\t\t\tMax: child.Size(),\n\t\t\t}, func(p *Painter) {\n\t\t\t\tchild.Draw(p)\n\t\t\t})\n\n\t\t\tp.R... | {
"audio": "",
"image": "",
"text": "\t\tfor _, b := range p.lit {\n\t\t\tif b == '\\n' {\n\t\t\t\tendline++\n\t\t\t}\n\t\t}\n\t}\n\n\tcomment = &ast.Comment{p.pos, p.lit}\n\tp.next0()\n\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) MinSizeHint() image.Point {\n\tvar minSize image.Point\n\n\tfor _, child := range b.children {\n\t\tsize := child.MinSizeHint()\n\t\tif b.Alignment() == Horizontal {\n\t\t\tminSize.X += size.X\n\t\t\tif size.Y > minSize.Y {\n\t\t\t\tminSize.Y = size.Y\n\t\t\t}\n\... | {
"audio": "",
"image": "",
"text": "\t\t\tif size.X > minSize.X {\n\t\t\t\tminSize.X = size.X\n\t\t\t}\n\t\t}\n\t}\n\n\tif b.border {\n\t\tminSize = minSize.Add(image.Point{2, 2})\n\t}\n\n\treturn minSize\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) SizeHint() image.Point {\n\tvar sizeHint image.Point\n\n\tfor _, child := range b.children {\n\t\tsize := child.SizeHint()\n\t\tif b.Alignment() == Horizontal {\n\t\t\tsizeHint.X += size.X\n\t\t\tif size.Y > sizeHint.Y {\n\t\t\t\tsizeHint.Y = size.Y\n\t\t\t}\n\t\... | {
"audio": "",
"image": "",
"text": " size.X > sizeHint.X {\n\t\t\t\tsizeHint.X = size.X\n\t\t\t}\n\t\t}\n\t}\n\n\tif b.border {\n\t\tsizeHint = sizeHint.Add(image.Point{2, 2})\n\t}\n\n\treturn sizeHint\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Box) Resize(size image.Point) {\n\tb.size = size\n\tinner := b.size\n\tif b.border {\n\t\tinner",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = b.size.Sub(image.Point{2, 2})\n\t}\n\tb.layoutChildren(inner)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " error) {\n\tvar v RuntimeSetMaxCallStackSizeToCaptureParams\n\tv.Size = size\n\treturn c.SetMaxCallStackSizeToCaptureWithParams(&v)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (ev *KeyEvent) Name() string {\n\ts := \"\"\n\tm := []string{}\n\tif ev.Modifiers&ModShift != 0 {\n\t\tm = append(m, \"Shift\")\n\t}\n\tif ev.Modifiers&ModAlt != 0 {\n\t\tm = append(m, \"Alt\")\n\t}\n\tif ev.Modifiers&ModMeta != 0 {\n\t\tm = append(m, \"Meta\")\n\t}\n\tif... | {
"audio": "",
"image": "",
"text": " = string(ev.Rune)\n\t\t} else {\n\t\t\ts = \"Unknown\"\n\t\t}\n\t}\n\tif len(m) != 0 {\n\t\tif ev.Modifiers&ModCtrl != 0 && strings.HasPrefix(s, \"Ctrl-\") {\n\t\t\ts = s[5:]\n\t\t}\n\t\treturn fmt.Sprintf(\"%s+%s\", strings.Join(m, \"+\"), s)\n\t}\n\treturn s\n}",
"video":... | {
"audio": "",
"image": "",
"text": " {\n\t\tev, err = scope.evalAST(t)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tev.loadValue(cfg)\n\tif ev.Name == \"\" {\n\t\tev.Name = expr\n\t}\n\treturn ev, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewGrid(cols, rows int) *Grid {\n\treturn &Grid{\n\t\tcols: cols,\n\t\trows: rows,\n\t\tcells: make(map[image.Point]Widget),\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tcolumnStretch: make(map[int]int),\n\t\trowStretch: make(map[int]int),\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " reader\n\trows := &Rows{\n\t\tcolumns: res.Cols,\n\t\tvalues: res.Rows,\n\t\trowcount: res.Rowcount,\n\t}\n\n\treturn rows, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (g *Grid) Draw(p *Painter) {\n\ts := g.Size()\n\n\tif g.hasBorder {\n\t\tborder := 1\n\n\t\t// Draw outmost border.\n\t\tp.DrawRect(0, 0, s.X, s.Y)\n\n\t\t// Draw column dividers.\n\t\tvar coloff int\n\t\tfor i := 0; i < g.cols-1; i++ {\n\t\t\tx := g.colWidths[i] + coloff... | {
"audio": "",
"image": "",
"text": " {\n\t\t\t\tx := g.colWidths[i] + coloff + border\n\t\t\t\tp.DrawRune(x, y, '┼')\n\t\t\t\tcoloff = x\n\t\t\t}\n\t\t\trowoff = y\n\t\t}\n\t}\n\n\t// Draw cell content.\n\tfor i := 0; i < g.cols; i++ {\n\t\tfor j := 0; j < g.rows; j++ {\n\t\t\tpos := image.Point{i, j}\n\t\t\twp ... | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (g *Grid) MinSizeHint() image.Point {\n\tif g.cols == 0 || g.rows == 0 {\n\t\treturn image.Point{}\n\t}\n\n\tvar width int\n\tfor i := 0; i < g.cols; i++ {\n\t\twidth += g.minColumnWidth(i)\n\t}\n\n\tvar height int\n\tfor j := 0; j",
"video": ""
} | {
"audio": "",
"image": "",
"text": " < g.rows; j++ {\n\t\theight += g.minRowHeight(j)\n\t}\n\n\tif g.hasBorder {\n\t\twidth += g.cols + 1\n\t\theight += g.rows + 1\n\t}\n\n\treturn image.Point{width, height}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = i\n\t\t}\n\t}\n\n\t// concatenate long name with namespace\n\tkey := option.EnvDefaultKey\n\tg = option.group\n\n\tfor g != nil {\n\t\tif g.EnvNamespace != \"\" {\n\t\t\tkey = g.EnvNamespace + namespaceDelimiter + key\n\t\t}\n\n\t\tswitch i := g.parent.(type) {\n\t\tcase *C... |
{
"audio": "",
"image": "",
"text": "func (g *Grid) SizeHint() image.Point {\n\tif g.cols == 0 || g.rows == 0 {\n\t\treturn image.Point{}\n\t}\n\n\tvar maxWidth int\n\tfor i := 0; i < g.cols; i++ {\n\t\tif w := g.columnWidth(i); w > maxWidth {\n\t\t\tmaxWidth = w\n\t\t}\n\t}\n\n\tvar maxHeight int\n\tfor j := 0; ... | {
"audio": "",
"image": "",
"text": " = h\n\t\t}\n\t}\n\n\twidth := maxWidth * g.cols\n\theight := maxHeight * g.rows\n\n\tif g.hasBorder {\n\t\twidth += g.cols + 1\n\t\theight += g.rows + 1\n\t}\n\n\treturn image.Point{width, height}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = i\n\t\t}\n\t}\n\n\t// concatenate long name with namespace\n\tkey := option.EnvDefaultKey\n\tg = option.group\n\n\tfor g != nil {\n\t\tif g.EnvNamespace != \"\" {\n\t\t\tkey = g.EnvNamespace + namespaceDelimiter + key\n\t\t}\n\n\t\tswitch i := g.parent.(type) {\n\t\tcase *C... |
{
"audio": "",
"image": "",
"text": "func (g *Grid) Resize(size image.Point) {\n\tg.size = size\n\tinner := g.size\n\tif g.hasBorder {\n\t\tinner.X = g.size.X - (g.cols",
"video": ""
} | {
"audio": "",
"image": "",
"text": " + 1)\n\t\tinner.Y = g.size.Y - (g.rows + 1)\n\t}\n\tg.layoutChildren(inner)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = i\n\t\t}\n\t}\n\n\t// concatenate long name with namespace\n\tkey := option.EnvDefaultKey\n\tg = option.group\n\n\tfor g != nil {\n\t\tif g.EnvNamespace != \"\" {\n\t\t\tkey = g.EnvNamespace + namespaceDelimiter + key\n\t\t}\n\n\t\tswitch i := g.parent.(type) {\n\t\tcase *C... |
{
"audio": "",
"image": "",
"text": "func (g *Grid) SetCell(pos image.Point, w Widget)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\tg.cells[pos] = w\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor _, widget := range w.widgets {\n\t\twidget.Resize()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (g *Grid) AppendRow(row ...Widget) {\n\tg.rows++\n\n\tif len(row) > g.cols {\n\t\tg.cols = len(row)\n\t}\n\n\tfor i, cell := range row {\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tpos := image.Point{i, g.rows - 1}\n\t\tg.SetCell(pos, cell)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\t\tgbi.rows[i].row = nr.Intersect(gbi.filter)\n\t\t} else if i == 0 || i == len(gbi.rows)-1 {\n\t\t\tgbi.rows[i].row = nr\n\t\t} else {\n\t\t\tgbi.rows[i].row = nr.Intersect(gbi.rows[i-1].row)\n\t\t}\n\t\tgbi.rows[i].id = rowID\n\n\t\tif !gbi.rows[i].row.IsEmpty() {\n\t\t\t... |
{
"audio": "",
"image": "",
"text": "func (g *Grid) RemoveRows() {\n\tg.rows = 0\n\tg.cells",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = make(map[image.Point]Widget)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = i\n\t\t}\n\t}\n\n\t// concatenate long name with namespace\n\tkey := option.EnvDefaultKey\n\tg = option.group\n\n\tfor g != nil {\n\t\tif g.EnvNamespace != \"\" {\n\t\t\tkey = g.EnvNamespace + namespaceDelimiter + key\n\t\t}\n\n\t\tswitch i := g.parent.(type) {\n\t\tcase *C... |
{
"audio": "",
"image": "",
"text": "func (g *Grid) SetRowStretch(row, stretch int) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tg.rowStretch[row] = stretch\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " to %s\", name)\n\t\t}\n\t\t*conn = c\n\t\treturn nil\n\t}\n\n\tg.Go(func() error {\n\t\treturn dialfn(stdin, &set.stdin)\n\t})\n\tg.Go(func() error {\n\t\treturn dialfn(stdout, &set.stdout)\n\t})\n\tg.Go(func() error {\n\t\treturn dialfn(stderr, &set.stderr)\n\t})\n\n\terr = ... |
{
"audio": "",
"image": "",
"text": "func (ui *tcellUI) Quit() {\n\tlogger.Printf(\"Quitting\")",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tui.screen.Fini()\n\tui.quit <- struct{}{}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " != nil {\n\t\tui.logger.Error(ui.logTag, \"UI.PrintLinef failed (message='%s'): %s\", message, err)\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func trimRightLen(s string, n int) string {\n\tif n <= 0 {\n\t\treturn s\n\t}\n\tc := utf8.RuneCountInString(s)\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\truneCount := 0\n\tvar i int\n\tfor i = range s {\n\t\tif runeCount >= c-n {\n\t\t\tbreak\n\t\t}\n\t\truneCount++\n\t}\n\treturn s[:i]\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " -1 {\n\t\treturn formulaTable[fmtForms(FormsTable[idx].Value)]\n\t}\n\treturn func(n int) int {\n\t\treturn n\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *StatusBar) Draw(p *Painter) {\n\tp.WithStyle(\"statusbar\", func(p *Painter) {\n\t\tp.FillRect(0, 0, b.Size().X, 1)\n\t\tp.DrawText(0, 0, b.text)",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tp.DrawText(b.Size().X-stringWidth(b.permText), 0, b.permText)\n\t})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " 0, err\n\t}\n\n\th, err := p.nextObjectHeader()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn p.getObjectSize(h)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s *StyledBox) Draw(p *tui.Painter) {\n\tp.WithStyle(s.Style, func(p",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *tui.Painter) {\n\t\ts.Box.Draw(p)\n\t})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn func(p *ProgressBar) {\n\t\tp.config.width = s\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (e *TextEdit) SizeHint() image.Point {\n\tvar max int\n\tlines := strings.Split(e.text.String(), \"\\n\")\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tfor _, line := range lines {\n\t\tif w := stringWidth(line); w > max {\n\t\t\tmax = w\n\t\t}\n\t}\n\treturn image.Point{max, e.text.heightForWidth(max)}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Usage:\\n\"\n\t\tlines := strings.Split(c.usage, \"\\n\")\n\t\tfor _, line := range lines {\n\t\t\tmessage += fmt.Sprintf(\" %s\\n\", line)\n\t\t}\n\t}\n\treturn message + \"\\n\"\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewPadder(x, y int, w Widget) *Padder {\n\treturn &Padder{\n\t\twidget: w,\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tpadding: image.Point{x, y},\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " int64) (n int, err error) {\n\treturn Wrap(w, p, off, w.wrapAt)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Padder) Draw(painter *Painter) {\n\tpainter.Translate(p.padding.X,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " p.padding.Y)\n\tdefer painter.Restore()\n\n\tp.widget.Draw(painter)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Padder) Size() image.Point",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\treturn p.widget.Size().Add(p.padding.Mul(2))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = b.size.Sub(image.Point{2, 2})\n\t}\n\tb.layoutChildren(inner)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Padder) Resize(size image.Point) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tp.widget.Resize(size.Sub(p.padding.Mul(2)))\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " p := range points {\n\t\tb.Extend(p.Point())\n\t}\n\n\tq := New(b, len(points))\n\n\tfor _, p := range points {\n\t\tq.Insert(p)\n\t}\n\n\treturn q\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Button) Draw(p *Painter) {\n\tstyle := \"button\"\n\tif b.IsFocused() {\n\t\tstyle += \".focused\"\n\t}\n\tp.WithStyle(style, func(p",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Painter) {\n\t\tlines := strings.Split(b.text, \"\\n\")\n\t\tfor i, line := range lines {\n\t\t\tp.FillRect(0, i, b.Size().X, 1)\n\t\t\tp.DrawText(0, i, line)\n\t\t}\n\t})\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tfor _, b := range p.lit {\n\t\t\tif b == '\\n' {\n\t\t\t\tendline++\n\t\t\t}\n\t\t}\n\t}\n\n\tcomment = &ast.Comment{p.pos, p.lit}\n\tp.next0()\n\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Button) SizeHint() image.Point {\n\tif len(b.text) == 0 {\n\t\treturn b.MinSizeHint()\n\t}\n\n\tvar size image.Point\n\tlines := strings.Split(b.text, \"\\n\")\n\tfor _, line := range lines {\n\t\tif w :=",
"video": ""
} | {
"audio": "",
"image": "",
"text": " stringWidth(line); w > size.X {\n\t\t\tsize.X = w\n\t\t}\n\t}\n\tsize.Y = len(lines)\n\n\treturn size\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Usage:\\n\"\n\t\tlines := strings.Split(c.usage, \"\\n\")\n\t\tfor _, line := range lines {\n\t\t\tmessage += fmt.Sprintf(\" %s\\n\", line)\n\t\t}\n\t}\n\treturn message + \"\\n\"\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (b *Button) OnKeyEvent(ev KeyEvent) {\n\tif !b.IsFocused() {\n\t\treturn\n\t}\n\tif ev.Key",
"video": ""
} | {
"audio": "",
"image": "",
"text": " == KeyEnter && b.onActivated != nil {\n\t\tb.onActivated(b)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tev, err = scope.evalAST(t)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tev.loadValue(cfg)\n\tif ev.Name == \"\" {\n\t\tev.Name = expr\n\t}\n\treturn ev, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (s Style) mergeIn(delta Style) Style {\n\tresult := s\n\tif delta.Fg != ColorDefault {\n\t\tresult.Fg = delta.Fg\n\t}\n\tif delta.Bg != ColorDefault {\n\t\tresult.Bg = delta.Bg\n\t}\n\tif delta.Reverse != DecorationInherit {\n\t\tresult.Reverse = delta.Reverse\n\t}\n\tif ... | {
"audio": "",
"image": "",
"text": " != DecorationInherit {\n\t\tresult.Bold = delta.Bold\n\t}\n\tif delta.Underline != DecorationInherit {\n\t\tresult.Underline = delta.Underline\n\t}\n\treturn result\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t}\n\tutcNow := UTCNow()\n\tdelta := requestTime.Sub(utcNow)\n\tif delta < 0 {\n\t\tdelta = delta * -1\n\t}\n\tif delta > DefaultSkewTime {\n\t\treturn fmt.Errorf(\"client time %v is too apart with server time %v\", requestTime, utcNow)\n\t}\n\treturn nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Theme) SetStyle(n",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, i Style) {\n\tp.styles[n] = i\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " return it.\n\tif p.n != 0 {\n\t\tp.n = 0\n\t\treturn p.tok\n\t}\n\n\tp.tok = p.sc.Scan()\n\treturn p.tok\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (p *Theme) HasStyle(name string) bool {\n\t_,",
"video": ""
} | {
"audio": "",
"image": "",
"text": " ok := p.styles[name]\n\treturn ok\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " bool {\n\treturn func(err error) bool {\n\t\treturn Cause(err) == cause\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewTable(cols, rows int) *Table {\n\treturn &Table{",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tGrid: NewGrid(cols, rows),\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " reader\n\trows := &Rows{\n\t\tcolumns: res.Cols,\n\t\tvalues: res.Rows,\n\t\trowcount: res.Rowcount,\n\t}\n\n\treturn rows, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (t *Table) RemoveRow(index int) {\n\tt.Grid.RemoveRow(index)\n\tif t.selected == index {\n\t\tt.selected",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = -1\n\t} else if t.selected > index {\n\t\tt.selected--\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " *Table {\n\tt.bordersColor = color\n\treturn t\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *List) Draw(p *Painter) {\n\tfor i, item := range l.items {\n\t\tstyle := \"list.item\"\n\t\tif i == l.selected-l.pos {\n\t\t\tstyle += \".selected\"\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t}\n\t\tp.WithStyle(style, func(p *Painter) {\n\t\t\tp.FillRect(0, i, l.Size().X, 1)\n\t\t\tp.DrawText(0, i, item)\n\t\t})\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif i := bytes.IndexByte(l.data[l.pos:], c); i == -1 {\n\t\t// Reached the end of data.\n\t\tl.pos = len(l.data)\n\t} else {\n\t\tl.pos += i + 1\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *List) SizeHint() image.Point {\n\tvar width int\n\tfor _, item := range l.items",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tif w := stringWidth(item); w > width {\n\t\t\twidth = w\n\t\t}\n\t}\n\treturn image.Point{width, len(l.items)}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tl.entries <- nil\n\tfor _, target := range l.Targets {\n\t\ttarget.Close()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *List) OnKeyEvent(ev KeyEvent) {\n\tif !l.IsFocused() {\n\t\treturn\n\t}\n\n\tswitch ev.Key {\n\tcase KeyUp:\n\t\tl.moveUp()\n\tcase KeyDown:",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t\tl.moveDown()\n\tcase KeyEnter:\n\t\tif l.onItemActivated != nil {\n\t\t\tl.onItemActivated(l)\n\t\t}\n\t}\n\n\tswitch ev.Rune {\n\tcase 'k':\n\t\tl.moveUp()\n\tcase 'j':\n\t\tl.moveDown()\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " {\n\t\tev, err = scope.evalAST(t)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tev.loadValue(cfg)\n\tif ev.Name == \"\" {\n\t\tev.Name = expr\n\t}\n\treturn ev, nil\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *List) AddItems(items ...string) {\n\tl.items =",
"video": ""
} | {
"audio": "",
"image": "",
"text": " append(l.items, items...)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " 0, &reheap\n\tl.all.Range(func(hash common.Hash, tx *types.Transaction) bool {\n\t\t*l.items = append(*l.items, tx)\n\t\treturn true\n\t})\n\theap.Init(l.items)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *List) RemoveItems() {\n\tl.items = []string{}\n\tl.pos",
"video": ""
} | {
"audio": "",
"image": "",
"text": " = 0\n\tl.selected = -1\n\tif l.onSelectionChanged != nil {\n\t\tl.onSelectionChanged(l)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " -1 {\n\t\t// Reached the end of data.\n\t\tl.pos = len(l.data)\n\t} else {\n\t\tl.pos += i + 1\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *List) RemoveItem(i int) {\n\t// Adjust pos and selected before removing.\n\tif l.pos >= len(l.items) {\n\t\tl.pos--\n\t}\n\tif l.selected == i {\n\t\tl.selected = -1\n\t} else if l.selected > i {\n\t\tl.selected--\n\t}\n\n\t// Copy items following i to position i.",
... | {
"audio": "",
"image": "",
"text": "\n\tcopy(l.items[i:], l.items[i+1:])\n\n\t// Shrink items by one.\n\tl.items[len(l.items)-1] = \"\"\n\tl.items = l.items[:len(l.items)-1]\n\n\tif l.onSelectionChanged != nil {\n\t\tl.onSelectionChanged(l)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tif i := bytes.IndexByte(l.data[l.pos:], c); i == -1 {\n\t\t// Reached the end of data.\n\t\tl.pos = len(l.data)\n\t} else {\n\t\tl.pos += i + 1\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func unquote(quoted string) (s string, triple bool, err error) {\n\t// Check for raw prefix: means don't interpret the inner \\.\n\traw := false\n\tif strings.HasPrefix(quoted, \"r\") {\n\t\traw = true\n\t\tquoted = quoted[1:]\n\t}\n\n\tif len(quoted) < 2 {\n\t\terr = fmt.Erro... | {
"audio": "",
"image": "",
"text": " if \\z (for some byte z) is not a known escape sequence\n\t\t\t// then it appears as literal text in the string.\n\t\t\tbuf.WriteString(quoted[:2])\n\t\t\tquoted = quoted[2:]\n\n\t\tcase '\\n':\n\t\t\t// Ignore the escape and the line break.\n\t\t\tquoted = quoted[2:]\n\n\t\t... | {
"audio": "",
"image": "",
"text": " %s\", columns, d.quoted(table), d.quoted(pkName), d.Placeholder)\n\n\trows, err := db.Query(q, pk)\n\tif err != nil {\n\t\treturn &dbErr{msg: \"meddler.Load: DB error in Query\", err: err}\n\t}\n\n\t// scan the row\n\treturn d.ScanRow(rows, dst)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func indexByte(s string, b byte) int {\n\tfor i := 0; i < len(s); i++ {\n\t\tif",
"video": ""
} | {
"audio": "",
"image": "",
"text": " s[i] == b {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tfor i := 0; i < cap(s); i++ {\n\t\ts.Lock()\n\t}\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func quote(unquoted string, triple bool) string {\n\tq := `\"`\n\tif triple {\n\t\tq = `\"\"\"`\n\t}\n\n\tvar buf bytes.Buffer\n\tbuf.WriteString(q)\n\n\tfor i := 0; i < len(unquoted); i++ {\n\t\tc := unquoted[i]\n\t\tif c == '\"' && triple && (i+1 < len(unquoted) && unquoted[... | {
"audio": "",
"image": "",
"text": " files are supposed to be Latin-1, so escape all control and high bytes.\n\t\t\t// I'd prefer to use \\x here, but Blaze does not implement\n\t\t\t// \\x in quoted strings (b/7272572).\n\t\t\tbuf.WriteByte('\\\\')\n\t\t\tbuf.WriteByte(hex[c>>6]) // actually octal but reusing h... | {
"audio": "",
"image": "",
"text": "\n\t\tif c == '`' {\n\t\t\tbuf.WriteByte('`')\n\t\t}\n\t}\n\tbuf.WriteByte('`')\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (cr *commentsRef) AllocComments() {\n\tif cr.ref == nil {\n\t",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\tcr.ref = new(Comments)\n\t}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " := conflictInput{unmerged, merged}\n\tfunc() {\n\t\tcr.inputLock.Lock()\n\t\tdefer cr.inputLock.Unlock()\n\t\t// Cancel any running CR before we return, so the caller can be\n\t\t// confident any ongoing CR superseded by this new input will be\n\t\t// canceled before it relea... |
{
"audio": "",
"image": "",
"text": "func AsFloat(x Value) (f float64, ok bool) {\n\tswitch x := x.(type) {\n\tcase Float:\n\t\treturn float64(x), true\n\tcase",
"video": ""
} | {
"audio": "",
"image": "",
"text": " Int:\n\t\treturn float64(x.Float()), true\n\t}\n\treturn 0, false\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\tcase x < 1<<42:\n\t\treturn 6\n\tcase x < 1<<49:\n\t\treturn 7\n\tcase x < 1<<56:\n\t\treturn 8\n\tcase x < 1<<63:\n\t\treturn 9\n\t}\n\treturn 10\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (fn *Function) Globals() StringDict {\n\tm := make(StringDict, len(fn.funcode.Prog.Globals))\n\tfor i, id := range fn.funcode.Prog.Globals {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\t\tif v := fn.globals[i]; v != nil {\n\t\t\tm[id.Name] = v\n\t\t}\n\t}\n\treturn m\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\n\t}\n\tglobals.lockID.Lock()\n\tdefer globals.lockID.Unlock()\n\tglobals.out = nil\n\tglobals.contexts = nil\n\tglobals.nextPID = 0\n\tglobals.nextID = 0\n\n\t// Lower back clock frequency once we're done.\n\tlowerClockFrequency()\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func NewBuiltin(name string, fn func(thread *Thread, fn *Builtin, args Tuple, kwargs []Tuple)",
"video": ""
} | {
"audio": "",
"image": "",
"text": " (Value, error)) *Builtin {\n\treturn &Builtin{name: name, fn: fn}\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " func(o *Options) { o.functions[name] = fn }\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func (l *List) checkMutable(verb string, structural bool) error {\n\tif l.frozen {\n\t\treturn fmt.Errorf(\"cannot %s",
"video": ""
} | {
"audio": "",
"image": "",
"text": " frozen list\", verb)\n\t}\n\tif structural && l.itercount > 0 {\n\t\treturn fmt.Errorf(\"cannot %s list during iteration\", verb)\n\t}\n\treturn nil\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " string, va ...interface{}) error {\n\treturn l.logMsg(attrs, LEVEL_EMERG, format, va...)\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Equal(x, y Value) (bool, error) {\n\tif x, ok := x.(String); ok {\n\t\treturn x == y, nil // fast",
"video": ""
} | {
"audio": "",
"image": "",
"text": " path for an important special case\n\t}\n\treturn EqualDepth(x, y, maxdepth)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func EqualDepth(x, y Value, depth int) (bool, error) {\n\treturn",
"video": ""
} | {
"audio": "",
"image": "",
"text": " CompareDepth(syntax.EQL, x, y, depth)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
{
"audio": "",
"image": "",
"text": "func Compare(op syntax.Token, x, y Value) (bool, error) {\n",
"video": ""
} | {
"audio": "",
"image": "",
"text": "\treturn CompareDepth(op, x, y, maxdepth)\n}",
"video": ""
} | {
"audio": "",
"image": "",
"text": " out.Y <= min {\n\t\ty = min\n\t} else {\n\t\ty = max\n\t}\n\tx := in.X + dx*(y-in.Y)/dy\n\tp.X, p.Y = x, y\n\tp.DeltaX, p.DeltaY = math.NaN(), math.NaN()\n\treturn\n}",
"video": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.