File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #lang racket
2+ (provide check-nasm-available)
3+ (require racket/gui/dynamic)
4+
5+ (define nasm-msg
6+ #<<HERE
7+ nasm not found: either you have not installed nasm
8+ or it cannot be found in your PATH: ~a.~a
9+ HERE
10+ )
11+
12+ (define macosx-msg
13+ #<<HERE
14+
15+
16+ It appears you launched DrRacket using Finder, which
17+ does properly set up the PATH environment variable.
18+ Try launching DrRacket from the command line using the
19+ 'drracket ' command.
20+ HERE
21+ )
22+
23+ (define (macos?)
24+ (eq? 'macosx (system-type 'os )))
25+
26+ ;; This will lie if you happen to run drracket from /, but that's OK.
27+ (define (launched-with-finder?)
28+ (equal? (string->path "/ " ) (find-system-path 'orig-dir )))
29+
30+ (define (drracket?)
31+ (gui-available?))
32+
33+ (define (check-nasm-available)
34+ (unless (parameterize ([current-output-port (open-output-string)]
35+ [current-error-port (open-output-string)])
36+ (system "nasm -v " ))
37+ (error (format nasm-msg
38+ (getenv "PATH " )
39+ (if (and (drracket?) (macos?) (launched-with-finder?)) macosx-msg "" )))))
Original file line number Diff line number Diff line change 44 [asm-interp (-> (listof instruction?) any/c)]
55 [asm-interp/io (-> (listof instruction?) string? any/c)])
66
7- (require "printer.rkt " "ast.rkt " "callback.rkt "
7+ (require "printer.rkt " "ast.rkt " "callback.rkt " " check-nasm.rkt "
88 (rename-in ffi/unsafe [-> _->]))
99(require (submod "printer.rkt " private ))
1010
11+ ;; Check NASM availability when required to fail fast.
12+ (check-nasm-available)
13+
1114;; Assembly code is linked with object files in this parameter
1215(define current-objs
1316 (make-parameter '() ))
You can’t perform that action at this time.
0 commit comments