From bug-octave-request at bevo dot che dot wisc dot edu Mon Oct 13 04:30:44 1997 Subject: empty lines in load file From: fabian at olymp dot Umwelt dot TU-Cottbus dot de (Rolf Fabian) To: bug-octave at bevo dot che dot wisc dot edu Date: Mon, 13 Oct 1997 10:42:21 +0100 fabian at umwelt dot tu-cottbus dot de topic: empty strings in load file Hi jwe, it's a great feature of octave to accept string matrices with variable column length as variables. So, it's straightforward to write routines in C-programs which parse streams/strings into line-oriented tokens and write them into octave-formatted load files for further high-level treatment. There's no problem, if you parse a simple example like welcome="Hello\nWorld!\n" which results in such an ascii loadfile newline characters, if '\n' are dismissed -------------- # name: welcome # type: string array # elements: 2 # length: 5 Hello # length: 6 World! -------------- This works quite well as long as there are no empty lines in the parsed input. If strings with empty lines are parsed e.g. welcome="Hello\n\nWorld!\n", the logical output would be -------------- # name: welcome # type: string array # elements: 3 # length: 5 Hello # length: 0 # length: 6 World! -------------- Such a load file seems to bring octave into big trouble! Octave's respond to this loadfile is :>error: load: failed to extract string length for element 2 :>error: .... Moreover, if there are additional variables defined in the loadfile, these errors prevents *ALL OF THEM* from beeing processed and loaded. Of course, for an experienced programmer, it's quite easy to process the input using whitespace to e.g. welcome="Hello\n \nWorld!\n" which removes the problem by writing a simple blank into the loadfile. This might be considered as a 'feature', but we suggest a more consistent treatment of empty strings in loadfiles. At least, such 'inconsistencies' should be treated as 'warnings' - not as 'errors' - in order to allow for reading additional variables from the file.! Best wishes Dr. Rolf Fabian