Rev 8177 | Rev 8414 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8177 | Rev 8195 | ||
---|---|---|---|
Line 77... | Line 77... | ||
77 | char tbuf[1024],sbuf[4096]; |
77 | char tbuf[1024],sbuf[4096]; |
78 | fclose(f); f=NULL; |
78 | fclose(f); f=NULL; |
79 | p1=getenv("TMPDIR"); if(p1==NULL || *p1==0) p1="."; |
79 | p1=getenv("TMPDIR"); if(p1==NULL || *p1==0) p1="."; |
80 | snprintf(tbuf,sizeof(tbuf),"%s/drawfile_.gif",p1); |
80 | snprintf(tbuf,sizeof(tbuf),"%s/drawfile_.gif",p1); |
81 | snprintf(sbuf,sizeof(sbuf),"convert %s %s",namebuf,tbuf); |
81 | snprintf(sbuf,sizeof(sbuf),"convert %s %s",namebuf,tbuf); |
82 | if (system(sbuf)) |
82 | if (system(sbuf)) fly_error("system_failed"); |
83 | f=fopen(tbuf,"r"); |
83 | f=fopen(tbuf,"r"); |
84 | } |
84 | } |
85 | return f; |
85 | return f; |
86 | } |
86 | } |
87 | 87 | ||
Line 94... | Line 94... | ||
94 | /* define image size */ |
94 | /* define image size */ |
95 | void obj_size(objparm *pm) |
95 | void obj_size(objparm *pm) |
96 | { |
96 | { |
97 | sizex=rint(pm->pd[0]); sizey=rint(pm->pd[1]); |
97 | sizex=rint(pm->pd[0]); sizey=rint(pm->pd[1]); |
98 | if(sizex<0 || sizey<0 || sizex>MAX_SIZE || sizey>MAX_SIZE) { |
98 | if(sizex<0 || sizey<0 || sizex>MAX_SIZE || sizey>MAX_SIZE) { |
99 |
|
99 | fly_error("bad_size"); return; |
100 | } |
100 | } |
101 | if(image!=NULL) { |
101 | if(image!=NULL) { |
102 |
|
102 | fly_error("size_already_defined"); return; |
103 | } |
103 | } |
104 | image=gdImageCreate(sizex,sizey); |
104 | image=gdImageCreate(sizex,sizey); |
105 | if(image==NULL) |
105 | if(image==NULL) fly_error("image_creation_failure"); |
106 | else { |
106 | else { |
107 | color_white=gdImageColorAllocate(image,255,255,255); |
107 | color_white=gdImageColorAllocate(image,255,255,255); |
108 | color_black=gdImageColorAllocate(image,0,0,0); |
108 | color_black=gdImageColorAllocate(image,0,0,0); |
109 | color_bounder=gdImageColorAllocate(image,1,2,3); |
109 | color_bounder=gdImageColorAllocate(image,1,2,3); |
110 | color_frame=gdImageColorAllocate(image,254,254,254); |
110 | color_frame=gdImageColorAllocate(image,254,254,254); |
Line 132... | Line 132... | ||
132 | gdImageDestroy(image);image=NULL; |
132 | gdImageDestroy(image);image=NULL; |
133 | } |
133 | } |
134 | pp=find_word_start(pm->str);*find_word_end(pp)=0; |
134 | pp=find_word_start(pm->str);*find_word_end(pp)=0; |
135 | inf=open4read(pp); |
135 | inf=open4read(pp); |
136 | if(inf==NULL) { |
136 | if(inf==NULL) { |
137 |
|
137 | fly_error("file_not_exist"); return; |
138 | } |
138 | } |
139 | image=gdImageCreateFromGif(inf); fclose(inf); |
139 | image=gdImageCreateFromGif(inf); fclose(inf); |
140 | if(image==NULL) { |
140 | if(image==NULL) { |
141 |
|
141 | fly_error("bad_gif"); return; |
142 | } |
142 | } |
143 | sizex=image->sx; sizey=image->sy; |
143 | sizex=image->sx; sizey=image->sy; |
144 | saved=0; |
144 | saved=0; |
145 | } |
145 | } |
146 | 146 | ||
Line 442... | Line 442... | ||
442 | void obj_hatchfill(objparm *pm) |
442 | void obj_hatchfill(objparm *pm) |
443 | { |
443 | { |
444 | int nx,ny,ax,ay, dir, c; |
444 | int nx,ny,ax,ay, dir, c; |
445 | scale(pm->pd,pm->p,1); |
445 | scale(pm->pd,pm->p,1); |
446 | nx=pm->pd[2]; ny=pm->pd[3]; ax=abs(nx); ay=abs(ny); |
446 | nx=pm->pd[2]; ny=pm->pd[3]; ax=abs(nx); ay=abs(ny); |
447 | if(nx==0 && ny==0) { |
447 | if(nx==0 && ny==0) {fly_error("bad displacement vector"); return;} |
448 | if((nx>0 && ny>0) || (nx<0 && ny<0)) dir=1; else dir=-1; |
448 | if((nx>0 && ny>0) || (nx<0 && ny<0)) dir=1; else dir=-1; |
449 | if(ax==0) {ax=100; dir=2;} |
449 | if(ax==0) {ax=100; dir=2;} |
450 | if(ay==0) {ay=100; dir=3;} |
450 | if(ay==0) {ay=100; dir=3;} |
451 | c=makehatchimage(ax,ay,pm->p[0],pm->p[1],pm->color[0]); |
451 | c=makehatchimage(ax,ay,pm->p[0],pm->p[1],pm->color[0]); |
452 | switch(dir) { |
452 | switch(dir) { |
Line 483... | Line 483... | ||
483 | void obj_gridfill(objparm *pm) |
483 | void obj_gridfill(objparm *pm) |
484 | { |
484 | { |
485 | int nx,ny, c; |
485 | int nx,ny, c; |
486 | scale(pm->pd,pm->p,1); |
486 | scale(pm->pd,pm->p,1); |
487 | nx=pm->pd[2]; ny=pm->pd[3]; nx=abs(nx); ny=abs(ny); |
487 | nx=pm->pd[2]; ny=pm->pd[3]; nx=abs(nx); ny=abs(ny); |
488 | if(nx==0 && ny==0) { |
488 | if(nx==0 && ny==0) {fly_error("bad grid size"); return;} |
489 | c=makehatchimage(nx,ny,pm->p[0],pm->p[1],pm->color[0]); |
489 | c=makehatchimage(nx,ny,pm->p[0],pm->p[1],pm->color[0]); |
490 | gdImageLine(himg,0,ny/2,nx-1,ny/2,c); gdImageLine(himg,nx/2,0,nx/2,ny-1,c); |
490 | gdImageLine(himg,0,ny/2,nx-1,ny/2,c); gdImageLine(himg,nx/2,0,nx/2,ny-1,c); |
491 | gdImageSetTile(image,himg); |
491 | gdImageSetTile(image,himg); |
492 | patchgdImageFill(image,pm->p[0],pm->p[1],gdTiled); |
492 | patchgdImageFill(image,pm->p[0],pm->p[1],gdTiled); |
493 | gdImageDestroy(himg); |
493 | gdImageDestroy(himg); |
Line 498... | Line 498... | ||
498 | void obj_diafill(objparm *pm) |
498 | void obj_diafill(objparm *pm) |
499 | { |
499 | { |
500 | int nx,ny, c; |
500 | int nx,ny, c; |
501 | scale(pm->pd,pm->p,1); |
501 | scale(pm->pd,pm->p,1); |
502 | nx=pm->pd[2]; ny=pm->pd[3]; nx=abs(nx); ny=abs(ny); |
502 | nx=pm->pd[2]; ny=pm->pd[3]; nx=abs(nx); ny=abs(ny); |
503 | if(nx==0 && ny==0) { |
503 | if(nx==0 && ny==0) {fly_error("bad grid size"); return;} |
504 | c=makehatchimage(nx,ny,pm->p[0],pm->p[1],pm->color[0]); |
504 | c=makehatchimage(nx,ny,pm->p[0],pm->p[1],pm->color[0]); |
505 | gdImageLine(himg,0,0,nx-1,ny-1,c); gdImageLine(himg,0,ny-1,nx-1,0,c); |
505 | gdImageLine(himg,0,0,nx-1,ny-1,c); gdImageLine(himg,0,ny-1,nx-1,0,c); |
506 | gdImageSetTile(image,himg); |
506 | gdImageSetTile(image,himg); |
507 | patchgdImageFill(image,pm->p[0],pm->p[1],gdTiled); |
507 | patchgdImageFill(image,pm->p[0],pm->p[1],gdTiled); |
508 | gdImageDestroy(himg); |
508 | gdImageDestroy(himg); |
Line 513... | Line 513... | ||
513 | void obj_dotfill(objparm *pm) |
513 | void obj_dotfill(objparm *pm) |
514 | { |
514 | { |
515 | int nx,ny, c; |
515 | int nx,ny, c; |
516 | scale(pm->pd,pm->p,1); |
516 | scale(pm->pd,pm->p,1); |
517 | nx=pm->pd[2]; ny=pm->pd[3]; nx=abs(nx); ny=abs(ny); |
517 | nx=pm->pd[2]; ny=pm->pd[3]; nx=abs(nx); ny=abs(ny); |
518 | if(nx==0 && ny==0) { |
518 | if(nx==0 && ny==0) {fly_error("bad grid size"); return;} |
519 | c=makehatchimage(nx,ny,pm->p[0],pm->p[1],pm->color[0]); |
519 | c=makehatchimage(nx,ny,pm->p[0],pm->p[1],pm->color[0]); |
520 | gdImageSetPixel(himg,nx/2,ny/2,c); |
520 | gdImageSetPixel(himg,nx/2,ny/2,c); |
521 | gdImageSetTile(image,himg); |
521 | gdImageSetTile(image,himg); |
522 | patchgdImageFill(image,pm->p[0],pm->p[1],gdTiled); |
522 | patchgdImageFill(image,pm->p[0],pm->p[1],gdTiled); |
523 | gdImageDestroy(himg); |
523 | gdImageDestroy(himg); |
Line 542... | Line 542... | ||
542 | void obj_string(objparm *pm) |
542 | void obj_string(objparm *pm) |
543 | { |
543 | { |
544 | char *pp, *pe, *p2; |
544 | char *pp, *pe, *p2; |
545 | int i; |
545 | int i; |
546 | pp=pm->str; pe=strchr(pp,','); if(pe==NULL) { |
546 | pp=pm->str; pe=strchr(pp,','); if(pe==NULL) { |
547 |
|
547 | fly_error("too_few_parms"); return; |
548 | } |
548 | } |
549 | *pe++=0; pp=find_word_start(pp); *find_word_end(pp)=0; |
549 | *pe++=0; pp=find_word_start(pp); *find_word_end(pp)=0; |
550 | pe=find_word_start(pe); strip_trailing_spaces(pe); |
550 | pe=find_word_start(pe); strip_trailing_spaces(pe); |
551 | if(*pp) { |
551 | if(*pp) { |
552 | for(i=0;i<fonttab_no && strcmp(pp,fonttab[i].name)!=0; i++); |
552 | for(i=0;i<fonttab_no && strcmp(pp,fonttab[i].name)!=0; i++); |
Line 581... | Line 581... | ||
581 | gdImagePtr insimg; |
581 | gdImagePtr insimg; |
582 | 582 | ||
583 | pp=find_word_start(pm->str);*find_word_end(pp)=0; |
583 | pp=find_word_start(pm->str);*find_word_end(pp)=0; |
584 | inf=open4read(pp); |
584 | inf=open4read(pp); |
585 | if(inf==NULL) { |
585 | if(inf==NULL) { |
586 |
|
586 | fly_error("file_not_exist"); return; |
587 | } |
587 | } |
588 | insimg=gdImageCreateFromGif(inf); fclose(inf); |
588 | insimg=gdImageCreateFromGif(inf); fclose(inf); |
589 | if(insimg==NULL) { |
589 | if(insimg==NULL) { |
590 |
|
590 | fly_error("bad_gif"); return; |
591 | } |
591 | } |
592 | scale(pm->pd,pm->p,1); |
592 | scale(pm->pd,pm->p,1); |
593 | if(pm->pd[2]<0 && pm->pd[3]<0 && pm->pd[4]<0 && pm->pd[5]<0) |
593 | if(pm->pd[2]<0 && pm->pd[3]<0 && pm->pd[4]<0 && pm->pd[5]<0) |
594 | gdImageCopy(image,insimg,pm->p[0],pm->p[1],0,0, |
594 | gdImageCopy(image,insimg,pm->p[0],pm->p[1],0,0, |
595 | insimg->sx,insimg->sy); |
595 | insimg->sx,insimg->sy); |
Line 607... | Line 607... | ||
607 | gdImagePtr insimg; |
607 | gdImagePtr insimg; |
608 | 608 | ||
609 | pp=find_word_start(pm->str);*find_word_end(pp)=0; |
609 | pp=find_word_start(pm->str);*find_word_end(pp)=0; |
610 | inf=open4read(pp); |
610 | inf=open4read(pp); |
611 | if(inf==NULL) { |
611 | if(inf==NULL) { |
612 |
|
612 | fly_error("file_not_found"); return; |
613 | } |
613 | } |
614 | insimg=gdImageCreateFromGif(inf); fclose(inf); |
614 | insimg=gdImageCreateFromGif(inf); fclose(inf); |
615 | if(insimg==NULL) { |
615 | if(insimg==NULL) { |
616 |
|
616 | fly_error("bad_gif"); return; |
617 | } |
617 | } |
618 | scale(pm->pd+4,pm->p+4,2); |
618 | scale(pm->pd+4,pm->p+4,2); |
619 | if(pm->pd[0]<0 && pm->pd[1]<0 && pm->pd[2]<0 && pm->pd[3]<0) |
619 | if(pm->pd[0]<0 && pm->pd[1]<0 && pm->pd[2]<0 && pm->pd[3]<0) |
620 | gdImageCopyResized(image,insimg,pm->p[4],pm->p[5],0,0, |
620 | gdImageCopyResized(image,insimg,pm->p[4],pm->p[5],0,0, |
621 | pm->p[6]-pm->p[4]+1,pm->p[7]-pm->p[5]+1, |
621 | pm->p[6]-pm->p[4]+1,pm->p[7]-pm->p[5]+1, |
Line 634... | Line 634... | ||
634 | FILE *inf; |
634 | FILE *inf; |
635 | gdImagePtr insimg; |
635 | gdImagePtr insimg; |
636 | 636 | ||
637 | pp=find_word_start(pm->str); *find_word_end(pp)=0; |
637 | pp=find_word_start(pm->str); *find_word_end(pp)=0; |
638 | inf=open4read(pp); if(inf==NULL) { |
638 | inf=open4read(pp); if(inf==NULL) { |
639 |
|
639 | fly_error("file_not_found"); return; |
640 | } |
640 | } |
641 | insimg=gdImageCreateFromGif(inf); fclose(inf); |
641 | insimg=gdImageCreateFromGif(inf); fclose(inf); |
642 | if(insimg==NULL) { |
642 | if(insimg==NULL) { |
643 |
|
643 | fly_error("bad_gif"); return; |
644 | } |
644 | } |
645 | if(pm->fill) { |
645 | if(pm->fill) { |
646 | gdImageSetTile(image,insimg); tiled=1; tileimg=insimg; |
646 | gdImageSetTile(image,insimg); tiled=1; tileimg=insimg; |
647 | } |
647 | } |
648 | else { |
648 | else { |
Line 667... | Line 667... | ||
667 | /* set style */ |
667 | /* set style */ |
668 | void obj_setstyle(objparm *pm) |
668 | void obj_setstyle(objparm *pm) |
669 | { |
669 | { |
670 | int i,t; |
670 | int i,t; |
671 | t=pm->pcnt/3; if(t<=0) { |
671 | t=pm->pcnt/3; if(t<=0) { |
672 |
|
672 | fly_error("too_few_parms"); return; |
673 | } |
673 | } |
674 | for(i=0;i<t;i++) { |
674 | for(i=0;i<t;i++) { |
675 | if(pm->pd[3*i]<0 || pm->pd[3*i+1]<0 || pm->pd[3*i+2]<0) |
675 | if(pm->pd[3*i]<0 || pm->pd[3*i+1]<0 || pm->pd[3*i+2]<0) |
676 | pm->p[i]=gdTransparent; |
676 | pm->p[i]=gdTransparent; |
677 | else |
677 | else |
Line 699... | Line 699... | ||
699 | } |
699 | } |
700 | 700 | ||
701 | /* set linewidth */ |
701 | /* set linewidth */ |
702 | void obj_linewidth(objparm *pm) |
702 | void obj_linewidth(objparm *pm) |
703 | { |
703 | { |
704 | if(pm->pd[0]<1 || pm->pd[0]>255) |
704 | if(pm->pd[0]<1 || pm->pd[0]>255) fly_error("bad_parms"); |
705 | else width=pm->pd[0]; |
705 | else width=pm->pd[0]; |
706 | } |
706 | } |
707 | 707 | ||
708 | /* set x range */ |
708 | /* set x range */ |
709 | void obj_xrange(objparm *pm) |
709 | void obj_xrange(objparm *pm) |
Line 743... | Line 743... | ||
743 | void obj_tstep(objparm *pm) |
743 | void obj_tstep(objparm *pm) |
744 | { |
744 | { |
745 | int dd; |
745 | int dd; |
746 | dd=pm->pd[0]; |
746 | dd=pm->pd[0]; |
747 | if(dd<3) { |
747 | if(dd<3) { |
748 |
|
748 | fly_error("bad_step"); return; |
749 | } |
749 | } |
750 | if(dd>2000) dd=2000; |
750 | if(dd>2000) dd=2000; |
751 | tstep=dd; |
751 | tstep=dd; |
752 | } |
752 | } |
753 | 753 | ||
Line 769... | Line 769... | ||
769 | double dc[2],t,v; |
769 | double dc[2],t,v; |
770 | int ic[2],oc[2]; |
770 | int ic[2],oc[2]; |
771 | 771 | ||
772 | n=itemnum(pm->str); |
772 | n=itemnum(pm->str); |
773 | if(n<1) { |
773 | if(n<1) { |
774 |
|
774 | fly_error("bad_parms"); return; |
775 | } |
775 | } |
776 | fnd_item(pm->str,1,p1); fnd_item(pm->str,2,p2); |
776 | fnd_item(pm->str,1,p1); fnd_item(pm->str,2,p2); |
777 | if(n==1 && !tranged) v=sizex/xscale/tstep; |
777 | if(n==1 && !tranged) v=sizex/xscale/tstep; |
778 | else v=(tend-tstart)/tstep; |
778 | else v=(tend-tstart)/tstep; |
779 | if(n==1) varn="x"; else varn="t"; |
779 | if(n==1) varn="x"; else varn="t"; |
Line 882... | Line 882... | ||
882 | } |
882 | } |
883 | 883 | ||
884 | /* marks end of execution */ |
884 | /* marks end of execution */ |
885 | void obj_end(objparm *pm) |
885 | void obj_end(objparm *pm) |
886 | { |
886 | { |
887 |
|
887 | fly_error("successful_end_of_execution"); |
888 | } |
888 | } |
889 | 889 | ||
890 | /* output */ |
890 | /* output */ |
891 | void obj_output(objparm *pm) |
891 | void obj_output(objparm *pm) |
892 | { |
892 | { |
Line 976... | Line 976... | ||
976 | /* arguments: un numero de matrice entre 1 et JC_NB_MATRICES, une liste de 4 nombres reels pour la matrice */ |
976 | /* arguments: un numero de matrice entre 1 et JC_NB_MATRICES, une liste de 4 nombres reels pour la matrice */ |
977 | void obj_setmatrix(objparm *pm) |
977 | void obj_setmatrix(objparm *pm) |
978 | { |
978 | { |
979 | int nummatrix = (int) (pm->pd[0]); |
979 | int nummatrix = (int) (pm->pd[0]); |
980 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
980 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
981 |
|
981 | fly_error("bad_matrix_number"); |
982 | return; |
982 | return; |
983 | } |
983 | } |
984 | matrices_pavage[nummatrix][0] = pm->pd[1]; |
984 | matrices_pavage[nummatrix][0] = pm->pd[1]; |
985 | matrices_pavage[nummatrix][1] = pm->pd[2]; |
985 | matrices_pavage[nummatrix][1] = pm->pd[2]; |
986 | matrices_pavage[nummatrix][2] = pm->pd[3]; |
986 | matrices_pavage[nummatrix][2] = pm->pd[3]; |
Line 990... | Line 990... | ||
990 | /* arguments: un numero de matrice entre 1 et JC_NB_MATRICES */ |
990 | /* arguments: un numero de matrice entre 1 et JC_NB_MATRICES */ |
991 | void obj_resetmatrix(objparm *pm) |
991 | void obj_resetmatrix(objparm *pm) |
992 | { |
992 | { |
993 | int nummatrix = (int) (pm->pd[0]); |
993 | int nummatrix = (int) (pm->pd[0]); |
994 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
994 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
995 |
|
995 | fly_error("bad_matrix_number"); |
996 | return; |
996 | return; |
997 | } |
997 | } |
998 | matrices_pavage[nummatrix][0] = 1; |
998 | matrices_pavage[nummatrix][0] = 1; |
999 | matrices_pavage[nummatrix][1] = 0; |
999 | matrices_pavage[nummatrix][1] = 0; |
1000 | matrices_pavage[nummatrix][2] = 0; |
1000 | matrices_pavage[nummatrix][2] = 0; |
Line 1004... | Line 1004... | ||
1004 | /* arguments: un numero de vecteur entre 1 et JC_NB_MATRICES, une liste de 2 nombres reels pour le vecteur */ |
1004 | /* arguments: un numero de vecteur entre 1 et JC_NB_MATRICES, une liste de 2 nombres reels pour le vecteur */ |
1005 | void obj_setvector(objparm *pm) |
1005 | void obj_setvector(objparm *pm) |
1006 | { |
1006 | { |
1007 | int nummatrix = (int) (pm->pd[0]); |
1007 | int nummatrix = (int) (pm->pd[0]); |
1008 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
1008 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
1009 |
|
1009 | fly_error("bad_vector_number"); |
1010 | return; |
1010 | return; |
1011 | } |
1011 | } |
1012 | vecteurs_pavage[nummatrix][0] = pm->pd[1]; |
1012 | vecteurs_pavage[nummatrix][0] = pm->pd[1]; |
1013 | vecteurs_pavage[nummatrix][1] = pm->pd[2]; |
1013 | vecteurs_pavage[nummatrix][1] = pm->pd[2]; |
1014 | } |
1014 | } |
Line 1016... | Line 1016... | ||
1016 | /* arguments: un numero de matrice entre 1 et JC_NB_MATRICES */ |
1016 | /* arguments: un numero de matrice entre 1 et JC_NB_MATRICES */ |
1017 | void obj_resetvector(objparm *pm) |
1017 | void obj_resetvector(objparm *pm) |
1018 | { |
1018 | { |
1019 | int nummatrix = (int) (pm->pd[0]); |
1019 | int nummatrix = (int) (pm->pd[0]); |
1020 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
1020 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
1021 |
|
1021 | fly_error("bad_vector_number"); |
1022 | return; |
1022 | return; |
1023 | } |
1023 | } |
1024 | vecteurs_pavage[nummatrix][0] = 0; |
1024 | vecteurs_pavage[nummatrix][0] = 0; |
1025 | vecteurs_pavage[nummatrix][1] = 0; |
1025 | vecteurs_pavage[nummatrix][1] = 0; |
1026 | } |
1026 | } |
Line 1028... | Line 1028... | ||
1028 | /* arguments: un numero de vecteur entre 1 et JC_NB_MATRICES, une liste de 6 nombres reels pour la matrice et le vecteur */ |
1028 | /* arguments: un numero de vecteur entre 1 et JC_NB_MATRICES, une liste de 6 nombres reels pour la matrice et le vecteur */ |
1029 | void obj_settransform(objparm *pm) |
1029 | void obj_settransform(objparm *pm) |
1030 | { |
1030 | { |
1031 | int nummatrix = (int) (pm->pd[0]); |
1031 | int nummatrix = (int) (pm->pd[0]); |
1032 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
1032 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
1033 |
|
1033 | fly_error("bad_vector_number"); |
1034 | return; |
1034 | return; |
1035 | } |
1035 | } |
1036 | matrices_pavage[nummatrix][0] = pm->pd[1]; |
1036 | matrices_pavage[nummatrix][0] = pm->pd[1]; |
1037 | matrices_pavage[nummatrix][1] = pm->pd[2]; |
1037 | matrices_pavage[nummatrix][1] = pm->pd[2]; |
1038 | matrices_pavage[nummatrix][2] = pm->pd[3]; |
1038 | matrices_pavage[nummatrix][2] = pm->pd[3]; |
Line 1045... | Line 1045... | ||
1045 | /* arguments: un numero de matrice entre 1 et JC_NB_MATRICES */ |
1045 | /* arguments: un numero de matrice entre 1 et JC_NB_MATRICES */ |
1046 | void obj_resettransform(objparm *pm) |
1046 | void obj_resettransform(objparm *pm) |
1047 | { |
1047 | { |
1048 | int nummatrix = (int) (pm->pd[0]); |
1048 | int nummatrix = (int) (pm->pd[0]); |
1049 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
1049 | if((nummatrix < 1) ||(nummatrix>JC_NB_MATRICES)) { |
1050 |
|
1050 | fly_error("bad_vector_number"); |
1051 | return; |
1051 | return; |
1052 | } |
1052 | } |
1053 | vecteurs_pavage[nummatrix][0] = 0; |
1053 | vecteurs_pavage[nummatrix][0] = 0; |
1054 | vecteurs_pavage[nummatrix][1] = 0; |
1054 | vecteurs_pavage[nummatrix][1] = 0; |
1055 | matrices_pavage[nummatrix][0] = 1; |
1055 | matrices_pavage[nummatrix][0] = 1; |
Line 1115... | Line 1115... | ||
1115 | // printf("pp contient %s\n",pp); |
1115 | // printf("pp contient %s\n",pp); |
1116 | 1116 | ||
1117 | 1117 | ||
1118 | inf=open4read(pp); |
1118 | inf=open4read(pp); |
1119 | if(inf==NULL) { |
1119 | if(inf==NULL) { |
1120 |
|
1120 | fly_error("file_not_exist"); return; |
1121 | } |
1121 | } |
1122 | insimg=gdImageCreateFromGif(inf); fclose(inf); |
1122 | insimg=gdImageCreateFromGif(inf); fclose(inf); |
1123 | if(insimg==NULL) { |
1123 | if(insimg==NULL) { |
1124 |
|
1124 | fly_error("bad_gif"); return; |
1125 | } |
1125 | } |
1126 | 1126 | ||
1127 | /* On recupere les numeros des matrices/vecteurs a faire agir, |
1127 | /* On recupere les numeros des matrices/vecteurs a faire agir, |
1128 | * s'il n'y en a pas, on les fait toutes agir |
1128 | * s'il n'y en a pas, on les fait toutes agir |
1129 | */ |
1129 | */ |
Line 1284... | Line 1284... | ||
1284 | setvar(p,strevalue(pp)); return 0; |
1284 | setvar(p,strevalue(pp)); return 0; |
1285 | } |
1285 | } |
1286 | /* search the number of the object */ |
1286 | /* search the number of the object */ |
1287 | i=search_list(objtab,obj_no,sizeof(objtab[0]),name); |
1287 | i=search_list(objtab,obj_no,sizeof(objtab[0]),name); |
1288 | if(i<0) { |
1288 | if(i<0) { |
1289 |
|
1289 | fly_error("bad_cmd"); return 1; |
1290 | } |
1290 | } |
1291 | if(image==NULL && (objtab[i].color_pos || objtab[i].required_parms>2)) { |
1291 | if(image==NULL && (objtab[i].color_pos || objtab[i].required_parms>2)) { |
1292 |
|
1292 | fly_error("image_not_defined"); return 1; |
1293 | } |
1293 | } |
1294 | ovlstrcpy(tbuf2,pp); |
1294 | ovlstrcpy(tbuf2,pp); |
1295 | if(objtab[i].color_pos || objtab[i].routine==obj_setstyle) { |
1295 | if(objtab[i].color_pos || objtab[i].routine==obj_setstyle) { |
1296 | substit(tbuf2); |
1296 | substit(tbuf2); |
1297 | } |
1297 | } |
1298 | if(parse_parms(tbuf2,&pm,objtab+i)!=0) |
1298 | if(parse_parms(tbuf2,&pm,objtab+i)!=0) fly_error("bad_parms"); |
1299 | else objtab[i].routine(&pm); |
1299 | else objtab[i].routine(&pm); |
1300 | return 0; |
1300 | return 0; |
1301 | } |
1301 | } |
1302 | 1302 |