Changeset 59 for anr/gantt.l


Ignore:
Timestamp:
Feb 2, 2010, 3:06:02 AM (14 years ago)
Author:
coach
Message:

IA: renumerotation des taches

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anr/gantt.l

    r54 r59  
    2929
    3030char* task_names[] = {
     31    0,
    3132    "Project management",
    3233    "Backbone infrastructure",
     
    3940    0
    4041};
    41 struct partner_def { char *key, *name, *file; } partner_table[] = {
    42     { "UNKNOW", "relax",   0,                 },
    43     { "irisa",  "irisa",   "table_irisa.tex"  },
    44     { "lip",    "lip",     "table_lip.tex"    },
    45     { "tima",   "tima",    "table_tima.tex"   },
    46     { "ubs",    "ubs",     "table_ubs.tex"    },
    47     { "upmc",   "upmc",    "table_upmc.tex"   },
    48     { "altera", "altera",  "table_altera.tex" },
    49     { "xilinx", "xilinx",  "table_xilinx.tex" },
    50     { "bull",   "bull",    "table_bull.tex"   },
    51     { "thales", "thales",  "table_thales.tex" },
    52     { "zied",   "zied",    "table_zied.tex"   },
    53     { "navtel", "navtel",  "table_navtel.tex" },
    54     { 0,        0,         0                  },
     42struct partner_def { char *key, *name, *fnfull, *fnshort; } partner_table[] = {
     43    { "UNKNOW" ,"relax"  ,0                       ,0                        },
     44    { "irisa"  ,"irisa"  ,"table_irisa_full.tex"  ,"table_irisa_short.tex"  },
     45    { "lip"    ,"lip"    ,"table_lip_full.tex"    ,"table_lip_short.tex"    },
     46    { "tima"   ,"tima"   ,"table_tima_full.tex"   ,"table_tima_short.tex"   },
     47    { "ubs"    ,"ubs"    ,"table_ubs_full.tex"    ,"table_ubs_short.tex"    },
     48    { "upmc"   ,"upmc"   ,"table_upmc_full.tex"   ,"table_upmc_short.tex"   },
     49    { "altera" ,"altera" ,"table_altera_full.tex" ,"table_altera_short.tex" },
     50    { "xilinx" ,"xilinx" ,"table_xilinx_full.tex" ,"table_xilinx_short.tex" },
     51    { "bull"   ,"bull"   ,"table_bull_full.tex"   ,"table_bull_short.tex"   },
     52    { "thales" ,"thales" ,"table_thales_full.tex" ,"table_thales_short.tex" },
     53    { "zied"   ,"zied"   ,"table_zied_full.tex"   ,"table_zied_short.tex"   },
     54    { "navtel" ,"navtel" ,"table_navtel_full.tex" ,"table_navtel_short.tex" },
     55    { 0        ,0        ,0                       ,0                        },
    5556};
    5657
     
    612613}
    613614
    614 void do_partner_table(int partner)
     615void do_partner_table_full(int partner)
    615616{
    616617    struct partner_def* part = partner_table+partner;
    617     if ( (curr->os=fopen(part->file,"w"))==0 ) {
    618         fprintf(stderr,"can not open %s file for writing.\n",part->file);
    619         fprintf(stderr,"generation of %s partner table is skipped.\n",part->file);
     618    if ( (curr->os=fopen(part->fnfull,"w"))==0 ) {
     619        fprintf(stderr,"can not open %s file for writing.\n",part->fnfull);
     620        fprintf(stderr,"generation of %s partner table is skipped.\n",part->fnfull);
    620621        return;
    621622    }
     
    674675    }
    675676    if ( an!=(an1+an2+an3) ) {
    676         fprintf(stderr,"bad computation in %s table.\n",part->file);
     677        fprintf(stderr,"bad computation in %s table.\n",part->fnfull);
    677678    }
    678679    fprintf(curr->os,"\\hline\n");
     
    685686}
    686687
     688void do_partner_table_short(int partner)
     689{
     690    struct partner_def* part = partner_table+partner;
     691    if ( (curr->os=fopen(part->fnshort,"w"))==0 ) {
     692        fprintf(stderr,"can not open %s file for writing.\n",part->fnshort);
     693        fprintf(stderr,"generation of %s partner table is skipped.\n",part->fnshort);
     694        return;
     695    }
     696    fprintf(curr->os,"\\begin{center}\\begin{small}\\begin{tabular}{|c|l||r|r|r||r|}\\hline\n");
     697    fprintf(curr->os,
     698        " & title & \\multicolumn{3}{c||}{years } & total \\\\\\cline{3-5}\n");
     699    fprintf(curr->os,
     700        " &       & \\multicolumn{1}{c|}{1} & \\multicolumn{1}{c|}{2} & "
     701                    "\\multicolumn{1}{c||}{3} &  \\\\\\hline\\hline\n");
     702    int tn,stn,dn,v=0;
     703    double an1=0,an2=0,an3=0,an=0;
     704    double tsk1,tsk2,tsk3,tsk;
     705    int newlineadded=1;
     706    for (tn=0 ; tn<T_MAX ; tn++) {
     707        if (curr->ls[tn][0][0][0]==0) break;
     708                tsk1=tsk2=tsk3=tsk=0;
     709        for (stn=0; stn<S_MAX; stn++) {
     710            for (dn=0; dn<D_MAX; dn++) {
     711                Tlivrable* top=curr->ls[tn][stn][dn][v];
     712                if (top==0) continue;
     713                Tlivrable* last=top->vers[top->nbvers-1];
     714                if (last->partner!=partner) continue;
     715                double sum1,sum2,sum3,sum=0;
     716                sum1 = last->hman[0]; sum +=sum1;
     717                sum2 = last->hman[1]; sum +=sum2;
     718                sum3 = last->hman[2]; sum +=sum3;
     719                an1 += sum1 ; tsk1 += sum1 ;
     720                an2 += sum2 ; tsk2 += sum2 ;
     721                an3 += sum3 ; tsk3 += sum3 ;
     722                an  += sum  ; tsk  += sum  ;
     723                newlineadded=0;
     724                char label[1000];
     725                gen_label_base(label,last);
     726                if ( (sum1!=0 && sum1>last->nbma[0] ) || (sum1==0 && last->nbma[0]!=0) )
     727                    fprintf(stderr,"ERROR: %s:%s probleme sur l'an 1 (in table=%2.1f, in gantt=%2.1f\n",
     728                        part->name,label,sum1,last->nbma[0]);
     729                if ( (sum2!=0 && sum2>last->nbma[1]) || (sum2==0 && last->nbma[1]!=0) )
     730                    fprintf(stderr,"ERROR: %s:%s probleme sur l'an 2 (in table=%2.1f, in gantt=%2.1f\n",
     731                        part->name,label,sum2,last->nbma[1]);
     732                if ( (sum3!=0 && sum3>last->nbma[2]) || (sum3==0 && last->nbma[2]!=0) )
     733                    fprintf(stderr,"ERROR: %s:%s probleme sur l'an 3 (in table=%2.1f, in gantt=%2.1f\n",
     734                        part->name,label,sum3,last->nbma[2]);
     735            }
     736        }
     737                if (tsk!=0)
     738        fprintf(curr->os,"Task-%d & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n",
     739            curr->ls[tn][0][0][0]->tn,
     740            task_names[curr->ls[tn][0][0][0]->tn],tsk1,tsk2,tsk3,tsk);
     741               
     742    }
     743    if ( an!=(an1+an2+an3) ) {
     744        fprintf(stderr,"bad computation in %s table.\n",part->fnshort);
     745    }
     746    fprintf(curr->os,"\\hline\n");
     747    fprintf(curr->os," & %s &  %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n",
     748            "total",an1,an2,an3,an);
     749
     750    fprintf(curr->os,"\\end{tabular}\\end{small}\\end{center}\n");
     751    fclose(curr->os);
     752    curr->os=0;
     753}
     754
    687755int main()
    688756{
    689     int tnplus[10] = { 0, 6, 7, -1 };
    690     int tnmoins[10] = { 0, 6, 7, -1 };
     757    int tnplus[10] = { 1, 7, 8, -1 };
     758    int tnmoins[10] = { 1, 7, 8, -1 };
    691759
    692760    yylex();
     
    700768    prepare2(curr);
    701769    prepare3(curr);
    702     do_partner_table(4);
    703     do_partner_table(5);
     770    do_partner_table_full(4); do_partner_table_short(4);
     771    do_partner_table_full(5); do_partner_table_short(5);
    704772
    705773    return 0;
Note: See TracChangeset for help on using the changeset viewer.