sb.append("\tfprintf(" + Util.getFileHandle(out) + ", \"%e\n\", temp);\n"); sb.append("\tprintf(\"[%d]: %e\n\", port, temp);\n"); sb.append("if (outputs_" + out.getFileName() + " != -1 && ++outputs_" + out.getFileName() + " >= " +
sb.append("\tfprintf(" + Util.getFileHandle(out) + ", \"%e\\n\", temp);\n"); sb.append("\tprintf(\"[%d]: %e\\n\", port, temp);\n"); sb.append("if (" + Util.getOutputsVar(out) + " != -1 && ++" + Util.getOutputsVar(out) + " >= " +
    public String toC()     {	StringBuffer sb = new StringBuffer();	//store	sb.append("while (switch_to_io_move(machine, port, &temp) == 0) yield;\n");	for (int i = 0; i < dests.length; i++) {	    if (dests[i].isFileOutput()) {		FileOutputContent out = (FileOutputContent)((FilterTraceNode)dests[i].getNext()).getFilter();		sb.append("\tfprintf(" + Util.getFileHandle(out) + ", \"%e\n\", temp);\n");		sb.append("\tprintf(\"[%d]: %e\n\", port, temp);\n");		sb.append("if (outputs_" + out.getFileName() + 			 " != -1 && ++outputs_" + out.getFileName() + " >= " + 			 out.getOutputs() + ") quit_sim();\n");	    }	    else {		sb.append("\t\t" + MagicDram.getBufferIdent(source, dests[i]) +			  "_buffer[" + MagicDram.getBufferIdent(source, dests[i]) +			  "_st] = temp;\n");		sb.append("\t\t" +  MagicDram.getBufferIdent(source, dests[i]) + 			  "_st = (" +  MagicDram.getBufferIdent(source, dests[i]) + 			  "_st + 1) % " +  MagicDram.getBufferIdent(source, dests[i]) + 			  "_size;\n");	    }	}		sb.append("\t\tyield;\n");	return sb.toString();    }