By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,353 Members | 1,555 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,353 IT Pros & Developers. It's quick & easy.

black word/white word encodings

P: n/a
C with 2 sprained hands.

I would nlike to emulate the t4 encoding scheme using the following

graphic:

* * *
* * *

***** o O o o
hello isn't working; let's ace the 'ello'.

*****
*****
*****
*****
*****
*****
*****
*****
************
************
************
***** ***
***** ***
***** ***
***** ***
***** ***
***** ***

Given that I can suck this in using a twenty by twenty char array, what

would be a sufficient black word/white word encoding scheme.
--
George

The action we take and the decisions we make in this decade will have
consequences far into this century. If America shows weakness and
uncertainty, the world will drift toward tragedy. That will not happen on
my watch.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/
Nov 10 '08 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On Sun, 9 Nov 2008 18:50:44 -0700, George <ge****@example.invalid>
wrote in comp.lang.c:
C with 2 sprained hands.

I would nlike to emulate the t4 encoding scheme using the following

graphic:

* * *
* * *

***** o O o o
hello isn't working; let's ace the 'ello'.

*****
*****
*****
*****
*****
*****
*****
*****
************
************
************
***** ***
***** ***
***** ***
***** ***
***** ***
***** ***

Given that I can suck this in using a twenty by twenty char array, what

would be a sufficient black word/white word encoding scheme.
I don't understand your question. Still, there's some code on my
website that you might find useful, from my chapter of the book "C
Unleashed". There's a source file there that contains a black and
white character set using 16 unsigned shorts for each character.

See http://jk-technology.com/C_Unleashed/code_list.html

There are also links there to source and header files for making
binary files from text files, using the character set. And for T4
encoding and decoding.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Nov 10 '08 #2

P: n/a
On Sun, 09 Nov 2008 20:55:41 -0600, Jack Klein wrote:
>Given that I can suck this in using a twenty by twenty char array, what

would be a sufficient black word/white word encoding scheme.

I don't understand your question. Still, there's some code on my
website that you might find useful, from my chapter of the book "C
Unleashed". There's a source file there that contains a black and
white character set using 16 unsigned shorts for each character.
Is the width of an unsigned short fixed.
>
See http://jk-technology.com/C_Unleashed/code_list.html
I think I have the identical materials on the disc that comes with the
book. Of course the disc doesn't have the errata, but I don't think there
were any significant ones with this material.
>
There are also links there to source and header files for making
binary files from text files, using the character set. And for T4
encoding and decoding.
This is as far as I get tonight:

Using the encoding formats on pp. 766-770, let's see what happens to our h,
which is a 20 x 20 that contains:


*****
*****
*****
*****
*****
*****
*****
*****
************
************
************
***** ***
***** ***
***** ***
***** ***
***** ***
***** ***
The first line consists of spaces and maybe a cr and a line feed. Any such
characters are simply not asterisks, ie, they are white. The first line is
empty and therefore contains 20 whites. Following the development, they
would contain 0xFF. We can represent this as 20W.

When we hit the top of the h, we have 3W, 5B, 12W.
Halfway down we have 3W, 12B, 5W.
Then 3W, 5B,4W,3B,5W

Ultimately, we have rows of 20W.

In the development, the blamk lines are translated as
1,728WM, 0WT, EOL

I think the analog is:
20 WT, EOL

and:

0001000 000000000001

I don't see how these words would differ except where that 1 bit is.
Aren't they both padded out with zeroes?
--
George

It's going to be the year of the sharp elbow and the quick tongue.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/
Nov 11 '08 #3

P: n/a
George wrote:
....
Is the width of an unsigned short fixed.
For any given implementation, the width is a fixed value, of at least 16
bits. It can be different on different implementations.
Nov 11 '08 #4

P: n/a
On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
George wrote:
...
>Is the width of an unsigned short fixed.

For any given implementation, the width is a fixed value, of at least 16
bits. It can be different on different implementations.
And the words for 1000 and 1 would be the same size and have the same
number of zeroes and ones?

