J_Misc.c
J_Error_t jGetMethod(J_Class* jc,J_UtfString name,J_UtfString desc,
					 J_Class** vc,J_ClassMethods** method){
  J_UtfString mname, mdesc;
  uint32_t    i, n;
  
 /* Initially null */
  *method = NULL;
  n = jc->numberSuperClasses;

/* printf("\tSearch: %s%s\n",name.str,desc.str); */
 
  while(1){
	for(i=0;i<jc->methodsCount;i++){
	  *method = &jc->methods[i];
	  mname = jGetUtfString(jc,(*method)->nameIdx);
	  mdesc = jGetUtfString(jc,(*method)->descrIdx);
//printf("\t\tcheck: %s%s <-> %s%s\n",mname.str,mdesc.str,name.str,desc.str);
	  if((name.len==mname.len) && (desc.len==mdesc.len) &&
		 !strncmp(name.str,mname.str,name.len) &&
		 !strncmp(desc.str,mdesc.str,desc.len)){
		if(vc){
		 //printf("*vc=%x\n",*vc);
		  *vc = jc;
/* CLASS_INFO((*vc)); printf("---> FOUND <---\n"); */
		}
	   return EOK;
	  }
	}

   /* not a virtual lookup or no superclass */
/* 	if(!vc || (n==0)) break; */
	if(!vc || !jc->numberSuperClasses) break;
	n--;

   /* lookup in superclass */
	if(jc->superClass) jc = jc->superClass;
	
/* { */
/*  J_UtfString tmp = jGetClassName(jc,jc->thisClassIdx);  */
/*  printf("Seek %s%s in superclass: %s !\n",name.str,desc.str,tmp.str); */
/* } */
	
  }

  return EMETHODNOTFOUND;
}
/**  
 *  Get method in class by signature
 */
Get method in class by signature
Get method in class by signature
J_Error_t jGetMethod(J_Class* jc,J_UtfString name,J_UtfString desc,
					 J_Class** vc,J_ClassMethods** method){
  J_UtfString mname, mdesc;
  uint32_t    i, n;
  *method = NULL;
  n = jc->numberSuperClasses;
  while(1){
	for(i=0;i<jc->methodsCount;i++){
	  *method = &jc->methods[i];
	  mname = jGetUtfString(jc,(*method)->nameIdx);
	  mdesc = jGetUtfString(jc,(*method)->descrIdx);
	  if((name.len==mname.len) && (desc.len==mdesc.len) &&
		 !strncmp(name.str,mname.str,name.len) &&
		 !strncmp(desc.str,mdesc.str,desc.len)){
		if(vc){
		  *vc = jc;
		}
	   return EOK;
	  }
	}
	if(!vc || !jc->numberSuperClasses) break;
	n--;
	if(jc->superClass) jc = jc->superClass;
  }
  return EMETHODNOTFOUND;
}
J_Error_t jGetMethod ( J_Class * jc , J_UtfString name , J_UtfString desc , J_Class * * vc , J_ClassMethods * * method ) { J_UtfString mname , mdesc ; uint32_t i , n ; * method = NULL ; n = jc -> numberSuperClasses ; while ( 1 ) { for ( i = 0 ; i < jc -> methodsCount ; i ++ ) { * method = & jc -> methods [ i ] ; mname = jGetUtfString ( jc , ( * method ) -> nameIdx ) ; mdesc = jGetUtfString ( jc , ( * method ) -> descrIdx ) ; if ( ( name . len == mname . len ) && ( desc . len == mdesc . len ) && ! strncmp ( name . str , mname . str , name . len ) && ! strncmp ( desc . str , mdesc . str , desc . len ) ) { if ( vc ) { * vc = jc ; } return EOK ; } } if ( ! vc || ! jc -> numberSuperClasses ) break ; n -- ; if ( jc -> superClass ) jc = jc -> superClass ; } return EMETHODNOTFOUND ; }
Get method in class by signature
Get method in class by signature
/* Initially null */ /* printf("\tSearch: %s%s\n",name.str,desc.str); */ //printf("\t\tcheck: %s%s <-> %s%s\n",mname.str,mdesc.str,name.str,desc.str); //printf("*vc=%x\n",*vc); /* CLASS_INFO((*vc)); printf("---> FOUND <---\n"); */ /* not a virtual lookup or no superclass */ /* 	if(!vc || (n==0)) break; */ /* lookup in superclass */ /* { */ /*  J_UtfString tmp = jGetClassName(jc,jc->thisClassIdx);  */ /*  printf("Seek %s%s in superclass: %s !\n",name.str,desc.str,tmp.str); */ /* } */