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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,335f67c75a2a5d5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-12-28 21:29:30 PST Path: supernews.google.com!sn-xit-02!supernews.com!newsfeed.online.be!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshub2.home.com!news.home.com!news1.rdc2.on.home.com.POSTED!not-for-mail Message-ID: <3A4C2098.5137C8D0@home.com> From: "Warren W. Gay VE3WWG" X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Ada0x Enhancement? Was: Tags.Internal_Tag(String'Input(Stream)) ?? References: <3A4B557F.F167C8E@home.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 29 Dec 2000 05:29:28 GMT NNTP-Posting-Host: 24.141.193.52 X-Complaints-To: abuse@home.net X-Trace: news1.rdc2.on.home.com 978067768 24.141.193.52 (Thu, 28 Dec 2000 21:29:28 PST) NNTP-Posting-Date: Thu, 28 Dec 2000 21:29:28 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:3444 Date: 2000-12-29T05:29:28+00:00 List-Id: tmoran@acm.org wrote: > > >This suggests that I have to define my own S'Class'Input() > >instead. This would allow me to read the tag in, in any way I > >please, but then how do I proceed from there? How does the > >Ada S'Class'Input() dispatch once the external tag is known? > It calls A'Input() if the data indicated type A, or B'Input() if > the data indicated type B, etc. Yes... that is how I have been coding it. I was however, hoping for a more automated way (without having to test for each possibility). After all, Ada knows about all the classes and dispatches as necessary with it's builtin tables etc. > So if you can use > for A'External_Tag use "RIFF"; > statements to cover all your tags, you needn't override S'Class'Input. This was the idea, but it won't work for the reasons outlined earlier (tag input). If you try it, you'll soon discover that Ada insists on calling upon String'Input() to read in the tag (which is the problem here). String'Input() insists on reading dope info that describes how long the tag string is (the array bounds actually). My external tags only have 4 bytes period, with no dope information provided in the file. Hence Ada ends up trying to read dope information, and getting tag information instead (with bad array bounds I might add ;-) > If your external way of specifying a type is too complex for that, > you will have to override S'Class'Input, and your code will have to > know about all the possible external tags and it will have to call > A'Input() or B'Input() or C'Input() as needed. Yes, I have resigned to doing this, and have started coding it this way this evening. As it turns out, some of the wave chunks ("fmt " for example) have special needs depending upon the format of the sample data etc. The physical location of discrimants in the file, and varying array sizes only make this problem worse. Additionally, Microsoft's stupid Wave format often provides odd length chunks, but they are padded to 16-bit boundaries (for the start of the next chunk). At other times, different wave software creates the file with odd length (to save a byte), and yet still other software creates a even length file with the pad byte. Additionally you have other nasties like zero terminated strings in the chunk etc. (gag) In short, all kinds of nasties in this format, seem to suggest that I'll better off to control things with my very own Chunk_Hdr'Class'Input() procedure. > Quite independently, if the external data organization doesn't > happen to match what your compiler expects, say because bounds are > stored differently, you'll have to override A'Input et al. Yes, this works for types that _you_ derive, but you cannot override the way String'Input() works for example. Hence you're back to the initial problem of how do you modify tag reading behavior? (while avoiding writing your own X'Class'Input procedure). > As has been pointed out, "For elementary types, the representation > in terms of stream elements is implementation defined." You may > be unpleasantly surprised. This has largely been deal with my lower level package Endian_Streams, from which the Wave_Streams package is derived. One of the goals of this project is to create a Wave Player/Recorder that works for Big Endian machines under Linux/FreeBSD as well as the Intel platform. > The order of calls for a composite type > is specified though, so if you write overrides for all the elementary > types, and any composite types that differ in data layout order, > you should be in good shape. Well folks, thanks for your efforts. It looks like the Wave file format is sufficiently messy that I am going to go with the Chunk_Hdr'Class'Input override route. However, it would be educational if someone did resolve this issue, for my future reference. It seems to me that (flame suit on) that Ada0x might consider a means to subsitute for the Tag input/output procedure. Perhaps something like: for Chunk_Hdr'Class'Tag_Input use My_Chunk_Hdr_Class_Tag_Input; This would then give the programmer a way to change the Tag_Input and Tag_Output, without having to resort to roll your own X'Class'Input procedure. Currently String'Input is always used to initiate the read of a tag. This leaves the programmer out of the loop :< -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg