4 #include "data_block.hh"
5 #include "data_block_0.hh"
11 data_block::data_block(tape_block
& idol
)
16 data_block::~data_block(){
19 int data_block::get_type(){
20 if ((init_state
==TBS_OK
)&&word_data
)
21 return (word_data
[0]&0xf000)>>12;
26 int data_block::get_subtype(){
28 return (new data_block_0(*this))->get_subtype();
33 *\brief Get the block's size in 16 bit words.
34 *\return The block's 16-bit data buffer's size including header and checksum.
36 int data_block::get_word_size(){
41 *\brief Extract 6 byte symbol name from word memory.
43 *\param startbyte the first byte of the desired symbol name
44 *\return a string containing the symbol name.
45 * Trailing spaces are included.
46 *\note The word_data is handled system-intependently big endian!
48 string
data_block::extract_string(int startbyte
){
49 string result
=""; // Start with empty string
51 // We don't accept negative arguments!
52 if (startbyte
<0) return result
;
54 // We also don't want segmentation faults!
55 if (word_size
<(startbyte
/2+1)) return result
;
57 // Here we pick out the characters.
58 for (int posi
=startbyte
;posi
<startbyte
+6;posi
++)
59 result
+=(word_data
[posi
/2]>>(8*(1-posi
%2)))&0x7f;