Menu

Using jcf with headconv

2006-01-28
2013-05-23
  • Bob Cousins

    Bob Cousins - 2006-01-28

    Hi everyone,

    I am hoping to do some work on improving headconv (tool for converting C header files to Delphi), and I wanted to sound out some ideas. It would be great to have the output from headconv passed through jcf.

    But then I thought, headconv will need to tokenise the C source code, translate to Delphi, then output as text, then input to jcf... why not pass the tokens to jcf and have it output text?

    I have just downloaded jcf source and am looking through it. I guess there is no interface to directly pass in a parse tree - so the question is could this be done?

    It might be a lot easier to keep the tools completely separate. But as there is good code in jcf to do formatting, it would be nice to reuse it if there was an easy way to do it.

    It's just a thought right now, I would like to hear what you think.

    Cheers

     
    • Anthony Steele

      Anthony Steele - 2006-02-07

      Hi Bob

      There is no interface directly to the parse tree, since this has not been needed before. The text is converted into a token list and then a parse tree before formatting.

      The tokens are kept in a class that is internal to the formatter, so this data cannot be just passed in from another tool that works differently, you'd still have to make a list of all the tokens.

      I wonder if there is a pressing need to do this – would using the formatter as is take too long? Parsing from text up again may seem inefficient, but if it doesn't take too long to execute, it may be simplest to use this existing interface. You could either call the formatter's main formatting routine to format code in a string as is done in some of the test cases, or invoke the command line formatter as an external program to work on a file.

      Converted header files can be large sometimes. How large are you anticipating these generated files being? The formatter is generally fast. Obviously it takes longer on large input files, but some of the performance bottlenecks found on large files were eliminated thanks to Adem Baba.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.