single_cream icon indicating copy to clipboard operation
single_cream copied to clipboard

put the scheme code into the c file

Open rain-1 opened this issue 6 years ago • 3 comments

You can turn all the stdlib scheme code into a C string with this:

cat src/init.scm src/preprocessor.scm src/std.scm | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$/"/' >> src/sch3.c

but then you have error: string length ‘15446’ is greater than the length ‘4095’ ISO C99 compilers are required to support [-Werror=overlength-strings] and need to ether use a slightly uncommon function fmemopen to read characters from it or do an object oriented layer for reading from a FILE* or a char* like in s - which adds code and complexity.

rain-1 avatar Jan 29 '19 17:01 rain-1

Can you mention what the goal is of doing this? I think I can guess, but probably better that I don't :)

akkartik avatar Jan 29 '19 20:01 akkartik

Well i got the idea from the problem you had with running sch3 without loading the standard library. This way there would be no extra trouble reading in files from disk, it would just be loaded up already

rain-1 avatar Jan 29 '19 20:01 rain-1

Ah, I see. I'm not sure you need to optimize for my foolishness there :/ Your Readme said the right command clear as day.

akkartik avatar Jan 29 '19 20:01 akkartik