+ "+" + max + "));\n");
+ "+" + max + "+1)-1);\n");
    public void visitMessageStatement(SIRMessageStatement self,            JExpression portal, String iname, String __ident,            JExpression[] params, SIRLatency latency) {        /*         p.print("//send_" + iname + "_" + ident + "(");         portal.accept(this);         p.print(", ");         latency.accept(this);         if (params != null)         for (int i = 0; i < params.length; i++)         if (params[i] != null)         {         p.print(", ");         params[i].accept(this);         }         p.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();                p.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++;                    p.print(",");                }                p.print(" num_params: " + num_params + "*/\n");                /*                 try {                 p.print(((JStringLiteral)params[1]).stringValue());                 // params[1].accept(this); // name of the portal method!                                   p.newLine();                 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 = 12; // size:4 mindex: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;                  }                 */                p.print("__msg_sock_" + selfID + "_" + dst + "out->write_int("                        + size + ");\n");                p.print("__msg_sock_" + selfID + "_" + dst + "out->write_int("                        + index + ");\n");                if (latency instanceof SIRLatencyMax) {                    int max = ((SIRLatencyMax) latency).getMax();                    //p.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)) {                        p.print("__msg_sock_" + selfID + "_" + dst                                + "out->write_int(sdep_" + selfID + "_" + dst                                + "->getDstPhase4SrcPhase(__counter_" + selfID                                + "+" + max + "));\n");                    } else {                        p.print("__msg_sock_" + selfID + "_" + dst                                + "out->write_int(sdep_" + selfID + "_" + dst                                + "->getSrcPhase4DstPhase(__counter_" + selfID                                + "+" + max + "));\n");                    }                } else {                    p.print("__msg_sock_" + selfID + "_" + dst                            + "out->write_int(-1);\n");                }                if (params != null) {                    for (int t = 0; t < method_params.length; t++) {                        String method_params_string = method_params[t]                                .toString();                        p.print("__msg_sock_" + selfID + "_" + dst                                + "out->write_");                        if (method_params_string == "int"                                || method_params_string == "float") {                            p.print(method_params_string + "(");                        } else {                            p.print("unsupported/* " + method_params_string                                    + " */ (");                        }                        // 			if (method_params[t].toString().equals("int")) {                        // 			    p.print("__msg_sock_"+selfID+"_"+dst+"out->write_int(");                        // 			}                        // 			if (method_params[t].toString().equals("float")) {                        // 			    p.print("__msg_sock_"+selfID+"_"+dst+"out->write_float(");                        // 			}                        // print out the parameter!                        PRINT_MSG_PARAM = t;                        params[2].accept(this);                        PRINT_MSG_PARAM = -1;                        p.print(");\n");                    }                }            }        }    }