1. Console Buffers

Can anyone help, this is so very nearly working.
I am attempting to emulate the F1/F2 screen buffering of the debugger.
save_text_image() and display_text_image() don't work on exw.

I managed to create the second buffer and can flick between it and the
original console, however the standard output is ending up in the
wrong buffer. I want to keep the a's and the b's separate.

constant FALSE=0, TRUE=1
include dll.e
integer topline
integer debugOn
		debugOn=FALSE
sequence runScreen, runPos
include image.e
atom
k32,CreateConsoleScreenBuffer,SetActiveScreenBuffer,GetStdHandle,SetStdHandle,runBuffer,dbgBuffer
	 k32=0

global procedure debug_screen(integer on)
--
-- if required save the current run-time screen
--
	if on then
		if not debugOn then
			if platform()=WIN32 then
				if k32=0 then
					k32=open_dll("kernel32.dll")

CreateConsoleScreenBuffer=define_c_func(k32,"CreateConsoleScreenBuffer",

{C_LONG,C_LONG,C_POINTER,C_LONG,C_LONG},C_LONG)

SetActiveScreenBuffer=define_c_proc(k32,"SetConsoleActiveScreenBuffer",{C_LONG})

GetStdHandle=define_c_func(k32,"GetStdHandle",{C_UINT},C_INT)

SetStdHandle=define_c_proc(k32,"SetStdHandle",{C_UINT,C_UINT})
					runBuffer=c_func(GetStdHandle,{-11})
--STD_OUTPUT_HANDLE

dbgBuffer=c_func(CreateConsoleScreenBuffer,{#C0000000,#00000003,NULL,1,NULL})
--						{generic read+write, file share read+write,
NULL, console_textmode_buffer, null}
				end if
				c_proc(SetActiveScreenBuffer,{dbgBuffer})
				c_proc(SetStdHandle,{-11,dbgBuffer})
			else
				runScreen=save_text_image({1,1},{25,80})
			end if
			runPos=get_position()
			debugOn=TRUE
		end if
	else
		if debugOn then
			if platform()=WIN32 then
				c_proc(SetActiveScreenBuffer,{runBuffer})
				c_proc(SetStdHandle,{-11,runBuffer})
			else
				display_text_image({1,1},runScreen)
				topline=-99
			end if
			position(runPos[1],runPos[2])
			debugOn=FALSE
		end if
	end if
end procedure
for i=1 to 10 do
	debug_screen(1)
	puts(1,"aa")
	if getc(0) then end if
	debug_screen(0)
	puts(1,"bbb")
	if getc(0) then end if
end for


Regards,
Pete

new topic     » topic index » view message » categorize

2. Re: Console Buffers

Pete Lomax wrote:

> Can anyone help, this is so very nearly working.
> I am attempting to emulate the F1/F2 screen buffering of the debugger.
> save_text_image() and display_text_image() don't work on exw.

Are you using an Eu version <= 2.4? In Eu 2.5 alpha, it *should* work:

<quote>
The library routines: put_screen_char(), get_screen_char(),
save_text_image() and display_text_image() have been implemented for
Windows text-mode consoles. These functions now work across all
platforms. Suggested by C.K. Lester.
</quote>
[Euphoria 2.5 alpha, relnotes.htm]

<big snip>

Regards,
   Juergen

-- 
A: Because it considerably reduces the readability of the text.
Q: Why?
A: Top posting.
Q: What is annoying in e-mail and news?

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu