Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic-graph-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
dynamic-graph-python
Commits
22bf9b97
Commit
22bf9b97
authored
14 years ago
by
florent
Browse files
Options
Downloads
Patches
Plain Diff
Rewrite enableTrace command without using commandLine.
* src/dynamic-graph-py.cc.
parent
7211d629
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dynamic-graph-py.cc
+25
-21
25 additions, 21 deletions
src/dynamic-graph-py.cc
with
25 additions
and
21 deletions
src/dynamic-graph-py.cc
+
25
−
21
View file @
22bf9b97
...
@@ -8,9 +8,8 @@
...
@@ -8,9 +8,8 @@
#include
<sstream>
#include
<sstream>
#include
<string>
#include
<string>
#include
<dynamic-graph/debug.h>
#include
<dynamic-graph/exception-factory.h>
#include
<dynamic-graph/exception-factory.h>
#include
<dynamic-graph/interpreter-helper.h>
#include
<dynamic-graph/functions.h>
#include
<dynamic-graph/signal-base.h>
#include
<dynamic-graph/signal-base.h>
namespace
dynamicgraph
{
namespace
dynamicgraph
{
...
@@ -38,8 +37,6 @@ namespace dynamicgraph {
...
@@ -38,8 +37,6 @@ namespace dynamicgraph {
}
}
PyObject
*
error
;
PyObject
*
error
;
static
dynamicgraph
::
InterpreterHelper
interpreter
;
/**
/**
\brief plug a signal into another one.
\brief plug a signal into another one.
*/
*/
...
@@ -77,27 +74,34 @@ namespace dynamicgraph {
...
@@ -77,27 +74,34 @@ namespace dynamicgraph {
PyObject
*
PyObject
*
enableTrace
(
PyObject
*
self
,
PyObject
*
args
)
enableTrace
(
PyObject
*
self
,
PyObject
*
args
)
{
{
char
*
trueFalse
=
NULL
;
PyObject
*
boolean
;
char
*
filename
=
NULL
;
char
*
filename
=
NULL
;
std
::
stringstream
ss
;
std
::
ostringstream
os
;
if
(
PyArg_ParseTuple
(
args
,
"ss"
,
&
trueFalse
,
&
filename
))
{
if
(
PyArg_ParseTuple
(
args
,
"Os"
,
&
boolean
,
&
filename
))
{
ss
<<
std
::
string
(
trueFalse
)
<<
" "
<<
std
::
string
(
filename
);
if
(
!
PyBool_Check
(
boolean
))
{
}
else
if
(
PyArg_ParseTuple
(
args
,
"s"
,
&
trueFalse
))
{
PyErr_SetString
(
PyExc_TypeError
,
"enableTrace takes as first "
ss
<<
std
::
string
(
trueFalse
);
"argument True or False,
\n
"" and as "
"second argument a filename."
);
return
NULL
;
}
if
(
boolean
==
Py_True
)
{
try
{
DebugTrace
::
openFile
(
filename
);
}
catch
(
const
std
::
exception
&
exc
)
{
PyErr_SetString
(
PyExc_IOError
,
exc
.
what
());
return
NULL
;
}
}
else
{
try
{
DebugTrace
::
closeFile
(
filename
);
}
catch
(
const
std
::
exception
&
exc
)
{
PyErr_SetString
(
PyExc_IOError
,
exc
.
what
());
return
NULL
;
}
}
}
else
{
}
else
{
return
NULL
;
return
NULL
;
}
}
std
::
istringstream
cmdArg
(
ss
.
str
());
try
{
ShellFunctions
::
cmdEnableTrace
(
std
::
string
(
"debugtrace"
),
cmdArg
,
os
);
}
catch
(
dynamicgraph
::
ExceptionFactory
&
exc
)
{
PyErr_SetString
(
error
,
exc
.
getStringMessage
().
c_str
());
return
NULL
;
}
return
Py_BuildValue
(
""
);
return
Py_BuildValue
(
""
);
}
}
}
}
...
@@ -109,7 +113,7 @@ namespace dynamicgraph {
...
@@ -109,7 +113,7 @@ namespace dynamicgraph {
static
PyMethodDef
dynamicGraphMethods
[]
=
{
static
PyMethodDef
dynamicGraphMethods
[]
=
{
{
"w_plug"
,
dynamicgraph
::
python
::
plug
,
METH_VARARGS
,
{
"w_plug"
,
dynamicgraph
::
python
::
plug
,
METH_VARARGS
,
"plug an output signal into an input signal"
},
"plug an output signal into an input signal"
},
{
"
w_debugt
race"
,
dynamicgraph
::
python
::
enableTrace
,
METH_VARARGS
,
{
"
enableT
race"
,
dynamicgraph
::
python
::
enableTrace
,
METH_VARARGS
,
"Enable or disable tracing debug info in a file"
},
"Enable or disable tracing debug info in a file"
},
// Signals
// Signals
{
"create_signal_base"
,
dynamicgraph
::
python
::
signalBase
::
create
,
METH_VARARGS
,
{
"create_signal_base"
,
dynamicgraph
::
python
::
signalBase
::
create
,
METH_VARARGS
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment