CoCreate User Forum  

Go Back   CoCreate User Forum > Support > Customization
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 04-28-2008, 07:06 AM
jkramer's Avatar
jkramer jkramer is offline
Registered User
 
Join Date: Oct 2002
Location: the Netherlands
Posts: 382
EOF error

Hi,

I'm not axactly an experienced programmer, but I do make a Lisp tool in OSD every now and then.
That's why I used Lisp to make an analysis tool for a whole bunch of csv-files made by an oscilloscope. The tool works fine, except for the fact that I get this error:
LISP error:
Unexpected end of #<string-input stream from " ">.
I suspect that it's something with linefeed characters or the like, because if I delete the last line of each file, it works correctly. But because I have to work through a pile of csv files, it's no fun to have the error all the time. Is there a way to prevent this?? See aattached lisp-file and (partial) example csv-file (please rename to .csv!!).
Thanks!
Regards,
Jaap
Attached Files
File Type: lsp pulses.lsp (1.6 KB, 423 views)
File Type: txt pulses_csv.txt (152.4 KB, 426 views)
Reply With Quote
  #2  
Old 04-28-2008, 09:55 AM
Wolfgang's Avatar
Wolfgang Wolfgang is offline
Registered User
 
Join Date: Nov 2002
Location: ... near Sindelfingen near Stuttgart, Germany
Posts: 754
Re: EOF error

I answer without executing the file(s)

have a look to the last line:
PHP Code:
1.063015E+00,9E-02, , ,2.330E+00 
after split at ',' you have
PHP Code:
'("1.063015E+00" "9E-02" "" "" "2.330E+00") 
so 3rd and 4th are empty string.... what should read-from-string read in this case???

Do you know about 'trace' ? .. if not learn about it, e.g. at: How can I trace function call (written by Claus)

When tracing you'll see that calling read-from-string makes the lisp error. You have to decide what to do if there's an empty string!

a) use IKIT function sd-read-from-string, then the LISP error does not appear
b) (if (zerop (length (third regel))) (setf z :invalid) (setf z (read....)))

You as the programmer have to handle this situation.

include in your testdata:
E+00,8E-02,1.53E-01,5.080E+00
2,3,4,
aa,42,"","88",8.2

wirte one function handling this stuff and call it X times
e.g. : (defun number-extract (list index) ....)
This function returns a number in every case.. as fall back 0.0 Then the rest of your code should be able to handle a zero.
Reply With Quote
  #3  
Old 04-28-2008, 10:00 PM
jkramer's Avatar
jkramer jkramer is offline
Registered User
 
Join Date: Oct 2002
Location: the Netherlands
Posts: 382
Re: EOF error

Hi,

thanks a lot! I should have checked better what causes the error...
I know where to look now
Kind regards,
Jaap
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:54 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.