在 Windows 中读取 CWEB 格式代码的最佳方式是什么?
Donald Knuth 在他的页面上有大量可供阅读的程序 。 但它们大多采用“奇怪的”CWEB 格式...
使它们在 Windows 中适当可读的最佳方法是什么?
Donald Knuth has a large number of programs to read on his page. But they are mostly in a "strange" CWEB format...
What could be the best way to make them appropriately readable in Windows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不到五分钟的谷歌搜索就出现了这一点:http://www.literateprogramming.com/cweb_download.html< /a>
Less than five minutes of Googling brings this up: http://www.literateprogramming.com/cweb_download.html
我发现阅读
CWEB
程序最方便的方法是运行cweave
(manpage) 在.w
源文件上生成.tex
文件,然后运行pdfetex 以获得漂亮的超链接 PDF。 如图所示:
正如您所知,
CWEB
程序的结构本身就是一种超链接(其中部分引用其他部分)。 拥有一个漂亮的链接 PDF 阅读起来绝对是一种乐趣,特别是如果程序是由 Don Knuth 本人编写的!以下设置需要您付出一些努力(以及下载的 MB 数),但我希望您会喜欢最终结果:
cweave
和ctangle
,请下载 源并构建/安装它们。安装 cygwin 和 cweb 后,对您想要研究的任何
.w
程序执行以下操作(我以bdd12.w
为例):cweave
像这样:cweave bdd12.w
这应该生成一个
bdd12.tex
文件。pdfetex
,如下所示:pdfetex bdd12.tex
这将为您提供一个整洁的、交叉引用的 PDF。 生成的 PDF 末尾还有符号索引(以及更多交叉引用数据),因此您可以快速跳转到它们的定义。
The way I find most convenient to read a
CWEB
program is by runningcweave
(manpage) on the.w
source file to generate a.tex
file, and then runningpdfetex
to get a nice hyperlinked PDF. Pictorially:As you would be aware, the structure of a
CWEB
program is itself sort of hyperlinked (with sections referring other sections). Having a nice, linked PDF is a sheer pleasure to read, specially if the programs have been written by Don Knuth himself!The following setup would involve some effort on your part (and MBs of download), but I hope you'll like the final result:
cweave
andctangle
with cygwin, download the sources and build/install those.Once cygwin and cweb have been installed, do the following to any
.w
program you wish to study (I'm taking an example ofbdd12.w
):cweave
like so:cweave bdd12.w
This should generate a
bdd12.tex
file.pdfetex
like so:pdfetex bdd12.tex
This should get you a neat, cross-referenced PDF. The generated PDF also has an index of symbols at the end (and some more crossreferencing data), so you can quickly jump to their definitions.