How to detect chr(0)

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

How to detect chr(0)

Fantome
This post has NOT been accepted by the mailing list yet.
I'm trying to detect a null character using chr(0) but it seems to be ignoring any null characters.

For example:
The_text = chr(0,1,2,3,4,255);  // this gives a string, that I can't really print out but in HEX: 0x0001020304FF
...
...
if (The_text[0] == chr(0))
{
     ... Do something....
}

This does nothing as if it ignores the null character. The comparison doesn't work for chr(0) but does work for all other values.

I'm using this in a type of encoder wheel generator but as I said, I can't seem to get OpenSCAD to detect chr(0). Is there another way to detect a null character ?

Thanks...
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

MichaelAtOz
Administrator
Hi, welcome to the forum.
Your post is still flagged "This post has NOT been accepted by the mailing list yet." which means that most people don't see it unless they look here. You need to complete the mailing list subscription

Re chr(0). Many systems use null terminated strings so chr(0) is treated as the end of the string. I suspect this is the case here, but haven't looked into the C RTL to confirm this.
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

MichaelAtOz
Administrator
Well ignore what I said...

t = chr(0,41,42,43,44,255);
echo(t);
text(t);
for(i=[0:len(t)-1]) {
        echo(t[i]);
        translate([0,i*15,0]) text(t[i]);
}

Shows it if getting past the chr(0)
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

MichaelAtOz
Administrator
t = chr(0,41,42,43,44,255);
echo(t);
text(t);
for(i=[0:len(t)-1]) {
        echo(t[i]);
        translate([0,i*15,0])
                text(t[i]);
if(t[i]==chr(0))
        echo("match 0");
if(t[i]==chr(255))
        echo("match 255");
}

Hmmm...

Either a bug, or chr(0) plays a part in unicode or means something else...
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
tp3
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

tp3
In reply to this post by MichaelAtOz
The chr() function is supposed to return valid unicode characters in utf-8
encoding, so for example "echo(chr(128512));" is valid and should give the
smiley character U+1F600.

Invalid input values will return an empty string, chr(0) is always treated
as invalid.

Note: This means that asking for chr(255) will internally result in the
bytes 0xc3 0xbf and not 0xff. As len() is also utf-8 aware, len(chr(255))
still returns 1 as it's one character.

ciao,
   Torsten.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

Fantome
tp3 wrote
The chr() function is supposed to return valid unicode characters in utf-8
encoding, so for example "echo(chr(128512));" is valid and should give the
smiley character U+1F600.

Invalid input values will return an empty string, chr(0) is always treated
as invalid.

Note: This means that asking for chr(255) will internally result in the
bytes 0xc3 0xbf and not 0xff. As len() is also utf-8 aware, len(chr(255))
still returns 1 as it's one character.

ciao,
   Torsten.

_______________________________________________
Hello and thanks for the input. I'm not sure what you mean by 'internally result' but here's an example that shows that chr(255) does return a hex value of 0xFF.

       the_text = chr(255);

       echo("number of characters = ",len(the_text));
       for (i=[0:len(the_text)-1])
       {
           for (ascii_v = [0:255])
           {
               if (the_text[i] == chr(ascii_v)) :
               {
                       if ((ascii_v) == 255):
                       {
                               xFF(count);
                        }
                        echo("character: ",the_text[i]);
                        echo("ASCII value:", ascii_v);  // print the ascii value being checked
                }
           }
       }

ECHO: "number of characters = ", 1
ECHO: "character: ", "y"
ECHO: "ASCII value:", 255

Note that the character that prints like a y with two dots above it has the hex value of 0xFF, not 0xC3 .0xBF.
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

Fantome
Sorry about those colons in the if statements. My cut&paste seemed to have messed things up a bit.
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

MichaelAtOz
Administrator
In reply to this post by Fantome
Your logic is a bit off there.

Basically your test is 'if(chr(255)==chr(255))'

Unfortunately, OpenSCAD doesn't (yet?) have a asc() function (or whatever the unicode version would be called).
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

