From: Mark Wooding Date: Thu, 8 Aug 2019 00:49:41 +0000 (+0100) Subject: src/module-impl.lisp: Indent the first line of a C fragment on output. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/commitdiff_plain/a61f73b9e977b2575fa0ef6ae2ca2ac3b0fc2221?ds=sidebyside src/module-impl.lisp: Indent the first line of a C fragment on output. If we make the text appear in the right column, then GCC (at least) will print out the correct line of the original Sod module and underline the right pieces of it in error messages. Which is pretty awesome, actually. --- diff --git a/src/module-impl.lisp b/src/module-impl.lisp index 44aa0b8..1eb2531 100644 --- a/src/module-impl.lisp +++ b/src/module-impl.lisp @@ -195,7 +195,10 @@ (defmethod print-object ((fragment c-fragment) stream) (prin1 (subseq text 0 37) stream) (write-string "..." stream)))) (output-c-excursion stream location - (lambda (stream) (write-string text stream)))))) + (lambda (stream) + (awhen (file-location-column location) + (dotimes (i it) (write-char #\space stream))) + (write-string text stream)))))) (defmethod make-load-form ((fragment c-fragment) &optional environment) (make-load-form-saving-slots fragment :environment environment))