From Wiki
Revision as of 13:52, 8 June 2020 by Garulfo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Currenlty m-cweb seems to be broken. Take the wc.tex from the example directory from the cweb distribution (made with cweave wc.w) and you should be able to use it like this:

\usemodule [cweb]


\title {Contents} \processCWEBcontents wc \page
\title {Sections} \processCWEBsections wc \page
\title {Sources}  \processCWEBsource   wc \page
\title {Index}    \processCWEBindex    wc \page


but ConTeXt is in an endless loop at:

This is pdfeTeXk, Version 3.141592-1.11a-2.1 (Web2C 7.5.2)
 \write18 enabled.
 %&-line parsing enabled.
entering extended mode


system         : macros of module cweb loaded
system         : mark CWEBfilename defined [CWEBfilename]
system         : mark CWEBsectiontitle defined [CWEBsectiontitle]
system         : mark CWEBsectionnumber defined [CWEBsectionnumber]
system         : mark CWEBsectiondepth defined [CWEBsectiondepth]
fonts          : needs map file:
fonts          : needs map file:
systems        : begin file main at line 3
title          : - Contents

What is wrong here?

With the help of Luigi Scarso and Aditya Mahajan I was able to get ConTeXt to compile a file generated with cweave. Here are the steps that I used ---

1. Place the following lines at the beginning of the web file:

   \input m-cweb

2. Place the following line at the end of the web file:


3. Run cweave

4. Remove the line that inputs "cwebmac" (TEXFILENAME is the name of the TeX file generated by cweave)

  There should be a much better way to remove or disable cwebmac but this was quick ;-)
  perl -p -i~ -e  'goto LINE if m(\input cwebmac)' TEXFILENAME

5. Run ConTeXt with command line (TEXFILENAME is the name of the TeX file generated by cweave)

  texexec --pdf TEXFILENAME

Here is a short example file ---

\input m-cweb

@** Hello World.

@; int main(void) { printf("Hello World.\n"); return(0); } @** Header Files. @
+= #include @ The end. \stoptext