home *** CD-ROM | disk | FTP | other *** search
- Article 4132 of comp.sys.amiga:
- Path: mcdsun!noao!hao!oddjob!uwvax!husc6!rutgers!cbmvax!andy
- From: andy@cbmvax.cbm.UUCP (Andy Finkel)
- Newsgroups: comp.sys.amiga
- Subject: Printer Device Control (source)
- Message-ID: <1787@cbmvax.cbmvax.cbm.UUCP>
- Date: 29 Apr 87 17:31:35 GMT
- Reply-To: andy@cbmvax.UUCP (Andy Finkel)
- Organization: Commodore Technology, West Chester, PA
- Lines: 1034
-
- (I need a path to the amiga sources group that works. That's
- why this is here. Promise, I won't post another source until
- I figure out a working path...)
-
- (oh, yes, I'm probably going to get comments on my gadget.c file...
- yes, it can easily be done programatically, but I tend to zap
- out lists of gadgets using EMACS MLISP macros when I'm in
- a hurry. Whatever you're used to, I guess)
-
- (These sources were compiled on Greenhill's C. You'll probably
- have to fiddle a little bit to make it compile on Manx, and
- to make it compile quietly on Lattice)
-
- Remember our recent discussion on what the printer.device should
- be expected to do, and what an application program should be expected
- to do ? (Thought you would) This program is the result.
- (BTW, thanks for the advice, Carolyn)
-
- Basically, once you fire it up it hangs around, waiting for anyone
- to do a DUMPRPORT. It then fires up a requester, and lets you
- play with the values being passed in the IORequest block.
-
- How to use:
- (from CLI)
- run control
-
- this fires it up. It opens the printer.device, and installs itself.
-
- To stop it, either send its process a ^C (using the break command)
- or execute it again.
-
- (From Workbench)
- give it an Icon. Double click on its icon. To stop it, double click
- on its icon again.
-
- How it works:
- The control program does a SetFunction on the printer.device's BeginIO
- and Expunge entry points. It then checks each IORequest block sent
- to the printer.device. If it finds a DUMPRPORT, it brings up a
- window filled with the parameters being passed to the printer.device.
- (Parameters are: CMap (pointer to the color map), Mode (your viewmodes),
- SrcX, SrcY, SrcWidth, SrcHeight, Destination Columns, Destination Rows,
- and the Special Flag (bits from right to left= Density 4, Density 3,
- Density 2, Density 1, Aspect, Centering, FracCols, FracRows, FullRows,
- FullCols, MilRows, and MilCols))
- By using the mouse and keyboard you can play with the paramters
- to your hearts content.
-
- Now, some words of warning...it is very possible to pass bad flags,
- numbers, etc to the printer.device. No error checking is done.
- (wouldn't want to limit the user :-) ) So you can crash your
- machine, or send the printer device into an infinite loop, or...
- (If you want to make it less fun, add the error checking)
-
- Warning #2: This program takes memory. Some programs on the
- edge may not like this. Especially as I've disabled the Expunge
- of the printer.device while the control program is in operation,
- for safety. Some programs are accustomed to doing an Expunge after
- printing (Deluxe Paint II springs to mind). When the printer.device
- refuses to go away, the calling application may get upset.
-
- Warning #3: The control window comes up on the front screen.
- This might get funny on some programs (like DP II) if you fool
- with the gadgets too much. If you plan to adjust dpaint
- pictures a lot, you might modify the program to bring the
- window up on the workbench screen.
-
- Last thing...note carefully the techniques for unwinding the SetFunction,
- and the use of SetFunction on a device. This can be used for
- many other abuses of the system. Be careful, though...most devices
- run as tasks, which means that any code running as part of that task
- can't use DOS functions.
-
- This posting will be in 2 parts...first the uuencoded .ld file.
- (please check the line lengths before uudecoding; maybe we'll
- catch the problems that way.
- Lengths are:
- 10903 for control.uue (after this README and trailing linefeed are removed)
- and 7892 for control.ld.
- )
-
- --
- andy finkel {ihnp4|seismo|allegra}!cbmvax!andy
- Commodore/Amiga /or/ pyramid!amiga!andy }
-
- "Do not meddle with the affairs of wizards, for it makes them soggy and hard
- to light."
-
- Any expressed opinions are mine; but feel free to share.
- I disclaim all responsibilities, all shapes, all sizes, all colors.
-