Re: [PATCH] Re: Eggs not installing on msys-mingw32

2023-11-05 Thread Matt Welland
Well, I have no idea what is going on but I'm suspecting a hardware
problem. In my last reply I was confident the problem was reproducible but
as I continued to try things that proved to not be the case.

I switched to working with Chicken-5.3.0rc2 and the build there failed on
creation of modules.db, again it was very reliably reproducible. Thinking
this was maybe a race condition between the creation of the modules.db file
and the following file copy I added a little code to read the file back and
compare it. The problem went away. Unfortunately when I reverted the code
the problem did not return. That does not make any sense whatsoever.

Currently I'm able to get to where when I install the sqlite3 egg it fails
with:

Error: unterminated list

If I run the install a couple times it results in a working egg.

I'll keep chipping away at this but I don't think I have anything tangible
to offer in terms of a problem statement other than ... "Windows sucks".

On Tue, Oct 31, 2023 at 3:25 AM Peter Bex  wrote:

> On Mon, Oct 30, 2023 at 05:45:28PM -0400, Matt Welland wrote:
> > Well, maybe there is a silver lining here, I can currently reliably
> > reproduce the problem!
>
> That's excellent!  Do you have to do any special steps, or does it
> simply always happen?
>
> > One hypothesis I'm looking at is replacing calls using
> with-input-from-file
> > and with-output-to-file with open-*-file ... close loops for the reading
> > and creation of the egg-info files.
>
> You're probably on the wrong track there.  AFAICT, egg-info files are
> only *created* in the foo.install.sh / foo.install.bat file, at the very
> end where (on *nix) it uses cat(1) to write into it.
>
> If the file is already empty, changing how it's read won't make a
> difference.
>
> The only way it would fail that I can see is if one presses ^C to abort
> installation at a very unlucky time.  This sounds like a race condition
> but depending on the shell, it might be that it will process that signal
> after evaluating the line that redirects stdout to the egg-info file,
> but before actually invoking cat.  Dunno, grasping at straws here :)
>
> Since you're using mingw, it's a UNIX shell at least.  Could you try
> inserting a sync(1) call at the end of the .install.sh file to see if
> that fixes things?
>
> Cheers,
> Peter
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: [PATCH] Re: Eggs not installing on msys-mingw32

2023-10-30 Thread Matt Welland
On Mon, Oct 30, 2023, 4:04 PM Mario Domenech Goulart 
wrote:

> Hi Matt,
>
> On Mon, 30 Oct 2023 09:43:00 -0400 Matt Welland 
> wrote:
>
> > On Mon, Oct 30, 2023 at 9:37 AM  wrote:
> >
> >  > How about
> >  > "empty egg-info file, possibly due to an aborted egg-install - please
> remove the file and reinstall the corresponding egg"?
> >  >
> >  > Rationale: Matt's case.  check-errors.egg-info was empty, but the
> >  > installation of base64 was failing.  If Matt had removed
> >  > check-errors.egg-info and retried installing base64, the installation
> of
> >  > base64 would work, but check-errors would still be broken
> >  > (chicken-status and chicken-uninstall would ignore it, for example).
> >
> >  Sure, whatever - feel free to change the message, if you think that
> makes it clearer.
> >
> > My reporting on this was incorrect. Sorry for creating the churn. I
> believe there is something going genuinely wrong with check-errors. One
> hypothesis
> > I have is that Windows is seeing the file name containing "errors" and
> doing something stupid and annoying. I am not experienced with Windows and
> have
> > no clue what that thing might be but I'll keep digging.
>
> Nothing to be sorry about.  I'm afraid this issue might not related to
> Windows, exclusively.  I took a look at IRC logs and and saw that we had
> at least four cases like that, two on Windows and two on Linux.  We have
> traces of three of those issues in paste.call-cc.org and in pastebin.com:
>
> *
> http://paste.call-cc.org/paste?id=476adbc8ef7b47d8a7ce9ccd7dc201d4737de7b7
> *
> http://paste.call-cc.org/paste?id=a7c9d3bd2dbc8837b02b418a33f6d7c5ca9d9455
> * https://pastebin.com/e2BdgGGC
>
> I think we have a bug somewhere.
>
> The eggs that triggered the problem (i.e., the ones that had their
> .egg-info file empty), according to the records we have, are:
>
> * apropos
> * check-errors
> * math
> * srfi-45
>

Well, maybe there is a silver lining here, I can currently reliably
reproduce the problem!

One hypothesis I'm looking at is replacing calls using with-input-from-file
and with-output-to-file with open-*-file ... close loops for the reading
and creation of the egg-info files. The reason is that I've seen problems
on creation/reading of files on NFS that *felt* like they were improved by
replacing the calls as described. I found where the egg-info was read but
not where it was created. Can you give me an idea as to where the egg-info
is being written or copied? It is a long shot but maybe worth a try.


> I've have pushed the patch submitted by Felix, as I think it improves
> the situation for users.  With it, users get a better error message and
> have at least a chance to work around the issue.
>
> I've created https://bugs.call-cc.org/ticket/1827 for that issue.
>
> All the best.
> Mario
> --
> http://parenteses.org/mario
>


Re: [PATCH] Re: Eggs not installing on msys-mingw32

2023-10-30 Thread Matt Welland
On Mon, Oct 30, 2023 at 9:37 AM  wrote:

> > How about
> > "empty egg-info file, possibly due to an aborted egg-install - please
> remove the file and reinstall the corresponding egg"?
> >
> > Rationale: Matt's case.  check-errors.egg-info was empty, but the
> > installation of base64 was failing.  If Matt had removed
> > check-errors.egg-info and retried installing base64, the installation of
> > base64 would work, but check-errors would still be broken
> > (chicken-status and chicken-uninstall would ignore it, for example).
>
> Sure, whatever - feel free to change the message, if you think that makes
> it clearer.
>

My reporting on this was incorrect. Sorry for creating the churn. I believe
there is something going genuinely wrong with check-errors. One hypothesis
I have is that Windows is seeing the file name containing "errors" and
doing something stupid and annoying. I am not experienced with Windows and
have no clue what that thing might be but I'll keep digging.


>
> felix
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: [PATCH] Re: Eggs not installing on msys-mingw32

2023-10-30 Thread Matt Welland
Copying the check-errors.egg-info file from another build into the
lib/chicken/11 directory seems to have genuinely let me move forward. Now
I'm getting a different error on the sqlite3 egg "The filename, directory
name, or volume label syntax is incorrect." The path it is complaining
about has a mix of forward and backward slashes. Installing sql-de-lite
worked fine so the sqlite3 problem is unrelated I think.

On Mon, Oct 30, 2023 at 9:21 AM Matt Welland  wrote:

> I think I was premature in concluding that removing the empty files was
> sufficient to fix this. I can remove the empty file but the moment I hit an
> egg that depends on check-errors it seems to get stuck.
>
> I turned off the continuous virus feature and I tried using
> CHICKEN_EGG_CACHE to put the cache in /tmp and each time it seems to go
> further but fails on check-errors.egg-info. Note that check-errors appears
> to be properly installed as it imports fine. I think something is
> attempting to remove or rewrite the check-errors.egg-info file and that
> causes the problem, at least that is currently my best guess.
>
> Unfortunately I don't think that stopping and reporting the empty file
> will be sufficient but I will try the patch. Any suggestions as to what to
> try next?
>
> On Mon, Oct 30, 2023 at 9:14 AM Mario Domenech Goulart <
> ma...@parenteses.org> wrote:
>
>> On Mon, 30 Oct 2023 14:01:44 +0100 felix.winkelm...@bevuta.com wrote:
>>
>> >> That was it. Thanks. I do have to keep running:
>> >>
>> >> find /software/ -name \*.egg-info -empty -delete -print
>> >>
>> >> as check-errors.egg-info seems to be a pervasive problem. Maybe it
>> would be
>> >> worth it to add a defence against this?
>> >
>> > Sorry - wrong patch, this is the right one.
>> >
>> >
>> > felix
>> >
>> >
>> > From 8a2a82a8171744546badacaa297bcf754bff3eba Mon Sep 17 00:00:00 2001
>> > From: felix 
>> > Date: Mon, 30 Oct 2023 14:00:41 +0100
>> > Subject: [PATCH] handle case when egg-info file is empty
>> >
>> > ---
>> >  egg-information.scm | 7 +--
>> >  1 file changed, 5 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/egg-information.scm b/egg-information.scm
>> > index 6f5f7cb9..1e7f8aec 100644
>> > --- a/egg-information.scm
>> > +++ b/egg-information.scm
>> > @@ -34,8 +34,11 @@
>> >  (if (file-exists? fname*) fname* fname)))
>> >
>> >  (define (load-egg-info fname)
>> > -  (let ((fname (locate-egg-file fname)))
>> > -(with-input-from-file fname read)))
>> > +  (let* ((fname (locate-egg-file fname))
>> > + (info (with-input-from-file fname read)))
>> > +(if (eof-object? info)
>> > +(error "empty egg-info file, possibly due to an aborted
>> egg-install - please remove the file and retry" fname)
>> > +info)))
>>
>> How about
>> "empty egg-info file, possibly due to an aborted egg-install - please
>> remove the file and reinstall the corresponding egg"?
>>
>> Rationale: Matt's case.  check-errors.egg-info was empty, but the
>> installation of base64 was failing.  If Matt had removed
>> check-errors.egg-info and retried installing base64, the installation of
>> base64 would work, but check-errors would still be broken
>> (chicken-status and chicken-uninstall would ignore it, for example).
>>
>> All the best.
>> Mario
>> --
>> http://parenteses.org/mario
>>
>
>
> --
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: [PATCH] Re: Eggs not installing on msys-mingw32

2023-10-30 Thread Matt Welland
I think I was premature in concluding that removing the empty files was
sufficient to fix this. I can remove the empty file but the moment I hit an
egg that depends on check-errors it seems to get stuck.

I turned off the continuous virus feature and I tried using
CHICKEN_EGG_CACHE to put the cache in /tmp and each time it seems to go
further but fails on check-errors.egg-info. Note that check-errors appears
to be properly installed as it imports fine. I think something is
attempting to remove or rewrite the check-errors.egg-info file and that
causes the problem, at least that is currently my best guess.

Unfortunately I don't think that stopping and reporting the empty file will
be sufficient but I will try the patch. Any suggestions as to what to try
next?

On Mon, Oct 30, 2023 at 9:14 AM Mario Domenech Goulart 
wrote:

> On Mon, 30 Oct 2023 14:01:44 +0100 felix.winkelm...@bevuta.com wrote:
>
> >> That was it. Thanks. I do have to keep running:
> >>
> >> find /software/ -name \*.egg-info -empty -delete -print
> >>
> >> as check-errors.egg-info seems to be a pervasive problem. Maybe it
> would be
> >> worth it to add a defence against this?
> >
> > Sorry - wrong patch, this is the right one.
> >
> >
> > felix
> >
> >
> > From 8a2a82a8171744546badacaa297bcf754bff3eba Mon Sep 17 00:00:00 2001
> > From: felix 
> > Date: Mon, 30 Oct 2023 14:00:41 +0100
> > Subject: [PATCH] handle case when egg-info file is empty
> >
> > ---
> >  egg-information.scm | 7 +--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/egg-information.scm b/egg-information.scm
> > index 6f5f7cb9..1e7f8aec 100644
> > --- a/egg-information.scm
> > +++ b/egg-information.scm
> > @@ -34,8 +34,11 @@
> >  (if (file-exists? fname*) fname* fname)))
> >
> >  (define (load-egg-info fname)
> > -  (let ((fname (locate-egg-file fname)))
> > -(with-input-from-file fname read)))
> > +  (let* ((fname (locate-egg-file fname))
> > + (info (with-input-from-file fname read)))
> > +(if (eof-object? info)
> > +(error "empty egg-info file, possibly due to an aborted
> egg-install - please remove the file and retry" fname)
> > +info)))
>
> How about
> "empty egg-info file, possibly due to an aborted egg-install - please
> remove the file and reinstall the corresponding egg"?
>
> Rationale: Matt's case.  check-errors.egg-info was empty, but the
> installation of base64 was failing.  If Matt had removed
> check-errors.egg-info and retried installing base64, the installation of
> base64 would work, but check-errors would still be broken
> (chicken-status and chicken-uninstall would ignore it, for example).
>
> All the best.
> Mario
> --
> http://parenteses.org/mario
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Eggs not installing on msys-mingw32

2023-10-30 Thread Matt Welland
That was it. Thanks. I do have to keep running:

find /software/ -name \*.egg-info -empty -delete -print

as check-errors.egg-info seems to be a pervasive problem. Maybe it would be
worth it to add a defence against this?




On Mon, Oct 30, 2023 at 12:18 AM Mario Domenech Goulart <
ma...@parenteses.org> wrote:

