Re: [Chicken-users] (hostinfo-addresses (hostname->hostinfo (get-host-name)))))) => returns only one address

2019-07-22 Thread Vasilij Schneidermann
One more time, with a patch for Jim.
From 8db9d5d79e63e3a552e5ab2a8571d9deeb7fa8f3 Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann 
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 000..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 000..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 000..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



signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] (hostinfo-addresses (hostname->hostinfo (get-host-name)))))) => returns only one address

2019-07-22 Thread Vasilij Schneidermann
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 
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 000..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 000..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 000..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



signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] (hostinfo-addresses (hostname->hostinfo (get-host-name)))))) => returns only one address

2019-07-22 Thread Vasilij Schneidermann
Hello Matt,

Turns out this wasn't that hard to port.  I've added Jim to Cc so that
he can take a look at the patch.

Unfortunately I don't know much about this networking thing, so I can't
help you with the bug, other than giving you debugging ideas.  Take a
look at how exactly the egg performs its lookups and compare it with
your own solution.  Maybe there's a crucial thing missing in the egg or
something.  Another thing that would help would be having a publicly
reachable host at hand that always returns multiple addresses.

Vasilij
From 8db9d5d79e63e3a552e5ab2a8571d9deeb7fa8f3 Mon Sep 17 00:00:00 2001
From: Vasilij Schneidermann 
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 000..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 000..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 000..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



signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] (hostinfo-addresses (hostname->hostinfo (get-host-name)))))) => returns only one address

2019-07-20 Thread Matt Welland
Hi Vasilij,

While it would be great if you decided to port hostinfo, note that
unfortunately with the hostinfo-addresses bug it is not much use to me. We
have some code that seems to work ok for now:
http://www.kiatoa.com/cgi-bin/fossils/ulex/artifact/5fd65e8732654017 so I
am not blocked by this. I was hoping to leverage an existing egg but that
is not critical. If Jim Ursertto sees this perhaps he can comment on his
plans.

Thanks,

Matt

On Sat, Jul 20, 2019 at 12:30 AM Vasilij Schneidermann 
wrote:

> Hello Matt,
>
> > BTW, I don't see a hostinfo egg for Chicken 5. Is porting hostinfo
> planned
> > or is the functionality available in a different egg?
>
> There is no such thing as a grand plan to port all the eggs, it's been
> done so far on a case-by-case basis.  If someone really needs an egg,
> they'll port it and notify the author or maintainer of the required
> changes.  Some authors and maintainers are proactive about it and port
> all of their eggs, but that's apparently not the case for this one.
>
> Looking further at it, it appears it was written by Jim Ursetto who put
> up some ported eggs on https://github.com/ursetto recently, but not that
> one yet.  From personal experience porting his eggs is challenging due
> to use of macros, internal stuff and other trickery.  This one doesn't
> look too bad though, I could give it a try if you like.
>
> Vasilij
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] (hostinfo-addresses (hostname->hostinfo (get-host-name)))))) => returns only one address

2019-07-20 Thread Vasilij Schneidermann
Hello Matt,

> BTW, I don't see a hostinfo egg for Chicken 5. Is porting hostinfo planned
> or is the functionality available in a different egg?

There is no such thing as a grand plan to port all the eggs, it's been
done so far on a case-by-case basis.  If someone really needs an egg,
they'll port it and notify the author or maintainer of the required
changes.  Some authors and maintainers are proactive about it and port
all of their eggs, but that's apparently not the case for this one.

Looking further at it, it appears it was written by Jim Ursetto who put
up some ported eggs on https://github.com/ursetto recently, but not that
one yet.  From personal experience porting his eggs is challenging due
to use of macros, internal stuff and other trickery.  This one doesn't
look too bad though, I could give it a try if you like.

Vasilij


signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users