From salutis at me.com Wed May 4 05:27:39 2022 From: salutis at me.com (=?utf-8?Q?Rudolf_Adamkovi=C4=8D?=) Date: Wed, 04 May 2022 14:27:39 +0200 Subject: [CM] Unicode support Message-ID: Hi there! The s7 website says that s7 "has [...] unicode, and so on." Yet, I struggle to print five black squares (U+25A0) in s7: ? (make-string 5 #\?) ;make-string second argument, #\?, is an undefined object but should be a character ? (make-string 5 #\x25A0) ;make-string second argument, #\x25A0, is an undefined object but should be a character ? (make-string 5 (string-ref "?" 0)) ... prints nothing All three attempts above work great in Guile, as usual. Any ideas? Rudy -- "Genius is 1% inspiration and 99% perspiration." -- Thomas Alva Edison, 1932 Rudolf Adamkovi? [he/him] Studenohorsk? 25 84103 Bratislava Slovakia From bil at ccrma.Stanford.EDU Wed May 4 09:07:07 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Wed, 04 May 2022 09:07:07 -0700 Subject: [CM] Unicode support In-Reply-To: References: Message-ID: Currently you need to do the unicode encoding of the bytes by hand, and send them to the terminal: (format *stderr* (string #\xe2 #\x96 #\xa0)) From bil at ccrma.Stanford.EDU Wed May 4 09:48:46 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Wed, 04 May 2022 09:48:46 -0700 Subject: [CM] Unicode support In-Reply-To: References: Message-ID: I think in s7.html I was referring to libutf8proc.scm, but I have never actually used that code. There are a few tests of it in s7test.scm. From j_hearon at hotmail.com Wed May 11 10:48:13 2022 From: j_hearon at hotmail.com (James Hearon) Date: Wed, 11 May 2022 17:48:13 +0000 Subject: [CM] portamento Message-ID: Hi, I'm still pondering how best to accomplish this. I tried a couple of exs below, one adding filters. I thought bandpass was best to try but couldn't get good high cutoff results with just one filter so I went to two overlapping bandpass filters. But I've buggered the freqs by an octave somehow. That could have been in using hz->radians as cutoffs. I think my experiments still sound too glissy overall. I'm wondering if there are other suggestions? Thank you, Jim ;no portamento. (definstrument (noport start-time duration frequency (amp-env '(0 0 1 1 2 1 3 0)) sampling-rate) (let* ((beg (floor (* start-time sampling-rate))) (end (+ beg (floor (* duration sampling-rate)))) (sine-wave (make-oscil :frequency frequency)) (ampf (make-env amp-env :duration duration :scaler 1.0)) ) (do ((i beg (+ i 1))) ((= i end)) (outa i (* (env ampf) (oscil sine-wave ))) (outb i (* (env ampf) (oscil sine-wave ))) ))) ;portamento. no filter. (definstrument (myport start-time duration frequency start-freq end-freq (amp-env '(0 0 1 1 2 1 3 0)) sampling-rate) (let* ((beg (floor (* start-time sampling-rate))) (end (+ beg (floor (* duration sampling-rate)))) (sine-wave (make-oscil :frequency frequency)) (ampf (make-env amp-env :duration duration :scaler 1.0)) (frqf (make-env '(0 0 1 1) :scaler (hz->radians (- end-freq start-freq)) :duration duration :base 0.67)) ) (do ((i beg (+ i 1))) ((= i end)) (outa i (* (env ampf) (oscil sine-wave (env frqf) ))) (outb i (* (env ampf) (oscil sine-wave (env frqf) ))) ))) (with-sound (:srate 48000 :channels 2 :header-type mus-riff :play #t) (myport 0 1 300 300 400 '(0 .3 .5 .1 1 .09) 48000) (noport 1.1 .9 400 '(0 .01 1 .1) 48000) (myport 2 1 400 400 500 '(0 .2 .5 .1 1 .09) 48000) (noport 3.1 .9 500 '(0 .01 1 .1) 48000) (noport 4 .3 500 '(0 .19 .3 .001) 48000) (myport 4.2 .6 500 500 300 '(0 .001 .5 .1 1 .3) 48000) (noport 5 1 300 '(0 .08 .3 .001) 48000) ) ;portamento adding filters. (definstrument (myportfilt start-time duration frequency start-freq end-freq (glissamp-env '(0 0 1 1 2 0)) (amp-env '(0 0 1 1 2 1 3 0)) sampling-rate order1 flow1 fhigh1 order2 flow2 fhigh2) (let* ((beg (floor (* start-time sampling-rate))) (end (+ beg (floor (* duration sampling-rate)))) (sine-wave (make-oscil :frequency frequency)) ;sine osc (ampf (make-env amp-env :duration duration :scaler 1.0)) ;overall amp env (frqf (make-env '(0 0 1 1) :scaler (hz->radians (- end-freq start-freq)) :duration duration :base 0.67)) ;gliss (gliss_amp (make-env glissamp-env :duration duration :scaler 1.0)) ;another amp env for the gliss (flt1 (make-butterworth-bandpass order1 (hz->radians flow1) (hz->radians fhigh1))) (flt2 (make-butterworth-bandpass order2 (hz->radians flow2) (hz->radians fhigh2))) ) (do ((i beg (+ i 1))) ((= i end)) (outa i (* (env ampf) (+ (* (env gliss_amp)(flt1 (oscil sine-wave (env frqf)))) (* (env gliss_amp)(flt2 (oscil sine-wave (env frqf))))))) (outb i (* (env ampf) (+ (* (env gliss_amp)(flt1 (oscil sine-wave (env frqf)))) (* (env gliss_amp)(flt2 (oscil sine-wave (env frqf))))))) ))) (with-sound (:srate 48000 :channels 2 :header-type mus-riff :play #t) (noport 0 .55 400 '(0 .03 1 .01) 48000) (myportfilt .5 .4 200 200 400 '(0 .3 .4 .1) '(0 0.03 .9 0.06) 48000 8 100 150 8 100 200) (noport .5 .5 800 '(0 .01 1 .01) 48000) (noport 1 .55 800 '(0 .03 1 .01) 48000) (myportfilt 1.5 .4 400 400 200 '(0 .3 .4 .01) '(0 0.03 .9 0.06) 48000 8 100 150 8 100 200) (noport 1.5 .5 400 '(0 .01 1 .01) 48000) (noport 3 1.1 400 '(0 .03 1 .01) 48000) (myportfilt 4 .9 200 200 400 '(0 .3 .9 .1) '(0 0.03 .9 0.06) 48000 8 100 150 8 100 200) (noport 5 1 800 '(0 .02 1 .1) 48000) ) -------------- next part -------------- An HTML attachment was scrubbed... URL: From irvise_ml at irvise.xyz Wed May 11 12:46:30 2022 From: irvise_ml at irvise.xyz (Fernando Oleo Blanco) Date: Wed, 11 May 2022 19:46:30 +0000 Subject: [CM] S7 questions and libc issue Message-ID: <20220511214626.12298fda@linux.fritz.box> Hi everybody, first things first, thank you for S7! I am writing to you since I am searching for a Scheme implementation. For that reason, I decided to create a comparison table. The table can be found in [1]. I would like to ask if there are any issues, problems or mistakes regarding the S7 entry. If you find them, please, let me know. I would like the table to be accurate so that I can make a better decision and fairly represent the implementation. The same page briefly documents the motivation and the main "goals" for a choice. In the end, S7 was selected to go to the more in depth review since it met the criteria I was looking for. Therefore, I am happy to say that S7.git builds with the TCC compiler [2] using no external dependencies! I have not tested the inclussion of external dependencies or using different "flags" to tweak the features. However, I seem to have hit a few roadblocks during testing. I would like to put them forth in case someone can help me or give pointers to a fix. The first interesting one is that TCC cannot compile S7 staticly on Linux/x86_64. It seems there are some Glibc/GCC requirements when staticly linking... Using the -ldl flag doesn't do anything to help. Here is the command used and the set of errors: ``` touch mus-config.h && tcc -c s7.c -I. && tcc -o repl repl.c s7.o -lm -I. -static && ./repl tcc: error: undefined symbol '__ehdr_start' tcc: error: undefined symbol '__gcc_personality_v0' tcc: error: undefined symbol '_Unwind_Resume' tcc: error: undefined symbol '_Unwind_GetCFA' tcc: error: undefined symbol '_Unwind_ForcedUnwind' tcc: error: undefined symbol '__multf3' tcc: error: undefined symbol '__addtf3' tcc: error: undefined symbol '__unordtf2' tcc: error: undefined symbol '__letf2' ``` The bigger issue is cross compiling to Linux/RISC-V. I personally want to see the Schemes implementations running there. I thought that S7 would have no issues since running the REPL is only 2 compilation files... But that was not the case. I initially used a GCC-RISC-V cross-compiler [3] to get the repl running on a Linux/RISC-V board that I have (it is actually an FPGA running Linux). But it complained that it could not find/use libc_s7.so and that it should be compiled by running `./repl libc_s7.scm` (this is documented on a footnote in [1]). However, that requires and expects gcc to be present on the system to run. My RISC-V board does not have a C compiler (it only has 32MB of RAM). Is this expected? I did not have to compile `libc_s7.scm` when compiling natively... I also tried generating the `libc_s7.c` file natively, then using the cross-compiler to generate a `libc_s7.so` for RISC-V and transfering it over, but that also does not work (I cannot remember the error). I also tried to link S7 staticly hoping that the `libc_s7.so` requirement would not happen, but that did not help either. Are there any recommendations as to how to better cross-compile S7? [1] https://irvise.xyz/Blog/scheme-implementation-comparison.html [2] https://bellard.org/tcc/ [3] https://toolchains.bootlin.com/releases_riscv32-ilp32d.html Thank you very much for your time! Best regards, Fernando Oleo Blanco From bil at ccrma.Stanford.EDU Wed May 11 13:29:23 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Wed, 11 May 2022 13:29:23 -0700 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220511214626.12298fda@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> Message-ID: <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> That's an interesting project! To answer some of your questions: I think tcc can build s7 statically in linux. Here's an example in Ubuntu: tcc -o s7 s7.c -I. -lm -DWITH_MAIN s7 s7: 9-May-2022 > (+ 1 2) 3 The -DWITH_MAIN switch includes a minimal repl, so you don't need repl.c or libc_s7.so. The other choice is nrepl.scm but that requires the notcurses-core library. I notice you're using musl -- I think s7 works with it, but there was some header problem in libgsl -- I did not pursue it. I haven't tried tcc with musl in linux. On your chart, the s7 entries looks accurate to me. s7 has the full numeric tower (including multiprecision support for all types via gmp, mpfr, and mpc). s7 macros are "low-level" -- CL-style define-macro. s7 has full tail recursion optimization, unless I inadvertently missed some case. You can define arbitrary types via "setters", but the optimizer is not very smart about them yet. From bil at ccrma.Stanford.EDU Wed May 11 13:50:26 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Wed, 11 May 2022 13:50:26 -0700 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220511214626.12298fda@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> Message-ID: <73569634484db4765dbfcece3d2d9c77@ccrma.stanford.edu> By support for types, are you referring to srfi-9 or srfi-99? That stuff is trivial; I'd use lets + methods in s7, but r7rs.scm also has an implementation using vectors. I thought you were referring to typed variables like saying "int i" in C. You'd use a setter for that in s7. From bil at ccrma.Stanford.EDU Wed May 11 14:37:30 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Wed, 11 May 2022 14:37:30 -0700 Subject: [CM] portamento In-Reply-To: References: Message-ID: <4f2f15ed447d9b6ca1d0705d4e207bf3@ccrma.stanford.edu> I wouldn't use a linear envelope for the amplitude and frequency. There are some examples online, but I would get a recording that has the effect you want, and try to mimic it -- that process makes you focus on the details (like is the sweep continuous, is it changing in speed, etc). From wdouglass at carnegierobotics.com Thu May 12 06:57:04 2022 From: wdouglass at carnegierobotics.com (Woody Douglass) Date: Thu, 12 May 2022 13:57:04 +0000 Subject: [CM] Test coverage Message-ID: All, I've been thinking about writing a coverage-report-generator for s7. I'm thinking about the kind of reports you see on codecov.io and the like. Is there a way to hook on execution of a given s7 form? if not, I would consider attempting to add something like that via a patch, but i'm just making sure i'm not reinventing any wheels here thanks, Woody Douglass From irvise_ml at irvise.xyz Thu May 12 09:32:33 2022 From: irvise_ml at irvise.xyz (Fernando Oleo Blanco) Date: Thu, 12 May 2022 16:32:33 +0000 Subject: [CM] S7 questions and libc issue In-Reply-To: <73569634484db4765dbfcece3d2d9c77@ccrma.stanford.edu> References: <20220511214626.12298fda@linux.fritz.box> <73569634484db4765dbfcece3d2d9c77@ccrma.stanford.edu> Message-ID: <20220512183230.6cc9310c@linux.fritz.box> Hi Bil, Am Wed, 11 May 2022 13:50:26 -0700 schrieb : > By support for types, are you referring to srfi-9 or > srfi-99? That stuff is trivial; I'd use lets + methods > in s7, but r7rs.scm also has an implementation using vectors. > I thought you were referring to typed variables > like saying "int i" in C. You'd use a setter for that in s7. > SRFI-9 and 99 are indeed interesting. But I mostly ment "traditional" types ala C (or even better, ala Ada ;). I know Scheme is a duck-typed language, but some type safety would help us. Thank you for your answer. Are setters portable? I am asking since it would be nice to be able to run in other implementations. I am sorry if this is a newbee question, since I am not familiar with Scheme and its idiosyncrasies. Regards, Fer From bil at ccrma.Stanford.EDU Thu May 12 09:37:44 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 12 May 2022 09:37:44 -0700 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220512183230.6cc9310c@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> <73569634484db4765dbfcece3d2d9c77@ccrma.stanford.edu> <20220512183230.6cc9310c@linux.fritz.box> Message-ID: > Are setters portable? Probably not -- I don't know of any other scheme that has them. From bil at ccrma.Stanford.EDU Thu May 12 09:52:51 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 12 May 2022 09:52:51 -0700 Subject: [CM] Test coverage In-Reply-To: References: Message-ID: It may not be quite what you want, but there is the profiler in s7 (profile.scm writes out the data), or the trace code in debug.scm. From wdouglass at carnegierobotics.com Thu May 12 10:02:34 2022 From: wdouglass at carnegierobotics.com (Woody Douglass) Date: Thu, 12 May 2022 17:02:34 +0000 Subject: [CM] Test coverage In-Reply-To: References: Message-ID: that trace code is kind of close, i'll read it closer. thanks! Woody On Thu, 2022-05-12 at 09:52 -0700, bil at ccrma.Stanford.EDU wrote: > It may not be quite what you want, but there is the profiler > in s7 (profile.scm writes out the data), or the trace code > in debug.scm. > From irvise_ml at irvise.xyz Thu May 12 11:58:35 2022 From: irvise_ml at irvise.xyz (Fernando Oleo Blanco) Date: Thu, 12 May 2022 18:58:35 +0000 Subject: [CM] S7 questions and libc issue In-Reply-To: <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> Message-ID: <20220512205832.5de3fb0b@linux.fritz.box> Thank you for your thorough answer, I will try to be as precise as possible. Am Wed, 11 May 2022 13:29:23 -0700 schrieb : > That's an interesting project! To answer some of > your questions: > > I think tcc can build s7 statically in linux. Here's an example > in Ubuntu: > > tcc -o s7 s7.c -I. -lm -DWITH_MAIN > s7 > s7: 9-May-2022 > > > (+ 1 2) > 3 > In order to build staticly one needs to add the "-static" flag. That is when the build failure happens. Building dynamicly works perfectly (tested on x86_64 OpenSUSE Tumbleweed). The error I added on the first message happens when running: `tcc s7.c -o s7-tcc -lm -I. -DWITH_MAIN -static` I think I am using TCC v0.9.27. I say I think because I believe master is still v0.9.27 even though it has received tons of improvements for years and I had installed TCC.git in the past... Maybe TCC.git does not have the issues. > The -DWITH_MAIN switch includes a minimal repl, so you don't need > repl.c or libc_s7.so. The other choice is nrepl.scm but that > requires the notcurses-core library. > I tried with the -DWITH_MAIN and it just works. Thank you. However, when I use GCC it errores/warns with the following message (TCC compilation on top for comparison and transparency): ``` fernando at linux:~/Builds/S7-scheme/s7-riscv-all-c> tcc s7.c -o s7-tcc -lm -I. -DWITH_MAIN fernando at linux:~/Builds/S7-scheme/s7-riscv-all-c> ./s7- s7-riscv s7-tcc fernando at linux:~/Builds/S7-scheme/s7-riscv-all-c> ./s7-tcc s7: 2-May-2022 > (exit) fernando at linux:~/Builds/S7-scheme/s7-riscv-all-c> gcc s7.c -o s7-gcc-dynamic -lm -I. -DWITH_MAIN fernando at linux:~/Builds/S7-scheme/s7-riscv-all-c> ./s7-gcc-dynamic s7: 2-May-2022 load /home/fernando/Builds/S7-scheme/s7-riscv-all-c/libc_s7.so failed: /home/fernando/Builds/S7-scheme/s7-riscv-all-c/libc_s7.so: undefined symbol: s7_f ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ;unbound variable fileno in (fileno stdin) ; (fileno stdin) ; repl.scm, line 207, position: 6849 ; (fileno stdin) ; ((terminal-fd (fileno stdin)) (tab-as-spa... ; ((lambda (hook lst) (when (or (not (proce... ;unbound variable *repl* ; (*repl* 'run) ; ((*repl* 'run)) ; ((lambda (new-size) (unless (= new-size h... ; histsize: 100, histpos: 0 ; histbuf: #("" "" "" "" ...) fernando at linux:~/Builds/S7-scheme/s7-riscv-all-c> gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/11/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-suse-linux Configured with: ../configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,ada,go,d,jit --enable-offload-targets=nvptx-none,amdgcn-amdhsa, --without-cuda-driver --enable-host-shared --enable-checking=release --disable-werror --with-gxx-include-dir=/usr/include/c++/11 --enable-ssp --disable-libssp --disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin --with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --enable-libphobos --enable-version-specific-runtime-libs --with-gcc-major-version-only --enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function --program-suffix=-11 --without-system-libunwind --enable-multilib --with-arch-32=x86-64 --with-tune=generic --with-build-config=bootstrap-lto-lean --enable-link-mutex --build=x86_64-suse-linux --host=x86_64-suse-linux Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.2.1 20220420 [revision 691af15031e00227ba6d5935c1d737026cda4129] (SUSE Linux) ``` When compiling with GCC it always seems to be trying to load libc_s7.so. The load fails because libc_s7.so cannot find the function "s7_f". That function is public and exists in s7.c... Maybe GCC is optimising it out?? If I delete libc_s7.so from a previous test, then I get the following warning: ``` fernando at linux:~/Builds/S7-scheme/s7-riscv-all-c> ./s7-gcc-dynamic s7: 2-May-2022 load /home/fernando/Builds/S7-scheme/s7-riscv-all-c/libc_s7.so failed: /home/fernando/Builds/S7-scheme/s7-riscv-all-c/libc_s7.so: cannot open shared object file: No such file or directory > ``` It tries to load it, warns about the library, and then just works. These two cases is what I have also seen in RISC-V. Let me retell my RISC-V adventures since there are some news. I compiled s7.c staticly with the -DWITH_MAIN flag. I sent the binary to my RISC-V installation and it gives the same libc_s7.so warning as above... But it works!! :D For this I used GCC 11, as GCC 10 was giving me errors during the compilation. However, when I cross-compile libc_s7.so, it seems there is a memory issue or error... It loads for a while and then it dies. Maybe there is some memory exhaustion problem. There is also the (likely) issue that if it is trying to load libc_s7.so, that it cannot do so. Glibc does not allow to dynamicly link with other modules with another system Glibc version from a static program. My system was compiled a long ago and it is using an older Glibc, which is why I need to compile staticly. However, a couple of times I got the error of the missing s7_f symbol... > I notice you're using musl -- I think s7 works with it, but there was > some header problem in libgsl -- I did not pursue it. I haven't > tried tcc with musl in linux. > This is going to be used for a compiler, so I do not care about "extra" functionality. I only care about the Scheme, SRFIs and extra bits related to programming in the Scheme implementation. The goal is to use musl, but not for now. And I am surprised that you had issues with it, it is a really good libc. > On your chart, the s7 entries looks accurate to me. s7 has the full > numeric tower (including multiprecision support for all types via > gmp, mpfr, and mpc). s7 macros are "low-level" -- CL-style > define-macro. s7 has full tail recursion optimization, unless > I inadvertently missed some case. You can define arbitrary types > via "setters", but the optimizer is not very smart about them > yet. > Thank you for these comments, I will try to add them as soon as possible :) One last question/issue... What is libc_s7.so supposed to do? I suppose it is an important part of S7... And I will need to interface with some C subsystems... Thank you very much for your time and care! Regards, Fer From bil at ccrma.Stanford.EDU Thu May 12 12:53:54 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 12 May 2022 12:53:54 -0700 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220512205832.5de3fb0b@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> Message-ID: For gcc, use gcc -o s7 s7.c -I. -lm -DWITH_MAIN -DWITH_C_LOADER=0 -pthread -static libc_s7.so gives FFI bindings for a large portion of libc. repl.scm needs it to get raw terminal handlers. The WITH_C_LOADER switch is what you needed, I think. From irvise_ml at irvise.xyz Thu May 12 14:08:52 2022 From: irvise_ml at irvise.xyz (Fernando Oleo Blanco) Date: Thu, 12 May 2022 21:08:52 +0000 Subject: [CM] S7 questions and libc issue In-Reply-To: References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> Message-ID: <20220512230843.7fe3a1e6@linux.fritz.box> Thank you for your help. I have one last set of questions if you do not mind. Am Thu, 12 May 2022 12:53:54 -0700 schrieb : > For gcc, use > > gcc -o s7 s7.c -I. -lm -DWITH_MAIN -DWITH_C_LOADER=0 -pthread > -static > > libc_s7.so gives FFI bindings for a large portion of libc. > repl.scm needs it to get raw terminal handlers. The > WITH_C_LOADER switch is what you needed, I think. > I compiled s7 as you indicated and now it works as expected. However, I have a few concers regarding libc_s7. It seems that it is needed by r7rs.scm. See the following test: ``` fernando at linux:~/Builds/S7-scheme/s7-riscv> ./s7 r7rs.scm s7: 2-May-2022 load r7rs.scm writing libc_s7.c loading libc_s7.so ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ; ((delete-file o-file-name)) ; ((load so-file-name cur-env)) ; ((curlet)) ``` When loading r7rs.scm it needs to create libc_s7.so. So it would seem that the libc.scm is quite important, which makes sense and I probably will need to make use of it. However, I see two problems. The first one is in the code snippet above. I do not know why, S7 always fails to load the .so with that message... There seems to be something wrong with symbol generation when compiling the .c file (or its generation from libc.scm...). Is that a bug? Did I do something wrong? And finally, how can I build libc_s7 into the s7 executable? I have tried compiling the libc_s7.c file into an object file and then compiling s7 a second time to see if it would get built inside... But that does not seem to help... My goal would be to get as close as possible to a "full" Scheme implementation with batteries included if possible in a single executable. Does S7 have a mechanism to bundle as much of the "core" functionalilty together or in a way that "just works". It could be that I have the s7 executable and I just load the .scm files directly without having to compile .so first. Thank you for your patiente, Fer From bil at ccrma.Stanford.EDU Thu May 12 14:52:26 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 12 May 2022 14:52:26 -0700 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220512230843.7fe3a1e6@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> <20220512230843.7fe3a1e6@linux.fritz.box> Message-ID: <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> > ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") This happens if you try to dynamically load an object file but don't have the dynamic loading functions -- when you build it without libdl (WITH_C_LOADER=0 probably). It treats libc_s7.so as a scheme (text) file. r7rs.scm needs the libc stuff; it starts with (require libc.scm). I suppose you could make a separate C program that loads s7.o and libc_s7.so. There is no way to do this with just s7.c itself. There are examples in s7.html of how to do this sort of thing. Also r7rs.scm is not a full r7rs implementation, and I have no plans to make it one. From irvise_ml at irvise.xyz Sat May 14 12:13:37 2022 From: irvise_ml at irvise.xyz (Fernando Oleo Blanco) Date: Sat, 14 May 2022 19:13:37 +0000 Subject: [CM] S7 questions and libc issue In-Reply-To: <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> <20220512230843.7fe3a1e6@linux.fritz.box> <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> Message-ID: <20220514211334.1f9a7f01@linux.fritz.box> Thank you for you answer, I have a few more comments/issues, but no more questions. Am Thu, 12 May 2022 14:52:26 -0700 schrieb : > > ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") > > This happens if you try to dynamically load an object file > but don't have the dynamic loading functions -- when you > build it without libdl (WITH_C_LOADER=0 probably). It treats > libc_s7.so as a scheme (text) file. > I tried to do everything from scratch just in case I was doing something wrong. Here is all the input/output and how it went (comments below): ``` fernando at linux:~/Builds/S7-scheme> git clone --depth 1 https://cm-gitlab.stanford.edu/bil/s7.git Klone nach 's7'... remote: Counting objects: 94, done. remote: Compressing objects: 100% (93/93), done. remote: Total 94 (delta 1), reused 0 (delta 0) Entpacke Objekte: 100% (94/94), 2.47 MiB | 1.25 MiB/s, fertig. fernando at linux:~/Builds/S7-scheme> ls s7 s7-riscv s7-riscv-all-c s7.tar.gz fernando at linux:~/Builds/S7-scheme> rm s7.tar.gz fernando at linux:~/Builds/S7-scheme> cd s7 fernando at linux:~/Builds/S7-scheme/s7> gcc -o s7 s7.c -I. -lm -DWITH_MAIN -ldl -pthread fernando at linux:~/Builds/S7-scheme/s7> ./s7 r7rs.scm s7: 16-May-2022 load r7rs.scm writing libc_s7.c loading libc_s7.so load /home/fernando/Builds/S7-scheme/s7/libc_s7.so failed: /home/fernando/Builds/S7-scheme/s7/libc_s7.so: undefined symbol: s7_f ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ; ((delete-file o-file-name)) ; ((load so-file-name cur-env)) ; ((curlet)) fernando at linux:~/Builds/S7-scheme/s7> gcc -o s7 s7.c -I. -lm -DWITH_MAIN -WITH_C_LOADER=1 -ldl -pthread gcc: error: unrecognized command-line option ?-WITH_C_LOADER=1? fernando at linux:~/Builds/S7-scheme/s7> gcc -o s7 s7.c -I. -lm -DWITH_MAIN -DWITH_C_LOADER=1 -ldl -pthread fernando at linux:~/Builds/S7-scheme/s7> ./s7 r7rs.scm s7: 16-May-2022 load r7rs.scm loading libc_s7.so load /home/fernando/Builds/S7-scheme/s7/libc_s7.so failed: /home/fernando/Builds/S7-scheme/s7/libc_s7.so: undefined symbol: s7_f ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ; ((format *stderr* "writing ~A~%" c-file-n... ; ((load so-file-name cur-env)) ; ((curlet)) ``` With a clean git clone, and trying the different WITH_C_LOADER options, I cannot make it work. The s7_f symbol seems to keep being deleted. I am using GCC 11.2.1 in OpenSUSE Tumbleweed. If I use TCC, the s7_f symbol/function error disappears (it is probably getting compiled). However, S7 still tries to interpret the .so as a .scm: ``` fernando at linux:~/Builds/S7-scheme/s7> rm libc_s7.* fernando at linux:~/Builds/S7-scheme/s7> rm s7 fernando at linux:~/Builds/S7-scheme/s7> tcc -o s7 s7.c -I. -lm -DWITH_MAIN -ldl -pthread s7.c:71: error: include file 'mus-config.h' not found fernando at linux:~/Builds/S7-scheme/s7> touch mus-config.h fernando at linux:~/Builds/S7-scheme/s7> tcc -o s7 s7.c -I. -lm -DWITH_MAIN -ldl -pthread fernando at linux:~/Builds/S7-scheme/s7> ./s7 r7rs.scm s7: 16-May-2022 load r7rs.scm writing libc_s7.c loading libc_s7.so ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ; ((delete-file o-file-name)) ; ((load so-file-name cur-env)) ; ((curlet)) ``` Does S7 use GCC when it tries to compile libc_s7.c? Maybe the same compiler that was used when compiling S7? There is not much informational output of what it is actually trying to do... > r7rs.scm needs the libc stuff; it starts with (require libc.scm). > I suppose you could make a separate C program that loads s7.o > and libc_s7.so. There is no way to do this with just s7.c itself. > There are examples in s7.html of how to do this sort of thing. > Also r7rs.scm is not a full r7rs implementation, and I have no > plans to make it one. > A full R7RS implementation is not a problem. I still need to see what we actually need, so I cannot make a judgement now. Thank you for your time! I will look deeper now into Chibi to see how it compares with the others. And S7 is a pretty cool piece of software! Regards, Fer From bil at ccrma.Stanford.EDU Sat May 14 12:53:20 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sat, 14 May 2022 12:53:20 -0700 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220514211334.1f9a7f01@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> <20220512230843.7fe3a1e6@linux.fritz.box> <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> <20220514211334.1f9a7f01@linux.fritz.box> Message-ID: > gcc -o s7 s7.c -I. -lm -DWITH_MAIN -ldl -pthread I sent this is a previous message: gcc -o s7 s7.c -I. -lm -DWITH_MAIN -DWITH_C_LOADER=0 -pthread -static From irvise_ml at irvise.xyz Sat May 14 13:30:42 2022 From: irvise_ml at irvise.xyz (Fernando Oleo Blanco) Date: Sat, 14 May 2022 20:30:42 +0000 Subject: [CM] S7 questions and libc issue In-Reply-To: References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> <20220512230843.7fe3a1e6@linux.fritz.box> <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> <20220514211334.1f9a7f01@linux.fritz.box> Message-ID: <20220514223039.4dc6a68b@linux.fritz.box> Am Sat, 14 May 2022 12:53:20 -0700 schrieb : > > gcc -o s7 s7.c -I. -lm -DWITH_MAIN -ldl -pthread > > I sent this is a previous message: > gcc -o s7 s7.c -I. -lm -DWITH_MAIN -DWITH_C_LOADER=0 -pthread > -static > > Oh, sorry, I forgot to mention that I did try your suggestion but it still did not work to due to .so problems. If I understood correctly, the s7_f symbol not being generated is due to the WITH_C_LOADER value, so that part is fine. Right now I am just trying to get r7rs.scm loaded and tested on my computer (no cross-compilation involved in the previous message nor in this one). Here is the output for full transparency on a clean git clone: ``` fernando at linux:~/Builds/S7-scheme/s7> gcc -o s7 s7.c -I. -lm -DWITH_MAIN -DWITH_C_LOADER=0 -pthread -static fernando at linux:~/Builds/S7-scheme/s7> ./s7 r7rs.scm s7: 16-May-2022 load r7rs.scm writing libc_s7.c loading libc_s7.so ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ; ((delete-file o-file-name)) ; ((load so-file-name cur-env)) ; ((curlet)) fernando at linux:~/Builds/S7-scheme/s7> gcc -o s7 s7.c -I. -lm -DWITH_MAIN -DWITH_C_LOADER=1 -pthread -static /usr/lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/bin/ld: /tmp/cc6q8upX.o: en la funci?n `load_shared_object': s7.c:(.text+0x5b25a): aviso: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking fernando at linux:~/Builds/S7-scheme/s7> rm libc_s7.* fernando at linux:~/Builds/S7-scheme/s7> ./s7 r7rs.scm s7: 16-May-2022 load r7rs.scm writing libc_s7.c loading libc_s7.so load /home/fernando/Builds/S7-scheme/s7/libc_s7.so failed: /home/fernando/Builds/S7-scheme/s7/libc_s7.so: undefined symbol: s7_f ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ; ((delete-file o-file-name)) ; ((load so-file-name cur-env)) ; ((curlet)) ``` Using the following compilation rule: `gcc s7.c -o repl -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic -Wno-stringop-overflow` as documented in the .html I get: ``` fernando at linux:~/Builds/S7-scheme/s7> gcc s7.c -o repl -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic -Wno-stringop-overflow fernando at linux:~/Builds/S7-scheme/s7> ./s7 r7rs.scm s7: 16-May-2022 load r7rs.scm writing libc_s7.c loading libc_s7.so load /home/fernando/Builds/S7-scheme/s7/libc_s7.so failed: /home/fernando/Builds/S7-scheme/s7/libc_s7.so: undefined symbol: s7_f ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ; ((delete-file o-file-name)) ; ((load so-file-name cur-env)) ; ((curlet)) ``` Shouldn't this just have worked since it is a "normal" S7 compilation case? It seems however I compile S7, it is always trying to interpret the .so as a .scm. Maybe this is triggered by the s7_f symbol error, but I do not understand how things work in S7.I may be missing something trivial or I may just be very dense. Thank you, Fer From bil at ccrma.Stanford.EDU Sat May 14 13:45:09 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sat, 14 May 2022 13:45:09 -0700 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220514223039.4dc6a68b@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> <20220512230843.7fe3a1e6@linux.fritz.box> <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> <20220514211334.1f9a7f01@linux.fritz.box> <20220514223039.4dc6a68b@linux.fritz.box> Message-ID: <2f79c63f3ef87800b17bc926e35e9616@ccrma.stanford.edu> > gcc s7.c -o repl -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic > -Wno-stringop-overflow > fernando at linux:~/Builds/S7-scheme/s7> ./s7 r7rs.scm You built the program "repl", then ran "s7". Try running repl. From irvise_ml at irvise.xyz Sat May 14 14:52:40 2022 From: irvise_ml at irvise.xyz (Fernando Oleo Blanco) Date: Sat, 14 May 2022 21:52:40 +0000 Subject: [CM] S7 questions and libc issue In-Reply-To: <2f79c63f3ef87800b17bc926e35e9616@ccrma.stanford.edu> References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> <20220512230843.7fe3a1e6@linux.fritz.box> <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> <20220514211334.1f9a7f01@linux.fritz.box> <20220514223039.4dc6a68b@linux.fritz.box> <2f79c63f3ef87800b17bc926e35e9616@ccrma.stanford.edu> Message-ID: <20220514235236.062ed60c@linux.fritz.box> Am Sat, 14 May 2022 13:45:09 -0700 schrieb : > > gcc s7.c -o repl -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic > > -Wno-stringop-overflow > > fernando at linux:~/Builds/S7-scheme/s7> ./s7 r7rs.scm > > You built the program "repl", then ran "s7". Try running repl. > I was being extremely dense... I works... I feel a bit ashamed... However, this may be interesting. It does not work with TCC. It still interprets the .so as a .scm. Here is the comparison between GCC and TCC (git master): ``` fernando at linux:~/Builds/S7-scheme/s7> rm repl fernando at linux:~/Builds/S7-scheme/s7> tcc s7.c -o repl -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic -Wno-stringop-overflow fernando at linux:~/Builds/S7-scheme/s7> ./repl r7rs.scm s7: 16-May-2022 load r7rs.scm loading libc_s7.so ;unbound variable (symbol "\x7f;ELF\x02;\x01;\x01;") ; (symbol "\x7f;ELF\x02;\x01;\x01;") ; libc_s7.so, line 1, position: 7 ; ((format *stderr* "writing ~A~%" c-file-n... ; ((load so-file-name cur-env)) ; ((curlet)) fernando at linux:~/Builds/S7-scheme/s7> rm repl fernando at linux:~/Builds/S7-scheme/s7> gcc s7.c -o repl -DWITH_MAIN -I. -O2 -g -ldl -lm -Wl,-export-dynamic -Wno-stringop-overflow fernando at linux:~/Builds/S7-scheme/s7> rm libc_s7.* fernando at linux:~/Builds/S7-scheme/s7> ./repl r7rs.scm s7: 16-May-2022 load r7rs.scm writing libc_s7.c loading libc_s7.so fernando at linux:~/Builds/S7-scheme/s7> ``` Though do not take this as a bug report. It may be just TCC being TCC. I tried with no optimisations (-O0) and the same error was produced. Best regards, Fer From bil at ccrma.Stanford.EDU Sat May 14 15:16:49 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sat, 14 May 2022 15:16:49 -0700 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220514235236.062ed60c@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> <86659abad2d4861ed0ebb7cad111a940@ccrma.stanford.edu> <20220512205832.5de3fb0b@linux.fritz.box> <20220512230843.7fe3a1e6@linux.fritz.box> <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> <20220514211334.1f9a7f01@linux.fritz.box> <20220514223039.4dc6a68b@linux.fritz.box> <2f79c63f3ef87800b17bc926e35e9616@ccrma.stanford.edu> <20220514235236.062ed60c@linux.fritz.box> Message-ID: For tcc, I think you need the -rdynamic and -DWITH_C_LOADER flags: /home/bil/snd-22/ tcc -o s7 s7.c -I. -lm -DWITH_MAIN -ldl -rdynamic -DWITH_C_LOADER /home/bil/snd-22/ s7 s7: 13-May-2022 load /home/bil/snd-22/libc_s7.so failed: /home/bil/snd-22/libc_s7.so: cannot open shared object file: No such file or directory > (load "libc.scm") writing libc_s7.c loading libc_s7.so (inlet 'c-pointer->string c-pointer->string 'string->c-pointer string->c-pointer 'isalnum isalnum 'isalpha isalpha 'iscntrl isc ntrl 'isdigit isdigit 'islower islower 'isgraph isgraph 'isprint isprint 'ispunct ispunct 'isspace isspace 'isupper isupper ... ) > (exit) /home/bil/snd-22/ s7 s7: 13-May-2022 <1> (load "r7rs.scm") box-type I'll look later to see why it didn't automatically make libc_s7.so. From irvise_ml at irvise.xyz Sat May 14 15:18:25 2022 From: irvise_ml at irvise.xyz (Fernando Oleo Blanco) Date: Sat, 14 May 2022 22:18:25 +0000 Subject: [CM] S7 questions and libc issue In-Reply-To: <20220514235236.062ed60c@linux.fritz.box> References: <20220511214626.12298fda@linux.fritz.box> <20220512230843.7fe3a1e6@linux.fritz.box> <8cf0c94ec8ae93d9f2d8888d5be1613c@ccrma.stanford.edu> <20220514211334.1f9a7f01@linux.fritz.box> <20220514223039.4dc6a68b@linux.fritz.box> <2f79c63f3ef87800b17bc926e35e9616@ccrma.stanford.edu> <20220514235236.062ed60c@linux.fritz.box> Message-ID: <20220515001820.07220509@linux.fritz.box> Am Sat, 14 May 2022 21:52:40 +0000 schrieb "Fernando Oleo Blanco" : > Though do not take this as a bug report. It may be just TCC being TCC. > I tried with no optimisations (-O0) and the same error was produced. > Maybe it is a bug... I looked for GCC in the s7.c source code to try and find whether GCC was being hard-coded as the compiler (when generating the .so). I quickly found the WITH_GCC flag. I noticed that it is automatically turned off if the compiler is not GCC nor Clang. So I patched it to also allow TINYC (see below) and recompiled the "repl" and tried running it... And it works!!! Though there is a warning and some things may need some more review (such as complex number support). ``` fernando at linux:~/Builds/S7-scheme/s7> ../../tcc-0.9.27-master/tcc s7.c -o repl -DWITH_MAIN -I. -O0 -g -ldl -lm -Wl,-export-dynamic -Wno-stringop-overflow -DWITH_GCC s7.c:52107: warning: function might return no value: 'g_abort' fernando at linux:~/Builds/S7-scheme/s7> rm libc_s7.* rm: das Entfernen von 'libc_s7.*' ist nicht m?glich: No such file or directory fernando at linux:~/Builds/S7-scheme/s7> ./repl r7rs.scm s7: 16-May-2022 load r7rs.scm writing libc_s7.c loading libc_s7.so fernando at linux:~/Builds/S7-scheme/s7> ``` The patch is: ``` diff --git a/s7.c b/s7.c index 2a7cce7..5c0f737 100644 --- a/s7.c +++ b/s7.c @@ -119,7 +119,7 @@ * this code doesn't compile anymore in gcc 4.3 -- c11 might be needed */ -#if (defined(__GNUC__) || defined(__clang__)) /* s7 uses PRId64 so (for example) g++ 4.4 is too old */ +#if (defined(__GNUC__) || defined(__clang__) || defined(__TINYC__)) /* s7 uses PRId64 so (for example) g++ 4.4 is too old */ #define WITH_GCC 1 #else #define WITH_GCC 0 ``` Regards, Fer From salutis at me.com Tue May 17 00:04:07 2022 From: salutis at me.com (=?utf-8?Q?Rudolf_Adamkovi=C4=8D?=) Date: Tue, 17 May 2022 09:04:07 +0200 Subject: [CM] Unexpected behavior of record types in lists Message-ID: Hello smart people! I found the following unexpected behavior of record types in lists: (define-record-type (make-proxy type) proxy? (type proxy-type)) (let ((proxies (list (make-proxy 'one) (make-proxy 'two)))) ;; EXPECTED: "one", ACTUAL: (display (proxy-type (list-ref proxies 0))) ;; EXPECTED: "two", ACTUAL: "two" (OK) (display (proxy-type (list-ref proxies 1)))) It makes our R7RS program fail tests on s7 (but not Guile). Rudy -- "Be especially critical of any statement following the word 'obviously.'" -- Anna Pell Wheeler, 1883-1966 Rudolf Adamkovi? [he/him] Studenohorsk? 25 84103 Bratislava Slovakia From bil at ccrma.Stanford.EDU Tue May 17 06:26:33 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Tue, 17 May 2022 06:26:33 -0700 Subject: [CM] Unexpected behavior of record types in lists In-Reply-To: References: Message-ID: <656e7edc52890cea5df3fb40956c4932@ccrma.stanford.edu> Thanks for the bug report. I think that was an overlooked name collision in the macro. I haven't tested this much, but here's a possible new version: (define-macro (define-record-type type make ? . fields) (let ((obj (gensym)) (typ (gensym)) (args (map (lambda (field) (values (list 'quote (car field)) (let ((par (memq (car field) (cdr make)))) (and (pair? par) (car par))))) fields))) `(begin (define (,? ,obj) (and (let? ,obj) (eq? (let-ref ,obj ',typ) ',type))) (define ,make (inlet ',typ ',type , at args)) ,@(map (lambda (field) (when (pair? field) (if (null? (cdr field)) (values) (if (null? (cddr field)) `(define (,(cadr field) ,obj) (let-ref ,obj ',(car field))) `(begin (define (,(cadr field) ,obj) (let-ref ,obj ',(car field))) (define (,(caddr field) ,obj val) (let-set! ,obj ',(car field) val))))))) fields) ',type))) From salutis at me.com Mon May 23 03:56:31 2022 From: salutis at me.com (=?utf-8?Q?Rudolf_Adamkovi=C4=8D?=) Date: Mon, 23 May 2022 12:56:31 +0200 Subject: [CM] Strange display behavior Message-ID: Hello smart people! I have just updated to 7aa20a28a95026b76a743d95b6a07729beac0dc5 and observe: ? (display '(foo . "hello")) (foo . "hello")(foo . "hello") ? (display `(foo . "hello")) (foo #\h #\e #\l #\l #\o)(foo #\h #\e #\l #\l #\o) Do we expect this? Rudy -- "Genius is 1% inspiration and 99% perspiration." -- Thomas Alva Edison, 1932 Rudolf Adamkovi? [he/him] Studenohorsk? 25 84103 Bratislava Slovakia From salutis at me.com Mon May 23 03:59:29 2022 From: salutis at me.com (Rudolf =?utf-8?Q?Adamkovi=C4=8D?=) Date: Mon, 23 May 2022 12:59:29 +0200 Subject: [CM] Unexpected behavior of record types in lists In-Reply-To: <656e7edc52890cea5df3fb40956c4932@ccrma.stanford.edu> References: <656e7edc52890cea5df3fb40956c4932@ccrma.stanford.edu> Message-ID: bil at ccrma.Stanford.EDU writes: > Thanks for the bug report. I think that was an > overlooked name collision in the macro. I > haven't tested this much, but here's a possible > new version: Hello Bill, I noticed that you pushed it as 7aa20a2. Everything works now! Thank you! Rudy -- "Mathematics takes us still further from what is human into the region of absolute necessity, to which not only the actual world, but every possible world, must conform." -- Bertrand Russell, 1902 Rudolf Adamkovi? [he/him] Studenohorsk? 25 84103 Bratislava Slovakia From salutis at me.com Mon May 23 04:04:26 2022 From: salutis at me.com (=?utf-8?Q?Rudolf_Adamkovi=C4=8D?=) Date: Mon, 23 May 2022 13:04:26 +0200 Subject: [CM] =?utf-8?q?=5BRudolf_Adamkovi=C4=8D=5D_Strange_display_behavi?= =?utf-8?q?or?= References: Message-ID: We now have: ? (equal? '(foo . "hello") `(foo . "hello")) #f That does not look right, does it? Rudy > ? (display '(foo . "hello")) > (foo . "hello")(foo . "hello") > > ? (display `(foo . "hello")) > (foo #\h #\e #\l #\l #\o)(foo #\h #\e #\l #\l #\o) -- "Genius is 1% inspiration and 99% perspiration." -- Thomas Alva Edison, 1932 Rudolf Adamkovi? [he/him] Studenohorsk? 25 84103 Bratislava Slovakia -------------------- End of forwarded message -------------------- -- "Programming reliably -- must be an activity of an undeniably mathematical nature [?] You see, mathematics is about thinking, and doing mathematics is always trying to think as well as possible." -- Edsger W. Dijkstra, 1981 Rudolf Adamkovi? [he/him] Studenohorsk? 25 84103 Bratislava Slovakia From salutis at me.com Mon May 23 04:18:46 2022 From: salutis at me.com (Rudolf =?utf-8?Q?Adamkovi=C4=8D?=) Date: Mon, 23 May 2022 13:18:46 +0200 Subject: [CM] Unicode support In-Reply-To: References: Message-ID: bil at ccrma.Stanford.EDU writes: > Currently you need to do the unicode encoding of the > bytes by hand, and send them to the terminal: > (format *stderr* (string #\xe2 #\x96 #\xa0)) Interesting! Thank you, and I apologize for a late reply. Unfortunately, we cannot use the terminal because we use s7 in a heavily sandboxed mobile application. Do you know of any other way? We just need to send a Unicode string across, from s7 to C to Swift. Thank you! Rudy -- "Strange as it may sound, the power of mathematics rests on its evasion of all unnecessary thought and on its wonderful saving of mental operations." -- Ernst Mach, 1838-1916 Rudolf Adamkovi? [he/him] Studenohorsk? 25 84103 Bratislava Slovakia From bil at ccrma.Stanford.EDU Mon May 23 07:11:13 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Mon, 23 May 2022 07:11:13 -0700 Subject: [CM] Strange display behavior In-Reply-To: References: Message-ID: <1a44027dcd366647ee32da025abdf793@ccrma.stanford.edu> Thanks for the bug report. The display and equal? results come from quasiquote's internal use of append; a couple weeks ago I changed generic append to handle sequences more consistently, and overlooked that problem -- s7test.scm has similar tests, but none that caught that particular case. I'll upload a fix for this tomorrow. From bil at ccrma.Stanford.EDU Mon May 23 11:11:23 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Mon, 23 May 2022 11:11:23 -0700 Subject: [CM] Unicode support In-Reply-To: References: Message-ID: <73536df67148ceff749e9c1d178ee98e@ccrma.stanford.edu> > We just need to send a Unicode string across, from s7 to C to Swift. I thought from your example that you wanted to see a filled square. If you want to encode a sequence of utf8 codepoints (if that is the correct terminology), I think you can use utf8proc_map or maybe utf8proc_encode_char (on each one), filling a byte-vector, then pass that to C -- the byte-vector data is a C array of bytes, so it can be used directly (see s7_byte_vector_elements). As I said before, I haven't had time (or need) to learn much about Unicode, but I wrote libutf8proc.scm because at that time the Julia language was using it to implement its utf8 stuff. From chris.actondev at gmail.com Mon May 23 14:44:47 2022 From: chris.actondev at gmail.com (Christos Vagias) Date: Mon, 23 May 2022 23:44:47 +0200 Subject: [CM] C GUI SDK etc Message-ID: Hi all, I just discovered a C GUI library, which seems really good. At least the documentation is amazing! https://nappgui.com/en/home/web/home.html https://nappgui.com/en/demo/die.html I think it'd be interesting to programmatically create s7 bindings from it, by parsing the headers. I've not been quite active since I started a new job (doing C++ instead of web dev for a change). Still working with s7 but much less time-wise. Bill I've yet to look into dynamic library loading for MSVC, but have not forgotten about it. Best, Christos -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at eggheadgames.com Thu May 26 02:42:14 2022 From: mike at eggheadgames.com (Michael Mee) Date: Thu, 26 May 2022 17:42:14 +0800 Subject: [CM] Strange display behavior In-Reply-To: References: Message-ID: <0ED8815A-5E3A-46A1-AD25-DF266E449F9D@eggheadgames.com> Thanks! Rudy?s example now works with the 26-may-2022 version! However this does not work as expected yet: ? (display `(foo . ,(string-append "hello " "there"))) (foo #\h #\i #\space #\t #\h #\e #\r #\e)(foo #\h #\i #\space #\t #\h #\e #\r #\e) For comparison, Guile gives: (foo . hello there) Thanks as always, Michael On 23 May 2022, at 18:56, Rudolf Adamkovi? wrote: > Hello smart people! > > I have just updated to 7aa20a28a95026b76a743d95b6a07729beac0dc5 and > observe: > > ? (display '(foo . "hello")) > (foo . "hello")(foo . "hello") > > ? (display `(foo . "hello")) > (foo #\h #\e #\l #\l #\o)(foo #\h #\e #\l #\l #\o) > > Do we expect this? > > Rudy > -- > "Genius is 1% inspiration and 99% perspiration." > -- Thomas Alva Edison, 1932 > > Rudolf Adamkovi? [he/him] > Studenohorsk? 25 > 84103 Bratislava > Slovakia > > _______________________________________________ > Cmdist mailing list > Cmdist at ccrma.stanford.edu > https://cm-mail.stanford.edu/mailman/listinfo/cmdist -------------- next part -------------- An HTML attachment was scrubbed... URL: From bil at ccrma.Stanford.EDU Thu May 26 06:10:49 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 26 May 2022 06:10:49 -0700 Subject: [CM] Strange display behavior In-Reply-To: <0ED8815A-5E3A-46A1-AD25-DF266E449F9D@eggheadgames.com> References: <0ED8815A-5E3A-46A1-AD25-DF266E449F9D@eggheadgames.com> Message-ID: <8255bbd22fd72b7dcaf634ab688795e9@ccrma.stanford.edu> > (display `(foo . ,(string-append "hello " "there"))) Thanks. This is the other append in g_quasiquote_1 which I meant to check, but got sidetracked -- ca line 67688. I'll put up the fixed version tomorrow. In s7 it displays as (foo . "hello there"). From mike at eggheadgames.com Fri May 27 21:09:01 2022 From: mike at eggheadgames.com (Michael Mee) Date: Sat, 28 May 2022 12:09:01 +0800 Subject: [CM] Strange display behavior In-Reply-To: <8255bbd22fd72b7dcaf634ab688795e9@ccrma.stanford.edu> References: <0ED8815A-5E3A-46A1-AD25-DF266E449F9D@eggheadgames.com> <8255bbd22fd72b7dcaf634ab688795e9@ccrma.stanford.edu> Message-ID: <314681A1-3B6E-4035-BAFA-321D085E6CFA@eggheadgames.com> Thanks! The latest version is back to passing all our tests. From bil at ccrma.Stanford.EDU Sun May 29 02:49:24 2022 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sun, 29 May 2022 02:49:24 -0700 Subject: [CM] Snd 22.4 Message-ID: Snd 22.4: in Snd, johnm got the pulseaudio playback to work. in s7: defined? changed slightly; you may want to add #t=locally defined generic append changed to make sequence handling more consistent, see s7test.scm ca line 10989 for examples checked: Fedora 36 (gcc 12.0), openbsd 7.1 Thanks!: Anders Vinjar, Michael Edwards, Fernando Oleo Blanco, Rudy Adamkovic, johnm, Michael Mee