/* ** ** reworking old overstrike ascii art ** ** fixed version for running under regina rexx, using streams instead of ** arexx way of using filehandlers(which I like alot more than streams) ** ** it aint terrible automated, as you have to cut the file into seperate pages ** ** at 1 as the first char in a line, signals a new page so just search ** for those and cut the file into senseable blocks, or fell free to add ** that function to the code ** ** ** ** Jacob Dahl Pind */ parse arg filename /* ** main */ /* counter for maximum amounts of overstriks */ max_os=0 /* loop counter of overstrikes */ os=0 /* */ fin="" /* count overstrik layers */ IF (stream(filename,"C","OPEN READ")=="READY:") THEN DO /* loop until we cant read anymore lines */ DO UNTIL (Lines(filename) = 0) line=linein(filename) command=Left(line,1) select when command="+" THEN call count_os otherwise os=0 end end end IF (stream(filename,"C","FLUSH")=="READY") THEN say "closing stream" say "maxium of overstrik layers : " max_os /* build layer files for writning */ call build_layerfiles /* clean layers */ call clean_layers lloop=0 /*split into layers now*/ IF (stream(filename,"C","OPEN READ")=="READY:") THEN DO /* loop until we cant read anymore lines */ DO UNTIL (Lines(filename) = 0) line=linein(filename) command=Left(line,1) size=length(line) outline=right(line,(size-1)) select when command=" " THEN call normal when command="0" THEN call ds when command="1" THEN call np when command="+" THEN call overstrike otherwise end end IF (stream(filename,"C","FLUSH")=="READY") THEN say "closing stream" end exit /* sub routines */ build_layerfiles: DO loop=0 TO max_os layerfile=filename||"."||loop if (stream(layerfile,"C","OPEN WRITE APPEND")=="READY:") THEN say layerfile END return count_os: os=os+1 /* check if we have reached a new record of overstriks */ if os > max_os THEN max_os = os return overstrike: os=os+1 /* set the right layer to contain the outline */ layer.os=outline return normal: /* reset os counter to 0 */ os=0 layer.os=outline do loop=0 to max_os layerfile=filename||"."||loop return=lineout(layerfile,layer.loop) end lloop=lloop+1 return ds: return np: exit return clean_layers: /* set all layers to empty lines */ do loop=0 to max_os layer.loop=fin END return .. .