4422f70159f44f7a4400666076e34a4df302e033
[mesa.git] / src / mesa / shader / slang / slang_print.c
1
2 /**
3 * Dump/print a slang_operation tree
4 */
5
6
7 #include "main/imports.h"
8 #include "slang_compile.h"
9 #include "slang_print.h"
10
11
12 static void
13 spaces(int n)
14 {
15 while (n--)
16 printf(" ");
17 }
18
19
20 static void
21 print_type(const slang_fully_specified_type *t)
22 {
23 switch (t->qualifier) {
24 case SLANG_QUAL_NONE:
25 /*printf("");*/
26 break;
27 case SLANG_QUAL_CONST:
28 printf("const ");
29 break;
30 case SLANG_QUAL_ATTRIBUTE:
31 printf("attrib ");
32 break;
33 case SLANG_QUAL_VARYING:
34 printf("varying ");
35 break;
36 case SLANG_QUAL_UNIFORM:
37 printf("uniform ");
38 break;
39 case SLANG_QUAL_OUT:
40 printf("output ");
41 break;
42 case SLANG_QUAL_INOUT:
43 printf("inout ");
44 break;
45 case SLANG_QUAL_FIXEDOUTPUT:
46 printf("fixedoutput");
47 break;
48 case SLANG_QUAL_FIXEDINPUT:
49 printf("fixedinput");
50 break;
51 default:
52 printf("unknown qualifer!");
53 }
54
55 switch (t->specifier.type) {
56 case SLANG_SPEC_VOID:
57 printf("void");
58 break;
59 case SLANG_SPEC_BOOL:
60 printf("bool");
61 break;
62 case SLANG_SPEC_BVEC2:
63 printf("bvec2");
64 break;
65 case SLANG_SPEC_BVEC3:
66 printf("bvec3");
67 break;
68 case SLANG_SPEC_BVEC4:
69 printf("bvec4");
70 break;
71 case SLANG_SPEC_INT:
72 printf("int");
73 break;
74 case SLANG_SPEC_IVEC2:
75 printf("ivec2");
76 break;
77 case SLANG_SPEC_IVEC3:
78 printf("ivec3");
79 break;
80 case SLANG_SPEC_IVEC4:
81 printf("ivec4");
82 break;
83 case SLANG_SPEC_FLOAT:
84 printf("float");
85 break;
86 case SLANG_SPEC_VEC2:
87 printf("vec2");
88 break;
89 case SLANG_SPEC_VEC3:
90 printf("vec3");
91 break;
92 case SLANG_SPEC_VEC4:
93 printf("vec4");
94 break;
95 case SLANG_SPEC_MAT2:
96 printf("mat2");
97 break;
98 case SLANG_SPEC_MAT3:
99 printf("mat3");
100 break;
101 case SLANG_SPEC_MAT4:
102 printf("mat4");
103 break;
104 case SLANG_SPEC_MAT23:
105 printf("mat2x3");
106 break;
107 case SLANG_SPEC_MAT32:
108 printf("mat3x2");
109 break;
110 case SLANG_SPEC_MAT24:
111 printf("mat2x4");
112 break;
113 case SLANG_SPEC_MAT42:
114 printf("mat4x2");
115 break;
116 case SLANG_SPEC_MAT34:
117 printf("mat3x4");
118 break;
119 case SLANG_SPEC_MAT43:
120 printf("mat4x3");
121 break;
122 case SLANG_SPEC_SAMPLER1D:
123 printf("sampler1D");
124 break;
125 case SLANG_SPEC_SAMPLER2D:
126 printf("sampler2D");
127 break;
128 case SLANG_SPEC_SAMPLER3D:
129 printf("sampler3D");
130 break;
131 case SLANG_SPEC_SAMPLERCUBE:
132 printf("samplerCube");
133 break;
134 case SLANG_SPEC_SAMPLER1DSHADOW:
135 printf("sampler1DShadow");
136 break;
137 case SLANG_SPEC_SAMPLER2DSHADOW:
138 printf("sampler2DShadow");
139 break;
140 case SLANG_SPEC_STRUCT:
141 printf("struct");
142 break;
143 case SLANG_SPEC_ARRAY:
144 printf("array");
145 break;
146 default:
147 printf("unknown type");
148 }
149 /*printf("\n");*/
150 }
151
152
153 static void
154 print_variable(const slang_variable *v, int indent)
155 {
156 spaces(indent);
157 printf("VAR ");
158 print_type(&v->type);
159 printf(" %s (at %p)", (char *) v->a_name, (void *) v);
160 if (v->initializer) {
161 printf(" :=\n");
162 slang_print_tree(v->initializer, indent + 3);
163 }
164 else {
165 printf(";\n");
166 }
167 }
168
169
170 static void
171 print_binary(const slang_operation *op, const char *oper, int indent)
172 {
173 assert(op->num_children == 2);
174 #if 0
175 printf("binary at %p locals=%p outer=%p\n",
176 (void *) op,
177 (void *) op->locals,
178 (void *) op->locals->outer_scope);
179 #endif
180 slang_print_tree(&op->children[0], indent + 3);
181 spaces(indent);
182 printf("%s at %p locals=%p outer=%p\n",
183 oper, (void *) op, (void *) op->locals,
184 (void *) op->locals->outer_scope);
185 slang_print_tree(&op->children[1], indent + 3);
186 }
187
188
189 static void
190 print_generic2(const slang_operation *op, const char *oper,
191 const char *s, int indent)
192 {
193 GLuint i;
194 if (oper) {
195 spaces(indent);
196 printf("%s %s at %p locals=%p outer=%p\n",
197 oper, s, (void *) op, (void *) op->locals,
198 (void *) op->locals->outer_scope);
199 }
200 for (i = 0; i < op->num_children; i++) {
201 spaces(indent);
202 printf("//child %u of %u:\n", i, op->num_children);
203 slang_print_tree(&op->children[i], indent);
204 }
205 }
206
207 static void
208 print_generic(const slang_operation *op, const char *oper, int indent)
209 {
210 print_generic2(op, oper, "", indent);
211 }
212
213
214 static const slang_variable_scope *
215 find_scope(const slang_variable_scope *s, slang_atom name)
216 {
217 GLuint i;
218 for (i = 0; i < s->num_variables; i++) {
219 if (s->variables[i]->a_name == name)
220 return s;
221 }
222 if (s->outer_scope)
223 return find_scope(s->outer_scope, name);
224 else
225 return NULL;
226 }
227
228 static const slang_variable *
229 find_var(const slang_variable_scope *s, slang_atom name)
230 {
231 GLuint i;
232 for (i = 0; i < s->num_variables; i++) {
233 if (s->variables[i]->a_name == name)
234 return s->variables[i];
235 }
236 if (s->outer_scope)
237 return find_var(s->outer_scope, name);
238 else
239 return NULL;
240 }
241
242
243 void
244 slang_print_tree(const slang_operation *op, int indent)
245 {
246 GLuint i;
247
248 switch (op->type) {
249
250 case SLANG_OPER_NONE:
251 spaces(indent);
252 printf("SLANG_OPER_NONE\n");
253 break;
254
255 case SLANG_OPER_BLOCK_NO_NEW_SCOPE:
256 spaces(indent);
257 printf("{ locals=%p outer=%p\n", (void*)op->locals, (void*)op->locals->outer_scope);
258 print_generic(op, NULL, indent+3);
259 spaces(indent);
260 printf("}\n");
261 break;
262
263 case SLANG_OPER_BLOCK_NEW_SCOPE:
264 spaces(indent);
265 printf("{{ // new scope locals=%p outer=%p: ",
266 (void *) op->locals,
267 (void *) op->locals->outer_scope);
268 for (i = 0; i < op->locals->num_variables; i++) {
269 printf("%s ", (char *) op->locals->variables[i]->a_name);
270 }
271 printf("\n");
272 print_generic(op, NULL, indent+3);
273 spaces(indent);
274 printf("}}\n");
275 break;
276
277 case SLANG_OPER_VARIABLE_DECL:
278 assert(op->num_children == 0 || op->num_children == 1);
279 {
280 slang_variable *v;
281 v = _slang_locate_variable(op->locals, op->a_id, GL_TRUE);
282 if (v) {
283 const slang_variable_scope *scope;
284 spaces(indent);
285 printf("DECL (locals=%p outer=%p) ", (void*)op->locals, (void*) op->locals->outer_scope);
286 print_type(&v->type);
287 printf(" %s (%p)", (char *) op->a_id,
288 (void *) find_var(op->locals, op->a_id));
289
290 scope = find_scope(op->locals, op->a_id);
291 printf(" (in scope %p) ", (void *) scope);
292 assert(scope);
293 if (op->num_children == 1) {
294 printf(" :=\n");
295 slang_print_tree(&op->children[0], indent + 3);
296 }
297 else if (v->initializer) {
298 printf(" := INITIALIZER\n");
299 slang_print_tree(v->initializer, indent + 3);
300 }
301 else {
302 printf(";\n");
303 }
304 /*
305 spaces(indent);
306 printf("TYPE: ");
307 print_type(&v->type);
308 spaces(indent);
309 printf("ADDR: %d size: %d\n", v->address, v->size);
310 */
311 }
312 else {
313 spaces(indent);
314 printf("DECL %s (anonymous variable!!!!)\n", (char *) op->a_id);
315 }
316 }
317 break;
318
319 case SLANG_OPER_ASM:
320 spaces(indent);
321 printf("ASM: %s at %p locals=%p outer=%p\n",
322 (char *) op->a_id,
323 (void *) op,
324 (void *) op->locals,
325 (void *) op->locals->outer_scope);
326 print_generic(op, "ASM", indent+3);
327 break;
328
329 case SLANG_OPER_BREAK:
330 spaces(indent);
331 printf("BREAK\n");
332 break;
333
334 case SLANG_OPER_CONTINUE:
335 spaces(indent);
336 printf("CONTINUE\n");
337 break;
338
339 case SLANG_OPER_DISCARD:
340 spaces(indent);
341 printf("DISCARD\n");
342 break;
343
344 case SLANG_OPER_RETURN:
345 spaces(indent);
346 printf("RETURN\n");
347 if (op->num_children > 0)
348 slang_print_tree(&op->children[0], indent + 3);
349 break;
350
351 case SLANG_OPER_LABEL:
352 spaces(indent);
353 printf("LABEL %s\n", (char *) op->a_id);
354 break;
355
356 case SLANG_OPER_EXPRESSION:
357 spaces(indent);
358 printf("EXPR: locals=%p outer=%p\n",
359 (void *) op->locals,
360 (void *) op->locals->outer_scope);
361 /*print_generic(op, "SLANG_OPER_EXPRESSION", indent);*/
362 slang_print_tree(&op->children[0], indent + 3);
363 break;
364
365 case SLANG_OPER_IF:
366 spaces(indent);
367 printf("IF\n");
368 slang_print_tree(&op->children[0], indent + 3);
369 spaces(indent);
370 printf("THEN\n");
371 slang_print_tree(&op->children[1], indent + 3);
372 spaces(indent);
373 printf("ELSE\n");
374 slang_print_tree(&op->children[2], indent + 3);
375 spaces(indent);
376 printf("ENDIF\n");
377 break;
378
379 case SLANG_OPER_WHILE:
380 assert(op->num_children == 2);
381 spaces(indent);
382 printf("WHILE cond:\n");
383 slang_print_tree(&op->children[0], indent + 3);
384 spaces(indent);
385 printf("WHILE body:\n");
386 slang_print_tree(&op->children[1], indent + 3);
387 break;
388
389 case SLANG_OPER_DO:
390 spaces(indent);
391 printf("DO body:\n");
392 slang_print_tree(&op->children[0], indent + 3);
393 spaces(indent);
394 printf("DO cond:\n");
395 slang_print_tree(&op->children[1], indent + 3);
396 break;
397
398 case SLANG_OPER_FOR:
399 spaces(indent);
400 printf("FOR init:\n");
401 slang_print_tree(&op->children[0], indent + 3);
402 spaces(indent);
403 printf("FOR while:\n");
404 slang_print_tree(&op->children[1], indent + 3);
405 spaces(indent);
406 printf("FOR step:\n");
407 slang_print_tree(&op->children[2], indent + 3);
408 spaces(indent);
409 printf("FOR body:\n");
410 slang_print_tree(&op->children[3], indent + 3);
411 spaces(indent);
412 printf("ENDFOR\n");
413 /*
414 print_generic(op, "FOR", indent + 3);
415 */
416 break;
417
418 case SLANG_OPER_VOID:
419 spaces(indent);
420 printf("(oper-void)\n");
421 break;
422
423 case SLANG_OPER_LITERAL_BOOL:
424 spaces(indent);
425 printf("LITERAL (");
426 for (i = 0; i < op->literal_size; i++)
427 printf("%s ", op->literal[0] ? "TRUE" : "FALSE");
428 printf(")\n");
429
430 break;
431
432 case SLANG_OPER_LITERAL_INT:
433 spaces(indent);
434 printf("LITERAL (");
435 for (i = 0; i < op->literal_size; i++)
436 printf("%d ", (int) op->literal[i]);
437 printf(")\n");
438 break;
439
440 case SLANG_OPER_LITERAL_FLOAT:
441 spaces(indent);
442 printf("LITERAL (");
443 for (i = 0; i < op->literal_size; i++)
444 printf("%f ", op->literal[i]);
445 printf(")\n");
446 break;
447
448 case SLANG_OPER_IDENTIFIER:
449 {
450 const slang_variable_scope *scope;
451 spaces(indent);
452 if (op->var && op->var->a_name) {
453 scope = find_scope(op->locals, op->var->a_name);
454 printf("VAR %s (in scope %p)\n", (char *) op->var->a_name,
455 (void *) scope);
456 assert(scope);
457 }
458 else {
459 scope = find_scope(op->locals, op->a_id);
460 printf("VAR' %s (in scope %p) locals=%p outer=%p\n",
461 (char *) op->a_id,
462 (void *) scope,
463 (void *) op->locals,
464 (void *) op->locals->outer_scope);
465 assert(scope);
466 }
467 }
468 break;
469
470 case SLANG_OPER_SEQUENCE:
471 print_generic(op, "COMMA-SEQ", indent+3);
472 break;
473
474 case SLANG_OPER_ASSIGN:
475 spaces(indent);
476 printf("ASSIGNMENT locals=%p outer=%p\n",
477 (void *) op->locals,
478 (void *) op->locals->outer_scope);
479 print_binary(op, ":=", indent);
480 break;
481
482 case SLANG_OPER_ADDASSIGN:
483 spaces(indent);
484 printf("ASSIGN\n");
485 print_binary(op, "+=", indent);
486 break;
487
488 case SLANG_OPER_SUBASSIGN:
489 spaces(indent);
490 printf("ASSIGN\n");
491 print_binary(op, "-=", indent);
492 break;
493
494 case SLANG_OPER_MULASSIGN:
495 spaces(indent);
496 printf("ASSIGN\n");
497 print_binary(op, "*=", indent);
498 break;
499
500 case SLANG_OPER_DIVASSIGN:
501 spaces(indent);
502 printf("ASSIGN\n");
503 print_binary(op, "/=", indent);
504 break;
505
506 /*SLANG_OPER_MODASSIGN,*/
507 /*SLANG_OPER_LSHASSIGN,*/
508 /*SLANG_OPER_RSHASSIGN,*/
509 /*SLANG_OPER_ORASSIGN,*/
510 /*SLANG_OPER_XORASSIGN,*/
511 /*SLANG_OPER_ANDASSIGN,*/
512 case SLANG_OPER_SELECT:
513 spaces(indent);
514 printf("SLANG_OPER_SELECT n=%d\n", op->num_children);
515 assert(op->num_children == 3);
516 slang_print_tree(&op->children[0], indent+3);
517 spaces(indent);
518 printf("?\n");
519 slang_print_tree(&op->children[1], indent+3);
520 spaces(indent);
521 printf(":\n");
522 slang_print_tree(&op->children[2], indent+3);
523 break;
524
525 case SLANG_OPER_LOGICALOR:
526 print_binary(op, "||", indent);
527 break;
528
529 case SLANG_OPER_LOGICALXOR:
530 print_binary(op, "^^", indent);
531 break;
532
533 case SLANG_OPER_LOGICALAND:
534 print_binary(op, "&&", indent);
535 break;
536
537 /*SLANG_OPER_BITOR*/
538 /*SLANG_OPER_BITXOR*/
539 /*SLANG_OPER_BITAND*/
540 case SLANG_OPER_EQUAL:
541 print_binary(op, "==", indent);
542 break;
543
544 case SLANG_OPER_NOTEQUAL:
545 print_binary(op, "!=", indent);
546 break;
547
548 case SLANG_OPER_LESS:
549 print_binary(op, "<", indent);
550 break;
551
552 case SLANG_OPER_GREATER:
553 print_binary(op, ">", indent);
554 break;
555
556 case SLANG_OPER_LESSEQUAL:
557 print_binary(op, "<=", indent);
558 break;
559
560 case SLANG_OPER_GREATEREQUAL:
561 print_binary(op, ">=", indent);
562 break;
563
564 /*SLANG_OPER_LSHIFT*/
565 /*SLANG_OPER_RSHIFT*/
566 case SLANG_OPER_ADD:
567 print_binary(op, "+", indent);
568 break;
569
570 case SLANG_OPER_SUBTRACT:
571 print_binary(op, "-", indent);
572 break;
573
574 case SLANG_OPER_MULTIPLY:
575 print_binary(op, "*", indent);
576 break;
577
578 case SLANG_OPER_DIVIDE:
579 print_binary(op, "/", indent);
580 break;
581
582 /*SLANG_OPER_MODULUS*/
583 case SLANG_OPER_PREINCREMENT:
584 spaces(indent);
585 printf("PRE++\n");
586 slang_print_tree(&op->children[0], indent+3);
587 break;
588
589 case SLANG_OPER_PREDECREMENT:
590 spaces(indent);
591 printf("PRE--\n");
592 slang_print_tree(&op->children[0], indent+3);
593 break;
594
595 case SLANG_OPER_PLUS:
596 spaces(indent);
597 printf("SLANG_OPER_PLUS\n");
598 break;
599
600 case SLANG_OPER_MINUS:
601 spaces(indent);
602 printf("SLANG_OPER_MINUS\n");
603 break;
604
605 /*SLANG_OPER_COMPLEMENT*/
606 case SLANG_OPER_NOT:
607 spaces(indent);
608 printf("NOT\n");
609 slang_print_tree(&op->children[0], indent+3);
610 break;
611
612 case SLANG_OPER_SUBSCRIPT:
613 spaces(indent);
614 printf("SLANG_OPER_SUBSCRIPT locals=%p outer=%p\n",
615 (void *) op->locals,
616 (void *) op->locals->outer_scope);
617 print_generic(op, NULL, indent+3);
618 break;
619
620 case SLANG_OPER_CALL:
621 #if 0
622 slang_function *fun
623 = _slang_locate_function(A->space.funcs, oper->a_id,
624 oper->children,
625 oper->num_children, &A->space, A->atoms);
626 #endif
627 spaces(indent);
628 printf("CALL %s(\n", (char *) op->a_id);
629 for (i = 0; i < op->num_children; i++) {
630 slang_print_tree(&op->children[i], indent+3);
631 if (i + 1 < op->num_children) {
632 spaces(indent + 3);
633 printf(",\n");
634 }
635 }
636 spaces(indent);
637 printf(")\n");
638 break;
639
640 case SLANG_OPER_FIELD:
641 spaces(indent);
642 printf("FIELD %s of\n", (char*) op->a_id);
643 slang_print_tree(&op->children[0], indent+3);
644 break;
645
646 case SLANG_OPER_POSTINCREMENT:
647 spaces(indent);
648 printf("POST++\n");
649 slang_print_tree(&op->children[0], indent+3);
650 break;
651
652 case SLANG_OPER_POSTDECREMENT:
653 spaces(indent);
654 printf("POST--\n");
655 slang_print_tree(&op->children[0], indent+3);
656 break;
657
658 default:
659 printf("unknown op->type %d\n", (int) op->type);
660 }
661
662 }
663
664
665
666 void
667 slang_print_function(const slang_function *f, GLboolean body)
668 {
669 GLuint i;
670
671 #if 0
672 if (_mesa_strcmp((char *) f->header.a_name, "main") != 0)
673 return;
674 #endif
675
676 printf("FUNCTION %s ( scope=%p\n",
677 (char *) f->header.a_name, (void *) f->parameters);
678
679 for (i = 0; i < f->param_count; i++) {
680 print_variable(f->parameters->variables[i], 3);
681 }
682
683 printf(") param scope = %p\n", (void *) f->parameters);
684
685 if (body && f->body)
686 slang_print_tree(f->body, 0);
687 }
688
689
690
691
692
693 const char *
694 slang_type_qual_string(slang_type_qualifier q)
695 {
696 switch (q) {
697 case SLANG_QUAL_NONE:
698 return "none";
699 case SLANG_QUAL_CONST:
700 return "const";
701 case SLANG_QUAL_ATTRIBUTE:
702 return "attribute";
703 case SLANG_QUAL_VARYING:
704 return "varying";
705 case SLANG_QUAL_UNIFORM:
706 return "uniform";
707 case SLANG_QUAL_OUT:
708 return "out";
709 case SLANG_QUAL_INOUT:
710 return "inout";
711 case SLANG_QUAL_FIXEDOUTPUT:
712 return "fixedoutput";
713 case SLANG_QUAL_FIXEDINPUT:
714 return "fixedinputk";
715 default:
716 return "qual?";
717 }
718 }
719
720
721 static const char *
722 slang_type_string(slang_type_specifier_type t)
723 {
724 switch (t) {
725 case SLANG_SPEC_VOID:
726 return "void";
727 case SLANG_SPEC_BOOL:
728 return "bool";
729 case SLANG_SPEC_BVEC2:
730 return "bvec2";
731 case SLANG_SPEC_BVEC3:
732 return "bvec3";
733 case SLANG_SPEC_BVEC4:
734 return "bvec4";
735 case SLANG_SPEC_INT:
736 return "int";
737 case SLANG_SPEC_IVEC2:
738 return "ivec2";
739 case SLANG_SPEC_IVEC3:
740 return "ivec3";
741 case SLANG_SPEC_IVEC4:
742 return "ivec4";
743 case SLANG_SPEC_FLOAT:
744 return "float";
745 case SLANG_SPEC_VEC2:
746 return "vec2";
747 case SLANG_SPEC_VEC3:
748 return "vec3";
749 case SLANG_SPEC_VEC4:
750 return "vec4";
751 case SLANG_SPEC_MAT2:
752 return "mat2";
753 case SLANG_SPEC_MAT3:
754 return "mat3";
755 case SLANG_SPEC_MAT4:
756 return "mat4";
757 case SLANG_SPEC_SAMPLER1D:
758 return "sampler1D";
759 case SLANG_SPEC_SAMPLER2D:
760 return "sampler2D";
761 case SLANG_SPEC_SAMPLER3D:
762 return "sampler3D";
763 case SLANG_SPEC_SAMPLERCUBE:
764 return "samplerCube";
765 case SLANG_SPEC_SAMPLER1DSHADOW:
766 return "sampler1DShadow";
767 case SLANG_SPEC_SAMPLER2DSHADOW:
768 return "sampler2DShadow";
769 case SLANG_SPEC_SAMPLER2DRECT:
770 return "sampler2DRect";
771 case SLANG_SPEC_SAMPLER2DRECTSHADOW:
772 return "sampler2DRectShadow";
773 case SLANG_SPEC_STRUCT:
774 return "struct";
775 case SLANG_SPEC_ARRAY:
776 return "array";
777 default:
778 return "type?";
779 }
780 }
781
782
783 static const char *
784 slang_fq_type_string(const slang_fully_specified_type *t)
785 {
786 static char str[1000];
787 sprintf(str, "%s %s", slang_type_qual_string(t->qualifier),
788 slang_type_string(t->specifier.type));
789 return str;
790 }
791
792
793 void
794 slang_print_type(const slang_fully_specified_type *t)
795 {
796 printf("%s %s", slang_type_qual_string(t->qualifier),
797 slang_type_string(t->specifier.type));
798 }
799
800
801 #if 0
802 static char *
803 slang_var_string(const slang_variable *v)
804 {
805 static char str[1000];
806 sprintf(str, "%s : %s",
807 (char *) v->a_name,
808 slang_fq_type_string(&v->type));
809 return str;
810 }
811 #endif
812
813
814 void
815 slang_print_variable(const slang_variable *v)
816 {
817 printf("Name: %s\n", (char *) v->a_name);
818 printf("Type: %s\n", slang_fq_type_string(&v->type));
819 }
820
821
822 void
823 _slang_print_var_scope(const slang_variable_scope *vars, int indent)
824 {
825 GLuint i;
826
827 spaces(indent);
828 printf("Var scope %p %d vars:\n", (void *) vars, vars->num_variables);
829 for (i = 0; i < vars->num_variables; i++) {
830 spaces(indent + 3);
831 printf("%s (at %p)\n", (char *) vars->variables[i]->a_name, (void*) (vars->variables + i));
832 }
833 spaces(indent + 3);
834 printf("outer_scope = %p\n", (void*) vars->outer_scope);
835
836 if (vars->outer_scope) {
837 /*spaces(indent + 3);*/
838 _slang_print_var_scope(vars->outer_scope, indent + 3);
839 }
840 }
841
842
843
844 int
845 slang_checksum_tree(const slang_operation *op)
846 {
847 int s = op->num_children;
848 GLuint i;
849
850 for (i = 0; i < op->num_children; i++) {
851 s += slang_checksum_tree(&op->children[i]);
852 }
853 return s;
854 }