unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [FEATURE] List all available languages
@ 2013-01-23 11:28 Nala Ginrut
  2013-01-25  9:56 ` Nala Ginrut
  0 siblings, 1 reply; 12+ messages in thread
From: Nala Ginrut @ 2013-01-23 11:28 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 469 bytes --]

As I talked with Andy, we may add a feature to list all available
languages. And if users add a new language to the %load-path, they may
see it listed out. Besides, this feature could be used in 'guild
compile' to detect all the language available.

Attached is a proc named 'get-all-available-languages', it'll scan all %
load-path and list the union of the languages available. 

Please review it.
If accepted, I'll format a patch into (ice-9 command-line).

Thanks!

[-- Attachment #2: lang.scm --]
[-- Type: text/x-scheme, Size: 560 bytes --]

(use-modules (ice-9 ftw) (srfi srfi-1))

(define (is-inner-lang? str)
  (and 
   (not (member str 
		'("glil" "glil.scm" "assembly" "assembly.scm" "bytecode" "objcode.scm" "objcode"
		  "tree-il" "tree-il.scm" "value" ".." ".")))
   str))

(define (get-all-available-languages)
  (let lp((rest (map (lambda (x) (string-append x "/language")) %load-path)) (result '()))
    (cond
     ((null? rest) (apply lset-union string=? result))
     (else 
      (let ((ll (scandir (car rest) is-inner-lang?)))
	(lp (cdr rest) (if ll (cons ll result) result)))))))

			 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-02-01  2:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-23 11:28 [FEATURE] List all available languages Nala Ginrut
2013-01-25  9:56 ` Nala Ginrut
2013-01-25 10:43   ` Nala Ginrut
2013-01-25 11:06     ` Andy Wingo
2013-01-25 16:46       ` Nala Ginrut
2013-01-31 10:32         ` Andy Wingo
2013-02-01  2:34           ` Nala Ginrut
2013-01-25 20:06       ` Mark H Weaver
2013-01-25 22:50         ` Mark H Weaver
2013-01-26  1:44           ` Nala Ginrut
2013-01-27 10:21           ` Andy Wingo
2013-01-27 15:31             ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).