Commit | Line | Data |
---|---|---|
9e8e5516 C |
1 | /* pe_cmp.c - compare two presentation elements */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/psap/RCS/pe_cmp.c,v 7.1 91/02/22 09:36:10 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/psap/RCS/pe_cmp.c,v 7.1 91/02/22 09:36:10 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: pe_cmp.c,v $ | |
12 | * Revision 7.1 91/02/22 09:36:10 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.0 89/11/23 22:13:01 mrose | |
16 | * Release 6.0 | |
17 | * | |
18 | */ | |
19 | ||
20 | /* | |
21 | * NOTICE | |
22 | * | |
23 | * Acquisition, use, and distribution of this module and related | |
24 | * materials are subject to the restrictions of a license agreement. | |
25 | * Consult the Preface in the User's Manual for the full terms of | |
26 | * this agreement. | |
27 | * | |
28 | */ | |
29 | ||
30 | ||
31 | /* LINTLIBRARY */ | |
32 | ||
33 | #include <stdio.h> | |
34 | #include "psap.h" | |
35 | ||
36 | /* \f */ | |
37 | ||
38 | int pe_cmp (p, q) | |
39 | register PE p, | |
40 | q; | |
41 | { | |
42 | register int i; | |
43 | ||
44 | if (p == NULLPE) | |
45 | return (q ? 1 : 0); | |
46 | if (q == NULLPE | |
47 | || p -> pe_class != q -> pe_class | |
48 | || p -> pe_form != q -> pe_form | |
49 | || p -> pe_id != q -> pe_id) | |
50 | return 1; | |
51 | ||
52 | /* XXX: perhaps compare pe_context ??? */ | |
53 | ||
54 | switch (p -> pe_form) { | |
55 | case PE_FORM_ICONS: | |
56 | if (p -> pe_ilen != q -> pe_ilen) | |
57 | return 1; | |
58 | /* else fall */ | |
59 | case PE_FORM_PRIM: | |
60 | if (i = p -> pe_len) { | |
61 | if (i != q -> pe_len || PEDcmp (p -> pe_prim, q -> pe_prim, i)) | |
62 | return 1; | |
63 | } | |
64 | else | |
65 | if (q -> pe_len) | |
66 | return 1; | |
67 | return 0; | |
68 | ||
69 | case PE_FORM_CONS: | |
70 | for (p = p -> pe_cons, q = q -> pe_cons; | |
71 | p; | |
72 | p = p -> pe_next, q = q -> pe_next) | |
73 | if (pe_cmp (p, q)) | |
74 | return 1; | |
75 | return (q ? 1 : 0); | |
76 | ||
77 | default: /* XXX */ | |
78 | return 1; | |
79 | } | |
80 | } |