From: <cde...@us...> - 2010-09-30 14:37:13
|
Revision: 7784 http://octave.svn.sourceforge.net/octave/?rev=7784&view=rev Author: cdemills Date: 2010-09-30 14:37:04 +0000 (Thu, 30 Sep 2010) Log Message: ----------- - tried to solve once (and for a long time) this stupid problems of EOL conventions Modified Paths: -------------- trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m Modified: trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m =================================================================== --- trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m 2010-09-30 11:01:54 UTC (rev 7783) +++ trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m 2010-09-30 14:37:04 UTC (rev 7784) @@ -130,6 +130,7 @@ sep = varargin{indi + 1}; varargin(indi:indi+1) = []; otherwise %# FIXME: just skip it for now + disp(sprintf("Ignoring unkown argument %s", varargin{indi})); indi = indi + 1; endswitch endwhile @@ -155,17 +156,18 @@ unwind_protect_cleanup fclose(fid); end_unwind_protect - lines = regexp(in,'(^|\n)([^\n]+)', 'match'); %# cut into lines - lines = cellfun(@(x) regexp(x, '[^\n]*', 'match'), lines); - %# remove \n - %#, \'UniformOutput', false); + eol = '\r\n|\n|\x0b|\f|\r|\x85'; + %# cut into lines -- include the EOL to have a one-to-one + %# matching between line numbers + lines = regexp(in, ['(^|' eol ')([^' eol ']+)'], 'match'); + %# remove the EOL character(s) + lines = cellfun(@(x) regexp(x, ['[^' eol ']+'], 'match'), lines); %# a field either starts at a word boundary, either by + - . for %# a numeric data, either by ' for a string. %# content = cellfun(@(x) regexp(x, '(\b|[-+\.''])[^,]*(''|\b)', 'match'),\ %# lines, 'UniformOutput', false); %# extract fields - content = cellfun(@(x) strsplit(x, sep), lines, \ 'UniformOutput', false); %# extract fields indl = 1; indj = 1; %# disp('line 151 '); keyboard @@ -233,7 +235,7 @@ %# fallback, avoiding a recursive call idx.type = '()'; indj = df._cnt(2)+(1:size(x, 2)); - + if iscell(x), if 2 == length(x), %# use the intermediate value as destination column This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |