[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 |
---|
[251] | 8 | #define PICT_LEFTSEP 2.0 |
---|
[51] | 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 |
---|
[251] | 24 | #define DELIVRABLE_LABELWIDTH 7.5 |
---|
[34] | 25 | #define DELIVRABLE_LABELHEIGHT DELIVRABLE_HEIGHT |
---|
[251] | 26 | #define DELIVRABLE_TITLEWIDTH 38 |
---|
[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[] = { |
---|
[147] | 43 | { "UNKNOW" ,"relax" ,0 ,0 }, |
---|
[121] | 44 | { "irisa" ,"irisa" ,"table_inria_cairn_full.tex" ,"table_inria_cairn_short.tex" }, |
---|
[147] | 45 | { "lip" ,"lip" ,"table_inria_compsys_full.tex","table_inria_compsys_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 | { "bull" ,"bull" ,"table_bull_full.tex" ,"table_bull_short.tex" }, |
---|
| 50 | { "thales" ,"thales" ,"table_thales_full.tex" ,"table_thales_short.tex" }, |
---|
[278] | 51 | { "mds" ,"mds" ,"table_mds_full.tex" ,"table_mds_short.tex" }, |
---|
[147] | 52 | { 0 ,0 ,0 ,0 }, |
---|
[52] | 53 | }; |
---|
[51] | 54 | |
---|
[34] | 55 | typedef struct _Tlivrable { |
---|
[36] | 56 | char v; // 0, 1, 2, ..., F |
---|
[151] | 57 | char* kind; |
---|
[34] | 58 | char* title; |
---|
[52] | 59 | int bm,em; // mois de bebut et de fin |
---|
| 60 | double hman[3]; // nombre de mh par an |
---|
[279] | 61 | int tn,stn,dn,vn; // task, sub-task, number |
---|
| 62 | int leader; // 1: the partner leads this livrable |
---|
| 63 | // 0: the partner helps for this livrable |
---|
[52] | 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] |
---|
[279] | 71 | struct _Tlivrable // versions of the livrable |
---|
| 72 | **vers; // null termiated (vers[i] = data[tn][stn][dn][j]) |
---|
| 73 | // this->leader == 1 |
---|
| 74 | // vers[0] = this |
---|
| 75 | // vers[i]->leadaer == this->leader |
---|
| 76 | // vers[i]->partner == this->partner |
---|
| 77 | int nbvers; // nombre de vers |
---|
[36] | 78 | double height; // height of livrable |
---|
| 79 | // int del_bm,del_em; // mois de bebut et de fin cummule |
---|
| 80 | // these fields are filled by the program for all elements |
---|
| 81 | int nbTitleLines; |
---|
| 82 | char* titleLines[5]; // null termiated |
---|
[279] | 83 | struct _Tlivrable // participant to the livrable |
---|
| 84 | **part; // null termiated (vers[i] = data[tn][stn][dn][j]) |
---|
| 85 | // this->leader == 1 |
---|
| 86 | // vers[i] != this |
---|
| 87 | // vers[i]->leader == 0 |
---|
| 88 | // vers[i]->partner != this->partner |
---|
| 89 | int nbpart; // nombre de vers |
---|
[34] | 90 | } Tlivrable; |
---|
| 91 | |
---|
| 92 | #define T_MAX 10 |
---|
| 93 | #define S_MAX 10 |
---|
| 94 | #define D_MAX 10 |
---|
| 95 | #define V_MAX 10 |
---|
[51] | 96 | typedef struct _Tdata { |
---|
| 97 | FILE* os; |
---|
| 98 | Tlivrable* ls[T_MAX][S_MAX][D_MAX][V_MAX]; |
---|
| 99 | } Tdata; |
---|
| 100 | Tdata data_org; |
---|
| 101 | Tdata* curr; |
---|
[36] | 102 | |
---|
[51] | 103 | Tdata* data_new(int *tnplus, int *tnmoins) |
---|
| 104 | { |
---|
| 105 | int i,skip; |
---|
| 106 | int tn,stn,dn,v; |
---|
| 107 | Tdata* data = malloc(sizeof(*data)); |
---|
| 108 | memset(data,0,sizeof(*data)); |
---|
| 109 | for (tn=0 ; tn<T_MAX ; tn++) |
---|
| 110 | for (stn=0; stn<S_MAX; stn++) |
---|
| 111 | for (dn=0; dn<D_MAX; dn++) |
---|
| 112 | for (v=0; v<V_MAX; v++) { |
---|
| 113 | if ( data_org.ls[tn][stn][dn][v]==0 ) continue; |
---|
| 114 | // tnplus treatment |
---|
| 115 | skip = 0; |
---|
| 116 | if (tnplus!=0) { |
---|
| 117 | skip=1; |
---|
| 118 | for (i=0 ; tnplus[i]!=-1 ; i++) { |
---|
| 119 | if ( tnplus[i]==data_org.ls[tn][stn][dn][v]->tn ) { |
---|
| 120 | skip=0; |
---|
| 121 | break; |
---|
| 122 | } } } |
---|
| 123 | if (skip) continue; |
---|
| 124 | // tnmoins treatment |
---|
| 125 | skip = 0; |
---|
| 126 | if (tnmoins!=0) { |
---|
| 127 | for (i=0 ; tnmoins[i]!=-1 ; i++) { |
---|
| 128 | //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]); |
---|
| 129 | if ( tnmoins[i]==data_org.ls[tn][stn][dn][v]->tn ) { |
---|
| 130 | skip=1; |
---|
| 131 | break; |
---|
| 132 | } } } |
---|
| 133 | //fprintf(stderr,"selected: [tn][stn][dn][v]=%d,%d,%d,%d skip=%d\n",tn,stn,dn,v,skip); |
---|
| 134 | if (skip) continue; |
---|
| 135 | Tlivrable* l=malloc(sizeof(*l)); |
---|
| 136 | *l = *data_org.ls[tn][stn][dn][v]; |
---|
| 137 | data->ls[tn][stn][dn][v] = l; |
---|
[52] | 138 | //fprintf(stderr,"selected: [tn][stn][dn][v]=%d,%d,%d,%d\n",tn,stn,dn,v); |
---|
[51] | 139 | } |
---|
| 140 | return data; |
---|
| 141 | } |
---|
| 142 | |
---|
[36] | 143 | int milestones[100]; |
---|
| 144 | |
---|
| 145 | char* gen_label_base(char* buf,Tlivrable*p) |
---|
[75] | 146 | { if (p->dn >=0) sprintf(buf,"D%d%d%d",p->tn,p->stn,p->dn); else sprintf(buf,""); return buf; } |
---|
[36] | 147 | char* gen_label_vers(char* buf,Tlivrable*p) |
---|
[51] | 148 | { if (p->nbvers<=1) strcpy(buf,""); else sprintf(buf,"V%c",p->v); return buf; } |
---|
[36] | 149 | char* gen_label_full(char* buf,Tlivrable*p) |
---|
| 150 | { char b[100],v[100]; gen_label_base(b,p); gen_label_vers(v,p); |
---|
| 151 | sprintf(buf,"%s%s%s",b,*v?"-":"",v); return buf; } |
---|
| 152 | |
---|
| 153 | void print_put(double x,double y, const char* object) |
---|
[51] | 154 | { fprintf(curr->os,"\\put(%.2f,%.2f){%s}\n",x,y,object); } |
---|
[36] | 155 | void print_hline(double x,double y, double len, const char* color) |
---|
| 156 | { |
---|
| 157 | char object[1024]; |
---|
[51] | 158 | if (color!=0) { fprintf(curr->os,"\\bgroup\\color{%s}\n",color); } |
---|
[36] | 159 | sprintf(object,"\\line(1,0){%.2f}",len); |
---|
| 160 | print_put(x,y,object); |
---|
[51] | 161 | if (color!=0) { fprintf(curr->os,"\\egroup\n"); } |
---|
[36] | 162 | } |
---|
| 163 | void print_vline(double x,double y, double len, const char* color) |
---|
| 164 | { |
---|
| 165 | char object[1024]; |
---|
[51] | 166 | if (color!=0) { fprintf(curr->os,"\\bgroup\\color{%s}\n",color); } |
---|
[36] | 167 | sprintf(object,"\\line(0,1){%.2f}",len); |
---|
| 168 | print_put(x,y,object); |
---|
[51] | 169 | if (color!=0) { fprintf(curr->os,"\\egroup\n"); } |
---|
[36] | 170 | } |
---|
| 171 | void print_box( |
---|
| 172 | int filled, char* vers, // vers may be 0, |
---|
| 173 | double x,double y, double dx, double dy, |
---|
| 174 | const char* boxcolor, // may be 0 (default COLOR_BOX_HEAVY) |
---|
| 175 | const char* bgcolor, // may be 0 (not set) |
---|
| 176 | const char* textcolor // may be 0 (black) |
---|
| 177 | ){ |
---|
| 178 | double tn=.4; |
---|
| 179 | char object[1024]; |
---|
| 180 | if ( boxcolor==0 ) boxcolor = COLOR_BOX_HEAVY; |
---|
| 181 | if ( filled==1 ) { |
---|
| 182 | sprintf(object, |
---|
| 183 | "\\fcolorbox{black}{%s}{\\makebox(%.2f,%.2f){}}", |
---|
| 184 | boxcolor,dx-2-tn,dy-2-tn); |
---|
| 185 | print_put(x,y+1,object); |
---|
| 186 | } else { |
---|
| 187 | double tn2=tn/2; |
---|
| 188 | double e=.1; |
---|
[51] | 189 | fprintf(curr->os,"\\bgroup\\color{%s}\n",boxcolor); |
---|
| 190 | fprintf(curr->os,"\\linethickness{%.2fmm}\n",tn); |
---|
[36] | 191 | print_hline(x+tn2-e ,y, dx ,0); |
---|
| 192 | print_hline(x+tn2-e ,y+dy, dx ,0); |
---|
| 193 | print_vline(x+tn-e ,y+e, dy-2*e ,0); |
---|
| 194 | print_vline(x+dx-2*e,y+e, dy-2*e ,0); |
---|
[51] | 195 | fprintf(curr->os,"\\egroup\n"); |
---|
[36] | 196 | } |
---|
| 197 | if (vers) { |
---|
| 198 | sprintf(object,"\\begin{tiny}\\textbf{%s}\\end{tiny}",vers); |
---|
| 199 | print_put(x+1,y+.5,object); |
---|
| 200 | } |
---|
| 201 | } |
---|
| 202 | |
---|
| 203 | void gen_titleLines(Tlivrable*p) |
---|
| 204 | { |
---|
| 205 | const char* macro="\\ganttlf"; |
---|
| 206 | char* pc = p->title; |
---|
| 207 | char* pc2; |
---|
| 208 | |
---|
| 209 | if (pc==0) return; |
---|
| 210 | |
---|
| 211 | while ( (pc2=strstr(pc,macro))!=0 ) { |
---|
| 212 | char c = *pc2; |
---|
| 213 | *pc2 = 0; |
---|
| 214 | p->titleLines[p->nbTitleLines]=strdup(pc); |
---|
| 215 | p->nbTitleLines+=1; |
---|
| 216 | *pc2=c; |
---|
| 217 | pc=pc2+strlen(macro); |
---|
| 218 | } |
---|
| 219 | p->titleLines[p->nbTitleLines]=strdup(pc); |
---|
| 220 | p->nbTitleLines+=1; |
---|
| 221 | } |
---|
[34] | 222 | %} |
---|
| 223 | |
---|
| 224 | %option noyywrap |
---|
| 225 | |
---|
| 226 | %% |
---|
[151] | 227 | int tn,stn,dn,v,bm,em; char* title; char* kind; |
---|
[52] | 228 | double an[3]; |
---|
| 229 | char* an_comment; |
---|
[279] | 230 | int leader; |
---|
[52] | 231 | int partner; |
---|
[34] | 232 | #.*\n ; |
---|
[279] | 233 | L=1 { leader=1; } |
---|
| 234 | L=0 { leader=0; } |
---|
[52] | 235 | T=[0-9]+ { tn=atoi(yytext+2); } |
---|
| 236 | S=[0-9]+ { stn=atoi(yytext+2); } |
---|
| 237 | D=[0-9]+ { dn=atoi(yytext+2); } |
---|
| 238 | V=V[1-8F] { v=yytext[3]; } |
---|
[36] | 239 | ML=[0-9]+ { |
---|
| 240 | int i; |
---|
| 241 | for (i=0 ; milestones[i]!=0 ; i++); |
---|
| 242 | milestones[i] = atoi(yytext+3); |
---|
| 243 | } |
---|
[34] | 244 | BM=[0-9]+ { bm=atoi(yytext+3); } |
---|
| 245 | EM=[0-9]+ { em=atoi(yytext+3); } |
---|
[52] | 246 | R=none { an[0]=0; an[1]=0; an[2]=0; an_comment=0; } |
---|
| 247 | R=[0-9:.]+ { |
---|
| 248 | char tmp[1000]; |
---|
| 249 | int status = sscanf(yytext+2,"%lf:%lf:%lf:%s",an+0,an+1,an+2,tmp); |
---|
| 250 | if (status<3) { |
---|
[151] | 251 | fprintf(stderr, |
---|
| 252 | "%s: is not resource definition, expected format \"N:N:N\" (near D%d%d%d-V%c)\n", |
---|
[52] | 253 | yytext+2,tn,stn,dn,v); |
---|
| 254 | an[0]=0; an[1]=0; an[2]=0; an_comment=0; |
---|
| 255 | } else if (status==3) { |
---|
| 256 | an_comment = 0; |
---|
| 257 | } else |
---|
| 258 | an_comment = strdup(tmp); |
---|
| 259 | } |
---|
| 260 | PART="{"[^}]+"}" { |
---|
| 261 | int i; |
---|
| 262 | partner=-1; |
---|
| 263 | for (i=0; partner_table[i].key!=0 ; i++) { |
---|
| 264 | if (strstr(yytext,partner_table[i].key)!=0 ) { |
---|
| 265 | partner=i; |
---|
| 266 | break; |
---|
| 267 | } |
---|
| 268 | } |
---|
| 269 | if ( partner==-1 ) { |
---|
| 270 | fprintf(stderr,"%s: does not contains a partner key (near D%d%d%d-V%c)\n", |
---|
| 271 | yytext+5,tn,stn,dn,v); |
---|
| 272 | partner=0; |
---|
| 273 | } |
---|
| 274 | } |
---|
[151] | 275 | KIND="{"[^}]+"}" { |
---|
| 276 | yytext[yyleng-1]=0; |
---|
| 277 | kind= strdup(yytext+6); |
---|
| 278 | if ( strcmp(kind,"x")!=0 && strcmp(kind,"d")!=0 && strcmp(kind,"h")!=0 && |
---|
| 279 | strcmp(kind,"d+x")!=0 ) |
---|
| 280 | fprintf(stderr,"ERROR:D%d%d%d invalid KIND: %s\n",tn,stn,dn,kind); |
---|
| 281 | } |
---|
| 282 | KIND="{}" { |
---|
| 283 | yytext[yyleng-1]=0; |
---|
| 284 | kind= strdup(yytext+6); |
---|
| 285 | } |
---|
[34] | 286 | TITLE=.*\n { |
---|
| 287 | char* pc=yytext+6; |
---|
[36] | 288 | yytext[yyleng-1]=0; |
---|
[34] | 289 | while ( *pc==' ' || *pc=='\t' ) pc+=1; |
---|
| 290 | title=strdup(pc); |
---|
| 291 | Tlivrable* p= (Tlivrable*) calloc(sizeof(*p),1); |
---|
| 292 | p->tn = tn; |
---|
| 293 | p->stn = stn; |
---|
| 294 | p->dn = dn; |
---|
| 295 | p->v = v; |
---|
[52] | 296 | p->hman[0] = an[0]; |
---|
| 297 | p->hman[1] = an[1]; |
---|
| 298 | p->hman[2] = an[2]; |
---|
[279] | 299 | p->leader = leader; |
---|
[52] | 300 | p->partner = partner; |
---|
[34] | 301 | p->title = title; |
---|
| 302 | p->bm = bm; |
---|
| 303 | p->em = em; |
---|
[151] | 304 | p->kind = kind; |
---|
[36] | 305 | gen_titleLines(p); |
---|
[34] | 306 | |
---|
[51] | 307 | for (v=0; data_org.ls[tn][stn][dn][v]!=0 ; v++); |
---|
| 308 | data_org.ls[tn][stn][dn][v] = p; |
---|
[52] | 309 | //fprintf(stderr,"ADDED: %d %d %d %d\n",tn,stn,dn,v); |
---|
[151] | 310 | tn=stn=dn=v=bm=em=0; |
---|
| 311 | title=kind=0; |
---|
| 312 | an[0]= an[1]=an[1]=0; |
---|
| 313 | an_comment=0; |
---|
| 314 | partner=0; |
---|
[279] | 315 | leader=0; |
---|
[34] | 316 | } |
---|
[52] | 317 | [ \t\n] ; |
---|
| 318 | . { fprintf(stderr,"%c: unexpected value in anr.gantt file (near D%d%d%d-V%c)\n", |
---|
| 319 | *yytext,tn,stn,dn,v); } |
---|
[34] | 320 | %% |
---|
| 321 | |
---|
[51] | 322 | void prepare0(Tdata* data) |
---|
[34] | 323 | { |
---|
[51] | 324 | int tn,stn,v; |
---|
[34] | 325 | int i0,i1,i; |
---|
| 326 | for (tn=0 ; tn<T_MAX ; tn++) |
---|
| 327 | for (stn=0; stn<S_MAX; stn++) { |
---|
[36] | 328 | //fprintf(stderr,"AVANT:t=%d:%d:: ",tn,stn); for (i=0; i<D_MAX ; i++) |
---|
[51] | 329 | //fprintf(stderr,"%d:%p ",i,data->ls[tn][stn][i][0]); fprintf(stderr,"\n"); |
---|
[34] | 330 | while (1) { |
---|
| 331 | for (i0=0 ; i0<D_MAX ; i0++) |
---|
[51] | 332 | if (data->ls[tn][stn][i0][0] == 0) break; |
---|
[34] | 333 | for (i1=i0+1 ; i1<D_MAX ; i1++) |
---|
[51] | 334 | if (data->ls[tn][stn][i1][0] != 0) break; |
---|
[34] | 335 | if (i1>=D_MAX) break; |
---|
| 336 | // shift |
---|
| 337 | for (i=0 ; (i1+i)<D_MAX ; i++) |
---|
| 338 | for (v=0;v<V_MAX;v+=1) { |
---|
[51] | 339 | data->ls[tn][stn][i0+i][v] = data->ls[tn][stn][i1+i][v]; |
---|
| 340 | data->ls[tn][stn][i1+i][v] = 0; |
---|
[34] | 341 | } |
---|
| 342 | } |
---|
[36] | 343 | //fprintf(stderr,"AVANT:t=%d:%d:: ",tn,stn); for (i=0; i<D_MAX ; i++) |
---|
[51] | 344 | //fprintf(stderr,"%d:%p ",i,data->ls[tn][stn][i][0]); fprintf(stderr,"\n"); |
---|
[34] | 345 | } |
---|
| 346 | } |
---|
[51] | 347 | void prepare1(Tdata* data) |
---|
[34] | 348 | { |
---|
[51] | 349 | int tn,dn,v; |
---|
[34] | 350 | int i0,i1,i; |
---|
| 351 | for (tn=0 ; tn<T_MAX ; tn++) { |
---|
[51] | 352 | //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] | 353 | while (1) { |
---|
| 354 | for (i0=0 ; i0<S_MAX ; i0++) |
---|
[51] | 355 | if (data->ls[tn][i0][0][0] == 0) break; |
---|
[34] | 356 | for (i1=i0+1 ; i1<S_MAX ; i1++) |
---|
[51] | 357 | if (data->ls[tn][i1][0][0] != 0) break; |
---|
[36] | 358 | //fprintf(stderr,"%d %d %d\n",tn,i0,i1); |
---|
[34] | 359 | if (i1>=S_MAX) break; |
---|
| 360 | // shift |
---|
| 361 | for (i=0 ; (i1+i)<S_MAX ; i++) |
---|
| 362 | for (dn=0;dn<D_MAX;dn+=1) |
---|
| 363 | for (v=0;v<V_MAX;v+=1) { |
---|
[51] | 364 | data->ls[tn][i0+i][dn][v] = data->ls[tn][i1+i][dn][v]; |
---|
| 365 | data->ls[tn][i1+i][dn][v] = 0; |
---|
[34] | 366 | } |
---|
| 367 | } |
---|
[51] | 368 | //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] | 369 | } |
---|
| 370 | } |
---|
[51] | 371 | void prepare2(Tdata* data) |
---|
[36] | 372 | { |
---|
[51] | 373 | int tn0,tn1,stn,dn,vn; |
---|
| 374 | int moved=1; |
---|
| 375 | while (moved) { |
---|
| 376 | moved=0; |
---|
| 377 | for (tn0=0 ; tn0<T_MAX ; tn0++) |
---|
| 378 | if (data->ls[tn0][0][0][0] == 0) break; |
---|
| 379 | for (tn1=tn0+1 ; tn1<T_MAX ; tn1++) |
---|
| 380 | if (data->ls[tn1][0][0][0] != 0) break; |
---|
| 381 | if (tn1==T_MAX) break; |
---|
| 382 | for (stn=0 ; stn<S_MAX ; stn++) |
---|
| 383 | for (dn=0;dn<D_MAX;dn+=1) |
---|
| 384 | for (vn=0;vn<V_MAX;vn+=1) { |
---|
| 385 | data->ls[tn0][stn][dn][vn] = data->ls[tn1][stn][dn][vn]; |
---|
| 386 | data->ls[tn1][stn][dn][vn] = 0; |
---|
| 387 | } |
---|
| 388 | moved=1; |
---|
| 389 | } |
---|
| 390 | } |
---|
| 391 | |
---|
| 392 | void prepare3(Tdata* data) |
---|
| 393 | { |
---|
[279] | 394 | int tn,stn,dn,vn,cnt; |
---|
| 395 | Tlivrable* tmp; |
---|
[36] | 396 | for (tn=0 ; tn<T_MAX ; tn++) |
---|
| 397 | for (stn=0; stn<S_MAX; stn++) |
---|
| 398 | for (dn=0; dn<D_MAX; dn++) { |
---|
[51] | 399 | Tlivrable* p = data->ls[tn][stn][dn][0]; |
---|
[36] | 400 | if (p==0) continue; |
---|
| 401 | p->nbvers=0 ; |
---|
[279] | 402 | p->nbpart=0 ; |
---|
| 403 | for (vn=0 ; vn<V_MAX ; vn+=1) { |
---|
| 404 | tmp = data->ls[tn][stn][dn][vn]; |
---|
| 405 | if (tmp==0) continue; |
---|
| 406 | if (tmp->leader==0) |
---|
| 407 | p->nbpart+=1; |
---|
| 408 | else |
---|
| 409 | p->nbvers+=1; |
---|
| 410 | } |
---|
[36] | 411 | p->vers=(Tlivrable**)malloc(sizeof(*p->vers)*(p->nbvers+1)); |
---|
[279] | 412 | for (vn=0,cnt=0 ; vn<V_MAX ; vn+=1) { |
---|
| 413 | tmp = data->ls[tn][stn][dn][vn]; |
---|
| 414 | if (tmp!=0 && tmp->leader==1) { |
---|
| 415 | p->vers[cnt++] = tmp; |
---|
| 416 | tmp->nbvers = p->nbvers; |
---|
| 417 | } |
---|
[36] | 418 | } |
---|
[279] | 419 | p->vers[cnt] = 0; |
---|
| 420 | if (p->nbpart!=0) { |
---|
| 421 | p->part=(Tlivrable**)malloc(sizeof(*p->part)*(p->nbpart+1)); |
---|
| 422 | for (vn=0,cnt=0 ; vn<V_MAX ; vn+=1) { |
---|
| 423 | tmp = data->ls[tn][stn][dn][vn]; |
---|
| 424 | if (tmp!=0 && tmp->leader==0) { |
---|
| 425 | p->part[cnt++] = tmp; |
---|
| 426 | } |
---|
| 427 | } |
---|
| 428 | p->part[cnt] = 0; |
---|
| 429 | } |
---|
| 430 | |
---|
[36] | 431 | p->height = 1.0*DELIVRABLE_HEIGHT; |
---|
| 432 | if (p->nbTitleLines>=1) { |
---|
| 433 | double h=0; |
---|
| 434 | h += p->vers[p->nbvers-1]->nbTitleLines*DELIVRABLE_TITLEHEIGHT; |
---|
| 435 | h += (p->vers[p->nbvers-1]->nbTitleLines-1)*(DELIVRABLE_TITLEHEIGHT/5.); |
---|
| 436 | if ( h>p->height) p->height=h; |
---|
| 437 | } |
---|
[52] | 438 | Tlivrable* lu= p->vers[p->nbvers-1]; |
---|
| 439 | int i; |
---|
[147] | 440 | //fprintf(stderr,"--------------------\n"); |
---|
[52] | 441 | for (i=0 ; i<p->nbvers ; i++) { |
---|
| 442 | Tlivrable* l= p->vers[i]; |
---|
| 443 | double bm= l->bm; |
---|
| 444 | double em= l->em; |
---|
| 445 | //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]); |
---|
| 446 | if (bm<12 && em>0) { |
---|
| 447 | lu->nbma[0] += (em>12?12:em)-bm; |
---|
| 448 | bm=12; |
---|
| 449 | } |
---|
| 450 | if (bm<24 && em>12) { |
---|
| 451 | lu->nbma[1] += (em>24?24:em)-bm; |
---|
| 452 | bm=24; |
---|
| 453 | } |
---|
| 454 | if (bm<36 && em>24) { |
---|
| 455 | lu->nbma[2] += em-bm; |
---|
| 456 | } |
---|
| 457 | //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); |
---|
| 458 | } |
---|
[36] | 459 | } |
---|
| 460 | } |
---|
[34] | 461 | |
---|
[51] | 462 | double task_livrable_height(int tn, double* delivrable_y) |
---|
[34] | 463 | { |
---|
[36] | 464 | int stn,dn,nblivrables=0; |
---|
| 465 | double height=0; |
---|
[51] | 466 | height += TASK_TITLEHEIGHT ; |
---|
| 467 | *delivrable_y = height; |
---|
| 468 | for (stn=0 ; curr->ls[tn][stn][0][0]!=0 ; stn++) |
---|
| 469 | for (dn=0 ; curr->ls[tn][stn][dn][0]!=0 ; dn++) { |
---|
[279] | 470 | if ( curr->ls[tn][stn][dn][0]->leader==0 ) continue; |
---|
[36] | 471 | nblivrables += 1; |
---|
[51] | 472 | height+=curr->ls[tn][stn][dn][0]->height; |
---|
[36] | 473 | } |
---|
| 474 | height += DELIVRABLE_VSEP/2; |
---|
| 475 | height += (nblivrables-1)*DELIVRABLE_VSEP; |
---|
| 476 | height += DELIVRABLE_VSEP/2; |
---|
| 477 | return height; |
---|
[34] | 478 | } |
---|
| 479 | |
---|
| 480 | void task_box(double pictwidth) |
---|
| 481 | { |
---|
| 482 | int tn; |
---|
[51] | 483 | for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ ) { |
---|
[34] | 484 | const char* color= (tn%2)!=0 ? TASK_BGC1 : TASK_BGC0 ; |
---|
[51] | 485 | fprintf(curr->os, |
---|
[36] | 486 | "\\put(%.2f,%.2f){\\fcolorbox{black}{%s}{\\makebox(%5.2f,%5.2f){}}}\n", |
---|
[51] | 487 | 0.0,curr->ls[tn][0][0][0]->task_y, |
---|
[34] | 488 | color, |
---|
[51] | 489 | pictwidth,curr->ls[tn][0][0][0]->task_dy |
---|
[34] | 490 | ); |
---|
| 491 | } |
---|
| 492 | } |
---|
| 493 | |
---|
| 494 | void month_grid(double x, double y, double dx, double dy) |
---|
| 495 | { |
---|
| 496 | int i; |
---|
| 497 | for (i=0 ; i<=36 ; i+=1,x+=PICT_MONTHWIDTH) { |
---|
| 498 | if ( (i%3)!=0 ) continue; |
---|
[51] | 499 | fprintf(curr->os, |
---|
[34] | 500 | "\\put(%5.1f,%5.1f){\\line(0,1){%5.1f}}\\put(%5.1f,%5.1f){%d}\n", |
---|
| 501 | x,y,dy-PICT_MONTHWIDTH-PICT_VSEP, |
---|
| 502 | x-2,y+dy-PICT_MONTHHEIGHT, |
---|
| 503 | i |
---|
| 504 | ); |
---|
| 505 | } |
---|
| 506 | } |
---|
| 507 | |
---|
[36] | 508 | void print_milestones(double x, double y, double dx, double dy) |
---|
| 509 | { |
---|
| 510 | int i; |
---|
| 511 | double tn=.3; |
---|
| 512 | //x=x-tn/2; |
---|
[51] | 513 | fprintf(curr->os,"\\bgroup\n"); |
---|
| 514 | fprintf(curr->os,"\\color{red}\n"); |
---|
| 515 | fprintf(curr->os,"\\linethickness{%.2fmm}\n",tn); |
---|
[36] | 516 | for (i=0 ; milestones[i]!=0 ; i+=1) { |
---|
| 517 | double xx= x + milestones[i]*PICT_MONTHWIDTH; |
---|
| 518 | print_vline(xx,y,dy-PICT_MONTHWIDTH-PICT_VSEP,0); |
---|
[251] | 519 | char tmp[100]; |
---|
| 520 | sprintf(tmp,"M%d",i+1); |
---|
| 521 | print_put(xx-2,y-3,tmp); |
---|
[36] | 522 | } |
---|
[51] | 523 | fprintf(curr->os,"\\egroup\n"); |
---|
[36] | 524 | } |
---|
| 525 | |
---|
[34] | 526 | double delivrable( |
---|
| 527 | double label_x, double box_x, double title_x, |
---|
| 528 | double y, |
---|
| 529 | int tn, int stn, int dn) |
---|
| 530 | { |
---|
[51] | 531 | Tlivrable* top=curr->ls[tn][stn][dn][0]; |
---|
| 532 | Tlivrable* last=curr->ls[tn][stn][dn][top->nbvers-1]; |
---|
[36] | 533 | char tmp[1000],label[1000],title[1000]; |
---|
[34] | 534 | double y0; |
---|
| 535 | int v; |
---|
| 536 | double label_dx = DELIVRABLE_LABELWIDTH ; |
---|
| 537 | double label_dy = DELIVRABLE_LABELHEIGHT ; |
---|
| 538 | double boxx,box_dx; |
---|
| 539 | double box_dy = DELIVRABLE_BOXHEIGHT ; |
---|
[251] | 540 | double title_dx = DELIVRABLE_TITLEWIDTH ; |
---|
[34] | 541 | double title_dy = DELIVRABLE_TITLEHEIGHT ; |
---|
[36] | 542 | |
---|
| 543 | //print_hline(0,y,180,0); |
---|
| 544 | gen_label_base(label,top); |
---|
| 545 | // y -= DELIVRABLE_HEIGHT; |
---|
| 546 | y -= top->height ; |
---|
| 547 | //print_hline(0,y,180,0); |
---|
[51] | 548 | fprintf(curr->os,"%% Delivrable %s (tn=%d stn=%d dn=%d\n",label,tn,stn,dn); |
---|
[36] | 549 | |
---|
| 550 | // print label |
---|
| 551 | //y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_LABELHEIGHT)/2; |
---|
| 552 | y0 = (top->height-DELIVRABLE_LABELHEIGHT)/2; |
---|
| 553 | sprintf(tmp,"\\ganttlabelstyle{%s}",label); |
---|
| 554 | print_put(label_x,y+y0,tmp); |
---|
| 555 | // print title |
---|
| 556 | if (last->nbTitleLines==1) { |
---|
| 557 | y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_TITLEHEIGHT)/2; |
---|
| 558 | y0 += DELIVRABLE_TITLEHEIGHT/5. ; |
---|
| 559 | sprintf(tmp,"\\gantttitlestyle{%s}",last->title); |
---|
| 560 | print_put(title_x,y+y0,tmp); |
---|
| 561 | } else if (last->nbTitleLines>1) { |
---|
| 562 | int i; |
---|
| 563 | // y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_TITLEHEIGHT)/2; |
---|
| 564 | y0=DELIVRABLE_TITLEHEIGHT/5.; |
---|
| 565 | sprintf(tmp,"\\gantttitlestyle{\\shortstack[l]{%s",last->titleLines[0]); |
---|
| 566 | for (i=1 ; i<last->nbTitleLines ; i+=1) { |
---|
| 567 | strcat(tmp,"\\\\"); |
---|
| 568 | strcat(tmp,last->titleLines[i]); |
---|
| 569 | } |
---|
| 570 | strcat(tmp,"}}"); |
---|
| 571 | print_put(title_x,y+y0,tmp); |
---|
| 572 | } |
---|
| 573 | |
---|
| 574 | // print box |
---|
| 575 | //y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_BOXHEIGHT)/2; |
---|
| 576 | y0 = (top->height-DELIVRABLE_BOXHEIGHT)/2; |
---|
| 577 | if ( last==top ) { |
---|
| 578 | Tlivrable* l=top; |
---|
| 579 | boxx = box_x + l->bm*PICT_MONTHWIDTH ; |
---|
| 580 | box_dx = (l->em - l->bm) * PICT_MONTHWIDTH; |
---|
| 581 | print_box(1,0,boxx,y+y0,box_dx,box_dy,COLOR_BOX_LIGHT,0,0); |
---|
| 582 | print_box(0,0,boxx,y+y0,box_dx,box_dy,0,0,0); |
---|
| 583 | } else for (v=0 ; v<top->nbvers ; v+=1) { |
---|
[51] | 584 | Tlivrable* l=curr->ls[tn][stn][dn][v] ; |
---|
[36] | 585 | gen_label_vers(tmp,l); |
---|
[34] | 586 | boxx = box_x + l->bm*PICT_MONTHWIDTH ; |
---|
| 587 | box_dx = (l->em - l->bm) * PICT_MONTHWIDTH; |
---|
[36] | 588 | print_box(1,0,boxx,y+y0,box_dx,box_dy,COLOR_BOX_LIGHT,0,0); |
---|
| 589 | print_box(0,tmp,boxx,y+y0,box_dx,box_dy,0,0,0); |
---|
[34] | 590 | } |
---|
[36] | 591 | y -= DELIVRABLE_VSEP; |
---|
[34] | 592 | return y; |
---|
| 593 | } |
---|
| 594 | |
---|
| 595 | void task_delivrable(double label_x, double box_x, double title_x, int tn) |
---|
| 596 | { |
---|
| 597 | int stn,dn; |
---|
[51] | 598 | Tlivrable* task=curr->ls[tn][0][0][0]; |
---|
| 599 | double y = task->task_y+task->task_dy-task->task_y_del; |
---|
| 600 | char tmp[1000]; |
---|
| 601 | sprintf(tmp,"\\textbf{Task-%d \\textit{%s}}",task->tn,task_names[task->tn]); |
---|
| 602 | print_put(label_x/2,y+(TASK_TITLEHEIGHT-TASK_TITLEFONTHEIGHT)/2,tmp); |
---|
| 603 | |
---|
[36] | 604 | //y += DELIVRABLE_VSEP/2. ; |
---|
[51] | 605 | for (stn=0 ; curr->ls[tn][stn][0][0]!=0 ; stn++) |
---|
| 606 | for (dn=0 ; curr->ls[tn][stn][dn][0]!=0 ; dn++) { |
---|
[75] | 607 | if (curr->ls[tn][stn][dn][0]->dn >=0) |
---|
| 608 | y=delivrable(label_x,box_x,title_x,y,tn,stn,dn); |
---|
[36] | 609 | } |
---|
[34] | 610 | } |
---|
| 611 | |
---|
[51] | 612 | void do_gantt(const char* fn, int* tnplus, int* tnmoins) |
---|
[34] | 613 | { |
---|
| 614 | int tn; |
---|
| 615 | double pictwidth, pictheight; |
---|
| 616 | double gantt_x,gantt_y; |
---|
| 617 | double gantt_dx,gantt_dy; |
---|
| 618 | |
---|
| 619 | double label_x,title_x; |
---|
[51] | 620 | curr = data_new(tnplus,tnmoins); |
---|
| 621 | if ( (curr->os=fopen(fn,"w"))==0 ) { |
---|
| 622 | fprintf(stderr,"can not open %s file for writing.\n",fn); |
---|
| 623 | fprintf(stderr,"generation of %s graph is skipped.\n",fn); |
---|
| 624 | return; |
---|
| 625 | } |
---|
| 626 | prepare0(curr); |
---|
| 627 | prepare1(curr); |
---|
| 628 | prepare2(curr); |
---|
| 629 | prepare3(curr); |
---|
[34] | 630 | |
---|
| 631 | pictheight=0 ; |
---|
| 632 | pictheight += PICT_BOTSEP ; |
---|
[51] | 633 | for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ ); |
---|
[34] | 634 | for ( tn=tn-1 ; tn>=0 ; tn-- ) { |
---|
[51] | 635 | double offset; |
---|
| 636 | curr->ls[tn][0][0][0]->task_y = pictheight; |
---|
| 637 | curr->ls[tn][0][0][0]->task_dy = task_livrable_height(tn,&offset); |
---|
| 638 | curr->ls[tn][0][0][0]->task_y_del = offset; |
---|
| 639 | pictheight += curr->ls[tn][0][0][0]->task_dy; |
---|
[34] | 640 | pictheight += TASK_VSEP; |
---|
| 641 | } |
---|
| 642 | pictheight += PICT_MONTHHEIGHT; |
---|
| 643 | pictheight += PICT_TOPSEP ; |
---|
| 644 | gantt_y = PICT_BOTSEP ; |
---|
| 645 | gantt_dy = pictheight-PICT_TOPSEP-PICT_BOTSEP ; |
---|
| 646 | |
---|
| 647 | pictwidth=0; |
---|
| 648 | pictwidth += PICT_LEFTSEP; |
---|
| 649 | label_x = pictwidth; |
---|
| 650 | pictwidth += DELIVRABLE_LABELWIDTH; |
---|
| 651 | pictwidth += PICT_HSEP; |
---|
| 652 | gantt_x = pictwidth ; |
---|
| 653 | gantt_dx = 36*PICT_MONTHWIDTH ; |
---|
| 654 | pictwidth += gantt_dx ; |
---|
| 655 | pictwidth += PICT_HSEP; |
---|
| 656 | title_x = pictwidth; |
---|
| 657 | pictwidth += DELIVRABLE_TITLEWIDTH; |
---|
| 658 | pictwidth += PICT_RIGHTSEP; |
---|
| 659 | |
---|
[296] | 660 | fprintf(curr->os,"\\setlength{\\unitlength}{0.9mm}\n"); |
---|
[51] | 661 | fprintf(curr->os,"\\begin{picture}(%.1f,%.1f)\n",pictwidth,pictheight); |
---|
| 662 | //print_hline(0,0,pictwidth,0); |
---|
| 663 | //print_hline(0,pictheight,pictwidth,0); |
---|
| 664 | task_box(pictwidth); |
---|
| 665 | month_grid(gantt_x,gantt_y,gantt_dx,gantt_dy); |
---|
| 666 | for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ ) { |
---|
[34] | 667 | task_delivrable(label_x,gantt_x,title_x,tn); |
---|
[51] | 668 | } |
---|
[36] | 669 | |
---|
| 670 | print_milestones(gantt_x,0,gantt_dx,gantt_dy+gantt_y); |
---|
[51] | 671 | fprintf(curr->os,"\\end{picture}\n"); |
---|
[52] | 672 | fclose(curr->os); |
---|
| 673 | curr->os=0; |
---|
[51] | 674 | } |
---|
[34] | 675 | |
---|
[279] | 676 | Tlivrable* do_partner_table_getLivrable(Tlivrable** leader, Tlivrable* top, int partner) |
---|
| 677 | { |
---|
| 678 | int i; |
---|
| 679 | Tlivrable* ret; |
---|
| 680 | *leader=top->vers[top->nbvers-1]; |
---|
| 681 | if (leader[0]->partner==partner) |
---|
| 682 | return *leader; |
---|
| 683 | for (i=0; i<top->nbpart ; i+=1) { |
---|
| 684 | ret= top->part[i]; |
---|
| 685 | if ( ret->partner==partner ) |
---|
| 686 | return ret; |
---|
| 687 | } |
---|
| 688 | return 0; |
---|
| 689 | } |
---|
| 690 | |
---|
[59] | 691 | void do_partner_table_full(int partner) |
---|
[52] | 692 | { |
---|
| 693 | struct partner_def* part = partner_table+partner; |
---|
[59] | 694 | if ( (curr->os=fopen(part->fnfull,"w"))==0 ) { |
---|
| 695 | fprintf(stderr,"can not open %s file for writing.\n",part->fnfull); |
---|
| 696 | fprintf(stderr,"generation of %s partner table is skipped.\n",part->fnfull); |
---|
[52] | 697 | return; |
---|
| 698 | } |
---|
[123] | 699 | fprintf(curr->os,"\\begin{tabular}{|c|l||r|r|r||r|}\\hline\n"); |
---|
[52] | 700 | fprintf(curr->os, |
---|
| 701 | "number & \\multicolumn{1}{c||}{title} & \\multicolumn{3}{c||}{years } & total \\\\\\cline{3-5}\n"); |
---|
| 702 | fprintf(curr->os, |
---|
| 703 | " & & \\multicolumn{1}{c|}{1} & \\multicolumn{1}{c|}{2} & " |
---|
| 704 | "\\multicolumn{1}{c||}{3} & \\\\\\hline\\hline\n"); |
---|
| 705 | int tn,stn,dn,v=0; |
---|
| 706 | double an1=0,an2=0,an3=0,an=0; |
---|
[54] | 707 | double tsk1,tsk2,tsk3,tsk; |
---|
[52] | 708 | int newlineadded=1; |
---|
| 709 | for (tn=0 ; tn<T_MAX ; tn++) { |
---|
| 710 | if (curr->ls[tn][0][0][0]==0) break; |
---|
| 711 | if (tn!=0 && newlineadded==0 ) { |
---|
| 712 | newlineadded = 1; |
---|
| 713 | fprintf(curr->os,"\\hline "); |
---|
| 714 | } |
---|
[54] | 715 | tsk1=tsk2=tsk3=tsk=0; |
---|
[52] | 716 | for (stn=0; stn<S_MAX; stn++) { |
---|
| 717 | for (dn=0; dn<D_MAX; dn++) { |
---|
[279] | 718 | Tlivrable *lcurr,*leader; |
---|
[52] | 719 | Tlivrable* top=curr->ls[tn][stn][dn][v]; |
---|
| 720 | if (top==0) continue; |
---|
[279] | 721 | if ( (lcurr=do_partner_table_getLivrable(&leader,top,partner))==0 ) |
---|
| 722 | continue; |
---|
[52] | 723 | double sum1,sum2,sum3,sum=0; |
---|
[279] | 724 | sum1 = lcurr->hman[0]; sum +=sum1; |
---|
| 725 | sum2 = lcurr->hman[1]; sum +=sum2; |
---|
| 726 | sum3 = lcurr->hman[2]; sum +=sum3; |
---|
[52] | 727 | char label[1000],title[1000]; |
---|
[279] | 728 | gen_label_base(label,leader); |
---|
| 729 | sprintf(title,"\\resstablestyletitle{%s}",leader->title); |
---|
[52] | 730 | fprintf(curr->os,"%s & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 731 | label,title,sum1,sum2,sum3,sum); |
---|
[54] | 732 | an1 += sum1 ; tsk1 += sum1 ; |
---|
| 733 | an2 += sum2 ; tsk2 += sum2 ; |
---|
| 734 | an3 += sum3 ; tsk3 += sum3 ; |
---|
| 735 | an += sum ; tsk += sum ; |
---|
[52] | 736 | newlineadded=0; |
---|
[279] | 737 | if ( sum1==0 && leader->nbma[0]!=0) |
---|
[145] | 738 | fprintf(stderr,"ERROR: %-10s:%s probleme sur l'an 1 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 739 | part->name,label,sum1,leader->nbma[0]); |
---|
| 740 | else if (sum1!=0 && leader->nbma[0]==0 ) |
---|
[145] | 741 | fprintf(stderr,"ERROR: %-10s:%s probleme sur l'an 1 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 742 | part->name,label,sum1,leader->nbma[0]); |
---|
| 743 | else if (sum1!=0 && sum1>leader->nbma[0] ) |
---|
[145] | 744 | fprintf(stderr,"WARNING: %-10s:%s probleme sur l'an 1 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 745 | part->name,label,sum1,leader->nbma[0]); |
---|
| 746 | if ( sum2==0 && leader->nbma[1]!=0) |
---|
[145] | 747 | fprintf(stderr,"ERROR: %-10s:%s probleme sur l'an 2 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 748 | part->name,label,sum2,leader->nbma[1]); |
---|
| 749 | else if ( sum2!=0 && leader->nbma[1]==0) |
---|
[145] | 750 | fprintf(stderr,"ERROR: %-10s:%s probleme sur l'an 2 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 751 | part->name,label,sum2,leader->nbma[1]); |
---|
| 752 | else if (sum2!=0 && sum2>leader->nbma[1]) |
---|
[145] | 753 | fprintf(stderr,"WARNING: %-10s:%s probleme sur l'an 2 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 754 | part->name,label,sum2,leader->nbma[1]); |
---|
| 755 | if ( sum3==0 && leader->nbma[2]!=0) |
---|
[145] | 756 | fprintf(stderr,"ERROR: %-10s:%s probleme sur l'an 3 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 757 | part->name,label,sum3,leader->nbma[2]); |
---|
| 758 | else if ( sum3!=0 && leader->nbma[2]==0) |
---|
[145] | 759 | fprintf(stderr,"ERROR: %-10s:%s probleme sur l'an 3 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 760 | part->name,label,sum3,leader->nbma[2]); |
---|
| 761 | else if (sum3!=0 && sum3>leader->nbma[2]) |
---|
[145] | 762 | fprintf(stderr,"WARNING: %-10s:%s probleme sur l'an 3 (in table=%2.1f, in gantt=%2.1f\n", |
---|
[279] | 763 | part->name,label,sum3,leader->nbma[2]); |
---|
[52] | 764 | } |
---|
| 765 | } |
---|
[54] | 766 | if (tsk!=0) |
---|
| 767 | fprintf(curr->os,"%s & total Task-%d & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 768 | "",curr->ls[tn][0][0][0]->tn,tsk1,tsk2,tsk3,tsk); |
---|
| 769 | |
---|
[52] | 770 | } |
---|
| 771 | if ( an!=(an1+an2+an3) ) { |
---|
[59] | 772 | fprintf(stderr,"bad computation in %s table.\n",part->fnfull); |
---|
[52] | 773 | } |
---|
[54] | 774 | fprintf(curr->os,"\\hline\n"); |
---|
[52] | 775 | fprintf(curr->os,"%s & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 776 | "","total",an1,an2,an3,an); |
---|
| 777 | |
---|
| 778 | fprintf(curr->os,"\\end{tabular}\n"); |
---|
| 779 | fclose(curr->os); |
---|
| 780 | curr->os=0; |
---|
| 781 | } |
---|
| 782 | |
---|
[59] | 783 | void do_partner_table_short(int partner) |
---|
| 784 | { |
---|
| 785 | struct partner_def* part = partner_table+partner; |
---|
| 786 | if ( (curr->os=fopen(part->fnshort,"w"))==0 ) { |
---|
| 787 | fprintf(stderr,"can not open %s file for writing.\n",part->fnshort); |
---|
| 788 | fprintf(stderr,"generation of %s partner table is skipped.\n",part->fnshort); |
---|
| 789 | return; |
---|
| 790 | } |
---|
| 791 | fprintf(curr->os,"\\begin{center}\\begin{small}\\begin{tabular}{|c|l||r|r|r||r|}\\hline\n"); |
---|
| 792 | fprintf(curr->os, |
---|
| 793 | " & title & \\multicolumn{3}{c||}{years } & total \\\\\\cline{3-5}\n"); |
---|
| 794 | fprintf(curr->os, |
---|
| 795 | " & & \\multicolumn{1}{c|}{1} & \\multicolumn{1}{c|}{2} & " |
---|
| 796 | "\\multicolumn{1}{c||}{3} & \\\\\\hline\\hline\n"); |
---|
| 797 | int tn,stn,dn,v=0; |
---|
| 798 | double an1=0,an2=0,an3=0,an=0; |
---|
| 799 | double tsk1,tsk2,tsk3,tsk; |
---|
| 800 | int newlineadded=1; |
---|
| 801 | for (tn=0 ; tn<T_MAX ; tn++) { |
---|
| 802 | if (curr->ls[tn][0][0][0]==0) break; |
---|
| 803 | tsk1=tsk2=tsk3=tsk=0; |
---|
| 804 | for (stn=0; stn<S_MAX; stn++) { |
---|
| 805 | for (dn=0; dn<D_MAX; dn++) { |
---|
[279] | 806 | Tlivrable *lcurr,*leader; |
---|
[59] | 807 | Tlivrable* top=curr->ls[tn][stn][dn][v]; |
---|
| 808 | if (top==0) continue; |
---|
[279] | 809 | if ( (lcurr=do_partner_table_getLivrable(&leader,top,partner))==0 ) |
---|
| 810 | continue; |
---|
[59] | 811 | double sum1,sum2,sum3,sum=0; |
---|
[279] | 812 | sum1 = lcurr->hman[0]; sum +=sum1; |
---|
| 813 | sum2 = lcurr->hman[1]; sum +=sum2; |
---|
| 814 | sum3 = lcurr->hman[2]; sum +=sum3; |
---|
[59] | 815 | an1 += sum1 ; tsk1 += sum1 ; |
---|
| 816 | an2 += sum2 ; tsk2 += sum2 ; |
---|
| 817 | an3 += sum3 ; tsk3 += sum3 ; |
---|
| 818 | an += sum ; tsk += sum ; |
---|
| 819 | newlineadded=0; |
---|
| 820 | char label[1000]; |
---|
[279] | 821 | gen_label_base(label,leader); |
---|
[59] | 822 | } |
---|
| 823 | } |
---|
| 824 | if (tsk!=0) |
---|
| 825 | fprintf(curr->os,"Task-%d & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 826 | curr->ls[tn][0][0][0]->tn, |
---|
| 827 | task_names[curr->ls[tn][0][0][0]->tn],tsk1,tsk2,tsk3,tsk); |
---|
| 828 | |
---|
| 829 | } |
---|
| 830 | if ( an!=(an1+an2+an3) ) { |
---|
| 831 | fprintf(stderr,"bad computation in %s table.\n",part->fnshort); |
---|
| 832 | } |
---|
| 833 | fprintf(curr->os,"\\hline\n"); |
---|
| 834 | fprintf(curr->os," & %s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 835 | "total",an1,an2,an3,an); |
---|
| 836 | |
---|
| 837 | fprintf(curr->os,"\\end{tabular}\\end{small}\\end{center}\n"); |
---|
| 838 | fclose(curr->os); |
---|
| 839 | curr->os=0; |
---|
| 840 | } |
---|
| 841 | |
---|
[147] | 842 | void do_livrable_tables_open(int tablenum, int last) |
---|
| 843 | { |
---|
| 844 | char fn[1024]; |
---|
| 845 | |
---|
| 846 | if (curr->os!=0) { |
---|
| 847 | fprintf(curr->os,"\\end{tabular}\n"); |
---|
| 848 | fclose(curr->os); |
---|
| 849 | curr->os = 0; |
---|
| 850 | } |
---|
| 851 | |
---|
| 852 | if ( last ) |
---|
| 853 | return; |
---|
| 854 | |
---|
| 855 | sprintf(fn,"table_livrable_%02d.tex",tablenum); |
---|
| 856 | if ( (curr->os=fopen(fn,"w"))==0 ) { |
---|
| 857 | fprintf(stderr,"FATAL: can not open %s file for writing.\n",fn); |
---|
| 858 | exit(1); |
---|
| 859 | } |
---|
| 860 | fprintf(curr->os,"\\begin{tabular}[t]{|l|c|c|c|p{\\desclen}|}\\hline\n"); |
---|
[151] | 861 | fprintf(curr->os,"number"); |
---|
| 862 | fprintf(curr->os," & resp."); |
---|
| 863 | fprintf(curr->os," & \\makebox[2mm]{T0+}"); |
---|
| 864 | fprintf(curr->os," & \\makebox[2mm]{kind}"); |
---|
| 865 | fprintf(curr->os," & description\\\\\\hline\\hline\n"); |
---|
[147] | 866 | } |
---|
| 867 | |
---|
| 868 | void do_livrable_tables(int maxlines) |
---|
| 869 | { |
---|
| 870 | int nblines=maxlines; |
---|
| 871 | int nbfile=1; |
---|
| 872 | int tn,stn,dn,v; |
---|
| 873 | do_livrable_tables_open(nbfile,0); nbfile +=1 ; |
---|
| 874 | for (tn=0 ; tn<T_MAX ; tn++) { if ( curr->ls[tn][0][0][0]==0 ) break; |
---|
| 875 | for (stn=0; stn<S_MAX; stn++) { if ( curr->ls[tn][stn][0][0]==0 ) break; |
---|
| 876 | for (dn=0; dn<D_MAX; dn++) { |
---|
| 877 | Tlivrable* top = curr->ls[tn][stn][dn][0]; |
---|
| 878 | if ( top==0 ) break; |
---|
| 879 | Tlivrable* last=top->vers[top->nbvers-1]; |
---|
| 880 | if ( (nblines-top->nbvers) <= 0 ) { |
---|
| 881 | do_livrable_tables_open(nbfile,0); nbfile +=1 ; |
---|
| 882 | nblines = maxlines; |
---|
| 883 | } |
---|
| 884 | for (v=0; v<V_MAX; v++) { |
---|
| 885 | Tlivrable* l = curr->ls[tn][stn][dn][v]; |
---|
| 886 | if ( l==0 ) break; |
---|
[279] | 887 | if ( l->leader==0 ) continue; |
---|
[147] | 888 | char label[1000],resp[100],date[100],kind[100],desc[1000]; |
---|
| 889 | gen_label_full(label,l); |
---|
| 890 | sprintf(resp,"\\S%s",partner_table[l->partner].key); |
---|
[151] | 891 | sprintf(date,"\\makebox[2mm][r]{%d}",l->em); |
---|
| 892 | sprintf(kind,"\\makebox[1mm]{%s}",l->kind); |
---|
[147] | 893 | if ( top->nbvers == 1 ) |
---|
| 894 | sprintf(desc,"%s \\\\\\hline\n",last->title); |
---|
| 895 | else if ( v==(top->nbvers-1) ) |
---|
| 896 | sprintf(desc, |
---|
| 897 | "\\multirow{-%d}{\\desclen}{%s}\\\\\\hline\n", |
---|
| 898 | top->nbvers,last->title); |
---|
| 899 | //else if ( v==(top->nbvers-1) ) |
---|
| 900 | // sprintf(desc, "\\\\\\hline\n"); |
---|
| 901 | else |
---|
| 902 | sprintf(desc, "\\\\\\cline{1-4}\n"); |
---|
| 903 | |
---|
| 904 | fprintf(curr->os,"%-15s", label); |
---|
| 905 | fprintf(curr->os," & %-10s", resp); |
---|
[151] | 906 | fprintf(curr->os," & %-30s", date); |
---|
| 907 | fprintf(curr->os," & %-30s", kind); |
---|
[147] | 908 | fprintf(curr->os," & %s", desc); |
---|
| 909 | nblines -= 1; |
---|
| 910 | } |
---|
| 911 | }}} |
---|
| 912 | do_livrable_tables_open(nbfile,1); |
---|
| 913 | } |
---|
| 914 | |
---|
[296] | 915 | #if 1 |
---|
| 916 | void do_effort_par_livrable(char* filename,int from_task, int to_task) |
---|
| 917 | { |
---|
| 918 | //struct partner_def* part; |
---|
| 919 | if ( (curr->os=fopen(filename,"w"))==0 ) { |
---|
| 920 | fprintf(stderr,"can not open %s file for writing.\n",filename); |
---|
| 921 | fprintf(stderr,"generation of %s partner table is skipped.\n",filename); |
---|
| 922 | return; |
---|
| 923 | } |
---|
| 924 | fprintf(curr->os,"\\begin{tabular}{|c|l||c|r|r|r||r|}\\hline\n"); |
---|
| 925 | fprintf(curr->os, |
---|
| 926 | "number & \\multicolumn{1}{c||}{title} & part. & \\multicolumn{3}{c||}{years } & total \\\\\\cline{4-6}\n"); |
---|
| 927 | fprintf(curr->os, |
---|
| 928 | " & & & \\multicolumn{1}{c|}{1} & \\multicolumn{1}{c|}{2} & " |
---|
| 929 | "\\multicolumn{1}{c||}{3} & \\\\\\hline\\hline\n"); |
---|
| 930 | int tn,stn,dn,partner; |
---|
| 931 | double an1=0,an2=0,an3=0,an=0; |
---|
| 932 | for (tn=0 ; tn<T_MAX ; tn++) { |
---|
| 933 | int livrablenb=0,subtasknb=0; |
---|
| 934 | int task_n,subtask_n; |
---|
| 935 | double t_sum1=0, t_sum2=0, t_sum3=0, t_sum=0; |
---|
| 936 | double st_sum1=0,st_sum2=0,st_sum3=0,st_sum=0; |
---|
| 937 | if (curr->ls[tn][0][0][0]==0) break; |
---|
| 938 | for (stn=0; stn<S_MAX; stn++) { |
---|
| 939 | st_sum1=st_sum2=st_sum3=st_sum=0; |
---|
| 940 | livrablenb=0; |
---|
| 941 | for (dn=0; dn<D_MAX; dn++) { |
---|
| 942 | int linenb = 0; |
---|
| 943 | Tlivrable* top=curr->ls[tn][stn][dn][0]; |
---|
| 944 | if ( top==0 ) break; |
---|
| 945 | if ( !( from_task<=top->tn && top->tn<=to_task ) ) break; |
---|
| 946 | double liv1=0,liv2=0,liv3=0,liv=0; |
---|
| 947 | for (partner=1 ; partner_table[partner].key!=0 ; partner+=1) { |
---|
| 948 | Tlivrable *lcurr,*leader; |
---|
| 949 | if ( (lcurr=do_partner_table_getLivrable(&leader,top,partner))==0 ) |
---|
| 950 | continue; |
---|
| 951 | double sum1,sum2,sum3,sum=0; |
---|
| 952 | sum1 = lcurr->hman[0]; sum +=sum1; |
---|
| 953 | sum2 = lcurr->hman[1]; sum +=sum2; |
---|
| 954 | sum3 = lcurr->hman[2]; sum +=sum3; |
---|
| 955 | char label[1000],title[1000]; |
---|
| 956 | gen_label_base(label,lcurr); |
---|
| 957 | sprintf(title,"\\resstablestyletitle{%s}",top->title); |
---|
| 958 | fprintf(curr->os,"%10s & %50s & %10s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 959 | linenb==0 ? label : "", |
---|
| 960 | linenb==0 ? title : "", |
---|
| 961 | partner_table[lcurr->partner].key, |
---|
| 962 | sum1,sum2,sum3,sum); |
---|
| 963 | linenb += 1; |
---|
| 964 | liv1 += sum1 ; st_sum1 += sum1 ; t_sum1 += sum1 ; an1 += sum1 ; |
---|
| 965 | liv2 += sum2 ; st_sum2 += sum2 ; t_sum2 += sum2 ; an2 += sum2 ; |
---|
| 966 | liv3 += sum3 ; st_sum3 += sum3 ; t_sum3 += sum3 ; an3 += sum3 ; |
---|
| 967 | liv += sum ; st_sum += sum ; t_sum += sum ; an += sum ; |
---|
| 968 | } |
---|
| 969 | if (linenb>1) |
---|
| 970 | fprintf(curr->os,"%10s & %50s & %10s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 971 | "","","total",liv1,liv2,liv3,liv); |
---|
| 972 | if (linenb>=0) { |
---|
| 973 | livrablenb +=1; |
---|
| 974 | task_n=top->tn; |
---|
| 975 | subtask_n=top->stn; |
---|
| 976 | } |
---|
| 977 | } |
---|
| 978 | if ( livrablenb>0) { |
---|
| 979 | char name[100]; |
---|
| 980 | char title[1000]; |
---|
| 981 | sprintf(name,"st%d-%d",task_n,subtask_n); |
---|
| 982 | sprintf(title,"\\resstablestyletitle{%s}",""); |
---|
| 983 | fprintf(curr->os,"%10s & %50s & %10s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\n", |
---|
| 984 | name,title,"total",st_sum1,st_sum2,st_sum3,st_sum); |
---|
| 985 | subtasknb += 1; |
---|
| 986 | } |
---|
| 987 | } |
---|
| 988 | if ( subtasknb>0 ) { |
---|
| 989 | char name[100]; |
---|
| 990 | char title[1000]; |
---|
| 991 | sprintf(name,"task-%d",task_n); |
---|
| 992 | sprintf(title,"\\resstablestyletitle{%s}",task_names[task_n]); |
---|
| 993 | fprintf(curr->os,"%10s & %50s & %10s & %2.1f & %2.1f & %2.1f & %2.1f \\\\\\hline\\hline\n", |
---|
| 994 | name,title,"total",t_sum1,t_sum2,t_sum3,t_sum); |
---|
| 995 | } |
---|
| 996 | } |
---|
| 997 | fprintf(curr->os,"\\end{tabular}\n"); |
---|
| 998 | fclose(curr->os); |
---|
| 999 | curr->os=0; |
---|
| 1000 | } |
---|
| 1001 | #endif |
---|
| 1002 | |
---|
[51] | 1003 | int main() |
---|
| 1004 | { |
---|
[278] | 1005 | int tnplus[10] = { 1, 2, 3, 4, 5, 6, -1 }; |
---|
| 1006 | int tnmoins[10] = { 1, 2, 3, 4, 5, 6, -1 }; |
---|
[51] | 1007 | |
---|
| 1008 | yylex(); |
---|
| 1009 | do_gantt("gantt.tex",0,0); |
---|
| 1010 | do_gantt("gantt1.tex",tnplus,0); |
---|
| 1011 | do_gantt("gantt2.tex",0,tnmoins); |
---|
| 1012 | |
---|
[52] | 1013 | curr = data_new(0,0); |
---|
| 1014 | prepare0(curr); |
---|
| 1015 | prepare1(curr); |
---|
| 1016 | prepare2(curr); |
---|
| 1017 | prepare3(curr); |
---|
[147] | 1018 | do_partner_table_full(1); do_partner_table_short(1); |
---|
[278] | 1019 | do_partner_table_full(2); do_partner_table_short(2); |
---|
[147] | 1020 | do_partner_table_full(3); do_partner_table_short(3); |
---|
| 1021 | do_partner_table_full(4); do_partner_table_short(4); |
---|
| 1022 | do_partner_table_full(5); do_partner_table_short(5); |
---|
[278] | 1023 | do_partner_table_full(6); do_partner_table_short(6); |
---|
[147] | 1024 | do_partner_table_full(7); do_partner_table_short(7); |
---|
| 1025 | do_partner_table_full(8); do_partner_table_short(8); |
---|
[52] | 1026 | |
---|
[147] | 1027 | curr = data_new(0,0); |
---|
| 1028 | prepare0(curr); |
---|
| 1029 | prepare1(curr); |
---|
| 1030 | prepare2(curr); |
---|
| 1031 | prepare3(curr); |
---|
[278] | 1032 | do_livrable_tables(40); |
---|
[296] | 1033 | |
---|
| 1034 | curr = data_new(0,0); |
---|
| 1035 | prepare0(curr); |
---|
| 1036 | prepare1(curr); |
---|
| 1037 | prepare2(curr); |
---|
| 1038 | prepare3(curr); |
---|
| 1039 | do_effort_par_livrable("effort-par-livrable-1.tex",1,3); |
---|
| 1040 | do_effort_par_livrable("effort-par-livrable-2.tex",4,7); |
---|
| 1041 | do_effort_par_livrable("effort-par-livrable-3.tex",8,8); |
---|
[34] | 1042 | return 0; |
---|
| 1043 | } |
---|