Subversion Repositories wimsdev

Rev

Rev 8843 | Rev 8859 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8843 Rev 8850
Line 82... Line 82...
82
          *p3=','; *(p3+1)=' ';
82
          *p3=','; *(p3+1)=' ';
83
      }
83
      }
84
    }
84
    }
85
    fprintf(outf,"\n!insmath %s\n$()",bf);
85
    fprintf(outf,"\n!insmath %s\n$()",bf);
86
}
86
}
-
 
87
 
87
 
88
 
88
void out_exec(char *s1, char *s2)
89
void out_exec(char *s1, char *s2)
89
{
90
{
90
    char *ps, *p, *pp, *pe, *pp2, *pe2, *pt, c;
91
    char *ps, *p, *pp, *pe, *pp2, *pe2, *pt, c;
91
    char *p2, *p3;
92
    char *p2, *p3;
Line 107... Line 108...
107
      if(*p!='\\') continue;
108
      if(*p!='\\') continue;
108
      c=*(p+1);
109
      c=*(p+1);
109
      if(isalnum(c)) {
110
      if(isalnum(c)) {
110
/* exit */
111
/* exit */
111
          if(strncmp(p+1,"exit",strlen("exit"))==0 && !isalnum(*(p+strlen("exit")+1))) {
112
          if(strncmp(p+1,"exit",strlen("exit"))==0 && !isalnum(*(p+strlen("exit")+1))) {
112
            *p=0; fprintf(outf,"%s\n!exit\n",ps); p+=5; ps=p;
113
            *p=0; fprintf(outf,"%s\n!exit\n",ps); p+=strlen("exit")+1; ps=p;
113
            continue;
114
            continue;
114
          }
115
          }
115
/* for */
116
/* for */
116
          if(strncmp(p+1,"for",strlen("for"))==0 && *find_word_start(p+strlen("for")+1)=='{') {
117
          if(strncmp(p+1,"for",strlen("for"))==0 && *find_word_start(p+strlen("for")+1)=='{') {
117
            char *pt;
118
            char *pt;
118
            *p=0; fprintf(outf,"%s",ps); p++; ps=p;
119
            *p=0; fprintf(outf,"%s",ps); p++; ps=p;
119
            pt=exec_for(p+3); if(pt>p+3) {p=pt-1;ps=pt;}
120
            pt=exec_for(p+strlen("for")); if(pt>p+strlen("for")) {p=pt-1;ps=pt;}
120
            continue;
121
            continue;
121
          }
122
          }
122
/* if */
123
/* if */
123
          if(strncmp(p+1,"if",strlen("if"))==0 && *find_word_start(p+strlen("if")+1)=='{') {
124
          if(strncmp(p+1,"if",strlen("if"))==0 && *find_word_start(p+strlen("if")+1)=='{') {
124
            char *pt;
125
            char *pt;
125
            *p=0; fprintf(outf,"%s",ps); p++; ps=p;
126
            *p=0; fprintf(outf,"%s",ps); p++; ps=p;
126
            pt=exec_if(p+2); if(pt>p+2) {p=pt-1;ps=pt;}
127
            pt=exec_if(p+2); if(pt>p+2) {p=pt-1;ps=pt;}
127
            continue;
128
            continue;
128
          }
129
          }
129
/* ifval */
130
/* ifval */
130
          if(strncmp(p+1,"ifval",strlen("ifval"))==0 && *find_word_start(p+strlen("ifval")+1)=='{') {
131
          if(strncmp(p+1,"ifval",strlen("ifval"))==0 && *find_word_start(p+strlen("ifval")+1)=='{') {
131
            char *pt;
132
            char *pt;
132
            *p=0; fprintf(outf,"%s",ps); p++; ps=p;
133
            *p=0; fprintf(outf,"%s",ps); p++; ps=p;
133
            pt=exec_if(p+5); if(pt>p+5) {p=pt-1;ps=pt;}
134
            pt=exec_if(p+strlen("ifval")); if(pt>p+strlen("ifval")) {p=pt-1;ps=pt;}
134
            continue;
135
            continue;
135
          }
136
          }
136
/* canvasdraw */
137
/* canvasdraw */
137
          if(strncmp(p+1,"canvasdraw",strlen("canvasdraw"))==0 && *find_word_start(p+strlen("canvasdraw")+1)=='{') {
138
          if(strncmp(p+1,"canvasdraw",strlen("canvasdraw"))==0 && *find_word_start(p+strlen("canvasdraw")+1)=='{') {
138
            pe=pp2=pe2="";
139
            pe=pp2=pe2="";
139
            pp=find_word_start(p+11);
140
            pp=find_word_start(p+strlen("canvasdraw")+1);
140
            if(*pp) pe=find_matching(pp+1,'}');
141
            if(*pp) pe=find_matching(pp+1,'}');
141
            if(pe) pp2=find_word_start(pe+1); else continue;
142
            if(pe) pp2=find_word_start(pe+1); else continue;
142
            if(pp2) pe2=find_matching(pp2+1,'}'); else continue;
143
            if(pp2) pe2=find_matching(pp2+1,'}'); else continue;
143
            if(pe2 && *pp2=='{' && *pe2=='}') {
144
            if(pe2 && *pp2=='{' && *pe2=='}') {
144
                pp++; pp2++; *p=*pe=*pe2=0;
145
                pp++; pp2++; *p=*pe=*pe2=0;
145
                fprintf(outf,"%s \n\
146
                fprintf(outf,"%s \n\
146
!read oef/canvasdraw.phtml %s \\\n%s \n$()", ps,pp,pp2);
147
!read oef/canvasdraw.phtml %s \\\n%s \n$()", ps,pp,pp2);
147
                ps=p=pe2; ps++; continue;
148
                ps=p=pe2; ps++;
148
            }
149
            }
149
          }
150
          }
150
 
151
 
151
/* draw */
152
/* draw */
152
          if(strncmp(p+1,"draw",strlen("draw"))==0 && *find_word_start(p+strlen("draw")+1)=='{') {
153
          if(strncmp(p+1,"draw",strlen("draw"))==0 && *find_word_start(p+strlen("draw")+1)=='{') {
153
            pe=pp2=pe2="";
154
            pe=pp2=pe2="";
154
            pp=find_word_start(p+5);
155
            pp=find_word_start(p+strlen("draw")+1);
155
            if(*pp) pe=find_matching(pp+1,'}');
156
            if(*pp) pe=find_matching(pp+1,'}');
156
            if(pe) pp2=find_word_start(pe+1); else continue;
157
            if(pe) pp2=find_word_start(pe+1); else continue;
157
            if(pp2) pe2=find_matching(pp2+1,'}'); else continue;
158
            if(pp2) pe2=find_matching(pp2+1,'}'); else continue;
158
            if(pe2 && *pp2=='{' && *pe2=='}') {
159
            if(pe2 && *pp2=='{' && *pe2=='}') {
159
                pp++; pp2++; *p=*pe=*pe2=0;
160
                pp++; pp2++; *p=*pe=*pe2=0;
Line 204... Line 205...
204
          }
205
          }
205
/* embed */
206
/* embed */
206
 
207
 
207
          if(strncmp(p+1,"embed",strlen("embed"))==0 && *find_word_start(p+strlen("embed")+1)=='{') {
208
          if(strncmp(p+1,"embed",strlen("embed"))==0 && *find_word_start(p+strlen("embed")+1)=='{') {
208
            pe=pp2=pe2="";
209
            pe=pp2=pe2="";
209
            pp=find_word_start(p+6);
210
            pp=find_word_start(p+strlen("embed")+1);
210
            if(*pp) pe=find_matching(pp+1,'}');
211
            if(*pp) pe=find_matching(pp+1,'}');
211
            if(pe && *pp=='{' && *pe=='}') {
212
            if(pe && *pp=='{' && *pe=='}') {
212
                pp++; *p=*pe=0;
213
                pp++; *p=*pe=0;
213
                fprintf(outf,"%s \n\
214
                fprintf(outf,"%s \n\
214
!read oef/embed.phtml %s \n$()", ps,pp);
215
!read oef/embed.phtml %s \n$()", ps,pp);
215
                ps=p=pe; ps++; embedcnt++; continue;
216
                ps=p=pe; ps++; embedcnt++; continue;
216
            }
217
            }
217
          }
218
          }
-
 
219
/* special */
218
          if(strncmp(p+1,"special",strlen("special"))==0 && *find_word_start(p+strlen("special"))=='{') {
220
          if(strncmp(p+1,"special",strlen("special"))==0 && *find_word_start(p+strlen("special"))=='{') {
219
            pe=pp2=pe2="";
221
            pe=pp2=pe2="";
220
            pp=find_word_start(p+8);
222
            pp=find_word_start(p+strlen("special")+1);
221
            if(*pp) pe=find_matching(pp+1,'}');
223
            if(*pp) pe=find_matching(pp+1,'}');
222
            if(pe && *pp=='{' && *pe=='}') {
224
            if(pe && *pp=='{' && *pe=='}') {
223
                pp++; *p=*pe=0;
225
                pp++; *p=*pe=0;
224
                fprintf(outf,"%s \n\
226
                fprintf(outf,"%s \n\
225
!read oef/special.phtml %s \n$()", ps,pp);
227
!read oef/special.phtml %s \n$()", ps,pp);