EuGrid Error Trap Mod

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

This is a useful mod to me. Might be to somebody else, too...

in EGW_DrawText(), replace

if atom(text) then
   text = {text}
end if


with

if atom(text) then
  text = {text}
else
  if not string(text) then -- make yer own string() function
    text = flatten(text) -- make yer own flatten() function
--    text = "ERROR!"  -- or with error string?
  end if
end if


because if text is a sequence but NOT a string, then the following line
in EuGrid.ew

-- Display the text in the buffer
    pstr = eugrid_mem:W32_acquire_mem(0, text )


will crash.

Here's the string() and flatten() functions I used... I bet there are
win32lib versions of these... :) I'm hoping this will receive official
acceptance into EuGrid. It would have helped me looooong ago. :/

function string(object s)
	if sequence(s) then
		for t=1 to length(s) do
			if not atom(s[t]) then
				return 1=2
			end if
		end for
	else
		return 1=2
	end if
	return 1=1
end function

function flatten(object s)
sequence result
	result = ""
	if sequence(s) then
		for t=1 to length(s) do
			result &= flatten( s[t] )
		end for
	end if
	return result
end function


-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu