summaryrefslogtreecommitdiffstats
path: root/tksao/frame/callback.C
blob: 3ec3d1f2e0c494b0b728fe4cdb4523fdf33ebf2d (plain)
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
// Copyright (C) 1999-2016
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#include <string.h>

#include "callback.h"

CallBack::CallBack(const CallBack& a)
{
  interp_ = a.interp_;

  type_ = a.type_;
  strcpy(proc_, a.proc_);
  strcpy(arg_, a.arg_);

  previous_ = NULL;
  next_ = NULL;
}

CallBack& CallBack::operator=(const CallBack& a) 
{
  interp_ = a.interp_;

  type_ = a.type_;
  strcpy(proc_, a.proc_);
  strcpy(arg_, a.arg_);

  previous_ = NULL;
  next_ = NULL;

  return *this;
}

CallBack::CallBack(Tcl_Interp* interp, Type type, 
		   const char* proc, const char* arg)
{
  interp_ = interp;

  type_ = type;

  if (proc)
    strncpy(proc_, proc, 32);
  else
    proc_[0] = '\0';

  if (arg)
    strncpy(arg_, arg, 64);
  else
    arg_[0] = '\0';

  previous_ = NULL;
  next_ = NULL;
}

int CallBack::eval(const char* arg2)
{
  return Tcl_VarEval(interp_, proc_, " ", arg_, " ", arg2, NULL);
}