function table(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9){ printf("#label %s, %s, %s, %s, %s, %s, %s, %s, %s, %s\n", x0,x1,x2,x3,x4,x5,x6,x7,x8,x9); } function note(pitch,step){ if (step < 128) printf("\t%sb1 , %d, 127\n",pitch,step); else printf("\t%sb1w, %d, 127\n",pitch,step); } function rest(step){ if (step < 128) printf("\txxx , %d\n",step); else printf("\txxxw, %d\n",step); } function seqs(num,xxx,c3,c4,c5){ printf("_v_%s\n",num); print "\tcall, _v_comst"; printf("\tnprg, INST_%s\n",num); if (xxx != 0) rest(xxx); if (c3 != 0) note("cn3",c3); if (c4 != 0) note("cn4",c4); if (c5 != 0) note("cn5",c5); print "\tfin" print; } BEGIN{ ON=1; OFF=0; table_count=0; table_flg=ON; seq_count=0; } { if (NF == 0) next; if (table_flg==ON){ for(i=1;i<=NF;i++){ if ($(i)~/#TBLEND/){ table_flg=OFF; break; } tbl[table_count]=$(i); table_count++; } } else{ if (NF != 5){ print "読み取りエラー"; print $0; exit; } num[seq_count]=$1; xxx[seq_count]=$2; c3[seq_count]=$3; c4[seq_count]=$4; c5[seq_count]=$5; seq_count++; } }