#!/usr/bin/clisp -q ;; This is an assembler preprocessor to take ARM assembly language in the ;; format I prefer and convert it to a format suitable for ;; input to the GNU assembler. ;; The initial conversion is to replace semicolons with at-signs. ;; We might later set up some simple renaming or substitutions. (defun pre-process-old () "Pickup the input and output file names from the command-line arguments. Copy the input to the output, but with modifications. To begin with, just change every occurrence of ';' to '@'. This version is not used now (see the version below instead). However, if our modifications become more complex, we may return to this version that reads a line at a time." (let ((input-file-name (first *args*)) (output-file-name (second *args*))) (with-open-file (input-file input-file-name :direction :input :element-type 'character) (with-open-file (output-file output-file-name :direction :output :element-type 'character) (loop for line = (read-line input-file nil nil) ; get next line while line do (write-line line output-file)))))) (defun pre-process () "Pickup the input and output file names from the command-line arguments. Copy the input to the output, but with modifications. To begin with, just change every occurrence of ';' to '@'." (let ((input-file-name (first *args*)) (output-file-name (second *args*))) (with-open-file (input-file input-file-name :direction :input :element-type 'character) (with-open-file (output-file output-file-name :direction :output :element-type 'character) (loop for char = (read-char input-file nil nil) ; get next char while char do (write-char (if (char= char #\;) #\@ char) output-file)))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Here is where we invoke the main function. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (pre-process)