Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit 7d559ef

Browse files
committed
Split 'make-socket' and update EXPLAIN.md
1 parent 57d3797 commit 7d559ef

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.5.25 (2014-04-15)
4+
5+
* Split 'make-socket' for more flexibility
6+
* Update EXPLAIN.md
7+
38
## 0.5.24 (2014-04-14)
49

510
* Update to picolisp-unit v0.6.1

EXPLAIN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ There's nothing special about this function. I simply wanted to highlight the [t
234234

235235
This can be caught with `(catch 'InternalError`. The return value is a list which will contain `'NanomsgError` in the `car`, and a String in the `cdr`.
236236

237-
### make-socket
237+
### create-socket
238238

239-
I won't go into detail about the `make-socket` internal function, but I was pleased to discover the [default](http://software-lab.de/doc/refD.html#default) function, which assigns a default value to a variable.
239+
I won't go into detail about the `create-socket` internal function, but I was pleased to discover the [default](http://software-lab.de/doc/refD.html#default) function, which assigns a default value to a variable.
240240

241241
```lisp
242-
[de make-socket (Addr Type Flag Domain)
242+
[de create-socket (Type Domain)
243243
(default Domain "AF_SP")
244244
```
245245

module.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[de MODULE_INFO
22
("name" "nanomsg")
3-
("version" "0.5.24")
3+
("version" "0.5.25")
44
("summary" "Nanomsg ffi-binding for PicoLisp")
55
("source" "https://github.com/aw/picolisp-nanomsg.git")
66
("author" "Alexander Williams")

nanomsg.l

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
(local MODULE_INFO MSG_MAX_SIZE *Nanomsg *NN_Symbols)
1010
(local nn-socket nn-close nn-setsockopt nn-getsockopt nn-bind nn-connect nn-shutdown nn-send nn-recv)
1111
(local nn-errno nn-strerror nn-symbol nn-poll nn-device nn-poll-lt-1 fetch-symbols symbol-val)
12-
(local exit-with-error exit-with-error-maybe make-socket make-endpoint check-endpoint sub-unsub non-blocking-io)
12+
(local exit-with-error exit-with-error-maybe create-socket make-socket make-endpoint check-endpoint)
13+
(local sub-unsub non-blocking-io)
1314

1415
(load (pack (car (file)) "module.l"))
1516

@@ -131,12 +132,17 @@
131132
((= -1 Result) (exit-with-error Sock)) ]
132133

133134
[de make-socket (Addr Type Flag Domain)
135+
(let Sock (create-socket Type Domain)
136+
(let Endpoint (make-endpoint Addr Type Flag Sock)
137+
(check-endpoint Sock Endpoint) ]
138+
139+
[de create-socket (Type Domain)
134140
(default Domain "AF_SP")
135-
(let Sock (nn-socket Domain Type)
136-
(if (= -1 Sock)
137-
(exit-with-error Sock)
138-
(let Endpoint (make-endpoint Addr Type Flag Sock)
139-
(check-endpoint Sock Endpoint) ]
141+
(prog1
142+
(nn-socket Domain Type)
143+
(if (= -1 @)
144+
(exit-with-error @)
145+
@ ]
140146

141147
[de make-endpoint (Addr Type Flag Sock)
142148
(cond ((= Type "NN_REP") (nn-bind Sock Addr))

0 commit comments

Comments
 (0)