Display C in HTML

M

Malcolm McLean

Richard Heathfield said:
Walter Roberson said:


Yes, sorry, I was of course aware of this, but I should have made it
more explicit in my reply.


I'm not suggesting that the text so produced is topical. I'm suggesting
that the program that produces that text is (or at least can be)
topical.
It is an ANSI C program that is a tool for documenting other ANSI C source,
so it is quite hard to argue that the post is not topical. Normally the
browser would not be written with only the standard library, of course,
although I believe you can get Unix text-based browers of sorts.
 
R

Richard Heathfield

Malcolm McLean said:
It is an ANSI C program that is a tool for documenting other ANSI C
source, so it is quite hard to argue that the post is not topical.

Yes. As you can see from my first reply in this thread, I too considered
the OP to be a topical article. (Having said that, at that time I
didn't realise he was after colour too, or I would not have posted the
code that I did post.)
 
F

Flash Gordon

SM Ryan wrote, On 01/07/07 01:31:
# Adam wrote, On 30/06/07 12:08:
# > Hi,
# >
# > Does anyone know of an online C-to-HTML converter to display code
# > nicely formatted in a browser?
#
# Almost certainly. Have a look at http://clc-wiki.net/wiki/intro_to_clc
# for information on why many will not consider your post topical, and dig
# around further on the site for possible enlightenment with your problem
# depending on what your real requirements are.

What's interesting is your smart ass response wasted more electrons
than simply letting other people respond.

Actually, as I stated, if he trawled around on that site he would have
found enlightenment that it uses a C-to-HTML converter to display C code
in a web browser with nice syntax highlighting. It also says how it does
it and how to contact those who set it up.
And why isn't the presentation of C code is not topical for comp.lang.c?

Style wars are certainly topical.
Try rereading posts from 1990 and see how the group used to be useful.

It would be reading, not rereading, and I have enough to do without
doing that.
 
F

Flash Gordon

Richard Heathfield wrote, On 01/07/07 09:08:
Malcolm McLean said:


Yes. As you can see from my first reply in this thread, I too considered
the OP to be a topical article. (Having said that, at that time I
didn't realise he was after colour too, or I would not have posted the
code that I did post.)

I read it as a request for either a pre-written tool or a website
providing a service he could use, and I believe I was correct. The tools
I know of for the job, one of which is used by http://clc-wiki.net/ are
not written in C, although such tools could be.
 
W

Walter Roberson

Malcolm McLean said:
It is an ANSI C program that is a tool for documenting other ANSI C source,
so it is quite hard to argue that the post is not topical.


It isn't hard to so argue at all.

You can't do colour in standard C. Period. Every use of colour
in C requires a system extension. That system extension might be
writing directly to system memory, or might be a call to an OS
library, or might be a call to a library that tries hard to be
portable, or might be some kind of external program that does one
of these things, but you can't get away from the system extension
for the task.

The fact that there are common programs that take text input
and produce coloured output is of no more importance to this matter
than the fact that there are common MS Windows assemblers that
take text input and produce whatever weird and wonderful output
that one might desire.

If we are to are to be consistent and we tell people, "MS Windows
assembly and what you can do with it is off-topic here", then we
must also tell people that "HTML and what you can do with it is
off-topic here."

Can you produce coloured text within HTML? "Yes, it's just a text
format" is, as far as clc is concerned, an off-topic answer: the clc
answer is, "We don't know, check an HTML newsgroup!".

If the poster goes away and comes back and says, 'I have a text
processing-task that involves [...] and changing this kind of
string to the literal "<push hue red 0.8>" followed by the string
followed by "<pop hue red>"', and doesn't implicitly make us
responsible for this not happening to produce the colour change
desired when the output is run through the off-topic external tool,
then that is -closer- to topicality, but still likely in the
realm of "That's an algorithm question" or "that's a parsing question".

