Subversion Repositories tendra.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 7u83 1
<?xml version="1.0" standalone="no"?>
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
3
  "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
4
 
5
<!--
6
  $Id$
7
-->
8
 
9
<book>
10
	<bookinfo>
11
		<title>Adding new APIs with tspec</title>
12
 
13
		<corpauthor>The TenDRA Project</corpauthor>
14
 
15
		<author>
16
			<firstname>Kate</firstname>
17
			<surname>Flavel</surname>
18
		</author>
19
		<authorinitials>KF</authorinitials>
20
		<pubdate>2006</pubdate>
21
 
22
		<copyright>
23
			<year>2006</year>
24
 
25
			<holder>The TenDRA Project</holder>
26
		</copyright>
27
	</bookinfo>
28
 
29
	<chapterinfo>
30
		<abstract>
31
			<para>
32
				<!-- TODO who this document is for -->
33
			</para>
34
 
35
			<para>
36
				<!-- TODO
37
				This is not a generic tspec guide; it's specific to
38
				how we use tspec within TenDRA.
39
				For the general usage guide, see user/guides/tspec.
40
				-->
41
			</para>
42
		</abstract>
43
	</chapterinfo>
44
 
45
	<!--
46
		TODO all titles are just sketches to remind me: they need replacing
47
		TODO add @id to sections and chapters
48
	-->
49
 
50
	<chapter id="introduction">
51
		<!-- TODO apparently this should be a <preface> -->
52
		<title>Introduction</title>
53
		<sect1>
54
			<title><!-- TODO what an API is --></title>
55
		</sect1>
56
 
57
		<sect1>
58
			<title><!-- TODO what it's for --></title>
59
		</sect1>
60
 
61
		<sect1>
62
			<title><!-- TODO how they're specified --></title>
63
			<!-- TODO -->
64
 
65
			<para>
66
				<!-- TODO link to the tspec guide and recap its explanation -->
67
			</para>
68
		</sect1>
69
 
70
		<sect1>
71
			<title><!-- TODO where they live in the source --></title>
72
 
73
			<!-- TODO. -->
74
			<para>
75
				<!-- TODO go have a look at the existing ones. -->
76
			</para>
77
		</sect1>
78
 
79
		<sect1>
80
			<title><!-- TODO Purpose of this document --></title>	<!-- Not who it's for -->
81
 
82
			<para>
83
				<!-- TODO A guide to the process of adding a new API to TenDRA with tspec. -->
84
			</para>
85
 
86
			<para>
87
				<!-- TODO
88
				This guide should introduce the process involved;
89
				how to go about the whole thing, what things should
90
				inherit from where and why, and how to perform testing.
91
				-->
92
			</para>
93
		</sect1>
94
	</chapter>
95
 
96
	<chapter>
97
		<title><!-- TODO Why --></title>
98
 
99
		<sect1>
100
			<title><!-- TODO daunting --></title>
101
			<para>
102
				Adding new APIs can be rather daunting for several reasons:
103
			</para>
104
 
105
			<!-- TODO -->
106
			<para>
107
				<!-- TODO They can be huge -->
108
			</para>
109
 
110
			<para>
111
				<!-- TODO they're confusing -->
112
			</para>
113
 
114
			<para>
115
				<!-- TODO even when they're not confusing, they're complex:
116
				there're fun exceptions like "the value of the limit
117
				may differ from those given in this header ..."
118
				which require special cases -->
119
			</para>
120
 
121
			<para>
122
				<!-- TODO Figuring out which bits inherit from existing APIs is
123
				confusing (explain inheritance) -->
124
			</para>
125
 
126
			<para>
127
				<!-- TODO It's unlikely that tspec is familiar -->
128
			</para>
129
 
130
			<para>
131
				<!-- TODO not adding them is easier (see Temptations
132
				for the easy way) -->
133
			</para>
134
		</sect1>
135
 
136
		<sect1>
137
			<title><!-- TODO Why bother at all? --></title>
138
 
139
			<!-- TODO -->
140
			<para>
141
				<!-- TODO good question. specs aren't required -->
142
			</para>
143
		</sect1>
144
 
145
		<sect1>
146
			<title><!-- TODO Why be so pedantic about inheritance? --></title>
147
 
148
			<!-- TODO -->
149
			<para>
150
				<!-- TODO
151
				Why bother with inheritance?  - also good...
152
				you can write the same thing without inheritance.
153
				-->
154
			</para>
155
 
156
			<para>
157
				<!-- TODO
158
				recap what inheritance is first
