*** empty log message ***
[h316.git] / pc-tools / ldc2 / doc / impl_spec.tex
CommitLineData
70896a91 1\section{Implementation Specification}
ea4c19a4 2
d65ad4d7 3\subsection{Theory of operation}
4\subsubsection{Overview}
5
6The program is implemented using standard C++.
7
8While the data structures according to \cite{ser16:progref}
9are designed consequently object oriented,
10most of the actual processing of the data after reading in is done
11by the routines contained in
12\verb|main.cpp|, \verb|config.cpp| and \verb|tool.cpp|.
13
14Program configuration is capsuled into the class \verb|configuration_manager|,
15used by the routines in \verb|config.cpp|.
16
17\subsubsection{Program flow}
18The \verb|main()| routine sets up the working environment using the \verb|do_config()|
19subroutine contained in \verb|config.cpp|. This contains parsing the command line,
20reading a configuration file, and setting the global \verb|cfg_*| flags. The input and
21output file descriptors \verb|in_fd| and \verb|out_fd| are assigned to 0 and 1 respective
22files as stated in the configuration (command line option or configuration file).
23The \verb|configuration_manager| is able to dynamically generate help output for all
24options.
25
26The next call is \verb|read_tape()|, the data input routine. In \verb|read_tape()|,
27the static factory method \verb|tape_block::gen_from_fd()| is used to create and
28check blocks, taking data directly from the global file descriptor \verb|in_fd|.\\
29At the end of \verb|read_tape()|, the vector \verb|tape| has been filled with
30pointers to instances of \verb|tape_block|.
31
32In the next step, the routine \verb|process_tape()| is called, in which
33integrity checks on object level and splitting to files (if desired)
34are accomplished. Every valid and complete object consist of either one
35single \verb|eot_block| or a series of \verb|data_block|s, while the last block
36of each object must be one of the types which mark the end of an object.
37
38After all that, \verb|process_symbols()| is called. This routine generates three vectors
39containing symbol names: \verb|exported|, \verb|called|, and \verb|unsatisfied|.
40The latter is the difference of \verb|called| and \verb|exported|.\\
41If desired, those vectors are written out to \verb|out_fd|, one symbol per line.
ea4c19a4 42
d65ad4d7 43\subsubsection{Block factory}
44The software makes use of C++ virtual methods allowing for convinient processing of
45multiple kinds of blocks without knowing much about the block type currently worked
46on.\\
47The block factory consists of the static factory method \verb|tape_block::gen_from_fd()|
48and a corresponding private constructor of class \verb|tape_block|. The constructor
49creates a block and reads data from the given file descriptor. The factory method
50then tries to determine the block's type and recreate an object of the most accurate
51subtype applying to the block. Information about the block types is contained in
52the block data itself. A pointer to the newly created object is returned or one
53of the exception defined in class \verb|tape_block| is thrown.
54
55
56\subsection{Detailed documentation}
57\subsubsection{Doxygen}
58The source code has been documented using Doxygen and appropriate
59comments throughout the program code. Doxygen generates a very useful
60html documentation containing very usable diagrams (not strictly UML, but
61very fine anyway), lists and detailed documentation.
62
63The Doxygen configuration also creates man pages, latex sources with
64makefile for PostScript and PDF output.
65
66\subsubsection{Not in this document}
67I have decided not to create UML class and collaboration diagrams because
68in my opinion the Doxygen documentation perfectly covers those needs.
69
70The project already took several times the time I allocated in my schedule....
71
72\subsection{Building \pname}
ea4c19a4 73\subsubsection{Build environment}
74The program has been successfully built under Linux with the following
75programs:
76\begin{itemize}
d65ad4d7 77\item GNU GCC, version 4.1.2
78\item GNU make, version 3.81
79\item Doxygen, version 1.4.2
ea4c19a4 80\item Debian teTex package, version 3.0
d65ad4d7 81\item Graphviz dot tool, version 2.8
ea4c19a4 82\end{itemize}
83At least the the software (without docs) should be compile on any
84POSIX compatible system with a fairly recent GCC and GNU make
85installed.
86
87\subsubsection{Build instructions}
88There is a simple \verb|Makefile| which eases the standard build
89process for the application and documentation. Changes may be
90necessary to compile on a system other than stated in the last
91paragraph.
ea4c19a4 92
93To build the application, follow these easy steps:
94\begin{itemize}
95
96\item Change directory to the \pname direcory.\\
97(Hint: That is the directory containing the subdirs \verb|src|
98and \verb|doc|.)
99
100\item Run \emph{make} (or \emph{gmake}).
101
102\item If you like, put the resulting binary somewhere in your system.
103\end{itemize}
104
105
106Further useful targets in the \verb|Makefile|:
107\begin{itemize}
108
109\item \verb|doc|: Build the Latex documentation (this document) in the
110\verb|doc| subfolder.
111
112\item \verb|doxy|: Build Doxygen source code documentation.\\
113The Doxygen output is placed in the subdir \verb|doxy|.
114
115\item \verb|clean|: Delete all files generated by the make process,
116including binaries and documentation.
117
118\end{itemize}
d65ad4d7 119
120% End of the show....