-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLookES.c
55 lines (45 loc) · 1.2 KB
/
LookES.c
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
/**
* LSI-11 Linker
* íÏÄÕÌØ ÕÐÒÁ×ÌÅÎÉÑ ÐÏÍÏÄÕÌØÎÙÍÉ ÓÐÉÓËÁÍÉ ÇÌÏÂÁÌØÎÙÈ
**/
#include "LinkerDefs"
static ExtQue qpool[ EXTPOOLSIZE ];
static int Nelems = 0;
void ClrES(){ Nelems = 0; } /* îÁ ÓÌÕÞÁÊ ÎÅÏÞÉÝÁÅÍÏÇÏ bss */
/*
* çÌÁ×ÎÙÊ ×ÎÅÛÎÉÊ ÜÆÆÅËÔ: ÍÏÄÉÆÉËÁÃÉÑ ÓÔÒÕËÔÕÒÙ ÐÏ ÕËÁÚÁÔÅÌÀ ExtEnv
*/
void AddES( ExtSym, ExtEnv, LocNum )
Symbol *ExtSym;
Module *ExtEnv;
int LocNum;
{
ExtQue *ExtDesc, **SearchPtr;
if( ExtSym == NULL ) return; /* îÁ×ÅÒÎÏÅ, ÐÅÒÅÏÐÒÅÄÅÌÅÎÎÙÊ */
if( (ExtSym->Stype & EXTERN ) == 0 ) return; /* ìÏËÁÌØÎÙÊ */
if( Nelems == EXTPOOLSIZE ) Error(10);
ExtDesc = & qpool[ Nelems++ ];
ExtDesc->Enext = NULL;
ExtDesc->Eptr = ExtSym;
ExtDesc->Elocnum = LocNum;
for( SearchPtr = & ExtEnv->Mbegsym;
*SearchPtr != NULL;
SearchPtr = & (*SearchPtr)->Enext ) ;
*SearchPtr = ExtDesc;
}
/*
* ðÏÉÓË LocNum × ÓÐÉÓËÅ ÄÌÑ ÚÁÄÁÎÎÏÇÏ ExtEnv
*/
Symbol *LookES( LocNum, ExtEnv )
unsigned LocNum;
Module *ExtEnv;
{
ExtQue *Pquele;
for( Pquele = ExtEnv->Mbegsym;
Pquele != NULL;
Pquele = Pquele->Enext )
{
if( Pquele->Elocnum == LocNum ) return Pquele->Eptr;
}
return NULL;
}