srecord 1.65.0
 
Loading...
Searching...
No Matches
hp64k.h
Go to the documentation of this file.
1//
2// srecord - manipulate eprom load files
3// Copyright (C) 2019 fenugrec
4// based on motorola.h
5//
6// This program is free software; you can redistribute it and/or modify it
7// under the terms of the GNU Lesser General Public License as published by
8// the Free Software Foundation; either version 3 of the License, or (at your
9// option) any later version.
10//
11// This program is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14// License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with this program. If not, see <http://www.gnu.org/licenses/>.
18//
19
20#ifndef LIB_INPUT_FILE_HP64K
21#define LIB_INPUT_FILE_HP64K
22
23#include <srecord/input/file.h>
24
25namespace srecord {
26
27/**
28 * The srecord::input_file_hp64k class is used to represent the parse
29 * state of a HP64000 Absolute formatted input file.
30 */
31class input_file_hp64k:
32 public input_file
33{
34public:
35 /**
36 * The destructor.
37 */
39
40 /**
41 * The create class method is used to create new dynamically
42 * allocated instances of this class.
43 *
44 * @param file_name
45 * The name of the file to be read.
46 * @returns
47 * smart pointer to new instance
48 */
49 static pointer create(const std::string &file_name);
50
51protected:
52 // See base class for documentation.
54
55 // See base class for documentation.
56 const char *get_file_format_name(void) const;
57
58 // See base class for documentation.
60
61 // See base class for documentation.
62 int format_option_number(void) const;
63
64private:
65 /**
66 * The constructor.
67 *
68 * @param file_name
69 * The name of the file to be read.
70 */
71 input_file_hp64k(const std::string &file_name);
72
73 // See base class for documentation.
74 bool is_binary(void) const;
75
76 /**
77 * Number of parsed data records
78 */
79 unsigned long rec_count;
80
81 /** Helper function: read two bytes, big-endian. Ret 1 if ok */
82 bool read_u16be(uint16_t *dest);
83
84 /** Read one data record. */
85 bool read_datarec(record &);
86
87 /** Read file magic and header */
88 bool read_hdr(record &);
89
90 /** Read Processor Information Record (PIR) */
91 bool read_pir(record &);
92
93 /**
94 * Parsing state. Files always have header, then PIR, then data records.
95 */
96 enum { need_hdr, need_pir, data } state;
97
98 /**
99 * The default constructor. Do not use.
100 */
102
103 /**
104 * The copy constructor. Do not use.
105 */
107
108 /**
109 * The assignment operator. Do not use.
110 */
111 input_file_hp64k &operator=(const input_file_hp64k &);
112};
113
114};
115
116#endif // LIB_INPUT_FILE_HP64K
117// vim: set ts=8 sw=4 et :
The srecord::arglex_tool is used to parse command line with srec-specific arguments.
Definition tool.h:41
The srecord::input_file_hp64k class is used to represent the parse state of a HP64000 Absolute format...
Definition hp64k.h:33
void command_line(arglex_tool *cmdln)
The command_line method is used by arglex_srec::get_input when parsing the command line,...
int format_option_number(void) const
The format_option_number method is used to obtain the option number, which can then be turned into te...
const char * get_file_format_name(void) const
The get_file_format_name method is used to find out the name of the file format being read.
virtual ~input_file_hp64k()
The destructor.
bool read(record &record)
The read method is used to read one record from the input.
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
input_file(const std::string &file_name)
The constructor.
std::shared_ptr< input_file > pointer
Definition file.h:39
The srecord::record class is used to represent a data record read from a file.
Definition record.h:35