pike.git/
src/
program.c
Branch:
Tag:
Non-build tags
All tags
No tags
1998-06-24
1998-06-24 04:56:46 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>
c0e446a857fa15f042838fbf0f818dc9471e4502 (
79
lines) (+
48
/-
31
)
[
Show
|
Annotate
]
Branch:
7.9
bugfix in ::
Rev: src/program.c:1.95
Rev: src/program.h:1.44
Rev: src/testsuite.in:1.116
4:
||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h"
-
RCSID("$Id: program.c,v 1.
94
1998/
05
/
25
19
:
00
:
37
grubba
Exp $");
+
RCSID("$Id: program.c,v 1.
95
1998/
06
/
24
04
:
56
:
46
hubbe
Exp $");
#include "program.h" #include "object.h" #include "dynamic_buffer.h"
1037:
p=np->inherits[e].prog; i=find_shared_string_identifier(name,p);
-
if(i==-1)
return
i;
+
if(i==-1)
+
{
+
i
=really_low_find_shared_string_identifier(name,p,1)
;
+
if(i==-1) return -1;
+
}
if(p->identifier_references[i].id_flags & ID_HIDDEN) return -1;
1839:
}
+
int really_low_find_shared_string_identifier(struct pike_string *name,
+
struct program *prog,
+
int see_static)
+
{
+
struct reference *funp;
+
struct identifier *fun;
+
int i,t;
+
for(i=0;i<(int)prog->num_identifier_references;i++)
+
{
+
funp = prog->identifier_references + i;
+
if(funp->id_flags & ID_HIDDEN) continue;
+
if(funp->id_flags & ID_HIDDEN)
+
if(!see_static)
+
continue;
+
fun = ID_FROM_PTR(prog, funp);
+
/* if(fun->func.offset == -1) continue; * Prototype */
+
if(!is_same_string(fun->name,name)) continue;
+
if(funp->id_flags & ID_INHERITED)
+
{
+
if(funp->id_flags & ID_PRIVATE) continue;
+
for(t=0; t>=0 && t<(int)prog->num_identifier_references; t++)
+
{
+
struct reference *funpb;
+
struct identifier *funb;
+
+
if(t==i) continue;
+
funpb=prog->identifier_references+t;
+
if(funpb->id_flags & (ID_HIDDEN|ID_STATIC)) continue;
+
if((funpb->id_flags & ID_INHERITED) && t<i) continue;
+
funb=ID_FROM_PTR(prog,funpb);
+
/* if(funb->func.offset == -1) continue; * prototype */
+
if(fun->name==funb->name) t=-10;
+
}
+
if(t < 0) continue;
+
}
+
return i;
+
}
+
return -1;
+
}
+
/* * lookup the number of a function in a program given the name in * a shared_string
1847:
struct program *prog) { int max,min,tst;
-
struct reference *funp;
+
struct identifier *fun; if(prog->flags & PROGRAM_FIXED)
1872:
min=tst+1; } }else{
-
int
i,t;
-
for(i=0;i<(int)prog->num
_
identifier
_
references;i++)
-
{
-
funp = prog->identifier
_
references + i;
-
if(funp->id
_
flags & ID
_
HIDDEN) continue;
-
fun = ID_FROM_PTR
(
prog, funp);
-
/* if(fun->func.offset == -1) continue; * Prototype */
-
if(!is_same_string(fun->
name,
name)) continue;
-
if(funp->id_flags & ID_INHERITED)
-
{
-
if(funp->id_flags & ID_PRIVATE) continue;
-
for(t=0; t>=0 && t<(int)
prog
->num_identifier_references; t++)
-
{
-
struct reference *funpb;
-
struct identifier *funb;
-
-
if(t==i) continue;
-
funpb=prog->identifier_references+t;
-
if(funpb->id_flags & (ID_HIDDEN|ID_STATIC)) continue;
-
if((funpb->id_flags & ID_INHERITED) && t<i) continue;
-
funb=ID_FROM_PTR(prog
,
funpb
);
-
/* if(funb->func.offset == -1) continue; * prototype */
-
if(fun->name==funb->name) t=-10;
+
return
really
_
low
_
find
_
shared
_
string
_
identifier
(name,prog,
0
);
}
-
if(t < 0) continue;
-
}
-
return i;
-
}
-
}
+
return -1; }