------------------------ AmigaOS 4 project ---------------------------

printer.device 39.7 (17.9.2002)

- Wrote function prototype header files for all components.

- Lost the time.c/timing.h files.

- All debug output now uses the assert.h macros.

- All function pointers are now type-safe.

- Switched over to use #pragmas instead of amiga.lib stubs.

- Got rid of almost all compiler warnings.

printer.device 39.8 (17.9.2002)

- Ran the indent command across all 'C' files to clean up the
  code a bit.

printer.device 39.9 (18.9.2002)

- Rewrote all the assembly language portions in 'C' which are not
  hardware specific.

- If opening a printer driver succeeds but any of the following
  initialization actions fail, the driver is now expunged. In
  older versions it would have remained in memory until they'd
  started to break out the ice skates in hell.

- The device no longer launches the unit Task in the device
  init code. All it does now is open libraries and perform
  general simple initializations.

- The unit task is now created as a separate entity and is
  no longer built from bits and pieces of the printer
  device base structure.

- The unit task is now created in the device open routine.

- The device open routine will now fail if any unit number
  other than 0 is used.

- The device open routine can now be called only from a
  Process. Previously, a Task could get stuck in the
  LoadSeg() code somewhere down the line which is called
  when the printer driver is brought into memory.

- The device expunge code no longer expects to be able to
  gun down the unit task.

- The device close code now properly shuts down the unit
  task rather than first attempting to steal its I/O
  requests and then giving each pending printer I/O
  request a push. All this cleanup work is now done by
  the unit task.

- The device AbortIO() function no longer pretends that if
  it manages to abort the parallel/serial I/O requests that
  may be pending at the moment, this automatically means
  that the current I/O request could be aborted.

- The device BeginIO() code is now a bit more careful about
  quick I/O. Which means that this option isn't ignored sometimes.

- The CMD_STOP and CMD_START commands now actually work.

- If the CMD_FLUSH command is unable to abort a pending I/O
  request, it won't hang around trying to abort the same
  request over and over again.

- The PRD_RAWWRITE command will no longer try to wait for an
  I/O request to return if the previous call to the CMD_WRITE
  core code brought up a timeout. A timeout condition that
  was registered first is likely to persist. This should fix
  the strange case of having to answer the same bloody timeout
  notification requester twice.

- Rewrote the entire error requester code which was far too
  convoluted and complicated to be sane. It now sports a simple
  and efficient locale catalog lookup routine rather than a
  hack which patches the error strings into the static data
  area.

- The unit task now checks if any of its resource allocations
  fail and will bail out if this is the case. Previously, it
  would have simply crashed.

- The unit task now uses separate message ports for the
  serial/parallel I/O and the timer.

printer.device 39.10 (18.9.2002)

- With one exception, dropped all the assembly language components
  and header files from the repository.

printer.device 39.11 (18.9.2002)

- Turned local functions into static functions where possible.

- Dropped the 'roll your own' case insensitive printer driver name
  comparison code. It didn't work for anything beyond the ASCII
  character set anyway.

- Lost some more stupid code in OpenPrinter() which was easy to
  replace with a novel routine called strcpy()...

printer.device 39.12 (18.9.2002)

- Dropped the unused ReadPixelArray() routine.

- Switched ReadPixelLine() over to use register parameters.

- Rebuilt with register function parameters; some functions and
  function pointers still need stack parameters, though.

- Dropped a bunch of unused global variables and moved some
  over to other places where they could stay local variables.

- sprintf() is not really necessary. strcpy() and strcat()
  can do the same job. Or strcpy() and AddPart().

printer.device 39.13 (18.9.2002)

- Introduced new types for the icky function pointers. Also
  added proper cases even for the function pointers without
  anyparameters.

- Removed all comparisons between signed and unsigned
  variables.

printer.device 39.14 (19.9.2002)

- Dropped Kickstart 1.1 compatibility code (ha!).

- Replaced the debugging macros for simple string output where
  possible.

- Cut down the number of blank spaces in function calls.

- Replaced a simple local loop with a memset() which does
  the same job.

printer.device 39.15 (19.9.2002)

- Replaced AllocMem()/FreeMem() calls with AllocVec()/FreeVec().

