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,bb308d1c28007ccb X-Google-Attributes: gid103376,public From: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Re: Help!! Writing binary bit by bit Date: 1997/04/16 Message-ID: <1997Apr16.075241.1@eisner>#1/1 X-Deja-AN: 235182790 X-Nntp-Posting-Host: eisner.decus.org References: <5j0vh0$2d1$3@cathedral.cerc.wvu.edu> X-Nntp-Posting-User: KILGALLEN X-Trace: 861191580/3134 Organization: LJK Software Newsgroups: comp.lang.ada Date: 1997-04-16T00:00:00+00:00 List-Id: In article <5j0vh0$2d1$3@cathedral.cerc.wvu.edu>, mcgreal@cs.wvu.edu (Martin McGreal) writes: > I'm trying to write a program that converts normal binary or ascii files into > Huffman code. I was going to use indexed_io's procedure read_by_key to > allocate the amount of bits used, but it turns out you can only allocate > BYTES with that procedure (i'm fairly certain, call me on that if you can). > > Is there any sort of IO that i'm not familiar with that gives the programmer > control over how many bits are written, and exactly what bits those are > (0's or 1's)? That is the only way I see to translate without having an IO > package translate for me. > > If I wanted to write 001101, and that's all, not the binary equvalent for > each digit. If I wanted to write one binary digit at a time, is it possible, > or is there a more appropriate place to find out? In DEC Ada on VMS (my presumption -- your newswriter seems to be having hiccups today) generic package INDEXED_IO is layered on top of the Record Management System (RMS) provided by VMS. RMS has a minimum granularity in record size of 1 byte. You will need some higher level mechanism to indicate how many of those bits are actually meaningful. I would suggest the ASN.1 encoding of BIT STRING. Then again, I am becoming an ASN.1 bigot in addition to a VMS bigot, an Ada bigot (and for that matter, an RMS bigot). Of course if you wanted some particular _ordering_ out of the resultant keys (as distinguished from direct lookup) BIT STRING would be a bad choice. Larry Kilgallen