srecord  1.65.0
fastload.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 2001, 2003, 2006-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 SRECORD_INPUT_FILE_FASTLOAD_H
20 #define SRECORD_INPUT_FILE_FASTLOAD_H
21 
22 #include <srecord/input/file.h>
23 
24 namespace srecord {
25 
26 /**
27  * The fastload class is used to parse an LSI Logic Fast Load format file.
28  */
30  public input_file
31 {
32 public:
33  /**
34  * The destructor.
35  */
37 
38  /**
39  * The create class method is used to create new dynamically
40  * allocated instances of this class.
41  *
42  * @param file_name
43  * The name of the file to be read.
44  * @returns
45  * smart pointer to new instance
46  */
47  static pointer create(const std::string &file_name);
48 
49 protected:
50  // See base class for documentation.
51  bool read(record &record);
52 
53  // See base class for documentation.
54  const char *get_file_format_name(void) const;
55 
56  // See base class for documentation.
57  int format_option_number(void) const;
58 
59 private:
60  /**
61  * A constructor. The input is read from the named file (or
62  * the standard input if the file anme is "-").
63  *
64  * @param file_name
65  * The name of the file to be read.
66  */
67  input_file_fastload(const std::string &file_name);
68 
69  /**
70  * Read one line (record) of input. Called by the #read method.
71  * Returns false at end of file.
72  */
73  bool read_inner(record &);
74 
75  /**
76  * Get a singe base-64 digit. Returns 0..63 for a valid digit.
77  * Fatal error if not a valid base-64 digit.
78  */
79  int get_digit(void);
80 
81  /**
82  * The get_number method is used to get a base-64 number.
83  * The ordering is big-endian, but like ordinary decimal numbers.
84  * Four digits is 24 bits.
85  */
86  unsigned long get_number(int min_digits, int max_digits);
87 
88  /**
89  * The seen_some_input instance variable is used to
90  * remember whether any input has been seen.
91  */
92  bool seen_some_input;
93 
94  /**
95  * The address instance variable is used to represent the
96  * current address within the file. It is set by the /A command,
97  * and advanced by the data, /B and /Z commands.
98  */
99  unsigned long address;
100 
101  /**
102  * The expect_white_space method is used to ensure that while
103  * space follows the various commands. It doesn't consume any
104  * input, since it uses peek_char to do the checking.
105  */
106  void expect_white_space(void);
107 
108  /**
109  * The default constructor. Do not use.
110  */
112 
113  /**
114  * The copy constructor. Do not use.
115  */
117 
118  /**
119  * The assignment operator. Do not use.
120  */
121  input_file_fastload &operator=(const input_file_fastload &);
122 };
123 
124 };
125 
126 #endif // SRECORD_INPUT_FILE_FASTLOAD_H
127 // vim: set ts=8 sw=4 et :
The fastload class is used to parse an LSI Logic Fast Load format file.
Definition: fastload.h:31
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
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...
virtual ~input_file_fastload()
The destructor.
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