print("  sock->write_int(sdep_"+selfID+"_"+dst+"->getSrcPhase4DstPhase(iteration+"+max+"));\n");
print("  sock->write_int(sdep_"+selfID+"_"+dst+"->getSrcPhase4DstPhase(iteration+"+max+"+1));\n");
    public void visitMessageStatement(SIRMessageStatement self,                                      JExpression portal,                                      String iname,                                      String __ident,                                      JExpression[] params,                                      SIRLatency latency)    {        /*          print("//send_" + iname + "_" + ident + "(");          portal.accept(this);          print(", ");          latency.accept(this);          if (params != null)          for (int i = 0; i < params.length; i++)          if (params[i] != null)          {          print(", ");          params[i].accept(this);          }          print(");");        */        String ident;        int num_params = 0;        if (portal instanceof SIRPortal) {            SIRStream receivers[] = ((SIRPortal)portal).getReceivers();            for (int i = 0; i < receivers.length; i++) {                int dst = NodeEnumerator.getSIROperatorId(receivers[i]);                System.out.println("/* iname: "+iname+" ident: "+self.getMessageName()+" type: "+((SIRPortal)portal).getPortalType().getCClass()+"*/\n");                System.out.println("params size: "+params.length);                ident = ((JStringLiteral)params[1]).stringValue();                print("/*");                for (int y = 0;; y++) {                    // this causes only msg param to be output                    PRINT_MSG_PARAM = y;                    params[2].accept(this);                    if (PRINT_MSG_PARAM == -1) break; // no more params!                    num_params++;                    print(",");                }                print(" num_params: "+num_params+"*/\n");                /*                  try {                  print(((JStringLiteral)params[1]).stringValue());                  // params[1].accept(this); // name of the portal method!                               print("\n");                  for (int y = 0;; y++) {                  // this causes only msg param to be output                  PRINT_MSG_PARAM = y;                   params[2].accept(this);                  if (PRINT_MSG_PARAM == -1) break; // no more params!                  }                  return;                  } catch (Exception ex) {                  ex.printStackTrace();                  }                */                        CClass pclass = ((SIRPortal)portal).getPortalType().getCClass();                CMethod methods[] = pclass.getMethods();                int index = -1;                int size = 16; // size:4 mindex:4 s_iter:4 exec_at:4                // int and float have size of 4 bytes                size += num_params * 4;                for (int t = 0; t < methods.length; t++) {                    System.out.println("/* has method: "+methods[t]+" */\n");                    if (methods[t].getIdent().equals(ident)) {                        index = t;                        break;                    }                }                CType method_params[] = methods[index].getParameters();                /*                  if (params != null) {                  // int and float have size of 4 bytes                  size += params.length * 4;                   }                */                        print("{ netsocket *sock = get_msg_out_socket("+dst+");\n");                print("  sock->write_int("+size+");\n");                print("  sock->write_int("+index+");\n");                print("  sock->write_int(iteration);\n");                if (latency instanceof SIRLatencyMax) {                    int max = ((SIRLatencyMax)latency).getMax();                    //print("__msg_sock_"+selfID+"_"+dst+"out->write_int("+max+");");                    SIRFilter sender = (SIRFilter)NodeEnumerator.getOperator(selfID);                    SIRFilter receiver = (SIRFilter)NodeEnumerator.getOperator(dst);                    if (LatencyConstraints.isMessageDirectionDownstream(sender, receiver)) {                                    print("  sock->write_int(sdep_"+selfID+"_"+dst+"->getDstPhase4SrcPhase(iteration+"+max+"));\n");                    } else {                                                            print("  sock->write_int(sdep_"+selfID+"_"+dst+"->getSrcPhase4DstPhase(iteration+"+max+"));\n");                                }                } else {                    print("  sock->write_int(-1);\n");                }                        if (params != null) {                    for (int t = 0; t < method_params.length; t++) {                        if (method_params[t].toString().equals("int")) {                            print("  sock->write_int(");                        }                        if (method_params[t].toString().equals("float")) {                            print("  sock->write_float(");                        }                        // print out the parameter!                        PRINT_MSG_PARAM = t;                        params[2].accept(this);                        PRINT_MSG_PARAM = -1;                        print(");\n");                    }                }                        print("}\n");            }        }    }