1 /******************************************************************************
5 * $Date: 2007/12/23 15:25:11 $
8 * $Log: tape_block.hh,v $
9 * Revision 2.1 2007/12/23 15:25:11 hachti
10 * *** empty log message ***
12 * Revision 2.0 2007-03-26 01:00:40 hachti
13 * *** empty log message ***
16 ******************************************************************************/
24 *\brief Tape data block base class.
26 * This class represents a Honeywell paper tape block.
27 * That may be some kind of data block or a end of tape mark.
37 TBT_DATA=0x10, //!< Data block
38 TBT_EOT, //!< End of tape block
39 TBT_BROKEN, //!< A broken block
43 *\brief Local base class for exceptions.
50 tape_block * get_block();
52 tape_block * m_broken_block;
56 *\brief Checksum error exception.
58 class checksum_error_exception
61 checksum_error_exception(tape_block * block);
65 *\brief EOF while reading block exception.
67 class eof_illegal_exception
70 eof_illegal_exception(tape_block * block);
74 *\brief EOF after reading block exception.
76 class eof_legal_exception
79 eof_legal_exception(int bytes_consumed);
83 tape_block * get_block();
87 *\brief IO error exception.
89 class io_error_exception
94 tape_block * get_block();
98 virtual ~tape_block();
100 tape_block(tape_block &);
101 void operator=(tape_block &);
103 virtual int get_type();
104 virtual int get_subtype();
105 virtual vector<string> get_description();
107 int get_discarded_bytes();
108 unsigned char * get_raw_data();
109 virtual int dump_to_fd(int fd);
110 virtual bool is_endblock();
111 virtual vector<string> get_exported_symbols();
112 virtual vector<string> get_called_symbols();
113 virtual vector<string> dump_contents();
114 virtual bool has_known_type();
116 static tape_block * gen_from_fd(int fd,
117 void(*input_start)(void *)=0,
118 void (*input_stop)(void *)=0,
119 void * start_stop_arg=0
122 protected: // methods
124 string get_typestring();
127 tape_block (int fd_p,
128 void(*input_start)(void *)=0,
129 void (*input_stop)(void *)=0,
130 void * start_stop_arg=0
133 int init_words(void);
136 protected: // members
137 int block_type; //!< Type of this block.
138 bool m_has_known_type; //!< Block is of a documented type.
139 int discarded_bytes; //!< Amount of bytes discarded before beginning.
140 unsigned char * raw_data; //!< Raw block data in bytes.
141 int raw_size; //!< Size of the raw data.
142 unsigned short * word_data; //!< Data organized in machine words.
143 int word_size; //!< Size of the blocks in machine words.
144 int poolsize; //!< Amount of data malloc'ed
145 }; // class tape_block