Keyboard macros: Difference between revisions

Content added Content deleted
No edit summary
Line 150:
! ...
END</lang>
 
=={{header|Icon}} and {{header|Unicon}}==
 
This is application-specific and works in both languages:
<lang unicon>
global kMap
 
procedure main()
kMap := table()
kMap["1"] := italicsOn
kMap["2"] := italicsOff
kMap["\x4"] := exit # ^D terminates
while writes(exec(getch()))
end
 
procedure exec(c)
return (\kMap[c])() | c
end
 
procedure italicsOn()
return "<i>"
end
 
procedure italicsOff()
return "<\\i>"
end</lang>
 
Sample run:
<pre>
->km
this is <i>italics<\i>.
->
</pre>
 
=={{header|Java}}==
<lang java>