> On Mon, 30 Oct 2023 06:53:05 +0100 Mario Domenech Goulart <
> ma...@parenteses.org> wrote:
>
> > On Sun, 29 Oct 2023 20:22:53 -0700 Matt Welland 
> wrote:
> >
> >> I'm guessing I've done something wrong in my setup but some eggs did
> install and some do not and I'm not sure what
> >> I'm missing.
> >>
> >>  MINGW32 ~
> >> $ chicken-install base64
> >> fetching base64
> >> C:\msys64\tmp\tempa4ea.8676\base64.egg
> >> C:\msys64\tmp\tempa4ea.8676\base64.scm
> >> C:\msys64\tmp\tempa4ea.8676\tests\run.scm
> >> 3 File(s) copied
> >> building base64
> >>c:/msys64/software/bin/csc -host -D compiling-extension -J -s
> -regenerate-import-libraries -setup
> >> -mode -I C:\Users\Owner\AppData\Local\chicken-install\base64 -C
> -IC:\Users\Owner\AppData\Local\chick
> >> en-install\base64 -O2 -d1 base64.scm -o
> C:\Users\Owner\AppData\Local\chicken-install\base64\base64.s
> >> o
> >>c:/msys64/software/bin/csc -regenerate-import-libraries -M
> -setup-mode -static -I C:\Users\Owner\
> >> AppData\Local\chicken-install\base64 -emit-link-file
> C:\Users\Owner\AppData\Local\chicken-install\ba
> >> se64\base64.link -host -D compiling-extension -c -unit base64 -D
> compiling-static-extension -C -IC:\
> >> Users\Owner\AppData\Local\chicken-install\base64 -O2 -d1 base64.scm -o
> C:\Users\Owner\AppData\Local\
> >> chicken-install\base64\base64.static.obj
> >>c:/msys64/software/bin/csc -setup-mode -s -host -I
> C:\Users\Owner\AppData\Local\chicken-install\b
> >> ase64 -C -IC:\Users\Owner\AppData\Local\chicken-install\base64 -O2 -d0
> base64.import.scm -o C:\Users
> >> \Owner\AppData\Local\chicken-install\base64\base64.import.so
> >>
> >> Error: (assq) bad argument type: #!eof
> >
> > I seem to remember seing such errors when .egg-info files get corrupted.
> > I'd start by checking for abnormally small (or even empty) .egg-info
> > files in the directories printed by
> >
> >   $ csi -p '(begin (import (chicken platform)) (repository-path))'
> >
> > If you find a corrupted file, say for egg foo, just copy any other good
> > .egg-info file over foo.egg-info and reinstall foo with `chicken-install
> foo'.
>
> Actually simply removing the corrupted .egg-info file and installing its
> corresponding egg again should do the trick.
>
> > Once the corrupted files have been fixed, you should be able to install
> > eggs again.
> >
> All the best.
> Mario
> --
> http://parenteses.org/mario
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Eggs not installing on msys-mingw32

2023-10-29 Thread Matt Welland
I'm guessing I've done something wrong in my setup but some eggs did
install and some do not and I'm not sure what I'm missing.

 MINGW32 ~
$ chicken-install base64
fetching base64
C:\msys64\tmp\tempa4ea.8676\base64.egg
C:\msys64\tmp\tempa4ea.8676\base64.scm
C:\msys64\tmp\tempa4ea.8676\tests\run.scm
3 File(s) copied
building base64
   c:/msys64/software/bin/csc -host -D compiling-extension -J -s
-regenerate-import-libraries -setup
-mode -I C:\Users\Owner\AppData\Local\chicken-install\base64 -C
-IC:\Users\Owner\AppData\Local\chick
en-install\base64 -O2 -d1 base64.scm -o
C:\Users\Owner\AppData\Local\chicken-install\base64\base64.s
o
   c:/msys64/software/bin/csc -regenerate-import-libraries -M -setup-mode
-static -I C:\Users\Owner\
AppData\Local\chicken-install\base64 -emit-link-file
C:\Users\Owner\AppData\Local\chicken-install\ba
se64\base64.link -host -D compiling-extension -c -unit base64 -D
compiling-static-extension -C -IC:\
Users\Owner\AppData\Local\chicken-install\base64 -O2 -d1 base64.scm -o
C:\Users\Owner\AppData\Local\
chicken-install\base64\base64.static.obj
   c:/msys64/software/bin/csc -setup-mode -s -host -I
C:\Users\Owner\AppData\Local\chicken-install\b
ase64 -C -IC:\Users\Owner\AppData\Local\chicken-install\base64 -O2 -d0
base64.import.scm -o C:\Users
\Owner\AppData\Local\chicken-install\base64\base64.import.so

Error: (assq) bad argument type: #!eof


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Hypergiant ckui - first few widgets and a calculator ui example.

2023-05-08 Thread Matt Welland
Buttons, labels, vbox and hbox work. click on a button and it changes shade
briefly and the associated proc is called. So far it wasn't too hard and I
think it is promising but text boxes, tree widgets, etc, scroll bars and
more are needed. Some questions below.

[image: image.png]

Request for comments:

   1. Please suggest a name for this UI, I'm calling it ckui for now.
   2. If this project reached a decent level of implementation would you be
   likely to use it?
   3. I've modeled the interface after IUP and so far it is very similar.
   Is this a pro or con?
   4. Buttons and other moving widgets could be implemented with either iqm
   models or sprite sheets. Which of those options would be more interesting
   for you?

This is the guts of the calculator UI:

 (gl:clear-color 0.8 0.8 0.8 1)
(show
 (apply vbox
  (label 'title "0123456789" 'w 120)
  (map (lambda (lst)
(apply hbox
   (map
(lambda (c)
  (button
'title c
'w 30
'h 32
'action (lambda (obj)
 (print "You pushed "c
lst)))
  '(("1" "2" "3" "+")
("4" "5" "6" "-")
("7" "8" "9" "*")))
  ))
--
(module ckui
	*

(import scheme
	chicken.base
	srfi-1
	srfi-4
	srfi-18
	srfi-69
	
	hypergiant
	typed-records
	)

(define valid-params
  '((label 'title)))

(define font (cond-expand
   (macosx "/Library/Fonts/Microsoft/Arial.ttf")
   (windows (begin 
  (use posix)
  (string-append (get-environment-variable "SYSTEMROOT")
 "/Fonts/Arial.ttf")))
   (else "/usr/share/fonts/truetype/msttcorefonts/arial.ttf")))

;; register widgets that can respond to mouse clicks or keyboard here
(define *active-widgets* (make-hash-table)) ;; obj => somename?

;; '(key1 val1 key2 val2 ...) => ((key1 . val1)(key2 . val2) ...)
(define (params->alist params)
  (if (odd? (length params))
  (begin
	(print "FATAL: params->alist called with odd number of params, must be key-val pairs: "params)
	(assert #f "FATAL: params->alist called with odd number of params"))
  (let loop ((rem params)
		 (res '()))
	(if (null? rem)
	res
	(let ((var (car rem))
		  (val (cadr rem)))
	  (loop (cddr rem) (cons (cons var val) res)))

(define (get-param params key #!optional (default #f))
  (or (alist-ref key params) default))

(define (set-param! widget key val)
  (gobj-params-set! widget
		(cons (cons key val)
			  (filter (lambda (x)
(not (eq? (car x) key)))
  (gobj-params widget)

(define (gobj-get-param gobj key)
  (get-param (gobj-params gobj) key))
	  
(define (label . keyvars)
  (make-gobj objtype: 'label params: (params->alist keyvars)))

(define (button . keyvars)
  (let* ((params (params->alist keyvars))
	 (name   (get-param params 'name))
	 (gobj   (make-gobj objtype: 'button params: params)))
(hash-table-set! *active-widgets* gobj name)
gobj))


(define (vbox . objs) ;; no params? have to use param-set! should be a 
  (make-gobj objtype: 'vbox objs: objs))

(define (hbox . objs) ;; no params? have to use param-set! should be a 
  (make-gobj objtype: 'hbox objs: objs))

;; generic graphic object
;;
(defstruct gobj
  (objtype 'na)
  (params  '())
  (objs'())
  (currx0  0)
  (curry0  0)
  (currx1  0)
  (curry1  0))

;; color='(r g b) 0-1
(define (rectangle-filled w h color)
  (rectangle-mesh
   w h
   color: (lambda (i) color) ;; '(r g b) 0-1
   centered?: #f))

(define (show-vbox widget params)
  ;; draw widgets from top to bottom
  (let loop ((rem (gobj-objs widget))
	 (x   (gobj-currx0 widget))  ;; start at upper left of the vbox location
	 (y   (gobj-curry0 widget))
	 (maxx 0))
(if (not (null? rem))
	(let* ((obj (car rem)))
	  (gobj-currx0-set! obj x) ;; set the origin for this obj
	  (gobj-curry0-set! obj y) ;;
	  (show obj)
	  (let* ((newmaxx (max maxx (gobj-currx1 obj)));; the new x1 maximum
		 (newmaxy (gobj-curry1 obj)))  ;; on instantiation the curry1 was set
	(gobj-currx1-set! widget newmaxx)  ;; set it every time
	(gobj-curry1-set! widget newmaxy)
	(loop (cdr rem) x newmaxy newmaxx
widget))

(define (show-hbox widget params)
  ;; draw widgets from top to bottom
  (let loop ((rem (gobj-objs widget))
	 (x   (gobj-currx0 widget))  ;; start at upper left of the vbox location
	 (y   (gobj-curry0 widget))
	 (maxy 0))
(if (not (null? rem))
	(let* ((obj (car rem)))
	  (gobj-currx0-set! obj x)
	  (gobj-curry0-set! obj y)
	  (show obj)
	  (let* ((newmaxx (gobj-currx1 obj))
		 (newmaxy (min maxy (gobj-curry1 obj
	(gobj-currx1-set! widget newmaxx)
	(gobj-curry1-set! widget newmaxy)
	(loop (cdr rem) newmaxx y newmaxy
widget))

(define (show-label widget params)
  (let* ((title  (get-param params 'title "n/a"))
	 (face   (load-face font 20))
	 (title-mesh (string-mesh title face))
	 (title-w(string-width title face))
	 (title-h(face-height face))
	 

Request change to hypergiant

2023-05-08 Thread Matt Welland
I want to get mouse clicks from the ui scene but I cannot access the ui
camera. In hypergiant/window.scm the ui camera is found in *ui-camera* but
this is not exported. When I added it to the exports I was able to see the
mouse clicks with this:

(get-cursor-world-position *ui-camera*)

Is there a better way to do this? If not, can hypergiant be updated with
this change?

Thanks.
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


hypergiant line-mesh - what are POINTS?

2023-05-02 Thread Matt Welland
It looks like I should be able to do line drawings with line-mesh. The spec
in the docs is:

[procedure] (line-mesh POINTS [mode: MODE])

Create a non-indexed mesh of POINTS. MODE should be a valid argument to
mode->gl, defaulting to #:line-strip.

But I can't figure out what POINTS are supposed to be. I've tried list
and vector of (make-point x y z) but I get:

Error: (make-mesh) Expected attribute attributes in the form (NAME
TYPE NUMBER [NORMALIZED]): position

Call history:

hyperscene.scm:232: set-camera-clip-planes! 
hyperscene.scm:233: set-camera-view-angle!  
hyperscene.scm:234: set-camera-viewport-ratio!  
example.scm:13: epoxy#clear-color   
example.scm:15: ckui#make-label 
ckui.scm:47: ##sys#get-keyword  
ckui.scm:47: ##sys#get-keyword  
ckui.scm:47: ##sys#get-keyword  
ckui.scm:47: old-make   
example.scm:14: ckui#show   
ckui.scm:80: label? 
ckui.scm:81: chicken.base#print 
ckui.scm:86: gl-math#make-point 
ckui.scm:87: gl-math#make-point 
ckui.scm:88: gl-math#make-point 
ckui.scm:87: hypergiant-geometry#line-mesh  <--


The snippet where I'm trying to create a node with mesh lines:

(add-node ui normal-pipeline-render-pipeline
 color: black
 position: (make-point 0 0 0)
 mesh: (line-mesh (vector (make-point 0 0 0)
  (make-point 100 0 0)))
 )

Thanks.
--


Re: Static compile using csm question; how to add linked extension?

2023-04-25 Thread Matt Welland
Yes, that worked and hyperscene.a was created, very cool!

I then discovered that neither libepoxy nor mesa have static libs installed
on Ubuntu. After getting the source, installing over 20 additional
libraries and figuring out how to turn on static compile it failed after an
hour of compiling (crappy machine). So not quite successful yet but close
enough to be worth trying again. Maybe setting up a guix box for this kind
of work would be more sensible?

Anyhow, thanks for taking the time to fix hyperscene.

Matt
-=-

On Tue, Apr 25, 2023 at 5:50 PM  wrote:

> > I'm trying to compile the simple.scm example from hypergiant statically
> > using csm. Is this possible?
> >
>
> Hi, again!
>
> Can you try the attached alternative .egg file for
> hyperscene? Just invoke
>
> chicken-install -r hyperscene
>
> and replace the .egg file with the one in this mail.
> This should give you a static hyperscene build that
> csm (hopefully) finds.
>
>
> felix
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Static compile using csm question; how to add linked extension?

2023-04-25 Thread Matt Welland
I'm trying to compile the simple.scm example from hypergiant statically
using csm. Is this possible?

all.options:
-program simple -C -I/usr/include

simple.options:
-L -L/usr/lib/x86_64-linux-gnu -L -lepoxy -L -lGL -static -L -static -L -lm
-L -ldl -link hyperscene

I've tried -R hyperscene and -link hyperscene but neither works.

What am I missing?

  '/home/mrwellan/data/buildall/ck5.3_23WW01/bin/csc' '-o' 'simple' '-I'
'/home/mrwellan/data/opensrc/hypergiant-examples' '-C' '-I' '-C'
'/home/mrwellan/data/opensrc/hypergiant-examples' '-static'
'/home/mrwellan/data/opensrc/hypergiant-examples/simple.scm' '-C'
'-I/usr/include' '-L' '-L/usr/lib/x86_64-linux-gnu' '-L' '-lepoxy' '-L'
'-lGL' '-L' '-static' '-L' '-lm' '-L' '-ldl' '-link' 'hyperscene'
csc: could not find linked extension: hyperscene
command failed with non-zero exit status:
'/home/mrwellan/data/buildall/ck5.3_23WW01/bin/csc' '-o' 'simple' '-I'
'/home/mrwellan/data/opensrc/hypergiant-examples' '-C' '-I' '-C'
'/home/mrwellan/data/opensrc/hypergiant-examples' '-static'
'/home/mrwellan/data/opensrc/hypergiant-examples/simple.scm' '-C'
'-I/usr/include' '-L' '-L/usr/lib/x86_64-linux-gnu' '-L' '-lepoxy' '-L'
'-lGL' '-L' '-static' '-L' '-lm' '-L' '-ldl' '-link' 'hyperscene'


Re: what are the needed switches to build hypergiant examples?

2023-04-24 Thread Matt Welland
Nevermind, I was missing the (now obvious) -L -lepoxy.

On Mon, Apr 24, 2023 at 10:18 PM Matt Welland 
wrote:

> I tried:
>
> matt@mars:~/.cache/chicken-install/hypergiant/examples$ ck53 csc -L -lGL
> models.scm
> models.c: In function ‘fastRenderBonePipeline’:
> models.c:80:25: warning: cast from pointer to integer of different size
> [-Wpointer-to-int-cast]
>80 | glBindTexture(3553, (unsigned int)data->uniformValues[2]);
>   | ^
> models.c: In function ‘fastRenderArraysBonePipeline’:
> models.c:100:30: warning: cast from pointer to integer of different size
> [-Wpointer-to-int-cast]
>   100 | glDrawArrays(data->mode, (GLint)data->offset, data->nElements);
>   |  ^
> /usr/bin/ld: models.o: warning: relocation against
> `epoxy_glBindVertexArray' in read-only section `.text'
> /usr/bin/ld: models.o: in function `fastRenderBonePipelineBegin':
> models.c:(.text+0x35): undefined reference to `epoxy_glUseProgram'
> /usr/bin/ld: models.o: in function `fastRenderBonePipeline':
> models.c:(.text+0x48): undefined reference to `epoxy_glActiveTexture'
> /usr/bin/ld: models.c:(.text+0x56): undefined reference to
> `epoxy_glBindTexture'
> /usr/bin/ld: models.c:(.text+0x61): undefined reference to
> `epoxy_glUniform1i'
> /usr/bin/ld: models.c:(.text+0x75): undefined reference to
> `epoxy_glUniformMatrix4fv'
> /usr/bin/ld: models.c:(.text+0x89): undefined reference to
> `epoxy_glUniformMatrix4fv'
> /usr/bin/ld: models.c:(.text+0x92): undefined reference to
> `epoxy_glBindVertexArray'
> /usr/bin/ld: models.c:(.text+0xa6): undefined reference to
> `epoxy_glDrawElements'
> /usr/bin/ld: models.o: in function `fastRenderArraysBonePipeline':
> models.c:(.text+0xc2): undefined reference to `epoxy_glUniformMatrix4fv'
> /usr/bin/ld: models.c:(.text+0xd6): undefined reference to
> `epoxy_glUniformMatrix4fv'
> /usr/bin/ld: models.c:(.text+0xdf): undefined reference to
> `epoxy_glBindVertexArray'
> /usr/bin/ld: models.c:(.text+0xef): undefined reference to
> `epoxy_glDrawArrays'
> /usr/bin/ld: models.o: in function `fastRenderBonePipelineEnd':
> models.c:(.text+0x101): undefined reference to `epoxy_glBindTexture'
> /usr/bin/ld: models.c:(.text+0x10a): undefined reference to
> `epoxy_glBindVertexArray'
> /usr/bin/ld: warning: creating DT_TEXTREL in a PIE
> collect2: error: ld returned 1 exit status
>
> Error: shell command terminated with non-zero exit status 256: 'gcc'
> 'models.o' -o 'models' -lGL -L/home/matt/data/buildall/ck5.3_23WW01/lib
> -Wl,-rpath=/home/matt/data/buildall/ck5.3_23WW01/lib -lchicken -lm -ldl
>
>
> --
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


what are the needed switches to build hypergiant examples?

2023-04-24 Thread Matt Welland
I tried:

matt@mars:~/.cache/chicken-install/hypergiant/examples$ ck53 csc -L -lGL
models.scm
models.c: In function ‘fastRenderBonePipeline’:
models.c:80:25: warning: cast from pointer to integer of different size
[-Wpointer-to-int-cast]
   80 | glBindTexture(3553, (unsigned int)data->uniformValues[2]);
  | ^
models.c: In function ‘fastRenderArraysBonePipeline’:
models.c:100:30: warning: cast from pointer to integer of different size
[-Wpointer-to-int-cast]
  100 | glDrawArrays(data->mode, (GLint)data->offset, data->nElements);
  |  ^
/usr/bin/ld: models.o: warning: relocation against
`epoxy_glBindVertexArray' in read-only section `.text'
/usr/bin/ld: models.o: in function `fastRenderBonePipelineBegin':
models.c:(.text+0x35): undefined reference to `epoxy_glUseProgram'
/usr/bin/ld: models.o: in function `fastRenderBonePipeline':
models.c:(.text+0x48): undefined reference to `epoxy_glActiveTexture'
/usr/bin/ld: models.c:(.text+0x56): undefined reference to
`epoxy_glBindTexture'
/usr/bin/ld: models.c:(.text+0x61): undefined reference to
`epoxy_glUniform1i'
/usr/bin/ld: models.c:(.text+0x75): undefined reference to
`epoxy_glUniformMatrix4fv'
/usr/bin/ld: models.c:(.text+0x89): undefined reference to
`epoxy_glUniformMatrix4fv'
/usr/bin/ld: models.c:(.text+0x92): undefined reference to
`epoxy_glBindVertexArray'
/usr/bin/ld: models.c:(.text+0xa6): undefined reference to
`epoxy_glDrawElements'
/usr/bin/ld: models.o: in function `fastRenderArraysBonePipeline':
models.c:(.text+0xc2): undefined reference to `epoxy_glUniformMatrix4fv'
/usr/bin/ld: models.c:(.text+0xd6): undefined reference to
`epoxy_glUniformMatrix4fv'
/usr/bin/ld: models.c:(.text+0xdf): undefined reference to
`epoxy_glBindVertexArray'
/usr/bin/ld: models.c:(.text+0xef): undefined reference to
`epoxy_glDrawArrays'
/usr/bin/ld: models.o: in function `fastRenderBonePipelineEnd':
models.c:(.text+0x101): undefined reference to `epoxy_glBindTexture'
/usr/bin/ld: models.c:(.text+0x10a): undefined reference to
`epoxy_glBindVertexArray'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

Error: shell command terminated with non-zero exit status 256: 'gcc'
'models.o' -o 'models' -lGL -L/home/matt/data/buildall/ck5.3_23WW01/lib
-Wl,-rpath=/home/matt/data/buildall/ck5.3_23WW01/lib -lchicken -lm -ldl


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Need GUI (again), gauging interest in an alternative approach.

2023-03-23 Thread Matt Welland
Thanks for the suggestion elf. More than ever I recognize how important it
is to make these decisions carefully and I appreciate input from the list.

I'll sketch out an analysis of my decision and then gauge wx in that light.
Maybe this will be of use to others, if not, my apologies for the email
clutter.

Project A, need gui with decent text widget. 90% done, (all Chicken) and
existing gui in IUP is decent.
Project B, builds on A, needs gui, text editing and 2D graphics, probably
vector and bitmap.
Project C, builds on A, needs 3D graphics and (hopefully) VR support (I
have a Valve Index, VR aspect would be fun to build and use I hope).
Project D unifies A, B and C but is an ordinary gui, it just needs good
widgets, especially text.

Linux, Windows, MacOS and Android support is important, IOS would be icing
on the cake.

In each of these projects the data to and from the gui from the logic side
is not large. The tcp to Godot approach or even json files in/out of Godot
will work ok.

   - wx would need an egg. I'm guessing the learning curve would be
   substantial.
   - wx + hypergiant seems clumsy, is there a way to embed a hypergiant
   view into a wx gui?
   - None of the options seem easy to deploy on all three primary
   platforms; Linux, Windows and Android, much less even possible to deploy to
   IOS.

So would wx save time, improve look and feel or have some other advantage?
Is there some other option I should consider?

On Thu, Mar 23, 2023 at 8:06 AM elf  wrote:

> Perhaps something more like wx would be better? Excellent cross-platform
> support, including all necessary support structures, and iirc it can give
> you lower-level graphics access too? Plus, of course, there are already
> bindings for a large num of languages, and a guide to writing new bindings,
> so...
>
> -elf
>
>
> On 23 March 2023 13:43:10 GMT+02:00, Matt Welland 
> wrote:
>
>> Tk is great, no doubt about it. I still miss Eric Gallesio's STk. The
>> reasons I decided against tk include:
>>
>>1. Clunky 1980's look and feel. (i)
>>2. No IOS or Android support. (ii)
>>3. I seemed to fight the widget layout model a lot when I used it.
>>(iii)
>>4. Two of the projects I'm starting are more game than normal app,
>>including plans to have a VR view.
>>
>> (i) has been addressed with the latest tk, including themes apparently.
>> (ii) it does appear possible to use tk on android but there is no touch
>> support as best I can tell.
>> (iii) Godot seems somewhat similar to IUP with hboxes, vboxes etc.
>> hopefully easier for me to learn.
>>
>> #2 is a big concern but #4 is the deciding factor. I really need
>> something that works and where I can reuse what I learn in many projects.
>> I'd strongly prefer to use 100% Chicken but I also need to get things done
>> and if I have to learn and use gd script for some of my projects I'll deal
>> with it. I am also starting to see the value of a well done gui designer.
>>
>> What I want is a button in Godot that switches out gd script for Chicken
>> Scheme. That would be an awesome tool! I'll settle for doing the
>> communications, logic and other heavy lifting in a Chicken program and bolt
>> on Godot for the user interface (via tcp for now).
>>
>> Just my $0.02
>>
>> On Wed, Mar 22, 2023 at 11:37 PM elf  wrote:
>>
>>> Erm, what's wrong with the tk bindings, which should work everywhere
>>> already?
>>>
>>> -elf
>>>
>>> On 23 March 2023 02:36:43 GMT+02:00, Matt Welland <
>>> mattrwell...@gmail.com> wrote:
>>> >That would be great Thomas. For my part, I'll start working on my
>>> project
>>> >using what I can, learning Godot along the way. When you get to working
>>> on
>>> >this please let me know how I can help.
>>> >
>>> >Regarding the approach, I like the tooling to generate a loadable module
>>> >idea. I figure leverage as much of Godot as a tool as possible.
>>> >
>>> >Thanks.
>>> >
>>> >On Wed, Mar 22, 2023 at 12:27 PM Thomas Chust 
>>> >wrote:
>>> >
>>> >> Hello,
>>> >>
>>> >> a combination of CHICKEN and Godot sounds very interesting! I've been
>>> >> meaning to experiment more with that engine for a while, and with
>>> Godot 4.0
>>> >> just out the door the time is probably perfect to try out the new
>>> extension
>>> >> APIs.
>>> >>
>>> >> I'm not completely sure how the CHICKEN/Godot hybrid should look like
>>> and
>>> >> suspect that embedding Godot i

Re: Need GUI (again), gauging interest in an alternative approach.

2023-03-23 Thread Matt Welland
Tk is great, no doubt about it. I still miss Eric Gallesio's STk. The
reasons I decided against tk include:

   1. Clunky 1980's look and feel. (i)
   2. No IOS or Android support. (ii)
   3. I seemed to fight the widget layout model a lot when I used it. (iii)
   4. Two of the projects I'm starting are more game than normal app,
   including plans to have a VR view.

(i) has been addressed with the latest tk, including themes apparently.
(ii) it does appear possible to use tk on android but there is no touch
support as best I can tell.
(iii) Godot seems somewhat similar to IUP with hboxes, vboxes etc.
hopefully easier for me to learn.

#2 is a big concern but #4 is the deciding factor. I really need something
that works and where I can reuse what I learn in many projects. I'd
strongly prefer to use 100% Chicken but I also need to get things done and
if I have to learn and use gd script for some of my projects I'll deal with
it. I am also starting to see the value of a well done gui designer.

What I want is a button in Godot that switches out gd script for Chicken
Scheme. That would be an awesome tool! I'll settle for doing the
communications, logic and other heavy lifting in a Chicken program and bolt
on Godot for the user interface (via tcp for now).

Just my $0.02

On Wed, Mar 22, 2023 at 11:37 PM elf  wrote:

