MCPcopy Create free account
hub / github.com/Singular/Singular / exitBuffer

Function exitBuffer

Singular/fevoices.cc:236–275  ·  view source on GitHub ↗

2 * exit Buffer of type 'typ': * returns 1 if buffer type could not be found */

Source from the content-addressed store, hash-verified

234* returns 1 if buffer type could not be found
235*/
236BOOLEAN exitBuffer(feBufferTypes typ)
237{
238 //printf("exitBuffer: %d(%s),(%x)\n",
239 // typ,BT_name[typ], currentVoice);
240 //Voice *p=currentVoice;
241 //PrintS("-----------------\ncurr:");
242 //do
243 //{
244 //Print("voice fn:%s\n",p->filename);
245 //p=p->prev;
246 //}
247 //while (p!=NULL);
248 //PrintS("----------------\n");
249 if (typ == BT_break) // valid inside for, while. may skip if, else
250 {
251 /*4 first check for valid buffer type, skip if/else*/
252 Voice *p=currentVoice;
253 loop
254 {
255 if ((p->typ != BT_if)
256 &&(p->typ != BT_else))
257 {
258 if (p->typ == BT_break /*typ*/)
259 {
260 while (p != currentVoice)
261 {
262 exitVoice();
263 }
264 exitVoice();
265 return FALSE;
266 }
267 else return TRUE;
268 }
269 if (p->prev==NULL) break;
270 p=p->prev;
271 }
272 /*4 break not inside a for/while: return an error*/
273 if (/*typ*/ BT_break != currentVoice->typ) return 1;
274 return exitVoice();
275 }
276
277 if ((typ == BT_proc)
278 || (typ == BT_example))

Callers 1

grammar.ccFile · 0.85

Calls 2

exitVoiceFunction · 0.85
ifFunction · 0.50

Tested by

no test coverage detected