TO Pete LOMAX re - tab spacing ........ I'm Lost

new topic     » topic index » view thread      » older message » newer message

Hi Pete ,
               Sorry mate .. I can't follow .

the following says it all 




--Les Rogers wrote:
--> .............. output is
--> HiThere
-->         HiThere
--> Can I make output
--> HiThere
-->    HiThere

--I doubt there is any way to change what the console does when you
puts(1,"\t"),
--but you can pre-process your output. Here is a routine I use in Edita to
convert
--tabs to spaces:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>



Pete,
       I am learning
       and I don't know how to implement your great code.

       Maybe you could show me ??

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

I ASSUME IT TURNS tab's 8 spaces into 1 or 2 or 3 ???

I AM REALLY IGNORANT of FUNCTIONS ETC.



include get.e
constant SPACE=' ', TAB='\t'
atom w     ,isTabWidth
                      isTabWidth=1

global function ExpandTabs(sequence text)
-- Replace any tabs with spaces.
-- Fast (92,000 lines/second or better)
integer tab
    while 1 do
        tab=find(TAB,text)
        if not tab then exit end if
        text=text[1..tab-1]&
             repeat(SPACE,isTabWidth-remainder(tab-1,isTabWidth))&
             text[tab+1..length(text)]
    end while
    return text
end function

--where isTabWidth needs to be set to/defined as 3 for the example you gave.
--You could of course make this a procedure, say Puts1, which displays to the
--console rather than 'return text'.

--HTH,
--Pete

       ----------->>>>  MY JUNK BELOW I THINK IS GARBAGE !!

             puts(1,"\t")
             if routine_id=ExpandTabs() then end if
             puts(1,"HiThere")
             w=wait_key()

cheers,

les.r.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu