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