srecord  1.65.0
forth.h
Go to the documentation of this file.
1 //
2 // srecord - manipulate eprom load files
3 // Copyright (C) 2008, 2010 Peter Miller
4 // Copyright (C) 2008 Torsten Sadowski
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it 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
9 // your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Public 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 SRECORD_OUTPUT_FILE_FORTH_H
21 #define SRECORD_OUTPUT_FILE_FORTH_H
22 
23 #include <srecord/output/file.h>
24 
25 namespace srecord
26 {
27 
28 /**
29  * The srecord::output_file_forth class is used to write a file that
30  * can be read by a FORTH system
31  */
33  public output_file
34 {
35 public:
36  /**
37  * The destrutcor.
38  */
39  virtual ~output_file_forth();
40 
41 private:
42  /**
43  * The constructor.
44  *
45  * @param file_name
46  * The name of the file to be written.
47  */
48  output_file_forth(const std::string &file_name);
49 
50 public:
51  /**
52  * The create class method is used to create new dynamically
53  * allocated instances of this class.
54  *
55  * @param file_name
56  * The file name to open to write data to. The name "-" is
57  * understood to mean the standard output.
58  */
59  static pointer create(const std::string &file_name);
60 
61 protected:
62  // See base class for documentation.
63  void write(const record &);
64 
65  // See base class for documentation.
66  void line_length_set(int);
67 
68  // See base class for documentation.
69  void address_length_set(int);
70 
71  // See base class for documentation.
73 
74  // See base class for documentation.
75  bool preferred_block_size_set(int nbytes);
76 
77  // See base class for documentation.
78  void command_line(arglex_tool *cmdln);
79 
80  // See base class for documentation.
81  const char *format_name() const;
82 
83 private:
84  /**
85  * The FORTH store command to use. Either C! for RAM or EEC! for EEPROM
86  */
87  std::string store_cmd;
88 
89  /**
90  * The emit_end_of_file method is used to write the ETX and
91  * checksum out to the file. It is safe top call this method more
92  * than once, only one ETX will be written.
93  */
94  void emit_end_of_file();
95 
96  /**
97  * The default constructor. Do not use.
98  */
100 
101  /**
102  * The copy constructor. Do not use.
103  */
105 
106  /**
107  * The assignment operator. Do not use.
108  */
109  output_file_forth &operator=(const output_file_forth &);
110 };
111 
112 };
113 
114 #endif // SRECORD_OUTPUT_FILE_FORTH_H
The srecord::arglex_tool is used to parse command line with srec-specific arguments.
Definition: tool.h:41
The srecord::output_file_forth class is used to write a file that can be read by a FORTH system.
Definition: forth.h:34
virtual ~output_file_forth()
The destrutcor.
int preferred_block_size_get() const
The preferred_block_size_get method is used to get the proferred block size of the output fformat.
void address_length_set(int)
The address_length_set method is used to set the minimum number of bytes to be written for addresses ...
bool preferred_block_size_set(int nbytes)
The preferred_block_size_set method is is to set a precific number of bytes for the preferred block s...
const char * format_name() const
The format_name method is used to obtain the name of this output format.
static pointer create(const std::string &file_name)
The create class method is used to create new dynamically allocated instances of this class.
void write(const record &)
The write method is used to write a recordonto an output.
void line_length_set(int)
The set_line_length method is used to set the maximum length of an output line, for those formats for...
void command_line(arglex_tool *cmdln)
The command_line method is used by arglex_srec::get_output when parsing the command line,...
The srecord::output_file class is used to represent a generic output file.
Definition: file.h:35
std::shared_ptr< output > pointer
Definition: output.h:41
The srecord::record class is used to represent a data record read from a file.
Definition: record.h:35