- Dropped the 1.3 compatibility code that's used in the aspect
  ratio calculation. We now query the display database for these
  values.

- Replaced the local temp1 and temp2 variables in the rastport
  dump code with local variable with more meaningful names.

printer.device 39.16 (19.9.2002)

- The GREY_SCALE2 rastport dump option is no longer supported.
  The device will refuse to print if this option is set.

- Renamed some more nondescript variables.

printer.device 39.17 (21.9.2002)

- Now requires graphics.library V39 (Kickstart 3.0 or higher).

- Oops: the unit task was trying to pick up I/O requests to
  be processed from the wrong MsgPort. Fixed.

- Dropped the assembly language planar to chunky conversion
  routine. The new code can't handle anything beyond 8
  planes yet and may use the blitter. This is going to be
  modified next.

printer.device 39.18 (21.9.2002)

- Oops: the temporary rastport allocated for planar to chunky
  pixel conversion didn't have the temporary bitmap installed
  which was created for it.

- The planar to chunky conversion code seems to work OK.

printer.device 39.19 (21.9.2002)

- Integrated the new with the old planar to chunky conversion
  code.

printer.device 39.20 (21.9.2002)

- The rastport dump code now checks the entire size of a bitplane
  before it decides whether a bitmap is valid or not.

- The planar to chunky pixel conversion routine did not work
  well for cases in which the area to be printed would not
  begin with the first bitmap pixel. Fixed.

printer.device 39.21 (21.9.2002)

- Oops. The planar to chunky conversion code did not take the
  actual bitmap depth into account. Fixed.

printer.device 39.22 (22.9.2002)

- Renamed some more nondescript function parameters and
  variables.

- To figure out whether a display mode refers to an extra
  halfbrite display, the rastport dump routine now consults
  the display database rather than relying solely on the
  mode ID flags.

- The rastport dump code no longer tries to read more colour
  data from a ColorMap than there are entries in that map.

- The PRD_QUERY command now checks if there is enough room
  in the output buffer.

- Lost some more unused function parameters.

- Found and removed the last Hedley monitor scan conversion
  code.

printer.device 39.23 (22.9.2002)

- PrtInfo.pi_ColorMapSize now holds the number of colour table entries, not
  the number of bytes in the colour table.

- The colour map is now initialized with unused entries set to represent
  white; previously, no initialization was done, leaving the unused entries
  set to random colours.

- Lost some more unnecessary local variables.

printer.device 39.24 (22.9.2002)

- Implanted two new dithering matrices for use with 24 bit colour printing
  when the time is ripe. The new 'halftone' matrix is a bit coarser than
  the old one, but that's in its nature; this is not a full-blown 16x16
  matrix, though. I picked an 8x8 matrix because it yields better results,
  that is, more image structure survives (larger halftone patterns have
  the unpleasant effect of obscuring the image data).

- Now uses 24 bit colour data for all printing tasks. Unfortunately, the
  printer drivers are currently 12-bit only, which is why the resulting
  data is cut down before it is sent to the driver. The only exceptions
  are the Floyd-Steinberg error diffusion filter and the built-in
  ordered and halftone dithering code that is used for ancient printer
  drivers (those predating Workbench 1.3). In this case, the entire
  dithering operation takes place in 24 bit colour space.

- Fixed an ancient bug in the Floyd-Steinberg error diffusion filter
  which would skew the weights during colour dithering. This did not
  have such a great impact on four bit colour values, but with eight
  bit colour values the picture would become oversaturated. Fixed.

- Lost the last internal assembly language header file.

printer.device 39.25 (22.9.2002)

- Scaling didn't work well because the 24 bit colour data was clamped
  to 12 bits prior to transfer. This caused the vertical scaling code
  to lose all the colour after two iterations. Fixed.

- Not sure if the vertical reduction code will produce something useful
  if the row colour values are added up over and over again, but
  at least now the results won't spill into the other colour components.

printer.device 39.26 (23.9.2002)

- The hold-and-modify mode is no longer detected by looking at the
  display mode ID. We now look at the display database for advice.
  This should help Picasso96 because its openness in choosing
  display mode IDs could mistakenly lead to hold-and-modify mode
  to be enabled.

- Integrated the CyberGraphX/Picasso96 true colour support. You
  can now toss any 15/16/24/32 bit colour data at the driver and
  it should come out OK.

