[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 24ac775643 246/323: Support Nim 1.6.6
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 24ac775643 246/323: Support Nim 1.6.6 |
Date: |
Thu, 9 Mar 2023 10:58:35 -0500 (EST) |
branch: externals/beardbolt
commit 24ac7756438e1fde72f547f22f374366b921d6f3
Author: Andreas Kröhnke <andreas@krohnke.me>
Commit: Jay Kamat <jaygkamat@gmail.com>
Support Nim 1.6.6
---
README.org | 2 ++
doc/rmsbolt.org | 9 +++++++++
rmsbolt.el | 31 +++++++++++++++++++++++++++++++
starters/rmsbolt.nim | 21 +++++++++++++++++++++
4 files changed, 63 insertions(+)
diff --git a/README.org b/README.org
index c957e0ed2a..97983d4d2b 100644
--- a/README.org
+++ b/README.org
@@ -119,6 +119,8 @@ The main knobs are described in the full documentation.
[[https://i.imgur.com/36aNVvf.gif][https://i.imgur.com/36aNVvf.gif]]
** Swift
[[https://gitlab.com/jgkamat/rmsbolt/uploads/80d38e840a149c77951891c3623ca2f2/lFG72Lv_-_Imgur.gif][https://gitlab.com/jgkamat/rmsbolt/uploads/80d38e840a149c77951891c3623ca2f2/lFG72Lv_-_Imgur.gif]]
+** Nim
+[[https://i.imgur.com/8y4jtK9.gif][https://i.imgur.com/8y4jtK9.gif]]
* Community and Support
diff --git a/doc/rmsbolt.org b/doc/rmsbolt.org
index 632a5c67f2..fbb1a2b031 100644
--- a/doc/rmsbolt.org
+++ b/doc/rmsbolt.org
@@ -199,6 +199,15 @@ file:
Uses Go's objdump tool to produce viewing-only bytecode. Go must be on the
path.
+** Nim
+
+Builds into object files into a temporary ~nim-cache~ directory generated by
+rmsbolt, which will then be copied and dissassembled.
+C++ backend is also possible to either with ~nim cpp~ or ~nim c
+--passC:-std=gnu++14~ and uses ~c++filt~ demangler.
+
+Use the ~{.exportc.}~ pragma for at least the main procedure that will be
dissassembled.
+
* Integrations
This section covers integrations that RMSbolt provides, which make it easier to
use RMSbolt with complex projects with many dependencies.
diff --git a/rmsbolt.el b/rmsbolt.el
index ae6a7e1e35..e5b6f6ba75 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -672,6 +672,30 @@ https://github.com/derickr/vld"
(rmsbolt--disassemble-file file-name (current-buffer))
(rmsbolt--handle-finish-compile src-buffer nil :override-buffer
(current-buffer)))))
+(cl-defun rmsbolt--nim-compile-cmd (&key src-buffer)
+ "Process a compile command for nim."
+ (rmsbolt--with-files
+ src-buffer
+ (let* ((disass (buffer-local-value 'rmsbolt-disassemble src-buffer))
+ (cmd (buffer-local-value 'rmsbolt-command src-buffer))
+ (cmd
+ (let* ((outdir (expand-file-name "nim-cache" rmsbolt--temp-dir)))
+ (string-join
+ (list cmd
+ "--debugger:native"
+ "--noLinking"
+ "--colors:off"
+ (concat "--nimcache:" outdir)
+ src-filename
+ (concat "&& cp "
+ (expand-file-name (concat "@m"
+ (ff-basename
src-filename)
+ (if (string-match
(rx "nim cpp") cmd) ".cpp.o" ".c.o"))
+ outdir)
+ " " output-filename))
+ " "))))
+ cmd)))
+
(cl-defun rmsbolt--zig-compile-cmd (&key src-buffer)
"Process a compile command for zig."
(rmsbolt--with-files
@@ -902,6 +926,13 @@ return t if successful."
:process-asm-custom-fn (lambda (_src-buffer lines)
lines)
:elisp-compile-override
#'rmsbolt--elisp-compile-override))
+ (nim-mode
+ . ,(make-rmsbolt-lang :compile-cmd "nim c"
+ :supports-disass t
+ :objdumper 'objdump
+ :demangler "c++filt"
+ :compile-cmd-function #'rmsbolt--nim-compile-cmd
+ :disass-hidden-funcs rmsbolt--hidden-func-c))
(zig-mode
. ,(make-rmsbolt-lang :compile-cmd "zig build-obj -O ReleaseFast"
:supports-asm t
diff --git a/starters/rmsbolt.nim b/starters/rmsbolt.nim
new file mode 100644
index 0000000000..bce7e91885
--- /dev/null
+++ b/starters/rmsbolt.nim
@@ -0,0 +1,21 @@
+import strutils
+
+# Nim rmsbolt starter file
+
+# Local Variables:
+# rmsbolt-command: "nim c --opt:size"
+# End:
+
+
+
+proc isRMS(a: char): uint8 {.exportc.} =
+ case a
+ of 'R': result = 1
+ of 'M': result = 2
+ of 'S': result = 3
+ else: result = 0
+
+proc main(): void =
+ const a: char = cast[char](1 + 1)
+ if (isRMS(a) != 0):
+ echo "$#" % $a
- [elpa] externals/beardbolt 51ff24b3b1 217/323: Fix native-comp docstring warnings, (continued)
- [elpa] externals/beardbolt 51ff24b3b1 217/323: Fix native-comp docstring warnings, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0bc89903f1 231/323: on-kill-buffer: Fix error on missing output-buffer, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d09d72f463 215/323: Add after-parse-hook, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt af37266681 227/323: Rename rmsbolt--cleanup-overlays -> rmsbolt--remove-overlays, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f3fe3d24db 230/323: Don't use a timer for updating overlays, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 6d0d799d44 233/323: Fix docstring warnings, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b4f31813dc 240/323: Auto stop an existing compilation, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 50cd4c6d0c 234/323: Use setq for `rmsbolt-dir`, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 9c56c62993 247/323: Update texi docs, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3baf531b55 238/323: Refactor: Move let binding closer to point of usage, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 24ac775643 246/323: Support Nim 1.6.6,
ELPA Syncer <=
- [elpa] externals/beardbolt e634757395 235/323: Remove unneeded lambda, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3514e6f288 237/323: rmsbolt-compile: Only ask to save the current buffer, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ea22302660 258/323: Delete beardbolt-split.el, doesn't justify separate file, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 7619539a86 243/323: starters/elisp: Fix compiler warning, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d37371b088 249/323: Fix byte-compilation warnings, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 1873e605ab 256/323: Remove unused test/test-helper.el, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ce91938102 261/323: Simplify management of bb--temp-dir, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 264b614805 264/323: * beardbolt.el (bb-compile): Better handling of hack-local-variables., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ed99686703 267/323: Handle TTYs with unknown background color, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 715f132d0e 263/323: Started rewriting. Too many changes to mention., ELPA Syncer, 2023/03/09