This is the mail archive of the cgen@sourceware.org mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch][commit] New (if (...) (...) (...)) Test Allowed at Top Level of the Input


   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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]