%use-macros

Martin Stein <[email protected]> Thu, 19 Feb 2015 22:24:22 +0100
Newsgroups gmane.emacs.cedet
Message-ID <[email protected]>
Hi,

In order to simplify integration of the preprocessor (wisent works 
differently than bovine, so I could not simply copy from the only 
example given in C/C++) I wanted to define my own grammar macros with 
%use-macros, which almost works, except for a few problems I could not 
resolve. I have created a semantic/wisent/f90-grammar-macros.el file, 
which contains

(defun semantic-f90-expand0-auxiliary (...)
   "Auxiliary function."
...)

(defun semantic-f90-grammar-macros-EXPAND0 (...)
   "Fortran 90 EXPAND macro with depth=0 and spp support."
...)

(provide 'semantic/wisent/f90-grammar-macros)

According to documentation which confirms with the code I would need to 
put the following into my f90.wy grammar file:

%use-macros semantic-f90-grammar-macros {EXPAND0}

However, the function inserting the macro into actions contains (see 
semantic/grammar.el, line 434ff in function semantic-grammar-use-macros)

(require lib)

where lib = semantic-f90-grammar-macros, which of course is nonsense. 
Naming the file semantic-f90-grammar-macros.el does neither fit the 
usual naming scheme nor does it help anyway. Using 
f90-grammar-macros-EXPAND0 does not help as well, since require still 
needs the path. Is there any other solution I have missed? As use-macros 
is not used anywhere, there is no example I could copy from.

There is another quandary, which leads to a simple albeit strange 
workaround: Replacing (require lib) by (require 
'semantic/wisent/f90-grammar-macros) works fine, until the compiler 
looks in vain for semantic-f90-expand0-auxiliary which is called from 
within semantic-f90-grammar-macros-EXPAND0. Adding a
%{
    (require 'semantic/wisent/f90-grammar-macros)
    ...
}
into my f90.wy file solves this problem. Even more, I can now delete the 
(require 'semantic/wisent/f90-grammar-macros) inside of 
semantic-grammar-use-macros and it still compiles. Almost. In fact, 
f90-grammar-macros is compiled after f90.wy, so whenever I edit 
f90-grammar-macros, I need to touch f90.wy and compile twice, or 
something like this. So I also need to add a dependency, but I could not 
figure out how to do this in Project.ede?
Or am I doing something fundamtally wrong??

Martin

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk