⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make-barchart.prl

📁 一个用在mips体系结构中的操作系统
💻 PRL
📖 第 1 页 / 共 2 页
字号:
            $connect[$sec] = 1;        }    }        if (/^SEPARATE_SECTIONS /) {        @fields = split(' ',$');        $separate_sections = 1;        foreach $sec (@fields) {            $separate[$sec] = 1;        }    }        if (/^NO_X_STAGGER/) {        $no_x_stagger = 1;    }        if (/^X_LABEL (.*)/) {        $x_label = $1;        Debug("X label = $x_label\n");    }        if (/^Y_LABEL (.*)/) {        $y_label = $1;    }        if (/^TITLE (.*)/) {        $title = $1;    }    if (/^KEY_BOX_UPPER_LEFT(.*)/) {        @fields = split;        $key_box_x1 = $fields[1];        $key_box_y1 = $fields[2];    }    if (/^KEY_BOX_UPPER_RIGHT(.*)/) {        @fields = split;        $key_box_x2 = $fields[1];        $key_box_y2 = $fields[2];    }        if (/WIDTH (\S+)/) {        print STDERR "XXX爓idhth $1\n";        $WIDTH = $1;    }    # FINALLY THE GRAPH DATA    if (/^D(.*)/) {       @fields = split;       $group = $fields[1];       $set = $fields[2];       for ($sec=0; $sec < $num_sections; $sec++) {           $data{$group, $set, $sec} = $fields[3+$sec];           $graph{$group, $set, $sec} = 0;       }   }}################################################################## Done reading in the file # Accumulate the data into stacked bar form#################################################################if ($num_groups == 0 || $num_sections == 0 || $num_sets == 0) {    printf STDERR "groups, sections, or sets is 0, either perl or you suck\n";    exit;}for ($group =0; $group < $num_groups; $group++) {    for ($set=0; $set < $num_sets; $set++) {        for ($sec=$num_sections-1; $sec >= 0; $sec--) {            for ($section = $sec; $section >= 0; $section--) {                $graph{$group, $set, $sec} += $data{$group, $set, $section};            }        }    }}################################################################## Turn on $DEBUG if you want to look at the data#################################################################if ($DEBUG) {    for ($group =0; $group < $num_groups; $group++) {        for ($set=0; $set < $num_sets; $set++) {            for ($sec=0; $sec < $num_sections; $sec++) {                printf("Data %d\n",$data{$group, $set, $sec});                printf("Graph %d\n", $graph{$group, $set, $sec});            }        }    }}################################################################## Print the splot header#################################################################printf "new graph\n";printf "size %3.2f by %3.2f\n", $WIDTH, $HEIGHT;printf "graph font %s\n", $GRAPH_FONT;$total_extra_space = 0;for ($i=0; $i<=$num_groups; $i++) {    $total_extra_space += $extra_space[$i];}$xmax = ($num_sets*2+1)*($num_groups)+$total_extra_space;$graph_xmax = $xmax;################################################################# Handle the key... the user can specify where to put this################################################################if ($EXCLUDE_KEY != 1) {    if ($custom_key_position == 1) {        $key_xpos = SetLocation($key_group, $key_set, .5);    } else {        $key_xpos = $graph_xmax * 1.05;    }    $key_ypos = $YMAX*0.98;    printf "key %3.2f, %3.2f, line, %s\n", $key_xpos, $key_ypos, $GRAPH_FONT;    $key_entry_height = $YMAX*0.055;    $key_entry_width  = $graph_xmax*0.08;    if (0) {      # Attempt to surround the key with a border (actually just the sides)      $xpos = $key_xpos*1.045;      $ypos = $key_ypos;      DrawLine($xpos, $ypos, $xpos, $ypos -(($num_sections)*$key_entry_height));      DrawLine($xpos+$key_entry_width, $ypos, $xpos+$key_entry_width,              $ypos - (($num_sections)*$key_entry_height));    }        # Feeble attempt to draw lines in the key that match the bars    if ($separate_sections) {         for ($sec = $num_sections-1; $sec >= 0; $sec--) {            if ($separate[$sec]) {                $ypos = $key_ypos - (($num_sections-1-$sec)*$key_entry_height);                DrawLine($key_xpos-0.2, $ypos, $key_xpos+$key_entry_width+0.2,                         $ypos);            }        }    }        if ($key_box_x1) {        # Draw a box around the key - this will be a hand-tweaking addition        DrawLine($key_box_x1, $key_box_y1, $key_box_x1, $key_box_y2);        DrawLine($key_box_x1, $key_box_y2, $key_box_x2, $key_box_y2);        DrawLine($key_box_x2, $key_box_y2, $key_box_x2, $key_box_y1);        DrawLine($key_box_x2, $key_box_y1, $key_box_x1, $key_box_y1);    }}################################################################# Compute the cumulative extra space for each group################################################################for ($i=1; $i <= $num_groups; $i++) {    $extra_space[$i] += $extra_space[$i-1];}################################################################## loop to print out the results#################################################################for ($sec = $num_sections-1; $sec >= 0; $sec--) {    PrintHeader($section_label[$sec], "fill", $COLOR[$sec],$CURVEMAT[$sec]);    printf "0, 0\n";    for ($group = 0; $group < $num_groups; $group++) {        for ($set=0; $set < $num_sets; $set++) {            $index = SetLocation($group, $set, 1);            printf "%d, %d\n", $index,  0;            printf "%d, %f\n", $index, $graph{$group, $set, $sec};            printf "%d, %f\n", $index + 1, $graph{$group, $set, $sec};            printf "%d, %d\n", $index + 1,  0;        }    }}################################################################# Set the maximum value of each set################################################################for ($group = 0; $group < $num_groups; $group++) {    for ($set=0; $set < $num_sets; $set++) {        if ($graph{$group, $set, $num_sections - 1}) {            $set_max{$group, $set} = $graph{$group, $set, $num_sections - 1};        } else {            $set_max{$group, $set} = $graph{$group, $set, $num_sections - 2};        }    }}################################################################# User wants a line drawn connecting certain sections of a group################################################################if ($connect_sections) {     for ($group = 0; $group < $num_groups; $group++) {        for ($sec = 0; $sec < $num_sections; $sec++) {            if ($connect[$sec]) {                PrintHeader("", "", "color black");                for ($set=0; $set < $num_sets-1; $set++) {                    $index = SetLocation($group, $set, 2);                    printf "%d, %f\n", $index, $graph{$group, $set, $sec};                    $index = SetLocation($group, $set + 1, 1);                    printf "%d, %f\n", $index, $graph{$group, $set+1, $sec};                }            }        }    }}################################################################# User wants a line drawn between certain sections of a single # bar... ################################################################if ($separate_sections) {     for ($group = 0; $group < $num_groups; $group++) {        for ($set=0; $set < $num_sets; $set++) {            for ($sec = 0; $sec < $num_sections; $sec++) {                if ($separate[$sec]) {                    $index = SetLocation($group, $set, 2);                    $ypos = $graph{$group, $set, $sec};                                    DrawLine($index-1.5, $ypos, $index+0.5, $ypos);                }            }        }    }}################################################################## loop to print out labels for the groups and sets################################################################for ($group=0; $group < $num_groups; $group++) {    for ($set=0; $set < $num_sets; $set++) {        if ($set_label_alignment eq "left") {             $set_location = SetLocation($group, $set, 1);        } else {            $set_location = SetLocation($group, $set, 1.5);        }        if ($set_label[$set] ne "BLANK") {            # Alternate lines for this output of set names            if ($set % 2) {                if ($no_x_stagger == 1) {                    PrintText($set_location, -(.05*$YMAX), $set_label[$set],                               $SET_FONT, $set_label_alignment,                               $rotate_set_labels);                } else {                    PrintText($set_location, -(.1*$YMAX), $set_label[$set],                               $SET_FONT, $set_label_alignment,                              $rotate_set_labels);                }            } else {                PrintText($set_location, -(.05*$YMAX), $set_label[$set],                          $SET_FONT, $set_label_alignment,                          $rotate_set_labels);            }        }        if ($top_set_label[$set] ne "BLANK") {            $set_location = SetLocation($group, $set, 2.0);            $ypos = $set_max{$group, $set} + 0.01*$YMAX,             PrintText($set_location, $ypos,                      $top_set_label[$set], $SET_FONT, "left", 90);        }    }    $group_location = GroupLocation($group);    if ($group_label[$group] ne "BLANK") {        if ($no_x_stagger == 1) {            PrintText($group_location, -(.13*$YMAX), $group_label[$group],                      $GROUP_FONT);        } else {            PrintText($group_location, -(.13*$YMAX), $group_label[$group],                      $GROUP_FONT);        }    }}################################################################# This is getting strange... super groups# This will only work for odd groups_per_supergroup################################################################if ($num_supergroups>0) {    $groups_per_supergroup = $num_groups / $num_supergroups;    $sg_num = 0;    for ($group=0; $group<$num_groups; $group++) {        # Hardcoding until I think this one through        if ($groups_per_supergroup == 3) {            if ((($group + 1) % 3) == 0) {                PrintText(GroupLocation($group), -(.2*$YMAX),                          $supergroup_label[$sg_num],$GROUP_FONT);                  $sg_num++;            }        } elsif ($groups_per_supergroup == 4) {            if ( ($group%4) == 1) {                print STDERR "XXXX supergroup $supergroup_label[$sg_num] \n";                PrintText((GroupLocation($group)+GroupLocation($group+1))/2,                          -(.2*$YMAX),                          $supergroup_label[$sg_num],$GROUP_FONT);                  $sg_num++;            }        }    }}################################################################## Print out the title of this graph... I don't like titles at the# bottom, so this puts it up top.################################################################if (defined($title) && ($title ne "NO-TITLE")) {    PrintText($graph_xmax/2, $YMAX*1.05, $title, $TITLE_FONT);}################################################################## Print out trailer information#################################################################printf "exclude x numbers\n";printf "x font $AXIS_FONT\n";printf "x minimum 0\n";printf "x maximum  $graph_xmax\n";printf "x interval 100\n";if (defined($x_label)) {    printf "x label $x_label\n";}if ($YMAX < $NUM_TICKS) {    printf "y numberstyle floating 2\n";}printf "y font $AXIS_FONT\n";printf "y tic font $TIC_FONT\n";printf "y minimum  $YMIN\n";printf "y maximum  $YMAX\n";printf "y interval %d\n", $YMAX/$NUM_TICKS;if (defined($y_label)) {    printf "y label $y_label\n";}printf "exclude mirror labels\n";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -