Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!vern From: vern@hati.cs.cornell.edu (Vern Paxson) Newsgroups: comp.sources.bugs Subject: Re: Problem with Flex and QNX Message-ID: <31511@cornell.UUCP> Date: 29 Aug 89 15:23:56 GMT References: <598@qcc-hal.UUCP> Sender: nobody@cornell.UUCP Reply-To: vern@cs.cornell.edu (Vern Paxson) Distribution: na Organization: Cornell Univ. CS Dept, Ithaca NY Lines: 26 In article <598@qcc-hal.UUCP> andrew@qcc-hal.UUCP (Andrew Kostiuk) writes: >I am trying to port Flex to the QNX Operating System ("UNIX-like" O/S >for PCs) and am having some problem. > >QNX (in its infinite wisdom) has decided to use the 0x1E character as a >new-line as opposed to the standard 0x0A. This I believe caused Flex to >decide that there is an illegal character in the input and the scanner >"jammed". > >After poking around in Flex, I think the "problem" in in the "Equivalent >Class" array used to map input characters to equvalent classes. >Unfortunately this array is generated by flex itself (as opposed to being >hardcoded) and it is not obvious how to "fix" this for the QNX environment. Try this. Copy initscan.c somewhere safe. Then edit initscan.c and change the 10th (start counting at 0) entry of the yy_ec[] array from 3 to 1; change the 30th entry (i.e., 0x1e) from 1 to 3. Edit the routine myesc() in misc.c so that \n translates into 0x1e (maybe the QNX C compiler will already do this for you). Do a "make first_flex" and now flex should treat 0x1e as new-line and 0x0a as j-random control character. Vern Vern Paxson vern@cs.cornell.edu Computer Science Dept. decvax!cornell!cs!vern Cornell University