Is the length of all these code words the same? If yes, does that mean
they get padded out with zeroes to the left?

Example:

Run length white code word black code word

2 0111 011

Are these not identical except for the third bit, counting from the right.

If there are 16 bits to a word, does not tte former have 13 zeroes while
the latter has 14. If yes, this contradicts claims about EOL on page 771.

--
George

Every nation in every region now has a decision to make. Either you are
with us, or you are with the terrorists.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/
Nov 11 '08 #5

P: n/a
George wrote:
On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
>George wrote:
[A lot of stuff I didn't understand, but one question that seemed quite
clear:]
>>Is the width of an unsigned short fixed.
For any given implementation, the width is a fixed value, of at least 16
bits. It can be different on different implementations.
Your question was about 'unsigned short', and so was my answer. Your
further questions either reflect a severe lack of elementary knowledge
about binary representations, or a failure to clearly communicate the
fact that you're actually referring to something other than unsigned
short. I'm favoring the second explanation, and if I'm right I won't be
able to answer your question until you make it clearer.

However, on the off chance that your questions are actually about the
binary representation used in unsigned short, I will answer them in that
context.
And the words for 1000 and 1 would be the same size and have the same
number of zeroes and ones?
unsigned short objects representing 1000 and 1 will take up the same
exact amount of memory.

A unsigned short object representing 1 will have one value bit set to 1,
and the rest of the value bits set to 0; padding bits, if any, might be
set to either 0 or 1.

A unsigned short object representing 1000 will have six value bits set
to 1, and the rest of the value bits set to 0; padding bits, if any,
might be set to either 0 or 1.
Is the length of all these code words the same? If yes, does that mean
they get padded out with zeroes to the left?
All unsigned short objects have the same size. All of the value bits
that don't need to be set to determine the value of the object must be
cleared (0). There could be padding bits, that are not value bits,
though this is rather uncommon; if they are present, they can be either
0 or 1.
Nov 12 '08 #6

P: n/a
On 11 Nov, 23:45, George <geo...@example.invalidwrote:
On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
George wrote:
Is the width of an unsigned short fixed.
For any given implementation, the width is a fixed value, of at least 16
bits. It can be different on different implementations.

And the words for 1000 and 1 would be the same size and have the same
number of zeroes and ones?

Is the length of all these code words the same? *If yes, does that mean
they get padded out with zeroes to the left?

Example:

Run length *white code word black code word

* *2 * * * * *0111 * * * * * * * 011

Are these not identical except for the third bit, counting from the right..

If there are 16 bits to a word, does not tte former have 13 zeroes while
the latter has 14. *If yes, this contradicts claims about EOL on page 771.
your questions need to become much clearer. For instance

"And the words for 1000 and 1 would be the same size and have the same
number of zeroes and ones?"

what is a "word". What base is 1000 and 1 in? What representation
are you using? Are they strings? Do you mean "the same number of
bits"?
--
Nick Keighley

Nov 12 '08 #7

P: n/a
On Wed, 12 Nov 2008 02:19:34 GMT, James Kuyper wrote:
George wrote:
>On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
>>George wrote:
[A lot of stuff I didn't understand, but one question that seemed quite
clear:]
>>>Is the width of an unsigned short fixed.
For any given implementation, the width is a fixed value, of at least 16
bits. It can be different on different implementations.

Your question was about 'unsigned short', and so was my answer. Your
further questions either reflect a severe lack of elementary knowledge
about binary representations, or a failure to clearly communicate the
fact that you're actually referring to something other than unsigned
short. I'm favoring the second explanation, and if I'm right I won't be
able to answer your question until you make it clearer.
I've seen this material discussed in mathematics, where we never really get
down to the zeroes and ones.
>
However, on the off chance that your questions are actually about the
binary representation used in unsigned short, I will answer them in that
context.
>And the words for 1000 and 1 would be the same size and have the same
number of zeroes and ones?

unsigned short objects representing 1000 and 1 will take up the same
exact amount of memory.

A unsigned short object representing 1 will have one value bit set to 1,
and the rest of the value bits set to 0; padding bits, if any, might be
set to either 0 or 1.

