Rev 8148 | Rev 8367 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8148 | Rev 8353 | ||
---|---|---|---|
Line 20... | Line 20... | ||
20 | #include "msg2wims.h" |
20 | #include "msg2wims.h" |
21 | 21 | ||
22 | char primbuf[MAX_LINELEN+1]; |
22 | char primbuf[MAX_LINELEN+1]; |
23 | char *primitive[256]; |
23 | char *primitive[256]; |
24 | int primcnt, prepcnt; |
24 | int primcnt, prepcnt; |
25 | - | ||
26 | 25 | ||
27 | char *prim_if(char *p) |
26 | char *prim_if(char *p) |
28 | { |
27 | { |
29 | char *p1, *p2, *p3, *p4, *p5, *p6; |
28 | char *p1, *p2, *p3, *p4, *p5, *p6; |
30 | char buf[MAX_LINELEN+1]; |
29 | char buf[MAX_LINELEN+1]; |
31 | p1=find_word_start(p); if(*p1!='{') return p; |
30 | p1=find_word_start(p); if(*p1!='{') return p; |
32 | p2=find_matching(p1+1,'}'); if(p2==NULL) return p; |
31 | p2=find_matching(p1+1,'}'); if(p2==NULL) return p; |
33 | p3=find_word_start(p2+1); if(*p3!='{') return p; |
32 | p3=find_word_start(p2+1); if(*p3!='{') return p; |
34 | p4=find_matching(p3+1,'}'); if(p4==NULL) return p; |
33 | p4=find_matching(p3+1,'}'); if(p4==NULL) return p; |
35 | *p2=0; snprintf(buf,sizeof(buf),"%s",p1+1); subst(buf); |
34 | *p2=0; snprintf(buf,sizeof(buf),"%s",p1+1); subst(buf); |
36 | /* for(pp=strchr(buf,'\\'); pp!=NULL; pp=strchr(pp+1,'\\')) { |
- | |
37 | if(isalnum(*(pp+1))) string_modify(buf,pp,pp+1,"$m_"); |
- | |
38 | } |
- | |
39 |
|
35 | prepcnt=0; parmprep(buf,pt_text); |
40 | fprintf(outf," \n!if %s \n",buf); |
36 | fprintf(outf," \n!if %s \n",buf); |
41 | p5=find_word_start(p4+1); |
37 | p5=find_word_start(p4+1); |
42 | if(*p5=='{' && (p6=find_matching(p5+1,'}'))!=NULL) { |
38 | if(*p5=='{' && (p6=find_matching(p5+1,'}'))!=NULL) { |
43 | *p4=elsechar; *p5=' '; *p6=endifchar; |
39 | *p4=elsechar; *p5=' '; *p6=endifchar; |
44 | } |
40 | } |
45 | else *p4=endifchar; |
41 | else *p4=endifchar; |
46 | return p3+1; |
42 | return p3+1; |
47 | } |
43 | } |
48 | 44 | ||
49 | char *prim_while(char *p) |
45 | char *prim_while(char *p) |
50 | { |
46 | { |
51 | char *p1, *p2, *p3, *p4; |
47 | char *p1, *p2, *p3, *p4; |
52 | char buf[MAX_LINELEN+1]; |
48 | char buf[MAX_LINELEN+1]; |
53 | p1=find_word_start(p); if(*p1!='{') return p; |
49 | p1=find_word_start(p); if(*p1!='{') return p; |
54 | p2=find_matching(p1+1,'}'); if(p2==NULL) return p; |
50 | p2=find_matching(p1+1,'}'); if(p2==NULL) return p; |
55 | p3=find_word_start(p2+1); if(*p3!='{') return p; |
51 | p3=find_word_start(p2+1); if(*p3!='{') return p; |
56 | p4=find_matching(p3+1,'}'); if(p4==NULL) return p; |
52 | p4=find_matching(p3+1,'}'); if(p4==NULL) return p; |
57 | *p2=0; snprintf(buf,sizeof(buf),"%s",p1+1); subst(buf); |
53 | *p2=0; snprintf(buf,sizeof(buf),"%s",p1+1); subst(buf); |
58 | /* for(pp=strchr(buf,'\\'); pp!=NULL; pp=strchr(pp+1,'\\')) { |
- | |
59 | if(isalnum(*(pp+1))) string_modify(buf,pp,pp+1,"$m_"); |
- | |
60 | } |
- | |
61 |
|
54 | prepcnt=0; parmprep(buf,pt_text); |
62 | fprintf(outf," \n!while %s \n",buf); |
55 | fprintf(outf," \n!while %s \n",buf); |
63 | *p4=whilechar; |
56 | *p4=whilechar; |
64 | return p3+1; |
57 | return p3+1; |
65 | } |
58 | } |
66 | 59 | ||
67 | char *prim_for(char *p) |
60 | char *prim_for(char *p) |
68 | { |
61 | { |
69 | char *p1, *p2, *p3, *p4; |
62 | char *p1, *p2, *p3, *p4; |
Line 71... | Line 64... | ||
71 | p1=find_word_start(p); if(*p1!='{') return p; |
64 | p1=find_word_start(p); if(*p1!='{') return p; |
72 | p2=find_matching(p1+1,'}'); if(p2==NULL) return p; |
65 | p2=find_matching(p1+1,'}'); if(p2==NULL) return p; |
73 | p3=find_word_start(p2+1); if(*p3!='{') return p; |
66 | p3=find_word_start(p2+1); if(*p3!='{') return p; |
74 | p4=find_matching(p3+1,'}'); if(p4==NULL) return p; |
67 | p4=find_matching(p3+1,'}'); if(p4==NULL) return p; |
75 | *p2=0; snprintf(buf,sizeof(buf),"%s",p1+1); subst(buf); |
68 | *p2=0; snprintf(buf,sizeof(buf),"%s",p1+1); subst(buf); |
76 | /* for(pp=strchr(buf,'\\'); pp!=NULL; pp=strchr(pp+1,'\\')) { |
- | |
77 | if(isalnum(*(pp+1))) string_modify(buf,pp,pp+1,"$m_"); |
- | |
78 | } |
- | |
79 |
|
69 | fprintf(outf," \n!for m_%s \n",find_word_start(buf)); |
80 | *p4=nextchar; |
70 | *p4=nextchar; |
81 | return p3+1; |
71 | return p3+1; |
82 | } |
72 | } |
83 | 73 | ||
84 | /* check whether the name is a document primitive. */ |
74 | /* check whether the name is a document primitive. */ |
85 | /* for the moment, only |
75 | /* for the moment, only def define if for while or as in "msg2wims_primitives" |
86 | description of primitive must |
76 | * description of primitive must be in primitive_dir="docu/primitives" |
- | 77 | * msg2wims_primitives is defined in two places: |
|
- | 78 | * public_html/modules/adm/doc/var.proc and public_html/scripts/docu/mkindex |
|
- | 79 | * should be elsewhere at least for primitives defined here |
|
- | 80 | * that is "def define if for while" |
|
- | 81 | */ |
|
- | 82 | ||
87 | char *doccheck(char *p) |
83 | char *doccheck(char *p) |
88 | { |
84 | { |
89 | char *pe, *pl, *pv, *pp, namebuf[128], parbuf[8192]; |
85 | char *pe, *pl, *pv, *pp, namebuf[128], parbuf[8192]; |
90 | int i, k, t; |
86 | int i, k, t; |
91 | 87 |