chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to handle egg with multiple modules


From: Arnaud Bailly
Subject: How to handle egg with multiple modules
Date: Mon, 24 May 2021 09:59:05 +0200

Hello,
I am trying to understand how to best structure scheme code. I like
using small and cohesive modules and I am a bit reluctant to use
`include` which seems to me somewhat low-level and very dependent on
file system's structure. So I have tried to start adding more modules
to my code. Here is the modified egg with the `modules` configuration

;;; srfi-1.egg -*- Scheme -*- vim: ft=scheme:

((synopsis "Origin of Species Library")
  (version "0.1")
  (author "Arnaud Bailly")
  (maintainer "Arnaud Bailly")
  (category tools)
  (test-dependencies test)
  (license "BSD")
  (dependencies generics srfi-1 srfi-133 format)
  (components (extension species
                         (modules species (species ui))
                         (csc-options "-O3" "-d0")
                         (source-dependencies
                          "species.ui.scm"  "ui.base.scm" "map.scm"
"utils.scm" "evolution.scm")
                         )
              (program darwin
                       (csc-options "-O3" "-static")
                       (component-dependencies species)
                       )))

and the module declaration:

(module (species ui)
        (clear-screen)

        (import (chicken base))
        (include "ui.base.scm")
)

and implementation:

(import scheme
        (chicken base))

;;; Clears the screen and reset cursor position
(define (clear-screen)
  (print "\x1b[2J\x1b[H"))

When I try to compile this egg with

$ chicken-install -test -n

I get the following weird error:

building species
   /usr/local/Cellar/chicken/5.2.0/bin/csc -host -D
compiling-extension -J -s -regenerate-import-libraries -setup-mode -I
/Users/arnaud/projects/scheme/origin-of-species -C
-I/Users/arnaud/projects/scheme/origin-of-species -O3 -d0 species.scm
-o /Users/arnaud/projects/scheme/origin-of-species/species.so
   /usr/local/Cellar/chicken/5.2.0/bin/csc
-regenerate-import-libraries -M -setup-mode -static -I
/Users/arnaud/projects/scheme/origin-of-species -emit-link-file
/Users/arnaud/projects/scheme/origin-of-species/species.link -host -D
compiling-extension -c -unit species -D compiling-static-extension -C
-I/Users/arnaud/projects/scheme/origin-of-species -O3 -d0 species.scm
-o /Users/arnaud/projects/scheme/origin-of-species/species.static.o
   /usr/local/Cellar/chicken/5.2.0/bin/csc -setup-mode -s -host -I
/Users/arnaud/projects/scheme/origin-of-species -C
-I/Users/arnaud/projects/scheme/origin-of-species -O3 -d0
species.import.scm -o
/Users/arnaud/projects/scheme/origin-of-species/species.import.so
   /usr/local/Cellar/chicken/5.2.0/bin/csc -setup-mode -host -I
/Users/arnaud/projects/scheme/origin-of-species -C
-I/Users/arnaud/projects/scheme/origin-of-species -O3 -static
darwin.scm -o /Users/arnaud/projects/scheme/origin-of-species/darwin

Error: (car) bad argument type:
|\xcf\xfa\xed\xfe\x07\x00\x00\x01\x03\x00\x00\x00\x02\x00\x00\x00\x11\x00\x00\x00\x90\x06\x00\x00\x85\x00|

Call history:

<syntax>   (##core#undefined)
<syntax>   (##core#begin (##core#set! loop (##core#loop-lambda (eco)
(begin (clear-screen) (print-map (eco (quo...
<syntax>   (##core#set! loop (##core#loop-lambda (eco) (begin
(clear-screen) (print-map (eco (quote biotopes)))...
<syntax>   (##core#loop-lambda (eco) (begin (clear-screen) (print-map
(eco (quote biotopes))) (print "Press [En...
<syntax>   (##core#begin (clear-screen) (print-map (eco (quote
biotopes))) (print "Press [Enter] to evolve one ...
<syntax>   (clear-screen)
<syntax>   (print-map (eco (quote biotopes)))
<syntax>   (eco (quote biotopes))
<syntax>   (quote biotopes)
<syntax>   (##core#quote biotopes)
<syntax>   (print "Press [Enter] to evolve one step ")
<syntax>   (read-line)
<syntax>   (loop (evolve-ecosystem eco))
<syntax>   (evolve-ecosystem eco)
<syntax>   (##core#let () loop)
<syntax>   (##core#begin loop) <--

Error: shell command terminated with non-zero exit status 17920:
'/usr/local/Cellar/chicken/5.2.0/bin/chicken' 'darwin.scm'
-output-file '/Users/arnaud/projects/scheme/origin-of-species/darwin.c'
-static -setup-mode -include-path
/Users/arnaud/projects/scheme/origin-of-species -optimize-level 3
-emit-link-file
/Users/arnaud/projects/scheme/origin-of-species/darwin.link

Error: shell command terminated with nonzero exit code
256
"sh /Users/arnaud/projects/scheme/origin-of-species/species.build.sh"

What am I doing wrong? What's the "standard" approach to structuring
modules with chicken?

Thanks in advance for your help
-- 
Arnaud Bailly - @dr_c0d3



reply via email to

[Prev in Thread] Current Thread [Next in Thread]