A unsigned short object representing 1000 will have six value bits set
to 1, and the rest of the value bits set to 0; padding bits, if any,
might be set to either 0 or 1.
The text here is critical, from pp 767-771 of unleashed.

The code words are variable length and strung together one after another
without regard for higher-level boundaries.

Ultimately lines are padded out on the eol word to make--they pad them out
to the left with zeroes--octets, which are unsigned shorts.

>
>Is the length of all these code words the same? If yes, does that mean
they get padded out with zeroes to the left?

All unsigned short objects have the same size. All of the value bits
that don't need to be set to determine the value of the object must be
cleared (0). There could be padding bits, that are not value bits,
though this is rather uncommon; if they are present, they can be either
0 or 1.
Padding with ones?
--
George

When I take action, I'm not going to fire a $2 million missile at a $10
empty tent and hit a camel in the butt. It's going to be decisive.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/
Nov 13 '08 #8

P: n/a
On Wed, 12 Nov 2008 00:20:54 -0800 (PST), Nick Keighley wrote:
On 11 Nov, 23:45, George <geo...@example.invalidwrote:
>On Tue, 11 Nov 2008 11:12:12 GMT, James Kuyper wrote:
>>George wrote:
>Is the length of all these code words the same? *If yes, does that mean
they get padded out with zeroes to the left?

Example:

Run length *white code word black code word

* *2 * * * * *0111 * * * * * * * 011

Are these not identical except for the third bit, counting from the right.

If there are 16 bits to a word, does not tte former have 13 zeroes while
the latter has 14. *If yes, this contradicts claims about EOL on page 771.

your questions need to become much clearer. For instance

"And the words for 1000 and 1 would be the same size and have the same
number of zeroes and ones?"

what is a "word". What base is 1000 and 1 in? What representation
are you using? Are they strings? Do you mean "the same number of
bits"?
Clarity isn't my strong suit now. This is new material for me.

By words I mean "code words" of the T.4 protocol. There are 64 terminating
white code words, a like number of black terminating code words, for a
total of 128 terminating code words. Since 1728/64 = 27, there are 27 white
make-up code words and a like number of black, for a total of 54 make-up
code words.

The final code word is the eol word, which has eleven leading zroes, unlike
any other code word. The eol you can pad out, but no other.

For our code to reproduce "h," we have:

%- characters are simply not asterisks, ie, they are white. The first line
is
%- empty and therefore contains 20 whites. Following the development, they
%- would contain 0xFF. We can represent this as 20W.
%-
%- When we hit the top of the h, we have 3W, 5B, 12W.
%- Halfway down we have 3W, 12B, 5W.
%- Then 3W, 5B,4W,3B,5W
%-
%- Ultimately, we have rows of 20W.
%-
%- In the development, the blamk lines are translated as
%- 1,728WM, 0WT, EOL
%-
%- I think the analog is:
%- 20 WT, EOL

This is 0001000 000000000001

3W, 5B, 12 W , eol is
1000 0011 001000 000000000001

3W, 5B,4W,3B,5W, eol is

1000 0011 1011 011 1100 000000000001

20 WT eol is again:
0001000 000000000001

What would be a good tool to use to string these together without a
prohibibitively long line or cr's or lf's?

--
George

To those of you who received honours, awards and distinctions, I say well
done. And to the C students, I say you, too, can be president of the United
States.
George W. Bush

Picture of the Day http://apod.nasa.gov/apod/
Nov 13 '08 #9

P: n/a
George wrote:
>
.... snip ...
>
--
To those of you who received honours, awards and distinctions,
I say well done. And to the C students, I say you, too, can be
president of the United States. -- George W. Bush
Well, this gives me a chance to trot out my latest sig:

Sometimes, when I look at my children, I say to myself:
"Lillian, you should have remained a virgin." -- Lillian Carter
I had a rose named after me, and I was very flattered. But I was
not pleased to read the description in the catalog:
"No good in bed, but fine against a wall.' -- Eleanor Roosevelt
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Nov 13 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.