Changeset 2488 in project


Ignore:
Timestamp:
11/20/06 19:41:58 (15 years ago)
Author:
felix winkelmann
Message:

various updates, documentation update for chicken-setup

Files:
64 added
24 edited

Legend:

Unmodified
Added
Removed
  • chicken/README

    r2443 r2488  
    33  (c)2000-2003 Felix L. Winkelmann
    44
    5   Version 2.504
     5  Version 2.505
    66
    77
     
    2525
    2626        4. Loads of extra libraries.
     27
     28        Note: Should you have any trouble in setting up and using CHICKEN, please ask questions on
     29        the Chicken mailing list. You can subscribe to the list from the Chicken homepage,
     30        http://www.call-with-current-continuation.org)
    2731
    2832 2. Installation:
  • chicken/README.darcs

    r2119 r2488  
     1
    12This file contains instructions for getting a working Chicken system from
    23a darcs checkout.  These are the canonical instructions.
     
    56Please see that file for details on that method.  The two methods are completely
    67independent of each other.
     8
     9If in trouble, please ask questions on the Chicken mailing list. You can
     10subscribe to the list from the Chicken homepage, http://www.call-with-current-continuation.org.
    711
    812(The following instructions were orignally written by Tony Garnock-Jones <tonyg@kcbbs.gen.nz>,
  • chicken/build.scm

    r2443 r2488  
    1 (define-constant +build-version+ "2.504")
     1(define-constant +build-version+ "2.505")
  • chicken/buildversion

    r2443 r2488  
    1 2.504
     12.505
  • chicken/chicken-more-macros.scm

    r1869 r2488  
    607607  (let ([var (gensym)])
    608608    `(let ((,var ,rest))
    609        (cond ((null? ,var) ,default-exp)
    610              ((null? (cdr ,var)) (car ,var))
    611              (else (##core#check (##sys#error (##core#immutable '"too many optional arguments") ,var)))))))
     609       (if (null? ,var)
     610           ,default-exp
     611           (if (##core#check (null? (cdr ,var)))
     612               (car ,var)
     613               (##sys#error (##core#immutable '"too many optional arguments") ,var))))))
    612614
    613615
  • chicken/chicken-setup.1

    r2181 r2488  
    5151
    5252.TP
    53 .B \-help
    54 Show usage information and exit.
    55 
    56 .TP
    57 .B \-version
    58 Display version and exit.
    59 
    60 .TP
    61 .B \-repository
    62 Displays the name of the extension repository.
    63 
    64 .TP
    65 .BI \-repository\ directory
    66 Sets the location of the extension repository for all subsequent operations.
    67 The default repository path is the installation library directory (usually
    68 .I \/usr\/local\/lib\/chicken
    69 , or (if set) the directory given in the environment variable
    70 .I CHICKEN\_REPOSITORY
    71 
    72 .TP
    73 .B \-program\-path
    74 Display the path where executables are installed.
    75 
    76 .TP
    77 .BI \-program\-path\ directory
    78 Sets the location where executables are installed.
    79 
    80 .TP
    81 .BI \-host\ hostname:port
    82 Specifies alternative host for downloading extensions.
    83 .B port
    84 may be omitted and defaults to 80.
    85 
    86 .TP
    87 .BI \-proxy\ hostname:port
    88 Connect to server via proxy.
    89 .B port
    90 may be omitted and defaults to 80.
    91 
    92 .TP
    93 .B \-uninstall
    94 Removes all following extensions from repository.
    95 
    96 .TP
    97 .B \-list
    98 List all installed extensions and exit, or show extension-information of extensions given on the
    99 command-line (following this option).
    100 
    101 .TP
    102 .BI \-run\ filename
    103 Load and execute given file.
    104 
    105 .TP
    106 .BI \-script\ filename
    107 Executes the given Scheme source file with all remaining arguments and exit.
    108 
    109 .TP
    110 .BI \-eval\ expression
    111 Evaluates the given expression(s).
    112 
    113 .TP
    114 .B \-fetch
    115 Only download, don't extract, build or install.
    116 
    117 .TP
    118 .B \-verbose
    119 Display additional information (mainly for debugging).
    120 
    121 .TP
    122 .B \-keep
    123 Keep temporary files and directories.
    124 
    125 .TP
    126 .B \-dont\-ask
    127 Do not ask the user before trying to download required extensions.
    128 
    129 .TP
    130 .B \-no\-install
    131 Do not install generated binaries and/or support files. Any invocations of
    132 .I install\-program
    133 ,
    134 .I install\-extension
    135 or
    136 .I install\-script
    137 will be be no-ops.
     53.B \-check
     54Downloads the repository-index and lists locally installed extensions for which a newer
     55release is available for download.
    13856
    13957.TP
     
    14967
    15068.TP
    151 .B \-dont\-ask
    152 Do not ask the user before trying to download required extensions.
     69.BI \-destdir\ pathname
     70Specifies alternative installation prefix by setting the
     71.B installation-prefix
     72parameter.
    15373
    15474.TP
     
    15878
    15979.TP
    160 .B \-check
    161 Downloads the repository-index and lists locally installed extensions for which a newer
    162 release is available for download.
     80.B \-dont\-ask
     81Do not ask the user before trying to download required extensions.
     82
     83.TP
     84.BI \-eval\ expression
     85Evaluates the given expression(s).
     86
     87.TP
     88.B \-fetch
     89Only download, don't extract, build or install.
     90
     91.TP
     92.B \-fetch\-tree
     93Downloads and prints the repository catalog to stdout.
     94
     95.TP
     96.B \-help
     97Show usage information and exit.
     98
     99.TP
     100.BI \-host\ hostname:port
     101Specifies alternative host for downloading extensions.
     102.B port
     103may be omitted and defaults to 80.
     104
     105.TP
     106.B \-keep
     107Keep temporary files and directories.
     108
     109.TP
     110.B \-list
     111List all installed extensions and exit, or show extension-information of extensions given on the
     112command-line (following this option).
     113
     114.TP
     115.BI \-local\ path
     116Fetch extension sources from local filesystem at
     117.B path
     118instead of downloading egg from egg server.
     119
     120.TP
     121.B \-no\-install
     122Do not install generated binaries and/or support files. Any invocations of
     123.I install\-program
     124,
     125.I install\-extension
     126or
     127.I install\-script
     128will be be no-ops.
     129
     130.TP
     131.B \-program\-path
     132Display the path where executables are installed.
     133
     134.TP
     135.BI \-program\-path\ directory
     136Sets the location where executables are installed.
     137
     138.TP
     139.BI \-proxy\ hostname:port
     140Connect to server via proxy.
     141.B port
     142may be omitted and defaults to 80.
     143
     144.TP
     145.B \-repository
     146Displays the name of the extension repository.
     147
     148.TP
     149.BI \-repository\ directory
     150Sets the location of the extension repository for all subsequent operations.
     151The default repository path is the installation library directory (usually
     152.I \/usr\/local\/lib\/chicken
     153, or (if set) the directory given in the environment variable
     154.I CHICKEN\_REPOSITORY
     155
     156.TP
     157.BI \-run\ filename
     158Load and execute given file.
     159
     160.TP
     161.BI \-script\ filename
     162Executes the given Scheme source file with all remaining arguments and exit.
     163
     164.TP
     165.BI \-svn\ url
     166Fetch extension sources from Subversion (http://subversion.tigris.org) repository,
     167instead of downloading egg from egg server.
     168
     169.TP
     170.BI \-tree\ filename
     171Uses the repository catalog stored in
     172.B filename
     173instead of downloading it.
     174
     175.TP
     176.B \-uninstall
     177Removes all following extensions from repository.
     178
     179.TP
     180.B \-verbose
     181Display additional information (mainly for debugging).
     182
     183.TP
     184.B \-version
     185Display version and exit.
    163186
    164187.TP
  • chicken/chicken-setup.scm

    r2443 r2488  
    9797  '("-help" "-uninstall" "-list" "-run" "-repository" "-program-path" "-version" "-script" "-check"
    9898    "-fetch" "-host" "-proxy" "-keep" "-verbose" "-csc-option" "-dont-ask" "-no-install" "-docindex" "-eval"
    99     "-debug" "-ls" "-release" "-test") )
     99    "-debug" "-ls" "-release" "-test" "-fetch-tree" "-tree" "-svn" "-local" "-destdir") )
    100100
    101101(define-constant short-options
    102   '(#\h #\u #\l #\r #\R #\P #\V #\s #\C #\f #\H #\p #\k #\v #\c #\d #\n #\i #\e #\D #f #f #\t) )
     102  '(#\h #\u #\l #\r #\R #\P #\V #\s #\C #\f #\H #\p #\k #\v #\c #\d #\n #\i #\e #\D #f #f #\t #f #f #f #f #f) )
    103103
    104104
     
    146146
    147147(define setup-root-directory (make-parameter #f))
    148 (define setup-build-directory (make-parameter #f))
     148(define setup-build-directory (make-parameter (current-directory)))
    149149(define setup-verbose-flag (make-parameter #f))
    150150(define setup-install-flag (make-parameter #t))
     
    166166(define *base-directory* (current-directory))
    167167(define *fetch-tree-only* #f)
    168 
    169 
    170 ; Repository-format:
    171 ;
    172 ; ((NAME FILENAME REQUIRED-NAME ...) ...)
    173 (define repository-hosts '(("www.call-with-current-continuation.org" "eggs" 80)))
     168(define *svn-repository* #f)
     169(define *local-repository* #f)
     170(define *destdir* #f)
     171(define *repository-hosts* '(("www.call-with-current-continuation.org" "eggs" 80)))
    174172
    175173
     
    415413      -ls EXTENSION              list installed files for extension
    416414      -fetch-tree                download and show repository catalog
     415      -tree FILENAME             use repository catalog from given file
     416      -svn URL                   fetch extension from subversion repository
     417      -local PATH                fetch extension from local filesystem
     418      -destdir PATH              specify alternative installation prefix
    417419  --                             ignore all following arguments
    418420
     
    458460      (when (setup-verbose-flag) (printf "writing info ~A -> ~S ...~%" id info))
    459461      (let ((sid (->string id)))
    460         (with-output-to-file (make-setup-info-pathname sid (repo-path))
     462        (with-output-to-file (make-setup-info-pathname sid (repo-path #t))
    461463          (cut pp info) ) ) ) ) )
    462464
     
    482484          (values '() oinfo) ) ) ) )
    483485
    484 (define (simple-install filename)
    485   (let ((so (pathname-replace-extension filename ##sys#load-dynamic-extension))
    486         (id (pathname-strip-extension filename)) )
    487     (run (csc -O2 -no-trace -s ,filename -emit-exports ,(make-pathname #f id "exports")))
    488     (when (setup-install-flag)
    489       (unless *windows* (run (,*remove-command* ,(make-pathname (repo-path) so))))
    490       (run (,*copy-command* ,so ,(repo-path)))
    491       (write-info id (list (make-pathname (repository-path) so)) '()) )
    492     (unless *keep-stuff* (run (rm ,so)) ) ) )
    493 
    494486(define (compute-tmpdir fname)
    495487  (if (equal? "egg-dir" (pathname-extension fname))
     
    502494
    503495(define (rmtmpdir)
    504   (chdir *base-directory*)
     496  (unless (string=? (current-directory) *base-directory*)
     497    (chdir *base-directory*) )
    505498  (when *tmpdir-created*
    506499    (set! *tmpdir-created* #f)
     
    516509      (lambda () (string=? "\x1f\x8b" (read-string 2))) ) )
    517510  (let ((tmpdir (compute-tmpdir filename)))
    518     (cond ((file-exists? tmpdir) (chdir tmpdir))
     511    (cond ((file-exists? tmpdir)
     512           (chdir tmpdir)
     513           (setup-build-directory (current-directory)) )
    519514          (else
    520515           (create-directory tmpdir)
     
    568563    (let* ((files (check-filelist (if (list? files) files (list files))))
    569564           (rpath (repo-path))
     565           (rpathd (repo-path #t))
    570566           (files (if *windows*
    571567                      (map (lambda (f)
     
    577573           (dests (map (lambda (f)
    578574                         (let ((from (if (pair? f) (car f) f))
    579                                (to (make-dest-pathname rpath f)) )
     575                               (to (make-dest-pathname rpathd f)) )
    580576                           (when (and (not *windows*) (equal? "so" (pathname-extension to)))
    581577                             (run (,*remove-command* ,to)) )
    582578                           (copy-file from to)
    583                            to) )
     579                           (make-dest-pathname rpath f)))
    584580                       files) ) )
    585581      (and-let* ((docs (assq 'documentation info)))
    586         (print "\n* Installing documentation files in " (pathname-directory (doc-index) )":")
    587         (for-each (cut print "  * " <>) (cdr docs))
    588         (newline)
    589         (set! *rebuild-doc-index* #t))
     582        (let ((docpath (pathname-directory (doc-index #t))))
     583          (print "\n* Installing documentation files in " docpath ":")
     584          (for-each
     585           (lambda (f)
     586             (if (file-exists? f)
     587                 (copy-file f (make-pathname docpath f))
     588                 (print "Warning: file " f " doesn't seem to exist") )
     589             (print "  * " <>) (cdr docs))
     590           (newline)
     591           (set! *rebuild-doc-index* #t)) ) )
    590592      (and-let* ((exs (assq 'examples info)))
    591593        (print "\n* Installing example files in " *example-directory* ":")
     
    605607  (when (setup-install-flag)
    606608    (let* ((files (check-filelist (if (list? files) files (list files))))
    607            (ppath (program-path))
     609           (ppath (if *destdir* (make-pathname *destdir* "bin") (program-path)))
    608610           (files (if *windows*
    609611                      (map (lambda (f)
     
    651653    (delete-file* (make-setup-info-pathname (->string ext)))))
    652654
    653 (define (repo-path)
    654   (let ((p (repository-path)))
     655(define (repo-path #!optional ddir?)
     656  (let ((p (if (and ddir? *destdir*)
     657               (make-pathname
     658                (list *destdir* "lib/chicken")
     659                (pathname-file (repository-path))) ; we need the binary-compat. version
     660               (repository-path))) )
    655661    (ensure-directory p)
    656662    p) )
     
    720726(define (download-repository-tree)
    721727  (unless *repository-tree*
    722     (print "downloading catalog ...")
    723     (let loop ((hosts repository-hosts))
     728    (when (setup-verbose-flag) (print "downloading catalog ..."))
     729    (let loop ((hosts *repository-hosts*))
    724730      (if (null? hosts)
    725731          (error "unable to connect")
     
    730736                (or (handle-exceptions ex
    731737                      (begin (printf "could not connect to ~A.~%" host) #f)
    732                       (printf "downloading catalog from ~A ...~%" host)
     738                      (when (setup-verbose-flag)
     739                        (printf "downloading catalog from ~A ...~%" host) )
    733740                      (let-values (((i o) (setup-tcp-connect host port)))
    734741                        (set! *last-decent-host* (car hosts))
     
    754761                                  #t)
    755762                                (loop) ) ) ) ) )
    756                     (loop more) ) ) ) ) ) ) ) ) )
     763                    (loop more) ) ) ) )
     764            ((x . _) (error "(internal) invalid host" x)) ) ) ) ) )
    757765
    758766(define *progress-indicator*
     
    774782
    775783(define (download-data hostdata item #!optional filename)
    776   (match hostdata
    777     ((host path port)
    778      (let ((fname (or filename (third (assq item *repository-tree*)))))
    779        (printf "downloading ~A from ~A ~!" fname hostdata)
    780        (let-values (((i o) (setup-tcp-connect host port)))
    781          (let ((req (http-get-request
    782                      (if filename (pathname-directory filename) path)
    783                      (if filename (pathname-strip-directory fname) fname)
    784                      host) ) )
    785            (when (setup-verbose-flag) (display req))
    786            (display req o) )
    787          (let loop ()
    788            (let ((ln (read-line i)))
    789              ;; check for 404 here...
    790              (if (string=? "" ln)
    791                  (let ((data (with-progress-indicator (cut read-string #f i))))
    792                    (close-input-port i)
    793                    (close-output-port o)
    794                    (with-output-to-file (pathname-strip-directory fname)
    795                      (cut display data) binary:) )
    796                  (loop) ) ) ) ) ) ) ) )
    797 
    798 (define (fetch-file-from-net ext)
     784  (unless hostdata (set! hostdata (car *repository-hosts*)))
     785  (cond (*local-repository*
     786         (when (setup-verbose-flag) (printf "fetching from local directory ~a ...~%" *local-repository*))
     787         (let ((p (->string item)))
     788           (copy-file (make-pathname *local-repository* p) (make-pathname #f p "egg-dir")) ) )
     789        (*svn-repository*
     790         (when (setup-verbose-flag) (printf "fetching from svn repository ~a ...~%" *svn-repository*))
     791         (let ((p (->string item)))
     792           (run (svn co ,(make-pathname *svn-repository* p) ,(make-pathname #f p "egg-dir"))) ) )
     793        (else
     794         (match hostdata
     795           ((host path port)
     796            (let ((fname (or filename (third (assq item *repository-tree*)))))
     797              (printf "downloading ~A from ~A ~!" fname hostdata)
     798              (let-values (((i o) (setup-tcp-connect host port)))
     799                (let ((req (http-get-request
     800                            (if filename (pathname-directory filename) path)
     801                            (if filename (pathname-strip-directory fname) fname)
     802                            host) ) )
     803                  (when *debug* (display req))
     804                  (display req o) )
     805                (let loop ()
     806                  (let ((ln (read-line i)))
     807                    ;; check for 404 here...
     808                    (if (string=? "" ln)
     809                        (let ((data (with-progress-indicator (cut read-string #f i))))
     810                          (close-input-port i)
     811                          (close-output-port o)
     812                          (with-output-to-file (pathname-strip-directory fname)
     813                            (cut display data)
     814                            binary:) )
     815                        (loop) ) ) ) ) ) )
     816           (x (error "(internal) invalid host" x)) ) ) ) )
     817
     818(define (fetch-file ext)
    799819  (define (requirements reqs)
    800820    (fold
     
    812832       (cond ((pathname-directory ext)
    813833              (printf "Warning: no repository index available, trying direct download...~%" ext)
    814               (set! *last-decent-host* (car repository-hosts))
     834              (set! *last-decent-host* (car *repository-hosts*))
    815835              (set! *dont-ask* #t)
    816836              (download-data
     
    838858    (let loop ((filename filename))
    839859      (cond ((and df (with-ext filename "setup")) => run-setup-script)
    840             ((and df (with-ext filename "scm")) => simple-install)
    841             ((and df (or (with-ext filename "egg") (with-ext filename "egg-dir"))) =>
     860            ((or (with-ext filename "egg") (with-ext filename "egg-dir")) =>
    842861             (lambda (f)
    843                (unpack/enter f)
    844                (loop (pathname-replace-extension f "setup"))
    845                (rmtmpdir) ) )
    846             ((fetch-file-from-net filename)
     862               (when df
     863                 (unpack/enter f)
     864                 (let ((sfile (pathname-replace-extension f "setup")))
     865                   (when (and (not (file-exists? sfile)) (file-exists? "tags") )
     866                     (let ((ds (sort (directory "tags") string>=?)))
     867                       (when (pair? ds)
     868                         (let ((d (make-pathname "tags" (car ds))))
     869                           (chdir d)
     870                           (setup-build-directory d) ) ) ) )
     871                   (loop sfile)
     872                   (rmtmpdir) ) ) ) )
     873            ((fetch-file filename)
    847874             (when df (loop (pathname-file filename))) ) ) ) ) )
    848875
    849 (define (doc-index)
    850   (make-pathname (repo-path) "index.html"))
     876(define (doc-index #!optional ddir?)
     877  (make-pathname (repo-path ddir?) "index.html"))
    851878
    852879(define (extension-documented? rpath fn)
     
    938965(define (main args)
    939966  (define (parse-host host eggdir)
    940     (set! repository-hosts
     967    (set! *repository-hosts*
    941968      (cons (match (string-match "(.+)\\:([0-9]+)" host)
    942969              ((_ host port) (list host (if eggdir "eggs" "") (string->number port)))
    943970              (_ (list host (if eggdir "eggs" "") 80)) )
    944             repository-hosts) )  )
     971            *repository-hosts*) )  )
    945972  (setup-root-directory *base-directory*)
    946973  (let ((uinst #f)
     
    9741001         (repository-path dir)
    9751002         (loop more) )
     1003        (("-tree" file . more)
     1004         (set! *repository-tree* (with-input-from-file file read))
     1005         (loop more) )
    9761006        (("--" . more)
    9771007         (exit) )
     
    9791009         (print (program-path))
    9801010         (exit) )
     1011        (("-destdir" path . more)
     1012         (set! *example-directory* (make-pathname path "examples"))
     1013         (set! *destdir* path)
     1014         (installation-prefix path)
     1015         (loop more) )
    9811016        (("-program-path" dir . more)
    9821017         (program-path dir)
     
    10011036        (("-host" host . more)
    10021037         (match (string-match "http://(.*)" host)
    1003            ((_ host)
    1004             (parse-host host #t) )
     1038           ((_ host) (parse-host host #t) )
    10051039           (_ (parse-host host #t)) )
    10061040         (loop more) )
     
    10451079         (set! anydone #t)
    10461080         (loop more) )
     1081        (("-svn" url . more)
     1082         (set! *svn-repository* url)
     1083         (set! *dont-ask* #t)
     1084         (loop more) )
     1085        (("-local" path . more)
     1086         (set! *local-repository* path)
     1087         (set! *dont-ask* #t)
     1088         (loop more) )
    10471089        (("-fetch-tree" . more)
    10481090         (set! *fetch-tree-only* #t)
     
    10551097                  1)
    10561098                 (else (exit 0)) ) ) )
    1057         (((or "-run" "-script" "-proxy" "-host" "-csc-option"))
     1099        (((or "-run" "-script" "-proxy" "-host" "-csc-option" "-ls" "-destdir" "-tree" "-local" "-svn" "-eval"))
    10581100         (error "missing option argument" (car args)) )
    10591101        ((filename . more)
  • chicken/csi.1

    r1016 r2488  
    115115
    116116.TP
     117.BI \-ss\ pathname
     118Similar to
     119.B \-script
     120but invokes the procedure
     121.B main
     122after loading the file specified by
     123.B pathname
     124with a single argument (the list of command line arguments) returning any result as status code.
     125
     126.TP
    117127.BI \-R\ \-require\-extension\  name
    118128Require extension for evaluated code.
  • chicken/csi.scm

    r2443 r2488  
    1 ;;;; csi.scm - Simple interpreter stub for CHICKEN
     1;;;; csi.scm - Interpreter stub for CHICKEN
    22;
    33; Copyright (c) 2000-2006, Felix L. Winkelmann
     
    100100    -k  -keyword-style STYLE    enable alternative keyword-syntax (none, prefix or suffix)
    101101    -s  -script PATHNAME        use interpreter for shell scripts
     102        -ss PATHNAME            shell script with `main' procedure
    102103    -R  -require-extension NAME require extension before executing code
    103104    -I  -include-path PATHNAME  add PATHNAME to include path
     
    832833
    833834(define-constant short-options
    834   '(#\k #\s #\v #\h #\D #\e #\i #\R #\b #\n #\q #\w #\- #\I #f) )
     835  '(#\k #\s #\v #\h #\D #\e #\i #\R #\b #\n #\q #\w #\- #\I #f #f) )
    835836
    836837(define-constant long-options
    837838  '("-keyword-style" "-script" "-version" "-help" "--help" "--" "-feature" "-eval" "-case-insensitive"
    838     "-require-extension" "-batch" "-quiet" "-no-warnings" "-no-init" "-include-path" "-release") )
     839    "-require-extension" "-batch" "-quiet" "-no-warnings" "-no-init" "-include-path" "-release" "-ss") )
    839840
    840841(define (canonicalize-args args)
     
    843844        '()
    844845        (let ((x (car args)))
    845           (cond ((or (string=? "-s" x) (string=? "-script" x)) args)
     846          (cond ((or (string=? "-s" x) (string=? "-ss" x) (string=? "-script" x)) args)
    846847                ((and (fx> (##sys#size x) 2)
    847848                      (char=? #\- (##core#inline "C_subchar" x 0))
     
    864865  (let* ([extraopts (parse-option-string (or (getenv "CSI_OPTIONS") ""))]
    865866         [args (canonicalize-args (cdr (argv)))]
    866          [loadlater #f]
    867867         [kwstyle (member* '("-k" "-keyword-style") args)]
    868          [script (member* '("-s" "-script") args)])
     868         [script (member* '("-s" "-ss" "-script") args)])
    869869    (cond [script
    870            (unless (pair? (cdr script)) (##sys#error "missing argument to `-script' option"))
     870           (unless (pair? (cdr script)) (##sys#error "missing script argument"))
    871871           (command-line-arguments (cddr script))
    872872           (register-feature! 'script)
    873873           (set-cdr! (cdr script) '())
    874            (when (and (memq (software-type) '(windows msdos))
    875                       (not (eq? (build-platform) 'cygwin)) )
    876              (and-let* ([sname (lookup-script-file (cadr script))])
     874           (when (and (eq? (software-type) 'windows) (not (eq? (build-platform) 'cygwin)) )
     875             (and-let* ((sname (lookup-script-file (cadr script))))
    877876               (set-car! (cdr script) sname) ) ) ]
    878877          [else
     
    883882           [batch (or script (member* '("-b" "-batch") args) eval?)]
    884883           [quiet (or script (member* '("-q" "-quiet") args) eval?)]
    885            [ipath (map chop-separator (string-split (or (getenv "CHICKEN_INCLUDE_PATH") "") ";"))] )
    886      
     884           [ipath (map chop-separator (string-split (or (getenv "CHICKEN_INCLUDE_PATH") "") ";"))] )     
    887885      (define (collect-options opt)
    888886        (let loop ([opts args])
     
    893891                          (cons (cadr p) (loop (cddr p)))) ) ]
    894892                [else '()] ) ) )
    895 
    896893      (define (loadinit)
    897894        (let ([fn (##sys#string-append "./" init-file)])
     
    902899                (when (file-exists? fn)
    903900                  (load fn) ) ) ) ) )
    904 
    905901      (when (member* '("-h" "-help" "--help") args)
    906902        (print-usage)
     
    945941      (do ([args args (cdr args)])
    946942          ((null? args)
    947            (when loadlater (load loadlater))
    948943           (unless batch
    949944             (repl)
     
    954949                  arg
    955950                  '("--" "-batch" "-quiet" "-no-init" "-no-warnings" "-script" "-b" "-q" "-n" "-w" "-s" "-i"
    956                     "-case-insensitive") ) )
     951                    "-case-insensitive" "-ss") ) )
    957952                ((member arg '("-feature" "-include-path" "-keyword-style" "-D" "-I" "-k"))
    958953                 (set! args (cdr args)) )
     
    966961                     (eval x) )
    967962                   (set! args (cdr args)) ) )
    968                 (else (load arg) ) ) ) ) ) ) )
     963                (else
     964                 (load arg)
     965                 (when (and script (string=? "-ss" (car script)))
     966                   (call-with-values (cut main (command-line-arguments))
     967                     (lambda results
     968                       (exit
     969                        (if (and (pair? results) (fixnum? (car results)))
     970                            (car results)
     971                            0) ) ) ) ) ) ) ) ) ) ) )
    969972
    970973(run)
  • chicken/eval.scm

    r1928 r2488  
    576576     p) ) )
    577577
     578(define ##sys#unbound-in-eval #f)
     579
    578580(define ##sys#compile-to-closure
    579581  (let ([macro? macro?]
     
    651653                            (cond-expand
    652654                             [unsafe (lambda v (##core#inline "C_slot" x 0))]
    653                              [else (lambda v (##core#inline "C_retrieve" x))] ) ) ]
     655                             [else
     656                              (when (and ##sys#unbound-in-eval (not (##sys#symbol-has-toplevel-binding? x)))
     657                                (set! ##sys#unbound-in-eval (cons (cons x cntr) ##sys#unbound-in-eval)) )
     658                              (lambda v (##core#inline "C_retrieve" x))] ) ) ]
    654659                       [(zero? i) (lambda (v) (##sys#slot (##sys#slot v 0) j))]
    655660                       [else (lambda (v) (##sys#slot (##core#inline "C_u_i_list_ref" v i) j))] ) ) ]
     
    11081113      (when (string? input)
    11091114        (set! input (##sys#expand-home-path input)) )
    1110       (let ([isdir #f]
    1111             [fname
     1115      (let* ([isdir #f]
     1116             [fname
    11121117             (cond [(port? input) #f]
    11131118                   [(not (string? input)) (badfile input)]
     
    20092014          (for-each (cut write-one <> ##sys#standard-output) xs) ) )
    20102015
    2011       (let ([stdin ##sys#standard-input]
    2012             [stdout ##sys#standard-output]
    2013             [stderr ##sys#standard-error]
    2014             [ehandler (##sys#error-handler)]
    2015             [rhandler (##sys#reset-handler)] )
     2016      (let ((stdin ##sys#standard-input)
     2017            (stdout ##sys#standard-output)
     2018            (stderr ##sys#standard-error)
     2019            (ehandler (##sys#error-handler))
     2020            (rhandler (##sys#reset-handler))
     2021            (uie ##sys#unbound-in-eval) )
    20162022
    20172023        (define (saveports)
     
    20602066                   (##sys#read-char-0 ##sys#standard-input) )
    20612067                 (##sys#clear-trace-buffer)
     2068                 (set! ##sys#unbound-in-eval '())
    20622069                 (receive result ((or ##sys#repl-eval-hook eval) exp)
     2070                   (when (and ##sys#warnings-enabled (pair? ##sys#unbound-in-eval))
     2071                     (let loop ((vars ##sys#unbound-in-eval) (u '()))
     2072                       (cond ((null? vars)
     2073                              (when (pair? u)
     2074                                (##sys#print
     2075                                 "Warning: the following toplevel variables are referenced but unbound:\n"
     2076                                 #f ##sys#standard-error)
     2077                                (for-each
     2078                                 (lambda (v)
     2079                                   (##sys#print "  " #f ##sys#standard-error)
     2080                                   (##sys#print (car v) #t ##sys#standard-error)
     2081                                   (when (cdr v)
     2082                                     (##sys#print " (in " #f ##sys#standard-error)
     2083                                     (##sys#print (cdr v) #t ##sys#standard-error)
     2084                                     (##sys#write-char-0 #\) ##sys#standard-error) )
     2085                                   (##sys#write-char-0 #\newline ##sys#standard-error) )
     2086                                 u) ) )
     2087                             ((or (memq (caar vars) u)
     2088                                  (##sys#symbol-has-toplevel-binding? (caar vars)) )
     2089                              (loop (cdr vars) u) )
     2090                             (else (loop (cdr vars) (cons (car vars) u))) ) 9 ) )
    20632091                   (write-results result)
    20642092                   (loop) ) ) ) ) )
    20652093         (lambda ()
     2094           (set! ##sys#unbound-in-eval uie)
    20662095           (##sys#error-handler ehandler)
    20672096           (##sys#reset-handler rhandler) ) ) ) ) ) )
  • codewalk/codewalk.scm

    r2443 r2488  
    3838  (export expansion-context expansion-context? macroexpand ##sys#macroexpand-0
    3939          expand expand/context macroexpand ##sys#macroexpand-1-local install-toplevel-expander
    40           ##sys#compiler-toplevel-macroexpand-hook) )
     40          ##sys#compiler-toplevel-macroexpand-hook ##sys#interpreter-toplevel-macroexpand-hook) )
    4141
    4242
     
    173173                             ((lambda)
    174174                              (##sys#check-syntax 'lambda x '(lambda lambda-list . #(_ 1)) #f)
    175                               (let ((llist (cadr x)))
     175                              (let ((llist (cadr x))
     176                                    (body (cddr x)) )
    176177                                (when (##sys#extended-lambda-list? llist)
    177178                                  (set!-values
    178179                                   (llist body)
    179180                                   (##sys#expand-extended-lambda-list
    180                                     llist (cddr x)
     181                                    llist body
    181182                                    ##sys#syntax-error-hook) ) )
    182183                                (##sys#decompose-lambda-list
     
    288289      (expander x) ) )
    289290  (set! ##sys#compiler-toplevel-macroexpand-hook expander2)
     291  (set! ##sys#interpreter-toplevel-macroexpand-hook expander2)
    290292  (when override-macroexpand
    291293    (set! macroexpand (lambda (exp . me) (expander exp)))
  • egg-post-commit

    r2486 r2488  
    8484    (let* ([ii (cdr info)]
    8585           [file (cadr (or (assq 'egg ii)
    86                            (assq 'file ii)
    87                            (error "Invalid entry, no egg nor file declaration" ii)))]
     86                           (error "Invalid entry, no egg declaration" ii)))]
    8887           [htmlfile (make-pathname #f (->string (car info)) "html")] )
    8988      `(tr (@ (style ,(conc "background-color: " color)))
     
    151150   (lambda (f)
    152151     (and (directory? f)
    153           (let ((mf (make-pathname (get-egg-dir f) f "meta")))
     152          (let* ((mf (make-pathname (get-egg-dir f) f "meta")))
    154153            (and (file-exists? mf)
     154                 (not (file-exists? (make-pathname f "_NO_EGG")))
    155155                 (begin
    156156                   (print* f #\space)
     
    190190    (ftp:disconnect ftp) ) )
    191191
    192 (define (put-coop-index-page eggnames repofile)
    193   (print
    194    (nth-value
    195     0
    196     (http:send-request
    197      (http:make-request
    198       'PUT
    199       (conc +coop-egg-index-page+
    200             "&comment="
    201             (url-encode
    202              (format #f "egg update ~a ~a" (string-trim-right (seconds->string (current-seconds)))
    203                      eggnames) ) )
    204       `(("Authorization" . ,(conc "Basic " (base64:encode (conc "egg-maintainers:" username password))))
    205         ("Content-type" . "text/plain")
    206         ("Connection" . "close") )
    207       (with-output-to-string
    208         (cut pp
    209              `((head "Egg status index")
    210                "\n\nRecently updated eggs: " ,(->string eggnames)
    211                "\n\n"
    212                (html
    213                 "<table class='changes' style='width: 60%;' border='0'><tr><th align='left'><b>Release</b></th><th align='left'>Egg</th></td></tr>"
    214                 ,@(map (lambda (item f)
    215                          (conc "<tr class=" f "><td class='trdate'>" (car item) "</td><td class='trname'>"
    216                                "<a href='" +call/cc-eggs-url+ "/" (cdr item) ".html'>"
    217                                (cdr item) "</a></td></tr>") )
    218                        (sort (map (match-lambda
    219                                     ((name (attrs ...) . _)
    220                                      (let ((a (assq 'date attrs)))
    221                                        (cons (cadr a) name) ) ) )
    222                                   repofile)
    223                              (lambda (a b) (string>? (car a) (car b))) )
    224                        (circular-list "odd" "even")) )
    225                (html "</table>")
    226                (readonly) ) ) ) ) ) ) ) )
    227 
    228192; Return the directory where the latest release for the egg is to be found,
    229193; relative to the base of the repository (eg. "svn-client/tags/1.2").
     
    240204
    241205(define (make-html-from-wiki egg-dir egg)
    242 
    243206  ; Load these extensions here so admins not using the wiki/streams can still
    244207  ; upload regular eggs (so the dependency is optional, only required in order
    245208  ; to upload eggs that use the wiki):
    246 
    247209  (use html-stream stream-ext srfi-40 stream-wiki)
    248 
    249210  (with-output-to-file (make-pathname egg-dir egg "html")
    250211    (lambda ()
     
    289250              (meta (car (read-file (make-pathname egg-dir eggname "meta"))))
    290251              (egg (or (alist-ref 'egg meta)
    291                        (alist-ref 'file meta)
    292                        (error "no `egg' or `file' property in meta info" meta)))
     252                       (error "no `egg' property in meta info" meta)))
    293253              (files (alist-ref 'files meta))
    294254              (hidden (alist-ref 'hidden meta))
     
    329289                                    `((date ,date)) ) )
    330290                             ,(car (or (alist-ref 'egg (cdr info))
    331                                        (alist-ref 'file (cdr info))
    332                                        (error "no `egg' or `file' property" info) ) )
     291                                       (error "no `egg' property" info) ) )
    333292                             ,@(let ([needs (assq 'needs (cdr info))])
    334293                                 (if needs
  • stream-base64/stream-base64.html

    r1 r2488  
    2323
    2424<ul>
     25<li>1.1 - added .setup script (felix)</li>
    2526<li>1.0 (r1578) - First public release.</li>
    2627</ul>
  • stream-base64/stream-base64.meta

    r1 r2488  
    11;;; stream-base64.meta -*- Hen -*-
    2 ((file "stream-base64.scm")
     2((egg "stream-base64.egg")
    33 (author "Alejandro Forero Cuervo")
    44 (synopsis
     
    66 (needs srfi-40 stream-ext)
    77 (category parsing)
     8 (files "stream-base64.scm" "stream-base64.setup" "stream-base64.html")
    89 (license "Public Domain"))
  • stream-cgi/stream-cgi.html

    r30 r2488  
    2121
    2222<ul>
     23<li>1.4 - added .setup script (felix)</li>
    2324<li>1.3 - Fixed bug in invocation of <code>hash-table-walk</code> [Thanks to Michal Dybizbanski]
    2425<li>1.2 - Adapted to SRFI-69-compatible hash-tables
  • stream-cgi/stream-cgi.meta

    r617 r2488  
    11;;; stream-cgi.meta -*- Hen -*-
    2 ((file "stream-cgi.scm")
     2((egg "stream-cgi.egg")
    33 (author "Alejandro Forero Cuervo")
    44 (synopsis
     
    66 (category web)
    77 (needs srfi-40 stream-ext content-type)
     8 (files "stream-cgi.scm" "stream-cgi.html" "stream-cgi.setup")
    89 (license "Public Domain"))
  • stream-ldif/stream-ldif.html

    r1 r2488  
    2323
    2424<ul>
    25 <li>1.1 adapted to SRFI-69-compatible hash-tables
     25<li>1.2 added .setup script (felix)</li>
     26<li>1.1 adapted to SRFI-69-compatible hash-tables</li>
    2627<li>1.0 (r1582) - First public release</li>
    2728</ul>
  • stream-ldif/stream-ldif.meta

    r1 r2488  
    11;;; stream-ldif.meta -*- Hen -*-
    2 ((file "stream-ldif.scm")
     2((egg "stream-ldif.egg")
    33 (author "Alejandro Forero Cuervo")
    44 (synopsis
     
    66 (needs srfi-40 stream-ext stream-base64)
    77 (category parsing)
     8 (files "stream-ldif.scm" "stream-ldif.setup" "stream-ldif.html")
    89 (license "Public Domain"))
  • wiki/Accessing external objects

    r1908 r2488  
    4242 [syntax] (define-foreign-type NAME TYPE [ARGCONVERT [RETCONVERT]])
    4343
    44 Defines an alias for {{TYPE}} with the name {{NAME}} (a symbol).
    45 {{TYPE}} may be a type-specifier
    46 or a string naming a C type. The namespace of foreign type specifiers
    47 is separate from the normal Scheme namespace.  The optional arguments
    48 {{ARGCONVERT}} and {{RETCONVERT}} should evaluate to procedures
    49 that map argument- and result-values to a value that can be transformed
    50 to {{TYPE}}:
     44Defines an alias for {{TYPE}} with the name {{NAME}} (a symbol).
     45{{TYPE}} may be a type-specifier or a string naming a C type. The
     46namespace of foreign type specifiers is separate from the normal
     47Scheme namespace.  The optional arguments {{ARGCONVERT}} and
     48{{RETCONVERT}} should evaluate to procedures that map argument- and
     49result-values to a value that can be transformed to {{TYPE}}:
    5150
    5251<enscript highlight=scheme>
     
    7776
    7877Defines a foreign variable of name {{NAME}} (a symbol). {{STRING}}
    79 should be the real name of a foreign variable or parameterless macro. If
    80 {{STRING}} is not given, then the variable name {{NAME}} will
    81 be converted to a string and used instead. All references and assignments
    82 (via {{set!}}) are modified to correctly convert values between
    83 Scheme and C representation. This foreign variable can only be accessed
    84 in the current compilation unit, but the name can be lexically shadowed.
    85 Note that {{STRING}} can name an arbitrary C expression. If no
    86 assignments are performed, then {{STRING}} doesn't even have to
    87 specify an lvalue.
     78should be the real name of a foreign variable or parameterless
     79macro. If {{STRING}} is not given, then the variable name {{NAME}}
     80will be converted to a string and used instead. All references and
     81assignments (via {{set!}}) are modified to correctly convert values
     82between Scheme and C representation. This foreign variable can only be
     83accessed in the current compilation unit, but the name can be
     84lexically shadowed.  Note that {{STRING}} can name an arbitrary C
     85expression. If no assignments are performed, then {{STRING}} doesn't
     86even have to specify an lvalue.
    8887
    8988<enscript highlight=scheme>
  • wiki/The User's Manual

    r2192 r2488  
    33== Introduction
    44
    5 ''(This document describes version 2.502)''
     5''(This document describes version 2.505)''
    66
    77'''CHICKEN is a compiler that translates Scheme source files into C''', which in
  • wiki/Using the interpreter

    r2465 r2488  
    4444; -s  -script PATHNAME : This is equivalent to {{-batch -quiet -no-init PATHNAME}}. Arguments following {{PATHNAME}} are available by using  {{command-line-arguments}} and are not processed as interpreter options. Extra options in the environment variable {{CSI_OPTIONS}} are ignored.
    4545
     46; -ss PATHNAME : The same as {{-s PATHNAME}} but invokes the procedure {{main}} with the value of {{(command-line-arguments)}} as its single argument. If the main procedure returns an integer result, then the interpreter is terminated, returning the integer as the status code back to the invoking process. Any other result terminates the interpreter with a zero exit status.
     47
    4648; -R  -require-extension NAME : Equivalent to evaluating {{(require-extension NAME)}}.
    4749
     
    8789accept more than 8 arguments.
    8890
     91Since it is sometimes useful to run a script into the interpreter without actually running it
     92(for example to test specific parts of it), the option {{-ss}} can be used as an alternative to {{-script}}.
     93{{-ss PATHNAME}} is equivalent to {{-script PATHNAME}} but invokes {{(main (command-line-arguments))}}
     94after loading all top-level forms of the script file. The result of {{main}} is returned as the exit status
     95to the shell. Any non-numeric result exits with status zero:
     96
     97 % cat hi.scm
     98 (define (main args)
     99   (print "Hi, " (car args))
     100   0)
     101 % csi -ss hi.scm you
     102 Hi, you
     103 % csi -q
     104 #;1> ,l hi.scm
     105 #;2> (main (list "ye all"))
     106 Hi, ye all
     107 0
     108 #;3>
    89109
    90110=== Toplevel commands
  • wiki/chicken-setup

    r2192 r2488  
    66=== Extension libraries
    77
    8 Extension libraries are extensions to the core functionality provided
    9 by the basic CHICKEN system, to be built and installed separately.
    10 The mechanism for loading compiled extensions is based on dynamically
    11 loadable code and as such is only available on systems on which
    12 loading compiled code at runtime is supported. Currently this are
    13 most UNIX-compatible platforms that provide the {{libdl}} functionality
    14 like Linux, Solaris, BSD, Mac OS X and Windows using Cygwin.
    15 Windows with the Microsoft tools is partially supported.
    16 
    17 Note: Extension may also be normal applications or shell scripts.
     8Extension libraries (''eggs'') are extensions to the core
     9functionality provided by the basic CHICKEN system, to be built and
     10installed separately.  The mechanism for loading compiled extensions
     11is based on dynamically loadable code and as such is only available on
     12systems on which loading compiled code at runtime is
     13supported. Currently these are most UNIX-compatible platforms that
     14provide the {{libdl}} functionality like Linux, Solaris, BSD, Mac OS X
     15and Windows using Cygwin.
     16
     17Note: Extension may also be normal applications or shell scripts, but
     18are usually libraries.
     19
     20{{chicken-setup}} will download the source code for extension
     21automatically from the canonical server at
     22[[http://www.call-with-current-continuation.org/eggs]] if the
     23requested egg does not exist in the current directory. Various
     24command-line options exist for customizing the process and/or
     25retrieving the egg from other locations or in other formats.
    1826
    1927
     
    2129
    2230To install an extension library, run the {{chicken-setup}} program
    23 with the extension name as argument. If the extension consists of a
    24 single Scheme file, then it is compiled and installed in the extension
    25 ''repository''. If it is an archive containing addition files, then
    26 the files are extracted and the contained ''setup'' script is
    27 executed. This setup script is a normal Scheme source file, which
    28 will be interpreted by {{chicken-setup}}. The complete language supported
    29 by {{csi}} is available, and the library units
    30 {{srfi-1 regex utils posix tcp}} are loaded. Additional
    31 libraries can of course be loaded at run-time.
    32 
    33 The setup script should perform all necessary steps to build the
    34 new library (or application). After a successful build, the extension
    35 can be installed by invoking one of the procedures
    36 {{install-extension}}, {{install-program}} or {{install-script}}.
    37 These procedures will copy a number of given files into the extension
    38 repository or in the path where the CHICKEN executables are located (in the
    39 case of executable programs or scripts). Additionally the list of
    40 installed files, and user-defined metadata is stored in the repository.
     31with the extension name as argument. The extension archive is
     32downloaded, its contents extracted and the contained ''setup'' script
     33is executed. This setup script is a normal Scheme source file, which
     34will be interpreted by {{chicken-setup}}. The complete language
     35supported by {{csi}} is available, and the library units {{srfi-1
     36regex utils posix tcp}} are loaded. Additional libraries can be loaded
     37at run-time.
     38
     39The setup script should perform all necessary steps to build the new
     40library (or application). After a successful build, the extension can
     41be installed by invoking one of the procedures {{install-extension}},
     42{{install-program}} or {{install-script}}.  These procedures will copy
     43a number of given files into the extension repository or in the path
     44where the CHICKEN executables are located (in the case of executable
     45programs or scripts). Additionally the list of installed files, and
     46user-defined metadata is stored in the repository.
    4147
    4248If no extension name is given on the command-line, and if none of the
    4349options {{-list}}, {{-version}}, {{-repository}} (without argument),
    44 {{-program-path}} (without argument), {{-fetch}} or {{-docindex}}
    45 is given, then all {{.setup}} scripts in the current directory are
    46 processed.
     50{{-program-path}} (without argument), {{-fetch}}, {{-fetch-tree}} or
     51{{-docindex}} is given, then all {{.setup}} scripts in the current
     52directory are processed.
    4753
    4854
    4955=== Creating extensions
    5056
    51 Extensions can be created by creating an (optionally gzipped) {{tar}} 
    52 archive named {{EXTENSION.egg}}
    53 containing all needed files plus a {{.setup}} script in the root directory.
    54 After {{chicken-setup}} has extracted the files, the setup script will be
    55 invoked. There are no additional constraints on the structure of the archive,
    56 but the setup script has to be in the root path of the archive.
     57Extensions can be created by creating an (optionally gzipped) {{tar}}
     58archive named {{EXTENSION.egg}} containing all needed files plus a
     59{{.setup}} script in the root directory.  After {{chicken-setup}} has
     60extracted the files, the setup script will be invoked. There are no
     61additional constraints on the structure of the archive, but the setup
     62script has to be in the root path of the archive.
    5763
    5864
     
    288294</enscript>
    289295
     296We need a {{.setup}} script to build and install our nifty extension:
     297
     298<enscript highlight=scheme>
     299;;;; hello.setup
     300
     301;; compile the code into a dynamically loadable shared object
     302;; (will generate hello.so or hello.dll on Windows)
     303(compile -s hello.scm)
     304
     305;; Install as extension library
     306(install-extension 'hello "hello.so")
     307</enscript>
     308
     309(Note: {{install-extension}} will recognized the {{.so}} extension and automatically
     310do the right thing on Windows)
     311
    290312After entering
    291313
    292314 $ chicken-setup hello
    293315
    294 at the shell prompt, the file {{hello.scm}} will be compiled into a dynamically loadable library,
    295 with the default compiler options {{-optimize-level 2 -no-trace -shared}}. If the
    296 compilation succeeds, {{hello.so}} will be stored in the repository, together with a file named
    297 {{hello.setup}} (not to be confused with a setup script - this {{.setup}} file just contains
    298 an a-list with metadata).
     316at the shell prompt (and in the same directory where the two files
     317exist), the file {{hello.scm}} will be compiled into a dynamically
     318loadable library. If the compilation succeeds, {{hello.so}} will
     319be stored in the repository, together with a file named
     320{{hello.setup-info}} containing an a-list with metadata.
     321If no extension name is given to {{chicken-setup}}, it will simply
     322execute the first file with the {{.setup}} extension it can find.
    299323
    300324Use it like any other CHICKEN extension:
     
    302326 $ csi -q
    303327 #;1> (require-extension hello)
    304  ; loading /usr/local/lib/chicken/hello.so ...
     328 ; loading /usr/local/lib/chicken/1/hello.so ...
    305329 #;2> (hello "me")
    306330 Hello, me!
    307331 #;3>
    308332
    309 For more elaborate build operations, when installing applications or scripts, or when
    310 additional metadata should be stored for an extension, a {{setup}} script is required
    311 and the script and all additional files should be packaged in a gzipped {{tar}} archive.
    312 
    313333Here we create a simple application:
    314334
     
    326346;;;; hello2.setup
    327347
    328 (run (csc hello2.scm))  ; compile `hello2'
     348(compile hello2.scm)  ; compile `hello2'
    329349(install-program 'hello2 "hello2") ; name of the extension and files to be installed
    330350</enscript>
     
    332352To use it, just run {{chicken-setup}} in the same directory:
    333353
    334  $ chicken-setup hello2
    335 
    336 Now the program {{hello2}} will be installed in the same location as the other CHICKEN
    337 tools (like {{chicken}}, {{csi}}, etc.), which will normally be {{/usr/local/bin}}.
    338 Note that you need write-permissions for those locations.
     354 $ chicken-setup
     355
     356(Here we omit the extension name)
     357
     358Now the program {{hello2}} will be installed in the same location as
     359the other CHICKEN tools (like {{chicken}}, {{csi}}, etc.), which will
     360normally be {{/usr/local/bin}}.  Note that you need write-permissions
     361for those locations and may have to run {{chicken-setup}} with
     362administrative rights.
    339363
    340364Uninstallation is just as easy:
     
    342366 $ chicken-setup -uninstall hello2
    343367
    344 {{chicken-setup}} provides a {{make}} macro, so building operations can be of
    345 arbitrary complexity. When running {{chicken-setup}} with an argument {{NAME}},
    346 for which no associated file {{NAME.setup}}, {{NAME.egg}} or {{NAME.scm}}
    347 exists will ask you to download the extension via HTTP from the default URL
    348 {{http://www.call-with-current-continuation.org/eggs}}. You can use the
    349 {{-host}} option to specify an alternative source location.
    350 
    351 If the given extension name contains a path prefix and the {{-host}} option
    352 is given, then {{chicken-setup}} can also download and install eggs from
    353 an arbitrary HTTP server. Alternatively you can pass a full URL (including the
    354 {{http://}} prefix. Note that no dependency checks are done when downloading
    355 eggs directly with the URL syntax.
    356 
    357 Finally a somewhat more complex example: We want to package a syntax extension with
    358 additional support code that is to be loaded at run-time of any Scheme code that
    359 uses that extension. We create a ''glass'' lambda, a procedure with free variables
    360 that can be manipulated from outside:
     368{{chicken-setup}} provides a {{make}} macro, so build operations can
     369be of arbitrary complexity. When running {{chicken-setup}} with an
     370argument {{NAME}}, for which no associated file {{NAME.setup}},
     371{{NAME.egg}} or {{NAME.scm}} exists will ask you to download the
     372extension via HTTP from the default URL
     373[[http://www.call-with-current-continuation.org/eggs]]. You can use
     374the {{-host}} option to specify an alternative source
     375location. Extensions that are required to compile and/or use the
     376requested extension are downloaded and installed automatically.
     377
     378If the given extension name contains a path prefix and the {{-host}}
     379option is given, then {{chicken-setup}} can also download and install
     380eggs from an arbitrary HTTP server. Alternatively you can pass a full
     381URL (including the {{http://}} prefix. Note that no dependency checks
     382are done when downloading eggs directly with the URL syntax.
     383
     384Finally a somewhat more complex example: We want to package a syntax
     385extension with additional support code that is to be loaded at
     386run-time of any Scheme code that uses that extension. We create a
     387''glass'' lambda, a procedure with free variables that can be
     388manipulated from outside:
    361389
    362390<enscript highlight=scheme>
     
    400428
    401429<enscript highlight=scheme>
    402 (run (csc -s -O2 -d0 glass-support.scm))
     430(compile -s glass-support.scm)
    403431
    404432(install-extension
     
    408436</enscript>
    409437
    410 The invocation of {{install-extension}} provides the files that
    411 are to be copied into the extension repository, and a metadata list that
     438The invocation of {{install-extension}} provides the files that are to
     439be copied into the extension repository, and a metadata list that
    412440specifies that the extension {{glass}} is a syntax extension and that,
    413 if it is declared to be used by other code (either with the {{require-extension}}
    414 or {{require-for-syntax}} form), then client code should perform an implicit
    415 {{(require 'glass-support)}} at startup.
     441if it is declared to be used by other code (either with the
     442{{require-extension}} or {{require-for-syntax}} form), then client
     443code should perform an implicit {{(require 'glass-support)}} at
     444startup.
    416445
    417446This can be conveniently packaged as an ''egg'':
     
    424453 $ csi -quiet
    425454 #;1> (require-extension glass)
    426  ; loading /usr/local/lib/chicken/glass.scm ...
    427  ; loading /usr/local/lib/chicken/glass-support.so ...
     455 ; loading /usr/local/lib/chicken/1/glass.scm ...
     456 ; loading /usr/local/lib/chicken/1/glass-support.so ...
    428457 #;2> (define foo (glass-lambda (x) (y) (+ x y)))
    429458 #;3> (glass-lambda-set! foo 'y 99)
     
    453482; {{-t  -test EXTENSION ...}} : return success if all given extensions are installed
    454483; {{-ls EXTENSION}} : List installed files for extension
    455 ; {{-fetch-tree}} : Downloads and prints the repository catalog
     484; {{-fetch-tree}} : Download and print the repository catalog
     485; {{-tree FILENAME}} : Download and show the repository catalog
     486; {{-svn URL}} : Fetch extension from [[http://subversion.tigris.org|Subversion]] repository
     487; {{-local PATHNAME}} : Fetch extension from local file
     488; {{-destdir PATHNAME}} : Specify alternative installation prefix (for packaging)
    456489; {{--}} : Ignore all following arguments.
    457490
     
    461494=== Windows notes
    462495
    463 {{chicken-setup}} works on Windows, when compiled with Visual C++, but depends on the {{tar}}
    464 and {{gunzip}} tools to extract the contents of an egg. The best way is to download an egg
    465 either manually (or with {{chicken-setup -fetch}}) and extract its contents with a separate program
    466 (like {{winzip}}). the {{CHICKEN_REPOSITORY}} environment variable has to be set (in addition
    467 to {{CHICKEN_HOME}}) to a directory where your compiled extensions should be located.
    468 
    469 The {{.setup}} scripts will not always work under Windows, and the extensions may require libraries
    470 that are not provided for Windows or work differently. Under these circumstances it is recommended
    471 to perform the required steps to build an extension manually.
     496{{chicken-setup}} works on Windows, when compiled with Visual C++, but
     497depends on the {{tar}} and {{gunzip}} tools to extract the contents of
     498an egg. The best way is to download an egg either manually (or with
     499{{chicken-setup -fetch}}) and extract its contents with a separate
     500program (like {{winzip}}). the {{CHICKEN_REPOSITORY}} environment
     501variable has to be set (in addition to {{CHICKEN_HOME}}) to a
     502directory where your compiled extensions should be located.
     503
     504The {{.setup}} scripts will not always work under Windows, and the
     505extensions may require libraries that are not provided for Windows or
     506work differently. Under these circumstances it is recommended to
     507perform the required steps to build an extension manually.
     508
     509The required UNIX tools are also available as Windows binaries.
     510Google or ask on the CHICKEN mailing list if you need help locating
     511them.
     512
     513
     514=== Other modes if installation
     515
     516It is possible to install extensions directly from a
     517[[http://subversion.tigris.org|Subversion]] repository or from a local
     518checkout by using the {{-svn}} or {{-local}} options. By using
     519either the {{svn}} client program (which must be installed) or
     520file-system operations all necessary files will be copied into the
     521current directory (creating a subdirectory named
     522{{EXTENSIONNAME.egg-dir}}), built and subsequently installed.
     523
     524Dependency information which is necessary to ensure required
     525extensions are also installed is downloaded automatically.  If you
     526have no internet connection or don't want to connect, you can als use
     527a local file containing the necessary dependency information.  The
     528{{-fetch-tree}} option retrieves the canonical ''repository file'' at
     529[[http://www.call-with-current-continuation.org/eggs/repository]],
     530writing it to stdout. Redirecting this output into a file and passing
     531the file via the {{-tree}} option to {{chicken-setup}} allows you now
     532to use the local repository file:
     533
     534Retrieve complete extension repository (big):
     535
     536 % cd /opt
     537 % svn co https://galinha.ucpel.tche.br/svn/chicken-eggs
     538
     539Get your own copy of the repository file:
     540
     541 % chicken-setup -fetch-tree >~/my-repository-file
     542
     543Now you can install eggs from your local checkout, with full
     544dependency tracking and without being connected to the internet:
     545
     546 % cd ~/tmp
     547 % chicken-setup -local /opt/eggs/chicken-eggs -tree ~/my-repository-file opengl
     548
    472549
    473550Previous: [[Interface to external functions and variables]]
  • wiki/eggs guidelines

    r1562 r2488  
    99
    1010; Introduction : Must briefly state the purpose of the egg.
    11 ; Examples : Must provide simple examples of the most important functions in the egg.  Note that all examples should be entirely self-contained; basically, pasting them in CSI should work, which means, among other things, that they should include the {{use}} or {{require-extension}} lines loading the egg.  Each example should be its own subsection and the actual code should follow a brief explanation of what it does.
     11; Examples : Must provide simple examples of the most important functions in the egg.  Note that all examples should be entirely self-contained; basically, pasting them in {{csi}} should work, which means, among other things, that they should include the {{use}} or {{require-extension}} lines loading the egg.  Each example should be its own subsection and the actual code should follow a brief explanation of what it does.
    1212; Authors :
    1313; License :
  • wiki/eggs tutorial

    r2480 r2488  
    6565In order for {{chicken-setup}} to install your extension, we recommend that you create a {{mpeg3.setup}} file with information about your egg.
    6666{{chicken-setup}} will load this file.
    67 
    68 In the case of eggs that only define runtime symbols, this step is entirely optional: you could ship your egg as a single {{.scm}} file.
    69 However, using a {{.setup}} file is still recommended as it will also allow you to state the version of your egg (which {{chicken-setup -list}} will print).
    7067
    7168If your egg does not contain macros, your setup file should look similar to the following:
     
    156153;web: Web programming
    157154;xml: XML processing
     155;sound: Sound related stuff
    158156
    159157== Managing eggs in the repository
Note: See TracChangeset for help on using the changeset viewer.