- The anti-aliasing option is disabled for true colour printing;
  the way the algorithm works, it has to have access to the pixel
  pen colours (which are supposed to be 16 bit values). This is not
  an option for true colour operation.

- The Hedley scan conversion option (GREY_SCALE2) is no longer rejected
  as an error because some custom printer drivers depend upon it. The
  printer.device will just ignore it for now.

printer.device 39.27 (23.9.2002)

- The unit task is now a unit process.

printer.device 39.28 (23.9.2002)

- The unit process now loads, initializes, opens, closes and expunges
  the printer driver. It also opens and closes the serial/parallen/netprint
  device.

- If the unit process cannot be initialized or cannot initialize its own
  data, the device open code now properly cleans up after itself.

- The device init code no longer opens timer.device with a NULL MsgPort
  in the timerequest. In fact, it doesn't open timer.device any more. This
  job is now done by the unit process which will open it with a well-formed
  timerequest.

- Preparations are underway to allow for more than one printer unit.

printer.device 39.29 (23.9.2002)

- The Floyd-Steinberg error diffusion filter now reverses the scan direction
  for every other line. Pixels will be processed in 'serpentine order'. This
  improves image quality because the kind of artefacts the traditional
  Floyd-Steinberg filter can generate will be avoided.

printer.device 39.30 (23.9.2002)

- Cut down the number of global data structures.

printer.device 39.31 (24.9.2002)

- According to the documentation, PRD_QUERY expects two bytes of data
  to be filled in and has to ignore the IOStdReq's io_Length field.
  Bummer.

- Dropped the data reserved for the generic printer driver. Turns out
  that this data was not even referenced once.

- Switched from local variables to per unit variables. There is just one
  unit for now, though, but the device is now practically reentrant.

printer.device 39.32 (16.10.2002)

- Lost a number of global variables which are now part of the printer
  unit data.

- The PWrite() and PBothReady() functions are now called from the
  PrinterData structure function pointers. This means that you can
  now replace both with dummy functions or implement a simple redirection
  mechanism without having to rewire the underlying I/O device. Set
  the function pointers to NULL to quietly drop any output.

- The default PrinterData->pd_PWrite and PrinterData->pd_PBothReady functions
  no longer permit any Process other than the unit process itself to call
  them. While this shouldn't have happened anyway, this avoids embarrassing
  crashes.

printer.device 39.33 (17.10.2002)

- Rewrote the device init/open/close/expunge and unit process code to
  allow for up to ten different units to be supported.

printer.device 39.34 (17.10.2002)

- The catalog file is now reopened for each unit. If the language changes
  while a unit is open, the next unit to be opened will use the then
  current catalog rather than sticking to the old catalog.

printer.device 39.35 (24.10.2002)

- The code that duplicates the I/O request the underlying parallel/serial/netprint
  device was opened with did not copy enough data. Fixed.

- Occasionally, WaitIO() could be called on an I/O request which was
  never used even once, leading to memory corruption. Fixed.

printer.device 39.36 (29.10.2002)

- Replaced most of the flag bit fiddling with macros which should make
  the purposes of the actions clearer.

- Removed another redundant and potentially troublesome test for the HAM
  display mode property.

- Print density values beyond 7 are now ignored. Previously, undefined
  behaviour could result.

- Modified the unit task code that deals with the properties of an I/O
  request (queued, current, done) to perform its bit fiddling in
  Disable() state. This should make the AbortIO() code safer.

printer.device 39.37 (2.11.2002)

- Lost some of the internal printer flags defined in "internal.h".

- The density range check was too restrictive. It now assumes that if
  the density value is > 7 it should be set to the maximum (7).

printer.device 40.1 (3.11.2002)

- Last checkin & version bump before the extension work begins.

printer.device 40.2 (19.7.2003)

- Now compiles using the public header files in V:include.

- Better integration into the OS4 build.

- Added NSD support.

printer.device 40.3 (31.7.2003)

- Closing the last active printer.device unit could crash because
  the locale.library was closed before the unit catalog data was
  to be released. Fixed.

printer.device 40.4 (31.7.2003)

- The plane size calculation in read_pixel_line.c was unreliable.
  Fixed.

printer.device 40.5 (9.1.2005)

