diff options
Diffstat (limited to 'src/python/swig')
-rw-r--r-- | src/python/swig/core.i | 111 | ||||
-rw-r--r-- | src/python/swig/debug.i | 93 | ||||
-rw-r--r-- | src/python/swig/drain.i | 48 | ||||
-rw-r--r-- | src/python/swig/event.i | 110 | ||||
-rw-r--r-- | src/python/swig/inet.i | 67 | ||||
-rw-r--r-- | src/python/swig/pyevent.cc | 72 | ||||
-rw-r--r-- | src/python/swig/pyevent.hh | 56 | ||||
-rw-r--r-- | src/python/swig/pyobject.cc | 195 | ||||
-rw-r--r-- | src/python/swig/pyobject.hh | 68 | ||||
-rw-r--r-- | src/python/swig/pyobject.i | 55 | ||||
-rw-r--r-- | src/python/swig/range.i | 42 | ||||
-rw-r--r-- | src/python/swig/serialize.i | 51 | ||||
-rw-r--r-- | src/python/swig/stats.i | 140 | ||||
-rw-r--r-- | src/python/swig/time.i | 44 | ||||
-rw-r--r-- | src/python/swig/trace.i | 64 |
15 files changed, 0 insertions, 1216 deletions
diff --git a/src/python/swig/core.i b/src/python/swig/core.i deleted file mode 100644 index 8b734b940..000000000 --- a/src/python/swig/core.i +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - * Steve Reinhardt - */ - -%module(package="_m5") core - -%{ -#include "base/misc.hh" -#include "base/random.hh" -#include "base/socket.hh" -#include "base/types.hh" -#include "python/swig/pyobject.hh" -#include "sim/core.hh" - -extern const char *compileDate; - -#ifdef DEBUG -const bool flag_DEBUG = true; -#else -const bool flag_DEBUG = false; -#endif -#ifdef NDEBUG -const bool flag_NDEBUG = true; -#else -const bool flag_NDEBUG = false; -#endif -const bool flag_TRACING_ON = TRACING_ON; - -inline void disableAllListeners() { ListenSocket::disableAll(); } - -inline bool listenersDisabled() { return ListenSocket::allDisabled(); } - -inline void -seedRandom(uint64_t seed) -{ - random_mt.init(seed); -} - -%} - -%include <std_string.i> -%include <stdint.i> - -%include "base/types.hh" - -void setOutputDir(const std::string &dir); -void doExitCleanup(); -void disableAllListeners(); -bool listenersDisabled(); -void seedRandom(uint64_t seed); - -%immutable compileDate; -char *compileDate; -const bool flag_DEBUG; -const bool flag_NDEBUG; -const bool flag_TRACING_ON; - -void setClockFrequency(Tick ticksPerSecond); - -Tick curTick(); - -class Checkpoint; - -void serializeAll(const std::string &cpt_dir); -CheckpointIn *getCheckpoint(const std::string &cpt_dir); -void unserializeGlobals(CheckpointIn &cp); - -class Logger -{ - public: - enum LogLevel { - PANIC = 0, - FATAL, - WARN, - INFO, - HACK, - NUM_LOG_LEVELS, - }; - - static void setLevel(LogLevel ll); - - private: - Logger(); -}; diff --git a/src/python/swig/debug.i b/src/python/swig/debug.i deleted file mode 100644 index b05b66e47..000000000 --- a/src/python/swig/debug.i +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * Copyright (c) 2010 The Hewlett-Packard Development Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -%module(package="_m5") debug - -%{ -#include <cassert> -#include <map> -#include <string> -#include <vector> - -#include "base/debug.hh" -#include "base/types.hh" -#include "sim/debug.hh" - -using namespace std; - -typedef map<string, Debug::Flag *> FlagsMap; -typedef vector<Debug::Flag *> FlagsVec; - -namespace Debug { -extern int allFlagsVersion; -FlagsMap &allFlags(); -} - -inline int -getAllFlagsVersion() -{ - return Debug::allFlagsVersion; -} - -inline FlagsVec -getAllFlags() -{ - FlagsMap &flagsMap = Debug::allFlags(); - - FlagsVec flags(flagsMap.size()); - - int index = 0; - FlagsMap::iterator i = flagsMap.begin(); - FlagsMap::iterator end = flagsMap.end(); - for (; i != end; ++i) { - assert(index < flags.size()); - flags[index++] = i->second; - } - - return flags; -} - -%} - -%ignore Debug::SimpleFlag::operator!; - -%include <std_string.i> -%include <std_vector.i> -%include <stdint.i> - -%include "base/debug.hh" -%include "base/types.hh" -%include "sim/debug.hh" - -%template(AllFlags) std::vector<Debug::Flag *>; - -int getAllFlagsVersion(); -std::vector<Debug::Flag *> getAllFlags(); diff --git a/src/python/swig/drain.i b/src/python/swig/drain.i deleted file mode 100644 index 8bd7ef9ef..000000000 --- a/src/python/swig/drain.i +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2012 ARM Limited - * All rights reserved - * - * The license below extends only to copyright in the software and shall - * not be construed as granting a license to any other intellectual - * property including but not limited to intellectual property relating - * to a hardware implementation of the functionality of the software - * licensed hereunder. You may use the software subject to the license - * terms below provided that you ensure that this notice is replicated - * unmodified and in its entirety in all distributions of the software, - * modified or unmodified, in source code or in binary form. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Andreas Sandberg - */ - -%module(package="_m5") drain - -%{ -#include "sim/drain.hh" -%} - -%nodefaultctor Drainable; - -%include "sim/drain.hh" diff --git a/src/python/swig/event.i b/src/python/swig/event.i deleted file mode 100644 index 464be8289..000000000 --- a/src/python/swig/event.i +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * Copyright (c) 2013 Advanced Micro Devices, Inc. - * Copyright (c) 2013 Mark D. Hill and David A. Wood - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -%module(package="_m5") event - -%{ -#include "base/types.hh" -#include "python/swig/pyevent.hh" -#include "sim/eventq_impl.hh" -#include "sim/sim_events.hh" -#include "sim/sim_exit.hh" -#include "sim/simulate.hh" -%} - -%import "python/swig/serialize.i" - -#pragma SWIG nowarn=350,351 - -%extend EventQueue { - void - schedule(Event *event, Tick when) - { - // Any python event that are scheduled must have their - // internal object's refcount incremented so that the object - // sticks around while it is in the event queue. - PythonEvent *pyevent = dynamic_cast<PythonEvent *>(event); - if (pyevent) - pyevent->incref(); - $self->schedule(event, when); - } - - void - deschedule(Event *event) - { - $self->deschedule(event); - - // Now that we're removing the python object from the event - // queue, we need to decrement its reference count. - PythonEvent *pyevent = dynamic_cast<PythonEvent *>(event); - if (pyevent) - pyevent->decref(); - } -} - -%typemap(out) PythonEvent* { - result->object = $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PythonEvent, SWIG_POINTER_NEW); -} - -%ignore EventQueue::schedule; -%ignore EventQueue::deschedule; - -%include <std_string.i> -%include <stdint.i> - -%include "base/types.hh" -%include "sim/eventq.hh" - -// This must follow eventq.hh -%include "python/swig/pyevent.hh" - -// minimal definition of SimExitEvent interface to wrap -class GlobalSimLoopExitEvent -{ - public: - std::string getCause(); - int getCode(); - GlobalSimLoopExitEvent(Tick when, const std::string &_cause, int c, - Tick _repeat = 0); -}; - -%exception simulate { - $action - if (!result) { - return NULL; - } -} - -GlobalSimLoopExitEvent *simulate(Tick num_cycles = MaxTick); -void exitSimLoop(const std::string &message, int exit_code); -void curEventQueue( EventQueue *); -EventQueue *getEventQueue(uint32_t index); diff --git a/src/python/swig/inet.i b/src/python/swig/inet.i deleted file mode 100644 index 144b3dbac..000000000 --- a/src/python/swig/inet.i +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * Copyright (c) 2010 Advanced Micro Devices, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - * Gabe Black - */ - -%{ -#include "base/inet.hh" -%} - -%import <std_string.i> -%import <stdint.i> - -namespace Net { -struct EthAddr -{ - EthAddr(); - EthAddr(const uint8_t ea[6]); - EthAddr(const std::string &addr); -}; - -struct IpAddress -{ - IpAddress(); - IpAddress(const uint32_t __addr); -}; - -struct IpNetmask : IpAddress -{ - IpNetmask(); - IpNetmask(const uint32_t __addr, const uint8_t __netmask); -}; - -struct IpWithPort : IpAddress -{ - IpWithPort(); - IpWithPort(const uint32_t __addr, const uint16_t __port); -}; - -} - diff --git a/src/python/swig/pyevent.cc b/src/python/swig/pyevent.cc deleted file mode 100644 index 39c57d116..000000000 --- a/src/python/swig/pyevent.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -#include <Python.h> - -#include "python/swig/pyevent.hh" - -#include "base/misc.hh" -#include "sim/async.hh" -#include "sim/eventq.hh" - -PythonEvent::PythonEvent(PyObject *code, Priority priority) - : Event(priority), eventCode(code) -{ - if (code == NULL) - panic("Passed in invalid object"); -} - -PythonEvent::~PythonEvent() -{ -} - -void -PythonEvent::process() -{ - PyObject *args = PyTuple_New(0); - PyObject *result = PyObject_Call(eventCode, args, NULL); - Py_DECREF(args); - - if (result) { - // Nothing to do just decrement the reference count - Py_DECREF(result); - } else { - // Somethign should be done to signal back to the main interpreter - // that there's been an exception. - async_event = true; - async_exception = true; - /* Wake up some event queue to handle event */ - getEventQueue(0)->wakeup(); - } - - // Since the object has been removed from the event queue, its - // reference count must be decremented. - Py_DECREF(object); -} diff --git a/src/python/swig/pyevent.hh b/src/python/swig/pyevent.hh deleted file mode 100644 index 9f2ce9ee7..000000000 --- a/src/python/swig/pyevent.hh +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -#ifndef __PYTHON_SWIG_PYEVENT_HH__ -#define __PYTHON_SWIG_PYEVENT_HH__ - -#include <Python.h> - -#include "sim/eventq.hh" -#include "sim/init.hh" -#include "sim/sim_events.hh" - -class PythonEvent : public Event -{ - private: - PyObject *eventCode; // PyObject to call to perform event - public: - PyObject *object; // PyObject wrapping this PythonEvent - - PythonEvent(PyObject *obj, Event::Priority priority); - ~PythonEvent(); - - void incref() { Py_INCREF(object); } - void decref() { Py_DECREF(object); } - - virtual void process(); -}; - -#endif // __PYTHON_SWIG_PYEVENT_HH__ diff --git a/src/python/swig/pyobject.cc b/src/python/swig/pyobject.cc deleted file mode 100644 index 07a2ef864..000000000 --- a/src/python/swig/pyobject.cc +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -#include <Python.h> - -#include <string> - -#include "base/inifile.hh" -#include "base/output.hh" -#include "config/the_isa.hh" - -#if THE_ISA != NULL_ISA -#include "dev/net/etherdevice.hh" -#include "dev/net/etherobject.hh" - -#endif -#include "python/swig/pyobject.hh" - -#include "mem/mem_object.hh" -#include "mem/ruby/slicc_interface/AbstractController.hh" -#include "sim/full_system.hh" -#include "sim/sim_object.hh" - -using namespace std; - -#if THE_ISA != NULL_ISA -EtherInt * -lookupEthPort(SimObject *so, const std::string &name, int i) -{ - EtherObject *eo = dynamic_cast<EtherObject *>(so); - EtherDevice *ed = dynamic_cast<EtherDevice *>(so); - if (eo == NULL && ed == NULL) { - warn("error casting SimObject %s", so->name()); - return NULL; - } - - EtherInt *p = NULL; - if (eo) - p = eo->getEthPort(name, i); - else - p = ed->getEthPort(name, i); - return p; -} -#endif - -/** - * Connect the described MemObject ports. Called from Python via SWIG. - * The indices i1 & i2 will be -1 for regular ports, >= 0 for vector ports. - * SimObject1 is the master, and SimObject2 is the slave - */ -int -connectPorts(SimObject *o1, const std::string &name1, int i1, - SimObject *o2, const std::string &name2, int i2) -{ -#if THE_ISA != NULL_ISA - EtherObject *eo1, *eo2; - EtherDevice *ed1, *ed2; - eo1 = dynamic_cast<EtherObject*>(o1); - ed1 = dynamic_cast<EtherDevice*>(o1); - eo2 = dynamic_cast<EtherObject*>(o2); - ed2 = dynamic_cast<EtherDevice*>(o2); - - if ((eo1 || ed1) && (eo2 || ed2)) { - EtherInt *p1 = lookupEthPort(o1, name1, i1); - EtherInt *p2 = lookupEthPort(o2, name2, i2); - - if (p1 != NULL && p2 != NULL) { - - p1->setPeer(p2); - p2->setPeer(p1); - - return 1; - } - } -#endif - - // These could be MessageBuffers from the ruby memory system. If so, they - // need not be connected to anything currently. - MessageBuffer *mb1, *mb2; - mb1 = dynamic_cast<MessageBuffer*>(o1); - mb2 = dynamic_cast<MessageBuffer*>(o2); - - if (mb1 || mb2) { - // No need to connect anything here currently. MessageBuffer - // connections in Python only serve to print the connections in - // the config output. - // TODO: Add real ports to MessageBuffers and use MemObject connect - // code below to bind MessageBuffer senders and receivers - return 1; - } - - MemObject *mo1, *mo2; - mo1 = dynamic_cast<MemObject*>(o1); - mo2 = dynamic_cast<MemObject*>(o2); - - if (mo1 == NULL || mo2 == NULL) { - panic ("Error casting SimObjects %s and %s to MemObject", o1->name(), - o2->name()); - } - - // generic master/slave port connection - BaseMasterPort& masterPort = mo1->getMasterPort(name1, i1); - BaseSlavePort& slavePort = mo2->getSlavePort(name2, i2); - - masterPort.bind(slavePort); - - return 1; -} - -inline IniFile & -inifile() -{ - static IniFile inifile; - return inifile; -} - -/** - * Convert a pointer to the Python object that SWIG wraps around a C++ - * SimObject pointer back to the actual C++ pointer. See main.i. - */ -extern "C" SimObject *convertSwigSimObjectPtr(PyObject *); - -// Python.h is notoriously not const-correct (for 2.4, anyway)... make -// a little define here to reduce the noise and make it easier to -// #ifdef away if Python.h gets fixed. Note there are a couple of -// these in sim/main.cc as well that are handled without this define. -#define PCC(s) const_cast<char *>(s) - -/** Single instance of PythonSimObjectResolver as its action is effectively - * static but SimObjectResolver can use a non-persistent object */ -PythonSimObjectResolver pythonSimObjectResolver; - -SimObject * -PythonSimObjectResolver::resolveSimObject(const string &name) -{ - PyObject *module = PyImport_ImportModule(PCC("m5.SimObject")); - if (module == NULL) - panic("Could not import m5.SimObject"); - - PyObject *resolver = - PyObject_GetAttrString(module, PCC("resolveSimObject")); - if (resolver == NULL) { - PyErr_Print(); - panic("resolveSimObject: failed to find resolveSimObject"); - } - - PyObject *ptr = PyObject_CallFunction(resolver, PCC("(s)"), name.c_str()); - if (ptr == NULL) { - PyErr_Print(); - panic("resolveSimObject: failure on call to Python for %s", name); - } - - SimObject *obj = convertSwigSimObjectPtr(ptr); - if (obj == NULL) - panic("resolveSimObject: failure on pointer conversion for %s", name); - - Py_DECREF(module); - Py_DECREF(resolver); - Py_DECREF(ptr); - - return obj; -} - -CheckpointIn * -getCheckpoint(const std::string &cpt_dir) -{ - return new CheckpointIn(cpt_dir, pythonSimObjectResolver); -} diff --git a/src/python/swig/pyobject.hh b/src/python/swig/pyobject.hh deleted file mode 100644 index 6147e4bd9..000000000 --- a/src/python/swig/pyobject.hh +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -#include <Python.h> - -#include "base/types.hh" -#include "dev/net/etherint.hh" -#include "sim/serialize.hh" -#include "sim/sim_object.hh" - -extern "C" SimObject *convertSwigSimObjectPtr(PyObject *); - -/** Resolve a SimObject name using the Python configuration */ -class PythonSimObjectResolver : public SimObjectResolver -{ - SimObject *resolveSimObject(const std::string &name); -}; - -EtherInt * lookupEthPort(SimObject *so, const std::string &name, int i); - -/** - * Connect the described MemObject ports. Called from Python via SWIG. - */ -int connectPorts(SimObject *o1, const std::string &name1, int i1, - SimObject *o2, const std::string &name2, int i2); - - -inline void -serializeAll(const std::string &cpt_dir) -{ - Serializable::serializeAll(cpt_dir); -} - -CheckpointIn * -getCheckpoint(const std::string &cpt_dir); - -inline void -unserializeGlobals(CheckpointIn &cp) -{ - Serializable::unserializeGlobals(cp); -} diff --git a/src/python/swig/pyobject.i b/src/python/swig/pyobject.i deleted file mode 100644 index d4601d6a9..000000000 --- a/src/python/swig/pyobject.i +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -%module(package="_m5") pyobject - -%{ -#include "python/swig/pyobject.hh" -%} - -// import these files for SWIG to wrap -%include <std_string.i> -%include <stdint.i> - -int connectPorts(SimObject *o1, const std::string &name1, int i1, - SimObject *o2, const std::string &name2, int i2); - -%wrapper %{ -// Convert a pointer to the Python object that SWIG wraps around a -// C++ SimObject pointer back to the actual C++ pointer. -SimObject * -convertSwigSimObjectPtr(PyObject *pyObj) -{ - SimObject *so; - if (SWIG_ConvertPtr(pyObj, (void **) &so, SWIGTYPE_p_SimObject, 0) == -1) - return NULL; - return so; -} -%} diff --git a/src/python/swig/range.i b/src/python/swig/range.i deleted file mode 100644 index 7ee27679f..000000000 --- a/src/python/swig/range.i +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -%module(package="_m5") range - -%{ -#include "base/types.hh" -#include "base/addr_range.hh" -%} - -%include <stdint.i> - -%rename(assign) *::operator=; -%include "base/types.hh" -%include "base/addr_range.hh" diff --git a/src/python/swig/serialize.i b/src/python/swig/serialize.i deleted file mode 100644 index 2ade6157a..000000000 --- a/src/python/swig/serialize.i +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2012 ARM Limited - * All rights reserved - * - * The license below extends only to copyright in the software and shall - * not be construed as granting a license to any other intellectual - * property including but not limited to intellectual property relating - * to a hardware implementation of the functionality of the software - * licensed hereunder. You may use the software subject to the license - * terms below provided that you ensure that this notice is replicated - * unmodified and in its entirety in all distributions of the software, - * modified or unmodified, in source code or in binary form. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Andreas Sandberg - */ - -%module(package="_m5") serialize - -%{ -#include "sim/serialize.hh" -%} - -%nodefaultctor Serializable; - -class Serializable -{ - virtual const std::string name() const = 0; -}; diff --git a/src/python/swig/stats.i b/src/python/swig/stats.i deleted file mode 100644 index c22cd45a3..000000000 --- a/src/python/swig/stats.i +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -%module(package="_m5") stats - -%include <std_list.i> -%include <std_string.i> -%include <std_vector.i> -%include <stdint.i> - -%{ -#include "base/stats/text.hh" -#include "base/stats/types.hh" -#include "base/callback.hh" -#include "base/misc.hh" -#include "base/statistics.hh" -#include "sim/core.hh" -#include "sim/stat_control.hh" -#include "sim/stat_register.hh" - -namespace Stats { - -inline FlagsType -Stats_Info_flags_get(Info *info) -{ - return info->flags; -} - -inline void -Stats_Info_flags_set(Info *info, FlagsType flags) -{ - info->flags = flags; -} - -inline char * -PCC(const char *string) -{ - return const_cast<char *>(string); -} - -void -call_module_function(const char *module_name, const char *func_name) -{ - PyObject *module = PyImport_ImportModule(PCC(module_name)); - if (module == NULL) - panic("Could not import %s", module); - - PyObject *result = PyObject_CallMethod(module, PCC(func_name), PCC("")); - if (result == NULL) { - PyErr_Print(); - panic("failure on call to function %s", func_name); - } - - Py_DECREF(module); - Py_DECREF(result); -} - -void -pythonDump() -{ - call_module_function("m5.stats", "dump"); -} - -void -pythonReset() -{ - call_module_function("m5.stats", "reset"); -} - -} // namespace Stats -%} - -%extend Stats::Info { - short flags; -} - -%ignore Stats::Info::flags; - -%import "base/stats/types.hh" -%import "base/types.hh" - -%include "base/stats/info.hh" -%include "base/stats/output.hh" - -namespace std { -%template(list_info) list<Stats::Info *>; -%template(vector_double) vector<double>; -%template(vector_string) vector<string>; -%template(vector_DistData) vector<Stats::DistData>; -} - -namespace Stats { - -void initSimStats(); -Output *initText(const std::string &filename, bool desc); - -void registerPythonStatsHandlers(); - -void schedStatEvent(bool dump, bool reset, - Tick when = curTick(), Tick repeat = 0); - -void periodicStatDump(Tick period = 0); - -void updateEvents(); - -void processResetQueue(); -void processDumpQueue(); -void enable(); -bool enabled(); - -std::list<Info *> &statsList(); - -} // namespace Stats diff --git a/src/python/swig/time.i b/src/python/swig/time.i deleted file mode 100644 index 9bbad081a..000000000 --- a/src/python/swig/time.i +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -%{ -#include <sys/time.h> -%} - -struct tm { - int tm_sec; /* seconds after the minute [0-60] */ - int tm_min; /* minutes after the hour [0-59] */ - int tm_hour; /* hours since midnight [0-23] */ - int tm_mday; /* day of the month [1-31] */ - int tm_mon; /* months since January [0-11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday [0-6] */ - int tm_yday; /* days since January 1 [0-365] */ -}; diff --git a/src/python/swig/trace.i b/src/python/swig/trace.i deleted file mode 100644 index 9ea60b816..000000000 --- a/src/python/swig/trace.i +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2006 The Regents of The University of Michigan - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer; - * redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution; - * neither the name of the copyright holders nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Authors: Nathan Binkert - */ - -%module(package="_m5") trace - -%{ -#include "base/trace.hh" -#include "base/types.hh" -#include "base/output.hh" - -inline void -output(const char *filename) -{ - OutputStream *file_stream = simout.find(filename); - - if (!file_stream) - file_stream = simout.create(filename); - - Trace::setDebugLogger(new Trace::OstreamLogger(*file_stream->stream())); -} - -inline void -ignore(const char *expr) -{ - ObjectMatch ignore(expr); - - Trace::getDebugLogger()->setIgnore(ignore); -} - -inline void enable() { Trace::enable(); } -inline void disable() { Trace::disable(); } -%} - -extern void output(const char *string); -extern void ignore(const char *expr); -extern void enable(); -extern void disable(); |