Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
maestro-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
maestro
maestro-core
Commits
3bcec4b9
Commit
3bcec4b9
authored
Nov 2, 2022
by
Utz-Uwe Haus
Browse files
Options
Downloads
Patches
Plain Diff
Implement mstro_cdo argout typemap
parent
0d7dd5a4
Branches
Branches containing commit
No related tags found
1 merge request
!24
Draft: Resolve "scripting interface to maestro core"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripting/maestro-py.i
+40
-6
40 additions, 6 deletions
scripting/maestro-py.i
with
40 additions
and
6 deletions
scripting/maestro-py.i
+
40
−
6
View file @
3bcec4b9
...
...
@@ -4,12 +4,46 @@
%
include
"
cpointer.i
"
%
include
"
exception.i
"
/* handling mstro_status return codes: suppress unless an error needs to be indicated. In that case: throw exeption */
/* No identifier conversion here. PEP-8 says
*
* > Function names should be lowercase, with words separated by underscores as
* > necessary to improve readability.
*
* so our C API will be just fine.
*/
/***** typemaps *****/
/* mstro_status codes: suppress unless an error needs to be indicated. In that case: throw exeption */
%
typemap
(
out
)
mstro_status
{
$result = SWIG_Py_Void();
if(MSTRO_OK!=$1) {
SWIG_exception(SWIG_RuntimeError, mstro_status_description($1));
}
}
/* CDO return values: */
%
typemap
(
in
,
numinputs
=
0
)
mstro_cdo
*
result
(
mstro_cdo
temp
)
{
$1 = &temp;
}
%
typemap
(
argout
)
mstro_cdo
*
result
{
/* Create shadow object (do not use SWIG_POINTER_NEW) */
PyObject * temp = SWIG_NewPointerObj(*$1,
$descriptor(mstro_cdo),
SWIG_POINTER_NEW);
/* if multiple results: ensure result is a list */
if(VOID_Object==$result) {
/* we're producing the first result */
$result = temp;
} else {
$result = SWIG_Py_Void();
/* coerce previous result to list and append */
if (!PyList_Check($result)) {
PyObject * tt = $result;
$result = PyList_New(1);
PyList_SetItem($result, 0, tt);
}
PyList_Append($result, temp);
Py_DECREF(temp);
}
}
...
...
...
...
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
sign in
to comment