From 5c3d717c55e3a9cadd924d6b20eab99f8f9615ba Mon Sep 17 00:00:00 2001 From: Kurt Jung Date: Wed, 29 Jan 2014 11:38:29 -0500 Subject: Name changes for Lint conformance. One key advantage of the camelback naming convention is that a machine can quickly tokenize name segments for indexing and tagging purposes. For example, HtmlWrite easily breaks into Html and Write. By capitalizing all letters in an initialism, this name breaks into H, T, M, L, and Write -- not as useful for tagging purposes. Rather than having to manually filter through the mostly valuable output of golint, I have grudgingly changed names so that golint produces no output. --- svgbasic.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'svgbasic.go') diff --git a/svgbasic.go b/svgbasic.go index 526f4eb..749933e 100644 --- a/svgbasic.go +++ b/svgbasic.go @@ -34,15 +34,15 @@ func init() { "M", " M ", "m", " m ") } -// SvgBasicSegmentType describes a single curve or position segment -type SvgBasicSegmentType struct { +// SVGBasicSegmentType describes a single curve or position segment +type SVGBasicSegmentType struct { Cmd byte // See http://www.w3.org/TR/SVG/paths.html for path command structure Arg [6]float64 } -func absolutizePath(segs []SvgBasicSegmentType) { +func absolutizePath(segs []SVGBasicSegmentType) { var x, y float64 - var segPtr *SvgBasicSegmentType + var segPtr *SVGBasicSegmentType adjust := func(pos int, adjX, adjY float64) { segPtr.Arg[pos] += adjX segPtr.Arg[pos+1] += adjY @@ -83,8 +83,8 @@ func absolutizePath(segs []SvgBasicSegmentType) { } } -func pathParse(pathStr string) (segs []SvgBasicSegmentType, err error) { - var seg SvgBasicSegmentType +func pathParse(pathStr string) (segs []SVGBasicSegmentType, err error) { + var seg SVGBasicSegmentType var j, argJ, argCount, prevArgCount int setup := func(n int) { // It is not strictly necessary to clear arguments, but result may be clearer @@ -154,20 +154,20 @@ func pathParse(pathStr string) (segs []SvgBasicSegmentType, err error) { return } -// SvgBasicType aggregates the information needed to describe a multi-segment +// SVGBasicType aggregates the information needed to describe a multi-segment // basic vector image -type SvgBasicType struct { +type SVGBasicType struct { Wd, Ht float64 - Segments [][]SvgBasicSegmentType + Segments [][]SVGBasicSegmentType } -// SvgBasicParse parses a simple scalable vector graphics (SVG) buffer into a +// SVGBasicParse parses a simple scalable vector graphics (SVG) buffer into a // descriptor. Only a small subset of the SVG standard, in particular the path // information generated by jSignature, is supported. The returned path data // includes only the commands 'M' (absolute moveto: x, y), 'L' (absolute // lineto: x, y), and 'C' (absolute cubic Bézier curve: cx0, cy0, cx1, cy1, // x1,y1). -func SvgBasicParse(buf []byte) (sig SvgBasicType, err error) { +func SVGBasicParse(buf []byte) (sig SVGBasicType, err error) { type pathType struct { D string `xml:"d,attr"` } @@ -181,7 +181,7 @@ func SvgBasicParse(buf []byte) (sig SvgBasicType, err error) { if err == nil { if src.Wd > 0 && src.Ht > 0 { sig.Wd, sig.Ht = src.Wd, src.Ht - var segs []SvgBasicSegmentType + var segs []SVGBasicSegmentType for _, path := range src.Paths { if err == nil { segs, err = pathParse(path.D) @@ -198,14 +198,14 @@ func SvgBasicParse(buf []byte) (sig SvgBasicType, err error) { return } -// SvgBasicFileParse parses a simple scalable vector graphics (SVG) file into a -// basic descriptor. See SvgBasicParse for additional comments and tutorial 20 +// SVGBasicFileParse parses a simple scalable vector graphics (SVG) file into a +// basic descriptor. See SVGBasicParse for additional comments and tutorial 20 // for an example of this function. -func SvgBasicFileParse(svgFileStr string) (sig SvgBasicType, err error) { +func SVGBasicFileParse(svgFileStr string) (sig SVGBasicType, err error) { var buf []byte buf, err = ioutil.ReadFile(svgFileStr) if err == nil { - sig, err = SvgBasicParse(buf) + sig, err = SVGBasicParse(buf) } return } -- cgit v1.2.1-24-ge1ad