Rev 8878 | Rev 17574 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8878 | Rev 12473 | ||
---|---|---|---|
Line 63... | Line 63... | ||
63 | double parallogram_fonda[]={0,0,100,0,0,100}; |
63 | double parallogram_fonda[]={0,0,100,0,0,100}; |
64 | 64 | ||
65 | /* Write the image */ |
65 | /* Write the image */ |
66 | void output(void) |
66 | void output(void) |
67 | { |
67 | { |
68 |
|
68 | FILE *out; |
69 | 69 | ||
70 |
|
70 | if(!image) return; |
71 |
|
71 | if(imagefilename[0]) { |
72 |
|
72 | out=fopen(imagefilename,"wb"); |
73 |
|
73 | if(out!=NULL) {gdImageGif(image, out); fclose(out); } |
74 |
|
74 | } |
75 |
|
75 | else gdImageGif(image, stdout); |
76 |
|
76 | saved=1; |
77 | } |
77 | } |
78 | 78 | ||
79 | /* substitute variable names by their environment strings |
79 | /* substitute variable names by their environment strings |
80 | * The buffer pointed to by p must have enough space |
80 | * The buffer pointed to by p must have enough space |
81 | * (defined by MAX_LINELEN). |
81 | * (defined by MAX_LINELEN). |
82 | */ |
82 | */ |
83 | char *substit(char *p) |
83 | char *substit(char *p) |
84 | { |
84 | { |
85 |
|
85 | char *pp, *pe; |
86 |
|
86 | char namebuf[MAX_NAMELEN+1]; |
87 |
|
87 | int i, l; |
88 | 88 | ||
89 |
|
89 | pe=strchr(p,'"'); if(pe!=NULL) l=pe-p; else l=MAX_LINELEN; |
90 |
|
90 | for(pp=find_name_start(p); *pp!=0 && pp-p<l; |
91 |
|
91 | pp=find_name_start(pe)) { |
92 |
|
92 | pe=find_name_end(pp); |
93 |
|
93 | if((pp>p && !isspace(*(pp-1)) && *(pp-1)!=',') || |
94 |
|
94 | (*pe!=0 && !isspace(*pe) && *pe!=',')) continue; |
95 |
|
95 | memmove(namebuf,pp,pe-pp); namebuf[pe-pp]=0; |
96 |
|
96 | i=search_list(nametab,nametab_no,sizeof(nametab[0]),namebuf); |
97 |
|
97 | if(i<0) continue; |
98 |
|
98 | if(nametab[i].type==t_prep && preptab[nametab[i].serial].typ==p_font) |
99 |
|
99 | break; |
100 |
|
100 | if(nametab[i].type==t_color) |
101 |
|
101 | string_modify(p,pp,pe,colortab[nametab[i].serial].def); |
102 |
|
102 | } |
103 |
|
103 | return p; |
104 | } |
104 | } |
105 | 105 | ||
106 | void fly_process(void) |
106 | void fly_process(void) |
107 | { |
107 | { |
108 |
|
108 | char buf[MAX_LINELEN+1]; |
109 |
|
109 | int c; |
110 |
|
110 | do { |
111 |
|
111 | c=ggetline(buf); obj_main(buf); |
112 |
|
112 | } |
113 |
|
113 | while(c!=EOF); |
114 | } |
114 | } |
115 | 115 | ||
116 | int verify_tables(void) { |
116 | int verify_tables(void) { |
117 |
|
117 | return evaltab_verify(); |
118 | } |
118 | } |
119 | 119 | ||
120 | int main(int argc, char *argv[]) |
120 | int main(int argc, char *argv[]) |
121 | { |
121 | { |
122 | int i; for (i = 0; i <= JC_NB_MATRICES; i++) |
122 | int i; for (i = 0; i <= JC_NB_MATRICES; i++) |
123 |
|
123 | matrices_pavage [i][0] = matrices_pavage[i][3] = 1; |
124 |
|
124 | substitute=substit; |
125 |
|
125 | ev_varcnt=&varcnt; ev_var=vartab; |
126 |
|
126 | if(argc==2 && strcasecmp(argv[1],"table")==0) { |
127 |
|
127 | if(verify_tables()) { |
128 |
|
128 | printf("Table disorder.\n"); return 1; |
129 | } |
- | |
130 | printf("Table orders OK.\n"); return 0; |
- | |
131 | } |
129 | } |
- | 130 | printf("Table orders OK.\n"); return 0; |
|
- | 131 | } |
|
132 |
|
132 | vartab[0].name="animstep"; vartab[0].value=0; |
133 |
|
133 | varcnt=1; |
134 |
|
134 | if(argc>1) snprintf(imagefilename,sizeof(imagefilename),"%s",argv[1]); |
135 |
|
135 | else imagefilename[0]=0; |
136 |
|
136 | fly_process(); |
137 |
|
137 | if(!saved || imagefilename[0]!=0) output(); |
138 |
|
138 | if(image) gdImageDestroy(image); |
139 |
|
139 | if(vimg_ready) vimg_close(); |
140 |
|
140 | return 0; |
141 | } |
141 | } |
142 | - |