Re: [Chicken-users] Chicken-setup
Thanks, that's what I needed. (It might be a good idea to put this in the README file for chicken :-) ) Bill Peter Bex wrote: On Sat, May 30, 2009 at 06:36:51PM -0400, bill wrote: Hi all, I've just moved my system to Xubuntu. The Ubuntu repository is running 3.2.7!!! I downloaded chicken-4.0.0, which I've been running for some time, but it does not seem to build chicken-setup. How do I get a new clean copy of chicken-setup? There is no chicken-setup for Chicken 4! It comes with a new set of egg repository maintenance scripts to replace it. Try chicken-install, chicken-status and chicken-uninstall instead :) Cheers, Peter ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Easyffi
Hi again, I'm still trying to get back into run m ode with Xubuntu and now I'm finding a problem with easyffi. I use gtk+ in my user interface and access it through easyffi.This is an old program that's worked for a long time - including in Chicken-4.0.0 on Gentoo. It compiles fine, but now I get the following runtime error: Error: unbound variable: foreign-parse Call history: foreign-parse-- The offending lines are only in the c code - I don't use 'foreign-parse' anywhere in the scheme code. Any ideas on what could be wrong? I rather like the Xubuntu distribution and would hate to go back to Gentoo. Bill ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Scope problem?
Hi, all-- I am working with the FastCGI egg, and have run into something that has me really puzzled and a bit worried. [ BTW, yes, I have ported this egg to Chicken 4.0 for my own use ... wanted to get going quickly on my web app. But if the original author(s) is unavailable, or lacks the time or desire to port the egg, I would be glad to contribute my work to the official collection--with the understanding that I don't have much expertise in interfacing w/ C libraries, and I may have accidentally inserted code that will delete all your files, or send out thousands of embarrassing e-mails with your signature ] After installing my modified egg, I attempted to deploy the demo app from the egg documentation. Basically, it starts an endless loop with either (fcgi-external-server-accept-loop ...) or (fcgi-dynamic-server-accept-loop ...) ... where 'external' means your app is executed independently of the Web server, while 'dynamic' means it is executed by the Web server. Anyway, when invoking either of these functions you pass a request-handler callback. The callback is itself a HOF with 4 required parameters, (in out err env). In, out, and err should be self-explanatory; env gives access to environment variables, and it may be invoked as: (env VARNAME), which returns the value of 1 variable, (env VARNAME DEFAULT)-- like the previous but with a default value, and (env), which should return all environment variables as an assoc list. Anyway, the demo app is supposed to display the results of (env SERVER_NAME [unknown]) followed by the results of (env). I found that the first form worked, but the second (reading all environment variables) did not. [ omitting lots of unsuccessful code edits and config file tweaks ] Eventually I saw a stack trace saying unbound variable: string-length Okay, so we needed the srfi-13 module? Yes, but here's what's strange: * No function or variable from srfi-13 is used in the demo app itself. * SRFI-13 functions are used within the fastcgi module -- but I already had (import srfi-13) in that scope. * When I added (require-extension srfi-13) TO THE APP, it started working. Maybe there's just some key point about the Chicken module system that I don't understand, but this seems like very wrong behavior. BTW, I am running Chicken SVN rev. 14767 on Linux. So, do I need further education, or should I report a bug? -- Matt Gushee : Bantam - lightweight file manager : matt.gushee.net/software/bantam/ : : RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ : ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Scope problem?
On Sun, May 31, 2009 at 04:11:27PM -0600, Matt Gushee wrote: So, do I need further education, or should I report a bug? I think we need to see the actual code to your fastcgi port to know more. By the way, string-length is a R5RS procedure, so you shouldn't need srfi-13. (which makes it extra-odd that it works when you load srfi-13) Cheers, Peter -- http://sjamaan.ath.cx -- The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music. -- Donald Knuth pgpO0xAnS4R6L.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Scope problem?
Peter Bex wrote: On Sun, May 31, 2009 at 04:11:27PM -0600, Matt Gushee wrote: So, do I need further education, or should I report a bug? I think we need to see the actual code to your fastcgi port to know more. By the way, string-length is a R5RS procedure, so you shouldn't need srfi-13. (which makes it extra-odd that it works when you load srfi-13) Sorry, it wasn't string-length, it was string-index. Also, one more detail that may be relevant: in this exploratory phase of development, I am running the code script-style, i.e. the script begins w/ #!/usr/local/bin/chicken -script Anyway, the fastcgi module code follows. I didn't change much: * Replace the old unit declarations with appropriate module declarations. * Changed miscellaneous foreign types as necessary. * Replaced a define-foreign-record section w/ define-foreign-record-type * Replaced all instances of make-property-condition with make-exn-condition * Replaced the byte-vector in (get-scheme-str) with a u8vector. I think that's about it. I can't say that I completely understand the code, though I will certainly learn it better as needed. -- BEGIN fastcgi.scm [ copyright notice omitted ] (module fastcgi ( fcgi-external-server-accept-loop fcgi-dynamic-server-accept-loop fcgi-accept-loop fcgi-get-post-data *fcgi-slurp-chunk-size* ) ( import scheme chicken matchable lolevel srfi-1 srfi-4 srfi-13 foreign foreigners conditions ) ;;; Stop the compiler complaining about implicit definitions. (foreign-declare struct fcgx_request; struct fcgx_stream; int FCGX_Init(); int FCGX_OpenSocket(char *, int); int FCGX_InitRequest(struct fcgx_request *, int, int); int FCGX_Accept_r(struct fcgx_request *); int FCGX_Finish_r(struct fcgx_request *); char *FCGX_GetParam(char *, char **); int FCGX_PutStr(char *, int, struct fcgx_stream *); int FCGX_GetStr(char *, int, struct fcgx_stream *); int FCGX_HasSeenEOF(struct fcgx_stream *); ) ;;; ;;; Low-level bindings for types/functions. ;;; (define-foreign-type fcgx-stream c-pointer) (define-foreign-type fcgx-param-array (c-pointer c-string)) ;; Apparently define-foreign-record no longer exists (define-foreign-record-type fcgx_request (constructor: make-fcgx_request) (int requestId fcgx_request-requestId) (int role fcgx_request-role) (fcgx-stream in fcgx_request-in) (fcgx-stream out fcgx_request-out) (fcgx-stream error fcgx_request-error) (fcgx-param-array env fcgx_request-env) ;; This is private stuff which in theory could change in future ;; (though AFAIK libfcgi hasn't changed significantly for years.) ;; We don't access these fields, but we need to allocate the correct ;; amount of memory when creating an FCGX_Request struct. (c-pointer params fcgx_request-params) (int ipcFd fcgx_request-ipcFd) (int isBeginProcessed fcgx_request-isBeginProcessed) (int keepConnection fcgx_request-keepConnection) (int appStatus fcgx_request-appStatus) (int nWriters fcgx_request-nWriters) (int flags fcgx_request-flags) (int listen_sock fcgx_request-listen_sock)) (define fcgx-init (foreign-lambda int FCGX_Init)) (define fcgx-open-socket (foreign-lambda int FCGX_OpenSocket c-string int)) (define fcgx-init-request (foreign-lambda int FCGX_InitRequest fcgx_request int int)) (define fcgx-accept-r (foreign-lambda int FCGX_Accept_r fcgx_request)) (define fcgx-finish-r (foreign-lambda int FCGX_Finish_r fcgx_request)) (define fcgx-get-param (foreign-lambda c-string FCGX_GetParam c-string fcgx-param-array)) (define fcgx-put-str (foreign-lambda int FCGX_PutStr c-string int fcgx-stream)) (define fcgx-get-str (foreign-lambda int FCGX_GetStr c-pointer int fcgx-stream)) (define fcgx-has-seen-eof (foreign-lambda bool FCGX_HasSeenEOF fcgx-stream)) (define fcgi-discard-input (foreign-lambda* void ((fcgx-stream s)) char buf[1024];while(FCGX_GetStr(buf,sizeof buf,s)0);)) ;;; ;;; The (relatively) high-level Scheme interface. ;;; (define (wrap-out-stream s) (lambda (o) ;;; Keep writing until all the characters in o have been written, or ;;; until fcgx-put-str returns 0, in which case we raise an exception. (let loop ((to-write (string-length o))) (unless (= 0 to-write) (let ((n (fcgx-put-str o to-write s))) (if ( n 0) (abort (make-exn-condition 'exn Error writing to libfcgi stream #f)) (loop (- to-write n (define *fcgi-slurp-chunk-size* 200) (define (fcgi-get-scheme-str size s) (let*( (buf (make-u8vector size)) (bufsz ((foreign-lambda* int ((u8vector buf)(int n)(fcgx-stream s)) { unsigned char *i = buf,
Re: [Chicken-users] Scope problem?
On Sun, May 31, 2009 at 05:06:37PM -0600, Matt Gushee wrote: Sorry, it wasn't string-length, it was string-index. OK, that clarifies it a bit ;) -- BEGIN fastcgi.scm [ copyright notice omitted ] ( import scheme chicken matchable lolevel srfi-1 srfi-4 srfi-13 foreign foreigners conditions ) [code] Import simply loads the import library (FOO.import.so) for each library FOO you import, it doesn't actually load the library itself. This makes no difference for built-in libraries that are part of libchicken.so, but for matchable, srfi-4, srfi-1, foreigners and srfi-13 you will have to add a statement to load them as well. You can either add (require-library srfi-13 srfi-1 srfi-4 matchable foreigners) to your code, or replace the import and require-library pair with one (use ...) or one (require-extension ...) expression. Hope this helps! Cheers, Peter -- http://sjamaan.ath.cx -- The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music. -- Donald Knuth pgpvSB6p1jEoC.pgp Description: PGP signature ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Scope problem?
Peter Bex wrote: Import simply loads the import library (FOO.import.so) for each library FOO you import, it doesn't actually load the library itself. This makes no difference for built-in libraries that are part of libchicken.so, but for matchable, srfi-4, srfi-1, foreigners and srfi-13 you will have to add a statement to load them as well. You can either add (require-library srfi-13 srfi-1 srfi-4 matchable foreigners) to your code, or replace the import and require-library pair with one (use ...) or one (require-extension ...) expression. Hope this helps! Well, it helps me to investigate further. But I don't think the actual behavior I have observed quite matches your explanation. For example, it appears that just about any FastCGI request will access symbols defined in foreigners and matchable, yet I have not seen any errors related to those extensions (or rather, I did at first, but not after I added the declarations to import them). Also, I notice that matchable and foreigners are eggs, while srfi-1, -4, and -13 are ... umm, what are they? They are installed with the core distribution, and listed in the Supported Language section of the Manual --but you say they should be treated as extensions? -- Matt Gushee : Bantam - lightweight file manager : matt.gushee.net/software/bantam/ : : RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ : ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Scope problem?
I actually ported this a few weeks back and have been running with no problems. The original author, Alex Drummond was going to email Felix to get me hooked up to commit the new egg, but I haven't heard what has become of that. In the meantime, here's the code: fastcgi.scm Description: Binary data fastcgi.setup Description: Binary data On May 31, 2009, at 6:44 PM, Matt Gushee wrote: Peter Bex wrote: Import simply loads the import library (FOO.import.so) for each library FOO you import, it doesn't actually load the library itself. This makes no difference for built-in libraries that are part of libchicken.so, but for matchable, srfi-4, srfi-1, foreigners and srfi-13 you will have to add a statement to load them as well. You can either add (require-library srfi-13 srfi-1 srfi-4 matchable foreigners) to your code, or replace the import and require-library pair with one (use ...) or one (require-extension ...) expression. Hope this helps! Well, it helps me to investigate further. But I don't think the actual behavior I have observed quite matches your explanation. For example, it appears that just about any FastCGI request will access symbols defined in foreigners and matchable, yet I have not seen any errors related to those extensions (or rather, I did at first, but not after I added the declarations to import them). Also, I notice that matchable and foreigners are eggs, while srfi-1, -4, and -13 are ... umm, what are they? They are installed with the core distribution, and listed in the Supported Language section of the Manual --but you say they should be treated as extensions? -- Matt Gushee : Bantam - lightweight file manager : matt.gushee.net/software/ bantam/ : : RASCL's A Simple Configuration Language : matt.gushee.net/ rascl/ : ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users