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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [src/] [librtools/] [Rtools.cpp] - Blame information for rev 11

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 wfjm
// $Id:  $
2
//
3
// Copyright 2011- 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 11 wfjm
// 2011-04-10   376   1.0.1  add ThrowLogic(), ThrowRuntime()
17 10 wfjm
// 2011-03-12   368   1.0    Initial version
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22
  \version $Id:  $
23
  \brief   Implemenation of Rtools .
24
*/
25
 
26
#include <stdexcept>
27
 
28
#include "Rtools.hpp"
29 11 wfjm
#include "RerrMsg.hpp"
30 10 wfjm
 
31
using namespace std;
32
using namespace Retro;
33
 
34
/*!
35
  \class Retro::Rtools
36
  \brief FIXME_docs
37
*/
38
 
39
//------------------------------------------+-----------------------------------
40
//! FIXME_docs
41
 
42
std::string Rtools::Flags2String(uint32_t flags, const RflagName* fnam,
43
                                 char delim)
44
{
45
  if (fnam == 0)
46
    throw invalid_argument("Rtools::Flags2String: fnam==NULL");
47
 
48
  string rval;
49
  while (fnam->mask) {
50
    if (flags & fnam->mask) {
51
      if (!rval.empty()) rval += delim;
52
      rval += fnam->name;
53
    }
54
    fnam++;
55
  }
56
  return rval;
57
}
58
 
59 11 wfjm
//------------------------------------------+-----------------------------------
60
//! FIXME_docs
61 10 wfjm
 
62 11 wfjm
void Rtools::ThrowLogic(const std::string& meth,
63
                        const std::string& text, int errnum)
64
{
65
  RerrMsg emsg;
66
  emsg.Init(meth, text);
67
  if (errnum != 0) emsg.AppendErrno(errnum);
68
  throw logic_error(emsg.Message());
69
}
70
 
71 10 wfjm
//------------------------------------------+-----------------------------------
72 11 wfjm
//! FIXME_docs
73
 
74
void Rtools::ThrowRuntime(const std::string& meth,
75
                          const std::string& text, int errnum)
76
{
77
  RerrMsg emsg;
78
  emsg.Init(meth, text);
79
  if (errnum != 0) emsg.AppendErrno(errnum);
80
  throw runtime_error(emsg.Message());
81
}
82
 
83
//------------------------------------------+-----------------------------------
84 10 wfjm
#if (defined(Retro_NoInline) || defined(Retro_Rtools_NoInline))
85
#define inline
86
//#include "Rtools.ipp"
87
#undef  inline
88
#endif

powered by: WebSVN 2.1.0

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