doug.moen
In reply to this post by Fantome
HI Fantome. In OpenSCAD, a string is an array of Unicode "code points", it isn't an array of bytes. Each code point in a string has a value between 1 and 0x10FFFF, except that some code point values are invalid. len(string) is the number of code points in the string, and str[i] is the i'th code point.

Torsten told you that internally, strings are represented in UTF-8 format. But there are no operations in OpenSCAD that allow you to access that internal representation. Numbers are represented internally as floating point, but you can't access the underlying bit and byte patterns in a float, either.

Your test program contains the word ASCII several times, but that's misleading, you don't have access to the underlying byte representation.

On 16 April 2015 at 23:20, Fantome <[hidden email]> wrote:
tp3 wrote
> The chr() function is supposed to return valid unicode characters in utf-8
> encoding, so for example "echo(chr(128512));" is valid and should give the
> smiley character U+1F600.
>
> Invalid input values will return an empty string, chr(0) is always treated
> as invalid.
>
> Note: This means that asking for chr(255) will internally result in the
> bytes 0xc3 0xbf and not 0xff. As len() is also utf-8 aware, len(chr(255))
> still returns 1 as it's one character.
>
> ciao,
>    Torsten.
>
> _______________________________________________

Hello and thanks for the input. I'm not sure what you mean by 'internally
result' but here's an example that shows that chr(255) does return a hex
value of 0xFF.

       the_text = chr(255);

       echo("number of characters = ",len(the_text));
       for (i=[0:len(the_text)-1])
       {
           for (ascii_v = [0:255])
           {
               if (the_text[i] == chr(ascii_v)) :
               {
                       if ((ascii_v) == 255):
                       {
                               xFF(count);
                        }
                        echo("character: ",the_text[i]);
                        echo("ASCII value:", ascii_v);  // print the ascii
value being checked
                }
           }
       }

ECHO: "number of characters = ", 1
ECHO: "character: ", "y"
ECHO: "ASCII value:", 255

Note that the character that prints like a y with two dots above it has the
hex value of 0xFF, not 0xC3 .0xBF.




--
View this message in context: http://forum.openscad.org/How-to-detect-chr-0-tp12351p12396.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

Fantome
In reply to this post by MichaelAtOz
MichaelAtOz wrote
Your logic is a bit off there.

Basically your test is 'if(chr(255)==chr(255))'

Unfortunately, OpenSCAD doesn't (yet?) have a asc() function (or whatever the unicode version would be called).
Yes, thanks. This is really just an example that represents my code. The actual code is many lines now. Basically it compares each character of the_text to the values from 0 to 255. This is, as I'm sure everybody here knows, the same as 0x00 to 0xFF. For example sake, I only included the condition that finds the 0xFF. Once I clean up my code I'll post it here or somewhere so people can enjoy it - tearing it apart or marveling at it. Either way it will be working at that point. (chr(0) is only part not working yet.)

... I should have pointed out that this code was only an example to show the comparison and what it printed out.
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

Fantome
In reply to this post by doug.moen
doug.moen wrote
HI Fantome. In OpenSCAD, a string is an array of Unicode "code points", it
isn't an array of bytes. Each code point in a string has a value between 1
and 0x10FFFF, except that some code point values are invalid. len(string)
is the number of code points in the string, and str[i] is the i'th code
point.

Torsten told you that internally, strings are represented in UTF-8 format.
But there are no operations in OpenSCAD that allow you to access that
internal representation. Numbers are represented internally as floating
point, but you can't access the underlying bit and byte patterns in a
float, either.

Your test program contains the word ASCII several times, but that's
misleading, you don't have access to the underlying byte representation.
Hello.
It's interesting to hear about the inner working of this. If OpenSCAD had the ability to let users manipulate the bits the possibilities for modelling objects and systems would be increased. Just my opinion of course.

When OpenScad echos/prints the chr(value), what it prints matches with the ASCII chart. This is why I named the variable ASCII_value. I don't think it's misleading. It is the ASCII value. It works for all 255 values, value 0 is the only one that is ignored by OpenSCAD.

