🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jim Meyering Fri, 23 Feb 1990 03:17
bison-1.03/bison.simple patch for HPUX/gcc
#1751
Author: Jim Meyering
Date: Fri, 23 Feb 1990 03:17
79 lines
3074 bytes
The problem is not in making bison, but rather in using its
parsers: bcopy is used in bison.simple and in the same file,
alloca needed a __GNUC__ hook.

The latest entry in bison's ChangeLog:
    Wed Aug 23 15:03:07 1989  Jay Fenlason  (hack at gnu)

I recently installed bison, then flex on hp9k300 HPUX 6.x using gcc.
The single problem I found was in making flex's parser using bison:
All compiles went fine, but at link time, two symbols were still
undefined: bcopy and alloca.  These I traced back to parse.o;
the references were from 'bison.simple.'

Here is a patch that worked for me -- though it would be nicer to
keep system dependencies out of such ``template'' files... maybe
an automatically generated separate version for people who use
memcpy instead of bcopy?  Otherwise, every time a SYSV user uses
a bison-generated parser, they have to remember to -DUSG or link
in a BSD library.

*** bison.simple.orig	Wed Apr 12 13:12:40 1989
--- bison.simple	Thu Feb 22 19:51:44 1990
***************
*** 19,27 ****
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
  
! #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
  #include <alloca.h>
  #endif
  
  /* This is the parser code that is written into each bison parser
    when the %semantic_parser declaration is not specified in the grammar.
--- 19,33 ----
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  
  
! #ifdef __GNUC__
! #define alloca __builtin_alloca
! #else
! #ifdef sparc
  #include <alloca.h>
+ #else
+ char *alloca ();
  #endif
+ #endif
  
  /* This is the parser code that is written into each bison parser
    when the %semantic_parser declaration is not specified in the grammar.
***************
*** 175,180 ****
--- 181,192 ----
        if (yymaxdepth > YYMAXLIMIT)
  	yymaxdepth = YYMAXLIMIT;
        yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
+ #ifndef bcopy
+ #if defined(SYS_V) || defined(USG)
+ #define bcopy(src, dst, num) memcpy((dst), (src), (num))
+ #define BCOPY_DEFINED
+ #endif
+ #endif
        bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
        yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
        bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
***************
*** 181,186 ****
--- 193,202 ----
  #ifdef YYLSP_NEEDED
        yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
        bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
+ #endif
+ #ifdef BCOPY_DEFINED
+ #undef BCOPY_DEFINED
+ #undef bcopy
  #endif
  #endif /* no yyoverflow */
  
-- 
Jim Meyering      meyering@cs.utexas.edu
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads