Mercurial > hg > octave-nkf
comparison scripts/plot/util/findobj.m @ 18575:dca6ecfd622c gui-release
findobj.m: let leading negation work (bug #41588).
* findobj.m: keep track of extranegation.
author | Sergey Plotnikov <seryozha.plotnikov@gmail.com> |
---|---|
date | Tue, 18 Feb 2014 18:21:55 +0100 |
parents | d63878346099 |
children | c446da1da9ff |
comparison
equal
deleted
inserted
replaced
18573:fb96b7f55242 | 18575:dca6ecfd622c |
---|---|
117 endif | 117 endif |
118 | 118 |
119 regularexpression = []; | 119 regularexpression = []; |
120 property = []; | 120 property = []; |
121 logicaloperator = {}; | 121 logicaloperator = {}; |
122 extranegation = []; | |
122 pname = {}; | 123 pname = {}; |
123 pvalue = {}; | 124 pvalue = {}; |
124 np = 1; | 125 np = 1; |
125 na = 1; | 126 na = 1; |
126 operatorprecedence = {"-not", "-and", "-or", "-xor"}; | 127 operatorprecedence = {"-not", "-and", "-or", "-xor"}; |
127 | 128 |
128 while (na <= numel (args)) | 129 while (na <= numel (args)) |
129 regularexpression(np) = 0; | 130 regularexpression(np) = 0; |
130 property(np) = 0; | 131 property(np) = 0; |
132 if (numel (extranegation) < np) | |
133 extranegation(np) = false; | |
134 endif | |
131 logicaloperator{np} = "and"; | 135 logicaloperator{np} = "and"; |
132 if (ischar (args{na})) | 136 if (ischar (args{na})) |
133 if (strcmpi (args{na}, "-regexp")) | 137 if (strcmpi (args{na}, "-regexp")) |
134 if (na + 2 <= numel (args)) | 138 if (na + 2 <= numel (args)) |
135 regularexpression(np) = 1; | 139 regularexpression(np) = 1; |
175 np = np + 1; | 179 np = np + 1; |
176 else | 180 else |
177 error ("findobj: inconsistent number of arguments"); | 181 error ("findobj: inconsistent number of arguments"); |
178 endif | 182 endif |
179 else | 183 else |
180 ## This is sloppy ... but works like Matlab. | |
181 if (strcmpi (args{na}, "-not")) | 184 if (strcmpi (args{na}, "-not")) |
182 h = []; | 185 extranegation(np) = true; |
183 return; | |
184 endif | 186 endif |
185 na = na + 1; | 187 na = na + 1; |
186 endif | 188 endif |
187 else | 189 else |
188 error ("findobj: properties and options must be strings"); | 190 error ("findobj: properties and options must be strings"); |
239 endif | 241 endif |
240 endif | 242 endif |
241 else | 243 else |
242 match(nh,np) = false; | 244 match(nh,np) = false; |
243 endif | 245 endif |
246 if (extranegation(np)) | |
247 match(nh,np) = ! match(nh,np); | |
248 endif | |
244 endfor | 249 endfor |
245 endfor | 250 endfor |
246 | 251 |
247 if (numpairs > 1) | 252 if (numpairs > 1) |
248 for no = 1 : numel (operatorprecedence) | 253 for no = 1 : numel (operatorprecedence) |