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

Commit 3e05d54

Browse files
committed
Add support for Nanomsg v1.1.2
1 parent c8bc657 commit 3e05d54

File tree

6 files changed

+38
-60
lines changed

6 files changed

+38
-60
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+
## 1.1.2 (2016-01-06)
4+
5+
* Bump nanomsg to 1.1.2
6+
* Remove the use of namespaces
7+
38
## 0.8.0 (2016-01-06)
49

510
* Bump nanomsg to 0.8-beta

Makefile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ PIL_SYMLINK_DIR ?= .lib
66
## Edit below
77
BUILD_REPO = https://github.com/nanomsg/nanomsg.git
88
BUILD_DIR = $(PIL_MODULE_DIR)/nanomsg/HEAD
9-
BUILD_REF = 0.8-beta
10-
LIB_DIR = .libs
9+
BUILD_REF = 1.1.2
1110
TARGET = libnanomsg.so
12-
BFLAGS = --enable-shared
1311
## Edit above
1412

1513
# Unit testing
@@ -21,7 +19,7 @@ COMPILE = make
2119

2220
.PHONY: all clean
2321

24-
all: $(BUILD_DIR) $(BUILD_DIR)/$(LIB_DIR)/$(TARGET) symlink
22+
all: $(BUILD_DIR) $(BUILD_DIR)/$(TARGET) symlink
2523

2624
$(BUILD_DIR):
2725
mkdir -p $(BUILD_DIR) && \
@@ -31,26 +29,25 @@ $(TEST_DIR):
3129
mkdir -p $(TEST_DIR) && \
3230
git clone $(TEST_REPO) $(TEST_DIR)
3331

34-
$(BUILD_DIR)/$(LIB_DIR)/$(TARGET):
32+
$(BUILD_DIR)/$(TARGET):
3533
cd $(BUILD_DIR) && \
3634
git checkout $(BUILD_REF) && \
37-
./autogen.sh && \
38-
./configure $(BFLAGS) && \
35+
./configure && \
3936
$(COMPILE) && \
40-
strip --strip-unneeded $(LIB_DIR)/$(TARGET)
37+
strip --strip-unneeded $(TARGET)
4138

4239
symlink:
4340
mkdir -p $(PIL_SYMLINK_DIR) && \
4441
cd $(PIL_SYMLINK_DIR) && \
45-
ln -sf ../$(BUILD_DIR)/$(LIB_DIR)/$(TARGET) $(TARGET)
42+
ln -sf ../$(BUILD_DIR)/$(TARGET) $(TARGET)
4643

4744
check: all $(TEST_DIR) run-tests
4845

4946
run-tests:
50-
./test.l
47+
PIL_NAMESPACES=false ./test.l
5148

5249
clean:
53-
cd $(BUILD_DIR)/$(LIB_DIR) && \
50+
cd $(BUILD_DIR) && \
5451
rm -f $(TARGET) && \
5552
cd - && \
5653
cd $(PIL_SYMLINK_DIR) && \

README.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Nanomsg FFI bindings for PicoLisp
22

