From: hideaki@mahler.ee.uec.ac.jp (Hideaki Tsuchiya)
Subject: Re: [386bsd] still trying to compile rayshade
Organization: University of Electro-Communications, Chofu, Tokyo, JAPAN
	<HIDEAKI.93Jan22175031@berlioz.ee.uec.ac.jp>
Date: Sat, 23 Jan 1993 10:21:47 GMT

Yesterday, I posted a unofficial patch to rayshade 4.0 patchlevel 6,
but it is incomplete. Here is a new unofficial patch.

In Garrett.Wollman@UVM.EDU's mail he writes:

>This is the way it's supposed to be.  Read the lex manual page, and
>then read /usr/src/usr.bin/lex/flexdoc.1.  Flex doesn't support
>yylineno *AT ALL*, so defining it won't do you any good.
>
>The proper thing to do is to fix RayShade's scanner.  I did that, and
>sent the patch to the authors more than a year ago, but they said they
>didn't have time to deal with it.
>
>In particular, you will need to include the following code:
>
>#ifdef FLEX_SCANNER
>int yylineno = 1;
>#undef yywrap
>#define BUMPIT() yylineno++
>#else
>#define BUMPIT()
>#endif /* FLEX_SCANNER */
>
>Then, in every rule which can possibly match a newline (there aren't
>very many, as I recall), you need to add BUMPIT(); to the end of the
>action.
>
>You probably want to compile with `lex -Cfe -bpv -t scanner.l >
>scanner.c'.
>
>-GAWollman

My failure is that I don't know 386BSD's lex is GNU flex! New patch is
as follows. Extract rayshade source, patch this and make.

IMPORTANT!
	The patch in <HIDEAKI.93Jan22175031@berlioz.ee.uec.ac.jp> is
	incomplete. Don't use it!

  Thanks Mr.Garrett for his report. I hope this patch is perfect.


*** ./raypaint/Makefile.SH.orig	Fri Jan 22 14:42:52 1993
--- ./raypaint/Makefile.SH	Fri Jan 22 15:53:23 1993
***************
*** 55,70 ****
  
  #
  # If using X11, use:
! #GRAPHICSLIB = -lX11
  
  #
  # If you are using GL, use:
! GRAPHICSLIB = -lgl_s
  
  LIBRAY = $(LIBRAYDIR)/libray.a
  LIBSHADE = $(LIBSHADEDIR)/libshade.a
  
! CFLAGS = $(CCFLAGS) $(URTINC) $(INCLUDE) $(OPTIMIZE) -DSHARED_EDGES
  SHELL = /bin/sh
  
  #
--- 55,70 ----
  
  #
  # If using X11, use:
! GRAPHICSLIB = -L/usr/X386/lib -lX11
  
  #
  # If you are using GL, use:
! #GRAPHICSLIB = -lgl_s
  
  LIBRAY = $(LIBRAYDIR)/libray.a
  LIBSHADE = $(LIBSHADEDIR)/libshade.a
  
! CFLAGS = $(CCFLAGS) $(URTINC) $(INCLUDE) $(OPTIMIZE) -DSHARED_EDGES -I/usr/X386/include
  SHELL = /bin/sh
  
  #
***************
*** 73,79 ****
  #
  LIBS = $(LIBSHADE) $(LIBRAY) $(URTLIB)
  
! DRIVE_C =	main.c graphics.c render.c version.c
  
  DRIVE_O = $(DRIVE_C:.c=.o)
  
--- 73,79 ----
  #
  LIBS = $(LIBSHADE) $(LIBRAY) $(URTLIB)
  
! DRIVE_C =	main.c xgraphics.c render.c version.c
  
  DRIVE_O = $(DRIVE_C:.c=.o)
  
*** ./libshade/lex.l.orig	Fri Jan 22 14:46:37 1993
--- ./libshade/lex.l	Sat Jan 23 15:05:28 1993
***************
*** 28,33 ****
--- 28,40 ----
  #include "symtab.h"
  #include "y.tab.h"
  extern char *strsave();
+ #ifdef FLEX_SCANNER
+ int  yylineno=1;
+ #undef yywrap
+ #define BUMPIT() yylineno++
+ #else
+ #define BUMPIT()
+ #endif /* FLEX_SCANNER */
  %}
  alpha	[a-zA-Z]
  special	[\.\_-]
***************
*** 39,45 ****
  %e 1500
  %n 600
  %%
! [ \t\n]			;
  ^#			handlehash();
  "/*"			skipcomments();
  ambient			return tAMBIENT;
--- 46,53 ----
  %e 1500
  %n 600
  %%
! [ \t]			;
! "\n"			BUMPIT();
  ^#			handlehash();
  "/*"			skipcomments();
  ambient			return tAMBIENT;
*** ./etc/rsconvert/lex.l.orig	Fri Jan 22 14:46:37 1993
--- ./etc/rsconvert/lex.l	Sat Jan 23 15:09:45 1993
***************
*** 21,26 ****
--- 21,33 ----
  #endif
  #include "libcommon/common.h"
  #include "y.tab.h"
+ #ifdef FLEX_SCANNER
+ int  yylineno=1;
+ #undef yywrap
+ #define BUMPIT() yylineno++
+ #else
+ #define BUMPIT()
+ #endif /* FLEX_SCANNER */
  %}
  alpha	[a-zA-Z]
  special	[\.\_-]
***************
*** 30,36 ****
  %p 3000
  %%
  [\t]			{WriteVerbatim(yytext);};
! "\n"			{};
  " "			{};
  ^#			{return handlehash();}
  "/*"			{skipcomments();}
--- 37,43 ----
  %p 3000
  %%
  [\t]			{WriteVerbatim(yytext);};
! "\n"			{BUMPIT();};
  " "			{};
  ^#			{return handlehash();}
  "/*"			{skipcomments();}
*** ./Configure.orig	Fri Jan 22 14:46:33 1993
--- ./Configure	Fri Jan 22 16:08:19 1993
***************
*** 172,181 ****
  fi
  
  if ls blurfl >/dev/null 2>&1; then
! 	if awk '' blurfl >/dev/null 2>&1; then
  		check='cat'
  	else
! 		check='awk ""'
  	fi
  else
  	check='ls'
--- 172,181 ----
  fi
  
  if ls blurfl >/dev/null 2>&1; then
! 	if awk '{}' blurfl >/dev/null 2>&1; then
  		check='cat'
  	else
! 		check='awk "{}"'
  	fi
  else
  	check='ls'
***************
*** 1235,1241 ****
  '');;
  *)  set X $cppflags
  	cppflags=''
! 	for flag do
  		case $flag in
  		-D*|-I*) cppflags="$cppflags $flag";;
  		esac
--- 1235,1241 ----
  '');;
  *)  set X $cppflags
  	cppflags=''
! 	for flag; do
  		case $flag in
  		-D*|-I*) cppflags="$cppflags $flag";;
  		esac


--
University of Electro-Communications, Japan.
Hideaki Tsuchiya (hideaki@strauss.ee.uec.ac.jp)
Xref: sparky comp.unix.bsd:11938 comp.sys.ibm.pc.hardware:37455