Ticket #1767: netstring-c5.patch

File netstring-c5.patch, 2.4 KB (added by Christopher Brannon, 3 years ago)

patch to port netstring to CHICKEN 5

  • netstring.egg

    diff -Nur netstring.egg netstring.egg
     
     1;;; netstring.egg -*- Scheme -*-
     2
     3((synopsis "Parsing and writing <a href=\"http://cr.yp.to/proto/netstrings.txt\">netstrings</a>")
     4 (category parsing)
     5 (test-dependencies test)
     6 (license "BSD")
     7 (author "Moritz Heidkamp")
     8 (components
     9  (extension netstring)))
  • netstring.meta

    diff -Nur netstring.meta netstring.meta
     
    1 ((synopsis "Parsing and writing <a href=\"http://cr.yp.to/proto/netstrings.txt\">netstrings</a>")
    2  (author "Moritz Heidkamp")
    3  (test-depends test)
    4  (category parsing)
    5  (license "BSD"))
  • netstring.scm

    diff -Nur netstring.scm netstring.scm
     
    22
    33(netstring-write netstring-read string->netstring netstring->string)
    44
    5 (import chicken scheme)
    6 (use (only extras read-string read-token)
    7      (only ports
    8            with-output-to-port
    9            with-output-to-string
    10            with-input-from-string))
     5(import
     6  (chicken base)
     7  (only (chicken format) sprintf)
     8  (only (chicken io) read-string read-token)
     9  (only (chicken port)
     10        with-output-to-port
     11        with-output-to-string
     12        with-input-from-string)
     13  scheme)
    1114
    1215(define (netstring-write str #!optional (port (current-output-port)) (terminator #\,))
    1316  (with-output-to-port port
     
    2932
    3033        (cond ((not (= (string-length string) len))
    3134               (error 'netstring-read
    32                       (format "wrong length, expected ~A but got ~A"
     35                      (sprintf "wrong length, expected ~A but got ~A"
    3336                              len
    3437                              (string-length string))))
    3538              (check-terminator?
  • netstring.setup

    diff -Nur netstring.setup netstring.setup
     
    1 (standard-extension "netstring" "0.0.4")
  • tests/run.scm

    diff -Nur tests/run.scm tests/run.scm
     
    1 (load-relative "../netstring")
    2 (import netstring)
    3 (use test)
     1(import (chicken port) netstring test)
    42
    53(test-begin)
    64