Skip to content

Files

Latest commit

 

History

History
58 lines (47 loc) · 2.21 KB

arduino_file.org

File metadata and controls

58 lines (47 loc) · 2.21 KB

File list

idfilenamestatus
driverarduino.orgS
python_functionsarduino.pySTA
lisp_functionsarduino.lispT0inside string ends with ;
function_enumsfunctions_enums.cTends with,
function_definitionsfunctions.cTfunction definitions
function_namesfunction_names.cTends with a coma
function_PROGMEMfunctions_PROGMEM.cT
function_docfunction_doc.cT
templateulisp.tmplI
outputulisp.inoO

Use format for template

from string import Template
import os
exec(open("./arduino.py").read())
os.system('touch ulisp.ino')
fnames = dict_from_columns(0,1,inp)
fstatus = dict_from_columns(0,2,inp)

fstrings = {}

for i in list(fnames.keys()):fstrings[i] = read_file_to_string(fnames[i])

template_string = fstrings['template']
unquoted_lisp_code = fstrings['lisp_functions']
quoted_lisp_code = quote_lisp_library_text(unquoted_lisp_code)
fstrings['lisp_functions'] = quoted_lisp_code

template_string7 = template_string.format(**fstrings)
os.system('touch ulisp.ino')
write_string_to_file(fnames['output'],template_string7)
os.system('mv '+fnames['output']+ " " + "./ulisp/"+fnames['output'])

read file in lisp

(defun read-file (infile)
  (with-open-file (instream infile :direction :input :if-does-not-exist nil)
    (when instream 
      (let ((string (make-string (file-length instream))))
        (read-sequence string instream)
        string))))

(setq funcs (read-file "functions.c"))
(format t "~a" funcs)