- Added an option to skip opening the ports driver and to skip
  performing any port device I/O.

- Added more debug output.

- Replaced the assert.c/assert.h code.

- Added strlcpy()/strlcat() functions.

- Preparations for PowerPC port.

printer.device 40.6 (10.1.2005)

- Added OS4 specific device/library initialization code.

- Added stub code to invoke the 68k functions with.

- Added a new build makefile for OS4.

TODO: Wrappers are required for the DefaultPWrite() and
      DefaultPBothReady() functions, which may get called
      from 68k code.

printer.device 40.7 (16.11.2005)

- Added 68k stub code for DefaultPWrite() and DefaultPBothReady().
  If the printer driver is written in PowerPC native code (as
  evident by testing the driver initialization function pointer)
  the original PowerPC functions will be used instead. All this
  means that the new printer.device might just work...

- Fixed the function pointer invocation for those functions which
  didn't receive all the necessary parameters.

printer.device 40.8 (17.11.2005)

- I had mixed up the configuration of the 68k stub callback functions
  and the PowerPC native functions. This rendered the printer.device
  essentially useless.

- A debug #define was still in the printer unit Process which had the
  effect of keeping the transport device (serial.device, parallel.device,
  netprint.device, etc.) from getting opened. Oops.

- Successfully tested printing with the "HP LaserJet" printer driver
  on the A3000UX. Both plain text printing and graphics dumps work.
  Next: try this on an AmigaOne with "lpr.device" as a stand-in for
  "arallel.device".

printer.device 40.9 (17.11.2005)

- Anti-aliasing in a RastPort dump is now turned off way before the
  necessary memory allocations and initializations begin rather than
  at the last minute and at great expense. Anti-aliasing is turned
  off specifically when the Floyd-Steinberg filter is active or the
  printout is to be scaled down both horizontally and vertically.

- The 24->12 bit colour conversion code was adding a round-off fudge
  to each R, G and B value. This caused colour data to "bleed" because
  the resulting values were occasionally larger than what a 4 bit
  value could hold.

- Discovered that the final image transfer pass, which handed over
  the preprocessed colour data to the printer, did not have to have
  converted the data to 12 bits. This should not happen for printer drivers
  written for the Workbench 1.0/1.1/1.2 API. Yes, it's silly.
  Drivers that old probably should not even be opened by this
  printer.device version. Hardware that old (20 years) likely won't
  work any longer.

printer.device 40.10 (18.11.2005)

- Now builds with gcc 4.0.0 with -Wall -Werror on AmigaOS.

- The PPC version crashed during open of unit 0-10 due to a wrong printer
  unit data size tag used for a CreateLibrary() call, fixed.

- The PPC version crashed during close of unit 0-10 due to an always
  direct call of the printer driver ped_Close() function, fixed, now
  68k functions are called via Emulator and NULL functions are ignored.
  This makes it possible to print at least with Printers:Generic and
  printtofile.device.

printer.device 40.11 (18.11.2005)

- Moved the requester handling into pwrite.c, and the locale support
  code into a separate file.

- The error requester now closes all by itself if one or more I/O
  requests return while the requester code is still waiting for the
  user to answer it.

- Reworked the local header files, getting rid of the forward
  declarations.

- Updated the dependencies in the build makefiles.

- TransferPixelArray() now returns an error code, as produced by
  the subroutines it calls.

- Errors generated by the transport device drivers are now
  detected and forwarded. This means in particular that cancelling
  the timeout requester should now finally show up only exactly
  once.

printer.device 40.12 (19.11.2005)

- Changed the routine which shows the error requester so that the
  requester will close by itself only if the "out of paper" or
  "printer offline" status has gone away, too. The code checks
  periodically, once a second, if the printer error status has
  changed.

- Replaced the "roll your own" timer MsgPort in wtask.c with
  a call to CreateMsgPort(), etc.

printer.device 40.13 (19.11.2005) 

- Added a check if the loaded printer driver is an 68k HUNK file.

printer.device 40.14 (29.11.2005) 

- No longer needs the "-fsigned-char" compiler switch to build.

- The assert functions now work with OS4.

- Now allows unit number -1 to be opened and uses the printer prefs
  supplied by Prefs/Printer for this unit.

