Re: [OT] Visiting Australia

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

ags wrote:
> 
> don cole wrote:
> > 
> > Ricardo M. Forno wrote:
> > > on our next holyday, from about 5th January 2005 to 25th of the same
> > > month.
> > I'm not from Australia or New Zealand but the 5th January 2005 passed a long
> > time ago.
> 
> Taht's a good pniot but it jsut geos to sohw how felxilbe teh hmaun barin is
> at filriteng out nsoie. :)

I read that too.

http://www.mrc-cbu.cam.ac.uk/~mattd/Cmabrigde/

Regards,

Bob

include Win32lib.ew
without warning

constant win = createEx(Window, "Demo", 0, 20, 20, 400, 280, 0, 0)
constant tool_bar = createEx(ToolBar, "", win, 0, 0, w32Edge, 34, 0, 0)
constant edit = createEx(RichEdit,
"I found that if you paste some Euphoria code into rich edit" &
" and click shuffle, it converts it to C++",
win, 0, 0, w32Edge, {w32Edge, +34}, or_all({ES_NOHIDESEL}), 0)
constant button = createEx(PushButton, "shuffle", tool_bar,
0, 0, 100, 30, 0, 0)
constant Menu_Edit           = createEx(Menu,     "&Menu",      win,
0, 1, 0, 0, 0, 0)
constant MenuItem_Cut        = createEx(MenuItem, "Cu&t",       Menu_Edit,
0, 2, 0, 0, 0, 0)
constant MenuItem_Copy       = createEx(MenuItem, "&Copy",      Menu_Edit,
0, 3, 0, 0, 0, 0)
constant MenuItem_Paste      = createEx(MenuItem, "&Paste",     Menu_Edit,
0, 4, 0, 0, 0, 0)
constant MenuItem_Delete     = createEx(MenuItem, "&Delete",    Menu_Edit,
0, 5, 0, 0, 0, 0)
constant MenuItem_Select_All = createEx(MenuItem, "Select&All", Menu_Edit,
0, 6, 0, 0, 0, 0)
--======================================================
--Cut
procedure Cut(atom self, atom event, sequence params)
cut(edit)
end procedure
setHandler(MenuItem_Cut, w32HClick, routine_id("Cut"))
--======================================================
--Copy
procedure Copy(atom self, atom event, sequence params)
copy(edit)
end procedure
setHandler(MenuItem_Copy, w32HClick, routine_id("Copy"))
--======================================================
--Paste
procedure Paste(atom self, atom event, sequence params)
paste(edit)
end procedure
setHandler(MenuItem_Paste, w32HClick, routine_id("Paste"))
--======================================================
--Delete
procedure Delete(atom self, atom event, sequence params)
clear(edit)
end procedure
setHandler(MenuItem_Delete, w32HClick, routine_id("Delete"))
--======================================================
--Select All
procedure Select_All(atom self, atom event, sequence params)
setIndex(edit, {1, 0})
end procedure
setHandler(MenuItem_Select_All, w32HClick, routine_id("Select_All"))
--======================================================
--Resize Window
procedure win_on_resize(atom self, atom event, sequence params)
setRect(edit, 0, 0, w32Edge, {w32Edge, +34}, True)
end procedure
setHandler(win, w32HResize, routine_id("win_on_resize"))
--======================================================
function create_words()
sequence word, RE_text, output
integer char
word = {}
output = {}
RE_text = getRichText(edit, -1)
for m = 1 to length(RE_text) do
char = RE_text[m]
if char >96 and char <123 then--if lower case letter,
word &= char--add to word
if m = length(RE_text) then
output = append(output, word)
end if
elsif char >64 and char <91 then--upper case
word &= char--add to word
if m = length(RE_text) then
output = append(output, word)
end if
else--often ASCII 32, 46 etc.
if length(word) then
output = append(output, word)
word = {}--start a new word
end if
output = append(output, {char})
end if
end for
return output
end function

function Scramble(sequence s)--from genfunc.e
integer len, k
object temp
len = length(s)
for i = 1 to len do
k = rand(len)
temp = s[k]
s[k] = s[i]
s[i] = temp
end for
return s
end function

procedure shuffle_spelling(atom self, atom event, sequence params)
--leave the first and last letters intact to maintain legibility.
sequence words, output, mid
output = {}
words = create_words()
for n = 1 to length(words) do
if length(words[n]) > 3 then
mid = Scramble(words[n][2..length(words[n])-1])
words[n] = words[n][1] & mid & words[n][length(words[n])]
end if
output &= words[n]
end for
setText(edit, output)
end procedure
setHandler(button, w32HClick, routine_id("shuffle_spelling"))

WinMain(win, Normal)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu