Difference between revisions of "CWEB"
m |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
Currenlty m-cweb seems to be broken. Take the wc.tex from the example directory from the cweb distribution (made with <tt>cweave wc.w</tt>) and you should be able to use it like this: | Currenlty m-cweb seems to be broken. Take the wc.tex from the example directory from the cweb distribution (made with <tt>cweave wc.w</tt>) and you should be able to use it like this: | ||
− | < | + | <texcode> |
\usemodule [cweb] | \usemodule [cweb] | ||
Line 14: | Line 12: | ||
\stoptext | \stoptext | ||
− | </ | + | </texcode> |
but ConTeXt is in an endless loop at: | but ConTeXt is in an endless loop at: | ||
Line 40: | Line 38: | ||
What is wrong here? | 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: | ||
+ | <texcode> | ||
+ | \input m-cweb | ||
+ | \activateCWEB | ||
+ | \setupinteraction[state=start] | ||
+ | \starttext | ||
+ | </texcode> | ||
+ | |||
+ | 2. Place the following line at the end of the web file: | ||
+ | <texcode> | ||
+ | \stoptext | ||
+ | </texcode> | ||
+ | 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 ;-)'' | ||
+ | |||
+ | <code> | ||
+ | perl -p -i~ -e 'goto LINE if m(\input cwebmac)' TEXFILENAME | ||
+ | </code> | ||
+ | |||
+ | 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 --- | ||
+ | |||
+ | <texcode> | ||
+ | \input m-cweb | ||
+ | \activateCWEB | ||
+ | \setupinteraction[state=start] | ||
+ | \starttext | ||
+ | |||
+ | @** Hello World. | ||
+ | |||
+ | @c | ||
+ | @<header files@>@; | ||
+ | |||
+ | int main(void) { | ||
+ | printf("Hello World.\n"); | ||
+ | return(0); | ||
+ | } | ||
+ | |||
+ | @** Header Files. | ||
+ | @<header files@>+= | ||
+ | #include <stdio.h> | ||
+ | |||
+ | @ The end. | ||
+ | \stoptext | ||
+ | </texcode> | ||
+ | |||
+ | [[Category:Old_Content]] |
Latest revision as of 13:52, 8 June 2020
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] \starttext \title {Contents} \processCWEBcontents wc \page \title {Sections} \processCWEBsections wc \page \title {Sources} \processCWEBsource wc \page \title {Index} \processCWEBindex wc \page \stoptext
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. (/opt/texlive/8/texmf/web2c/cp8bit.tcx) entering extended mode ... system : macros of module cweb loaded (/opt/context/2004.6.26/texmf/tex/context/base/m-cweb.tex system : mark CWEBfilename defined [CWEBfilename] system : mark CWEBsectiontitle defined [CWEBsectiontitle] system : mark CWEBsectionnumber defined [CWEBsectionnumber] system : mark CWEBsectiondepth defined [CWEBsectiondepth] ) fonts : needs map file: ec-public-lm.map fonts : needs map file: original-base.map 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 \activateCWEB \setupinteraction[state=start] \starttext
2. Place the following line at the end of the web file:
\stoptext
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 \activateCWEB \setupinteraction[state=start] \starttext @** Hello World. @c @@; int main(void) { printf("Hello World.\n"); return(0); } @** Header Files. @ += #include @ The end. \stoptext