Page 144 - DCAP507_SYSTEM_SOFTWARE
P. 144

System Software




                    Notes          char  sname[10];
                                   int  padd;
                                   int  plen;
                                   }  estab[20];
                                   struct  object_code
                                   {  char  code[15];
                                   int  add;
                                   }
                                   obcode[500];
                                   void  main()
                                   {
                                   FILE  *fp1,*fp2,*fp3;
                                   int
                                   i,j,n=0,num=0,inc=0,count=0,record=0,pstart,exeloc,start,textloc,loc,mloc[30],textlen,ml
                                   en[30],length,location,x,y;
                                   long  int  newadd;
                                   char  *add1,operation,lbl[10],input[10],label[30][10],address[10];
                                   clrscr();
                                   fp1=fopen("link1.c","r");
                                   fp2=fopen("link2.c","r");
                                   fp3=fopen("link3.c","w");
                                   rewind(fp1);
                                   rewind(fp2);
                                   rewind(fp3);
                                   while(!feof(fp2))
                                   {
                                   fscanf(fp2,"%s%s%d
                                   %d",estab[num].csect,estab[num].sname,&estab[num].padd,&estab[num].plen);
                                   num++;
                                   }  exeloc=estab[0].padd;
                                   loc=exeloc;
                                   start=loc;
                                   while(!feof(fp1))
                                   {
                                   fscanf(fp1,"%s",input);
                                   if(strcmp(input,"H")==0)
                                   {
                                   fscanf(fp1,"%s",input);
                                   for(i=0;i<num;i++)
                                   if(strcmp(input,estab[i].csect)==0)




          138                               LOVELY PROFESSIONAL UNIVERSITY
   139   140   141   142   143   144   145   146   147   148   149