Пример #1
0
void StructureAbstractValue::clobber()
{
    SAMPLE("StructureAbstractValue clobber");

    // The premise of this approach to clobbering is that anytime we introduce
    // a watchable structure into an abstract value, we watchpoint it. You can assert
    // that this holds by calling assertIsWatched().

    if (isTop())
        return;

    setClobbered(true);

    if (m_set.isThin()) {
        if (!m_set.singleStructure())
            return;
        if (!m_set.singleStructure()->dfgShouldWatch())
            makeTopWhenThin();
        return;
    }

    StructureSet::OutOfLineList* list = m_set.structureList();
    for (unsigned i = list->m_length; i--;) {
        if (!list->list()[i]->dfgShouldWatch()) {
            makeTop();
            return;
        }
    }
}
Пример #2
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   script << makeTop( "store_ui.cgi", "Stores" )
          << makeStaticBox(  "Store ID","Id",StoreID,"12" ) 
          << makeComboBox( "Marketer*:","MarketerID",MarketerID,
                           "select MarketerID, MarketerName from Marketer" )
          << makeComboBox( "Sub-Categories*:","SubcategoryID",SubcategoryIDs,
                           "select SubcategoryID, concat(CategoryName, ' - ',  SubcategoryName) "
                           "from Subcategory s inner join Category c on s.CategoryID = "
                           "c.CategoryID", "", " multiple='multiple' size='6'" )  
          << makeTextBox(  "Marketer Store ID","MarketerStoreID",MarketerStoreID,"55" )                                                   
          << makeTextBox(  "Store Name*:","StoreName",StoreName,"55" )
          << makeTextBox(  "Store Link*:","StoreLink",StoreLink,"512","55" )           
          << makeTextArea( "Store Info*:","StoreInfo",StoreInfo ) 
          << makeComboBox( "Store Template:","StoreTemplateID", StoreTemplateID,
                           "select StoreTemplateID, StoreTemplateName from StoreTemplate" )                              
          << makeImageBox( "Store Image*:","StoreImage", StoreImage,"35" ) 
          << makeManualComboBox("Commission Type*:","CommissionType", 
                                CommissionType, "Dollar ($)=$,Percentage (%)=%" ) 
          << makeTextBox( "Commission*:","Commission",Commission,"8" ) 
          << makeTextBox( "Discount*:","Discount",Discount,"8" ) 
          << makeTextBox( "Footnote: ","Footnote",Footnote,"55" ) 
          << makeBoolBox(  "Featured Store?:","Featured", Featured) 
          << makeBoolBox(  "Store Enabled?:","Enabled", Enabled)                   
          << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }      
Пример #3
0
CRFileHistRecord * CRFileHist::savePosition( lString16 fpathname, size_t sz,
                            const lString16 & title,
                            const lString16 & author,
                            const lString16 & series,
                            ldomXPointer ptr )
{
    //CRLog::trace("CRFileHist::savePosition");
    lString16 name;
	lString16 path;
    splitFName( fpathname, path, name );
    CRBookmark bmk( ptr );
    //CRLog::trace("Bookmark created");
    int index = findEntry( name, path, (lvsize_t)sz );
    //CRLog::trace("findEntry exited");
    if ( index>=0 ) {
        makeTop( index );
        _records[0]->setLastPos( &bmk );
        _records[0]->setLastTime( (time_t)time(0) );
        return _records[0];
    }
    CRFileHistRecord * rec = new CRFileHistRecord();
    rec->setTitle( title );
    rec->setAuthor( author );
    rec->setSeries( series );
    rec->setFileName( name );
    rec->setFilePath( path );
    rec->setFileSize( (lvsize_t)sz );
    rec->setLastPos( &bmk );
    rec->setLastTime( (time_t)time(0) );

    _records.insert( 0, rec );
    //CRLog::trace("CRFileHist::savePosition - exit");
    return rec;
}
Пример #4
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   ocString group_sql = "select id, name from groups";
   if( !oLogin.SiteAdmin() )
   {
     group_sql += " where id = ";
     group_sql += oLogin.GroupId();
   }
   group_sql += " order by name";
   script << endl << "<!--" << group_sql << "-->" << endl;
   script << makeTop("users_ui.cgi", "USERS")
          << makeStaticBox("Id","id",id,"12" )
          << makeComboBox("Group", "group_id", group_id, 
                           group_sql)                
          << makeTextBox("First","first",first,"24")
          << makeTextBox("Last","last",last,"24")
          << makeTextBox("Login","login",login,"24")
          << makeTextBox("Password","password",password,"12")
          << makeTextBox("Phone Number","phone_number",phone_number,"16")
          << makeTextBox("Email","email",email,"64");
   if( group_id != 0 )
   {
     ocString select = "select r.id, r.name from roles r inner join group_roles gr on "
                       "r.id = gr.role_id where gr.group_id = ";
     select.append(group_id);                   
     script
          << makeComboBox("Roles","role_id",user_roles,
                          select.c_str(), 
                          "", " multiple='multiple' size='6'" );  
   }                                    
   script << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }      
