|
|
1.1 ! root 1: BEGIN { ! 2: total = -1.0; ! 3: maxcolor = .65 ! 4: minsaturation = .3; ! 5: ! 6: print ".GS"; ! 7: print ".PS"; ! 8: print"/ShadedEllipse {"; ! 9: print" /height exch def"; ! 10: print" /width exch def"; ! 11: print" /nodename exch def"; ! 12: print" currentpoint % save for label"; ! 13: print" % distort user space"; ! 14: print" gsave"; ! 15: print" currentpoint translate"; ! 16: print" 0 0 moveto"; ! 17: print" width height div 1 scale % scale in x"; ! 18: print" height 2 div 0 rmoveto"; ! 19: print" 0 0 height 2 div 0 360 arc closepath"; ! 20: print" gsave"; ! 21: print" fill"; ! 22: print" grestore"; ! 23: print" 0 setgray stroke"; ! 24: print" grestore"; ! 25: print" moveto"; ! 26: print" gsave"; ! 27: print" 0 setgray"; ! 28: print" nodename width .9 mul height .9 mul daglabel"; ! 29: print" grestore"; ! 30: print"} def"; ! 31: print"/ShadedEllipse_clip {Ellipse_clip} bind def"; ! 32: print".PE"; ! 33: printf ("draw nodes as ShadedEllipse color \"[%.2f %.2f 1]\";\n",maxcolor,minsaturation); ! 34: ! 35: } ! 36: ! 37: $1 ~ /\[/ && $0 !~ "as a" { ! 38: if ($5 == "start") total = $3 + $4; ! 39: else {if (total <= 0.0) exit;} ! 40: if (NF == 6) { ! 41: tail = $5 ! 42: source = 1 ! 43: } ! 44: else { ! 45: tail = $6 ! 46: source = 0 ! 47: } ! 48: first = 1 ! 49: ! 50: while (getline) { ! 51: if (NF == 0) { ! 52: if (first == 1) { ! 53: if (source == 1) ! 54: print "node " tail ";" ! 55: } ! 56: else ! 57: print ";" ! 58: break ! 59: } ! 60: if ( $2 ~ /\./ ) { ! 61: color = maxcolor * (1.0 - ($1 + $2)/total) ! 62: ! 63: if (first == 1) { ! 64: first = 0 ! 65: printf ("edge from %s to %s color \"[%.2f 1 1]\"", tail, $4, color) ! 66: } ! 67: else { ! 68: printf (",\n\tto %s color \"[%.2f 1 1]\"", $4, color) ! 69: } ! 70: Indegree[$4] += 1; ! 71: } ! 72: else { # Recursive call ! 73: if (first == 1) { ! 74: first = 0 ! 75: printf ("edge from %s to %s ", tail, $2) ! 76: } ! 77: else { ! 78: printf (",\n\tto %s", $2) ! 79: } ! 80: } ! 81: } ! 82: } ! 83: ! 84: $1 == "flat" { ! 85: while ($1 != "granularity:") getline; ! 86: getline; ! 87: getline; ! 88: getline; ! 89: getline; ! 90: while (Indegree[$(NF - 1)] <= 0) getline; ! 91: scale = $1; ! 92: while (NF > 0) { ! 93: if ($1 == "") exit; ! 94: if ($(NF - 2) == "<cycle") func_name = $(NF - 3); ! 95: else func_name = $(NF - 1); ! 96: if (Indegree[func_name] > 0) { ! 97: color = maxcolor * (1.0 - $1/scale); ! 98: saturation = minsaturation + ((1.0 - minsaturation) * $1/scale); ! 99: printf("draw %s color \"[%.2f %.2f 1]\";\n",func_name,color,saturation); ! 100: } ! 101: getline; ! 102: } ! 103: exit; ! 104: } ! 105: ! 106: END { print ".GE" }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.