gambiteer on master
Make manual's TCP Client with T… Merge pull request #762 from ve… (compare)
feeley on master
Windows: Fix typo (compare)
feeley on master
Fix select abort for --enable-m… Windows: restrict event mask to… Avoid infinite loop on EPIPE er… and 1 more (compare)
Hi there!
While porting my json-rpc to Gambit, I found a possible bug:
> (alist->hash-table '())
*** ERROR IN (stdin)@2.1 -- PAIR LIST expected
(srfi/69#alist->hash-table '())
Trying to convert an empty list into a hash-table sounds lame, but I'm using it as a set-filter
for make-parameter
, like this:
(define json-rpc-handler-table
(make-parameter '() (lambda (alist) (alist->hash-table alist equal?))))
I'm using v4.9.4. BTW, I also noticed that gsi still shows v4.9.3
define-values
, the correct implementation of this form and other R7RS forms depends on the new macro system we are working on… in the meantime you can use this definition:(define-macro (define-values vars expr)
(cond ((null? vars)
(let ((temp (gensym)))
`(##define ,temp
(##call-with-values (##lambda () ,expr) ##list))))
((null? (cdr vars))
`(##define ,(car vars) ,expr))
(else
(let ((temp (gensym)))
`(##begin
(##define ,temp
(##call-with-values (##lambda () ,expr) ##list))
,@(map (lambda (var)
`(##define ,var
(##if (##pair? ,temp)
(##let ((val (##car ,temp)))
(##set! ,temp (##cdr ,temp))
val)
(##error "too few values"))))
vars))))))
In the "try" IDE, I'd like to change the orientation of the console and editor panes from horizontal to vertical, i.e. have the console on top of the editor. I thought that maybe just changing UI.js:59 from:
elem.classList.add('g-h-panes');
to
elem.classList.add('g-v-panes');
might suffice, but no such luck. I end up just seeing the console. Most all of the class/style stuff seems to be nicely abstracted but I'm guessing that there is an assumption built somewhere in there (maybe the CSS) that is breaking it. Any guidance would be appreciated. My CSS-fu is not strong.
Thanks.
Another question about the web-based IDE in contrib/try
: Do I really need to server all the files in the try\try\lib
directory? I assume that some or all of it is to support a set of auto-loaded modules, some or all of which are needed by the demo code. Are any of them needed for core R7RS-small execution? Also, are all the various file types in a given subdirectory necessary? Typically I will see foo.scm
, foo.js
, foo#.scm
, foo.o1
, foo.o1.js
, and foo.o1.js.gz
files.
I'm fairly new to Gambit (though not to Scheme), so forgive my naiveté ;-)
@tck42 You can set GAMBUILD_VERBOSE=yes
or use gsc -verbose …
to get a trace of the C compiler invocations. For example:
$ GAMBUILD_VERBOSE=yes gsc foo.scm
gcc-9 -O1 -bundle -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 -D___SINGLE_HOST -D___DYNAMIC -I"/usr/local/Gambit/include" -o 'foo.o1' 'foo.c'
$ GAMBUILD_VERBOSE=yes gsc -exe foo.scm
gcc-9 -O1 -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 -D___SINGLE_HOST -I"/usr/local/Gambit/include" -c -o 'foo.o' 'foo.c'
gcc-9 -O1 -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 -D___SINGLE_HOST -I"/usr/local/Gambit/include" -c -o 'foo_.o' 'foo_.c'
gcc-9 -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 -D___SINGLE_HOST -I"/usr/local/Gambit/include" -o 'foo' 'foo_.o' 'foo.o' "/usr/local/Gambit/lib/libgambit.a”
After gsc
has generated the C file(s) it will call the ~~bin/gambuild-C
script as the last step of the compilation to invoke the C compiler and linker. When that script is called with no command line arguments it will dump all of the environment variable bindings it uses:
$ `gsc -e '(display (path-expand "~~bin/gambuild-C"))'`
C_COMPILER="gcc-9"
C_PREPROC="gcc-9 -E"
PKG_CONFIG="pkg-config"
FLAGS_OBJ=" -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 "
FLAGS_DYN=" -bundle -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 "
FLAGS_LIB=" -dynamiclib -install_name \$(libdir)/\$(LIBRARY)\$(LIB_VERSION_SUFFIX) "
FLAGS_EXE=" -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fomit-frame-pointer -fPIC -fno-common -mpc64 "
FLAGS_OPT=" -O1"
FLAGS_OPT_RTS=" -O3"
DEFS_OBJ=" -D___SINGLE_HOST "
DEFS_DYN=" -D___SINGLE_HOST -D___DYNAMIC"
DEFS_LIB=" -D___SINGLE_HOST "
DEFS_EXE=" -D___SINGLE_HOST “
…
You can see for example that FLAGS_DYN
are the flags used for compiling a dynamically loadable object file.
If you need additional command line parameters to be passed to the C compiler you can do it manually with the -cc-options XXX
argument to gsc
, or set CFLAGS
.
$ cp contrib/GambitREPL/json*.scm .
$ gsc . json
$ gsi .
Gambit v4.9.4-39-g9a887b80
> (import json)
> (define x (call-with-input-string "{\"name\":\"John\", \"age\":30, \"car\":null}" json-read))
> (table-ref x "age")
30
> (table->list x)
(("name" . "John") ("car") ("age" . 30))
configure
script copies the current setting of CFLAGS
into the makefiles and the gambuild-C
script. So when a Scheme file is compiled by gsc
it should only be using (implicitly) the setting of CFLAGS
at that moment, i.e. there is no relationship with the build environment.
-Wl,-dT,/builddir/build/BUILD/.package_note-gambit-c-4.9.3-7.fc36.x86_64.ld
FLAGS_DYN="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-gambit-c-4.9.3-7.fc36.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic -shared"
FLAGS_LIB="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-gambit-c-4.9.3-7.fc36.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -rdynamic -shared"
FLAGS_EXE="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/builddir/build/BUILD/.package_note-gambit-c-4.9.3-7.fc36.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic"
FLAGS_DYN="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/home/tck42/rpmbuild/BUILD/gambit-4.9.4/.package_note-gambit-c-4.9.4-1.fc37.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic -shared"
FLAGS_LIB="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/home/tck42/rpmbuild/BUILD/gambit-4.9.4/.package_note-gambit-c-4.9.4-1.fc37.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -rdynamic -shared"
FLAGS_EXE="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -Wl,-dT,/home/tck42/rpmbuild/BUILD/gambit-4.9.4/.package_note-gambit-c-4.9.4-1.fc37.x86_64.ld -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-trapping-math -fno-math-errno -fschedule-insns2 -foptimize-sibling-calls -fmodulo-sched -freschedule-modulo-scheduled-loops -fomit-frame-pointer -fPIC -fno-common -mpc64 -rdynamic"
I see the problem in configure.ac
:
if test "$ENABLE_CPLUSPLUS" = yes; then
CORCXXFLAGS="$CXXFLAGS"
else
CORCXXFLAGS="$CFLAGS"
fi
FLAGS_OBJ="$CORCXXFLAGS $FLAGS_OBJ $FLAGS_OBJ_DYN $FLAGS_OBJ_DYN_LIB_EXE"
FLAGS_DYN="$LDFLAGS $CORCXXFLAGS $FLAGS_DYN $FLAGS_OBJ_DYN $FLAGS_OBJ_DYN_LIB_EXE $FLAGS_DYN_LIB"
so I was wrong and CFLAGS
from the build environment is being captured in the generated gambuild-C
script...