159
				-->
160
			</para>
161
 
162
			<para>
163
				<!-- TODO
164
				One argument is to centralise code, and 
165
				mistakes (either in your API or the existing ones)
166
				This helps test the existing ones.
167
				-->
168
			</para>
169
 
170
			<para>
171
				<!-- TODO
172
				Motivational speech: it's very easy to make something
173
				here that works; it's very tedious to make it correct
174
				and since it's a specification, it *has* to be correct,
175
				or there's no point
176
				-->
177
			</para>
178
		</sect1>
179
 
180
		<sect1>
181
			<title><!-- TODO Temptations for the easy way --></title>
182
 
183
			<!-- TODO -->
184
			<para>
185
				<!-- TODO
186
				For example, temptation and POSIX3:
187
				- explain temptation
188
				-->
189
			</para>
190
 
191
			<para>
192
				<!-- TODO
193
				I'm going through them one by one 
194
				and checking... instead of (incorrectly) editing the POSIX1 
195
				definition, those should be under POSIX3 (which is incomplete) 
196
				-->
197
			</para>
198
 
199
			<para>
200
				<!-- TODO
201
				I'm trying to really check everything that goes on here,
202
				so we don't accidentally break unrelated things
203
				(unrelated things being machine definitions, or other specs)
204
				-->
205
			</para>
206
		</sect1>
207
 
208
		<!-- TODO -->
209
		<para>
210
			<!-- TODO
211
			In conclusion:
212
			Explain that this is tedious, pedantic, difficult to get
213
			right, and also very important that it *is* done correctly.
214
			That's pretty much the worst case for a task on all parts.
215
			-->
216
		</para>
217
	</chapter>
218
 
219
	<chapter>
220
		<title><!-- TODO Looking at your API --></title>
221
 
222
		<para>
223
			<!-- TODO
224
			Discuss about your API:
225
			What API are you adding?
226
			-->
227
		</para>
228
 
229
		<sect1>
230
			<title><!-- TODO is it a viable candidate at all? --></title>
231
 
232
			<!-- TODO -->
233
			<para>
234
				<!-- TODO
235
				What APIs are suitable for inclusion into the base, and what
236
				aren't (i.e. if it's important enough to come with your OS's
237
				base, and has a stable standard, we should probably include
238
				it - if it's a moving target or work in progress, we probably
239
				shouldn't). This should also mention something about which
240
				language are supported.
241
				-->
242
			</para>
243
 
244
			<!-- TODO -->
245
			<sect2>
246
				<title><!-- TODO is it standardised and no longer in flux --></title>
247
 
248
				<!-- TODO -->
249
			</sect2>
250
 
251
			<sect2>
252
				<title><!-- TODO is it useful to people other than yourself? --></title>
253
 
254
				<!-- TODO -->
255
 
256
				<!--
257
					TODO: it would be interesting to let users specify their