Taking in text, whirling it around, and producing output text:
possibly topical. But as soon as the requirement is added that the
result has to have a particular effect in a system extension
(e.g., that various words actually have to -be- colorized in a browser),
it's off-topic; we have to stop no further than "this will produce
the text output you specified; what some other program does with
this is out of our hands."
 
S

SM Ryan

#
# message # > # Adam wrote, On 30/06/07 12:08:
# > # > Hi,
# > # >
# > # > Does anyone know of an online C-to-HTML converter to display code
# > # > nicely formatted in a browser?
# > #
# > # Almost certainly. Have a look at http://clc-wiki.net/wiki/intro_to_clc
# > # for information on why many will not consider your post topical, and dig
# > # around further on the site for possible enlightenment with your problem
# > # depending on what your real requirements are.
# >
# > What's interesting is your smart ass response wasted more electrons
# > than simply letting other people respond.
# >
# > And why isn't the presentation of C code is not topical for comp.lang.c?
# > Try rereading posts from 1990 and see how the group used to be useful.
# It is completely within the grasp of ISO C to do what you want, that is, if
# HTML can be represented by C char arrays.
#
# What code do you have so far?

I actually convert RTF to C. I could convert HTML if I wanted using textutil.
 
S

SM Ryan

# SM Ryan wrote, On 01/07/07 01:31:
# > # Adam wrote, On 30/06/07 12:08:
# > # > Hi,
# > # >
# > # > Does anyone know of an online C-to-HTML converter to display code
# > # > nicely formatted in a browser?
# > #
# > # Almost certainly. Have a look at http://clc-wiki.net/wiki/intro_to_clc
# > # for information on why many will not consider your post topical, and dig
# > # around further on the site for possible enlightenment with your problem
# > # depending on what your real requirements are.
# >
# > What's interesting is your smart ass response wasted more electrons
# > than simply letting other people respond.
#
# Actually, as I stated, if he trawled around on that site he would have
# found enlightenment that it uses a C-to-HTML converter to display C code
# in a web browser with nice syntax highlighting. It also says how it does
# it and how to contact those who set it up.

If you know an answer, why not just give an answer?
 
S

SM Ryan

(e-mail address removed)-cnrc.gc.ca (Walter Roberson) wrote:
# In article <[email protected]>,
#
# >It is an ANSI C program that is a tool for documenting other ANSI C source,
# >so it is quite hard to argue that the post is not topical.
#
#
# It isn't hard to so argue at all.
#
# You can't do colour in standard C. Period. Every use of colour

Nonsense. The standard only concerns it with the interpretation
of characters from some source. It doesn't concern itself with
source or any secondary attributes of the characters. Doesn't
if require ASCII.
 
F

Flash Gordon

SM Ryan wrote, On 01/07/07 19:14:
# SM Ryan wrote, On 01/07/07 01:31:
# > # Adam wrote, On 30/06/07 12:08:
# > # > Hi,
# > # >
# > # > Does anyone know of an online C-to-HTML converter to display code
# > # > nicely formatted in a browser?
# > #
# > # Almost certainly. Have a look at http://clc-wiki.net/wiki/intro_to_clc
# > # for information on why many will not consider your post topical, and dig
# > # around further on the site for possible enlightenment with your problem
# > # depending on what your real requirements are.
# >
# > What's interesting is your smart ass response wasted more electrons
# > than simply letting other people respond.
#
# Actually, as I stated, if he trawled around on that site he would have
# found enlightenment that it uses a C-to-HTML converter to display C code
# in a web browser with nice syntax highlighting. It also says how it does
# it and how to contact those who set it up.

If you know an answer, why not just give an answer?

I could not be bothered to actually dig out the correct reference of an
answer, but the site is not so large or badly organised that it is
terribly difficult to find, so I just told the OP to dig around.
 
W

Walter Roberson

(e-mail address removed)-cnrc.gc.ca (Walter Roberson) wrote:
# You can't do colour in standard C. Period. Every use of colour
Nonsense. The standard only concerns it with the interpretation
of characters from some source. It doesn't concern itself with
source or any secondary attributes of the characters.

