Skip to content

Commit 1af6477

Browse files
committed
Move all library initializers into their respective packages
1 parent 6bd5388 commit 1af6477

File tree

10 files changed

+33
-23
lines changed

10 files changed

+33
-23
lines changed

dns.i

-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
%feature("intern_function", "swig-lispify");
22
%feature("export");
33
%typemap(cin) u_short ":unsigned-short";
4-
54
%insert("lisphead") %{
6-
(defpackage :dns
7-
(:use :cl :cffi))
85
(in-package :dns)
96
%}
107

src/dns/dns.asd

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
:licence "WTFPL"
55
:serial t
66
:description "Helpful DNS functions where Lisp doesn't efficiently do the right things"
7-
:components ((:file "ffi"))
7+
:components ((:file "package")
8+
(:file "ffi"))
89
:depends-on (:cffi))

src/dns/ffi.lisp

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
;;; Do not make changes to this file unless you know what you are doing--modify
55
;;; the SWIG interface file instead.
66

7-
(defpackage :dns
8-
(:use :cl :cffi))
97
(in-package :dns)
108

119

src/dns/package.lisp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(defpackage :dns
2+
(:use :cl :cffi)
3+
(:export
4+
#:initialize-library))
5+
(in-package :dns)
6+
7+
(cffi:define-foreign-library dns
8+
(:unix (:or "c-src/libdns.so")))
9+
10+
(defun initialize-library ()
11+
(cffi:use-foreign-library dns))

src/http3/package.lisp

-12
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,3 @@
77

88
(in-package :http3)
99

10-
(cffi:define-foreign-library lsquic
11-
(:unix (:or "lsquic/src/liblsquic/liblsquic.so")))
12-
13-
(cffi:define-foreign-library dns
14-
(:unix (:or "c-src/libdns.so")))
15-
16-
(cffi:define-foreign-library udp
17-
(:unix (:or "c-src/libudp.so")))
18-
19-
(cffi:use-foreign-library lsquic)
20-
(cffi:use-foreign-library dns)
21-
(cffi:use-foreign-library udp)

src/lsquic/package.lisp

+7
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,10 @@
3737
(subseq name (length s))
3838
name)))
3939
prefixes-to-remove))) flag package))))
40+
41+
(cffi:define-foreign-library lsquic
42+
(:unix (:or "lsquic/src/liblsquic/liblsquic.so")))
43+
(cffi:use-foreign-library lsquic)
44+
45+
(dns:initialize-library)
46+
(udp:initialize-library)

src/udp/ffi.lisp

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
;;; Do not make changes to this file unless you know what you are doing--modify
55
;;; the SWIG interface file instead.
66

7-
(defpackage :udp
8-
(:use :cl :cffi))
97
(in-package :udp)
108

119

src/udp/package.lisp

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(defpackage :udp
2+
(:use :cl :cffi)
3+
(:export
4+
#:initialize-library))
5+
(in-package :udp)
6+
7+
(cffi:define-foreign-library udp
8+
(:unix (:or "c-src/libudp.so")))
9+
10+
(defun initialize-library ()
11+
(cffi:use-foreign-library udp))

src/udp/udp.asd

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
:licence "WTFPL"
55
:serial t
66
:description "Helpful UDP functions where Lisp doesn't efficiently do the right things"
7-
:components ((:file "ffi"))
7+
:components ((:file "package")
8+
(:file "ffi"))
89
:depends-on (:cffi))

udp.i

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
%feature("intern_function", "swig-lispify");
22
%feature("export");
33
%insert("lisphead") %{
4-
(defpackage :udp
5-
(:use :cl :cffi))
64
(in-package :udp)
75
%}
86

0 commit comments

Comments
 (0)