C Board  

Go Back   C Board > Community Boards > General Discussions
Welcome, dwks.
You last visited: 05-06-2007 at 01:20 PM
Private Messages: Unread 0, Total 325.
User CP FAQ Members List Calendar Search New Posts Mark Forums Read Open Buddy List Log Out


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 03-23-2007, 04:34 PM   #1
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
codeform version 1.2.0 #2

Codeform, a syntax highlighter [intended] for C and C++.

Codeform's main page: http://dwks.theprogrammingsite.com/myprogs/codeform.htm
Direct download link: http://dwks.theprogrammingsite.com/m...n/codeform.zip

"clip" download link (Windows clipboard utilities): http://dwks.theprogrammingsite.com/m.../down/clip.zip

Since the other threads were sadly lost in the recent presumed board restore from a backup, I'm starting another codeform thread. With good reason. Here is a list of the things I have done in the past two days:
  • (Incomplete) Rules files for highlighting other rules files and phpbb were added. From names.txt:
    Code:
    cfrule  codeform rules files
    ...
    phpbb  (PhpBB) BBCode (just like vbb but with [color=black] around everything)
  • The static variables in add_rule() were removed into struct rules_t (as struct prevrule_t pr). There are now no global or static variables in codeform, though there is a rather complex structure that is passed to most functions (at least in part). Oh well.
  • [bugfix] (related to the static variables) A rare memory leak occured when the last rule already existed:
    Code:
    =keyword
    int:[:]
    int:[[:]]
    It was fixed by freeing prevrule_t from main() with a call to the new function free_prevrule().
  • Several spelling mistakes in the source file were fixed. Some undoubtable remain.
  • [bugfix] Many keywords starting with the same characters would cause some to be ignored under certain conditions due to a problem with find_rule_new():
    Code:
    =keyword
    x:[:]
    do:*:*
    done:*:*
    double:*:*
    doubles:*:*
    doubled:*:*
    doubling:*:*
  • [bugfix] A variable directly following an undefined variable would be ignored, due to an oversight in find_var_replace():
    Code:
    =keyword
    int:$(formbb)$(keyworddarkc)$(formba):$(forma)
  • [bugfix] A memory leak of at least BUFSIZ characters per input file occured. (The leak was the longest line in the file as a multiple of BUFSIZ, rounded up. So if BUFSIZ was 512 and there was a line in the file 530 characters long, 1024 characters would have been leaked.) It was fixed by adding free(line) into read_file().
  • [bugfix] A memory leak occured for every parameter passed to the program. free_argument() was calling free() instead of free_strings().
  • [bugfix] When reading rules files with DOS-style newlines under Linux, repeated sections ("*") were taken as literal "*"s. (This was manifest with codeform online.) chomp_newline() was added which chomps '\r's as well as '\n's.
  • [bugfix] One byte too many was being allocated for every variable name in add_var9).
  • One call to strlen() was eliminated by making remove_escapes() cooperate with shrink_string().
