+/*
+r
+$Id: main.cpp,v 1.4 2006/11/20 01:20:11 hachti Exp $
+$Log: main.cpp,v $
+Revision 1.4 2006/11/20 01:20:11 hachti
+*** empty log message ***
+Revision 1.3 2006-11-20 01:19:48 hachti
+Another revision
+
+*/
#include <stdio.h>
#include <unistd.h>
do{
if (myblock) delete myblock;
myblock=tape_block::gen_from_fd(0);
-
+
vector<string> desc=myblock->get_description();
for (vector<string>::iterator iter=desc.begin();
iter!=desc.end();iter++)
printf("%s\n",(*iter).c_str());
-
-
-// if ((myblock->get_type()==0)&&(myblock->get_subtype()==050)){
-// data_block * dp=(data_block *)myblock;
-// printf ("0-50 symbol name: %s\n",dp->extract_string(4).c_str());
-// printf ("0-50 symbol name: %s\n",dp->extract_string(11).c_str());
-// printf ("Block size:%i\n",dp->get_word_size());
-// }
} while (myblock->get_state()==tape_block::TBS_OK);
- printf("---");
- printf("State:%i\n",myblock->get_state());
- printf("raw size:%i\n",myblock->get_raw_size());
return 0;
}
#include "data_block_0_54.hh"
#include "data_block_0_60.hh"
#include "data_block_0_50.hh"
+#include "data_block_0_64.hh"
+#include "data_block_1.hh"
+#include "data_block_2.hh"
+#include "data_block_3.hh"
+#include "data_block_4.hh"
+#include "data_block_5.hh"
+#include "data_block_6.hh"
+#include "data_block_7.hh"
#include "eot_block.hh"
#include "discard_block.hh"
* - data_block_0_50
* - data_block_0_54
* - data_block_0_60
+ * - data_block_0_64
* - data_block_1
* - data_block_2
* - data_block_3
void (*input_stop)(void *),
void * start_stop_arg)
{
- tape_block * res_block;
- res_block=new tape_block(fd,input_start,input_stop,start_stop_arg);
- data_block * d_block;
- data_block_0 * d0_block;
- eot_block * e_block;
- discard_block * di_block;
-
- // Retype to data_block if possible
- switch(res_block->get_type()){
- case tape_block::TBT_DATA: // Make pointer a data block
- d_block=new data_block(*res_block);
- delete res_block;
- res_block=d_block;
+ tape_block * n_tape_block=0;
+ data_block * n_data_block=0;
+ data_block * n_data_block_x=0;
+ data_block_0 * n_data_block_0=0;
+ data_block_0 * n_data_block_0_x=0;
+ eot_block * n_eot_block=0;
+ discard_block * n_discard_block=0;
+
+ n_tape_block=new tape_block(fd,input_start,input_stop,start_stop_arg);
+
+ // Retype to data_block, eot_block, discard_block - if possible
+ switch(n_tape_block->get_type()){
+ case tape_block::TBT_DATA:
+ n_data_block = new data_block(*n_tape_block);
break;
case tape_block::TBT_EOT:
- e_block=new eot_block(*res_block);
- delete res_block;
- res_block=e_block;
- break;
+ n_eot_block=new eot_block(*n_tape_block);
+ delete n_tape_block;
+ return n_eot_block;
case tape_block::TBT_DISCARD:
- di_block=new discard_block(*res_block);
- delete res_block;
- res_block=di_block;
- break;
- default: // All other cases
- return res_block;
+ n_discard_block = new discard_block(*n_tape_block);
+ delete n_tape_block;
+ return n_discard_block;
+ default:
+ return n_tape_block;
}
-
- // Retype again, if it's a data_block now
-
- switch(res_block->get_type()){
- case 00:
- d0_block=new data_block_0(*d_block);
- d_block=d0_block;
- break;
-// case 01: d_block=new data_block_1(*d_block); break;
-// case 02: d_block=new data_block_2(*d_block); break;
-// case 03: d_block=new data_block_3(*d_block); break;
-// case 04: d_block=new data_block_4(*d_block); break;
-// case 05: d_block=new data_block_5(*d_block); break;
-// case 06: d_block=new data_block_6(*d_block); break;
-// case 07: d_block=new data_block_7(*d_block); break;
+ delete n_tape_block;
+
+ // Now only data blocks are left
+
+ switch(n_data_block->get_type()){
+ case 00: n_data_block_0=new data_block_0(*n_data_block); break;
+ case 01: n_data_block_x=new data_block_1(*n_data_block); break;
+ case 02: n_data_block_x=new data_block_2(*n_data_block); break;
+ case 03: n_data_block_x=new data_block_3(*n_data_block); break;
+ case 04: n_data_block_x=new data_block_4(*n_data_block); break;
+ case 05: n_data_block_x=new data_block_5(*n_data_block); break;
+ case 06: n_data_block_x=new data_block_6(*n_data_block); break;
+ case 07: n_data_block_x=new data_block_7(*n_data_block); break;
default:
- return res_block;
+ return n_data_block;
+ }
+ if (n_data_block_0==0){ // So we must have found another one
+ delete n_data_block;
+ return n_data_block_x;
}
- delete res_block;
- res_block=d_block;
- if (res_block->get_type()==0) switch(d0_block->get_subtype()){
- case 000: d0_block=new data_block_0_0(*d0_block); break;
- case 001: d0_block=new data_block_0_1(*d0_block); break;
- case 002: d0_block=new data_block_0_2(*d0_block); break;
- case 003: d0_block=new data_block_0_3(*d0_block); break;
- case 004: d0_block=new data_block_0_4(*d0_block); break;
- case 010: d0_block=new data_block_0_10(*d0_block); break;
- case 014: d0_block=new data_block_0_14(*d0_block); break;
- case 024: d0_block=new data_block_0_24(*d0_block); break;
- case 044: d0_block=new data_block_0_44(*d0_block); break;
- case 030: d0_block=new data_block_0_30(*d0_block); break;
- case 054: d0_block=new data_block_0_54(*d0_block); break;
- case 060: d0_block=new data_block_0_60(*d0_block); break;
- case 050: d0_block=new data_block_0_50(*d0_block); break;
+ // Here only type 0 left
+
+ switch(n_data_block_0->get_subtype()){
+ case 000: n_data_block_0_x=new data_block_0_0(*n_data_block_0); break;
+ case 001: n_data_block_0_x=new data_block_0_1(*n_data_block_0); break;
+ case 002: n_data_block_0_x=new data_block_0_2(*n_data_block_0); break;
+ case 003: n_data_block_0_x=new data_block_0_3(*n_data_block_0); break;
+ case 004: n_data_block_0_x=new data_block_0_4(*n_data_block_0); break;
+ case 010: n_data_block_0_x=new data_block_0_10(*n_data_block_0); break;
+ case 014: n_data_block_0_x=new data_block_0_14(*n_data_block_0); break;
+ case 024: n_data_block_0_x=new data_block_0_24(*n_data_block_0); break;
+ case 044: n_data_block_0_x=new data_block_0_44(*n_data_block_0); break;
+ case 030: n_data_block_0_x=new data_block_0_30(*n_data_block_0); break;
+ case 054: n_data_block_0_x=new data_block_0_54(*n_data_block_0); break;
+ case 060: n_data_block_0_x=new data_block_0_60(*n_data_block_0); break;
+ case 064: n_data_block_0_x=new data_block_0_64(*n_data_block_0); break;
+ case 050: n_data_block_0_x=new data_block_0_50(*n_data_block_0); break;
default:
- return res_block;
+ return n_data_block_0;
}
- delete res_block;
- res_block=d0_block;
-
- return res_block;
+ delete n_data_block_0;
+ return n_data_block_0_x;
}
/***************************************************************/