//生成函数体 private void genFunctionToHead(FileStream fs, FunctionsManager functionManager) { for (int i = 0; i < functionManager.getElementCount(); i++) { FunctionElement fun = (FunctionElement)functionManager.getElement(i); String strParams = " ("; ArrayList paramList = (ArrayList)fun.getValue(); for (int j = 0; j < paramList.Count; j++) { strParams += "p" + j; if (j < paramList.Count - 1) { strParams += ","; } } strParams += ");"; IOUtil.writeTextLine(fs, "host " + fun.name + strParams); } }
//合并 public void combine(FunctionsManager srcFunctionsManager) { short len = (short)srcFunctionsManager.getElementCount(); for (int i = 0; i < len; i++) { FunctionElement srcFunctionElement = (FunctionElement)srcFunctionsManager.getElement(i); //检查相同 FunctionElement localFunctionElement = null; bool findSame=false; for (int j = 0; j < getElementCount(); j++) { localFunctionElement = (FunctionElement)getElement(j); if (localFunctionElement.equalsFunctionElement(srcFunctionElement)) { findSame = true; break; } } //处理 if (!findSame)//将自身合并入 { srcFunctionElement.combineTo(this); } else { localFunctionElement.commet = srcFunctionElement.commet+"";//更新注释 srcFunctionElement.changeUseInfor(localFunctionElement);//转移引用 } } }