3-
[![GitHub release](https://img.shields.io/github/release/aw/picolisp-nanomsg.svg)](https://github.com/aw/picolisp-nanomsg) [![Build Status](https://travis-ci.org/aw/picolisp-nanomsg.svg?branch=master)](https://travis-ci.org/aw/picolisp-nanomsg) [![Dependency](https://img.shields.io/badge/%5Bdeps%5D%20Nanomsg-0.8--beta-ff69b4.svg)](https://github.com/nanomsg/nanomsg) [![Dependency](https://img.shields.io/badge/[deps] picolisp--unit-v1.0.0-ff69b4.svg)](https://github.com/aw/picolisp-unit.git)
3+
[![GitHub release](https://img.shields.io/github/release/aw/picolisp-nanomsg.svg)](https://github.com/aw/picolisp-nanomsg) [![Build Status](https://travis-ci.org/aw/picolisp-nanomsg.svg?branch=master)](https://travis-ci.org/aw/picolisp-nanomsg) [![Dependency](https://img.shields.io/badge/%5Bdeps%5D%20Nanomsg-1.1.2-ff69b4.svg)](https://github.com/nanomsg/nanomsg) [![Dependency](https://img.shields.io/badge/[deps] picolisp--unit-v2.1.0-ff69b4.svg)](https://github.com/aw/picolisp-unit.git)
44

55
[Nanomsg](http://nanomsg.org/index.html) FFI bindings for [PicoLisp](http://picolisp.com/).
66

@@ -15,7 +15,8 @@ The following protocols are supported:
1515

1616
# Requirements
1717

18-
* PicoLisp 64-bit v3.1.9+
18+
* PicoLisp 64-bit v17.3+
19+
* Tested up to PicoLisp 64-bit v18.1.17
1920
* Git
2021
* UNIX/Linux development/build tools (gcc, make/gmake, etc..)
2122

@@ -35,7 +36,7 @@ This binding relies on the _Official Nanomsg C Library_, compiled as a shared li
3536

3637
Once compiled, the shared library is symlinked as:
3738

38-
.lib/libnanomsg.so -> .modules/nanomsg/HEAD/src/.libs/libnanomsg.so
39+
.lib/libnanomsg.so -> .modules/nanomsg/HEAD/libnanomsg.so
3940

4041
The `nanomsg.l` file searches for `.lib/libnanomsg.so`, relative to its current directory.
4142

@@ -47,7 +48,7 @@ To keep everything updated, type:
4748

4849
# Usage
4950

50-
Only the following functions are exported publicly, and namespaced with `(symbols 'nanomsg)` (or the prefix: `nanomsg~`):
51+
Only the following functions are considered `public`:
5152

5253
* `protocol-bind`: bind a `REP, PUB, BUS, PAIR, PULL, or SURVEYOR` socket (inproc, ipc, tcp)
5354
* `protocol-connect`: connect to a `REQ, SUB, BUS, PAIR, PUSH, RESPONDENT` socket (inproc, ipc, tcp)
@@ -67,7 +68,6 @@ When an error occurs, `'InternalError` is thrown, along with the error (error ty
6768
pil +
6869
(load "nanomsg.l")
6970
70-
(symbols 'nanomsg)
7171
(let Error
7272
(catch 'InternalError
7373
(protocol-bind "REP" "tcpz://127.0.0.1:5560" "AF_SP_RAW")
@@ -85,7 +85,6 @@ pil +
8585
pil +
8686
(load "nanomsg.l")
8787
88-
(symbols 'nanomsg)
8988
(unless (fork)
9089
(let Sockpair
9190
(protocol-bind "REP" "tcp://127.0.0.1:5560")
@@ -106,7 +105,6 @@ pil +
106105
pil +
107106
(load "nanomsg.l")
108107
109-
(symbols 'nanomsg)
110108
(unless (fork)
111109
(let Sockpair
112110
(protocol-connect "REQ" "tcp://127.0.0.1:5560")
@@ -126,7 +124,6 @@ pil +
126124
pil +
127125
(load "nanomsg.l")
128126
129-
(symbols 'nanomsg)
130127
(unless (fork)
131128
(let Sockpair
132129
(protocol-connect "SUB" "tcp://127.0.0.1:5560")
@@ -144,7 +141,6 @@ pil +
144141
pil +
145142
(load "nanomsg.l")
146143
147-
(symbols 'nanomsg)
148144
(let Sockpair
149145
(protocol-bind "PUB" "tcp://127.0.0.1:5560")
150146
(while T (msg-send (car Sockpair) "test Hello World!"))
@@ -159,7 +155,6 @@ pil +
159155
pil +
160156
(load "nanomsg.l")
161157
162-
(symbols 'nanomsg)
163158
(unless (fork)
164159
(let Sockpair
165160
(protocol-connect "BUS" "tcp://127.0.0.1:5560")
@@ -176,7 +171,6 @@ pil +
176171
pil +
177172
(load "nanomsg.l")
178173
179-
(symbols 'nanomsg)
180174
(unless (fork)
181175
(let Sockpair
182176
(protocol-bind "BUS" "tcp://127.0.0.1:5560")
@@ -193,7 +187,6 @@ pil +
193187
pil +
194188
(load "nanomsg.l")
195189
196-
(symbols 'nanomsg)
197190
(unless (fork)
198191
(let Sockpair
199192
(protocol-connect "PAIR" "tcp://127.0.0.1:5560")
@@ -210,7 +203,6 @@ pil +
210203
pil +
211204
(load "nanomsg.l")
212205
213-
(symbols 'nanomsg)
214206
(unless (fork)
215207
(let Sockpair
216208
(protocol-bind "PAIR" "tcp://127.0.0.1:5560")
@@ -227,7 +219,6 @@ pil +
227219
pil +
228220
(load "nanomsg.l")
229221
230-
(symbols 'nanomsg)
231222
(unless (fork)
232223
(let Sockpair
233224
(protocol-bind "PULL" "tcp://127.0.0.1:5560")
@@ -244,7 +235,6 @@ pil +
244235
pil +
245236
(load "nanomsg.l")
246237
247-
(symbols 'nanomsg)
248238
(unless (fork)
249239
(let Sockpair
250240
(protocol-connect "PUSH" "tcp://127.0.0.1:5560")
@@ -264,7 +254,6 @@ work as expected.
264254
pil +
265255
(load "nanomsg.l")
266256
267-
(symbols 'nanomsg)
268257
(unless (fork)
269258
(let Sockpair (protocol-bind "SURVEYOR" "tcp://127.0.0.1:5560")
270259
(msg-send (car Sockpair) "Knock knock.")
@@ -281,7 +270,6 @@ pil +
281270
pil +
282271
(load "nanomsg.l")
283272
284-
(symbols 'nanomsg)
285273
(unless (fork)
286274
(let Sockpair
287275
(protocol-connect "RESPONDENT" "tcp://127.0.0.1:5560")
@@ -327,4 +315,4 @@ If you want to improve this library, please make a pull-request.
327315
# License
328316

329317
[MIT License](LICENSE)
330-
Copyright (c) 2015-2016 Alexander Williams, Unscramble <license@unscramble.jp>
318+
Copyright (c) 2015-2018 Alexander Williams, Unscramble <license@unscramble.jp>

nanomsg.l

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@
22
#
33
# The MIT License (MIT)
44
#
5-
# Copyright (c) 2015-2016 Alexander Williams, Unscramble <license@unscramble.jp>
6-
7-
(symbols 'nanomsg 'pico)
8-
9-
(local MODULE_INFO MSG_MAX_SIZE *Nanomsg *NN_Symbols)
10-
(local nn-socket nn-close nn-setsockopt nn-getsockopt nn-bind nn-connect nn-shutdown nn-send nn-recv)
11-
(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 create-socket make-socket make-endpoint check-endpoint)
13-
(local sub-unsub non-blocking-io)
14-
15-
(load (pack (car (file)) "module.l"))
5+
# Copyright (c) 2015-2018 Alexander Williams, Unscramble <license@unscramble.jp>
166

177
(setq
188
MSG_MAX_SIZE (if (sys "NANOMSG_MAX_SIZE") (format @) 8192) # 8KB should be enough

test.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
(chdir "test/"
66
(mapcar load (filter '((N) (sub? "test_" N)) (dir "."))) )
77

8-
(unit~report)
8+
(report)

test/test_nanomsg.l

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,101 +2,99 @@
22

33
(prinl "^J Testing Nanomsg FFI bindings for PicoLisp^J")
44

5-
(symbols 'nanomsg)
6-
75
(setq *My_tests_are_order_dependent NIL)
86

97
[de test-rep-bind ()
108
(let (Sockpair (rep-bind "tcp://127.0.0.1:5560")
11-
Result (unit~assert-equal '(0 . 1)
9+
Result (assert-equal '(0 . 1)
1210
Sockpair
1311
"REP-BIND socket is created") )
1412
(end-sock Sockpair)
1513
Result ]
1614

1715
[de test-req-connect ()
1816
(let (Sockpair (req-connect "tcp://127.0.0.1:5560")
19-
Result (unit~assert-equal '(0 . 1)
17+
Result (assert-equal '(0 . 1)
2018
Sockpair
2119
"REQ-CONNECT socket is created") )
2220
(end-sock Sockpair)
2321
Result ]
2422

2523
[de test-pub-bind ()
2624
(let (Sockpair (pub-bind "tcp://127.0.0.1:5560")
27-
Result (unit~assert-equal '(0 . 1)
25+
Result (assert-equal '(0 . 1)
2826
Sockpair
2927
"PUB-BIND socket is created") )
3028
(end-sock Sockpair)
3129
Result ]
3230

3331
[de test-sub-connect ()
3432
(let (Sockpair (sub-connect "tcp://127.0.0.1:5560")
35-
Result (unit~assert-equal '(0 . 1)
33+
Result (assert-equal '(0 . 1)
3634
Sockpair
3735
"SUB-CONNECT socket is created") )
3836
(end-sock Sockpair)
3937
Result ]
4038

4139
[de test-bus-bind ()
4240
(let (Sockpair (bus-bind "tcp://127.0.0.1:5560")
43-
Result (unit~assert-equal '(0 . 1)
41+
Result (assert-equal '(0 . 1)
4442
Sockpair
4543
"BUS-BIND socket is created") )
4644
(end-sock Sockpair)
4745
Result ]
4846

4947
[de test-bus-connect ()
5048
(let (Sockpair (bus-connect "tcp://127.0.0.1:5560")
51-
Result (unit~assert-equal '(0 . 1)
49+
Result (assert-equal '(0 . 1)
5250
Sockpair
5351
"BUS-CONNECT socket is created") )
5452
(end-sock Sockpair)
5553
Result ]
5654

5755
[de test-pair-bind ()
5856
(let (Sockpair (pair-bind "tcp://127.0.0.1:5560")
59-
Result (unit~assert-equal '(0 . 1)
57+
Result (assert-equal '(0 . 1)
6058
Sockpair
6159
"PAIR-BIND socket is created") )
6260
(end-sock Sockpair)
6361
Result ]
6462

6563
[de test-pair-connect ()
6664
(let (Sockpair (pair-connect "tcp://127.0.0.1:5560")
67-
Result (unit~assert-equal '(0 . 1)
65+
Result (assert-equal '(0 . 1)
6866
Sockpair
6967
"PAIR-CONNECT socket is created") )
7068
(end-sock Sockpair)
7169
Result ]
7270

7371
[de test-pull-bind ()
7472
(let (Sockpair (pull-bind "tcp://127.0.0.1:5560")
75-
Result (unit~assert-equal '(0 . 1)
73+
Result (assert-equal '(0 . 1)
7674
Sockpair
7775
"PULL-BIND socket is created") )
7876
(end-sock Sockpair)
7977
Result ]
8078

8179
[de test-push-connect ()
8280
(let (Sockpair (push-connect "tcp://127.0.0.1:5560")
83-
Result (unit~assert-equal '(0 . 1)
81+
Result (assert-equal '(0 . 1)
8482
Sockpair
8583
"PULL-CONNECT socket is created") )
8684
(end-sock Sockpair)
8785
Result ]
8886

8987
[de test-survey-bind ()
9088
(let (Sockpair (survey-bind "tcp://127.0.0.1:5560")
91-
Result (unit~assert-equal '(0 . 1)
89+
Result (assert-equal '(0 . 1)
9290
Sockpair
9391
"SURVEY-BIND socket is created") )
9492
(end-sock Sockpair)
9593
Result ]
9694

9795
[de test-respond-connect ()
9896
(let (Sockpair (respond-connect "tcp://127.0.0.1:5560")
99-
Result (unit~assert-equal '(0 . 1)
97+
Result (assert-equal '(0 . 1)
10098
Sockpair
10199
"RESPOND-CONNECT socket is created") )
102100
(end-sock Sockpair)
@@ -116,28 +114,28 @@
116114
Result (msg-recv (car Sockpair)))
117115
(end-sock Sockpair)
118116

119-
(unit~assert-equal "Hello World!"
117+
(assert-equal "Hello World!"
120118
Result
121119
"Successfully send/receive a message using PAIR protocol" ]
122120

123121
[de test-protocol-bind ()
124122
(let (Sockpair (protocol-bind "REP" "tcp://127.0.0.1:5560")
125-
Result (unit~assert-equal '(0 . 1)
123+
Result (assert-equal '(0 . 1)
126124
Sockpair
127125
"Protocol REP-BIND socket is created") )
128126
(end-sock Sockpair)
129127
Result ]
130128

131129
[de test-protocol-connect ()
132130
(let (Sockpair (protocol-connect "REQ" "tcp://127.0.0.1:5560")
133-
Result (unit~assert-equal '(0 . 1)
131+
Result (assert-equal '(0 . 1)
134132
Sockpair
135133
"Protocol REQ-CONNECT socket is created") )
136134
(end-sock Sockpair)
137135
Result ]
138136

139-
[unit~execute
140-
'(unit~assert-throws 'InternalError
137+
[execute
138+
'(assert-throws 'InternalError
141139
'(NanomsgError . "Protocol not supported")
142140
'(rep-bind "tcpz://127.0.0.1:5560")
143141
"Throw an InternalError when trying to use an invalid protocol" )

0 commit comments

Comments
 (0)