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

Dave Brolley brolley@redhat.com
Thu May 11 14:12:00 GMT 2006


Thien-Thi Nguyen wrote:

>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")))
>
>  
>
The point isn't really the (include "..."). That's just what I happened 
to use the 'if' capability for. The true and false expressions could 
theoretically be any valid top level CGEN construct. Implementing 
conditional capability for them all seems like a lot more work for no 
gain and may not even make sense in some cases. Also 'cond' or 'case' 
could easily be added as top level tests if necessary.

Dave



More information about the Cgen mailing list