Exemplo n.º 1
0
  public static UserDefinedOpcode loadFromXML(Element data) {
    UserDefinedOpcode retVal = new UserDefinedOpcode();

    Elements nodes = data.getElements();

    while (nodes.hasMoreElements()) {
      Element node = nodes.next();

      String val = node.getTextString();

      if (val == null) {
        val = "";
      }
      switch (node.getName()) {
        case "opcodeName":
          retVal.opcodeName = val;
          break;
        case "outTypes":
          retVal.outTypes = val;
          break;
        case "inTypes":
          retVal.inTypes = val;
          break;
        case "codeBody":
          retVal.codeBody = val;
          break;
        case "comments":
          retVal.comments = val;
          break;
      }
    }

    return retVal;
  }
Exemplo n.º 2
0
  public static void main(String[] args) {
    UserDefinedOpcode udo = new UserDefinedOpcode();
    udo.opcodeName = "getFrequency";

    udo.outTypes = "i";
    udo.inTypes = "i";

    // udo.useLocalKsmps = false;
    // udo.localKsmps = 1;
    //
    // udo.inArgs = "ipch";
    // udo.outArgs = "iout";

    udo.codeBody = "ipch\t xin\niout	= (ipch < 15 ? cpspch(ipch) : ipch)\n\txout iout	";

    System.out.println(udo.toString());
    // System.out.println(udo.getArgs());
  }