bug in char_test() ?

new topic     » topic index » view thread      » older message » newer message


I decided to give the char_test() in types.e some work in an app. The function of the app is to strip out and separate non-english and non-printable data, merely to lessen the computers workload, narrow the focus for now. There's gigabytes, it's too much data right now.

I started by asking some questions in #euphoria irc channel:

Is everyting in CS_Printable printable, and all else isn't?
So i can use it to filter out the Korean, Chinese, Afghani, Iranian, Polish, Turkish, etc?

I got no answers, i coded it up anyhow, and it broke:

My source code is: if char_test(dataline,CS_Printable)

The error printed to screen by the interpreter is:
c:\Euphoria-4.0.4\include\std\types.e:191 in function char_test()
type_check failure, char_set is 6

dataline = /a/[/r/CapableOf/,/c/en/dog/,/c/en/fight/] /r/CapableOf /c/en/dog /c/en/fight /ctx/all 1 /s/activity/globalmind/assert,/s/contributor/globalmind/ks/maybe /e/624633f49ed73af19503a5cd75c97210b58ea47f /d/globalmind a dog can fight.

types.e line 191 = public function char_test(object test_data, sequence char_set)

i called it with char_test(dataline,CS_Printable)
where CS_Printable = { {' ', '~'} } per line 253 of types.e


The code ran 100's of times before this crash, and nowhere did i redefine CS_Printable to be 6.

useless

Edit:
CS_Printable is enumerated as 6, it's set in
public procedure set_default_charsets()
but Defined_Sets isn't public, so i cannot call
if char_test(dataline,Defined_Sets[CS_Printable]) then
or
if char_test(dataline,types:Defined_Sets[CS_Printable]) then

So how do i make this work?
By appending all the various enumerated types by copy/pasting out of types.e until a text line passed as TRUE, i changed my source to:

if char_test(dataline,{{' ', '~'},{' ', '/'},{':', '?'},{'[', '`'},{'{', '~'},{' ', '~'}, "  ", "\t\t", "\n\n", "\r\r", {8,8}, {7,7}}) 



useless

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu