Sigrid Solveig HaflínudóttirC FFI: the beginnings2f8fcfd10 months agoHistory
29 lines · 1004 B · Text
RawDownload
(def c (make-cc (λ (m) (princ m) (newline))))(assert (cc? c))(cc-add-include-path c "/usr/include/uuid")(cc-set-options c "-luuid")(def (match s)  (and (> (length s) 5)       (equal? (map rune-downcase (str-sub s 0 5))               "uuid_")))(assert (cc-compile          c          «#include <uuid.h>           »          (λ (filename line sym)            (when (match (aref sym 0))              (princ "symbol: ")              (with-bindings ((*print-pretty* NIL)) (print sym))              (princ " [" filename ":" line "]")              (newline)))          (λ (filename line name value)            (when (match name)              (princ "macro: " name " = " value " [" filename ":" line "]")              (let ((i (str->num value)))                (when i                  (set-top-level-value! (sym "uuid:" (str-sub name 5))                                        i)))              (newline)))))(assert (cc-relocate c))(princ "uuid:STR_LEN=" uuid:STR_LEN)(newline)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t