- Added the private commands PRD_RESETPREFS, PRD_LOADPREFS, PRD_USEPREFS,
  PRD_SAVEPREFS, PRD_LASTSAVEDPREFS and the public commands PRD_READPREFS,
  PRD_WRITEPREFS, PRD_EDITPREFS.

- Now opens and requires iffparse.library to parse ENV:sys/printerN.prefs
  (1 <= N <= 9) to override the GetPrefs() result, so the units 1 to 9
  do actually use their own settings now as defined with Prefs/Printer.

printer.device 40.15 (29.11.2005) 

- Added support for the PRTA_NoIO tag, when TRUE, no connection device
  driver will be opened.

- PRD_DUMPRPORT no longer requires a RastPort or Layer or BitMap so the
  print preview in Prefs/Printer works now.

printer.device 40.16 (30.11.2005) 

- Now initializes DeviceData.dd_Segment and DeviceData.dd_ExecBase for
  safety.

- Now initializes PrinterData.pd_DriverName and PrinterData.pd_UnitNumber
  for V44 compatibility.

- Now uses PrinterUnitPrefs.pu_OpenDeviceFlags when opening the connection
  device for V44 compatibility.

- Before calling PrinterExtendedData.ped_ConvFunc() a check for the
  printer segment version is done. Changed this from ">= 35" to ">= 34"
  as described in <devices/prtbase.h>.

- Now initializes PrinterData.pd_PRead() and PrinterData.pd_PQuery() for
  44 compatibility. However, the functions which get called do nothing yet.

- No longer allocates MEMF_PUBLIC memory.

- Added the public command PRD_DUMPRPORTTAGS for V44 compatibility.

- Added a missing NULL pointer check in GetPrinterData().

-------------------- AmigaOS 3.1.4.(1) project -----------------------

printer.device 45.1 (1.6.2018)

- Ported to 68K again.

- Fixed a missing check whether cybergraphics is present if
  an rtg bitmap is to be printed.

printer.device 45.2 (2.6.2018)

- Double buffering in the device was broken. After queuing the
  second buffer for printing, the first buffer is filled again even
  if its printing did not yet complete.

printer.device 45.3 (3.6.2018)

- Recompiled with the small data model.

- Aborting a DUMPRPORT could have left the printer in an undefined
  state. The way how the abort is now signalled had been revised,
  and the current row is continued to print, and printing is only
  aborted after the current row had been send.

printer.device 45.4 (6.6.2018)

- Previous versions of the device always flushed the printer driver
  from RAM as soon as the device was closed. This was a functional
  change from v39 of the device. While probably acceptable for
  harddisk users, this would really be an anoyance for disk users.
  The printer device does now buffer printer drivers until it is
  expunged, as it used to.

- The printer device did never check whether the driver initialization
  code returned a success indicator, and rather used the driver
  nevertheless, even if initialization failed. It does check now.
  This resulted in the failure of some buggy drivers (most notably
  the new HP_DeskJet/LaserJet and postcript drivers. Outch!)

- The driver default hooks already need to be defined at the time
  the init function of the driver is called, and not at the time
  the task is initialized.

- The printer.device ignored the PRTA_8BitGuns tag of the V44 printer
  drivers and always provided the output data with 4 bits/gun,
  unlike it should. I fiddled this in as a new flag...

- Added a flag such that loaded printer segments cannot be used by
  two tasks at once. Unfortunately necessary as printer drivers are
  not re-entrant.

printer.device 45.5 (13.6.2018)

- Unfortunately, some printer drivers return an incorrect result
  code from their Init() function, the printer.device now also
  accepts a -1 as success indicator. Unfortunately, this means
  that broken drivers cannot signal a failure.

- The render function was also called during initialization, but
  may have resulted in an error for a non-graphics printer. Such
  an error is now also accepted as the printer.device does also
  support text-only printing.

printer.device 45.6 (16.6.2018)

- The hack to accept -1 as alternative OK result code does unfortunately
  not work with the older drivers which use just this value to
  indicate an error. Bummer!

printer.device 45.7 (21.6.2018)

- The Floyd error distribution algorithm uses a temporary 16-bit buffer
  in order to allow 8-bits/gun printing, but unfortunately left some
  temporary data in its 8-bit output buffer that was leaked through from
  the 16-bit error distribution buffer. This caused shadows on the right
  hand side of the print if twice the input size was larger that the
  output size.

