|
@@ -135,7 +135,6 @@ library/flash pointer), NAME-FORMAT is a FORMAT string allowing
|
|
|
the name of the entry to be modified for this particular
|
|
|
calculator, and FLAG-KEYS are keyword symbols specifying certain
|
|
|
flags for this calculator."
|
|
|
- (interactive)
|
|
|
(let ((entry-names nil)
|
|
|
(entry-stack-effect nil)
|
|
|
(entry-description nil)
|
|
@@ -175,6 +174,42 @@ flags for this calculator."
|
|
|
(push (list entry-names entry-stack-effect (reverse entry-description) entry-calc-infos) entries))
|
|
|
(reverse entries)))
|
|
|
|
|
|
+;;; Creating calculator data files
|
|
|
+;;;
|
|
|
+(defun rpl-edb-generate-calculator-data (edb-entries calculator)
|
|
|
+ "Generate data for CALCULATOR (a keyword identifying the model).
|
|
|
+Return a hash-table whose entries are keyed by entry name and
|
|
|
+whose values are lists of the form:
|
|
|
+ (STACK-EFFECT DESCRIPTION ADDRESS &rest FLAGS)."
|
|
|
+ (assert (keywordp calculator))
|
|
|
+ (let ((table (make-hash-table)))
|
|
|
+ (dolist (entry edb-entries)
|
|
|
+ (cl-destructuring-bind (names stack-effect description calc-infos) entry
|
|
|
+ (let ((calc-info (car (cl-member calculator calc-infos
|
|
|
+ :test (lambda (key info) (equal key (car info)))))))
|
|
|
+ (when calc-info
|
|
|
+ (let* ((addr-str (cadr calc-info))
|
|
|
+ (fmt-str (if (caddr calc-info) (caddr calc-info) "%s"))
|
|
|
+ (flags (cdddr calc-info))
|
|
|
+ (stack-str (apply 'concat (mapcar (lambda (s) (concat s "\n")) stack-effect)))
|
|
|
+ (descrip-str (apply 'concat (mapcar (lambda (s) (concat s "\n")) description)))
|
|
|
+ (data (cons stack-str (cons descrip-str (cons addr-str flags)))))
|
|
|
+ (dolist (name names)
|
|
|
+ (puthash (format fmt-str name) data table)))))))
|
|
|
+ table))
|
|
|
+
|
|
|
+(defun rpl-edb-make-calculator-data-file (edb-entries calculator)
|
|
|
+ ""
|
|
|
+ (assert (keywordp calculator))
|
|
|
+ (rpl-write-data-file (rpl-edb-generate-calculator-data edb-entries calculator)
|
|
|
+ (rpl-make-sysrpl-data-filename calculator)))
|
|
|
+
|
|
|
(defvar rpl-edb-entries nil
|
|
|
"A place on which to push the parsed entries.")
|
|
|
|
|
|
+(defun rpl-edb-make-all-data-files ()
|
|
|
+ ""
|
|
|
+ (interactive)
|
|
|
+ (setq rpl-edb-entries (rpl-edb-parse-buffer))
|
|
|
+ (dolist (calculator '(:38G :39G :48G :49G)) ; TODO auto-find all calculator models
|
|
|
+ (rpl-edb-make-calculator-data-file rpl-edb-entries calculator)))
|