From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.devel Subject: [FEATURE] List all available languages Date: Wed, 23 Jan 2013 19:28:38 +0800 Organization: HFG Message-ID: <1358940518.3676.5.camel@Renee-desktop.suse> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-WRLRbjpScz7MV4+NgMz9" X-Trace: ger.gmane.org 1358940534 2110 80.91.229.3 (23 Jan 2013 11:28:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Jan 2013 11:28:54 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Jan 23 12:29:09 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TxyVx-0001Jl-J2 for guile-devel@m.gmane.org; Wed, 23 Jan 2013 12:29:09 +0100 Original-Received: from localhost ([::1]:33594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxyVg-0005nB-BS for guile-devel@m.gmane.org; Wed, 23 Jan 2013 06:28:52 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxyVZ-0005mt-A2 for guile-devel@gnu.org; Wed, 23 Jan 2013 06:28:50 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxyVY-0001C4-6r for guile-devel@gnu.org; Wed, 23 Jan 2013 06:28:45 -0500 Original-Received: from mail-pb0-f47.google.com ([209.85.160.47]:55831) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxyVY-0001Bx-19 for guile-devel@gnu.org; Wed, 23 Jan 2013 06:28:44 -0500 Original-Received: by mail-pb0-f47.google.com with SMTP id wz17so4612501pbc.20 for ; Wed, 23 Jan 2013 03:28:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:subject:from:to:date:organization :content-type:x-mailer:mime-version; bh=ZAWyg5ZHvZoez/riS4erAC2hM6mv4KacIbpAtmvkbuU=; b=Hyx86XdNhjLkpC3k0PQXzGO6vG/o4s12gvIMuchciuDHYGJVu6JzeQcajO6jUb1A6z zY60F/QygxLt2+b4Ahj/r9FLr48sJm4B7FAVCwb/rtB4FUpRboA3pOxVCQQ20FTX/DBS aVvtVWl74an229F3BJGR6db+oxbr2aseM82pt1qG0cwvWwuJqrGiej7fPply/cX2FZCO GwNdIlMBU3VXXoJxZUe4yh0l5FwNckYdY+Q23ZLY8jTcDGC+Bz5K8k0JZrCzn9TVzX5F 08xviR1bRyTQs6WCKxuSJHc8nbd0dfw5yLPkZm6+XrllOesbi89LktmT9bibmCHa478J e6CQ== X-Received: by 10.66.82.35 with SMTP id f3mr3668171pay.49.1358940523101; Wed, 23 Jan 2013 03:28:43 -0800 (PST) Original-Received: from [147.2.147.112] ([61.14.130.226]) by mx.google.com with ESMTPS id m3sm13407939pav.4.2013.01.23.03.28.40 (version=SSLv3 cipher=RC4-SHA bits=128/128); Wed, 23 Jan 2013 03:28:41 -0800 (PST) X-Mailer: Evolution 3.4.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.160.47 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15560 Archived-At: --=-WRLRbjpScz7MV4+NgMz9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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! --=-WRLRbjpScz7MV4+NgMz9 Content-Disposition: attachment; filename="lang.scm" Content-Type: text/x-scheme; name="lang.scm"; charset="UTF-8" Content-Transfer-Encoding: 7bit (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))))))) --=-WRLRbjpScz7MV4+NgMz9--