From: hachti Date: Sun, 19 Nov 2006 10:08:23 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://gitweb.hachti.de/?a=commitdiff_plain;h=09cb0f4f1082875e0e87d169c0cd373a7d3f9d80;p=h316.git *** empty log message *** --- diff --git a/pc-tools/ldc2/src/data_block.cpp b/pc-tools/ldc2/src/data_block.cpp index f0c9153..41d52f8 100644 --- a/pc-tools/ldc2/src/data_block.cpp +++ b/pc-tools/ldc2/src/data_block.cpp @@ -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 data_block::get_description(){ + vector 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>(8*(1-posi%2)))&0x7f; return result; } + diff --git a/pc-tools/ldc2/src/data_block.hh b/pc-tools/ldc2/src/data_block.hh index f6047ff..383a643 100644 --- a/pc-tools/ldc2/src/data_block.hh +++ b/pc-tools/ldc2/src/data_block.hh @@ -1,26 +1,30 @@ -#ifndef DATA_BLOCK_HH -#define DATA_BLOCK_HH +#ifndef DATA_BLOCK_H +#define DATA_BLOCK_H +#include #include + #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 get_description(); +protected: + string extract_label(int); }; diff --git a/pc-tools/ldc2/src/data_block_0.cpp b/pc-tools/ldc2/src/data_block_0.cpp index dec8e9b..f43c016 100644 --- a/pc-tools/ldc2/src/data_block_0.cpp +++ b/pc-tools/ldc2/src/data_block_0.cpp @@ -1,7 +1,4 @@ -#include - #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 data_block_0::get_description(){ + vector 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; +} + + diff --git a/pc-tools/ldc2/src/data_block_0.hh b/pc-tools/ldc2/src/data_block_0.hh index a29f68e..997102b 100644 --- a/pc-tools/ldc2/src/data_block_0.hh +++ b/pc-tools/ldc2/src/data_block_0.hh @@ -1,7 +1,9 @@ #ifndef DATA_BLOCK_0_H #define DATA_BLOCK_0_H +#include #include + #include "data_block.hh" /*! @@ -10,11 +12,17 @@ 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 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 index 0000000..2e1d222 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_0.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_0.hh" + +#include + +/*! + *\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 data_block_0_0::get_description(){ + vector 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 index 0000000..2ffaf6e --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_0.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_0_H +#define DATA_BLOCK_0_0_H + +#include +#include + +#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 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 index 0000000..1b590bd --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_1.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_1.hh" + +#include + +/*! + *\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 data_block_0_1::get_description(){ + vector 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 index 0000000..df42d7f --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_1.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_1_H +#define DATA_BLOCK_0_1_H + +#include +#include + +#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 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 index 0000000..690fc12 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_10.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_10.hh" + +#include + +/*! + *\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 data_block_0_10::get_description(){ + vector 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 index 0000000..6e17767 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_10.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_10_H +#define DATA_BLOCK_0_10_H + +#include +#include + +#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 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 index 0000000..3dc139f --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_14.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_14.hh" + +#include + +/*! + *\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 data_block_0_14::get_description(){ + vector 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 index 0000000..d2de5c8 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_14.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_14_H +#define DATA_BLOCK_0_14_H + +#include +#include + +#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 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 index 0000000..f95f905 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_2.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_2.hh" + +#include + +/*! + *\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 data_block_0_2::get_description(){ + vector 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 index 0000000..d2912d9 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_2.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_2_H +#define DATA_BLOCK_0_2_H + +#include +#include + +#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 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 index 0000000..e164358 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_24.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_24.hh" + +#include + +/*! + *\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 data_block_0_24::get_description(){ + vector 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 index 0000000..441ca7e --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_24.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_24_H +#define DATA_BLOCK_0_24_H + +#include +#include + +#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 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 index 0000000..fc751e4 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_3.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_3.hh" + +#include + +/*! + *\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 data_block_0_3::get_description(){ + vector 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 index 0000000..70bf265 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_3.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_3_H +#define DATA_BLOCK_0_3_H + +#include +#include + +#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 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 index 0000000..2df9232 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_30.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_30.hh" + +#include + +/*! + *\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 data_block_0_30::get_description(){ + vector 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 index 0000000..5faa439 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_30.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_30_H +#define DATA_BLOCK_0_30_H + +#include +#include + +#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 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 index 0000000..962a0ad --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_4.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_4.hh" + +#include + +/*! + *\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 data_block_0_4::get_description(){ + vector 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 index 0000000..2ce7860 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_4.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_4_H +#define DATA_BLOCK_0_4_H + +#include +#include + +#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 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 index 0000000..e07f342 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_44.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_44.hh" + +#include + +/*! + *\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 data_block_0_44::get_description(){ + vector 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 index 0000000..64ac98b --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_44.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_44_H +#define DATA_BLOCK_0_44_H + +#include +#include + +#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 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 index 0000000..753fe03 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_50.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_50.hh" + +#include + +/*! + *\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 data_block_0_50::get_description(){ + vector 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 index 0000000..c8e8def --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_50.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_50_H +#define DATA_BLOCK_0_50_H + +#include +#include + +#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 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 index 0000000..33a4b64 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_54.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_54.hh" + +#include + +/*! + *\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 data_block_0_54::get_description(){ + vector 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 index 0000000..0930204 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_54.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_54_H +#define DATA_BLOCK_0_54_H + +#include +#include + +#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 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 index 0000000..b342cb5 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_60.cpp @@ -0,0 +1,21 @@ +#include "data_block_0_60.hh" + +#include + +/*! + *\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 data_block_0_60::get_description(){ + vector 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 index 0000000..da8c8d4 --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_60.hh @@ -0,0 +1,26 @@ +#ifndef DATA_BLOCK_0_60_H +#define DATA_BLOCK_0_60_H + +#include +#include + +#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 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 index 0000000..d52289d --- /dev/null +++ b/pc-tools/ldc2/src/data_block_0_label_extractor.cpp @@ -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 data_block_0_label_extractor::get_labels(){ + int l_count=word_size/3-1; + vector result; + for (int l_no=0; l_no +#include + +#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 get_labels(); + +}; + +#endif diff --git a/pc-tools/ldc2/src/discard_block.cpp b/pc-tools/ldc2/src/discard_block.cpp index e69de29..ee50ec4 100644 --- a/pc-tools/ldc2/src/discard_block.cpp +++ b/pc-tools/ldc2/src/discard_block.cpp @@ -0,0 +1,68 @@ +#include +#include + +#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 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 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(){} diff --git a/pc-tools/ldc2/src/discard_block.hh b/pc-tools/ldc2/src/discard_block.hh index e69de29..af9ad66 100644 --- a/pc-tools/ldc2/src/discard_block.hh +++ b/pc-tools/ldc2/src/discard_block.hh @@ -0,0 +1,38 @@ +#ifndef DISCARD_BLOCK_H +#define DISCARD_BLOCK_H + +#include +#include + +#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 get_description(); + +discard_block(tape_block &); +private: // methods + + discard_block(); + +}; // class discard_block + + +#endif diff --git a/pc-tools/ldc2/src/eot_block.cpp b/pc-tools/ldc2/src/eot_block.cpp index e69de29..756515e 100644 --- a/pc-tools/ldc2/src/eot_block.cpp +++ b/pc-tools/ldc2/src/eot_block.cpp @@ -0,0 +1,41 @@ +#include +#include + +#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 eot_block:: get_description(){ + vector 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(){} diff --git a/pc-tools/ldc2/src/eot_block.hh b/pc-tools/ldc2/src/eot_block.hh index 700e3a8..8aa5a6d 100644 --- a/pc-tools/ldc2/src/eot_block.hh +++ b/pc-tools/ldc2/src/eot_block.hh @@ -1,25 +1,29 @@ - #ifndef EOT_BLOCK_H #define EOT_BLOCK_H #include +#include + +#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 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 diff --git a/pc-tools/ldc2/src/tape_block.cpp b/pc-tools/ldc2/src/tape_block.cpp index 30f9819..0d011eb 100644 --- a/pc-tools/ldc2/src/tape_block.cpp +++ b/pc-tools/ldc2/src/tape_block.cpp @@ -1,14 +1,27 @@ #include #include #include - -#include -#include +#include #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 tape_block:: get_description(){ - char buffer[100]; - sprintf(buffer," (%0o-%02o) Untyped tape block", - get_type(),get_subtype()); vector 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); +} /***************************************************************/ /*! diff --git a/pc-tools/ldc2/src/tape_block.hh b/pc-tools/ldc2/src/tape_block.hh index f023ead..d2ca3df 100644 --- a/pc-tools/ldc2/src/tape_block.hh +++ b/pc-tools/ldc2/src/tape_block.hh @@ -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,