ministat.c (cd05b0f7a160bf1b5235b4da4aade30683e5d878) | ministat.c (4a7f3dcea5e69827c138eeb1121860d901bace55) |
---|---|
1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * --- 269 unchanged lines hidden (view full) --- 278 double span; 279 int width; 280 281 double x0, dx; 282 int height; 283 char *data; 284 char **bar; 285 int separate_bars; | 1/* 2 * ---------------------------------------------------------------------------- 3 * "THE BEER-WARE LICENSE" (Revision 42): 4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you 5 * can do whatever you want with this stuff. If we meet some day, and you think 6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp 7 * ---------------------------------------------------------------------------- 8 * --- 269 unchanged lines hidden (view full) --- 278 double span; 279 int width; 280 281 double x0, dx; 282 int height; 283 char *data; 284 char **bar; 285 int separate_bars; |
286 int num_datasets; |
|
286}; 287 288static struct plot plot; 289 290static void | 287}; 288 289static struct plot plot; 290 291static void |
291SetupPlot(int width, int separate) | 292SetupPlot(int width, int separate, int num_datasets) |
292{ 293 struct plot *pl; 294 295 pl = &plot; 296 pl->width = width; 297 pl->height = 0; 298 pl->data = NULL; 299 pl->bar = NULL; 300 pl->separate_bars = separate; | 293{ 294 struct plot *pl; 295 296 pl = &plot; 297 pl->width = width; 298 pl->height = 0; 299 pl->data = NULL; 300 pl->bar = NULL; 301 pl->separate_bars = separate; |
302 pl->num_datasets = num_datasets; |
|
301 pl->min = 999e99; 302 pl->max = -999e99; 303} 304 305static void 306AdjPlot(double a) 307{ 308 struct plot *pl; --- 30 unchanged lines hidden (view full) --- 339 return; 340 341 if (pl->separate_bars) 342 bar = val-1; 343 else 344 bar = 0; 345 346 if (pl->bar == NULL) { | 303 pl->min = 999e99; 304 pl->max = -999e99; 305} 306 307static void 308AdjPlot(double a) 309{ 310 struct plot *pl; --- 30 unchanged lines hidden (view full) --- 341 return; 342 343 if (pl->separate_bars) 344 bar = val-1; 345 else 346 bar = 0; 347 348 if (pl->bar == NULL) { |
347 pl->bar = malloc(sizeof(char *) * 2); 348 memset(pl->bar, 0, sizeof(char*) * 2); | 349 pl->bar = malloc(sizeof(char *) * pl->num_datasets); 350 memset(pl->bar, 0, sizeof(char*) * pl->num_datasets); |
349 } 350 if (pl->bar[bar] == NULL) { 351 pl->bar[bar] = malloc(pl->width); 352 memset(pl->bar[bar], 0, pl->width); 353 } 354 355 m = 1; 356 i = -1; --- 64 unchanged lines hidden (view full) --- 421 if (k >= 0 && k < MAX_DS) 422 putchar(symbol[k]); 423 else 424 printf("[%02x]", k); 425 } 426 putchar('|'); 427 putchar('\n'); 428 } | 351 } 352 if (pl->bar[bar] == NULL) { 353 pl->bar[bar] = malloc(pl->width); 354 memset(pl->bar[bar], 0, pl->width); 355 } 356 357 m = 1; 358 i = -1; --- 64 unchanged lines hidden (view full) --- 423 if (k >= 0 && k < MAX_DS) 424 putchar(symbol[k]); 425 else 426 printf("[%02x]", k); 427 } 428 putchar('|'); 429 putchar('\n'); 430 } |
429 for (i = 0; i < 2; i++) { | 431 for (i = 0; i < pl->num_datasets; i++) { |
430 if (pl->bar[i] == NULL) 431 continue; 432 putchar('|'); 433 for (j = 0; j < pl->width; j++) { 434 k = pl->bar[i][j]; 435 if (k == 0) 436 k = ' '; 437 putchar(k); --- 125 unchanged lines hidden (view full) --- 563 nds = argc; 564 for (i = 0; i < nds; i++) { 565 ds[i] = ReadSet(argv[i]); 566 printf("%c %s\n", symbol[i+1], argv[i]); 567 } 568 } 569 570 if (!flag_n) { | 432 if (pl->bar[i] == NULL) 433 continue; 434 putchar('|'); 435 for (j = 0; j < pl->width; j++) { 436 k = pl->bar[i][j]; 437 if (k == 0) 438 k = ' '; 439 putchar(k); --- 125 unchanged lines hidden (view full) --- 565 nds = argc; 566 for (i = 0; i < nds; i++) { 567 ds[i] = ReadSet(argv[i]); 568 printf("%c %s\n", symbol[i+1], argv[i]); 569 } 570 } 571 572 if (!flag_n) { |
571 SetupPlot(74, flag_s); | 573 SetupPlot(74, flag_s, nds); |
572 for (i = 0; i < nds; i++) 573 DimPlot(ds[i]); 574 for (i = 0; i < nds; i++) 575 PlotSet(ds[i], i + 1); 576 DumpPlot(); 577 } 578 VitalsHead(); 579 Vitals(ds[0], 1); 580 for (i = 1; i < nds; i++) { 581 Vitals(ds[i], i + 1); 582 if (!flag_n) 583 Relative(ds[i], ds[0], ci); 584 } 585 exit(0); 586} | 574 for (i = 0; i < nds; i++) 575 DimPlot(ds[i]); 576 for (i = 0; i < nds; i++) 577 PlotSet(ds[i], i + 1); 578 DumpPlot(); 579 } 580 VitalsHead(); 581 Vitals(ds[0], 1); 582 for (i = 1; i < nds; i++) { 583 Vitals(ds[i], i + 1); 584 if (!flag_n) 585 Relative(ds[i], ds[0], ci); 586 } 587 exit(0); 588} |