Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!bofin!cjmchale From: cjmchale@cs.tcd.ie (Ciaran McHale) Newsgroups: comp.windows.x Subject: Re: Lex and X11/Xutil.h conflict Message-ID: <1991Apr2.125922.14345@cs.tcd.ie> Date: 2 Apr 91 12:59:22 GMT References: <9103270244.AA02490@pelli> <102367@tut.cis.ohio-state.edu> Organization: DSG, Dept. of Comp. Sci., Trinity College, Dublin. Lines: 44 In <102367@tut.cis.ohio-state.edu> frank@giza.cis.ohio-state.edu (Frank Adelstein) writes: >In article <9103270244.AA02490@pelli> phils@athena.mit.EDU writes: >>I need to include in my lex file, but I'm having >>trouble with lex wanting to do something like >>#define input() ... while X11/Xutil.h has a record called "input" >>in its XWMHints struct. >> > >The work-around we used (and there must be a better way) was to manually >include the specific things that we needed from X11/Intrinsic.h >(which in our case was Boolean, String and Widget). Here's what >the top of our lex file looks like: > >%{ >typedef char *String; >typedef int Boolean; >typedef void *Widget; >/* >#include >#include >*/ >#include "types.h" /* types and stuff used by our program */ >#include "y.tab.h" >%} > >I don't know what the "correct" way to do it would be (I think this >would qualify as 'quick and dirty'). And the less that is defined, >the less likely it'll break if the includes change. Hope this helps. Another approach would be to to run lex and munge the output file with sed to change all occurances of output() to, say, lex_output(). This should remove the name conflicts. Such munging can be automated nicely if you're using make to manage recompilations. And you _are_ using make, aren't you :-) Ciaran. -- Ciaran McHale "There's a lot to be said for verbosity." ---- Department of Computer Science, Trinity College, Dublin 2, Ireland. \ / Telephone: +353-1-772941 ext 1538 FAX: +353-1-772204 \/ Telex: 93782 TCD EI email: cjmchale@cs.tcd.ie