Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

put the scheme code into the c file #5

Open
rain-1 opened this issue Jan 29, 2019 · 3 comments
Open

put the scheme code into the c file #5

rain-1 opened this issue Jan 29, 2019 · 3 comments

Comments

@rain-1
Copy link
Owner

rain-1 commented Jan 29, 2019

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.

@akkartik
Copy link

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

@rain-1
Copy link
Owner Author

rain-1 commented Jan 29, 2019

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

@akkartik
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants