Package macromedia.asc.util

Examples of macromedia.asc.util.IntList


            case CONSTANT_TypeName:
            {
                int nameIndex = poolIn.readU32();
                int newNameIndex = getIndex(poolIndex, cp_mn, nameIndex);
                int count = poolIn.readU32();
                IntList newParams = new IntList();
                for( int i = 0; i<count;++i) {
                    newParams.add(getIndex(poolIndex, cp_mn, poolIn.readU32()));
                }
                start = in_mn.size();
                in_mn.writeU8(constKind);
                in_mn.writeU32(newNameIndex);
                in_mn.writeU32(count);
                for( int i =0; i < count; ++i ) {
                    in_mn.writeU32(newParams.at(i));
                }
        break;
            }

            default:
View Full Code Here


        }
    }

    private IntList trimMetadata(int[] metadata)
    {
        IntList newMetadata = new IntList();
        int length = metadata != null ? metadata.length : 0;
        for( int i = 0; i < length; ++i)
        {
            int new_index = metadataInfo.getIndex(poolIndex, metadata[i]) ;
            if( new_index != -1 )
            {
                newMetadata.add(new_index);
            }
        }
        return newMetadata;
    }
View Full Code Here

    }

  public void slotTrait(int trait_kind, int name, int slotId, int type, int value, int value_kind, int[] metadata)
  {
    currentBuffer.writeU32(pool.history.getIndex(poolIndex, IndexHistory.cp_mn, name));
        IntList new_metadata = trimMetadata(metadata);
    if ( ((trait_kind >> 4) & TRAIT_FLAG_metadata) != 0 && new_metadata.size()==0 )
    {
      trait_kind = trait_kind & ~(TRAIT_FLAG_metadata << 4);
    }
    currentBuffer.writeU8(trait_kind);
View Full Code Here

  }

  public void methodTrait(int trait_kind, int name, int dispId, int methodInfo, int[] metadata)
  {
    currentBuffer.writeU32(pool.history.getIndex(poolIndex, IndexHistory.cp_mn, name));
        IntList new_metadata = trimMetadata(metadata);
    if ( ((trait_kind >> 4) & TRAIT_FLAG_metadata) != 0 && new_metadata.size()==0 )
    {
      trait_kind = trait_kind & ~(TRAIT_FLAG_metadata << 4);
    }
    currentBuffer.writeU8(trait_kind);
View Full Code Here

  }

  public void classTrait(int kind, int name, int slotId, int classIndex, int[] metadata)
  {
    currentBuffer.writeU32(pool.history.getIndex(poolIndex, IndexHistory.cp_mn, name));
        IntList new_metadata = trimMetadata(metadata);
    if ( ((kind >> 4) & TRAIT_FLAG_metadata) != 0 && new_metadata.size()==0 )
    {
      kind = kind & ~(TRAIT_FLAG_metadata << 4);
    }
    currentBuffer.writeU8(kind);
View Full Code Here

  }

  public void functionTrait(int kind, int name, int slotId, int methodInfo, int[] metadata)
  {
    currentBuffer.writeU32(pool.history.getIndex(poolIndex, IndexHistory.cp_mn, name));
        IntList new_metadata = trimMetadata(metadata);
    if ( ((kind >> 4) & TRAIT_FLAG_metadata) != 0 && new_metadata.size()==0 )
    {
      kind = kind & ~(TRAIT_FLAG_metadata << 4);
    }
    currentBuffer.writeU8(kind);
View Full Code Here

        // If we're keeping [Embed] metadata then we can just call the default impl
        // in the base class as we're not doing any special filtering here
        if( keepEmbed )
            return super.addMetadata(metadata);

        IntList metaDataIndices = null;

        if ((metadata != null) && (metadata.size() > 0))
        {
            metaDataIndices = new IntList(metadata.size());

            for (MetaData metaData : metadata)
            {
                String id = metaData.id;

                if (!id.equals(StandardDefs.MD_EMBED))
                {
                    Value[] values = metaData.values;
                    int metaDataIndex = addMetadataInfo(id, values);
                    metaDataIndices.add(metaDataIndex);
                }
            }
        }
        return metaDataIndices;
    }