Пример #5
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   script << makeTop( "category_ui.cgi", "Categories" )
          << makeTextBox("Category ID","Id",CategoryID,"12")
          << makeTextBox("CategoryName","CategoryName",CategoryName,"56")          
          << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }      
Пример #6
0
bool StructureAbstractValue::mergeNotTop(const StructureSet& other)
{
    SAMPLE("StructureAbstractValue merge not top");

    if (!m_set.merge(other))
        return false;

    if (m_set.size() > polymorphismLimit)
        makeTop();

    return true;
}
Пример #7
0
ldomXPointer CRFileHist::restorePosition( ldomDocument * doc, lString16 fpathname, size_t sz )
{
    lString16 name;
    lString16 path;
    splitFName( fpathname, path, name );
    int index = findEntry( name, path, (lvsize_t)sz );
    if ( index>=0 ) {
        makeTop( index );
        return doc->createXPointer( _records[0]->getLastPos()->getStartPos() );
    }
    return ldomXPointer();
}
Пример #8
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   script << makeTop("group_sites_ui.cgi", "GROUP SITES")
          << makeStaticBox("Id", "id", id, "12")           
          << makeComboBox( "Group", "group_id", group_id, 
                           "select id, name from groups order by name" )  
          << makeComboBox( "Site", "site_id", site_id, 
                           "select id, name from metasite.sites order by name" )                            
          << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }      
Пример #9
0
 // implement pure virtual of form display
 bool form_display( void )
 {
   bool breturn = true;
   script << makeTop("roles_ui.cgi", "ROLES")
          << makeStaticBox("Id","id",id,"12" )             
          << makeTextBox("Name","name",name,"24")
          << makeTextArea("Comments","comment",comment,  "2", "50")
          << makeComboBox( "Services","service_id",role_services,
                           "select id,  name from services", 
                           "", " multiple='multiple' size='6'" );
   script << makeButtons( key() )
          << makeBottom( m_result ) << endl; 
   return breturn;
 }