258
					own APIs privately (or perhaps make a community resource
259
					of APIs for projects somehow. Perhaps this should be a ticket
260
				-->
261
			</sect2>
262
		</sect1>
263
 
264
		<sect1>
265
			<title><!-- TODO How it relates to other APIs --></title>
266
 
267
			<!-- TODO -->
268
			<para>
269
				<!-- TODO
270
				When to inherit, and when to write from scratch (i.e. write
271
				from scratch if the specification independently states the
272
				same thing as another by coincidence, as opposed to
273
				explicitly stating that it should correlate with (and defer
274
				to!) a parent specification)
275
				-->
276
			</para>
277
 
278
			<sect2>
279
				<title>Inheriting APIs</title>
280
 
281
				<para>
282
					This is the usual case: an API that builds on previous
283
					standards. For example, POSIX builds on ANSI.
284
				</para>
285
 
286
				<!-- TODO explain more -->
287
			</sect2>
288
 
289
			<sect2>
290
				<title>Standalone APIs</title>
291
 
292
				<!-- TODO -->
293
				<para>
294
					<!-- TODO
295
					If it's an entirely self-standing API,
296
					*sure* it's appropriate to add? (it might be)
297
					-->
298
				</para>
299
			</sect2>
300
		</sect1>
301
	</chapter>
302
 
303
	<chapter>
304
		<title>Implementation Approach</title>
305
 
306
		<!-- TODO -->
307
		<para>
308
			<!-- TODO
309
			Implementation details. Link to the tspec guides
310
			sections here.
311
			-->
312
		</para>
313
 
314
		<sect1>
315
			<title>Sequence of Implementation</title>
316
 
317
			<!-- TODO -->
318
			<para>
319
				<!-- TODO
320
				How not to be overwhelmed by the sheer size of something
321
				like POSIX3. Some dicipline is required here: do not get eager.
322
				-->
323
			</para>
324
 
325
			<para>
326
				<!-- TODO
327
				APIs can be large; you can optimise work flow by grouping
328
				related tasks. Less switching between modes gives faster
329
				implementation time and less mistakes
330
				-->
331
			</para>
332
 
333
			<para>
334
				<!-- TODO
335
				One thing that's helping me here is to tackle strictly only
336
				the really simple files first, leaving the complex ones for
337
				later. The rough pattern there is to finish working on lots
338
				of simple ones all at once, and then to spend a longer time
339
				working through each complex file individually. This also
340
				helps keep up motivation by cutting down the list of incoming
341
				things!
342
				-->
343
			</para>
344
 
345
			<para>
346
				<!-- TODO
347
				i was doing all the headers which only define constants, first
348
				then all the ones which inherit things from previous 
349
				specifications (this is very tedious to get right)
350
				limits.h was way down that list
351
				-->
352
			</para>
353
 
354
			<para>
355
				<!-- TODO
356
				but we can do just the things needed, first, if you like
357
				think about customer demand: we can provide it without
358
				damaging our project. maybe even partial headers
359
				(comment them)
360
				-->
361
			</para>
362
		</sect1>
363
 
364
		<sect1>
365
			<title>Implementing Inheritance</title>
366
 
367
			<!-- TODO -->
368
			<para>
369
				<!-- TODO
370
				How our inheritance is structured at the directory level
371
				(with +IMPLEMENT), and what qualifies for this.
372
				-->
373
			</para>
374
 
375
			<para>
376
				<!-- TODO
377
				How our inheritance is structured within files (with +USE),
378
				and what qualifies for this.
379
				-->
380
			</para>
381
		</sect1>
382
	</chapter>
383
 
384
	<chapter>
385
		<title>Testing</title>
386
 
387
		<!-- TODO -->
388
		<para>
389
			<!-- TODO
390
		 	How to test your abstract implementation.
391
			Not easy, and tempting to skip!
392
			-->
393
		</para>
394
 
395
		<sect1>
396
			<title><!-- TODO often not practical to fully test --></title>
397
 
398
			<!-- TODO -->
399
			<para>
400
				<!-- TODO
401
				(i.e. to find/make a perfect implementation)
402
				So instead the trick is to be as thorough as possible
403
				without neccessarily being comprehensive.
404
				-->
405
			</para>
406
		</sect1>
407
 
408
		<sect1>
409
			<title><!-- TODO often not practical to test fail cases --></title>
410
 
411
			<!-- TODO -->
412
			<para>
413
				<!-- TODO
414
				(there are lots)
415
				-->
416
			</para>
417
		</sect1>
418
 
419
		<sect1>
420
			<title><!-- TODO What if one of your test systems doesn't actually conform? --></title>
421
 
422
			<para>
423
				<!-- TODO
424
				This can be confusing and annoying. Don't panic!
425
				It's easy to miss this, and tempting to handle it
426
				incorrectly. But we have a method to express this properly:
427
				-->
428
			</para>
429
 
430
			<para>
431
				<!-- TODO
432
				It's the implementation at fault, not the spec, so state
433
				it there: add __WRONG, etc to machines
434
				-->
435
			</para>
436
		</sect1>
437
	</chapter>
438
 
439
	<chapter>
440
		<title><!-- TODO Interesting Points from a Worked Example --></title>
441
 
442
		<para>
443
			<!-- TODO
444
			e.g. POSIX3. introduce the background to why we added this.
445
			(getting hold of the POSIX2 spec was annoying;
446
			if you want to do this; you need it to see where 
447
			to inherit and where not to and to double-check)
448
			-->
449
		</para>
450
 
451
		<para>
452
			<!-- TODO
453
			see POSIX2/limits.h - that just imports from POSIX1, 
454
			but limits.h changes significantly for v3
455
			-->
456
		</para>
457
	</chapter>
458
 
459
	<chapter>
460
		<title>Related Documents</title>
461
 
462
		<!--
463
			TODO looks like the other documents need a little cleanup
464
			for their siblings here, too.
465
		-->
466
 
467
		<para>
468
			<!-- TODO both of these should be hyperlinks:
469
			* tspec guide
470
			* where the apis live in the source. go explore!
471
			-->
472
		</para>
473
	</chapter>
474
</book>
475