1*43125SbosticTo convert two pass to 1 pass operation: 2*43125Sbostic(I suggest that you use a subdirectory, since 3*43125Sbosticit is hard to repair some of this damage once done) 4*43125Sbostic 5*43125SbosticI assume that you have new copies of the machine-independent 6*43125Sbosticfiles. The file cl is no longer used, and there is no 7*43125Sbosticuse of lex at all. The file scan.c contains the new 8*43125Sbosticlexical analyzer. Moreover, the file comm2.c is no longer 9*43125Sbosticused when the passes are loaded together. 10*43125SbosticThese changes may affect local procedures for searching, printing, 11*43125Sbosticdiffing, etc. the compiler. 12*43125Sbostic 13*43125SbosticI suggest that you take the makefile in /usr/n as well, to help you 14*43125Sbosticalong. 15*43125Sbostic 16*43125SbosticThe conversion process, as well as I understand it is as follows. 17*43125Sbostic 18*43125Sbostic1. Make a subdirectory, and put in it the old machine dependent files 19*43125Sbosticmacdefs, mac2defs, local.c, order.c, code.c, local2.c, and table.c. 20*43125SbosticPut in all the new machine independent stuff, including the new makefile 21*43125Sbostic 22*43125Sbostic2. Insert the line # define ONEPASS into macdefs 23*43125SbosticChange LABFMT by deleting the \n. 24*43125Sbostic 25*43125Sbostic3. In all the machine dependent source files local.c, 26*43125Sbosticcode.c, order.c, local2.c, and table.c, remove the includes of 27*43125Sbosticmanifest and macdefs; these are now included by mfile1 and mfile2. 28*43125Sbostic 29*43125Sbostic4. The main routine for pass 2 (probably on local2.c) 30*43125Sbosticshould be deleted; it probably only does a call to mainp2. 31*43125SbosticIf it does anything else of interest, 32*43125Sbosticlet me know. 33*43125Sbostic 34*43125Sbostic5. On the file local.c, in the routine `ecode', 35*43125Sbosticreplace the lines 36*43125Sbostic printf( ".%d\t%s\n", lineno, ftitle ); 37*43125Sbostic prtree( p ); 38*43125Sbosticby 39*43125Sbostic p2tree( p ); 40*43125Sbostic p2compile( p ); 41*43125Sbostic 42*43125Sbostic6. In code.c, in the function bccode, replace the line 43*43125Sbostic printf( "[\t%d\t%d\t%d\t\n", ftnno, XXXX, YYYY ); 44*43125Sbosticby 45*43125Sbostic p2bbeg( XXXX, YYYY ); 46*43125SbosticAlso, in efcode, replace the line which prints out the "]..." 47*43125Sbosticwith 48*43125Sbostic p2bend(); 49*43125Sbostic 50*43125Sbostic7. In code.c and local.c, look at all remaining printfs. Lines 51*43125Sbosticwhich go onto the intermediate file all had ")" at the head. 52*43125SbosticAll of these must be clobbered. Thus, a line which read 53*43125Sbostic printf( ") xxx yyy\n) zzz www\n" ); 54*43125Sbosticmust be changed to read 55*43125Sbostic printf( " xxx yyy\n zzz www\n" ); 56*43125SbosticThis is tedious, although a few cleverly chosen ed commands 57*43125Sbosticwill probably do the trick. 58*43125Sbostic 59*43125Sbostic8. Say make, and stand back. The result is a 60*43125Sbosticsingle program called comp. 61*43125SbosticYou may experience loading errors as a result of having used the 62*43125Sbosticsame external names in the first and second pass. Look at the 63*43125Sbosticbeginning of mfile2 to get a hint about one way to deal with 64*43125Sbosticthis problem (add stuff to mac2defs to change the names). 65*43125SbosticThe other way to deal with it is just fix it... 66*43125Sbostic 67*43125Sbostic9. As a side-effect of other changes, the meaning of the arguments 68*43125Sbosticto match has changed slightly; ASG OPANY, as it always 69*43125Sbosticdid, matches any assignment op except ++, --, and = itself. 70*43125SbosticOPANY, on the other hand, matches only ops which are not assignment 71*43125Sbosticops. In table.c, there must be explicit rewriting rule entries for 72*43125Sbostic++, --, and =. In most cases with which I am familiar, this should 73*43125Sbosticbe true already, and no change is needed. 74*43125Sbostic 75*43125Sbostic10. Usage is /lib/cpp x.c | comp 76*43125Sbosticwhich produces assembler output on the std. output. 77*43125Sbosticresearch!/usr/bin/ncc gives the interdata compiler, with many 78*43125Sbosticbells and whistles, as a Bourne shell script. 79*43125Sbosticregression tests, and checks that this compiler 80*43125Sbosticproduces the same output as the earlier one, are 81*43125Sbosticboth wise. 82*43125Sbostic 83*43125SbosticGood Luck! 84