Пример #10
0
bool StructureAbstractValue::add(Structure* structure)
{
    SAMPLE("StructureAbstractValue add");

    if (isTop())
        return false;

    if (!m_set.add(structure))
        return false;

    if (m_set.size() > polymorphismLimit)
        makeTop();

    return true;
}
Пример #11
0
void StructureAbstractValue::observeTransition(Structure* from, Structure* to)
{
    SAMPLE("StructureAbstractValue observeTransition");

    ASSERT(!from->dfgShouldWatch());

    if (isTop())
        return;

    if (!m_set.contains(from))
        return;

    if (!m_set.add(to))
        return;

    if (m_set.size() > polymorphismLimit)
        makeTop();
}
Пример #12
0
void StructureAbstractValue::observeTransitions(const TransitionVector& vector)
{
    SAMPLE("StructureAbstractValue observeTransitions");

    if (isTop())
        return;

    StructureSet newStructures;
    for (unsigned i = vector.size(); i--;) {
        ASSERT(!vector[i].previous->dfgShouldWatch());

        if (!m_set.contains(vector[i].previous))
            continue;

        newStructures.add(vector[i].next);
    }

    if (!m_set.merge(newStructures))
        return;

    if (m_set.size() > polymorphismLimit)
        makeTop();
}
Пример #13
0
void small_Energy_Progress_Measure(node** nodes, int N) {
   
    int i;
    lista_bidirezionale** lista_L = (lista_bidirezionale**) malloc(sizeof(lista_bidirezionale*)); 
    int* inlistaL = calloc(N,sizeof(int));


    for (i=0; i<N; i++){
        //printlist(nodes[i]->out_neighbour);
        edgeList* iteratore; // = malloc(sizeof(edgeList));
        iteratore = nodes[i]->out_neighbour;

        if (nodes[i]->player == 0){
            int counter = 0;

            while(iteratore != NULL){
                if (iteratore->weight < 0){
                    counter++;
                    iteratore = iteratore->next;
                } else {
                    break;
                }
            }
            if (counter == nodes[i]->out_degree){
                lista_L = aggiungiNodo(lista_L, nodes[i]->id);
                inlistaL[nodes[i]->id]=1;
            }
        }else {
            while(iteratore != NULL){
                if (iteratore->weight < 0){
                    lista_L = aggiungiNodo(lista_L, nodes[i]->id);
                    inlistaL[nodes[i]->id]=1;
                    break;
                }else{
                    iteratore = iteratore->next;
                }       
            } 

        }
        //printlist(nodes[i]->out_neighbour);
    }

    int* f = calloc(N,sizeof(int));
    int* count = malloc(N*sizeof(int));
    int T = makeTop(nodes,N);

    printf("Il top è %i \n", T);

    printL(*lista_L,nodes);

    for (i=0; i<N; i++){
        if (nodes[i]-> player == 0){
            if (inLista(nodes[i]->id, *lista_L)){
                count[i] = 0;
            } else {
                count[i] = setCount_v(nodes,nodes[i]->id,T,f);
            }
        }
    }

    printL(*lista_L,nodes);
    /*
    lista_bidirezionale* it = *lista_L; 
    while (it != NULL){
        fprintf(stderr, "  %i \n",it->id);
        it = it-> next;
    }
    */

    int old_f, v;
    lista_bidirezionale* it = *lista_L; 
    while (it != NULL){
        v = (*lista_L) -> id;
        old_f = f[v];
        it = eliminaNodo(*lista_L, lista_L);
        inlistaL[v]=0;
        f[v] = Lift(f,v,nodes,T);

        printf("f[%s] vale %i \n",nodes[v]->label,f[v]);
        if (nodes[v]->player == 0)
            count[v] = setCount_v(nodes,v,T,f);
        edgeList* v_1 = nodes[v]->in_neighbour;
        while (v_1 != NULL){
            //fprintf(stderr,"v_1 e' %s \n",nodes[v_1->id]->label);
            if (f[v_1->id] < confronta_misure(f[v],v_1->weight,T)){
                if (nodes[v_1->id]->player == 0) {
                    if (f[v_1->id] >= confronta_misure(old_f,v_1->weight,T))
                        count[v_1->id]-= 1;
                    if (count[v_1->id] <= 0){
                        //fprintf(stderr,"count[%s] <= 0 Aggiungo il nodo %s a L\n",nodes[v_1->id]->label,nodes[v_1->id]->label);
                        if (inlistaL[nodes[v_1->id]->id]==0){
                            lista_L = aggiungiNodo(lista_L, nodes[v_1->id]->id);
                            inlistaL[nodes[v_1->id]->id]=1;
                            it = *lista_L;
                        }
                    }
                } else{
                    if (inlistaL[nodes[v_1->id]->id]==0){
                        lista_L = aggiungiNodo(lista_L, nodes[v_1->id]->id);
                        inlistaL[nodes[v_1->id]->id]=1;
                        it = *lista_L;
                    }
                }
            }
            v_1 = v_1 -> next;
        }
        printL(*lista_L,nodes);
    }

    for (i=0; i<N; i++){
        if (f[i] == T)
            fprintf(stdout, "Il nodo %s ha misura = T  \n",nodes[i]->label);
        else
            fprintf(stdout, "Il nodo %s ha misura = %i  \n",nodes[i]->label , f[i]);
    }

}