예제 #1
0
//7.3.2.3 Supplemental enhancement information RBSP syntax
void structure(sei_rbsp)(h264_stream_t* h, bs_t* b)
{
    if( is_reading )
    {
        for( int i = 0; i < h->num_seis; i++ )
        {
            sei_free(h->seis[i]);
        }

        h->num_seis = 0;
        do {
            h->num_seis++;
            h->seis = (sei_t**)realloc(h->seis, h->num_seis * sizeof(sei_t*));
            h->seis[h->num_seis - 1] = sei_new();
            h->sei = h->seis[h->num_seis - 1];
            structure(sei_message)(h, b);
        } while( more_rbsp_data(h, b) );

    }

    if( is_writing )
    {
        for (int i = 0; i < h->num_seis; i++)
        {
            h->sei = h->seis[i];
            structure(sei_message)(h, b);
        }
        h->sei = NULL;
    }

    structure(rbsp_trailing_bits)(h, b);
}
예제 #2
0
void PutByIdVariant::dumpInContext(PrintStream& out, DumpContext* context) const
{
    switch (kind()) {
    case NotSet:
        out.print("<empty>");
        return;
        
    case Replace:
        out.print(
            "<Replace: ", inContext(structure(), context), ", offset = ", offset(), ">");
        return;
        
    case Transition:
        out.print(
            "<Transition: ", inContext(oldStructure(), context), " -> ",
            pointerDumpInContext(newStructure(), context), ", [",
            listDumpInContext(constantChecks(), context), "], offset = ", offset(), ">");
        return;
        
    case Setter:
        out.print(
            "<Setter: ", inContext(structure(), context), ", [",
            listDumpInContext(constantChecks(), context), "]");
        if (m_alternateBase)
            out.print(", alternateBase = ", inContext(JSValue(m_alternateBase), context));
        out.print(", offset = ", m_offset);
        out.print(", call = ", *m_callLinkStatus);
        out.print(">");
        return;
    }
    
    RELEASE_ASSERT_NOT_REACHED();
}
예제 #3
0
int main(void) {
    
    int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    
    // int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50};
    
    BST* root = build_balanced_tree(a, 0, 8);
	
	structure(root, 0);

	printf("\n\n------------------------------------\n\n");
	
	root = remove_node(root, 2);
	
	printf("\n\n------------------------------------\n\n");
	
	root = remove_node(root, root->data);
    
    structure(root, 0);
/*
    assert(root != NULL);
    assert(root->data == 5);
    assert(root->left != NULL);
    assert(root->left->data == 2);
    assert(root->left->left->data == 1);
    assert(root->left->left->left == NULL);
    assert(root->left->left->right == NULL);
    assert(root->left->right != NULL);
    assert(root->left->right->data == 3);
    assert(root->left->right->left == NULL);
    assert(root->left->right->right != NULL);
    assert(root->left->right->right->data == 4);
    assert(root->left->right->right->left == NULL);
    assert(root->left->right->right->right == NULL);
    
    assert(root->right != NULL);
    assert(root->right->data == 7);
    assert(root->right->left != NULL);
    assert(root->right->left->data == 6);
    assert(root->right->left->right == NULL);
    assert(root->right->left->left == NULL);
    assert(root->right->right != NULL);
    assert(root->right->right->data == 8);
    assert(root->right->right->left == NULL);
    assert(root->right->right->right != NULL);
    assert(root->right->right->right->data == 9);
    assert(root->right->right->right->left == NULL);
    assert(root->right->right->right->right == NULL);
    assert(root->right->right->left == NULL);
*/

    printf("Yay!\n");

    return 0;
}
예제 #4
0
void structure(BST* root, int level) {
    int i;

    if (root == NULL) {
        padding('\t', level);
        puts("~");
    } else {
        structure(root->right, level+1);
        padding('\t', level);
        printf("%d\n", root->data);
        structure(root->left, level+1);
    }
}
예제 #5
0
void structure ( struct treeNode *temp, int level )
{
  int i;

  if ( temp == NULL ) {
    padding ( '\t', level );
    puts ( "~" );
  }
  else {
    structure ( temp->right, level + 1 );
    padding ( '\t', level );
    printf ( "%d\n", temp->data );
    structure ( temp->left, level + 1 );
  }
}
예제 #6
0
파일: hardbody.cpp 프로젝트: Jintram/egfrd
void inject_particles(Tworld_& world, Trng_& rng, Tpid_list_& pid_list, typename Tworld_::species_id_type const& sid, int n)
{
    typedef typename Tworld_::particle_id_pair_and_distance_list particle_id_pair_list;
    typedef typename Tworld_::particle_id_pair particle_id_pair;
    typedef typename Tworld_::length_type length_type;
    typedef typename Tworld_::particle_shape_type particle_shape_type;
    typedef typename Tworld_::position_type position_type;
    typedef typename Tworld_::species_type species_type;
    typedef typename Tworld_::structure_type structure_type;
    species_type const& s(world.get_species(sid));
    boost::shared_ptr<structure_type> structure(world.get_structure(s.structure_id()));
 
    for (int i = 0; i < n; ++i)
    {
        particle_shape_type p(position_type(), s.radius());

        for (;;)
        {
            p.position() = structure->random_position(rng);
            if (boost::scoped_ptr<particle_id_pair_list>(
                world.check_overlap(p)) == 0)
            {
                break;
            }
            std::cerr << i << "th particle rejected" << std::endl;
        }
        
        particle_id_pair i(world.new_particle(sid, p.position()));
        pid_list.push_back(i.first);
    }
}
예제 #7
0
파일: assn5.c 프로젝트: greptruth/algo_lab
void structure( Node *root, int level )
{
  int i;
  if ( root == NULL ) {
    padding ( '\t', level );
    puts ( "~" );
  }
  else {
    structure ( root->right, level + 1 );
    padding ( '\t', level );
    // if(root->l==0)
    // 	printf("here\n");
    printf ( "[%d,%d)\n", root->l,root->u );
    structure ( root->left, level + 1 );
  }
}
void JSDOMWindowShell::setWindow(JSC::VM& vm, JSDOMWindow* window)
{
    ASSERT_ARG(window, window);
    setTarget(vm, window);
    structure()->setGlobalObject(*JSDOMWindow::commonVM(), window);
    gcController().garbageCollectSoon();
}
void JSGlobalObject::init(JSObject* thisValue)
{
    ASSERT(JSLock::currentThreadIsHoldingLock());

    structure()->disableSpecificFunctionTracking();

    d()->globalData = Heap::heap(this)->globalData();
    d()->globalScopeChain = ScopeChain(this, d()->globalData.get(), this, thisValue);

    JSGlobalObject::globalExec()->init(0, 0, d()->globalScopeChain.node(), CallFrame::noCaller(), 0, 0);

    if (JSGlobalObject*& headObject = head()) {
        d()->prev = headObject;
        d()->next = headObject->d()->next;
        headObject->d()->next->d()->prev = this;
        headObject->d()->next = this;
    } else
        headObject = d()->next = d()->prev = this;

    d()->debugger = 0;

    d()->profileGroup = 0;

    reset(prototype());
}
예제 #10
0
파일: Structure.cpp 프로젝트: dog-god/iptv
void Structure::materializePropertyMap(JSGlobalData& globalData)
{
    ASSERT(structure()->classInfo() == &s_info);
    ASSERT(!m_propertyTable);

    Vector<Structure*, 8> structures;
    structures.append(this);

    Structure* structure = this;

    // Search for the last Structure with a property table.
    while ((structure = structure->previousID())) {
        if (structure->m_isPinnedPropertyTable) {
            ASSERT(structure->m_propertyTable);
            ASSERT(!structure->m_previous);

            m_propertyTable = structure->m_propertyTable->copy(globalData, 0, numberOfSlotsForLastOffset(m_offset, m_typeInfo.type()));
            break;
        }

        structures.append(structure);
    }

    if (!m_propertyTable)
        createPropertyMap(numberOfSlotsForLastOffset(m_offset, m_typeInfo.type()));

    for (ptrdiff_t i = structures.size() - 2; i >= 0; --i) {
        structure = structures[i];
        if (!structure->m_nameInPrevious)
            continue;
        PropertyMapEntry entry(globalData, this, structure->m_nameInPrevious.get(), structure->m_offset, structure->m_attributesInPrevious, structure->m_specificValueInPrevious.get());
        m_propertyTable->add(entry);
    }
}
예제 #11
0
void JSDOMWindowShell::setWindow(VM& vm, JSDOMWindow* window)
{
    ASSERT_ARG(window, window);
    setTarget(vm, window);
    structure()->setGlobalObject(vm, window);
    GCController::singleton().garbageCollectSoon();
}
예제 #12
0
파일: assn5.c 프로젝트: greptruth/algo_lab
void CHANGE_TREE(Node** root,int l,int u,int n)
{
	int i,live;
	int length= ceil((u-l)/(n*1.00));
	//MERGE(root,65-,65,NULL,NULL);
	/*for(i=u+1;i>1;i=i-length)
	{
		Q_MERGE(root,i-length,i);
		//printf("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n");
		printf("__%d %d_______________________________________________________________________________________\n",i-length,i);
		//
		structure(*root,2);
		//printf("__%d %d_______________________________________________________________________________________\n",i-length,i);
		//scanf("%d",&live);
	}*/

	for(i=1;i<=u;i=i+length)
	{
		Q_MERGE(root,i,i+length);
		//printf("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n");
		printf("__%d %d_______________________________________________________________________________________\n",i-length,i);
		//
		structure(*root,2);
		//printf("__%d %d_______________________________________________________________________________________\n",i-length,i);
		//scanf("%d",&live);
	}

}
void JSPropertyNameIterator::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    visitor.appendValues(m_jsStrings.get(), m_jsStringsSize, MayContainNullValues);
    if (m_cachedPrototypeChain)
        visitor.append(&m_cachedPrototypeChain);
}
예제 #14
0
PvaClientRPCPtr PvaClientRPC::create(
        PvaClientPtr const &pvaClient,
        Channel::shared_pointer const & channel)
{
     StructureConstPtr structure(getFieldCreate()->createStructure());
     PVStructurePtr pvRequest(getPVDataCreate()->createPVStructure(structure));
     return create(pvaClient,channel,pvRequest);
}
예제 #15
0
//7.3.2.7 Filler data RBSP syntax
void structure(filler_data_rbsp)(h264_stream_t* h, bs_t* b)
{
    while( bs_next_bits(b, 8) == 0xFF )
    {
        value( ff_byte, f(8, 0xFF) );
    }
    structure(rbsp_trailing_bits)(h, b);
}
void JSAudioContext::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(visitor);
    m_impl->visitJSEventListeners(visitor);
}
void StructureChain::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    size_t i = 0;
    while (m_vector[i])
        visitor.append(&m_vector[i++]);
}
예제 #18
0
void JSCSSRule::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(visitor);
    visitor.addOpaqueRoot(root(impl()));
}
예제 #19
0
void NativeErrorConstructor::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    InternalFunction::visitChildren(visitor);
    if (m_errorStructure)
        visitor.append(&m_errorStructure);
}
예제 #20
0
void ProgramExecutable::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    ScriptExecutable::visitChildren(visitor);
    if (m_programCodeBlock)
        m_programCodeBlock->visitAggregate(visitor);
}
예제 #21
0
파일: assn5.c 프로젝트: greptruth/algo_lab
int main()
{
	int l=1,up=20,n=8,i;
	//printf("%d %d %d  \n",l,up,n);
	int length= ceil((up-l)/(n*1.00));
	Node* root=malloc(sizeof(Node));
	//int upper=16;
	//printf("%d %d %d  \n",l,upper,n);
	//printf(">> %d \n",length);
	_CREATE_INTERVAL_TREE(root,l,up,n,length,1);

	structure(root,2);

	for(i=l;i<=up;i++)
	{
		INSERT(root,i);
	}
	// INSERT(root,5);
	// INSERT(root,1);
	// INSERT(root,2);
	// INSERT(root,3);
	// INSERT(root,5);

	structureList(root,2);


	// printf("\n\nMERGE PROCESSS STARTED \n");
	// MERGE(root,1,9,NULL,NULL);
	//MERGE(root,16,25,NULL,NULL);
	//structure(root,2);
	//Q_MERGE(&root,1,4);
	//Q_MERGE(&root,1,3);

	//CHANGE_TREE(&root,l,up,4);
	printf("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\n");
	structure(root,2);

	//structureList(root,2);



	//structureList(root,2);

}
void JSSharedWorker::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(visitor);

    if (MessagePort* port = impl()->port())
        visitor.addOpaqueRoot(port);
}
예제 #23
0
NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue* location)
{
    if (JSObject* getterFunction = asGetterSetter(*location)->getter()) {
        if (!structure()->isDictionary())
            slot.setCacheableGetterSlot(this, getterFunction, offsetForLocation(location));
        else
            slot.setGetterSlot(getterFunction);
    } else
        slot.setUndefined();
}
예제 #24
0
void JSFunction::finishCreation(ExecState* exec, FunctionExecutable* executable, ScopeChainNode* scopeChainNode)
{
    Base::finishCreation(exec->globalData());
    ASSERT(inherits(&s_info));

    // Switching the structure here is only safe if we currently have the function structure!
    ASSERT(structure() == scopeChainNode->globalObject->functionStructure());
    setStructure(exec->globalData(), scopeChainNode->globalObject->namedFunctionStructure());
    putDirectOffset(exec->globalData(), scopeChainNode->globalObject->functionNameOffset(), executable->nameValue());
}
예제 #25
0
const struct LogStructure *AP_Logger::structure_for_msg_type(const uint8_t msg_type)
{
    for (uint16_t i=0; i<_num_types;i++) {
        const struct LogStructure *s = structure(i);
        if (s->msg_type == msg_type) {
            // in use
            return s;
        }
    }
    return nullptr;
}
예제 #26
0
StructureSet PutByIdVariant::baseStructure() const
{
    ASSERT(kind() == Setter);
    
    if (!m_alternateBase)
        return structure();
    
    Structure* structure = structureFor(m_constantChecks, m_alternateBase);
    RELEASE_ASSERT(structure);
    return structure;
}
예제 #27
0
void RegExpObject::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(visitor);
    if (d->regExp)
        visitor.append(&d->regExp);
    if (UNLIKELY(!d->lastIndex.get().isInt32()))
        visitor.append(&d->lastIndex);
}
예제 #28
0
void FunctionExecutable::visitChildren(SlotVisitor& visitor)
{
    ASSERT_GC_OBJECT_INHERITS(this, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(structure()->typeInfo().overridesVisitChildren());
    ScriptExecutable::visitChildren(visitor);
    if (m_codeBlockForCall)
        m_codeBlockForCall->visitAggregate(visitor);
    if (m_codeBlockForConstruct)
        m_codeBlockForConstruct->visitAggregate(visitor);
}
예제 #29
0
//7.3.2.10 RBSP slice trailing bits syntax
void structure(rbsp_slice_trailing_bits)(h264_stream_t* h, bs_t* b)
{
    structure(rbsp_trailing_bits)(h, b);
    if( h->pps->entropy_coding_mode_flag )
    {
        while( more_rbsp_trailing_data(h, b) )
        {
            value( cabac_zero_word, f(16, 0x0000) );
        }
    }
}
예제 #30
0
BlockedCmatrix MMFstage::matrix() {
	Bstructure structure(nchannels);
	for (int i = 0; i < nchannels; i++)
		structure[i] = channel[i]->n;
	BlockedCmatrix R = BlockedCmatrix::Identity(structure);
	for (int I = 0; I < nchannels; I++) {
		auto S = R.virtual_street(I);
		channel[I]->applyFromLeftTo(S);
	}
	return R;
}