Using context with cweave
I created the file hello.w containing the following lines ---
@** Hello.
@c
@
On 8/28/07, John Luciani
I created the file hello.w containing the following lines ---
@** Hello.
@c @
@; int main(void) { printf("Hello World.\n"); return(0); }
@ Header files. @
+= #include I run the commands cweave hello.w texexec --pdf --modules m-cweb hello.tex
The text that is output in hello.pdf are cweb macros ---
\input cwebmac \N{0}{1}Hello. \Y\B\X2:header files\X\7 For printed version
$> texexec --pdf test.tex
%% hello.tex
\input m-cweb
\activateCWEB
\starttext
\N{0}{1}Hello.
\Y\B\X2:header files\X\7
\&{int} \\{main}(\&{void})\1\1\2\2\6
${}\{{}$\1\6
\\{printf}(\.{"Hello\ World.\\n"});\6
\&{return} (\T{0});\6
\4${}\}{}$\2\par
\fi
\M{2}Header files.
\Y\B\4\X2:header files\X${}\E{}$\6
\8\#\&{include} \.{
On 8/27/07, luigi scarso
On 8/28/07, John Luciani
wrote: I created the file hello.w containing the following lines ---
@** Hello.
@c @
@; int main(void) { printf("Hello World.\n"); return(0); }
@ Header files. @
+= #include I run the commands cweave hello.w texexec --pdf --modules m-cweb hello.tex
The text that is output in hello.pdf are cweb macros ---
\input cwebmac \N{0}{1}Hello. \Y\B\X2:header files\X\7 For printed version
$> texexec --pdf test.tex %% hello.tex \input m-cweb \activateCWEB \starttext \N{0}{1}Hello.
\Y\B\X2:header files\X\7 \&{int} \\{main}(\&{void})\1\1\2\2\6 ${}\{{}$\1\6 \\{printf}(\.{"Hello\ World.\\n"});\6 \&{return} (\T{0});\6 \4${}\}{}$\2\par \fi
\M{2}Header files. \Y\B\4\X2:header files\X${}\E{}$\6 \8\#\&{include} \.{
}\par \U1.\fi
\inx \fin \con \stoptext
Thanks. The printed version now compiles! I noticed the following differences from the pdftex version --- * The first line is not indented * The section hyperlinks are not created * The @d sections and the @< @> declaration sections begin in the left margin.
for screen ....
??? Thanks for your help. (* jcl *) -- http://www.luciani.org
for screen ....
??? This is a new topicct for me; to compile, I have had a quick look inside m-cweb but nothing more. Actually I have no idea if one can have a screen version with some macro like \activateCWEB, I'm sorry.
-- luigi ---------------------------------------------------------------- If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
On 8/28/07, luigi scarso
for screen ....
??? This is a new topicct for me; to compile, I have had a quick look inside m-cweb but nothing more. Actually I have no idea if one can have a screen version with some macro like \activateCWEB, I'm sorry.
I appreciate your help. Thanks. The screen version example that I like is at http://www.pragma-ade.com/itdemos/internal/cweb/cweb-scr.pdf (* jcl *) -- http://www.luciani.org
The screen version example that I like is at http://www.pragma-ade.com/itdemos/internal/cweb/cweb-scr.pdf Yes, I like it too. I'm really interesting about WEB, so I would like to produce something analogous for WEB too. Do youn know leo ? http://webpages.charter.net/edreamleo/front.html
-- luigi ---------------------------------------------------------------- If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
On 8/28/07, luigi scarso
The screen version example that I like is at http://www.pragma-ade.com/itdemos/internal/cweb/cweb-scr.pdf Yes, I like it too. I'm really interesting about WEB, so I would like to produce something analogous for WEB too. Do youn know leo ? http://webpages.charter.net/edreamleo/front.html
I have not used leo. For editing tasks I default to my old friend --- EMACS ;-) Whether editing C for an MSP430 or Coldfire chip, Perl, TeX (and friends) or SQL I use the same tool. For cweb editing I have been using multiple-major-mode (mmm) so that TeX and cweb are colorized appropriately. (* jcl *) -- http://www.luciani.org
On Tue, 28 Aug 2007, John Luciani wrote:
On 8/28/07, luigi scarso
wrote: for screen ....
??? This is a new topicct for me; to compile, I have had a quick look inside m-cweb but nothing more. Actually I have no idea if one can have a screen version with some macro like \activateCWEB, I'm sorry.
I appreciate your help. Thanks.
The screen version example that I like is at http://www.pragma-ade.com/itdemos/internal/cweb/cweb-scr.pdf
Did you try: http://wiki.contextgarden.net/CWEB (the page says cweb is broken, but you got partial success, so worth a try) Aditya
On 8/30/07, Aditya Mahajan
Did you try:
http://wiki.contextgarden.net/CWEB
(the page says cweb is broken, but you got partial success, so worth a try)
Using Luigi's suggestion I did the following --- * In the tex file created by cweave replace the line \input cwebmac with \input m-cweb \activateCWEB \starttext * At the end of the tex file add the line \stoptext * run the command texexec --pdf TEXFILENAME The resultant pdf file is missing hyperlinks and the indentation is off. (* jcl *) -- http://www.luciani.org
On Fri, 31 Aug 2007, John Luciani wrote:
On 8/30/07, Aditya Mahajan
wrote: Did you try:
http://wiki.contextgarden.net/CWEB
(the page says cweb is broken, but you got partial success, so worth a try)
Using Luigi's suggestion I did the following ---
* In the tex file created by cweave replace the line
\input cwebmac
with
\input m-cweb \activateCWEB \starttext
* At the end of the tex file add the line
\stoptext
* run the command
texexec --pdf TEXFILENAME
The resultant pdf file is missing hyperlinks and the indentation is off.
A guess for hyperlinks. Try \setupinteraction[state=start]. Aditya
On 8/31/07, Aditya Mahajan
On Fri, 31 Aug 2007, John Luciani wrote:
On 8/30/07, Aditya Mahajan
wrote: Did you try:
http://wiki.contextgarden.net/CWEB
(the page says cweb is broken, but you got partial success, so worth a try)
Using Luigi's suggestion I did the following ---
* In the tex file created by cweave replace the line
\input cwebmac
with
\input m-cweb \activateCWEB \starttext
* At the end of the tex file add the line
\stoptext
* run the command
texexec --pdf TEXFILENAME
The resultant pdf file is missing hyperlinks and the indentation is off.
A guess for hyperlinks. Try \setupinteraction[state=start].
That worked!!! Thanks. I will have to browse through the documentation for the various options. (* jcl *) -- http://www.luciani.org
Aditya Mahajan wrote:
On Fri, 31 Aug 2007, John Luciani wrote:
That worked!!! Thanks.
Can you update the wiki page on how to get a working cweb file using ConTeXt?
i didn't join this discussion but the complication of web code is that it defines all those one char commands and such it would be nice to have a variant of cweb that spits out more verbose commands, so that we don't need to push/pop definitions and get rid of interference ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 8/31/07, Hans Hagen
Aditya Mahajan wrote:
On Fri, 31 Aug 2007, John Luciani wrote:
That worked!!! Thanks.
Can you update the wiki page on how to get a working cweb file using ConTeXt?
i didn't join this discussion but the complication of web code is that it defines all those one char commands and such
it would be nice to have a variant of cweb that spits out more verbose commands, so that we don't need to push/pop definitions and get rid of interference
That would be extremely useful. I am using cweb to document code for embedded systems. I like to use single character macros to typeset component reference designators and electrical parameters. I use macro calls like: For components --- \R{1}, \C{23}, \L{43} For voltages and currents --- \V{1}, \I{1} etc. For dimensions --- \F (farads), \S (seconds), \H (henries), etc. Since your here ---- Is there any chance of getting the cweb file that was used to generate cweb-scr.pdf? I like the format and was hoping to do something similar with my programs. Thanks. (* jcl *) -- http://www.luciani.org
John Luciani wrote:
Since your here ---- Is there any chance of getting the cweb file that was used to generate cweb-scr.pdf? I like the format and was hoping to do something similar with my programs.
remind me in a few weeks .. to busy with other things now (new xml mechanisms) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 8/31/07, Hans Hagen
John Luciani wrote:
Since your here ---- Is there any chance of getting the cweb file that was used to generate cweb-scr.pdf? I like the format and was hoping to do something similar with my programs.
remind me in a few weeks .. to busy with other things now (new xml mechanisms)
Sounds great! Thanks. (* jcl *) -- http://www.luciani.org
On 8/31/07, Aditya Mahajan
On Fri, 31 Aug 2007, John Luciani wrote:
That worked!!! Thanks.
Can you update the wiki page on how to get a working cweb file using ConTeXt?
Aditya
I added my notes to the bottom of the page --- http://wiki.contextgarden.net/CWEB If that is not the appropriate place let me know and I can move it. Feel free to make any modifications. (* jcl *) -- http://www.luciani.org
Anothers step: 1) save you cweaved tex file as wc.tex 2) put this in test0001a.tex %% tex0001a \usemodule [cweb] \def\ignoreCWEBinput{\relax} \activateCWEB \setupinteraction[state=start] \starttext \title {Contents} \processCWEBcontents wc \page \title {Sections} \processCWEBsections wc \page \title {Sources} \processCWEBsource wc \page \title {Index} \processCWEBindex wc \page \stoptext 3) texexec --pdf --batch test0001a \def\ignoreCWEBinput{\relax} avoid endless loop for now. btw, it's no correct again. -- luigi ---------------------------------------------------------------- If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
On 8/31/07, luigi scarsowrote: > Anothers step: > 1) save you cweaved tex file as wc.tex No, sorry. 1) Save you cweb file in wc.cweb. process as usual with $> cweave wc.cweb then comment \input cwebmac in wc.tex You should end with wc.cweb wc.idx wc.scn wc.tex wc.toc 2) put this in test0001a.tex %% tex0001a \usemodule [cweb] \def\ignoreCWEBinput{\relax} \setupinteraction[state=start] \starttext \title {Contents} \processCWEBcontents wc \page \title {Sections} \processCWEBsections wc \page \title {Sources} \processCWEBsource wc \page \title {Index} \processCWEBindex wc \page \stoptext 3) texexec --pdf --batch test0001a \def\ignoreCWEBinput{\relax} avoid endless loop for now; btw, it's no correct again (maybe wc.toc ?) And again, no news for screen version. -- luigi ---------------------------------------------------------------- If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
On 8/31/07, luigi scarso
wrote: Anothers step: 1)..
On 9/1/07, luigi scarso
Anothers step: 1)... 2a) put this in test001b.tex \usemodule[cweb] \setupbodyfont [9pt] \setuppapersize [S6][S6] \setuplayout [backspace=72.5pt, leftmargin=50pt, leftmargindistance=12.5pt, rightmargin=0pt, rightedge=80pt, rightedgedistance=10pt, leftedge=0pt, width=430pt, topspace=10pt, header=0pt, footer=30pt, bottomdistance=10pt, bottom=15pt, height=410pt, style=\ss] \setupinteraction[state=start] \def\ignoreCWEBinput{\relax} \unprotect \def\fixtranslatednumber[#1--#2::#3]{% \@@filterpagepart[#1--#2--#3]} \protect \defCWEBmacro\contentsline#1#2#3#4#5% {\ifnum#2=0 \smallbreak \fi \line{\consetup{#2}#1 \rm \leaders\hbox to .5em{.\hfil}\hfil\ {\localcolortrue\goto{#3}[web:#3]}% below: \gotorealpage ? should be changed \hbox to3em{\localcolortrue\hss\gotorealpage{}{}{#5}{\fixtranslatednumber[#4]\presetgoto}}}} \starttext \title {Contents} \processCWEBcontents wc \page \title {Sections} \processCWEBsections wc \page \title {Sources} \processCWEBsource wc \page \title {Index} \processCWEBindex wc \page \stoptext 2b)put this in process.tex \usemodule[abr-01] \usemodule[mod-00] \usemodule[mod-02] \def\TypeThreeModule#1% {\readfile{#1.tex}{}{}% \WriteBatchFile} \def\WriteBatchFile {\doglobal\increment\ModuleNumber \immediate\write\BatchFile{texmfstart texexec --pdf --batch \FileName }} \starttext \TitelBlad{Documentation} \placemodulecontent \ModuleGroup{test001b}{test001b} \processmodule{test001b} {3} \placemoduleregister \ColofonBlad \stoptext 3) now you must set shell_escape=t and compile with $> texexec --pdf process Ok, now we have a "dirty" screen version (better than nothing, isn't it ?) -- luigi ---------------------------------------------------------------- If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
On 8/31/07, luigi scarso
Ok, now we have a "dirty" screen version (better than nothing, isn't it ?)
Thanks again. I tried both the print and the screen instructions and both compile without error. I will have to compare the print version output with the plain tex output but it looks quite close now. I will take a closer look at the screen version as well. (* jcl *) -- http://www.luciani.org
participants (4)
-
Aditya Mahajan
-
Hans Hagen
-
John Luciani
-
luigi scarso