Examples of PCodeFunction


Examples of nexj.core.scripting.PCodeFunction

   /**
    * @see nexj.core.tools.GenericREPL#evaluate(java.lang.Object)
    */
   protected Object evaluate(Object expr)
   {
      PCodeFunction fun = new Compiler().compile(expr, null, m_machine, true);
      Object value = m_machine.invoke(fun, (Pair)null);

      m_machine.getGlobalEnvironment().defineVariable(LAST, value);

      return value;
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

   {
      try
      {
         Lookup posMap = new HashTab();
         Object code = parse(sExpr, posMap);
         PCodeFunction fun = m_compiler.compile(code, posMap, m_context.getMachine(), true);

         return m_context.getMachine().invoke(fun, (Pair)null);
      }
      catch (Exception e)
      {
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

      contact.setValue("pair", new Pair("A", new Pair("B")));
      contact.setValue("cvector", new char[]{'a', 'b', 'c'});
      contact.setValue("bvector", new byte[]{0, (byte)0xAB, 0x12});
      contact.setValue("svector", new String[]{"a", "b", "c"});
      contact.setValue("vector", new Object[]{"a", "b", "c"});
      contact.setValue("function", new PCodeFunction(new char[]{0, 1, 2}, new Object[]{"abc"}));
      contact.setValue("macro", new PCodeMacro(new char[]{3, 4, 5}, new Object[]{"cde"}, null));

      PrivilegeSet privilegeSet = Repository.getMetadata().createPrivilegeSet();

      privilegeSet.add(Repository.getMetadata().getPrimitivePrivilege("updateContact"));
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

      assertEquals(3, vec.length);
      assertEquals("a", vec[0]);
      assertEquals("b", vec[1]);
      assertEquals("c", vec[2]);

      PCodeFunction fun = (PCodeFunction)contact.getValue("function");

      assertEquals(3, fun.code.length);
      assertEquals(0, fun.code[0]);
      assertEquals(1, fun.code[1]);
      assertEquals(2, fun.code[2]);
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

      assertEquals("create", ((TransferObject)res.getResult(0)).getEventName());
      assertNull(tobj.getOID());
      assertEquals(1, res.getEventCount());
      assertEquals(1, ((List)res.getEvent(0)).size());

      tobj.setValue("number", new Pair(new PCodeFunction()));

      try
      {
         server.invoke(req);
         fail("Expected RPCException");
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

         for (Iterator typeItr = def.getTypesIterator(); typeItr.hasNext(); )
         {
            ModelType type = (ModelType)typeItr.next();
            Object code = type.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + type.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }

         for (Iterator intItr = def.getInterfacesIterator(); intItr.hasNext(); )
         {
            Interface iface = (Interface)intItr.next();
            Object code = iface.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + iface.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }

         for (Iterator svcItr = def.getServicesIterator(); svcItr.hasNext(); )
         {
            Service service = (Service)svcItr.next();
            Object code = service.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + service.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }
      }

      for (Iterator implItr = m_implementationMap.valueIterator(); implItr.hasNext(); )
      {
         Implementation impl = (Implementation)implItr.next();
         Object code = impl.getCode();
         PCodeFunction fun;

         posMap.clear();
         posMap.put(code, new TextPosition(0, 0, "implementation:" + impl.getNamePrefix()));

         try
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

                        m_container.resume();

                        // Suspend the thread if in script debugging mode
                        if (m_bDebug)
                        {
                           PCodeFunction nextFunction = (PCodeFunction)((utest.hasInitializer()) ? functionObjArray[0]
                              : functionObjArray[nTestCase]);

                           s_logger.debug("Waiting for script debugger to connect");

                           try
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

         if (step == null)
         {
            return null;
         }

         PCodeFunction fun = step.step(this);
         computeCleanupActivityCollection();

         if (fun != null)
         {
            m_lastStep = step;
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

    * Binds a properly compiled p-code function to the variable frame.
    * @param fun The function to bind.
    */
   public PCodeFunction bind(PCodeFunction fun)
   {
      return new PCodeFunction(fun.code, fun.constants, m_variableArray);
   }
View Full Code Here

Examples of nexj.core.scripting.PCodeFunction

      contact.setValue("pair", new Pair("A", new Pair("B")));
      contact.setValue("cvector", new char[]{'a', 'b', 'c'});
      contact.setValue("bvector", new byte[]{0, (byte)0xAB, 0x12});
      contact.setValue("svector", new String[]{"a", "b", "c"});
      contact.setValue("vector", new Object[]{"a", "b", "c"});
      contact.setValue("function", new PCodeFunction(new char[]{0, 1, 2}, new Object[]{"abc"}));
      contact.setValue("macro", new PCodeMacro(new char[]{3, 4, 5}, new Object[]{"cde"}, null));

      PrivilegeSet privilegeSet = Repository.getMetadata().createPrivilegeSet();

      privilegeSet.add(Repository.getMetadata().getPrimitivePrivilege("updateContact"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.