srecord  1.65.0
dec_binary.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 2001, 2003, 2006-2008, 2010-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 SRECORD_INPUT_FILE_DEC_BINARY_H
20 #define SRECORD_INPUT_FILE_DEC_BINARY_H
21 
22 
23 #include <srecord/input/file.h>
24 
25 namespace srecord {
26 
27 /**
28  * The srecord::input_file_dec_binary class is used to parse a DEC
29  * Binary (PDP 11 absolute loader XXDP) format file.
30  */
32  public input_file
33 {
34 public:
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 
51 protected:
52  // See base class for documentation.
53  bool read(record &record);
54 
55  // See base class for documentation.
56  const char *get_file_format_name(void) const;
57 
58  // See base class for documentation.
59  bool is_binary(void) const;
60 
61  // See base class for documentation.
62  int format_option_number(void) const;
63 
64 private:
65  /**
66  * A constructor. The input is read from the named file (or
67  * the standard input if the file anme is "-").
68  *
69  * @param file_name
70  * The name of the file to be read.
71  */
72  input_file_dec_binary(const std::string &file_name);
73 
74  /**
75  * The get_byte method is used to fetch a byte of input, and
76  * update the checksum. We over-ride the base implementation,
77  * because we use raw bytes rather than two hex digits.
78  */
79  int get_byte();
80 
81  /**
82  * This format has NUL characters for optional badding around
83  * blocks. This method is used to skip past such padding.
84  * Returns true if there is more inoput available, or false at
85  * end of file.
86  */
87  bool skip_nul();
88 
89  /**
90  * The current_pos instance variable is used to track out
91  * position within the current record. We need todo this
92  * becase DEC Binary records can be significantly longer than
93  * other formats.
94  */
95  unsigned long current_pos;
96 
97  /**
98  * The current_length instance variable is used to remember
99  * the length of the current record. It is zero if there is no
100  * "current" record.
101  */
102  unsigned long current_length;
103 
104  /**
105  * The current_address instance variable is used to track the
106  * load address of the current record. It is updated each time
107  * we return a partial block, so that we alsoways return the
108  * correct load address.
109  */
110  unsigned long current_address;
111 
112  /**
113  * The copy constructor. Do not use.
114  */
116 
117  /**
118  * The assignment operator. Do not use.
119  */
120  input_file_dec_binary &operator=(const input_file_dec_binary &);
121 };
122 
123 };
124 
125 // vim: set ts=8 sw=4 et :
126 #endif // SRECORD_INPUT_FILE_DEC_BINARY_H
The srecord::input_file_dec_binary class is used to parse a DEC Binary (PDP 11 absolute loader XXDP) ...
Definition: dec_binary.h:33
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...
virtual ~input_file_dec_binary()
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.
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...
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
bool read(record &record)
The read method is used to read one record from the input.
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