[34] | 1 | %{ |
---|
[36] | 2 | #define COLOR_Milestone "gtcMilestone" |
---|
| 3 | #define COLOR_BOX_HEAVY "gtcBoxHeavy" |
---|
| 4 | #define COLOR_BOX_LIGHT "gtcBoxLight" |
---|
[34] | 5 | |
---|
[51] | 6 | #define PICT_TOPSEP 0.0 |
---|
| 7 | #define PICT_BOTSEP 3.0 |
---|
| 8 | #define PICT_LEFTSEP 3.0 |
---|
| 9 | #define PICT_RIGHTSEP 3.0 |
---|
| 10 | #define PICT_VSEP 2.0 |
---|
| 11 | #define PICT_HSEP 2.0 |
---|
[34] | 12 | |
---|
| 13 | #define PICT_MONTHHEIGHT 5 // police height |
---|
| 14 | #define PICT_MONTHWIDTH (10./3.) |
---|
| 15 | |
---|
| 16 | #define TASK_VSEP 2 |
---|
[36] | 17 | #define TASK_BGC0 "gtcTaskBG0" |
---|
| 18 | #define TASK_BGC1 "gtcTaskBG1" |
---|
[51] | 19 | #define TASK_TITLEHEIGHT 6. |
---|
| 20 | #define TASK_TITLEFONTHEIGHT 2. |
---|
[34] | 21 | |
---|
| 22 | #define DELIVRABLE_VSEP 1 |
---|
| 23 | #define DELIVRABLE_HEIGHT 3 |
---|
[36] | 24 | #define DELIVRABLE_LABELWIDTH 10 |
---|
[34] | 25 | #define DELIVRABLE_LABELHEIGHT DELIVRABLE_HEIGHT |
---|
[36] | 26 | #define DELIVRABLE_TITLEWIDTH 35 |
---|
[34] | 27 | #define DELIVRABLE_TITLEHEIGHT DELIVRABLE_HEIGHT |
---|
[36] | 28 | #define DELIVRABLE_BOXHEIGHT (DELIVRABLE_HEIGHT) |
---|
[34] | 29 | |
---|
[51] | 30 | char* task_names[] = { |
---|
[59] | 31 | 0, |
---|
[51] | 32 | "Project management", |
---|
| 33 | "Backbone infrastructure", |
---|
| 34 | "System generation", |
---|
| 35 | "HAS front-end", |
---|
| 36 | "HAS back-end", |
---|
| 37 | "PC/FPGA communication middleware", |
---|
| 38 | "Industrial demonstrators", |
---|
| 39 | "Dissemination", |
---|
| 40 | 0 |
---|
| 41 | }; |
---|
[59] | 42 | struct 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 }, |
---|
[52] | 56 | }; |
---|
[51] | 57 | |
---|
[34] | 58 | typedef struct _Tlivrable { |
---|
[36] | 59 | int tn,stn,dn,vn; // task, sub-task, number |
---|
| 60 | char v; // 0, 1, 2, ..., F |
---|
[34] | 61 | char* title; |
---|
[52] | 62 | int bm,em; // mois de bebut et de fin |
---|
| 63 | double hman[3]; // nombre de mh par an |
---|
| 64 | int partner; // index dans partner_table |
---|
[36] | 65 | // these fields are filled by the program for data[tn][0][0][0] |
---|
[34] | 66 | double task_y; // top of task |
---|
| 67 | double task_dy; // bot of task is task_y+task_dy |
---|
[51] | 68 | double task_y_del; // delivrables start at task_y+task_y_del |
---|
[52] | 69 | double nbma[3]; // durée en mois par annee |
---|
[36] | 70 | // these fields are filled by the program for data[tn][stn][dn][0] |
---|
| 71 | struct _Tlivrable |
---|
| 72 | **vers; // null termiated (vers[i] = &data[tn][stn][dn][i]) |
---|
| 73 | int nbvers; // nombre de vers |
---|
| 74 | double height; // height of livrable |
---|
| 75 | // int del_bm,del_em; // mois de bebut et de fin cummule |
---|
| 76 | // these fields are filled by the program for all elements |
---|
| 77 | int nbTitleLines; |
---|
| 78 | char* titleLines[5]; // null termiated |
---|
[34] | 79 | } Tlivrable; |
---|
| 80 | |
---|
| 81 | #define T_MAX 10 |
---|
| 82 | #define S_MAX 10 |
---|
| 83 | #define D_MAX 10 |
---|
| 84 | #define V_MAX 10 |
---|
[51] | 85 | typedef struct _Tdata { |
---|
| 86 | FILE* os; |
---|
| 87 | Tlivrable* ls[T_MAX][S_MAX][D_MAX][V_MAX]; |
---|
| 88 | } Tdata; |
---|
| 89 | Tdata data_org; |
---|
| 90 | Tdata* curr; |
---|
[36] | 91 | |
---|
[51] | 92 | Tdata* data_new(int *tnplus, int *tnmoins) |
---|
| 93 | { |
---|
| 94 | int i,skip; |
---|
| 95 | int tn,stn,dn,v; |
---|
| 96 | Tdata* data = malloc(sizeof(*data)); |
---|
| 97 | memset(data,0,sizeof(*data)); |
---|
| 98 | for (tn=0 ; tn<T_MAX ; tn++) |
---|
| 99 | for (stn=0; stn<S_MAX; stn++) |
---|
| 100 | for (dn=0; dn<D_MAX; dn++) |
---|
| 101 | for (v=0; v<V_MAX; v++) { |
---|
| 102 | if ( data_org.ls[tn][stn][dn][v]==0 ) continue; |
---|
| 103 | // tnplus treatment |
---|
| 104 | skip = 0; |
---|
| 105 | if (tnplus!=0) { |
---|
| 106 | skip=1; |
---|
| 107 | for (i=0 ; tnplus[i]!=-1 ; i++) { |
---|
| 108 | if ( tnplus[i]==data_org.ls[tn][stn][dn][v]->tn ) { |
---|
| 109 | skip=0; |
---|
| 110 | break; |
---|
| 111 | } } } |
---|
| 112 | if (skip) continue; |
---|
| 113 | // tnmoins treatment |
---|
| 114 | skip = 0; |
---|
| 115 | if (tnmoins!=0) { |
---|
| 116 | for (i=0 ; tnmoins[i]!=-1 ; i++) { |
---|
| 117 | //fprintf(stderr,"i=%d data_org.ls[tn][stn][dn][v]->tn=%d tnmoins[i]=%d\n",i,data_org.ls[tn][stn][dn][v]->tn,tnmoins[i]); |
---|
| 118 | if ( tnmoins[i]==data_org.ls[tn][stn][dn][v]->tn ) { |
---|
| 119 | skip=1; |
---|
| 120 | break; |
---|
| 121 | } } } |
---|
| 122 | //fprintf(stderr,"selected: [tn][stn][dn][v]=%d,%d,%d,%d skip=%d\n",tn,stn,dn,v,skip); |
---|
| 123 | if (skip) continue; |
---|
| 124 | Tlivrable* l=malloc(sizeof(*l)); |
---|
| 125 | *l = *data_org.ls[tn][stn][dn][v]; |
---|
| 126 | data->ls[tn][stn][dn][v] = l; |
---|
[52] | 127 | //fprintf(stderr,"selected: [tn][stn][dn][v]=%d,%d,%d,%d\n",tn,stn,dn,v); |
---|
[51] | 128 | } |
---|
| 129 | return data; |
---|
| 130 | } |
---|
| 131 | |
---|
[36] | 132 | int milestones[100]; |
---|
| 133 | |
---|
| 134 | char* gen_label_base(char* buf,Tlivrable*p) |
---|
[75] | 135 | { if (p->dn >=0) sprintf(buf,"D%d%d%d",p->tn,p->stn,p->dn); else sprintf(buf,""); return buf; } |
---|
[36] | 136 | char* gen_label_vers(char* buf,Tlivrable*p) |
---|
[51] | 137 | { if (p->nbvers<=1) strcpy(buf,""); else sprintf(buf,"V%c",p->v); return buf; } |
---|
[36] | 138 | char* gen_label_full(char* buf,Tlivrable*p) |
---|
| 139 | { char b[100],v[100]; gen_label_base(b,p); gen_label_vers(v,p); |
---|
| 140 | sprintf(buf,"%s%s%s",b,*v?"-":"",v); return buf; } |
---|
| 141 | |
---|
| 142 | void print_put(double x,double y, const char* object) |
---|
[51] | 143 | { fprintf(curr->os,"\\put(%.2f,%.2f){%s}\n",x,y,object); } |
---|
[36] | 144 | void print_hline(double x,double y, double len, const char* color) |
---|
| 145 | { |
---|
| 146 | char object[1024]; |
---|
[51] | 147 | if (color!=0) { fprintf(curr->os,"\\bgroup\\color{%s}\n",color); } |
---|
[36] | 148 | sprintf(object,"\\line(1,0){%.2f}",len); |
---|
| 149 | print_put(x,y,object); |
---|
[51] | 150 | if (color!=0) { fprintf(curr->os,"\\egroup\n"); } |
---|
[36] | 151 | } |
---|
| 152 | void print_vline(double x,double y, double len, const char* color) |
---|
| 153 | { |
---|
| 154 | char object[1024]; |
---|
[51] | 155 | if (color!=0) { fprintf(curr->os,"\\bgroup\\color{%s}\n",color); } |
---|
[36] | 156 | sprintf(object,"\\line(0,1){%.2f}",len); |
---|
| 157 | print_put(x,y,object); |
---|
[51] | 158 | if (color!=0) { fprintf(curr->os,"\\egroup\n"); } |
---|
[36] | 159 | } |
---|
| 160 | void print_box( |
---|
| 161 | int filled, char* vers, // vers may be 0, |
---|
| 162 | double x,double y, double dx, double dy, |
---|
| 163 | const char* boxcolor, // may be 0 (default COLOR_BOX_HEAVY) |
---|
| 164 | const char* bgcolor, // may be 0 (not set) |
---|
| 165 | const char* textcolor // may be 0 (black) |
---|
| 166 | ){ |
---|
| 167 | double tn=.4; |
---|
| 168 | char object[1024]; |
---|
| 169 | if ( boxcolor==0 ) boxcolor = COLOR_BOX_HEAVY; |
---|
| 170 | if ( filled==1 ) { |
---|
| 171 | sprintf(object, |
---|
| 172 | "\\fcolorbox{black}{%s}{\\makebox(%.2f,%.2f){}}", |
---|
| 173 | boxcolor,dx-2-tn,dy-2-tn); |
---|
| 174 | print_put(x,y+1,object); |
---|
| 175 | } else { |
---|
| 176 | double tn2=tn/2; |
---|
| 177 | double e=.1; |
---|
[51] | 178 | fprintf(curr->os,"\\bgroup\\color{%s}\n",boxcolor); |
---|
| 179 | fprintf(curr->os,"\\linethickness{%.2fmm}\n",tn); |
---|
[36] | 180 | print_hline(x+tn2-e ,y, dx ,0); |
---|
| 181 | print_hline(x+tn2-e ,y+dy, dx ,0); |
---|
| 182 | print_vline(x+tn-e ,y+e, dy-2*e ,0); |
---|
| 183 | print_vline(x+dx-2*e,y+e, dy-2*e ,0); |
---|
[51] | 184 | fprintf(curr->os,"\\egroup\n"); |
---|
[36] | 185 | } |
---|
| 186 | if (vers) { |
---|
| 187 | sprintf(object,"\\begin{tiny}\\textbf{%s}\\end{tiny}",vers); |
---|
| 188 | print_put(x+1,y+.5,object); |
---|
| 189 | } |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | void gen_titleLines(Tlivrable*p) |
---|
| 193 | { |
---|
| 194 | const char* macro="\\ganttlf"; |
---|
| 195 | char* pc = p->title; |
---|
| 196 | char* pc2; |
---|
| 197 | |
---|
| 198 | if (pc==0) return; |
---|
| 199 | |
---|
| 200 | while ( (pc2=strstr(pc,macro))!=0 ) { |
---|
| 201 | char c = *pc2; |
---|
| 202 | *pc2 = 0; |
---|
| 203 | p->titleLines[p->nbTitleLines]=strdup(pc); |
---|
| 204 | p->nbTitleLines+=1; |
---|
| 205 | *pc2=c; |
---|
| 206 | pc=pc2+strlen(macro); |
---|
| 207 | } |
---|
| 208 | p->titleLines[p->nbTitleLines]=strdup(pc); |
---|
| 209 | p->nbTitleLines+=1; |
---|
| 210 | } |
---|
[34] | 211 | %} |
---|
| 212 | |
---|
| 213 | %option noyywrap |
---|
| 214 | |
---|
| 215 | %% |
---|
| 216 | int tn,stn,dn,v,bm,em; char* title; |
---|
[52] | 217 | double an[3]; |
---|
| 218 | char* an_comment; |
---|
| 219 | int partner; |
---|
[34] | 220 | #.*\n ; |
---|
[52] | 221 | T=[0-9]+ { tn=atoi(yytext+2); } |
---|
| 222 | S=[0-9]+ { stn=atoi(yytext+2); } |
---|
| 223 | D=[0-9]+ { dn=atoi(yytext+2); } |
---|
[75] | 224 | D=none { dn=-2; } |
---|
[52] | 225 | V=V[1-8F] { v=yytext[3]; } |
---|
[36] | 226 | ML=[0-9]+ { |
---|
| 227 | int i; |
---|
| 228 | for (i=0 ; milestones[i]!=0 ; i++); |
---|
| 229 | milestones[i] = atoi(yytext+3); |
---|
| 230 | } |
---|
[34] | 231 | BM=[0-9]+ { bm=atoi(yytext+3); } |
---|
| 232 | EM=[0-9]+ { em=atoi(yytext+3); } |
---|
[52] | 233 | R=none { an[0]=0; an[1]=0; an[2]=0; an_comment=0; } |
---|
| 234 | R=[0-9:.]+ { |
---|
| 235 | char tmp[1000]; |
---|
| 236 | int status = sscanf(yytext+2,"%lf:%lf:%lf:%s",an+0,an+1,an+2,tmp); |
---|
| 237 | if (status<3) { |
---|
| 238 | fprintf(stderr,"%s: is not resource definition, expected format \"N:N:N\" (near D%d%d%d-V%c)\n", |
---|
| 239 | yytext+2,tn,stn,dn,v); |
---|
| 240 | an[0]=0; an[1]=0; an[2]=0; an_comment=0; |
---|
| 241 | } else if (status==3) { |
---|
| 242 | an_comment = 0; |
---|
| 243 | } else |
---|
| 244 | an_comment = strdup(tmp); |
---|
| 245 | } |
---|
| 246 | PART="{"[^}]+"}" { |
---|
| 247 | int i; |
---|
| 248 | partner=-1; |
---|
| 249 | for (i=0; partner_table[i].key!=0 ; i++) { |
---|
| 250 | if (strstr(yytext,partner_table[i].key)!=0 ) { |
---|
| 251 | partner=i; |
---|
| 252 | break; |
---|
| 253 | } |
---|
| 254 | } |
---|
| 255 | if ( partner==-1 ) { |
---|
| 256 | fprintf(stderr,"%s: does not contains a partner key (near D%d%d%d-V%c)\n", |
---|
| 257 | yytext+5,tn,stn,dn,v); |
---|
| 258 | partner=0; |
---|
| 259 | } |
---|
| 260 | } |
---|
[34] | 261 | TITLE=.*\n { |
---|
| 262 | char* pc=yytext+6; |
---|
[36] | 263 | yytext[yyleng-1]=0; |
---|
[34] | 264 | while ( *pc==' ' || *pc=='\t' ) pc+=1; |
---|
| 265 | title=strdup(pc); |
---|
| 266 | Tlivrable* p= (Tlivrable*) calloc(sizeof(*p),1); |
---|
| 267 | p->tn = tn; |
---|
| 268 | p->stn = stn; |
---|
| 269 | p->dn = dn; |
---|
| 270 | p->v = v; |
---|
[52] | 271 | p->hman[0] = an[0]; |
---|
| 272 | p->hman[1] = an[1]; |
---|
| 273 | p->hman[2] = an[2]; |
---|
| 274 | p->partner = partner; |
---|
[34] | 275 | p->title = title; |
---|
| 276 | p->bm = bm; |
---|
| 277 | p->em = em; |
---|
[36] | 278 | gen_titleLines(p); |
---|
[34] | 279 | |
---|
[51] | 280 | for (v=0; data_org.ls[tn][stn][dn][v]!=0 ; v++); |
---|
| 281 | data_org.ls[tn][stn][dn][v] = p; |
---|
[52] | 282 | //fprintf(stderr,"ADDED: %d %d %d %d\n",tn,stn,dn,v); |
---|
[34] | 283 | } |
---|
[52] | 284 | [ \t\n] ; |
---|
| 285 | . { fprintf(stderr,"%c: unexpected value in anr.gantt file (near D%d%d%d-V%c)\n", |
---|
| 286 | *yytext,tn,stn,dn,v); } |
---|
[34] | 287 | %% |
---|
| 288 | |
---|
[51] | 289 | void prepare0(Tdata* data) |
---|
[34] | 290 | { |
---|
[51] | 291 | int tn,stn,v; |
---|
[34] | 292 | int i0,i1,i; |
---|
| 293 | for (tn=0 ; tn<T_MAX ; tn++) |
---|
| 294 | for (stn=0; stn<S_MAX; stn++) { |
---|
[36] | 295 | //fprintf(stderr,"AVANT:t=%d:%d:: ",tn,stn); for (i=0; i<D_MAX ; i++) |
---|
[51] | 296 | //fprintf(stderr,"%d:%p ",i,data->ls[tn][stn][i][0]); fprintf(stderr,"\n"); |
---|
[34] | 297 | while (1) { |
---|
| 298 | for (i0=0 ; i0<D_MAX ; i0++) |
---|
[51] | 299 | if (data->ls[tn][stn][i0][0] == 0) break; |
---|
[34] | 300 | for (i1=i0+1 ; i1<D_MAX ; i1++) |
---|
[51] | 301 | if (data->ls[tn][stn][i1][0] != 0) break; |
---|
[34] | 302 | if (i1>=D_MAX) break; |
---|
| 303 | // shift |
---|
| 304 | for (i=0 ; (i1+i)<D_MAX ; i++) |
---|
| 305 | for (v=0;v<V_MAX;v+=1) { |
---|
[51] | 306 | data->ls[tn][stn][i0+i][v] = data->ls[tn][stn][i1+i][v]; |
---|
| 307 | data->ls[tn][stn][i1+i][v] = 0; |
---|
[34] | 308 | } |
---|
| 309 | } |
---|
[36] | 310 | //fprintf(stderr,"AVANT:t=%d:%d:: ",tn,stn); for (i=0; i<D_MAX ; i++) |
---|
[51] | 311 | //fprintf(stderr,"%d:%p ",i,data->ls[tn][stn][i][0]); fprintf(stderr,"\n"); |
---|
[34] | 312 | } |
---|
| 313 | } |
---|
[51] | 314 | void prepare1(Tdata* data) |
---|
[34] | 315 | { |
---|
[51] | 316 | int tn,dn,v; |
---|
[34] | 317 | int i0,i1,i; |
---|
| 318 | for (tn=0 ; tn<T_MAX ; tn++) { |
---|
[51] | 319 | //fprintf(stderr,"AVANT:t=%d:: ",tn,i0,i1); for (i=0; i<S_MAX ; i++) fprintf(stderr,"%d:%p ",i,data->ls[tn][i][0][0]); fprintf(stderr,"\n"); |
---|
[34] | 320 | while (1) { |
---|
| 321 | for (i0=0 ; i0<S_MAX ; i0++) |
---|
[51] | 322 | if (data->ls[tn][i0][0][0] == 0) break; |
---|
[34] | 323 | for (i1=i0+1 ; i1<S_MAX ; i1++) |
---|
[51] | 324 | if (data->ls[tn][i1][0][0] != 0) break; |
---|
[36] | 325 | //fprintf(stderr,"%d %d %d\n",tn,i0,i1); |
---|
[34] | 326 | if (i1>=S_MAX) break; |
---|
| 327 | // shift |
---|
| 328 | for (i=0 ; (i1+i)<S_MAX ; i++) |
---|
| 329 | for (dn=0;dn<D_MAX;dn+=1) |
---|
| 330 | for (v=0;v<V_MAX;v+=1) { |
---|
[51] | 331 | data->ls[tn][i0+i][dn][v] = data->ls[tn][i1+i][dn][v]; |
---|
| 332 | data->ls[tn][i1+i][dn][v] = 0; |
---|
[34] | 333 | } |
---|
| 334 | } |
---|
[51] | 335 | //fprintf(stderr,"APRES:t=%d:: ",tn,i0,i1); for (i=0; i<S_MAX ; i++) fprintf(stderr,"%d:%p ",i,data->ls[tn][i][0][0]); fprintf(stderr,"\n"); |
---|
[34] | 336 | } |
---|
| 337 | } |
---|
[51] | 338 | void prepare2(Tdata* data) |
---|
[36] | 339 | { |
---|
[51] | 340 | int tn0,tn1,stn,dn,vn; |
---|
| 341 | int moved=1; |
---|
| 342 | while (moved) { |
---|
| 343 | moved=0; |
---|
| 344 | for (tn0=0 ; tn0<T_MAX ; tn0++) |
---|
| 345 | if (data->ls[tn0][0][0][0] == 0) break; |
---|
| 346 | for (tn1=tn0+1 ; tn1<T_MAX ; tn1++) |
---|
| 347 | if (data->ls[tn1][0][0][0] != 0) break; |
---|
| 348 | if (tn1==T_MAX) break; |
---|
| 349 | for (stn=0 ; stn<S_MAX ; stn++) |
---|
| 350 | for (dn=0;dn<D_MAX;dn+=1) |
---|
| 351 | for (vn=0;vn<V_MAX;vn+=1) { |
---|
| 352 | data->ls[tn0][stn][dn][vn] = data->ls[tn1][stn][dn][vn]; |
---|
| 353 | data->ls[tn1][stn][dn][vn] = 0; |
---|
| 354 | } |
---|
| 355 | moved=1; |
---|
| 356 | } |
---|
| 357 | } |
---|
| 358 | |
---|
| 359 | void prepare3(Tdata* data) |
---|
| 360 | { |
---|
[36] | 361 | int tn,stn,dn,vn; |
---|
| 362 | for (tn=0 ; tn<T_MAX ; tn++) |
---|
| 363 | for (stn=0; stn<S_MAX; stn++) |
---|
| 364 | for (dn=0; dn<D_MAX; dn++) { |
---|
[51] | 365 | Tlivrable* p = data->ls[tn][stn][dn][0]; |
---|
[36] | 366 | if (p==0) continue; |
---|
| 367 | p->nbvers=0 ; |
---|
| 368 | for (vn=0 ; vn<V_MAX ; vn+=1) |
---|
[51] | 369 | if (data->ls[tn][stn][dn][vn]!=0) p->nbvers+=1; |
---|
[36] | 370 | p->vers=(Tlivrable**)malloc(sizeof(*p->vers)*(p->nbvers+1)); |
---|
| 371 | for (vn=0 ; vn<p->nbvers ; vn+=1) { |
---|
[51] | 372 | p->vers[vn] = data->ls[tn][stn][dn][vn]; |
---|
| 373 | data->ls[tn][stn][dn][vn]->nbvers = p->nbvers; |
---|
[36] | 374 | } |
---|
| 375 | p->vers[vn] = 0; |
---|
| 376 | p->height = 1.0*DELIVRABLE_HEIGHT; |
---|
| 377 | if (p->nbTitleLines>=1) { |
---|
| 378 | double h=0; |
---|
| 379 | h += p->vers[p->nbvers-1]->nbTitleLines*DELIVRABLE_TITLEHEIGHT; |
---|
| 380 | h += (p->vers[p->nbvers-1]->nbTitleLines-1)*(DELIVRABLE_TITLEHEIGHT/5.); |
---|
| 381 | if ( h>p->height) p->height=h; |
---|
| 382 | } |
---|
[52] | 383 | Tlivrable* lu= p->vers[p->nbvers-1]; |
---|
| 384 | int i; |
---|
| 385 | fprintf(stderr,"--------------------\n"); |
---|
| 386 | for (i=0 ; i<p->nbvers ; i++) { |
---|
| 387 | Tlivrable* l= p->vers[i]; |
---|
| 388 | double bm= l->bm; |
---|
| 389 | double em= l->em; |
---|
| 390 | //fprintf(stderr," %d%d%d-V%c: bm=%2.f em=%2.f --> %2.1f %2.1f %2.1f\n",l->tn,l->stn,l->dn,l->v,bm,em, lu->nbma[0],lu->nbma[1],lu->nbma[2]); |
---|
| 391 | if (bm<12 && em>0) { |
---|
| 392 | lu->nbma[0] += (em>12?12:em)-bm; |
---|
| 393 | bm=12; |
---|
| 394 | } |
---|
| 395 | if (bm<24 && em>12) { |
---|
| 396 | lu->nbma[1] += (em>24?24:em)-bm; |
---|
| 397 | bm=24; |
---|
| 398 | } |
---|
| 399 | if (bm<36 && em>24) { |
---|
| 400 | lu->nbma[2] += em-bm; |
---|
| 401 | } |
---|
| 402 | //fprintf(stderr," %d%d%d-V%c: bm=%2.f em=%2.f --> %2.1f %2.1f %2.1f %p\n",l->tn,l->stn,l->dn,l->v,bm,em, lu->nbma[0],lu->nbma[1],lu->nbma[2], lu); |
---|
| 403 | } |
---|
[36] | 404 | } |
---|
| 405 | } |
---|
[34] | 406 | |
---|
[51] | 407 | double task_livrable_height(int tn, double* delivrable_y) |
---|
[34] | 408 | { |
---|
[36] | 409 | int stn,dn,nblivrables=0; |
---|
| 410 | double height=0; |
---|
[51] | 411 | height += TASK_TITLEHEIGHT ; |
---|
| 412 | *delivrable_y = height; |
---|
| 413 | for (stn=0 ; curr->ls[tn][stn][0][0]!=0 ; stn++) |
---|
| 414 | for (dn=0 ; curr->ls[tn][stn][dn][0]!=0 ; dn++) { |
---|
[36] | 415 | nblivrables += 1; |
---|
[51] | 416 | height+=curr->ls[tn][stn][dn][0]->height; |
---|
[36] | 417 | } |
---|
| 418 | height += DELIVRABLE_VSEP/2; |
---|
| 419 | height += (nblivrables-1)*DELIVRABLE_VSEP; |
---|
| 420 | height += DELIVRABLE_VSEP/2; |
---|
| 421 | return height; |
---|
[34] | 422 | } |
---|
| 423 | |
---|
| 424 | void task_box(double pictwidth) |
---|
| 425 | { |
---|
| 426 | int tn; |
---|
[51] | 427 | for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ ) { |
---|
[34] | 428 | const char* color= (tn%2)!=0 ? TASK_BGC1 : TASK_BGC0 ; |
---|
[51] | 429 | fprintf(curr->os, |
---|
[36] | 430 | "\\put(%.2f,%.2f){\\fcolorbox{black}{%s}{\\makebox(%5.2f,%5.2f){}}}\n", |
---|
[51] | 431 | 0.0,curr->ls[tn][0][0][0]->task_y, |
---|
[34] | 432 | color, |
---|
[51] | 433 | pictwidth,curr->ls[tn][0][0][0]->task_dy |
---|
[34] | 434 | ); |
---|
| 435 | } |
---|
| 436 | } |
---|
| 437 | |
---|
| 438 | void month_grid(double x, double y, double dx, double dy) |
---|
| 439 | { |
---|
| 440 | int i; |
---|
| 441 | for (i=0 ; i<=36 ; i+=1,x+=PICT_MONTHWIDTH) { |
---|
| 442 | if ( (i%3)!=0 ) continue; |
---|
[51] | 443 | fprintf(curr->os, |
---|
[34] | 444 | "\\put(%5.1f,%5.1f){\\line(0,1){%5.1f}}\\put(%5.1f,%5.1f){%d}\n", |
---|
| 445 | x,y,dy-PICT_MONTHWIDTH-PICT_VSEP, |
---|
| 446 | x-2,y+dy-PICT_MONTHHEIGHT, |
---|
| 447 | i |
---|
| 448 | ); |
---|
| 449 | } |
---|
| 450 | } |
---|
| 451 | |
---|
[36] | 452 | void print_milestones(double x, double y, double dx, double dy) |
---|
| 453 | { |
---|
| 454 | int i; |
---|
| 455 | double tn=.3; |
---|
| 456 | //x=x-tn/2; |
---|
[51] | 457 | fprintf(curr->os,"\\bgroup\n"); |
---|
| 458 | fprintf(curr->os,"\\color{red}\n"); |
---|
| 459 | fprintf(curr->os,"\\linethickness{%.2fmm}\n",tn); |
---|
[36] | 460 | for (i=0 ; milestones[i]!=0 ; i+=1) { |
---|
| 461 | double xx= x + milestones[i]*PICT_MONTHWIDTH; |
---|
| 462 | print_vline(xx,y,dy-PICT_MONTHWIDTH-PICT_VSEP,0); |
---|
| 463 | } |
---|
[51] | 464 | fprintf(curr->os,"\\egroup\n"); |
---|
[36] | 465 | } |
---|
| 466 | |
---|
[34] | 467 | double delivrable( |
---|
| 468 | double label_x, double box_x, double title_x, |
---|
| 469 | double y, |
---|
| 470 | int tn, int stn, int dn) |
---|
| 471 | { |
---|
[51] | 472 | Tlivrable* top=curr->ls[tn][stn][dn][0]; |
---|
| 473 | Tlivrable* last=curr->ls[tn][stn][dn][top->nbvers-1]; |
---|
[36] | 474 | char tmp[1000],label[1000],title[1000]; |
---|
[34] | 475 | double y0; |
---|
| 476 | int v; |
---|
| 477 | double label_dx = DELIVRABLE_LABELWIDTH ; |
---|
| 478 | double label_dy = DELIVRABLE_LABELHEIGHT ; |
---|
| 479 | double boxx,box_dx; |
---|
| 480 | double box_dy = DELIVRABLE_BOXHEIGHT ; |
---|
| 481 | double title_dx = DELIVRABLE_LABELWIDTH ; |
---|
| 482 | double title_dy = DELIVRABLE_TITLEHEIGHT ; |
---|
[36] | 483 | |
---|
| 484 | //print_hline(0,y,180,0); |
---|
| 485 | gen_label_base(label,top); |
---|
| 486 | // y -= DELIVRABLE_HEIGHT; |
---|
| 487 | y -= top->height ; |
---|
| 488 | //print_hline(0,y,180,0); |
---|
[51] | 489 | fprintf(curr->os,"%% Delivrable %s (tn=%d stn=%d dn=%d\n",label,tn,stn,dn); |
---|
[36] | 490 | |
---|
| 491 | // print label |
---|
| 492 | //y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_LABELHEIGHT)/2; |
---|
| 493 | y0 = (top->height-DELIVRABLE_LABELHEIGHT)/2; |
---|
| 494 | sprintf(tmp,"\\ganttlabelstyle{%s}",label); |
---|
| 495 | print_put(label_x,y+y0,tmp); |
---|
| 496 | // print title |
---|
| 497 | if (last->nbTitleLines==1) { |
---|
| 498 | y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_TITLEHEIGHT)/2; |
---|
| 499 | y0 += DELIVRABLE_TITLEHEIGHT/5. ; |
---|
| 500 | sprintf(tmp,"\\gantttitlestyle{%s}",last->title); |
---|
| 501 | print_put(title_x,y+y0,tmp); |
---|
| 502 | } else if (last->nbTitleLines>1) { |
---|
| 503 | int i; |
---|
| 504 | // y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_TITLEHEIGHT)/2; |
---|
| 505 | y0=DELIVRABLE_TITLEHEIGHT/5.; |
---|
| 506 | sprintf(tmp,"\\gantttitlestyle{\\shortstack[l]{%s",last->titleLines[0]); |
---|
| 507 | for (i=1 ; i<last->nbTitleLines ; i+=1) { |
---|
| 508 | strcat(tmp,"\\\\"); |
---|
| 509 | strcat(tmp,last->titleLines[i]); |
---|
| 510 | } |
---|
| 511 | strcat(tmp,"}}"); |
---|
| 512 | print_put(title_x,y+y0,tmp); |
---|
| 513 | } |
---|
| 514 | |
---|
| 515 | // print box |
---|
| 516 | //y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_BOXHEIGHT)/2; |
---|
| 517 | y0 = (top->height-DELIVRABLE_BOXHEIGHT)/2; |
---|
| 518 | if ( last==top ) { |
---|
| 519 | Tlivrable* l=top; |
---|
| 520 | boxx = box_x + l->bm*PICT_MONTHWIDTH ; |
---|
| 521 | box_dx = (l->em - l->bm) * PICT_MONTHWIDTH; |
---|
| 522 | print_box(1,0,boxx,y+y0,box_dx,box_dy,COLOR_BOX_LIGHT,0,0); |
---|
| 523 | print_box(0,0,boxx,y+y0,box_dx,box_dy,0,0,0); |
---|
| 524 | } else for (v=0 ; v<top->nbvers ; v+=1) { |
---|
[51] | 525 | Tlivrable* l=curr->ls[tn][stn][dn][v] ; |
---|
[36] | 526 | gen_label_vers(tmp,l); |
---|
[34] | 527 | boxx = box_x + l->bm*PICT_MONTHWIDTH ; |
---|
| 528 | box_dx = (l->em - l->bm) * PICT_MONTHWIDTH; |
---|
[36] | 529 | print_box(1,0,boxx,y+y0,box_dx,box_dy,COLOR_BOX_LIGHT,0,0); |
---|
| 530 | print_box(0,tmp,boxx,y+y0,box_dx,box_dy,0,0,0); |
---|
[34] | 531 | } |
---|
[36] | 532 | y -= DELIVRABLE_VSEP; |
---|
[34] | 533 | return y; |
---|
| 534 | } |
---|
| 535 | |
---|
| 536 | void task_delivrable(double label_x, double box_x, double title_x, int tn) |
---|
| 537 | { |
---|
| 538 | int stn,dn; |
---|
[51] | 539 | Tlivrable* task=curr->ls[tn][0][0][0]; |
---|
| 540 | double y = task->task_y+task->task_dy-task->task_y_del; |
---|
| 541 | char tmp[1000]; |
---|
| 542 | sprintf(tmp,"\\textbf{Task-%d \\textit{%s}}",task->tn,task_names[task->tn]); |
---|
| 543 | print_put(label_x/2,y+(TASK_TITLEHEIGHT-TASK_TITLEFONTHEIGHT)/2,tmp); |
---|
| 544 | |
---|
[36] | 545 | //y += DELIVRABLE_VSEP/2. ; |
---|
[51] | 546 | for (stn=0 ; curr->ls[tn][stn][0][0]!=0 ; stn++) |
---|
| 547 | for (dn=0 ; curr->ls[tn][stn][dn][0]!=0 ; dn++) { |
---|
[75] | 548 | if (curr->ls[tn][stn][dn][0]->dn >=0) |
---|
| 549 | y=delivrable(label_x,box_x,title_x,y,tn,stn,dn); |
---|
[36] | 550 | } |
---|
[34] | 551 | } |
---|
| 552 | |
---|
[51] | 553 | void do_gantt(const char* fn, int* tnplus, int* tnmoins) |
---|
[34] | 554 | { |
---|
| 555 | int tn; |
---|
| 556 | double pictwidth, pictheight; |
---|
| 557 | double gantt_x,gantt_y; |
---|
| 558 | double gantt_dx,gantt_dy; |
---|
| 559 | |
---|
| 560 | double label_x,title_x; |
---|
[51] | 561 | curr = data_new(tnplus,tnmoins); |
---|
| 562 | if ( (curr->os=fopen(fn,"w"))==0 ) { |
---|
| 563 | fprintf(stderr,"can not open %s file for writing.\n",fn); |
---|
| 564 | fprintf(stderr,"generation of %s graph is skipped.\n",fn); |
---|
| 565 | return; |
---|
| 566 | } |
---|
| 567 | prepare0(curr); |
---|
| 568 | prepare1(curr); |
---|
| 569 | prepare2(curr); |
---|
| 570 | prepare3(curr); |
---|
[34] | 571 | |
---|
| 572 | pictheight=0 ; |
---|
| 573 | pictheight += PICT_BOTSEP ; |
---|
[51] | 574 | for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ ); |
---|
[34] | 575 | for ( tn=tn-1 ; tn>=0 ; tn-- ) { |
---|
[51] | 576 | double offset; |
---|
| 577 | curr->ls[tn][0][0][0]->task_y = pictheight; |
---|
| 578 | curr->ls[tn][0][0][0]->task_dy = task_livrable_height(tn,&offset); |
---|
| 579 | curr->ls[tn][0][0][0]->task_y_del = offset; |
---|
| 580 | pictheight += curr->ls[tn][0][0][0]->task_dy; |
---|
[34] | 581 | pictheight += TASK_VSEP; |
---|
| 582 | } |
---|
| 583 | pictheight += PICT_MONTHHEIGHT; |
---|
| 584 | pictheight += PICT_TOPSEP ; |
---|
| 585 | gantt_y = PICT_BOTSEP ; |
---|
| 586 | gantt_dy = pictheight-PICT_TOPSEP-PICT_BOTSEP ; |
---|
| 587 | |
---|
| 588 | pictwidth=0; |
---|
| 589 | pictwidth += PICT_LEFTSEP; |
---|
| 590 | label_x = pictwidth; |
---|
| 591 | pictwidth += DELIVRABLE_LABELWIDTH; |
---|
| 592 | pictwidth += PICT_HSEP; |
---|
| 593 | gantt_x = pictwidth ; |
---|
| 594 | gantt_dx = 36*PICT_MONTHWIDTH ; |
---|
| 595 | pictwidth += gantt_dx ; |
---|
| 596 | pictwidth += PICT_HSEP; |
---|
| 597 | title_x = pictwidth; |
---|
| 598 | pictwidth += DELIVRABLE_TITLEWIDTH; |
---|
| 599 | pictwidth += PICT_RIGHTSEP; |
---|
| 600 | |
---|
[51] | 601 | fprintf(curr->os,"\\setlength{\\unitlength}{1.0mm}\n"); |
---|
| 602 | fprintf(curr->os,"\\begin{picture}(%.1f,%.1f)\n",pictwidth,pictheight); |
---|
| 603 | //print_hline(0,0,pictwidth,0); |
---|
| 604 | //print_hline(0,pictheight,pictwidth,0); |
---|
| 605 | task_box(pictwidth); |
---|
| 606 | month_grid(gantt_x,gantt_y,gantt_dx,gantt_dy); |
---|
| 607 | for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ ) { |
---|
[34] | 608 | task_delivrable(label_x,gantt_x,title_x,tn); |
---|
[51] | 609 | } |
---|
[36] | 610 | |
---|
| 611 | print_milestones(gantt_x,0,gantt_dx,gantt_dy+gantt_y); |
---|
[51] | 612 | fprintf(curr->os,"\\end{picture}\n"); |
---|
[52] | 613 | fclose(curr->os); |
---|
| 614 | curr->os=0; |
---|
[51] | 615 | } |
---|
[34] | 616 | |
---|
[59] | 617 | void do_partner_table_full(int partner) |
---|
[52] | 618 | { |
---|
| 619 | struct partner_def* part = partner_table+partner; |
---|
[59] | 620 | if ( (curr->os=fopen(part->fnfull,"w"))==0 ) { |
---|
| 621 | fprintf(stderr,"can not open %s file for writing.\n",part->fnfull); |
---|
| 622 | fprintf(stderr,"generation of %s partner table is skipped.\n",part->fnfull); |
---|
[52] | 623 | return; |
---|
| 624 | } |
---|
| 625 | fprintf(curr->os,"\\begin{tabular}{|c|p{3.5cm}||r|r|r||r|}\\hline\n"); |
---|
| 626 | fprintf(curr->os, |
---|
| 627 | "number & \\multicolumn{1}{c||}{title} & \\multicolumn{3}{c||}{years } & total \\\\\\cline{3-5}\n"); |
---|
| 628 | fprintf(curr->os, |
---|
| 629 | " & & \\multicolumn{1}{c|}{1} & \\multicolumn{1}{c|}{2} & " |
---|
| 630 | "\\multicolumn{1}{c||}{3} & \\\\\\hline\\hline\n"); |
---|
| 631 | int tn,stn,dn,v=0; |
---|
| 632 | double an1=0,an2=0,an3=0,an=0; |
---|
[54] | 633 | double tsk1,tsk2,tsk3,tsk; |
---|
[52] | 634 | int newlineadded=1; |
---|
| 635 | for (tn=0 ; tn<T_MAX ; tn++) { |
---|
| 636 | if (curr->ls[tn][0][0][0]==0) break; |
---|
| 637 | if (tn!=0 && newlineadded==0 ) { |
---|
| 638 | newlineadded = 1; |
---|
| 639 | fprintf(curr->os,"\\hline "); |
---|
| 640 | } |
---|
[54] | 641 | tsk1=tsk2=tsk3=tsk=0; |
---|
[52] | 642 | for (stn=0; stn<S_MAX; stn++) { |
---|
| 643 | for (dn=0; dn<D_MAX; dn++) { |
---|
| 644 | Tlivrable* top=curr->ls[tn][stn][dn][v]; |
---|
| 645 | if (top==0) continue; |
---|
| 646 | Tlivrable* last=top->vers[top->nbvers-1]; |
---|
| 647 | if (last->partner!=partner) continue; |
---|
| 648 | double sum1,sum2,sum3,sum=0; |
---|
| 649 | sum1 = last->hman[0]; sum +=sum1; |
---|
| 650 | sum2 = last->hman[1]; sum +=sum2; |
---|
| 651 | sum3 = last->hman[2]; sum +=sum3; |
---|
| 652 | char label[1000],title[1000]; |
---|
| 653 | gen_label_base(label,last); |
---|
| 654 | sprintf(title,"\\resstablestyletitle{%s}",last->title); |
---|
| 655 | fprintf(curr->os,"%s & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 656 | label,title,sum1,sum2,sum3,sum); |
---|
[54] | 657 | an1 += sum1 ; tsk1 += sum1 ; |
---|
| 658 | an2 += sum2 ; tsk2 += sum2 ; |
---|
| 659 | an3 += sum3 ; tsk3 += sum3 ; |
---|
| 660 | an += sum ; tsk += sum ; |
---|
[52] | 661 | newlineadded=0; |
---|
[63] | 662 | if ( sum1==0 && last->nbma[0]!=0) |
---|
[52] | 663 | fprintf(stderr,"ERROR: %s:%s probleme sur l'an 1 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 664 | part->name,label,sum1,last->nbma[0]); |
---|
[63] | 665 | if (sum1!=0 && sum1>last->nbma[0] ) |
---|
| 666 | fprintf(stderr,"WARNING: %s:%s probleme sur l'an 1 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 667 | part->name,label,sum1,last->nbma[0]); |
---|
| 668 | if (sum2!=0 && sum2>last->nbma[1]) |
---|
| 669 | fprintf(stderr,"WARNING: %s:%s probleme sur l'an 2 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 670 | part->name,label,sum2,last->nbma[1]); |
---|
| 671 | if ( sum2==0 && last->nbma[1]!=0) |
---|
[52] | 672 | fprintf(stderr,"ERROR: %s:%s probleme sur l'an 2 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 673 | part->name,label,sum2,last->nbma[1]); |
---|
[63] | 674 | if ( sum3==0 && last->nbma[2]!=0) |
---|
[52] | 675 | fprintf(stderr,"ERROR: %s:%s probleme sur l'an 3 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 676 | part->name,label,sum3,last->nbma[2]); |
---|
[63] | 677 | if (sum3!=0 && sum3>last->nbma[2]) |
---|
| 678 | fprintf(stderr,"WARNING: %s:%s probleme sur l'an 3 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 679 | part->name,label,sum3,last->nbma[2]); |
---|
[52] | 680 | } |
---|
| 681 | } |
---|
[54] | 682 | if (tsk!=0) |
---|
| 683 | fprintf(curr->os,"%s & total Task-%d & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 684 | "",curr->ls[tn][0][0][0]->tn,tsk1,tsk2,tsk3,tsk); |
---|
| 685 | |
---|
[52] | 686 | } |
---|
| 687 | if ( an!=(an1+an2+an3) ) { |
---|
[59] | 688 | fprintf(stderr,"bad computation in %s table.\n",part->fnfull); |
---|
[52] | 689 | } |
---|
[54] | 690 | fprintf(curr->os,"\\hline\n"); |
---|
[52] | 691 | fprintf(curr->os,"%s & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 692 | "","total",an1,an2,an3,an); |
---|
| 693 | |
---|
| 694 | fprintf(curr->os,"\\end{tabular}\n"); |
---|
| 695 | fclose(curr->os); |
---|
| 696 | curr->os=0; |
---|
| 697 | } |
---|
| 698 | |
---|
[59] | 699 | void do_partner_table_short(int partner) |
---|
| 700 | { |
---|
| 701 | struct partner_def* part = partner_table+partner; |
---|
| 702 | if ( (curr->os=fopen(part->fnshort,"w"))==0 ) { |
---|
| 703 | fprintf(stderr,"can not open %s file for writing.\n",part->fnshort); |
---|
| 704 | fprintf(stderr,"generation of %s partner table is skipped.\n",part->fnshort); |
---|
| 705 | return; |
---|
| 706 | } |
---|
| 707 | fprintf(curr->os,"\\begin{center}\\begin{small}\\begin{tabular}{|c|l||r|r|r||r|}\\hline\n"); |
---|
| 708 | fprintf(curr->os, |
---|
| 709 | " & title & \\multicolumn{3}{c||}{years } & total \\\\\\cline{3-5}\n"); |
---|
| 710 | fprintf(curr->os, |
---|
| 711 | " & & \\multicolumn{1}{c|}{1} & \\multicolumn{1}{c|}{2} & " |
---|
| 712 | "\\multicolumn{1}{c||}{3} & \\\\\\hline\\hline\n"); |
---|
| 713 | int tn,stn,dn,v=0; |
---|
| 714 | double an1=0,an2=0,an3=0,an=0; |
---|
| 715 | double tsk1,tsk2,tsk3,tsk; |
---|
| 716 | int newlineadded=1; |
---|
| 717 | for (tn=0 ; tn<T_MAX ; tn++) { |
---|
| 718 | if (curr->ls[tn][0][0][0]==0) break; |
---|
| 719 | tsk1=tsk2=tsk3=tsk=0; |
---|
| 720 | for (stn=0; stn<S_MAX; stn++) { |
---|
| 721 | for (dn=0; dn<D_MAX; dn++) { |
---|
| 722 | Tlivrable* top=curr->ls[tn][stn][dn][v]; |
---|
| 723 | if (top==0) continue; |
---|
| 724 | Tlivrable* last=top->vers[top->nbvers-1]; |
---|
| 725 | if (last->partner!=partner) continue; |
---|
| 726 | double sum1,sum2,sum3,sum=0; |
---|
| 727 | sum1 = last->hman[0]; sum +=sum1; |
---|
| 728 | sum2 = last->hman[1]; sum +=sum2; |
---|
| 729 | sum3 = last->hman[2]; sum +=sum3; |
---|
| 730 | an1 += sum1 ; tsk1 += sum1 ; |
---|
| 731 | an2 += sum2 ; tsk2 += sum2 ; |
---|
| 732 | an3 += sum3 ; tsk3 += sum3 ; |
---|
| 733 | an += sum ; tsk += sum ; |
---|
| 734 | newlineadded=0; |
---|
| 735 | char label[1000]; |
---|
| 736 | gen_label_base(label,last); |
---|
[63] | 737 | /* doublons , non ? |
---|
| 738 | if ( (sum1!=0 && sum1>last->nbma[0] ) || (sum1==0 && last->nbma[0]!=0) ) |
---|
[59] | 739 | fprintf(stderr,"ERROR: %s:%s probleme sur l'an 1 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 740 | part->name,label,sum1,last->nbma[0]); |
---|
| 741 | if ( (sum2!=0 && sum2>last->nbma[1]) || (sum2==0 && last->nbma[1]!=0) ) |
---|
| 742 | fprintf(stderr,"ERROR: %s:%s probleme sur l'an 2 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 743 | part->name,label,sum2,last->nbma[1]); |
---|
| 744 | if ( (sum3!=0 && sum3>last->nbma[2]) || (sum3==0 && last->nbma[2]!=0) ) |
---|
| 745 | fprintf(stderr,"ERROR: %s:%s probleme sur l'an 3 (in table=%2.1f, in gantt=%2.1f\n", |
---|
| 746 | part->name,label,sum3,last->nbma[2]); |
---|
[63] | 747 | */ |
---|
[59] | 748 | } |
---|
| 749 | } |
---|
| 750 | if (tsk!=0) |
---|
| 751 | fprintf(curr->os,"Task-%d & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 752 | curr->ls[tn][0][0][0]->tn, |
---|
| 753 | task_names[curr->ls[tn][0][0][0]->tn],tsk1,tsk2,tsk3,tsk); |
---|
| 754 | |
---|
| 755 | } |
---|
| 756 | if ( an!=(an1+an2+an3) ) { |
---|
| 757 | fprintf(stderr,"bad computation in %s table.\n",part->fnshort); |
---|
| 758 | } |
---|
| 759 | fprintf(curr->os,"\\hline\n"); |
---|
| 760 | fprintf(curr->os," & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 761 | "total",an1,an2,an3,an); |
---|
| 762 | |
---|
| 763 | fprintf(curr->os,"\\end{tabular}\\end{small}\\end{center}\n"); |
---|
| 764 | fclose(curr->os); |
---|
| 765 | curr->os=0; |
---|
| 766 | } |
---|
| 767 | |
---|
[51] | 768 | int main() |
---|
| 769 | { |
---|
[113] | 770 | int tnplus[10] = { 1, 2, 3, 4, -1 }; |
---|
| 771 | int tnmoins[10] = { 1, 2, 3, 4, -1 }; |
---|
[51] | 772 | |
---|
| 773 | yylex(); |
---|
| 774 | do_gantt("gantt.tex",0,0); |
---|
| 775 | do_gantt("gantt1.tex",tnplus,0); |
---|
| 776 | do_gantt("gantt2.tex",0,tnmoins); |
---|
| 777 | |
---|
[52] | 778 | curr = data_new(0,0); |
---|
| 779 | prepare0(curr); |
---|
| 780 | prepare1(curr); |
---|
| 781 | prepare2(curr); |
---|
| 782 | prepare3(curr); |
---|
[60] | 783 | do_partner_table_full(3); do_partner_table_short(3); |
---|
[59] | 784 | do_partner_table_full(4); do_partner_table_short(4); |
---|
| 785 | do_partner_table_full(5); do_partner_table_short(5); |
---|
[113] | 786 | do_partner_table_full(7); do_partner_table_short(7); |
---|
| 787 | do_partner_table_full(8); do_partner_table_short(8); |
---|
| 788 | do_partner_table_full(9); do_partner_table_short(9); |
---|
| 789 | do_partner_table_full(10); do_partner_table_short(10); |
---|
[52] | 790 | |
---|
[34] | 791 | return 0; |
---|
| 792 | } |
---|