File: movetot.c

package info (click to toggle)
irsim 9.7.75-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,596 kB
  • sloc: ansic: 24,733; sh: 6,803; makefile: 411; csh: 269; tcl: 76
file content (64 lines) | stat: -rw-r--r-- 1,535 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/***** Copyright (C) 1989 Stanford University, Arturo Salz ****/

#include <stdio.h>
#include <stdlib.h>

#include "ana.h"
#include "ana_glob.h"

public void MoveToTimeValue(TimeType start)
{
    if (start == tims.start)
	return;
    else if (start < tims.first)
	start = tims.first;
    else if (start > tims.last)
	start = tims.last;

    tims.start = start;
    tims.end = start + tims.steps;
    RedrawTimes();
    UpdateScrollBar();
    DrawTraces(start, tims.end);
}

public void MoveToT(char *str)
{
    double   tmp;
    TimeType start;

    if (str == NULL) {
	XBell(display, 0);
	return;
    }
    tmp = atof(str);
    if (tmp < 0.0) tmp = 0.0;
    start = (TimeType) ns2d(tmp);
    MoveToTimeValue(start);
}

public void MoveToTime(char *s)
{
    /* Argument "s" is the menu string; ignore it. */
    Query( "\nEnter Time > ", MoveToT );
}

/*----------------------------------------------------------------------*/
/* Determine if the indicated time (in ps) is valid.  Return 0 if the	*/
/* time is within the simulation period and on-screen.  Return -1 if	*/
/* the time is within the simulation period but outside the analyzer	*/
/* window bounds.  Return -2 if the time is in the future of the	*/
/* simulation, and -3 if the time is invalid (< 0).			*/
/*----------------------------------------------------------------------*/

public int ValidTime(TimeType t)
{
   if (t < tims.start)
	return -3;
   else if (t > tims.end)
	return -2;
   else if ((t < tims.first) || (t > tims.last))
	return -1;
   else
	return 0;
}