Beispiel #1
0
void list_var(SYM *sp, int i)
{
	TypeArray *ta;
	
		int     j;
        for(j = i; j; --j)
                lfs.printf("    ");
		if (sp->name->length()== 0)
			lfs.printf("%-10s =%06x ","<unnamed>",(unsigned int)sp->value.u);
		else {
			lfs.printf("%-10s =%06x",(char *)sp->name->c_str(),(unsigned int)sp->value.u);
			if (sp->tp)
				if (sp->tp->bit_width != -1)
					lfs.printf("  %d %d",sp->tp->bit_offset,sp->tp->bit_width);
		}
//			if (sp->IsPascal) ofs.printf("\tpascal ");
        if( sp->storage_class == sc_external)
                ofs.printf("\textern\t%s\n",(char *)sp->name->c_str());
        else if( sp->storage_class == sc_global )
                ofs.printf(";\tglobal\t%s\n",(char *)sp->name->c_str());
		put_typedef(sp->storage_class==sc_typedef);
        put_sc(sp->storage_class);
        put_ty(sp->tp);
        lfs.printf("\n");
        if(sp->tp == 0)
                return;
    if (sp->tp) {
  		if (sp->tp->type==bt_ifunc || sp->tp->type==bt_func) {
  			lfs.printf("\t\tParameters:\n\t\t\t");
  			ta = sp->GetProtoTypes();
  			ta->Print(&lfs);
  			if (ta)
  				delete ta;
			lfs.printf("Stack Space:\n\t\t");
			lfs.printf("Argbot: %d\n\t\t", sp->argbot);
			lfs.printf("Tmpbot: %d\n\t\t", sp->tempbot);
			lfs.printf("Stkspc: %d\n\t\t", sp->stkspace);
  		}
	  }
	  if (sp->tp) {
        if((sp->tp->type == bt_struct || sp->tp->type == bt_union || sp->tp->type==bt_class) &&
                sp->storage_class == sc_type)
                ListTable(&(sp->tp->lst),i+1);
    }
}
Beispiel #2
0
int TABLE::Find(std::string na,__int16 rettype, TypeArray *typearray, bool exact)
{
	SYM *thead, *first;
	int nn;
	TypeArray *ta;
	char namebuf[1000];
	int s1,s2,s3;
	std::string name;

  dfs.puts("</Find>\n");
  dfs.puts((char *)na.c_str());
  if (this==nullptr) {
    matchno = 0;
    return 0;
  }
	if (na.length()==0) {
	  dfs.printf("name is empty string\n");
		throw new C64PException(ERR_NULLPOINTER,1);
  }

	matchno = 0;
	if (this==&gsyms[0])
		thead = SYM::GetPtr(gsyms[hashadd((char *)na.c_str())].GetHead());
	else
		thead = SYM::GetPtr(head);
	first = thead;
//	while(thead != NULL) {
//	  lfs.printf("Ele:%s|\n", (char *)thead->name->c_str());
//	  thead = thead->GetNext();
// }
 thead = first;
	while( thead != NULL) {
//		dfs.printf((char *)"|%s|,|%s|\n",(char *)thead->name->c_str(),(char *)na.c_str());
    name = *thead->name;
		s1 = thead->name->compare(na);
		s2 = thead->name2->compare(na);
		s3 = thead->name3->compare(na);
//		dfs.printf("s1:%d ",s1);
//		dfs.printf("s2:%d ",s2);
//		dfs.printf("s3:%d\n",s3);
		if(((s1&s2)|(s1&s3)|(s2&s3))==0) {
		  dfs.printf("Match\n");
			match[matchno] = thead;
			matchno++;
			if (matchno > 98)
				break;
		
			if (exact) {
				ta = thead->GetProtoTypes();
				if (ta->IsEqual(typearray)) {
				  dfs.printf("Exact match");
				  ta->Print();
				  typearray->Print();
				  delete ta;
				  return 1;
				}
				ta->Print();
				delete ta;
			}
		}
    thead = thead->GetNextPtr();
    if (thead==first) {
      dfs.printf("Circular list.\n");
      throw new C64PException(ERR_CIRCULAR_LIST,1);
    }
  }
  dfs.puts("</Find>\n");
  return exact ? 0 : matchno;
}