View Full Code Here

          int lo_id = slots.at(0).id;
          int hi_id = slots.at(slots.size()-1).id;
          if( slots.size() -1 == hi_id - lo_id)
          {
            // Contiguous slot ids
            slot_id_boundaries = new IntList(2);
            slot_id_boundaries.add(lo_id);
            slot_id_boundaries.add(hi_id);
          }
          else
          {
            // Some non contiguous slot ids.  Should be just a few blocks of contiguous id's though
            slot_id_boundaries = new IntList(6);
            int last_id = lo_id;
            int start_id = lo_id;
            for( int i = 1, size = slots.size(); i < size; ++i )
            {
              int id = slots.at(i).id;
View Full Code Here

        int qname_index = ab.addMultiNameConstant(bytecodeFactory.ConstantQualifiedName(name_index,namespace_index,false));

        if( name instanceof ParameterizedName )
        {
            ParameterizedName pname = (ParameterizedName)name;
            IntList params = new IntList(pname.type_params.size());
            for(int i = 0, n = pname.type_params.size(); i < n; ++i )
            {
                params.add(addClassName(pname.type_params.at(i)));
            }
            qname_index = ab.addMultiNameConstant(bytecodeFactory.ConstantTypeName(qname_index, params));
        }

        return qname_index;
View Full Code Here

    protected void FinishClass(Context cx, final QName name, final QName basename, boolean is_dynamic, boolean is_final, boolean is_interface, boolean is_nullable)
    {
        ObjectList<ByteList> static_traits = new ObjectList<ByteList>();
        ObjectList<ByteList> instance_traits = new ObjectList<ByteList>();
        IntList interfaces = new IntList();
        int scope_depth  = cx.getScopes().size();
       
        ObjectValue protected_namespace = null;

        // Iterate through the members of the class and define the traits

        if( !is_interface )
        {
            // Class traits

            ObjectValue obj = cx.scope(scope_depth-2);
            Builder     bui = obj.builder;

            protected_namespace = ((ClassBuilder)bui).protected_namespace;

            FinishTraits(obj, static_traits);
        }


        {
            // Instance vars

            ObjectValue obj = cx.scope(scope_depth-1);
            InstanceBuilder bui = obj.builder instanceof InstanceBuilder ? (InstanceBuilder) obj.builder : null;

            // interfaces can implement other interfaces, must express this in abc
            {
                for (ReferenceValue ref : bui.interface_refs)
                {
                    interfaces.add(makeMultiname(ref.name,ref.getImmutableNamespaces()));
                }
            }

            FinishTraits(obj, instance_traits);           
        }

        // Make a multiname

        int qname_index = addClassName(name);
        int base_index = basename == null ? 0 : addClassName(basename);
        int iinit_info = 0;

        //if( !is_interface )
        {
            ObjectValue obj = cx.scope();
            int slot_id = obj.getSlotIndex(cx,GET_TOKEN,"$construct",cx.publicNamespace());
            slot_id = obj.getImplicitIndex(cx,slot_id,EMPTY_TOKEN);
            Slot slot = obj.getSlot(cx,slot_id);
            iinit_info = GetMethodInfo(slot.getMethodName());
        }
        /*else
        {
            iinit_info = GetMethodInfo(name+"$iinit");
        }*/

        int class_info = GetClassInfo(name);

        int flags = 0;
        if (!is_dynamic)
            flags |= CLASS_FLAG_sealed;
        if (is_final)
            flags |= CLASS_FLAG_final;
        if (is_interface)
            flags |= CLASS_FLAG_interface;
        if (!is_nullable)
            flags |= CLASS_FLAG_non_nullable;

        int protected_index = (protected_namespace != null) ? addNamespace(protected_namespace) : 0;
        if (protected_index != 0)
            flags |= CLASS_FLAG_protected;
       
        ab.addBytesToTable(ab.instances,bytecodeFactory.InstanceInfo(ab.instances.at(class_info),qname_index,base_index,flags,protected_index,
                           interfaces.size(),interfaces,
                           iinit_info /*GetMethodInfo(name+"$"+name)*/,instance_traits,class_info));

        int cinit_info = GetMethodInfo(name+"$cinit");
        ab.addBytesToTable(ab.classes,bytecodeFactory.ClassInfo(ab.classes.at(class_info),
                                                cinit_info,static_traits,class_info));
View Full Code Here

TOP

Related Classes of macromedia.asc.util.IntList

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.