> On Jun 21, 2016, at 5:21 AM, Chaos Eternal <[email protected]> wrote:
> 349: 3 [read-token]
> 294: 2 [exec-cpp "if (ODBCVER >= 0x0300)"]
> In ice-9/boot-9.scm:
> 157: 1 [catch error ...]
> In
> /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.scm:
> 69: 0 [eval-expr (ge (ident "ODBCVER") (fixed "0x0300"))]
>
> /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.scm:69:22:
> In procedure eval-expr:
> /home/chaos/src/nyacc/examples/nyacc/../../module/nyacc/lang/c99/cppbody.scm:69:22:
> In procedure >=: Wrong type argument in position 1: #f
> chaos@florrum:~/src/nyacc/examples/nyacc
>
I think that is fixed my in-progress version.
mwette$ cat zz.h
#define ODBCVER 123
#if (ODBCVER >= 0x0300)
int bar() { return 1; }
#else
int bar() { return 2; }
#endif
int foo() { bar(); }
mwette$ ./cxp zz.h
zz.h:
(trans-unit
(cpp-stmt (define (name "ODBCVER") (repl "123")))
(cpp-stmt (if "(ODBCVER >= 0x0300)"))
(fctn-defn
(decl-spec-list (type-spec (fixed-type "int")))
(ftn-declr (ident "bar") (param-list))
(compd-stmt
(block-item-list (return (p-expr (fixed "1"))))))
(cpp-stmt (else ""))
(fctn-defn
(decl-spec-list (type-spec (fixed-type "int")))
(ftn-declr (ident "bar") (param-list))
(compd-stmt
(block-item-list (return (p-expr (fixed "2"))))))
(cpp-stmt (endif ""))
(fctn-defn
(decl-spec-list (type-spec (fixed-type "int")))
(ftn-declr (ident "foo") (param-list))
(compd-stmt
(block-item-list
(expr-stmt
(fctn-call (p-expr (ident "bar")) (expr-list)))))))