> Erm, what's wrong with the tk bindings, which should work everywhere
> already?
>
> -elf
>
> On 23 March 2023 02:36:43 GMT+02:00, Matt Welland 
> wrote:
> >That would be great Thomas. For my part, I'll start working on my project
> >using what I can, learning Godot along the way. When you get to working on
> >this please let me know how I can help.
> >
> >Regarding the approach, I like the tooling to generate a loadable module
> >idea. I figure leverage as much of Godot as a tool as possible.
> >
> >Thanks.
> >
> >On Wed, Mar 22, 2023 at 12:27 PM Thomas Chust 
> >wrote:
> >
> >> Hello,
> >>
> >> a combination of CHICKEN and Godot sounds very interesting! I've been
> >> meaning to experiment more with that engine for a while, and with Godot
> 4.0
> >> just out the door the time is probably perfect to try out the new
> extension
> >> APIs.
> >>
> >> I'm not completely sure how the CHICKEN/Godot hybrid should look like
> and
> >> suspect that embedding Godot in a CHICKEN egg would at least be
> cumbersome.
> >> Maybe some kind of tooling to streamline the task of rolling CHICKEN
> code
> >> into a single loadable module for Godot to use would be most promising
> 樂
> >>
> >> I think I've just found a project for the upcoming CHICKEN summer
> workshop
> >> 
> >>
> >> Ciao,
> >> Thomas C.
> >>
> >>
> >> Am Mi., 22. März 2023 um 15:28 Uhr schrieb Matt Welland <
> >> mattrwell...@gmail.com>:
> >>
> >>> I've been using IUP with Chicken for years. I really enjoy using it
> >>> (thanks Thomas!). But, here we are, over 10 years later and IUP is
> still
> >>> not available as an official Debian package and it is a burden to
> deploy.
> >>> It is also still not supported on Mac.
> >>>
> >>> So, I'm scouting around (again) for alternatives and I'm starting to
> lean
> >>> towards using Godot for my next project. Godot + Chicken scheme that
> is.
> >>> I'm hoping that I can deploy  to mac, Linux and Windows and maybe even
> >>> android without too much pain.
> >>>
> >>> Here is an article that makes the case for using Godot for graphical
> user
> >>> interfaces:
> >>>
> >>>
> >>>
> https://medium.com/swlh/what-makes-godot-engine-great-for-advance-gui-applications-b1cfb941df3b
> >>>
> >>> I can achieve what I need with any one of three approaches:
> >>>
> >>> 1. Godot <==> chicken executable, where the connection could be tcp,
> http
> >>> or similar.
> >>>
> >>> 2. Godot <==> chicken .so file
> >>>
> >>> 3. Chicken <==> godot egg
> >>>
> >>> I don't have time or expertise to do an egg without help. Before I
> start
> >>> working using option 1 or 2 I wanted to ask the chicken community if
> there
> >>> was interest in collaborating on creating a godot egg.
> >>>
> >>> Thanks!
> >>>
> >>> NOTE: If hypergiant had a widget library with a decent text widget
> (line
> >>> wrapping, copy/paste to the OS etc.) I'd have considered it. Raylib was
> >>> also interesting and it's text support might have been adequate but
> the egg
> >>> was never published and seems abandoned.
> >>>
> >>>
> >>> --
> >>> Complexity is your enemy. Any fool can make something complicated.
> >>> It is hard to keep things simple. - Richard Branson.
> >>>
> >>
> >
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Need GUI (again), gauging interest in an alternative approach.

2023-03-22 Thread Matt Welland
That would be great Thomas. For my part, I'll start working on my project
using what I can, learning Godot along the way. When you get to working on
this please let me know how I can help.

Regarding the approach, I like the tooling to generate a loadable module
idea. I figure leverage as much of Godot as a tool as possible.

Thanks.

On Wed, Mar 22, 2023 at 12:27 PM Thomas Chust 
wrote:

> Hello,
>
> a combination of CHICKEN and Godot sounds very interesting! I've been
> meaning to experiment more with that engine for a while, and with Godot 4.0
> just out the door the time is probably perfect to try out the new extension
> APIs.
>
> I'm not completely sure how the CHICKEN/Godot hybrid should look like and
> suspect that embedding Godot in a CHICKEN egg would at least be cumbersome.
> Maybe some kind of tooling to streamline the task of rolling CHICKEN code
> into a single loadable module for Godot to use would be most promising 樂
>
> I think I've just found a project for the upcoming CHICKEN summer workshop
> 
>
> Ciao,
> Thomas C.
>
>
> Am Mi., 22. März 2023 um 15:28 Uhr schrieb Matt Welland <
> mattrwell...@gmail.com>:
>
>> I've been using IUP with Chicken for years. I really enjoy using it
>> (thanks Thomas!). But, here we are, over 10 years later and IUP is still
>> not available as an official Debian package and it is a burden to deploy.
>> It is also still not supported on Mac.
>>
>> So, I'm scouting around (again) for alternatives and I'm starting to lean
>> towards using Godot for my next project. Godot + Chicken scheme that is.
>> I'm hoping that I can deploy  to mac, Linux and Windows and maybe even
>> android without too much pain.
>>
>> Here is an article that makes the case for using Godot for graphical user
>> interfaces:
>>
>>
>> https://medium.com/swlh/what-makes-godot-engine-great-for-advance-gui-applications-b1cfb941df3b
>>
>> I can achieve what I need with any one of three approaches:
>>
>> 1. Godot <==> chicken executable, where the connection could be tcp, http
>> or similar.
>>
>> 2. Godot <==> chicken .so file
>>
>> 3. Chicken <==> godot egg
>>
>> I don't have time or expertise to do an egg without help. Before I start
>> working using option 1 or 2 I wanted to ask the chicken community if there
>> was interest in collaborating on creating a godot egg.
>>
>> Thanks!
>>
>> NOTE: If hypergiant had a widget library with a decent text widget (line
>> wrapping, copy/paste to the OS etc.) I'd have considered it. Raylib was
>> also interesting and it's text support might have been adequate but the egg
>> was never published and seems abandoned.
>>
>>
>> --
>> Complexity is your enemy. Any fool can make something complicated.
>> It is hard to keep things simple. - Richard Branson.
>>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Need GUI (again), gauging interest in an alternative approach.

2023-03-22 Thread Matt Welland
I've been using IUP with Chicken for years. I really enjoy using it (thanks
Thomas!). But, here we are, over 10 years later and IUP is still not
available as an official Debian package and it is a burden to deploy. It is
also still not supported on Mac.

So, I'm scouting around (again) for alternatives and I'm starting to lean
towards using Godot for my next project. Godot + Chicken scheme that is.
I'm hoping that I can deploy  to mac, Linux and Windows and maybe even
android without too much pain.

Here is an article that makes the case for using Godot for graphical user
interfaces:

https://medium.com/swlh/what-makes-godot-engine-great-for-advance-gui-applications-b1cfb941df3b

I can achieve what I need with any one of three approaches:

1. Godot <==> chicken executable, where the connection could be tcp, http
or similar.

2. Godot <==> chicken .so file

3. Chicken <==> godot egg

I don't have time or expertise to do an egg without help. Before I start
working using option 1 or 2 I wanted to ask the chicken community if there
was interest in collaborating on creating a godot egg.

Thanks!

NOTE: If hypergiant had a widget library with a decent text widget (line
wrapping, copy/paste to the OS etc.) I'd have considered it. Raylib was
also interesting and it's text support might have been adequate but the egg
was never published and seems abandoned.


--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


New egg: fcp - basic Freenet interface

2022-12-21 Thread Matt Welland
I've released a new egg, fcp. It can be used to insert and retrieve files
from the Freenet network. It also comes with a command-line interface.

http://wiki.call-cc.org/eggref/5/fcp

Thanks to Mario for adding the egg.

Matt
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: generalized-arrays egg, array-read fails on array written with array-write

2022-12-17 Thread Matt Welland
Hi Jeremy,

Thanks for the response. This was with Chicken 5. I found
generalized-arrays easy to understand and I like the api. Most of the other
array eggs either had some limitation or were tough to understand how to
use. However I think I'll be able to make srfi-63 work for now. If you ever
get a chance to fix generalized-arrays I'd likely switch back.

Thanks again,
Matt
-=-

On Thu, Dec 15, 2022 at 12:28 PM Matt Welland 
wrote:

