Advertisement

Online .cpp parsing into HTML

Started by November 06, 2000 04:59 PM
39 comments, last by baskuenen 24 years, 1 month ago
Thats a cool idea. Hell if i knew how to write CGI stuff id make that right now. And to anyone who will make this. Im sure you know this already but make sure you dont color keywords that are in comments. Oh, how do i write CGI? Are there any tutorials?

-Snyper
=============================Where's the 'any' key?=============================
quote: Original post by GeniX

And when the person tries to go to
http://www.mysite.com/cgi-bin/parser?source.cpp


I can imagine doing this:
http://www.mysite.com/cgi-bin/parser?source.cpp

But how would the script look if I wanted:
http://www.othersite.com/cgi-bin/parser?http://www.mysite.com/source.cpp

The later would be harder to do, but it would make it usefull for everbody!


ImmaGNUman: what do you think of the above thing, and what do you think of using style-sheets?

Edited by - baskuenen on November 7, 2000 9:07:59 PM
Advertisement
It should look like this:

http://foo.bar.com/whereever/cgi-bin/cpp2html.pl?src=Address of source

Doesnt matter where the source is, just as long as it is possible to open it.

As for style sheets, never worked with em, nor do I know how to, in fact, i dont even know what they do.

Also, it wont color keywords in comments, in fact, it was so simple to avoid that, at least for C++ style //''s. All I did was check every line for //''s, remove the part of the line with //, and take the rest(if its nothing, loop for next line) and check it against the keywords.

As for CGI, it can be done in many languages, but Perl is easy to use with CGI. Goto Perl.com and read the tutorials if you want.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
Heres a beta CPP2HTML.PL

It doesn't parse C comments yet. Look for bugs.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt

Edited by - ImmaGNUman on November 7, 2000 10:50:19 PM
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
The link does not work for me!!!!
Bas, u asked for a tool also and I repeatedly have said i have a tool that will convert c++ to html with syntax highlighting and anyway u want the damn thing, so whoever wants this, just give me your address and i will send it today.
Advertisement
quote: Original post by saisoft

The link does not work for me!!!!


Just click on the link, then remove the CPP2HTML.PL part in the address bar and press enter. This way you can access the file CPP2HTML.PL.

--------------------------Programmers don't byte, they nibble a bit. Unknown Person-------------------------
Hrm, erm, that one wouldn't have worked anyway, I forgot to change the source file from my test file to the paramaters. It should work now: cpp2html.pl.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt

Edited by - immaGNUman on November 8, 2000 5:03:21 PM
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
Getting docs from across the internet isnt hard with Perl. The open statement WONT work... simply put this in:

    use LWP::Simple; # the libary you needif ($myurl =~ m/^(http\:\/\/)/) {  # checks for http:// at the start of the url$thewebpage = get($myurl); # gets the webpage} else {# otherwise open file normallyopen(....)}    


I would have wrote something like this if immagnuman hadnt got there first. Oh well.
jumble-----------
Hrm, thanks, havent worked much with file i/o over the internet, mostly files on the servers...

Tripod also lets me run my scripts, so you can test it without a d/l. Eg. members.tripod.com/immagnuman/cgi-bin/cpp2html.pl?src=wherever

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt

Edited by - immaGNUman on November 8, 2000 7:43:53 PM
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt

This topic is closed to new replies.

Advertisement