1 /******************************************************************************
5 * $Date: 2007/03/26 01:00:40 $
8 * $Log: tape_block.hh,v $
9 * Revision 2.0 2007/03/26 01:00:40 hachti
10 * *** empty log message ***
13 ******************************************************************************/
21 *\brief Tape data block base class.
23 * This class represents a Honeywell paper tape block.
24 * That may be some kind of data block or a end of tape mark.
34 TBT_DATA=0x10, //!< Data block
35 TBT_EOT, //!< End of tape block
36 TBT_BROKEN, //!< A broken block
40 *\brief Local base class for exceptions.
47 tape_block * get_block();
49 tape_block * m_broken_block;
53 *\brief Checksum error exception.
55 class checksum_error_exception
58 checksum_error_exception(tape_block * block);
62 *\brief EOF while reading block exception.
64 class eof_illegal_exception
67 eof_illegal_exception(tape_block * block);
71 *\brief EOF after reading block exception.
73 class eof_legal_exception
76 eof_legal_exception(int bytes_consumed);
80 tape_block * get_block();
84 *\brief IO error exception.
86 class io_error_exception
91 tape_block * get_block();
95 virtual ~tape_block();
97 tape_block(tape_block &);
98 void operator=(tape_block &);
100 virtual int get_type();
101 virtual int get_subtype();
102 virtual vector<string> get_description();
104 int get_discarded_bytes();
105 unsigned char * get_raw_data();
106 virtual int dump_to_fd(int fd);
107 virtual bool is_endblock();
108 virtual vector<string> get_exported_symbols();
109 virtual vector<string> get_called_symbols();
110 virtual bool has_known_type();
112 static tape_block * gen_from_fd(int fd,
113 void(*input_start)(void *)=0,
114 void (*input_stop)(void *)=0,
115 void * start_stop_arg=0
118 protected: // methods
120 string get_typestring();
123 tape_block (int fd_p,
124 void(*input_start)(void *)=0,
125 void (*input_stop)(void *)=0,
126 void * start_stop_arg=0
129 int init_words(void);
132 protected: // members
133 int block_type; //!< Type of this block.
134 bool m_has_known_type; //!< Block is of a documented type.
135 int discarded_bytes; //!< Amount of bytes discarded before beginning.
136 unsigned char * raw_data; //!< Raw block data in bytes.
137 int raw_size; //!< Size of the raw data.
138 unsigned short * word_data; //!< Data organized in machine words.
139 int word_size; //!< Size of the blocks in machine words.
140 int poolsize; //!< Amount of data malloc'ed
141 }; // class tape_block