For my specific application I guess I'll just figure out a work around since it seems obvious now that OpenSCAD is treating chr(0) as a 'something' that is not used in any comparison. The inner workings of OpenSCAD must have checks for a NULL character or chr(0) that equates to 'jump to the next character'. Oh well. One disappointment out of 256 values, still 99.61% satisfaction.
 
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

doug.moen
The reason you see ASCII values is that ASCII is a proper subset of unicode. The letter 'A' has value 65 in ASCII and also value 65 as a Unicode code point. But OpenSCAD is still a Unicode system, not an ASCII system, because the entire Unicode range is supported. So there's no need to stop at chr(255), when you also have chr(256), chr(257), and so on.

If you want to represent an array of values between 0 and 255 using a string, you can still do that, you'll just have represent 0 in a different way: pick a different code point. Or you could add an offset, and use the range chr(1) to chr(256) to represent the values 0 to 255. Of course, I'm not really sure what you're trying to do, but I hope this has helped.

On 17 April 2015 at 12:29, Fantome <[hidden email]> wrote:
doug.moen wrote
> HI Fantome. In OpenSCAD, a string is an array of Unicode "code points", it
> isn't an array of bytes. Each code point in a string has a value between 1
> and 0x10FFFF, except that some code point values are invalid. len(string)
> is the number of code points in the string, and str[i] is the i'th code
> point.
>
> Torsten told you that internally, strings are represented in UTF-8 format.
> But there are no operations in OpenSCAD that allow you to access that
> internal representation. Numbers are represented internally as floating
> point, but you can't access the underlying bit and byte patterns in a
> float, either.
>
> Your test program contains the word ASCII several times, but that's
> misleading, you don't have access to the underlying byte representation.

Hello.
It's interesting to hear about the inner working of this. If OpenSCAD had
the ability to let users manipulate the bits the possibilities for modelling
objects and systems would be increased. Just my opinion of course.

When OpenScad echos/prints the chr(value), what it prints matches with the
ASCII chart. This is why I named the variable ASCII_value. I don't think
it's misleading. It is the ASCII value. It works for all 255 values, value 0
is the only one that is ignored by OpenSCAD.

For my specific application I guess I'll just figure out a work around since
it seems obvious now that OpenSCAD is treating chr(0) as a 'something' that
is not used in any comparison. The inner workings of OpenSCAD must have
checks for a NULL character or chr(0) that equates to 'jump to the next
character'. Oh well. One disappointment out of 256 values, still 99.61%
satisfaction.




--
View this message in context: http://forum.openscad.org/How-to-detect-chr-0-tp12351p12405.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

Fantome
doug.moen wrote
The reason you see ASCII values is that ASCII is a proper subset of
unicode. The letter 'A' has value 65 in ASCII and also value 65 as a
Unicode code point. But OpenSCAD is still a Unicode system, not an ASCII
system, because the entire Unicode range is supported. So there's no need
to stop at chr(255), when you also have chr(256), chr(257), and so on.

If you want to represent an array of values between 0 and 255 using a
string, you can still do that, you'll just have represent 0 in a different
way: pick a different code point. Or you could add an offset, and use the
range chr(1) to chr(256) to represent the values 0 to 255. Of course, I'm
not really sure what you're trying to do, but I hope this has helped.
Hey thanks! Sometimes the simple answers are the best. Since OpenSCAD is using Unicode then yes, I can simply use chr(256) to represent a zero. I like it.

Thanks again. Satisfaction has just increased to 100%.
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

MichaelAtOz
Administrator
In reply to this post by Fantome
Fantome wrote
When OpenScad echos/prints the chr(value), what it prints matches with the ASCII chart. This is why I named the variable ASCII_value. I don't think it's misleading. It is the ASCII value. It works for all 255 values, value 0 is the only one that is ignored by OpenSCAD.
Note this line in the wiki re chr():

Note: When used with echo() the output to the console for character codes greater than 127 is platform dependent.

Also code-points above 0x7F are actually stored as 2 bytes

U+0080 U+07FF 2 bytes 110xxxxx 10xxxxxx wikipedia

The UTF-8 ASCII 'compatability' in terms if byte code is only for 00-7F.

