public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@glug.org>
To: cgen@sources.redhat.com
Subject: Re: [patch][commit] New (if (...) (...) (...)) Test Allowed at Top Level  of the Input
Date: Thu, 11 May 2006 11:52:00 -0000	[thread overview]
Message-ID: <E1Fe9fG-0007H5-3z@mail.agora-net.com> (raw)
In-Reply-To: <17506.11439.818364.259602@casey.transmeta.com> (message from 	Doug Evans on Wed, 10 May 2006 11:10:55 -0700 (PDT))

   From: Doug Evans <dje@transmeta.com>
   Date: Wed, 10 May 2006 11:10:55 -0700 (PDT)

   Blech.

   Dave Brolley writes:

    > I've committed the attach patch. I allows the psecification of
    > 
    > (if (application-is? <appname>)
    >     (true expr)
    >     (false expr))
    > 
    > at the top level of the CGEN input. This test corresponds to (eq? 
    > application <appname>) which is found in many places in the CGEN source. 
    > For example
    > 
    > (if  (application-is? SID-SIMULATOR)
    >      (include "sid-macros.cpu")
    >      (include "sim-macros.cpu"))

why not allow computed `include' instead?  (perhaps that is already
supported?)  something like:

(include EXPR)

then EXPR can be all manner of `if', `cond' or whatever.  e.g.:

(include (if (application-is? SID-SIMULATOR)
             "sid-macros.cpu"
             "sim-macros.cpu"))

(include (cond ((application-is? SID-SIMULATOR)
                "sid-macros.cpu")
               (else "sim-macros.cpu")))

(include (case (application->symbol APPLICATION-OBJECT)
           ((SIMULATOR) "sid-macros.cpu")
           (else "sid-macros.cpu")))

going from `if' to `cond' gets you extensibility.  going from `cond' to
`case' gets you regularity and some namespace separation, providing you
are in the mood for a certain style of symbolic manipulation...

thi

  reply	other threads:[~2006-05-11 11:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-10 17:57 Dave Brolley
2006-05-10 18:11 ` Doug Evans
2006-05-11 11:52   ` Thien-Thi Nguyen [this message]
2006-05-11 14:12     ` Dave Brolley
2006-05-11 16:45       ` Jim Blandy
2006-05-11 20:52         ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1Fe9fG-0007H5-3z@mail.agora-net.com \
    --to=ttn@glug.org \
    --cc=cgen@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).