p.println("__buffer[__index++] = FileWriter__5_4__the_bits;");
p.println("__buffer[__index++] = " + the_bits + ";");
    private static void genFileWriterWork(SIRFileWriter fw, int selfID,                                          CodegenPrintWriter p) {        String theType = "" + fw.getInputType();        if (theType.equals("bit")) {            // the bit type is special since you can not just read or            // write a bit.  It requires buffering in some larger            // integer type.            String bits_to_go = bitsToGoName(fw);            String the_bits = theBitsName(fw);                        p.println("unsigned char __buffer[____n/8+1];");            p.println("int __index = 0;");            p.println("for (; 0 < ____n; ____n--) {");            p.indent();            p.println(the_bits + " = (" + bits_type + ") ((" + the_bits                       + " << 1) | (" + ClusterUtils.popName(selfID)                       + "() & 1));");            p.println(bits_to_go + "--;");            p.println("if (" + bits_to_go + " == 0) {");            p.indent();            p.println("__buffer[__index++] = FileWriter__5_4__the_bits;");            p.println(the_bits + " = 0;");            p.println(bits_to_go + " = 8 * sizeof(" + the_bits + ");");            p.outdent();            p.println("}");            p.outdent();            p.println("}");            p.println("fwrite(__buffer, "                      + "sizeof(" + the_bits +"), " + "__index, " + fpName(fw)                      + ");");        } else {            // not a bit type.  write directly to file without needing to buffer bits.	    	    p.println("\n  int __index;" + "\n" +		      "  for (__index=0; __index < ____n; __index++) {" + "\n" +		      "    FileWriter_write<"+theType+">(__file_descr__"+selfID+", __pop__"+selfID+"());\n" +		      "  }\n");	    /*            NetStream in = RegisterStreams.getFilterInStream(fw);            // source and destination of incoming stream            int s = in.getSource();            int d = in.getDest();                        p.println("#ifdef __FUSED_" + s + "_" + d);            p.indent();             {                p.println("fwrite(&(BUFFER_" + s + "_" + d + "[TAIL_" + s + "_" + d + "]), " +                           "sizeof(BUFFER_" + s + "_" + d + "[TAIL_" + s + "_" + d + "]), " +                          "____n, " + fpName(fw) + ");");                p.println("TAIL_" + s + "_" + d + "+=____n;");            }            p.outdent();            p.println("#else");            p.indent();            {                p.println("fwrite(&(__pop_buf__" + selfID + "[__tail__" + selfID + "]), " +                          "sizeof(__pop_buf__" + selfID + "[__tail__" + selfID + "]), " +                          "____n, " + fpName(fw) + ");");                p.println("__tail__" + selfID + "+=____n;");            }            p.outdent();            p.println("#endif");	    */        }    }