Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/**********************************************************************
32
$Author: release $
33
$Date: 1998/01/17 15:55:46 $
34
$Revision: 1.1.1.1 $
35
$Log: aldefs.c,v $
36
 * Revision 1.1.1.1  1998/01/17  15:55:46  release
37
 * First version to be checked into rolling release.
38
 *
39
 * Revision 1.1  1995/04/06  10:44:05  currie
40
 * Initial revision
41
 *
42
***********************************************************************/
43
 
44
 
45
 
46
#include "config.h"
47
#include "common_types.h"
48
#include "installglob.h"
49
#include "basicread.h"
50
#include "messages_c.h"
51
 
52
#include "aldefs.h"
53
 
54
#define max(x,y) ((x)>(y)) ? (x) : (y)
55
 
56
 
57
/* The alignment definitions form a set of simultaneous equations
58
   of the form
59
 
60
     a1 = f1(a1,a2 .. an)
61
     a2 = f2(a1,a2 ... an)
62
     ...
63
 
64
   The functions f1 f2 etc. are formed entirely from f_alignment,
65
   which takes a shape and delivers an alignment, and unite_sets.
66
   f_alignment provides constants. Since the representation of
67
   alignments must be a homomorphism of sets under unite_sets, and
68
   since any program contains a finite number of basic alignments,
69
   these equations can be solved by iterating unite_sets until
70
   no further change occurs. Unite_sets is represented here by max.
71
*/
72
 
73
/* PROCEDURES */
74
 
75
void process_aldefs
76
    PROTO_Z ()
77
{
78
  aldef * my_aldef;
79
  int changed; /* records whether a change has been made */
80
  int complete;
81
 
82
 
83
  do  /* iterate max until no change */
84
   {
85
     my_aldef = top_aldef;
86
     changed = 0;
87
     complete = 1;
88
     while (my_aldef != (aldef *)0)
89
      {
90
        switch (my_aldef -> al.al_n)
91
         {
92
           case 1: break;
93
           case 2: {
94
                     alignment a1;
95
                     alignment a2;
96
                     a2 = my_aldef -> al.al_val.al_join.b;
97
                     a1 = my_aldef -> al.al_val.al_join.a;
98
                     if (a1->al.al_n == 1 && a2->al.al_n == 1)
99
                      {
100
                        my_aldef -> al.al_n = 1;
101
                        my_aldef -> al.al_val.al =
102
                            max(a1->al.al_val.al, a2->al.al_val.al);
103
                        changed = 1;
104
                      }
105
                     else
106
                        complete = 0;
107
                     break;
108
                   };
109
	   case 3: {
110
		     alignment a1;
111
                     a1 = my_aldef -> al.al_val.al_join.a;
112
                     if (a1->al.al_n == 1)
113
                      {
114
                        my_aldef -> al.al_n = 1;
115
                        my_aldef -> al.al_val.al = a1->al.al_val.al;
116
                        changed = 1;
117
                      }
118
                     else
119
                        complete = 0;
120
                     break;
121
		   };
122
           default: failer(ILLEGAL_ALIGNMENT);
123
         };
124
        my_aldef = my_aldef -> next_aldef;
125
      };
126
   } while (changed) ;
127
 
128
  if (!complete)
129
    failer(INCOMPLETE_ALIGNMENT_EQS);
130
  return;
131
}