@Torsten, according to Wikipedia, 0x00 is NULL and is a valid code point. ???

Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

MichaelAtOz
Administrator
Also, NULL can be represented as "\u0000"

t=chr(0);
u="\u0000";
u2="\u0000";
echo(t,u); //ECHO: ""," "
if (t==u)
  echo("t==u"); // no
if (u==u2)
  echo("u==u2"); // yes
text(u);  // blank

You should read the 'invalid characters' part in the Wikipedia article. There a a number of Unicode chars in the range 0x7F-0xFF that are invalid. It is just luck that they seem to work.
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

doug.moen
Also, NULL can be represented as "\u0000"

echo("\u0000" == "\u0020");
ECHO: true

So \u0000 is converted to a space character.

>@Torsten, according to Wikipedia, 0x00 is NULL and is a valid code point.
>???

There are a couple of good reasons to not support NUL.
They all stem from the fact that C programs use the NUL character to terminate a character string.
  • One reason might be implementation reasons: a lot of the string APIs available to C++ programs use NUL terminated strings.
  • Another reason is security related: there are a number of network security exploits that are involve the insertion of NUL characters into network traffic. There are a couple of projects that build web interfaces on top of OpenSCAD, so if a malicious OpenSCAD script has the ability to insert NUL characters into these project's web traffic, it might be possible to build an exploit.

On 17 April 2015 at 18:12, MichaelAtOz <[hidden email]> wrote:
Also, NULL can be represented as "\u0000"

t=chr(0);
u="\u0000";
u2="\u0000";
echo(t,u); //ECHO: ""," "
if (t==u)
  echo("t==u"); // no
if (u==u2)
  echo("u==u2"); // yes
text(u);  // blank

You should read the 'invalid characters' part in the Wikipedia article.
There a a number of Unicode chars in the range 0x7F-0xFF that are invalid.
It is just luck that they seem to work.



-----
Unless specifically shown otherwise above, my contribution is in the Public Domain; To the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. This work is published globally via the internet. :) Inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/
--
View this message in context: http://forum.openscad.org/How-to-detect-chr-0-tp12351p12411.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

Fantome
In reply to this post by MichaelAtOz
MichaelAtOz wrote
You should read the 'invalid characters' part in the Wikipedia article. There a a number of Unicode chars in the range 0x7F-0xFF that are invalid. It is just luck that they seem to work.
Hmm, I went to a better source, Unicode.org. I couldn't find anything stating that any values are invalid but I did find this:
Q: Are noncharacters invalid in Unicode strings and UTFs?

A: Absolutely not. Noncharacters do not cause a Unicode string to be ill-formed in any UTF. This can be seen explicitly in the table above, where every noncharacter code point has a well-formed representation in UTF-32, in UTF-16, and in UTF-8. An implementation which converts noncharacter code points between one UTF representation and another must preserve these values correctly. The fact that they are called "noncharacters" and are not intended for open interchange does not mean that they are somehow illegal or invalid code points which make strings containing them invalid.

Maybe there is some confusion with what I am doing. I'm not looking to print anything out as in text. I am only interested in the 8bit values. Wether it's Unicode, ASCII or whatever doesn't really matter because 8 bits will always be 8 bits, even if they are taken from a 32 bit value.

I looked at the chart on Unicode.org for the values from 0x80 to 0xFF and didn't see anything unexpected. I'll post my code this weekend. It seems that I always have a hard time explaining my thoughts and methods. (This is on me, nobody else.) Perhaps seeing the code will make it clear.

In any case, my original question has been answered and I now have a way to use chr() to represent 0x00. Thanks for that.
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

nophead
If you just want a string of numbers, why not just use a vector? It won't be 8 bits, it will be integers stored as floats, but as you can see characters aren't really 8 bits either.

The only difference I can see would be if you do maths on the values but if do it all modulo 256 with the % operator and floor divisions, etc, you should be able to emulate 8 bits.

On 18 April 2015 at 04:26, Fantome <[hidden email]> wrote:
MichaelAtOz wrote
> You should read the 'invalid characters' part in the Wikipedia article.
> There a a number of Unicode chars in the range 0x7F-0xFF that are invalid.
> It is just luck that they seem to work.

