summaryrefslogtreecommitdiffstats
path: root/tksao/frame/callback.C
blob: 28940ec1fb5ccce672e7c2ca549beeb8d64a7617 (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-2017
// 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);
}