Re: Read/write integers?

"Ger Hobbelt" <[email protected]>
Newsgroups gmane.mail.spam.crm114
Message-ID <[email protected]>
On Sun, Apr 27, 2008 at 10:59 PM, David King <[email protected]> wrote:
[..]
>  At the moment, I've limited each entry to one line of text, delimited by
> newlines ("window <bychunk> /\n/ /\n/"). That makes it relatively easy to
> communicate with crm114 just by "print line into pipe, read line". (And it
> works very well!) However, given the line-length limit imposed by crm114 (on
> my 32-bit machine, crm114 will crash if I feed it lines longer than 4k, and
> on my 64-bit machine, it crashes on lines longer than 1k; probably
> libreadline or somesuch's fault), that means that for longer entries, I can
> only classify based on the first ~1k of the message, which isn't ideal, and
> keeps me from adding some of the more interesting tokens from our database,
> as they could be quite long.

Let me digest the rest of what you're saying there, but one thing is important:

crm114 should *NOT* crash. Never. _Ever_.

So what you're running into is a bug; besides, the minimum buffer for
window <bychunk> should be somewhere around 8 MEGAbyte, unless you
changed the 'data windows size' using a commandline switch. ('-w'
switch)

The next border that you may hit somewhere is MAX_PATTERN, which
currently stands at 16KByte.


>  Since it's not possible for crm114 to parse or generate the length-header

On output, length of a string can be produced using the :#:var: 'eval'
length operation, but this is just off the top of my head and without
checking what you _really_ need yet.


>  Let me know. I'd use it :) If one could pull the ordinal value of a
> character, it would be easy to multiply to combine several and get a
> representation of the integer value (taking endianness into account as
> appropriate)

I have something almost working already - at least for the latest
private GerH build - and the concept is really simple. I'll post the
(ahem) proof of concept later tonight. No endianess 'handling' in
there though. :-|




-- 
Met vriendelijke groeten / Best regards,

Ger Hobbelt

--------------------------------------------------
web: http://www.hobbelt.com/
 http://www.hebbut.net/
mail: [email protected]
mobile: +31-6-11 120 978
--------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.