Package macromedia.asc.util

Examples of macromedia.asc.util.ByteList


        int return_type = type != null ? addClassName(type.getName(cx)) : 0;
       

        IntList param_types = null;
        IntList param_values = null;
        ByteList param_kinds = null;

        {
            ObjectValue obj = cx.scope();
            Slots slots = obj.slots;

            if (slots != null)
            {
                param_types = new IntList(slots.size());
                param_values = new IntList(slots.size()); // default values
                param_kinds = new ByteList(slots.size());
   
                Iterator<Slot> it = slots.iterator();
                //it.next(); // first one is this
                boolean value_required = false;
                for (int i = 1; it.hasNext() && i < max_params; ++i)
                {
                    Slot slot = it.next();
                    int type_index = addClassName(slot.getType().getName(cx));
                    param_types.add(type_index);
   
                    int value_index = 0;
                    byte value_kind = 0;
                    ObjectValue iv = slot.getInitializerValue();
                    if (iv != null)
                    {
                        value_required = true;
                        String value = iv.toString();
                        NumberUsage numberUsage = iv.getNumberUsage();
                        TypeValue defaultValueType = slot.getInitializerValue().type != null ? slot.getInitializerValue().type.getTypeValue() : null;
                        if (defaultValueType == cx.booleanType())
                        {
                            // The index doesn't matter, as long as its non 0
                            // there are no boolean values in any cpool, instead the value will be determined by the kind byte
                            value_index = value.equals("true")?CONSTANT_True:CONSTANT_False;
                            value_kind = value.equals("true")?CONSTANT_True:CONSTANT_False;
                        }
                        else if (defaultValueType == cx.stringType())
                        {
                            value_index = ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(value));
                            value_kind = CONSTANT_Utf8;
                        }
                        else if (defaultValueType == cx.intType())
                        {
                            value_index = ab.addIntConstant(bytecodeFactory.ConstantIntegerInfo(getValueOfNumberLiteral(value,new TypeValue[1], numberUsage).intValue()));
                            value_kind = CONSTANT_Integer;
                        }
                        else if ((defaultValueType == cx.doubleType()) || (cx.abcVersion(Features.TARGET_AVM1) && (defaultValueType == cx.uintType())))
                        {
                            value_index = ab.addDoubleConstant(bytecodeFactory.ConstantDoubleInfo(getValueOfNumberLiteral(value,new TypeValue[1], numberUsage).doubleValue()));
                            value_kind = CONSTANT_Double;
                        }
                        else if (defaultValueType == cx.uintType())
                        {
                            value_index = ab.addUintConstant(bytecodeFactory.ConstantUintInfo(getValueOfNumberLiteral(value,new TypeValue[1], numberUsage).uintValue()));
                            value_kind = CONSTANT_UInteger;
                        }
                        else if (cx.statics.es4_numerics && (defaultValueType == cx.decimalType()))
                        {
                            value_index = ab.addDecimalConstant(bytecodeFactory.ConstantDecimalInfo(getValueOfNumberLiteral(value,new TypeValue[1], numberUsage).decimalValue()));
                            value_kind = CONSTANT_Decimal;
                        }
                        else if (defaultValueType == cx.nullType())
                        {
                            // Similar to boolean above, the value will be determined by the kind byte (there is only 1 possible value for null)
                            value_index = CONSTANT_Null;
                            value_kind = CONSTANT_Null;
                        }
                        else if (defaultValueType == cx.voidType())
                        {
                            value_index = 0; // will be undefined at runtime
                            value_kind = 0;
                        }
                        else if (slot.getInitializerValue() instanceof NamespaceValue )
                        {
                            value_index = addNamespace(slot.getInitializerValue());
                            value_kind = CONSTANT_Namespace;
                        }
                    }
                    if (value_required)
                    {
                        param_values.add(value_index);
                        param_kinds.add(value_kind);
                    }
                }
                if (value_required)
                {
                    flags |= METHOD_HasOptional;
View Full Code Here


    {
      BytecodeBuffer bc = new BytecodeBuffer(bl.toByteArray(false));
      if (bc.readU8() == CONSTANT_Qname)
      {
        int ns_index = bc.readU32();
        ByteList nsbl = ab.constant_ns_pool.get(ns_index-1);
        BytecodeBuffer nsbc = new BytecodeBuffer(nsbl.toByteArray(false));
        int nskind = nsbc.readU8();
        if (nskind == CONSTANT_Namespace || nskind == CONSTANT_PackageNamespace)
        {
          int uri_index = nsbc.readU32();
          int name_index = bc.readU32();
View Full Code Here

    state = Empty;
    workflow = 0;

    if (bytes == null)
    {
      bytes = new ByteList();
    }
    else
    {
      bytes.clear();
    }
View Full Code Here

    public static ByteList optimize(ByteList bytes )
    {
        BytecodeBuffer[] byte_codes = new BytecodeBuffer[1];
        byte_codes[0] = new BytecodeBuffer(bytes.toByteArray());
        byte[] temp = optimize(byte_codes);
        ByteList new_bytes = new ByteList(temp.length);
        new_bytes.addAll(temp);
        return new_bytes;
    }
View Full Code Here

  }

  public void addDeclStyle(int style)
  {
    if (decl_styles == null)
      decl_styles = new ByteList(2);
    decl_styles.push_back((byte)style);
  }
View Full Code Here

        int return_type = type != null ? addClassName(type.getName(cx)) : 0;
       

        IntList param_types = null;
        IntList param_values = null;
        ByteList param_kinds = null;

        {
            ObjectValue obj = cx.scope();
            Slots slots = obj.slots;

            if (slots != null)
            {
                param_types = new IntList(slots.size());
                param_values = new IntList(slots.size()); // default values
                param_kinds = new ByteList(slots.size());
   
                Iterator<Slot> it = slots.iterator();
                //it.next(); // first one is this
                boolean value_required = false;
                for (int i = 1; it.hasNext() && i < max_params; ++i)
                {
                    Slot slot = it.next();
                    int type_index = addClassName(slot.getType().getName(cx));
                    param_types.add(type_index);
   
                    int value_index = 0;
                    byte value_kind = 0;
                    ObjectValue iv = slot.getInitializerValue();
                    if (iv != null)
                    {
                        value_required = true;
                        String value = iv.toString();
                        NumberUsage numberUsage = iv.getNumberUsage();
                        TypeValue defaultValueType = slot.getInitializerValue().type != null ? slot.getInitializerValue().type.getTypeValue() : null;
                        if (defaultValueType == cx.booleanType())
                        {
                            // The index doesn't matter, as long as its non 0
                            // there are no boolean values in any cpool, instead the value will be determined by the kind byte
                            value_index = value.equals("true")?CONSTANT_True:CONSTANT_False;
                            value_kind = value.equals("true")?CONSTANT_True:CONSTANT_False;
                        }
                        else if (defaultValueType == cx.stringType())
                        {
                            value_index = ab.addUtf8Constant(bytecodeFactory.ConstantUtf8Info(value));
                            value_kind = CONSTANT_Utf8;
                        }
                        else if (defaultValueType == cx.intType())
                        {
                            value_index = ab.addIntConstant(bytecodeFactory.ConstantIntegerInfo(getValueOfNumberLiteral(value,new TypeValue[1], numberUsage).intValue()));
                            value_kind = CONSTANT_Integer;
                        }
                        else if ((defaultValueType == cx.doubleType()) || (cx.abcVersion(Features.TARGET_AVM1) && (defaultValueType == cx.uintType())))
                        {
                            value_index = ab.addDoubleConstant(bytecodeFactory.ConstantDoubleInfo(getValueOfNumberLiteral(value,new TypeValue[1], numberUsage).doubleValue()));
                            value_kind = CONSTANT_Double;
                        }
                        else if (defaultValueType == cx.uintType())
                        {
                            value_index = ab.addUintConstant(bytecodeFactory.ConstantUintInfo(getValueOfNumberLiteral(value,new TypeValue[1], numberUsage).uintValue()));
                            value_kind = CONSTANT_UInteger;
                        }
                        else if (cx.statics.es4_numerics && (defaultValueType == cx.decimalType()))
                        {
                            value_index = ab.addDecimalConstant(bytecodeFactory.ConstantDecimalInfo(getValueOfNumberLiteral(value,new TypeValue[1], numberUsage).decimalValue()));
                            value_kind = CONSTANT_Decimal;
                        }
                        else if (defaultValueType == cx.nullType())
                        {
                            // Similar to boolean above, the value will be determined by the kind byte (there is only 1 possible value for null)
                            value_index = CONSTANT_Null;
                            value_kind = CONSTANT_Null;
                        }
                        else if (defaultValueType == cx.voidType())
                        {
                            value_index = 0; // will be undefined at runtime
                            value_kind = 0;
                        }
                        else if (slot.getInitializerValue() instanceof NamespaceValue )
                        {
                            value_index = addNamespace(slot.getInitializerValue());
                            value_kind = CONSTANT_Namespace;
                        }
                    }
                    if (value_required)
                    {
                        param_values.add(value_index);
                        param_kinds.add(value_kind);
                    }
                }
                if (value_required)
                {
                    flags |= METHOD_HasOptional;
View Full Code Here

    {
      BytecodeBuffer bc = new BytecodeBuffer(bl.toByteArray(false));
      if (bc.readU8() == CONSTANT_Qname)
      {
        int ns_index = bc.readU32();
        ByteList nsbl = ab.constant_ns_pool.get(ns_index-1);
        BytecodeBuffer nsbc = new BytecodeBuffer(nsbl.toByteArray(false));
        int nskind = nsbc.readU8();
        if (nskind == CONSTANT_Namespace || nskind == CONSTANT_PackageNamespace)
        {
          int uri_index = nsbc.readU32();
          int name_index = bc.readU32();
View Full Code Here

TOP

Related Classes of macromedia.asc.util.ByteList

Copyright © 2018 www.massapicom. 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.