Google
 

Trailing-Edge - PDP-10 Archives - mit_emacs_170_teco_1220 - emacs/maccnv.emacs
There are no other files named maccnv.emacs in the archive.
!* -*-TECO-*- *!
!~Filename~:! !Convert Twenex MONSYM file into TWXBTS.MID (Rel 4).!
MACCNV
!Convert MACRO-10:! !C Convert MACRO-10 defs files to MIDAS defs files.
Turns every assignment into a DEFSYM.
Converts MACRO-10 nnBm and ^D and "X" to MIDAS.!

    [0 [1
!*** Make @FLR move across a balanced MIDAS expression.!
    [..d 128*5,A:I..D
  <(1m(m.m &)Alter)..D)  , 

    j < :s=;			    !* Find next symbol definition.!
	.( 0l 1a-;"e )w l !<!>' )j  !* Ignore ='s in comments.!
	@f=r
	.u1 0l 6F~DEFSYM"e l !<!>' q1j   !* Ignore lines that are already defsyms.!
	1a-:"e c' "# i:'	    !* Put a colon in after one or two ='s unless one is there!
	.u0 :fb;"e :l' .u1	    !* Put q0, q1 around sym value (not incl comment)!
	q0,q1fs bound
	j<:sB; -d		    !* Search for the "B" construct.!
	  1af0123456789:"l	    !* "B" followed by digit =>!
	    .,(\u1 .)fk	    !* gobble and delete the number,!
	    i_ 35-q1\ i.'	    !* Put back _35 minus it, in decimal, with point.!
	  "#
	    i_<35.-.RADIX 10., !* Turn nnnB<FOO> into nnn_<35.-.RADIX 10.,<FOO>>.!
	    fll i>'
	  >
	0fsvbw 0fsvz
	0l i DEFSYM	 l	    !* Put DEFSYM at front of line.!
	>
    j < :s=:<Z_; 2rdi0 >	    !* Convert <Z -3> to <0 -3>!
    j < :s";			    !* If we see a " not in a comment,!
	0:fb;.err"e
	  c 1a-" !'!"e d'	    !* Convert "X" into just "X !
		"# ''		    !* Can't convert => ask user to fix.!
	"# l'>
    j < :s ^D; -2d
	1af0123456789:"l	    !* ^D followed by digit =>!
	  \w i.'		    !* Use decimal point instead.!
	"# i .RADIX_10.,' >	    !* Else ^D turns into .RADIX 10.,!
!** Delete all macro definitions.!
    j < :s
DEFINE;
        0l .,(s<!>! r.)k	    !* Delete up to "<" that starts the macro.!
	flk >			    !* Delete body of macro.!
    
!Convert MONSYM:! !C Convert MONSYM.MAC to TWXBTS.MID.!

    [0 [1
    J sDEFINE_JSLISTl
    b,.k			    !* Kill stuff at head of file!
    .u0
    s
JSLIST 0lk			    !* Find end of them.!
    .,(-s
> 0l .)fk			    !* Flush end of JSLIST defn, and call to it.!
    fsz-.f[vz
    q0j < :sDEFJS_;		    !* Turn DEFJS FOO,30,... into DEFSYM FOO=:JSYS 30 .!
    	  0kiDEFSYM	
	  s,-d
	  i=:JSYS_
	  s,
fkc :k>
    0fsvz
    sOPDEF_ERJMP		    !* Flush the MACRO definitions of ERJMP, ERCAL,!
    0l .,(s >> l.)k
    i
DEFSYM	ERJMP=:JUMP_16,0		;JUMP_ON_ERROR
DEFSYM	ERCAL=:JUMP_17,0		;CALL_ON_ERROR_(SIMULATE_PUSHJ_17,ADR)

    sDEFINE_GOPDEF		    !* Flush definition of GOPDEF.!
    0l .u0 .,( s
;-l .)k
    s
0l z-.fsvz		    !* Restricting to just this page,!
    q0j < :s GOPDEF_;		    !* Turn GOPDEFs into DEFSYMs.!
	  0k i DEFSYM	 s,rdi=: >
    s.NODDT0lk	  
    0fsvz
    (sBRINI.-2l .),(s
0l.)k	    !* Flush break mask stuff.!
    sDEFINE_.ERCOD 0l.u0 k
      s
DEFINE_.ERR_
      -s
> 0l .,zk			    !* Kill definition of .ERR and all that follows.!
      q0j < :s.err_(;		    !* Change each .ERR into an assignment.!
            0k .,(s,r.)fx1	    !* Put numeric value in Q1 as string.!
	    iDEFSYM	 d
	    s, r2d i==:.ERBAS+1 !* Turn it into an assignment statement.!
	    i	;
	    !<! s> r:k >	    !* Turn error message into a comment.!
    m(m.m Convert_Macro-10)	    !* Do general things.!
    bji;_TWENEX_system_bits
;_This_file_is_generated_from_MONSYM.MAC_by_the_Convert_Monsym_macro
;_in_the_MACCNV_EMACS_library.  

.AUXIL


IFNDEF_DEFSYM,[	;ALLOW_USER_TO_USE_SYMBOLS_IN_OTHER_WAYS_IF_HE_WISHES.
		;BUT_NORMALLY,_DEFSYM_FOO==BAR_DOES_FOO==BAR_WITH_ERROR_CHECK.
DEFINE_DEFSYM_X/
IRPS_Z,,[X]
IFNDEF_Z,.QUOTE/.QUOTE/X
.ELSE_[
___$$TEM1==Z
___.QUOTE/.QUOTE/X
___IFN_Z-$$TEM1,.ERR_Z_MULTIPLY_.QUOTE`.QUOTE/DEFINED/`
]
.ISTOP
TERMIN_TERMIN

IFLE_.MLLIT,.ERR_.MLLIT_MUST_BE_1;_SETTING_IT_TO_1.
.MLLIT==1
$$TEMP==1
]
.ELSE_$$TEMP==0


    zji

;If_this_file_provided_the_definition_of_DEFSYM,_flush_it_
;so_that_we_leave_things_as_we_found_them.
IFN_$$TEMP,EXPUNG_DEFSYM