From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7876e4356325725b X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: Ada.Streams examples Date: 1999/03/11 Message-ID: <7c8o0u$509$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 453810712 References: <36e61db4.50430543@news.pacbell.net> <7c64kl$r8s$1@nnrp1.dejanews.com> <36e6cd2c.3377267@news.pacbell.net> <7c6s4s$hrt$1@nnrp1.dejanews.com> <36e6fe8d.16020474@news.pacbell.net> X-Http-Proxy: 1.0 x11.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Mar 11 15:38:07 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1999-03-11T00:00:00+00:00 List-Id: In article <36e6fe8d.16020474@news.pacbell.net>, tmoran@bix.com (Tom Moran) wrote: > > o Create a 'Write procedure for that bitmap type which converts the bitmap > >to a bmp and does one massive Write call for the stream. The problem with > >this approach is that if anyone ever wants to do a 'Write on a bitmap for any > >reason, the'll get a BMP. You can't overload it to get a JPG or GIF or a > >straight memory dump (which is what they might be expecting). > Someone could presumably do > type GIFED_Bitmap is new BMP with null record; > for GIFED_Bitmap'Write use Convert_To_GIF_And_Write; > Then internally a GIFED_Bitmap is the same as my BMP, and my routines > all work on it, but when the user writes it he gets his > Convert_To_GIF_And_Write instead of my BMP'Write. > No? Well, yes. But those are still different types, not the same type. I can think of several other objections, but they all really boil down to...YUK! > > o Create a Write_BMP and Read_BMP routine that take in files and bitmaps as > >parameters, and forget about streams. > But with the BMP'Write I separate the file from the conversion, so > the result of the conversion could be handed to a called C routine, > say. That seems to me a pretty strong argument for BMP'Write instead > of BMP_Write. That is true. If there are several different sources you might want to route your output to other than just disk files, that is a point in the favor of using 'Write for the conversion. But note that in the case you give the C routine will have to be able to handle the data in the way 'Write will give it. If you write both 'Write and the stream's Write (which internally interfaces to the C) then you should be ok. You still have the problem of some goober comming along and trying to do an Integer'Write to your BMP stream, but perhaps that's not a big deal in your application. T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own