[comp.sources.bugs] Problem with Flex and QNX

andrew@qcc-hal.UUCP (Andrew R. Kostiuk) (08/25/89)

Hi:

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.

Are there any Flex Gurus out there you have any suggestions?  Many thanks
it advance.

+---------------------------------------------------------------------+
| +--------------+    Andrew R. Kostiuk      #4 - 2345 Avenue C North |
| |   Q  C  C    |    M.Sc., P.Eng.          Saskatoon, SK.           |
| |COMMUNICATIONS|    Systems Engineer       CANADA     S7L 5Z5       |
| | CORPORATION  |    Tel.: (306)665-6488    Fax.: (306)665-9936      |
| +--------------+    uucp: alberta!dvinci!qcc-hal!andrew             |
+---------------------------------------------------------------------+

vern@hati.cs.cornell.edu (Vern Paxson) (08/29/89)

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