(index ("inline" 0) ("inline-compile" 810) ("inline-cache" 2279))
(def (sig (syntax "(inline STRING [OPTIONS])" (id inline))) (p "Expands into a call of " (tt "inline-compile") " and compiles the code given in " (tt "STRING") ".  If encountered in compiled code, then this form will directly expand into a " (tt "(bind* ...)") " form, effectively embedding the inline code in the compiled file (so no run-time compilation is needed).  The optional string argument " (tt "OPTIONS") " may contain additional compilation parameters (these are ignored, when " (tt "inline") " is used in compiled code).") (highlight scheme "(inline \"int foo(int n) { return(n * 2); }\") \n\n  ==> (inline-compile \"int foo(int n) { return(n * 2); }\") ; when interpreted\n  ==> (bind*                                             ; when compiled\n        \"int foo(int n) { return(n * 2); }\")"))
(def (sig (procedure "(inline-compile STRING [OPTIONS])" (id inline-compile))) (p "Compiles the C source code in " (tt "STRING") " dynamically. If a compiled library with the same source text is currently loaded (and has been cached), then nothing is done. If it is not loaded, the " (i "inline cache") " is consulted, whether a compiled file for the same text is stored, and, if it is, it's loaded and the procedure is returned. If no such file exists, the compiler (``csc'') is invoked to create a compiled library (with any extra options passed in " (tt "OPTIONS") "), which is stored in the cache. The code will be compiled as if wrapped in " (tt "#>! ... <#") ". Note that you will have to shield " (tt "#include") " forms, if you don't want them to be processed by the FFI parser:") (highlight scheme "(inline #<<EOF\n#ifndef CHICKEN\n#include \"gd.h\"\n#include <stdio.h>\n#endif\n\nvoid genimages(int w, int h) {\n  gdImagePtr im;\n  FILE *pngout, *jpegout;\n  int black;\n  int white;\n\n  im = gdImageCreate(w, h);\n  black = gdImageColorAllocate(im, 0, 0, 0);\t\n  white = gdImageColorAllocate(im, 255, 255, 255);\t\n  gdImageLine(im, 0, 0, w - 1, h - 1, white);\t\n  pngout = fopen(\"test.png\", \"wb\");\n  jpegout = fopen(\"test.jpg\", \"wb\");\n  gdImagePng(im, pngout);\n  gdImageJpeg(im, jpegout, -1);\n  fclose(pngout);\n  fclose(jpegout);\n  gdImageDestroy(im);\n}\nEOF\n\"-L -lgd -L -lpng -L -lz -L -ljpeg -L -lfreetype\"\n)\n\n(genimages 64 64)"))
(def (sig (parameter "inline-cache" (id inline-cache))) (p "Holds the name of the directory which is used as a cache for compiled code and defaults to " (tt "./.cache") "."))
