CIR Playground
Load example...
CIR on GitHub
Input
Run
#include <stdio.h> #include <stdlib.h> #include <cir.h> #include <zlib.h> static CirCodeId def(const char *data) { char *buf = malloc(4096); z_stream strm; strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; int ret = deflateInit(&strm, 9); if (ret != Z_OK) cir_fatal("deflateInit failed"); strm.avail_in = strlen(data); strm.next_in = data; strm.avail_out = 4095; strm.next_out = buf; deflate(&strm, Z_FINISH); size_t len = 4095 - strm.avail_out; deflateEnd(&strm); buf[len] = 0; return CirCode_ofExpr(CirValue_ofString(buf, len + 1)); } int main(void) { fwrite(@def("Hello World!"), sizeof(@def("Hello World!")), 1, stdout); return 0; }
stdout
stderr
Load Example...
×
00 - Compile-time fibonacci
01 - Inline Repeat
02 - Compile-time strtok
03 - Does a code call a function
04 - C Preprocessor identifiers may be accidentally shadowed
05 - CIR identifiers won't be accidentally shadowed
06 - C Preprocessor accidental capture of symbols
07 - CIR won't accidentally capture symbols
08 - bf-to-C (low level ver)
09 - bf-to-C (with quote-antiquote)
10 - async-await
11 - Embed an external file
12 - zlib