/* ** ** reworking old overstrike ascii art ** ** made for Arexx under amigaOs, but should be easy to change into something ** regina rexx can understand, its only the filehandling functions that differs ** from arexx and regina iso rexx ** ** Jacob Dahl Pind */ parse arg filename /* path and name of layers */ pathname="ram:layer." /* ** main */ /* counter for maximum amounts of overstriks */ max_os=0 /* loop counter of overstrikes */ os=0 /* */ fin="" /* count overstrik layers */ IF open(fh,filename,"READ") THEN DO DO UNTIL EOF(fh) line=readln(fh) command=Left(line,1) select when command="+" THEN call count_os otherwise os=0 end end close(fh) end 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 open(fh,filename,"READ") THEN DO DO UNTIL EOF(fh) line=readln(fh) 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 end end close(fh) end exit /* sub routines */ build_layerfiles: DO loop=0 TO max_os layerfile=pathname||loop IF open(fh2,layerfile,"WRITE") THEN DO close(fh2) END 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=pathname||loop IF open(fh2,layerfile,"APPEND") THEN DO writeLN(fh2,layer.loop) close(fh2) END end lloop=lloop+1 say "line :"lloop 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 .. .