1 | # |
---|
2 | # This shell script generates the starting template for a manager chapter. |
---|
3 | # |
---|
4 | |
---|
5 | |
---|
6 | # Set this based on which chapter you want to generate a template for. |
---|
7 | chapter=$1 |
---|
8 | |
---|
9 | case ${chapter} in |
---|
10 | task) |
---|
11 | CHAPTER_CAPS="Task" |
---|
12 | CHAPTER_LOWER="task" |
---|
13 | ROUTINES=" cre_tsk del_tsk sta_tsk ext_tsk exd_tsk ter_tsk \ |
---|
14 | dis_dsp ena_dsp chg_pri rot_rdq rel_wai get_tid ref_tsk" |
---|
15 | ;; |
---|
16 | |
---|
17 | tasksync) |
---|
18 | CHAPTER_CAPS="Task-Dependent Synchronization" |
---|
19 | CHAPTER_LOWER="task-dependent synchronization" |
---|
20 | ROUTINES=" sus_tsk rsm_tsk frsm_tsk \ |
---|
21 | slp_tsk tslp_tsk wup_tsk can_wup" |
---|
22 | ;; |
---|
23 | |
---|
24 | semaphore) |
---|
25 | CHAPTER_CAPS="Semaphore" |
---|
26 | CHAPTER_LOWER="semaphore" |
---|
27 | ROUTINES="cre_sem del_sem sig_sem wai_sem preq_sem twai_sem ref_sem " |
---|
28 | ;; |
---|
29 | |
---|
30 | eventflags) |
---|
31 | CHAPTER_CAPS="Eventflags" |
---|
32 | CHAPTER_LOWER="eventflags" |
---|
33 | ROUTINES=" cre_flg del_flg set_flg clr_flg wai_flg pol_flg \ |
---|
34 | twai_flg ref_flg " |
---|
35 | ;; |
---|
36 | |
---|
37 | mailbox) |
---|
38 | CHAPTER_CAPS="Mailbox" |
---|
39 | CHAPTER_LOWER="mailbox" |
---|
40 | ROUTINES="cre_mbx del_mbx snd_msg rcv_msg prcv_msg trcv_msg ref_mbx" |
---|
41 | ;; |
---|
42 | |
---|
43 | msgbuffer) |
---|
44 | CHAPTER_CAPS="Message Buffer" |
---|
45 | CHAPTER_LOWER="message buffer" |
---|
46 | ROUTINES=" cre_mbf del_mbf snd_mbf psnd_mbf tsnd_mbf rcv_mbf prcv_mbf \ |
---|
47 | trcv_mbf ref_mbf " |
---|
48 | ;; |
---|
49 | |
---|
50 | rendezvous) |
---|
51 | CHAPTER_CAPS="Rendezvous" |
---|
52 | CHAPTER_LOWER="rendezvous" |
---|
53 | ROUTINES=" cre_por del_por cal_por pcal_por tcal_por acp_por pacp_por \ |
---|
54 | tacp_por fwd_por rpl_rdv ref_por" |
---|
55 | ;; |
---|
56 | |
---|
57 | interrupt) |
---|
58 | CHAPTER_CAPS="Interrupt" |
---|
59 | CHAPTER_LOWER="interrupt" |
---|
60 | ROUTINES=" def_int ret_int ret_wup loc_cpu unl_cpu dis_int ena_int |
---|
61 | chg_iXX ref_iXX" |
---|
62 | ;; |
---|
63 | |
---|
64 | memorypool) |
---|
65 | CHAPTER_CAPS="Memory Pool" |
---|
66 | CHAPTER_LOWER="memory pool" |
---|
67 | ROUTINES=" cre_mpl del_mpl get_blk pget_blk tget_blk rel_blk ref_mpl" |
---|
68 | ;; |
---|
69 | |
---|
70 | fixedblock) |
---|
71 | CHAPTER_CAPS="Fixed Block" |
---|
72 | CHAPTER_LOWER="fixed block" |
---|
73 | ROUTINES=" cre_mpf del_mpf get_blf pget_blf tget_blf rel_blf ref_mpf" |
---|
74 | ;; |
---|
75 | |
---|
76 | |
---|
77 | time) |
---|
78 | CHAPTER_CAPS="Time" |
---|
79 | CHAPTER_LOWER="time" |
---|
80 | ROUTINES=" get_tim set_tim dly_tsk \ |
---|
81 | def_cyc act_cyc ref_cyc \ |
---|
82 | def_alm ref_alm ret_tmr" |
---|
83 | ;; |
---|
84 | |
---|
85 | config) |
---|
86 | CHAPTER_CAPS="System" |
---|
87 | CHAPTER_LOWER="system" |
---|
88 | ROUTINES=" get_ver ref_sys ref_cfg def_svc def_exc" |
---|
89 | ;; |
---|
90 | |
---|
91 | network) |
---|
92 | CHAPTER_CAPS="Network Support" |
---|
93 | CHAPTER_LOWER="network support" |
---|
94 | ROUTINES=" nrea_dat nwri_dat nget_nod nget_ver" |
---|
95 | ;; |
---|
96 | *) |
---|
97 | echo "Unknown chapter name" |
---|
98 | exit 1 |
---|
99 | ;; |
---|
100 | esac |
---|
101 | |
---|
102 | if [ "x${CHAPTER_CAPS}" = "x" -o "x${CHAPTER_LOWER}" = "x" \ |
---|
103 | -o "x${ROUTINES}" = "x" ] ; then |
---|
104 | echo "initialization problem" |
---|
105 | exit 1 |
---|
106 | fi |
---|
107 | |
---|
108 | echo "@c" |
---|
109 | echo "@c This is the chapter from the RTEMS ITRON User's Guide that" |
---|
110 | echo "@c documents the services provided by the ${CHAPTER_LOWER}" |
---|
111 | echo "@c manager." |
---|
112 | echo "@c" |
---|
113 | echo "@c \$Id\$" |
---|
114 | echo "@c" |
---|
115 | echo "" |
---|
116 | echo "@chapter ${CHAPTER_CAPS}" Manager |
---|
117 | echo "" |
---|
118 | echo "@section Introduction" |
---|
119 | echo "" |
---|
120 | echo "The " |
---|
121 | echo "${CHAPTER_LOWER} manager is ..." |
---|
122 | echo "" |
---|
123 | echo "The services provided by the ${CHAPTER_LOWER} manager are:" |
---|
124 | echo "" |
---|
125 | echo "@itemize @bullet" |
---|
126 | |
---|
127 | for routine in ${ROUTINES} |
---|
128 | do |
---|
129 | description=`grep ${routine} ../../itron_spec/itron3-1.txt | grep "]" | cut -d']' -f2` |
---|
130 | description=`echo ${description}` |
---|
131 | echo "@item @code{${routine}} - ${description}" |
---|
132 | done |
---|
133 | echo "@end itemize" |
---|
134 | |
---|
135 | echo "" |
---|
136 | echo "@section Background" |
---|
137 | echo "" |
---|
138 | echo "@section Operations" |
---|
139 | echo "" |
---|
140 | echo "@section System Calls" |
---|
141 | echo "" |
---|
142 | echo "This section details the ${CHAPTER_LOWER} manager's services." |
---|
143 | echo "A subsection is dedicated to each of this manager's services" |
---|
144 | echo "and describes the calling sequence, related constants, usage," |
---|
145 | echo "and status codes." |
---|
146 | echo "" |
---|
147 | |
---|
148 | for routine in ${ROUTINES} |
---|
149 | do |
---|
150 | description=`grep ${routine} ../../itron_spec/itron3-1.txt | grep "]" | cut -d']' -f2` |
---|
151 | description=`echo ${description}` |
---|
152 | echo "" |
---|
153 | echo "@c" |
---|
154 | echo "@c ${routine}" |
---|
155 | echo "@c" |
---|
156 | echo "" |
---|
157 | echo "@page" |
---|
158 | echo "@subsection ${routine} - ${description}" |
---|
159 | echo "" |
---|
160 | echo "@subheading CALLING SEQUENCE:" |
---|
161 | echo "" |
---|
162 | echo "@ifset is-C" |
---|
163 | echo "@example" |
---|
164 | proto=`grep "${routine} (" ../../itron_spec/itron3-6.txt | sed -e 's/ercd = //'` # | sed -e 's/ \\(/(/'` |
---|
165 | |
---|
166 | echo `echo ${proto} | cut -d'(' -f1`"(" |
---|
167 | echo ${proto} | cut -d'(' -f2 | sed -e 's/ .;//' |
---|
168 | echo ");" |
---|
169 | # echo "int ${routine}(" |
---|
170 | # echo ");" |
---|
171 | echo "@end example" |
---|
172 | echo "@end ifset" |
---|
173 | echo "" |
---|
174 | echo "@ifset is-Ada" |
---|
175 | echo "@end ifset" |
---|
176 | echo "" |
---|
177 | echo "@subheading STATUS CODES:" |
---|
178 | echo "" |
---|
179 | echo "@code{EXXX} - " |
---|
180 | echo "" |
---|
181 | echo "@subheading DESCRIPTION:" |
---|
182 | echo "" |
---|
183 | echo "@subheading NOTES:" |
---|
184 | echo "" |
---|
185 | done |
---|
186 | |
---|