*** empty log message ***
authorhachti <hachti>
Sun, 19 Nov 2006 10:08:23 +0000 (10:08 +0000)
committerhachti <hachti>
Sun, 19 Nov 2006 10:08:23 +0000 (10:08 +0000)
38 files changed:
pc-tools/ldc2/src/data_block.cpp
pc-tools/ldc2/src/data_block.hh
pc-tools/ldc2/src/data_block_0.cpp
pc-tools/ldc2/src/data_block_0.hh
pc-tools/ldc2/src/data_block_0_0.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_0.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_1.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_1.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_10.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_10.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_14.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_14.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_2.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_2.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_24.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_24.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_3.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_3.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_30.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_30.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_4.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_4.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_44.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_44.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_50.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_50.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_54.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_54.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_60.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_60.hh [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_label_extractor.cpp [new file with mode: 0644]
pc-tools/ldc2/src/data_block_0_label_extractor.hh [new file with mode: 0644]
pc-tools/ldc2/src/discard_block.cpp
pc-tools/ldc2/src/discard_block.hh
pc-tools/ldc2/src/eot_block.cpp
pc-tools/ldc2/src/eot_block.hh
pc-tools/ldc2/src/tape_block.cpp
pc-tools/ldc2/src/tape_block.hh

index f0c91538c0480daabbb430b16aa3fea01dc4b58e..41d52f8f2a22bb7a83462810b21207692d733b63 100644 (file)
@@ -8,14 +8,17 @@
 
 using namespace std;
 
-data_block::data_block(tape_block& idol)
-  :tape_block(idol)
-{
-}
-
-data_block::~data_block(){
-}
+/*!
+ *\brief Specialisation constructor.
+ */
+data_block::data_block(tape_block& org)
+  :tape_block(org)
+{}
 
+/*!
+ *\brief Determine block type.
+ *\return the block type extracted from the block's data.
+ */
 int data_block::get_type(){
   if ((init_state==TBS_OK)&&word_data)
     return (word_data[0]&0xf000)>>12;
@@ -23,39 +26,47 @@ int data_block::get_type(){
  return block_type;
 }
 
-int data_block::get_subtype(){
-  if (get_type()==0)
-    return (new data_block_0(*this))->get_subtype();
-  else return 0;
-}
-
 /*!
  *\brief Get the block's size in 16 bit words.
- *\return The block's 16-bit data buffer's size including header and checksum.
+ *\return The block's 16-bit data buffer's size including
+ *         header and checksum.
  */
 int data_block::get_word_size(){
   return word_size;
 }
 
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block::get_description(){
+  vector<string> result;
+  string r_string="*****      "+get_typestring()+"Untyped data block, this \
+ is an illegal condition!";
+  result.insert(result.end(),r_string);
+  return result;
+}
+
 /*!
  *\brief Extract 6 byte symbol name from word memory.
  *
- *\param  startbyte the first byte of the desired symbol name
+ *\param  firstbyte the first byte of the desired symbol name
  *\return a string containing the symbol name. 
  *        Trailing spaces are included.
  *\note The word_data is handled system-intependently big endian!
  */
-string data_block::extract_string(int startbyte){
+string data_block::extract_label(int firstbyte){
   string result="";  // Start with empty string
   
   // We don't accept negative arguments!
-  if (startbyte<0) return result; 
+  if (firstbyte<0) return result; 
   
   // We also don't want segmentation faults!
-  if (word_size<(startbyte/2+1)) return result; 
+  if (word_size<(firstbyte/2+1)) return result; 
  
   // Here we pick out the characters.
-  for (int posi=startbyte;posi<startbyte+6;posi++)
+  for (int posi=firstbyte;posi<firstbyte+6;posi++)
     result+=(word_data[posi/2]>>(8*(1-posi%2)))&0x7f;
   return result;
 }
+
index f6047ffdfeca02a0806c4561035ad39649fbcdcc..383a64369c612abdc8008e3068d2f99de2e9318c 100644 (file)
@@ -1,26 +1,30 @@
-#ifndef DATA_BLOCK_HH
-#define DATA_BLOCK_HH
+#ifndef DATA_BLOCK_H
+#define DATA_BLOCK_H
 
+#include<vector>
 #include<string>
+
 #include "tape_block.hh"
 
 using namespace std;
 
+/*!
+ * Class representating a data tape block.
+ */
 class data_block
   : public tape_block
 {
-private: 
-  data_block();
-  
-public:
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+private:
   data_block(tape_block&);
-  ~data_block();
-  
-  virtual int get_type();
-  virtual int get_subtype();
+
+public:  
+  int get_type();
   int get_word_size();
-  //protected:
-  string extract_string(int startbyte);
+  virtual vector<string> get_description();
+protected:
+  string extract_label(int);
 };
 
 
index dec8e9b3e0be665f774e229255801a4b25fe3685..f43c016151bea4e18f5d5585c6cab17f468bc01d 100644 (file)
@@ -1,7 +1,4 @@
-#include <string>
-
 #include "data_block_0.hh"
-#include "data_block.hh"
 
 /*!
  *\brief Parent class copy constructor.
@@ -10,14 +7,27 @@ data_block_0::data_block_0(data_block & org)
   :data_block(org)
 {}
 
-
 /*!
- *\brief Default destructor.
- */
-data_block_0::~data_block_0(){}
-
+ * Determine the block's subtype.
+ *\return The block's subtype, read from block data.
+ */ 
 int data_block_0::get_subtype(){
   return (word_data[0]&0x0fc0)>>6;
 }
 
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0::get_description(){
+  vector<string> result;
+  char buffer[150];
+  sprintf(buffer,"           (0-%02o)    Type 0 data block, unknown\
+ subtype, this is an illegal condition!",get_subtype());
+  string r_string=buffer;
+  result.insert(result.end(),r_string);
+  return result;
+}
+
+
 
index a29f68effb17d0c214209d79339a1e5848663e5f..997102b97bb96e825f0e8ee9afcba0acb81997d3 100644 (file)
@@ -1,7 +1,9 @@
 #ifndef DATA_BLOCK_0_H
 #define DATA_BLOCK_0_H
 
+#include <vector>
 #include <string>
+
 #include "data_block.hh"
 
 /*!
 class data_block_0
   : public data_block
 {
- public:
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+private:
   data_block_0(data_block&);
-  virtual ~data_block_0();
+
+public:  
   int get_subtype();
-protected:
+  vector<string> get_description();
+
 };
 
 #endif
+
+
diff --git a/pc-tools/ldc2/src/data_block_0_0.cpp b/pc-tools/ldc2/src/data_block_0_0.cpp
new file mode 100644 (file)
index 0000000..2e1d222
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_0.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_0::data_block_0_0(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_0::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_0.hh b/pc-tools/ldc2/src/data_block_0_0.hh
new file mode 100644 (file)
index 0000000..2ffaf6e
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_0_H
+#define DATA_BLOCK_0_0_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_0
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_0(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_1.cpp b/pc-tools/ldc2/src/data_block_0_1.cpp
new file mode 100644 (file)
index 0000000..1b590bd
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_1.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_1::data_block_0_1(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_1::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_1.hh b/pc-tools/ldc2/src/data_block_0_1.hh
new file mode 100644 (file)
index 0000000..df42d7f
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_1_H
+#define DATA_BLOCK_0_1_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_1
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_1(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_10.cpp b/pc-tools/ldc2/src/data_block_0_10.cpp
new file mode 100644 (file)
index 0000000..690fc12
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_10.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_10::data_block_0_10(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_10::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_10.hh b/pc-tools/ldc2/src/data_block_0_10.hh
new file mode 100644 (file)
index 0000000..6e17767
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_10_H
+#define DATA_BLOCK_0_10_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_10
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_10(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_14.cpp b/pc-tools/ldc2/src/data_block_0_14.cpp
new file mode 100644 (file)
index 0000000..3dc139f
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_14.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_14::data_block_0_14(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_14::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_14.hh b/pc-tools/ldc2/src/data_block_0_14.hh
new file mode 100644 (file)
index 0000000..d2de5c8
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_14_H
+#define DATA_BLOCK_0_14_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_14
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_14(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_2.cpp b/pc-tools/ldc2/src/data_block_0_2.cpp
new file mode 100644 (file)
index 0000000..f95f905
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_2.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_2::data_block_0_2(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_2::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_2.hh b/pc-tools/ldc2/src/data_block_0_2.hh
new file mode 100644 (file)
index 0000000..d2912d9
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_2_H
+#define DATA_BLOCK_0_2_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_2
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_2(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_24.cpp b/pc-tools/ldc2/src/data_block_0_24.cpp
new file mode 100644 (file)
index 0000000..e164358
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_24.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_24::data_block_0_24(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_24::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_24.hh b/pc-tools/ldc2/src/data_block_0_24.hh
new file mode 100644 (file)
index 0000000..441ca7e
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_24_H
+#define DATA_BLOCK_0_24_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_24
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_24(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_3.cpp b/pc-tools/ldc2/src/data_block_0_3.cpp
new file mode 100644 (file)
index 0000000..fc751e4
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_3.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_3::data_block_0_3(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_3::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_3.hh b/pc-tools/ldc2/src/data_block_0_3.hh
new file mode 100644 (file)
index 0000000..70bf265
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_3_H
+#define DATA_BLOCK_0_3_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_3
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_3(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_30.cpp b/pc-tools/ldc2/src/data_block_0_30.cpp
new file mode 100644 (file)
index 0000000..2df9232
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_30.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_30::data_block_0_30(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_30::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_30.hh b/pc-tools/ldc2/src/data_block_0_30.hh
new file mode 100644 (file)
index 0000000..5faa439
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_30_H
+#define DATA_BLOCK_0_30_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_30
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_30(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_4.cpp b/pc-tools/ldc2/src/data_block_0_4.cpp
new file mode 100644 (file)
index 0000000..962a0ad
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_4.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_4::data_block_0_4(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_4::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_4.hh b/pc-tools/ldc2/src/data_block_0_4.hh
new file mode 100644 (file)
index 0000000..2ce7860
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_4_H
+#define DATA_BLOCK_0_4_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_4
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_4(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_44.cpp b/pc-tools/ldc2/src/data_block_0_44.cpp
new file mode 100644 (file)
index 0000000..e07f342
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_44.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_44::data_block_0_44(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_44::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_44.hh b/pc-tools/ldc2/src/data_block_0_44.hh
new file mode 100644 (file)
index 0000000..64ac98b
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_44_H
+#define DATA_BLOCK_0_44_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_44
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_44(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_50.cpp b/pc-tools/ldc2/src/data_block_0_50.cpp
new file mode 100644 (file)
index 0000000..753fe03
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_50.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_50::data_block_0_50(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_50::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_50.hh b/pc-tools/ldc2/src/data_block_0_50.hh
new file mode 100644 (file)
index 0000000..c8e8def
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_50_H
+#define DATA_BLOCK_0_50_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_50
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_50(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_54.cpp b/pc-tools/ldc2/src/data_block_0_54.cpp
new file mode 100644 (file)
index 0000000..33a4b64
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_54.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_54::data_block_0_54(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_54::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_54.hh b/pc-tools/ldc2/src/data_block_0_54.hh
new file mode 100644 (file)
index 0000000..0930204
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_54_H
+#define DATA_BLOCK_0_54_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_54
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_54(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_60.cpp b/pc-tools/ldc2/src/data_block_0_60.cpp
new file mode 100644 (file)
index 0000000..b342cb5
--- /dev/null
@@ -0,0 +1,21 @@
+#include "data_block_0_60.hh"
+
+#include <stdio.h>
+
+/*!
+ *\brief Parent class copy constructor.
+ */
+data_block_0_60::data_block_0_60(data_block_0 & org)
+  :data_block_0(org)
+{}
+
+/*!
+ *\brief Describe the block.
+ *\return A vector of text lines describing this block.
+ */
+vector<string> data_block_0_60::get_description(){
+  vector<string> result;
+  result.insert(result.end(),"Fixme!     "+get_typestring()+"Default 0-* block");
+  return result;
+}
+
diff --git a/pc-tools/ldc2/src/data_block_0_60.hh b/pc-tools/ldc2/src/data_block_0_60.hh
new file mode 100644 (file)
index 0000000..da8c8d4
--- /dev/null
@@ -0,0 +1,26 @@
+#ifndef DATA_BLOCK_0_60_H
+#define DATA_BLOCK_0_60_H
+
+#include <vector>
+#include <string>
+
+#include "data_block_0.hh"
+
+/*!
+ *\brief Class for block type (0-0).
+ */
+class data_block_0_60
+  : public data_block_0
+{
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public:
+  vector<string> get_description();
+
+protected:
+  data_block_0_60(data_block_0&);
+  
+
+};
+
+#endif
diff --git a/pc-tools/ldc2/src/data_block_0_label_extractor.cpp b/pc-tools/ldc2/src/data_block_0_label_extractor.cpp
new file mode 100644 (file)
index 0000000..d52289d
--- /dev/null
@@ -0,0 +1,17 @@
+#include "data_block_0_label_extractor.hh"
+
+/*!
+ *\brief Default constructor.
+ */
+
+/*!
+ *\brief Extract labels from data_block_0_* blocks
+ *\return A vector containing all labels present in the block
+ */
+vector<string> data_block_0_label_extractor::get_labels(){
+  int l_count=word_size/3-1;
+  vector<string> result;
+  for (int l_no=0; l_no<l_count;l_no++)
+    result.insert(result.end(),extract_label(4+6*l_no));
+  return result;
+}
diff --git a/pc-tools/ldc2/src/data_block_0_label_extractor.hh b/pc-tools/ldc2/src/data_block_0_label_extractor.hh
new file mode 100644 (file)
index 0000000..f7c8a98
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef DATA_BLOCK_0_LABEL_EXTRACTOR_H
+#define DATA_BLOCK_0_LABEL_EXTRACTOR_H
+
+#include <vector>
+#include <string>
+
+#include "data_block.hh"
+
+/*!
+ *\brief Abstract class providing label extraction for some data_block_0 subtypes.
+ * This class cannot be instantiated.\n
+ */
+class data_block_0_label_extractor
+  : public virtual data_block
+{
+
+private:
+  data_block_0_label_extractor();
+
+protected:  
+  vector<string> get_labels();
+
+};
+
+#endif
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..ee50ec49bb3c7341a87984c85406d2ac236c77a4 100644 (file)
@@ -0,0 +1,68 @@
+#include <string>
+#include <vector>
+
+#include "discard_block.hh"
+#include "tape_block.hh"
+
+using namespace std;
+
+/***************************************************************/
+/*!
+ *\brief Copy constructor.
+ */
+discard_block::discard_block(discard_block & org){
+  operator=(org);
+}
+
+/***************************************************************/
+/*!
+ *\brief Get a cleartext description of the block.
+ *\return ldc style descriptive line for the block
+ */
+vector<string> discard_block::get_description(){
+  string r_string;
+  switch(init_state){
+  case TBS_OK:
+    r_string="*****      (X-XX)   Discard block, init_status OK,\
+ this is an illegal condition!";
+    break;
+  case TBS_EOF_LEGAL:
+    r_string="           (EOF)     Legal EOF";
+    break;
+  case TBS_EOF_ILLEGAL:
+    r_string="           (EOF)     Illegal EOF while in block!";
+    break;
+  case TBS_CHECKSUM:
+    r_string="           (CHK)     Checksum error in Block!";
+    break;
+  case TBS_IOERR:
+    r_string="           (IOE)     IO-Error during initialisation!";
+    break;
+  case TBS_DEFAULT:
+    r_string="*****      (X-XX)    Discard block, init_status not set,\
+ this is an illegal condition!";
+    break;
+  default:
+    r_string="*****      (X-XX)    Discard block, init_status unknown,\
+ this is an illegal condition!";
+    break;
+  }
+  vector<string> result;
+  result.insert(result.end(),r_string);
+  return result;
+}
+
+/***************************************************************/
+/*!
+ *\brief Specialisation constructor
+ */
+discard_block::discard_block(tape_block & org)
+  : tape_block(org)
+{
+}
+
+/***************************************************************/
+/*!
+ *\brief Default constructor.
+ */
+discard_block::discard_block(){}
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..af9ad66b70f1d2e0ba850c33e15ad7129006de5d 100644 (file)
@@ -0,0 +1,38 @@
+#ifndef DISCARD_BLOCK_H
+#define DISCARD_BLOCK_H
+
+#include <string>
+#include <vector>
+
+#include "tape_block.hh"
+
+using namespace std;
+
+/*!
+ *\brief Class representating an invalid block.
+ *
+ *Reasons for a block to be invalid are:\n
+ * - EOF on fd used to initialise,
+ * - Checksum error in a block
+ * - IO error while reading from fd
+ * The reason for the block to be a discard_block can be
+ * resolved by using get_state().
+ */
+class discard_block
+  :public tape_block
+{
+  friend tape_block* tape_block::gen_from_fd(int,void(*)(void*),
+                                            void(*)(void*),void*);
+public: // methods
+  discard_block(discard_block &);
+  virtual vector<string> get_description();
+
+discard_block(tape_block &);
+private:   // methods
+
+  discard_block();
+
+}; // class discard_block
+
+
+#endif
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..756515e5aeb435da4e08523670f0d5b3eb6354a9 100644 (file)
@@ -0,0 +1,41 @@
+#include <string>
+#include <vector>
+
+#include "eot_block.hh"
+#include "tape_block.hh"
+
+using namespace std;
+
+/***************************************************************/
+/*!
+ *\brief Copy constructor.
+ */
+eot_block::eot_block(eot_block & org){
+  operator=(org);
+}
+
+/***************************************************************/
+/*!
+ *\brief Get a cleartext description of the block.
+ *\return ldc style descriptive line for the block
+ */
+vector<string> eot_block:: get_description(){
+  vector<string> result;
+  string r_string="           (EOT)     End of Tape mark";
+  result.insert(result.end(),r_string);
+  return result;
+}
+
+/***************************************************************/
+/*!
+ *\brief Specialisation constructor
+ */
+eot_block::eot_block(tape_block & org)
+  : tape_block(org)
+{}
+
+/***************************************************************/
+/*!
+ *\brief Default constructor.
+ */
+eot_block::eot_block(){}
index 700e3a892926fa1309709e1645d33f14d972a08d..8aa5a6d1851365797017ad03e5d9f2150880a93f 100644 (file)
@@ -1,25 +1,29 @@
-
 #ifndef EOT_BLOCK_H
 #define EOT_BLOCK_H
 
 #include <string>
+#include <vector>
+
+#include "tape_block.hh"
+
 using namespace std;
 
-class eot_block
-  : public tape_block
+/*!
+ *\brief Class representating an End of Tape block.
+ */
+class eot_block : public tape_block
 {
-private: 
+  friend tape_block * tape_block::gen_from_fd(int,void(*)(void*),
+                                             void(*)(void*),void*);
+public: // methods
+  eot_block(eot_block &);
+  virtual vector<string> get_description();
+
+private:   // methods
+  eot_block(tape_block &);
   eot_block();
   
-public:
-  eot_block(tape_block&);
-  ~eot_block();
-  
-  virtual int get_type();
-  virtual int get_subtype();
-  int get_word_size();
-  
+}; // class eot_block
 
-};
 
 #endif
index 30f9819971a600528b7b68950a2ddcdd605c24d9..0d011ebb0392b59635a3becec22f5c71eb3776c6 100644 (file)
@@ -1,14 +1,27 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
-
-#include <string>
-#include <vector>
+#include <stdio.h>
 
 #include "tape_block.hh"
 #include "data_block.hh"
 #include "data_block_0.hh"
+#include "data_block_0_0.hh"
+#include "data_block_0_1.hh"
+#include "data_block_0_2.hh"
+#include "data_block_0_3.hh"
+#include "data_block_0_4.hh"
+#include "data_block_0_10.hh"
+#include "data_block_0_14.hh"
+#include "data_block_0_24.hh"
+#include "data_block_0_44.hh"
+#include "data_block_0_30.hh"
+#include "data_block_0_54.hh"
+#include "data_block_0_60.hh"
+#include "data_block_0_50.hh"
 
+#include "eot_block.hh"
+#include "discard_block.hh"
 #include "silent_code.hh"
 #include "hw_constants.hh"
 
@@ -101,11 +114,9 @@ int tape_block::get_subtype(){
  *\return ldc style descriptive line for the block
  */
 vector<string> tape_block:: get_description(){
-  char buffer[100];
-  sprintf(buffer,"           (%0o-%02o) Untyped tape block",
-         get_type(),get_subtype());
   vector<string> result;
-  result.insert(result.end(),buffer);
+  result.insert(result.end(),
+               "*****      "+get_typestring()+"Untyped tape block");
   return result;
 }
 
@@ -135,7 +146,7 @@ unsigned char * tape_block::get_raw_data(){
  *\brief Static factory method with file descriptor support.
  *
  * This method creates a tape_block by using the private
- * constructor with file descriptor support.\t
+ * constructor with file descriptor support.\n
  * It always returns a valid pointer, errors
  * or exceptional conditions during creation are marked in the
  * object's state.\n
@@ -147,30 +158,31 @@ unsigned char * tape_block::get_raw_data(){
  * This allows for easy use of the object using it's virtual
  * interface methods or a cast of the pointer to a sub type pointer 
  * according to the type information, and then using the subtype's
- * methods not already present in tape_block.\t
- * Objects of the  following subclasses are automagically generated:\t
+ * methods not already present in tape_block.\n
+ * Objects of the  following subclasses are automagically generated:\n
  * - eot_block
+ * - discard_block
  * - data_block
- *     -data_block_0
- *         -data_block_0_0
- *         -data_block_0_1
- *         -data_block_0_2
- *         -data_block_0_3
- *         -data_block_0_4
- *         -data_block_0_10
- *         -data_block_0_14
- *         -data_block_0_24
- *         -data_block_0_30
- *         -data_block_0_50
- *         -data_block_0_54
- *         -data_block_0_60
- *      -data_block_1
- *      -data_block_2
- *      -data_block_3
- *      -data_block_4
- *      -data_block_5
- *      -data_block_6
- *      -data_block_7
+ *   data_block_0
+ *     data_block_0_0
+ *     data_block_0_1
+ *     data_block_0_2
+ *     data_block_0_3
+ *     data_block_0_4
+ *     data_block_0_10
+ *     data_block_0_14
+ *     data_block_0_24
+ *     data_block_0_30
+ *     data_block_0_50
+ *     data_block_0_54
+ *     data_block_0_60
+ *   data_block_1
+ *   data_block_2
+ *   data_block_3
+ *   data_block_4
+ *   data_block_5
+ *   data_block_6
+ *   data_block_7
  *
  *\return Pointer to an object of type tape_block or a subclass.
  *\param fd A file descriptor where the read is taken from.
@@ -189,9 +201,11 @@ tape_block * tape_block::gen_from_fd(int  fd,
 {
   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;
-  
+  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
@@ -199,6 +213,16 @@ tape_block * tape_block::gen_from_fd(int  fd,
     delete res_block;
     res_block=d_block;
     break;
+  case tape_block::TBT_EOT:
+    e_block=new eot_block(*res_block);
+    delete res_block;
+    res_block=e_block;
+    break;
+  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;
   }
@@ -224,18 +248,19 @@ tape_block * tape_block::gen_from_fd(int  fd,
   res_block=d_block;
   
   if (res_block->get_type()==0) switch(d0_block->get_subtype()){
-//   case 000: d0_block=new data_block_0_00(d0_block); break;
-//   case 001: d0_block=new data_block_0_01(d0_block); break;
-//   case 002: d0_block=new data_block_0_02(d0_block); break;
-//   case 003: d0_block=new data_block_0_03(d0_block); break;
-//   case 004: d0_block=new data_block_0_04(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 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 060: d0_block=new data_block_0_50(d0_block); break;
+  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;
   default:
     return res_block;
   }
@@ -251,6 +276,20 @@ tape_block * tape_block::gen_from_fd(int  fd,
  */
 tape_block::tape_block(){}
 
+/***************************************************************/
+/*!
+ *\brief get a short type description string.
+ *\return A small string to be used in description methods.
+ *
+ * The string is always 19 characters long.\n
+ * An example is "(99-99)   ".
+ */
+string tape_block::get_typestring(){
+  char buffer[13];
+  sprintf(buffer,"(%o-%o)      ",get_type(),get_subtype());
+  buffer[10]=0;
+  return string(buffer);
+}
 
 /***************************************************************/
 /*!
index f023ead0d05aa1dd6cbb38f3043599be1c82803a..d2ca3df4c0e90a65bf62845e65bff59b9341c17b 100644 (file)
@@ -56,8 +56,11 @@ public: // methods
                                  void * start_stop_arg=0
                                  );
  
-private:   // methods
+protected:   // methods
   tape_block();
+  string get_typestring();
+
+private:   // methods
   tape_block (int  fd_p,
              void(*input_start)(void *)=0,
              void (*input_stop)(void *)=0,