91 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Text
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			91 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			Text
		
	
	
		
			Executable file
		
	
	
	
	
| EM_TABLE=../../../etc/em_table
 | |
| echo "switch(p->em_opcode) {"
 | |
| for i in - cdflnorswz p b
 | |
| do
 | |
| 	list=`./argtype $i $EM_TABLE`
 | |
| 	case $i in
 | |
| 	-)	args='()'
 | |
| 		echo "	/* no arguments */"
 | |
| 		;;
 | |
| 	cdflnorswz)
 | |
| 		args='(p->em_cst)'
 | |
| 		echo "	/* one integer constant argument */"
 | |
| 		;;
 | |
| 	p)
 | |
| 		args='(p->em_pnam)'
 | |
| 		echo "	/* a procedure name argument */"
 | |
| 		;;
 | |
| 	b)
 | |
| 
 | |
| : Grumbl, an instruction label as argument is encoded in a sp_cst2
 | |
| 
 | |
| 		args='((label) (p->em_cst))'
 | |
| 		echo "	/* An instruction label argument */"
 | |
| 		;;
 | |
| 	esac
 | |
| 	for i in $list
 | |
| 	do
 | |
| 		cat << EOF
 | |
| 	case op_$i:
 | |
| 		C_$i$args;
 | |
| 		break;
 | |
| EOF
 | |
| 	done
 | |
| done
 | |
| list=`./argtype g $EM_TABLE`
 | |
| cat << 'EOF'
 | |
| 	default:
 | |
| /* a "g" argument */
 | |
| 		if (p->em_argtype == nof_ptyp) {
 | |
| 			switch(p->em_opcode) {
 | |
| 				default:
 | |
| 					C_error = "Illegal mnemonic";
 | |
| 					break;
 | |
| EOF
 | |
| for i in $list
 | |
| do
 | |
| 	cat << EOF
 | |
| 				case op_$i:
 | |
| 					C_${i}_dlb(p->em_dlb, p->em_off);
 | |
| 					break;
 | |
| EOF
 | |
| done
 | |
| cat << 'EOF'
 | |
| 			}
 | |
| 		}
 | |
| 		else if (p->em_argtype == sof_ptyp) {
 | |
| 			switch(p->em_opcode) {
 | |
| 				default:
 | |
| 					C_error = "Illegal mnemonic";
 | |
| 					break;
 | |
| EOF
 | |
| for i in $list
 | |
| do
 | |
| 	cat << EOF
 | |
| 				case op_$i:
 | |
| 					C_${i}_dnam(p->em_dnam, p->em_off);
 | |
| 					break;
 | |
| EOF
 | |
| done
 | |
| cat << 'EOF'
 | |
| 			}
 | |
| 		}
 | |
| 		else /*argtype == cst_ptyp */ {
 | |
| 			switch(p->em_opcode) {
 | |
| 				default:
 | |
| 					C_error = "Illegal mnemonic";
 | |
| 					break;
 | |
| EOF
 | |
| for i in $list
 | |
| do
 | |
| 	cat << EOF
 | |
| 				case op_$i:
 | |
| 					C_$i(p->em_cst);
 | |
| 					break;
 | |
| EOF
 | |
| done
 | |
| cat << 'EOF'
 | |
| 			}
 | |
| 		}
 | |
| }
 | |
| EOF
 |