There are still some things to fix, however: Valgrind still shows a few hundred bytes leaked for very complex rules files (down from several thousand, thanks to all of the memory leak bug fixes). (It's the first time I've ever used Valgrind; it's amazing.) I'm pretty sure there's something up with the previous-rule code in add_rule() et al.

HOWTO.txt is sort of out of date.

I want to add Perl support (a rather large undertaking, don't expect it within days ).

Also see the TODO list for other things that I still need to do:
Code:
/*-------------------------------------------*\
 | TODO list for future versions of codeform |
\*-------------------------------------------*/

Short-term
- ? Optimise rule searching by looking in the previous position first
- Add support for "\n" and "\param" in specific comments ("" and /*! */)
- Make a "function" rule: \w+\s+\(
- ? Don't print closing tags for same-coloured nested comments
- Provide a default rules directory that is searched first
- Make "escaped newline" (\) character specifiable
- Don't count #es in #defines as new comments;
    don't allow nestcoms to include themselves
[done] - Allow multiple prev pointers!
[done] - free static variables in add_rule()

Long-term
- Make input, output and styles rules files separate

Distant long-term
- Support indent-style code beautifying
I haven't forgotten about the Win32 functions, don't worry, but the lists are gone now so it will take me a while . . . .

Codeform online still isn't working. Any ideas? How can I run a program as a restricted user from a priviledged Perl script?
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!

Last edited by dwks : 03-23-2007 at 04:55 PM.
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-23-2007, 04:56 PM   #2
kryptkat
Registered User
 
kryptkat's Avatar
 
Join Date: Dec 2002
Posts: 295
Would you like me to put the win api list back up?
kryptkat is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-23-2007, 05:14 PM   #3
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
Sure. Or you could create the codeform rules files yourself if you're feeling up to it.

Perhaps something like this:
Code:
=keyword

keyworddarkb=
keyworddarka=

auto:$(keyworddarkb):$(keyworddarka)
bool:*:*
break:*:*
case:*:*
...
In fact, I have a Perl script for you:
Code:
#!/usr/bin/perl

print "=keyword\n\nkeyworddarkb=\nkeyworddarka=\n\n";
chomp($l = <>);
print "$l:\$(keyworddarkb):\$(keyworddarka)\n";

while(<>) {
    chomp;
    print "$_:*:*\n";
}
Note: it's untested. [edit] Okay, now I've edited the code and tested it. It works pretty well. It assumes an input file with one keyword per line. [/edit]
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!

Last edited by dwks : 03-23-2007 at 05:18 PM.
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-23-2007, 05:20 PM   #4
kryptkat
Registered User
 
kryptkat's Avatar
 
Join Date: Dec 2002
Posts: 295
Code:
=keyword

keyworddarkb=
keyworddarka=

auto:$(keyworddarkb):$(keyworddarka)
bool:*:*
break:*:*
case:*:*
...
i have no clue what that is or does.... <i know it is perl but....>

Code:
#!/usr/bin/perl

print "=keyword\n\nkeyworddarkb=\nkeyworddarka=\n\n";
$l = <>;
print "$l:$(keyworddarkb):$(keyworddarka)\n"

while(<>) {
    print "$_:*:*\n";
}
have no perl compiler....
kryptkat is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-23-2007, 05:24 PM   #5
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
I'll run it for you then. (It's a Perl interpreter BTW.) Post the list (as an attachment!) if you have it handy. If not, I'll start looking . . . .
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-23-2007, 05:36 PM   #6
kryptkat
Registered User
 
kryptkat's Avatar
 
Join Date: Dec 2002
Posts: 295
put it all on one file.txt



note to self.... dx9 and gdi need to add
Attached Files
File Type: txt Winnapilist.txt (65.0 KB, 28 views)
kryptkat is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-23-2007, 05:56 PM   #7
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
Here it is . . . generated by this:
Code:
#!/usr/bin/perl

print "=keyword\n\nkeyworddarkb=\nkeyworddarka=\n\n";
chomp($l = <>);
$l =~ s/\s*\(?\s*$//;
print "$l:\$(keyworddarkb):\$(keyworddarka)\n";

while($l = <>) {
    chomp($l);
    $l =~ s/\(?\s*$//;
    if($l =~ /\/\*(.*)\*\// || $l =~ /(. Functions)/) {
        print "# $1\n";
    }
    elsif($l ne '') {
        print "$l:*:*\n";
    }
}
I call it rules/winapi on my machine. It's used like so:
Code:
$ ./codeform -f rules/cpp_vbb_1 -f rules/winapi ...
It's untested BTW. Let me know if you have problems with it. The latest upload of codeform segfaults quite often for no apparent reason . . . not a good sign.

[edit] Stupid attachments. You can't have a file with no extension . . . remove the .txt. [/edit]
Attached Files
File Type: txt winapi.txt (72.8 KB, 19 views)
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!

Last edited by dwks : 03-23-2007 at 06:00 PM.
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-23-2007, 06:02 PM   #8
twomers
The Superheterodyne
 
twomers's Avatar
 
Join Date: Dec 2005
Location: Ireland
Posts: 1,542
Might be worth putting in some documentation about the clipboard programs too so people can use your code formatter along with your clipboard thing.
__________________
I've got to get a girlfriend, just for the summer, until this wears off. She'll be a summery girl. She'll have hair. She'll have summery friends who know how to be outside. She'll play tennis and wear dresses and have bare feet, and in the autumn, I'll ditch her, because she's my summer girl!
twomers is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-24-2007, 04:24 AM   #9
kryptkat
Registered User
 
kryptkat's Avatar
 
Join Date: Dec 2002
Posts: 295
tested it. it hangs. let it run all night just to see if it was slow or not working. 9pm to 7:30am is enough time to know that it crashed.

first thought colins on math functions
second thought two rule files
third thought comments in file.
fourth thought perl script messed up
fifth thought multiple references of the same functions

manually edit win api file retry with manually made rule file.

other thoughts as to why it crashed?

[edit]
how large of .c file can it handle?
[/edit]

Last edited by kryptkat : 03-24-2007 at 04:26 AM.
kryptkat is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-24-2007, 09:26 AM   #10
kryptkat
Registered User
 
kryptkat's Avatar
 
Join Date: Dec 2002
Posts: 295
care to try that again?

here is the list sorted with the duplicates removed and the comments removed. it is ready for a perl script to turn it to a winapi rule file.

note there is gdi in there hbitmap and bitblit i think all of it .
Attached Files
File Type: txt winnapirawsortlist.txt (57.4 KB, 16 views)
kryptkat is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-24-2007, 12:52 PM   #11
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
Quote:
first thought colins on math functions
second thought two rule files
third thought comments in file.
fourth thought perl script messed up
fifth thought multiple references of the same functions
Colons in function names would definitely mess codeform up -- they need to be escaped.
Comments in file beginning with '#' are fine -- "/**/" comments are not. I think I got rid of them though.
The Perl script may well have messed up.
Multiple functions of the same name would cause the duplicates to be ignored (only the first one counts).

Quote:
[edit]
how large of .c file can it handle?
[/edit]
At least 64 KB -- that's the largest I've tested -- but I know for a fact that its line length is theoretically unlimited (5,000,000 character lines on an old computer). If you find a larger source file, feel free to test it. There's no reason why a larger file would crash it however.

I expect the problems you encountered were due to a bug in the codeform I uploaded . . . I've re-uploaded it again, having done the following changes last night (it was a late night...):
  • Changes
  • The line in add_var()
    Code:
    vars->data[pos]->from = malloc(eq - str);
    becomes
    Code:
    vars->data[pos]->from = malloc(eq - str + 1);
    Despite the reassuring comment, the previous version did have a buffer overflow and I suspect that was what was causing the segmentation faults.
  • free_onerule()'s free() goes inside the if statement -- might make codeform very slightly faster
  • Added
    Code:
    && x <= ruledata->data[y]->data.number
    to free_onerule()'s inner if statement -- it might do something on rare occasions.
  • (minor change) In add_rule, the return value of the call to add_allocated_rule() is saved and pr->freep is set to it.
  • Fixed yet another memory leak due to a bug in add_rule().
  • This line is added to free_dup_onerule() to get rid of a small memory leak when keywords of the same name were added:
    Code:
    free(rule->data.len);
  • Re-written free_rulecdat() completely to get rid of a serious memory leak to look like this:
    Code:
    void free_rulecdat(const struct rules_t *rules) {
        enum type_t x;
        size_t y;
    
        for(x = 0; x < TYPES; x ++) {
            if(rules->cdat[x]) {
                for(y = 0; y < rules->cdat[x]->data.number; y ++) {
                    free(rules->cdat[x]->data.data[y]);
                }
                
                free(rules->cdat[x]->data.data);
                free(rules->cdat[x]->data.len);
                free(rules->cdat[x]);
            }
        }
    }
I did a few other things too, not worth mentioning here.

Valgrind now reports no memory leaks for codeform! Even for rules/c_1_css. But it does report "invalid read"s, whatever that is. (Enlighten me?)

I will indeed re-create the winapi file and test it this time (I'm on the right computer). I'll report back in a few minutes.
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-24-2007, 01:06 PM   #12
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
Okay, download the latest version; rules/winapi is included in it. I tested it with this command line and it worked:
Code:
C:\>codeform -f rules\_html -f rules\c_1ext -f rules\winapi rules\winapi
It increased the size of the .ZIP by a bit.

[edit] For nicer colours try
Code:
C:\>codeform -f rules\_html -f rules\c_1 -f rules\winapi rules\winapi
Here's a sample (with _vbb of course instead of _html):
Code:
=keyword

keyworddarkb=
keyworddarka=

AbnormalTermination:$(keyworddarkb):$(keyworddarka)
AbortDoc:*:*
AbortPath:*:*
AbortPrinter:*:*
AbortProc:*:*
ABORTPROC:*:*
AbortSystemShutdown:*:*
accept:*:*
AcceptEx:*:*
AccessNtmsLibraryDoor:*:*
ACMDRIVERENUMCB:*:*
ACMDRIVERPROC:*:*
ACMFILTERCHOOSEHOOKPROC:*:*
ACMFILTERENUMCB:*:*
ACMFILTERTAGENUMCB:*:*
ACMFORMATCHOOSEHOOKPROC:*:*
ACMFORMATENUMCB:*:*
ACMFORMATTAGENUMCB:*:*
...etc...
[/edit]

The executable included in the .ZIP is not compiled with my normal compiler but it should still work.

The linux executable included is ancient. If you're using linux just compile it yourself. Type "make clean" and then "make".
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!

Last edited by dwks : 03-24-2007 at 01:09 PM.
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-24-2007, 02:16 PM   #13
kryptkat
Registered User
 
kryptkat's Avatar
 
Join Date: Dec 2002
Posts: 295
Quote:
If you find a larger source file, feel free to test it.
<very big grin>

was looking over your changes....good to know. i do not have linux.

the winapi file is large and i hope it will add to the progs popularity. it has helped fix a few progs already. if i had realized you were going to run it through a prog to make the rule file i would have plucked cleaned stuffed and baked the file in the first place. thank you.
kryptkat is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-24-2007, 03:05 PM   #14
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
I used another Perl program that basically takes codeform.c and copies it 100 times into another file. Here are the results:
Code:
timeit: 14285 ms

 Volume in drive [edited]
 Volume Serial Number is [edited]

 Directory of [edited]

24/03/2007  03:59 PM         7,098,100 bigfile
24/03/2007  03:59 PM        20,343,374 bigfile.htm
               2 File(s)     27,441,474 bytes
               0 Dir(s)      56,410,112 bytes free
Not bad . . . A 7MB file was processed in 14.3 seconds (admittedly, it was in the background but this is a really fast computer).

Quote:
<very big grin>

was looking over your changes....good to know. i do not have linux.

the winapi file is large and i hope it will add to the progs popularity. it has helped fix a few progs already. if i had realized you were going to run it through a prog to make the rule file i would have plucked cleaned stuffed and baked the file in the first place. thank you.
Thank you for the list. All I did was write a program to parse it and tested and uploaded it . . . you did all of the work.

Sorry that the change list is not very legible. I wrote it as I was coding and never intended to put it on the internet or anything.
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-31-2007, 03:29 AM   #15
zacs7
What's a "pointer"?
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Allocated on the heap.
Posts: 215
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.
zacs7 is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-31-2007, 01:09 PM   #16
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
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. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-31-2007, 04:13 PM   #17
zacs7
What's a "pointer"?
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Allocated on the heap.
Posts: 215
You should make a CGI version to perhaps?
__________________

Ubuntu 6.10
GCC 4.1.1
Linux vs Vista Kernel

I made $20 today just by watering this guy's lawn in speedos.
zacs7 is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-31-2007, 04:58 PM   #18
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
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. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-31-2007, 05:14 PM   #19
zacs7
What's a "pointer"?
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Allocated on the heap.
Posts: 215
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
__________________

Ubuntu 6.10
GCC 4.1.1
Linux vs Vista Kernel

I made $20 today just by watering this guy's lawn in speedos.

Last edited by zacs7 : 03-31-2007 at 05:18 PM.
zacs7 is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-31-2007, 05:23 PM   #20
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
Quote:
I did sign-up before the board crashed :frown: I lost my account...
That's too bad. All I lost was 300 posts. You lost your join date etc . . .

Quote:
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
Quote:
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.

Quote:
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. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-31-2007, 05:33 PM   #21
zacs7
What's a "pointer"?
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Allocated on the heap.
Posts: 215
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)
Attached Files
File Type: txt functions.lib.txt (22.0 KB, 15 views)
__________________

Ubuntu 6.10
GCC 4.1.1
Linux vs Vista Kernel

I made $20 today just by watering this guy's lawn in speedos.
zacs7 is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 03-31-2007, 05:44 PM   #22
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
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. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 04-01-2007, 04:13 AM   #23
zacs7
What's a "pointer"?
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Allocated on the heap.
Posts: 215
yes well :P, I didn't write the descriptions they're from the web...
__________________

Ubuntu 6.10
GCC 4.1.1
Linux vs Vista Kernel

I made $20 today just by watering this guy's lawn in speedos.
zacs7 is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 04-02-2007, 12:01 PM   #24
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
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]
Attached Files
File Type: txt functions.txt (22.0 KB, 9 views)
File Type: txt codeform.pl.txt (3.6 KB, 7 views)
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!

Last edited by dwks : 04-02-2007 at 02:56 PM.
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 04-02-2007, 12:38 PM   #25
Perspective
Crazy Fool
 
Perspective's Avatar
 
Join Date: Jan 2003
Location: Canada
Posts: 2,207
how about linking standard (or common lib) functions to online definitions (like online man pages or something).
Perspective is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 04-02-2007, 01:53 PM   #26
kryptkat
Registered User
 
kryptkat's Avatar
 
Join Date: Dec 2002
Posts: 295
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.
kryptkat is offline Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 04-02-2007, 02:52 PM   #27
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
Quote:
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

Quote:
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. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 04-02-2007, 05:02 PM   #28
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
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]
Attached Files
File Type: txt codeform.pl.txt (4.1 KB, 9 views)
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 04-02-2007, 05:37 PM   #29
citizen
Perfect Gentleman
 
Join Date: Apr 2006
Location: MI
Posts: 1,256
> 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.
citizen is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Old 04-03-2007, 11:46 AM   #30
dwks
DWK
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 4,239
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]

Quote:
Other than that, you've done a nifty job so far.
Thank you.
__________________
dwk

Seek and ye shall find. quaere et invenies. (Latin by dwks.)

"Only those who will risk going too far can possibly find out how far one can go." -- TS Eliot
"I have not failed. I've just found 10,000 ways that won't work." -- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing." -- John Powell

My website: http://dwks.theprogrammingsite.com/

Other programming boards:
codeform version 1.2.0 is here!

Last edited by dwks : 04-03-2007 at 12:16 PM.
dwks is online now Report Post   Reply With Quote Multi-Quote This Message Quick reply to this message
Reply


Quick Reply
Message:
Remove Text Formatting
Bold
Italic
Underline
Wrap [QUOTE] tags around selected text
 
Decrease Size
Increase Size
Options

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may post new threads
You may post replies
You may post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 10:01 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2007, Jelsoft Enterprises Ltd.