Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
python-cellframe
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
1
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
Show more breadcrumbs
cellframe
python-cellframe
Commits
711f850c
Commit
711f850c
authored
4 years ago
by
alexey.stratulat
Browse files
Options
Downloads
Patches
Plain Diff
[+] Added handler pressing keys Ctrl+C for Windows.
parent
65326d8a
No related branches found
Branches containing commit
No related tags found
1 merge request
!24
Features 3398
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/python-cellframe.h
+7
-1
7 additions, 1 deletion
include/python-cellframe.h
src/python-cellframe.c
+19
-1
19 additions, 1 deletion
src/python-cellframe.c
with
26 additions
and
2 deletions
include/python-cellframe.h
+
7
−
1
View file @
711f850c
...
...
@@ -59,10 +59,16 @@
#include
"wrapping_dap_chain_gdb.h"
#include
"dap_common.h"
#include
"signal.h"
#include
"dap_server.h"
#ifdef _WIN32
#include
"Windows.h"
BOOL
WINAPI
consoleHandler
(
DWORD
);
#else
#include
"signal.h"
void
sigfunc
(
int
sig
);
#endif
PyObject
*
python_cellframe_init
(
PyObject
*
self
,
PyObject
*
args
);
...
...
This diff is collapsed.
Click to expand it.
src/python-cellframe.c
+
19
−
1
View file @
711f850c
...
...
@@ -25,6 +25,19 @@ static bool submodules_deint;
PyObject
*
CellFrame_error
=
NULL
;
#ifdef _WIN32
BOOL
WINAPI
consoleHandler
(
DWORD
dwType
){
if
(
dwType
==
CTRL_C_EVENT
){
log_it
(
L_NOTICE
,
"Handler Ctrl+C"
);
dap_server_loop_stop
();
deinit_modules
();
}
return
TRUE
;
}
#else
void
sigfunc
(
int
sig
){
if
(
sig
==
SIGINT
){
log_it
(
L_NOTICE
,
"Handler Ctrl+C"
);
...
...
@@ -32,6 +45,7 @@ void sigfunc(int sig){
deinit_modules
();
}
}
#endif
PyObject
*
python_cellframe_init
(
PyObject
*
self
,
PyObject
*
args
){
const
char
*
app_name
;
...
...
@@ -43,7 +57,11 @@ PyObject *python_cellframe_init(PyObject *self, PyObject *args){
s_init_ks
=
true
;
submodules_deint
=
false
;
signal
(
SIGINT
,
sigfunc
);
#ifdef _WIN32
setConsoleCtrlHandler
((
PHANDLER_ROUTINE
)
consoleHandler
,
TRUE
);
#else
signal
(
SIGINT
,
sigfunc
);
#endif
if
(
!
PyArg_ParseTuple
(
args
,
"s"
,
&
JSON_str
)){
PyErr_SetString
(
CellFrame_error
,
"ERROR in function call signature: can't get one String argument"
);
...
...
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