Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CWEB question

1 view
Skip to first unread message

Deniz Yuret

unread,
Jan 11, 1997, 3:00:00 AM1/11/97
to

Does anyone know if there is a way to stop cweave from formatting
some of my C sections and treat them as normal text (or verbatim).
The problem comes up, for example, when I try to dump non-C files
within the same web file, using @(fname@>=... I would like to have
my Makefile and maybe some small data files dumped this way. So
all I need is some way to tell cweave to not do what it is doing for
one section. Please respond to my email address.
--
Deniz Yuret
MIT Artificial Intelligence Laboratory tel: (617) 253-6247
545 Technology Square, Room: NE43-815 fax: (617) 253-5060
Cambridge, MA 02139, USA e-mail: de...@ai.mit.edu

F. Gaertner

unread,
Jan 14, 1997, 3:00:00 AM1/14/97
to Deniz Yuret

In article <32D80BB7...@ai.mit.edu>, Deniz Yuret <de...@ai.mit.edu> writes:
#>Does anyone know if there is a way to stop cweave from formatting
#>some of my C sections and treat them as normal text (or verbatim).
#>The problem comes up, for example, when I try to dump non-C files
#>within the same web file, using @(fname@>=... I would like to have
#>my Makefile and maybe some small data files dumped this way. So
#>all I need is some way to tell cweave to not do what it is doing for
#>one section. Please respond to my email address.

As far as I know this is not possible in CWEB. You must use a tool
that can distinguish between the different languages you are using.
Currently only the language independent tools (e.g. noweb or nuweb,
both certainly worth a try) allow to mix multi-lingual code in a file.
I know that FWEB can handle different languages too, but I not
sure if you can mix them in a single file.

You'll have to forget about prettyprinting though if you choose
a language independent tool, but this can be fixed (for noweb
see for example http://www.iti.informatik.th-darmstadt.de/
~gaertner/pretzel/noweb-pp.html).

For the sources of these tools, see the FAQ of
comp.programming.literate.

Cheers,

Felix


Deutscher

unread,
Jan 15, 1997, 3:00:00 AM1/15/97
to

F. Gaertner (the...@sun11.rbg.informatik.th-darmstadt.de) wrote:

: In article <32D80BB7...@ai.mit.edu>, Deniz Yuret <de...@ai.mit.edu> writes:
: #>Does anyone know if there is a way to stop cweave from formatting
: #>some of my C sections and treat them as normal text (or verbatim).
: #>The problem comes up, for example, when I try to dump non-C files
: #>within the same web file, using @(fname@>=... I would like to have
: #>my Makefile and maybe some small data files dumped this way. So
: #>all I need is some way to tell cweave to not do what it is doing for
: #>one section. Please respond to my email address.

: Currently only the language independent tools (e.g. noweb or nuweb,


: both certainly worth a try) allow to mix multi-lingual code in a file.

: I know that FWEB can handle different languages too, but I not
: sure if you can mix them in a single file.

You can. I do it. Stefan

==========================================================================
Stefan A. Deutscher, s...@utk.edu, (001)-423-[522-7845|974-7838|574-5897]
home^ UTK^ ORNL^
==========================================================================
If there is software you'd like to have in a native OS/2 version, visit
the: OS/2 E-mail Campaign Page http://www.andrews.edu/~boyko/email.html
--------------------------------------------------------------------------

Brian Danilko

unread,
Jan 15, 1997, 3:00:00 AM1/15/97
to

Deniz Yuret <de...@ai.mit.edu> wrote:

>Does anyone know if there is a way to stop cweave from formatting

>some of my C sections and treat them as normal text (or verbatim).

Cweb (at least version 3.0 and above) has a @= control code which
is valid in the C part of a chunk and treats the text as verbatim.

I have used this to place copyright information into my generated
cpp and hpp files as otherwise ctangle removes comments while
writing these files. The only problem is that cweave places a box
around each line. I'm sure that this would be easy to change in
the cwebmac.tex file - of course this should be in a change file
that is tangled in to produce cwebmac.tex!

So the process is:
@(makefile@>=
@=The first line@>
@=The second line@>

Messy!

Hope that this helps

Brian


-----------------------------------------------------------------------
Brian Danilko email: t...@olis.net.au
Formal Solutions home page: http://olis.net.au/~tsg
phone/fax: (08) 8388-7216
postal: 20 Main Street
Hahndorf, South Australia 5245


F. Gaertner

unread,
Jan 16, 1997, 3:00:00 AM1/16/97
to

In article <E43Ep...@cwi.nl>, ma...@cwi.nl (Marc van Leeuwen) writes:
#>
#>It would be a nice idea to have a per-output-file C/verbatim attribute in
#>CWEB; this would not be too hard to implement, if it weren't for the fact
#>that when cweave processes a module, it has no idea to which file ctangle
#>will send the corresponding code (it might in fact go to several files). I
#>wonder how FWEB tackles this issue; my guess is that it leaves the
#>responsibility for selecting languages consistently with the inclusion
#>structure of modules to the literate programmer.

It would be nice if the WEAVE processor could determine automatically
what kind of file a particular chunk is going too. This would make it
possible to use different prettyprinters for different chunks or to
spare some chunks from any prettyprinting at all.

But how determine which file a chunk goes to? One could follow the chunk
dependency tree to a root and look what it's called (e.g. ``... header ...'')
and conclude the information from this. Are there any other ideas?

Felix


Norman Ramsey

unread,
Jan 16, 1997, 3:00:00 AM1/16/97
to

In article <5blm12$1k...@rs18.hrz.th-darmstadt.de>,

If your only purpose is to choose a prettyprinter, I bet it is easy to
modify the prettyprinter to give you a judgement about whether the
language matches the prettyprinter. If you use Knuth's techniques,
just look for minimum-size reductions.

N

--
Norman Ramsey
http://www.cs.virginia.edu/~nr

Marc van Leeuwen

unread,
Jan 16, 1997, 3:00:00 AM1/16/97
to

In article <5bjkjd$q...@curlew.mtx.net.au>, t...@olis.net.au (Brian Danilko) writes:
|> Deniz Yuret <de...@ai.mit.edu> wrote:
|>
|> >Does anyone know if there is a way to stop cweave from formatting
|> >some of my C sections and treat them as normal text (or verbatim).
|>
|> Cweb (at least version 3.0 and above) has a @= control code which
|> is valid in the C part of a chunk and treats the text as verbatim.
|> [...]

|> So the process is:
|> @(makefile@>=
|> @=The first line@>
|> @=The second line@>

I mailed a lengthy reply to Deniz concerning this matter, which I am not
going to repeat here. In short, the problem is that ctangle still considers
the output as C code, and emits comments (like /*45:*/) and `#line'
directives, which `make' is probably not going to like. With CWEBx this can
be solved using the `-l' option to ctangle. However, provided you do not
wish to break up the makefile into chunks, you could alternatively simply
keep it as a separate file and include it verbatim (using \input) into one
of the sections of the CWEB file, which seems a better solution to me.

It would be a nice idea to have a per-output-file C/verbatim attribute in

CWEB; this would not be too hard to implement, if it weren't for the fact

that when cweave processes a module, it has no idea to which file ctangle

will send the corresponding code (it might in fact go to several files). I

wonder how FWEB tackles this issue; my guess is that it leaves the

responsibility for selecting languages consistently with the inclusion

structure of modules to the literate programmer.

--
Marc van Leeuwen | What has man wrought
CWI, Amsterdam | for the year naughty-naught?
http://www.cwi.nl/~maavl/ | '00-programming will get its revenge!

0 new messages