[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 43f0eac016 004/323: Add support for changing
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 43f0eac016 004/323: Add support for changing compiler and flags |
Date: |
Thu, 9 Mar 2023 10:57:48 -0500 (EST) |
branch: externals/beardbolt
commit 43f0eac016f2d09531fdf03962bbc1768a840cc5
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Add support for changing compiler and flags
---
README.org | 2 ++
rmsbolt.el | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 54 insertions(+), 5 deletions(-)
diff --git a/README.org b/README.org
index 11bd429529..e041f7da80 100644
--- a/README.org
+++ b/README.org
@@ -9,3 +9,5 @@ A basic implementation of the
[[https://github.com/mattgodbolt/compiler-explorer
- Compilation runs entirely on your machine
- Faster results
- Infinitely hackable!
+- Write your code in your preferred editing environment
+- Runs entirely with 0 js
diff --git a/rmsbolt.el b/rmsbolt.el
index e1b8505334..2a9aef760d 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -41,11 +41,41 @@
"Shell rmsbolt will use to split paths.")
(defvar rmsbolt-output-buffer "*rmsbolt-output*")
-(defvar rmsbolt-output-filename "rmsbolt.s")
+(defun rmsbolt-output-filename ()
+ (expand-file-name "rmsbolt.s" rmsbolt-temp-dir))
(defvar rmsbolt-hide-compile t)
(defvar rmsbolt-intel-x86 t)
(defvar rmsbolt-filter-asm-directives t)
+;;;; Classes
+
+(cl-defstruct (rmsbolt-options
+ (:conc-name rmsbolt-o-))
+ (compile-cmd
+ ""
+ :type string
+ :documentation "The command used to compile this file")
+ )
+
+(cl-defstruct (rmsbolt-lang
+ (:conc-name rmsbolt-l-))
+ (options
+ nil
+ :type 'rmsbolt-options
+ :documentation "The default options object to use.")
+ (mode
+ 'fundamental-mode
+ :type 'symbol
+ :documentation "The mode to activate this language in."))
+
+(defvar rmsbolt-languages
+ `((c-mode .
+ ,(make-rmsbolt-lang :mode 'c-mode
+ :options (make-rmsbolt-options
+ :compile-cmd "gcc -g -O0")) )
+ ))
+
+
;;;; Macros
(defmacro rmsbolt-with-display-buffer-no-window (&rest body)
@@ -80,13 +110,13 @@
(with-current-buffer (get-buffer-create rmsbolt-output-buffer)
(cond ((not compilation-fail)
- (if (not (file-exists-p rmsbolt-output-filename))
+ (if (not (file-exists-p (rmsbolt-output-filename)))
(message "Error reading from output file.")
(delete-region (point-min) (point-max))
(insert
(rmsbolt--process-asm-lines
(with-temp-buffer
- (insert-file-contents rmsbolt-output-filename)
+ (insert-file-contents (rmsbolt-output-filename))
(split-string (buffer-string) "\n" t))))
(asm-mode)
(display-buffer (current-buffer))))
@@ -94,15 +124,32 @@
;; Display compilation output
(display-buffer buffer))))))
+(defun rmsbolt--get-cmd ()
+ "Gets the rms command from the buffer, if available."
+ (save-excursion
+ (goto-char (point-min))
+ (re-search-forward (rx "RMS:" (1+ space) (group (1+ (any "-" alnum
space)))) nil t)
+ (match-string-no-properties 1)))
+(defun rmsbolt--parse-options ()
+ "Parse RMS options from file."
+ (let* ((lang (cdr-safe (assoc major-mode rmsbolt-languages)))
+ (options (copy-rmsbolt-options (rmsbolt-l-options lang)))
+ (cmd (rmsbolt--get-cmd)))
+ (when cmd
+ (setf (rmsbolt-ro-compile-cmd options) cmd))
+ options))
+
(defun rmsbolt-compile ()
"Compile the current rmsbolt buffer."
(interactive)
(save-some-buffers nil (lambda () rmsbolt-mode))
- (let* ((cmd "gcc -O0")
+ (let* ((options (rmsbolt--parse-options))
+ (cmd (rmsbolt-o-compile-cmd options))
(cmd (mapconcat 'identity
(list cmd
+ "-g"
"-S" (buffer-file-name)
- "-o" rmsbolt-output-filename
+ "-o" (rmsbolt-output-filename)
(when rmsbolt-intel-x86
"-masm=intel"))
" ")))
- [elpa] branch externals/beardbolt created (now 06fd5a1eee), ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2626732524 003/323: Add filter for assembler directives, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 43f0eac016 004/323: Add support for changing compiler and flags,
ELPA Syncer <=
- [elpa] externals/beardbolt 61ccd7a73e 001/323: Initial commit, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b6127c7f67 007/323: Fix error when not filtering for labels, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 38649b53f2 018/323: Relicense to affero GPL, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f04df12d28 011/323: Add config facility for object dumping, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 74b773d370 026/323: Fix crash on quit for real, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a9e5fbfd7a 028/323: Implement line number parsing for disassembled files, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3b6bb5bd75 030/323: Add basic overlays to view matched lines, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5ab75b7f56 014/323: Add stubs for dissasembly, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0a55783f33 029/323: Add skeleton for font-lock, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 8dcd74b511 031/323: Clean up rmsbolt.c by moving starters into helper files, ELPA Syncer, 2023/03/09