Added an "_" to the file name obtained from library-name->file-name
if the last symbol of the library name matches the regex "^main_*$".
This commit is contained in:
parent
c19b79927e
commit
d3fb9eeb96
|
@ -1 +1 @@
|
||||||
1644
|
1645
|
||||||
|
|
|
@ -91,19 +91,24 @@
|
||||||
(assertion-violation 'library-extensions
|
(assertion-violation 'library-extensions
|
||||||
"not a list of strings" x)))))
|
"not a list of strings" x)))))
|
||||||
|
|
||||||
(define (library-name->file-name x)
|
(define (library-name->file-name ls)
|
||||||
(let-values (((p extract) (open-string-output-port)))
|
(let-values (((p extract) (open-string-output-port)))
|
||||||
(define (display-hex n)
|
(define (display-hex n)
|
||||||
(cond
|
(cond
|
||||||
((<= 0 n 9) (display n p))
|
((<= 0 n 9) (display n p))
|
||||||
(else (display
|
(else (write-char
|
||||||
(integer->char
|
(integer->char
|
||||||
(+ (char->integer #\A)
|
(+ (char->integer #\A)
|
||||||
(- n 10)))
|
(- n 10)))
|
||||||
p))))
|
p))))
|
||||||
(let f ((ls x))
|
(define (main*? x)
|
||||||
(unless (null? ls)
|
(and (>= (string-length x) 4)
|
||||||
(display "/" p)
|
(string=? (substring x 0 4) "main")
|
||||||
|
(for-all (lambda (x) (char=? x #\_))
|
||||||
|
(string->list (substring x 4 (string-length x))))))
|
||||||
|
(let f ((x (car ls)) (ls (cdr ls)))
|
||||||
|
(write-char #\/ p)
|
||||||
|
(let ([name (symbol->string x)])
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (c)
|
(lambda (c)
|
||||||
(cond
|
(cond
|
||||||
|
@ -111,15 +116,16 @@
|
||||||
(char<=? #\A c #\Z)
|
(char<=? #\A c #\Z)
|
||||||
(char<=? #\0 c #\9)
|
(char<=? #\0 c #\9)
|
||||||
(memv c '(#\- #\. #\_ #\~)))
|
(memv c '(#\- #\. #\_ #\~)))
|
||||||
(display c p))
|
(write-char c p))
|
||||||
(else
|
(else
|
||||||
(display "%" p)
|
(write-char #\% p)
|
||||||
(let ((n (char->integer c)))
|
(let ((n (char->integer c)))
|
||||||
(display-hex (quotient n 16))
|
(display-hex (quotient n 16))
|
||||||
(display-hex (remainder n 16))))))
|
(display-hex (remainder n 16))))))
|
||||||
(string->list
|
(string->list name))
|
||||||
(symbol->string (car ls))))
|
(if (null? ls)
|
||||||
(f (cdr ls))))
|
(when (main*? name) (write-char #\_ p))
|
||||||
|
(f (car ls) (cdr ls)))))
|
||||||
(extract)))
|
(extract)))
|
||||||
|
|
||||||
(define file-locator
|
(define file-locator
|
||||||
|
|
Loading…
Reference in New Issue