OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librutiltpp/] [RtclSignalAction.hpp] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 wfjm
// $Id: RtclSignalAction.hpp 521 2013-05-20 22:16:45Z mueller $
2
//
3
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2013-05-17   521   1.0    Initial version
17
// ---------------------------------------------------------------------------
18
 
19
/*!
20
  \file
21
  \version $Id: RtclSignalAction.hpp 521 2013-05-20 22:16:45Z mueller $
22
  \brief   Declaration of class RtclSignalAction.
23
*/
24
 
25
#ifndef included_Retro_RtclSignalAction
26
#define included_Retro_RtclSignalAction 1
27
 
28
// Note: on cpp environment _POSIX_C_SOURCE is already defined !!
29
#include <signal.h>
30
 
31
#include "tcl.h"
32
 
33
#include "librtools/RerrMsg.hpp"
34
#include "librtools/Rexception.hpp"
35
#include "librtcltools/RtclOPtr.hpp"
36
 
37
namespace Retro {
38
 
39
  class RtclSignalAction {
40
    public:
41
 
42
      static bool              Init(Tcl_Interp* interp, RerrMsg& emsg);
43
      static RtclSignalAction* Obj();
44
 
45
      bool          SetAction(int signum, Tcl_Obj* pobj, RerrMsg& emsg);
46
      bool          GetAction(int signum, Tcl_Obj*& pobj, RerrMsg& emsg);
47
      bool          ClearAction(int signum, RerrMsg& emsg);
48
 
49
    protected:
50
      bool          ValidSignal(int signum, RerrMsg& emsg);
51
      void          TclChannelHandler(int mask);
52
      static void   SignalHandler(int signum);
53
      static void   ThunkTclChannelHandler(ClientData cdata, int mask);
54
      static void   ThunkTclExitProc(ClientData cdata);
55
 
56
    private:
57
                    RtclSignalAction(Tcl_Interp* interp);
58
                   ~RtclSignalAction();
59
 
60
    protected:
61
      Tcl_Interp*   fpInterp;               //!< Tcl interpreter used
62
      int           fFdPipeRead;            //!< attn pipe read fd
63
      int           fFdPipeWrite;           //!< attn pipe write fd
64
      Tcl_Channel   fShuttleChn;            //!< Tcl channel
65
      bool          fActionSet[32];         //!< true if SetAction() done
66
      RtclOPtr      fpScript[32];           //!< action scripts
67
      struct sigaction fOldAction[32];      //!< original sigaction
68
 
69
    private:
70
      static RtclSignalAction* fpObj;       //!< pointer to singleton
71
  };
72
 
73
} // end namespace Retro
74
 
75
//#include "RtclSignalAction.ipp"
76
 
77
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.