printer.device 45.8 (29.6.2018)

- The Bresenham algorithm to upscale images was just erraneous and thus
  resulted in wrong or incorrect scaling factors, except if the scaling
  factors were all integer. This may result in wrong aspect ratios in
  images.

- Modified the handling of 8-bit printing such that it uses the same
  conventions as AmigaOs 4, namely the threshold is upscaled by the
  printer.device and not the device handlers. Hence, device handlers are
  changed again - to the previous release.

printer.device 45.9 (4.7.2018)

- In case the printer is offline or out of paper, and waiting for an
  IORequest from the parallel device to never return, also accept an
  abortion of the rastport dump function.

- Fixed an off-by-one error in the Floyd-Steinberg algorithm for color
  graphics.

printer.device 45.10 (5.7.2018)

- Centalized the abort check for all expansion and reduction functions.

printer.device 45.11 (14.7.2018)

- Minimalistic micro-optimization in cwrite.

printer.device 45.12 (15.7.2018)

- The printer status test used the wrong logic for the printer select
  line and hence made wrong decisions when aborting a print process
  and when selecting the warning text.

- Aborting a printing process was (due to that and other nonsense)
  still broken.

- Printing CGfx/P96 rastports was broken due to a data-type mix-up.

printer.device 45.13 (17.7.2018)

- The printer drivers expected that the printer.device uses its
  IORequests alternating, but nothing in the back-end device can
  guarantee that request 1 is ready before request 2 if request 1
  is send before request 2, so now an explicit check for this
  condition is made.

printer.device 45.14 (21.7.2018)

- Fixed an out of bounds access when color-mixing for reducing
  the dimensions of graphics.

- Integer scaling may have resulted in dimensions beyond the physical
  page dimensions, in which case the dimensions would have been clipped,
  resulting in non-integer scaling. Integer scaling is now smarter,
  avoiding a round-up in such a case.

printer.device 45.15 (23.7.2018)

- Downscaling of images was just broken. In case a printer pixel is
  sx pixels wide and sy pixels high, the average is computed by
  dividing the sum by sx*sy, and not sx+sy.

- Downscaling accumulated the pixel values into 8 bit values. This
  might have worked for 4-bit color samples, but not for 8 bit
  samples. Increased the buffer size.

- Downscaling of HAM graphics was just broken in case the image was
  rotated as the code did not keep trace of the last HAM value
  correctly and instead used the partial sum as HAM predictor. The
  HAM buffer is hence also needed for rotated scanning.

- Isolated the HAM updater, and also refactored the scanning and
  conversion process which was close to unreadable.

- In case color-correction was turned on, the corrected colors were
  not carried over correctly in case the device downscaled bitmaps.

- Printing true-color images could have crashed because the code
  never initialized the color map to zero in such cases.

- Rotated printing of true-color images was broken because the code
  assumed 16-bit and not 32-bit entries.

printer.device 45.16 (30.7.2018)

- When checking the tag list for 8-bit printing, the code did not
  check for the extended printer flag and only relied on the
  version. This has been fixed.

- Removed some dead code and refactored the driver open function.

- In case the driver code could not be loaded, the device would
  have crashed. It delivers an error now.

- The printer initialization sequence is now only send to the printer
  the first time the driver is loaded.

--------------------------- AmigaOS 3.2 project ----------------------

printer.device 45.18 (01.10.2019)

- Fixed a bug in PRD_QUERY. In case the query operation cannot be
  made QUICK, the outgoing query did not respond back to the right
  reply port, namely that of the sender, and hence was left unheared
  of.

printer.device 47.1 (01.02.2020)

- The printer.device now also reads printergfxN.prefs for consistency.


printer.device 47.2 (23.5.2020)

- Replaced the unsafe built-in locale string lookup code with a
  safer version. Also removed the code comment in the "locale.c"
  which claimed that the unsafe version was the one adapted from
  CygnusEd code, because the code used here was replaced with
  the unsafe version used by CatComp.

printer.device 47.3 (23.5.2020)

- So the same unsafe lookup code, and the block data were part
  of printer device twice: once in "locale.c" and again in
  "requester.c", too.
