00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef USE_GD
00024
00025 #include <stdlib.h>
00026 #include <stdio.h>
00027 #include <time.h>
00028 #include <ctype.h>
00029 #include <math.h>
00030 #include <errno.h>
00031 #include <unistd.h>
00032 #include <string.h>
00033 #include <sys/types.h>
00034 #include <sys/stat.h>
00035 #include <fcntl.h>
00036 #include <dirent.h>
00037 #include <assert.h>
00038 #include <signal.h>
00039 #include <string.h>
00040
00041 #include "common.h"
00042
00043 #include "oifdefine.h"
00044
00045 #include <gd.h>
00046 #include <gdfontmb.h>
00047 #include <gdfontt.h>
00048
00049 #define LINE_PLOT (1<<0)
00050 #define PULSE_PLOT (1<<1)
00051 #define COMP_PLOT (1<<2)
00052 #define FALL_PLOT (1<<3)
00053
00054 #define AUTO_MIN (1<<0)
00055 #define AUTO_MAX (1<<1)
00056 #define KEEP_SCALE (1<<2)
00057 #define LOG2_SCALE (1<<3)
00058
00059 #define XMAX 500.0
00060 #define XMARGIN 40.0
00061 #define YMARGIN 40.0
00062 #define YMAX 250.0
00063
00064 int xTicks;
00065 int label;
00066 int shortLength=24*60;
00067 int longLength=7*24*60;
00068 int useSynth=0;
00069 int NPLOTS;
00070 char stationName[128] = "";
00071
00072
00074 #define MAX_STRING_LENGTH 64
00075 struct OsirisInformationField {
00076 char name[MAX_STRING_LENGTH];
00077 int type;
00078 int verboseOnly;
00079 int valid;
00080 union {
00081 float f;
00082 int d;
00083 char s[MAX_STRING_LENGTH];
00084 } value;
00085 };
00086
00087 struct PlotType {
00088 gdImagePtr im;
00089 char * name;
00090 char *mask;
00091 char *format;
00092 char *yFormat;
00093 char *xTitle;
00094 char *yTitle;
00095 char *title;
00096 int order;
00097 int color;
00098 int type;
00099 float *data;
00100 int *count;
00101 int active;
00102 float yMin;
00103 float yMax;
00104 int autoScale;
00105 float yTicks;
00106 int maxLag;
00107 void * aux;
00108 };
00109
00110 struct PlotType plot[] = {
00111 {
00112 name: "",
00113 xTitle: "time",
00114 yTitle: "kBytes",
00115 title: "Total space on storage",
00116 mask: "DISK:",
00117 format: "%*s %*s %f",
00118 color: 0x0000ff,
00119 type: LINE_PLOT,
00120 autoScale: AUTO_MAX,
00121 yMin: 0.,
00122 yTicks: 5.0,
00123 maxLag: 1,
00124 yFormat: "",
00125 aux: NULL,
00126 order: 2
00127 },
00128 {
00129 name: "",
00130 xTitle: "time",
00131 yTitle: "kBytes",
00132 title: "Used space on storage",
00133 mask: "DISK:",
00134 format: "%*s %*s %*s %f",
00135 color: 0xff0000,
00136 type: COMP_PLOT,
00137 autoScale: KEEP_SCALE,
00138 yTicks: 5.0,
00139 maxLag: 1,
00140 yFormat: "%7.0g",
00141 aux: NULL,
00142 order: 1
00143 },
00144 {
00145 name: "Storage",
00146 xTitle: "time",
00147 yTitle: "kBytes",
00148 title: "Free space on storage",
00149 mask: "DISK:",
00150 format: "%*s %*s %*s %f",
00151 color: 0x00ff00,
00152 type: FALL_PLOT,
00153 autoScale: KEEP_SCALE,
00154 yTicks: 5.0,
00155 maxLag: 1,
00156 yFormat: "%7.0g",
00157 aux: NULL,
00158 order: 0
00159 },
00160 {
00161 name: "Temperature",
00162 xTitle: "time",
00163 yTitle: "degrees",
00164 title: "Internal temperature",
00165 mask: "STATUS:",
00166 format: "%*s %*s %*s %*s %f",
00167 color: 0x0000ff,
00168 type: LINE_PLOT,
00169 autoScale: (AUTO_MIN|AUTO_MAX),
00170 yFormat: "%7.1f",
00171 aux: NULL,
00172 yTicks: -1,
00173 maxLag: 1,
00174 order: 0
00175 },
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194 {
00195 name: "NTP",
00196 xTitle: "time",
00197 yTitle: "time accuracy (ms)",
00198 title: "NTP time accuracy",
00199 mask: "NTP:",
00200 format: "%*s %f",
00201 color: 0x0000ff,
00202 type: LINE_PLOT,
00203 autoScale: (AUTO_MIN|AUTO_MAX),
00204 yFormat: "%7.0f",
00205 aux: NULL,
00206 yTicks: 100.0,
00207 maxLag: 1,
00208 order: 0
00209 },
00210 {
00211 name: "CpuLoad",
00212 xTitle: "time",
00213 yTitle: "CPU load (%)",
00214 title: "Main CPU load",
00215 mask: "STATUS:",
00216 format: "%*s %f",
00217 color: 0x0000ff,
00218 type: PULSE_PLOT,
00219 autoScale: 0,
00220 yMin: 0,
00221 yFormat: "%7.0f",
00222 aux: NULL,
00223 yMax: 100,
00224 yTicks: 5.0,
00225 maxLag: 1,
00226 order: 0
00227 },
00228 {
00229 name: "",
00230 xTitle: "time",
00231 yTitle: "",
00232 title: "Internal battery",
00233 mask: "STATUS:",
00234 format: "%*s %*s %*s %f",
00235 color: 0x00ff00,
00236 type: LINE_PLOT,
00237 autoScale: 0,
00238 yFormat: "",
00239 aux: NULL,
00240 yMin: 7,
00241 yMax: 17,
00242 yTicks: 5.0,
00243 maxLag: 1,
00244 order: 1
00245 },
00246 {
00247 name: "Power",
00248 xTitle: "time",
00249 yTitle: "level (volts)",
00250 title: "Main power supply",
00251 mask: "STATUS:",
00252 format: "%*s %*s %f",
00253 color: 0x0000ff,
00254 type: LINE_PLOT,
00255 autoScale: KEEP_SCALE,
00256 yFormat: "%7.1f",
00257 aux: NULL,
00258 yMin: 7,
00259 yMax: 17,
00260 yTicks: 5.0,
00261 maxLag: 1,
00262 order: 0
00263 },
00264 {
00265 name: "ClockDrift",
00266 xTitle: "time",
00267 yTitle: "clock drift (ppm)",
00268 title: "Clock drift",
00269 mask: "CLOCK:",
00270 format: "%*s %f",
00271 color: 0x0000ff,
00272 type: LINE_PLOT,
00273 autoScale: 0,
00274 yMin: -0.75,
00275 yMax: 0.7,
00276 yFormat: "%7.1f",
00277 aux: NULL,
00278 yTicks: -0.2,
00279 maxLag: 1,
00280 order: 0
00281 },
00282 {
00283 name: "ClockShift",
00284 xTitle: "time",
00285 yTitle: "clock shift (s)",
00286 title: "Clock shift",
00287 mask: "CLOCK:",
00288 format: "%*s %*s %f",
00289 color: 0x0000ff,
00290 type: LINE_PLOT,
00291 autoScale: (AUTO_MIN|AUTO_MAX),
00292 yFormat: "%7.7g",
00293 aux: NULL,
00294 yTicks: 5.0,
00295 maxLag: 1,
00296 order: 0
00297 },
00298 {
00299 name: "Throughput",
00300 xTitle: "throughput",
00301 yTitle: "Bytes/s",
00302 title: "Data throughput",
00303 mask: "DISK:",
00304 format: "%*s %*s %*s %*s %*s %*s %f",
00305 color: 0x0000ff,
00306 type: PULSE_PLOT,
00307 autoScale: (AUTO_MIN|AUTO_MAX),
00308 yFormat: "%7g",
00309 aux: NULL,
00310 yTicks: 5.0,
00311 maxLag: 1,
00312 order: 0
00313 },
00314 {
00315 name: "",
00316 xTitle: "time",
00317 yTitle: "# sats",
00318 title: "Satelites in view",
00319 mask: "GPS:",
00320 format: "%*s %*s %*f/%f",
00321 color: 0x0000ff,
00322 type: PULSE_PLOT,
00323 autoScale: (AUTO_MAX),
00324 yMin: 0,
00325 yFormat: "",
00326 aux: NULL,
00327 yTicks: 5.0,
00328 maxLag: 1,
00329 order: 1
00330 },
00331 {
00332 name: "Gps",
00333 xTitle: "",
00334 yTitle: "",
00335 title: "Satelites used",
00336 mask: "GPS:",
00337 color: 0x00f000,
00338 format: "%*s %*s %f",
00339 type: PULSE_PLOT,
00340 autoScale: KEEP_SCALE,
00341 yFormat: "%7.0f",
00342 aux: NULL,
00343 yTicks: -1.0,
00344 maxLag: 1,
00345 order: 0
00346 },
00347
00348 {
00349 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00350 color: 0xa0a0a0,
00351 format: "%*s %f",
00352 yFormat: "%7.0f",
00353 yTicks: -1.0,
00354 maxLag: 1,
00355 yMin: 0,
00356 yMax: 24,
00357 aux: &(acquisit_Sta0),
00358 order: 23
00359 },
00360 {
00361 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00362 color: 0xa00000,
00363 format: "%*s %*s %f",
00364 yFormat: "%7.0f",
00365 yTicks: -1.0,
00366 maxLag: 1,
00367 yMin: 0,
00368 yMax: 24,
00369 aux: &(acquisit_Sta1),
00370 order: 22
00371 },
00372 {
00373 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00374 color: 0x0a0000,
00375 format: "%*s %*s %*s %f",
00376 yFormat: "%7.0f",
00377 yTicks: -1.0,
00378 maxLag: 1,
00379 yMin: 0,
00380 yMax: 24,
00381 aux: &(acquisit_Sta2),
00382 order: 21
00383 },
00384 {
00385 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00386 color: 0x00a000,
00387 format: "%*s %*s %*s %*s %f",
00388 yFormat: "%7.0f",
00389 yTicks: -1.0,
00390 maxLag: 1,
00391 yMin: 0,
00392 yMax: 24,
00393 aux: &(acquisit_Sta3),
00394 order: 20
00395 },
00396 {
00397 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00398 color: 0x000a00,
00399 format: "%*s %*s %*s %*s %*s %f",
00400 yFormat: "%7.0f",
00401 yTicks: -1.0,
00402 maxLag: 1,
00403 yMin: 0,
00404 yMax: 24,
00405 aux: &(acquisit_Sta4),
00406 order: 19
00407 },
00408 {
00409 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00410 color: 0x0000a0,
00411 format: "%*s %*s %*s %*s %*s %*s %f",
00412 yFormat: "%7.0f",
00413 yTicks: -1.0,
00414 maxLag: 1,
00415 yMin: 0,
00416 yMax: 24,
00417 aux: &(acquisit_Sta5),
00418 order: 18
00419 },
00420 {
00421 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00422 color: 0x00000a,
00423 format: "%*s %*s %*s %*s %*s %*s %*s %f",
00424 yFormat: "%7.0f",
00425 yTicks: -1.0,
00426 maxLag: 1,
00427 yMin: 0,
00428 yMax: 24,
00429 aux: &(acquisit_Sta6),
00430 order: 17
00431 },
00432 {
00433 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00434 color: 0xaa0000,
00435 format: "%*s %*s %*s %*s %*s %*s %*s %*s %f",
00436 yFormat: "%7.0f",
00437 yTicks: -1.0,
00438 maxLag: 1,
00439 yMin: 0,
00440 yMax: 24,
00441 aux: &(acquisit_Sta7),
00442 order: 16
00443 },
00444 {
00445 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00446 color: 0x0aa000,
00447 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00448 yFormat: "%7.0f",
00449 yTicks: -1.0,
00450 maxLag: 1,
00451 yMin: 0,
00452 yMax: 24,
00453 aux: &(acquisit_Sta8),
00454 order: 15
00455 },
00456 {
00457 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00458 color: 0x00aa00,
00459 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00460 yFormat: "%7.0f",
00461 yTicks: -1.0,
00462 maxLag: 1,
00463 yMin: 0,
00464 yMax: 24,
00465 aux: &(acquisit_Sta9),
00466 order: 14
00467 },
00468 {
00469 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00470 color: 0x000aa0,
00471 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00472 yFormat: "%7.0f",
00473 yTicks: -1.0,
00474 maxLag: 1,
00475 yMin: 0,
00476 yMax: 24,
00477 aux: &(acquisit_Sta10),
00478 order: 13
00479 },
00480 {
00481 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00482 color: 0x0000aa,
00483 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00484 yFormat: "%7.0f",
00485 yTicks: -1.0,
00486 maxLag: 1,
00487 yMin: 0,
00488 yMax: 24,
00489 aux: &(acquisit_Sta11),
00490 order: 12
00491 },
00492 {
00493 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00494 color: 0xaaa000,
00495 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00496 yFormat: "%7.0f",
00497 yTicks: -1.0,
00498 maxLag: 1,
00499 yMin: 0,
00500 yMax: 24,
00501 aux: &(acquisit_Sta12),
00502 order: 11
00503 },
00504 {
00505 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00506 color: 0x0aaa00,
00507 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00508 yFormat: "%7.0f",
00509 yTicks: -1.0,
00510 maxLag: 1,
00511 yMin: 0,
00512 yMax: 24,
00513 aux: &(acquisit_Sta13),
00514 order: 10
00515 },
00516 {
00517 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00518 color: 0x00aaa0,
00519 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00520 yFormat: "%7.0f",
00521 yTicks: -1.0,
00522 maxLag: 1,
00523 yMin: 0,
00524 yMax: 24,
00525 aux: &(acquisit_Sta14),
00526 order: 9
00527 },
00528 {
00529 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00530 color: 0x000aaa,
00531 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00532 yFormat: "%7.0f",
00533 yTicks: -1.0,
00534 maxLag: 1,
00535 yMin: 0,
00536 yMax: 24,
00537 aux: &(acquisit_Sta15),
00538 order: 8
00539 },
00540 {
00541 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00542 color: 0xa000aa,
00543 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00544 yFormat: "%7.0f",
00545 yTicks: -1.0,
00546 maxLag: 1,
00547 yMin: 0,
00548 yMax: 24,
00549 aux: &(acquisit_Sta16),
00550 order: 7
00551 },
00552 {
00553 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00554 color: 0x0a00aa,
00555 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00556 yFormat: "%7.0f",
00557 yTicks: -1.0,
00558 maxLag: 1,
00559 yMin: 0,
00560 yMax: 24,
00561 aux: &(acquisit_Sta17),
00562 order: 6
00563 },
00564 {
00565 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00566 color: 0x00a0aa,
00567 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00568 yFormat: "%7.0f",
00569 yTicks: -1.0,
00570 maxLag: 1,
00571 yMin: 0,
00572 yMax: 24,
00573 aux: &(acquisit_Sta18),
00574 order: 5
00575 },
00576 {
00577 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00578 color: 0xa0aa00,
00579 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00580 yFormat: "%7.0f",
00581 yTicks: -1.0,
00582 maxLag: 1,
00583 yMin: 0,
00584 yMax: 24,
00585 aux: &(acquisit_Sta19),
00586 order: 4
00587 },
00588 {
00589 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00590 color: 0x0aaa00,
00591 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00592 yFormat: "%7.0f",
00593 yTicks: -1.0,
00594 maxLag: 1,
00595 yMin: 0,
00596 yMax: 24,
00597 aux: &(acquisit_Sta20),
00598 order: 3
00599 },
00600 {
00601 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00602 color: 0x00aa0a,
00603 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00604 yFormat: "%7.0f",
00605 yTicks: -1.0,
00606 maxLag: 1,
00607 yMin: 0,
00608 yMax: 24,
00609 aux: &(acquisit_Sta21),
00610 order: 2
00611 },
00612 {
00613 name: "", xTitle: "", yTitle: "", title: "", mask: "STA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00614 color: 0xa0aa0a,
00615 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00616 yFormat: "%7.0f",
00617 yTicks: -1.0,
00618 maxLag: 1,
00619 yMin: 0,
00620 yMax: 24,
00621 aux: &(acquisit_Sta22),
00622 order: 1
00623 },
00624 {
00625 name: "STA",
00626 xTitle: "",
00627 yTitle: "",
00628 title: "Short term average (log2)",
00629 mask: "STA:",
00630 color: 0x000000,
00631 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00632 type: LINE_PLOT,
00633 autoScale: KEEP_SCALE|LOG2_SCALE,
00634 yFormat: "%7.0f",
00635 yTicks: -1.0,
00636 maxLag: 1,
00637 yMin: 0,
00638 yMax: 24,
00639 aux: &(acquisit_Sta23),
00640 order: 0
00641 },
00642
00643 {
00644 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00645 color: 0xa0a0a0,
00646 format: "%*s %f",
00647 yFormat: "%7.0f",
00648 yTicks: -1.0,
00649 maxLag: 1,
00650 yMin: 0,
00651 yMax: 24,
00652 aux: &(acquisit_Lta0),
00653 order: 23
00654 },
00655 {
00656 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00657 color: 0xa00000,
00658 format: "%*s %*s %f",
00659 yFormat: "%7.0f",
00660 yTicks: -1.0,
00661 maxLag: 1,
00662 yMin: 0,
00663 yMax: 24,
00664 aux: &(acquisit_Lta1),
00665 order: 22
00666 },
00667 {
00668 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00669 color: 0x0a0000,
00670 format: "%*s %*s %*s %f",
00671 yFormat: "%7.0f",
00672 yTicks: -1.0,
00673 maxLag: 1,
00674 yMin: 0,
00675 yMax: 24,
00676 aux: &(acquisit_Lta2),
00677 order: 21
00678 },
00679 {
00680 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00681 color: 0x00a000,
00682 format: "%*s %*s %*s %*s %f",
00683 yFormat: "%7.0f",
00684 yTicks: -1.0,
00685 maxLag: 1,
00686 yMin: 0,
00687 yMax: 24,
00688 aux: &(acquisit_Lta3),
00689 order: 20
00690 },
00691 {
00692 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00693 color: 0x000a00,
00694 format: "%*s %*s %*s %*s %*s %f",
00695 yFormat: "%7.0f",
00696 yTicks: -1.0,
00697 maxLag: 1,
00698 yMin: 0,
00699 yMax: 24,
00700 aux: &(acquisit_Lta4),
00701 order: 19
00702 },
00703 {
00704 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00705 color: 0x0000a0,
00706 format: "%*s %*s %*s %*s %*s %*s %f",
00707 yFormat: "%7.0f",
00708 yTicks: -1.0,
00709 maxLag: 1,
00710 yMin: 0,
00711 yMax: 24,
00712 aux: &(acquisit_Lta5),
00713 order: 18
00714 },
00715 {
00716 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00717 color: 0x00000a,
00718 format: "%*s %*s %*s %*s %*s %*s %*s %f",
00719 yFormat: "%7.0f",
00720 yTicks: -1.0,
00721 maxLag: 1,
00722 yMin: 0,
00723 yMax: 24,
00724 aux: &(acquisit_Lta6),
00725 order: 17
00726 },
00727 {
00728 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00729 color: 0xaa0000,
00730 format: "%*s %*s %*s %*s %*s %*s %*s %*s %f",
00731 yFormat: "%7.0f",
00732 yTicks: -1.0,
00733 maxLag: 1,
00734 yMin: 0,
00735 yMax: 24,
00736 aux: &(acquisit_Lta7),
00737 order: 16
00738 },
00739 {
00740 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00741 color: 0x0aa000,
00742 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00743 yFormat: "%7.0f",
00744 yTicks: -1.0,
00745 maxLag: 1,
00746 yMin: 0,
00747 yMax: 24,
00748 aux: &(acquisit_Lta8),
00749 order: 15
00750 },
00751 {
00752 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00753 color: 0x00aa00,
00754 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00755 yFormat: "%7.0f",
00756 yTicks: -1.0,
00757 maxLag: 1,
00758 yMin: 0,
00759 yMax: 24,
00760 aux: &(acquisit_Lta9),
00761 order: 14
00762 },
00763 {
00764 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00765 color: 0x000aa0,
00766 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00767 yFormat: "%7.0f",
00768 yTicks: -1.0,
00769 maxLag: 1,
00770 yMin: 0,
00771 yMax: 24,
00772 aux: &(acquisit_Lta10),
00773 order: 13
00774 },
00775 {
00776 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00777 color: 0x0000aa,
00778 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00779 yFormat: "%7.0f",
00780 yTicks: -1.0,
00781 maxLag: 1,
00782 yMin: 0,
00783 yMax: 24,
00784 aux: &(acquisit_Lta11),
00785 order: 12
00786 },
00787 {
00788 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00789 color: 0xaaa000,
00790 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00791 yFormat: "%7.0f",
00792 yTicks: -1.0,
00793 maxLag: 1,
00794 yMin: 0,
00795 yMax: 24,
00796 aux: &(acquisit_Lta12),
00797 order: 11
00798 },
00799 {
00800 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00801 color: 0x0aaa00,
00802 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00803 yFormat: "%7.0f",
00804 yTicks: -1.0,
00805 maxLag: 1,
00806 yMin: 0,
00807 yMax: 24,
00808 aux: &(acquisit_Lta13),
00809 order: 10
00810 },
00811 {
00812 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00813 color: 0x00aaa0,
00814 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00815 yFormat: "%7.0f",
00816 yTicks: -1.0,
00817 maxLag: 1,
00818 yMin: 0,
00819 yMax: 24,
00820 aux: &(acquisit_Lta14),
00821 order: 9
00822 },
00823 {
00824 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00825 color: 0x000aaa,
00826 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00827 yFormat: "%7.0f",
00828 yTicks: -1.0,
00829 maxLag: 1,
00830 yMin: 0,
00831 yMax: 24,
00832 aux: &(acquisit_Lta15),
00833 order: 8
00834 },
00835 {
00836 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00837 color: 0xa000aa,
00838 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00839 yFormat: "%7.0f",
00840 yTicks: -1.0,
00841 maxLag: 1,
00842 yMin: 0,
00843 yMax: 24,
00844 aux: &(acquisit_Lta16),
00845 order: 7
00846 },
00847 {
00848 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00849 color: 0x0a00aa,
00850 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00851 yFormat: "%7.0f",
00852 yTicks: -1.0,
00853 maxLag: 1,
00854 yMin: 0,
00855 yMax: 24,
00856 aux: &(acquisit_Lta17),
00857 order: 6
00858 },
00859 {
00860 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00861 color: 0x00a0aa,
00862 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00863 yFormat: "%7.0f",
00864 yTicks: -1.0,
00865 maxLag: 1,
00866 yMin: 0,
00867 yMax: 24,
00868 aux: &(acquisit_Lta18),
00869 order: 5
00870 },
00871 {
00872 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00873 color: 0xa0aa00,
00874 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00875 yFormat: "%7.0f",
00876 yTicks: -1.0,
00877 maxLag: 1,
00878 yMin: 0,
00879 yMax: 24,
00880 aux: &(acquisit_Lta19),
00881 order: 4
00882 },
00883 {
00884 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00885 color: 0x0aaa00,
00886 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00887 yFormat: "%7.0f",
00888 yTicks: -1.0,
00889 maxLag: 1,
00890 yMin: 0,
00891 yMax: 24,
00892 aux: &(acquisit_Lta20),
00893 order: 3
00894 },
00895 {
00896 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00897 color: 0x00aa0a,
00898 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00899 yFormat: "%7.0f",
00900 yTicks: -1.0,
00901 maxLag: 1,
00902 yMin: 0,
00903 yMax: 24,
00904 aux: &(acquisit_Lta21),
00905 order: 2
00906 },
00907 {
00908 name: "", xTitle: "", yTitle: "", title: "", mask: "LTA:", type: LINE_PLOT, autoScale: KEEP_SCALE|LOG2_SCALE,
00909 color: 0xa0aa0a,
00910 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00911 yFormat: "%7.0f",
00912 yTicks: -1.0,
00913 maxLag: 1,
00914 yMin: 0,
00915 yMax: 24,
00916 aux: &(acquisit_Lta22),
00917 order: 1
00918 },
00919 {
00920 name: "LTA",
00921 xTitle: "",
00922 yTitle: "",
00923 title: "Long term average (log2)",
00924 mask: "LTA:",
00925 color: 0x000000,
00926 format: "%*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %f",
00927 type: LINE_PLOT,
00928 autoScale: KEEP_SCALE|LOG2_SCALE,
00929 yFormat: "%7.0f",
00930 yTicks: -1.0,
00931 maxLag: 1,
00932 yMin: 0,
00933 yMax: 24,
00934 aux: &(acquisit_Lta23),
00935 order: 0
00936 }
00937 };
00938
00940 void InitPlot(void)
00941 {
00942 int i;
00943 char *s=MyGetenv("STATION");
00944 if (s)
00945 {
00946 strcpy(stationName,s);
00947 }
00948 s=MyGetenv("UseOif");
00949 if (s)
00950 {
00951 if (0==strcmp(s,"yes"))
00952 {
00953 useSynth=1;
00954 }
00955 }
00956 for (i=0; i<NPLOTS; i++)
00957 {
00958
00959 plot[i].data=(float*)malloc(longLength*sizeof(float));
00960 plot[i].count=(int*)malloc(longLength*sizeof(int));
00961 memset(plot[i].data,0,longLength*sizeof(float));
00962 memset(plot[i].count,0,longLength*sizeof(int));
00963 plot[i].active=0;
00964 }
00965 }
00966
00968 void DoPlots(void)
00969 {
00970 char line[512];
00971 time_t startDate;
00972 int i,length,j,k;
00973 int black;
00974 int active=0;
00975 gdPoint points[2];
00976
00977 NPLOTS=sizeof(plot)/sizeof(struct PlotType);
00978 InitPlot();
00979
00980 startDate=time(NULL)+1800-longLength*60;
00981
00982 k=0;
00983
00984 while (fgets(line, 511, stdin)!=NULL)
00985 {
00986 double dt;
00987 time_t t;
00988 int len,ndx;
00989 k++;
00990 if ((k%1000)==0)
00991 {
00992 fprintf(stderr,"%d\n",k);
00993 }
00994
00995 if (line[20]=='#') continue;
00996 len=strlen(line);
00997
00998 if (useSynth==0)
00999 {
01000 if (line[len-6]=='S')
01001 {
01002 if (0==strcmp(line+len-6,"SYNTH\n"))
01003 {
01004 continue;
01005 }
01006 }
01007 }
01008 else
01009 {
01010 if (line[len-6]!='S')
01011 {
01012 continue;
01013 }
01014 if (0!=strcmp(line+len-6,"SYNTH\n"))
01015 {
01016 continue;
01017 }
01018 }
01019
01020 str2time(line,&dt);
01021 t=(time_t)dt;
01022
01023 if (t<startDate) continue;
01024
01025 printf("%s",line);
01026
01027 for (i=0; i<NPLOTS; i++)
01028 {
01029 float tmpf;
01030
01031 if (strncmp(line+20,plot[i].mask,strlen(plot[i].mask)))
01032 {
01033 continue;
01034 }
01035
01036
01037 if (plot[i].aux)
01038 {
01039 struct OsirisInformationField *o;
01040 o=plot[i].aux;
01041 if (o->valid==0)
01042 {
01043 continue;
01044 }
01045 }
01046
01047
01048 if (0==strncmp(line+20,"DISK",4))
01049 {
01050 int ts,fs;
01051 sscanf(line+20,"%*s %*s %d %d",&ts,&fs);
01052 if ((ts==0)&&(fs==0))
01053 {
01054 continue;
01055 }
01056 }
01057
01058
01059 ndx=(t-startDate)/60;
01060 if ((ndx<0)||(ndx>=longLength))
01061 {
01062 puts(line);
01063 continue;
01064 }
01065 if (1==sscanf(line+20,plot[i].format,&tmpf))
01066 {
01067
01068 if (plot[i].autoScale&LOG2_SCALE)
01069 {
01070 tmpf+=0.1;
01071 if ((tmpf!=-1)&&(tmpf!=0))
01072 {
01073 plot[i].data[ndx]+=1.44269504*log(1.+fabs(tmpf/256.));
01074 plot[i].count[ndx]++;
01075 }
01076 }
01077 else
01078 {
01079 plot[i].data[ndx]+=tmpf;
01080 plot[i].count[ndx]++;
01081 }
01082 }
01083
01084 }
01085 }
01086
01087 for (i=0; i<NPLOTS; i++)
01088 {
01089 for (j=0; j<longLength; j++)
01090 {
01091 if (plot[i].count[j])
01092 {
01093 plot[i].data[j]/=(float)plot[i].count[j];
01094 }
01095 }
01096 }
01097
01098 for (length=0; length<2; length++)
01099 {
01100 int startPoint;
01101 char *suffix;
01102 if (length==0)
01103 {
01104 startPoint=0;
01105 suffix="Long";
01106 }
01107 else
01108 {
01109 startPoint=longLength-shortLength;
01110 suffix="Short";
01111 }
01112
01113 for (i=0; i<NPLOTS; i++)
01114 {
01115 int white,color,lag=0,skip;
01116 FILE *fout;
01117 double scaleY,scaleX,tmpf,delta=0.0;
01118
01119 if ((KEEP_SCALE&plot[i].autoScale)!=KEEP_SCALE)
01120 {
01121 for (j=startPoint; j<longLength; j++)
01122 {
01123 if (plot[i].count[j])
01124 {
01125 if (plot[i].autoScale&AUTO_MIN)
01126 {
01127 plot[i].yMin=plot[i].data[j];
01128 }
01129 if (plot[i].autoScale&AUTO_MAX)
01130 {
01131 plot[i].yMax=plot[i].data[j];
01132 }
01133 break;
01134 }
01135 }
01136 for (; j<longLength; j++)
01137 {
01138 if (plot[i].count[j]==0) continue;
01139 if ((KEEP_SCALE&plot[i].autoScale)!=KEEP_SCALE)
01140 {
01141 if (plot[i].autoScale&AUTO_MIN)
01142 {
01143 if (plot[i].data[j]<plot[i].yMin)
01144 {
01145 plot[i].yMin=plot[i].data[j];
01146 }
01147 }
01148 if (plot[i].autoScale&AUTO_MAX)
01149 {
01150 if (plot[i].data[j]>plot[i].yMax)
01151 {
01152 plot[i].yMax=plot[i].data[j];
01153 }
01154 }
01155 }
01156 }
01157 }
01158 scaleY=(YMAX-2.*YMARGIN)/(plot[i].yMax-plot[i].yMin);
01159 scaleX=(XMAX-3.*XMARGIN)/(float)(longLength-startPoint);
01160
01161
01162 if (plot[i].im==NULL)
01163 {
01164 plot[i].im=gdImageCreate(XMAX, YMAX);
01165 }
01166 if (plot[i].order>0)
01167 {
01168 plot[i+1].im=plot[i].im;
01169 if ((KEEP_SCALE&plot[i+1].autoScale)==KEEP_SCALE)
01170 {
01171 plot[i+1].yMax=plot[i].yMax;
01172 plot[i+1].yMin=plot[i].yMin;
01173 }
01174 }
01175 white=gdImageColorAllocate(plot[i].im, 255, 255, 255);
01176 black=gdImageColorAllocate(plot[i].im, 0, 0, 0);
01177 color=gdImageColorAllocate(plot[i].im,
01178 (plot[i].color>>16)&0xff,
01179 (plot[i].color>>8)&0xff,
01180 (plot[i].color)&0xff);
01181 j=startPoint;
01182 skip=0;
01183
01184 while (j<longLength)
01185 {
01186
01187 for (; j<longLength; j++)
01188 {
01189 if (plot[i].count[j]>0)
01190 {
01191 points[0].x=(int)( 2*XMARGIN+
01192 scaleX*(float)(j-startPoint) );
01193 points[0].y=(int)( YMARGIN +
01194 (plot[i].yMax-plot[i].data[j])*scaleY );
01195 skip=1;
01196 break;
01197 }
01198 }
01199
01200 for (; j<longLength; j++)
01201 {
01202 if (plot[i].count[j]==0)
01203 {
01204 lag++;
01205 if (lag>plot[i].maxLag)
01206 {
01207 break;
01208 }
01209 else
01210 {
01211 continue;
01212 }
01213 }
01214 else
01215 {
01216 lag=0;
01217 }
01218
01219
01220 plot[i].active=1;
01221 points[1].x=(int)( 2*XMARGIN +
01222 scaleX*(float)(j-startPoint) );
01223 points[1].y=(int)( YMARGIN +
01224 (plot[i].yMax-plot[i].data[j])*scaleY );
01225 switch (plot[i].type)
01226 {
01227 case PULSE_PLOT:
01228 points[0].x=points[1].x;
01229 points[0].y=(int)( YMARGIN +
01230 (plot[i].yMax-plot[i].yMin)*scaleY );
01231 gdImageOpenPolygon(plot[i].im,
01232 points, 2, color);
01233 break;
01234 case COMP_PLOT:
01235 points[0].y=(int)( YMARGIN +
01236 (plot[i].yMax-plot[i].yMin)*scaleY );
01237 points[1].y=(int)( YMAX - YMARGIN -
01238 (plot[i].yMax-plot[i].data[j])*scaleY );
01239 points[0].x=points[1].x;
01240 gdImageOpenPolygon(plot[i].im,
01241 points, 2, color);
01242 break;
01243 case FALL_PLOT:
01244 points[0].y=(int)( YMARGIN +1 );
01245 points[1].y=(int)( YMAX - YMARGIN -
01246 (plot[i].yMax-plot[i].data[j])*scaleY );
01247 points[0].x=points[1].x;
01248 gdImageOpenPolygon(plot[i].im,
01249 points, 2, color);
01250 break;
01251 case LINE_PLOT:
01252 gdImageOpenPolygon(plot[i].im,
01253 points, 2, color);
01254 skip=0;
01255 points[0].x=points[1].x;
01256 points[0].y=points[1].y;
01257 break;
01258 }
01259 }
01260 j++;
01261 }
01262
01263 points[0].x=2*XMARGIN;
01264 points[1].x=XMAX-XMARGIN;
01265 points[0].y=YMAX-YMARGIN;
01266 points[1].y=YMAX-YMARGIN;
01267 gdImageOpenPolygon(plot[i].im,points, 2, black);
01268
01269
01270 if (startPoint==0)
01271 {
01272 xTicks=60*12;
01273 label=3*24*60;
01274 k=3*24*60;
01275 }
01276 else
01277 {
01278 xTicks=60;
01279 label=12*60;
01280 k=12*60;
01281 }
01282 j=startPoint+(60*xTicks*(1+(startDate/(60*xTicks)))-startDate)/60;
01283 k=startPoint+(60*k*(1+(startDate/(60*k)))-startDate)/60;
01284
01285 for (; j<longLength; j+=xTicks)
01286 {
01287 points[0].x=(int)( 2*XMARGIN + scaleX*(float)(j-startPoint) );
01288 points[1].x=points[0].x;
01289 points[0].y=(int)(YMAX-YMARGIN);
01290 points[1].y=(int)(YMAX-YMARGIN + 2);
01291 gdImageOpenPolygon(plot[i].im,points, 2, black);
01292 }
01293
01294 for (; k<longLength; k+=label)
01295 {
01296 points[0].x=(int)( 2*XMARGIN + scaleX*(float)(k-startPoint) );
01297 points[1].x=points[0].x;
01298 points[1].y=(int)(YMAX-YMARGIN + 8);
01299 gdImageOpenPolygon(plot[i].im,points, 2, black);
01300 strcpy(line,time2str((double)(60+startDate+60*k)));
01301 line[16]=0;
01302 gdImageString(plot[i].im, gdFontGetMediumBold(),
01303 points[1].x-50,
01304 points[1].y,
01305 (unsigned char *)line, black);
01306 }
01307
01308 if (strlen(plot[i].xTitle))
01309 {
01310 gdImageString(plot[i].im, gdFontGetMediumBold(),
01311 XMAX/2,
01312 YMAX-YMARGIN + 20,
01313 (unsigned char *)plot[i].xTitle, black);
01314 }
01315
01316
01317 points[0].x=2*XMARGIN;
01318 points[1].x=points[0].x;
01319 points[0].y=YMARGIN;
01320 points[1].y=YMAX-YMARGIN;
01321 gdImageOpenPolygon(plot[i].im,points, 2, black);
01322
01323
01324 if (plot[i].yTicks>0.0)
01325 {
01326 delta=(plot[i].yMax-plot[i].yMin)/(double)(plot[i].yTicks);
01327 }
01328 if (plot[i].yTicks<0.0)
01329 {
01330 delta=-plot[i].yTicks;
01331 }
01332 if (((plot[i].yMax-plot[i].yMin)/delta)>10.)
01333 {
01334 delta=(plot[i].yMax-plot[i].yMin)/10.;
01335 }
01336 tmpf=delta*floor(plot[i].yMin/delta);
01337
01338 while (tmpf<plot[i].yMin) tmpf+=delta;
01339
01340 for (; tmpf<plot[i].yMax; tmpf+=delta)
01341 {
01342 points[1].y=points[0].y=
01343 (int)(YMARGIN+(plot[i].yMax-tmpf)*scaleY );
01344 points[0].x=2*XMARGIN;
01345 points[0].x=2*XMARGIN-4;
01346 gdImageOpenPolygon(plot[i].im,points, 2, black);
01347
01348 sprintf(line,plot[i].yFormat,tmpf);
01349 gdImageString(plot[i].im, gdFontGetMediumBold(),
01350 20, points[0].y-5,
01351 (unsigned char *)line, black);
01352 }
01353
01354
01355 if (strlen(plot[i].yTitle))
01356 {
01357 gdImageStringUp(plot[i].im, gdFontGetMediumBold(),
01358 5,
01359 2*YMAX/3,
01360 (unsigned char *)plot[i].yTitle, black);
01361 }
01362
01363 gdImageString(plot[i].im, gdFontGetMediumBold(),
01364 XMAX/2, 5+10*plot[i].order,
01365 (unsigned char *)plot[i].title, color);
01366
01367 if (plot[i].name)
01368 {
01369 active+=plot[i].active;
01370 if (strlen(plot[i].name))
01371 {
01372 sprintf(line,"%s%s.gif",plot[i].name,suffix);
01373 if (active)
01374 {
01375 fout=fopen(line,"wb");
01376 gdImageGif(plot[i].im, fout);
01377 fclose(fout);
01378 }
01379 else
01380 {
01381 unlink(line);
01382 }
01383 active=0;
01384 }
01385 }
01386 else
01387 {
01388
01389 if (plot[i].active)
01390 {
01391 active=1;
01392 }
01393 }
01394 }
01395
01396 for (i=0; i<NPLOTS; i++)
01397 {
01398 if (plot[i].order==0)
01399 {
01400 gdImageDestroy(plot[i].im);
01401 }
01402 plot[i].im=NULL;
01403 }
01404 }
01405 }
01406
01407 #endif // USE_GD