Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap-app-cli-python
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap-app-cli-python
Commits
f2600596
Commit
f2600596
authored
5 years ago
by
Dmitriy A. Gerasimov
Browse files
Options
Downloads
Patches
Plain Diff
[*] Bind fixed
parent
25a90c2c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+35
-0
35 additions, 0 deletions
CMakeLists.txt
include/libdap-app-cli-python.h
+79
-0
79 additions, 0 deletions
include/libdap-app-cli-python.h
src/libdap-app-cli-python.c
+32
-0
32 additions, 0 deletions
src/libdap-app-cli-python.c
with
146 additions
and
0 deletions
CMakeLists.txt
0 → 100644
+
35
−
0
View file @
f2600596
project
(
dap_app_cli_python_module C
)
cmake_minimum_required
(
VERSION 2.8
)
set
(
CMAKE_VERBOSE_MAKEFILE ON
)
set
(
CMAKE_COLOR_MAKEFILE ON
)
set
(
CMAKE_C_STANDARD 11
)
#set(SUBMODULES_NO_BUILD ON)
add_definitions
(
"-fpic"
)
add_definitions
(
"-DDAP_LOG_MT"
)
if
(
NOT
(
${
SUBMODULES_NO_BUILD
}
MATCHES ON
))
if
(
NOT
(
TARGET dap_core
))
add_subdirectory
(
libdap
)
target_compile_options
(
dap_core PRIVATE
"-fpic"
)
endif
()
endif
()
file
(
GLOB APP_CLI_PYTHON_SRCS src/*.c
)
file
(
GLOB APP_CLI_PYTHON_HEADERS include/*.h
)
set
(
Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4
)
find_package
(
PythonLibs REQUIRED
)
include_directories
(
${
PYTHON_INCLUDE_DIR
}
include/
)
add_library
(
${
PROJECT_NAME
}
STATIC
${
APP_CLI_PYTHON_SRCS
}
${
APP_CLI_PYTHON_HEADERS
}
)
target_link_libraries
(
${
PROJECT_NAME
}
)
target_link_libraries
(
${
PROJECT_NAME
}
dap_core dap_app_cli
)
target_include_directories
(
${
PROJECT_NAME
}
PUBLIC include/
)
This diff is collapsed.
Click to expand it.
include/libdap-app-cli-python.h
0 → 100644
+
79
−
0
View file @
f2600596
#pragma once
#define PY_SSIZE_T_CLEAN
#include
<Python.h>
#include
"dap_common.h"
#include
"dap_app_cli.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
PyAppCli
{
PyObject_HEAD
}
PyAppCliObject
;
PyObject
*
dap_app_cli_main_py
(
PyObject
*
self
,
PyObject
*
args
);
static
PyMethodDef
AppCliMethods
[]
=
{
{
"main"
,
dap_app_cli_main_py
,
METH_VARARGS
|
METH_STATIC
,
"Main CLI function"
},
{
NULL
,
NULL
,
0
,
NULL
}
};
static
PyTypeObject
DapAppCli_dapAppCliType
=
{
PyVarObject_HEAD_INIT
(
NULL
,
0
)
"CellFrame.AppCli"
,
/* tp_name */
sizeof
(
PyAppCliObject
),
/* tp_basicsize */
0
,
/* tp_itemsize */
0
,
/* tp_dealloc */
0
,
/* tp_print */
0
,
/* tp_getattr */
0
,
/* tp_setattr */
0
,
/* tp_reserved */
0
,
/* tp_repr */
0
,
/* tp_as_number */
0
,
/* tp_as_sequence */
0
,
/* tp_as_mapping */
0
,
/* tp_hash */
0
,
/* tp_call */
0
,
/* tp_str */
0
,
/* tp_getattro */
0
,
/* tp_setattro */
0
,
/* tp_as_buffer */
Py_TPFLAGS_DEFAULT
|
Py_TPFLAGS_BASETYPE
,
/* tp_flags */
"AppCli object"
,
/* tp_doc */
0
,
/* tp_traverse */
0
,
/* tp_clear */
0
,
/* tp_richcompare */
0
,
/* tp_weaklistoffset */
0
,
/* tp_iter */
0
,
/* tp_iternext */
AppCliMethods
,
/* tp_methods */
0
,
/* tp_members */
0
,
/* tp_getset */
0
,
/* tp_base */
0
,
/* tp_dict */
0
,
/* tp_descr_get */
0
,
/* tp_descr_set */
0
,
/* tp_dictoffset */
0
,
/* tp_init */
0
,
/* tp_alloc */
PyType_GenericNew
,
/* tp_new */
0
,
/* tp_free */
0
,
/* tp_is_gc*/
0
,
/* tp_bases*/
0
,
/* tp_mro */
0
,
/* tp_cache */
0
,
/* tp_subclasses */
0
,
/* tp_weaklist */
0
,
/* tp_del */
0
,
/* tp_version_tag*/
0
,
/* tp_finalize*/
};
#ifdef __cplusplus
}
#endif
This diff is collapsed.
Click to expand it.
src/libdap-app-cli-python.c
0 → 100644
+
32
−
0
View file @
f2600596
#include
"dap_common.h"
#include
"libdap-app-cli-python.h"
#define LOG_TAG "libdap-app-cli-crypto"
/**
* @brief dap_app_cli_main_py
* @param self
* @param args
* @return
*/
PyObject
*
dap_app_cli_main_py
(
PyObject
*
self
,
PyObject
*
args
)
{
(
void
)
self
;
char
*
l_app_name
=
NULL
;
int
l_argc
=
0
;
char
**
l_argv
=
NULL
;
PyObject
*
l_args_py
=
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"sI"
,
&
l_app_name
,
&
l_args_py
))
return
NULL
;
Py_ssize_t
l_args_py_size
=
PyList_Size
(
l_args_py
);
if
(
l_args_py_size
){
l_argc
=
l_args_py_size
;
l_argv
=
DAP_NEW_Z_SIZE
(
char
*
,
sizeof
(
char
**
)
*
l_argc
);
for
(
int
i
=
0
;
i
<
l_argc
;
i
++
){
l_argv
[
i
]
=
PyBytes_AsString
(
PyList_GetItem
(
l_args_py
,
i
));
}
}
return
PyLong_FromLong
((
long
)
dap_app_cli_main
(
l_app_name
,
l_argc
,
l_argv
));
}
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