comparison net.rhope @ 147:f3686f60985d

Sort of working port of framework. Transaction bug seems to be getting in the way. Going to work around, but want the old version in the repo so I can test later.
author Mike Pavone <pavone@retrodev.com>
date Mon, 22 Nov 2010 01:15:02 -0500
parents 357f4ce3ca6d
children e9a8269384bb
comparison
equal deleted inserted replaced
146:1f39e69446f9 147:f3686f60985d
431 { 431 {
432 If[Wait for IO[[con]Filedes >>, 1]] 432 If[Wait for IO[[con]Filedes >>, 1]]
433 { 433 {
434 data,out con,err <- [con]_Read Delim[delim,poffset,buflist] 434 data,out con,err <- [con]_Read Delim[delim,poffset,buflist]
435 }{ 435 }{
436 err <- [Fold[_Add Len[?], 0, buflist]]+[Length[[con]Buffer >>]] 436 err <- [Fold[_Add Len[?], 0, buflist]]+[Length[[con]Read Buffer >>]]
437 } 437 }
438 }{ 438 }{
439 ,checknew <- If[[poffset]>=[0]] 439 ,checknew <- If[[poffset]>=[0]]
440 { 440 {
441 If[[[delim]Length]>[[outbuf]Length]] 441 If[[[delim]Length]>[[outbuf]Length]]
442 { 442 {
443 //Avoid possibility of having to check across more than 2 buffers 443 //Avoid possibility of having to check across more than 2 buffers
444 data,out con,err <-[[con]Buffer <<[ 444 data,out con,err <-[[con]Read Buffer <<[
445 _Merge Buffers[[[buflist]Append[[con]Buffer >>]]Append[outbuf]] 445 _Merge Buffers[[[buflist]Append[[con]Read Buffer >>]]Append[outbuf]]
446 ] 446 ]
447 ]Read Delim[delim] 447 ]Read Delim[delim]
448 }{ 448 }{
449 ,checknew <- _Check Split[[con]Buffer >>, outbuf, delim ,poffset] 449 ,checknew <- _Check Split[[con]Read Buffer >>, outbuf, delim ,poffset]
450 { 450 {
451 before <- [_internal_array_copychunk[[con]Read Buffer >>, 0, _internal_array_allocnaked[~, UInt8()], 0, ~] 451 before <- [_internal_array_copychunk[[con]Read Buffer >>, 0, _internal_array_allocnaked[~, UInt8()], 0, ~]
452 ]Length <<[~] 452 ]Length <<[~]
453 453
454 data <- _Merge Buffers[[buflist]Append[before]] 454 data <- _Merge Buffers[[buflist]Append[before]]
455 after off <- [[delim]Length]- [[[[con]Buffer >>]Length]-[~]] 455 after off <- [[delim]Length]- [[[[con]Read Buffer >>]Length]-[~]]
456 rbufferlen <- [[outbuf]Length]-[after off] 456 rbufferlen <- [[outbuf]Length]-[after off]
457 out con <- [con]Read Buffer <<[ 457 out con <- [con]Read Buffer <<[
458 [_internal_array_copychunk[outbuf, after off, 458 [_internal_array_copychunk[outbuf, after off,
459 _internal_array_allocnaked[rbufferlen, UInt8()], 0, rbufferlen] 459 _internal_array_allocnaked[rbufferlen, UInt8()], 0, rbufferlen]
460 ]Length <<[rbufferlen] 460 ]Length <<[rbufferlen]