[comp.sys.amiga] ConUnit of current console device

grwalter@watcgl.waterloo.edu (Fred Walter) (08/03/88)

Thanx to all the people who responded to my first question. I have STEVIE
(a vi-clone) up and running on my Amiga. Before posting it I want to fix a few
things (such as undo, which came broken :-() and I want to 'Amigize' it some
more.

So, how does one get a pointer to the ConUnit of the current console device ?
I need this so that I can : a) get the current x/y position of the cursor
                            b) get the current window size
                            c) get at the window title (for the filename/etc)

Now I can do a) and b) through reading and writing to the console, but getting
the values from the ConUnit would be much quicker and simpler (not to
mention it wouldn't cause problems with type-ahead).

Advance Thanx,
	fred

grwalter@watcgl.uwaterloo.ca                  (Canadian domain)
grwalter@watcgl.waterloo.edu                  (US Internet, including CSNET)
grwalter@watcgl.waterloo.cdn                  (CDNnet and some European nets)
watmath!watcgl!grwalter                       (UUCP)
uunet!watmath!watcgl!grwalter                 (another UUCP alternative)
grwalter%watcgl.waterloo.edu@csnet-relay.arpa (ARPA)

carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) (08/04/88)

In article <5403@watcgl.waterloo.edu> grwalter@watcgl.waterloo.edu (Fred Walter) writes:
>[]
>
>So, how does one get a pointer to the ConUnit of the current console device ?
>I need this so that I can : a) get the current x/y position of the cursor
>                            b) get the current window size
>                            c) get at the window title (for the filename/etc)
>[]

You don't say what you have to work with.

If you have your own intuition window to which you have attached a 
console.device, the ConUnit pointer is in your iorequest after OpenDevice, 
in io_Unit.

If you are in an AmigaDOS CON: window, you must send an ACTION_DISK_INFO
packet to the console process message port.  For CLI windows (and
other CON: windows which have been fully set up as standard output for
a process, such as the windows some of my startups create), this
MsgPort is proc->pr_ConsoleTask.  For plain CON: windows, you must
extract the MsgPort from the DOS handle for the file.

file = Open(CON:...
fh = (struct FileHandle *)(file << 2);
msgport = fh->fh_Type;

For an example of sending an ACTION_DISK_INFO packet to a console msgport,
see my ConPackets.c on Fish disk 56.  Or check amiga sources group -
it may be there.  With 1.2 or greater CON: or NEWCON:, this packet
will get you both the window pointer and the io request pointer
(from which you get the ConUnit pointer).

WARNINGS:  Two gotchas

1. NIL: file handles have a NULL fh_Type (MsgPort).  Do not send a packet to
   a NULL MsgPort !

2. If your program is running in an AUX: CLI rather than a CON: or NEWCON:, 
   the packet will succeed but you get NO valid Window pointer, and
   your io_Unit will NOT be a ConUnit !  
   
-- 
==========================================================================
  Carolyn Scheppner -- CATS  Commodore Amiga Technical Support
  PHONE 215-431-9180   UUCP  ...{uunet,allegra,rutgers}!cbmvax!carolyn 

 Pad with zeros for a light, airy program.
==========================================================================

thomax@netmbx.UUCP (Thomas) (08/09/88)

In article <5403@watcgl.waterloo.edu> grwalter@watcgl.waterloo.edu (Fred Walter) writes:
>Thanx to all the people who responded to my first question. I have STEVIE
>(a vi-clone) up and running on my Amiga. Before posting it I want to fix a few
>things (such as undo, which came broken :-() and I want to 'Amigize' it some
>more.
hello out..

an vi would be very nice, but i hope, i can run it via the AUX:
can you tell more about that feat???
					mfg thomax

no, i dont have a signature...