From: ishmal Date: Tue, 20 Jun 2006 21:23:20 +0000 (+0000) Subject: add alternate xml output to dep file X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=afbb6b2be4d535a9c083df878711cf0cbeb9bf18;p=inkscape.git add alternate xml output to dep file --- diff --git a/src/deptool.cpp b/src/deptool.cpp index cf58a7902..a5e4f9058 100644 --- a/src/deptool.cpp +++ b/src/deptool.cpp @@ -282,7 +282,7 @@ private: /** * */ - bool saveDepFile(); + bool saveDepFile(bool doXml); /** * @@ -996,7 +996,7 @@ bool DepTool::run() return false; if (!generateDependencies()) return false; - saveDepFile(); + saveDepFile(false); saveRefFile(true); return true; } @@ -1076,7 +1076,7 @@ bool DepTool::saveFileList() * This is the main product. This file lists the Include directives, * the Object list, and the dependency list. */ -bool DepTool::saveDepFile() +bool DepTool::saveDepFile(bool doXml) { time_t tim; time(&tim); @@ -1086,76 +1086,168 @@ bool DepTool::saveDepFile() { trace("cannot open 'make.dep' for writing"); } - fprintf(f, "########################################################\n"); - fprintf(f, "## File: make.dep\n"); - fprintf(f, "## Generated by DepTool at :%s", ctime(&tim)); - fprintf(f, "########################################################\n"); + if (doXml) + { + fprintf(f, "\n"); + fprintf(f, "\n"); + fprintf(f, "\n"); + fprintf(f, "\n"); - fprintf(f, "\n\n"); + fprintf(f, "\n\n"); - fprintf(f, "########################################################\n"); - fprintf(f, "## I N C L U D E\n"); - fprintf(f, "########################################################\n"); - fprintf(f, "DEPTOOL_INCLUDE ="); + fprintf(f, "\n"); + fprintf(f, "\n"); + fprintf(f, "\n"); - std::vector::iterator inciter; - for (inciter=directories.begin() ; inciter!=directories.end() ; inciter++) - { - fprintf(f, " \\\n"); - String dirname = *inciter; - fprintf(f, "-I%s", dirname.c_str()); - } + std::vector::iterator inciter; + for (inciter=directories.begin() ; inciter!=directories.end() ; inciter++) + { + String dirname = *inciter; + fprintf(f, " \n", dirname.c_str()); + } - fprintf(f, "\n\n\n"); - fprintf(f, "########################################################\n"); - fprintf(f, "## O B J E C T S\n"); - fprintf(f, "########################################################\n"); - fprintf(f, "DEPTOOL_OBJECTS ="); + fprintf(f, "\n"); + fprintf(f, "\n\n\n"); + fprintf(f, "\n"); + fprintf(f, "\n"); - std::map::iterator oiter; - for (oiter=allFiles.begin() ; oiter!=allFiles.end() ; oiter++) - { - FileRec *frec = oiter->second; - if (frec->type == FileRec::CFILE) + std::map::iterator oiter; + for (oiter=allFiles.begin() ; oiter!=allFiles.end() ; oiter++) { - fprintf(f, " \\\n"); - String fname = frec->path; - if (fname.size()>0) - fname.append("/"); - fname.append(frec->baseName); - fname.append(".o"); - fprintf(f, "%s", fname.c_str()); + FileRec *frec = oiter->second; + if (frec->type == FileRec::CFILE) + { + String fname = frec->path; + if (fname.size()>0) + fname.append("/"); + fname.append(frec->baseName); + fname.append(".o"); + fprintf(f, " \n", fname.c_str()); + } } - } - fprintf(f, "\n\n\n"); - fprintf(f, "########################################################\n"); - fprintf(f, "## D E P E N D E N C I E S\n"); - fprintf(f, "########################################################\n"); - std::map::iterator iter; - for (iter=depFiles.begin() ; iter!=depFiles.end() ; iter++) + fprintf(f, "\n"); + fprintf(f, "\n\n\n"); + fprintf(f, "\n"); + fprintf(f, "\n\n"); + std::map::iterator iter; + for (iter=depFiles.begin() ; iter!=depFiles.end() ; iter++) + { + FileRec *frec = iter->second; + if (frec->type == FileRec::OFILE) + { + String fname = iter->first; + fprintf(f, "\n", fname.c_str()); + std::map::iterator citer; + for (citer=frec->files.begin() ; citer!=frec->files.end() ; citer++) + { + String cfname = citer->first; + fprintf(f, " \n", cfname.c_str()); + } + fprintf(f, "\n\n"); + } + } + + fprintf(f, "\n"); + fprintf(f, "\n\n\n"); + fprintf(f, "\n"); + fprintf(f, "\n"); + } + else // ######### !XML { - FileRec *frec = iter->second; - if (frec->type == FileRec::OFILE) + fprintf(f, "########################################################\n"); + fprintf(f, "## File: make.dep\n"); + fprintf(f, "## Generated by DepTool at :%s", ctime(&tim)); + fprintf(f, "########################################################\n"); + + fprintf(f, "\n\n"); + + fprintf(f, "########################################################\n"); + fprintf(f, "## I N C L U D E\n"); + fprintf(f, "########################################################\n"); + fprintf(f, "DEPTOOL_INCLUDE ="); + + std::vector::iterator inciter; + for (inciter=directories.begin() ; inciter!=directories.end() ; inciter++) + { + fprintf(f, " \\\n"); + String dirname = *inciter; + fprintf(f, "-I%s", dirname.c_str()); + } + + fprintf(f, "\n\n\n"); + fprintf(f, "########################################################\n"); + fprintf(f, "## O B J E C T S\n"); + fprintf(f, "########################################################\n"); + fprintf(f, "DEPTOOL_OBJECTS ="); + + std::map::iterator oiter; + for (oiter=allFiles.begin() ; oiter!=allFiles.end() ; oiter++) { - String fname = iter->first; - fprintf(f, "%s:", fname.c_str()); - std::map::iterator citer; - for (citer=frec->files.begin() ; citer!=frec->files.end() ; citer++) + FileRec *frec = oiter->second; + if (frec->type == FileRec::CFILE) { - String cfname = citer->first; fprintf(f, " \\\n"); - fprintf(f, "\t%s", cfname.c_str()); + String fname = frec->path; + if (fname.size()>0) + fname.append("/"); + fname.append(frec->baseName); + fname.append(".o"); + fprintf(f, "%s", fname.c_str()); } - fprintf(f, "\n\n\n"); } - } - fprintf(f, "\n\n\n"); - fprintf(f, "########################################################\n"); - fprintf(f, "## E N D\n"); - fprintf(f, "########################################################\n"); + + fprintf(f, "\n\n\n"); + fprintf(f, "########################################################\n"); + fprintf(f, "## D E P E N D E N C I E S\n"); + fprintf(f, "########################################################\n"); + std::map::iterator iter; + for (iter=depFiles.begin() ; iter!=depFiles.end() ; iter++) + { + FileRec *frec = iter->second; + if (frec->type == FileRec::OFILE) + { + String fname = iter->first; + fprintf(f, "%s:", fname.c_str()); + std::map::iterator citer; + for (citer=frec->files.begin() ; citer!=frec->files.end() ; citer++) + { + String cfname = citer->first; + fprintf(f, " \\\n"); + fprintf(f, "\t%s", cfname.c_str()); + } + fprintf(f, "\n\n\n"); + } + } + + fprintf(f, "\n\n\n"); + fprintf(f, "########################################################\n"); + fprintf(f, "## E N D\n"); + fprintf(f, "########################################################\n"); + } fclose(f); @@ -1188,7 +1280,7 @@ bool DepTool::saveRefFile(bool doXml) fprintf(f, "## Note: The metric is the 'distance' of inclusion from\n"); fprintf(f, "## the given file.\n"); fprintf(f, "########################################################\n"); - fprintf(f, "--!>\n"); + fprintf(f, "-->\n"); fprintf(f, "\n\n"); @@ -1216,7 +1308,7 @@ bool DepTool::saveRefFile(bool doXml) fprintf(f, "########################################################\n"); fprintf(f, "## E N D\n"); fprintf(f, "########################################################\n"); - fprintf(f, "--!>\n"); + fprintf(f, "-->\n"); } else //######### not xml