Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | 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
/* 80x86/overlap.c */
32
 
33
/**********************************************************************
34
$Author: release $
35
$Date: 1998/01/17 15:55:52 $
36
$Revision: 1.1.1.1 $
37
$Log: overlap.c,v $
38
 * Revision 1.1.1.1  1998/01/17  15:55:52  release
39
 * First version to be checked into rolling release.
40
 *
41
 * Revision 1.2  1995/01/30  12:56:41  pwe
42
 * Ownership -> PWE, tidy banners
43
 *
44
 * Revision 1.1  1994/10/27  14:15:22  jmf
45
 * Initial revision
46
 *
47
 * Revision 1.1  1994/07/12  14:39:22  jmf
48
 * Initial revision
49
 *
50
**********************************************************************/
51
 
52
 
53
#include "config.h"
54
#include "common_types.h"
55
#include "tags.h"
56
#include "expmacs.h"
57
#include "exp.h"
58
 
59
#include "overlap.h"
60
 
61
/* PROCEDURES */
62
 
63
/* false if a value of shape sha at
64
   w1 cannot overlap with one at w2.
65
   true if it does or might overlap.
66
   only used by move, so we can assume
67
   that w1 and w2 are addressable.
68
*/
69
int might_overlap
70
    PROTO_N ( (sha, w1, w2) )
71
    PROTO_T ( shape sha X where w1 X where w2 )
72
{
73
  exp e1 = w1.where_exp;
74
  exp e2 = w2.where_exp;
75
  exp i1, i2;
76
  int off1, off2, sz;
77
 
78
  if (name(e1) != name_tag) {
79
    if (name(e2) == name_tag && iscaonly(son(e2)))
80
      return 0;
81
    return 1;
82
  };
83
 
84
  if (name(e2) != name_tag) {
85
    if (name(e1) == name_tag && iscaonly(son(e1)))
86
      return 0;
87
    return 1;
88
  };
89
 
90
	/* both are name_tags */
91
  i1 = son(e1);
92
  i2 = son(e2);
93
  if (isglob(i1)) {
94
    if (i1 != i2)
95
      return 0;
96
    sz = shape_size(sha);
97
    off1 = no(e1) + w1.where_off;
98
    off2 = no(e2) + w2.where_off;
99
    if (off1 <= off2 && (off1 + sz) > off2)
100
      return 1;
101
    if (off2 <= off1 && (off2 + sz) > off1)
102
      return 1;
103
    return 0;
104
  };
105
  if (isglob(i2))
106
    return 0;
107
 
108
	/* both are local */
109
  if (ptno(i1) != ptno(i2))
110
    return 0;
111
 
112
  sz = shape_size(sha);
113
  off1 = no(e1) + no(i1) + w1.where_off;
114
  off2 = no(e2) + no(i2) + w2.where_off;
115
  if (off1 <= off2 && (off1 + sz) > off2)
116
    return 1;
117
  if (off2 <= off1 && (off2 + sz) > off1)
118
    return 1;
119
  return 0;
120
 
121
}