For some reason putting Jim into Cc didn't work, so I'm trying it the
other way.  Once again, a patch for porting hostinfo to C5.

Vasilij
From 8db9d5d79e63e3a552e5ab2a8571d9deeb7fa8f3 Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann <m...@vasilij.de>
Date: Mon, 22 Jul 2019 22:49:30 +0200
Subject: [PATCH] C5 compatibility

---
 build-hostinfo     |  2 ++
 build-hostinfo.bat |  2 ++
 hostinfo.egg       |  7 +++++++
 hostinfo.scm       | 22 ++++++++++++++++------
 4 files changed, 27 insertions(+), 6 deletions(-)
 create mode 100755 build-hostinfo
 create mode 100644 build-hostinfo.bat
 create mode 100644 hostinfo.egg

diff --git a/build-hostinfo b/build-hostinfo
new file mode 100755
index 0000000..56c69a4
--- /dev/null
+++ b/build-hostinfo
@@ -0,0 +1,2 @@
+#!/bin/sh
+"$CHICKEN_CSC" -O2 -d2 -C "$CFLAGS" -L "$LDFLAGS" "$@"
diff --git a/build-hostinfo.bat b/build-hostinfo.bat
new file mode 100644
index 0000000..c882ab5
--- /dev/null
+++ b/build-hostinfo.bat
@@ -0,0 +1,2 @@
+@echo off
+%CHICKEN_CSC% -O2 -d2 -C %CFLAGS% -L -lws2_32 -L %LDFLAGS% %*
diff --git a/hostinfo.egg b/hostinfo.egg
new file mode 100644
index 0000000..f6fb52b
--- /dev/null
+++ b/hostinfo.egg
@@ -0,0 +1,7 @@
+;;; hostinfo.meta -*- Hen -*-
+((synopsis "Look up host, protocol, and service information")
+ (author "Jim Ursetto")
+ (dependencies foreigners system-information)
+ (license "BSD")
+ (category net)
+ (components (extension hostinfo (custom-build "build-hostinfo"))))
diff --git a/hostinfo.scm b/hostinfo.scm
index 7dfd0fc..7ede91a 100644
--- a/hostinfo.scm
+++ b/hostinfo.scm
@@ -60,8 +60,6 @@
 
 #> #include "hostinfo.h" <#
 
-(require-extension srfi-4 lolevel posix)
-
 (module hostinfo
 ;;; Short and sweet lookups
   (current-hostname
@@ -82,10 +80,22 @@
 ;;; Utilities
    string->ip ip->string)
 
-  (import scheme chicken
-          extras srfi-4 lolevel posix foreign
-         data-structures
-          foreigners)
+  (import scheme)
+
+  (cond-expand
+   (chicken-4
+    (import chicken foreign)
+    (require extras srfi-4 lolevel posix data-structures foreigners))
+   (chicken-5
+    (import (chicken base))
+    (import (chicken blob))
+    (import (chicken fixnum))
+    (import (chicken foreign))
+    (import (chicken format))
+    (import (chicken string))
+    (import (srfi 4))
+    (import foreigners)
+    (import system-information)))
 
   (define (vector-map p v0)   ; to avoid linking in vector-lib
     (let* ((len (vector-length v0))
-- 
2.22.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to