Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
fd2a776b
Commit
fd2a776b
authored
Nov 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6bde31f8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
+31
-7
wcfs/internal/_wcfs.pyx
wcfs/internal/_wcfs.pyx
+30
-6
wcfs/internal/wcfs_misc.h
wcfs/internal/wcfs_misc.h
+1
-1
No files found.
wcfs/internal/_wcfs.pyx
View file @
fd2a776b
...
...
@@ -34,17 +34,27 @@ cdef extern from *:
from
libc.stdio
cimport
printf
# XXX temp
# XXX -> pygolang
cdef
extern
from
"wcfs_misc.h"
namespace
"io"
nogil
:
error
EOF
"io::EOF_"
error
ErrUnexpectedEOF
cdef
extern
from
"wcfs_watchlink.h"
nogil
:
cppclass
_WatchLink
:
error
close
()
#error recvReq(ctx, PinReq *rx_into
)
error
recvReq
(
context
.
Context
ctx
,
PinReq
*
prx
)
pair
[
string
,
error
]
sendReq
(
context
.
Context
ctx
,
const
string
&
req
)
cppclass
WatchLink
(
refptr
[
_WatchLink
]):
# WatchLink.X = WatchLink->X in C++
error
close
"_ptr()->close"
()
error
recvReq
"_ptr()->recvReq"
(
context
.
Context
ctx
,
PinReq
*
prx
)
pair
[
string
,
error
]
sendReq
"_ptr()->sendReq"
(
context
.
Context
ctx
,
const
string
&
req
)
cppclass
PinReq
:
pass
cdef
extern
from
"wcfs.h"
nogil
:
cppclass
WCFS
:
string
mountpoint
...
...
@@ -84,7 +94,19 @@ cdef class PyWatchLink:
raise
RuntimeError
(
err
.
Error
())
# XXX exc class?
# XXX recvReq
def
recvReq
(
PyWatchLink
pywlink
,
context
.
PyContext
pyctx
):
# -> PinReq | None when EOF
cdef
PinReq
req
with
nogil
:
err
=
wlink_recvReq_pyexc
(
pywlink
.
wlink
,
pyctx
.
ctx
,
&
req
)
if
err
.
eq
(
EOF
):
return
None
if
err
!=
nil
:
raise
RuntimeError
(
err
.
Error
())
# XXX exc class?
cdef
PyPinReq
pyreq
=
PyPinReq
.
__new__
()
pyreq
.
pinreq
=
req
return
pyreq
def
sendReq
(
PyWatchLink
pywlink
,
context
.
PyContext
pyctx
,
string
req
):
# -> reply(string)
with
nogil
:
...
...
@@ -92,18 +114,17 @@ cdef class PyWatchLink:
reply
=
_
.
first
err
=
_
.
second
printf
(
"pyxsendReq: reply='%s'
\
n
"
,
reply
.
c_str
())
#
printf("pyxsendReq: reply='%s'\n", reply.c_str())
if
err
!=
nil
:
raise
RuntimeError
(
err
.
Error
())
# XXX -> Xpy(err) ? pyraiseIf(err) ?
printf
(
"pyxsendReq: reply -> ok
\
n
"
)
#
printf("pyxsendReq: reply -> ok\n")
return
reply
cdef
class
PyPinReq
:
pass
cdef
PinReq
pinreq
...
...
@@ -119,5 +140,8 @@ cdef nogil:
error
wlink_close_pyexc
(
WatchLink
wlink
)
except
+
topyexc
:
return
wlink
.
close
()
error
wlink_recvReq_pyexc
(
WatchLink
wlink
,
context
.
Context
ctx
,
PinReq
*
prx
)
except
+
topyexc
:
return
wlink
.
recvReq
(
ctx
,
prx
)
pair
[
string
,
error
]
wlink_sendReq_pyexc
(
WatchLink
wlink
,
context
.
Context
ctx
,
const
string
&
req
)
except
+
topyexc
:
return
wlink
.
sendReq
(
ctx
,
req
)
wcfs/internal/wcfs_misc.h
View file @
fd2a776b
...
...
@@ -55,7 +55,7 @@ using std::vector;
const
nullptr_t
nil
=
nullptr
;
// io::
// io::
XXX -> pygolang
namespace
io
{
extern
const
global
<
error
>
EOF_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment