ret.append("#define BUFSIZE " + buffersize + "\n\n");
ret.append("#define BUFSIZE " + buffersize + "\n"); ret.append("#define MINUSONE " + (buffersize - 1) + "\n\n");
    private static String createJoinerWork(FlatNode joiner)     {	boolean fp = false;	StringBuffer ret = new StringBuffer();	int buffersize = nextPow2((Integer)SimulationCounter.maxJoinerBufferSize.get(joiner),				  joiner);	//get the type, since this joiner is guaranteed to be connected to a filter	CType ctype = getJoinerType(joiner);  //??	if (ctype.equals(CStdType.Float))	    fp = true;	String type = ctype.toString(); 		ret.append("#define BUFSIZE " + buffersize + "\n\n");		ret.append("void work() { \n");	//print the temp for the for loop	ret.append("  int rep;\n");	HashSet buffers = (HashSet)JoinerSimulator.buffers.get(joiner);	Iterator bufIt = buffers.iterator();	//print all the var definitions	while (bufIt.hasNext()) {	    String current = (String)bufIt.next();	    ret.append("int first" + current + " = 0;\n");	    ret.append("int last" + current + " = 0;\n");	    ret.append(type + " buffer" + current + "[BUFSIZE];\n");	}	//print the init schedule			JoinerScheduleNode init = (JoinerScheduleNode)Simulator.initJoinerCode.get(joiner);	while (init != null) {	    int repeat = 1;	    String code = init.getC(fp);	    init = init.next;	    //look for repeats	    while (true) {		if (init == null)		    break;		if (init.getC(fp).equals(code)) {		    init = init.next;		    repeat++;		}		else 		    break;	    }	    if (repeat > 1) 		ret.append("for (rep = 0; rep < " + repeat + "; rep++) {\n");	    ret.append(code);	    if (repeat > 1)		ret.append("}\n");	    	}	//print the steady state schedule	JoinerScheduleNode steady = (JoinerScheduleNode)Simulator.steadyJoinerCode.get(joiner);	ret.append("while(1) {\n");	while (steady != null) {	    int repeat = 1;	    String code = steady.getC(fp);	    steady = steady.next;	    //look for repeats	    while (true) {		if (steady == null)		    break;		if (steady.getC(fp).equals(code)) {		    steady = steady.next;		    repeat++;		}		else 		    break;	    }	    if (repeat > 1) 		ret.append("for (rep = 0; rep < " + repeat + "; rep++) {\n");	    ret.append(code);	    if (repeat > 1)		ret.append("}\n");	}	ret.append("}}\n");	return ret.toString();	    }