*BSD News Article 14902


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!sdd.hp.com!swrinde!cs.utexas.edu!uunet!mcsun!Germany.EU.net!gmd.de!mururoa!veit
From: veit@mururoa.gmd.de (Holger Veit)
Subject: Re: porting question (_cnt, _flsbuf, _ptr)
Message-ID: <1993Apr22.074652.2290@gmd.de>
Sender: veit@mururoa (Holger Veit)
Nntp-Posting-Host: mururoa
Organization: GMD, Sankt Augustin, Germany
References:  <2BD59287.11259@ics.uci.edu>
Date: Thu, 22 Apr 1993 07:46:52 GMT
Lines: 50

In article <2BD59287.11259@ics.uci.edu>, rmyers@ics.uci.edu (Richard E. Myers) writes:
|> I'm trying to port Analog 5.1 (Caltech analog circuit simulator) to
|> 386bsd and gcc doesn't understand the following line:
|> 
|> #define putc(x, p)      (--(p)->_cnt < 0 ? \
|>                         _flsbuf((unsigned char) (x), (p)) : \
|>                         (int) (*(p)->_ptr++ = (unsigned char) (x)))
|>     putc(c, outfile);
|> 
|> 
|> It seems the _cnt, and _ptr structure members are unrecognized and
|> likewise the function _flsbuf() can not be found.
|> 
|> Looking in /usr/include/stdio.h I came up with the idea that maybe I
|> should change _cnt --> _w and _ptr --> _p.  But I'm not a C guru and
|> mostly just guessing.  I have no clue what the equivalent to _flsbuf()
|> is.
|> 
|> If anyone has suggestions I would greatly appreciate it.  Other than
|> the above and needing to install srand48, the port has progressed with
|> out a major hitch.

stdio has been rewritten in BSD to avoid copyright problems with at&t.
Unfortunately this causes several problems with software that 
accesses the low level of stdio which should be transparent for the user.
xview is another package that accesses this low level. In your
example, it looks as if your software redefines the putc macro from
stdio. Usually there are no reasons to do this. It is included with
the file <stdio.h> automatically. Unless your software makes use of
the private fields of _iob later which I don't believe, I would
exclude this macro from the file by #ifdef's and include <stdio.h> instead.

Holger
 
|>   -- Richard
|> 
|> -------------------------------------------------------------------------------
|> Richard Myers						| (714) 856-7473
|> The Center for the Neurobiology of Learning and Memory  | 
|> University of California, Irvine                        | rmyers@ics.uci.edu 
|> Irvine, CA 92717-3800 USA                               | 
|> -------------------------------------------------------------------------------

-- 
         Dr. Holger Veit                   | INTERNET: Holger.Veit@gmd.de
|  |   / GMD-SET German National Research  | Phone: (+49) 2241 14 2448
|__|  /  Center for Computer Science       | Fax:   (+49) 2241 14 2342
|  | /   P.O. Box 13 16                    |    Three lines Signature space
|  |/    Schloss Birlinghoven              |    available for rent. Nearly
         DW-5205 St. Augustin, Germany     |    unused, good conditions