Changeset 2488 in project
- Timestamp:
- 11/20/06 19:41:58 (14 years ago)
- Files:
-
- 64 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
chicken/README
r2443 r2488 3 3 (c)2000-2003 Felix L. Winkelmann 4 4 5 Version 2.50 45 Version 2.505 6 6 7 7 … … 25 25 26 26 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) 27 31 28 32 2. Installation: -
chicken/README.darcs
r2119 r2488 1 1 2 This file contains instructions for getting a working Chicken system from 2 3 a darcs checkout. These are the canonical instructions. … … 5 6 Please see that file for details on that method. The two methods are completely 6 7 independent of each other. 8 9 If in trouble, please ask questions on the Chicken mailing list. You can 10 subscribe to the list from the Chicken homepage, http://www.call-with-current-continuation.org. 7 11 8 12 (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.50 4")1 (define-constant +build-version+ "2.505") -
chicken/buildversion
r2443 r2488 1 2.50 41 2.505 -
chicken/chicken-more-macros.scm
r1869 r2488 607 607 (let ([var (gensym)]) 608 608 `(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)))))) 612 614 613 615 -
chicken/chicken-setup.1
r2181 r2488 51 51 52 52 .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 54 Downloads the repository-index and lists locally installed extensions for which a newer 55 release is available for download. 138 56 139 57 .TP … … 149 67 150 68 .TP 151 .B \-dont\-ask 152 Do not ask the user before trying to download required extensions. 69 .BI \-destdir\ pathname 70 Specifies alternative installation prefix by setting the 71 .B installation-prefix 72 parameter. 153 73 154 74 .TP … … 158 78 159 79 .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 81 Do not ask the user before trying to download required extensions. 82 83 .TP 84 .BI \-eval\ expression 85 Evaluates the given expression(s). 86 87 .TP 88 .B \-fetch 89 Only download, don't extract, build or install. 90 91 .TP 92 .B \-fetch\-tree 93 Downloads and prints the repository catalog to stdout. 94 95 .TP 96 .B \-help 97 Show usage information and exit. 98 99 .TP 100 .BI \-host\ hostname:port 101 Specifies alternative host for downloading extensions. 102 .B port 103 may be omitted and defaults to 80. 104 105 .TP 106 .B \-keep 107 Keep temporary files and directories. 108 109 .TP 110 .B \-list 111 List all installed extensions and exit, or show extension-information of extensions given on the 112 command-line (following this option). 113 114 .TP 115 .BI \-local\ path 116 Fetch extension sources from local filesystem at 117 .B path 118 instead of downloading egg from egg server. 119 120 .TP 121 .B \-no\-install 122 Do not install generated binaries and/or support files. Any invocations of 123 .I install\-program 124 , 125 .I install\-extension 126 or 127 .I install\-script 128 will be be no-ops. 129 130 .TP 131 .B \-program\-path 132 Display the path where executables are installed. 133 134 .TP 135 .BI \-program\-path\ directory 136 Sets the location where executables are installed. 137 138 .TP 139 .BI \-proxy\ hostname:port 140 Connect to server via proxy. 141 .B port 142 may be omitted and defaults to 80. 143 144 .TP 145 .B \-repository 146 Displays the name of the extension repository. 147 148 .TP 149 .BI \-repository\ directory 150 Sets the location of the extension repository for all subsequent operations. 151 The 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 158 Load and execute given file. 159 160 .TP 161 .BI \-script\ filename 162 Executes the given Scheme source file with all remaining arguments and exit. 163 164 .TP 165 .BI \-svn\ url 166 Fetch extension sources from Subversion (http://subversion.tigris.org) repository, 167 instead of downloading egg from egg server. 168 169 .TP 170 .BI \-tree\ filename 171 Uses the repository catalog stored in 172 .B filename 173 instead of downloading it. 174 175 .TP 176 .B \-uninstall 177 Removes all following extensions from repository. 178 179 .TP 180 .B \-verbose 181 Display additional information (mainly for debugging). 182 183 .TP 184 .B \-version 185 Display version and exit. 163 186 164 187 .TP -
chicken/chicken-setup.scm
r2443 r2488 97 97 '("-help" "-uninstall" "-list" "-run" "-repository" "-program-path" "-version" "-script" "-check" 98 98 "-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") ) 100 100 101 101 (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) ) 103 103 104 104 … … 146 146 147 147 (define setup-root-directory (make-parameter #f)) 148 (define setup-build-directory (make-parameter #f))148 (define setup-build-directory (make-parameter (current-directory))) 149 149 (define setup-verbose-flag (make-parameter #f)) 150 150 (define setup-install-flag (make-parameter #t)) … … 166 166 (define *base-directory* (current-directory)) 167 167 (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))) 174 172 175 173 … … 415 413 -ls EXTENSION list installed files for extension 416 414 -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 417 419 -- ignore all following arguments 418 420 … … 458 460 (when (setup-verbose-flag) (printf "writing info ~A -> ~S ...~%" id info)) 459 461 (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)) 461 463 (cut pp info) ) ) ) ) ) 462 464 … … 482 484 (values '() oinfo) ) ) ) ) 483 485 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 494 486 (define (compute-tmpdir fname) 495 487 (if (equal? "egg-dir" (pathname-extension fname)) … … 502 494 503 495 (define (rmtmpdir) 504 (chdir *base-directory*) 496 (unless (string=? (current-directory) *base-directory*) 497 (chdir *base-directory*) ) 505 498 (when *tmpdir-created* 506 499 (set! *tmpdir-created* #f) … … 516 509 (lambda () (string=? "\x1f\x8b" (read-string 2))) ) ) 517 510 (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)) ) 519 514 (else 520 515 (create-directory tmpdir) … … 568 563 (let* ((files (check-filelist (if (list? files) files (list files)))) 569 564 (rpath (repo-path)) 565 (rpathd (repo-path #t)) 570 566 (files (if *windows* 571 567 (map (lambda (f) … … 577 573 (dests (map (lambda (f) 578 574 (let ((from (if (pair? f) (car f) f)) 579 (to (make-dest-pathname rpath f)) )575 (to (make-dest-pathname rpathd f)) ) 580 576 (when (and (not *windows*) (equal? "so" (pathname-extension to))) 581 577 (run (,*remove-command* ,to)) ) 582 578 (copy-file from to) 583 to))579 (make-dest-pathname rpath f))) 584 580 files) ) ) 585 581 (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)) ) ) 590 592 (and-let* ((exs (assq 'examples info))) 591 593 (print "\n* Installing example files in " *example-directory* ":") … … 605 607 (when (setup-install-flag) 606 608 (let* ((files (check-filelist (if (list? files) files (list files)))) 607 (ppath ( program-path))609 (ppath (if *destdir* (make-pathname *destdir* "bin") (program-path))) 608 610 (files (if *windows* 609 611 (map (lambda (f) … … 651 653 (delete-file* (make-setup-info-pathname (->string ext))))) 652 654 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))) ) 655 661 (ensure-directory p) 656 662 p) ) … … 720 726 (define (download-repository-tree) 721 727 (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*)) 724 730 (if (null? hosts) 725 731 (error "unable to connect") … … 730 736 (or (handle-exceptions ex 731 737 (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) ) 733 740 (let-values (((i o) (setup-tcp-connect host port))) 734 741 (set! *last-decent-host* (car hosts)) … … 754 761 #t) 755 762 (loop) ) ) ) ) ) 756 (loop more) ) ) ) ) ) ) ) ) ) 763 (loop more) ) ) ) ) 764 ((x . _) (error "(internal) invalid host" x)) ) ) ) ) ) 757 765 758 766 (define *progress-indicator* … … 774 782 775 783 (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) 799 819 (define (requirements reqs) 800 820 (fold … … 812 832 (cond ((pathname-directory ext) 813 833 (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*)) 815 835 (set! *dont-ask* #t) 816 836 (download-data … … 838 858 (let loop ((filename filename)) 839 859 (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")) => 842 861 (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) 847 874 (when df (loop (pathname-file filename))) ) ) ) ) ) 848 875 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")) 851 878 852 879 (define (extension-documented? rpath fn) … … 938 965 (define (main args) 939 966 (define (parse-host host eggdir) 940 (set! repository-hosts967 (set! *repository-hosts* 941 968 (cons (match (string-match "(.+)\\:([0-9]+)" host) 942 969 ((_ host port) (list host (if eggdir "eggs" "") (string->number port))) 943 970 (_ (list host (if eggdir "eggs" "") 80)) ) 944 repository-hosts) ) )971 *repository-hosts*) ) ) 945 972 (setup-root-directory *base-directory*) 946 973 (let ((uinst #f) … … 974 1001 (repository-path dir) 975 1002 (loop more) ) 1003 (("-tree" file . more) 1004 (set! *repository-tree* (with-input-from-file file read)) 1005 (loop more) ) 976 1006 (("--" . more) 977 1007 (exit) ) … … 979 1009 (print (program-path)) 980 1010 (exit) ) 1011 (("-destdir" path . more) 1012 (set! *example-directory* (make-pathname path "examples")) 1013 (set! *destdir* path) 1014 (installation-prefix path) 1015 (loop more) ) 981 1016 (("-program-path" dir . more) 982 1017 (program-path dir) … … 1001 1036 (("-host" host . more) 1002 1037 (match (string-match "http://(.*)" host) 1003 ((_ host) 1004 (parse-host host #t) ) 1038 ((_ host) (parse-host host #t) ) 1005 1039 (_ (parse-host host #t)) ) 1006 1040 (loop more) ) … … 1045 1079 (set! anydone #t) 1046 1080 (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) ) 1047 1089 (("-fetch-tree" . more) 1048 1090 (set! *fetch-tree-only* #t) … … 1055 1097 1) 1056 1098 (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")) 1058 1100 (error "missing option argument" (car args)) ) 1059 1101 ((filename . more) -
chicken/csi.1
r1016 r2488 115 115 116 116 .TP 117 .BI \-ss\ pathname 118 Similar to 119 .B \-script 120 but invokes the procedure 121 .B main 122 after loading the file specified by 123 .B pathname 124 with a single argument (the list of command line arguments) returning any result as status code. 125 126 .TP 117 127 .BI \-R\ \-require\-extension\ name 118 128 Require extension for evaluated code. -
chicken/csi.scm
r2443 r2488 1 ;;;; csi.scm - Simple interpreter stub for CHICKEN1 ;;;; csi.scm - Interpreter stub for CHICKEN 2 2 ; 3 3 ; Copyright (c) 2000-2006, Felix L. Winkelmann … … 100 100 -k -keyword-style STYLE enable alternative keyword-syntax (none, prefix or suffix) 101 101 -s -script PATHNAME use interpreter for shell scripts 102 -ss PATHNAME shell script with `main' procedure 102 103 -R -require-extension NAME require extension before executing code 103 104 -I -include-path PATHNAME add PATHNAME to include path … … 832 833 833 834 (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) ) 835 836 836 837 (define-constant long-options 837 838 '("-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") ) 839 840 840 841 (define (canonicalize-args args) … … 843 844 '() 844 845 (let ((x (car args))) 845 (cond ((or (string=? "-s" x) (string=? "-s cript" x)) args)846 (cond ((or (string=? "-s" x) (string=? "-ss" x) (string=? "-script" x)) args) 846 847 ((and (fx> (##sys#size x) 2) 847 848 (char=? #\- (##core#inline "C_subchar" x 0)) … … 864 865 (let* ([extraopts (parse-option-string (or (getenv "CSI_OPTIONS") ""))] 865 866 [args (canonicalize-args (cdr (argv)))] 866 [loadlater #f]867 867 [kwstyle (member* '("-k" "-keyword-style") args)] 868 [script (member* '("-s" "-s cript") args)])868 [script (member* '("-s" "-ss" "-script") args)]) 869 869 (cond [script 870 (unless (pair? (cdr script)) (##sys#error "missing argument to `-script' option"))870 (unless (pair? (cdr script)) (##sys#error "missing script argument")) 871 871 (command-line-arguments (cddr script)) 872 872 (register-feature! 'script) 873 873 (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)))) 877 876 (set-car! (cdr script) sname) ) ) ] 878 877 [else … … 883 882 [batch (or script (member* '("-b" "-batch") args) eval?)] 884 883 [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") "") ";"))] ) 887 885 (define (collect-options opt) 888 886 (let loop ([opts args]) … … 893 891 (cons (cadr p) (loop (cddr p)))) ) ] 894 892 [else '()] ) ) ) 895 896 893 (define (loadinit) 897 894 (let ([fn (##sys#string-append "./" init-file)]) … … 902 899 (when (file-exists? fn) 903 900 (load fn) ) ) ) ) ) 904 905 901 (when (member* '("-h" "-help" "--help") args) 906 902 (print-usage) … … 945 941 (do ([args args (cdr args)]) 946 942 ((null? args) 947 (when loadlater (load loadlater))948 943 (unless batch 949 944 (repl) … … 954 949 arg 955 950 '("--" "-batch" "-quiet" "-no-init" "-no-warnings" "-script" "-b" "-q" "-n" "-w" "-s" "-i" 956 "-case-insensitive" ) ) )951 "-case-insensitive" "-ss") ) ) 957 952 ((member arg '("-feature" "-include-path" "-keyword-style" "-D" "-I" "-k")) 958 953 (set! args (cdr args)) ) … … 966 961 (eval x) ) 967 962 (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) ) ) ) ) ) ) ) ) ) ) ) 969 972 970 973 (run) -
chicken/eval.scm
r1928 r2488 576 576 p) ) ) 577 577 578 (define ##sys#unbound-in-eval #f) 579 578 580 (define ##sys#compile-to-closure 579 581 (let ([macro? macro?] … … 651 653 (cond-expand 652 654 [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))] ) ) ] 654 659 [(zero? i) (lambda (v) (##sys#slot (##sys#slot v 0) j))] 655 660 [else (lambda (v) (##sys#slot (##core#inline "C_u_i_list_ref" v i) j))] ) ) ] … … 1108 1113 (when (string? input) 1109 1114 (set! input (##sys#expand-home-path input)) ) 1110 (let ([isdir #f]1111 [fname1115 (let* ([isdir #f] 1116 [fname 1112 1117 (cond [(port? input) #f] 1113 1118 [(not (string? input)) (badfile input)] … … 2009 2014 (for-each (cut write-one <> ##sys#standard-output) xs) ) ) 2010 2015 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) ) 2016 2022 2017 2023 (define (saveports) … … 2060 2066 (##sys#read-char-0 ##sys#standard-input) ) 2061 2067 (##sys#clear-trace-buffer) 2068 (set! ##sys#unbound-in-eval '()) 2062 2069 (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 ) ) 2063 2091 (write-results result) 2064 2092 (loop) ) ) ) ) ) 2065 2093 (lambda () 2094 (set! ##sys#unbound-in-eval uie) 2066 2095 (##sys#error-handler ehandler) 2067 2096 (##sys#reset-handler rhandler) ) ) ) ) ) ) -
codewalk/codewalk.scm
r2443 r2488 38 38 (export expansion-context expansion-context? macroexpand ##sys#macroexpand-0 39 39 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) ) 41 41 42 42 … … 173 173 ((lambda) 174 174 (##sys#check-syntax 'lambda x '(lambda lambda-list . #(_ 1)) #f) 175 (let ((llist (cadr x))) 175 (let ((llist (cadr x)) 176 (body (cddr x)) ) 176 177 (when (##sys#extended-lambda-list? llist) 177 178 (set!-values 178 179 (llist body) 179 180 (##sys#expand-extended-lambda-list 180 llist (cddr x)181 llist body 181 182 ##sys#syntax-error-hook) ) ) 182 183 (##sys#decompose-lambda-list … … 288 289 (expander x) ) ) 289 290 (set! ##sys#compiler-toplevel-macroexpand-hook expander2) 291 (set! ##sys#interpreter-toplevel-macroexpand-hook expander2) 290 292 (when override-macroexpand 291 293 (set! macroexpand (lambda (exp . me) (expander exp))) -
egg-post-commit
r2486 r2488 84 84 (let* ([ii (cdr info)] 85 85 [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)))] 88 87 [htmlfile (make-pathname #f (->string (car info)) "html")] ) 89 88 `(tr (@ (style ,(conc "background-color: " color))) … … 151 150 (lambda (f) 152 151 (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"))) 154 153 (and (file-exists? mf) 154 (not (file-exists? (make-pathname f "_NO_EGG"))) 155 155 (begin 156 156 (print* f #\space) … … 190 190 (ftp:disconnect ftp) ) ) 191 191 192 (define (put-coop-index-page eggnames repofile)193 (print194 (nth-value195 0196 (http:send-request197 (http:make-request198 'PUT199 (conc +coop-egg-index-page+200 "&comment="201 (url-encode202 (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-string208 (cut pp209 `((head "Egg status index")210 "\n\nRecently updated eggs: " ,(->string eggnames)211 "\n\n"212 (html213 "<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-lambda219 ((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 228 192 ; Return the directory where the latest release for the egg is to be found, 229 193 ; relative to the base of the repository (eg. "svn-client/tags/1.2"). … … 240 204 241 205 (define (make-html-from-wiki egg-dir egg) 242 243 206 ; Load these extensions here so admins not using the wiki/streams can still 244 207 ; upload regular eggs (so the dependency is optional, only required in order 245 208 ; to upload eggs that use the wiki): 246 247 209 (use html-stream stream-ext srfi-40 stream-wiki) 248 249 210 (with-output-to-file (make-pathname egg-dir egg "html") 250 211 (lambda () … … 289 250 (meta (car (read-file (make-pathname egg-dir eggname "meta")))) 290 251 (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))) 293 253 (files (alist-ref 'files meta)) 294 254 (hidden (alist-ref 'hidden meta)) … … 329 289 `((date ,date)) ) ) 330 290 ,(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) ) ) 333 292 ,@(let ([needs (assq 'needs (cdr info))]) 334 293 (if needs -
stream-base64/stream-base64.html
r1 r2488 23 23 24 24 <ul> 25 <li>1.1 - added .setup script (felix)</li> 25 26 <li>1.0 (r1578) - First public release.</li> 26 27 </ul> -
stream-base64/stream-base64.meta
r1 r2488 1 1 ;;; stream-base64.meta -*- Hen -*- 2 (( file "stream-base64.scm")2 ((egg "stream-base64.egg") 3 3 (author "Alejandro Forero Cuervo") 4 4 (synopsis … … 6 6 (needs srfi-40 stream-ext) 7 7 (category parsing) 8 (files "stream-base64.scm" "stream-base64.setup" "stream-base64.html") 8 9 (license "Public Domain")) -
stream-cgi/stream-cgi.html
r30 r2488 21 21 22 22 <ul> 23 <li>1.4 - added .setup script (felix)</li> 23 24 <li>1.3 - Fixed bug in invocation of <code>hash-table-walk</code> [Thanks to Michal Dybizbanski] 24 25 <li>1.2 - Adapted to SRFI-69-compatible hash-tables -
stream-cgi/stream-cgi.meta
r617 r2488 1 1 ;;; stream-cgi.meta -*- Hen -*- 2 (( file "stream-cgi.scm")2 ((egg "stream-cgi.egg") 3 3 (author "Alejandro Forero Cuervo") 4 4 (synopsis … … 6 6 (category web) 7 7 (needs srfi-40 stream-ext content-type) 8 (files "stream-cgi.scm" "stream-cgi.html" "stream-cgi.setup") 8 9 (license "Public Domain")) -
stream-ldif/stream-ldif.html
r1 r2488 23 23 24 24 <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> 26 27 <li>1.0 (r1582) - First public release</li> 27 28 </ul> -
stream-ldif/stream-ldif.meta
r1 r2488 1 1 ;;; stream-ldif.meta -*- Hen -*- 2 (( file "stream-ldif.scm")2 ((egg "stream-ldif.egg") 3 3 (author "Alejandro Forero Cuervo") 4 4 (synopsis … … 6 6 (needs srfi-40 stream-ext stream-base64) 7 7 (category parsing) 8 (files "stream-ldif.scm" "stream-ldif.setup" "stream-ldif.html") 8 9 (license "Public Domain")) -
wiki/Accessing external objects
r1908 r2488 42 42 [syntax] (define-foreign-type NAME TYPE [ARGCONVERT [RETCONVERT]]) 43 43 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}}: 44 Defines 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 46 namespace of foreign type specifiers is separate from the normal 47 Scheme namespace. The optional arguments {{ARGCONVERT}} and 48 {{RETCONVERT}} should evaluate to procedures that map argument- and 49 result-values to a value that can be transformed to {{TYPE}}: 51 50 52 51 <enscript highlight=scheme> … … 77 76 78 77 Defines a foreign variable of name {{NAME}} (a symbol). {{STRING}} 79 should be the real name of a foreign variable or parameterless macro. If80 {{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.78 should be the real name of a foreign variable or parameterless 79 macro. If {{STRING}} is not given, then the variable name {{NAME}} 80 will be converted to a string and used instead. All references and 81 assignments (via {{set!}}) are modified to correctly convert values 82 between Scheme and C representation. This foreign variable can only be 83 accessed in the current compilation unit, but the name can be 84 lexically shadowed. Note that {{STRING}} can name an arbitrary C 85 expression. If no assignments are performed, then {{STRING}} doesn't 86 even have to specify an lvalue. 88 87 89 88 <enscript highlight=scheme> -
wiki/The User's Manual
r2192 r2488 3 3 == Introduction 4 4 5 ''(This document describes version 2.50 2)''5 ''(This document describes version 2.505)'' 6 6 7 7 '''CHICKEN is a compiler that translates Scheme source files into C''', which in -
wiki/Using the interpreter
r2465 r2488 44 44 ; -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. 45 45 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 46 48 ; -R -require-extension NAME : Equivalent to evaluating {{(require-extension NAME)}}. 47 49 … … 87 89 accept more than 8 arguments. 88 90 91 Since 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))}} 94 after loading all top-level forms of the script file. The result of {{main}} is returned as the exit status 95 to 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> 89 109 90 110 === Toplevel commands -
wiki/chicken-setup
r2192 r2488 6 6 === Extension libraries 7 7 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. 8 Extension libraries (''eggs'') are extensions to the core 9 functionality provided by the basic CHICKEN system, to be built and 10 installed separately. The mechanism for loading compiled extensions 11 is based on dynamically loadable code and as such is only available on 12 systems on which loading compiled code at runtime is 13 supported. Currently these are most UNIX-compatible platforms that 14 provide the {{libdl}} functionality like Linux, Solaris, BSD, Mac OS X 15 and Windows using Cygwin. 16 17 Note: Extension may also be normal applications or shell scripts, but 18 are usually libraries. 19 20 {{chicken-setup}} will download the source code for extension 21 automatically from the canonical server at 22 [[http://www.call-with-current-continuation.org/eggs]] if the 23 requested egg does not exist in the current directory. Various 24 command-line options exist for customizing the process and/or 25 retrieving the egg from other locations or in other formats. 18 26 19 27 … … 21 29 22 30 To 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. 31 with the extension name as argument. The extension archive is 32 downloaded, its contents extracted and the contained ''setup'' script 33 is executed. This setup script is a normal Scheme source file, which 34 will be interpreted by {{chicken-setup}}. The complete language 35 supported by {{csi}} is available, and the library units {{srfi-1 36 regex utils posix tcp}} are loaded. Additional libraries can be loaded 37 at run-time. 38 39 The setup script should perform all necessary steps to build the new 40 library (or application). After a successful build, the extension can 41 be installed by invoking one of the procedures {{install-extension}}, 42 {{install-program}} or {{install-script}}. These procedures will copy 43 a number of given files into the extension repository or in the path 44 where the CHICKEN executables are located (in the case of executable 45 programs or scripts). Additionally the list of installed files, and 46 user-defined metadata is stored in the repository. 41 47 42 48 If no extension name is given on the command-line, and if none of the 43 49 options {{-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 52 directory are processed. 47 53 48 54 49 55 === Creating extensions 50 56 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 setupscript has to be in the root path of the archive.57 Extensions can be created by creating an (optionally gzipped) {{tar}} 58 archive named {{EXTENSION.egg}} containing all needed files plus a 59 {{.setup}} script in the root directory. After {{chicken-setup}} has 60 extracted the files, the setup script will be invoked. There are no 61 additional constraints on the structure of the archive, but the setup 62 script has to be in the root path of the archive. 57 63 58 64 … … 288 294 </enscript> 289 295 296 We 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 310 do the right thing on Windows) 311 290 312 After entering 291 313 292 314 $ chicken-setup hello 293 315 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). 316 at the shell prompt (and in the same directory where the two files 317 exist), the file {{hello.scm}} will be compiled into a dynamically 318 loadable library. If the compilation succeeds, {{hello.so}} will 319 be stored in the repository, together with a file named 320 {{hello.setup-info}} containing an a-list with metadata. 321 If no extension name is given to {{chicken-setup}}, it will simply 322 execute the first file with the {{.setup}} extension it can find. 299 323 300 324 Use it like any other CHICKEN extension: … … 302 326 $ csi -q 303 327 #;1> (require-extension hello) 304 ; loading /usr/local/lib/chicken/ hello.so ...328 ; loading /usr/local/lib/chicken/1/hello.so ... 305 329 #;2> (hello "me") 306 330 Hello, me! 307 331 #;3> 308 332 309 For more elaborate build operations, when installing applications or scripts, or when310 additional metadata should be stored for an extension, a {{setup}} script is required311 and the script and all additional files should be packaged in a gzipped {{tar}} archive.312 313 333 Here we create a simple application: 314 334 … … 326 346 ;;;; hello2.setup 327 347 328 ( run (csc hello2.scm)) ; compile `hello2'348 (compile hello2.scm) ; compile `hello2' 329 349 (install-program 'hello2 "hello2") ; name of the extension and files to be installed 330 350 </enscript> … … 332 352 To use it, just run {{chicken-setup}} in the same directory: 333 353 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 358 Now the program {{hello2}} will be installed in the same location as 359 the other CHICKEN tools (like {{chicken}}, {{csi}}, etc.), which will 360 normally be {{/usr/local/bin}}. Note that you need write-permissions 361 for those locations and may have to run {{chicken-setup}} with 362 administrative rights. 339 363 340 364 Uninstallation is just as easy: … … 342 366 $ chicken-setup -uninstall hello2 343 367 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 369 be of arbitrary complexity. When running {{chicken-setup}} with an 370 argument {{NAME}}, for which no associated file {{NAME.setup}}, 371 {{NAME.egg}} or {{NAME.scm}} exists will ask you to download the 372 extension via HTTP from the default URL 373 [[http://www.call-with-current-continuation.org/eggs]]. You can use 374 the {{-host}} option to specify an alternative source 375 location. Extensions that are required to compile and/or use the 376 requested extension are downloaded and installed automatically. 377 378 If the given extension name contains a path prefix and the {{-host}} 379 option is given, then {{chicken-setup}} can also download and install 380 eggs from an arbitrary HTTP server. Alternatively you can pass a full 381 URL (including the {{http://}} prefix. Note that no dependency checks 382 are done when downloading eggs directly with the URL syntax. 383 384 Finally a somewhat more complex example: We want to package a syntax 385 extension with additional support code that is to be loaded at 386 run-time of any Scheme code that uses that extension. We create a 387 ''glass'' lambda, a procedure with free variables that can be 388 manipulated from outside: 361 389 362 390 <enscript highlight=scheme> … … 400 428 401 429 <enscript highlight=scheme> 402 ( run (csc -s -O2 -d0 glass-support.scm))430 (compile -s glass-support.scm) 403 431 404 432 (install-extension … … 408 436 </enscript> 409 437 410 The invocation of {{install-extension}} provides the files that 411 are tobe copied into the extension repository, and a metadata list that438 The invocation of {{install-extension}} provides the files that are to 439 be copied into the extension repository, and a metadata list that 412 440 specifies 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. 441 if it is declared to be used by other code (either with the 442 {{require-extension}} or {{require-for-syntax}} form), then client 443 code should perform an implicit {{(require 'glass-support)}} at 444 startup. 416 445 417 446 This can be conveniently packaged as an ''egg'': … … 424 453 $ csi -quiet 425 454 #;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 ... 428 457 #;2> (define foo (glass-lambda (x) (y) (+ x y))) 429 458 #;3> (glass-lambda-set! foo 'y 99) … … 453 482 ; {{-t -test EXTENSION ...}} : return success if all given extensions are installed 454 483 ; {{-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) 456 489 ; {{--}} : Ignore all following arguments. 457 490 … … 461 494 === Windows notes 462 495 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 497 depends on the {{tar}} and {{gunzip}} tools to extract the contents of 498 an egg. The best way is to download an egg either manually (or with 499 {{chicken-setup -fetch}}) and extract its contents with a separate 500 program (like {{winzip}}). the {{CHICKEN_REPOSITORY}} environment 501 variable has to be set (in addition to {{CHICKEN_HOME}}) to a 502 directory where your compiled extensions should be located. 503 504 The {{.setup}} scripts will not always work under Windows, and the 505 extensions may require libraries that are not provided for Windows or 506 work differently. Under these circumstances it is recommended to 507 perform the required steps to build an extension manually. 508 509 The required UNIX tools are also available as Windows binaries. 510 Google or ask on the CHICKEN mailing list if you need help locating 511 them. 512 513 514 === Other modes if installation 515 516 It is possible to install extensions directly from a 517 [[http://subversion.tigris.org|Subversion]] repository or from a local 518 checkout by using the {{-svn}} or {{-local}} options. By using 519 either the {{svn}} client program (which must be installed) or 520 file-system operations all necessary files will be copied into the 521 current directory (creating a subdirectory named 522 {{EXTENSIONNAME.egg-dir}}), built and subsequently installed. 523 524 Dependency information which is necessary to ensure required 525 extensions are also installed is downloaded automatically. If you 526 have no internet connection or don't want to connect, you can als use 527 a 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]], 530 writing it to stdout. Redirecting this output into a file and passing 531 the file via the {{-tree}} option to {{chicken-setup}} allows you now 532 to use the local repository file: 533 534 Retrieve complete extension repository (big): 535 536 % cd /opt 537 % svn co https://galinha.ucpel.tche.br/svn/chicken-eggs 538 539 Get your own copy of the repository file: 540 541 % chicken-setup -fetch-tree >~/my-repository-file 542 543 Now you can install eggs from your local checkout, with full 544 dependency 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 472 549 473 550 Previous: [[Interface to external functions and variables]] -
wiki/eggs guidelines
r1562 r2488 9 9 10 10 ; 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 CSIshould 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. 12 12 ; Authors : 13 13 ; License : -
wiki/eggs tutorial
r2480 r2488 65 65 In order for {{chicken-setup}} to install your extension, we recommend that you create a {{mpeg3.setup}} file with information about your egg. 66 66 {{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).70 67 71 68 If your egg does not contain macros, your setup file should look similar to the following: … … 156 153 ;web: Web programming 157 154 ;xml: XML processing 155 ;sound: Sound related stuff 158 156 159 157 == Managing eggs in the repository
Note: See TracChangeset
for help on using the changeset viewer.