Thread: codeform version 1.2.0 #2

  1. #16
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Quote Originally Posted by zacs7 View Post
    DWKS, perhaps look into the <pre></pre> tags and keep tabs?, Rather than converting them to spaces...?

    Think about it, its an extra 3 bytes per tab... It all adds up. Not to mention it makes the highlighted source easier to "cut & paste" while keeping its original formatting.

    Anywho just thought i'd comment.
    Actually right now codeform prints all whitespace verbatim into the output file. Any tabs, spaces, or newlines in your source file will also be in the output file.

    The HTML output format does indeed use <pre></pre> tags. (See the files rules/_html.)

    If you wanted to have tabs converted to spaces or vice versa you could either do it yourself with a separate program -- it's quite easy; I think I have at least five programs that do it -- or create rules that look like this:
    Code:
    =keyword
    <tab>::<space><space><space><space>:# converts tabs to spaces
    <space><space><space><space>:<tab>:# converts spaces to tabs
    Note that I don't know if that will work; keywords containing spaces might not match properly. (And codeform isn't on this computer so I can't test it.) It should however and if it doesn't just give me a shout.

    Comments are much appreciated.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  2. #17
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    You should make a CGI version to perhaps?

  3. #18
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Guess what? I was doing just that. If you'd signed up before the board crashed, I could link you to the thread, but alas it is gone. I wrote a Perl script which ran codeform on the remote server. It worked perfectly, but codeform was running as a priviledged user, opening up tons of security holes. Unfortunately there doesn't seem to be a user called nobody on that server. So I guess I could host codeform version 1.2.0 online, as it is called, but would it be a good idea? . . . .

    My only idea was to restrict the input file to, say, 32KB, to reduce the risk of buffer overruns. Codeform, as I mentioned, does not have any memory leaks when run through Valgrind, but it does have lots of "Invalid read"s. I don't know what those are but I'm guessing they're related to buffer overruns. Once I fix those I think I will host codeform online. We'll see.

    If you have a server that will run Perl scripts that can execute other programs which may or may not have buffer overruns, let me know.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #19
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I did sign-up before the board crashed I lost my account...

    Anywho, as you mentioned in the other thread perhaps link to standard-c functions ?

    And maybe something for the future: use anchors for user declared functions so you can 'skip' to their declarations, eg

    Code:
    <pre>
    
    void Foo(void);
    
    int main(void)
    {
    	<a href="#foo">Foo</a>();
    	return 0;
    }
    
    <a name="foo"></a>
    void Foo(void)
    {
    	return;
    }
    
    </pre>
    Sorry, I don't currently have access to a server , specially not one with, DuN-DUN-DUN PERL!:P
    Last edited by zacs7; 03-31-2007 at 06:18 PM.

  5. #20
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I did sign-up before the board crashed I lost my account...
    That's too bad. All I lost was 300 posts. You lost your join date etc . . .

    Anywho, as you mentioned in the other thread perhaps link to standard-c functions ?
    Actually I just did that really quickly . . . here's the gist of it.
    Code:
    linkfuncbb=[url=
    linkfuncba=]
    linkfunca=[/url]
    linkfuncurl=http://www.opengroup.org/pubs/online/7908799/xsh/
    
    =keyword
    atoi:$(linkfuncbb)$(linkfuncurl)atoi$(linkfuncba):$(linkfunca)
    printf:$(linkfuncbb)$(linkfuncurl)printf$(linkfuncba):$(linkfunca)
    (Highlighted with codeform. ) I still need to find a list of C functions, though. (Feel free to find one. :P) It's used like so:
    Code:
    $ codeform -f rules/c_1_vbb -f rules/clinkfunc
    And maybe something for the future: use anchors for user declared functions so you can 'skip' to their declarations, eg
    Code:
    <pre>
    
    void Foo(void);
    
    int main(void)
    {
    	<a href="#foo">Foo</a>();
    	return 0;
    }
    
    <a name="foo"></a>
    void Foo(void)
    {
    	return;
    }
    
    </pre>
    Unfortunately codeform is currently a single-pass parser. Doing something like that would be impossible. I plan to change it however.

    Sorry, I don't currently have access to a server , specially not one with, DuN-DUN-DUN PERL!:P
    I can find tons of free web hosts that support Perl, but none of them like me executing codeform from within the Perl script . . . not surprisingly.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #21
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I created a IRC bot a while ago, in the process I made a list of most of the standard C functions....

    See the attachment, I know it doesn't contain URLS, but its a start - and it does explain what each does. Perhaps you could add tooltips for the standard funcs instead (so it doesn't rely on the internet)

  7. #22
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Thanks for the list. I'll transform it into some codeform files as soon as I can (probably by tomorrow night). One to turn "printf" into
    Code:
    $(clinkfuncbb)$(clinkfuncurl)printf$(clinkfuncba)printf$(clinkfunca)
    or
    Code:
    [url=http://www.opengroup.org/pubs/online/7908799/xsh/printf]printf[/url]
    and one for
    Code:
    <a alt="printf(f, ...) is equivalent to fprintf(stdout, f, ...)">printf</a>
    perhaps with a link too. I may re-create the alts though. That printf one isn't too helpful.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  8. #23
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    yes well :P, I didn't write the descriptions they're from the web...

  9. #24
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Sorry, I haven't finished the clinkfunc rules (as they are to be called) yet. My estimates are always off . . . six months before I first released codeform I said "codeform should be finished within two weeks or maybe three."

    I have implemented doubling-the-allocated-memory-size. It hasn't been uploaded yet though. (It's a simple two line change to get_string().)

    I have attached the latest version of codeform online's Perl script in case anyone's interested. [edit] I attached the wrong file. I'm also attaching the Perl script now. [/edit]
    Last edited by dwks; 04-02-2007 at 02:56 PM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  10. #25
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    how about linking standard (or common lib) functions to online definitions (like online man pages or something).

  11. #26
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    note. i did put math.h functions names in winapi list. they are included just the names.

    note 2. if anyone wants dx9 list. i may start on it sometime.

  12. #27
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    how about linking standard (or common lib) functions to online definitions (like online man pages or something).
    That's exactly what this clinkfunc will do. In theory. Here's an example of what it should look like: http://cboard.cprogramming.com/showp...67&postcount=8

    note. i did put math.h functions names in winapi list. they are included just the names.
    Okay, good to know.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  13. #28
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    I've decided to risk it and host codeform version 1.2.0 online. Perhaps it should have a new thread -- but too late now.

    Codeform version 1.2.0 online: http://dwks.theprogrammingsite.com/m...e/cfonline.htm

    Tell me how you like it. If you find any bugs please let me know. Just as before, input files are limited to 32KB in size. The Windows API rules are also supported (only for style 1).

    I may not keep codeform online up and running forever, but if I stop hosting it I'll let everyone know here.

    [edit] The Perl script is attached, with .txt added. [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  14. #29
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    > If you find any bugs please let me know.
    The browser will parse #include <header> as #include, and template stuff will also act up,
    which is wrong. At least let your users knw this is the case to avoid a surprise.

    Other than that, you've done a nifty job so far.

  15. #30
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    What do you mean?
    Code:
    #include <stdio.h>
    
    template <typename t>
    It works pretty well for me. Post the code you messed it up with. [edit] That's how it's supposed to look BTW. If you were thinking it should look like
    Code:
    #include <stdio.h>
    well, that wasn't how it was designed. twomers wanted the same thing however. It's relatively easy to implement; just get rid of the "#" comment and add these keywords:
    Code:
    =keyword
    #include:[color=green]:[/color]
    #define:...etc...
    I may add an option in codeform online to do that. [/edit]

    Other than that, you've done a nifty job so far.
    Thank you.
    Last edited by dwks; 04-03-2007 at 12:16 PM.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. No Version info tab in file properties?
    By cpjust in forum Windows Programming
    Replies: 2
    Last Post: 06-03-2008, 03:42 PM
  3. How to set File Version of VC++ 6 dll
    By mercury529 in forum Windows Programming
    Replies: 3
    Last Post: 12-08-2006, 02:49 PM
  4. Finding the windows version...
    By The_Muffin_Man in forum Windows Programming
    Replies: 1
    Last Post: 06-10-2004, 11:39 PM
  5. Dev C++ Version 5
    By Zoalord in forum C++ Programming
    Replies: 3
    Last Post: 08-30-2003, 01:56 PM