Bug Summary

File:src/bloop.c
Warning:line 680, column 24
Although the value stored to 'cmax' is used in the enclosing expression, the value is never actually read from 'cmax'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name bloop.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/kfp/aldor/aldor/aldor/src -fcoverage-compilation-dir=/home/kfp/aldor/aldor/aldor/src -resource-dir /usr/local/lib/clang/18 -D PACKAGE_NAME="aldor" -D PACKAGE_TARNAME="aldor" -D PACKAGE_VERSION="1.4.0" -D PACKAGE_STRING="aldor 1.4.0" -D PACKAGE_BUGREPORT="aldor@xinutec.org" -D PACKAGE_URL="" -D PACKAGE="aldor" -D VERSION="1.4.0" -D YYTEXT_POINTER=1 -D HAVE_STDIO_H=1 -D HAVE_STDLIB_H=1 -D HAVE_STRING_H=1 -D HAVE_INTTYPES_H=1 -D HAVE_STDINT_H=1 -D HAVE_STRINGS_H=1 -D HAVE_SYS_STAT_H=1 -D HAVE_SYS_TYPES_H=1 -D HAVE_UNISTD_H=1 -D STDC_HEADERS=1 -D HAVE_LIBREADLINE=1 -D HAVE_READLINE_READLINE_H=1 -D HAVE_READLINE_HISTORY=1 -D HAVE_READLINE_HISTORY_H=1 -D USE_GLOOP_SHELL=1 -D GENERATOR_COROUTINES=0 -D HAVE_DLFCN_H=1 -D LT_OBJDIR=".libs/" -I . -D VCSVERSION="2c53e759f1e00e345f8b172e7139debda72fda13" -internal-isystem /usr/local/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-empty-body -Wno-enum-compare -Wno-missing-field-initializers -Wno-unused -Wno-unused-parameter -Wno-error=format -Wno-error=type-limits -Wno-error=strict-aliasing -Wno-sign-compare -Wno-error=shift-negative-value -Wno-error=clobbered -std=c99 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2026-01-15-223856-845667-1 -x c bloop.c
1/*****************************************************************************
2 *
3 * bloop.c: Interactive break loop.
4 *
5 * Copyright (c) 1990-2007 Aldor Software Organization Ltd (Aldor.org).
6 *
7 ****************************************************************************/
8
9#include "bloop.h"
10#include "opsys.h"
11#include "stab.h"
12#include "strops.h"
13#include "store.h"
14#include "util.h"
15#include "tposs.h"
16#include "abpretty.h"
17#include "doc.h"
18#include "comsg.h"
19#include "sexpr.h"
20
21/*
22 * :: External state control
23 */
24
25#define MAX_CMD200 200
26
27#define MAX_MSG50000 50000
28
29#define MAX_STR8000 8000
30#define PATH_END(-1) (-1)
31#define SESCAPE'\007' '\007'
32
33#define stoAllocVec(n, T)((T *) stoAlloc(0, (n) * sizeof(T))) ((T *) stoAlloc(OB_Other0, (n) * sizeof(T)))
34#define stoAllocObj(oty)((oty *) stoAlloc(0,sizeof(oty))) ((oty *) stoAlloc(OB_Other0,sizeof(oty)))
35
36/*****************************************************************************
37 *
38 * :: Initialization/Finalization
39 *
40 ****************************************************************************/
41
42static FILE *fin, *fout;
43static char * msg;
44
45struct breakMsg {
46 CoMsg comsg; /* Message associated with the error. */
47 int depth; /* Distance from root to node. -1 => no path */
48 int *path; /* Path to node, or 0. */
49};
50
51typedef struct breakMsg *BreakMsg;
52
53
54/*
55 * :: Internal state control
56 */
57static Bool bloopInterface = false((int) 0);
58static Bool bloopIsNice = true1;
59
60static int bloopMsgc = -1;
61static BreakMsg * bloopMsgv = 0;
62
63static AbSyn bloopAbRoot = 0;
64static Stab bloopStab = 0;
65
66static int bloopCurrIx = -1;
67static int * bloopCurrAbPath = 0;
68static int bloopCurrAbDepth= -1;
69static int bloopTmpSet = 0;
70
71static AbSyn bloopAbCurr = 0;
72static AbSyn bloopAbTmp = 0;
73static AbSyn bloopAbParent = 0;
74
75#define BLOOP_CURR(bloopMsgv[bloopCurrIx]) (bloopMsgv[bloopCurrIx])
76#define BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1) (BLOOP_CURR(bloopMsgv[bloopCurrIx])->depth != -1)
77
78
79char * getTok (char **);
80
81/*
82 * :: Action declarations
83 */
84localstatic void bloopInit (int comsgc, CoMsg *comsgv);
85localstatic void bloopFini (void);
86
87localstatic void bloopHandleCmds (void);
88localstatic String bloopGetCommand (void);
89localstatic void bloopSendString (String, String);
90localstatic void bloopSendMsg (Msg);
91
92localstatic void bloopMSelect (void);
93localstatic void bloopSelect (int);
94localstatic void bloopSetCurr (void);
95
96localstatic void bloopComsg (void);
97localstatic void bloopNotes (void);
98localstatic void bloopGetPos (void);
99localstatic void bloopResetCurr (void);
100localstatic void bloopPosWhere (void);
101localstatic void bloopWhere (void);
102
103localstatic void bloopShow (void);
104localstatic void bloopUse (void);
105localstatic void bloopMeans (void);
106localstatic void bloopMsg (void);
107localstatic void bloopSeman (void);
108localstatic void bloopScope (void);
109localstatic void bloopUgly (void);
110localstatic void bloopNice (void);
111
112localstatic void bloopHome (void);
113localstatic void bloopUp (void);
114localstatic void bloopDown (void);
115localstatic void bloopNext (void);
116localstatic void bloopPrev (void);
117
118localstatic void bloopStabPretty (void);
119
120localstatic Bool breakToQuit = false((int) 0);
121
122/*****************************************************************************
123 *
124 * :: External entry points
125 *
126 ****************************************************************************/
127
128AbSyn
129breakSetRoot(AbSyn isNew)
130{
131 AbSyn old = bloopAbRoot;
132 bloopAbRoot = isNew;
133 return old;
134}
135
136void
137breakInterrupt(void)
138{
139 if (bloopInterface) {
140 fprintf(stderrstderr, "No compiler messages!\n");
141 fflush(stderrstderr);
142 bloopSendString("done", "\"\"");
143 exitSetHandler((ExitFun) 0);
144 exitFailure();
145 }
146}
147
148void
149breakLoop(Bool forHuman, int msgc, CoMsg *msgv)
150{
151 fin = osStdin;
152 fout = osStdout;
153 bloopInterface = !forHuman;
154
155 if (msgc <= 0) return;
156
157 if (!bloopInterface) bloopSendMsg(ALDOR_M_BreakEnter276);
158
159 bloopInit(msgc, msgv);
160 bloopSelect(int0((int) 0));
161 bloopHandleCmds();
162 bloopFini();
163
164 if (!bloopInterface) bloopSendMsg(ALDOR_M_BreakExit277);
165
166 if (breakToQuit) exitFailure();
167}
168
169/*
170 * :: The break loop
171 */
172localstatic void
173bloopHandleCmds()
174{
175 String cmd;
176
177 if (bloopInterface) {
178 sprintf(msg, "%d", bloopMsgc);
179 bloopSendString("nummsgs", msg);
180 }
181 for (;;) {
182 cmd = bloopGetCommand();
183 /*
184 * Test for commands alphabetically.
185 */
186 strcpy(msg, "");
187 if (strEqual("", cmd)) {
188 bloopSendMsg(ALDOR_M_BreakMsgHelpAvail281);
189 }
190 else if (strIsPrefix("down", cmd)) {
191 bloopDown();
192 }
193 else if (strIsPrefix("getcomsg", cmd)) {
194 bloopComsg();
195 }
196 else if (strIsPrefix("notes", cmd)) {
197 bloopNotes();
198 }
199 else if (strIsPrefix("getpos", cmd)) {
200 bloopGetPos();
201 }
202 else if (strIsPrefix("help", cmd)) {
203 bloopSendMsg(ALDOR_M_BreakHelp295);
204 }
205 else if (strIsPrefix("home", cmd)) {
206 bloopHome();
207 }
208 else if (strIsPrefix("means", cmd)) {
209 bloopMeans();
210 }
211 else if (strIsPrefix("mselect", cmd)) {
212 bloopMSelect();
213 }
214 else if (strIsPrefix("mnext", cmd)) {
215 bloopSelect(bloopCurrIx+1);
216 }
217 else if (strIsPrefix("mprev", cmd)) {
218 bloopSelect(bloopCurrIx-1);
219 }
220 else if (strIsPrefix("msg", cmd)) {
221 bloopMsg();
222 }
223 else if (strIsPrefix("next", cmd)) {
224 bloopNext();
225 }
226 else if (strIsPrefix("nice", cmd)) {
227 bloopNice();
228 }
229 else if (strIsPrefix("pos", cmd)) {
230 bloopPosWhere();
231 }
232 else if (strIsPrefix("prev", cmd)) {
233 bloopPrev();
234 }
235 else if (strIsPrefix("quit", cmd)) {
236 breakToQuit = true1;
237 exitSetHandler((ExitFun) 0);
238 break;
239 }
240 else if (strIsPrefix("scope", cmd)) {
241 bloopScope();
242 }
243 else if (strIsPrefix("seman", cmd)) {
244 bloopSeman();
245 }
246 else if (strIsPrefix("show", cmd)) {
247 bloopShow();
248 }
249 else if (strIsPrefix("use", cmd)) {
250 bloopUse();
251 }
252 else if (strIsPrefix("ugly", cmd)) {
253 bloopUgly();
254 }
255 else if (strIsPrefix("up", cmd)) {
256 bloopUp();
257 }
258 else if (strIsPrefix("where", cmd)) {
259 bloopWhere();
260 }
261 else {
262 bloopSendMsg(ALDOR_M_BreakHelp295);
263 if (!bloopInterface) {
264 sprintf(msg, comsgString(ALDOR_M_BreakNoCmd279), cmd);
265 bloopSendString("msg", msg);
266 }
267 }
268 }
269}
270
271localstatic void
272bloopInit(int msgc, CoMsg *comsgv)
273{
274 int i, j, ix;
275
276 msg = (char *) stoAlloc(OB_Other0, MAX_MSG50000);
277
278 /*
279 * Filter out the notes from the messages.
280 */
281 bloopMsgc = msgc;
282 for (i = 0; i < msgc; i++)
283 if (comsgv[i]->tag == COMSG_NOTE) bloopMsgc--;
284 bloopMsgv = stoAllocVec(bloopMsgc + 1, BreakMsg)((BreakMsg *) stoAlloc(0, (bloopMsgc + 1) * sizeof(BreakMsg))
)
;
285
286 /*
287 * Fill a null-terminated break-msg vector.
288 */
289 for (i = 0, ix = 0; i < msgc; i++) {
290 if (comsgv[i]->tag != COMSG_NOTE) {
291 bloopMsgv[ix] = stoAllocObj(struct breakMsg)((struct breakMsg *) stoAlloc(0,sizeof(struct breakMsg)));
292 bloopMsgv[ix]->comsg = comsgv[i];
293 bloopMsgv[ix]->depth = -1;
294 bloopMsgv[ix]->path = 0;
295 ix++;
296 }
297 }
298
299 /*
300 * If there is a root, set up path-to-node index vectors.
301 */
302 if (bloopAbRoot) {
303 int len;
304 AIntList p, q;
305 AbSyn node;
306
307 for (i = 0; i < bloopMsgc; i++) {
308 node = bloopMsgv[i]->comsg->node;
309 if (!node) continue;
310
311 p = abPathToNode(bloopAbRoot, node, abEqual, &len,
312 (AIntList) 0);
313 if (len >= 0) {
314 bloopMsgv[i]->depth = len;
315 bloopMsgv[i]->path = stoAllocVec(len+1, int)((int *) stoAlloc(0, (len+1) * sizeof(int)));
316
317 for (q = p, j = 0; q; q = cdr(q)((q)->rest), j++)
318 bloopMsgv[i]->path[j] = car(q)((q)->first);
319 bloopMsgv[i]->path[j] = PATH_END(-1);
320 }
321 listFree(AInt)(AInt_listPointer->Free)(p);
322 }
323 }
324
325 /*
326 * Initialize relevant global variables.
327 */
328 bloopStab = stabFile();
329
330 if (bloopAbRoot) {
331 int ht = abTreeHeight(bloopAbRoot);
332 bloopCurrAbPath = stoAllocVec(ht + 1, int)((int *) stoAlloc(0, (ht + 1) * sizeof(int)));
333 }
334}
335
336localstatic void
337bloopFini(void)
338{
339 bloopStab = 0;
340
341 bloopCurrIx = -1;
342 bloopMsgc = -1;
343 stoFree((Pointer) bloopMsgv);
344
345 bloopCurrAbDepth = -1;
346 if (bloopCurrAbPath) {
347 stoFree((Pointer) bloopCurrAbPath);
348 bloopCurrAbPath = 0;
349 }
350
351 bloopAbCurr = 0;
352 bloopAbParent = 0;
353
354 stoFree(msg);
355}
356
357localstatic void
358bloopSelect(int ix)
359{
360 int i;
361
362 if (ix < 0 || ix >= bloopMsgc) {
363 bloopSendMsg(ALDOR_M_BreakMsgCantSelect290);
364 return;
365 }
366
367 if (bloopTmpSet) {
368 bloopAbCurr = bloopAbTmp;
369 bloopAbTmp = 0;
370 bloopTmpSet = 0;
371 bloopResetCurr();
372 }
373
374 bloopCurrIx = ix;
375 bloopCurrAbDepth = BLOOP_CURR(bloopMsgv[bloopCurrIx])->depth;
376
377 if (BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1) && BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->tag != COMSG_NOTE) {
378 for (i = 0; i < bloopCurrAbDepth; i++)
379 bloopCurrAbPath[i] = BLOOP_CURR(bloopMsgv[bloopCurrIx])->path[i];
380 bloopCurrAbPath[i] = PATH_END(-1);
381 bloopSetCurr();
382 }
383 else {
384 bloopAbParent = 0;
385 bloopAbCurr = bloopAbRoot;
386 }
387 /* Make this part of prompt command in bloopGetCommand. */
388 if (bloopInterface)
389 bloopSendString("ready", "\"\"");
390}
391
392localstatic void
393bloopMSelect(void)
394{
395 String cmd;
396 int index;
397 char *s;
398
399 cmd = bloopGetCommand();
400 s = getTok(&cmd);
401 index = atoi(s);
402 bloopSelect(index);
403}
404
405localstatic void
406bloopSetCurr(void)
407{
408 int i;
409
410 if (!BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1)) return;
411
412 bloopStab = stabFile();
413
414 bloopAbParent = 0;
415 bloopAbCurr = bloopAbRoot;
416 if (abStab(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->stab : 0)
) bloopStab = abStab(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->stab : 0)
;
417
418 for (i = 0; bloopCurrAbPath[i] != PATH_END(-1); i++) {
419 bloopAbParent = bloopAbCurr;
420 bloopAbCurr = abArgv(bloopAbParent)((bloopAbParent)->abGen.data.argv)[bloopCurrAbPath[i]];
421 if (abStab(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->stab : 0)
) bloopStab = abStab(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->stab : 0)
;
422 }
423}
424
425
426localstatic void
427bloopSendString(char *cmd, char *str)
428{
429 if (bloopInterface) {
430 if (str)
431 fprintf(fout, "(%s \"%s\")\n", cmd, str);
432 else
433 fprintf(fout, "(%s \"%s\")\n", cmd, "Invalid string!");
434 fflush(fout);
435 }
436 else {
437 fprintf(fout, "%s\n", str);
438 fflush(fout);
439 }
440}
441
442localstatic void
443bloopSendMsg(Msg msg)
444{
445 bloopSendString("msg", comsgString(msg));
446}
447
448int
449bloopMsgFPrintf(FILE *fout, Msg msg, ...)
450{
451 int cc;
452 va_list argp;
453
454 va_start(argp, msg)__builtin_va_start(argp, msg);
455 cc = bloopMsgVFPrintf(fout, msg, argp);
456 va_end(argp)__builtin_va_end(argp);
457
458 return cc;
459}
460
461int
462bloopMsgVFPrintf(FILE *fout, Msg msg, va_list argp)
463{
464 int cc = 0;
465
466 cc += fprintf(fout, "(error %c", SESCAPE'\007');
467 cc += comsgVFPrintf(fout, msg, argp);
468 cc += fprintf(fout, "%c)\n", SESCAPE'\007');
469 fflush(fout);
470
471 return cc;
472}
473
474/*
475 * Read a command and return it in a static string.
476 */
477localstatic String
478bloopGetCommand(void)
479{
480 char cmd[MAX_CMD200];
481 char *s;
482
483 if (!bloopInterface)
484 prompt(fin, fout, "%s", comsgString(ALDOR_M_BreakMsgPrompt280));
485 else
486 prompt(fin, fout, "(ready \"\")\n");
487
488 if (fgets(cmd, sizeof(cmd), fin) == NULL((void*)0))
489 return NULL((void*)0);
490
491 /* Trim white space from both ends. */
492 s = cmd + strlen(cmd) - 1;
493 while (s >= cmd && isspace(*s)((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int)
_ISspace)
) s--;
494 if (s >= cmd && isspace(*s)((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int)
_ISspace)
) *s = 0;
495 s = strCopy(cmd);
496 while (*s && isspace(*s)((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int)
_ISspace)
) s++;
497
498 return s;
499}
500
501localstatic void
502bloopComsg(void)
503{
504 FileName file;
505 String fileName;
506 Length lmin, cmin;
507 SrcPos spos = BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->pos;
508 String text = BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->text;
509 CoMsgList notes = BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->notes.noteList;
510
511 file = sposFile(spos);
512 fileName = fnameUnparseStatic(file);
513 lmin = sposLine(spos);
514 cmin = sposChar(spos);
515 sprintf(msg, "(getcomsg %d %d %c%s%c %d %d %c%s%c)\n",
516 bloopCurrIx+1, (int)listLength(CoMsg)(CoMsg_listPointer->_Length)(notes),
517 SESCAPE'\007', fileName, SESCAPE'\007',
518 (int) lmin, (int) cmin, SESCAPE'\007', text, SESCAPE'\007');
519 if (bloopInterface) {
520 fprintf(fout, "%s", msg);
521 fflush(fout);
522 }
523}
524
525localstatic void
526bloopNotes(void)
527{
528 CoMsgList notes = BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->notes.noteList;
529
530 if (BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->tag == COMSG_NOTE) {
531 bloopSendString("ready", "This is a note.");
532 return;
533 }
534 fprintf(fout, "(notes %d ", bloopCurrIx+1);
535 for (notes = listNReverse(CoMsg)(CoMsg_listPointer->NReverse)(notes); notes; notes = cdr(notes)((notes)->rest)) {
536 CoMsg co = car(notes)((notes)->first);
537 if (co && co->notes.noteNumber)
538 fprintf(fout, " %d ", co->notes.noteNumber);
539 }
540 fprintf(fout, ")\n");
541
542 if (bloopInterface) {
543 fprintf(fout, "%s", msg);
544 fflush(fout);
545 }
546}
547
548/*
549 * Grab the next word from buf.
550 */
551char *
552getTok(char **prest)
553{
554 char *s = *prest, *result;
555
556 while (*s && isspace(*s)((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int)
_ISspace)
) s++;
557 result = s;
558
559 if (*s == '\"') {
560 s++;
561 result++;
562 while (*s != '\"') {s++;};
563 }
564 else
565 while (*s && !isspace(*s)((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int)
_ISspace)
) {s++;};
566
567 if (*s) {
568 *s++ = 0;
569 while (*s && isspace(*s)((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int)
_ISspace)
) {s++;};
570 }
571
572 *prest = (*s && !isspace(*s)((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int)
_ISspace)
) ? s : 0;
573
574 return result;
575}
576
577localstatic void
578bloopGetPos(void)
579{
580 FileName fName;
581 SrcPos pmin, pmax;
582 Length glmin, glmax, lmin = 0, cmin = 0, lmax = 0, cmax = 0;
583 String cmd;
584 SrcPos bPos;
585 AbSyn node1, node2, tmpCurr;
586
587 if (!bloopAbCurr) {
588 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
589 return;
590 }
591 else if (bloopInterface)
592 bloopSendString("ready", "\"\"");
593 else if (!bloopInterface) {
594 bloopSendString("msg", "Cannot execute this command!");
595 return;
596 }
597
598 cmd = bloopGetCommand();
599 if (cmd) lmin = atoi(getTok(&cmd));
600 if (cmd) cmin = atoi(getTok(&cmd));
601 if (cmd) lmax = atoi(getTok(&cmd));
602 if (cmd) cmax = atoi(getTok(&cmd));
603 if (*cmd) getTok(&cmd);
604 bPos = abPos(bloopAbCurr)(spstackFirst((bloopAbCurr)->abHdr.pos));
605 fName = sposFile(bPos);
606 glmin = sposGLine(fName, lmin);
607 glmax = sposGLine(fName, lmax);
608 pmin = sposGet(glmin, cmin);
609 node1 = abContainer(bloopAbRoot, pmin);
610 pmax = sposGet(glmax, cmax);
611 node2 = abContainer(bloopAbRoot, pmax);
612
613 tmpCurr = bloopAbCurr;
614 bloopAbCurr = abSupremum(bloopAbRoot, node1, node2, abEqual);
615 if (!bloopAbCurr) {
616 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
617 bloopAbCurr = tmpCurr;
618 return;
619 }
620 else {
621 bloopTmpSet = 1;
622 if (!bloopAbTmp) bloopAbTmp = tmpCurr;
623 bloopResetCurr();
624 bloopSendString("ready", "\"\"");
625 }
626}
627
628localstatic void
629bloopResetCurr(void)
630{
631 int j, len;
632 AIntList p, q;
633 AbSyn node;
634
635 if (!bloopAbRoot) return;
636 BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->node = bloopAbCurr;
637 BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->pos = abPos(bloopAbCurr)(spstackFirst((bloopAbCurr)->abHdr.pos));
638 node = BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->node;
639 if (!node) return;
640
641 p = abPathToNode(bloopAbRoot, node, abEqual, &len, (AIntList) 0);
642 if (len >= 0) {
643 BLOOP_CURR(bloopMsgv[bloopCurrIx])->depth = len;
644 BLOOP_CURR(bloopMsgv[bloopCurrIx])->path = stoAllocVec(len+1, int)((int *) stoAlloc(0, (len+1) * sizeof(int)));
645
646 for (q = p, j = 0; q; q = cdr(q)((q)->rest), j++)
647 BLOOP_CURR(bloopMsgv[bloopCurrIx])->path[j] = car(q)((q)->first);
648 BLOOP_CURR(bloopMsgv[bloopCurrIx])->path[j] = PATH_END(-1);
649 }
650 listFree(AInt)(AInt_listPointer->Free)(p);
651
652 bloopCurrAbDepth = BLOOP_CURR(bloopMsgv[bloopCurrIx])->depth;
653
654 if (BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1) && BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg->tag != COMSG_NOTE) {
655 for (j = 0; j < bloopCurrAbDepth; j++)
656 bloopCurrAbPath[j] = BLOOP_CURR(bloopMsgv[bloopCurrIx])->path[j];
657 bloopCurrAbPath[j] = PATH_END(-1);
658 bloopSetCurr();
659 }
660}
661
662#define DEBUG_NODE_
663
664localstatic void
665bloopPosWhere(void)
666{
667 SrcPos pmin, pmax;
668 Length lmin, cmin, lmax, cmax;
669#ifdef DEBUG_NODE
670 FileName fileName;
671 String fName;
672 SrcPos bloopPos;
673
674 bloopPos = abPos(bloopAbCurr)(spstackFirst((bloopAbCurr)->abHdr.pos));
675 fileName = sposFile(bloopPos);
676 fName = fnameUnparseStatic(fileName);
677 strFree(fName);
678#endif
679 if (!bloopAbCurr) {
680 lmin = cmin = lmax = cmax = -1;
Although the value stored to 'cmax' is used in the enclosing expression, the value is never actually read from 'cmax'
681 sprintf(msg, "(pos \"%d\" \"%d\" \"%d\" \"%d\")\n",
682 -1, -1, -1, -1);
683 }
684 else {
685 abPosSpan(bloopAbCurr, &pmin, &pmax);
686/*
687 pmin = abPos(bloopAbCurr);
688 pmax = abEnd(bloopAbCurr);
689 */
690 lmin = sposLine(pmin);
691 cmin = sposChar(pmin);
692 lmax = sposLine(pmax);
693 cmax = sposChar(pmax);
694 if (lmax < lmin) lmax = lmin;
695 if (cmax < cmin) cmax = cmin;
696 sprintf(msg, "(pos \"%d\" \"%d\" \"%d\" \"%d\")\n",
697 (int) lmin, (int) cmin, (int) lmax, (int) cmax);
698 }
699 if (bloopInterface) {
700 fprintf(fout, "%s", msg);
701 fflush(fout);
702 }
703}
704
705localstatic void
706bloopWhere(void)
707{
708 Length lmin, cmin, lmax, cmax;
709 SrcPos pmin, pmax;
710 FileName file;
711 String fileName;
712 SrcPos bloopPos;
713
714 if (!bloopAbCurr) {
715 bloopPos = sposTop();
716 lmin = cmin = lmax = cmax = -1;
717 }
718 else {
719 bloopPos = abPos(bloopAbCurr)(spstackFirst((bloopAbCurr)->abHdr.pos));
720#ifdef DEBUG_WHERE
721 fprintf(stderrstderr, "\n\t!!!Where %d\n", bloopPos);
722 abPrint(stderrstderr, bloopAbCurr);
723 fprintf(stderrstderr, "\n");
724#endif
725 abPosSpan(bloopAbCurr, &pmin, &pmax);
726 lmin = sposLine(pmin);
727 cmin = sposChar(pmin);
728 lmax = sposLine(pmax);
729 cmax = sposChar(pmax);
730 if (lmax < lmin) lmax = lmin;
731 if (cmax < cmin) cmax = cmin;
732 }
733
734 file = sposFile(bloopPos);
735 if (file)
736 fileName = fnameUnparseStatic(file);
737 else
738 fileName = 0;
739
740 if (fileName)
741 sprintf(msg, "(where \"%s\" %d %d %d %d)\n",
742 fileName, (int) lmin, (int) cmin, (int) lmax, (int) cmax);
743 else
744 sprintf(msg, "(where \"%s\" %d %d %d %d)\n",
745 fileName, -1, -1, -1, -1);
746 if (bloopInterface) {
747 fprintf(fout, "%s", msg);
748 fflush(fout);
749 }
750#ifdef DEBUG_WHERE
751 fprintf(stderrstderr, msg);
752#endif
753}
754
755localstatic void
756bloopNice(void)
757{
758 bloopIsNice = true1;
759 bloopSendString("msg", "nice");
760}
761
762localstatic void
763bloopUgly(void)
764{
765 bloopIsNice = false((int) 0);
766 bloopSendString("msg", "ugly");
767}
768
769localstatic void
770bloopShow(void)
771{
772 if (!bloopAbCurr) {
773 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
774 return;
775 }
776
777 if (bloopInterface) {
778 if (bloopIsNice) {
779 strcpy(msg, abPretty(bloopAbCurr));
780 bloopSendString("msg", msg);
781 }
782 else {
783 fprintf(fout, "(%s %c", "msg", SESCAPE'\007');
784 abWrSExpr(fout, bloopAbCurr, SXRW_Default((1L<<1) | (1L<<3)));
785 fprintf(fout, "%c)\n", SESCAPE'\007');
786 fflush(fout);
787 }
788 }
789 else {
790 int (*p)(FILE *, AbSyn);
791 p = bloopIsNice ? abPrettyPrint : abPrint;
792 p(fout, bloopAbCurr);
793 fprintf(fout, "\n");
794 }
795}
796
797localstatic void
798bloopScope(void)
799{
800 if (!bloopAbCurr) {
801 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
802 return;
803 }
804 if (!bloopStab)
805 bloopSendMsg(ALDOR_M_BreakMsgNoStab284);
806 else {
807 if (bloopInterface) {
808 fprintf(fout, "(msg \"");
809 bloopStabPretty();
810 fprintf(fout, "\")\n");
811 fflush(fout);
812 }
813 else
814 stabPrint(fout, bloopStab);
815 }
816}
817
818
819localstatic void
820bloopMsg(void)
821{
822 if (bloopInterface) return;
823 comsgReportOne(fout, BLOOP_CURR(bloopMsgv[bloopCurrIx])->comsg);
824}
825
826localstatic void
827bloopSeman(void)
828{
829 char str[MAX_STR8000];
830
831 if (!bloopAbCurr) {
832 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
833 return;
834 }
835 if (abComment(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->comment : 0)
) {
836 sprintf(str, "Documentation: ++%s\n",
837 docString(abComment(bloopAbCurr))((((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->comment : 0))->corpus)
);
838 if (bloopInterface)
839 strncat(msg, str, strlen(str));
840 else
841 bloopSendString("msg", str);
842 }
843 if (abSyme(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->syme : 0)
) {
844 sprintf(str, "Symbol meaning: %s\n",
845 symePretty(abSyme(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->syme : 0)
));
846 if (bloopInterface)
847 strncat(msg, str, strlen(str));
848 else
849 bloopSendString("msg", str);
850 }
851 if (abTForm(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->tform : 0)
) {
852 sprintf(str, "Type form: %s\n",
853 tfPretty(abTForm(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->tform : 0)
));
854 if (bloopInterface)
855 strncat(msg, str, strlen(str));
856 else
857 bloopSendString("msg", str);
858 }
859 if (abImplicit(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->implicit : 0)
) {
860 sprintf(str, "Implicit operator: %s\n",
861 abPretty(abImplicit(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->implicit : 0)
));
862 if (bloopInterface)
863 strncat(msg, str, strlen(str));
864 else
865 bloopSendString("msg", str);
866 }
867 if (abTContext(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->embed : 0)
) {
868 sprintf(msg, "Embedding map: %ld\n",
869 abTContext(bloopAbCurr)((bloopAbCurr)->abHdr.seman ? (bloopAbCurr)->abHdr.seman
->embed : 0)
);
870 if (bloopInterface)
871 strncat(msg, str, strlen(str));
872 else
873 bloopSendString("msg", str);
874 }
875 if (bloopInterface)
876 bloopSendString("msg", msg);
877}
878
879localstatic void
880bloopUse(void)
881{
882 String s;
883
884 if (!bloopAbCurr) {
885 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
886 return;
887 }
888
889 switch (abUse(bloopAbCurr)((bloopAbCurr)->abHdr.use)) {
890 case AB_Use_Declaration:s = "Declaration"; break;
891 case AB_Use_Type: s = "Type"; break;
892 case AB_Use_Label: s = "Label"; break;
893 case AB_Use_Assign: s = "Assign"; break;
894 case AB_Use_Define: s = "Define"; break;
895 case AB_Use_Value: s = "Value"; break;
896 case AB_Use_RetValue: s = "RetValue"; break;
897 case AB_Use_NoValue: s = "NoValue"; break;
898 case AB_Use_Iterator: s = "Iterator"; break;
899 case AB_Use_LIMIT: s = "No use info"; break;
900 default:
901 bloopSendMsg(ALDOR_M_BreakMsgBadNode282);
902 s = 0;
903 break;
904 }
905 if (s) {
906 sprintf(msg, comsgString(ALDOR_M_BreakMsgUsedContext293), s);
907 bloopSendString("msg", msg);
908 }
909}
910
911localstatic void
912bloopMeans(void)
913{
914 SymeList ml;
915 int i;
916
917 if (!bloopAbCurr) {
918 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
919 return;
920 }
921
922 if (abTag(bloopAbCurr)((bloopAbCurr)->abHdr.tag) == AB_Id) {
923 if (!bloopStab) {
924 bloopSendMsg(ALDOR_M_BreakMsgNoStab284);
925 return;
926 }
927
928 ml = stabGetMeanings(bloopStab, NULL((void*)0), bloopAbCurr->abId.sym);
929 for (i = 1; ml; ml = cdr(ml)((ml)->rest), i++) {
930 char str[MAX_MSG50000];
931 if (i == 1)
932 sprintf(msg, "%d: %s\n", i,
933 symePretty(car(ml)((ml)->first)));
934 else {
935 sprintf(str, "%d: %s\n", i,
936 symePretty(car(ml)((ml)->first)));
937 strncat(msg, str, strlen(str));
938 }
939 }
940 bloopSendString("msg", msg);
941 }
942 else {
943 int (*p)(FILE *, TForm);
944 p = bloopIsNice ? tfPrettyPrint : tfPrint;
945
946 if (!bloopAbCurr) {
947 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
948 return;
949 }
950
951 switch (abState(bloopAbCurr)((bloopAbCurr)->abHdr.state)) {
952 case AB_State_AbSyn:
953 bloopSendMsg(ALDOR_M_BreakMsgNoTypeInfo285);
954 break;
955 case AB_State_Error: {
956 char str[MAX_MSG50000];
957 if (bloopInterface) {
958 sprintf(msg, comsgString(ALDOR_M_BreakMsgNTypes291), NULL((void*)0));
959 sprintf(str, "\n");
960 strcat(msg, str);
961 bloopSendString("msg", msg);
962 }
963 else
964 fprintf(fout, comsgString(ALDOR_M_BreakMsgNTypes291), NULL((void*)0));
965
966 break;
967 }
968 case AB_State_HasPoss: {
969 TPoss tp;
970 TPossIterator ti;
971 int i, n;
972 char str[MAX_MSG50000];
973
974 tp = abTPoss(bloopAbCurr)((bloopAbCurr)->abHdr.type.poss);
975 n = tpossCount(tp);
976
977 if (bloopInterface) {
978 sprintf(msg, comsgString(ALDOR_M_BreakMsgNTypes291), n);
979 sprintf(str, "\n");
980 strcat(msg, str);
981 }
982 else
983 fprintf(fout, comsgString(ALDOR_M_BreakMsgNTypes291), n);
984 for (tpossITER(ti,tp)((ti).possl = (tp ? (tp)->possl : ((void*)0))),i=1; tpossMORE(ti)((ti).possl); tpossSTEP(ti)((ti).possl = (((ti).possl)->rest)),i++) {
985 if (bloopInterface) {
986 sprintf(str, "%d: ", i);
987 strcat(msg, str);
988 if (bloopIsNice)
989 sprintf(str, "%s\n",
990 tfPretty(tpossELT(ti)tpossELT_(&ti)));
991 else
992 sprintf(str, "%s\n",
993 tfPretty(tpossELT(ti)tpossELT_(&ti)));
994 strcat(msg, str);
995 }
996 else {
997 fprintf(fout, comsgString(ALDOR_M_BreakMsgNTypes291), n);
998 fprintf(fout, "%d: ", i);
999 p(fout, tpossELT(ti)tpossELT_(&ti));
1000 fprintf(fout, "\n");
1001 }
1002 }
1003 if (bloopInterface)
1004 bloopSendString("msg", msg);
1005 break;
1006 }
1007 case AB_State_HasUnique:
1008 if (bloopInterface) {
1009 strcpy(msg, comsgString(ALDOR_M_BreakMsg1Type292));
1010 if (bloopIsNice)
1011 strcat(msg, tfPretty(abTUnique(bloopAbCurr)((bloopAbCurr)->abHdr.type.unique)));
1012 else
1013 strcat(msg, tfPretty(abTUnique(bloopAbCurr)((bloopAbCurr)->abHdr.type.unique)));
1014 strcat(msg, "\n");
1015 bloopSendString("msg", msg);
1016 }
1017 else {
1018 fprintf(fout, "%s", comsgString(ALDOR_M_BreakMsg1Type292));
1019 p(fout, abTUnique(bloopAbCurr)((bloopAbCurr)->abHdr.type.unique));
1020 fprintf(fout, "\n");
1021 }
1022 break;
1023 default:
1024 bloopSendMsg(ALDOR_M_BreakMsgBadNode282);
1025 break;
1026 }
1027 }
1028}
1029
1030localstatic void
1031bloopHome(void)
1032{
1033 int i;
1034
1035 if (!BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1) || !bloopAbCurr) {
1036 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
1037 return;
1038 }
1039
1040 if (bloopTmpSet) {
1041 bloopAbCurr = bloopAbTmp;
1042 bloopAbTmp = 0;
1043 bloopTmpSet = 0;
1044 bloopResetCurr();
1045 }
1046
1047 for (i = 0; BLOOP_CURR(bloopMsgv[bloopCurrIx])->path[i] != PATH_END(-1); i++)
1048 bloopCurrAbPath[i] = BLOOP_CURR(bloopMsgv[bloopCurrIx])->path[i];
1049 bloopCurrAbPath[i] = PATH_END(-1);
1050 bloopCurrAbDepth = BLOOP_CURR(bloopMsgv[bloopCurrIx])->depth;
1051
1052 bloopSetCurr();
1053 if (!bloopInterface)
1054 bloopShow();
1055 else
1056 bloopSendString("ready", "\"\"");
1057}
1058
1059localstatic void
1060bloopUp(void)
1061{
1062 if (!bloopAbCurr) {
1063 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
1064 return;
1065 }
1066 if (!BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1) || bloopAbParent == 0) {
1067 bloopSendMsg(ALDOR_M_BreakMsgAtTop286);
1068 return;
1069 }
1070
1071 bloopCurrAbDepth--;
1072 bloopCurrAbPath[bloopCurrAbDepth] = PATH_END(-1);
1073
1074 bloopSetCurr();
1075 if (abTag(bloopAbCurr)((bloopAbCurr)->abHdr.tag) == AB_Nothing) bloopUp();
1076 if (!bloopInterface)
1077 bloopShow();
1078 else
1079 bloopSendString("ready", "\"\"");
1080}
1081
1082localstatic void
1083bloopDown(void)
1084{
1085 if (!bloopAbCurr) {
1086 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
1087 return;
1088 }
1089 if (!BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1) || abIsLeaf(bloopAbCurr)(((bloopAbCurr)->abHdr.tag) < AB_NODE_START)) {
1090 bloopSendMsg(ALDOR_M_BreakMsgAtLeaf287);
1091 return;
1092 }
1093
1094 bloopCurrAbDepth++;
1095 bloopCurrAbPath[bloopCurrAbDepth-1] = 0;
1096 bloopCurrAbPath[bloopCurrAbDepth] = PATH_END(-1);
1097
1098 bloopSetCurr();
1099 if (abTag(bloopAbCurr)((bloopAbCurr)->abHdr.tag) == AB_Nothing) bloopHome();
1100 if (!bloopInterface)
1101 bloopShow();
1102 else
1103 bloopSendString("ready", "\"\"");
1104}
1105
1106localstatic void
1107bloopPrev(void)
1108{
1109 if (!bloopAbCurr) {
1110 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
1111 return;
1112 }
1113 if (!BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1)) {
1114 bloopSendMsg(ALDOR_M_BreakMsgNoPrev288);
1115 return;
1116 }
1117 if (bloopAbParent == 0) {
1118 bloopSendMsg(ALDOR_M_BreakMsgAtTop286);
1119 return;
1120 }
1121
1122 if (bloopCurrAbPath[bloopCurrAbDepth-1] == 0) {
1123 bloopSendMsg(ALDOR_M_BreakMsgNoPrev288);
1124 return;
1125 }
1126
1127 bloopCurrAbPath[bloopCurrAbDepth-1]--;
1128 bloopSetCurr();
1129 if (abTag(bloopAbCurr)((bloopAbCurr)->abHdr.tag) == AB_Nothing) bloopPrev(); /* should be a while loop*/
1130 if (!bloopInterface)
1131 bloopShow();
1132 else
1133 bloopSendString("ready", "\"\"");
1134}
1135
1136localstatic void
1137bloopNext(void)
1138{
1139 if (!bloopAbCurr) {
1140 bloopSendMsg(ALDOR_M_BreakMsgNoNode283);
1141 return;
1142 }
1143 if (!BLOOP_NODE((bloopMsgv[bloopCurrIx])->depth != -1)) {
1144 bloopSendMsg(ALDOR_M_BreakMsgNoNext289);
1145 return;
1146 }
1147 if (bloopAbParent == 0) {
1148 bloopSendMsg(ALDOR_M_BreakMsgAtTop286);
1149 return;
1150 }
1151
1152 if (bloopCurrAbPath[bloopCurrAbDepth-1] == abArgc(bloopAbParent)((bloopAbParent)->abHdr.argc)-1) {
1153 bloopSendMsg(ALDOR_M_BreakMsgNoNext289);
1154 return;
1155 }
1156
1157 bloopCurrAbPath[bloopCurrAbDepth-1]++;
1158 bloopSetCurr();
1159 if (abTag(bloopAbCurr)((bloopAbCurr)->abHdr.tag) == AB_Nothing) bloopNext(); /* should be a while loop*/
1160 if (!bloopInterface)
1161 bloopShow();
1162 else
1163 bloopSendString("ready", "\"\"");
1164}
1165
1166localstatic void
1167bloopStabPretty(void)
1168{
1169 char str[MAX_STR8000];
1170 int ts, minlev = 0;
1171 int c, count = 0;
1172 StabLevel slev;
1173
1174 for (; bloopStab && count < MAX_MSG50000-10; bloopStab = cdr(bloopStab)((bloopStab)->rest)) {
1175 slev = car(bloopStab)((bloopStab)->first);
1176 if (slev->lexicalLevel < minlev)
1177 break;
1178 fprintf(fout, "\n");
1179 count += 1;
1180 sprintf(str, "Symbol Table Level %ld , %s, (serial %ld), ",
1181 slev->lexicalLevel,
1182 slev->tformsUsed.table ? "LARGE" :
1183 "SMALL", slev->serialNo);
1184 fprintf(fout, "%s", str);
1185 count += strlen(str);
1186 fprintf(fout, " %d symbols.\n", ts = tblSize(slev->tbl));
1187 if (ts) {
1188 Table t = slev->tbl;
1189 struct TblSlot *b;
1190 int i;
1191
1192 fprintf(fout, "\n");
1193 count += 1;
1194 for (i = 0; i < t->buckc; i++) {
1195 for (b = t->buckv[i]; b;
1196 b = b->next) {
1197 StabEntry stent = (StabEntry) b->elt;
1198 SymeList symes = stent->symev[0];
1199
1200 for (c = 0; symes && c < MAX_STR8000; symes = cdr(symes)((symes)->rest)) {
1201 sprintf(str, "%s", symePretty(car(symes)((symes)->first)));
1202 c += strlen(str);
1203 fprintf(fout, "%s", str);
1204 if (cdr(symes)((symes)->rest))
1205 fprintf(fout, "\n");
1206 }
1207 fprintf(fout, "\n");
1208 count += c + 1;
1209 }
1210 }
1211 }
1212 fprintf(fout, "\n");
1213 count += 1;
1214
1215 if (slev->tformsUnused) {
1216 TFormList tfl;
1217
1218 fprintf(fout, "Type forms registered but not used: \n");
1219 for (c = 0, tfl = slev->tformsUnused; tfl && c < MAX_STR8000; tfl = cdr(tfl)((tfl)->rest)) {
1220 sprintf(str, "%s\n",
1221 tfPretty(car(tfl)((tfl)->first)));
1222 c += strlen(str);
1223 fprintf(fout, "%s", str);
1224 }
1225 fprintf(fout, "\n");
1226 count += c + 1;
1227 }
1228
1229 sprintf(str, "All type forms used: \n");
1230 fprintf(fout, "%s", str);
1231 count += strlen(str);
1232
1233 if (!slev->tformsUsed.list) {
1234 sprintf(str, "NONE");
1235 fprintf(fout, "%s", str);
1236 count += strlen(str);
1237 }
1238 else {
1239 TFormUsesList tful = slev->tformsUsed.list;
1240 c = 0;
1241 while (tful && c < MAX_STR8000) {
1242 TFormUses tfu = car(tful)((tful)->first);
1243 tful = cdr(tful)((tful)->rest);
1244 c += tfuPrint(fout, tfu);
1245 }
1246 count += c;
1247 }
1248 fprintf(fout, "\n");
1249 count += 1;
1250
1251 if (slev->labelsInScope) {
1252 AbSynList asl = slev->labelsInScope;
1253 fprintf(fout, "Labels in this scope: ");
1254 c = 0;
1255 while (asl && c < MAX_STR8000) {
1256 sprintf(str, "%s", abPretty(car(asl)((asl)->first)));
1257 c += strlen(str);
1258 fprintf(fout, "%s", str);
1259 asl = cdr(asl)((asl)->rest);
1260 asl ? fprintf(fout,", ") : fprintf(fout,"\n");
1261 }
1262 fprintf(fout, "\n");
1263 count += c + 1;
1264 }
1265
1266 if (slev->boundSymes) {
1267 SymeList sl = slev->boundSymes;
1268 sprintf(str, "Bound symbol meanings: \n");
1269 fprintf(fout, "%s", str);
1270 count += strlen(str);
1271 c = 0;
1272 while (sl && c < MAX_STR8000) {
1273 sprintf(str, "%s", symePretty(car(sl)((sl)->first)));
1274 c += strlen(str);
1275 fprintf(fout, "%s", str);
1276 sl = cdr(sl)((sl)->rest);
1277 if (sl) fprintf(fout, "\n");
1278 }
1279 count += c;
1280 }
1281 fprintf(fout, "\n");
1282 count += 1;
1283 }
1284}