Added per-calculator SysRPL databases.

This commit is contained in:
Paul Onions 2014-04-23 21:57:07 +01:00
parent 23ee0ca3d3
commit 98093a9dea
8 changed files with 53058 additions and 37 deletions

9714
data/sysrpl-data.38G.el Normal file

File diff suppressed because it is too large Load diff

10950
data/sysrpl-data.39G.el Normal file

File diff suppressed because it is too large Load diff

12603
data/sysrpl-data.48G.el Normal file

File diff suppressed because it is too large Load diff

19709
data/sysrpl-data.49G.el Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,5 @@
;;; -*- mode: emacs-lisp; lexical-binding: t -*-
;;; rpl-base.el -- basic setup for the RPL tools
;; Copyright (C) 2014 Paul Onions
@ -13,6 +15,7 @@
;; Basic setup for the RPL tools.
;;; Code:
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customizations
@ -32,7 +35,7 @@
"Make the SysRPL data filename used for CALCULATOR.
Where CALCULATOR should be a keyword symbol identifying the
calculator model, e.g. :48G, :49G etc."
(assert (keywordp calculator))
(cl-assert (keywordp calculator))
(concat rpl-sysrpl-data-file-prefix "." (substring (symbol-name calculator) 1) ".el"))
(defvar rpl-tools-data-dir
@ -69,13 +72,39 @@ string (either relative or absolute)."
;;
(message "Loading SysRPL information")
(defvar rpl-sysrpl-data
nil ;;(rpl-read-data-file rpl-sysrpl-data-file)
"!!!TODO!!!")
(defvar rpl-sysrpl-data-38g
(rpl-read-data-file (rpl-make-sysrpl-data-filename :38G))
"SysRPL data for the 38G calculator.")
(defvar rpl-sysrpl-names
nil ; extract from rpl-sysrpl-data
"!!!TODO!!!")
(defvar rpl-sysrpl-data-39g
(rpl-read-data-file (rpl-make-sysrpl-data-filename :39G))
"SysRPL data for the 39G calculator.")
(defvar rpl-sysrpl-data-48g
(rpl-read-data-file (rpl-make-sysrpl-data-filename :48G))
"SysRPL data for the 48G calculator.")
(defvar rpl-sysrpl-data-49g
(rpl-read-data-file (rpl-make-sysrpl-data-filename :49G))
"SysRPL data for the 49G calculator.")
(defun rpl-sysrpl-data-get-names (data)
(let ((names nil))
(maphash (lambda (key val)
(setq names (cons key names)))
data)
names))
(defun rpl-sysrpl-names (calculator)
(cl-assert (keywordp calculator))
(cond ((eql calculator :38G)
(rpl-sysrpl-data-get-names rpl-sysrpl-data-38g))
((eql calculator :39G)
(rpl-sysrpl-data-get-names rpl-sysrpl-data-39g))
((eql calculator :48G)
(rpl-sysrpl-data-get-names rpl-sysrpl-data-48g))
((eql calculator :49G)
(rpl-sysrpl-data-get-names rpl-sysrpl-data-49g))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Common keymap (including the ``RPL'' menu)

View file

@ -1,3 +1,5 @@
;;; -*- mode: emacs-lisp; lexical-binding: t -*-
;;; rpl-edb.el -- utilities to parse the entries database
;; Copyright (C) 2014 Paul Onions
@ -194,7 +196,7 @@ flags for this calculator."
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))
(cl-assert (keywordp calculator))
(let ((table (make-hash-table)))
(dolist (entry edb-entries)
(cl-destructuring-bind (names stack-effect description calc-infos) entry
@ -213,7 +215,7 @@ whose values are lists of the form:
(defun rpl-edb-make-calculator-data-file (edb-entries calculator)
""
(assert (keywordp calculator))
(cl-assert (keywordp calculator))
(rpl-write-data-file (rpl-edb-generate-calculator-data edb-entries calculator)
(rpl-make-sysrpl-data-filename calculator)))

View file

@ -1,3 +1,5 @@
;;; -*- mode: emacs-lisp; lexical-binding: t -*-
;;; rpl-tools.el -- tools for RPL calculator programming
;; Copyright (C) 2014 Paul Onions

View file

@ -1,6 +1,8 @@
;;; -*- mode: emacs-lisp; lexical-binding: t -*-
;;; sysrpl-mode.el -- Major mode for the SysRPL programming language
;; Copyright (C) 2013 Paul Onions
;; Copyright (C) 2014 Paul Onions
;; Author: Paul Onions <paul.onions@acm.org>
;; Keywords: RPL, SysRPL, HP48, HP49, HP50, calculator
@ -14,12 +16,12 @@
;; language of HP48/49/50-series calculators.
;;; Code:
(require 'cl-lib)
(require 'rpl-base)
(defcustom rpl-sysrpl-default-calculator :HP48G
(defcustom rpl-sysrpl-default-calculator :48G
"Default calculator type for SysRPL mode."
:type '(radio :HP38G :HP39G :HP48G :HP49G)
:type '(radio :38G :39G :48G :49G)
:group 'rpl)
(defface sysrpl-name '((t (:foreground "blue")))
@ -27,7 +29,7 @@
:group 'rpl)
(defvar sysrpl-syntax-table
(let ((table (make-syntax-table)))
(let ((table (make-syntax-table prog-mode-syntax-table)))
(modify-syntax-entry ?: "w" table)
(modify-syntax-entry ?! "w" table)
(modify-syntax-entry ?@ "w" table)
@ -48,8 +50,14 @@
table)
"The SysRPL syntax table.")
(defun sysrpl-make-keywords-regexp (calculator)
(cl-assert (keywordp calculator))
(concat "\\<" (regexp-opt (rpl-sysrpl-names calculator)) "\\>"))
(defvar sysrpl-keywords-regexp
(concat "\\<" (regexp-opt rpl-sysrpl-names) "\\>")
;; !!! TODO Unfortunately does not work because Emacs complains that
;; !!! the regular expression is too large (?!?)
(sysrpl-make-keywords-regexp rpl-sysrpl-default-calculator)
"Regular expression for SysRPL keywords.")
(defvar sysrpl-keyword-face 'sysrpl-name)
@ -60,25 +68,29 @@
(defvar sysrpl-selected-calculator rpl-sysrpl-default-calculator
"Currently selected calculator model.")
(defun sysrpl-select-hp38g ()
(defun sysrpl-select-38g ()
"Set the currently selected calculator model to be the 38G."
(interactive)
(setq sysrpl-selected-calculator :HP38G))
(setq sysrpl-selected-calculator :38G)
(setq sysrpl-keywords-regexp (sysrpl-make-keywords-regexp :38G)))
(defun sysrpl-select-hp39g ()
(defun sysrpl-select-39g ()
"Set the currently selected calculator model to be the 39G."
(interactive)
(setq sysrpl-selected-calculator :HP39G))
(setq sysrpl-selected-calculator :39G)
(setq sysrpl-keywords-regexp (sysrpl-make-keywords-regexp :39G)))
(defun sysrpl-select-hp48g ()
(defun sysrpl-select-48g ()
"Set the currently selected calculator model to be the 48G."
(interactive)
(setq sysrpl-selected-calculator :HP48G))
(setq sysrpl-selected-calculator :48G)
(setq sysrpl-keywords-regexp (sysrpl-make-keywords-regexp :48G)))
(defun sysrpl-select-hp49g ()
(defun sysrpl-select-49g ()
"Set the currently selected calculator model to be the 49G."
(interactive)
(setq sysrpl-selected-calculator :HP49G))
(setq sysrpl-selected-calculator :49G)
(setq sysrpl-keywords-regexp (sysrpl-make-keywords-regexp :49G)))
(defvar sysrpl-mode-map
(let ((map (make-sparse-keymap))
@ -88,18 +100,18 @@
(define-key map [menu-bar rpl-menu] (cons "RPL" menu-map))
(define-key menu-map [sysrpl-menu-separator-1]
'(menu-item "--"))
(define-key menu-map [sysrpl-menu-select-hp49g]
'(menu-item "HP49G" sysrpl-select-hp49g
:button (:radio . (eql :HP49G sysrpl-selected-calculator))))
(define-key menu-map [sysrpl-menu-select-hp48g]
'(menu-item "HP48G" sysrpl-select-hp48g
:button (:radio . (eql :HP48G sysrpl-selected-calculator))))
(define-key menu-map [sysrpl-menu-select-hp39g]
'(menu-item "HP39G" sysrpl-select-hp39g
:button (:radio . (eql :HP39G sysrpl-selected-calculator))))
(define-key menu-map [sysrpl-menu-select-hp38g]
'(menu-item "HP38G" sysrpl-select-hp38g
:button (:radio . (eql :HP38G sysrpl-selected-calculator))))
(define-key menu-map [sysrpl-menu-select-49g]
'(menu-item "HP49G" sysrpl-select-49g
:button (:radio . (eql :49G sysrpl-selected-calculator))))
(define-key menu-map [sysrpl-menu-select-48g]
'(menu-item "HP48G" sysrpl-select-48g
:button (:radio . (eql :48G sysrpl-selected-calculator))))
(define-key menu-map [sysrpl-menu-select-39g]
'(menu-item "HP39G" sysrpl-select-39g
:button (:radio . (eql :39G sysrpl-selected-calculator))))
(define-key menu-map [sysrpl-menu-select-38g]
'(menu-item "HP38G" sysrpl-select-38g
:button (:radio . (eql :38G sysrpl-selected-calculator))))
map)
"The SysRPL mode local keymap.")
@ -109,7 +121,7 @@
(define-derived-mode sysrpl-mode prog-mode "SysRPL"
"Major mode for the SysRPL language."
:group 'rpl
(setq font-lock-defaults (list sysrpl-font-lock-keywords))
(setq rpl-menu-compile-file-enable t))
(setq font-lock-defaults (list 'sysrpl-font-lock-keywords))
(setq rpl-menu-compile-file-enable nil))
(provide 'sysrpl-mode)