That would be doing colour -outside- of standard C. If the
characters were somehow coloured in their external representation,
then the colour information would have to be removed by
the standard library for text files; for binary files, you
aren't working with text, you are working with bytes of binary
data; and you wouldn't be working directly with colour, only
with data streams that something external interpreted as colour.

Your argument is fatally generalizable. "Q: You can't play sounds
in standard C"; "A: Nonsense; the characters could have secondary
attributes that are sounds". "Q: You can't do direct hardware access
in standard C"; "A: Nonsense; the characters could have secondary
attributes that happened to engage the desired hardware access".
"Q: You can't reliably predict the future in standard C";
"A: Nonsense; the characters could have secondary attributes
that are quantum entanglements and by examining them, you could
invoke 'spooky action at a distance' that had the effect of
predicting the future relative to the normal speed-of-light
propagation of information that defines the distinction between
past and future."
 
A

Army1987

Walter Roberson said:
That would be doing colour -outside- of standard C. If the
characters were somehow coloured in their external representation,
then the colour information would have to be removed by
the standard library for text files; for binary files, you
aren't working with text, you are working with bytes of binary
data; and you wouldn't be working directly with colour, only
with data streams that something external interpreted as colour.

Your argument is fatally generalizable. "Q: You can't play sounds
in standard C"; "A: Nonsense; the characters could have secondary
attributes that are sounds".
'\a', for example. And it *is* standard C (even if it just
expresses an "intent").
 
W

Walter Roberson

"Walter Roberson" <[email protected]> ha scritto nel messaggio news:[email protected]...
'\a', for example. And it *is* standard C


Heh, you got me there. But \a "produces an audible or visible alert",
no promises which or what (or when.)
(even if it just
expresses an "intent").

Going back to the original request, I don't think the poster would
have been happy with a solution that involved programming the
machine to "produce happy purple electronic thoughts around this 'while'
keyword". The OP wanted actual colour, not the "intent" of colour.
 
C

CBFalconer

Walter said:
.... snip ...


Heh, you got me there. But \a "produces an audible or visible
alert", no promises which or what (or when.)

Hah. On the DS9K it waits until the next shut-down, then lights a
pilot for 10.5 millisecs. Be alert. :)
 
W

Walter Roberson

Walter Roberson wrote:
Hah. On the DS9K it waits until the next shut-down, then lights a
pilot for 10.5 millisecs. Be alert. :)

On the DS9K "Winter Edition", the pilot is near a propane
vent that gets opened for a period each time UB is detected.
Program badly and You Will Know if an alert occurred!
(Oh, and memory is randomly initialized with \a's to make life ...
Interesting... if you fail to terminate that string you are outputing...)
 
S

SM Ryan

(e-mail address removed)-cnrc.gc.ca (Walter Roberson) wrote:
# In article <[email protected]>,
# >[email protected] (Walter Roberson) wrote:
#
# ># You can't do colour in standard C. Period. Every use of colour
#
# >Nonsense. The standard only concerns it with the interpretation
# >of characters from some source. It doesn't concern itself with
# >source or any secondary attributes of the characters.
#
# characters were somehow coloured in their external representation,
# then the colour information would have to be removed by
# the standard library for text files; for binary files, you
# That would be doing colour -outside- of standard C. If the

Your claim is that text attributes of the source
code are dictated by ANSI C. This is false. ANSI C doesn't
care what the text attributes are, or even whether its
EBCDIC or ASCII or something else.

# Your argument is fatally generalizable. "Q: You can't play sounds

Your argument is fatally generalisale: 'You can't use Gill Sans
or Helvetica or Optima in C source files.' But I do. I even use
bold and italic case in my C sources.

There is no reason you cannot encode a C program as a flute music
assuming you have some mechanism to extract particular characters
from that particular information stream.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top