From c3a3000908f063bb152825fecb226df422e83e90 Mon Sep 17 00:00:00 2001 From: Michael McLoughlin Date: Sat, 5 Jan 2019 13:45:09 -0800 Subject: [PATCH] internal/load: doc exported symbols (#9) --- internal/load/load.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/internal/load/load.go b/internal/load/load.go index 417b55a..eacdc59 100644 --- a/internal/load/load.go +++ b/internal/load/load.go @@ -12,11 +12,13 @@ import ( "github.com/mmcloughlin/avo/internal/opcodesxml" ) +// Expected data source filenames. const ( - defaultCSVName = "x86.v0.2.csv" - defaultOpcodesXMLName = "x86_64.xml" + DefaultCSVName = "x86.v0.2.csv" + DefaultOpcodesXMLName = "x86_64.xml" ) +// Loader builds an instruction database from underlying datasources. type Loader struct { X86CSVPath string OpcodesXMLPath string @@ -25,13 +27,17 @@ type Loader struct { order map[string]opcodescsv.OperandOrder } +// NewLoaderFromDataDir constructs an instruction loader from datafiles in the +// given directory. The files themselves are expected to have the standard +// names: see Default*Name constants. func NewLoaderFromDataDir(dir string) *Loader { return &Loader{ - X86CSVPath: filepath.Join(dir, defaultCSVName), - OpcodesXMLPath: filepath.Join(dir, defaultOpcodesXMLName), + X86CSVPath: filepath.Join(dir, DefaultCSVName), + OpcodesXMLPath: filepath.Join(dir, DefaultOpcodesXMLName), } } +// Load performs instruction loading. func (l *Loader) Load() ([]inst.Instruction, error) { if err := l.init(); err != nil { return nil, err