#!/com/sh
# Build a printer driver for prsvr.

args " "
if (existf generic_uid.bin) then
    args "File generic_uid.bin already exists"
else
    args "Create object type"
    crty generic -l          
    args "Create binary object"
    crtyobj generic          
    args "Delete object type"
    dlty generic             
endif

args " "
args "Compiling driver_generic.c"
args "Be patient: may take around 15 minutes ..."
# Total run times
# big:  DN10000, 32MB RAM (1 CPU)
# c6123: DN4000, 24MB RAM
# c717:  DN3500,  8MB RAM (diskless)
# +-------+-------+-------+-------+---------+
# |       |         Times         | Size of |
# | Level |   big | c6123 |  c717 |  output |
# +-------+-------+-------+-------+---------+
# | opt 0 |  0:30 |  2:05 |  2:00 |   74970 |
# | opt 1 |  0:35 |  2:25 |  2:35 |   74430 |
# | opt 2 |  1:00 |  3:40 |       |   74378 |
# | opt 3 |  3:00 |  9:50 |       |   71242 |
# | opt 4 |  5:30 | 32:30 |       |  106474 |
# +-------+-------+-------+-------+---------+
cc driver_generic.c -pic -info 4 -cpu m68k -opt 2

args " "
args "Bind the lot"
# prsvr_driver_trait can be found in
#  /domain_examples/hardcopy/driver.
args "Ignore error messages about Undefined Globals"
# (all  First referenced in driver_generic.bin)
#   add_db_range_c
#   add_db_string_c
#   add_db_value_c
#   alloc_db
#   free_db_c
#   get_db_string_c
#   get_db_value_c
#   inq_entry_c
#   print_entries_c
#   set_db_value_c
#   spe_$pio_set_mode
bind -b generic - <<!
-allmark
driver_generic.bin
generic_uid.bin
prsvr_driver_trait
-entry generic_$initialize
-end
!

args " "
args "Delete the object file driver_generic.bin"
dlf driver_generic.bin -l

args " "
args "Done."
