Rev 7840 | Rev 8160 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7840 | Rev 8068 | ||
---|---|---|---|
Line 43... | Line 43... | ||
43 | p[j]=0; |
43 | p[j]=0; |
44 | } |
44 | } |
45 | 45 | ||
46 | /* Returns a mask string composed of '0's and '1's, where |
46 | /* Returns a mask string composed of '0's and '1's, where |
47 | * '0' means corresponding positions of buf[0] and buf[1] are |
47 | * '0' means corresponding positions of buf[0] and buf[1] are |
48 | * equal. |
48 | * equal. |
- | 49 | */ |
|
49 | void text_compare(char *p) |
50 | void text_compare(char *p) |
50 | { |
51 | { |
51 | int min,max, i; |
52 | int min,max, i; |
52 | _text_cut(p,"and"); |
53 | _text_cut(p,"and"); |
53 | min=strlen(t_buf[0]); max=strlen(t_buf[1]); |
54 | min=strlen(t_buf[0]); max=strlen(t_buf[1]); |
Line 105... | Line 106... | ||
105 | /* put chars in buf[0] in a new string, into positions |
106 | /* put chars in buf[0] in a new string, into positions |
106 | * corresponding to '1's in the mask buf[1]. |
107 | * corresponding to '1's in the mask buf[1]. |
107 | * Positions corresponding to '0's are filled by space. |
108 | * Positions corresponding to '0's are filled by space. |
108 | * Fill stops at the end of buf[0]. If buf[1] is |
109 | * Fill stops at the end of buf[0]. If buf[1] is |
109 | * too short, it is reused from the start. |
110 | * too short, it is reused from the start. |
- | 111 | * FIXME: using 0 as a mask gives a bug |
|
- | 112 | */ |
|
- | 113 | /* |
|
- | 114 | @@ !text expand abcdef mask 01 |
|
- | 115 | @@ a b c d e f |
|
- | 116 | @@ !text expand abcdef mask 011 |
|
- | 117 | @@ ab cd e |
|
- | 118 | @@ !text expand abcdefg using 101110 |
|
- | 119 | @@ a bcd e fg |
|
110 | */ |
120 | */ |
111 | void text_expand(char *p) |
121 | void text_expand(char *p) |
112 | { |
122 | { |
113 | int i,j,k,n1,n2; |
123 | int i,j,k,n1,n2; |
114 | _text_cut(p,"using"); |
124 | _text_cut(p,"using"); |
Line 123... | Line 133... | ||
123 | 133 | ||
124 | /* character by character replacement of buf[1] by buf[0], |
134 | /* character by character replacement of buf[1] by buf[0], |
125 | * replacing only mask-effective chars. |
135 | * replacing only mask-effective chars. |
126 | * The resulting string is as long as buf[1], and the replacement |
136 | * The resulting string is as long as buf[1], and the replacement |
127 | * stops when chars buf[0] has run out. |
137 | * stops when chars buf[0] has run out. |
- | 138 | */ |
|
- | 139 | /* |
|
- | 140 | @@ !text insert abcefg into hijkl mask 10100 |
|
- | 141 | @@ aibkl |
|
128 | */ |
142 | */ |
129 | void text_insert(char *p) |
143 | void text_insert(char *p) |
130 | { |
144 | { |
131 | int i,j,n1,n2; |
145 | int i,j,n1,n2; |
132 | _text_cut(p,"into"); |
146 | _text_cut(p,"into"); |
Line 145... | Line 159... | ||
145 | void text_interact(char *p) |
159 | void text_interact(char *p) |
146 | { |
160 | { |
147 | char *table, *dline, *tline[MAX_TLEN]; |
161 | char *table, *dline, *tline[MAX_TLEN]; |
148 | char *p1, *p2; |
162 | char *p1, *p2; |
149 | int i,j1,j2,k,l,l2,n; |
163 | int i,j1,j2,k,l,l2,n; |
150 | 164 | ||
151 | table=wordchr(p,"table"); |
165 | table=wordchr(p,"table"); |
152 | if(table==NULL) error2("syntax_error"); |
166 | if(table==NULL) error2("syntax_error"); |
153 | *table=0; strip_trailing_spaces(p); |
167 | *table=0; strip_trailing_spaces(p); |
154 | table=find_word_start(table+strlen("table")); |
168 | table=find_word_start(table+strlen("table")); |
155 | snprintf(t_buf[2],MAX_LINELEN,"%s",table); |
169 | snprintf(t_buf[2],MAX_LINELEN,"%s",table); |
Line 180... | Line 194... | ||
180 | } |
194 | } |
181 | p[k]=0; |
195 | p[k]=0; |
182 | } |
196 | } |
183 | 197 | ||
184 | /* returns a mask string composed of '0's and '1's, where |
198 | /* returns a mask string composed of '0's and '1's, where |
185 | * '0' means corresponding char in buf[1] appears in buf[0]. |
199 | * '0' means corresponding char in buf[1] appears in buf[0]. |
- | 200 | */ |
|
- | 201 | /* |
|
- | 202 | @@ !text mark a in abcaefa |
|
- | 203 | @@ 001001 |
|
- | 204 | */ |
|
186 | void text_mark(char *p) |
205 | void text_mark(char *p) |
187 | { |
206 | { |
188 | int i, n; |
207 | int i, n; |
189 | _text_cut(p,"in"); |
208 | _text_cut(p,"in"); |
190 | n=strlen(t_buf[1]); |
209 | n=strlen(t_buf[1]); |