在 Windows 中读取 CWEB 格式代码的最佳方式是什么?

发布于 2024-07-24 16:32:50 字数 193 浏览 4 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心碎的声音 2024-07-31 16:32:50

不到五分钟的谷歌搜索就出现了这一点:http://www.literateprogramming.com/cweb_download.html< /a>

Less than five minutes of Googling brings this up: http://www.literateprogramming.com/cweb_download.html

因为看清所以看轻 2024-07-31 16:32:50

我发现阅读 CWEB 程序最方便的方法是运行 cweave (manpage) 在.w源文件上生成.tex文件,然后运行pdfetex 以获得漂亮的超链接 PDF。 如图所示:

     `.W SOURCE   ----(cweave)---->   .TEX   ----(pdfetex)---->   PDF`

正如您所知,CWEB 程序的结构本身就是一种超链接(其中部分引用其他部分)。 拥有一个漂亮的链接 PDF 阅读起来绝对是一种乐趣,特别是如果程序是由 Don Knuth 本人编写的!

以下设置需要您付出一些努力(以及下载的 MB 数),但我希望您会喜欢最终结果:

  • 安装 Cygwin(对于任何认真的 Windows 程序员来说,我认为安装 cygwin 是理所当然的事情)。 确保安装与排版相关的软件包(tex、pdfetex、amstex 等)。 如果 cygwin 为您提供了安装 CWEB 的选项,请也这样做。
  • 如果您没有通过 cygwin 获得 cweavectangle,请下载 并构建/安装它们。

安装 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 running cweave (manpage) on the .w source file to generate a .tex file, and then running pdfetex to get a nice hyperlinked PDF. Pictorially:

     `.W SOURCE   ----(cweave)---->   .TEX   ----(pdfetex)---->   PDF`

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:

  • Install Cygwin (for any serious Windows programmer, I think installing cygwin is a no-brainer). Make sure you install the Typesetting related packages (tex, pdfetex, amstex and all that). If cygwin gives you an option to install CWEB, do that too.
  • If you don't get cweave and ctangle 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 of bdd12.w):

  • Run cweave like so: cweave bdd12.w
    This should generate a bdd12.tex file.
  • Then run 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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文