> This seems like a bug (unless I'm missing something?):
>
> (module justtesting *
> (import scheme chicken.base generalized-arrays storage-classes)
>
> (define (testit)
>   (let* ((size (vector 100 100))
>  (ary  (make-array vector-storage-class size 0)))
> (with-output-to-file "testarray.dat"
>   (lambda ()
>  (array-write ary)))
> (print "wrote array to testarray.dat")
> (let* ((readdata (with-input-from-file "testarray.dat"
> array-read)))
>   (print "read data into readdata: "readdata
> (testit))
>
> OUTPUT:
>
> wrote array to testarray.dat
>
> Error: Expected a char representing a digit.: #\#
>
> Call history:
>
> array-write-read.scm:1: ##sys#with-environment
> array-write-read.scm:1: ##sys#register-compiled-module
> array-write-read.scm:4: chicken.load#load-extension
> array-write-read.scm:4: chicken.load#load-extension
> array-write-read.scm:34: testit
> array-write-read.scm:23: generalized-arrays#make-array
> array-write-read.scm:24: scheme#with-output-to-file
> array-write-read.scm:27: generalized-arrays#array-write
> array-write-read.scm:28: chicken.base#print
> array-write-read.scm:29: scheme#with-input-from-file   <--
>
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


generalized-arrays egg, array-read fails on array written with array-write

2022-12-15 Thread Matt Welland
This seems like a bug (unless I'm missing something?):

(module justtesting *
(import scheme chicken.base generalized-arrays storage-classes)

(define (testit)
  (let* ((size (vector 100 100))
 (ary  (make-array vector-storage-class size 0)))
(with-output-to-file "testarray.dat"
  (lambda ()
 (array-write ary)))
(print "wrote array to testarray.dat")
(let* ((readdata (with-input-from-file "testarray.dat"
array-read)))
  (print "read data into readdata: "readdata
(testit))

OUTPUT:

wrote array to testarray.dat

Error: Expected a char representing a digit.: #\#

Call history:

array-write-read.scm:1: ##sys#with-environment
array-write-read.scm:1: ##sys#register-compiled-module
array-write-read.scm:4: chicken.load#load-extension
array-write-read.scm:4: chicken.load#load-extension
array-write-read.scm:34: testit
array-write-read.scm:23: generalized-arrays#make-array
array-write-read.scm:24: scheme#with-output-to-file
array-write-read.scm:27: generalized-arrays#array-write
array-write-read.scm:28: chicken.base#print
array-write-read.scm:29: scheme#with-input-from-file   <--

--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


generalized-arrays broken link to arrays-cowan

2022-12-14 Thread Matt Welland
The link location is now:
https://small.r7rs.org/wiki/ArraysCowan/2/

Thanks.

--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Request for feedback: Chicken as a self-contained AppImage

2022-09-29 Thread Matt Welland
Thanks!

On Thu, Sep 29, 2022 at 8:30 AM Daniel Ziltener  wrote:

> Hi Matt,
>
> The AppImage-specific sources are on OBS at
> https://build.opensuse.org/package/show/home:zilti:appimages/chicken5 .
> So I don't have an AppDir. But you can download the appimage and run it
> with the --appimage-extract argument:
> chicken5.AppImage --appimage-extract
> That way it'll extract the AppDir into a folder called squashfs-root.
>
> On 29.09.22 14:09, Matt Welland wrote:
>
> Hi Daniel,
>
> I'd like to try appImage for some apps written in Chicken. I'm guessing
> that your set up for bundling Chicken itself would be a good starting
> point. Can you provide a tar of your AppDir or notes on how you created it?
>
> Thanks,
> Matt
> -=-
>
> On Wed, Sep 28, 2022 at 3:37 PM Daniel Ziltener 
> wrote:
>
>> Hello Chickeners!
>>
>> I had a "why not?" idea recently. I'm maintaining the RPM packages for
>> Chicken, and I thought "why not pack Chicken into an AppImage?" - and
>> that's what I did!
>>
>> For those who don't know AppImages: they are single-file volumes (think
>> ISO or DMG) but executable, and they work, without any further
>> requirements apart from FUSE (to mount the embedded SquashFS), on every
>> Linux distribution. You download an AppImage, rename it if you want,
>> make it executable, and it's ready for use. (if you have AppImageUpdate
>> installed, you can even automatically check for and get updates).
>>
>> So in this case, I packed a little script into the AppImage, since
>> Chicken has a whole bunch of executables. The AppImage is being built on
>> OpenSUSE's OBS service, and a download page is on
>> https://www.appimagehub.com/p/1911578/ , where you'll also find further
>> description on how to use it.
>>
>> Try it out if you like, and let me know about your thoughts, bugs to
>> fix, or improvements to make. A bit later I will link it on the
>> installation page of the Chicken wiki.
>>
>> Best regards,
>> Daniel
>>
>>
>>
>
> --
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Request for feedback: Chicken as a self-contained AppImage

2022-09-29 Thread Matt Welland
Hi Daniel,

I'd like to try appImage for some apps written in Chicken. I'm guessing
that your set up for bundling Chicken itself would be a good starting
point. Can you provide a tar of your AppDir or notes on how you created it?

Thanks,
Matt
-=-

On Wed, Sep 28, 2022 at 3:37 PM Daniel Ziltener  wrote:

> Hello Chickeners!
>
> I had a "why not?" idea recently. I'm maintaining the RPM packages for
> Chicken, and I thought "why not pack Chicken into an AppImage?" - and
> that's what I did!
>
> For those who don't know AppImages: they are single-file volumes (think
> ISO or DMG) but executable, and they work, without any further
> requirements apart from FUSE (to mount the embedded SquashFS), on every
> Linux distribution. You download an AppImage, rename it if you want,
> make it executable, and it's ready for use. (if you have AppImageUpdate
> installed, you can even automatically check for and get updates).
>
> So in this case, I packed a little script into the AppImage, since
> Chicken has a whole bunch of executables. The AppImage is being built on
> OpenSUSE's OBS service, and a download page is on
> https://www.appimagehub.com/p/1911578/ , where you'll also find further
> description on how to use it.
>
> Try it out if you like, and let me know about your thoughts, bugs to
> fix, or improvements to make. A bit later I will link it on the
> installation page of the Chicken wiki.
>
> Best regards,
> Daniel
>
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Minor typo in posixunix.scm

2022-09-14 Thread Matt Welland
posixunix.scm:  (posix-error #:file-error 'create-symbol-link "cannot
create symbolic link" old new) ) ) )

Should probably be "create-symbolic-link".

Thanks,
Matt
-=-
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: csm static build fails on yaml egg

2022-06-11 Thread Matt Welland
Ok. csm is helpful but not a magic bullet. I assumed that because "csm
-program yamltest" worked without additional switches etc I could merely
add -static to get a static build. Adding all.options and yamltest.options
with the needed info works:

cat all.options
-program yamltest -C -I/usr/include

cat yamltest.options
L -L/usr/lib/x86_64-linux-gnu -L -lyaml -static -L -static -L -lm -L
-ldl> ldd yamltest

$ file yamltest
yamltest: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux),
statically linked, for GNU/Linux 3.2.0,
BuildID[sha1]=642844535ad617a9378ce2ff7a7616e74dcdd940, not stripped

Thanks Felix.

On Sat, Jun 11, 2022 at 4:32 PM  wrote:

> > This is on ubuntu, chicken 5.3:
> >
> > Test code:
> > (module yamltest *
> > (import scheme
> > chicken.string
> > yaml)
> > (write (yaml-load "test.yaml")))
> >
> > > csm -static -program yamltest
> >   '/home/ubuntu/data/buildall/w23-0-ck5.3/bin/csc' '-o' 'yamltest' '-I'
> > '/home/ubuntu/data/opensrc/testsnips/yaml_static' '-C' '-I' '-C'
> > '/home/ubuntu/data/opensrc/testsnips/yaml_static' '-static'
> > '/home/ubuntu/data/opensrc/testsnips/yaml_static/yamltest.scm'
> > /home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
> > `f_3911':
> > yaml.static.c:(.text+0xae1c): undefined reference to `yaml_parser_delete'
> > yaml.static.c:(.text+0xae48): undefined reference to `yaml_parser_delete'
>
> Does this egg require an external library to be linked? It looks like it
> does. You need to add that.
>
>
> felix
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: How best to get a default result from sqlite3, or to use or not use first-result?

2022-06-11 Thread Matt Welland
Thanks all for the perspectives. Clearly I misinterpreted the intent of the
design of first-result. I'll use one of the provided options. Thomas, an
enhancement to the sqlite3 egg would be great if you get a chance.

Matt
-=-

On Thu, Jun 9, 2022 at 2:34 AM Thomas Chust  wrote:

> Hello Matt,
>
> it may be a bit of an oversight that no such procedure exists in the
> SQLite3 egg, but you could define something like this:
>
> (define (one-result/default default db sql . parameters)
>   (call-with-temporary-statements
> (lambda (stmt)
>   (apply bind-parameters! stmt parameters)
>   (if (step! stmt)
> (column-data stmt 0)
> default))
> db sql))
>
> [untested, and leaving the usual "overloads" for statement objects vs. SQL
> source as an exercise to the reader ]
>
> Ciao,
> Thomas
>
>
> Am Mi., 8. Juni 2022 um 20:10 Uhr schrieb Matt Welland :
>
>> The problem: retrieve one value from a query, if there is no matching
>> row return a default.
>>
>> Method 1: use for-each-row, overwrite the default with found values
>> Method 2: use first-result, on exception return the default
>> Method 3: use fold-row (wasn't an option when I first wrote the code)
>>
>> My question is, which of these is the "right" way to do what I want? Is
>> there another, better, way? Note that method #2 has problems in my
>> program but it might be due to my using chicken 4.10 (for now).
>>
>> ==additional details==
>>
>> Method 1, for-each-row, was my original approach and seemed to work
>> fine.
>>
>> Then, in the midst of a major rewrite I tried to use first-result. It
>> seemed odd to me to use an exception this way but I assumed (wrongly?)
>> it was a fancy software engineery way to do things since the sqlite3
>> egg did not provide any direct way to do what I want.
>>
>> However I hit a strange scalability issue with database locks happening
>> only a few hours into a run. After a lot of fruitless debug and on a
>> hunch, I replaced the first-result with a for-each-row and now am able
>> to run ten of thousands of tests over many hours (still not perfect,
>> work progresses).
>>
>> I plan to replace use of for-each-row with something like:
>>
>> (define (get-id db name default)
>>   (fold-row (lambda (row)
>>   (car row))
>> #f
>> db "SELECT id FROM tests WHERE testname=?" name))
>>
>> Thanks.
>>
>>
>>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


csm static build fails on yaml egg

2022-06-11 Thread Matt Welland
This is on ubuntu, chicken 5.3:

Test code:
(module yamltest *
(import scheme
chicken.string
yaml)
(write (yaml-load "test.yaml")))

> csm -static -program yamltest
  '/home/ubuntu/data/buildall/w23-0-ck5.3/bin/csc' '-o' 'yamltest' '-I'
'/home/ubuntu/data/opensrc/testsnips/yaml_static' '-C' '-I' '-C'
'/home/ubuntu/data/opensrc/testsnips/yaml_static' '-static'
'/home/ubuntu/data/opensrc/testsnips/yaml_static/yamltest.scm'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3911':
yaml.static.c:(.text+0xae1c): undefined reference to `yaml_parser_delete'
yaml.static.c:(.text+0xae48): undefined reference to `yaml_parser_delete'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3542':
yaml.static.c:(.text+0xb15c): undefined reference to `yaml_event_delete'
yaml.static.c:(.text+0xb188): undefined reference to `yaml_event_delete'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3758':
yaml.static.c:(.text+0xb597): undefined reference to
`yaml_mapping_start_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3708':
yaml.static.c:(.text+0xb884): undefined reference to
`yaml_sequence_start_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3664':
yaml.static.c:(.text+0xbb12): undefined reference to
`yaml_scalar_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_2045':
yaml.static.c:(.text+0xbedb): undefined reference to `yaml_emitter_delete'
yaml.static.c:(.text+0xbf07): undefined reference to `yaml_emitter_delete'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3905':
yaml.static.c:(.text+0xd9d5): undefined reference to
`yaml_parser_initialize'
yaml.static.c:(.text+0xd9e1): undefined reference to
`yaml_parser_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3561':
yaml.static.c:(.text+0xda7f): undefined reference to `yaml_emitter_emit'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_2100':
yaml.static.c:(.text+0xdc02): undefined reference to
`yaml_document_start_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_2256':
yaml.static.c:(.text+0xe1b1): undefined reference to
`yaml_mapping_end_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_2075':
yaml.static.c:(.text+0xe274): undefined reference to
`yaml_stream_end_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_2228':
yaml.static.c:(.text+0xe337): undefined reference to
`yaml_sequence_end_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_2268':
yaml.static.c:(.text+0xe5d6): undefined reference to
`yaml_alias_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3762':
yaml.static.c:(.text+0xe6ca): undefined reference to
`yaml_mapping_start_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3712':
yaml.static.c:(.text+0xe7be): undefined reference to
`yaml_sequence_start_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_2172':
yaml.static.c:(.text+0xe8a4): undefined reference to
`yaml_document_end_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_2063':
yaml.static.c:(.text+0xe98b): undefined reference to
`yaml_stream_start_event_initialize'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_1969':
yaml.static.c:(.text+0xea5c): undefined reference to
`yaml_emitter_initialize'
yaml.static.c:(.text+0xea79): undefined reference to
`yaml_emitter_initialize'
yaml.static.c:(.text+0xea85): undefined reference to
`yaml_emitter_set_unicode'
yaml.static.c:(.text+0xea91): undefined reference to
`yaml_emitter_set_indent'
yaml.static.c:(.text+0xeaa2): undefined reference to
`yaml_emitter_set_unicode'
yaml.static.c:(.text+0xeac0): undefined reference to
`yaml_emitter_set_indent'
yaml.static.c:(.text+0xeb04): undefined reference to
`yaml_emitter_set_output_file'
yaml.static.c:(.text+0xeb53): undefined reference to
`yaml_emitter_set_output_file'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3006':
yaml.static.c:(.text+0xece4): undefined reference to
`yaml_parser_set_input_file'
yaml.static.c:(.text+0xedda): undefined reference to
`yaml_parser_set_input_string'
/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o: In function
`f_3302':
yaml.static.c:(.text+0xfaa0): undefined reference to `yaml_parser_parse'
collect2: error: ld returned 1 exit status

Error: shell command terminated with non-zero exit status 256: 'gcc'
'yamltest.o' '/home/ubuntu/data/buildall/w23-0-ck5.3/lib/chicken/11/yaml.o'

How best to get a default result from sqlite3, or to use or not use first-result?

2022-06-08 Thread Matt Welland
The problem: retrieve one value from a query, if there is no matching
row return a default.

Method 1: use for-each-row, overwrite the default with found values
Method 2: use first-result, on exception return the default
Method 3: use fold-row (wasn't an option when I first wrote the code)

My question is, which of these is the "right" way to do what I want? Is
there another, better, way? Note that method #2 has problems in my
program but it might be due to my using chicken 4.10 (for now).

==additional details==

Method 1, for-each-row, was my original approach and seemed to work
fine.

Then, in the midst of a major rewrite I tried to use first-result. It
seemed odd to me to use an exception this way but I assumed (wrongly?)
it was a fancy software engineery way to do things since the sqlite3
egg did not provide any direct way to do what I want.

However I hit a strange scalability issue with database locks happening
only a few hours into a run. After a lot of fruitless debug and on a
hunch, I replaced the first-result with a for-each-row and now am able
to run ten of thousands of tests over many hours (still not perfect,
work progresses).

I plan to replace use of for-each-row with something like:

(define (get-id db name default)
  (fold-row (lambda (row)
  (car row))
#f
db "SELECT id FROM tests WHERE testname=?" name))

Thanks.




Re: What is this message trying to tell me? csc: could not find linked extension: chicken.csi

2022-05-26 Thread Matt Welland
Thanks Felix, that was the hint I needed. I was calling (repl). Once I
removed that it compiled static just fine.


On Wed, May 25, 2022 at 5:00 PM  wrote:

> > ck5 csm -program kvpub -static
> >   '/home/mrwellan/data/buildall/ck5.3/bin/csc' '-c' '-static' '-J'
> > '/home/mrwellan/data/kvpub/mtargs.scm' '-I' '/home/mrwellan/data/kvpub'
> > '-C' '-I' '-C' '/home/mrwellan/data/kvpub' '-unit' 'mtargs'
> > '-emit-link-file' 'mtargs.link' '-o' 'mtargs.o'
> >   '/home/mrwellan/data/buildall/ck5.3/bin/csc' '-o' 'kvpub' '-I'
> > '/home/mrwellan/data/kvpub' '-C' '-I' '-C' '/home/mrwellan/data/kvpub'
> > '-static' 'mtargs.o' '-uses' 'mtargs'
> '/home/mrwellan/data/kvpub/inval.scm'
> > csc: could not find linked extension: chicken.csi
> > command failed with non-zero exit status:
> > '/home/mrwellan/data/buildall/ck5.3/bin/csc' '-o' 'kvpub' '-I'
> > '/home/mrwellan/data/kvpub' '-C' '-I' '-C' '/home/mrwellan/data/kvpub'
> > '-static' 'mtargs.o' '-uses' 'mtargs'
> '/home/mrwellan/data/kvpub/inval.scm'
>
> You are trying to link statically a program that uses the (chicken csi)
> module, but there is no such object file for static linking available
> (chicken.csi lives in "csi" the interpreter and is not part of libchicken
> or the set of statically linkable extensions).
>
> You have to create a shared object and load it into csi to be able to
> use exports from the chicken.csi module.
>
>
> felix
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


What is this message trying to tell me? csc: could not find linked extension: chicken.csi

2022-05-25 Thread Matt Welland
ck5 csm -program kvpub -static
  '/home/mrwellan/data/buildall/ck5.3/bin/csc' '-c' '-static' '-J'
'/home/mrwellan/data/kvpub/mtargs.scm' '-I' '/home/mrwellan/data/kvpub'
'-C' '-I' '-C' '/home/mrwellan/data/kvpub' '-unit' 'mtargs'
'-emit-link-file' 'mtargs.link' '-o' 'mtargs.o'
  '/home/mrwellan/data/buildall/ck5.3/bin/csc' '-o' 'kvpub' '-I'
'/home/mrwellan/data/kvpub' '-C' '-I' '-C' '/home/mrwellan/data/kvpub'
'-static' 'mtargs.o' '-uses' 'mtargs' '/home/mrwellan/data/kvpub/inval.scm'
csc: could not find linked extension: chicken.csi
command failed with non-zero exit status:
'/home/mrwellan/data/buildall/ck5.3/bin/csc' '-o' 'kvpub' '-I'
'/home/mrwellan/data/kvpub' '-C' '-I' '-C' '/home/mrwellan/data/kvpub'
'-static' 'mtargs.o' '-uses' 'mtargs' '/home/mrwellan/data/kvpub/inval.scm'
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: How to do formatting in iup textbox?

2022-02-04 Thread Matt Welland
On Thu, Feb 3, 2022 at 6:29 PM Vasilij Schneidermann 
wrote:

> Hello Matt,
>
> > What is the equivalent to iup.user in the Chicken iup egg?
>
> The egg doesn't have a binding for "IupUser", so you'd need to expose
> that first.
>

Ok. That makes sense.

> Or more generally, how to apply formatting to text in the textbox widget?
>
> Should be a manner of using `attribute-set!` on the widget.
>

I thought it should be possible to just use attribute-set! and perhaps it
is. However I have not been able to figure it out. In the lua example the
formatting attributes are set on the user object which is somehow attached
to the text widget.

I tried something like this:

 (attribute-set! x "ADDFORMATTAG" "\"ALIGNMENT\" = \"CENTER\"")
 (attribute-set! x "ADDFORMATTAG" "\"SELECTION\" = \"1,1:3,50\"")

But it doesn't appear to make any difference. Suggestions?

Thanks,
Matt
-=-

>
> Vasilij
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


How to do formatting in iup textbox?

2022-01-28 Thread Matt Welland
What is the equivalent to iup.user in the Chicken iup egg?
local tags = *iup.user* { selectionpos = "7:24", bgcolor = "255 128 64" }
text1.addformattag = tags


Or more generally, how to apply formatting to text in the textbox widget?

Thanks,

Matt

--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Guidance requested for debugging import problem.

2021-11-29 Thread Matt Welland
On Mon, 2021-11-29 at 21:16 +0100, felix.winkelm...@bevuta.com wrote:
> > Hi!
> 
> The problem here is that read-syntax extensions are not seen by csm,
> which
> tries to load and parse all source files. This was a blatant
> oversight on my part,
> I just committed a few changes to the csm trunk that adds a "-csm-
> extend FILENAME"
> option. You should be able to pass this directly to csm or via an
> options file -
> it works like csc's "-extend" and loads a file (source or compiled)
> into the
> processor so read-syntax extensions in the loaded file are installed.
> 
> Could you give it a try? I have not tagged a new release yet, you can
> check it
> out via svn:
> svn co 
> https://anonym...@code.call-cc.org/svn/chicken-eggs/release/5/csm
> 
> I'd be very grateful for feedback. I think csm is quite useful, but
> it hasn't been
> tested enough yet and it needs serious usage to clarify whether the
> approach is
> worth it and robust enough. 
> 

It worked! Very nice. I'll keep using it and feedback any other issues
I run into. Thanks.


> felix
> 
> 




Re: Guidance requested for debugging import problem.

2021-11-29 Thread Matt Welland
Hi Felix,

I did not know about csm (or perhaps forgot it's existence?). Anyhow it
seems like a potentially much better solution than a
hand-maintained Makefile. I've tried it on a couple code bases and I'm
running into a few issues, some are just cruft in the code but two cases
I'm running into invalid sharp syntax errors:
===
csm -program logpro -ignore tests/run.scm
while reading file /home/mrwellan/data/logpro/logprocessor.scm:

Error: invalid sharp-sign read syntax: #\/
===
For logpro I wanted to expose the #/ ... / syntax to users. Since
regex-literals is not ported in chicken 5 I just injected the code into
logpro for now but it seems that csm doesn't understand the situation.

Thanks.





On Mon, Nov 15, 2021 at 5:01 AM  wrote:

> > Wow, that seems to have fixed it. Thanks!!
>
> Also, I will not tire to point out that "csm" is always a viable
> alternative! :-)
>
>
> felix
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Guidance requested for debugging import problem.

2021-11-14 Thread Matt Welland
Wow, that seems to have fixed it. Thanks!!

On Sun, Nov 14, 2021 at 3:54 PM  wrote:

> > I went ahead and completed the minimal example build including the use of
> > .import.o files to enable using modules in evals. See attached tar. It
> > works fine which implies that, as you suggested, I have something wrong
> in
> > my build system.
>
> Thanks for the example code, this is really helpful understanding the
> problem.
> I have added -M to the compilation rules for the modules and removed the
> "uses" declaration of m1.import and the example still seems to work.
> -M includes the registration code in the binary, so that the module is
> visible
> at runtime. Perhaps this would help getting rid of the seprate *.import
> units.
>
>
> felix
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Guidance requested for debugging import problem.

2021-11-14 Thread Matt Welland
I went ahead and completed the minimal example build including the use of
.import.o files to enable using modules in evals. See attached tar. It
works fine which implies that, as you suggested, I have something wrong in
my build system.

I do think this little sample build might be helpful for others ramping up
on creating a chicken application. I could not find a sample app on the
wiki, after getting input on best known methods I can add it.

On Sat, Nov 13, 2021 at 11:25 PM Matt Welland 
wrote:

> The .import.o files are there to support access to modules in evals (there
> is a past email thread on this). Those files are compiled like this:
>
> csc  -unit apimod.import -c apimod.import.scm -o apimod.import.o
>
> I've attached a basic testcase that models the build without the import.o
> stuff. Please confirm it is correct and then I'll add an example of the
> .import.o files.
>
> Thanks again.
>
> On Sat, Nov 13, 2021 at 4:58 AM  wrote:
>
>> > Thanks Felix for looking. Both run with -:d and attached.
>> >
>> > I only see the following loading calls in dashboard.log:
>> >
>> > ; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/
>> > chicken.time.import.so ...
>> > [debug] loading compiled library
>> > /home/matt/data/buildall/ck5.2/lib/chicken/11/chicken.time.import.so
>> > (0x555a9a701260)
>> > [debug] entering toplevel...
>> > ; loading ./debugprint.import.scm ...
>> > ; loading ./mtargs.import.scm ...
>> > ; loading ./commonmod.import.scm ...
>> > ; loading ./configfmod.import.scm ...
>>
>> I'm not sure I fully understand the problem here, but these look strange:
>>
>> [debug] entering apimod.import...
>> [debug] entering debugprint.import...
>> [debug] entering mtargs.import...
>> [debug] entering commonmod.import...
>> [debug] entering configfmod.import...
>> [debug] entering bigmod.import...
>>
>> Are import-libraries compiled as modules? I think there might be a problem
>> with your build system - these messages indicate the modules of the names
>> given are compiled as library units / toplevel proceduresm which
>> shouldn't be.
>> Import libraries are auxiliary files that are loaded or included, but do
>> not
>> represent separate toplevel procedures. The latter are only created for
>> library units
>> and modules. Please check how the shown files (apimod, etc.) are compiled
>> and with what options.
>>
>>
>> felix
>>
>>
>
> --
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


testbuild.tar.gz
Description: application/gzip


Re: Guidance requested for debugging import problem.

2021-11-13 Thread Matt Welland
The .import.o files are there to support access to modules in evals (there
is a past email thread on this). Those files are compiled like this:

csc  -unit apimod.import -c apimod.import.scm -o apimod.import.o

I've attached a basic testcase that models the build without the import.o
stuff. Please confirm it is correct and then I'll add an example of the
.import.o files.

Thanks again.

On Sat, Nov 13, 2021 at 4:58 AM  wrote:

> > Thanks Felix for looking. Both run with -:d and attached.
> >
> > I only see the following loading calls in dashboard.log:
> >
> > ; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/
> > chicken.time.import.so ...
> > [debug] loading compiled library
> > /home/matt/data/buildall/ck5.2/lib/chicken/11/chicken.time.import.so
> > (0x555a9a701260)
> > [debug] entering toplevel...
> > ; loading ./debugprint.import.scm ...
> > ; loading ./mtargs.import.scm ...
> > ; loading ./commonmod.import.scm ...
> > ; loading ./configfmod.import.scm ...
>
> I'm not sure I fully understand the problem here, but these look strange:
>
> [debug] entering apimod.import...
> [debug] entering debugprint.import...
> [debug] entering mtargs.import...
> [debug] entering commonmod.import...
> [debug] entering configfmod.import...
> [debug] entering bigmod.import...
>
> Are import-libraries compiled as modules? I think there might be a problem
> with your build system - these messages indicate the modules of the names
> given are compiled as library units / toplevel proceduresm which shouldn't
> be.
> Import libraries are auxiliary files that are loaded or included, but do
> not
> represent separate toplevel procedures. The latter are only created for
> library units
> and modules. Please check how the shown files (apimod, etc.) are compiled
> and with what options.
>
>
> felix
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


testbuild.tar.gz
Description: application/gzip


Re: Guidance requested for debugging import problem.

2021-11-12 Thread Matt Welland
Thanks Felix for looking. Both run with -:d and attached.

I only see the following loading calls in dashboard.log:

; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/
chicken.time.import.so ...
[debug] loading compiled library
/home/matt/data/buildall/ck5.2/lib/chicken/11/chicken.time.import.so
(0x555a9a701260)
[debug] entering toplevel...
; loading ./debugprint.import.scm ...
; loading ./mtargs.import.scm ...
; loading ./commonmod.import.scm ...
; loading ./configfmod.import.scm ...


On Fri, Nov 12, 2021 at 3:31 PM  wrote:

> > On Fri, Nov 12, 2021 at 3:47 AM  wrote:
> >
> > > > Update. I found that removing the *.import.scm files causes the
> problem
> > > to
> > > > also occur when running the executable in the directory where
> compiled.
> > > > However the non-gui executable still works fine. Why would a compiled
> > > > Chicken program be reading the import.scm files at run time?
> > >
> > > This can depend on compiler options: the import files contain code to
> > > register modules and imports, depending on compilation type
> > > (static/dynamic)
> > > and certain compiler options, this code is compiled into the executable
> > > or is loaded from a separate file.
> > >
> > > If you run the binaries with "-:d" and/or "-:d" do you get any
> information
> > > regarding the loaded files?
> > >
> >
> > I see the *.import.scm files being loaded in the output only in this one
> > place after chicken.time.import.so:
> >
> > ; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/
> > chicken.time.import.so ...
> > [debug] loading compiled library
> > /home/matt/data/buildall/ck5.2/lib/chicken/11/chicken.time.import.so
> > (0x555a9a701260)
> > [debug] entering toplevel...
> > ; loading ./debugprint.import.scm ...
> > ; loading ./mtargs.import.scm ...
> > ; loading ./commonmod.import.scm ...
> > ; loading ./configfmod.import.scm ...
> > ; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/base64.import.so
> ...
> >
>
> Can you run both apps with the debug flags and show their output?
>
>
> felix
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.
Script started on 2021-11-12 18:47:36-0500
[debug] application startup...
[debug] heap resized to 1048576 bytes
[debug] stack bottom is 0x7fffd3cf5780.
[debug] entering toplevel...
[debug] entering library...
[debug] entering build-version...
[debug] entering eval...
[debug] entering modules...
[debug] entering chicken-syntax...
[debug] entering expand...
[debug] entering internal...
[debug] entering ducttape-lib...
[debug] entering file...
[debug] entering extras...
[debug] entering data-structures...
[debug] entering irregex...
[debug] entering pathname...
[debug] entering posix...
[debug] entering scheduler...
[debug] entering port...
[debug] entering lolevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/regex.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/regex.so (0x55aa95624c00)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/ansi-escape-sequences.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/ansi-escape-sequences.so (0x55aa95625800)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/srfi-1.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/srfi-1.so (0x55aa95626e60)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/test.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/test.so (0x55aa95628910)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/slice.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/slice.so (0x55aa9562a240)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/srfi-13.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/srfi-13.so (0x55aa9562a890)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/srfi-14.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/srfi-14.so (0x55aa9562cc10)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/rfc3339.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/rfc3339.so (0x55aa9562e610)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/matchable.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/matchable.so (0x55aa9562f5b0)
[debug] entering toplevel...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/directory-utils.so ...
[debug] loading compiled library /home/matt/data/buildall/ck5.2/lib/chicken/11/directory-utils.so (0x55aa9562fcb0)
[debug] entering toplevel...
; 

Re: Guidance requested for debugging import problem.

2021-11-12 Thread Matt Welland
On Fri, Nov 12, 2021 at 3:47 AM  wrote:

> > Update. I found that removing the *.import.scm files causes the problem
> to
> > also occur when running the executable in the directory where compiled.
> > However the non-gui executable still works fine. Why would a compiled
> > Chicken program be reading the import.scm files at run time?
>
> This can depend on compiler options: the import files contain code to
> register modules and imports, depending on compilation type
> (static/dynamic)
> and certain compiler options, this code is compiled into the executable
> or is loaded from a separate file.
>
> If you run the binaries with "-:d" and/or "-:d" do you get any information
> regarding the loaded files?
>

I see the *.import.scm files being loaded in the output only in this one
place after chicken.time.import.so:

; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/
chicken.time.import.so ...
[debug] loading compiled library
/home/matt/data/buildall/ck5.2/lib/chicken/11/chicken.time.import.so
(0x555a9a701260)
[debug] entering toplevel...
; loading ./debugprint.import.scm ...
; loading ./mtargs.import.scm ...
; loading ./commonmod.import.scm ...
; loading ./configfmod.import.scm ...
; loading /home/matt/data/buildall/ck5.2/lib/chicken/11/base64.import.so ...



>
> felix
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Guidance requested for debugging import problem.

2021-11-11 Thread Matt Welland
Update. I found that removing the *.import.scm files causes the problem to
also occur when running the executable in the directory where compiled.
However the non-gui executable still works fine. Why would a compiled
Chicken program be reading the import.scm files at run time?

On Thu, Nov 11, 2021 at 8:17 PM Matt Welland  wrote:

> Background: I've converted a flat (compilation units but not modules)
> chicken program to modules and from chicken 4.12 to chicken 5.2. There are
> two executables, a command-line only and a gui using iup.
>
> The problem: The command-line program runs fine from any directory however
> the IUP gui program only works from the directory where it was compiled.
> When run from a different directory I get an error "Error: (import-syntax)
> during expansion of (import-syntax ...) - cannot import from undefined
> module
> debugprint".
>
> I'm looking for suggestions on how to debug this further.
>
> Thanks.
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Guidance requested for debugging import problem.

2021-11-11 Thread Matt Welland
Background: I've converted a flat (compilation units but not modules)
chicken program to modules and from chicken 4.12 to chicken 5.2. There are
two executables, a command-line only and a gui using iup.

The problem: The command-line program runs fine from any directory however
the IUP gui program only works from the directory where it was compiled.
When run from a different directory I get an error "Error: (import-syntax)
during expansion of (import-syntax ...) - cannot import from undefined
module
debugprint".

I'm looking for suggestions on how to debug this further.

Thanks.
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Seeking feedback for nng egg

2021-10-16 Thread Matt Welland
Yes, that was it. I'm not familiar with cmake. To get shared libraries in
nng I guess you need to do:

cd build
cmake -D BUILD_SHARED_LIBS:BOOL=on ..

The nng egg built fine after that. Now I'll give testing it a try.

Thanks.

On Thu, Oct 14, 2021 at 11:37 PM Zbigniew Szadkowski 
wrote:

> Is nng compiled as a shared library? Because it looks like it’s linking
> against an archive file.
>
> On Oct 14, 2021, at 20:49, Matt Welland  wrote:
>
> 
> I added "-C" "-fPIC" and get this:
>
> matt@mars:~/src/chicken-nng$ ck5 chicken-install -s
> building nng
>/home/matt/data/buildall/ck5.2/bin/csc -host -D compiling-extension -J
> -s -regenerate-import-libraries -setup-mode -I /home/matt/src/chicken-nng
> -C -I/home/matt/src/chicken-nng -C -fPIC -L -lnng src/nng.scm -o
> /home/matt/src/chicken-nng/nng.so
> /usr/bin/ld: //usr/local/lib/libnng.a(nng.c.o): relocation R_X86_64_PC32
> against symbol `nng_recvmsg' can not be used when making a shared object;
> recompile with -fPIC
> /usr/bin/ld: final link failed: Bad value
> collect2: error: ld returned 1 exit status
>
> Error: shell command terminated with non-zero exit status 256: 'gcc'
> '/home/matt/src/chicken-nng/nng.o' -o '/home/matt/src/chicken-nng/nng.so'
> -shared -lnng -L/home/matt/data/buildall/ck5.2/lib
> -Wl,-R/home/matt/data/buildall/ck5.2/lib -lchicken -lm -ldl
>
> Error: shell command terminated with nonzero exit code
> 256
> "sh /home/matt/src/chicken-nng/nng.build.sh"
>
> I'm wondering if my nng install is somehow broken? I compiled and ran the
> reqrep demo and it works fine.
>
> On Wed, Oct 13, 2021 at 4:22 PM Ariela Wenner  wrote:
>
>>
>> Huh, weird. I have been trying to replicate whatever is going on, without
>> luck
>> so far.
>>
>> Would you mind editing the csc-options inside the egg definition on line
>> 8?
>>
>> Should look like this:
>>
>> (csc-options "-C" "-fPIC" "-L" "-lnng")
>>
>> Then try building again. If the error persist send me the logs and I'll
>> look
>> into it.
>>
>> Cheers!
>>
>> On Wed, 13 Oct 2021 16:00:46 -0400
>> Matt Welland  wrote:
>>
>> > OS is lubuntu 20.04, latest nng from git.
>> >
>> > Thanks.
>> >
>>
>
>
> --
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Seeking feedback for nng egg

2021-10-14 Thread Matt Welland
I added "-C" "-fPIC" and get this:

matt@mars:~/src/chicken-nng$ ck5 chicken-install -s
building nng
   /home/matt/data/buildall/ck5.2/bin/csc -host -D compiling-extension -J
-s -regenerate-import-libraries -setup-mode -I /home/matt/src/chicken-nng
-C -I/home/matt/src/chicken-nng -C -fPIC -L -lnng src/nng.scm -o
/home/matt/src/chicken-nng/nng.so
/usr/bin/ld: //usr/local/lib/libnng.a(nng.c.o): relocation R_X86_64_PC32
against symbol `nng_recvmsg' can not be used when making a shared object;
recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status

Error: shell command terminated with non-zero exit status 256: 'gcc'
'/home/matt/src/chicken-nng/nng.o' -o '/home/matt/src/chicken-nng/nng.so'
-shared -lnng -L/home/matt/data/buildall/ck5.2/lib
-Wl,-R/home/matt/data/buildall/ck5.2/lib -lchicken -lm -ldl

Error: shell command terminated with nonzero exit code
256
"sh /home/matt/src/chicken-nng/nng.build.sh"

I'm wondering if my nng install is somehow broken? I compiled and ran the
reqrep demo and it works fine.

On Wed, Oct 13, 2021 at 4:22 PM Ariela Wenner  wrote:

>
> Huh, weird. I have been trying to replicate whatever is going on, without
> luck
> so far.
>
> Would you mind editing the csc-options inside the egg definition on line 8?
>
> Should look like this:
>
> (csc-options "-C" "-fPIC" "-L" "-lnng")
>
> Then try building again. If the error persist send me the logs and I'll
> look
> into it.
>
> Cheers!
>
> On Wed, 13 Oct 2021 16:00:46 -0400
> Matt Welland  wrote:
>
> > OS is lubuntu 20.04, latest nng from git.
> >
> > Thanks.
> >
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Seeking feedback for nng egg

2021-10-13 Thread Matt Welland
OS is lubuntu 20.04, latest nng from git.

Thanks.

On Wed, Oct 13, 2021, 8:11 AM Ariela Wenner  wrote:

> Hi Matt!
>
> Oh yeah, I'm aware of the srfi-69 dep missing , I'll be fixing that asap
>
> I have to admit I've never come across that error while working on this
> egg, though. What OS are you using? I'll see if I can replicate that.
>
> Thanks for giving this a try, cheers!
>
> El 12 de octubre de 2021 11:28:47 p. m. GMT-03:00, Matt Welland <
> m...@kiatoa.com> escribió:
> >Hi Ariela,
> >
> >I'd like to give this a try but I'm not sure how to build it.
> >
> >1. it seems to need srfi-69
> >
> >2. I tried to compile with "make" and "chicken-install" but
> >   get a message about needing to use -fPIC. How to do that?
> >   I tried with: CSC_OPTIONS='-C "-fPIC"' make
> >
> >Thanks.
> >
>
> --
>
>


Re: Seeking feedback for nng egg

2021-10-12 Thread Matt Welland
Hi Ariela,
 
I'd like to give this a try but I'm not sure how to build it.

1. it seems to need srfi-69

2. I tried to compile with "make" and "chicken-install" but 
   get a message about needing to use -fPIC. How to do that? 
   I tried with: CSC_OPTIONS='-C "-fPIC"' make

Thanks.

On Sat, 2021-10-09 at 19:16 -0300, Ariela Wenner wrote:
> Hi all. I've been working on writing a very barebones nng egg[0] and
> I think
> it's usable now. It supports rep, req, pull, push, sub, pub, pair,
> surveyor,
> respondent and bus sockets, with TLS transport. At the moment options
> are kinda
> limited, but it is fairly easy to add anything missing.
> 
> If it sounds like it could be of use to you, please give it a try and
> tell me if
> there's anything broken or any other kind of feedback. If all goes
> well I'll
> make a tag and actually try to get this submitted to the coup.
> 
> Cheers!
> 
> [0]: https://gitlab.com/ariSun/chicken-nng
> 




Re: Hard coded paths in csc and relocatable chicken

2021-05-21 Thread Matt Welland
HI Mario,

Yes, static csc, csi etc would work but the calls in csc to other chicken
tools would need to use $PATH or I would be up against the same issue.

I'll try some of the other suggestions. I did look at csc.scm but I have
not been able to figure out where the hard-coded paths are created. Maybe
it is in the "C" compilation step?

The classic solution for this in the scripting world is to find the path to
the running executable and use that to find the child executables:

I.e. if csc used (pathname-directory (car (argv to prefix as a path to
the other executable calls or an env var to give end users control then I'd
be enabled.

Thanks,
Matt
-=-

On Fri, May 21, 2021 at 10:58 AM Mario Domenech Goulart <
ma...@parenteses.org> wrote:

> Hi Matt,
>
> On Thu, 20 May 2021 15:04:16 -0700 Matt Welland 
> wrote:
>
> > As mentioned in the coding jam I put together a chicken bundle including
> the iup egg ready to go outside the box. It turns out that my assertion that
> > it worked was wrong. I tested by running csi and was able to load iup
> and create a button and I assumed that if this worked then so would
> compilation
> > with csc. Not so. While a little script hackery could swizzle the full
> paths in the .info files for eggs I don't think there is any way to change
> the
> > paths in compiled binaries such as csc.
> >
> > I really would like to be able to make a relocatable build system to
> enable us to use chicken in our ever more constrained compute environment.
> >
> > The directories are all pointing to the original install directory. E.g.
> >> strings csc | less
> > ...
> > _edata
> > __bss_start
> > _end
> > /home/matt/buildall/ck5.2/lib
> > GLIBC_2.3
> > GLIBC_2.2.5
> >
> > Any suggestions or ideas on how to work around this?
>
> Would static linking be an acceptable solution in this case?
>
> All the best.
> Mario
> --
> http://parenteses.org/mario
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Hard coded paths in csc and relocatable chicken

2021-05-20 Thread Matt Welland
As mentioned in the coding jam I put together a chicken bundle including
the iup egg ready to go outside the box. It turns out that my assertion
that it worked was wrong. I tested by running csi and was able to load iup
and create a button and I assumed that if this worked then so would
compilation with csc. Not so. While a little script hackery could swizzle
the full paths in the .info files for eggs I don't think there is any way
to change the paths in compiled binaries such as csc.

I really would like to be able to make a relocatable build system to enable
us to use chicken in our ever more constrained compute environment.

The directories are all pointing to the original install directory. E.g.
> strings csc | less
...
_edata
__bss_start
_end
/home/matt/buildall/ck5.2/lib
GLIBC_2.3
GLIBC_2.2.5

Any suggestions or ideas on how to work around this?

Thanks,
Matt
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Chicken 5, chicken-install goes silent for long time on installing long list of eggs

2021-04-27 Thread Matt Welland
chicken install address-info ansi-escape-sequences apropos base64 crypt
csv-abnf
directory-utils filepath fmt format http-client
intarweb json linenoise matchable md5 message-digest moremacros
pathname-expand postgresql queues regex-case rfc3339 s11n sha1
slice sparse-vectors spiffy
spiffy-directory-listing spiffy-request-vars sql-de-lite sqlite3
srfi-19 srfi-69 stack sxml-modifications sxml-serializer
sxml-transforms sxpath system-information tcp6 test uri-common z3

... long wait before there is any output ...

A little visual feedback would give the user some confidence that things
are proceeding.

--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Chicken 5 compilation, coerced inexact literal number warning. What am I missing here?

2021-04-08 Thread Matt Welland
Yes, you are correct, the error from not finding the .h was spurious. On
looking again I noticed that there is a fixnum directive in the
hostinfo.scm file:

(declare
 (fixnum))

Prior to finding .h message I was including the hostinfo.scm file and then
later importing it. When I converted it to a compilation unit the fixnum no
longer applied.

On Wed, Apr 7, 2021 at 10:49 PM Peter Bex  wrote:

> On Wed, Apr 07, 2021 at 10:42:39PM -0700, Matt Welland wrote:
> > There is a .h file in hostinfo and I didn't catch the error message.
> > Presumably that somehow put the compiler into fixnum mode.
>
> hm, if possible could you figure out what exactly did that?
> A C header file shouldn't change the compiler's mode!
>
> Glad to hear you figured out how to solve the issue though!
>
> Cheers,
> Peter
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Chicken 5 compilation, coerced inexact literal number warning. What am I missing here?

2021-04-07 Thread Matt Welland
Thanks Peter. That helped. I'm not certain but I think it was where I had
put hostinfo egg from chicken 4 into a subdir and was including it. There
is a .h file in hostinfo and I didn't catch the error message. Presumably
that somehow put the compiler into fixnum mode. Now on to the next porting
challenge :)



On Tue, Apr 6, 2021 at 11:20 PM Peter Bex  wrote:

> On Tue, Apr 06, 2021 at 09:37:32PM -0700, Matt Welland wrote:
> > This one I sort of understand but it does seem annoying:
> >
> > Warning: coerced inexact literal number `9e+99' to fixnum
> >
> 848859130765266355329578537025198862586562510896759102769772101980841694466750283776
>
> I don't get this, unless I use -fixnum-arithmetic.  The message
> is a bit misleading because that number is (obviously) not a fixnum.
> However, if I compile it and I get that warning, it errors out with
>
>   Error: [internal compiler error] bad immediate (prepare)
>
> This makes sense because that's not a fixnum.  Maybe something we
> could "fix" by making the number overflow, or something.
>
> > but the following I don't understand:
> >
> > This line:
> > (define megatest-version 1.6584)
> >
> > generates this warning:
> > Warning: literal is out of range - will be truncated to integer: 1.6584
>
> I don't get that unless I compile with -fixnum-arithmetic.
>
> > But a small test program works fine:
> >
> > $ cat testit.scm
> > (module testit
> > *
> > (import scheme)
> > (define abc 1.2345)
> > )
> >
> > (import testit)
> > (print (/ abc 2))
> > $ csc testit.scm
> > $ ./testit
> > 0.61725
>
> If I compile that as "csc -fixnum-arithmetic testit.scm" I get the
> same warning and it prints zero.  If I compile it without flags,
> I get the expected output, like you.
>
> Cheers,
> Peter
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Chicken 5 compilation, coerced inexact literal number warning. What am I missing here?

2021-04-06 Thread Matt Welland
This one I sort of understand but it does seem annoying:

Warning: coerced inexact literal number `9e+99' to fixnum
848859130765266355329578537025198862586562510896759102769772101980841694466750283776

but the following I don't understand:

This line:
(define megatest-version 1.6584)

generates this warning:
Warning: literal is out of range - will be truncated to integer: 1.6584

But a small test program works fine:

$ cat testit.scm
(module testit
*
(import scheme)
(define abc 1.2345)
)

(import testit)
(print (/ abc 2))
$ csc testit.scm
$ ./testit
0.61725
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Chicken GUI options survey and questions.

2021-03-05 Thread Matt Welland
I'm starting (yet another) attempt to move a big project of mine to
Chicken 5 and now is a good time to look at other options for the GUI.
Before I do some evaluations I'm interested in hearing any thoughts
from others.

What is your preferred toolkit for making GUI apps with chicken? 

I've been using IUP, which I know and like very much. I've listed the
pros and cons (from my perspective) far below.

Alternatives to consider


 * webview egg
 * qt-light 
 * pstk (probably not really an option, ancient look/feel).
 * kiwi (probably too limited for my needs)

Others
--

nuklear http://wiki.call-cc.org/eggref/4/nuklear,
https://github.com/Immediate-Mode-UI/Nuklear
looks interesting, not clear if actively supported

flutter - no egg yet but checks all modern gui boxes and
  highly portable. Comments on effort required to 
  make a binding to Chicken would be appreciated.
  BTW: No, I'm not interested in developing in dart.
  I'm sure it is a great language but I like Chicken.

My experiences with IUP
---

Pros: 
 - super easy to learn and use
 - Good range of widgets
 - decent performance

Cons:

 - native widgets can look dated across platforms
 - you are at the whim of the platform. 
   (E.g. In my case Gnome broke using bgcolor in
buttons which I was relying on.)
 - Very difficult to install, still no Ubuntu package.





Dead link on matchable documentation

2020-09-27 Thread Matt Welland
This link to this paper an-introduction-to-lispy-pattern-matching.html,
from http://wiki.call-cc.org/eggref/5/matchable, is dead. I could not find
the paper.

Thanks.

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: tabular is not handling "" escapes

2020-03-06 Thread Matt Welland
Thanks Ivan, I much appreciate the support.

I tested 1.2 and it does solve the escaped quotes problem. I do now see
another problem. Multi-line cells cause the parser some grief. The attached
test.csv generated from Excel imports fine to gnumeric but fails with an
"unable to parse record" with tabular.

On Fri, Mar 6, 2020 at 8:16 AM Ivan Raikov  wrote:

> Hi Matt,
>
> Thank you for using tabular and for reporting this issue. This was
> indeed a bug in the code that handles escaped quotes. I have fixed it
> and have made a new release (1.2). Let me know if you run into any
> other issues. Best regards,
>
> -Ivan
>
> On Thu, Mar 5, 2020 at 2:14 PM Matt Welland 
> wrote:
> >
> > It is common in csv to escape double quotes with double quotes. This
> does not work in tabular and I was unable to figure out any other
> mechanism. Replacing the first " with \ did not work and neither did using
> single quotes around the string. Is there a built in mechanism? The csv
> files in question come from Microsoft Excel but I tested with a csv from
> Gnumeric and see the same problem.
> >
> > cat testing.csv
> > Junk,"Joe  ""Super"" Duper Guy",zsssy
> > "More Junk",1,2
> >
> > ../portit pp testing.csv
> >
> > Error: (list->string) bad argument type - not a character: (#\")
> >
> > Call history:
> >
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?
> > utf8-srfi-14.scm:101: iset#iset-contains?   <--
> >
> > Thanks.
> > --
> > Complexity is your enemy. Any fool can make something complicated.
> > It is hard to keep things simple. - Richard Branson.
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


test.csv
Description: MS-Excel spreadsheet


tabular is not handling "" escapes

2020-03-05 Thread Matt Welland
It is common in csv to escape double quotes with double quotes. This does
not work in tabular and I was unable to figure out any other mechanism.
Replacing the first " with \ did not work and neither did using single
quotes around the string. Is there a built in mechanism? The csv files in
question come from Microsoft Excel but I tested with a csv from Gnumeric
and see the same problem.

cat testing.csv
Junk,"Joe  ""Super"" Duper Guy",zsssy
"More Junk",1,2

../portit pp testing.csv

Error: (list->string) bad argument type - not a character: (#\")

Call history:

utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?
utf8-srfi-14.scm:101: iset#iset-contains?   <--

Thanks.
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: How to get a useful repl with Chicken 5?

2020-01-31 Thread Matt Welland
Updates:

1. breadline installed out of the box, no extra effort required, on SLES11
at work.
2. breadline did exactly what I expected when I added (repl) to the code in
the given csirc example and put it in my program.
3. ^R, history saving and all the other powerful features of readline all
seem to work.
4. Code completion works!! Maybe it is a bit much to ask but it'd be useful
if completion rolled over from internal symbols to files. (*)

Thanks Vasilij, this egg is very much appreciated. If no one else is
reporting problems on Ubuntu 18.04 then likely I've got something messed up
on my home machine. I'll debug further and report back on what I find.

This is what I included in my code to get a repl with line editing, history
etc:

  (case command
((repl)
 (import (chicken load))
 (load-verbose #f)
 (let ()
   (import (chicken format))
   (import (chicken process-context))
   (unless (get-environment-variable "INSIDE_EMACS")
  (import breadline)
  (import breadline-scheme-completion)
  (history-file (format "~a/.csi_history" (get-environment-variable
"HOME")))
  (stifle-history! 1)
  (completer-word-break-characters-set! "\"\'`;|(")
  (completer-set! scheme-completer)
  (basic-quote-characters-set! "\"|")
  (variable-bind! "blink-matching-paren" "on")
  (paren-blink-timeout-set! 20)
  (current-input-port (make-readline-port
 (repl)  ;; added this
)
 . . .

(*) What I mean by rollover is this:
#;> (publis
;; fills out from internal symbols and the publish is filled out. Then I'd
like to enter a filename:
#;> (publish "examples/a
;; if breadline doesn't find an internal symbol "examples/a" then it could
look at the filesystem and list the files that match.

On Fri, Jan 31, 2020 at 4:30 AM Matt Welland  wrote:

> For linenoise I was not able to get saving history to work.
>
> I'm having trouble getting breadline to install on Ubuntu on this old
> laptop. I have libreadline-dev installed but when I do chicken-install
> breadline I get:
>
> matt@matt-HP-EliteBook-6930p:~$ chicken-install breadline
> building breadline
>/home/matt/.cache/chicken-install/breadline/build-breadline -host -D
> compiling-extension -J -s -regenerate-import-libraries -setup-mode -I
> /home/matt/.cache/chicken-install/breadline -C
> -I/home/matt/.cache/chicken-install/breadline -O2 -d1 breadline.scm -o
> /home/matt/.cache/chicken-install/breadline/breadline.so
> Package readline was not found in the pkg-config search path.
> Perhaps you should add the directory containing `readline.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'readline' found
> Package readline was not found in the pkg-config search path.
> Perhaps you should add the directory containing `readline.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'readline' found
> Package readline was not found in the pkg-config search path.
> Perhaps you should add the directory containing `readline.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'readline' found
> Package readline was not found in the pkg-config search path.
> Perhaps you should add the directory containing `readline.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'readline' found
> /usr/bin/ld: cannot find -lncurses
> collect2: error: ld returned 1 exit status
>
> Error: shell command terminated with non-zero exit status 256: 'gcc'
> '/home/matt/.cache/chicken-install/breadline/breadline.o' -o
> '/home/matt/.cache/chicken-install/breadline/breadline.so' -shared
> -lreadline -lncurses -L/opt/chicken/5.1.0_WW45/lib
> -Wl,-R/opt/chicken/5.1.0_WW45/lib -lchicken -lm -ldl
>/home/matt/.cache/chicken-install/breadline/build-breadline
> -regenerate-import-libraries -setup-mode -static -I
> /home/matt/.cache/chicken-install/breadline -emit-link-file
> /home/matt/.cache/chicken-install/breadline/breadline.link -host -D
> compiling-extension -c -unit breadline -D compiling-static-extension -C
> -I/home/matt/.cache/chicken-install/breadline -O2 -d1 breadline.scm -o
> /home/matt/.cache/chicken-install/breadline/breadline.static.o
> Package readline was not found in the pkg-config search path.
> Perhaps you should add the directory containing `readline.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'readline' found
> Package readline was not found in the pkg-config search path.
> Perhaps you should add the directory containing `readline.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'readline' found
> Package readline was not found in the pkg-config search path.
> Perhaps you should add the directory containing `readline.pc'
> to the PKG_CONFIG_PATH environment variable
> No pac

Re: How to get a useful repl with Chicken 5?

2020-01-31 Thread Matt Welland
For linenoise I was not able to get saving history to work.

I'm having trouble getting breadline to install on Ubuntu on this old
laptop. I have libreadline-dev installed but when I do chicken-install
breadline I get:

matt@matt-HP-EliteBook-6930p:~$ chicken-install breadline
building breadline
   /home/matt/.cache/chicken-install/breadline/build-breadline -host -D
compiling-extension -J -s -regenerate-import-libraries -setup-mode -I
/home/matt/.cache/chicken-install/breadline -C
-I/home/matt/.cache/chicken-install/breadline -O2 -d1 breadline.scm -o
/home/matt/.cache/chicken-install/breadline/breadline.so
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
/usr/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status

Error: shell command terminated with non-zero exit status 256: 'gcc'
'/home/matt/.cache/chicken-install/breadline/breadline.o' -o
'/home/matt/.cache/chicken-install/breadline/breadline.so' -shared
-lreadline -lncurses -L/opt/chicken/5.1.0_WW45/lib
-Wl,-R/opt/chicken/5.1.0_WW45/lib -lchicken -lm -ldl
   /home/matt/.cache/chicken-install/breadline/build-breadline
-regenerate-import-libraries -setup-mode -static -I
/home/matt/.cache/chicken-install/breadline -emit-link-file
/home/matt/.cache/chicken-install/breadline/breadline.link -host -D
compiling-extension -c -unit breadline -D compiling-static-extension -C
-I/home/matt/.cache/chicken-install/breadline -O2 -d1 breadline.scm -o
/home/matt/.cache/chicken-install/breadline/breadline.static.o
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
Package readline was not found in the pkg-config search path.
Perhaps you should add the directory containing `readline.pc'
to the PKG_CONFIG_PATH environment variable
No package 'readline' found
   /opt/chicken/5.1.0_WW45/bin/csc -setup-mode -s -host -I
/home/matt/.cache/chicken-install/breadline -C
-I/home/matt/.cache/chicken-install/breadline -O2 -d0 breadline.import.scm
-o /home/matt/.cache/chicken-install/breadline/breadline.import.so
   /opt/chicken/5.1.0_WW45/bin/csc -host -D compiling-extension -J -s
-regenerate-import-libraries -setup-mode -I
/home/matt/.cache/chicken-install/breadline -C
-I/home/matt/.cache/chicken-install/breadline -O2 -d1
breadline-scheme-completion.scm -o
/home/matt/.cache/chicken-install/breadline/breadline-scheme-completion.so
   /opt/chicken/5.1.0_WW45/bin/csc -regenerate-import-libraries -setup-mode
-static -I /home/matt/.cache/chicken-install/breadline -emit-link-file
/home/matt/.cache/chicken-install/breadline/breadline-scheme-completion.link
-host -D compiling-extension -c -unit breadline-scheme-completion -D
compiling-static-extension -C -I/home/matt/.cache/chicken-install/breadline
-O2 -d1 breadline-scheme-completion.scm -o
/home/matt/.cache/chicken-install/breadline/breadline-scheme-completion.static.o
   /opt/chicken/5.1.0_WW45/bin/csc -setup-mode -s -host -I
/home/matt/.cache/chicken-install/breadline -C
-I/home/matt/.cache/chicken-install/breadline -O2 -d0
breadline-scheme-completion.import.scm -o
/home/matt/.cache/chicken-install/breadline/
breadline-scheme-completion.import.so
  installing breadline
install: cannot stat
'/home/matt/.cache/chicken-install/breadline/breadline.so': No such file or
directory

Error: shell command terminated with nonzero exit code
256
"sh /home/matt/.cache/chicken-install/breadline/breadline.install.sh"



On Fri, Jan 31, 2020 at 12:21 AM Vasilij Schneidermann 
wrote:

> Hello Matt,
>
> > I've read the docs on linenoise and breadline but I'm not seeing how to
> get
> > a useful editable repl.
> >
> > Any pointers or suggestions would be appreciated.
>
> I've developed breadline.  Its wiki page has an examples section which
> shows how to create a custom REPL for programs 

Re: How to get a useful repl with Chicken 5?

2020-01-30 Thread Matt Welland
Hi Daniel, that is a good suggestion. rlwrap it is for today. Still, it
would be nice to have something that I can build into my apps as I did for
Chicken 4. Thanks.

On Thu, Jan 30, 2020 at 11:29 AM Daniel Ortmann 
wrote:

> How about: rlwrap csi
>
> It has been good to me, saving the history into ~/.csi_history
>
> On 1/30/20 12:01 PM, Matt Welland wrote:
>
> Line editing and saving history make using a repl much more productive for
> me. With chicken 4 I was able to get a useful repl with something like this
> sequence of calls:
>
> (import extras) ;; might not be needed?
> (import readline)
> (import apropos)
> ;; my imports here ...
> (install-history-file (get-environment-variable "HOME") ".some_history")
> (current-input-port (make-readline-port "someprog> "))
> (repl)
>
> I've tried linenoise but don't see how to save the history:
>
> (import linenoise)
> (set-history-length! 300)
> (load-history-from-file historyf)
> (current-input-port (make-linenoise-port))
> (repl)
> ;; (save-history-to-file historyf) ;; doesn't work :(
>
> I've read the docs on linenoise and breadline but I'm not seeing how to
> get a useful editable repl.
>
> Any pointers or suggestions would be appreciated.
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


How to get a useful repl with Chicken 5?

2020-01-30 Thread Matt Welland
Line editing and saving history make using a repl much more productive for
me. With chicken 4 I was able to get a useful repl with something like this
sequence of calls:

(import extras) ;; might not be needed?
(import readline)
(import apropos)
;; my imports here ...
(install-history-file (get-environment-variable "HOME") ".some_history")
(current-input-port (make-readline-port "someprog> "))
(repl)

I've tried linenoise but don't see how to save the history:

(import linenoise)
(set-history-length! 300)
(load-history-from-file historyf)
(current-input-port (make-linenoise-port))
(repl)
;; (save-history-to-file historyf) ;; doesn't work :(

I've read the docs on linenoise and breadline but I'm not seeing how to get
a useful editable repl.

Any pointers or suggestions would be appreciated.
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Multi-platform app development options for chicken?

2020-01-21 Thread Matt Welland
Thanks Jörg, I was not aware of lambanative. It looks really interesting. I
will explore it.

On Mon, Jan 20, 2020 at 3:46 AM Jörg F. Wittenberger <
joerg.wittenber...@softeyes.net> wrote:

> Hi Matt,
>
> this is what I currently do to this end:
>
> Since a while I'm using lambdanative.  It makes it easy for me to build
> APKs.  Supports iOS too, though I never tried.  I make a Chicken build
> for it (not avail upstream but I'll make it avail if anyone would like
> it). Chicken running in a pthread talking to the Gambit pthread from
> lambdanative via abstract socket.  To make it easier to control native
> Android GUI elements, I ported the original JScheme (and very
> slightly extended it, e.g., to enable contructors to dispatch on
> argument types)[1].
>
> The only thing I'm currently really, really missing is a way to have
> select(2)able fd's for pthread-to-pthread communication under Windows.
>
> My verdict: great it all you need is to quickly glue some GUI
> together.  However: IUp is much more capable, but also harder
> to use.
>
> Complex user interfaces I rather do as Web applications.  The server in
> Chicken on the loopback interface the GUI part (on Android) is the
> webkit widget from Android, controled via LNjScheme.  (On Linux/Windows
> it starts a Webbrowser.  iOS I did not tryso far.)
>
> Best
>
> /Jörg
>
> [1]:
>
> https://github.com/part-cw/lambdanative/tree/master/apps/DemoAndroidLNjScheme
>
>
> On Sun, 19 Jan 2020 11:57:26 -0700
> Matt Welland  wrote:
>
> > Currently I've got windows and Linux covered  and I'm very happy with
> > the Chicken+IUP combo (although getting that to work on old platforms
> > with Chicken 5 is a challenge). However I need to try again for
> > Android. The SDL build worked and has great potential for games but
> > not so much for regular apps.
> >
> > My thought is to learn Javascript and ramp up on something like
> > Native ( https://www.nativescript.org) which begs the question, is it
> > feasible to use Chicken as part of a Native app such that the core of
> > the app is Chicken and the interface is Javascript/Native?
> >
> > I'm looking for opinions and comments from Chicken users as to how you
> > would approach this problem.
> >
> > Thanks.
> > --
> > Complexity is your enemy. Any fool can make something complicated.
> > It is hard to keep things simple. - Richard Branson.
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Multi-platform app development options for chicken?

2020-01-19 Thread Matt Welland
Currently I've got windows and Linux covered  and I'm very happy with the
Chicken+IUP combo (although getting that to work on old platforms with
Chicken 5 is a challenge). However I need to try again for Android. The SDL
build worked and has great potential for games but not so much for regular
apps.

My thought is to learn Javascript and ramp up on something like Native (
https://www.nativescript.org) which begs the question, is it feasible to
use Chicken as part of a Native app such that the core of the app is
Chicken and the interface is Javascript/Native?

I'm looking for opinions and comments from Chicken users as to how you
would approach this problem.

Thanks.
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: csirc when transitioning from chicken 4 to 5

2020-01-15 Thread Matt Welland
Perfect! I was not aware of cond-expand. Thanks!

On Wed, Jan 15, 2020 at 11:28 AM Peter Bex  wrote:

> On Wed, Jan 15, 2020 at 11:00:02AM -0700, Matt Welland wrote:
> > I have not been able to figure out how to make a .csirc that works for
> both
> > chicken 4 and 5.
> >
> > (import (chicken platform)) is not legal for chicken 4 but
> > (chicken-version) is not available in chicken 5 until you've done the
> > import. Chicken and egg :)
>
> Try cond-expand;
>
> (cond-expand
>   (chicken-5
> (import (chicken platform)))
>   (chicken-4
> (use extras)))
>
> Cheers,
> Peter
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


csirc when transitioning from chicken 4 to 5

2020-01-15 Thread Matt Welland
I have not been able to figure out how to make a .csirc that works for both
chicken 4 and 5.

(import (chicken platform)) is not legal for chicken 4 but
(chicken-version) is not available in chicken 5 until you've done the
import. Chicken and egg :)

How about having chicken 5 csi load ".csirc5"?

Thanks
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: register-compiled-module performance

2020-01-11 Thread Matt Welland
On Sat, Jan 11, 2020 at 8:47 AM megane  wrote:

>
> Matt Welland  writes:
>
> > With Chicken 4 I'm seeing a pretty high impact on startup time from
> > (declare (uses foo.import)). I think that will be less of a problem when
> I
> > switch from using * for my export lists to only the procedures that need
> to
> > be exported. However I was very surprised to see readline in the top
> three
> > when I ran a profile. I'm thinking somehow I've created a genuine problem
> > but I've no idea what to look for.
> >
> > Suggestions?
>
> I'd guess this is from the O(n^2) behaviour of merge-se in modules.scm.
> This has been fixed in C5.
>

Ok, that is good to know. I'll not worry about startup time for now and
will put the energy into getting to chicken 5. Thanks.


> Here's a version for C4 that I used to use:
>
> (define (merge-se . ses*) ; later occurrences take precedence to earlier
> ones
>   (let ([table (make-hash-table)]
> [rses (reverse ses*)])
> (let loop ([ses (cdr rses)]
>[last-se #f]
>[se2 (car rses)])
>   (cond
>[(null? ses) se2]
>[(eq? last-se (car ses))
> (loop (cdr ses) last-se se2)]
>[(null? (car ses))
> (loop (cdr ses) last-se se2)]
>[(not last-se)
> (for-each (lambda (e) (hash-table-set! table (car e) #t)) se2)
> (loop ses se2 se2)]
>[else
> (let lp ([se (car ses)]
>  [se2 se2])
>   (cond
>[(null? se) (loop (cdr ses) (car ses) se2)]
>[(hash-table-exists? table (caar se))
> (lp (cdr se) se2)]
>[else
> (hash-table-set! table (caar se) #t)
> (lp (cdr se) (cons (car se) se2))]))]
> >
> > Note - migration is a work in progress but we are not quite at a point
> > where I can test this in Chicken 5.
> >
> > procedure  calls
> >  seconds  average  percent
> >
> ---
> >   29
> >  1.8800.064   12.384
> > megamod.import.scm:71: ##sys#register-compiled-module  1
> >  1.6601.660   10.935
> > readline.scm:74: ##sys#register-compiled-module1
> >  1.5801.580   10.408
> > runsmod.import.scm:43: ##sys#register-compiled-module  1
> >  1.3501.3508.893
>
>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


register-compiled-module performance

2020-01-11 Thread Matt Welland
With Chicken 4 I'm seeing a pretty high impact on startup time from
(declare (uses foo.import)). I think that will be less of a problem when I
switch from using * for my export lists to only the procedures that need to
be exported. However I was very surprised to see readline in the top three
when I ran a profile. I'm thinking somehow I've created a genuine problem
but I've no idea what to look for.

Suggestions?

Note - migration is a work in progress but we are not quite at a point
where I can test this in Chicken 5.

procedure  calls
 seconds  average  percent
---
  29
 1.8800.064   12.384
megamod.import.scm:71: ##sys#register-compiled-module  1
 1.6601.660   10.935
readline.scm:74: ##sys#register-compiled-module1
 1.5801.580   10.408
runsmod.import.scm:43: ##sys#register-compiled-module  1
 1.3501.3508.893


--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: Tidy way to test and set when using test egg?

2020-01-10 Thread Matt Welland
Hi Kristian,

The test egg does a great job of making it easy to hone in on the root
cause of a problem but I thought to get that benefit the call must be done
in the context of the test macro. Maybe I'd get the feedback I want from
using test-group. I've not used test-group much.

csi> (test-group "foo" (define res (- #f 2))(test 1 res))

Warning: error in group outside of tests

Error: (-) bad argument type: #f
1 test completed in 0.0 seconds.
1 error (100%).
0 out of 1 (0%) tests passed.
-- done testing foo
--

Maybe that addresses the problem I was trying to solve. I'll try it.

On Fri, Jan 10, 2020 at 8:41 AM Kristian Lein-Mathisen <
kristianl...@gmail.com> wrote:

>
> Hi Matt,
>
> So you want to keep the result for more upcoming test? Why? Just curious.
>
> I've for the most part been content with:
>
> (test-group
>  "-"
>   (define res (- 2 1))
>   (test 1 res)
>  (print "res: " res) )
> ;; res out of scope here (good thing, no?)
>
> K.
>
>
>
> On Fri, Jan 10, 2020, 16:22 John Cowan  wrote:
>
>> Mixing definitions and expressions in a block isn't actually legal
>> Scheme, though it does work in Chicken.  All defines are supposed to come
>> first and all expressions afterwards.  Since the test library is shared
>> with Chibi, and since Chibi doesn't allow this extension, I can't see
>> adding this to the library.
>>
>> On Fri, Jan 10, 2020 at 10:18 AM Matt Welland 
>> wrote:
>>
>>> I find myself doing stuff like this very often when writing tests using
>>> the test egg:
>>>
>>> ;; A trivial example where  the function under test is "-"
>>> (define data #f)
>>> (test #f 1 (let ((res (- 2 1)))(set! data res) res))
>>>
>>> I'd really prefer to do something like:
>>>
>>> (test-and-define data #f 1 (- 2 1))
>>>
>>> But the closest I could get was:
>>>
>>> (define-syntax test-and-set
>>>   (syntax-rules ()
>>> ((_ name arg1 arg2 body ...)
>>>  (test arg1 arg2
>>>   (let ((res (begin body ...)))
>>> (set! name res)
>>> res
>>> )
>>>
>>> So I can do:
>>>
>>> (define data #f)
>>> (test-and-set data #f 1 (- 2 1))
>>>
>>> Questions:
>>>
>>> 1. Is there a generally better way to test and gather the result for use
>>> in downstream tests?
>>>
>>> 2. Is there a way to write a macro that can create the toplevel binding?
>>>
>>>
>>> --
>>> --
>>> Complexity is your enemy. Any fool can make something complicated.
>>> It is hard to keep things simple. - Richard Branson.
>>>
>>

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Tidy way to test and set when using test egg?

2020-01-10 Thread Matt Welland
I find myself doing stuff like this very often when writing tests using the
test egg:

;; A trivial example where  the function under test is "-"
(define data #f)
(test #f 1 (let ((res (- 2 1)))(set! data res) res))

I'd really prefer to do something like:

(test-and-define data #f 1 (- 2 1))

But the closest I could get was:

(define-syntax test-and-set
  (syntax-rules ()
((_ name arg1 arg2 body ...)
 (test arg1 arg2
  (let ((res (begin body ...)))
(set! name res)
res
)

So I can do:

(define data #f)
(test-and-set data #f 1 (- 2 1))

Questions:

1. Is there a generally better way to test and gather the result for use in
downstream tests?

2. Is there a way to write a macro that can create the toplevel binding?


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: It would be nice if glob "/*/*" worked

2019-11-29 Thread Matt Welland
On Fri, Nov 29, 2019 at 2:59 AM Tim via  wrote:

> Hi Matt,
>
> Matt Welland writes:
> > Supporting glob patterns at any level would be handy. I started to
> > implement something which I've included below but before I complete it:
>
> I like this idea too.  Just one thing: would it be possible to use the
> double-asterisk ** instead of a single * to represent the directory
> matching portion?  I.e.  /subdir/**/*.txt would find any file with a
> name ending in .txt in any directory below /subdir. This is a pretty
> common syntax for recursive globbing I think; at least I've seen it in
> zsh, python and a few other places.
>

I don't understand the use or benefit of using ** for directories. Bash,
perl and python all expand "*/c*" as I would expect. Can you send a pointer
to the usage you are referring to?


>
> Tim
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: It would be nice if glob "/*/*" worked

2019-11-21 Thread Matt Welland
Improved version:

(define (multi-glob pathspec)
  (let* ((path-parts (intersperse (string-split pathspec "/" #t) "/")))
(if (null? path-parts)
'()
(let loop ((parts  (cdr path-parts))
  (result (let ((p (car path-parts)))
(if (string=? p "")
'("/")
(glob (car path-parts))
 (if (null? parts)
 result
 (let* ((part (car parts))
(rem  (cdr parts)))
(loop rem
 (apply append
(map (lambda (curr)
   (let ((new (string-append curr part)))
 (cond
  ((and (directory? curr)(file-read-access? curr))
(glob new))
  ((member part '("." ".." "/")) new)
  (else '()
 result)

On Thu, Nov 21, 2019 at 3:25 AM Matt Welland  wrote:

> Supporting glob patterns at any level would be handy. I started to
> implement something which I've included below but before I complete it:
>
> 1. Is there a multi-level glob implementation in some other egg? The glob
> that comes with posix only handles the pattern in the top level. I didn't
> find anything in searching the eggs.
>
> 2. Does anyone have an implementation they can share?
>
> 3. If I complete the implementation below can it be added to posix or
> should I create an egg?
>
> (define (multi-glob pathspec)
>   (let* ((path-parts (string-split pathspec "/" #t)))
> (if (null? path-parts)
> '()
> (let loop ((parts  (cdr path-parts))
>(result (let ((p (car path-parts)))
>  (if (string=? p "")
>  '("/")
>  (glob (car path-parts))
>   (if (null? parts)
>   result
>   (let* ((part (car parts))
>  (rem  (cdr parts)))
> (loop rem
>   (apply append
>  (map (lambda (curr)
> (let ((new (string-append curr "/"
> part)))
>   (if (and (directory? curr)
>(file-read-access? curr))
>   (glob new)
>   '(
>   result)
> ~
>
> ~
>
> --
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.
>


-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


It would be nice if glob "/*/*" worked

2019-11-21 Thread Matt Welland
Supporting glob patterns at any level would be handy. I started to
implement something which I've included below but before I complete it:

1. Is there a multi-level glob implementation in some other egg? The glob
that comes with posix only handles the pattern in the top level. I didn't
find anything in searching the eggs.

2. Does anyone have an implementation they can share?

3. If I complete the implementation below can it be added to posix or
should I create an egg?

(define (multi-glob pathspec)
  (let* ((path-parts (string-split pathspec "/" #t)))
(if (null? path-parts)
'()
(let loop ((parts  (cdr path-parts))
   (result (let ((p (car path-parts)))
 (if (string=? p "")
 '("/")
 (glob (car path-parts))
  (if (null? parts)
  result
  (let* ((part (car parts))
 (rem  (cdr parts)))
(loop rem
  (apply append
 (map (lambda (curr)
(let ((new (string-append curr "/"
part)))
  (if (and (directory? curr)
   (file-read-access? curr))
  (glob new)
  '(
  result)
~

~

-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


Re: How to solve this import in an eval problem?

2019-11-12 Thread Matt Welland
That works. Thanks!

On Tue, Nov 12, 2019, 1:11 AM Peter Bex  wrote:

> On Mon, Nov 11, 2019 at 10:43:44PM -0700, Matt Welland wrote:
> > I'm working toward porting my various projects to chicken 5 and for one
> > project I first want to convert a bunch of compilation units to modules.
> > This has mostly gone well but I'm stuck on exposing module code in an
> eval.
> > Without modules this worked great as everything was visible to the eval.
> >
> > It actually works ok if I run in the directory where the .import.scm file
> > lives but fails when the exe is run from a different directory.
>
> Hi Matt,
>
> That makes sense; to import a module at run-time, that module needs to be
> available, so it must be in the module search path (which is the chicken
> lib
> dir and the current directory).
>
> I've tried your test case, and tweaked it a bit to make it work on C5.
> The way to make this work without requiring the module to be in the search
> path would be to bake it into the executable.
>
> To do that, you can compile the import library into a .o file and include
> it in the final binary, much like you did with the main code of a.scm.
>
> I added this recipe to the Makefile:
>
> a.import.o: a.import.scm a.o
> csc -unit a.import -c a.import.scm -o $*.o
>
> And then I added (declare (uses a.import)) to the top of c.scm to ensure
> that the import library's toplevel gets invoked.  Also, add dependencies
> as needed for Make to do its thing.
>
> This way, the module registration is also done inside the executable, and
> because the module is already known, the run-time import won't cause it to
> be looked up at runtime.
>
> Cheers,
> Peter
>


How to solve this import in an eval problem?

2019-11-11 Thread Matt Welland
I'm working toward porting my various projects to chicken 5 and for one
project I first want to convert a bunch of compilation units to modules.
This has mostly gone well but I'm stuck on exposing module code in an eval.
Without modules this worked great as everything was visible to the eval.

It actually works ok if I run in the directory where the .import.scm file
lives but fails when the exe is run from a different directory.

I put together a testcase:

https://www.kiatoa.com/cgi-bin/fossils/megatest/uv/configf-testing.tar.gz

run make and then ./c in the directory where it was compiled and it works.
Run from another directory and the module "a" is not found.
=example
mkdir tmp;cd tmp
../c
Can I run stuff from module "a":
/var/tmp

Run the non-modularized version

Error: (import) during expansion of (import ...) - cannot import from
undefined module: a
...
==end example===
Thanks in advance for any help.
-- 
--
Complexity is your enemy. Any fool can make something complicated.
It is hard to keep things simple. - Richard Branson.


[Chicken-users] blob-utils egg fails to install on mingw-msys32

2019-09-15 Thread Matt Welland
  copy "blob-hexadecimal.types"
"c:\chicken-iup\lib\chicken\8\blob-hexadecimal.types"
1 file(s) copied.
  "c:\chicken-iup\bin\csc" -feature compiling-extension -setup-mode
 pack-integer.scm -shared -optimize-leaf-routines -inline -output-file
pack-integer.so -emit-import-library pack-integer -emit-type-file
pack-integer.types -scrutinize -specialize -optimize-level 3 -debug-level 1
-no-procedure-checks
pack-integer.c: In function 'f_1357':
pack-integer.c:1085:8: warning: implicit declaration of function 'stub27';
did you mean 'stub329'? [-Wimplicit-function-declaration]
 1085 | av2[1]=stub27(C_SCHEME_UNDEFINED,t5,t6,t7);
  |^~
  |stub329
C:/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.2.0/../../../../i686-w64-mingw32/bin/ld.exe:
pack-integer.o:pack-integer.c:(.text+0x26e4): undefined reference to
`stub27'
collect2.exe: error: ld returned 1 exit status

Error: shell command terminated with non-zero exit status 1: ""gcc"
"pack-integer.o" -o "pack-integer.so" -Wl,--enable-auto-import -shared
-Lc:\chicken-iup\lib -Lc:\chicken-iup\lib\ -lchicken -lm -lws2_32"

Error: shell command failed with nonzero exit status 1:

  ""c:\chicken-iup\bin\csc" -feature compiling-extension -setup-mode
 pack-integer.scm -shared -optimize-leaf-routines -inline -output-file
pack-integer.so -emit-import-library pack-integer -emit-type-file
pack-integer.types -scrutinize -specialize -optimize-level 3 -debug-level 1
-no-procedure-checks"


Error: shell command terminated with nonzero exit code
70
"\"\"c:\\chicken-iup\\bin\\csi\" -bnq -setup-mode -e \"(require-library
setup-ap...

--
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 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


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

2019-07-19 Thread Matt Welland
There are three interfaces on the host but hostinfo-addresses returns only
one. I think this may be a bug.

I'm using chicken 4.13 and see the same behavior on Ubuntu 18.04 and SLES11.

csi> (hostinfo-addresses (hostname->hostinfo (get-host-name)))
#(#u8(10 27 44 127))

Sometimes I get 127.0.0.1, sometimes I get one of the external interfaces.

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

Thanks.
--
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] I'm trying to use the cairo egg with the sdl2 egg but not making much progress. An

2019-01-29 Thread Matt Welland
On Tue, 2019-01-29 at 16:09 +0100, Christian Kellermann wrote:
> * Matt Welland  [190129 05:44]:
> > With this I was able to get a sample page up. Thanks!
> > 
> > If Christian Kellermann, owner of cairo, sees this and would like
> > to
> > add an sdl2 demo to the cairo egg please let me know.
> 
> It seems like I am the owner now :)

Hmmm... did I misread the docs? Ah, I see I found your name by an
example and didn't look further. Well, thanks for helping :)

Attached is my hacked up example for cairo on sdl2. I hope it is of
use.

> Sure, why not, send it this way!
> 
> Thank you Matt!
> 
> Kind regards,
> 
> Christian
> 
; A test program for the Cairo bindings
; Michael Bridgen 
; Tony Garnock-Jones 

(use posix)
(use (prefix sdl2 sdl2:)
 miscmacros)
(use cairo)
(import chicken scheme foreign)

	
;; From:	ko...@upyum.com
;;
(define (sdl-colorspace->cairo bytes-per-pixel)
  (case (* 8 bytes-per-pixel)
((8) CAIRO_FORMAT_A8)
((24) CAIRO_FORMAT_RGB24)
((32) CAIRO_FORMAT_ARGB32)
(else CAIRO_FORMAT_ARGB32)))

(define (create-sdl2-cairo-context window)
  (let*-values
(((width height) (sdl2:window-size window))
 ((window-surface) (sdl2:window-surface window))
 ((cairo-surface)
  (cairo-image-surface-create-for-data
(sdl2:surface-pixels-raw window-surface)
(sdl-colorspace->cairo
  (sdl2:pixel-format-bytes-per-pixel (sdl2:surface-format window-surface)))
width
height
(sdl2:surface-pitch window-surface
(cairo-create cairo-surface)))

;;; Draw (or redraw) the entire scene. It would be more efficient to
;;; only redraw the parts of the scene that have changed, but since
;;; this is just a demo program we don't want to get too complex.
(define (draw-scene!)
  (let ((window-surf (sdl2:window-surface window)))
;; Clear the whole screen using a blue background color
(sdl2:fill-rect! window-surf #f (sdl2:make-color 0 80 160))
;; Draw the smileys
;; (draw-obj! smiley2 window-surf)
;; (draw-obj! smiley1 window-surf)
;; Refresh the screen
(sdl2:update-window-surface! window)))




#;(sdl-init SDL_INIT_EVERYTHING)

(define maxx 640)
(define maxy 480)

;;; Initialize the parts of SDL that we need.
(sdl2:set-main-ready!)
(sdl2:init! '(video events joystick))

;; Automatically call sdl2:quit! when program exits normally.
(on-exit sdl2:quit!)

;; Call sdl2:quit! and then call the original exception handler if an
;; unhandled exception reaches the top level.
(current-exception-handler
 (let ((original-handler (current-exception-handler)))
   (lambda (exception)
 (sdl2:quit!)
 (original-handler exception


(printf "Compiled with SDL version ~A~N" (sdl2:compiled-version))
(printf "Running with SDL version ~A~N" (sdl2:current-version))
(printf "Using sdl2 egg version ~A~N" (sdl2:egg-version))

;;; Create a new window.
(define window
  (sdl2:create-window!
   "SDL Basics" ; title
   'centered  100   ; x, y
   800  600 ; w, h
   '(shown resizable))) ; flags

;;; Restrict the window from being made too small or too big, for no
;;; reason except to demonstrate this feature.
(set! (sdl2:window-maximum-size window) '(1024 768))
(set! (sdl2:window-minimum-size window) '(200 200))

(printf "Window position: ~A, size: ~A, max size: ~A, min size: ~A~N"
(receive (sdl2:window-position window))
(receive (sdl2:window-size window))
(receive (sdl2:window-maximum-size window))
(receive (sdl2:window-minimum-size window)))

(define c (create-sdl2-cairo-context window)) ;; (cairo-create is))

(cairo-set-source-rgba c 1 1 0 1)

(cairo-set-line-width c 20)

(cairo-new-path c)
(cairo-set-line-cap c CAIRO_LINE_CAP_BUTT)
(cairo-move-to c 10 10)
(cairo-line-to c 10 80)

(cairo-stroke c)

(cairo-new-path c)
(cairo-set-line-cap c CAIRO_LINE_CAP_ROUND)
(cairo-move-to c 50 10)
(cairo-line-to c 50 80)
(cairo-stroke c)

(cairo-new-path c)
(cairo-set-line-cap c CAIRO_LINE_CAP_SQUARE)
(cairo-move-to c 90 10)
(cairo-line-to c 90 80)
(cairo-stroke c)

(cairo-set-line-join c CAIRO_LINE_JOIN_BEVEL)
(define (tri)
  (cairo-new-path c)
  (cairo-move-to c 110 110)
  (cairo-line-to c 110 190)
  (cairo-line-to c 190 190)
  (cairo-close-path c))

(cairo-set-line-width c 10)
(tri)
(cairo-set-source-rgb c 0 1 1)
(cairo-stroke c)
(tri)
(cairo-set-source-rgb c 1 0 1)
(cairo-fill c)

(define (radians degrees)
  (* 3.142 (/ degrees 180)))

(define (sector x y d)
  (cairo-new-path c)
  (cairo-move-to c x y)
  (cairo-line-to c (+ x d) y)
  (cairo-line-to c (+ x d) (+ y d))
  (cairo-arc c (+ x d) y d (radians 90) (radians 180)))

(sector 240 240 60)
(cairo-set-line-join c CAIRO_LINE_JOIN_MITER)
(cairo-set-source-rgb c 1 0.5 0)
(cairo-stroke c)

(cairo-reset-clip c)
(cairo-new-path c)
(cairo-rectangle c 30 240 70 300)
(ca

Re: [Chicken-users] I'm trying to use the cairo egg with the sdl2 egg but not making much progress. An

2019-01-28 Thread Matt Welland
With this I was able to get a sample page up. Thanks!

If Christian Kellermann, owner of cairo, sees this and would like to
add an sdl2 demo to the cairo egg please let me know.

On Mon, 2019-01-28 at 08:12 +0100, ko...@upyum.com wrote:
> Matt Welland  wrote:
> > Assuming it is possible, I'd like to use cairo to draw on sdl2
> > surfaces. I've read the demos and other available code but I'm not
> > yet
> > seeing how to bolt them together. Does anyone have some example
> > code
> > they can share to help me get going?
> 
> It is absolutly possible! I’ve done it countless times, with surfaces
> as well as textures (in the renderers API).
> 
> Here is the code I’ve wrote to use cairo on surfaces:
> It’s old code and I’ve not tested it in a whire though.
> 
> (define (sdl-colorspace->cairo bytes-per-pixel)
>   (case (* 8 bytes-per-pixel)
> ((8) CAIRO_FORMAT_A8)
> ((24) CAIRO_FORMAT_RGB24)
> ((32) CAIRO_FORMAT_ARGB32)
> (else CAIRO_FORMAT_ARGB32)))
> 
> (define (create-sdl2-cairo-context window)
>   (let-values
> (((width height) (window-size window))
>  ((window-surface) (window-surface window))
>  ((cairo-surface)
>   (cairo-image-surface-create-for-data
> (surface-pixels-raw window-surface)
> (sdl-colorspace->cairo
>   (pixel-format-bytes-per-pixel (surface-format window-
> surface)))
> width
> height
> (surface-pitch window-surface
> (cairo-create cairo-surface)))


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


[Chicken-users] I'm trying to use the cairo egg with the sdl2 egg but not making much progress. Any example code out there?

2019-01-27 Thread Matt Welland
Assuming it is possible, I'd like to use cairo to draw on sdl2
surfaces. I've read the demos and other available code but I'm not yet
seeing how to bolt them together. Does anyone have some example code
they can share to help me get going?

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


Re: [Chicken-users] Has hypergiant been used on Android?

2019-01-20 Thread Matt Welland
On Mon, 2019-01-21 at 01:12 +0100, Kooda wrote:
> On 1/21/19 12:15 AM, Matt Welland wrote:
> > 
> > Regarding hypergiant, after many tries it did install in the docker
> > but 
> > I have not been able to get the demo to work on android. I'll
> > report 
> > back if I get it working.
> Don’t try too hard.
> 
> I’m taking over the maintenance of the Hypergiant & cie eggs and
> making 
> it work on OpenGL ES platforms is on my top priority list. For now
> many 
> things are just not designed to work and will require quite a lot of 
> changes (for example in glls).
> 
> I’ll announce here when new versions are available. :)

good to know, thanks!

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

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


Re: [Chicken-users] Has hypergiant been used on Android?

2019-01-20 Thread Matt Welland
On Mon, 2019-01-07 at 22:52 -0700, Matt Welland wrote:
> Thanks Kristian, I'll give the docker builder a try!
> 
> On Mon, 2019-01-07 at 18:01 +0300, Kristian Lein-Mathisen wrote:
> > 
> > Hi Matt,
> > 
> > I don't know if anyone has tried Hypergiant, but I've been playing
> > around with SDL2:
> > 
> > https://github.com/chicken-mobile/chicken-sdl2-android-builder
> > 
> > The Android tooling makes most things extremely painful. The
> > Dockerfile instructions for SDL might be of help to you if you
> > choose to experiment yourself.
Regarding the chicken-sdl2-android docker build process:
The docker build was very helpful. It seems I had tried it some time in
the past as it was already installed. FYI, I was not able to build the
docker on an Ubuntu 18.04 system, but I was able to "docker export ..."
and "docker import ..." to transfer it. I have made a tar gz of the
ready-to-use docker under IPFS. If someone wishes to try the docker,
installing IPFS and running something like the following command might
be easier than running the builder (although probably not any faster):
ipfs cat /ipfs/QmTBTajLA8BmT5CGzEYczEgzJPzDCpyRs73hAEa5isaYGJ | gunzip
| docker import
Regarding hypergiant, after many tries it did install in the docker but
I have not been able to get the demo to work on android. I'll report
back if I get it working.
Thanks Kristian for all the effort you put into the android chicken-
sdl2 docker. 
> > Best of luck!
> > K.
> > 

> > On Sun, Jan 6, 2019, 02:42 Matt Welland  > > >From 
> > the eggs page it looks like hypergiant should work on android. Can
> > > 
> > > anyone report sucessfully doing so? Is the work flow for deploying on
> > > 
> > > android documented or tested?
> > > 

> > > 
> > > I'm considering using hypergiant instead of godot for a project.
> > > 
> > > Deploying on Android is a primary goal and being able to use Chicken
> > > 
> > > would be a welcome boon. Any insight or advice appreciated.
> > > 

> > > 
> > > Thanks.
> > > 

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

> > 

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


Re: [Chicken-users] Has hypergiant been used on Android?

2019-01-07 Thread Matt Welland
Thanks Kristian, I'll give the docker builder a try!
On Mon, 2019-01-07 at 18:01 +0300, Kristian Lein-Mathisen wrote:
> 
> Hi Matt,
> 
> I don't know if anyone has tried Hypergiant, but I've been playing
> around with SDL2:
> 
> https://github.com/chicken-mobile/chicken-sdl2-android-builder
> 
> The Android tooling makes most things extremely painful. The
> Dockerfile instructions for SDL might be of help to you if you choose
> to experiment yourself.
> 
> Best of luck!
> K.
> 
> 
> On Sun, Jan 6, 2019, 02:42 Matt Welland  > From the eggs page it looks like hypergiant should work on android.
> > Can
> > anyone report sucessfully doing so? Is the work flow for deploying
> > on
> > android documented or tested?
> > 
> > I'm considering using hypergiant instead of godot for a project.
> > Deploying on Android is a primary goal and being able to use
> > Chicken
> > would be a welcome boon. Any insight or advice appreciated.
> > 
> > Thanks.
> > 
> > ___
> > Chicken-users mailing list
> > Chicken-users@nongnu.org
> > https://lists.nongnu.org/mailman/listinfo/chicken-users
> > ___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Has hypergiant been used on Android?

2019-01-05 Thread Matt Welland
>From the eggs page it looks like hypergiant should work on android. Can
anyone report sucessfully doing so? Is the work flow for deploying on
android documented or tested?

I'm considering using hypergiant instead of godot for a project.
Deploying on Android is a primary goal and being able to use Chicken
would be a welcome boon. Any insight or advice appreciated.

Thanks.

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


Re: [Chicken-users] Is Android not unix?

2018-11-25 Thread Matt Welland
On Mon, 2018-11-26 at 07:26 +0300, Kristian Lein-Mathisen wrote:
> 
> I don't know how UserLand works, but there's no containerization in
> Termux. It's just an terminal emulator with its own package manager
> with quite a few packeges like emacs, gnu make and clang. So building
> CHICKEN is pretty straight forward.
According to their wiki Termux does not do chroot to present a standard
fs to the user. There is a script to do it called termux-chroot.
Userland must do the chroot as it does present a standard fs to the
user. 
https://wiki.termux.com/wiki/Differences_from_Linux
> > K.

> On Mon, Nov 26, 2018, 06:46 elf  > I had no 
> problem compiling chicken in termux (though occasionally there are linkage 
> warnings on android6).
> > 

> > 
> > My understanding is that android is basically stripped down linux with a 
> > java overlord layer. No compatibility layer necessary. This is borne out by 
> > my current work on cross-system randomness - it behaves exactly like a 
> > linux machine, with the same syscalls, etc.
> > 

> > 
> > (Which reminds me. If anyone has a bsd box i can get a login for, it would 
> > be much appreciated. Im trying to do a chicken wrapper for true randomness 
> > using sidechannel effects... so something that looks platform independent.)
> > 

> > 
> > -elf
> > 

> > 
> > On 26 November 2018 5:15:03 GMT+02:00, Matt Welland  wrote:
> > 
> > >Isn't Termux similar to UserLand - a compatibility layer of sorts
> > 
> > >similar to LXC or LXD? If so, I would not be surprised to see
> > 
> > >incompatibilities. I had to do several hacks to get IUP working on
> > 
> > >UserLand.
> > 
> > >
> > 
> > >On Mon, 2018-11-19 at 13:10 +0100, Thomas Chust wrote:
> > 
> > >> On Mon, 19 Nov 2018 13:19:10 +0300 Kristian Lein-Mathisen 
> > 
> > >> i...@gmail.com> wrote:
> > 
> > >> 
> > 
> > >> > 
> > 
> > >> > [...]
> > 
> > >> > I was trying tweetnacl on Termux on Android 9 and ran into this
> > 
> > >> > problem:
> > 
> > >> > 
> > 
> > >> > u0_a191@localhost ~/p/chicken-5.0.0>
> > 
> > >> > csi -R tweetnacl -p '(make-symmetric-sign-key)'
> > 
> > >> > 
> > 
> > >> > Error: (read-u8vector) bad argument type - not a port: #f
> > 
> > >> > 
> > 
> > >> > 
> > 
> > >> > This happens because tweetnacl creates its current-entropy-port
> > 
> > >> > using
> > 
> > >> > cond-expand with unix, windows or else, the latter which is
> > 
> > >> > yielding the #f
> > 
> > >> > error above.
> > 
> > >> > [...]
> > 
> > >> Hello,
> > 
> > >> 
> > 
> > >> interesting, I would have thought that Android would qualify as a
> > 
> > >> unixoid system since it has a Linux kernel! If there is some other
> > 
> > >> feature identifier I should use that would indicate the system likely
> > 
> > >> supports /dev/random, please let me know so I can adapt the tweetnacl
> > 
> > >> code.
> > 
> > >> 
> > 
> > >> Anyway, as a workaround to get tweetnacl running, you can simply do
> > 
> > >> 
> > 
> > >>   (current-entropy-port (open-input-file "/dev/random"))
> > 
> > >> 
> > 
> > >> by hand.
> > 
> > >> 
> > 
> > >> I hope that helps :-)
> > 
> > >> 
> > 
> > >> Ciao,
> > 
> > >> Thomas
> > 
> > >> 
> > 
> > >> 
> > 
> > >> ___
> > 
> > >> Chicken-users mailing list
> > 
> > >> Chicken-users@nongnu.org
> > 
> > >> https://lists.nongnu.org/mailman/listinfo/chicken-users
> > 
> > >
> > 
> > >___
> > 
> > >Chicken-users mailing list
> > 
> > >Chicken-users@nongnu.org
> > 
> > >https://lists.nongnu.org/mailman/listinfo/chicken-users
> > 

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


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


Re: [Chicken-users] Is Android not unix?

2018-11-25 Thread Matt Welland
Isn't Termux similar to UserLand - a compatibility layer of sorts
similar to LXC or LXD? If so, I would not be surprised to see
incompatibilities. I had to do several hacks to get IUP working on
UserLand.

On Mon, 2018-11-19 at 13:10 +0100, Thomas Chust wrote:
> On Mon, 19 Nov 2018 13:19:10 +0300 Kristian Lein-Mathisen  i...@gmail.com> wrote:
> 
> > 
> > [...]
> > I was trying tweetnacl on Termux on Android 9 and ran into this
> > problem:
> > 
> > u0_a191@localhost ~/p/chicken-5.0.0>
> > csi -R tweetnacl -p '(make-symmetric-sign-key)'
> > 
> > Error: (read-u8vector) bad argument type - not a port: #f
> > 
> > 
> > This happens because tweetnacl creates its current-entropy-port
> > using
> > cond-expand with unix, windows or else, the latter which is
> > yielding the #f
> > error above.
> > [...]
> Hello,
> 
> interesting, I would have thought that Android would qualify as a
> unixoid system since it has a Linux kernel! If there is some other
> feature identifier I should use that would indicate the system likely
> supports /dev/random, please let me know so I can adapt the tweetnacl
> code.
> 
> Anyway, as a workaround to get tweetnacl running, you can simply do
> 
>   (current-entropy-port (open-input-file "/dev/random"))
> 
> by hand.
> 
> I hope that helps :-)
> 
> Ciao,
> Thomas
> 
> 
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users

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


Re: [Chicken-users] Chicken + IUP precompiled bundle for Raspbian (ARM) available.

2018-07-09 Thread Matt Welland
Hi Thomas,

First, congratulations on your achievement!

Thanks for the response. I think you are right. On doing a little more
digging I found execstack which seemed to get me past that issue. Now it is
missing libpng16-16. I'll chip away at this a little more.

Matt
-=-

On Mon, Jul 9, 2018 at 2:55 PM, Thomas Chust  wrote:

> On Mon, 9 Jul 2018 10:44:05 -0700 Matt Welland 
> wrote:
>
> > [...]
> > However the IUP egg uses ffcall which doesn't work on GNURoot, presumably
> > because it is a chroot environment.
> > [...]
>
> Hello,
>
> to me it seems more likely that some security feature such as
> non-executable stack interferes with ffcall. That library is old and I
> should really replace it with libffi in the IUP egg at some point – the
> problem is just that libffi has a far more complicated API :-/
>
> Ciao,
> Thomas
>
>
> --
> When C++ is your hammer, every problem looks like your thumb.
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Chicken + IUP precompiled bundle for Raspbian (ARM) available.

2018-07-09 Thread Matt Welland
If you'd like to try Chicken with the IUP gui on your Raspberry pi you can
download a prebuilt binary tar from:

http://www.kiatoa.com/cgi-bin/fossils/opensrc/uv/pkgs/chicken-iup-arm-rasbian-06-08-2018.tar.gz

and untar it into /

I made this with the intention of using it in GNURoot Debian on android.
However the IUP egg uses ffcall which doesn't work on GNURoot, presumably
because it is a chroot environment. The rest of chicken and the installed
eggs seem to work fine.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] directory-utils egg has dependency that appears to not exist

2018-04-07 Thread Matt Welland
Directory utils 1.1.0 depends on typed-define which does not appear to
exist. If I install 1.0.6 it works.

Thanks.

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


Re: [Chicken-users] bug or usage problem with posix group-information and there is no change-group?

2018-02-14 Thread Matt Welland
On Wed, 2018-02-14 at 13:44 +0100, Vasilij Schneidermann wrote:
> Hello Matt,
> 
> > 
> > In the repl calling group-information with the string name of a
> > group
> > works fine, in compiled code I get an error, expected fixnum but
> > received string. I tested with Chicken 4.13
> I can reproduce this with the test code being `(group-information
> "root")`.
> FWIW, I get a warning during compilation, not an error.  The compiled
> code runs just fine and emits the expected result.  This is due to
> the
> relevant entry in the `types.db` file stating that the group-
> information
> procedure accepts an integer only.  If you unpack the release tarball
> and change the enclosed `types.db` to specify `(or string fixnum)`
> for
> the first argument of the function, the compiled CHICKEN should
> behave
> correctly.

Ah, yes, it was a warning, not an error. My mistake.

> 
> > 
> > Also I see a change-file-owner but no change-file-group. A change-
> > file-
> > group would be useful as you can change the group without being
> > root.
> > I.e. an analog to the chgrp command would be useful.
> Have you inspected the documentation of that procedure?  It accepts
> three arguments, the path to the file and the new user ID and group
> ID,
> therefore it allows implementing both `chown` and `chgrp`.  I don't
> think an extra procedure is necessary.
> 

I had tried by setting the user id to my user id and group to the
group-id but it failed - on looking again I see that I was testing in
an xterm where I had not done a newgrp to make the group I'd added for
testing available. My mistake again.

Thanks for taking a look and sorry for the noise.

> Vasilij

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


[Chicken-users] bug or usage problem with posix group-information and there is no change-group?

2018-02-12 Thread Matt Welland
In the repl calling group-information with the string name of a group
works fine, in compiled code I get an error, expected fixnum but
received string. I tested with Chicken 4.13

Also I see a change-file-owner but no change-file-group. A change-file-
group would be useful as you can change the group without being root.
I.e. an analog to the chgrp command would be useful.

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


Re: [Chicken-users] Memory allocation and limits in chicken scheme programs

2017-12-13 Thread Matt Welland
On Wed, Dec 13, 2017 at 12:41 PM, Peter Bex <pe...@more-magic.net> wrote:

> On Wed, Dec 13, 2017 at 11:13:54AM -0700, Matt Welland wrote:
> > I'm using Chicken 4.10.0 and with the below script chicken rapidly
> > allocates memory then seems to get stuck:
>
> Hi Matt,
>
> Try to update to CHICKEN 4.13.0 first (standard advice, we usually
> fix lots of issues in new versions).  I simply get this after a few
> seconds:
>
> [panic] out of memory - heap has reached its maximum size - execution
> terminated
>
> The fix is to increase the maximum allowed heap size using -:hm:
> csi -:hm4G ./test.scm cleanly exits after a few seconds here with either
> version of CHICKEN.
>
> > The program chokes after 133 rounds through the loop. No "out of memory'
> > message.
>
> I suppose that's a bug we fixed in 4.13.0; I seem to recall an issue like
> that where allocating near the maximum heap size would result in it
> triggering a GC, then filling up the heap immediately again etc, resulting
> in a GC loop, but I can't find it in NEWS right now.


Much better with 4.13. Thanks. I have it working up to 128G. I don't
understand the heap and will do some more reading but am I correct in
assuming that the size of the heap will determine the largest data
structure I can have in memory? I base this on seeing the VIRT column in
htop plateau at 128G when I used -:nm128G.


> > The process memory usage doesn't seem to grow and the program just
> > hangs. I added -B: but didn't get any output.
>
> Try the -:g option (debugging output for the GC); you'll quickly see that
> it's resizing the heap all the time to the same limit.
>
> Cheers,
> Peter
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Memory allocation and limits in chicken scheme programs

2017-12-13 Thread Matt Welland
I'm using Chicken 4.10.0 and with the below script chicken rapidly
allocates memory then seems to get stuck:

=script=
(define start-time (current-milliseconds))
(define max-n 200)
(let loop ((n   0)
   (stuff  '()))
  (let ((bigvec (make-vector 100 0)))
(print n " Elapsed time: " (/ (- (current-milliseconds) start-time)
1000) " s ")
(if (< n max-n)
(loop (+ n 1)(cons bigvec stuff)
=end script=

On a machine with lots of memory, nothing in cache or buffers:

> free -g; utils/memproblem-simple
 total   used   free sharedbuffers cached
Mem:  1009 13996  0  1  1
-/+ buffers/cache: 10999
Swap:  512  0511

The program chokes after 133 rounds through the loop. No "out of memory'
message. The process memory usage doesn't seem to grow and the program just
hangs. I added -B: but didn't get any output.

Suggestions on what might cause this and if so how to work around it or how
to debug further?

0 Elapsed time: 0.007 s
1 Elapsed time: 0.027 s
2 Elapsed time: 0.031 s
...
131 Elapsed time: 2.09 s
132 Elapsed time: 2.093 s
133 Elapsed time: 2.768 s
^C
(I gave up waiting)
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] How to use bezier function in 2d-primitives?

2017-10-26 Thread Matt Welland
On Oct 25, 2017 4:32 PM, "Kooda" <ko...@upyum.com> wrote:

On Tue, 24 Oct 2017 22:15:47 -0700 Matt Welland
<mattrwell...@gmail.com> wrote:
> I tried this:
>
> (use 2d-primitives)
> (with-output-to-file "test.csv"
>   (lambda ()
> (for-each
>(lambda (v)
>   (print (f32vector-ref v 0)","(f32vector-ref v 1)))
> (bezier->vects (bezier:create (vect:create 0 0)(vect:create 2
> 5)(vect:create 7 5)(vect:create 10 0) 10
>
> Then load test.csv into gnumeric and graph it and I see two straight
> line segments. Either I'm not correctly understanding how to use
> bezier or there is a bug.
>
> Thanks,
>
> Matt
> -=-

Looks like the 2d-primitives egg has a bug indeed! I’ll open a ticket.

Here is a version of bezier->vects that does what you expect. I hope
this will help!

(define (bezier->vects* b n)
  (let ((increment (/ 1 n)))
(let loop ((step 0))
  (if (>= step 1)
  (list (bezier:ref b 1))
  (cons (bezier:ref b step)
(loop (+ step increment)))


Thanks Kooda! With your fix I was able to draw the beginnings of a
primitive boat hull using my little experimental app "a3d".

For anyone into 3D printers, Openscad and POVRay, etc. you might find a3d
of interest. It attempts to provide a limited way to write your scene or
design in scheme and then visualize in POVRay or Openscad and target 3D
printers.

You can see more a http://www.kiatoa.com/fossils/opensrc/wiki?name=a3d
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] How to use bezier function in 2d-primitives?

2017-10-24 Thread Matt Welland
I tried this:

(use 2d-primitives)
(with-output-to-file "test.csv"
  (lambda ()
(for-each
   (lambda (v)
  (print (f32vector-ref v 0)","(f32vector-ref v 1)))
(bezier->vects (bezier:create (vect:create 0 0)(vect:create 2
5)(vect:create 7 5)(vect:create 10 0) 10

Then load test.csv into gnumeric and graph it and I see two straight line
segments. Either I'm not correctly understanding how to use bezier or there
is a bug.

Thanks,

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


[Chicken-users] ANN: Chicken + IUP installer for Windows has been updated.

2017-09-21 Thread Matt Welland
The chicken-iup installer for Windows has been updated.

URL: http://www.kiatoa.com/fossils/chicken-iup

Chicken version: 4.12.0
IUP version: 3.22
Canvas Draw version: 5.9

Lots of pre-installed eggs:

abnf  version:
7.0
advice .. version:
0.3
alist-lib  version:
0.2.11
ansi-escape-sequences ... version:
0.4
apropos ... version:
2.2.1
args .. version:
1.5.1
awful  version:
0.42.0
awful-server . version:
0.42.0
base64  version:
3.3.1
basic-sequences . version:
2.0
big-chicken . version:
0.4
bind .. version:
1.5.2
bindings .. version:
7.0.4
call-with-environment-variables ... version:
0.1.7
canvas-draw ... version:
1.1.1
check-errors .. version:
2.1.0
chicken-bind .. version:
1.5.2
chicken-doc ... version:
0.4.7
chicken-doc-cmd ... version:
0.4.7
chicken-dump .. version:
0.9.7
condition-utils ... version:
1.4.2
coops .. version:
1.93
cplusplus-object .. version:
1.5.2
csv . version:
5.3
csv-char-list ... version:
5.3
csv-string .. version:
5.3
csv-xml .. version:
0.11.1
datatype  version:
1.4
define-record-and-printer . version:
0.1.4
defstruct ... version:
1.6
detail-object . version:
1.8.6
directory-utils ... version:
1.0.6
dot-locking . version:
0.2
expand-full ... version:
1.0.3
filepath  version:
1.5
fmt ... version:
0.808
fmt-c . version:
0.808
fmt-color . version:
0.808
fmt-js  version:
0.808
fmt-unicode ... version:
0.808
foof-loop ... version:
8.1
foreigners  version:
1.4.1
format  version:
3.1.6
functional-lists .. version:
0.0.2
hahn .. version:
0.9.3
html-tags .. version:
0.11
html-utils . version:
0.10
http-client-conditions  version:
1.4.2
http-session  version:
2.9
ini-file .. version:
0.3.4
input-classes ... version:
1.0
input-parse . version:
1.1
intarweb  version:
1.7
intarweb-conditions ... version:
1.4.2
irc ... version:
1.9.8
iset  version:
2.0
iup ... version:
1.7.0
iup-dynamic ... version:
1.7.0
json  version:
1.5
lalr .. version:
2.4.3
lazy-seq 

Re: [Chicken-users] chicken-install -keep-installed not working when doing -deploy

2017-05-01 Thread Matt Welland
I'm using 4.10. I had problems with 4.11 but will try again with 4.12. 
Thanks.


On Sun, Apr 30, 2017 at 11:17 PM, Evan Hanson <ev...@foldling.org> 
wrote:

Hi Matt,

On 2017-04-30 23:10, Matt Welland wrote:
 I think -keep-installed is detecting the egg already installed to 
the system

 - but it should be looking at the deploy directory when deploying.


Unfortunately that's very likely; this was an issue in CHICKEN that 
was only
fixed in 4.11.2. You can refer to http://bugs.call-cc.org/ticket/1144 
for more

info about that bug.

What version of CHICKEN are you using, and if it's 4.11.1 or older, 
is it

possible for you to upgrade?

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


[Chicken-users] chicken-install -keep-installed not working when doing -deploy

2017-05-01 Thread Matt Welland
I think -keep-installed is detecting the egg already installed to the 
system - but it should be looking at the deploy directory when 
deploying.


I am trying to get the following Makefile to work somewhat efficiently, 
however as make iterates over each egg some of the same dependencies 
are installed over and over again:


# Need to run as follows (PREFIX is the path to where the iup lib is 
installed):

#
# CSC_OPTIONS="-I$PREFIX/include -L$PREFIX/lib" make deploy

CSCOPTS=
SRCFILES=src/db.scm
SOFILES = $(SRCFILES:%.scm=%.so)
DEPLOYSOFILES = $(SOFILES:src/%=deploytarg/%)

EGGS=matchable readline apropos base64 regex-literals format regex-case 
test coops trace csv \
dot-locking posix-utils posix-extras directory-utils hostinfo 
tcp-server rpc csv-xml fmt \
json md5 awful http-client spiffy uri-common intarweb 
spiffy-request-vars \
spiffy-directory-listing ssax sxml-serializer sxml-modifications 
srfi-42 matchable \

iup canvas-draw sqlite3

DPLYEGGS = $(EGGS:%=deploytarg/%.so)

all : dashboard
deploy : deploytarg/dashboard

src/%.so : src/%.scm
csc $(CSCOPTS) -J -s $<
cp src/$*.so $*.import.scm deploytarg

deploytarg/%.so : Makefile
chicken-install -p deploytarg -deploy $*

deploytarg/dashboard : $(DPLYEGGS) $(DEPLOYSOFILES) src/dashboard.scm
csc -deploy $(OFILES) src/dashboard.scm -o deploytarg
mv deploytarg/deploytarg deploytarg/dashboard


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


Re: [Chicken-users] How to use units and modules together?

2017-04-30 Thread Matt Welland

That did the trick. Thanks Evan.

On Sun, Apr 30, 2017 at 9:32 PM, Evan Hanson  wrote:

Hi Matt,

You're very close. The only step you missed was emitting an import 
file

for your "other" module so that csc knows what to do when you "(import
other)" in main.scm.

This should work (note "-j other"):

csc other.scm -c -j other
csc other.o main.scm

Cheers,

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


[Chicken-users] How to use units and modules together?

2017-04-30 Thread Matt Welland
Is using units and modules together supported? I'd like to use modules 
but don't want to have to install them as eggs.


I have tried this:

=main.scm=
(declare (uses other))
(import other)

(other-print "Hello")
==end

=other.scm=
(declare (unit other))

(module other
   (other-print)
 (import scheme chicken)
 (define (other-print arg)
   (print "Got: " arg)))

(import other)
==end==

Compile like this:

csc other.scm -c
csc other.o main.scm

===
It won't let me import other:

Syntax error (import): cannot import from undefined module

other

Expansion history:

(##core#begin (import other))
(import other)<--

However if I comment out the (import other) I can call other-print like 
this:


(other#other-print "Hello")

and it works.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] How to turn off exception handlers in my code?

2017-03-15 Thread Matt Welland

This seems to be working:

(define-syntax common:handle-exceptions
 (syntax-rules ()
   ((_ exn errstmt body ...)
(begin body ...

I was hung up trying variations on this:

(define-syntax common:handle-exceptions
 (syntax-rules ()
   ((_ exn errstmt ...)
(begin ...

which does NOT work. I guess a placeholder is needed for the first 
statement captured by the ellipsis.


On Wed, Mar 15, 2017 at 1:05 PM, Matt Welland <m...@kiatoa.com> wrote:
I have many exception handlers, mostly handle-exceptions but some 
condition-case, and I'd like to run some tests and turn OFF the 
exception handling. I tried using a proc but that does not work:


(define (mt-faux-handle-exceptions exn alt . cmds)
  (let ((alt-proc (lambda ()
(let ((exn exn))
  alt
(apply lambda '() cmds)))

The exn variable is not seen by the alt code and a "Error: unbound 
variable: exn" message is issued.


I've tried a macro but I don't know enough to make it work. This 
starting point works:


(define-syntax common:handle-exceptions
   (syntax-rules ()
 ((_ exn-in errstmt ...)
  (handle-exceptions exn-in errstmt ...

But I run into trouble as soon as I try to replace the actual 
handle-exceptions with something else.


Is there any built-in switchable on/off exception handler or does 
someone have a macro they can share that does what I need or 
something similar?


Any help appreciated.

Thanks,

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


  1   2   3   >