From: hachti Date: Mon, 26 Mar 2007 00:44:16 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://gitweb.hachti.de/?p=h316.git;a=commitdiff_plain;h=de6b6757167b76f4c363177d66f3ac4502811b42 *** empty log message *** --- diff --git a/pc-tools/ldc2/data/test1.asm b/pc-tools/ldc2/data/test1.asm index 436472a..76351a7 100644 --- a/pc-tools/ldc2/data/test1.asm +++ b/pc-tools/ldc2/data/test1.asm @@ -1,11 +1,13 @@ SUBR SONNE,SUN SUBR BLUME,BLU + SUBR ABCDEF,AFFE REL ORG '1000 ICA ICA BLU LDA 0 SUN LDA 1 +AFFE CRA END \ No newline at end of file diff --git a/pc-tools/ldc2/data/test1.obj b/pc-tools/ldc2/data/test1.obj index b0275b5..b3e6142 100644 Binary files a/pc-tools/ldc2/data/test1.obj and b/pc-tools/ldc2/data/test1.obj differ diff --git a/pc-tools/ldc2/doc/req_spec.tex b/pc-tools/ldc2/doc/req_spec.tex index fb2cf5c..e81c23d 100644 --- a/pc-tools/ldc2/doc/req_spec.tex +++ b/pc-tools/ldc2/doc/req_spec.tex @@ -5,7 +5,7 @@ \item The program shall run on any computer running GNU/Linux. \item It has no graphical user interface but a help option and command line error reporting. \item The program shall support and check all block types according to \cite{ser16:progref:bformats}. -\item The Program must be able to list a tape image's contents. +\item The program must be able to list a tape image's contents. \item The program shall be capable of splitting tape images into single object files. \item The program's structure must be modular and easily extendable. \end{itemize} @@ -14,7 +14,7 @@ \begin{itemize} \item Possibility to split a tape image into single data block files. \item Software handshake paper tape reader control:\\ -A paper paper tape reader connected to the computer's serial port could be motion-controlled +A paper tape reader connected to the computer's serial port could be motion-controlled by use of XON and XOFF characters. This is useful when error breaks for tape inspection are enabled and the paper tape device does not support RTS/CTS hardware handshake. \item Full POSIX.1, 2004 edition, compliance.\\ @@ -78,12 +78,6 @@ found in \cite{ser16:progref:bformats}. an end of tape mark is an appropriate end block. } -\rd{chk005}{Interactive checksum error handling}{ - The program shall be configurable to pause block processing on - detection of a checksum error (\req{chk002}) and resume processing after - user intervention.\\ - This feature is incompatible with data input from standard input. -} %******************************************************************************* \subsection{Additional features} @@ -101,6 +95,24 @@ found in \cite{ser16:progref:bformats}. of all blocks contained in the input data.\\ The output line format shall be unified for all block types. } +\vspace{0.5em} +\par +Here is an example output for the object \verb|O$PB|: \begin{verbatim} +O$PB (0-0) Subprogram Name +O$PS (0-0) " " +O$PLDR (0-0) " " + (0-24) Switch to relocatable mode + (0-4) Data + (0-4) Data +O$PB (0-50) Subprogram Entry Point Definition + (0-4) Data + (0-4) Data + (0-4) Data +O$PLDR (0-50) Subprogram Entry Point Definition + (0-4) Data + (0-4) Data + (0-14) End +\end{verbatim} \rd{da002}{List exported symbols}{ Output a list of all exported symbols. @@ -148,6 +160,10 @@ found in \cite{ser16:progref:bformats}. a zero-padded three digit number and EOT blocks are not suppressed. } +\rd{dp003}{Split into numbered blocks}{ + The whole tape is split into one named and numbered file for each block. +} + %******************************************************************************* \newpage @@ -165,11 +181,15 @@ found in \cite{ser16:progref:bformats}. } \rd{err001}{Error types}{ + The program shall react to several error conditions. Some error + conditions can be turned into warnings by program configuration, + see \req{cfg003} and \req{cfg004} for details.\\ The following distinguished error types shall exist: \begin{itemize} \item Input/output error:\\ - Error occuring during reading from the input file descriptor - or during writing to an output file.\\ + Error occuring during read from the input file descriptor + or during write to an output file.\\ + No recovery from this error is possible. \enosup \item Block integrity error:\\ Caused by failed check according to \req{chk001}.\\ @@ -196,7 +216,11 @@ found in \cite{ser16:progref:bformats}. } \rd{err002}{Program exit codes}{ - \begin{table}[H] + The application shall return several different exir codes to the + execution environment (i.e. the shell). On occurrence of any error, + the program shall terminate with the appropriate exit code.\\ + Program runs with warnings shall return a special exit code. + \begin{table}[H] \begin{center} \begin{tabular}{|r|c|} \hline @@ -210,6 +234,7 @@ found in \cite{ser16:progref:bformats}. Unknown block type error & 5\\ Object integrity error & 6\\ Usage error & 7\\ + Success with warnings & 99 \\ Internal program error & 100 \\ \hline \end{tabular} @@ -219,6 +244,8 @@ found in \cite{ser16:progref:bformats}. } \rd{err003}{Error and warning messages}{ + Every warning or error case shall cause an appropriate error respective + warning message.\\ Error messages shall consinst of ''Error:'' and the error reason.\\ Warning messages shall consist of ''Warning:'' and a descriptive text.\\ @@ -316,12 +343,14 @@ found in \cite{ser16:progref:bformats}. (\req{dp001}).\\ split\_objects\_numbered & S & Split into numbered object files (\req{dp002}).\\ + split\_blocks & B & Split tape into named and numbered block + files (\req{dp003}).\\ ignore\_block\_errors & b & Ignore block integrity errors (\req{err001},\req{chk001}).\\ ignore\_checksum\_errors & k & Ignore Checksum errors (\req{err001}\req{chk002}).\\ - pause\_on\_checksum\_error & p & Wait for user input on checksum error - (\req{chk005}).\\ +% pause\_on\_checksum\_error & p & Wait for user input on checksum error +% (\req{chk005}).\\ ignore\_unknown\_block\_errors & n & Ignore errors causes by datablocks of unknown type (\req{err001}\req{chk003}).\\ @@ -355,6 +384,9 @@ found in \cite{ser16:progref:bformats}. \rd{cfg005}{Configuration file syntax}{ The configuration file must comply two the following grammar, given in EBNF: } + +% | "pause_on_checksum_error" + \begin{verbatim} ConfigurationFile = { ConfigurationLine "" } ; ConfigurationLine = SwitchLine | StringLine | CommentLine ; @@ -363,9 +395,9 @@ ConfigurationLine = SwitchLine | StringLine | CommentLine ; CommentLine = WSpace [ "#" String ] ; WSpace = { " " } ; SwLong = "output_info" | "ouput_called" | "output_exported" - | "output_unsatisfied" | "split_objects" [ _"numbered" ] + | "output_unsatisfied" | "split_objects" [ "_numbered" ] + | "split_blocks" | "ignore_block_errors" | "ignore_checksum_errors - | "pause_on_checksum_error" | "ignore_unknown_block_errors" | "ignore_object_integrity" | "quiet" ; @@ -373,7 +405,7 @@ ConfigurationLine = SwitchLine | StringLine | CommentLine ; BoolValue = TrueStr | FalseStr ; String = { ? Every character except newline ?} ; TrueStr = "yes" | "1" | "true" ; - FalseStr = | "no" | "0" | "false" ; + FalseStr = "no" | "0" | "false" ; \end{verbatim} \rd{cfg006}{Command Line syntax}{ @@ -392,27 +424,31 @@ ShortSwitch = "-" SwShort ; LongSwitch = "--" SwLong [ "=" BoolValue ] ; ShortParam = "-" StrShort String ; LongParam = "--" StrLong "=" String ; - SwShort = "h" | "a" | "c" | "e" | "u" | "s" | "S" + SwShort = "h" | "a" | "c" | "e" | "u" | "s" | "S" | "B" | "b" | "k" | "p" | "n" | "g" | "q"; SwLong = "help" | "output_info" | "ouput_called" | "output_exported" - | "output_unsatisfied" | "split_objects" [ _"numbered" ] + | "output_unsatisfied" | "split_objects" [ "_numbered" ] | "ignore_block_errors" | "ignore_checksum_errors" - | "pause_on_checksum_error" | "ignore_unknown_block_errors" | "ignore_object_integrity" | "quiet" ; StrShort = "o" ; StrLong = "out_file" ; \end{verbatim} + Some command line examples:\\ + \verb|ldc2 -ve --output-file=out.dat in.dat|\\ + \verb|ldc2 -kb test.obj|\\ + +% | "pause_on_checksum_error" \newpage \rd{cfg007}{Configuration implications}{ \begin{itemize} - \item \emph{pause\_on\_checksum\_errors} implies \emph{ignore\_checksum\_errors}. - \item \emph{pause\_on\_checksum\_errors} is completely ignored when input - is read from standard input. - \item \emph{output\_*} and \emph{split\_*} inhibit +% \item \emph{pause\_on\_checksum\_error} implies \emph{ignore\_checksum\_errors}. +% \item \emph{pause\_on\_checksum\_error} is completely ignored when input +% is read from standard input. + \item \emph{output\_*} inhibit tape information output (\req{da001}). \item \emph{help} inhibits all other actions. \end{itemize} diff --git a/pc-tools/ldc2/src/config.cpp b/pc-tools/ldc2/src/config.cpp index 1a10ac7..5cb7043 100644 --- a/pc-tools/ldc2/src/config.cpp +++ b/pc-tools/ldc2/src/config.cpp @@ -28,9 +28,10 @@ int cfg_output_exported=0; int cfg_output_unsatisfied=0; int cfg_split_objects=0; int cfg_split_objects_numbered=0; +int cfg_split_blocks=0; int cfg_ignore_block_errors=0; int cfg_ignore_checksum_errors=0; -int cfg_pause_on_checksum_error=0; +//int cfg_pause_on_checksum_error=0; int cfg_ignore_unknown_block_errors=0; int cfg_ignore_object_integrity_errors=0; int cfg_list_contents=1; @@ -40,7 +41,7 @@ int cfg_quiet=0; int cfg_version=0; int in_fd=0; //! File descriptor for data input -int out_fd=2; //! File descriptor for text output +int out_fd=1; //! File descriptor for text output void do_config(int argc, char ** args){ @@ -68,14 +69,18 @@ void do_config(int argc, char ** args){ "List all unsatisfied symbols.", &cfg_output_unsatisfied,true,true); - ar.add_option_switch("S","split_objects_numbered", - "Split input data into distinct numbered files", - &cfg_split_objects_numbered,true,true); - ar.add_option_switch("s","split_objects", "Split input data into distinct object files.", &cfg_split_objects,true,true); + ar.add_option_switch("S","split_objects_numbered", + "Split input data into distinct numbered files", + &cfg_split_objects_numbered,true,true); + + ar.add_option_switch("B","split_blocks", + "Split tape into named and numbered block files", + &cfg_split_blocks,true,true); + ar.add_option_switch("b","ignore_block_errors", "Ignore block integrity errors. This will output broken blocks,too", &cfg_ignore_block_errors,true,true); @@ -84,9 +89,9 @@ void do_config(int argc, char ** args){ "Ignore block checksum errors. Errors will be converted to warnings.", &cfg_ignore_checksum_errors,true,true); - ar.add_option_switch("p","pause_on_checksum_error", - "Wait for user input on checksum error.", - &cfg_pause_on_checksum_error,true,true); +// ar.add_option_switch("p","pause_on_checksum_error", +// "Wait for user input on checksum error.", +// &cfg_pause_on_checksum_error,true,true); ar.add_option_switch("n","ignore_unknown_block_errors", "Ignore errors caused by unknown block types. Errors will be converted to warnings.", @@ -196,13 +201,11 @@ Errors will be converted to warnings.", if (cfg_verbose)cfg_quiet=0; // The configuration implications according to /cfg007/ - if (in_fd==0) cfg_pause_on_checksum_error=0; - if (cfg_pause_on_checksum_error==1) cfg_ignore_checksum_errors=1; + // if (in_fd==0) cfg_pause_on_checksum_error=0; + // if (cfg_pause_on_checksum_error==1) cfg_ignore_checksum_errors=1; if (cfg_output_info||cfg_output_called||cfg_output_exported|| - cfg_output_unsatisfied|| - cfg_split_objects||cfg_split_objects_numbered) - cfg_list_contents=0; + cfg_output_unsatisfied) cfg_list_contents=0; } diff --git a/pc-tools/ldc2/src/config.hh b/pc-tools/ldc2/src/config.hh index 09d056e..6dbd99f 100644 --- a/pc-tools/ldc2/src/config.hh +++ b/pc-tools/ldc2/src/config.hh @@ -19,6 +19,7 @@ extern int cfg_output_exported; extern int cfg_output_unsatisfied; extern int cfg_split_objects; extern int cfg_split_objects_numbered; +extern int cfg_split_blocks; extern int cfg_ignore_block_errors; extern int cfg_ignore_checksum_errors; extern int cfg_pause_on_checksum_error; diff --git a/pc-tools/ldc2/src/data_block.cpp b/pc-tools/ldc2/src/data_block.cpp index c836585..6ebee44 100644 --- a/pc-tools/ldc2/src/data_block.cpp +++ b/pc-tools/ldc2/src/data_block.cpp @@ -77,3 +77,4 @@ string data_block::extract_label(int firstbyte){ + diff --git a/pc-tools/ldc2/src/data_block_0_0.cpp b/pc-tools/ldc2/src/data_block_0_0.cpp index 86113d9..e1a462f 100644 --- a/pc-tools/ldc2/src/data_block_0_0.cpp +++ b/pc-tools/ldc2/src/data_block_0_0.cpp @@ -38,4 +38,3 @@ vector data_block_0_0::get_description(){ vector data_block_0_0::get_exported_symbols(){ return get_labels(); } - diff --git a/pc-tools/ldc2/src/data_block_0_3.cpp b/pc-tools/ldc2/src/data_block_0_3.cpp index 3b8a074..b11dadf 100644 --- a/pc-tools/ldc2/src/data_block_0_3.cpp +++ b/pc-tools/ldc2/src/data_block_0_3.cpp @@ -22,3 +22,12 @@ vector data_block_0_3::get_description(){ return result; } +/***************************************************************/ +/*! + *\brief Determine if the block marks the end of an object + *\return true because this block is an end block. + */ +bool data_block_0_3::is_endblock(){ + return true; +} + diff --git a/pc-tools/ldc2/src/data_block_0_3.hh b/pc-tools/ldc2/src/data_block_0_3.hh index 70bf265..665033b 100644 --- a/pc-tools/ldc2/src/data_block_0_3.hh +++ b/pc-tools/ldc2/src/data_block_0_3.hh @@ -16,6 +16,7 @@ class data_block_0_3 void(*)(void*),void*); public: vector get_description(); + bool is_endblock(); protected: data_block_0_3(data_block_0&); diff --git a/pc-tools/ldc2/src/data_block_0_label_extractor.cpp b/pc-tools/ldc2/src/data_block_0_label_extractor.cpp index 537099c..d1b3d11 100644 --- a/pc-tools/ldc2/src/data_block_0_label_extractor.cpp +++ b/pc-tools/ldc2/src/data_block_0_label_extractor.cpp @@ -13,7 +13,9 @@ data_block_0_label_extractor::data_block_0_label_extractor(data_block_0& org) vector data_block_0_label_extractor::get_labels(){ int l_count=word_size/3-1; vector result; - for (int l_no=0; l_no data_block_3::get_description(){ return result; } -/***************************************************************/ -/*! - *\brief Determine if the block marks the end of an object - *\return true because this block is an end block. - */ -bool data_block_3::is_endblock(){ - return true; -} - diff --git a/pc-tools/ldc2/src/data_block_3.hh b/pc-tools/ldc2/src/data_block_3.hh index c661231..7a5b902 100644 --- a/pc-tools/ldc2/src/data_block_3.hh +++ b/pc-tools/ldc2/src/data_block_3.hh @@ -19,7 +19,6 @@ protected: public: vector get_description(); - bool is_endblock(); }; #endif diff --git a/pc-tools/ldc2/src/data_block_4.cpp b/pc-tools/ldc2/src/data_block_4.cpp index 3e11dcd..c258c26 100644 --- a/pc-tools/ldc2/src/data_block_4.cpp +++ b/pc-tools/ldc2/src/data_block_4.cpp @@ -20,15 +20,6 @@ vector data_block_4::get_description(){ return result; } -/***************************************************************/ -/*! - *\brief Determine if the block marks the end of an object - *\return true because this block is an end block. - */ -bool data_block_4::is_endblock(){ - return true; -} - diff --git a/pc-tools/ldc2/src/data_block_4.hh b/pc-tools/ldc2/src/data_block_4.hh index f73f805..702f33d 100644 --- a/pc-tools/ldc2/src/data_block_4.hh +++ b/pc-tools/ldc2/src/data_block_4.hh @@ -19,7 +19,6 @@ protected: public: vector get_description(); - bool is_endblock(); }; #endif diff --git a/pc-tools/ldc2/src/data_block_6.cpp b/pc-tools/ldc2/src/data_block_6.cpp index 58d3039..1a41f08 100644 --- a/pc-tools/ldc2/src/data_block_6.cpp +++ b/pc-tools/ldc2/src/data_block_6.cpp @@ -28,7 +28,8 @@ vector data_block_6::get_description(){ */ vector data_block_6::get_exported_symbols(){ vector result; - result.insert(result.end(),extract_label(3)); + string rs=extract_label(3); + if (rs!=" ") result.insert(result.end(),rs); return result; } diff --git a/pc-tools/ldc2/src/data_block_7.cpp b/pc-tools/ldc2/src/data_block_7.cpp index 263cb93..121ed2d 100644 --- a/pc-tools/ldc2/src/data_block_7.cpp +++ b/pc-tools/ldc2/src/data_block_7.cpp @@ -1,3 +1,5 @@ +$Header: /var/lib/cvs/h316/pc-tools/ldc2/src/data_block_7.cpp,v 1.6 2007/03/26 00:45:12 hachti Exp $ + #include "data_block_7.hh" /*! diff --git a/pc-tools/ldc2/src/main.cpp b/pc-tools/ldc2/src/main.cpp index 34f2279..eafdf6a 100644 --- a/pc-tools/ldc2/src/main.cpp +++ b/pc-tools/ldc2/src/main.cpp @@ -1,5 +1,8 @@ /* ldc2 preliminary main program */ +#include +#include +#include #include #include @@ -157,10 +160,15 @@ void read_tape(){ if (error) fprintf(stderr,message.c_str()); if (warning) fprintf(stdwarn,message.c_str()); - - if(cfg_list_contents){ + + if(error||warning){ dump_vector(block->get_description()); - if (!error&&!warning) spaced=false; + } else { + if(cfg_list_contents){ + FILE * tmp_fp=fdopen(out_fd,"w"); + dump_vector_fp(block->get_description(),tmp_fp); + if (!error&&!warning) spaced=false; + } } if (error||warning||cfg_verbose){ @@ -177,38 +185,202 @@ void read_tape(){ } } // read_tape() + /******************************************************************************/ +void process_tape(){ + if (cfg_verbose) fprintf(stdwarn,"Processing Tape.\n"); + + bool in_object=false; + char filename[100]; + char filename_numbered[100]; + string objname; + int unknown_count=-1; + int fd=-1, fd_numbered=-1; + int obj_no=0; + int obj_start_block; + + for (unsigned int i=0; iget_type()==tape_block::TBT_EOT){ + objname="EOT"; + if (in_object){ + if (cfg_ignore_object_integrity_errors){ + fprintf(stdwarn,"Warning: Object integrity error!\n"); + warnings++; + } else { + fprintf(stderr,"Error: Object integrity error!\ + (Object no %i, Block %i unexpected)\n",obj_no,i); + errors++; + errcode=6; + return; + } + } + } + + if (!in_object){ // object begin + obj_no++; + obj_start_block=i; + + objname="UNKNOWN"; + unknown_count++; + + vectornames=block->get_exported_symbols(); + for (unsigned int a=0; aget_type()==tape_block::TBT_EOT){ + objname="EOT"; + } + + // Open file for split objects + if (cfg_split_objects && (block->get_type()!=tape_block::TBT_EOT)){ + if (objname=="UNKNOWN")snprintf(filename,99,"UNKNOWN%02i.obj",unknown_count); + else snprintf(filename,99,"%s.obj",objname.c_str()); + if (fd>-1) close (fd); + fd=open(filename,O_WRONLY|O_CREAT|O_TRUNC,0666); + printf("opening \"%s\"\n",filename); + if (fd<0){ + fprintf(stderr,"Error: could not open file \"%s\" for writing!\n", + filename); + exit (1); + } + } + + // Open file for split objects numbered + snprintf(filename_numbered,99,"%03i0-%s.obj",obj_no,objname.c_str()); + if (cfg_split_objects_numbered){ + if (fd_numbered>-1) close (fd_numbered); + fd_numbered=open(filename_numbered,O_WRONLY|O_CREAT|O_TRUNC,0666); + if (fd_numbered<0){ + fprintf(stderr,"Error: could not open file \"%s\" for writing!\n", + filename_numbered); + exit (1); + } + } + in_object=true; + } // object begin + + // Output block data + if (cfg_split_objects){ + try{ + if (block->get_type()!=tape_block::TBT_EOT) // Don't want EOT here + block->dump_to_fd(fd); + } + catch (tape_block::io_error_exception e){ + fprintf(stderr,"Error: could write to file \"%s\"!\n", + filename); + exit (1); + } + } // if (cfg_split_objects) + + // Output block data + if (cfg_split_objects_numbered){ + try{ + block->dump_to_fd(fd_numbered); + } + catch (tape_block::io_error_exception e){ + fprintf(stderr,"Error: could write to file \"%s\"!\n", + filename_numbered); + exit (1); + } + } // if (cfg_split_objects_numbered) + + // Output individual block file if desired + if (cfg_split_blocks){ + char fname[100]; + snprintf(fname,99,"%03i0-%s-%03i.block",obj_no,objname.c_str(),i-obj_start_block); + int fd_block=open(fname,O_WRONLY|O_TRUNC|O_CREAT,0666); + if (fd_block<0){ + fprintf(stderr,"Error: could not open file \"%s\" for writing!\n", + fname); + exit (1); + } + try{ + block->dump_to_fd(fd_block); + } + catch (tape_block::io_error_exception e){ + fprintf(stderr,"Error: could write to file \"%s\"!\n", + fname); + exit (1); + } + close(fd_block); + } + + if (block->is_endblock()||(block->get_type()==tape_block::TBT_EOT)) { + in_object=false; + if (fd!=-1) close(fd); + if (fd_numbered!=-1) close(fd_numbered); + } + } // for (...) + + if (in_object){ + if (cfg_ignore_object_integrity_errors){ + fprintf(stdwarn,"Warning: Object integrity error!\n"); + warnings++; + } else { + fprintf(stdwarn,"Error: Object integrity error!\n"); + errors++; + errcode=6; + return; + } + } + -void type_check(){ - bool warning=false; - bool error=false; +} // process_tape() +void process_called_imports(){ + vectorexported; + vectorcalled; + vector unsatisfied; + for (unsigned int i=0; ihas_known_type()){ - FILE * fp; - if (cfg_ignore_unknown_block_errors){ - fp=stdwarn; - warning=true; - } else { - fp=stderr; - error=true; - } - if (!spaced) { - spaced=false;fprintf(fp,"\n"); - fprintf(fp,"Warning: Unknown Block type! Block No.%i\n",i); - dump_vector_fp(tape[i]->get_description(),fp); - fprintf(fp,"\n"); - spaced=true; - } - if (!cfg_ignore_unknown_block_errors){ - int errcode=5; - fprintf(stdwarn,"Failed. (%i)\n",errcode); - exit(errcode); + merge_vector_unique(exported,tape[i]->get_exported_symbols()); + merge_vector_unique(called,tape[i]->get_called_symbols()); + } + + for (unsigned int icalled=0;icalleddump_to_fd(out_fd); - } + if (warnings>0){ + fprintf(stdwarn,"Warnings:%i\n",warnings); + return 99; } - - + if (cfg_verbose) fprintf(stdwarn,"Success.\n"); return 0; } // main() diff --git a/pc-tools/ldc2/src/tape_block.cpp b/pc-tools/ldc2/src/tape_block.cpp index b759a12..b6fc25b 100644 --- a/pc-tools/ldc2/src/tape_block.cpp +++ b/pc-tools/ldc2/src/tape_block.cpp @@ -339,7 +339,7 @@ tape_block * tape_block::gen_from_fd(int fd, 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 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; diff --git a/pc-tools/ldc2/src/tool.cpp b/pc-tools/ldc2/src/tool.cpp index cc04868..b33e027 100644 --- a/pc-tools/ldc2/src/tool.cpp +++ b/pc-tools/ldc2/src/tool.cpp @@ -7,22 +7,6 @@ using namespace std; -/*! - *\brief Output a vector of strings to out_fd. - *\arg strings A vector containing text. - *\retval 0 The vector was empty. - *\retval 1 The vector contained text. - */ -int dump_vector(vector strings){ - int res=0; - for (vector::iterator iter=strings.begin();iter strings){ int dump_vector_fp(vector strings, FILE * fp){ int res=0; for (vector::iterator iter=strings.begin();itersubstr(0,iter->find_last_not_of(" ")+1).c_str()); res=1; } return res; } /*! - *\brief add contents of one vector to another vector uniquely. - *\param target Reference to the target vector. - *\param source Reference to the vector whose contents are to be added - * to target. + *\brief Output a vector of strings to out_fd. + *\arg strings A vector containing text. + *\retval 0 The vector was empty. + *\retval 1 The vector contained text. */ -template -void merge_vector_unique(vector &target, const vector & source){ - for (unsigned int isource=0; isource strings){ + FILE * fp=fdopen(out_fd,"w"); + return dump_vector_fp(strings,fp); } diff --git a/pc-tools/ldc2/src/tool.hh b/pc-tools/ldc2/src/tool.hh index cfc31bb..1941f7c 100644 --- a/pc-tools/ldc2/src/tool.hh +++ b/pc-tools/ldc2/src/tool.hh @@ -9,8 +9,24 @@ using namespace std; extern int dump_vector(vector strings); extern int dump_vector_fp(vector strings, FILE * fp); -template -extern void merge_vector_unique(vector &target, const vector & source); +/*! + *\brief add contents of one vector to another vector uniquely. + *\param target Reference to the target vector. + *\param source Reference to the vector whose contents are to be added + * to target. + */ +template +void merge_vector_unique(vector &target, const vector & source){ + for (unsigned int isource=0; isource