File: APEQC.c

package info (click to toggle)
qepcad 1.74%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,828 kB
  • sloc: ansic: 27,242; cpp: 2,995; makefile: 1,285; perl: 91
file content (80 lines) | stat: -rw-r--r-- 2,023 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*======================================================================
                      APEQC(c,k,P)

Apply equational constraints.

Inputs
   c : a cell over which a stack has just been constructed.
   k : the level of c.
   P : the list of projection factors.

Output
   None.

Effect
   If there are no (k+1)-level constraints nothing is done.
   Otherwise each cell of the stack over c which fails to satisfy 
   each k-level constraint has its truth value set to FALSE and its 
   HOWTV field set to BYEQC.
======================================================================*/
#include "qepcad.h"

void QepcadCls::APEQC(Word c, Word k, Word P)
{
        Word c1,E,E1,E11,Ep,Ep1,i,j,m,M,Mp,S,t,Ps,p;

Step1: /* Get (k+1)-level equational constraints, if none, return. */
	E = LELTI(GVEQNCONST,k+1);
	if (E == NIL) return;

Step2: /* Get the stack over c. */
	S = LELTI(c,CHILD);

Step3: /* Get the next cell in stack with undetermined truth value. */
	if (S != NIL)
	   ADV(S,&c1,&S);
	else
	   goto Return;
	t = LELTI(c1,TRUTH);
	if (t != UNDET)
	   goto Step3;

Step4: /* Get the signature list of the cell. */
	M = LELTI(c1,SIGNPF);

Step5: /* Initialize the constraint list. */
	Ep = E;

Step6: /* Get the next constraint, if any, and initialize it;*/
       /* else return. */
	if (Ep == NIL)
	  goto Step3;
	else {
	  ADV(Ep,&E1,&Ep);
	  Ep1 = E1; }
	
Step7: /* Get the level and index of the next element of the constraint, 
if any; else set truth value of cell to FALSE and return for next cell. */
	if (Ep1 == NIL) {
	  SLELTI(c1,TRUTH,FALSE);
	  SLELTI(c1,HOWTV,BYEQC);
	  if (k < GVNFV) GVEQN2A = SUNION(GVEQN2A,LIST1(E));
	  goto Step3; }
	else {
	  ADV(Ep1,&E11,&Ep1);
	  i = SECOND(E11);
	  j = THIRD(E11); }

Step8: /* Check whether P_i,j is zero in c1. */
	Mp = LELTI(M,k + 2 - i);
	Ps = LELTI(P,i);
	while (Mp != NIL) {
	  ADV(Mp,&m,&Mp);
	  ADV(Ps,&p,&Ps);
	  if (m == 0 && THIRD(LELTI(p,PO_LABEL)) == j)
	    goto Step6; }
	goto Step7;
	
Return: /* Prepare for return. */
        return;
}