Documentation ¶
Overview ¶
Package ihex implements a parser for Intel HEX files.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ParseError ¶
A ParseError represents an error encountered during parsing.
func (ParseError) Error ¶
func (e ParseError) Error() string
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
A Parser reads records from an io.Reader, with an interface similar to bufio.Scanner.
Example ¶
lines := ` :1000000000E10EBFEFE531E001E011E0010F40E05B :1000100052E00E94710432E000E111EF010F41E073 :00000001FF ` parser := NewParser(strings.NewReader(lines)) for parser.Parse() { data := parser.Data() fmt.Printf("%04x %d\n", data.Address, len(data.Bytes)) } if err := parser.Err(); err != nil { fmt.Println("error:", err) }
Output: 0000 16 0010 16
func (*Parser) CSIP ¶
CSIP returns cs and ip with ok true if the parser read a record of type 3; otherwise it returns with ok false.
func (*Parser) Data ¶
Data returns the last record read by the Parse method. The underlying data may be overwritten by subsequent calls to Parse.
func (*Parser) EIP ¶
EIP returns eip with ok true if the parser read a record of type 5; otherwise it returns with ok false.
func (*Parser) Parse ¶
Parse reads the next data record, which can then be accessed by the Data method. It returns false when there are no more data records, or if an error occurred during parsing. After parsing is finished, information from record types 3 or 5 can be accessed by the CSIP or EIP methods; an error, if any, can be accessed by the Err method.