source: anr/gantt.l @ 51

Last change on this file since 51 was 51, checked in by coach, 15 years ago

IA: split gantt diagram into 2 figures

  • Property svn:keywords set to Revision HeadURL Id
File size: 17.3 KB
RevLine 
[34]1%{
[36]2#define COLOR_Milestone  "gtcMilestone"
3#define COLOR_BOX_HEAVY "gtcBoxHeavy"
4#define COLOR_BOX_LIGHT "gtcBoxLight"
[34]5
[51]6#define PICT_TOPSEP   0.0
7#define PICT_BOTSEP   3.0
8#define PICT_LEFTSEP  3.0
9#define PICT_RIGHTSEP 3.0
10#define PICT_VSEP     2.0
11#define PICT_HSEP     2.0
[34]12
13#define PICT_MONTHHEIGHT 5  // police height
14#define PICT_MONTHWIDTH  (10./3.)
15
16#define TASK_VSEP  2
[36]17#define TASK_BGC0       "gtcTaskBG0"
18#define TASK_BGC1       "gtcTaskBG1"
[51]19#define TASK_TITLEHEIGHT 6.
20#define TASK_TITLEFONTHEIGHT 2.
[34]21
22#define DELIVRABLE_VSEP   1
23#define DELIVRABLE_HEIGHT 3
[36]24#define DELIVRABLE_LABELWIDTH  10
[34]25#define DELIVRABLE_LABELHEIGHT DELIVRABLE_HEIGHT
[36]26#define DELIVRABLE_TITLEWIDTH  35
[34]27#define DELIVRABLE_TITLEHEIGHT DELIVRABLE_HEIGHT
[36]28#define DELIVRABLE_BOXHEIGHT   (DELIVRABLE_HEIGHT)
[34]29
[51]30char* task_names[] = {
31    "Project management",
32    "Backbone infrastructure",
33    "System generation",
34    "HAS front-end",
35    "HAS back-end",
36    "PC/FPGA communication middleware",
37    "Industrial demonstrators",
38    "Dissemination",
39    0
40};
41
[34]42typedef struct _Tlivrable {
[36]43    int tn,stn,dn,vn;  // task, sub-task, number
44    char v;            // 0, 1, 2, ..., F
[34]45    char* title;
46    int   bm,em;   // mois de bebut et de fin
[36]47    // these fields are filled by the program for data[tn][0][0][0]
[34]48    double task_y;           // top of task
49    double task_dy;          // bot of task is task_y+task_dy
[51]50    double task_y_del;       // delivrables start at task_y+task_y_del
[36]51    // these fields are filled by the program for data[tn][stn][dn][0]
52    struct _Tlivrable
53            **vers; // null termiated (vers[i] = &data[tn][stn][dn][i])
54    int    nbvers;     // nombre de vers
55    double height;     // height of livrable
56    // int del_bm,del_em;    // mois de bebut et de fin cummule
57    // these fields are filled by the program for all elements
58    int   nbTitleLines;
59    char* titleLines[5]; // null termiated
[34]60} Tlivrable;
61
62#define T_MAX 10
63#define S_MAX 10
64#define D_MAX 10
65#define V_MAX 10
[51]66typedef struct _Tdata {
67    FILE*      os;
68    Tlivrable* ls[T_MAX][S_MAX][D_MAX][V_MAX];
69} Tdata;
70Tdata  data_org;
71Tdata* curr;
[36]72
[51]73Tdata* data_new(int *tnplus, int *tnmoins)
74{
75    int i,skip;
76    int tn,stn,dn,v;
77    Tdata* data = malloc(sizeof(*data));
78    memset(data,0,sizeof(*data));
79    for (tn=0 ; tn<T_MAX ; tn++)
80    for (stn=0; stn<S_MAX; stn++)
81    for (dn=0; dn<D_MAX; dn++)
82    for (v=0; v<V_MAX; v++) {
83        if ( data_org.ls[tn][stn][dn][v]==0 ) continue;
84        // tnplus treatment
85        skip = 0;
86        if (tnplus!=0) {
87            skip=1;
88            for (i=0 ; tnplus[i]!=-1 ; i++) {
89                if ( tnplus[i]==data_org.ls[tn][stn][dn][v]->tn ) {
90                    skip=0;
91                    break;
92        }   }   }
93        if (skip) continue;
94        // tnmoins treatment
95        skip = 0;
96        if (tnmoins!=0) {
97            for (i=0 ; tnmoins[i]!=-1 ; i++) {
98//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]);
99                if ( tnmoins[i]==data_org.ls[tn][stn][dn][v]->tn ) {
100                    skip=1;
101                    break;
102        }   }   }
103//fprintf(stderr,"selected: [tn][stn][dn][v]=%d,%d,%d,%d skip=%d\n",tn,stn,dn,v,skip);
104        if (skip) continue;
105        Tlivrable* l=malloc(sizeof(*l));
106        *l = *data_org.ls[tn][stn][dn][v];
107        data->ls[tn][stn][dn][v] = l;
108fprintf(stderr,"selected: [tn][stn][dn][v]=%d,%d,%d,%d\n",tn,stn,dn,v);
109    }
110    return data;
111}
112
[36]113int milestones[100];
114
115char* gen_label_base(char* buf,Tlivrable*p)
116    { sprintf(buf,"D%d%d%d",p->tn,p->stn,p->dn); return buf; }
117char* gen_label_vers(char* buf,Tlivrable*p)
[51]118    { if (p->nbvers<=1) strcpy(buf,""); else sprintf(buf,"V%c",p->v); return buf; }
[36]119char* gen_label_full(char* buf,Tlivrable*p)
120    { char b[100],v[100]; gen_label_base(b,p); gen_label_vers(v,p);
121      sprintf(buf,"%s%s%s",b,*v?"-":"",v); return buf; }
122
123void print_put(double x,double y, const char* object)
[51]124    { fprintf(curr->os,"\\put(%.2f,%.2f){%s}\n",x,y,object); }
[36]125void print_hline(double x,double y, double len, const char* color)
126{
127    char object[1024];
[51]128    if (color!=0) { fprintf(curr->os,"\\bgroup\\color{%s}\n",color); }
[36]129    sprintf(object,"\\line(1,0){%.2f}",len);
130    print_put(x,y,object);
[51]131    if (color!=0) { fprintf(curr->os,"\\egroup\n"); }
[36]132}
133void print_vline(double x,double y, double len, const char* color)
134{
135    char object[1024];
[51]136    if (color!=0) { fprintf(curr->os,"\\bgroup\\color{%s}\n",color); }
[36]137    sprintf(object,"\\line(0,1){%.2f}",len);
138    print_put(x,y,object);
[51]139    if (color!=0) { fprintf(curr->os,"\\egroup\n"); }
[36]140}
141void print_box(
142    int filled, char* vers, // vers may be 0,
143    double x,double y, double dx, double dy,
144    const char* boxcolor,  // may be 0 (default COLOR_BOX_HEAVY)
145    const char* bgcolor,   // may be 0 (not set)
146    const char* textcolor //  may be 0 (black)
147){
148    double tn=.4;
149    char object[1024];
150    if ( boxcolor==0 ) boxcolor = COLOR_BOX_HEAVY;
151    if ( filled==1 ) {
152        sprintf(object,
153            "\\fcolorbox{black}{%s}{\\makebox(%.2f,%.2f){}}",
154                boxcolor,dx-2-tn,dy-2-tn);
155        print_put(x,y+1,object);
156    } else {
157        double tn2=tn/2;
158        double e=.1;
[51]159        fprintf(curr->os,"\\bgroup\\color{%s}\n",boxcolor);
160        fprintf(curr->os,"\\linethickness{%.2fmm}\n",tn);
[36]161        print_hline(x+tn2-e ,y,    dx     ,0);
162        print_hline(x+tn2-e ,y+dy, dx     ,0);
163        print_vline(x+tn-e  ,y+e,  dy-2*e ,0);
164        print_vline(x+dx-2*e,y+e,  dy-2*e ,0);
[51]165        fprintf(curr->os,"\\egroup\n");
[36]166    }
167    if (vers) {
168        sprintf(object,"\\begin{tiny}\\textbf{%s}\\end{tiny}",vers);
169        print_put(x+1,y+.5,object);
170    }
171}
172
173void gen_titleLines(Tlivrable*p)
174{
175    const char* macro="\\ganttlf";
176    char* pc = p->title;
177    char* pc2;
178
179    if (pc==0) return;
180   
181    while ( (pc2=strstr(pc,macro))!=0 ) {
182        char c = *pc2;
183        *pc2 = 0;
184        p->titleLines[p->nbTitleLines]=strdup(pc);
185        p->nbTitleLines+=1;
186        *pc2=c;
187        pc=pc2+strlen(macro);
188    }
189    p->titleLines[p->nbTitleLines]=strdup(pc);
190    p->nbTitleLines+=1;
191}
[34]192%}
193
194%option noyywrap
195
196%%
197 int tn,stn,dn,v,bm,em; char* title;
198#.*\n   ;
199T=[0-9]+ { tn=atoi(yytext+2); }
200T=D[0-9]+ { tn=atoi(yytext+3); }
201S=[0-9]+ { stn=atoi(yytext+2); }
202D=[0-9]+ { dn=atoi(yytext+2); }
203V=V.     { v=yytext[3]; }
[36]204V=       { v='F'; }
205ML=[0-9]+ {
206        int i;
207        for (i=0 ; milestones[i]!=0 ; i++);
208        milestones[i] = atoi(yytext+3);
209    }
[34]210
211BM=[0-9]+ { bm=atoi(yytext+3); }
212EM=[0-9]+ { em=atoi(yytext+3); }
213TITLE=.*\n {
214        char* pc=yytext+6;
[36]215        yytext[yyleng-1]=0;
[34]216        while ( *pc==' ' || *pc=='\t' ) pc+=1;
217        title=strdup(pc);
218        Tlivrable* p= (Tlivrable*) calloc(sizeof(*p),1);
219        p->tn = tn;
220        p->stn = stn;
221        p->dn = dn;
222        p->v  = v;
223        p->title = title;
224        p->bm = bm;
225        p->em = em;
[36]226        gen_titleLines(p);
[34]227
[51]228        for (v=0; data_org.ls[tn][stn][dn][v]!=0 ; v++);
229        data_org.ls[tn][stn][dn][v] = p;
[34]230fprintf(stderr,"ADDED: %d %d %d %d\n",tn,stn,dn,v);
[36]231//{int i,tn=0; fprintf(stderr,"CURR:t=%d:: ",tn); for (i=0; i<S_MAX ; i++) fprintf(stderr,"%d:%p ",i,data[tn][i][0][0]); fprintf(stderr,"\n"); }
[34]232    }
233.|\n ;
234%%
235
[51]236void prepare0(Tdata* data)
[34]237{
[51]238int tn,stn,v;
[34]239int i0,i1,i;
240    for (tn=0 ; tn<T_MAX ; tn++)
241    for (stn=0; stn<S_MAX; stn++) {
[36]242//fprintf(stderr,"AVANT:t=%d:%d:: ",tn,stn); for (i=0; i<D_MAX ; i++)
[51]243//fprintf(stderr,"%d:%p ",i,data->ls[tn][stn][i][0]); fprintf(stderr,"\n");
[34]244        while (1) {
245            for (i0=0 ; i0<D_MAX ; i0++)
[51]246                if (data->ls[tn][stn][i0][0] == 0) break;
[34]247            for (i1=i0+1 ; i1<D_MAX ; i1++)
[51]248                if (data->ls[tn][stn][i1][0] != 0) break;
[34]249            if (i1>=D_MAX) break;
250            // shift
251            for (i=0 ; (i1+i)<D_MAX ; i++)
252                for (v=0;v<V_MAX;v+=1) {
[51]253                    data->ls[tn][stn][i0+i][v] = data->ls[tn][stn][i1+i][v];
254                    data->ls[tn][stn][i1+i][v] = 0;
[34]255                }
256        }
[36]257//fprintf(stderr,"AVANT:t=%d:%d:: ",tn,stn); for (i=0; i<D_MAX ; i++)
[51]258//fprintf(stderr,"%d:%p ",i,data->ls[tn][stn][i][0]); fprintf(stderr,"\n");
[34]259    }
260}
[51]261void prepare1(Tdata* data)
[34]262{
[51]263int tn,dn,v;
[34]264int i0,i1,i;
265    for (tn=0 ; tn<T_MAX ; tn++) {
[51]266//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]267        while (1) {
268            for (i0=0 ; i0<S_MAX ; i0++)
[51]269                if (data->ls[tn][i0][0][0] == 0) break;
[34]270            for (i1=i0+1 ; i1<S_MAX ; i1++)
[51]271                if (data->ls[tn][i1][0][0] != 0) break;
[36]272//fprintf(stderr,"%d %d %d\n",tn,i0,i1);
[34]273            if (i1>=S_MAX) break;
274            // shift
275            for (i=0 ; (i1+i)<S_MAX ; i++)
276                for (dn=0;dn<D_MAX;dn+=1)
277                    for (v=0;v<V_MAX;v+=1) {
[51]278                        data->ls[tn][i0+i][dn][v] = data->ls[tn][i1+i][dn][v];
279                        data->ls[tn][i1+i][dn][v] = 0;
[34]280                    }
281        }
[51]282//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]283    }
284}
[51]285void prepare2(Tdata* data)
[36]286{
[51]287int tn0,tn1,stn,dn,vn;
288int moved=1;
289    while (moved) {
290        moved=0;
291        for (tn0=0 ; tn0<T_MAX ; tn0++)
292            if (data->ls[tn0][0][0][0] == 0) break;
293        for (tn1=tn0+1 ; tn1<T_MAX ; tn1++)
294            if (data->ls[tn1][0][0][0] != 0) break;
295        if (tn1==T_MAX) break;
296        for (stn=0 ; stn<S_MAX ; stn++)
297            for (dn=0;dn<D_MAX;dn+=1)
298                for (vn=0;vn<V_MAX;vn+=1) {
299                    data->ls[tn0][stn][dn][vn] = data->ls[tn1][stn][dn][vn];
300                    data->ls[tn1][stn][dn][vn] = 0;
301                }
302        moved=1;
303    }
304}
305
306void prepare3(Tdata* data)
307{
[36]308int tn,stn,dn,vn;
309    for (tn=0 ; tn<T_MAX ; tn++)
310    for (stn=0; stn<S_MAX; stn++)
311    for (dn=0; dn<D_MAX; dn++) {
[51]312        Tlivrable* p = data->ls[tn][stn][dn][0];
[36]313        if (p==0) continue;
314        p->nbvers=0 ;
315        for (vn=0 ; vn<V_MAX ; vn+=1)
[51]316            if (data->ls[tn][stn][dn][vn]!=0) p->nbvers+=1;
[36]317        p->vers=(Tlivrable**)malloc(sizeof(*p->vers)*(p->nbvers+1));
318        for (vn=0 ; vn<p->nbvers ; vn+=1) {
[51]319            p->vers[vn] = data->ls[tn][stn][dn][vn];
320            data->ls[tn][stn][dn][vn]->nbvers = p->nbvers;
[36]321        }
322        p->vers[vn] = 0;
323        p->height = 1.0*DELIVRABLE_HEIGHT;
324        if (p->nbTitleLines>=1) {
325            double h=0;
326            h += p->vers[p->nbvers-1]->nbTitleLines*DELIVRABLE_TITLEHEIGHT;
327            h += (p->vers[p->nbvers-1]->nbTitleLines-1)*(DELIVRABLE_TITLEHEIGHT/5.);
328            if ( h>p->height) p->height=h;
329        }
330    }
331}
[34]332
[51]333double task_livrable_height(int tn, double* delivrable_y)
[34]334{
[36]335int    stn,dn,nblivrables=0;
336double height=0;
[51]337    height += TASK_TITLEHEIGHT ;
338    *delivrable_y = height;
339    for (stn=0 ; curr->ls[tn][stn][0][0]!=0 ; stn++)
340        for (dn=0 ; curr->ls[tn][stn][dn][0]!=0 ; dn++) {
[36]341            nblivrables += 1;
[51]342            height+=curr->ls[tn][stn][dn][0]->height;
[36]343        }
344        height += DELIVRABLE_VSEP/2;
345        height += (nblivrables-1)*DELIVRABLE_VSEP;
346        height += DELIVRABLE_VSEP/2;
347    return height;
[34]348}
349
350void  task_box(double pictwidth)
351{
352    int tn;
[51]353    for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ ) {
[34]354        const char* color= (tn%2)!=0 ? TASK_BGC1 : TASK_BGC0 ;
[51]355        fprintf(curr->os,
[36]356            "\\put(%.2f,%.2f){\\fcolorbox{black}{%s}{\\makebox(%5.2f,%5.2f){}}}\n",
[51]357            0.0,curr->ls[tn][0][0][0]->task_y,
[34]358            color,
[51]359            pictwidth,curr->ls[tn][0][0][0]->task_dy
[34]360        );
361    }
362}
363
364void  month_grid(double x, double y, double dx, double dy)
365{
366    int i;
367    for (i=0 ;  i<=36 ; i+=1,x+=PICT_MONTHWIDTH) {
368        if ( (i%3)!=0 ) continue;
[51]369        fprintf(curr->os,
[34]370            "\\put(%5.1f,%5.1f){\\line(0,1){%5.1f}}\\put(%5.1f,%5.1f){%d}\n",
371            x,y,dy-PICT_MONTHWIDTH-PICT_VSEP,
372            x-2,y+dy-PICT_MONTHHEIGHT,
373            i
374        );
375    }
376}
377
[36]378void  print_milestones(double x, double y, double dx, double dy)
379{
380    int i;
381    double tn=.3;
382    //x=x-tn/2;
[51]383    fprintf(curr->os,"\\bgroup\n");
384    fprintf(curr->os,"\\color{red}\n");
385    fprintf(curr->os,"\\linethickness{%.2fmm}\n",tn);
[36]386    for (i=0 ;  milestones[i]!=0 ; i+=1) {
387        double xx= x + milestones[i]*PICT_MONTHWIDTH;
388        print_vline(xx,y,dy-PICT_MONTHWIDTH-PICT_VSEP,0);
389    }
[51]390    fprintf(curr->os,"\\egroup\n");
[36]391}
392
[34]393double delivrable(
394    double label_x, double box_x, double title_x,
395    double y,
396    int tn, int stn, int dn)
397{
[51]398    Tlivrable* top=curr->ls[tn][stn][dn][0];
399    Tlivrable* last=curr->ls[tn][stn][dn][top->nbvers-1];
[36]400    char tmp[1000],label[1000],title[1000];
[34]401    double y0;
402    int v;
403    double label_dx = DELIVRABLE_LABELWIDTH ;
404    double label_dy = DELIVRABLE_LABELHEIGHT ;
405    double boxx,box_dx;
406    double box_dy = DELIVRABLE_BOXHEIGHT ;
407    double title_dx = DELIVRABLE_LABELWIDTH ;
408    double title_dy = DELIVRABLE_TITLEHEIGHT ;
[36]409   
410//print_hline(0,y,180,0);
411    gen_label_base(label,top);
412    // y -= DELIVRABLE_HEIGHT;
413    y -= top->height ;
414//print_hline(0,y,180,0);
[51]415    fprintf(curr->os,"%% Delivrable %s (tn=%d stn=%d dn=%d\n",label,tn,stn,dn);
[36]416
417    // print label
418    //y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_LABELHEIGHT)/2;
419    y0 = (top->height-DELIVRABLE_LABELHEIGHT)/2;
420    sprintf(tmp,"\\ganttlabelstyle{%s}",label);
421    print_put(label_x,y+y0,tmp);
422    // print title
423    if (last->nbTitleLines==1) {
424        y0  = (DELIVRABLE_HEIGHT-DELIVRABLE_TITLEHEIGHT)/2;
425        y0 += DELIVRABLE_TITLEHEIGHT/5. ;
426        sprintf(tmp,"\\gantttitlestyle{%s}",last->title);
427        print_put(title_x,y+y0,tmp);
428    } else if (last->nbTitleLines>1) {
429        int i;
430        // y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_TITLEHEIGHT)/2;
431        y0=DELIVRABLE_TITLEHEIGHT/5.;
432        sprintf(tmp,"\\gantttitlestyle{\\shortstack[l]{%s",last->titleLines[0]);
433        for (i=1 ; i<last->nbTitleLines ; i+=1) {
434            strcat(tmp,"\\\\");
435            strcat(tmp,last->titleLines[i]);
436        }
437        strcat(tmp,"}}");
438        print_put(title_x,y+y0,tmp);
439    }
440       
441    // print box
442    //y0 = (DELIVRABLE_HEIGHT-DELIVRABLE_BOXHEIGHT)/2;
443    y0 = (top->height-DELIVRABLE_BOXHEIGHT)/2;
444    if ( last==top ) {
445        Tlivrable* l=top;
446        boxx = box_x + l->bm*PICT_MONTHWIDTH ;
447        box_dx  = (l->em - l->bm) * PICT_MONTHWIDTH;
448        print_box(1,0,boxx,y+y0,box_dx,box_dy,COLOR_BOX_LIGHT,0,0);
449        print_box(0,0,boxx,y+y0,box_dx,box_dy,0,0,0);
450    } else for (v=0 ; v<top->nbvers ; v+=1) {
[51]451        Tlivrable* l=curr->ls[tn][stn][dn][v] ;
[36]452        gen_label_vers(tmp,l);
[34]453        boxx = box_x + l->bm*PICT_MONTHWIDTH ;
454        box_dx  = (l->em - l->bm) * PICT_MONTHWIDTH;
[36]455        print_box(1,0,boxx,y+y0,box_dx,box_dy,COLOR_BOX_LIGHT,0,0);
456        print_box(0,tmp,boxx,y+y0,box_dx,box_dy,0,0,0);
[34]457    }
[36]458    y -= DELIVRABLE_VSEP;
[34]459    return y;
460}
461
462void task_delivrable(double label_x, double box_x, double title_x, int tn)
463{
464int stn,dn;
[51]465Tlivrable* task=curr->ls[tn][0][0][0];
466double y = task->task_y+task->task_dy-task->task_y_del;
467    char tmp[1000];
468    sprintf(tmp,"\\textbf{Task-%d \\textit{%s}}",task->tn,task_names[task->tn]);
469    print_put(label_x/2,y+(TASK_TITLEHEIGHT-TASK_TITLEFONTHEIGHT)/2,tmp);
470
[36]471    //y += DELIVRABLE_VSEP/2. ;
[51]472    for (stn=0 ; curr->ls[tn][stn][0][0]!=0 ; stn++)
473        for (dn=0 ; curr->ls[tn][stn][dn][0]!=0 ; dn++) {
[34]474            y=delivrable(label_x,box_x,title_x,y,tn,stn,dn);
[36]475        }
[34]476}
477
[51]478void do_gantt(const char* fn, int* tnplus, int* tnmoins)
[34]479{
480    int tn;
481    double pictwidth, pictheight;
482    double gantt_x,gantt_y;
483    double gantt_dx,gantt_dy;
484
485    double label_x,title_x;
[51]486    curr = data_new(tnplus,tnmoins);
487    if ( (curr->os=fopen(fn,"w"))==0 ) {
488        fprintf(stderr,"can not open %s file for writing.\n",fn);
489        fprintf(stderr,"generation of %s graph is skipped.\n",fn);
490        return;
491    }
492    prepare0(curr);
493    prepare1(curr);
494    prepare2(curr);
495    prepare3(curr);
[34]496
497    pictheight=0 ;
498    pictheight += PICT_BOTSEP ;
[51]499    for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ );
[34]500    for ( tn=tn-1 ; tn>=0 ; tn-- ) {
[51]501        double offset;
502        curr->ls[tn][0][0][0]->task_y     = pictheight;
503        curr->ls[tn][0][0][0]->task_dy    = task_livrable_height(tn,&offset);
504        curr->ls[tn][0][0][0]->task_y_del = offset;
505        pictheight += curr->ls[tn][0][0][0]->task_dy;
[34]506        pictheight += TASK_VSEP;
507    }
508    pictheight += PICT_MONTHHEIGHT;
509    pictheight += PICT_TOPSEP ;
510    gantt_y  = PICT_BOTSEP ;
511    gantt_dy = pictheight-PICT_TOPSEP-PICT_BOTSEP ;
512
513    pictwidth=0;
514    pictwidth += PICT_LEFTSEP;
515    label_x    = pictwidth;
516    pictwidth += DELIVRABLE_LABELWIDTH;
517    pictwidth += PICT_HSEP;
518    gantt_x    = pictwidth ;
519    gantt_dx   = 36*PICT_MONTHWIDTH ;
520    pictwidth += gantt_dx ;
521    pictwidth += PICT_HSEP;
522    title_x    = pictwidth;
523    pictwidth += DELIVRABLE_TITLEWIDTH;
524    pictwidth += PICT_RIGHTSEP;
525   
[51]526    fprintf(curr->os,"\\setlength{\\unitlength}{1.0mm}\n");
527    fprintf(curr->os,"\\begin{picture}(%.1f,%.1f)\n",pictwidth,pictheight);
528    //print_hline(0,0,pictwidth,0);
529    //print_hline(0,pictheight,pictwidth,0);
530    task_box(pictwidth);
531    month_grid(gantt_x,gantt_y,gantt_dx,gantt_dy);
532    for ( tn=0 ; curr->ls[tn][0][0][0]!=0 ; tn++ ) {
[34]533        task_delivrable(label_x,gantt_x,title_x,tn);
[51]534    }
[36]535
536    print_milestones(gantt_x,0,gantt_dx,gantt_dy+gantt_y);
[51]537    fprintf(curr->os,"\\end{picture}\n");
538}
[34]539
[51]540int main()
541{
542    int tnplus[10] = { 0, 6, 7, -1 };
543    int tnmoins[10] = { 0, 6, 7, -1 };
544
545    yylex();
546    do_gantt("gantt.tex",0,0);
547    do_gantt("gantt1.tex",tnplus,0);
548    do_gantt("gantt2.tex",0,tnmoins);
549
[34]550    return 0;
551}
Note: See TracBrowser for help on using the repository browser.