Hi Felix, hi all, I've recently tried CRUNCH a bit and would like to give some feedback:
Installation: - worked fine on macOS - failed on NetBSD 10.1, for two reasons: - -Wno-parenthesis-equality is not available (gcc 10.5.0) - popcount32 (tests/embedded) has conflicting type with popcount32 defined in /usr/include/strings.h: former is long->long and latter is uint32->uint32. - After fixing that, the egg compiled, and installed fine. CRUNCH_NO_UTF: - I found a bit weird that only an object file is offered, why not a static library? Concerns with LTO? - If only an object is installedi (as currently is), can we have a command option to get the full path to the object? - CRUNCH_NO_UTF does not work properly because the function crunch_read_string (in crunch.h) has a call to crunch_utf_decode outside the #ifdef guard. crunch.h: - crunch.h file defines several functions as static, but if they are not used, the compiler complains. (I typically use -Wall when compiling). Why can't all these functions be marked as inline? Then the compiler won't complain and it can still decide not inline them if it prefers. - crunch.h needs some documentation at the top to explain the compile options (CRUNCH_NO_UTF, CRUNCH_FREESTANDING, CRUNCH_EMBEDDED, ...). Also a license notice in the file would be useful in case the developer wants to create a customized crunch.h and redistribute it. The example where I'd like to try CRUNCH might be outside the planned usecase: I'd like to program a microcontroller firmware with CRUNCH, specifically an atmega32u4. In theory it should be possible: transpile the CRUNCH program into C, compile the C program with avr-gcc, flash the device. With a few tweaks, I got a small program that blinks a LED running. The main issues were the many things crunch.h takes for granted, but that are not available in the avr world: file, process-context, etc. So for each section in crunch.h refering to a library, I've created an #ifdef guard and disabled most of them. Something like this: #ifndef CRUNCH_IMPORT_SCHEME_FILE /* (scheme file) */ ... #endif I have disabled (scheme file), (scheme time), (scheme complex), (scheme inexact), and (crunch process-context). My suggestion here would be to add such guards to all libraries supported by CRUNCH and then only enable them (by defining CRUNCH_IMPORT_<LIB>) if the respective <LIB> has been imported in the .scm file. Besides the libraries, I also had to make optional (and disabled) all interfaces with complex numbers, 128bit integers, and which use fmemopen. From three, the most intrusive change was regarding the complex numbers because they are spread all over the file (similarly as `CRUNCH_NO_UTF`). For the moment this is all feedback I have. Thanks for releasing this nice feature to the CHICKEN ecosystem. Cheers, -Diogo