]> git.cameronkatri.com Git - mandoc.git/blob - strings.c
896971a9e56eeea28b3394d1a22646bd33e8a10e
[mandoc.git] / strings.c
1 /* $Id: strings.c,v 1.22 2009/02/27 10:55:16 kristaps Exp $ */
2 /*
3 * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the
7 * above copyright notice and this permission notice appear in all
8 * copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
18 */
19 #include <assert.h>
20 #include <ctype.h>
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <string.h>
24 #ifndef __OpenBSD__
25 #include <time.h>
26 #endif
27
28 /*
29 * Convert scalars to and from string format.
30 */
31
32 #include "private.h"
33
34 #ifdef __linux__
35 extern char *strptime(const char *, const char *, struct tm *);
36 #endif
37
38
39 size_t
40 mdoc_isescape(const char *p)
41 {
42 size_t c;
43
44 if ('\\' != *p++)
45 return(0);
46
47 switch (*p) {
48 case ('\\'):
49 /* FALLTHROUGH */
50 case ('\''):
51 /* FALLTHROUGH */
52 case ('`'):
53 /* FALLTHROUGH */
54 case ('-'):
55 /* FALLTHROUGH */
56 case (' '):
57 /* FALLTHROUGH */
58 case ('&'):
59 /* FALLTHROUGH */
60 case ('.'):
61 /* FALLTHROUGH */
62 case ('e'):
63 return(2);
64 case ('*'):
65 if (0 == *++p || ! isgraph((int)*p))
66 return(0);
67 switch (*p) {
68 case ('('):
69 if (0 == *++p || ! isgraph((int)*p))
70 return(0);
71 return(4);
72 default:
73 break;
74 }
75 return(3);
76 case ('('):
77 if (0 == *++p || ! isgraph((int)*p))
78 return(0);
79 if (0 == *++p || ! isgraph((int)*p))
80 return(0);
81 return(4);
82 case ('['):
83 break;
84 default:
85 return(0);
86 }
87
88 for (c = 3, p++; *p && ']' != *p; p++, c++)
89 if ( ! isgraph((int)*p))
90 break;
91
92 return(*p == ']' ? c : 0);
93 }
94
95
96 int
97 mdoc_iscdelim(char p)
98 {
99
100 switch (p) {
101 case('.'):
102 /* FALLTHROUGH */
103 case(','):
104 /* FALLTHROUGH */
105 case(';'):
106 /* FALLTHROUGH */
107 case(':'):
108 /* FALLTHROUGH */
109 case('?'):
110 /* FALLTHROUGH */
111 case('!'):
112 /* FALLTHROUGH */
113 case('('):
114 /* FALLTHROUGH */
115 case(')'):
116 /* FALLTHROUGH */
117 case('['):
118 /* FALLTHROUGH */
119 case(']'):
120 /* FALLTHROUGH */
121 case('{'):
122 /* FALLTHROUGH */
123 case('}'):
124 return(1);
125 default:
126 break;
127 }
128
129 return(0);
130 }
131
132
133 int
134 mdoc_isdelim(const char *p)
135 {
136
137 if (0 == *p)
138 return(0);
139 if (0 != *(p + 1))
140 return(0);
141 return(mdoc_iscdelim(*p));
142 }
143
144
145 enum mdoc_sec
146 mdoc_atosec(const char *p)
147 {
148
149 assert(p);
150 if (0 == strcmp(p, "NAME"))
151 return(SEC_NAME);
152 else if (0 == strcmp(p, "RETURN VALUES"))
153 return(SEC_RETURN_VALUES);
154 else if (0 == strcmp(p, "SEE ALSO"))
155 return(SEC_SEE_ALSO);
156 else if (0 == strcmp(p, "SYNOPSIS"))
157 return(SEC_SYNOPSIS);
158 else if (0 == strcmp(p, "DESCRIPTION"))
159 return(SEC_DESCRIPTION);
160 else if (0 == strcmp(p, "ENVIRONMENT"))
161 return(SEC_ENVIRONMENT);
162 else if (0 == strcmp(p, "FILES"))
163 return(SEC_FILES);
164 else if (0 == strcmp(p, "EXAMPLES"))
165 return(SEC_EXAMPLES);
166 else if (0 == strcmp(p, "DIAGNOSTICS"))
167 return(SEC_DIAGNOSTICS);
168 else if (0 == strcmp(p, "ERRORS"))
169 return(SEC_ERRORS);
170 else if (0 == strcmp(p, "STANDARDS"))
171 return(SEC_STANDARDS);
172 else if (0 == strcmp(p, "HISTORY"))
173 return(SEC_HISTORY);
174 else if (0 == strcmp(p, "AUTHORS"))
175 return(SEC_AUTHORS);
176 else if (0 == strcmp(p, "CAVEATS"))
177 return(SEC_CAVEATS);
178 else if (0 == strcmp(p, "BUGS"))
179 return(SEC_BUGS);
180
181 return(SEC_CUSTOM);
182 }
183
184
185 time_t
186 mdoc_atotime(const char *p)
187 {
188 struct tm tm;
189 char *pp;
190
191 (void)memset(&tm, 0, sizeof(struct tm));
192
193 if (xstrcmp(p, "$Mdocdate: February 27 2009 $"))
194 return(time(NULL));
195 if ((pp = strptime(p, "$Mdocdate: February 27 2009 $", &tm)) && 0 == *pp)
196 return(mktime(&tm));
197 /* XXX - this matches "June 1999", which is wrong. */
198 if ((pp = strptime(p, "%b %d %Y", &tm)) && 0 == *pp)
199 return(mktime(&tm));
200 if ((pp = strptime(p, "%b %d, %Y", &tm)) && 0 == *pp)
201 return(mktime(&tm));
202
203 return(0);
204 }
205
206
207 enum mdoc_msec
208 mdoc_atomsec(const char *p)
209 {
210
211 if (0 == strcmp(p, "1"))
212 return(MSEC_1);
213 else if (0 == strcmp(p, "2"))
214 return(MSEC_2);
215 else if (0 == strcmp(p, "3"))
216 return(MSEC_3);
217 else if (0 == strcmp(p, "3f"))
218 return(MSEC_3f);
219 else if (0 == strcmp(p, "3p"))
220 return(MSEC_3p);
221 else if (0 == strcmp(p, "4"))
222 return(MSEC_4);
223 else if (0 == strcmp(p, "5"))
224 return(MSEC_5);
225 else if (0 == strcmp(p, "6"))
226 return(MSEC_6);
227 else if (0 == strcmp(p, "7"))
228 return(MSEC_7);
229 else if (0 == strcmp(p, "8"))
230 return(MSEC_8);
231 else if (0 == strcmp(p, "9"))
232 return(MSEC_9);
233 else if (0 == strcmp(p, "X11"))
234 return(MSEC_X11);
235 else if (0 == strcmp(p, "X11R6"))
236 return(MSEC_X11R6);
237 else if (0 == strcmp(p, "local"))
238 return(MSEC_local);
239 else if (0 == strcmp(p, "n"))
240 return(MSEC_n);
241 else if (0 == strcmp(p, "unass"))
242 return(MSEC_unass);
243 else if (0 == strcmp(p, "draft"))
244 return(MSEC_draft);
245 else if (0 == strcmp(p, "paper"))
246 return(MSEC_paper);
247
248 return(MSEC_DEFAULT);
249 }
250
251
252 enum mdoc_vol
253 mdoc_atovol(const char *p)
254 {
255
256 if (0 == strcmp(p, "AMD"))
257 return(VOL_AMD);
258 else if (0 == strcmp(p, "IND"))
259 return(VOL_IND);
260 else if (0 == strcmp(p, "KM"))
261 return(VOL_KM);
262 else if (0 == strcmp(p, "LOCAL"))
263 return(VOL_LOCAL);
264 else if (0 == strcmp(p, "PRM"))
265 return(VOL_PRM);
266 else if (0 == strcmp(p, "PS1"))
267 return(VOL_PS1);
268 else if (0 == strcmp(p, "SMM"))
269 return(VOL_SMM);
270 else if (0 == strcmp(p, "URM"))
271 return(VOL_URM);
272 else if (0 == strcmp(p, "USD"))
273 return(VOL_USD);
274
275 return(VOL_DEFAULT);
276 }
277
278
279 enum mdoc_arch
280 mdoc_atoarch(const char *p)
281 {
282
283 if (0 == strcmp(p, "alpha"))
284 return(ARCH_alpha);
285 else if (0 == strcmp(p, "amd64"))
286 return(ARCH_amd64);
287 else if (0 == strcmp(p, "amiga"))
288 return(ARCH_amiga);
289 else if (0 == strcmp(p, "arc"))
290 return(ARCH_arc);
291 else if (0 == strcmp(p, "arm"))
292 return(ARCH_arm);
293 else if (0 == strcmp(p, "armish"))
294 return(ARCH_armish);
295 else if (0 == strcmp(p, "aviion"))
296 return(ARCH_aviion);
297 else if (0 == strcmp(p, "hp300"))
298 return(ARCH_hp300);
299 else if (0 == strcmp(p, "hppa"))
300 return(ARCH_hppa);
301 else if (0 == strcmp(p, "hppa64"))
302 return(ARCH_hppa64);
303 else if (0 == strcmp(p, "i386"))
304 return(ARCH_i386);
305 else if (0 == strcmp(p, "landisk"))
306 return(ARCH_landisk);
307 else if (0 == strcmp(p, "luna88k"))
308 return(ARCH_luna88k);
309 else if (0 == strcmp(p, "mac68k"))
310 return(ARCH_mac68k);
311 else if (0 == strcmp(p, "macppc"))
312 return(ARCH_macppc);
313 else if (0 == strcmp(p, "mvme68k"))
314 return(ARCH_mvme68k);
315 else if (0 == strcmp(p, "mvme88k"))
316 return(ARCH_mvme88k);
317 else if (0 == strcmp(p, "mvmeppc"))
318 return(ARCH_mvmeppc);
319 else if (0 == strcmp(p, "pmax"))
320 return(ARCH_pmax);
321 else if (0 == strcmp(p, "sgi"))
322 return(ARCH_sgi);
323 else if (0 == strcmp(p, "socppc"))
324 return(ARCH_socppc);
325 else if (0 == strcmp(p, "sparc"))
326 return(ARCH_sparc);
327 else if (0 == strcmp(p, "sparc64"))
328 return(ARCH_sparc64);
329 else if (0 == strcmp(p, "sun3"))
330 return(ARCH_sun3);
331 else if (0 == strcmp(p, "vax"))
332 return(ARCH_vax);
333 else if (0 == strcmp(p, "zaurus"))
334 return(ARCH_zaurus);
335
336 return(ARCH_DEFAULT);
337 }
338
339
340 enum mdoc_att
341 mdoc_atoatt(const char *p)
342 {
343
344 assert(p);
345 if (0 == strcmp(p, "v1"))
346 return(ATT_v1);
347 else if (0 == strcmp(p, "v2"))
348 return(ATT_v2);
349 else if (0 == strcmp(p, "v3"))
350 return(ATT_v3);
351 else if (0 == strcmp(p, "v4"))
352 return(ATT_v4);
353 else if (0 == strcmp(p, "v5"))
354 return(ATT_v5);
355 else if (0 == strcmp(p, "v6"))
356 return(ATT_v6);
357 else if (0 == strcmp(p, "v7"))
358 return(ATT_v7);
359 else if (0 == strcmp(p, "32v"))
360 return(ATT_32v);
361 else if (0 == strcmp(p, "V.1"))
362 return(ATT_V1);
363 else if (0 == strcmp(p, "V.2"))
364 return(ATT_V2);
365 else if (0 == strcmp(p, "V.3"))
366 return(ATT_V3);
367 else if (0 == strcmp(p, "V.4"))
368 return(ATT_V4);
369
370 return(ATT_DEFAULT);
371 }
372
373
374 char *
375 mdoc_type2a(enum mdoc_type type)
376 {
377 switch (type) {
378 case (MDOC_ROOT):
379 return("root");
380 case (MDOC_BLOCK):
381 return("block");
382 case (MDOC_HEAD):
383 return("block-head");
384 case (MDOC_BODY):
385 return("block-body");
386 case (MDOC_TAIL):
387 return("block-tail");
388 case (MDOC_ELEM):
389 return("elem");
390 case (MDOC_TEXT):
391 return("text");
392 default:
393 break;
394 }
395
396 abort();
397 /* NOTREACHED */
398 }
399
400
401 const char *
402 mdoc_arch2a(enum mdoc_arch arch)
403 {
404
405 switch (arch) {
406 case (ARCH_alpha):
407 return("Alpha");
408 case (ARCH_amd64):
409 return("AMD64");
410 case (ARCH_amiga):
411 return("Amiga");
412 case (ARCH_arc):
413 return("ARC");
414 case (ARCH_arm):
415 return("ARM");
416 case (ARCH_armish):
417 return("ARMISH");
418 case (ARCH_aviion):
419 return("AViiON");
420 case (ARCH_hp300):
421 return("HP300");
422 case (ARCH_hppa):
423 return("HPPA");
424 case (ARCH_hppa64):
425 return("HPPA64");
426 case (ARCH_i386):
427 return("i386");
428 case (ARCH_landisk):
429 return("LANDISK");
430 case (ARCH_luna88k):
431 return("Luna88k");
432 case (ARCH_mac68k):
433 return("Mac68k");
434 case (ARCH_macppc):
435 return("MacPPC");
436 case (ARCH_mvme68k):
437 return("MVME68k");
438 case (ARCH_mvme88k):
439 return("MVME88k");
440 case (ARCH_mvmeppc):
441 return("MVMEPPC");
442 case (ARCH_pmax):
443 return("PMAX");
444 case (ARCH_sgi):
445 return("SGI");
446 case (ARCH_socppc):
447 return("SOCPPC");
448 case (ARCH_sparc):
449 return("SPARC");
450 case (ARCH_sparc64):
451 return("SPARC64");
452 case (ARCH_sun3):
453 return("Sun3");
454 case (ARCH_vax):
455 return("VAX");
456 case (ARCH_zaurus):
457 return("Zaurus");
458 case (ARCH_DEFAULT):
459 return(NULL);
460 default:
461 break;
462 }
463
464 abort();
465 /* NOTREACHED */
466 }
467
468
469 const char *
470 mdoc_vol2a(enum mdoc_vol vol)
471 {
472
473 switch (vol) {
474 case (VOL_AMD):
475 return("Ancestral Manual Documents");
476 case (VOL_IND):
477 return("Manual Master Index");
478 case (VOL_KM):
479 return("Kernel Manual");
480 case (VOL_LOCAL):
481 return("Local Manual");
482 case (VOL_PRM):
483 return("Programmer's Manual");
484 case (VOL_PS1):
485 return("Programmer's Supplementary Documents");
486 case (VOL_SMM):
487 return("System Manager's Manual");
488 case (VOL_URM):
489 return("Reference Manual");
490 case (VOL_USD):
491 return("User's Supplementary Documents");
492 case (VOL_DEFAULT):
493 return(NULL);
494 default:
495 break;
496 }
497
498 abort();
499 /* NOTREACHED */
500 }
501
502
503 const char *
504 mdoc_msec2a(enum mdoc_msec msec)
505 {
506
507 switch (msec) {
508 case(MSEC_1):
509 return("1");
510 case(MSEC_2):
511 return("2");
512 case(MSEC_3):
513 return("3");
514 case(MSEC_3f):
515 return("3f");
516 case(MSEC_3p):
517 return("3p");
518 case(MSEC_4):
519 return("4");
520 case(MSEC_5):
521 return("5");
522 case(MSEC_6):
523 return("6");
524 case(MSEC_7):
525 return("7");
526 case(MSEC_8):
527 return("8");
528 case(MSEC_9):
529 return("9");
530 case(MSEC_X11):
531 return("X11");
532 case(MSEC_X11R6):
533 return("X11R6");
534 case(MSEC_local):
535 return("local");
536 case(MSEC_n):
537 return("n");
538 case(MSEC_unass):
539 /* FALLTHROUGH */
540 case(MSEC_draft):
541 return("draft");
542 case(MSEC_paper):
543 return("paper");
544 case(MSEC_DEFAULT):
545 return(NULL);
546 default:
547 break;
548 }
549
550 abort();
551 /* NOTREACHED */
552 }
553
554
555 const char *
556 mdoc_st2a(int c)
557 {
558 char *p;
559
560 switch (c) {
561 case(MDOC_p1003_1_88):
562 p = "IEEE Std 1003.1-1988 (\\(lqPOSIX\\(rq)";
563 break;
564 case(MDOC_p1003_1_90):
565 p = "IEEE Std 1003.1-1990 (\\(lqPOSIX\\(rq)";
566 break;
567 case(MDOC_p1003_1_96):
568 p = "ISO/IEC 9945-1:1996 (\\(lqPOSIX\\(rq)";
569 break;
570 case(MDOC_p1003_1_2001):
571 p = "IEEE Std 1003.1-2001 (\\(lqPOSIX\\(rq)";
572 break;
573 case(MDOC_p1003_1_2004):
574 p = "IEEE Std 1003.1-2004 (\\(lqPOSIX\\(rq)";
575 break;
576 case(MDOC_p1003_1):
577 p = "IEEE Std 1003.1 (\\(lqPOSIX\\(rq)";
578 break;
579 case(MDOC_p1003_1b):
580 p = "IEEE Std 1003.1b (\\(lqPOSIX\\(rq)";
581 break;
582 case(MDOC_p1003_1b_93):
583 p = "IEEE Std 1003.1b-1993 (\\(lqPOSIX\\(rq)";
584 break;
585 case(MDOC_p1003_1c_95):
586 p = "IEEE Std 1003.1c-1995 (\\(lqPOSIX\\(rq)";
587 break;
588 case(MDOC_p1003_1g_2000):
589 p = "IEEE Std 1003.1g-2000 (\\(lqPOSIX\\(rq)";
590 break;
591 case(MDOC_p1003_2_92):
592 p = "IEEE Std 1003.2-1992 (\\(lqPOSIX.2\\(rq)";
593 break;
594 case(MDOC_p1387_2_95):
595 p = "IEEE Std 1387.2-1995 (\\(lqPOSIX.7.2\\(rq)";
596 break;
597 case(MDOC_p1003_2):
598 p = "IEEE Std 1003.2 (\\(lqPOSIX.2\\(rq)";
599 break;
600 case(MDOC_p1387_2):
601 p = "IEEE Std 1387.2 (\\(lqPOSIX.7.2\\(rq)";
602 break;
603 case(MDOC_isoC_90):
604 p = "ISO/IEC 9899:1990 (\\(lqISO C90\\(rq)";
605 break;
606 case(MDOC_isoC_amd1):
607 p = "ISO/IEC 9899/AMD1:1995 (\\(lqISO C90\\(rq)";
608 break;
609 case(MDOC_isoC_tcor1):
610 p = "ISO/IEC 9899/TCOR1:1994 (\\(lqISO C90\\(rq)";
611 break;
612 case(MDOC_isoC_tcor2):
613 p = "ISO/IEC 9899/TCOR2:1995 (\\(lqISO C90\\(rq)";
614 break;
615 case(MDOC_isoC_99):
616 p = "ISO/IEC 9899:1999 (\\(lqISO C99\\(rq)";
617 break;
618 case(MDOC_ansiC):
619 p = "ANSI X3.159-1989 (\\(lqANSI C\\(rq)";
620 break;
621 case(MDOC_ansiC_89):
622 p = "ANSI X3.159-1989 (\\(lqANSI C\\(rq)";
623 break;
624 case(MDOC_ansiC_99):
625 p = "ANSI/ISO/IEC 9899-1999 (\\(lqANSI C99\\(rq)";
626 break;
627 case(MDOC_ieee754):
628 p = "IEEE Std 754-1985";
629 break;
630 case(MDOC_iso8802_3):
631 p = "ISO 8802-3: 1989";
632 break;
633 case(MDOC_xpg3):
634 p = "X/Open Portability Guide Issue 3 "
635 "(\\(lqXPG3\\(rq)";
636 break;
637 case(MDOC_xpg4):
638 p = "X/Open Portability Guide Issue 4 "
639 "(\\(lqXPG4\\(rq)";
640 break;
641 case(MDOC_xpg4_2):
642 p = "X/Open Portability Guide Issue 4.2 "
643 "(\\(lqXPG4.2\\(rq)";
644 break;
645 case(MDOC_xpg4_3):
646 p = "X/Open Portability Guide Issue 4.3 "
647 "(\\(lqXPG4.3\\(rq)";
648 break;
649 case(MDOC_xbd5):
650 p = "X/Open System Interface Definitions Issue 5 "
651 "(\\(lqXBD5\\(rq)";
652 break;
653 case(MDOC_xcu5):
654 p = "X/Open Commands and Utilities Issue 5 "
655 "(\\(lqXCU5\\(rq)";
656 break;
657 case(MDOC_xsh5):
658 p = "X/Open System Interfaces and Headers Issue 5 "
659 "(\\(lqXSH5\\(rq)";
660 break;
661 case(MDOC_xns5):
662 p = "X/Open Networking Services Issue 5 "
663 "(\\(lqXNS5\\(rq)";
664 break;
665 case(MDOC_xns5_2d2_0):
666 p = "X/Open Networking Services Issue 5.2 Draft 2.0 "
667 "(\\(lqXNS5.2D2.0\\(rq)";
668 break;
669 case(MDOC_xcurses4_2):
670 p = "X/Open Curses Issue 4 Version 2 "
671 "(\\(lqXCURSES4.2\\(rq)";
672 break;
673 case(MDOC_susv2):
674 p = "Version 2 of the Single UNIX Specification";
675 break;
676 case(MDOC_susv3):
677 p = "Version 3 of the Single UNIX Specification";
678 break;
679 case(MDOC_svid4):
680 p = "System V Interface Definition, Fourth Edition "
681 "(\\(lqSVID4\\(rq)";
682 break;
683 default:
684 p = NULL;
685 break;
686 }
687
688 return(p);
689 }
690
691
692 const char *
693 mdoc_att2a(enum mdoc_att c)
694 {
695 char *p;
696
697 switch (c) {
698 case(ATT_v1):
699 p = "Version 1 AT&T UNIX";
700 break;
701 case(ATT_v2):
702 p = "Version 2 AT&T UNIX";
703 break;
704 case(ATT_v3):
705 p = "Version 3 AT&T UNIX";
706 break;
707 case(ATT_v4):
708 p = "Version 4 AT&T UNIX";
709 break;
710 case(ATT_v5):
711 p = "Version 5 AT&T UNIX";
712 break;
713 case(ATT_v6):
714 p = "Version 6 AT&T UNIX";
715 break;
716 case(ATT_v7):
717 p = "Version 7 AT&T UNIX";
718 break;
719 case(ATT_32v):
720 p = "Version 32V AT&T UNIX";
721 break;
722 case(ATT_V1):
723 p = "AT&T System V.1 UNIX";
724 break;
725 case(ATT_V2):
726 p = "AT&T System V.2 UNIX";
727 break;
728 case(ATT_V3):
729 p = "AT&T System V.3 UNIX";
730 break;
731 case(ATT_V4):
732 p = "AT&T System V.4 UNIX";
733 break;
734 default:
735 p = "AT&T UNIX";
736 break;
737 }
738
739 return(p);
740 }
741
742
743 size_t
744 mdoc_macro2len(int macro)
745 {
746
747 switch (macro) {
748 case(MDOC_Ad):
749 return(12);
750 case(MDOC_Ao):
751 return(12);
752 case(MDOC_An):
753 return(12);
754 case(MDOC_Aq):
755 return(12);
756 case(MDOC_Ar):
757 return(12);
758 case(MDOC_Bo):
759 return(12);
760 case(MDOC_Bq):
761 return(12);
762 case(MDOC_Cd):
763 return(12);
764 case(MDOC_Cm):
765 return(10);
766 case(MDOC_Do):
767 return(10);
768 case(MDOC_Dq):
769 return(12);
770 case(MDOC_Dv):
771 return(12);
772 case(MDOC_Eo):
773 return(12);
774 case(MDOC_Em):
775 return(10);
776 case(MDOC_Er):
777 return(12);
778 case(MDOC_Ev):
779 return(15);
780 case(MDOC_Fa):
781 return(12);
782 case(MDOC_Fl):
783 return(10);
784 case(MDOC_Fo):
785 return(16);
786 case(MDOC_Fn):
787 return(16);
788 case(MDOC_Ic):
789 return(10);
790 case(MDOC_Li):
791 return(16);
792 case(MDOC_Ms):
793 return(6);
794 case(MDOC_Nm):
795 return(10);
796 case(MDOC_No):
797 return(12);
798 case(MDOC_Oo):
799 return(10);
800 case(MDOC_Op):
801 return(14);
802 case(MDOC_Pa):
803 return(32);
804 case(MDOC_Pf):
805 return(12);
806 case(MDOC_Po):
807 return(12);
808 case(MDOC_Pq):
809 return(12);
810 case(MDOC_Ql):
811 return(16);
812 case(MDOC_Qo):
813 return(12);
814 case(MDOC_So):
815 return(12);
816 case(MDOC_Sq):
817 return(12);
818 case(MDOC_Sy):
819 return(6);
820 case(MDOC_Sx):
821 return(16);
822 case(MDOC_Tn):
823 return(10);
824 case(MDOC_Va):
825 return(12);
826 case(MDOC_Vt):
827 return(12);
828 case(MDOC_Xr):
829 return(10);
830 default:
831 break;
832 };
833 return(0);
834 }