Subversion Repositories tendra.SVN

Rev

Rev 2 | 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
#include "config.h"
32
#include "common_types.h"
33
#include "tags.h"
34
#include "externs.h"
35
#include "expmacs.h"
36
#include "shapemacs.h"
37
#include "exp.h"
38
#include "basicread.h"
39
#include "flags.h"
40
#include "table_fns.h"
41
#include "installglob.h"
42
#include "check.h"
43
#include "glopt.h"
44
 
45
 
46
/*
47
  disabled temporarily - this function replaces calls to the 
48
  strcpy function with a direct mem -> mem copy.
49
*/
50
 
51
 
52
void glopt
53
    PROTO_N ( ( dp ) )
54
    PROTO_T ( dec *dp )
55
{
56
#if 0
57
  if (!strcmp(dp -> dec_u.dec_val.dec_id, "strcpy"))
58
  {
59
    exp i = dp -> dec_u.dec_val.dec_exp;
60
    exp t = pt(i);
61
    if (t == nilexp)
62
      return;
63
 
64
    while (1)
65
    {
66
      if (!last(t) && !last(bro(t)) && last(bro(bro(t))) &&
67
	  name(bro(bro(bro(t)))) == apply_tag &&
68
	  son(bro(bro(bro(t)))) == t){
69
	exp dest = bro(t);
70
	exp source = bro(dest);
71
 
72
	if (name(source) == name_tag && isglob(son(source)) &&
73
	    isvar(son(source)) && no(son(source)) == 1){
74
	  dec * source_dec = brog(son(source));
75
	  if (!source_dec -> dec_u.dec_val.extnamed &&
76
	      son(source_dec -> dec_u.dec_val.dec_exp) != nilexp){
77
	    exp source_def = son(son(source));
78
	    shape sha = sh(source_def);
79
	    if (name(source_def) == string_tag &&
80
		ptno(source_def) == 8){
81
	      char * s = nostr(source_def);
82
	      int n, j;
83
	      int l = shape_size(sha) / 8;
84
	      for (j=0; j < l && s[j] != 0; ++j);
85
	      if (j < l){
86
		exp q;
87
		exp to_change = bro(source);
88
		exp idsc = getexp(sh(bro(source)), nilexp, 0,
89
				  dest, nilexp,
90
				  0, 2, ident_tag);
91
		exp n1 = getexp(sh(dest), nilexp, 0, idsc,
92
				nilexp, 0, 0, name_tag);
93
		exp n2 = getexp(sh(dest), nilexp, 0, idsc, n1,
94
				0, 0, name_tag);
95
		exp_list el;
96
 
97
		pt(idsc) = n2;
98
 
99
		q = f_assign(n1, f_contents(sha, source));
100
		el.start = q;
101
		el.end = q;
102
		el.number = 1;
103
		q = f_sequence(el, n2);
104
		clearlast(dest);
105
		bro(dest) = q;
106
		setfather(idsc, q);
107
		replace(to_change, idsc, idsc);
108
		t = pt(i);
109
	      }
110
	    }
111
	  }
112
	}
113
      }
114
      if (pt(t) == nilexp)
115
	return;
116
      t = pt(t);
117
    };
118
  };
119
#endif
120
  return;
121
}
122
 
123
 
124
 
125
 
126
 
127