[Chicken-users] Surprising testbase behaviour
Using define-test procedures with arguments inside test/case constructs seems to terminate in rather unexpected fashion; that is, the first such call ends the test/case. See attached code and output. -Robin -- Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo Proud Supporter of the Singularity Institute - http://singinst.org/ http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ (use testbase testbase-output-compact testbase-output-human testbase-output-html testbase-output-minimal) (define-test (my-test arg) "My Test" (test/case (conc "My Test: " arg) (expect-eq 'baz 'baz))) (define-test (my-test2 arg) "My Test 2" (test/case (conc "My Test 2: " arg) (expect-eq 'weeble 'weeble))) (define-test basic-test "Stuff" (test/case "More Stuff" (expect-eq 'qux 'qux) (my-test 'foo) (expect-eq 'qux 'qux) (my-test 'bar) (expect-eq 'qux 'qux)) (test/case "More Stuff2" (expect-eq 'qux 'qux) (my-test2 'foo) (expect-eq 'qux 'qux) (my-test2 'bar) (expect-eq 'qux 'qux)) (my-test 'foo) (my-test 'bar) ) (test::for-each (cut test::styler-set! <> test::output-style-human)) (run-test "Some Testing") ** Running Some Testing ** Test Suite: Stuff Test Case: More Stuff Expectation: Expect eq Expected: qux Unevaluated: (quote qux) Evaluated: qux Passed: Test Suite: My Test: Test Case: My Test: foo Expectation: Expect eq Expected: baz Unevaluated: (quote baz) Evaluated: baz Passed: Passed: My Test: foo Passed: My Test: Passed: More Stuff Test Case: More Stuff2 Expectation: Expect eq Expected: qux Unevaluated: (quote qux) Evaluated: qux Passed: Test Suite: My Test 2: Test Case: My Test 2: foo Expectation: Expect eq Expected: weeble Unevaluated: (quote weeble) Evaluated: weeble Passed: Passed: My Test 2: foo Passed: My Test 2: Passed: More Stuff2 Test Suite: My Test: Test Case: My Test: foo Expectation: Expect eq Expected: baz Unevaluated: (quote baz) Evaluated: baz Passed: Passed: My Test: foo Passed: My Test: Test Suite: My Test: Test Case: My Test: bar Expectation: Expect eq Expected: baz Unevaluated: (quote baz) Evaluated: baz Passed: Passed: My Test: bar Passed: My Test: Passed: Stuff ALL TESTS SUCCESSFUL! ** Passed Some Testing ** ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Chapter 1 is ready
Some time ago, I posted a draft of a rework of Chapter 1 of the manual, at http://chicken.wiki.br/new-chapter1. A number of you made changes and additions, and today I made my final set of revisions, so I now declare this to be Ready To Go. I'm not sure of the exact mechanism for doing this, so I'll leave in the capable hands of whoever is responsible for the manual the task of making it the new official Chapter 1. My next task is going to be a revision of Chapter 3, on the compiler. -- v ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] bug and potential fix for numbers egg
> "John" == John Cowan <[EMAIL PROTECTED]> writes: John> Alex Shinn scripsit: >> As a potential workaround, I've attached a patch >> which first checks if both the numerator and >> denominator fit within a long (there's no direct way >> to check if they fit in a double), and if so just >> uses the straight C operations >> >> (double) numerator / (double) denominator >> >> which is more accurate than what GMP does! John> I think that's the right general idea, but "long" John> can be 32 bits, and often is; I think you need to John> use a system-dependent type that can be guaranteed John> to be 64 bits (does Chicken have one?). Well, we're restricted to the GMP API, which gives us mpz_fits_slong_p and mpz_get_d but no mpz_fits_double_p or mpz_fits_long_long_p. So I believe this is the most accurate we can hope for in a straightforward manner. -- Alex ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] http cookie order
On Fri, Mar 28, 2008 at 8:31 PM, Drake Wilson <[EMAIL PROTECTED]> wrote: > [RFC excerpts snipped] > My interpretation of this is: > > - Forwarders are not permitted to rearrange multiple Set-Cookie > headers. HTTP client and server libraries have the same > constraint. > > - Origin servers should not generate multiple Set-Cookie headers in > the same response for the same (name, domain, path) tuple, since > it is not clear what one should do with them. > > - Clients should interpret Set-Cookie headers in the order they are > received, partly because it's a more constrained interpretation of > the term "pre-existing" in the spec, and partly due to rude-ish > websites that will return ambiguous responses and expect that > interpretation. (I do not know of any site that expects a > different interpretation of multiple cookies overwriting each > other in the same response.) Excellent analysis, Drake. I think your interpretation is on the money. > (RFC 2109 is also supposedly "obsoleted" by RFC 2965, but that > describes the behavior of Set-Cookie2 headers, not Set-Cookie headers, > and it doesn't seem any clearer.) Yes, I find that odd as well. :-) Thanks, Graham ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] http cookie order
Quoth Graham Fawcett <[EMAIL PROTECTED]>, on 2008-03-28 09:59:16 -0400: > RFC2109 allows for multiple Set-Cookies, but it also > warns that "an intervening gateway could fold multiple such headers > into a single header". Since "folding" is undefined, there's no way > the origin server can guarantee the sequence of the cookies in the > received header. FWIW, from RFC 2616 (HTTP/1.1), section 4.2: | Multiple message-header fields with the same field-name MAY be | present in a message if and only if the entire field-value for that | header field is defined as a comma-separated list [i.e., #(values)]. | [...] The order in which header fields with the same field-name are | received is therefore significant to the interpretation of the | combined field value, and thus a proxy MUST NOT change the order of | these field values when a message is forwarded. >From RFC 2109 (HTTP State Management Mechanism), section 4.3.3: | If a user agent receives a Set-Cookie response header whose NAME is | the same as a pre-existing cookie, and whose Domain and Path | attribute values exactly (string) match those of a pre-existing | cookie, the new cookie supersedes the old. It's not entirely clear whether "pre-existing" means "from a previous request" or not. A Web search does not turn up much discussion on the matter. A previous preliminary specification, http://wp.netscape.com/newsref/std/cookie_spec.html, writes "with the latest instance taking precedence" which is also somewhat ambiguous in that "latest" may or may not mean "latest within the same response". My interpretation of this is: - Forwarders are not permitted to rearrange multiple Set-Cookie headers. HTTP client and server libraries have the same constraint. - Origin servers should not generate multiple Set-Cookie headers in the same response for the same (name, domain, path) tuple, since it is not clear what one should do with them. - Clients should interpret Set-Cookie headers in the order they are received, partly because it's a more constrained interpretation of the term "pre-existing" in the spec, and partly due to rude-ish websites that will return ambiguous responses and expect that interpretation. (I do not know of any site that expects a different interpretation of multiple cookies overwriting each other in the same response.) (RFC 2109 is also supposedly "obsoleted" by RFC 2965, but that describes the behavior of Set-Cookie2 headers, not Set-Cookie headers, and it doesn't seem any clearer.) ---> Drake Wilson ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] autoconf build failing on posixunix.c
Sorry I was not clear. I am using Chicken 3.0.0 but I am trying to build a binary using the Chicken source together with my app. The reason being I want to distribute the binary on platforms (embedded Linux) without Chicken. It is just the posix unit giving me problems. I only appear to be using a couple of functions from the posix unit so I could I guess just add my own FFI to those functions and remove posixunix.c from the build. John. On 28/03/2008, John Cowan <[EMAIL PROTECTED]> wrote: > john scripsit: > > > Hi, I am trying to build a binary using autoconf. Everything had been > > working fine until my program required the posix unit. The build now > > bombs out as follows: > > > The autoconf build has been dead for a long time. Please download a more > recent > snapshot and build that. > > > -- > John Cowan [EMAIL PROTECTED] http://ccil.org/~cowan > Promises become binding when there is a meeting of the minds and > consideration > is exchanged. So it was at King's Bench in common law England; so it was > under the common law in the American colonies; so it was through more than > two centuries of jurisprudence in this country; and so it is today. >--Specht v. Netscape > ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] autoconf build failing on posixunix.c
john scripsit: > Hi, I am trying to build a binary using autoconf. Everything had been > working fine until my program required the posix unit. The build now > bombs out as follows: The autoconf build has been dead for a long time. Please download a more recent snapshot and build that. -- John Cowan [EMAIL PROTECTED] http://ccil.org/~cowan Promises become binding when there is a meeting of the minds and consideration is exchanged. So it was at King's Bench in common law England; so it was under the common law in the American colonies; so it was through more than two centuries of jurisprudence in this country; and so it is today. --Specht v. Netscape ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Win32 Threading Issue
hi, On Thu, Mar 27, 2008 at 06:12:15PM -0400, Raymond Medeiros wrote: > (define send-data > (lambda (ip port msg) > (define-values (i o) (tcp-connect (->string ip) port)) > (write msg o) > (let ((result (read-line i))) > (close-input-port i) > (close-output-port o) result))) if i had to guess i'd try to move the (close-output-port o) before the read-line. but i don't have windows. hth&bye, hans. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] how to access all error info in with-exception-handler?
hi, On Fri, Mar 28, 2008 at 04:34:48PM -0500, Heinrich Taube wrote: > now, when i trap the same error in an environmentn with my error handler > all i seem to get is the first part of the string, ie the message without > the symbol name: > > >>> Error: unbound variable > > my question is: how can i get a string that will contain what error > messages normally show in the repl?? i think the rest is in (condition-property-accessor 'exn 'arguments). you can also use print-error-message and print-call-chain from the library unit. hth&bye, hans. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] autoconf build failing on posixunix.c
Hi, I am trying to build a binary using autoconf. Everything had been working fine until my program required the posix unit. The build now bombs out as follows: posixunix.c: In function 'stub355': posixunix.c:615: error: 'C_group' undeclared (first use in this function) posixunix.c:615: error: (Each undeclared identifier is reported only once posixunix.c:615: error: for each function it appears in.) posixunix.c: In function 'f_3109': posixunix.c:10388: error: 'C_group' undeclared (first use in this function) posixunix.c: In function 'f_3119': posixunix.c:10404: error: 'C_group' undeclared (first use in this function) posixunix.c: In function 'f_3127': posixunix.c:10482: error: 'C_group' undeclared (first use in this function) posixunix.c: In function 'f_2730': posixunix.c:11067: error: 'C_pipefds' undeclared (first use in this function) posixunix.c: In function 'f_2734': posixunix.c:11081: error: 'C_pipefds' undeclared (first use in this function) make: *** [posixunix.o] Error 1 Any pointers as what is missing from the build? I had a grep around the source but I am lost. TIA, John. ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] how to access all error info in with-exception-handler?
I have an error handler that traps errors under callbacks using with- exception-handler. its wroking quite well except that I dont know how to get all the error information to print out. for example if i eval an unbound symbol in the REPL the message includes the name of the offending symbol: #;50> baz Error: unbound variable: baz now, when i trap the same error in an environmentn with my error handler all i seem to get is the first part of the string, ie the message without the symbol name: >>> Error: unbound variable my question is: how can i get a string that will contain what error messages normally show in the repl?? here what my with-exception-handler looks like (its only part of the macroexpantion so not everytnig is shown, just pretend print-error calls display, etc:) (call-with-current-continuation (lambda (%%stopproc%%) (with-exception-handler (lambda (err112) (print-error (sprintf ">>> Error: ~A~%" ((condition-property-accessor 'exn 'message) err112) )) (%%stopproc%% -2)) (lambda () (if (>= v108 v109) (begin (%%stopproc%% -1))) (print "hiho") (set! v108 (+ v108 1)) wait111 thansk for any info, --rick ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] bug and potential fix for numbers egg
Alex Shinn scripsit: > As a potential workaround, I've attached a patch which first > checks if both the numerator and denominator fit within a > long (there's no direct way to check if they fit in a > double), and if so just uses the straight C operations > > (double) numerator / (double) denominator > > which is more accurate than what GMP does! I think that's the right general idea, but "long" can be 32 bits, and often is; I think you need to use a system-dependent type that can be guaranteed to be 64 bits (does Chicken have one?). -- John Cowan [EMAIL PROTECTED] ccil.org/~cowan Dievas dave dantis; Dievas duos duonos --Lithuanian proverb Deus dedit dentes; deus dabit panem --Latin version thereof Deity donated dentition; deity'll donate doughnuts --English version by Muke Tever God gave gums; God'll give granary --Version by Mat McVeagh ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Win32 Threading Issue
On Thu, Mar 27, 2008 at 6:12 PM, Raymond Medeiros <[EMAIL PROTECTED]> wrote: > > can someone give me a reasonable explanation as to why this would not > work on Win32 but works properly on Linux? > what am i missing here? Just curious, in what way doesn't it work? Graham > > (use tcp-server) > > (thread-start! >(make-thread > (lambda () >((make-tcp-server > (tcp-listen 9000) > (lambda () > (write-line (conc "response: " (read) > #t)) > )) > (thread-yield!) > > (define send-data >(lambda (ip port msg) > (define-values (i o) (tcp-connect (->string ip) port)) > (write msg o) > (let ((result (read-line i))) >(close-input-port i) >(close-output-port o) result))) > > > (letrec ((loop > (lambda () > (pp (send-data "127.0.0.1" 9000 "hi")) > (loop >(loop)) > > > > ___ > 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
Re: [Chicken-users] http cookie order
On Thu, Mar 27, 2008 at 9:07 PM, Tony Sidaway <[EMAIL PROTECTED]> wrote: > Using http.egg to write a bot that has to login to a ubb forum, I > discovered that the cookie processing order of that egg resulted in > login failure. When I tweaked http:read-request-attributes to > reverse the order of the attributes it returned, all was well. > > This is because in reply to a successful login the ubb server sends a > sequence of set-cookie headers, one of which is something like > "ubbt_myid=deleted" (presumably to end any previous session) while a > later header contains a cookie that looks something like > "ubbt_myid=26" signifying the id corresponding to the username. > > Processing the cookies in the wrong order results in the Cookie > attribute of the http-request object being set to contain > "ubbt_myid=deleted", destroying the session login data on the client > side and effectively ending the session. It's a bit risky of the UBB server to send two Set-Cookies with the same cookie name, without giving one precedence by specifying a more specific path. RFC2109 allows for multiple Set-Cookies, but it also warns that "an intervening gateway could fold multiple such headers into a single header". Since "folding" is undefined, there's no way the origin server can guarantee the sequence of the cookies in the received header. If the two cookies have different path precedence, that's a different matter: effectively they are two different cookies. I suppose it makes sense to retain the headers in the order they were received from the server, but gateway meddling could lead to unpredictable results in this particular case. Just my two cents, Graham ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] egg question
On Thu, Mar 27, 2008 at 1:02 PM, William Ramsay <[EMAIL PROTECTED]> wrote: > Hi, > > I'm working with the xlib egg, which naturally calls the xlib c > procedures.In a case where the egg function has a parameter of > (POINTER UNSIGNED-CHAR) what do I use? In other words how do I create a > pointer to a string in Scheme? Unfortunately, you will have to create the appropriate foreign pointer objects to some statically allocated data in this case (There is a comment in the original xlib wrapper code that mentions this problem). It should be possible to write some helper functions, but it will in any case be a bit ugly. Another possibility is to write a small C wrapper that calls the C Xlib function and provides a more easy to access API. Some Xlib functions like XGetWindowProperty have a very complex interface and interpret result locations different according to passed flags. Horrible to wrap. cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] eval of (0) crashes app
Can you give me the output of "bt" inside gdb? (this will produce the backtrace). world's smallest backtrace :) [Switching to process 5374 thread 0x9903] 0x001946be in C_eval_toplevel () (gdb) bt #0 0x001946be in C_eval_toplevel () Cannot access memory at address 0x12 (gdb) ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] eval of (0) crashes app
On Fri, Mar 28, 2008 at 12:33 PM, Heinrich Taube <[EMAIL PROTECTED]> wrote: > > > You mean "(car {1 2 3})", literally? Or "(car 1) ..."? > > literally with { }. this also crashes the app. > Ah, ok - this is just like "(car (1 2 3))" which is the same error case as "(0)" in the end. > > when i trigger the error under gdb by evaling (0) this is what gets > printed (sorry I dont know anything more about gdb yet!): Can you give me the output of "bt" inside gdb? (this will produce the backtrace). cheers, felix ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] eval of (0) crashes app
Does the crash happen on every error (for example an unbounded variable reference, like evaluating the string "xyz") or only when calling invalid values in procedure position? no, the vast majority of errors like unbound variables or too few too many args are caught. I havent touched the Scheme.cpp code for quite some time and it is otherwise working quite well. its bound to be something in my code but am not sure where to look at yet You mean "(car {1 2 3})", literally? Or "(car 1) ..."? literally with { }. this also crashes the app. Can you run it under gdb and get the location and backtrace where it crashes? when i trigger the error under gdb by evaling (0) this is what gets printed (sorry I dont know anything more about gdb yet!): Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x0005 [Switching to process 5264 thread 0x9903] 0x001946be in C_eval_toplevel () (gdb) -- here is the whole trace gdb build/Release/Grace.app/Contents/MacOS/grace GNU gdb 6.3.50-20050815 (Apple version gdb-768) (Tue Oct 2 04:07:49 UTC 2007) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries .. done warning: UUID mismatch detected between: /Lisp/grace/build/macosx/build/Release/Grace.app/Contents/MacOS/grace /Lisp/grace/build/macosx/build/Release/Grace.app.dSYM/Contents/ Resources/DWARF/grace... (gdb) run Starting program: /Lisp/grace/build/macosx/build/Release/Grace.app/ Contents/MacOS/grace Reading symbols for shared libraries + . done --- Grace Executable file: /Lisp/grace/build/macosx/build/Release/Grace.app/ Contents/MacOS/grace Resource directory: /Lisp/grace/build/macosx/build/Release/Grace.app/ Contents/Resources Application file: /Lisp/grace/build/macosx/build/Release/Grace.app Preferences file: /Users/hkt/Library/Preferences/Grace.prefs Home directory: /Users/hkt Current working directory: /Users/hkt User documents directory: /Users/hkt/Documents User application data directory: /Users/hkt/Library Common application data directory: /Library Temp directory: /Users/hkt/Library/Caches/grace Preferences: Prefs file loaded: yes NativeTitleBars: yes ConsoleTheme: Clarity and Beauty ConsoleFontSize: 24 EditorFontSize: 17 HeapSize: 100 StackSize: 64000 --- Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Reading symbols for shared libraries . done Chicken init: heap=100 stack=64000 scheduling queue is empty CoreMidi - opening out: Bus 1 Reading symbols for shared libraries done calling eval node 1, input '(0)' Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x0005 [Switching to process 5264 thread 0x9903] 0x001946be in C_eval_toplevel () (gdb) ___ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users