Design and Implementation of a Documentation Tool for ... - MADOC
Design and Implementation of a Documentation Tool for ... - MADOC
Design and Implementation of a Documentation Tool for ... - MADOC
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
A <strong>Implementation</strong> <strong>of</strong> <strong>for</strong>script<br />
This section will describe the code <strong>of</strong> <strong>for</strong>script in detail. You will learn how<br />
the s<strong>of</strong>tware hooks into the input <strong>and</strong> output stream <strong>of</strong> the client application <strong>and</strong><br />
how it reacts to things like window size changes or the child terminating. Other<br />
interesting topics include how to launch a subprocess <strong>and</strong> change its controlling<br />
terminal as well as how to read from multiple data streams at once without<br />
having to run separate processes.<br />
A.1 Overview<br />
Here’s the current version number <strong>of</strong> <strong>for</strong>script. Any future alterations can<br />
be explained in the text at relevant placed. MYVERSION is defined as a global<br />
constant.<br />
15a 〈globals 8d〉+≡ (15b) ⊳ 8d 22a ⊲<br />
const char *MYVERSION = "1.0.0";<br />
Defines:<br />
MYVERSION, used in chunk 25b.<br />
The code begins with feature test macros, ordinary macros <strong>and</strong> include statements.<br />
Afterwards, constants <strong>and</strong> global variables are defined.<br />
15b 〈declarations <strong>and</strong> definitions 15b〉≡ (7a)<br />
〈featuretest 27b〉<br />
〈macros 37c〉<br />
〈includes 8b〉<br />
〈constants 16a〉<br />
〈globals 8d〉<br />
The functions used in the code are put in an order that makes sure every<br />
function is defined be<strong>for</strong>e it is called. Since die() is required at many places, it<br />
is put first. Next, all the chunk writing functions appear (the helper functions<br />
first). Then come the functions that write startup <strong>and</strong> shutdown messages on<br />
the screen, followed by the signal h<strong>and</strong>ling functions like finish. The functions<br />
doshell <strong>and</strong> doio are the main input/output functions that represent the parent<br />
<strong>and</strong> child processes.<br />
15c 〈functions 15c〉≡ (7a)<br />
〈die 23b〉<br />
〈swrite 22b〉<br />
〈chunkw 21〉<br />
〈chunkwhf 22d〉<br />
〈chunkwm 23a〉<br />
〈chunks 17a〉<br />
〈statusmsg 24b〉<br />
〈done 37d〉<br />
〈finish 37b〉<br />
〈winsize 30b〉<br />
〈resized 30a〉<br />
〈doshell 31c〉<br />
〈doio 33c〉<br />
15