Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Parsing the include-structure of a cpp-project

Parsing the include-structure of a cpp-project

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structuresjsontutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tomerland
    wrote on last edited by
    #1

    dear gurus, i want to parse all h-files (may be also cpp-files) of my project to get out the dependency-graph. Do you have some idea how to do it? Are there any working components available? Thanks

    M 1 Reply Last reply
    0
    • T Tomerland

      dear gurus, i want to parse all h-files (may be also cpp-files) of my project to get out the dependency-graph. Do you have some idea how to do it? Are there any working components available? Thanks

      M Offline
      M Offline
      Matthew Faithfull
      wrote on last edited by
      #2

      I guess the source to do this must be available as part of doxygen, the Open Source C++ documentation generator available on Sourceforge and probably elsewhere. It obviously does a lot more than just a dependency-graph though so it might be more trouble to pull out what you need than to write it from scratch. You could look into starting out with Flex and Bison ( Windows versions of Unix Lex and Yacc also available as C++ sources ) to generate a simple parser that only processes #includes. On the other hand if you have VS2005 or better you could just turn on Show Includes in the Advanced options for your project and you'll get a build output window filled wiht the entire inclusion hierarchy. Makes you appreciate how fast even MS compilers really are when you see the hundreds of files that get included even in a relatively simple project. :)

      "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

      T 1 Reply Last reply
      0
      • M Matthew Faithfull

        I guess the source to do this must be available as part of doxygen, the Open Source C++ documentation generator available on Sourceforge and probably elsewhere. It obviously does a lot more than just a dependency-graph though so it might be more trouble to pull out what you need than to write it from scratch. You could look into starting out with Flex and Bison ( Windows versions of Unix Lex and Yacc also available as C++ sources ) to generate a simple parser that only processes #includes. On the other hand if you have VS2005 or better you could just turn on Show Includes in the Advanced options for your project and you'll get a build output window filled wiht the entire inclusion hierarchy. Makes you appreciate how fast even MS compilers really are when you see the hundreds of files that get included even in a relatively simple project. :)

        "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

        T Offline
        T Offline
        Tomerland
        wrote on last edited by
        #3

        Thanks for your points. I already work with doxygen. It's really good. Unfortunately I have only a graphical output. What I now need is a "graph-like" output-structure which I can parse by myself to automate physical-design issues Kind regards

        M 1 Reply Last reply
        0
        • T Tomerland

          Thanks for your points. I already work with doxygen. It's really good. Unfortunately I have only a graphical output. What I now need is a "graph-like" output-structure which I can parse by myself to automate physical-design issues Kind regards

          M Offline
          M Offline
          Matthew Faithfull
          wrote on last edited by
          #4

          If you're already familiar with doxygen then I'd suggest perhaps building a modified version that outputs xml to a file of your choice in parallel to its normal output. That way you can keep the existing doxygen parsing. All you need to find is the points in the code where doxygen processes #includes, make sure you've got a reasonable version of msxml.dll in memory and the rest is a little bit of COM, some tables of tag strings and should hopefully be straight forward. Of course if you can architect it as some sort of plugin/addon module/patch for doxygen then you can contribute it back to the community and make the world a little better for all your hard work :-D

          "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

          T 1 Reply Last reply
          0
          • M Matthew Faithfull

            If you're already familiar with doxygen then I'd suggest perhaps building a modified version that outputs xml to a file of your choice in parallel to its normal output. That way you can keep the existing doxygen parsing. All you need to find is the points in the code where doxygen processes #includes, make sure you've got a reasonable version of msxml.dll in memory and the rest is a little bit of COM, some tables of tag strings and should hopefully be straight forward. Of course if you can architect it as some sort of plugin/addon module/patch for doxygen then you can contribute it back to the community and make the world a little better for all your hard work :-D

            "The secret of happiness is freedom, and the secret of freedom, courage." Thucydides (B.C. 460-400)

            T Offline
            T Offline
            Tomerland
            wrote on last edited by
            #5

            Unfortunately I'm only familiar with using the doxygen binary - not the source-code

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups