clines-from-file - The argument to CLINES, LINE, is not a string



There is a great macro in ECL called Clines which allows me to paste C code into the ECL C output file and then other parts of ECL allow me to access and call that code once its compiled. What Im trying to do is write a function which allows me to read a file and puts its contents into Clines rather than having the C embedded as strings in the Lisp source. However I am a clueless newbie :-( I have the following function :

(defun clines-from-file (filename)
  (with-open-file (stream filename :direction :input)
    (loop for line = (read-line stream nil stream)
      until (eql line stream) do
      (Clines line))))

which I would think does what I want, however it generates an error when I load the file. ECL says:

The argument to CLINES, LINE, is not a string.

which is confusing because it 'looks' like a string if I change (Clines line) to (print line).

Can anyone help? I have a feeling that clines-from-file needs to be a macro like Clines but Im still learning macros.

Best regards, Bunny

.



Relevant Pages