public void CheckDPDList(TObj tobj) { TObj objlist[] = tobj.getTObjList(); if (objlist == null) return; for (int i = 0; i < objlist.length; i++) { TObj tmpobj = objlist[i]; CheckDPDList(tmpobj); TDpd dpdlist[] = tmpobj.getTDpdList(); if (dpdlist == null) continue; for (int j = 0; j < dpdlist.length; j++) { TDpd tmpdpd = dpdlist[j]; if (tmpdpd == null) continue; if (tmpdpd.getType() == C_FUNCTION_CALL) { String dpd_name = tmpdpd.getName(); if (dpd_name.indexOf('(') > 0) { dpd_name = dpd_name.substring(0, dpd_name.indexOf('(')).trim(); } if (hfunname.containsKey(dpd_name)) { Integer val = (Integer) hfunname.get(dpd_name); int cnt = val.intValue() + 1; hfunname.put(dpd_name, new Integer(cnt)); // log.debug("push hash", dpd_name + ", count =" + cnt); } } } } }
public TObj getFind_MethodTObj(TObj parent_tobj, int line_seq) { if (parent_tobj == null) return null; try { TObj tobjList[] = parent_tobj.getTObjList(); if (tobjList == null) return null; int count = tobjList.length; for (int i = 0; i < count; i++) { int objType = tobjList[i].getType(); int is = tobjList[i].getTLocation().getStartLine(); int ie = tobjList[i].getTLocation().getEndLine(); if (objType == 510004 && is <= line_seq && line_seq <= ie) return tobjList[i]; TObj tobjSubList[] = tobjList[i].getTObjList(); if (tobjSubList != null) { TObj findTObj = getFind_MethodTObj(tobjList[i], line_seq); if (findTObj != null) return findTObj; } } } catch (Exception e) { System.out.println(e.getMessage()); } return null; }
public long generateGID(String prefix, TObj tobj) { String obj_name = tobj.getName(); if (tobj.getType() == C_FUNCTION_OBJECT) { if (obj_name.indexOf('(') > 0) { obj_name = obj_name.substring(0, obj_name.indexOf('(')).trim(); } obj_name = obj_name.trim(); int cnt = 0; if (hfunname.containsKey(obj_name)) { Integer val = (Integer) hfunname.get(obj_name); cnt = val.intValue(); } if (mainflag) { // || cnt > 0) { String str = new String(); str = filestr + "." + obj_name; tobj.setGID(str); return FileUtil.getGID("<EC>", str); } else if (submainflag) { // || cnt > 0) { String str = new String(); if (hsubmainname.containsKey(obj_name)) { str = obj_name; tobj.setGID(str); return FileUtil.getGID("<EC>", str); } else { str = filestr + "." + obj_name; tobj.setGID(str); return FileUtil.getGID("<EC>", str); } } else { String str = new String(); if (hStaticfun.containsKey(obj_name)) { str = filestr + "." + obj_name; } else str = obj_name; tobj.setGID(str); return FileUtil.getGID("<EC>", str); } } return 0L; }
public void CheckObjList(CM_SRC cm_src, TObj tobj) { TObj objlist[] = tobj.getTObjList(); if (objlist == null) return; for (int i = 0; i < objlist.length; i++) { TObj tmpobj = objlist[i]; CheckObjList(cm_src, tmpobj); String objname = tmpobj.getName(); String fullobjname = tmpobj.getName(); int idx; if ((idx = objname.indexOf('(')) > 0) { objname = objname.substring(0, idx).trim(); } if (tmpobj.getType() == C_FUNCTION_OBJECT) { tmpobj.setKeyValidation(100); if (objname.equals("main")) { mainflag = true; } else if (extern_main_flag(objname, fullobjname) == true) { mainflag = true; log.debug("extern find main", tmpobj.getName()); } else if (fullobjname.indexOf("(TPSVCINFO") > 0) { submainflag = true; if (!hsubmainname.containsKey(objname)) { Integer val = new Integer(0); hsubmainname.put(objname, val); } log.debug("find sub main", tmpobj.getName()); } else if (extern_sub_flag(objname, fullobjname) == true) { submainflag = true; if (!hsubmainname.containsKey(objname)) { Integer val = new Integer(0); hsubmainname.put(objname, val); } log.debug("extern find sub main", tmpobj.getName()); } else { if (!hfunname.containsKey(objname)) { // log.debug("push hash", objname); Integer val = new Integer(0); hfunname.put(objname, val); } } } if (tmpobj.getType() == C_FUNCTION_DECARE || tmpobj.getType() == C_FUNCTION_OBJECT) { TMeta mt[] = tmpobj.getTMetaList(); for (int k = 0; k < mt.length; k++) { if (mt[k].getName().equals("5100410")) { if (mt[k].getValue().startsWith("static ")) { hStaticfun.put(objname, objname); } } } } } }