Compare commits
10 Commits
b0f5b43ccd
...
a94340b281
Author | SHA1 | Date |
---|---|---|
TakeV | a94340b281 | |
TakeV | 0a030d4515 | |
TakeV | d4fd886bcb | |
TakeV | 4638ca6e9a | |
TakeV | 3222e7d0c9 | |
TakeV | 7f0364de19 | |
TakeV | e46f2f0566 | |
TakeV | 19e06c0182 | |
TakeV | a7c418a1c0 | |
TakeV | b6d2775f20 |
|
@ -63,3 +63,4 @@ stamp-h[0-9]
|
|||
tmp
|
||||
/.version
|
||||
/doc/stamp-[0-9]
|
||||
/.envrc
|
||||
|
|
43
README.org
43
README.org
|
@ -1,4 +1,45 @@
|
|||
# -*- mode: org; coding: utf-8; -*-
|
||||
|
||||
#+TITLE: README for Guile-Nrepl
|
||||
#+TITLE: README for Guile-nREPL
|
||||
|
||||
* Description
|
||||
nREPL server implementation for guile.
|
||||
|
||||
* Spells for working with the project
|
||||
|
||||
If you have guix and org-mode, the src blocks in this section can be executed directly from this doc.
|
||||
|
||||
** Building
|
||||
To build the project, you need hall, autoconf, guile, and automake. If you are running guix, you just need to run a =guix shell= to get all the requirements.
|
||||
|
||||
#+begin_src shell
|
||||
guix shell -m manifest.scm -f guix.scm # Skip if you do not use guix
|
||||
hall build -x
|
||||
autoreconf -vif
|
||||
./configure
|
||||
make
|
||||
#+end_src
|
||||
|
||||
** Testing
|
||||
After the project is built, test the project via:
|
||||
|
||||
#+BEGIN_SRC shell
|
||||
make check
|
||||
#+END_SRC
|
||||
|
||||
** Cleaning
|
||||
To get back to a clean state, run:
|
||||
|
||||
#+BEGIN_SRC shell
|
||||
hall clean -x
|
||||
#+END_SRC
|
||||
|
||||
** Misc Incantations
|
||||
Other things that may be useful.
|
||||
*** Load shell in direnv
|
||||
If you use direnv, you can drop into the shell automatically with:
|
||||
|
||||
#+BEGIN_SRC shell
|
||||
echo 'eval $(guix shell --search-paths -m manifest.scm -f guix.scm)' > .envrc
|
||||
direnv allow
|
||||
#+END_SRC
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
(define-module (guile-nrepl bencode)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (string->bencode
|
||||
integer->bencode
|
||||
list->bencode
|
||||
pair->bencode))
|
||||
|
||||
(define (string->bencode input-str)
|
||||
(when (string? input-str)
|
||||
(format #f "~d:~a" (string-length input-str) input-str)))
|
||||
|
||||
(define (integer->bencode input-int)
|
||||
(when (integer? input-int)
|
||||
(format #f "i~de" input-int)))
|
||||
|
||||
(define (list->bencode input-list)
|
||||
(when (list? input-list)
|
||||
(format #f "l~ae" (apply string-append (map bencode-encode-dispatch input-list)))))
|
||||
|
||||
(define (pair->bencode input-pair)
|
||||
(when (pair? input-pair)
|
||||
(format #f "d~a~ae"
|
||||
(bencode-encode-dispatch (car input-pair))
|
||||
(bencode-encode-dispatch (cdr input-pair)))))
|
||||
|
||||
(define (bencode-encode-dispatch input-value)
|
||||
(cond
|
||||
((string? input-value) (string->bencode input-value))
|
||||
((integer? input-value) (integer->bencode input-value))
|
||||
((list? input-value) (list->bencode input-value))
|
||||
((pair? input-value) (pair->bencode input-value))))
|
74
guix.scm
74
guix.scm
|
@ -1,30 +1,48 @@
|
|||
(use-modules
|
||||
(guix packages)
|
||||
((guix licenses) #:prefix license:)
|
||||
(guix download)
|
||||
(guix build-system gnu)
|
||||
(gnu packages)
|
||||
(gnu packages autotools)
|
||||
(gnu packages guile)
|
||||
(gnu packages guile-xyz)
|
||||
(gnu packages pkg-config)
|
||||
(gnu packages texinfo))
|
||||
|
||||
(package
|
||||
(name "guile-nrepl")
|
||||
(version "0.1")
|
||||
(source "./guile-nrepl-0.1.tar.gz")
|
||||
(build-system gnu-build-system)
|
||||
(arguments `())
|
||||
(native-inputs
|
||||
`(("autoconf" ,autoconf)
|
||||
("automake" ,automake)
|
||||
("pkg-config" ,pkg-config)
|
||||
("texinfo" ,texinfo)))
|
||||
(inputs `(("guile" ,guile-3.0)))
|
||||
(propagated-inputs `())
|
||||
(synopsis "")
|
||||
(description "")
|
||||
(home-page "")
|
||||
(license license:gpl3+))
|
||||
(guix gexp)
|
||||
(guix packages)
|
||||
((guix licenses) #:prefix license:)
|
||||
(guix download)
|
||||
(guix git-download)
|
||||
(guix build-system gnu)
|
||||
(gnu packages)
|
||||
(gnu packages autotools)
|
||||
(gnu packages guile)
|
||||
(gnu packages guile-xyz)
|
||||
(gnu packages pkg-config)
|
||||
(gnu packages texinfo))
|
||||
|
||||
(let ((%source-dir (dirname (current-filename))))
|
||||
(package
|
||||
(name "guile-nrepl")
|
||||
(version "0.1")
|
||||
(source (local-file %source-dir
|
||||
#:recursive? #t
|
||||
#:select? (git-predicate %source-dir)))
|
||||
(build-system gnu-build-system)
|
||||
(arguments
|
||||
(list
|
||||
#:make-flags
|
||||
#~(list "GUILE_AUTO_COMPILE=0")
|
||||
#:phases
|
||||
#~(modify-phases %standard-phases
|
||||
(delete 'strip)
|
||||
(add-before 'configure 'hall-build
|
||||
(lambda _
|
||||
(system* "hall" "build" "-x")))
|
||||
(add-after 'hall-build 'autoreconf
|
||||
(lambda _
|
||||
(system* "autoreconf" "-vif"))))))
|
||||
(native-inputs
|
||||
(list autoconf
|
||||
automake
|
||||
guile-hall
|
||||
pkg-config
|
||||
texinfo))
|
||||
(inputs (list guile-3.0))
|
||||
(propagated-inputs (list guile-config
|
||||
guile-torrent))
|
||||
(synopsis "???")
|
||||
(description "???")
|
||||
(home-page "???")
|
||||
(license license:gpl3+)))
|
||||
|
|
18
hall.scm
18
hall.scm
|
@ -2,22 +2,24 @@
|
|||
(name "guile-nrepl")
|
||||
(prefix "")
|
||||
(version "0.1")
|
||||
(author "")
|
||||
(author "TakeV")
|
||||
(copyright (2023))
|
||||
(synopsis "")
|
||||
(description "")
|
||||
(description "An nREPL implementation in guile")
|
||||
(home-page "")
|
||||
(license gpl3+)
|
||||
(dependencies `())
|
||||
(dependencies
|
||||
`(("guile-config" ,guile-config)
|
||||
("guile-torrent" ,guile-torrent)))
|
||||
(skip ())
|
||||
(files (libraries
|
||||
((scheme-file "guile-nrepl")
|
||||
(directory "guile-nrepl" ())))
|
||||
(tests ((directory "tests" ())))
|
||||
((directory
|
||||
"guile-nrepl"
|
||||
((scheme-file "bencode")))))
|
||||
(tests ((directory "tests" ((scheme-file "bencode")))))
|
||||
(programs ((directory "scripts" ())))
|
||||
(documentation
|
||||
((org-file "README")
|
||||
(symlink "README" "README.org")
|
||||
((symlink "README" "README.org")
|
||||
(text-file "HACKING")
|
||||
(text-file "COPYING")
|
||||
(directory "doc" ((texi-file "guile-nrepl")))))
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
;; What follows is a "manifest" equivalent to the command line you gave.
|
||||
;; You can store it in a file that you may then pass to any 'guix' command
|
||||
;; that accepts a '--manifest' (or '-m') option.
|
||||
|
||||
(concatenate-manifests
|
||||
(list (specifications->manifest
|
||||
(list "guile-hall" "guile-torrent"))
|
||||
(package->development-manifest
|
||||
(specification->package "guile-hall"))))
|
|
@ -0,0 +1,10 @@
|
|||
(define-module (tests bencode)
|
||||
#:use-module (srfi srfi-64)
|
||||
#:use-module (guile-nrepl bencode))
|
||||
|
||||
(test-group "bencode"
|
||||
(test-group "encode"
|
||||
(test-group "string->bencode"
|
||||
(test-equal "empty string case" "0:" (string->bencode ""))
|
||||
(test-equal "test word serializes" "5:takev" (string->bencode "takev"))
|
||||
#;(test-assert "number input returns false" (list? (string->bencode 15))))))
|
Loading…
Reference in New Issue