/*************************************************************** * MODULE NAME: TEXT07.SIM * * PUBLIC PROCEDURES: TAB$HANDLER * ***************************************************************/ tabulation: do; put: procedure(a) external; declare a address; end put; declare dcl literally 'declare', lit literally 'literally'; dcl eos lit '1', newline lit '2', tab lit '09h'; dcl tabvector(21) byte external; dcl tabsym byte external; dcl (lbuff,outbuf) (128) byte external; dcl lblen byte external; $eject /************************************************************ * TAB$HANDLER - PUT OUT THE INPUT TEXT TABLE ACCORDING * * TO THE SPECIFIED COLUMNS. * ************************************************************/ tab$handler: procedure public; dcl (optr,iptr,i,j) byte; optr,iptr = 0; /* outbuf and inbuf pointer */ j = 1; do while j <= tabvector(0) and lbuff(iptr) <> eos; /* more than specified tables is not allowed */ i = 1; /* charcount each column */ do while lbuff(iptr) <> tabsym and lbuff(iptr) <> eos; if i <= tabvector(j) then do; outbuf(optr) = lbuff(iptr); optr = optr + 1; i = i + 1; end; iptr = iptr + 1; end; do while i < tabvector(j); /* extra spaces */ outbuf(optr) = ' '; optr = optr + 1; i = i + 1; end; j = j + 1; /* get next table length */ if lbuff(iptr) <> eos then iptr = iptr+1; /* next char pos */ end; outbuf(optr) = newline; call put(.outbuf); end tabhandler; end tabulation; eof