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#include <cstdint>
25
26namespace srecord {
27
28/**
29 * The srecord::input_file_hp64k class is used to represent the parse
30 * state of a HP64000 Absolute formatted input file.
31 */
32class input_file_hp64k:
33 public input_file
34{
35public:
36 /**
37 * The destructor.
38 */
40
41 /**
42 * The create class method is used to create new dynamically
43 * allocated instances of this class.
44 *
45 * @param file_name
46 * The name of the file to be read.
47 * @returns
48 * smart pointer to new instance
49 */
50 static pointer create(const std::string &file_name);
51
52protected:
53 // See base class for documentation.
55
56 // See base class for documentation.
57 const char *get_file_format_name(void) const;
58
59 // See base class for documentation.
61
62 // See base class for documentation.
63 int format_option_number(void) const;
64
65private:
66 /**
67 * The constructor.
68 *
69 * @param file_name
70 * The name of the file to be read.
71 */
72 input_file_hp64k(const std::string &file_name);
73
74 // See base class for documentation.
75 bool is_binary(void) const;
76
77 /**
78 * Number of parsed data records
79 */
80 unsigned long rec_count;
81
82 /** Helper function: read two bytes, big-endian. Ret 1 if ok */
83 bool read_u16be(uint16_t *dest);
84
85 /** Read one data record. */
86 bool read_datarec(record &);
87
88 /** Read file magic and header */
89 bool read_hdr(record &);
90
91 /** Read Processor Information Record (PIR) */
92 bool read_pir(record &);
93
94 /**
95 * Parsing state. Files always have header, then PIR, then data records.
96 */
97 enum { need_hdr, need_pir, data } state;
98
99 /**
100 * The default constructor. Do not use.
101 */
103
104 /**
105 * The copy constructor. Do not use.
106 */
108
109 /**
110 * The assignment operator. Do not use.
111 */
112 input_file_hp64k &operator=(const input_file_hp64k &);
113};
114
115};
116
117#endif // LIB_INPUT_FILE_HP64K
118// 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:34
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.
virtual bool is_binary(void) const
The is_binary method is used to to determine whether or not a file format is binary (true) of text (f...
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