Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!oliveb!sun!thetone!swilson From: swilson%thetone@Sun.COM (Scott Wilson) Newsgroups: comp.sys.mac.programmer Subject: Re: Question about Bison Message-ID: <72176@sun.uucp> Date: 8 Oct 88 19:51:21 GMT References: <8246@cit-vax.Caltech.Edu> Sender: news@sun.uucp Reply-To: swilson@sun.UUCP (Scott Wilson) Organization: Sun Microsystems, Mountain View Lines: 37 >I just installed Bison on a Mac II and I'm having a problem when linking. >Using bison.simple, I get a link error (missing functions alloca and bcopy). >When I use bison.hairy (using the %semantic_parser command), I get other link >errors (several missing functions). I assume I should simply replace >alloca with NewPtr and bcopy with MemCopy. Is this correct? Also, under >what conditions would I want to use bison.hairy as apposed to bison.simple? NewPtr will not give you the equivalent of alloca. What you should do is look at the functionality of alloca and bcopy and either add your own routines or replace them with an equivalent. For your reference their definitions are (from SunOS 4.0): char *alloca(size) int size; alloca() allocates size bytes of space in the stack frame of the caller, and returns a pointer to the allocated block. This temporary space is automatically freed when the caller returns. and: bcopy(b1, b2, length) char *b1, *b2; int length; bcopy() copies length bytes from string b1 to the string b2. Overlapping strings are handled correctly. Notice that the argument order of bcopy is reversed of the SysV similar routine called memcpy. As for alloca, you can write your own in assembler or you can try the "portable" alloca in C form that comes with GNU emacs. -- Scott Wilson arpa: swilson@sun.com Sun Microsystems uucp: ...!sun!swilson Mt. View, CA