home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 227_01 / graf.txt < prev    next >
Encoding:
Text File  |  1988-02-09  |  89.8 KB  |  3,829 lines

  1.  
  2.  
  3.  
  4.                        Compatible graphics library
  5.  
  6.  
  7.  
  8.                 Public Domain Compatible Graphics Library
  9.  
  10.                             The C User's Group
  11.  
  12.                                   Author
  13.                              Rainer Gerhards
  14.                              Petronellastr. 6
  15.                             D-5112 Baesweiler
  16.                                West Germany
  17.  
  18.                              Library Version
  19.                              2.1, 11/15/1987
  20.  
  21.                           Documentation Version
  22.                          2.1 (11/15/87 16:56:50)
  23.  
  24.  
  25.                        supported operating systems
  26.                       MS-DOS or PC-DOS 2.0 or higher
  27.  
  28.                           supported C compilers
  29.                               Lattice C 3.0
  30.                              Datalight C 2.23
  31.                            Borland Turbo C 1.0
  32.                               [Microsoft C]
  33.  
  34.                          supported graphics cards
  35.                     Hercules monochrome graphics card
  36.                      enhanced graphics adapter (EGA)
  37.                          IBM std. BIOS interface
  38.                     Elsa PC XXHR vector graphics board
  39.  
  40.                         supported graphics printer
  41.                           Nec pinwriter P6 / P7
  42.                        Epson TM compatible printers
  43.  
  44.                             supported plotters
  45.                           --- currently none ---
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.                                   Page 1
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                        Compatible graphics library
  71.  
  72.  
  73.  
  74.                  This document describes  the  compatible
  75.                  graphics   library   for   almost  every
  76.                  (strong   words,   I   know)   computer.
  77.                  Everybody  is  free  to  copy,  adapt or
  78.                  modify   the    listed    sources    and
  79.                  documentation.  It would be nice, if you
  80.                  copy this acknowledgment and the authors
  81.                  name and address too.
  82.                  If you have new  ideas  or  improvements
  83.                  please contact the author.
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.                                   Page 2
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                        Compatible graphics library
  137.  
  138.  
  139.  
  140.        1.  Introduction
  141.  
  142.        1.1  Design_history_and_background
  143.  
  144.        This library was first designed as a  demonstration  library
  145.        for very fast assembly language routines.  But after a while
  146.        using it, I think that this C library is much more  powerful
  147.        than  the  assembly  language  library is.  Ok, the assembly
  148.        language library is  somewhat  faster,  but  it  hasn't  the
  149.        ability  to  run  on all well-known graphics devices for the
  150.        IBM PC.  And I think it will be a horrible task to port  the
  151.        library  to a really different environment - an Unix machine
  152.        for example.  This is a much  more  easy  task  with  the  C
  153.        language library.
  154.        So this C library builds the base of a  compatible  graphics
  155.        system, which will run on a CP/M machine as well as on a big
  156.        Unix system.  Currently  only  parts  of  the  IBM  personal
  157.        computer  hardware  are  supported,  because  I own no other
  158.        hardware. I hope, that other users will help  to  make  this
  159.        library really portable and powerful.
  160.  
  161.        While the first version implemented only  the  basic  tasks,
  162.        the  current  version (2.1) has many intersting features and
  163.        is greatly enhanced above version 1.1. It is  very  nice  to
  164.        move  from  one  video device to another without source-code
  165.        changes.  I also improved the speed and memory  requirements
  166.        of  the  library  dramatically,  and so I think this version
  167.        covers a lot of serious projects.
  168.  
  169.        I hope that some of you  have  some  interesting  ideas  and
  170.        algorithms and want to tell me about them.  So I hope to get
  171.        a full praxis-driven library.  In addition, I hope that some
  172.        of  you  want  to port the low-level parts of the library to
  173.        different machines and  graphics  environments,  making  the
  174.        library  really  portable.   Everybody  should  feel free to
  175.        contact me!
  176.  
  177.        1.2  Current_features
  178.  
  179.        The  most  powerful  feature   of   the   library   is   its
  180.        compatibility  and  hardware  independency.  You may use the
  181.        library  on  many  machines,  as  long  as  there's   driver
  182.        available.  And new drivers can be very simply added.
  183.  
  184.        The library currently supports:
  185.  
  186.           - switching    between    different     display     modes
  187.             (graphics/nongraphics)
  188.  
  189.           - drawing pixels
  190.  
  191.  
  192.  
  193.  
  194.                                   Page 3
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                        Compatible graphics library
  203.  
  204.  
  205.  
  206.           - drawing lines
  207.  
  208.           - drawing polylines
  209.  
  210.           - drawing boxes
  211.  
  212.           - filling boxes with given colors (e.g. clear windows)
  213.  
  214.           - draw any ellipses in full or in part
  215.  
  216.           - paint any region on the screen with a given color.  The
  217.             region is defined by a border color.
  218.  
  219.           - you may use a global  coordinate  system,  freeing  you
  220.             from the given hardware parameters. Also very useful in
  221.             numerical applications.
  222.  
  223.           - print graphics screens as a hardcopy function.  This is
  224.             currently  limited  to  the  Hercules graphics card and
  225.             Epson compatible printers.
  226.  
  227.           - clear the graphics screen.
  228.  
  229.           - read the color of a specified pixel.
  230.  
  231.           - output text in different styles  with  user  selectable
  232.             foreground and background colors.
  233.  
  234.           - use a library error-code system. Errors occurred  while
  235.             processing  graphics  Information may be printed with a
  236.             function like perror.
  237.  
  238.           - a full turtle graphics system
  239.  
  240.           - different device  write  modes.   New  drawing  may  be
  241.             modifyed according to the old video contents (XOR them,
  242.             e. g.).
  243.  
  244.        1.3  new_features_and_enhancements_of_version_2.1
  245.  
  246.        The following new features, enhancements and bug fixes  have
  247.        been applied to the library since version 2.1:
  248.  
  249.           - A bug in the medium-level header file has  been  fixed.
  250.             The EGA-mode was defined in this header file, resulting
  251.             in bad coding sequences for  devices  other  than  EGA.
  252.             This  define  has  been moved to the right place in the
  253.             EGA low-level header file.
  254.             Note  that  the  version  1.1  distribution  disk   was
  255.             corrupted by this bug.
  256.  
  257.  
  258.  
  259.  
  260.                                   Page 4
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                        Compatible graphics library
  269.  
  270.  
  271.  
  272.           - A bad bug in herc.c, the C-part of  the  hercules  low-
  273.             level driver has been detected and removed.  Mr. Decker
  274.             of Nuernberg, West Germany reported my, that the  given
  275.             port  address  in this low-level driver were incorrect.
  276.             As a result, the switch into the hercules graphic  mode
  277.             was  unsuccessful.  I'm sorry, the Hercules emulation I
  278.             use  on  the  QuadEGA  switched  always  correctly   to
  279.             graphics  mode,  so I don't saw an error.  Sorry to all
  280.             Hercules users who only saw a black screen!   This  bug
  281.             has been corrected (two addresses, dammed!).
  282.  
  283.           - The low-level driver for the Hercules graphics card and
  284.             the EGA have been greatly improved and speeded up.  New
  285.             internal function calls have been added, resulting in a
  286.             great  speedup  of the whole library code.  This effect
  287.             is extreme in function paint and line.
  288.  
  289.           - The  hercules  low-level  driver  has  a  much   better
  290.             hardcopy  routine. The new routine optimizes the print-
  291.             output before sending it to the printer, resulting in a
  292.             great  decrease  of print-time, if the screen is nearly
  293.             blank.   The  more  information  is  presented  on  the
  294.             graphics  screen,  the  less the decrease of print time
  295.             will  be,  but  I  think  it's  really  good  for  many
  296.             applications.
  297.  
  298.           - The stack space  needed  by  function  paint  has  been
  299.             dramatically  reduced.   It now requires only about 20%
  300.             of the original space.  Also the  processing  time  has
  301.             been reduced.
  302.  
  303.           - The assembly language  macros  have  been  implemented.
  304.             Version  1.1 used the Lattice macros, which couldn't be
  305.             distributed due  to  copyright  limitations.   The  now
  306.             written  macro  package  implements  all  used  Lattice
  307.             macros in a manner, that makes moving to a new compiler
  308.             an  relatively  easy  task.  Also some macros have been
  309.             defined for this reason, which weren't  implemented  in
  310.             the  Lattice  package.   You may find the macro package
  311.             also  of  interest  for  your  own  assembly   language
  312.             routines,  the  documentation  should be good enough to
  313.             use them.  They are  not  documented  as  part  of  the
  314.             library,  because  their internal implementation is not
  315.             guaranteed to be the same in the next release.
  316.             Nevertheless, there are some parameters the  user  must
  317.             set  to  correct assemble the sources.  This parameters
  318.             are described below.
  319.  
  320.           - A new set of parameters have been added to the  medium-
  321.             /high-level header file "graphics.h".  These parameters
  322.             allows it the user to modify some  minor  configuration
  323.  
  324.  
  325.  
  326.                                   Page 5
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                        Compatible graphics library
  335.  
  336.  
  337.  
  338.             parameters.   The  usage  of  this  mechanism  will  be
  339.             described below.
  340.  
  341.           - The text-output system has been added.  It is currently
  342.             not  complete  implemented, but offers a good chance to
  343.             do most text-output jobs.
  344.  
  345.           - The new function polyline has been  added.   It  allows
  346.             the user to draw a complex figure or line with only one
  347.             function call.  It is able to work on a variable  table
  348.             which  holds line coordinates.  All the coordinates are
  349.             concatenated with a user-specified color.
  350.  
  351.           - An error system has been implemented.  Functions, which
  352.             may  detect  error  conditions  return  -1 if an actual
  353.             error occurred, 0  otherwise.   In  case  of  an  error
  354.             return,  the global variable "gr_error" may be examined
  355.             for the exact error reason.   The  function  "grperror"
  356.             has  been  added to print the error message in a human-
  357.             readable form.   It  is  much  like  perror,  but  with
  358.             increased functionality.  The error system is described
  359.             in greater detail below.
  360.  
  361.           - A complete turtle graphics system has been added.  This
  362.             system  supports  all  of  the  common  turtle graphics
  363.             commands  including  turtle  positioning,  moving   and
  364.             hiding/showing.   This  package  is  described below in
  365.             more detail.
  366.  
  367.           - A new, powerful feature has been  added:  You  now  can
  368.             specify  an  so-called  write mode.  This write mode is
  369.             applied to all pixel drawing operations.  It allows you
  370.             to  modify  the  display contents in respect to its old
  371.             state.  E. g. the old pixel color may be XORed with the
  372.             new color.
  373.  
  374.           - A basic-equivalence header file has been  added.   This
  375.             allows  it  user's  who  like  the basic names for some
  376.             graphics primitives to  use  them,  without  destroying
  377.             compatibility  to  users (and library versions), who do
  378.             not.
  379.             This feature is an idea of Michael Yokoyama of Aiea, HI
  380.             96701.
  381.  
  382.           - Some documentation bugs have been fixed and  the  whole
  383.             documentation  has  been upgraded to reflect the latest
  384.             version of the library.
  385.  
  386.           - The whole library is now maintained internally by  Unix
  387.             SCCS,  so  the  SCCS  version numbering scheme has been
  388.             adapted.  All version numbers are now starting at  one.
  389.  
  390.  
  391.  
  392.                                   Page 6
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                        Compatible graphics library
  401.  
  402.  
  403.  
  404.             The old version 1.1 has been renamed to 1.1.
  405.  
  406.           - Some minor bugs have been fixed.
  407.  
  408.        1.4  Release_compatibility
  409.  
  410.        The graphics library is upward compatible.  This means, that
  411.        programs  that  used  version  1.1  of  the library will run
  412.        without modification using version 2.1 of the library.  Note
  413.        that  not  all 2.1 functions are supported by version 1.1 of
  414.        the library, so you can not move user code from 2.1 to  1.1.
  415.        Even if it may be possible (no extended functionality used),
  416.        you should always use the  latest  version  of  the  library
  417.        because of bug fixes and execution speed.
  418.  
  419.        When moving form  version  1.1  to  2.1,  you  need  not  to
  420.        recompile  the  user  code  if  you  don't need the extended
  421.        functionality.
  422.  
  423.        Note that low-level drivers written for Version 1.1  of  the
  424.        library  are  still  functional  under  2.1.   If  this  are
  425.        assembly language drivers, they should be  upgraded  to  use
  426.        the  new  macro  support  facility.  This easies the task to
  427.        move them to other compilers.
  428.  
  429.  
  430.        2.  Library_design
  431.  
  432.        The library uses  three  logical  parts:  one  medium-level,
  433.        completely  machine  independent  graphics kernel, a medium-
  434.        level machine-independent part  and  one  low-level  machine
  435.        dependent  part.   There are header (.h) files for the high-
  436.        and low-level parts.
  437.        The user program hasn't to know which  function  resides  in
  438.        which part of the graphics library.  If it uses the official
  439.        entry points, it must be portable to any new  video  device,
  440.        if  it's  supported  by  the  library.   The available entry
  441.        points are listed under "User program interface".
  442.  
  443.        2.1  High-level_library_part
  444.  
  445.        The high-level  library  part  is  completely  hardware  and
  446.        operating  system  independent.  It's written entirely in C.
  447.        It contains all the more complex drawing operations based on
  448.        the medium- and low-level part.
  449.  
  450.        There's no need to recompile the  high-level  part  for  the
  451.        different  video  devices.   This  makes  it possible to use
  452.        loadable   device   drivers,   which   allows    dynamically
  453.        reconfiguration  of  the  user-program  for  different video
  454.        devices - all at runtime without recompilation.
  455.  
  456.  
  457.  
  458.                                   Page 7
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                        Compatible graphics library
  467.  
  468.  
  469.  
  470.        Currently this feature isn't implemented and there aren't  a
  471.        lot of functions in the high-level category.
  472.  
  473.        2.2  medium-level_library_part
  474.  
  475.        This part  was  called  high-level  in  version  1.1.   It's
  476.        written  completely  in  C.   It  includes  all the graphics
  477.        primitives like line drawing, area filling and so on.   This
  478.        part  uses  no  direct hardware parameters or interfaces. It
  479.        uses  standardized  interfaces  to  the  low-level  routines
  480.        instead.  If you need special coding for special hardware or
  481.        greater speed, you may include this coding  in  the  medium-
  482.        level  part,  but  use  conditional  compilation  to keep it
  483.        portable.
  484.        Though this part is hardware independent,  it  needs  to  be
  485.        recompiled  for  every  new  video device.  The medium-level
  486.        part must know some  common  hardware  parameters  like  the
  487.        screen  resolution.   Also  there  is different coding to be
  488.        activated for different  devices.   This  ensures  the  best
  489.        throughput  by  using  hardware-specific  features  and also
  490.        ensures  compatibility  by  also  implementing  a   general,
  491.        sometimes slower routine.
  492.  
  493.        To perform the recompilation successfully  the  medium-level
  494.        routines  uses  the  information  contained in the low-level
  495.        header files.  So it's very important, that every new device
  496.        defines  it's  hardware  parameters  in  it's  corresponding
  497.        header-file.  There must also  for  every  device  a  unique
  498.        mode-identifier  be  defined.  This identifier allows it the
  499.        medium-level routines to use special hardware  features  but
  500.        remain compatible.
  501.  
  502.        2.3  Low-level_library_part
  503.  
  504.        The low-level part is written in C and assembler.   This  C-
  505.        coding must use non-standard functions1 to perform its work.
  506.        A  recompilation  of this parts with different compilers may
  507.        be difficult.  Only tasks, which couldn't be performed in  C
  508.        are  written  in  assembler.  These are most common only the
  509.        write and read pixel functions.  As many coding as  possible
  510.        should be written in C!
  511.  
  512.  
  513.  
  514.        __________
  515.  
  516.         0. device is here used as an alias for the low-level device
  517.            driver functions.
  518.  
  519.         1. like hardware port I/O
  520.  
  521.  
  522.  
  523.  
  524.                                   Page 8
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                        Compatible graphics library
  533.  
  534.  
  535.  
  536.        The low-level functions  are  called  very  often  from  the
  537.        medium-level  routines,  especially the read and write pixel
  538.        functions.  To guarantee a good throughput, these  functions
  539.        should  be  optimized.   It is a good practice, to look very
  540.        sceptic to these  two  functions  and  the  whole  low-level
  541.        driver.
  542.  
  543.        The low-level routines may implement as  many  functions  as
  544.        possible,  but the user program should only use the standard
  545.        functions of the low-level part.  These are  listed  in  the
  546.        chapter   "User   program  interface".   Using  non-standard
  547.        functions may cause incompatibilities, because some hardware
  548.        may not be able to perform specific tasks.
  549.        The list of accessible low-level functions may grew  in  the
  550.        future,  but  it  must be granteed that almost every current
  551.        video device2 is able to perform the task.  An  example  for
  552.        such  tasks may by bytewise addressing of the video memory -
  553.        but is this identical on all video devices? I think no.   So
  554.        it's  a  better practice to add new or optimize old high- or
  555.        medium-level functions.  They are much more flexible.
  556.  
  557.        2.4  Stages_of_compatibility
  558.  
  559.        The implementation goal of this library  was  (and  is)  her
  560.        great  compatibility  on  a  wide range of machines.  Though
  561.        this goal is  currently  reached  nearly  100%  in  the  DOS
  562.        environment,  the  design process showed that there are some
  563.        useful functions which can only be implemented on many,  but
  564.        not all devices.  An example for such functions is the video
  565.        pages system.  On systems, where is no direct access to  the
  566.        video  memory information, the execution time needed to read
  567.        a full screen via the read pixel function is much  to  large
  568.        to  allow  a  page change.  But this function is very useful
  569.        and can be implemented on many video devices.  If you strict
  570.        exclude  such  functions,  which can't be implemented an all
  571.        devices, you can't implement a graphics paging system.   But
  572.        if  you  implement this system only on devices which support
  573.        them, you destroy the whole compatibility.
  574.        So  I  decided  to  declare  a  class  of  "pseudo-portable"
  575.        functions:   These  functions  are available on almost every
  576.        video device, but return an error value to the caller.3 This
  577.        value  may  say  the  following:  "This  function  can't  be
  578.  
  579.  
  580.        __________
  581.  
  582.         2. These are not only DOS devices - remember the other
  583.            popular systems like Apple Mac and Unix systems.
  584.  
  585.         3. using the now implemented error system.
  586.  
  587.  
  588.  
  589.  
  590.                                   Page 9
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                        Compatible graphics library
  599.  
  600.  
  601.  
  602.        performed  by   this   video   device!".    It's   now   the
  603.        responsibility  of  the  user  program  to  make use of this
  604.        information and react correctly.  Note that there is a great
  605.        difference  between  this implementation philosophy and "not
  606.        to implement" the feature.  An error  message  may  also  be
  607.        generated if the feature is available with the current video
  608.        devices, but there are not enough resources available to use
  609.        it  (not  enough  memory,  e.  g.).  So the user program has
  610.        always to look and react at the error codes.
  611.  
  612.        Though this  is  a  way  of  implementing  hardware-specific
  613.        features  in this library, I think it should only be used on
  614.        limited tasks, which should be common to many video devices.
  615.        There  should  be as less functions which use such hardware-
  616.        specific features as possible!
  617.  
  618.  
  619.        3.  Installation_of_the_library
  620.  
  621.        This section covers the whole  installation  process,  which
  622.        must  performed  by you in order to get the library working.
  623.        To ease this task, only the  pure  installation  process  is
  624.        described,  not the way to make the library suit your meets.
  625.        This task is covered in the section "Modifying the library",
  626.        where   useful   information  about  extended  configuration
  627.        parameters can be found.
  628.        But be warned: this section was intended for  use  by  those
  629.        who  want  to  part the library to a new environment or make
  630.        serious changes.  The information presented  there  is  very
  631.        technical.
  632.  
  633.        3.1  Bringing_up_the_library
  634.  
  635.        The following files are guaranteed to be on the distribution
  636.        disc.
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.                                  Page 10
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                        Compatible graphics library
  665.  
  666.  
  667.  
  668.        File name       file description
  669.        graf.s          This documentation file in nroff
  670.                        source code format.
  671.        graf.txt        This documentation file as pure
  672.                        ASCII text.
  673.        readme.doc      Contains latest information, which
  674.                        is not included in this document.
  675.        grafturt.c      First part of the high-level library part,
  676.                        contains the turtle graphics system.
  677.        graf.c          First part of the medium-level library
  678.                        part.
  679.        graftext.c      Second part of the medium-level library
  680.                        part.
  681.        herc.c          First part of the hercules low-level
  682.                        driver
  683.        herca.asm       Second part of the hercules low-level
  684.                        driver.
  685.        ega.c           First part of the ega low-level driver.
  686.        egaa.asm        Second part of the ega low-level
  687.                        driver.
  688.        bios.c          Standard BIOS low-level driver.
  689.        xxhr.c          Driver for the Elsa PC XXHR graphics card.
  690.        btrigtab.c      Program to build trigonometric tables.
  691.        graphics.h      High-level header file.
  692.        herc.h          Low-level hercules device header file.
  693.        ega.h           Low-level ega device header file.
  694.        bios.h          Low-level BIOS header file.
  695.        xxhr.h          Low-level xxhr header file.
  696.        dos.mac         Macro file for the assembly language
  697.                        modules.
  698.        allglob.h       Header file for programs, which want to use
  699.                        the world coordinate system only.
  700.        basnames.h      Basic equivalence macros. For users who
  701.                        like basic function names.
  702.        stdfont.h       Standardfont for use by graftext.c.
  703.        trigtab.h       Precomputed trigonometric tables. Should be
  704.                        rebuild on the target machine using btrigtab.c.
  705.        blddsk.bat      MS-DOS library disk build routine.
  706.  
  707.        This file list may be extended in the future.
  708.  
  709.        The distribution disk shipped to you may contain  additional
  710.        object (.obj) files.  Especially the assembly language files
  711.        will come per-assembled, because not everybody will  own  an
  712.        assembler.
  713.        But the availability of object files will  be  depending  on
  714.        the  free space on the distribution disk.  I try to copy all
  715.        object files for every supported compiler and  memory  model
  716.        to  the  distribution  disk.   But these files need a lot of
  717.        space, so it can't be guaranteed that these files will be on
  718.        the disk.
  719.  
  720.  
  721.  
  722.                                  Page 11
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                        Compatible graphics library
  731.  
  732.  
  733.  
  734.        Look  at  the  file  "readme.doc"  for  the   current   file
  735.        organization on the distribution disk.
  736.  
  737.        To install, you have first to copy all the  files  you  need
  738.        from  the  distribution  disk to either a new floppy or your
  739.        working directory on your hard-disk.  You need at least  the
  740.        high-  and medium-level source code and header files and one
  741.        complete (C  and  ASM  source  and  header  file)  low-level
  742.        driver.
  743.        If the objects for your compiler and memory model are on the
  744.        distribution  disk,  the  installation  is  done and you can
  745.        begin using the library.  If not, you have  to  compile  the
  746.        source  files  with  your compiler.  If your compiler is not
  747.        currently  supported  by  the  library,  switch  to  section
  748.        "Modifying  the  library", where some useful information for
  749.        the port to a new compiler can be  found.   Also  switch  to
  750.        this section, if you want to make some configuration changes
  751.        to the library.
  752.        To compile the  delivered  version  of  the  library,  first
  753.        choose  which  graphics  device  do  you want to use.  After
  754.        that, copy the corresponding low-level header to the generic
  755.        low-level  header file "graf.h".  After that, simply compile
  756.        the high- and medium-level library files  as  listed  above.
  757.        Than  compile  the  low-level file and assemble the assembly
  758.        language part of the low-level driver, if given.
  759.        Note that you have to modify  the  file  "dos.mac"  to  your
  760.        requirements  to  perform  the assembly successful.  See the
  761.        following subsection "Configuring dos.mac"  for  information
  762.        about this task.
  763.        You should combine the resulting object files  to  a  single
  764.        library, which simplifies the link-procedure.
  765.        If you need multiple memory model support, perform the above
  766.        steps for each memory model you selected to use.
  767.  
  768.        After doing the compilations, you may have  to  modify  your
  769.        link-batchfiles.  For  example, the Lattice C compiler comes
  770.        with 8 batchfiles named LINKS, LINKD, LINKP, LINKL,  LINKMS,
  771.        LINKMD,  LINKMP,  and  LINKML.  These batchfiles don't allow
  772.        you to specify your own librarys. You have  to  modify  them
  773.        like in the following example:
  774.  
  775.        LINKS contains:
  776.        link /lc/s/c +%1 %2,%1,%1/map,/lc/s/lc
  777.  
  778.        You modify this to:
  779.        link /lc/s/c +%1 %2,%1,%1/map,/lc/s/lc+"name of your graphic library"
  780.  
  781.        Note: Slash (/) were used as path delimiter!
  782.  
  783.        After you have done this, you are ready to use the library.
  784.  
  785.  
  786.  
  787.  
  788.                                  Page 12
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                        Compatible graphics library
  797.  
  798.  
  799.  
  800.        If you use the a compiler with cc-like  utility  (integrated
  801.        compile/link),  just  name your library on the command line.
  802.        It will be automatically included in the link procedure.
  803.  
  804.        3.2  Configuring_dos.mac
  805.  
  806.        The assembly routines need to know about the environment, in
  807.        which  they  have  to  execute.  They have to know about the
  808.        calling  compiler  and  the   memory   model   used.    This
  809.        environmental data is kept in file dos.mac.
  810.        In order to  successful  reassemble  the  assembly  language
  811.        files,  you  have  to  modify  file  "dos.mac"  so  that  it
  812.        represents the execution environment you decided to use.  In
  813.        order  to  ease  this job, there are predefined tags in file
  814.        "dos.mac".  The following display  list  is  extracted  from
  815.        dos.mac and lists these tags and gives a brief description.
  816.  
  817.        ;
  818.        ;       Define Memory-model to use
  819.        ;       --------------------------
  820.        ;       Equate the memory model to use to 1, all others to 0.
  821.        ;
  822.        S_MODEL equ     1
  823.        D_MODEL equ     0
  824.        P_MODEL equ     0
  825.        L_MODEL equ     0
  826.  
  827.        ;
  828.        ;       Define C-compiler to use
  829.        ;       ------------------------
  830.        ;       Equate the label, that describes your C-compiler to his current
  831.        ;       version (major version number * 10 + 1st digit of minor version
  832.        ;       number). All other labels must be equated to 0.
  833.        ;
  834.        LC      equ     0                       ; Lattice C
  835.        DLC     equ     22                      ; Datalight C V. 2.2x
  836.        MSC     equ     0                       ; Microsoft C  NOT TESTED
  837.        TC      equ     0                       : Borland Turbo C
  838.  
  839.        As listed above, you have to equate the memory model to  use
  840.        to  1, all others to 0.  If your compiler supports different
  841.        memory models, select one of  the  above  according  to  the
  842.        following table:
  843.  
  844.        Model   Code    Data
  845.        S       64K     64K
  846.        P       unlmtd  64K
  847.        D       64K     unlmtd
  848.        L       unlmtd  unlmtd
  849.  
  850.        The equate of your compiler  to  his  version  number  makes
  851.  
  852.  
  853.  
  854.                                  Page 13
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                        Compatible graphics library
  863.  
  864.  
  865.  
  866.        calling-sequence  changes4  transparent  to   the   graphics
  867.        library.
  868.        Note that these configuration tags will be extensive  error-
  869.        checked  and  all  detected  errors  will be reported during
  870.        assembly.  Nevertheless, you should be very carefully,  when
  871.        modifying  these  parameters,  because not all errors can be
  872.        detected (e. g. wrong memory model chosed).
  873.  
  874.        Be aware of the fact, that the MSC macros aren't tested yet.
  875.        I  think  the work, but I've currently no access to MSC.  So
  876.        expect some trouble if you decide to use the MSC driver.
  877.  
  878.  
  879.        4.  User_program_interface
  880.  
  881.        4.1  Header_files
  882.  
  883.        The user program interface is defined in the various  header
  884.        (.h)  files.   There  are two classes of header files: First
  885.        ONE (and only  one)  header  file  defining  the  high-  and
  886.        medium-level functions and constants.
  887.        This header file is named "graphics.h".
  888.        Second there are many header files  defining  the  low-level
  889.        functions and constants.
  890.  
  891.        These low-level header files may be used  in  two  different
  892.        ways:
  893.        First you may include the device dependent header  files  by
  894.        name,  e.  g.   "hercgraf.h" for the Hercules graphics card.
  895.        This  way  has  the   disadvantage   of   missing   hardware
  896.        independency  of  the  user  code.  If you want to move to a
  897.        different video device, you have first to change the  header
  898.        file names in all of your sources.
  899.        The second way to use the  header  files  is  to  include  a
  900.        generic  filename,  e. g.   "graf.h".  You may copy than the
  901.        correct header file (e. g.  "hercgraf.h")  to  this  generic
  902.        file.  If you want to switch another video device, just copy
  903.        the new header file to the generic file.  There  is  nothing
  904.        more to do, no code must be changed!
  905.  
  906.        I think this second method is much better and should  always
  907.        be  used.   The  medium-  and  high-level  routines use this
  908.        method too5.  To aid you in using this "good"6  method,  the
  909.  
  910.  
  911.        __________
  912.  
  913.         4. that may occur during compiler development
  914.  
  915.         5. See "Modifying the library"
  916.  
  917.  
  918.  
  919.  
  920.                                  Page 14
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                        Compatible graphics library
  929.  
  930.  
  931.  
  932.        medium-level header file does a #include "graf.h".   If  you
  933.        don't want this, please  do  a  #define  NOLLHINC  7  before
  934.        #including the high level header file.
  935.  
  936.        4.2  Available_function_calls
  937.  
  938.        The following  is  a  brief  description  of  the  available
  939.        function  calls.  It is guaranteed that these functions will
  940.        work in every implementation.
  941.        Each function is listed with  her  name,  parameters  and  a
  942.        description.   These  information  can  also be found in the
  943.        sources, from where it  is  extracted.   If  you  need  more
  944.        information   about  a  particular  function,  look  at  the
  945.        sources.  There can be much more information found  than  in
  946.        this  document.   But  beware of the fact, that the internal
  947.        algorithms are subject to change without notice!
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.        ____________________________________________________________
  978.  
  979.         6. hope you think so too
  980.  
  981.         7. NO Low-Level Header file INClude
  982.  
  983.  
  984.  
  985.  
  986.                                  Page 15
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                        Compatible graphics library
  995.  
  996.  
  997.  
  998.        4.2.1  Box_function
  999.  
  1000.        name           box
  1001.  
  1002.        class          medium-level
  1003.  
  1004.        synopsis       box(x1, y1, x2, y2, color);
  1005.                       int x1, y1;            upper left corner
  1006.                       int x2, y2;            lower right corner
  1007.                       int color;             border color
  1008.  
  1009.        description    This function draws a border of "color" covering the
  1010.                       given box. The box is specified through the upper
  1011.                       left (x1, y1) and to lower right (x2, y2) corner. The
  1012.                       box itself isn't modified (e. g. must be cleared
  1013.                       explicitly).
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.                                  Page 16
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                        Compatible graphics library
  1061.  
  1062.  
  1063.  
  1064.        4.2.2  circle_function
  1065.  
  1066.        name           circle
  1067.  
  1068.        class          medium-level
  1069.  
  1070.        synopsis       circle(x, y, radius, color, aspect)
  1071.                       int x, y;              center coordinate
  1072.                       int radius;            circle radius
  1073.                       int color;             circle color
  1074.                       float aspect;          aspect ratio
  1075.  
  1076.        description    This function draws a circle according to the
  1077.                       given parameters.  Note that this function is
  1078.                       only capable of drawing a full circle.
  1079.  
  1080.        see also       ellipsis
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.                                  Page 17
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                        Compatible graphics library
  1127.  
  1128.  
  1129.  
  1130.        4.2.3  convxco_function
  1131.  
  1132.        name           convxco
  1133.  
  1134.        class          medium-level
  1135.  
  1136.        synopsis       locx = convxco(x)
  1137.                       float x      x coordinate to convert
  1138.                       int locx     hardware x coordinate
  1139.  
  1140.        description    This function converts a global coordinate to
  1141.                       a  local,  hardware dependent coordinate. Its
  1142.                       return value may be directly passed to  other
  1143.                       functions.
  1144.  
  1145.        see also       convyco, convxdis, convydis
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.                                  Page 18
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                        Compatible graphics library
  1193.  
  1194.  
  1195.  
  1196.        4.2.4  convxdis_function
  1197.  
  1198.        name           convxdis
  1199.  
  1200.        class          medium-level
  1201.  
  1202.        synopsis       locxdist = convxdis(xdis)
  1203.                       double xdis  distance to convert
  1204.                       int locxdist hardware distance
  1205.  
  1206.        description    This function converts a global x distance to
  1207.                       a  local, hardware dependent x distance.  Its
  1208.                       return value may be directly passed to  other
  1209.                       functions.
  1210.  
  1211.        see            convxco, convyco, convydis
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.                                  Page 19
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                        Compatible graphics library
  1259.  
  1260.  
  1261.  
  1262.        4.2.5  convyco_function
  1263.  
  1264.        name           convyco
  1265.  
  1266.        class          medium-level
  1267.  
  1268.        synopsis       locy = convyco(y)
  1269.                       float y      y coordinate to convert
  1270.                       int locy     hardware y coordinate
  1271.  
  1272.        description    This function converts a global coordinate to
  1273.                       a  local,  hardware dependent coordinate. Its
  1274.                       return value may be directly passed to  other
  1275.                       functions.
  1276.  
  1277.        see also       convxco, convxdis, convydis
  1278.  
  1279.        4.2.6  convydis_function
  1280.  
  1281.        name           convydis
  1282.  
  1283.        class          medium-level
  1284.  
  1285.        synopsis       locydist = convydis(ydis)
  1286.                       double ydis  distance to convert
  1287.                       int locydist hardware distance
  1288.  
  1289.        description    This function converts a global y distance to
  1290.                       a  local, hardware dependent y distance.  Its
  1291.                       return value may be directly passed to  other
  1292.                       functions.
  1293.  
  1294.        see            convxco, convyco, convxdis
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.                                  Page 20
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                        Compatible graphics library
  1325.  
  1326.  
  1327.  
  1328.        4.2.7  ellipsis_function
  1329.  
  1330.        name           ellipsis
  1331.  
  1332.        class          medium-level
  1333.  
  1334.        synopsis       ellipsis(x, y, rx, ry, ws, we, color)
  1335.                       int x, y      center coordinate
  1336.                       int rx        x - 'radius'
  1337.                       int ry        y - 'radius'
  1338.                       int ws        begin angle 0..360
  1339.                       int we        end  angle 0..360
  1340.                       int color     line color
  1341.  
  1342.        description    This function draws any sort of ellipsis.  It
  1343.                       is often called circle, but I think this name
  1344.                       should better be  reserved  for  a  function,
  1345.                       which  only  draws a FULL circle (see above).
  1346.                       This function may not only draw a  circle  or
  1347.                       any  possible ellipsis, it is also capable of
  1348.                       drawing only parts of.  them. This feature is
  1349.                       often  used  in  pie-charts.  Because  of its
  1350.                       great  flexibility,  this  function  is  much
  1351.                       slower  than  circle. If you only want a full
  1352.                       circle (or ellipsis) you should call circle.
  1353.  
  1354.        see also       circle, fellipsis
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.                                  Page 21
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                        Compatible graphics library
  1391.  
  1392.  
  1393.  
  1394.        4.2.8  fellipsis_function
  1395.  
  1396.        name           fellipsis
  1397.  
  1398.        class          medium-level
  1399.  
  1400.        synopsis       fellipsis(x, y, rx, ry, ws, we, color)
  1401.                       int x, y      center coordinate
  1402.                       int rx        x - 'radius'
  1403.                       int ry        y - 'radius'
  1404.                       int ws        begin angle 0..360
  1405.                       int we        end  angle 0..360
  1406.                       int color     line color
  1407.  
  1408.        description    This function is much  like  ellipsis(),  but
  1409.                       it's  faster because it uses only full angles
  1410.                       to  draw  the  ellipsis.   Note   that   this
  1411.                       function produces good results only for small
  1412.                       radius-values.
  1413.  
  1414.        also           ellipsis, circle
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.                                  Page 22
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                        Compatible graphics library
  1457.  
  1458.  
  1459.  
  1460.        4.2.9  fillbox_function
  1461.  
  1462.        name           fillbox
  1463.  
  1464.        class          medium-level
  1465.  
  1466.        synopsis       fillbox(x1, y1, x2, y2, color);
  1467.                       int x1, y1;            upper left corner
  1468.                       int x2, y2;            lower right corner
  1469.                       int color;             fill color
  1470.  
  1471.        description    This function fills  a  given  box  with  the
  1472.                       specified   color.    The  box  is  specified
  1473.                       through the upper left (x1, y1) and the lower
  1474.                       right  (x2, y2) corner.  This function is the
  1475.                       counterpart to box, which draws the border.
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.                                  Page 23
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                        Compatible graphics library
  1523.  
  1524.  
  1525.  
  1526.        4.2.10  getpixel_function
  1527.  
  1528.        name           getpixel
  1529.  
  1530.        class          low-level
  1531.  
  1532.        synopsis       color = getpixel(x, y);
  1533.                       int x, y;       coordinate of the pixel
  1534.                       int color;      returned color of that pixel
  1535.  
  1536.        description    This function reads ("gets") the color  of  a
  1537.                       specified pixel.
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.                                  Page 24
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                        Compatible graphics library
  1589.  
  1590.  
  1591.  
  1592.        4.2.11  grperror_-_print_last_error
  1593.  
  1594.        name           grperror
  1595.  
  1596.        class          medium-level
  1597.  
  1598.        synopsis       grperror(fil);
  1599.                       FILE *fil;      file to put error-message in (or NULL if
  1600.                                       to put on current display).
  1601.                       char *msg;      error-message header text (like perror).
  1602.  
  1603.        description    This function prints the last detected  error
  1604.                       that  occurred  in  the graphics library.  It
  1605.                       has the ability to write to a user text  file
  1606.                       or to the current graphics screen. Writing to
  1607.                       a file may be useful for not destroying  your
  1608.                       graphics display. You chose between this both
  1609.                       modes by your file pointer: if  it  is  NULL,
  1610.                       the function writes to the display, otherwise
  1611.                       it uses your file pointer to  write  to  that
  1612.                       file.   No  write  errors  are reported.  The
  1613.                       function  writes  first  the   user-specified
  1614.                       message, than the internal error-message.
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.                                  Page 25
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                        Compatible graphics library
  1655.  
  1656.  
  1657.  
  1658.        4.2.12  gt_backw_function
  1659.  
  1660.        name           gt_backw
  1661.  
  1662.        class          high-level
  1663.  
  1664.        synopsis       gt_backw(count)
  1665.                       int count;      count to move backward
  1666.  
  1667.        description    This function is  the  opposite  to  function
  1668.                       gt_forwd.   It moves the turtle the specified
  1669.                       position in backward direction.
  1670.  
  1671.        see            gt_forwd
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682.  
  1683.  
  1684.  
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.                                  Page 26
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                        Compatible graphics library
  1721.  
  1722.  
  1723.  
  1724.        4.2.13  gt_dir_function
  1725.  
  1726.        name           gt_dir
  1727.  
  1728.        class          high-level
  1729.  
  1730.        synopsis       gt_dir(degrees);
  1731.                       int degrees;      new turtle direction in degrees.
  1732.  
  1733.        description    This  function  sets  the   absolute   turtle
  1734.                       direction  in  degrees for further moves.  If
  1735.                       the value contained in "degrees" is  invalid,
  1736.                       it  will  be converted into the range 0..359.
  1737.                       Negative degrees will be correctly  converted
  1738.                       to their positive counterpart.
  1739.  
  1740.        see            gt_tleft, gt_trgth
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.                                  Page 27
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                        Compatible graphics library
  1787.  
  1788.  
  1789.  
  1790.        4.2.14  gt_forwd_function
  1791.  
  1792.        name           gt_forwd
  1793.  
  1794.        class          high-level
  1795.  
  1796.        synopsis       gt_forwd(count)
  1797.                       int count;      count to move forward
  1798.  
  1799.        description    This function moves the  turtle  forward  the
  1800.                       specified   count   of  'logical'  pixel  (or
  1801.                       backward, if negative).
  1802.  
  1803.        see            gt_backw
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.                                  Page 28
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                        Compatible graphics library
  1853.  
  1854.  
  1855.  
  1856.        4.2.15  gt_hide_function
  1857.  
  1858.        name           gt_hide
  1859.  
  1860.        class          high-level
  1861.  
  1862.        synopsis       gt_hide();
  1863.  
  1864.        description    The  turtle   isn't   shown   after   drawing
  1865.                       operations if this function is called.
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.                                  Page 29
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                        Compatible graphics library
  1919.  
  1920.  
  1921.  
  1922.        4.2.16  gt_home_function
  1923.  
  1924.        name           gt_home
  1925.  
  1926.        class          high-level
  1927.  
  1928.        synopsis       gt_home();
  1929.  
  1930.        description    This function sets the  turtle  to  the  home
  1931.                       position.   After  this  function  call,  the
  1932.                       turtle will be located at  (0,0)  (middle  of
  1933.                       screen) and points in upward direction.
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.                                  Page 30
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                        Compatible graphics library
  1985.  
  1986.  
  1987.  
  1988.        4.2.17  gt_init_function
  1989.  
  1990.        name           gt_init
  1991.  
  1992.        class          high-level
  1993.  
  1994.        synopsis       gt_init();
  1995.  
  1996.        description    This function initializes the turtle-graphics
  1997.                       package.   It  clears the graphics screen and
  1998.                       initializes the global  to  local  coordinate
  1999.                       system  with  the default turtle window size.
  2000.                       All turtle  parameters  are  reset  to  their
  2001.                       defaults, which are as follows:
  2002.  
  2003.  
  2004.                       - turtle position                    (0,0)
  2005.                       - turtle direction                    0
  2006.                       - turtle visible                      no
  2007.                       - turtle delay                        none
  2008.                       - turtle window                       -400,200,400,-200
  2009.                       - turtle pen up                       no
  2010.                       - turtle pen color                    1
  2011.  
  2012.  
  2013.                       Note: This function MUST be called before any
  2014.                       other  turtle  graphics function. If it's not
  2015.                       called, the other function  may  crash.  This
  2016.                       function  MAY  be called at any time to reset
  2017.                       the turtle graphics system.
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.                                  Page 31
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.                        Compatible graphics library
  2051.  
  2052.  
  2053.  
  2054.        4.2.18  gt_pcolr_function
  2055.  
  2056.        name           gt_pcolr
  2057.  
  2058.        class          high-level
  2059.  
  2060.        synopsis       gt_pcolr(color);
  2061.                       color;        new pen color
  2062.  
  2063.        description    This function sets the turtle pen color.  All
  2064.                       further drawing will use the specified color.
  2065.  
  2066.                       Note: The pen status is not modified,  so  if
  2067.                       the  pen  is  lift  up,  no drawing will take
  2068.                       place.
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.                                  Page 32
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                        Compatible graphics library
  2117.  
  2118.  
  2119.  
  2120.        4.2.19  gt_pendn_function
  2121.  
  2122.        name           gt_pendn
  2123.  
  2124.        class          high-level
  2125.  
  2126.        synopsis       gt_pendn();
  2127.  
  2128.        description    This function lifts the turtle pen  down,  so
  2129.                       that   a   line  will  be  drawn  by  further
  2130.                       movements. The pen may be lift up by function
  2131.                       gt_penup.
  2132.  
  2133.        note           It is not reported as error, if the  function
  2134.                       is  called  while  the  turtle pen is already
  2135.                       lift down.
  2136.  
  2137.        see            gt_penup
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.                                  Page 33
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                        Compatible graphics library
  2183.  
  2184.  
  2185.  
  2186.        4.2.20  gt_penup_function
  2187.  
  2188.        name           gt_penup
  2189.  
  2190.        class          high-level
  2191.  
  2192.        synopsis       gt_penup();
  2193.  
  2194.        description    This function lifts the  turtle  pen  up,  so
  2195.                       that   no  line  will  be  drawn  by  further
  2196.                       movements.  The  pen  may  be  lift  down  by
  2197.                       function gt_pendn.
  2198.  
  2199.        note           It is not reported as error, if the  function
  2200.                       is  called  while  the  turtle pen is already
  2201.                       lift up.
  2202.  
  2203.        see            gt_pendn
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.                                  Page 34
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.                        Compatible graphics library
  2249.  
  2250.  
  2251.  
  2252.        4.2.21  gt_setco_function
  2253.  
  2254.        name           gt_setco
  2255.  
  2256.        class          high-level
  2257.  
  2258.        synopsis       gt_setco(x, y);
  2259.                       int x,y;     new turtle coordinates.
  2260.  
  2261.        description    This function sets the turtle  to  the  given
  2262.                       position.  The  position is a turtle graphics
  2263.                       coordinate.   No   line   is    draw    while
  2264.                       repositioning the turtle.
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.                                  Page 35
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.                        Compatible graphics library
  2315.  
  2316.  
  2317.  
  2318.        4.2.22  gt_show_function
  2319.  
  2320.        name           gt_show
  2321.  
  2322.        class          high-level
  2323.  
  2324.        synopsis       gt_show();
  2325.  
  2326.        description    The  turtle  is  shown  after  each   drawing
  2327.                       operation if this function is called.
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.                                  Page 36
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.                        Compatible graphics library
  2381.  
  2382.  
  2383.  
  2384.        4.2.23  gt_tleft_function
  2385.  
  2386.        name           gt_tleft
  2387.  
  2388.        class          high-level
  2389.  
  2390.        synopsis       gt_tleft(degrees);
  2391.                       int degrees;      turtle rotate count in degrees
  2392.  
  2393.        description    This function  rotates  the  turtle  in  left
  2394.                       direction,  using  the rotate count specified
  2395.                       in degrees. Negative counts  mean  rotate  to
  2396.                       right position.
  2397.  
  2398.        see            gt_trght, gt_dir
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.                                  Page 37
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.                        Compatible graphics library
  2447.  
  2448.  
  2449.  
  2450.        4.2.24  gt_trght_function
  2451.  
  2452.        name           gt_trght
  2453.  
  2454.        class          high-level
  2455.  
  2456.        synopsis       gt_tleft(degrees);
  2457.                       int degrees;      turtle rotate count in degrees
  2458.  
  2459.        description    This function rotates  the  turtle  in  right
  2460.                       direction,  using  the rotate count specified
  2461.                       in degrees. Negative counts  mean  rotate  to
  2462.                       left position.
  2463.  
  2464.        see            gt_dir, gt_tleft
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.                                  Page 38
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.                        Compatible graphics library
  2513.  
  2514.  
  2515.  
  2516.        4.2.25  gt_usrmv_function
  2517.  
  2518.        name           gt_usrmv
  2519.  
  2520.        class          high-level
  2521.  
  2522.        synopsis       gt_usrmv(speedtab);
  2523.                       int *speedtab;      speed table for moves.
  2524.  
  2525.        description    This function allows it the program  to  give
  2526.                       the  user  control over turtle movement.  The
  2527.                       function accepts single  keystroke  commands.
  2528.                       The  commands are not echoed.  The caller may
  2529.                       supply a  table  of  speed  values  for  each
  2530.                       supported speed (0 .. 9). This table consists
  2531.                       of  10  int-type  entries,  which  holds  the
  2532.                       movement entity in the selected speed. If the
  2533.                       user wishes to use the default  speed  table,
  2534.                       he  must  supply  a  NULL  pointer.  Commands
  2535.                       available:
  2536.  
  2537.                       0 .. 9 : select turtle speed.
  2538.                       n      : turtle direction north
  2539.                       e      : turtle direction east
  2540.                       w      : turtle direction west
  2541.                       s      : turtle direction south
  2542.                       h      : home turtle
  2543.                       b      : move turtle backward
  2544.                       f      : move turtle forward
  2545.                       l      : turn turtle left 1 degree
  2546.                       L      : turn turtle left 5 degrees
  2547.                       r      : turn turtle right 1 degree
  2548.                       R      : turn turtle right 5 degrees
  2549.                       g      : go, change no direction
  2550.                       q      : quit this function
  2551.  
  2552.  
  2553.                       Note: The turtle system must  be  initialized
  2554.                       before  calling  this  function.  The current
  2555.                       state of the turtle  system  is  not  altered
  2556.                       before  execution,  so  all parameters are as
  2557.                       set by you.
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.                                  Page 39
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.                        Compatible graphics library
  2579.  
  2580.  
  2581.  
  2582.        4.2.26  gtgetdir_function
  2583.  
  2584.        name           gtgetdir
  2585.  
  2586.        class          high-level
  2587.  
  2588.        synopsis       degrees = gtgetdir();
  2589.                       int degrees;      current turtle direction in degrees.
  2590.  
  2591.        description    This  function  returns  the  current  turtle
  2592.                       position in degrees.  The returned value will
  2593.                       be in range 0 .. 359.
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610.  
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.                                  Page 40
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.                        Compatible graphics library
  2645.  
  2646.  
  2647.  
  2648.        4.2.27  Line_function
  2649.  
  2650.        name           line
  2651.  
  2652.        class          medium-level
  2653.  
  2654.        synopsis       line(x1, y1, x2, y2, color);
  2655.                       int x1, y1;            starting coordinate
  2656.                       int x2, y2;            ending coordinate
  2657.                       int color;             line color
  2658.  
  2659.        description    This function draws a line of "color" between
  2660.                       the  starting  (x1,  y1)  and ending (x2, y2)
  2661.                       coordinate.
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.                                  Page 41
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.                        Compatible graphics library
  2711.  
  2712.  
  2713.  
  2714.        4.2.28  paint_function
  2715.  
  2716.        name           paint
  2717.  
  2718.        class          medium-level
  2719.  
  2720.        synopsis       paint(x, y, paintclr, border)
  2721.                       int x, y;       coordinate of a point within the area
  2722.                       int paintclr;   the color used to paint
  2723.                       int border;     is the color of the border defining the
  2724.                                       area
  2725.  
  2726.        description    This function paints an  area.  The  area  is
  2727.                       defined  by  a  border  of  a specified color
  2728.                       ("border") and the coordinate  of  one  pixel
  2729.                       within  the  area  (x,  y). The color used to
  2730.                       paint is given in "paintclr".  This  function
  2731.                       uses  several  subroutines  and  a  recursive
  2732.                       algorithm! It's only the  "initializer",  the
  2733.                       main work is performed by the other Routines.
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.                                  Page 42
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.                        Compatible graphics library
  2777.  
  2778.  
  2779.  
  2780.        4.2.29  polyline_function_-_draw_complex_lines          This
  2781.        function  may  be  used  to draw charts or complex geometric
  2782.        figures.
  2783.  
  2784.        name           polyline
  2785.  
  2786.        class          medium-level
  2787.  
  2788.        synopsis       ret = polyline(color, coords, ...)
  2789.                       int ret;     0 on success, -1 otherwise.
  2790.                       int color    color of the line
  2791.                       int coords   coordinate list (x, y), ends with -1, -1
  2792.  
  2793.        description    This function draws a polyline. That means  a
  2794.                       line,  which is made of multiple coordinates.
  2795.                       You supply as many coordinates as you need to
  2796.                       describe  the  line in an integer array. They
  2797.                       must be  in  (x,y)  order.  The  end  of  the
  2798.                       coordinate   list   is   indicated   by   the
  2799.                       coordinate pair (-1,-1).  The function starts
  2800.                       now  at the first coordinate and draws a line
  2801.                       from this point  to  the  second  coordinate.
  2802.                       From  there  it  draws  a  line  to the third
  2803.                       coordinate  and  so  on,  until  the  end  of
  2804.                       coordinate list is reached. If the coordinate
  2805.                       list is in- valid,  the  function  returns  a
  2806.                       true  (-1) result, otherwise it returns false
  2807.                       (0). In case of an error return the  graphics
  2808.                       error  variable may be examined.  The line is
  2809.                       drawn in color "color".
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.                                  Page 43
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.                        Compatible graphics library
  2843.  
  2844.  
  2845.  
  2846.        4.2.30  print_screen_function_-_hardcopy    This    function
  2847.        allows a program-controlled hardcopy of the current graphics
  2848.        page.
  2849.  
  2850.        Warning: currently only available for the hercules  graphics
  2851.        card!
  2852.  
  2853.        name           prtgraf
  2854.  
  2855.        class          medium-level
  2856.  
  2857.        synopsis       ret = prtgraf();
  2858.                       int ret;      0 if successful, -1 otherwise.
  2859.  
  2860.        description    This function  prints  the  entire  graphics-
  2861.                       screen  on a dot-matrix printer. The function
  2862.                       was developed using a  NEC  P6  printer,  but
  2863.                       should  run  with  little alteration on every
  2864.                       EPSON  compatible  printer.    The   function
  2865.                       return 0 if successful, -1 if not. In case of
  2866.                       an error return the  error  system  holds  an
  2867.                       extended or code.
  2868.  
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.                                  Page 44
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.                        Compatible graphics library
  2909.  
  2910.  
  2911.  
  2912.        4.2.31  putmsg_-_complex_text_output_function
  2913.  
  2914.        name           putmsg
  2915.  
  2916.        class          medium-level
  2917.  
  2918.        synopsis       putmsg(x,  y,  foreg,  backg,  string,  font,
  2919.                       mode);
  2920.                       int x, y;            starting coordinate (upper left corner)
  2921.                       int foreg;           foreground color
  2922.                       int backg;           background color
  2923.                       char *string;        string to draw
  2924.                       int font;            font-number to use
  2925.                       int mode;            output mode (font modifier)
  2926.  
  2927.        description    This function draws the string pointed to  by
  2928.                       "string"  on  the graphics screen. The string
  2929.                       must be  -terminated. Drawing begins at  x,y,
  2930.                       which  is  the upper left corner of the first
  2931.                       character in the string. The  characters  are
  2932.                       painted   in   color  foreg,  the  character-
  2933.                       background is painted in  color  backg.   The
  2934.                       font  to  use  must  be  specified  in  font.
  2935.                       Currently only STDFONT  is  supported.  Field
  2936.                       mode  contains  the string output mode, which
  2937.                       is a font modifier. This field may be used to
  2938.                       select   italics   or   other  output  modes.
  2939.                       Currently only OM_NORM, OM_ITAL and  OM_RITAL
  2940.                       are supported.
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.                                  Page 45
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.                        Compatible graphics library
  2975.  
  2976.  
  2977.  
  2978.        4.2.32  setgloco_function
  2979.  
  2980.        name           setgloco
  2981.  
  2982.        class          medium-level
  2983.  
  2984.        synopsis       setgloco(x_beg, y_beg, x_end, y_end)
  2985.                       float x_beg, y_beg    minimum coordinates values
  2986.                       float x_end, y_end    maximum coordinates values
  2987.  
  2988.        description    This function  initializes  the  global/local
  2989.                       coordinate  system. This system allows you to
  2990.                       address  your  pixels  based  on   a   global
  2991.                       coordinate system. This system is independent
  2992.                       from the hardware coordinate  system.  Global
  2993.                       coordinates   may   be   converted  to  local
  2994.                       coordinates, which are to be used to  address
  2995.                       the  hardware.  So your application hasn't to
  2996.                       look at the present video  hardware  but  use
  2997.                       always  a hardware independent own coordinate
  2998.                       system.  In addition you may use floats,  not
  2999.                       only integers as coordinates. This is a great
  3000.                       advantage in numerical applications.
  3001.  
  3002.        warning        This function initializes the system, so  any
  3003.                       call  to  the  convert  routines  will return
  3004.                       garbage, until this function is called!
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.                                  Page 46
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.                        Compatible graphics library
  3041.  
  3042.  
  3043.  
  3044.        4.2.33  setpixel_function
  3045.  
  3046.        name           setpixel
  3047.  
  3048.        class          low-level, old call, compatibility class
  3049.  
  3050.        synopsis       setpixel(x, y, color);
  3051.                       int x, y;       coordinate of the pixel
  3052.                       int color;      pixel-color
  3053.  
  3054.        description    This function sets a pixel of  color  "color"
  3055.                       at the specified coordinate.
  3056.  
  3057.        warning        This  function  is  superseded  by   function
  3058.                       wrtpixel.     It's    included   mainly   for
  3059.                       compatibility  reasons.   It  does  not   not
  3060.                       support  the graphics write mode.  Do not use
  3061.                       this function call, if you do not  absolutely
  3062.                       need backward compatibility to version 1.1 of
  3063.                       the library!
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.                                  Page 47
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.                        Compatible graphics library
  3107.  
  3108.  
  3109.  
  3110.        4.2.34  setwm_function
  3111.  
  3112.        name           setwm
  3113.  
  3114.        class          medium-level
  3115.  
  3116.        synopsis       setwm(mode);
  3117.                       WRITEMOD mode;                  new write mode
  3118.  
  3119.        description    This function sets the  library  write  mode.
  3120.                       All write operations are performed in respect
  3121.                       to the current write mode.   For  a  list  of
  3122.                       currently   supported  write  modes  see  the
  3123.                       definition of WRITEMOD in graphics.h!
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.                                  Page 48
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.                        Compatible graphics library
  3173.  
  3174.  
  3175.  
  3176.        4.2.35  wrtpixel_function
  3177.  
  3178.        name           wrtpixel
  3179.  
  3180.        class          medium-level
  3181.  
  3182.        synopsis       wrtpixel(x, y, color);
  3183.                       int x, y;              pixel coordinate
  3184.                       int color;             pixel color
  3185.  
  3186.        description    This function sets a pixel in the given color
  3187.                       at the specified coordinate. The pixel is set
  3188.                       in respect to the current write mode.
  3189.  
  3190.        4.3  Linking_using_object_files_or_librarys
  3191.  
  3192.        There are two ways to link the graphics routines  into  your
  3193.        program.   The  first  were described above: You may use the
  3194.        librarys build during the installation  process.   Then  you
  3195.        have  only  to  alter  your  link-batchfiles,  the  rest  is
  3196.        automatic.  This is normally  the  best  method.   But  this
  3197.        method  has  the  disadvantage  of including the librarys in
  3198.        every of your link-sessions. This needs time (especially  on
  3199.        floppy-based  systems).   So, if you only need the libraries
  3200.        in a few programs, you may think that  this  way  isn't  the
  3201.        right.
  3202.  
  3203.        Then you may use the second method: You may not only specify
  3204.        the  libraries,  you also may specify the routines as stand-
  3205.        alone objects.  So  link  only  the  object  files  in  your
  3206.        program.   You  have to name the files each link-session (or
  3207.        construct a short batch-file).  Please remember, that  there
  3208.        are  low,  medium  and  high  level  routines.   You have to
  3209.        include all of them in the link-process.
  3210.        Here is a sample link-call using the std. Lattice link-files
  3211.        and the hercules low-level driver:
  3212.        LINKMS your-program +graf+herc+herca
  3213.        Note that you do not always have  to  include  three  object
  3214.        files.  The  standard BIOS driver, for example, has only one
  3215.        low-level  object  file,  because  the  complete   low-level
  3216.        handling  can  be done in C.  However, I think there will be
  3217.        mostly two low-level drivers.
  3218.        You may specify the object-file names at any  position,  the
  3219.        above  given  is  only one possible specification.  You must
  3220.        only link your main program first, because this is the  name
  3221.        Lattice uses for the .EXE file.
  3222.  
  3223.        Caution: The general medium-level driver  must  be  compiled
  3224.        separately  for each low-level device (as stated above).  So
  3225.        you have to use different medium-level object  files.  Using
  3226.        wrong  medium-level  drivers  may  cause  link errors and/or
  3227.  
  3228.  
  3229.  
  3230.                                  Page 49
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.                        Compatible graphics library
  3239.  
  3240.  
  3241.  
  3242.        program crashes!
  3243.  
  3244.  
  3245.        5.  Customization_of_the_library
  3246.  
  3247.        This section contains information about how to customize the
  3248.        library to your specific needs.
  3249.  
  3250.        In general the library is unmodified usable, though the this
  3251.        version  may  not the best for your needs.  In order to make
  3252.        the library more useful, there is a facility to  change  the
  3253.        behaviour  of  the  library  with  only  a few configuration
  3254.        parameters.   This  parameters   are   contained   in   file
  3255.        "graphics.h".  By setting this parameters to new values, you
  3256.        can create a version that's  more  special  to  your  needs,
  3257.        without completely modifying the library.
  3258.  
  3259.        This facility should allow you  to  configure  many  library
  3260.        features  to  your  needs, although it is not as powerful as
  3261.        really modifying library source code.  But I think  it  will
  3262.        be powerful enough for most purposes.
  3263.  
  3264.        The configuration parameters are explained in the  top  part
  3265.        of    "graphics.h".    For   a   detailed   description   of
  3266.        configuration changes see this file.
  3267.  
  3268.        Note: after changing  configuration  parameters,  the  whole
  3269.        library must be recompiled!
  3270.  
  3271.  
  3272.        6.  Modifying_the_library
  3273.  
  3274.        If the above described way of customizing the library is not
  3275.        powerful  enough  for your needs, or if you plan to port the
  3276.        library  to  a  new  environment,  the  information   needed
  3277.        therefore is contained in this chapter.
  3278.  
  3279.        But be  aware  of  the  fact,  that  modifying  the  library
  3280.        requires working knowledge of the C programming language and
  3281.        porting the library requires good knowledge  of  the  target
  3282.        machine.   If you do not fulfill the above requirements, ask
  3283.        someone else for help or you can become frustrated!
  3284.  
  3285.        The  following  sections  contain  information   about   the
  3286.        internal  implementation  and  general  philosophy  of  this
  3287.        library.  If you modify the library,  please  don't  violate
  3288.        the basic  concepts,  because  such  violations  will  cause
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.                                  Page 50
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.                        Compatible graphics library
  3305.  
  3306.  
  3307.  
  3308.        problems with newer releases.  It also would be fine, if you
  3309.        not  only  extend  or port the library, but also update this
  3310.        manual.  If you use new or  significant  faster  algorithms,
  3311.        please  notify  the  author,  so  he  can make these changes
  3312.        common to all users and include them in further developments
  3313.        and  enhancements.  In either case, please inform the author
  3314.        of bugs.  The will be fixed as  fast  as  possible  (if  you
  3315.        developed a fix, please send it too!).
  3316.        For a general overview see sections "Library  design".   You
  3317.        should read this section before continuing here.
  3318.  
  3319.        6.1  Basic_rules
  3320.  
  3321.        This section points out the basic rules  for  modifying  the
  3322.        library.   NEVER  violate these rules, otherwise you can not
  3323.        be sure to  move  to  new  levels  of  the  library  without
  3324.        problems.    Coding,   which  violates  these  rules,  isn't
  3325.        accepted nor enhanced by the author.
  3326.        I think these rules are so basic software-engeneering  rules
  3327.        that I can point out them for short.
  3328.  
  3329.          1.  Never use compiler-specific features. This is the dead
  3330.              for portability!
  3331.  
  3332.          2.  Never use undocumented routines.  They may be  removed
  3333.              or modifyed without notice.
  3334.  
  3335.          3.  Use only the documented interfaces.  Static  variables
  3336.              only   contain   useful   information,   if   such  is
  3337.              guaranteed!
  3338.  
  3339.          4.  Never change the documented interface of a function.
  3340.              You  would  destroy  portability.   If  you  add   new
  3341.              functionality  to  a  procedure,  which requires a new
  3342.              parameter, use a different function  call  name.   You
  3343.              may   internally   call  the  old  function  to  avoid
  3344.              duplicate coding.
  3345.  
  3346.          5.  Never introduce a routine which is  hardware-specific.
  3347.              Use  at  least a pseudo-hardware-independent function,
  3348.              as stated above.  But do use such  functions  only  if
  3349.              absolutely  necessary  and  it  is  supported  by most
  3350.              video-devices (I think at least 75%).  Remember,  that
  3351.  
  3352.  
  3353.        __________
  3354.  
  3355.         7. like the high-, medium and low-level driver concept
  3356.  
  3357.         7. or use sub-subroutines
  3358.  
  3359.  
  3360.  
  3361.  
  3362.                                  Page 51
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.                        Compatible graphics library
  3371.  
  3372.  
  3373.  
  3374.              one goal of the library was the portability on a  wide
  3375.              range  of  machines.   So  there have to be as less as
  3376.              possible hardware-dependent functions.
  3377.              You may use hardware-dependent functions internal, but
  3378.              they should not be documented as legal functions.
  3379.  
  3380.          6.  You should  try  to  implement  new  features  in  the
  3381.              hardware-independent,  high-  or  medium-level part of
  3382.              the library.   So  porting  this  function  to  a  new
  3383.              environment isn't painful.
  3384.  
  3385.          7.  Never implement hardware-dependent  functions  in  the
  3386.              high- or medium-level part.
  3387.              If you introduce a hardware-dependent function,  which
  3388.              is  common  to many video devices (and may be emulated
  3389.              by the others), put this in the low-level parts.  This
  3390.              makes  implementation of the library more visible.  In
  3391.              addition, ones who want to port  the  library  to  new
  3392.              devices  can  be  sure,  that they must not modify the
  3393.              high- and medium-level part.
  3394.  
  3395.          8.  You may modify parts of the medium-level  routines  to
  3396.              call some hardware-specific routines if, and only  if,
  3397.              there is also a implementation of the same thing using
  3398.              the standard read/write pixel interface.  You have  to
  3399.              use  conditional  compilation  to activate your coding
  3400.              for a special video-device.
  3401.              Such an implementation makes sense, if you can  reduce
  3402.              the runtime significantly.  An example for this is the
  3403.              EGA device.
  3404.  
  3405.          9.  Always   document   a   new   function   or   function
  3406.              enhancement.  Use the standard function header in your
  3407.              source  to  document  a new function.  If you port the
  3408.              library to a new operating system, compiler  or  video
  3409.              device,  please complete the information in the header
  3410.              page of this document.
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.        __________
  3420.  
  3421.         7. which are then implemented in the low-level part
  3422.  
  3423.         7. See the library sources for an example.
  3424.  
  3425.  
  3426.  
  3427.  
  3428.                                  Page 52
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.                        Compatible graphics library
  3437.  
  3438.  
  3439.  
  3440.        6.2  Library_Modes
  3441.  
  3442.        The graphics header-files are  included  in  both  user  and
  3443.        library programs.  However, these files have to do different
  3444.        jobs in each case.  In order to  simplify  maintenance,  the
  3445.        header  files  contain information to do all jobs correctly.
  3446.        The  current  job  is  selected   via   the   library   mode
  3447.        preprocessor  variable  LIB_MODE.   This  variable has to be
  3448.        defined before #including the graphics header files.
  3449.  
  3450.        This variable may  hold  different  values,  thus  selecting
  3451.        different  coding in the header-files.  Currently modes 0, 1
  3452.        and 2 are defined, but new can be added on demand.
  3453.  
  3454.        mode 0  is the user mode.  It is also set if LIB_MODE  isn't
  3455.                defined.   In  mode  0 all library internal features
  3456.                are disabled.
  3457.  
  3458.        mode 1  is the primary library mode.  All internal  features
  3459.                are  enabled,  but library variables are declared to
  3460.                be external.
  3461.  
  3462.        mode 2  is  much  like  mode  1,  except  that  the  library
  3463.                variables  will be allocated.  So this mode can only
  3464.                be set in one module.  This  module  is  called  the
  3465.                master   module,  because  it  allocates  the  whole
  3466.                library external data space.
  3467.  
  3468.        6.3  Function_sets
  3469.  
  3470.        The medium-level library part contains  two  function  sets.
  3471.        The  function  set  are  almost  identical  in  the  calling
  3472.        sequence.  This two sets are introduced by  the  write  mode
  3473.        system.   Generally  drawing  is  done in normal write mode,
  3474.        what means directly with the user-specified color.   But  if
  3475.        it's  done  in  one of the other modes, the color must first
  3476.        selected according  to  the  user-specified  color  and  the
  3477.        previous  contents  of  the display buffer.  Thus the second
  3478.        approach is much more  time  consuming,  even  because  some
  3479.        optimizations  can't  be  applied  to write modes other than
  3480.        normal.
  3481.  
  3482.        So most functions have two forms: one  very  fast,  strictly
  3483.        optimized  normal  write  mode version, and one more general
  3484.        but also slower all write modes function.   This  design  is
  3485.        completely  invisible  to the user program, because the user
  3486.        program always calls the fast alternative and this  function
  3487.        switches to its slower pendant if needed.
  3488.  
  3489.        Note that  this  approach  is  unique  to  the  medium-level
  3490.        library  part.   If you plan to extend this part you have to
  3491.  
  3492.  
  3493.  
  3494.                                  Page 53
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.                        Compatible graphics library
  3503.  
  3504.  
  3505.  
  3506.        know, that there is a  function  which  supports  write-mode
  3507.        applications.      It's    function    sel_color(),    which
  3508.        automatically selects the drawing color for the pixel it  is
  3509.        called for.  Note that this function will be included in all
  3510.        further releases and so it's  save  to  use  it.   It's  not
  3511.        documented because it's invisible to user programs.  For the
  3512.        calling sequence look at the source code function header  in
  3513.        file graf.c.
  3514.  
  3515.        6.4  Modifying_High-Level_Parts
  3516.  
  3517.        The high-level library part has to  be  completely  hardware
  3518.        independent.   So  no calls to hardware specific routines or
  3519.        other hardware specific features can be included.   Do  only
  3520.        use  the  documented interfaces of the medium- and low-level
  3521.        library parts.  Always remember, that the lower level  parts
  3522.        will be dynamically loadable in the future.
  3523.  
  3524.        I think that the high-level library part will be  the  least
  3525.        part  modified.   I  also think such modifications make only
  3526.        sense in case of bug fixes and functionality enhancements.
  3527.  
  3528.        6.5  Modifying_medium-level_parts
  3529.  
  3530.        The  medium-level  library   parts   should   be   hardware-
  3531.        INdependent.    Though,   you   may   include  some  special
  3532.        hardware-calls if you use conditional compilation.  This way
  3533.        may   be  chosen,  if  the  performance  may  grew  rapidly.
  3534.        However, if  you  use  this  way,  implement  the  hardware-
  3535.        dependent  parts  as  calls to low-level routines performing
  3536.        the job.  Also there must be always a  routine  implemented,
  3537.        which only uses the basic low-level routines for reading and
  3538.        writing a pixel.  This guarantees portability.
  3539.        All #define's, which are common to almost every video-device
  3540.        should  be done in the medium-level header file (same as the
  3541.        high-level header file).  There should also  all  documented
  3542.        functions    be    prototyped.    Please   use   conditional
  3543.        compilation, if you use newer language features like void or
  3544.        enum,  so these constructs can be easily commented out.  Use
  3545.        different names for each new feature, because some  compiler
  3546.        implement part of this new features.  They should be used if
  3547.        possible.  Note that the word USE_VOID e. g. is currently in
  3548.        use by the library to implement the void keyword.
  3549.        Whatever you do, keep in mind  that  the  medium-level  part
  3550.        should  be as portable and hardware-independent as possible.
  3551.  
  3552.  
  3553.        __________
  3554.  
  3555.         7. #if(?) ... #else ... #endif
  3556.  
  3557.  
  3558.  
  3559.  
  3560.                                  Page 54
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.                        Compatible graphics library
  3569.  
  3570.  
  3571.  
  3572.        But you should also remember,  that  the  medium-level  part
  3573.        must be recompiled for each low-level driver...
  3574.  
  3575.        6.6  Modifying_low-level_parts
  3576.  
  3577.        You may modify everything  except  the  few  documented  and
  3578.        guaranteed  function-interfaces.   But  you  should  try  to
  3579.        implement as much coding as possible in C, because  you  may
  3580.        use  parts  of  existing low-level drivers or others may use
  3581.        your drivers to implement another video-device.  Also a port
  3582.        of  existing  drivers  to  another  operating  system may be
  3583.        simpler, if the driver is written nearly complete in C.
  3584.        You should use low-level routines only if it's impossible to
  3585.        do  the  same  with  medium-level routines (or to get a much
  3586.        better performance).   Please  let  your  low  level-routine
  3587.        communicate  with  the  medium-level  routine  only by using
  3588.        strictly defined interfaces.
  3589.        Do not introduce a low-level routine for common usage, if it
  3590.        can't be implemented on almost every video-device!
  3591.  
  3592.        6.7  Modifying_header_files
  3593.  
  3594.        Header files play a  very  important  part  in  the  library
  3595.        design  - so do not forget them.  Every new high- or medium-
  3596.        level routine or definition should be added to the  ONE  AND
  3597.        ONLY  medium-level  header  file "graphics.h".  Do not add a
  3598.        second  or  third  high/medium-level  Header  file!   Put  a
  3599.        device-id  in  every  low-level  header file (HERCGRAF is an
  3600.        example).  So the medium-level routine knows  which  is  the
  3601.        current  low-level driver and may activate different coding.
  3602.        It may also be of interest  for  the  user-program  to  know
  3603.        which video-device is active.
  3604.  
  3605.  
  3606.        7.  Development_environment
  3607.  
  3608.        It may be interested for you  to  here  something  about  my
  3609.        development  environment.  The library were implemented on 2
  3610.        IBM-AT's.   One  is  equipped  with  a   hercules-compatible
  3611.        monochrome  graphics  card,  one  with  the  Quad-EGA  and a
  3612.        monochrome display.  So there could be no  development  done
  3613.        for  color-graphics,  but  I think the EGA-routines will run
  3614.        using color-graphics, too.  One AT is equipped  with  2.5Mb,
  3615.        one with 512Kb memory, both without 80287.  Both are running
  3616.        under PC_DOS 3.1 (German version), one under XENIX, and  one
  3617.        under  Mikroport's  Unix System V.  There were some resident
  3618.        programs loaded.
  3619.        The software environment  consist  of  the  sh  and  related
  3620.        utilities by Allen Holub, the Lattice, Datalight,  Datalight
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.                                  Page 55
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.                        Compatible graphics library
  3635.  
  3636.  
  3637.  
  3638.        optimizing and Borland's Turbo C compiler and Microsoft MASM
  3639.        4.0  and  related products.  The files were edited using the
  3640.        Turbo Pascal editor.  This document was edited  under  UNIX,
  3641.        using  vi,  nroff and the mm macro package.  My (new) own AT
  3642.        is the one equipped with 2.5Mb, no 80287 and  the  Quad-EGA.
  3643.        I  currently  own  the  sh  and  utilities,  the  Datalight,
  3644.        Datalight optimizing and  Borland's  Turbo C  compiler,  the
  3645.        Blaise  runoff  formatter and the standard IBM PC linker.  I
  3646.        also own the PC/vi editor, which is really  great,  and  Mr.
  3647.        Holub's  nr  text  formatter,  which is much better than the
  3648.        Runoff formatter (and much less expensive!).  The system  is
  3649.        also  equipped  with Hersey Mikro Consultings Fansi-Console,
  3650.        which greatly speeds up consol  writing,  but  unfortunately
  3651.        needs  a lot of memory (50 Kb from small 640 Kb DOS memory).
  3652.        And I'm running  Microport's  UNIX  System  V-AT  since  one
  3653.        month.
  3654.        Now think about new features, which can  be  developed  with
  3655.        this environment...
  3656.  
  3657.  
  3658.        8.  Future_enhancements
  3659.  
  3660.        This chapter list the current and planed developments, which
  3661.        will  be made available in the future.  In addition to these
  3662.        points I want to get some feedback from you, resulting in  a
  3663.        better  and better library.  This feedback may be in form of
  3664.        new ideas, algorithms and, of course, critic.  I really love
  3665.        to  hear your comments, because I myself cover only a little
  3666.        span of potential applications, so my library will always be
  3667.        restricted, until you send my new ideas.
  3668.  
  3669.        But enough of the feedback, here are the facts about  future
  3670.        enhancements:
  3671.  
  3672.           - First of all,  the  high-level  library  part  will  be
  3673.             greatly  enhanced.   I hope I can implement many useful
  3674.             high-level functions in the  near  future.   This  will
  3675.             include  a  metafile system and related plotter drivers
  3676.             (have you seen the new plotter  entry  in  the  heading
  3677.             page?).
  3678.  
  3679.           - text output
  3680.             will be advanced.
  3681.             The  current  text-output  function  only  supports   a
  3682.             limited  functionality.   This  functionality  will  be
  3683.  
  3684.  
  3685.        __________
  3686.  
  3687.         7. , which are really great!!!!
  3688.  
  3689.  
  3690.  
  3691.  
  3692.                                  Page 56
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.                        Compatible graphics library
  3701.  
  3702.  
  3703.  
  3704.             greatly enhanced.  More  style-modifiers  and  loadable
  3705.             character sets will be implemented.  Also a font-editor
  3706.             may come with the next release.
  3707.  
  3708.           - virtual graphics pages will be implemented
  3709.             These implementation of virtual pages will  base  on  a
  3710.             hardware-independent   algorithm,   so   that  multiple
  3711.             display pages will also be available on  devices  which
  3712.             not   directly  support  them.   In  addition,  because
  3713.             graphics need a lot of memory, which is  not  available
  3714.             at   some   systems,  the  library  will  implement  an
  3715.             algorithm,  which  is  able  to  use  mass-storage  for
  3716.             inactive pages (virtual memory management).
  3717.  
  3718.           - I try to port the library to the UNIX operating system
  3719.             I'm not sure, that these port will be successful in the
  3720.             end.   I'm  not  very  similar  with the UNIX operating
  3721.             system, nor with graphics programming using  UNIX  and,
  3722.             of  course,  graphics  terminals.   My first attempt to
  3723.             implement the library was not successful, but I learned
  3724.             that an operating system like UNIX is very, very secure
  3725.             (so secure that my I/O-instructions don't work).
  3726.             Don't misunderstand my: I  really  love  the  way  UNIX
  3727.             goes,  but  I don't know currently how to implement the
  3728.             library.
  3729.             But I also think that the port will  be  possible  now,
  3730.             where I can use my own Unix.
  3731.  
  3732.                       Help!
  3733.                       If  someone  has  some  information
  3734.                       about this job, please write me.  I
  3735.                       would happily receive each piece of
  3736.                       information.
  3737.  
  3738.  
  3739.        9.  Final_observations
  3740.  
  3741.        At this point, thanks to all "heros", which read this  whole
  3742.        document.   I  know,  my  English is very bad, so I hope you
  3743.        excuse all the little (or should I better say big!?)  errors
  3744.        in spelling and grammar.
  3745.        I hope my English will grew better in  the  future,  so  the
  3746.        documents will grew better, too.
  3747.  
  3748.        In addition, I want to thank all people which  will  contact
  3749.        my  (I  hope there will be some). I also want to thank the C
  3750.        User's Group for distributing the library and this document.
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.                                  Page 57
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.                                  CONTENTS
  3771.  
  3772.  
  3773.        1.  Introduction........................................   3
  3774.            1.1  Design history and background..................   3
  3775.            1.2  Current features...............................   3
  3776.            1.3  new features and enhancements of version
  3777.                 2.1............................................   4
  3778.            1.4  Release compatibility..........................   7
  3779.  
  3780.        2.  Library design......................................   7
  3781.            2.1  High-level library part........................   7
  3782.            2.2  medium-level library part......................   8
  3783.            2.3  Low-level library part.........................   8
  3784.            2.4  Stages of compatibility........................   9
  3785.  
  3786.        3.  Installation of the library.........................  10
  3787.            3.1  Bringing up the library........................  10
  3788.            3.2  Configuring dos.mac............................  13
  3789.  
  3790.        4.  User program interface..............................  14
  3791.            4.1  Header files...................................  14
  3792.            4.2  Available function calls.......................  15
  3793.            4.3  Linking using object files or librarys.........  49
  3794.  
  3795.        5.  Customization of the library........................  50
  3796.  
  3797.        6.  Modifying the library...............................  50
  3798.            6.1  Basic rules....................................  51
  3799.            6.2  Library Modes..................................  53
  3800.            6.3  Function sets..................................  53
  3801.            6.4  Modifying High-Level Parts.....................  54
  3802.            6.5  Modifying medium-level parts...................  54
  3803.            6.6  Modifying low-level parts......................  55
  3804.            6.7  Modifying header files.........................  55
  3805.  
  3806.        7.  Development environment.............................  55
  3807.  
  3808.        8.  Future enhancements.................................  56
  3809.  
  3810.        9.  Final observations..................................  57
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.                                   - i -
  3825.  
  3826.  
  3827.  
  3828.  
  3829.