Hmm, I went to a better source, Unicode.org. I couldn't find anything
stating that any values are invalid but I did find this:
*Q: Are noncharacters invalid in Unicode strings and UTFs?

A: Absolutely not. Noncharacters do not cause a Unicode string to be
ill-formed in any UTF. This can be seen explicitly in the table above, where
every noncharacter code point has a well-formed representation in UTF-32, in
UTF-16, and in UTF-8. An implementation which converts noncharacter code
points between one UTF representation and another must preserve these values
correctly. The fact that they are called "noncharacters" and are not
intended for open interchange does not mean that they are somehow illegal or
invalid code points which make strings containing them invalid.
*
Maybe there is some confusion with what I am doing. I'm not looking to print
anything out as in text. I am only interested in the 8bit values. Wether
it's Unicode, ASCII or whatever doesn't really matter because 8 bits will
always be 8 bits, even if they are taken from a 32 bit value.

I looked at the chart on Unicode.org for the values from 0x80 to 0xFF and
didn't see anything unexpected. I'll post my code this weekend. It seems
that I always have a hard time explaining my thoughts and methods. (This is
on me, nobody else.) Perhaps seeing the code will make it clear.

In any case, my original question has been answered and I now have a way to
use chr() to represent 0x00. Thanks for that.




--
View this message in context: http://forum.openscad.org/How-to-detect-chr-0-tp12351p12415.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

Fantome
nophead wrote
If you just want a string of numbers, why not just use a vector? It won't
be 8 bits, it will be integers stored as floats, but as you can see
characters aren't really 8 bits either.

The only difference I can see would be if you do maths on the values but if
do it all modulo 256 with the % operator and floor divisions, etc, you
should be able to emulate 8 bits.
Yup I could most likely do it with the % operator. I'm still new to openSCAd so I just chose a way and decided to stick with it until either it worked or I decided it couldn't be done.

I put my code up on thingiverse (http://www.thingiverse.com/thing:779394) because the end result of it is meant to be a 3D printed object. Anybody interested in what I did should take a look.

I will look into the modulo 256 stuff next. Maybe I'll redo it all and end up with a much shorter listing.

thanks again...
Reply | Threaded
Open this post in threaded view
|

Re: How to detect chr(0)

nophead
I see now that your input is a string and you basically want to convert it to binary. Yes it can be done with much less code. Here is a simple example:

function testbit(n, x) = (floor(x / pow(2,n)) % 2) == 1;

function binary(x, n = 7) = n >= 0 ? str((testbit(n, x) ? "1" : "0"), binary(x, n - 1)) : "";

function asc(c, n = 0) = c == chr(n) ? n : asc(c, n + 1);

text = "ABCD";

for(i = [0 : len(text)-1])
  echo(text[i], binary(asc(text[i])));


ECHO: "A", "01000001"

ECHO: "B", "01000010"

ECHO: "C", "01000011"

ECHO: "D", "01000100"


Not very speed efficient as OpenScad seems to lack asc();


On 18 April 2015 at 18:14, Fantome <[hidden email]> wrote:
nophead wrote
> If you just want a string of numbers, why not just use a vector? It won't
> be 8 bits, it will be integers stored as floats, but as you can see
> characters aren't really 8 bits either.
>
> The only difference I can see would be if you do maths on the values but
> if
> do it all modulo 256 with the % operator and floor divisions, etc, you
> should be able to emulate 8 bits.

Yup I could most likely do it with the % operator. I'm still new to openSCAd
so I just chose a way and decided to stick with it until either it worked or
I decided it couldn't be done.

I put my code up on thingiverse (http://www.thingiverse.com/thing:779394)
because the end result of it is meant to be a 3D printed object. Anybody
interested in what I did should take a look.

I will look into the modulo 256 stuff next. Maybe I'll redo it all and end
up with a much shorter listing.

thanks again...



--
View this message in context: http://forum.openscad.org/How-to-detect-chr-0-tp12351p12417.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
12