// See cairo_rel_line_to().
//
// C API documentation: http://cairographics.org/manual/cairo-Paths.html#cairo-rel-line-to
2319
func (cr *Context) RelLineTo(dx, dy float64) {
	C.cairo_rel_line_to(cr.Ptr, C.double(dx), C.double(dy))
	if err := cr.status(); err != nil {
		panic(err)
	}
}
786272
func (r Row) ToTextLine(res *bytes.Buffer, bs []string, sep string) error {
	cnt := len(bs)
	if sep == "" {
		sep = "\t"
	}
	for _, b := range bs {
		cnt--
		v := "<NULL>"
		if c, ok := r[b]; ok {
			v = c.String()
		}
		if _, err := res.WriteString(v); err != nil {
			return err
		}
		if cnt > 0 {
			res.WriteString(sep)
		}
	}
	return nil
}
717863
func (f *File) Line(p Pos) int {
	// TODO(gri) this can be implemented much more efficiently
	return f.Position(p).Line
}
532475
func (l *Line) Intersection(line *Line) *Point {
	den := (line.b[1]-line.a[1])*(l.b[0]-l.a[0]) - (line.b[0]-line.a[0])*(l.b[1]-l.a[1])
	U1 := (line.b[0]-line.a[0])*(l.a[1]-line.a[1]) - (line.b[1]-line.a[1])*(l.a[0]-line.a[0])
	U2 := (l.b[0]-l.a[0])*(l.a[1]-line.a[1]) - (l.b[1]-l.a[1])*(l.a[0]-line.a[0])

	if den == 0 {
		// collinear, all bets are off
		if U1 == 0 && U2 == 0 {
			return InfinityPoint
		}

		return nil
	}

	if U1/den < 0 || U1/den > 1 || U2/den < 0 || U2/den > 1 {
		return nil
	}

	return l.Interpolate(U1 / den)
}
1237593
func Line(nums []float64) string {
	if len(nums) == 0 {
		return ""
	}
	indices := normalize(nums)
	var sparkline bytes.Buffer
	for _, index := range indices {
		sparkline.WriteRune(steps[index])
	}
	return sparkline.String()
}
284652
func (u *UI) Line(format string, a ...interface{}) {
	u.LineIndent(0, format, a...)
}
534924
func (cr *Context) CopyPath() *Path {
	ret := wrapPath(C.cairo_copy_path(cr.Ptr))
	if err := cr.status(); err != nil {
		panic(err)
	}
	return ret
}
1352456
func (d *ArgErrDetail) Lines() []string {
	lines := make([]string, 2)
	lines[0] = fmt.Sprint("have: ", formatArgs(d.Have))
	lines[1] = fmt.Sprint("want: ", formatArgs(d.Want))
	return lines
}
66077
func (g *Group) Line() *Statement {
	s := Line()
	g.items = append(g.items, s)
	return s
}
335418
func getPatternFromLine(line string) (*regexp.Regexp, bool) {
	// Trim OS-specific carriage returns.
	line = strings.TrimRight(line, "\r")

	// Strip comments [Rule 2]
	if strings.HasPrefix(line, `#`) {
		return nil, false
	}

	// Trim string [Rule 3]
	// TODO: Handle [Rule 3], when the " " is escaped with a \
	line = strings.Trim(line, " ")

	// Exit for no-ops and return nil which will prevent us from
	// appending a pattern against this line
	if line == "" {
		return nil, false
	}

	// TODO: Handle [Rule 4] which negates the match for patterns leading with "!"
	negatePattern := false
	if line[0] == '!' {
		negatePattern = true
		line = line[1:]
	}

	// Handle [Rule 2, 4], when # or ! is escaped with a \
	// Handle [Rule 4] once we tag negatePattern, strip the leading ! char
	if regexp.MustCompile(`^(\#|\!)`).MatchString(line) {
		line = line[1:]
	}

	// If we encounter a foo/*.blah in a folder, prepend the / char
	if regexp.MustCompile(`([^\/+])/.*\*\.`).MatchString(line) && line[0] != '/' {
		line = "/" + line
	}

	// Handle escaping the "." char
	line = regexp.MustCompile(`\.`).ReplaceAllString(line, `\.`)

	magicStar := "#$~"

	// Handle "/**/" usage
	if strings.HasPrefix(line, "/**/") {
		line = line[1:]
	}
	line = regexp.MustCompile(`/\*\*/`).ReplaceAllString(line, `(/|/.+/)`)
	line = regexp.MustCompile(`\*\*/`).ReplaceAllString(line, `(|.`+magicStar+`/)`)
	line = regexp.MustCompile(`/\*\*`).ReplaceAllString(line, `(|/.`+magicStar+`)`)

	// Handle escaping the "*" char
	line = regexp.MustCompile(`\\\*`).ReplaceAllString(line, `\`+magicStar)
	line = regexp.MustCompile(`\*`).ReplaceAllString(line, `([^/]*)`)

	// Handle escaping the "?" char
	line = strings.Replace(line, "?", `\?`, -1)

	line = strings.Replace(line, magicStar, "*", -1)

	// Temporary regex
	var expr = ""
	if strings.HasSuffix(line, "/") {
		expr = line + "(|.*)$"
	} else {
		expr = line + "(|/.*)$"
	}
	if strings.HasPrefix(expr, "/") {
		expr = "^(|/)" + expr[1:]
	} else {
		expr = "^(|.*/)" + expr
	}
	pattern, _ := regexp.Compile(expr)

	return pattern, negatePattern
}
480719
func linkgetline(ctxt *Link, line int, f **LSym, l *int) {
	var a [HISTSZ]struct {
		incl *Hist
		idel int
		line *Hist
		ldel int
	}
	var lno int
	var d int
	var dlno int
	var n int
	var h *Hist
	var buf string
	var buf1 string
	var file string
	lno = line
	n = 0
	for h = ctxt.Hist; h != nil; h = h.Link {
		if h.Offset < 0 {
			continue
		}
		if lno < h.Line {
			break
		}
		if h.Name != "XXXXXXX" {
			if h.Offset > 0 {
				// #line directive
				if n > 0 && n < HISTSZ {
					a[n-1].line = h
					a[n-1].ldel = h.Line - h.Offset + 1
				}
			} else {
				// beginning of file
				if n < HISTSZ {
					a[n].incl = h
					a[n].idel = h.Line
					a[n].line = nil
				}
				n++
			}
			continue
		}
		n--
		if n > 0 && n < HISTSZ {
			d = h.Line - a[n].incl.Line
			a[n-1].ldel += d
			a[n-1].idel += d
		}
	}
	if n > HISTSZ {
		n = HISTSZ
	}
	if n <= 0 {
		*f = Linklookup(ctxt, "??", HistVersion)
		*l = 0
		return
	}
	n--
	if a[n].line != nil {
		file = a[n].line.Name
		dlno = a[n].ldel - 1
	} else {
		file = a[n].incl.Name
		dlno = a[n].idel - 1
	}
	if (ctxt.Windows == 0 && file[0] == '/') || (ctxt.Windows != 0 && file[1] == ':') || file[0] == '<' {
		buf = fmt.Sprintf("%s", file)
	} else {
		buf = fmt.Sprintf("%s/%s", ctxt.Pathname, file)
	}
	// Remove leading ctxt->trimpath, or else rewrite $GOROOT to $GOROOT_FINAL.
	if ctxt.Trimpath != "" && haspathprefix(buf, ctxt.Trimpath) {
		if len(buf) == len(ctxt.Trimpath) {
			buf = "??"
		} else {
			buf1 = fmt.Sprintf("%s", buf[len(ctxt.Trimpath)+1:])
			if buf1[0] == '\x00' {
				buf1 = "??"
			}
			buf = buf1
		}
	} else if ctxt.Goroot_final != "" && haspathprefix(buf, ctxt.Goroot) {
		buf1 = fmt.Sprintf("%s%s", ctxt.Goroot_final, buf[len(ctxt.Goroot):])
		buf = buf1
	}
	lno -= dlno
	*f = Linklookup(ctxt, buf, HistVersion)
	*l = lno
}
930734
func rel(basepath, targpath string) (string, error) {
	// filepath.Rel can't handle UUID paths in windows
	if runtime.GOOS == "windows" {
		pfx := basepath + `\`
		if strings.HasPrefix(targpath, pfx) {
			p := strings.TrimPrefix(targpath, pfx)
			if p == "" {
				p = "."
			}
			return p, nil
		}
	}
	return filepath.Rel(basepath, targpath)
}
1219470
func Line(prompt string) (string, error) {
	ins := getInstance()
	ins.SetPrompt(prompt)
	return ins.Readline()
}
1036000
func (p *Polyline) Reverse() {
	for i := 0; i < len(*p)/2; i++ {
		(*p)[i], (*p)[len(*p)-i-1] = (*p)[len(*p)-i-1], (*p)[i]
	}
}
78106
func (c *collection) relPath(apiName string) string {
	escapedName := pathEscape(c.name)
	return path.Join(c.db.relPath(), "_api", apiName, escapedName)
}
1200850
func (c *Conn) printLine(cmd string, args ...interface{}) {
	io.WriteString(c.c.W, cmd)
	for _, a := range args {
		c.c.W.Write(space)
		fmt.Fprint(c.c.W, a)
	}
	c.c.W.Write(crnl)
}
22836
func (pattern *MeshPattern) CurveTo(x1, y1, x2, y2, x3, y3 float64) {
	C.cairo_mesh_pattern_curve_to(pattern.Ptr, C.double(x1), C.double(y1), C.double(x2), C.double(y2), C.double(x3), C.double(y3))
	if err := pattern.status(); err != nil {
		panic(err)
	}
}