srecord  1.65.0
motorola.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 1998-2000, 2002, 2003, 2005-2008, 2010, 2011, 2013 Peter Miller
4 //
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or (at your
8 // option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13 // License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 
19 #ifndef LIB_INPUT_FILE_MOTOROLA_H
20 #define LIB_INPUT_FILE_MOTOROLA_H
21 
22 #include <srecord/input/file.h>
23 
24 namespace srecord {
25 
26 /**
27  * The srecord::input_file_motorola class is used to represent the parse
28  * state of a Motorola S-Record formatted input file.
29  */
31  public input_file
32 {
33 public:
34  /**
35  * The destructor.
36  */
38 
39  /**
40  * The create class method is used to create new dynamically
41  * allocated instances of this class.
42  *
43  * @param file_name
44  * The name of the file to be read.
45  * @returns
46  * smart pointer to new instance
47  */
48  static pointer create(const std::string &file_name);
49 
50 protected:
51  // See base class for documentation.
52  bool read(record &record);
53 
54  // See base class for documentation.
55  const char *get_file_format_name(void) const;
56 
57  // See base class for documentation.
58  void command_line(arglex_tool *cmdln);
59 
60  // See base class for documentation.
61  int format_option_number(void) const;
62 
63 private:
64  /**
65  * The constructor.
66  *
67  * @param file_name
68  * The name of the file to be read.
69  */
70  input_file_motorola(const std::string &file_name);
71 
72  /**
73  * The data_count instance variable is used to remember the number
74  * of data lines has occurred fo far in the input file.
75  */
76  unsigned long data_count;
77 
78  /**
79  * The read_inner method is used to read a record of input.
80  * The read method is a wrapper around this method.
81  */
82  bool read_inner(record &);
83 
84  /**
85  * The garbage_warning instance variable is used to remember whether
86  * or not a warning about garbage input lines has been issued yet.
87  */
88  bool garbage_warning;
89 
90  /**
91  * The seen_some_input instance variable is used to remember where
92  * any data has been seen in this file yet.
93  */
94  bool seen_some_input;
95 
96  /**
97  * The header_seen instance variable is used to remember whether
98  * or not the header record has been seen yet.
99  */
100  bool header_seen;
101 
102  /**
103  * The termination_seen instance variable is used to remember
104  * whether or not the termination record has been seen yet.
105  */
106  bool termination_seen;
107 
108  /**
109  * The address_shift method is used to remember how far to the left
110  * addresses need to be shifted to become byte addresses.
111  * The default is zero (0).
112  *
113  * This is because of some poorly though out "extentions" to the
114  * file format, for 16-bit and 32-bit data busses. I say "poory
115  * thought out" because the no way (zero, zip, nada) of discovering
116  * this just by looking at the first data line in the file (and if
117  * the lines are jumbled just right, the first few lines are no
118  * more enlightening).
119  */
120  unsigned address_shift;
121 
122  /**
123  * The default constructor. Do not use.
124  */
126 
127  /**
128  * The copy constructor. Do not use.
129  */
131 
132  /**
133  * The assignment operator. Do not use.
134  */
135  input_file_motorola &operator=(const input_file_motorola &);
136 };
137 
138 };
139 
140 #endif // LIB_INPUT_FILE_MOTOROLA_H
141 // 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_motorola class is used to represent the parse state of a Motorola S-Record fo...
Definition: motorola.h:32
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
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...
void command_line(arglex_tool *cmdln)
The command_line method is used by arglex_srec::get_input when parsing the command line,...
bool read(record &record)
The read method is used to read one record from the input.
virtual ~input_file_motorola()
The destructor.
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.
The srecord::input_file class is used to represent an generic input file.
Definition: file.h:37
std::shared_ptr< input > pointer
Definition: input.h:41
The srecord::record class is used to represent a data record read from a file.
Definition: record.h:35