srecord  1.65.0
trs80.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 2012, 2013 Peter Miller
4 //
5 // Code contribution by Eric Smith <eric@brouhaha.com>
6 // Copyright assigned to Peter Miller 15-Mar-2012.
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU Lesser General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or (at your
11 // option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
16 // for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public License
19 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //
21 
22 #ifndef SRECORD_INPUT_FILE_TRS80_H
23 #define SRECORD_INPUT_FILE_TRS80_H
24 
25 
26 #include <srecord/input/file.h>
27 
28 namespace srecord {
29 
30 /**
31  * The srecord::input_file_trs80 class is used to parse a Radio Shack
32  * TRS-80 load module file.
33  */
35  public input_file
36 {
37 public:
38  /**
39  * The destructor.
40  */
41  virtual ~input_file_trs80();
42 
43  /**
44  * The create class method is used to create new dynamically
45  * allocated instances of this class.
46  *
47  * @param file_name
48  * The name of the file to be read.
49  * @returns
50  * smart pointer to new instance
51  */
52  static pointer create(const std::string &file_name);
53 
54 protected:
55  // See base class for documentation.
56  bool read(record &result);
57 
58  // See base class for documentation.
59  const char *get_file_format_name(void) const;
60 
61  // See base class for documentation.
62  bool is_binary(void) const;
63 
64  // See base class for documentation.
65  int format_option_number(void) const;
66 
67 private:
68  /**
69  * The termination_seen instance variable is used to remember
70  * whether or not a termination record has been seen yet.
71  */
72  bool termination_seen;
73 
74  /**
75  * The data_seen instance variable is used to remember
76  * whether or not a data record has been seen yet.
77  */
78  bool data_seen;
79 
80  /**
81  * A constructor. The input is read from the named file (or
82  * the standard input if the file anme is "-").
83  *
84  * @param file_name
85  * The name of the file to be read.
86  */
87  input_file_trs80(const std::string &file_name);
88 
89  /**
90  * The get_byte method is used to fetch a byte of input, and
91  * update the checksum. We over-ride the base implementation,
92  * because we use raw bytes rather than two hex digits.
93  */
94  int get_byte(void);
95 
96  /**
97  * The pending instance variable is used to remember the second
98  * half of large data packets, in the case where they must be splt.
99  */
100  record *pending;
101 
102  /**
103  * The copy constructor. Do not use.
104  */
106 
107  /**
108  * The assignment operator. Do not use.
109  */
110  input_file_trs80 &operator=(const input_file_trs80 &);
111 };
112 
113 };
114 
115 // vim: set ts=8 sw=4 et :
116 #endif // SRECORD_INPUT_FILE_TRS80_H
The srecord::input_file_trs80 class is used to parse a Radio Shack TRS-80 load module file.
Definition: trs80.h:36
virtual ~input_file_trs80()
The destructor.
bool read(record &result)
The read method is used to read one record from the input.
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.
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...
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.
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