Wild Life: print.c Source File

Wild Life 2.30

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Macros
print.c
Go to the documentation of this file.
1
6 /* Copyright 1991 Digital Equipment Corporation.
7 ** All Rights Reserved.
8 *****************************************************************/
9
10 #include "defs.h"
11
12 long print_depth=PRINT_DEPTH;
13 long indent=FALSE;
14 long const_quote=TRUE;
15 long write_resids=FALSE;
16 long write_canon=FALSE;
17 long write_stderr=FALSE;
18 long write_corefs=TRUE;
19
20 long page_width=PAGE_WIDTH;
21
22 long display_persistent=FALSE;
23
24 char *no_name="pointer";
25 char *name="symbol";
26 // char *buffer;
27 char seg_format[PRINT_POWER+4];
28
29 item pretty_things[PRETTY_SIZE];
30
31 /* Used to distinguish listings from other writes */
32 static long listing_flag;
33
34 /* Used to list function bodies in a nice way */
35 /* Only valid if listing_flag==TRUE */
36 static long func_flag;
37
38 /* Precedence of the comma and colon operators (or 0 if none exists) */
39 #define COMMA_PREC ((commasym->op_data)?(commasym->op_data->precedence):0)
40 #define COLON_PREC ((colonsym->op_data)?(colonsym->op_data->precedence):0)
41
42
43
52 void init_print()
53 {
54 (void)snprintf(seg_format,PRINT_POWER+4,"%%0%ldd",PRINT_POWER);
55 }
56
63 char * heap_nice_name()
64 {
65 string tmp1,tmp2;
66 char g,len; // ,leading_a;
67
68 g= ++gen_sym_counter;
69 len=2;
70 strcpy(tmp2,"");
71 do {
72 g--;
73 /* Prefix one character to tmp2: */
74 (void)snprintf(tmp1,2,"%c",g%26+'A');
75 strcat(tmp1,tmp2);
76 strcpy(tmp2,tmp1);
77 g=g/26;
78 len++;
79 } while (g>0 && len<STRLEN);
80 if (len>=STRLEN)
81 perr("Variable name too long -- the universe has ceased to exist.");
82
83 strcpy(tmp1,"_");
84 strcat(tmp1,tmp2);
85
86 return heap_copy_string(tmp1);
87 }
88
99 GENERIC unique_name()
100 {
101 GENERIC name_loc;
102
103 do name_loc=(GENERIC)heap_nice_name();
104 while (find(STRCMP,(char *)name_loc,var_tree));
105
106 return name_loc;
107 }
108
118 long str_to_int(char *s)
119 {
120 long v=0;
121 char c;
122
123 c=(*s);
124 if (c==0)
125 v= -1;
126 else {
127 while (DIGIT(c)) {
128 v=v*10+(c-'0');
129 s++;
130 c=(*s);
131 }
132 if (c!=0) v= -1;
133 }
134
135 return v;
136 }
137
147 void print_bin(long b)
148 {
149 long p;
150
151 for (p=INT_SIZE;p--;p>0)
152 {
153 fprintf(outfile,(b&1?"X":" "));
154 b = b>>1;
155 }
156 }
157
167 void print_code(FILE *s,ptr_int_list c)
168 {
169 outfile=s;
170
171 if (c==NOT_CODED)
172 fprintf(outfile," (not coded) ");
173 else {
174 fprintf(outfile," [");
175 while (c) {
176 print_bin((long)c->value_1);
177 c=c->next;
178 }
179 fprintf(outfile,"]");
180 }
181 }
182
192 void print_operator_kind(FILE *s,long kind)
193 {
194 switch (kind) {
195 case xf:
196 fprintf(s,"xf");
197 break;
198 case fx:
199 fprintf(s,"fx");
200 break;
201 case yf:
202 fprintf(s,"yf");
203 break;
204 case fy:
205 fprintf(s,"fy");
206 break;
207 case xfx:
208 fprintf(s,"xfx");
209 break;
210 case xfy:
211 fprintf(s,"xfy");
212 break;
213 case yfx:
214 fprintf(s,"yfx");
215 break;
216 default:
217 fprintf(s,"illegal");
218 break;
219 }
220 }
221
233 void check_pointer(ptr_psi_term p)
234 {
235 ptr_node n;
236
237 if (p) {
238 deref_ptr(p);
239 n=find(INTCMP,(char *)p,pointer_names);
240 if (n==NULL) {
241 (void)heap_insert(INTCMP,(char *)p,&pointer_names,(GENERIC)NULL);
242 go_through(p);
243 }
244 else
245 n->data=(GENERIC)no_name;
246 }
247 }
248
258 void go_through_tree(ptr_node t)
259 {
260 if (t) {
261 if (t->left) {
262 go_through_tree(t->left);
263 }
264 check_pointer((ptr_psi_term)t->data);
265 if (t->right) {
266 go_through_tree(t->right);
267 }
268 }
269
270 }
271
282 void go_through(ptr_psi_term t)
283 {
284 if (t->attr_list)
285 go_through_tree(t->attr_list);
286
287 /*
288 if(r=t->resid)
289 while(r) {
290 if(r->goal->pending)
291 go_through(r->goal->aaaa_1);
292 r=r->next;
293 } */
294 }
295
308 void insert_variables(ptr_node vars,long force)
309 {
310 ptr_psi_term p;
311 ptr_node n;
312
313 if(vars) {
314 insert_variables(vars->right,force);
315 p=(ptr_psi_term )vars->data;
316 deref_ptr(p);
317 n=find(INTCMP,(char *)p,pointer_names);
318 if (n)
319 if (n->data || force)
320 n->data=(GENERIC)vars->key;
321 insert_variables(vars->left,force);
322 }
323 }
324
334 void forbid_variables(ptr_node n)
335 {
336 ptr_psi_term v;
337
338 if(n) {
339 forbid_variables(n->right);
340 v=(ptr_psi_term )n->data;
341 deref_ptr(v);
342 (void)heap_insert(INTCMP,(char *)v,&printed_pointers,(GENERIC)n->key);
343 forbid_variables(n->left);
344 }
345 }
346
374 void prettyf_inner(char *s,long q,char c)
375 {
376 char *sb=buffer;
377
378 if (indent) {
379 while (*sb) sb++;
380 if (q) { *sb = c; sb++; }
381 while (*s) {
382 if (q && *s==c) { *sb = *s; sb++; }
383 *sb = *s; sb++; s++;
384 }
385 if (q) { *sb = c; sb++; }
386 *sb=0;
387 }
388 else {
389 if (q) (void)putc(c,outfile);
390 while (*s) {
391 if (q && *s==c) { (void)putc(*s,outfile); }
392 (void)putc(*s,outfile);
393 s++;
394 }
395 if (q) (void)putc(c,outfile);
396 }
397 }
398
406 long starts_nonlower(char *s)
407 {
408 return (*s && !LOWER(s[0]));
409 }
410
418 long has_non_alpha(char *s)
419 {
420 while (*s) {
421 if (!ISALPHA(*s)) return TRUE;
422 s++;
423 }
424 return FALSE;
425 }
426
434 long all_symbol(char *s)
435 {
436 while (*s) {
437 if (!SYMBOL(*s)) return FALSE;
438 s++;
439 }
440 return TRUE;
441 }
442
450 long is_integer(char *s)
451 {
452 if (!*s) return FALSE;
453 if (*s=='-') s++;
454 while (*s) {
455 if (!DIGIT(*s)) return FALSE;
456 s++;
457 }
458 return TRUE;
459 }
460
470 long no_quote(char *s)
471 {
472 if (!s[0]) return FALSE;
473
474 if (s[0]=='%') return FALSE;
475 if (SINGLE(s[0]) && s[1]==0) return TRUE;
476 if (s[0]=='_' && s[1]==0) return FALSE;
477 if (all_symbol(s)) return TRUE;
478
479 if (!LOWER(s[0])) return FALSE;
480 s++;
481 while (*s) {
482 if (!ISALPHA(*s)) return FALSE;
483 s++;
484 }
485 return TRUE;
486 }
487
496 void prettyf(char *s)
497 {
498 prettyf_inner(s,FALSE,'\'');
499 }
500
507 void prettyf_quoted_string(char *s)
508 {
509 prettyf_inner((char *)s,const_quote,'"');
510 }
511
529 void prettyf_quote(char *s)
530 {
531 prettyf_inner(s, const_quote && !no_quote(s), '\'');
532 }
533 /*
534 !is_integer(s) &&
535 (starts_nonlower(s) || has_non_alpha(s)) &&
536 ((int)strlen(s)>1
537 ? !all_symbol(s):
538 ((int)strlen(s)==1
539 ? (s[0]==' ' || s[0]=='_' || UPPER(s[0]) || DIGIT(s[0]))
540 : TRUE
541 )
542 ),
543 '\'');
544 */
545
554 void end_tab()
555 {
556 if (indent) {
557 indx->str=(char *)heap_alloc(strlen(buffer)+1);
558 strcpy(indx->str,buffer);
559 indx++;
560 *buffer=0;
561 }
562 }
563
573 void mark_tab(ptr_tab_brk t)
574 {
575 end_tab();
576 indx->tab=t;
577 }
578
587 void new_tab(ptr_tab_brk *t)
588 {
589 (*t)=HEAP_ALLOC(tab_brk);
590 (*t)->broken=FALSE;
591 (*t)->printed=FALSE;
592 (*t)->column=0;
593 }
594
595
608 long strpos(long pos, char *str)
609 {
610 while (*str) {
611 if (str[0]=='\n') pos=0; else pos++;
612 str++;
613 }
614 return pos;
615 }
616
626 void work_out_length()
627 {
628 ptr_item i;
629 long done=FALSE;
630 long pos;
631 ptr_tab_brk worst,root;
632 long w;
633
634 while(!done) {
635
636 pos=0;
637 done=TRUE;
638
639 w= -1;
640 worst=NULL;
641 root=NULL;
642
643 for(i=pretty_things+1;(unsigned long)i<(unsigned long)indx;i++) {
644
645 if(i->tab->broken && i->tab->printed) {
646 pos=i->tab->column;
647 root=NULL;
648 }
649
650 if(!i->tab->printed) i->tab->column=pos;
651
652 if(!(i->tab->broken))
653 if(!root || (root && (root->column)>=(i->tab->column)))
654 root=i->tab;
655
656 /* pos=pos+strlen(i->str); */
657 pos=strpos(pos,i->str);
658 i->tab->printed=TRUE;
659
660 if(pos>page_width)
661 done=FALSE;
662
663 if(pos>w) {
664 w=pos;
665 worst=root;
666 }
667 }
668
669 for(i=pretty_things+1;(unsigned long)i<(unsigned long)indx;i++)
670 i->tab->printed=FALSE;
671
672 if(!done)
673 if(worst)
674 worst->broken=TRUE;
675 else
676 done=TRUE;
677 }
678 }
679
680 /*** RM: Dec 11 1992 (START) ***/
681
690 long count_features(ptr_node t)
691 {
692 long c=0;
693 if(t) {
694 if(t->left)
695 c+=count_features(t->left);
696 c++;
697 if(t->right)
698 c+=count_features(t->right);
699 }
700 return c;
701 }
702
713 long check_legal_cons(ptr_psi_term t,ptr_definition t_type)
714 {
715 return (t->type==t_type &&
716 count_features(t->attr_list)==2 &&
717 find(FEATCMP,one,t->attr_list) &&
718 find(FEATCMP,two,t->attr_list));
719 }
720
721 /*** RM: Dec 11 1992 (END) ***/
722
734 void pretty_list(ptr_psi_term t,long depth)
735 {
736 ptr_tab_brk new;
737 ptr_definition t_type;
738 ptr_psi_term car,cdr;
739 ptr_node n;
740 char sep[4],end[3];
741 long list_depth; /* 20.8 */
742 long done=FALSE; /* RM: Dec 11 1992 */
743
744 strcpy(sep,"ab");
745 strcpy(end,"cd");
746 t_type=t->type;
747
748 if (overlap_type(t_type,alist)) {
749 if (!equal_types(t_type,alist)) {
750 pretty_symbol(t_type->keyword); /* RM: Jan 13 1993 */
751 prettyf(DOTDOT);
752 }
753 prettyf("[");
754 strcpy(sep,",");
755 strcpy(end,"]");
756 }
757
758 /*
759 else if (equal_types(t_type,conjunction)) {
760 prettyf("(");
761 strcpy(sep,DOTDOT);
762 strcpy(end,")");
763 }
764 */
765
766 else if (equal_types(t_type,disjunction)) {
767 prettyf("{");
768 strcpy(sep,";");
769 strcpy(end,"}");
770 }
771
772
773 /* RM: Dec 11 1992 New code for printing lists */
774
775 new_tab(&new);
776 list_depth=0; /* 20.8 */
777 while(!done) {
778 mark_tab(new);
779 if(list_depth==print_depth)
780 prettyf("...");
781
782 get_two_args(t->attr_list,&car,&cdr);
783 deref_ptr(car);
784 deref_ptr(cdr);
785
786
787 if(list_depth<print_depth)
788 pretty_tag_or_psi_term(car,COMMA_PREC,depth);
789
790 /* Determine how to print the CDR */
791 n=find(INTCMP,(char *)cdr,pointer_names);
792
793 if(n && n->data) {
794 prettyf("|");
795 pretty_tag_or_psi_term(cdr,MAX_PRECEDENCE+1,depth);
796 done=TRUE;
797 }
798 else
799 if(( /* RM: Feb 1 1993 */
800 (cdr->type==nil && overlap_type(t_type,alist)) ||
801 (cdr->type==disj_nil && t_type==disjunction)
802 )
803 && !cdr->attr_list)
804 done=TRUE;
805 else
806 if(!check_legal_cons(cdr,t_type)) {
807 prettyf("|");
808 pretty_tag_or_psi_term(cdr,MAX_PRECEDENCE+1,depth);
809 done=TRUE;
810 }
811 else {
812 if(list_depth<print_depth)
813 prettyf(sep);
814 t=cdr;
815 }
816
817 list_depth++;
818 }
819
820 prettyf(end);
821 }
822
834 void pretty_tag_or_psi_term(ptr_psi_term p, long sprec, long depth)
835 {
836 ptr_node n,n2;
837
838 if (p==NULL) {
839 prettyf("<VOID>");
840 return;
841 }
842 if (FALSE /*depth>=print_depth*/) { /* 20.8 */
843 prettyf("...");
844 return;
845 }
846 deref_ptr(p);
847
848 n=find(INTCMP,(char *)p,pointer_names);
849
850 if (n && n->data) {
851 if (n->data==(GENERIC)no_name) {
852 n->data=(GENERIC)unique_name();
853 /* sprintf(name,"_%ld%c",++gen_sym_counter,0); */
854 /* n->data=(GENERIC)heap_copy_string(name); */
855 }
856 n2=find(INTCMP,(char *)p,printed_pointers);
857 if(n2==NULL) {
858 prettyf((char *)n->data);
859 (void)heap_insert(INTCMP,(char *)p,&printed_pointers,(GENERIC)n->data);
860 if (!is_top(p)) {
861 prettyf(DOTDOT);
862 pretty_psi_term(p,COLON_PREC,depth);
863 }
864 }
865 else
866 prettyf((char *)n2->data);
867 }
868 else
869 pretty_psi_term(p,sprec,depth);
870 }
871
887 long check_opargs(ptr_node n)
888 {
889 if (n) {
890 long f=check_opargs(n->left) | check_opargs(n->right);
891 if (!featcmp(n->key,"1")) return 1 | f;
892 if (!featcmp(n->key,"2")) return 2 | f;
893 return 4 | f;
894 }
895 else
896 return 0;
897 }
898
899
913 long opcheck(ptr_psi_term t, long *prec, long *type)
914 {
915 long op;
916 long result=NOTOP;
917 long numarg=check_opargs(t->attr_list);
918 ptr_operator_data opdat=t->type->op_data;
919
920 *prec=0;
921 if (numarg!=1 && numarg!=3) return NOTOP;
922 while (opdat) {
923 op=opdat->type;
924 if (numarg==1) {
925 if (op==xf || op==yf) { result=POSTFIX; break; }
926 if (op==fx || op==fy) { result=PREFIX; break; }
927 }
928 if (numarg==3)
929 if (op==xfx || op==xfy || op==yfx) { result=INFIX; break; }
930 opdat=opdat->next;
931 }
932 if (opdat==NULL) return NOTOP;
933 *prec=opdat->precedence;
934 *type=op;
935 return result;
936 }
937
949 long pretty_psi_with_ops(ptr_psi_term t,long sprec,long depth)
950 {
951 // ptr_tab_brk new;
952 ptr_psi_term arg1, arg2;
953 long ttype, a1type, a2type;
954 long tprec, a1prec, a2prec;
955 long tkind, a1kind, a2kind;
956 long p1, p2, argswritten;
957 long sp; /* surrounding parentheses */
958
959 if (write_canon) return FALSE; /* PVR 24.2.94 */
960
961 argswritten=TRUE;
962 tkind=opcheck(t, &tprec, &ttype);
963 sp=(tkind==INFIX||tkind==PREFIX||tkind==POSTFIX) && tprec>=sprec;
964 if (sp) prettyf("(");
965 if (tkind==INFIX) {
966 get_two_args(t->attr_list, &arg1, &arg2);
967 deref_ptr(arg1); /* 16.9 */
968 deref_ptr(arg2); /* 16.9 */
969 a1kind = opcheck(arg1, &a1prec, &a1type);
970 a2kind = opcheck(arg2, &a2prec, &a2type);
971
972 /* The p1 and p2 flags tell whether to put parens around t's args */
973 /* Calculate p1 flag: */
974 if (a1prec>tprec) p1=TRUE;
975 else if (a1prec<tprec) p1=FALSE;
976 else /* equal priority */
977 if (ttype==xfy || ttype==xfx) p1=TRUE;
978 else /* yfx */
979 if (a1type==yfx || a1type==fx || a1type==fy) p1=FALSE;
980 else p1=TRUE;
981
982 /* Calculate p2 flag: */
983 if (a2prec>tprec) p2=TRUE;
984 else if (a2prec<tprec) p2=FALSE;
985 else /* equal priority */
986 if (ttype==yfx || ttype==xfx) p2=TRUE;
987 else /* xfy */
988 if (a2type==xfy || a2type==xf || a2type==yf) p2=FALSE;
989 else p2=TRUE;
990
991 /* Write the expression */
992 if (p1) prettyf("(");
993 pretty_tag_or_psi_term(arg1,MAX_PRECEDENCE+1,depth);
994 if (p1) prettyf(")");
995 if (!p1 && strcmp(t->type->keyword->symbol,",")) {
996 prettyf(" ");
997 }
998 pretty_quote_symbol(t->type->keyword); /* RM: Jan 13 1993 */
999 if (listing_flag && !func_flag &&
1000 (!strcmp(t->type->keyword->symbol,",") ||
1001 !strcmp(t->type->keyword->symbol,":-"))) {
1002 prettyf("\n ");
1003 }
1004 else {
1005 if (!p2 && strcmp(t->type->keyword->symbol,".")) prettyf(" ");
1006 }
1007 if (p2) prettyf("(");
1008 pretty_tag_or_psi_term(arg2,MAX_PRECEDENCE+1,depth);
1009 if (p2) prettyf(")");
1010 }
1011 else if (tkind==PREFIX) {
1012 get_two_args(t->attr_list, &arg1, &arg2); /* arg2 does not exist */
1013 a1kind = opcheck(arg1, &a1prec, &a1type);
1014
1015 /* Calculate p1 flag: */
1016 if (a1type==fx || a1type==fy) p1=FALSE;
1017 else p1=(tprec<=a1prec);
1018
1019 pretty_quote_symbol(t->type->keyword); /* RM: Jan 13 1993 */
1020 if (!p1) prettyf(" ");
1021 if (p1) prettyf("(");
1022 pretty_tag_or_psi_term(arg1,MAX_PRECEDENCE+1,depth);
1023 if (p1) prettyf(")");
1024 }
1025 else if (tkind==POSTFIX) {
1026 get_two_args(t->attr_list, &arg1, &arg2); /* arg2 does not exist */
1027 a1kind = opcheck(arg1, &a1prec, &a1type);
1028
1029 /* Calculate p1 flag: */
1030 if (a1type==xf || a1type==yf) p1=FALSE;
1031 else p1=(tprec<=a1prec);
1032
1033 if (p1) prettyf("(");
1034 pretty_tag_or_psi_term(arg1,MAX_PRECEDENCE+1,depth);
1035 if (p1) prettyf(")");
1036 if (!p1) prettyf(" ");
1037 pretty_quote_symbol(t->type->keyword); /* RM: Jan 13 1993 */
1038 }
1039 else {
1040 argswritten=FALSE;
1041 }
1042 if (sp) prettyf(")");
1043 return argswritten;
1044 }
1045
1046 /****************************************************************************/
1047
1058 void pretty_psi_term(ptr_psi_term t,long sprec,long depth)
1059 {
1060 char buf[STRLEN]; /* Big enough for a long number */
1061 ptr_residuation r;
1062 long argswritten;
1063 // double fmod();
1064
1065 if (t) {
1066 deref_ptr(t); /* PVR */
1067
1068 /* if (trace) printf("<%ld>",t->status); For brunobug.lf PVR 14.2.94 */
1069
1070 /* RM: Feb 12 1993 */
1071 if(display_persistent &&
1072 (GENERIC)t>heap_pointer)
1073 prettyf(" $");
1074
1075 if((t->type==alist || t->type==disjunction) && check_legal_cons(t,t->type))
1076 pretty_list(t,depth+1); /* RM: Dec 11 1992 */
1077 else
1078 if(t->type==nil && !t->attr_list)
1079 prettyf("[]");
1080 else
1081 if(t->type==disj_nil && !t->attr_list) /* RM: Feb 1 1993 */
1082 prettyf("{}");
1083 else {
1084 argswritten=FALSE;
1085 if (t->value_3) {
1086 #ifdef CLIFE
1087 if(t->type->type==block) { /* RM 20 Jan 1993 */
1088 pretty_block(t); /* AA 21 Jan 1993 */
1089 }
1090 else
1091 #endif /* CLIFE */
1092 if (sub_type(t->type,integer)) {
1093 /* Print integers in chunks up to the full precision of the REAL */
1094 long seg,neg,i;
1095 REAL val;
1096 char segbuf[100][PRINT_POWER+3];
1097
1098 val = *(REAL *)t->value_3;
1099 neg = (val<0.0);
1100 if (neg) val = -val;
1101 if (val>WL_MAXINT) goto PrintReal;
1102 seg=0;
1103 while (val>=(double)PRINT_SPLIT) {
1104 double tmp;
1105 tmp=(REAL)fmod((double)val,(double)PRINT_SPLIT);
1106 (void)snprintf(segbuf[seg],100,seg_format,(unsigned long)tmp);
1107 val=floor(val/(double)PRINT_SPLIT);
1108 seg++;
1109 }
1110 (void)snprintf(segbuf[seg],100,"%s%ld",(neg?"-":""),(unsigned long)val);
1111 for (i=seg; i>=0; i--) prettyf(segbuf[i]);
1112 if (!equal_types(t->type,integer)) {
1113 prettyf(DOTDOT);
1114 pretty_symbol(t->type->keyword); /* RM: Jan 13 1993 */
1115 }
1116 }
1117 else if (sub_type(t->type,real)) {
1118 PrintReal:
1119 (void)snprintf(buf,STRLEN,"%lg",*(REAL *)t->value_3);
1120 prettyf(buf);
1121 if (!equal_types(t->type,real) &&
1122 !equal_types(t->type,integer)) {
1123 prettyf(DOTDOT);
1124 pretty_symbol(t->type->keyword); /* RM: Jan 13 1993 */
1125 }
1126 }
1127 else if (sub_type(t->type,quoted_string)) {
1128 prettyf_quoted_string((char *)t->value_3);
1129 if(!equal_types(t->type,quoted_string)) {
1130 prettyf(DOTDOT);
1131 pretty_quote_symbol(t->type->keyword); /* RM: Jan 13 1993 */
1132 }
1133 }
1134 /* DENYS: BYTEDATA */
1135 else if (sub_type(t->type,sys_bytedata)) {
1136 pretty_quote_symbol(t->type->keyword);
1137 }
1138 else if (equal_types(t->type,stream)) {
1139 (void)snprintf(buf,STRLEN,"stream(%ld)",(long)t->value_3);
1140 prettyf(buf);
1141 }
1142 else if (equal_types(t->type,eof))
1143 pretty_quote_symbol(eof->keyword); /* RM: Jan 13 1993 */
1144 else if (equal_types(t->type,cut))
1145 pretty_quote_symbol(cut->keyword); /* RM: Jan 13 1993 */
1146 else {
1147 prettyf("*** bad object '");
1148 pretty_symbol(t->type->keyword); /* RM: Jan 13 1993 */
1149 prettyf("'***");
1150 }
1151 }
1152 else {
1153 if (depth<print_depth) /* 20.8 */
1154 argswritten=pretty_psi_with_ops(t,sprec,depth+1);
1155 /* RM: Jan 13 1993 */
1156 if (!argswritten) pretty_quote_symbol(t->type->keyword);
1157 }
1158
1159 /* write_canon -- PVR 24.2.94 */
1160 if (!argswritten && t->attr_list &&
1161 (depth<print_depth || write_canon)) /* 20.8 */
1162 pretty_attr(t->attr_list,depth+1);
1163
1164 if (depth>=print_depth && !write_canon && t->attr_list) /* 20.8 */
1165 prettyf("(...)");
1166 }
1167 if ((r=t->resid))
1168 while (r) {
1169 if (r->goal->pending) {
1170 if (FALSE /* write_resids 11.8 */) {
1171 prettyf("\\");
1172 pretty_psi_term(r->goal->aaaa_1,0,depth);
1173 }
1174 else
1175 prettyf("~");
1176 }
1177 r=r->next;
1178 }
1179 }
1180 }
1181
1199 void do_pretty_attr(ptr_node t,ptr_tab_brk tab,long *cnt,long two,long depth)
1200 {
1201 long v;
1202 char s[4];
1203 ptr_module module;
1204
1205 if (t) {
1206 if (t->left) {
1207 do_pretty_attr(t->left,tab,cnt,two,depth);
1208 prettyf(",");
1209 }
1210
1211 /* Don't start each argument on a new line, */
1212 /* unless printing a function body: */
1213 mark_tab(tab);
1214
1215 v=str_to_int(t->key);
1216 if (v<0) {
1217 if(display_modules) { /* RM: Jan 21 1993 */
1218 module=extract_module_from_name(t->key);
1219 if(module) {
1220 prettyf(module->module_name);
1221 prettyf("#");
1222 }
1223 }
1224 prettyf_quote(strip_module_name(t->key));
1225
1226 prettyf(" => ");
1227 }
1228 else if (v== *cnt)
1229 (*cnt)++ ;
1230 else {
1231 (void)snprintf(s,4,"%ld",v);
1232 prettyf(s); /* 6.10 */
1233 prettyf(" => ");
1234 }
1235
1236 /* pretty_tag_or_psi_term(t->data,(two?COMMA_PREC:MAX_PRECEDENCE+1)); */
1237 pretty_tag_or_psi_term((ptr_psi_term)t->data,COMMA_PREC,depth);
1238
1239 if (t->right) {
1240 prettyf(",");
1241 do_pretty_attr(t->right,tab,cnt,two,depth);
1242 }
1243 }
1244 }
1245
1246
1254 long two_or_more(ptr_node t)
1255 {
1256 if (t) {
1257 if (t->left || t->right) return TRUE; else return FALSE;
1258 }
1259 else
1260 return FALSE;
1261 }
1262
1273 void pretty_attr(ptr_node t,long depth)
1274 {
1275 ptr_tab_brk new;
1276 long cnt=1;
1277
1278 prettyf("(");
1279 new_tab(&new);
1280
1281 do_pretty_attr(t,new,&cnt,two_or_more(t),depth);
1282
1283 prettyf(")");
1284 }
1285
1293 void pretty_output()
1294 {
1295 ptr_item i;
1296 long j;
1297
1298 for(i=pretty_things+1;(unsigned long)i<(unsigned long)indx;i++) {
1299 if(i->tab->broken && i->tab->printed) {
1300 fprintf(outfile,"\n");
1301 for(j=0;j<i->tab->column;j++)
1302 fprintf(outfile," ");
1303 }
1304 fprintf(outfile,"%s",i->str);
1305 i->tab->printed=TRUE;
1306 }
1307 }
1308
1318 void pretty_variables(ptr_node n,ptr_tab_brk tab)
1319 {
1320 ptr_psi_term tok;
1321 ptr_node n2;
1322
1323 if(n->left) {
1324 pretty_variables(n->left,tab);
1325 prettyf(", ");
1326 }
1327
1328 mark_tab(tab);
1329 prettyf(n->key);
1330 prettyf(" = ");
1331
1332 tok=(ptr_psi_term )n->data;
1333 deref_ptr(tok);
1334 n2=find(INTCMP,(char *)tok,printed_pointers);
1335 if(strcmp((char *)n2->data,n->key)<0)
1336 /* Reference to previously printed variable */
1337 prettyf((char *)n2->data);
1338 else {
1339 if (eqsym->op_data) {
1340 long tkind, tprec, ttype, eqprec;
1341 eqprec=eqsym->op_data->precedence;
1342 tkind=opcheck(tok, &tprec, &ttype);
1343 if (tprec>=eqprec) prettyf("(");
1344 pretty_psi_term(tok,MAX_PRECEDENCE+1,0);
1345 if (tprec>=eqprec) prettyf(")");
1346 }
1347 else
1348 pretty_psi_term(tok,MAX_PRECEDENCE+1,0);
1349 }
1350
1351 if(n->right) {
1352 prettyf(", ");
1353 pretty_variables(n->right,tab);
1354 }
1355 }
1356
1368 long print_variables(long printflag)
1369 {
1370 ptr_tab_brk new;
1371 GENERIC old_heap_pointer;
1372 if (!printflag) return FALSE; /* 21.1 */
1373
1374 outfile=output_stream;
1375 listing_flag=FALSE;
1376 old_heap_pointer=heap_pointer;
1377
1378 pointer_names=NULL;
1379 printed_pointers=NULL;
1380 gen_sym_counter=0;
1381 go_through_tree(var_tree);
1382 insert_variables(var_tree,TRUE);
1383 forbid_variables(var_tree);
1384
1385 indent=TRUE;
1386 const_quote=TRUE;
1387 write_resids=TRUE;
1388 write_canon=FALSE;
1389 *buffer=0;
1390 indx=pretty_things;
1391
1392 if (var_tree) {
1393 new_tab(&new);
1394 pretty_variables(var_tree,new);
1395 prettyf(".");
1396 mark_tab(new);
1397 prettyf("\n");
1398 end_tab();
1399
1400 if (indent) {
1401 work_out_length();
1402 pretty_output();
1403 }
1404 }
1405 heap_pointer=old_heap_pointer;
1406 return (var_tree!=NULL);
1407 }
1408
1419 void write_attributes(ptr_node n,ptr_tab_brk tab)
1420 {
1421 if(n) {
1422 write_attributes(n->left,tab);
1423 mark_tab(tab);
1424 pretty_tag_or_psi_term((ptr_psi_term)n->data,MAX_PRECEDENCE+1,0);
1425 write_attributes(n->right,tab);
1426 }
1427 }
1428
1429
1438 void listing_pred_write(ptr_node n,long fflag)
1439 {
1440 long old_print_depth;
1441
1442 listing_flag=TRUE;
1443 func_flag=fflag;
1444 indent=TRUE;
1445 const_quote=TRUE;
1446 write_corefs=TRUE;
1447 write_stderr=FALSE;
1448 write_resids=FALSE;
1449 write_canon=FALSE;
1450 outfile=output_stream;
1451 old_print_depth=print_depth;
1452 print_depth=PRINT_DEPTH;
1453 main_pred_write(n);
1454 print_depth=old_print_depth;
1455 (void)fflush(outfile);
1456 }
1457
1469 void pred_write(ptr_node n)
1470 {
1471 listing_flag=FALSE;
1472 /* write_stderr=FALSE; */
1473 outfile=(write_stderr?stderr:output_stream);
1474 main_pred_write(n);
1475 (void)fflush(outfile);
1476 }
1477
1484 void main_pred_write(ptr_node n)
1485 {
1486 if (n) {
1487 GENERIC old_heap_pointer;
1488 ptr_tab_brk new;
1489
1490 if (!write_corefs) main_pred_write(n->left);
1491
1492 old_heap_pointer=heap_pointer;
1493 pointer_names=NULL;
1494 printed_pointers=NULL;
1495 gen_sym_counter=0;
1496 if (write_corefs)
1497 go_through_tree(n);
1498 else
1499 check_pointer((ptr_psi_term)n->data);
1500 insert_variables(var_tree,FALSE);
1501
1502 *buffer=0;
1503
1504 indx=pretty_things;
1505 new_tab(&new);
1506
1507 if (write_corefs) {
1508 write_attributes(n,new);
1509 }
1510 else {
1511 mark_tab(new);
1512 pretty_tag_or_psi_term((ptr_psi_term)n->data,MAX_PRECEDENCE+1,0);
1513 }
1514
1515 end_tab();
1516
1517 if (indent) {
1518 work_out_length();
1519 pretty_output();
1520 }
1521
1522 heap_pointer=old_heap_pointer;
1523
1524 if (!write_corefs) main_pred_write(n->right);
1525 }
1526 }
1527
1536 void display_psi_stdout(ptr_psi_term t)
1537 {
1538 outfile=stdout;
1539 main_display_psi_term(t);
1540 }
1541
1550 void display_psi_stderr(ptr_psi_term t)
1551 {
1552 outfile=stderr;
1553 main_display_psi_term(t);
1554 }
1555
1564 void display_psi_stream(ptr_psi_term t)
1565 {
1566 outfile=output_stream;
1567 main_display_psi_term(t);
1568 }
1569
1579 void display_psi(FILE *s,ptr_psi_term t)
1580 {
1581 outfile=s;
1582 main_display_psi_term(t);
1583 }
1584
1585
1593 void main_display_psi_term(ptr_psi_term t)
1594 {
1595 GENERIC old_heap_pointer;
1596 ptr_tab_brk new;
1597
1598 listing_flag=FALSE;
1599 if(t) {
1600
1601 deref_ptr(t);
1602
1603 old_heap_pointer=heap_pointer;
1604 pointer_names=NULL;
1605 printed_pointers=NULL;
1606 gen_sym_counter=0;
1607 go_through(t);
1608 insert_variables(var_tree,FALSE);
1609
1610 indent=FALSE;
1611 const_quote=TRUE;
1612 write_resids=FALSE;
1613 write_canon=FALSE;
1614 *buffer=0;
1615 indx=pretty_things;
1616
1617 new_tab(&new);
1618 mark_tab(new);
1619 pretty_tag_or_psi_term(t,MAX_PRECEDENCE+1,0);
1620 end_tab();
1621 if (indent) {
1622 work_out_length();
1623 pretty_output();
1624 }
1625
1626 heap_pointer=old_heap_pointer;
1627 }
1628 else
1629 printf("*null psi_term*");
1630 }
1631
1643 void display_couple(ptr_psi_term u,char *s,ptr_psi_term v)
1644 {
1645 GENERIC old_heap_pointer;
1646 ptr_tab_brk new;
1647
1648 output_stream=stdout;
1649 listing_flag=FALSE;
1650 old_heap_pointer=heap_pointer;
1651
1652 pointer_names=NULL;
1653 printed_pointers=NULL;
1654 gen_sym_counter=0;
1655 check_pointer(u);
1656 check_pointer(v);
1657 insert_variables(var_tree,TRUE);
1658
1659 indent=FALSE;
1660 const_quote=TRUE;
1661 write_resids=FALSE;
1662 write_canon=FALSE;
1663 *buffer=0;
1664 indx=pretty_things;
1665 new_tab(&new);
1666 mark_tab(new);
1667 pretty_tag_or_psi_term(u,MAX_PRECEDENCE+1,0);
1668 prettyf(s);
1669 pretty_tag_or_psi_term(v,MAX_PRECEDENCE+1,0);
1670 end_tab();
1671
1672 if (indent) {
1673 work_out_length();
1674 pretty_output();
1675 }
1676
1677 heap_pointer=old_heap_pointer;
1678 }
1679
1690 void print_resid_message(ptr_psi_term t,ptr_resid_list r)
1691 {
1692 GENERIC old_heap_pointer;
1693 ptr_tab_brk new;
1694 ptr_resid_list r2; /* 21.9 */
1695
1696 outfile=stdout;
1697 listing_flag=FALSE;
1698 old_heap_pointer=heap_pointer;
1699
1700 pointer_names=NULL;
1701 printed_pointers=NULL;
1702 gen_sym_counter=0;
1703
1704 check_pointer(t);
1705
1706 r2=r;
1707 while(r2) {
1708 check_pointer(r2->var);
1709 r2=r2->next;
1710 }
1711
1712 insert_variables(var_tree,TRUE);
1713
1714 indent=FALSE;
1715 const_quote=TRUE;
1716 write_resids=FALSE;
1717 write_canon=FALSE;
1718 *buffer=0;
1719 indx=pretty_things;
1720 new_tab(&new);
1721 mark_tab(new);
1722
1723 prettyf("residuating ");
1724 pretty_tag_or_psi_term(t,MAX_PRECEDENCE+1,0);
1725 prettyf(" on variable(s) {");
1726
1727 r2=r;
1728 while(r2) {
1729 pretty_tag_or_psi_term(r2->var,MAX_PRECEDENCE+1,0);
1730 r2=r2->next;
1731 if(r2)
1732 prettyf(",");
1733 }
1734
1735 prettyf("}\n");
1736 end_tab();
1737
1738 heap_pointer=old_heap_pointer;
1739 }
disjunction
ptr_definition disjunction
symbol in bi module
Definition: def_glob.h:249
wl_goal::aaaa_1
ptr_psi_term aaaa_1
Definition: def_struct.h:239
printed_pointers
ptr_node printed_pointers
Definition: def_glob.h:1007
alist
ptr_definition alist
symbol in bi module
Definition: def_glob.h:319
wl_psi_term::resid
ptr_residuation resid
Definition: def_struct.h:189
prettyf_quoted_string
void prettyf_quoted_string(char *s)
prettyf_quoted_string
Definition: print.c:507
pretty_things
item pretty_things[PRETTY_SIZE]
Definition: print.c:29
get_two_args
void get_two_args(ptr_node t, ptr_psi_term *a, ptr_psi_term *b)
get_two_args
Definition: login.c:47
wl_operator_data::precedence
long precedence
Definition: def_struct.h:75
is_top
#define is_top(T)
Definition: def_macro.h:113
unique_name
GENERIC unique_name()
unique_name
Definition: print.c:99
prettyf
void prettyf(char *s)
prettyf
Definition: print.c:496
prettyf_inner
void prettyf_inner(char *s, long q, char c)
prettyf_inner
Definition: print.c:374
two_or_more
long two_or_more(ptr_node t)
two_or_more
Definition: print.c:1254
yfx
#define yfx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1037
FEATCMP
#define FEATCMP
indicates to use featcmp for comparison (in trees.c)
Definition: def_const.h:979
perr
void perr(char *str)
perr
Definition: error.c:763
heap_pointer
GENERIC heap_pointer
used to allocate from heap - size allocated subtracted - adj for alignment
Definition: def_glob.h:55
wl_item
Definition: def_struct.h:314
eqsym
ptr_definition eqsym
symbol in syntax module
Definition: def_glob.h:270
integer
ptr_definition integer
symbol in bi module
Definition: def_glob.h:312
wl_tab_brk::printed
long printed
Definition: def_struct.h:312
opcheck
long opcheck(ptr_psi_term t, long *prec, long *type)
opcheck
Definition: print.c:913
xfx
#define xfx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1021
wl_operator_data
Definition: def_struct.h:73
go_through_tree
void go_through_tree(ptr_node t)
go_through_tree
Definition: print.c:258
wl_residuation::goal
ptr_goal goal
Definition: def_struct.h:172
INTCMP
#define INTCMP
indicates to use intcmp for comparison (in trees.c)
Definition: def_const.h:971
wl_residuation::next
ptr_residuation next
Definition: def_struct.h:173
POSTFIX
#define POSTFIX
used in pretty printing in print.c
Definition: def_const.h:1374
NOT_CODED
#define NOT_CODED
For LIFE boolean calculation built-in.
Definition: def_const.h:294
cut
ptr_definition cut
symbol in syntax module
Definition: def_glob.h:242
two
char * two
Definition: def_glob.h:892
listing_pred_write
void listing_pred_write(ptr_node n, long fflag)
listing_pred_write
Definition: print.c:1438
work_out_length
void work_out_length()
work_out_length
Definition: print.c:626
wl_operator_data::next
ptr_operator_data next
Definition: def_struct.h:76
wl_module
Definition: def_struct.h:105
display_modules
long display_modules
whether to display modules with symbols
Definition: def_glob.h:741
wl_tab_brk::column
long column
Definition: def_struct.h:310
fx
#define fx
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1000
pretty_symbol
void pretty_symbol(ptr_keyword k)
pretty_symbol
Definition: modules.c:452
defs.h
includes
wl_psi_term
Definition: def_struct.h:177
COLON_PREC
#define COLON_PREC
Definition: print.c:40
forbid_variables
void forbid_variables(ptr_node n)
Definition: print.c:334
INT_SIZE
#define INT_SIZE
How many types can be encoded on one integer in the transitive closure encoding.
Definition: def_const.h:317
check_legal_cons
long check_legal_cons(ptr_psi_term t, ptr_definition t_type)
check_legal_cons
Definition: print.c:713
strpos
long strpos(long pos, char *str)
strpos
Definition: print.c:608
main_pred_write
void main_pred_write(ptr_node n)
main_pred_write
Definition: print.c:1484
DIGIT
#define DIGIT(C)
Definition: def_macro.h:42
wl_resid_list::next
ptr_resid_list next
Definition: def_struct.h:97
wl_item::tab
ptr_tab_brk tab
Definition: def_struct.h:316
stream
ptr_definition stream
symbol in bi module
Definition: def_glob.h:382
strip_module_name
char * strip_module_name(char *str)
strip_module_name
Definition: modules.c:144
wl_residuation
Definition: def_struct.h:168
wl_definition::keyword
ptr_keyword keyword
Definition: def_struct.h:147
ISALPHA
#define ISALPHA(C)
Definition: def_macro.h:48
wl_item::str
char * str
Definition: def_struct.h:315
ptr_psi_term
struct wl_psi_term * ptr_psi_term
quotedStackCopy
Definition: def_struct.h:62
write_stderr
long write_stderr
Definition: print.c:17
wl_node::data
GENERIC data
Definition: def_struct.h:201
NULL
#define NULL
Definition: def_const.h:533
var_tree
ptr_node var_tree
Definition: def_glob.h:1005
display_couple
void display_couple(ptr_psi_term u, char *s, ptr_psi_term v)
display_couple
Definition: print.c:1643
is_integer
long is_integer(char *s)
is_integer
Definition: print.c:450
xfy
#define xfy
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1030
starts_nonlower
long starts_nonlower(char *s)
starts_nonlower
Definition: print.c:406
DOTDOT
#define DOTDOT
used in pretty printing in print.c
Definition: def_const.h:1346
prettyf_quote
void prettyf_quote(char *s)
prettyf_quote
Definition: print.c:529
REAL
#define REAL
Which C type to use to represent reals and integers in Wild_Life.
Definition: def_const.h:132
wl_keyword::symbol
char * symbol
Definition: def_struct.h:118
overlap_type
long overlap_type(ptr_definition t1, ptr_definition t2)
overlap_type
Definition: types.c:1579
print_depth
long print_depth
Definition: print.c:12
mark_tab
void mark_tab(ptr_tab_brk t)
mark_tab
Definition: print.c:573
outfile
FILE * outfile
Definition: def_glob.h:974
LOWER
#define LOWER(C)
Definition: def_macro.h:46
SYMBOL
#define SYMBOL(C)
Definition: def_macro.h:57
heap_insert
ptr_node heap_insert(long comp, char *keystr, ptr_node *tree, GENERIC info)
heap_insert
Definition: trees.c:320
print_bin
void print_bin(long b)
print_bin
Definition: print.c:147
pointer_names
ptr_node pointer_names
Definition: def_glob.h:1008
write_attributes
void write_attributes(ptr_node n, ptr_tab_brk tab)
write_attributes
Definition: print.c:1419
PAGE_WIDTH
#define PAGE_WIDTH
Initial page width for printing.
Definition: def_const.h:169
sys_bytedata
ptr_definition sys_bytedata
symbol in sys module
Definition: def_glob.h:983
wl_node::left
ptr_node left
Definition: def_struct.h:199
sub_type
long sub_type(ptr_definition t1, ptr_definition t2)
sub_type
Definition: types.c:1642
wl_int_list
Definition: def_struct.h:84
real
ptr_definition real
symbol in bi module
Definition: def_glob.h:375
has_non_alpha
long has_non_alpha(char *s)
has_non_alpha
Definition: print.c:418
pretty_list
void pretty_list(ptr_psi_term t, long depth)
pretty_list
Definition: print.c:734
pretty_quote_symbol
void pretty_quote_symbol(ptr_keyword k)
pretty_quote_symbol
Definition: modules.c:470
PREFIX
#define PREFIX
used in pretty printing in print.c
Definition: def_const.h:1367
GENERIC
unsigned long * GENERIC
unsigned long *GENERIC
Definition: def_struct.h:35
display_psi_stdout
void display_psi_stdout(ptr_psi_term t)
display_psi_stdout
Definition: print.c:1536
buffer
char * buffer
buffer used only in print.c - there is local with same name in xpred.c
Definition: def_glob.h:781
display_persistent
long display_persistent
Definition: print.c:22
new_tab
void new_tab(ptr_tab_brk *t)
new_tab
Definition: print.c:587
pretty_tag_or_psi_term
void pretty_tag_or_psi_term(ptr_psi_term p, long sprec, long depth)
pretty_tag_or_psi_term
Definition: print.c:834
write_corefs
long write_corefs
Definition: print.c:18
deref_ptr
#define deref_ptr(P)
Definition: def_macro.h:100
heap_copy_string
char * heap_copy_string(char *s)
heap_copy_string
Definition: trees.c:172
wl_tab_brk
Definition: def_struct.h:309
main_display_psi_term
void main_display_psi_term(ptr_psi_term t)
main_display_psi_term
Definition: print.c:1593
name
char * name
Definition: print.c:25
wl_node::key
char * key
Definition: def_struct.h:198
wl_tab_brk::broken
long broken
Definition: def_struct.h:311
TRUE
#define TRUE
Standard boolean.
Definition: def_const.h:268
pretty_psi_with_ops
long pretty_psi_with_ops(ptr_psi_term t, long sprec, long depth)
pretty_psi_with_ops
Definition: print.c:949
indx
ptr_item indx
Definition: def_glob.h:970
STRCMP
#define STRCMP
indicates to use strcmp for comparison (c function)
Definition: def_const.h:963
PRINT_POWER
#define PRINT_POWER
Power of ten to split printing (REALs are often more precise than ints.
Definition: def_const.h:190
eof
ptr_definition eof
symbol in syntax module
Definition: def_glob.h:263
pretty_variables
void pretty_variables(ptr_node n, ptr_tab_brk tab)
pretty_variables
Definition: print.c:1318
str_to_int
long str_to_int(char *s)
str_to_int
Definition: print.c:118
FALSE
#define FALSE
Standard boolean.
Definition: def_const.h:275
wl_resid_list
Definition: def_struct.h:94
no_name
char * no_name
Definition: print.c:24
pred_write
void pred_write(ptr_node n)
pred_write
Definition: print.c:1469
print_resid_message
void print_resid_message(ptr_psi_term t, ptr_resid_list r)
print_resid_message
Definition: print.c:1690
display_psi_stderr
void display_psi_stderr(ptr_psi_term t)
display_psi_stderr
Definition: print.c:1550
nil
ptr_definition nil
symbol in bi module
Definition: def_glob.h:340
extract_module_from_name
ptr_module extract_module_from_name(char *str)
extract_module_from_name
Definition: modules.c:116
wl_psi_term::value_3
GENERIC value_3
Definition: def_struct.h:186
check_pointer
void check_pointer(ptr_psi_term p)
check_pointer
Definition: print.c:233
wl_resid_list::var
ptr_psi_term var
Definition: def_struct.h:95
seg_format
char seg_format[PRINT_POWER+4]
Definition: print.c:27
disj_nil
ptr_definition disj_nil
symbol in syntax module
Definition: def_glob.h:256
wl_module::module_name
char * module_name
Definition: def_struct.h:106
one
char * one
Definition: def_glob.h:891
equal_types
#define equal_types(A, B)
Definition: def_macro.h:111
print_code
void print_code(FILE *s, ptr_int_list c)
print_code
Definition: print.c:167
xf
#define xf
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:993
display_psi_stream
void display_psi_stream(ptr_psi_term t)
display_psi_stream
Definition: print.c:1564
find
ptr_node find(long comp, char *keystr, ptr_node tree)
find
Definition: trees.c:394
heap_nice_name
char * heap_nice_name()
heap_nice_name
Definition: print.c:63
PRINT_DEPTH
#define PRINT_DEPTH
Initial depth limit for printing.
Definition: def_const.h:176
featcmp
long featcmp(char *str1, char *str2)
featcmp
Definition: trees.c:106
init_print
void init_print()
init_print
Definition: print.c:52
INFIX
#define INFIX
used in pretty printing in print.c
Definition: def_const.h:1360
yf
#define yf
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1007
check_opargs
long check_opargs(ptr_node n)
check_opargs
Definition: print.c:887
wl_definition
Definition: def_struct.h:145
PRETTY_SIZE
#define PRETTY_SIZE
Maximum number of syntactic tokens in a pretty-printed output term.
Definition: def_const.h:147
MAX_PRECEDENCE
#define MAX_PRECEDENCE
Maximum operator precedence.
Definition: def_const.h:205
no_quote
long no_quote(char *s)
no_quote
Definition: print.c:470
gen_sym_counter
long gen_sym_counter
Definition: def_glob.h:1009
do_pretty_attr
void do_pretty_attr(ptr_node t, ptr_tab_brk tab, long *cnt, long two, long depth)
do_pretty_attr
Definition: print.c:1199
PRINT_SPLIT
#define PRINT_SPLIT
Size at which to split printing (REALs are often more precise than ints.
Definition: def_const.h:183
all_symbol
long all_symbol(char *s)
all_symbol
Definition: print.c:434
WL_MAXINT
#define WL_MAXINT
Maximum exactly representable integer (2^53-1 for double IEEE format)
Definition: def_const.h:140
display_psi
void display_psi(FILE *s, ptr_psi_term t)
display_psi
Definition: print.c:1579
NOTOP
#define NOTOP
used in pretty printing in print.c
Definition: def_const.h:1353
SINGLE
#define SINGLE(C)
Definition: def_macro.h:52
write_canon
long write_canon
Definition: print.c:16
func_flag
static long func_flag
Definition: print.c:36
output_stream
FILE * output_stream
Definition: def_glob.h:1017
const_quote
long const_quote
Definition: print.c:14
go_through
void go_through(ptr_psi_term t)
go_through
Definition: print.c:282
STRLEN
#define STRLEN
Maximum size of file names and input tokens (which includes input strings) (Note: calculated tokens c...
Definition: def_const.h:162
insert_variables
void insert_variables(ptr_node vars, long force)
insert_variables
Definition: print.c:308
write_resids
long write_resids
Definition: print.c:15
listing_flag
static long listing_flag
Definition: print.c:32
wl_node
Definition: def_struct.h:197
end_tab
void end_tab()
end_tab
Definition: print.c:554
wl_psi_term::type
ptr_definition type
Definition: def_struct.h:181
wl_int_list::value_1
GENERIC value_1
Definition: def_struct.h:85
pretty_psi_term
void pretty_psi_term(ptr_psi_term t, long sprec, long depth)
pretty_psi_term
Definition: print.c:1058
pretty_output
void pretty_output()
pretty_output
Definition: print.c:1293
HEAP_ALLOC
#define HEAP_ALLOC(A)
Definition: def_macro.h:20
wl_psi_term::attr_list
ptr_node attr_list
Definition: def_struct.h:187
wl_goal::pending
ptr_definition pending
Definition: def_struct.h:243
print_variables
long print_variables(long printflag)
print_variables
Definition: print.c:1368
quoted_string
ptr_definition quoted_string
symbol in bi module
Definition: def_glob.h:368
indent
long indent
Definition: print.c:13
wl_definition::op_data
ptr_operator_data op_data
Definition: def_struct.h:158
print_operator_kind
void print_operator_kind(FILE *s, long kind)
print_operator_kind
Definition: print.c:192
heap_alloc
GENERIC heap_alloc(long s)
heap_alloc
Definition: memory.c:1616
pretty_attr
void pretty_attr(ptr_node t, long depth)
pretty_attr
Definition: print.c:1273
count_features
long count_features(ptr_node t)
count_features
Definition: print.c:690
COMMA_PREC
#define COMMA_PREC
Definition: print.c:39
fy
#define fy
was enum (operator) but va_arg could not handle - now typedef
Definition: def_const.h:1014
wl_node::right
ptr_node right
Definition: def_struct.h:200
page_width
long page_width
Definition: print.c:20
wl_int_list::next
ptr_int_list next
Definition: def_struct.h:86