⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 convert

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻
字号:
To convert two pass to 1 pass operation:(I suggest that you use a subdirectory, sinceit is hard to repair some of this damage once done)I assume that you have new copies of the machine-independentfiles.  The file cl is no longer used, and there is nouse of lex at all.  The file scan.c contains the newlexical analyzer.  Moreover, the file comm2.c is no longerused when the passes are loaded together.These changes may affect local procedures for searching, printing,diffing, etc. the compiler.I suggest that you take the makefile in /usr/n as well, to help youalong.The conversion process, as well as I understand it is as follows.1.  Make a subdirectory, and put in it the old machine dependent filesmacdefs, mac2defs, local.c, order.c, code.c, local2.c, and table.c.Put in all the new machine independent stuff, including the new makefile2.  Insert the line # define ONEPASS into macdefsChange LABFMT by deleting the \n.3.  In all the machine dependent source files local.c,code.c, order.c, local2.c, and table.c, remove the includes ofmanifest and macdefs; these are now included by mfile1 and mfile2.4.  The main routine for pass 2 (probably on local2.c)should be deleted; it probably only does a call to mainp2.If it does anything else of interest,let me know.5.  On the file local.c, in the routine `ecode',replace the lines     printf( ".%d\t%s\n", lineno, ftitle );     prtree( p );by     p2tree( p );     p2compile( p );6.  In code.c, in the function bccode, replace the line     printf( "[\t%d\t%d\t%d\t\n", ftnno, XXXX, YYYY );by     p2bbeg( XXXX, YYYY );Also, in efcode, replace the line which prints out the "]..."with     p2bend();7.  In code.c and local.c, look at all remaining printfs.  Lineswhich go onto the intermediate file all had ")" at the head.All of these must be clobbered.  Thus, a line which read     printf( ")    xxx yyy\n)   zzz  www\n" );must be changed to read     printf( "    xxx yyy\n   zzz  www\n" );This is tedious, although a few cleverly chosen ed commandswill probably do the trick.8.  Say make, and stand back.  The result is asingle program called comp.You may experience loading errors as a result of having used thesame external names in the first and second pass.  Look at thebeginning of mfile2 to get a hint about one way to deal withthis problem (add stuff to mac2defs to change the names).The other way to deal with it is just fix it...9.  As a side-effect of other changes, the meaning of the argumentsto match has changed slightly; ASG OPANY, as it alwaysdid, matches any assignment op except ++, --, and = itself.OPANY, on the other hand, matches only ops which are not assignmentops.  In table.c, there must be explicit rewriting rule entries for++, --, and =.  In most cases with which I am familiar, this shouldbe true already, and no change is needed.10. Usage is  /lib/cpp x.c | compwhich produces assembler output on the std. output.research!/usr/bin/ncc gives the interdata compiler, with manybells and whistles, as a Bourne shell script.regression tests, and checks that this compilerproduces the same output as the earlier one, areboth wise.Good Luck!

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -